StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtMuDstReader.h
1 /***************************************************************************
2  *
3  * $Id: StHbtMuDstReader.h,v 1.2 2003/09/07 03:49:02 perev Exp $
4  * Author: Frank Laue, BNL, laue@bnl.gov
5  ***************************************************************************/
6 #ifndef StHbtMuDstReader_hh
7 #define StHbtMuDstReader_hh
8 
9 #include <string>
10 
11 #include "StMaker.h"
12 #include "StChain.h"
13 #include "St_DataSetIter.h"
14 #include "StMuDSTMaker/COMMON/StMuArrays.h"
15 
16 #include "Base/StHbtEventReader.hh"
17 
18 
19 
20 class StMuEvent;
21 class StMuDst;
22 class StMuCut;
23 
24 class StEvent;
25 class StTrackNode;
26 class StTrack;
27 class StRichSpectra;
28 class StDetectorState;
29 class StL3AlgorithmInfo;
30 
32 
33 class StIOMaker;
34 
36 class StStrangeEvMuDst;
38 class StV0MuDst;
39 class StV0Mc;
40 class StXiMuDst;
41 class StXiMc;
42 class StKinkMuDst;
43 class StKinkMc;
44 class StStrangeAssoc;
45 
47 class StMuCut;
48 
49 class TFile;
50 class TTree;
51 class TChain;
52 class TClonesArray;
53 
56 
58  public:
59  StHbtMuDstReader(int mode, int nameMode, const char* dirName="./", const char* fileName="test.event.root", const char* filter=".", int maxfiles=10 );
61 
62  StHbtEvent* ReturnHbtEvent();
63  int Init();
64  int Init(const char* ReadWrite, StHbtString& Message)
65  { return StHbtEventReader::Init(ReadWrite,Message);}//WarnOff
66  void Clear();
67  void Finish();
68 
69  bool readTracks();
70  bool readV0s();
71  bool readXis();
72  bool readKinks();
73  unsigned int trackType();
74  StMuDst* muDst();
75  TChain* chain();
76  TTree* tree();
77  StEvent* stEvent();
78  StStrangeMuDstMaker* stStrangeMuDstMaker();
79 
80  void setTrackFilter(StMuCut* c);
81  void setL3TrackFilter(StMuCut* c);
82  void setProbabilityPidFile(const char* file);
83  void setStEvent(StEvent*);
84  void setStStrangeMuDstMaker(StStrangeMuDstMaker*);
85  void setTrackType(unsigned int);
86  void setReadTracks(bool);
87  void setReadV0s(bool);
88  void setReadXis(bool);
89  void setReadKinks(bool);
90 
91  enum ioMode {ioRead, ioWrite};
92  enum ioNameMode {ioFix, ioAuto};
93 private:
94 
95  StMuDst* mStMuDst;
96 
97  StEvent* mStEvent;
98  StStrangeMuDstMaker* mStStrangeMuDstMaker;
99  StIOMaker* mIOMaker;
100 
101  ioMode mIoMode;
102  ioNameMode mIoNameMode;
103  string mDirName;
104  string mFileName;
105  string mFilter;
106  int mMaxFiles;
107 
108  unsigned int mTrackType;
109  bool mReadTracks;
110  bool mReadV0s;
111  bool mReadXis;
112  bool mReadKinks;
113  bool mFinish;
114 
115  StMuCut* mTrackFilter;
116  StMuCut* mL3TrackFilter;
117 
118  TFile* mCurrentFile;
119  string mCurrentFileName;
120 
121  TChain* mChain;
122  TTree* mTTree;
123 
124  int mEventCounter;
125  int mSplit;
126  int mCompress;
127  int mBufferSize;
128 
129  StHbtEvent* mHbtEvent;
130  StuProbabilityPidAlgorithm* mProbabilityPidAlgorithm;
131 
132 
134 
135  string buildFileName(string dir, string fileName, string extention);
136  void openWrite(string fileName);
137  void write();
138  void closeWrite();
139 
140  void makeChain(const char* dir, const char* filter, int maxFiles=10);
141  void openRead();
142  void read();
143  void closeRead();
144 
145  void clear(TClonesArray* t, int& counter);
146  void clear();
147  TClonesArray* clonesArray(TClonesArray* p, const char* type, int size, int& counter);
148 
149  void fill();
150  void fillTrees(StEvent* ev, StMuCut* cut=0);
151  void fillEvent(StEvent* ev, StMuCut* cut=0);
152  void fillStrange(StStrangeMuDstMaker*);
153  void fillL3Tracks(StEvent* ev, StMuCut* cut=0);
154  void fillTracks(StEvent* ev, StMuCut* cut=0);
155  void fillDetectorStates(StEvent* ev);
156  void fillL3AlgorithmInfo(StEvent* ev);
157  template <class T> void addType(TClonesArray* tcaFrom, TClonesArray* tcaTo , T t);
158  template <class T> int addType(TClonesArray* tcaTo , T t);
159  template <class T, class U> int addType(TClonesArray* tcaTo , U u, T t);
160  void addTrackNode(const StEvent* ev, const StTrackNode* node, StMuCut* cut, TClonesArray* gTCA=0, TClonesArray* pTCA=0, TClonesArray* oTCA=0, bool l3=false);
161  int addTrack(TClonesArray* tca, const StEvent* event, const StTrack* track, StMuCut* cut, int index2Global, bool l3=false);
162 /* int addRichSpectra(const StRichSpectra* rich); */
163 /* int addDetectorState(const StDetectorState* states); */
164 /* int addL3AlgorithmInfo(TClonesArray* tca, StL3AlgorithmInfo* alg); */
165 
166  StRichSpectra* richSpectra(const StTrack* track);
167 
168 
169  string basename(string);
170 
171  friend class StMuDst;
172 
173  TClonesArray* arrays[__NARRAYS__];
174  TClonesArray* mArrays[__NARRAYS__];
175 
176  TClonesArray* strangeArrays[__NSTRANGEARRAYS__];
177  TClonesArray* mStrangeArrays[__NSTRANGEARRAYS__];
178 
179  ClassDef(StHbtMuDstReader, 1)
180 };
181 
182 inline StMuDst* StHbtMuDstReader::muDst() { return mStMuDst;}
183 inline TChain* StHbtMuDstReader::chain() { return mChain; }
184 inline TTree* StHbtMuDstReader::tree() { return mTTree; }
185 inline void StHbtMuDstReader::setTrackFilter(StMuCut* c) { mTrackFilter=c;}
186 inline void StHbtMuDstReader::setL3TrackFilter(StMuCut* c) { mL3TrackFilter=c;}
187 inline void StHbtMuDstReader::setStStrangeMuDstMaker(StStrangeMuDstMaker* s) {mStStrangeMuDstMaker=s;}
188 inline StStrangeMuDstMaker* StHbtMuDstReader::stStrangeMuDstMaker() {return mStStrangeMuDstMaker;}
189 inline void StHbtMuDstReader::setTrackType(unsigned int t) {mTrackType=t;}
190 inline unsigned int StHbtMuDstReader::trackType() {return mTrackType;}
191 
192 inline bool StHbtMuDstReader::readTracks() { return mReadTracks;}
193 inline bool StHbtMuDstReader::readV0s() { return mReadV0s;}
194 inline bool StHbtMuDstReader::readXis() { return mReadXis;}
195 inline bool StHbtMuDstReader::readKinks() { return mReadKinks;}
196 inline void StHbtMuDstReader::setReadTracks(bool b) { mReadTracks=b;}
197 inline void StHbtMuDstReader::setReadV0s(bool b) { mReadV0s=b;}
198 inline void StHbtMuDstReader::setReadXis(bool b) { mReadXis=b;}
199 inline void StHbtMuDstReader::setReadKinks(bool b) { mReadKinks=b;}
200 
201 #endif
202 
203 /***************************************************************************
204  *
205  * $Log: StHbtMuDstReader.h,v $
206  * Revision 1.2 2003/09/07 03:49:02 perev
207  * gcc 3.2 + WarnOff
208  *
209  * Revision 1.1 2002/03/20 19:32:24 laue
210  * new reader for common MuDsts
211  *
212  *
213  **************************************************************************/
Definition: StV0Mc.hh:17
static TClonesArray ** strangeArrays
array of TClonesArrays for the stuff inherited from the StStrangeMuDst
Definition: StMuDst.h:188
Definition: StXiMc.hh:17
StHbtMuDstReader(int mode, int nameMode, const char *dirName="./", const char *fileName="test.event.root", const char *filter=".", int maxfiles=10)
static TClonesArray ** arrays
array of TClonesArrays
Definition: StMuDst.h:185