StPicoDstMaker.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #ifndef STAR_StPicoDstMaker
  2. #define STAR_StPicoDstMaker
  3. #include "StMaker.h"
  4. #include "TClonesArray.h"
  5. class TFile;
  6. class TTree;
  7. class StFile;
  8. class StMuDst;
  9. class StMuEvent;
  10. class StMuTrack;
  11. class StBTofHeader;
  12. class StEmcCollection;
  13. class StEmcPosition;
  14. class StEmcGeom;
  15. class StPicoDst;
  16. class StPicoEvent;
  17. class StPicoTrack;
  18. class StPicoV0;
  19. class StPicoTrigger;
  20. class StPicoBTOWHit;
  21. class StPicoBTofHit;
  22. class StPicoCut;
  23. #include "StPicoConstants.h"
  24. #include "StPicoArrays.h"
  25. #include "StEmcRawHit.h"
  26. #include <vector>
  27. #include <utility>
  28. #include <string>
  29. #if !defined(ST_NO_NAMESPACES)
  30. using namespace std;
  31. #endif
  32. class StPicoDstMaker : public StMaker {
  33. public:
  34. StPicoDstMaker(const char *name="PicoDst");
  35. StPicoDstMaker(int mode, const char* fileName="", const char* name="PicoDst");
  36. virtual ~StPicoDstMaker();
  37. virtual Int_t Init();
  38. virtual Int_t Make();
  39. virtual void Clear(Option_t *option="");
  40. virtual Int_t Finish();
  41. void printArrays();
  42. void SetStatus(const char *arrType,int status);
  43. void setRunNumber(Int_t);
  44. void setCreatingPhiWgt(Bool_t);
  45. void setProdMode(Int_t);
  46. void setEmcMode(const Int_t mode=1); // 0:No EMC, 1:EMC On
  47. /// Returns null pointer if no StPicoDst
  48. StPicoDst *picoDst();
  49. /// In read mode, returns pointer to the chain of .picoDst.root files
  50. TChain* chain();
  51. /// Returns pointer to the current TTree, the top level io structure
  52. TTree* tree();
  53. /// Sets the split level for the file and all branches. Please refer to the ROOT manual (http://root.cern.ch) for more info
  54. void setSplit(int=99);
  55. /// Sets the buffer size for all branches.
  56. void setBufferSize(int=65536*4);
  57. /// Sets the compression level for the file and all branches. 0 means no compression, 9 is the higher compression level.
  58. void setCompression(int comp=9);
  59. protected:
  60. #define saveDelete(t) { delete t; t=0;}
  61. void streamerOff();
  62. void openWrite();
  63. void write();
  64. void closeWrite();
  65. Int_t openRead();
  66. void read();
  67. void setBranchAddresses();
  68. void closeRead();
  69. void setBranchAddresses(TChain*);
  70. void clearIndices();
  71. void buildEmcIndex();
  72. void initEmc();
  73. void finishEmc();
  74. void DeclareHistos();
  75. void WriteHistos();
  76. void FillHistograms(int, float*);
  77. void assignArrays();
  78. void clearArrays();
  79. void zeroArrays();
  80. void createArrays();
  81. TClonesArray* clonesArray(TClonesArray*& p, const char* type, int size, int& counter);
  82. Int_t MakeRead();
  83. Int_t MakeWrite();
  84. void fillTracks();
  85. void fillEvent();
  86. void fillV0();
  87. void fillTrigger();
  88. void fillBTOWHits();
  89. void fillBTofHits();
  90. Int_t phiBin(int, StMuTrack *, float);
  91. void addPhiWeight(StMuTrack *, float, float*);
  92. Int_t centrality(int);
  93. bool getBEMC(StMuTrack *, int*, int*, float*, float*, int*, int*);
  94. enum ioMode {ioRead, ioWrite};
  95. // production modes for different data sets
  96. enum prodMode {minbias, central, ht, minbias2};
  97. StMuDst* mMuDst;
  98. StMuEvent* mMuEvent;
  99. StBTofHeader* mBTofHeader;
  100. StEmcCollection* mEmcCollection;
  101. StEmcPosition* mEmcPosition;
  102. StEmcGeom* mEmcGeom[4];
  103. StEmcRawHit* mEmcIndex[4800];
  104. StPicoDst* mPicoDst;
  105. StPicoCut* mPicoCut;
  106. Int_t mCentrality;
  107. Float_t mBField;
  108. Int_t mIoMode; //! I/O mode: 0: - write, 1: - read
  109. Bool_t mCreatingPhiWgt; //! creating phi weight files
  110. Int_t mProdMode; //! prod mode: 0: - mb, 1: - central, 2: - ht, 3: - mb2, mb with phi weight and q-vector calculation
  111. Int_t mEmcMode; //! EMC ON(=1)/OFF(=0)
  112. TString mInputFileName; //! *.list - MuDst or picoDst
  113. TString mOutputFileName; //! FileName
  114. TString mPhiWgtFileName; //! phi weight filename
  115. TString mPhiTestFileName; //! phi weight filename
  116. TFile* mOutputFile;
  117. TFile* mPhiWgtFile;
  118. Int_t mRunNumber;
  119. TChain* mChain;
  120. TTree* mTTree;
  121. int mEventCounter;
  122. int mSplit;
  123. int mCompression;
  124. int mBufferSize;
  125. Int_t mIndex2Primary[nTrk];
  126. Int_t mMap2Track[nTrk];
  127. //
  128. TH1D* mPhiWgtHist[nCen+1][nEW*nDet];
  129. static const char* mEW[nEW*nDet]; //!={"EE","EW","WE","WW","FarWest","West","East","FarEast"};
  130. Float_t mPhiWeightRead[nCen+1][nEW*nDet*nPhi];
  131. Float_t mPhiWeightWrite[nEW*nDet*nPhi]; // phi weight for the current event
  132. //
  133. friend class StPicoDst;
  134. TClonesArray* mPicoAllArrays[__NALLPICOARRAYS__];
  135. TClonesArray** mPicoArrays; //[__NPICOARRAYS__]
  136. TClonesArray** mPicoV0Arrays; //[__NPICOV0ARRAYS__]
  137. char mStatusArrays[__NALLPICOARRAYS__];
  138. ClassDef(StPicoDstMaker,1)
  139. };
  140. inline StPicoDst* StPicoDstMaker::picoDst() { return mPicoDst; }
  141. inline TChain* StPicoDstMaker::chain() { return mChain; }
  142. inline TTree* StPicoDstMaker::tree() { return mTTree; }
  143. inline void StPicoDstMaker::setSplit(int split) { mSplit = split;}
  144. inline void StPicoDstMaker::setCompression(int comp) { mCompression = comp;}
  145. inline void StPicoDstMaker::setBufferSize(int buf) { mBufferSize = buf; }
  146. inline void StPicoDstMaker::setRunNumber(int run) { mRunNumber = run; }
  147. inline void StPicoDstMaker::setCreatingPhiWgt(bool val) { mCreatingPhiWgt = val; }
  148. inline void StPicoDstMaker::setProdMode(int val) { mProdMode = val; }
  149. inline void StPicoDstMaker::setEmcMode(const Int_t mode) { mEmcMode = mode; }
  150. #endif