30 configuration_(config),
31 data_header_(data_header) {
32 this->AddFriend(tree);
35 Chain(
const std::string& filename,
const std::string& treename) : TChain(treename.c_str()) {
36 TFile* file = TFile::Open(filename.c_str(),
"read");
38 data_header_ = (
DataHeader*) file->Get(
"DataHeader");
39 this->Add(filename.c_str());
42 Chain(std::vector<std::string> filelists, std::vector<std::string> treenames) : TChain(treenames.at(0).c_str()),
43 filelists_(std::move(filelists)),
44 treenames_(std::move(treenames)) {
50 ANALYSISTREE_ATTR_NODISCARD
Configuration* GetConfiguration()
const {
return configuration_; }
51 ANALYSISTREE_ATTR_NODISCARD
DataHeader* GetDataHeader()
const {
return data_header_; }
52 ANALYSISTREE_ATTR_NODISCARD
const std::map<std::string, BranchPointer>& GetBranchPointers()
const {
return branches_; }
53 ANALYSISTREE_ATTR_NODISCARD
const std::map<std::string, Matching*>& GetMatchPointers()
const {
return matches_; }
55 void SetDataHeader(
DataHeader* dh) { data_header_ = dh; }
57 int CheckBranchExistence(
const std::string& branchname);
59 BranchPointer GetPointerToBranch(
const std::string& name)
const {
60 auto br = branches_.find(name);
61 if (br != branches_.end()) {
64 throw std::runtime_error(
"Branch " + name +
" is not found!");
76 Long64_t Draw(
const char* varexp,
const char* selection =
nullptr, Option_t* option =
"", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0)
override;
77 Long64_t Scan(
const char* varexp,
const char* selection =
nullptr, Option_t* option =
"", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0)
override;
79 void Print(Option_t*)
const override {
80 this->data_header_->Print();
81 this->configuration_->Print();
84 [[deprecated(
"Will be removed soon to avoid confusion with TChain::GetBranch. Use GetBranchObject")]]
class Branch GetBranch(const std::string& name) const;
86 class
Branch GetBranchObject(const std::string& name) const;
88 Matching* GetMatching(const std::string& br1, const std::string& br2) const {
89 auto match = matches_.find(configuration_->GetMatchName(br1, br2));
90 if (match == matches_.end()) {
91 throw std::runtime_error(
"No matching found");
108 void InitConfiguration();
109 void InitDataHeader();
111 static TChain* MakeChain(
const std::string& filelist,
const std::string& treename);
129 std::string LookupAlias(
const std::vector<std::string>& names,
const std::string& name,
size_t copy = 0);
131 std::vector<std::string> filelists_{};
132 std::vector<std::string> treenames_{};
137 std::map<std::string, BranchPointer> branches_{};
138 std::map<std::string, Matching*> matches_{};