StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSpinTreeReader.h
1 /*
2  * StSpinTreeReader.h
3  * StarSpinLibraries
4  *
5  * Created by Adam Kocoloski on 5/7/07.
6  * Last updated 7/4/07.
7  *
8  */
9 
10 #if !defined(ST_SPIN_TREE_READER)
11 #define ST_SPIN_TREE_READER
12 
13 #include <set>
14 
15 #include "TChain.h"
16 #include "TEventList.h"
17 
18 #include "StSpinPool/StJetSkimEvent/StJetSkimEvent.h"
19 #include "StSpinPool/StJets/StJet.h"
20 #include "StSpinPool/StChargedPionAnalysisMaker/StChargedPionTrack.h"
21 #include "TPi0Event.h"
22 #include "StPrimaryElectron.h"
23 #include "StGlobalElectron.h"
24 //#include "StEEmcPool/StEEmcPi0Mixer/StEEmcPair.h"
25 
27 public:
28  StSpinTreeReader(const char *treeName = "spinTree");
29  virtual ~StSpinTreeReader();
30  StSpinTreeReader(const StSpinTreeReader &other);
31  StSpinTreeReader& operator=(const StSpinTreeReader &rhs);
32 
33  void selectDataset(const char *path);
34  void selectFile(const char *path);
35  void selectFile(std::string & path);
36 
37  long GetEntries();
38  void GetEntry(long i);
39 
40  //all branches are turned on by default; use these flags to turn them off
41  bool connectJets;
42  bool connectNeutralJets;
43  bool connectChargedPions;
44  bool connectBemcPions;
45  bool connectBemcElectrons;
46  bool connectEemcPions;
47 
48  //setters
49  void selectRunlist(const char *path);
50  void selectRun(int runnumber);
51  void removeRun(int runnumber);
52 
53  void selectTrigger(int trigger);
54  bool requireDidFire;
55  bool requireShouldFire;
56 
57  const TEventList* eventList() const {return mEventList;}
58  void setEventList(TEventList *elist) {mEventList = elist;}
59 
60  //accessors
61  const TChain* chain() const {return mChain;}
62 
63  const StJetSkimEvent* event() const {return mEvent;}
64 
65  int nJets() {return mConeJets->GetEntries();}
66  const TClonesArray* jets() const {return mConeJets;}
67  const StJet* jet(int i) const {return (StJet*)mConeJets->At(i);}
68 
69  int nNeutralJets() {return mConeJetsEMC->GetEntries();}
70  const TClonesArray* neutralJets() const {return mConeJetsEMC;}
71  const StJet* neutralJet(int i) const {return (StJet*)mConeJetsEMC->At(i);}
72 
73  int nChargedPions() {return mChargedPions->GetEntries();}
74  const TClonesArray* chargedPions() const {return mChargedPions;}
75  const StChargedPionTrack* chargedPion(int i) const {return (StChargedPionTrack*)mChargedPions->At(i);}
76 
77  int nBemcPions() {return mBemcPions->GetEntries();}
78  const TClonesArray* bemcPions() const {return mBemcPions;}
79  const TPi0Candidate* bemcPion(int i) const {return (TPi0Candidate*)mBemcPions->At(i);}
80 
81  int nBemcElectrons() {return mBemcElectrons->GetEntries();}
82  const TClonesArray* bemcElectrons() const {return mBemcElectrons;}
83  const StPrimaryElectron* bemcElectron(int i) const {return (StPrimaryElectron*)mBemcElectrons->At(i);}
84 
85  int nBemcGlobalElectrons() {return mBemcGlobalElectrons->GetEntries();}
86  const TClonesArray* bemcGlobalElectrons() const {return mBemcGlobalElectrons;}
87  const StGlobalElectron* bemcGlobalElectron(int i) const {return (StGlobalElectron*)mBemcGlobalElectrons->At(i);}
88 
89  //int nEemcPions() {return mEemcNeutralPions->GetEntries();}
90  //TClonesArray* eemcPions() {return mEemcNeutralPions;}
91  //StEEmcPair* eemcPion(int i) {return (StEEmcPair*)mEemcNeutralPions->At(i);}
92 
93 private:
94  StJetSkimEvent *mEvent;
95  TClonesArray *mConeJets;
96  TClonesArray *mConeJetsEMC;
97  TClonesArray *mChargedPions;
98  TClonesArray *mBemcPions;
99  TClonesArray *mBemcElectrons;
100  TClonesArray *mBemcGlobalElectrons;
101  TClonesArray *mEemcPions;
102 
103  std::map<int,std::string> mFileList;
104  std::set<int> mRunList;
105  std::set<int> mTriggerList;
106 
107  TChain *mChain;
108  TEventList *mEventList;
109 
110  //these chains are friends of the parent chain
111  TChain *mChainConeJets;
112  TChain *mChainConeJetsEMC;
113  TChain *mChainChargedPions;
114  TChain *mChainBemcPions;
115  TChain *mChainBemcElectrons;
116  TChain *mChainEemcPions;
117 
118  std::string mCurrentFileName;
119 
120  void connect();
121  bool mIsConnected;
122 
123  ClassDef(StSpinTreeReader,1)
124 };
125 
126 #endif
Definition: StJet.h:91