StHbtMuDstReader.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. #include <string>
  9. #include "StMaker.h"
  10. #include "StChain.h"
  11. #include "St_DataSetIter.h"
  12. #include "StMuDSTMaker/COMMON/StMuArrays.h"
  13. #include "Base/StHbtEventReader.hh"
  14. class StMuEvent;
  15. class StMuDst;
  16. class StMuCut;
  17. class StEvent;
  18. class StTrackNode;
  19. class StTrack;
  20. class StRichSpectra;
  21. class StDetectorState;
  22. class StL3AlgorithmInfo;
  23. class StuProbabilityPidAlgorithm;
  24. class StIOMaker;
  25. /// strangeness group stuff
  26. class StStrangeEvMuDst;
  27. class StStrangeMuDstMaker;
  28. class StV0MuDst;
  29. class StV0Mc;
  30. class StXiMuDst;
  31. class StXiMc;
  32. class StKinkMuDst;
  33. class StKinkMc;
  34. class StStrangeAssoc;
  35. ///
  36. class StMuCut;
  37. class TFile;
  38. class TTree;
  39. class TChain;
  40. class TClonesArray;
  41. //!class ioMode;//!enum ioMode {ioRead, ioWrite};
  42. //!class ioNameMode;//!enum ioNameMode {ioFix, ioAuto};
  43. class StHbtMuDstReader : public StHbtEventReader {
  44. public:
  45. StHbtMuDstReader(int mode, int nameMode, const char* dirName="./", const char* fileName="test.event.root", const char* filter=".", int maxfiles=10 );
  46. ~StHbtMuDstReader();
  47. StHbtEvent* ReturnHbtEvent();
  48. int Init();
  49. int Init(const char* ReadWrite, StHbtString& Message)
  50. { return StHbtEventReader::Init(ReadWrite,Message);}//WarnOff
  51. void Clear();
  52. void Finish();
  53. bool readTracks();
  54. bool readV0s();
  55. bool readXis();
  56. bool readKinks();
  57. unsigned int trackType();
  58. StMuDst* muDst();
  59. TChain* chain();
  60. TTree* tree();
  61. StEvent* stEvent();
  62. StStrangeMuDstMaker* stStrangeMuDstMaker();
  63. void setTrackFilter(StMuCut* c);
  64. void setL3TrackFilter(StMuCut* c);
  65. void setProbabilityPidFile(const char* file);
  66. void setStEvent(StEvent*);
  67. void setStStrangeMuDstMaker(StStrangeMuDstMaker*);
  68. void setTrackType(unsigned int);
  69. void setReadTracks(bool);
  70. void setReadV0s(bool);
  71. void setReadXis(bool);
  72. void setReadKinks(bool);
  73. enum ioMode {ioRead, ioWrite};
  74. enum ioNameMode {ioFix, ioAuto};
  75. private:
  76. StMuDst* mStMuDst;
  77. StEvent* mStEvent;
  78. StStrangeMuDstMaker* mStStrangeMuDstMaker;
  79. StIOMaker* mIOMaker;
  80. ioMode mIoMode;
  81. ioNameMode mIoNameMode;
  82. string mDirName;
  83. string mFileName;
  84. string mFilter;
  85. int mMaxFiles;
  86. unsigned int mTrackType;
  87. bool mReadTracks;
  88. bool mReadV0s;
  89. bool mReadXis;
  90. bool mReadKinks;
  91. bool mFinish;
  92. StMuCut* mTrackFilter;
  93. StMuCut* mL3TrackFilter;
  94. TFile* mCurrentFile;
  95. string mCurrentFileName;
  96. TChain* mChain;
  97. TTree* mTTree;
  98. int mEventCounter;
  99. int mSplit;
  100. int mCompress;
  101. int mBufferSize;
  102. StHbtEvent* mHbtEvent;
  103. StuProbabilityPidAlgorithm* mProbabilityPidAlgorithm;
  104. //! protected:
  105. string buildFileName(string dir, string fileName, string extention);
  106. void openWrite(string fileName);
  107. void write();
  108. void closeWrite();
  109. void makeChain(const char* dir, const char* filter, int maxFiles=10);
  110. void openRead();
  111. void read();
  112. void closeRead();
  113. void clear(TClonesArray* t, int& counter);
  114. void clear();
  115. TClonesArray* clonesArray(TClonesArray* p, const char* type, int size, int& counter);
  116. void fill();
  117. void fillTrees(StEvent* ev, StMuCut* cut=0);
  118. void fillEvent(StEvent* ev, StMuCut* cut=0);
  119. void fillStrange(StStrangeMuDstMaker*);
  120. void fillL3Tracks(StEvent* ev, StMuCut* cut=0);
  121. void fillTracks(StEvent* ev, StMuCut* cut=0);
  122. void fillDetectorStates(StEvent* ev);
  123. void fillL3AlgorithmInfo(StEvent* ev);
  124. template <class T> void addType(TClonesArray* tcaFrom, TClonesArray* tcaTo , T t);
  125. template <class T> int addType(TClonesArray* tcaTo , T t);
  126. template <class T, class U> int addType(TClonesArray* tcaTo , U u, T t);
  127. void addTrackNode(const StEvent* ev, const StTrackNode* node, StMuCut* cut, TClonesArray* gTCA=0, TClonesArray* pTCA=0, TClonesArray* oTCA=0, bool l3=false);
  128. int addTrack(TClonesArray* tca, const StEvent* event, const StTrack* track, StMuCut* cut, int index2Global, bool l3=false);
  129. /* int addRichSpectra(const StRichSpectra* rich); */
  130. /* int addDetectorState(const StDetectorState* states); */
  131. /* int addL3AlgorithmInfo(TClonesArray* tca, StL3AlgorithmInfo* alg); */
  132. StRichSpectra* richSpectra(const StTrack* track);
  133. string basename(string);
  134. friend class StMuDst;
  135. TClonesArray* arrays[__NARRAYS__];
  136. TClonesArray* mArrays[__NARRAYS__];
  137. TClonesArray* strangeArrays[__NSTRANGEARRAYS__];
  138. TClonesArray* mStrangeArrays[__NSTRANGEARRAYS__];
  139. ClassDef(StHbtMuDstReader, 1)
  140. };
  141. inline StMuDst* StHbtMuDstReader::muDst() { return mStMuDst;}
  142. inline TChain* StHbtMuDstReader::chain() { return mChain; }
  143. inline TTree* StHbtMuDstReader::tree() { return mTTree; }
  144. inline void StHbtMuDstReader::setTrackFilter(StMuCut* c) { mTrackFilter=c;}
  145. inline void StHbtMuDstReader::setL3TrackFilter(StMuCut* c) { mL3TrackFilter=c;}
  146. inline void StHbtMuDstReader::setStStrangeMuDstMaker(StStrangeMuDstMaker* s) {mStStrangeMuDstMaker=s;}
  147. inline StStrangeMuDstMaker* StHbtMuDstReader::stStrangeMuDstMaker() {return mStStrangeMuDstMaker;}
  148. inline void StHbtMuDstReader::setTrackType(unsigned int t) {mTrackType=t;}
  149. inline unsigned int StHbtMuDstReader::trackType() {return mTrackType;}
  150. inline bool StHbtMuDstReader::readTracks() { return mReadTracks;}
  151. inline bool StHbtMuDstReader::readV0s() { return mReadV0s;}
  152. inline bool StHbtMuDstReader::readXis() { return mReadXis;}
  153. inline bool StHbtMuDstReader::readKinks() { return mReadKinks;}
  154. inline void StHbtMuDstReader::setReadTracks(bool b) { mReadTracks=b;}
  155. inline void StHbtMuDstReader::setReadV0s(bool b) { mReadV0s=b;}
  156. inline void StHbtMuDstReader::setReadXis(bool b) { mReadXis=b;}
  157. inline void StHbtMuDstReader::setReadKinks(bool b) { mReadKinks=b;}
  158. #endif
  159. /***************************************************************************
  160. *
  161. * $Log: StHbtMuDstReader.h,v $
  162. * Revision 1.2 2003/09/07 03:49:02 perev
  163. * gcc 3.2 + WarnOff
  164. *
  165. * Revision 1.1 2002/03/20 19:32:24 laue
  166. * new reader for common MuDsts
  167. *
  168. *
  169. **************************************************************************/