Public Member Functions | Private Member Functions | Private Attributes | List of all members
garana::HeaderTree Class Reference

#include <HeaderTree.h>

Inheritance diagram for garana::HeaderTree:
garana::TreeReader

Public Member Functions

 HeaderTree ()
 
 HeaderTree (TTree *tree)
 
 HeaderTree (TTree *tree, char opt)
 
Int_t const & Run () const
 
Int_t const & SubRun () const
 
Int_t const & POT () const
 
Int_t const & NSpills () const
 
const std::string *const TreeType () const
 
TLorentzVector *const & TpcCenter () const
 
std::string const & Geometry () const
 
void SetRun (const Int_t run)
 
void SetSubRun (const Int_t subrun)
 
void SetTreeType (std::string type)
 
- Public Member Functions inherited from garana::TreeReader
virtual ~TreeReader ()
 
void SetupRead (TTree *tree)
 
TTree * GetInputTree ()
 
size_t NEntries () const
 
virtual void GetEntry (const UInt_t &ientry)
 
Int_t Event () const
 
const TObjArray * GetBranchList () const
 
void Fill ()
 
void Write ()
 
void CheckOpt (char opt)
 
bool BlockWrite () const
 

Private Member Functions

bool SetBranchAddresses () override
 

Private Attributes

Int_t fRun = -1
 
Int_t fSubRun = -1
 
Int_t fPOT = -1
 
Int_t fNSpills = -1
 
TLorentzVector * fTpcCenter = nullptr
 
std::string fGeometry
 
std::string fTreeType
 
std::stringfTreeTypePtr = &fTreeType
 
std::stringfGeometryPtr = &fGeometry
 
TBranch * b_Run = nullptr
 
TBranch * b_SubRun = nullptr
 
TBranch * b_TreeType = nullptr
 
TBranch * b_TpcCenter = nullptr
 
TBranch * b_POT = nullptr
 
TBranch * b_NSpills = nullptr
 
TBranch * b_Geometry = nullptr
 

Additional Inherited Members

- Protected Attributes inherited from garana::TreeReader
const std::string treename
 
char fOpt = 'r'
 
TTree * fTreeIn = nullptr
 pointer to the analyzed TTree or TChain More...
 
UInt_t fCurrentEntry = UINT_MAX
 
TBranch * b_Event = nullptr
 
Int_t fEvent = -1
 event number for tree entry More...
 

Detailed Description

Definition at line 16 of file HeaderTree.h.

Constructor & Destructor Documentation

HeaderTree::HeaderTree ( )

Definition at line 12 of file HeaderTree.cxx.

12 {}
HeaderTree::HeaderTree ( TTree *  tree)

Definition at line 13 of file HeaderTree.cxx.

14 {
15  SetupRead(tree);
16 }
void SetupRead(TTree *tree)
Definition: TreeReader.cxx:6
HeaderTree::HeaderTree ( TTree *  tree,
char  opt 
)

Definition at line 18 of file HeaderTree.cxx.

19 {
20  CheckOpt(opt);//sets TreeReader::fOpt
21 
22  if(fOpt=='r'){
23  SetupRead(tree);
24  }
25  else {
26  fTreeIn = tree;
28  }
29 }//
opt
Definition: train.py:196
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
bool SetBranchAddresses() override
Definition: HeaderTree.cxx:80
void CheckOpt(char opt)
Definition: TreeReader.cxx:67
void SetupRead(TTree *tree)
Definition: TreeReader.cxx:6

Member Function Documentation

std::string const & HeaderTree::Geometry ( ) const

Definition at line 70 of file HeaderTree.cxx.

70  {
71  fTreeIn->GetEntry(0);
72  return fGeometry;
73 }
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
std::string fGeometry
Definition: HeaderTree.h:45
Int_t const & HeaderTree::NSpills ( ) const

Definition at line 65 of file HeaderTree.cxx.

65  {
66  fTreeIn->GetEntry(0);
67  return fNSpills;
68 }
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
Int_t const & HeaderTree::POT ( ) const

Definition at line 60 of file HeaderTree.cxx.

60  {
61  fTreeIn->GetEntry(0);
62  return fPOT;
63 }
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
Int_t const & HeaderTree::Run ( ) const

Definition at line 50 of file HeaderTree.cxx.

50  {
51  fTreeIn->GetEntry(0);
52  return fRun;
53 }
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
bool HeaderTree::SetBranchAddresses ( )
overrideprivatevirtual

Implements garana::TreeReader.

Definition at line 80 of file HeaderTree.cxx.

