DESY Hbb Analysis Framework
TreeBase.cc
Go to the documentation of this file.
1 // system include files
2 #include <iostream>
3 #include <string>
4 #include <algorithm>
5 //
6 // user include files
8 
9 
10 //
11 // class declaration
12 //
13 
14 using namespace analysis;
15 using namespace analysis::tools;
16 
17 //
18 // constructors and destructor
19 //
20 // template <typename Object>
21 TreeBase::TreeBase() : TChain()
22 {
23 }
24 //template <typename Object>
25 TreeBase::TreeBase(TChain * tree, const std::string & name) : TChain()
26 {
27  tree_ = tree;
28  name_ = name;
29 
30  std::string treeTitle = std::string(tree_->GetTitle());
31  treeTitle.erase(std::remove(treeTitle.begin(),treeTitle.end(),' '),treeTitle.end());
32  className_ = treeTitle.substr(0,treeTitle.find_first_of("|"));
33  inputTag_ = treeTitle.substr(treeTitle.find_first_of("|")+1);
34 
35  TObjArray * treeBranches = tree_->GetListOfBranches();
36  for ( int i = 0 ; i < treeBranches->GetEntries() ; ++i )
37  branches_.push_back(treeBranches->At(i)->GetName());
38 
39 }
40 
41 
43 {
44 }
45 
46 
47 //
48 // member functions
49 //
50 
51 void TreeBase::event(const int & event) { tree_ -> GetEntry(event); }
52 TChain * TreeBase::tree() { return tree_; }
53 
std::string className_
Definition: TreeBase.h:55
std::vector< std::string > branches_
Definition: TreeBase.h:58
std::string inputTag_
Definition: TreeBase.h:56
void event(const int &event)
Definition: TreeBase.cc:51