StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcTreeMaker.h
1 /*
2  * Created by S. Gliske, May 2012
3  *
4  * Description: General utility class for reading and writing
5  * EEmcTrees. The "tree" is actually several trees, divided into
6  * "parts." The parts (may) include the following:
7  *
8  * - Part 1
9  * - Event header information
10  * - Spin information
11  * - Location of the primary vertex
12  * - An EEmcEnergy_t container, holding the calibrated but unprocessed
13  energy response of the EEMC
14  * - Part 2
15  * - TClonesArray of EEmcClusters
16  * - TClonesArray of EEmcHits
17  * - Part 3
18  * - TClonesArray of EM particle candidates, i.e. particles detected
19  * by the EEMC
20  * - TClonesArray of "two particle" candidates, i.e. a candidate parent
21  * particle which decays (decayed) into two EM particles.
22  * - Part 4 (unused in any current analysis--not fully debugged)
23  * - Set of high towers and trigger patches for the event
24  *
25  *
26  */
27 
28 #ifndef StEEmcTreeMaker_H_
29 #define StEEmcTreeMaker_H_
30 
31 #include <set>
32 #include <Rtypes.h>
33 #include <TVector3.h>
34 #include "StMaker.h"
35 
36 // need this in the .h for linking purposes
37 #include "StRoot/StTriggerUtilities/StTriggerSimuMaker.h"
38 
39 class StSpinInfoMaker_t;
40 class StSpinInfo_t;
42 class EEmcEnergy_t;
43 class StEEmcHitMaker_t;
44 
45 class StSimpleCluster_t;
46 class EEmcSmdCluster_t;
47 class StEEmcHit_t;
48 class EEmcHit_t;
49 class TrigSet;
50 
51 class StEEmcTreeMaker_t : public StMaker {
52  public:
54  StEEmcTreeMaker_t( const Char_t *myName );
55 
57  virtual ~StEEmcTreeMaker_t();
58 
60  Int_t Init();
61 
63  Int_t Make();
64 
66  void Clear(Option_t *opts="");
67 
69  Int_t Finish();
70 
71  // to keep track of trees being read in or written out
72  enum iostatus_t { READ, WRITE, IGNORE };
73 
74  // to keep track of the type/stage of the tree
75  enum treeTypeEnum_t { PART_1, PART_2, PART_3, PART_4, NUM_TREE_PARTS };
76 
78  void setTreeStatus( treeTypeEnum_t type, iostatus_t iostatus, const Char_t* fileName );
79  void setMaxNumEvents( Int_t maxNum );
80  void setStartingEvent( Int_t num ){ mNumEvents = num; };
81  void setNumTowerThres( UInt_t num ); // for placing a cut on the number of "high" towers
82 
83  void setSpinInfoMkr( StSpinInfoMaker_t* spinInfoMkr );
84  void setEEmcEnergyMkr( StEEmcEnergyMaker_t* eMkr );
85  void setEEmcHitMkr( StEEmcHitMaker_t* hMkr );
86  void setEEmcTreeReader( StEEmcTreeMaker_t *treeRdr );
87 
88  void doSpinInfoIO( Bool_t doIt = 1 );
89  void doEvtHddrIO( Bool_t doIt = 1 );
90  void doMakePairs( Bool_t doIt = 1 );
91 
92  void setHTTPthres( Double_t ht, Double_t tp ); // both ht and tp used for Part1, just ht used for Part 4
93 
96  StSpinInfo_t* getSpinInfo();
97  EEmcEnergy_t* getEEmcEnergy();
98  TVector3* getVertex();
99  UInt_t getBbcOnlineTimeDiff();
100 
101  TClonesArray* getHitArray();
102 
103  const TrigSet* getHardwareTriggerSet();
104  const TrigSet* getSoftwareTriggerSet();
105 
106  Int_t getNumPart1EventsWritten() const;
107  Int_t getNumEEmcClusters() const;
108  Int_t getNumEEmcHits() const;
109  Int_t getNumParticleCandidates1() const;
110  Int_t getNumParticleCandidates2() const;
111 
112  TIter getEEmcClusterIter();
113  TIter getEEmcHitIter();
114  TIter getEEmcParticleCandidateIter1();
115  TIter getEEmcParticleCandidateIter2();
116 
120 
121  protected:
123  iostatus_t mIOStat[ NUM_TREE_PARTS ];
124  std::string mFilename[ NUM_TREE_PARTS ];
125 
127  TFile *mFile[ NUM_TREE_PARTS ];
128  TTree *mTree[ NUM_TREE_PARTS ];
129 
131  TChain *mChain[ NUM_TREE_PARTS ];
132 
134  Int_t mNumEvents, mNumPart1EventsWritten;
135 
138 
140  Bool_t mSpinInfoIO;
141  Bool_t mEventHddrIO;
142 
145  Bool_t mDoMakePairs;
146 
148  UInt_t mNumTowers;
149  Double_t mHTthres, mTPthres;
150 
152 
155  StSpinInfo_t *mSpinInfo;
156  EEmcEnergy_t *mEEmcEnergy;
157 
160 
161  // vertex rank
162  Float_t mVertexRank;
163 
165  TVector3 *mVertex;
166  TrigSet *mHrdTrigSet, *mSftTrigSet; // hardware (MuDst) and software (simulated) triggers
167  TClonesArray *mClusArr;
168  TClonesArray *mHitArr;
169  TClonesArray *mParticleArr1;
170  TClonesArray *mParticleArr2;
171  TArrayF *mET0ht, *mET0tp;
172 
173  // makers
174  StSpinInfoMaker_t* mSpinInfoMkr;
175  StEEmcEnergyMaker_t* mEnMkr;
176  StEEmcHitMaker_t* mHitMkr;
177  StEEmcTreeMaker_t* mTreeRdr; // to read the mEEmcEnergy, when this one is ignoring it.
178 
179  // extra functions
180  Int_t openForRead( treeTypeEnum_t type );
181  Int_t openForWrite( treeTypeEnum_t type, const Char_t *name );
182  Int_t fillPart1();
183  Int_t fillPart2();
184  Int_t fillPart3();
185  Int_t fillPart4();
186 
187  static void copySimpleClusterToSmdCluster( const EEmcEnergy_t& eemcEnergy, Short_t sector, Bool_t inLayerV, const StSimpleCluster_t& other, EEmcSmdCluster_t& clus );
188  static void copyStEEmcHitToEEmcHit( const EEmcEnergy_t& eemcEnergy, Int_t uClusIdx, Int_t vClusIdx, const StEEmcHit_t& other, EEmcHit_t& hit );
189 
190  const Float_t *mEta;
191 
192  private:
193  // for ROOT
194  ClassDef( StEEmcTreeMaker_t, 1 );
195 
196 };
197 
198 
199 // inline accessors
200 
202 inline StSpinInfo_t* StEEmcTreeMaker_t::getSpinInfo(){ return mSpinInfo; };
203 inline EEmcEnergy_t* StEEmcTreeMaker_t::getEEmcEnergy(){ return mEEmcEnergy; };
204 inline TVector3* StEEmcTreeMaker_t::getVertex(){ return mVertex; };
205 inline UInt_t StEEmcTreeMaker_t::getBbcOnlineTimeDiff(){ return mBbcOnlineTimeDiff; };
206 
207 inline TClonesArray* StEEmcTreeMaker_t::getHitArray(){ return mHitArr; };
208 
209 inline Int_t StEEmcTreeMaker_t::getNumEEmcClusters() const { return ( mClusArr ? mClusArr->GetEntriesFast() : 0 ); };
210 inline Int_t StEEmcTreeMaker_t::getNumEEmcHits() const { return ( mHitArr ? mHitArr->GetEntriesFast() : 0 ); };
211 inline Int_t StEEmcTreeMaker_t::getNumParticleCandidates1() const { return ( mParticleArr1 ? mParticleArr1->GetEntriesFast() : 0 ); };
212 inline Int_t StEEmcTreeMaker_t::getNumParticleCandidates2() const { return ( mParticleArr2 ? mParticleArr2->GetEntriesFast() : 0 ); };
213 
214 inline TIter StEEmcTreeMaker_t::getEEmcClusterIter(){ return TIter( mClusArr ); };
215 inline TIter StEEmcTreeMaker_t::getEEmcHitIter(){ return TIter( mHitArr ); };
216 inline TIter StEEmcTreeMaker_t::getEEmcParticleCandidateIter1(){ return TIter( mParticleArr1 ); };
217 inline TIter StEEmcTreeMaker_t::getEEmcParticleCandidateIter2(){ return TIter( mParticleArr2 ); };
218 
219 inline void StEEmcTreeMaker_t::setHTTPthres( Double_t ht, Double_t tp ){ mHTthres = ht; mTPthres = tp; };
220 
221 inline Int_t StEEmcTreeMaker_t::getNumPart1EventsWritten() const { return mNumPart1EventsWritten; };
222 
223 inline void StEEmcTreeMaker_t::doMakePairs( Bool_t doIt ){ mDoMakePairs = doIt; };
224 
225 inline void StEEmcTreeMaker_t::setNumTowerThres( UInt_t num ){ mNumTowers = num; };
226 
227 #endif
228 
229 /*
230  * $Id: StEEmcTreeMaker.h,v 1.2 2013/02/21 21:28:50 sgliske Exp $
231  * $Log: StEEmcTreeMaker.h,v $
232  * Revision 1.2 2013/02/21 21:28:50 sgliske
233  * added vertex rank
234  *
235  * Revision 1.1 2012/11/26 19:06:10 sgliske
236  * moved from offline/users/sgliske/StRoot/StEEmcPool/StEEmcTreeMaker to StRoot/StEEmcPool/StEEmcTreeMaker
237  *
238  *
239  */
iostatus_t mIOStat[NUM_TREE_PARTS]
filenames
Int_t mMaxNumEvents
max number of events
StEvtHddr * mEventHddr
The data.
StEvtHddr * getEvtHddr()
accessors
TFile * mFile[NUM_TREE_PARTS]
TFiles/TTrees for writing.
UInt_t mNumTowers
thresholds for keeping the event
virtual ~StEEmcTreeMaker_t()
deconstructor
void setTreeStatus(treeTypeEnum_t type, iostatus_t iostatus, const Char_t *fileName)
modifiers
Int_t mNumEvents
number of events processed / written outt
UInt_t mBbcOnlineTimeDiff
BBC time difference.
StEEmcTreeMaker_t(const Char_t *myName)
constructor
void Clear(Option_t *opts="")
Clear for next event.
Bool_t mSpinInfoIO
whether to save various things
TChain * mChain[NUM_TREE_PARTS]
TChains for reading.
The class.
Definition: StEEmcHit.h:37
TVector3 * mVertex
the following pointers are owned by the class
Int_t Make()
Build an event.
Int_t Finish()
Write everything to file.
Include StRoot headers.
Int_t Init()
Initialize.