80  {
81 
82  if(fOpt=='r'){
83  fTreeIn->SetBranchAddress("Run", &fRun, &b_Run );
84  fTreeIn->SetBranchAddress("SubRun", &fSubRun, &b_SubRun );
85  fTreeIn->SetBranchAddress("TreeType", &fTreeTypePtr, &b_TreeType );
86  fTreeIn->SetBranchAddress("POT", &fPOT, &b_POT );
87  fTreeIn->SetBranchAddress("NSpills", &fNSpills, &b_NSpills );
88  fTreeIn->SetBranchAddress("Geometry", &fGeometryPtr, &b_Geometry );
89  fTreeIn->SetBranchAddress("TpcCenter", &fTpcCenter, &b_TpcCenter);
90  }
91 
92  if(fOpt=='w'){
93  fTreeIn->Branch("Run", &fRun, "Run/I" );
94  fTreeIn->Branch("SubRun", &fSubRun, "SubRun/I" );
95  fTreeIn->Branch("TreeType", &fTreeType );
96  fTreeIn->Branch("POT", &fPOT, "POT/I" );
97  fTreeIn->Branch("NSpills", &fNSpills, "NSpills/I" );
98  fTreeIn->Branch("Geometry", &fGeometry );
99  fTreeIn->Branch("TpcCenter", &fTpcCenter );
100  }
101 
102  return true;
103 }
TBranch * b_TreeType
Definition: HeaderTree.h:53
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
TBranch * b_Run
Definition: HeaderTree.h:51
std::string fGeometry
Definition: HeaderTree.h:45
TLorentzVector * fTpcCenter
Definition: HeaderTree.h:44
TBranch * b_NSpills
Definition: HeaderTree.h:56
TBranch * b_Geometry
Definition: HeaderTree.h:57
std::string * fGeometryPtr
Definition: HeaderTree.h:48
TBranch * b_POT
Definition: HeaderTree.h:55
std::string * fTreeTypePtr
Definition: HeaderTree.h:47
std::string fTreeType
Definition: HeaderTree.h:46
TBranch * b_SubRun
Definition: HeaderTree.h:52
TBranch * b_TpcCenter
Definition: HeaderTree.h:54
void HeaderTree::SetRun ( const Int_t  run)

Definition at line 105 of file HeaderTree.cxx.

105  {
106  std::cout << "SetRun called" << std::endl;
107  if(BlockWrite())
108  return;
109 
110  fRun = run;
111  std::cout << "set run = " << fRun << std::endl;
112 }
bool BlockWrite() const
Definition: TreeReader.cxx:93
QTextStream & endl(QTextStream &s)
void HeaderTree::SetSubRun ( const Int_t  subrun)

Definition at line 114 of file HeaderTree.cxx.

114  {
115  if(BlockWrite())
116  return;
117  fSubRun = subrun;
118 }
bool BlockWrite() const
Definition: TreeReader.cxx:93
void HeaderTree::SetTreeType ( std::string  type)

Definition at line 120 of file HeaderTree.cxx.

120  {
121  if(BlockWrite())
122  return;
123  fTreeType = type;
125 }
std::string * fTreeTypePtr
Definition: HeaderTree.h:47
bool BlockWrite() const
Definition: TreeReader.cxx:93
std::string fTreeType
Definition: HeaderTree.h:46
static QCString type
Definition: declinfo.cpp:672
Int_t const & HeaderTree::SubRun ( ) const

Definition at line 55 of file HeaderTree.cxx.

55  {
56  fTreeIn->GetEntry(0);
57  return fSubRun;
58 }
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
TLorentzVector *const & HeaderTree::TpcCenter ( ) const

Definition at line 75 of file HeaderTree.cxx.

75  {
76  fTreeIn->GetEntry(0);
77  return fTpcCenter;
78 }
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
TLorentzVector * fTpcCenter
Definition: HeaderTree.h:44
const std::string *const HeaderTree::TreeType ( ) const

Definition at line 32 of file HeaderTree.cxx.

32  {
33 
34  fTreeIn->GetEntry(0);
35  //std::cout << "trying tree type, " << fTreeType << std::endl;
36  try{
37 
38  if(fTreeTypePtr->compare("structured")!=0 && fTreeTypePtr->compare("flat")!=0)
39  throw fTreeTypePtr;
40 
41  }
42  catch(std::string* type){
43  std::cerr << "HeaderTree::TreeType: tree type is not set." << '\n';
44  }
45 
46  return fTreeTypePtr;
47 }
std::string string
Definition: nybbler.cc:12
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
std::string * fTreeTypePtr
Definition: HeaderTree.h:47

Member Data Documentation

TBranch* garana::HeaderTree::b_Geometry = nullptr
private

Definition at line 57 of file HeaderTree.h.

TBranch* garana::HeaderTree::b_NSpills = nullptr
private

Definition at line 56 of file HeaderTree.h.

TBranch* garana::HeaderTree::b_POT = nullptr
private

Definition at line 55 of file HeaderTree.h.

TBranch* garana::HeaderTree::b_Run = nullptr
private

Definition at line 51 of file HeaderTree.h.

TBranch* garana::HeaderTree::b_SubRun = nullptr
private

Definition at line 52 of file HeaderTree.h.

TBranch* garana::HeaderTree::b_TpcCenter = nullptr
private

Definition at line 54 of file HeaderTree.h.

TBranch* garana::HeaderTree::b_TreeType = nullptr
private

Definition at line 53 of file HeaderTree.h.

std::string garana::HeaderTree::fGeometry
private

Definition at line 45 of file HeaderTree.h.

std::string* garana::HeaderTree::fGeometryPtr = &fGeometry
private

Definition at line 48 of file HeaderTree.h.

Int_t garana::HeaderTree::fNSpills = -1
private

Definition at line 43 of file HeaderTree.h.

Int_t garana::HeaderTree::fPOT = -1
private

Definition at line 42 of file HeaderTree.h.

Int_t garana::HeaderTree::fRun = -1
private

Definition at line 40 of file HeaderTree.h.

Int_t garana::HeaderTree::fSubRun = -1
private

Definition at line 41 of file HeaderTree.h.

TLorentzVector* garana::HeaderTree::fTpcCenter = nullptr
private

Definition at line 44 of file HeaderTree.h.

std::string garana::HeaderTree::fTreeType
private

Definition at line 46 of file HeaderTree.h.

std::string* garana::HeaderTree::fTreeTypePtr = &fTreeType
private

Definition at line 47 of file HeaderTree.h.


The documentation for this class was generated from the following files: