StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoDstMaker.h
1 
51 #ifndef StPicoDstMaker_h
52 #define StPicoDstMaker_h
53 
54 // StChain headers
55 #include "StChain/StMaker.h"
56 
57 // PicoDst headers
58 #include "StPicoEvent/StPicoArrays.h"
59 #include "StPicoDstMaker/StPicoFmsFiller.h"
60 
61 #if defined (__TFG__VERSION__)
62 #include "StMuDSTMaker/COMMON/StMuDst.h"
63 #endif /* __TFG__VERSION__ */
64 
65 class TClonesArray;
66 class TChain;
67 class TFile;
68 class TTree;
69 class StMuDst;
70 class StMuTrack;
71 class StEmcCollection;
72 class StEmcPosition;
73 class StEmcGeom;
74 class StEmcRawHit;
75 class StPicoDst;
76 class StPicoEvent;
77 
78 //_________________
79 class StPicoDstMaker : public StMaker {
80 
81  public:
82 
84  enum PicoIoMode {IoWrite=1, IoRead=2};
85 #if !defined (__TFG__VERSION__)
86  enum PicoVtxMode {NotSet=0, Default=1, Vpd=2, VpdOrDefault=3, Mtd=4, FXT=5};
94 #endif /* ! __TFG__VERSION__ */
95  enum PicoCovMtxMode {Skip=0, Write=1};
98  enum PicoBEmcSmdMode {SmdSkip=0, SmdWrite=1};
99 
101  StPicoDstMaker(char const* name = "PicoDst");
103  StPicoDstMaker(PicoIoMode ioMode, char const* fileName = "",
104  char const* name = "PicoDst");
106  virtual ~StPicoDstMaker();
107 
109  virtual Int_t InitRun(Int_t const runnumber);
111  virtual Int_t Init();
113  virtual Int_t Make();
115  virtual void Clear(Option_t* option = "");
117  virtual Int_t Finish();
118 
120  void printArrays();
121 
123  void SetStatus(char const* branchNameRegex, int enable);
124 
126  StPicoDst* picoDst() { return mPicoDst; }
128  TChain* chain() { return mChain; }
130  TTree* tree() { return mTTree; }
131 
134  void setSplit(int = 99);
136  void setBufferSize(int = 65536 * 4);
139  void setCompression(int comp = 9);
140 
141 #if defined (__TFG__VERSION__)
142  PicoVtxMode vtxMode() { return StMuDst::instance()->vtxMode(); }
143  void setVtxMode(const PicoVtxMode vtxMode)
144  { StMuDst::instance()->setVtxMode(vtxMode); }
145  void SetMaxTrackDca(Double_t cut = 50)
146  { StMuDst::instance()->SetMaxTrackDca(cut); }
147  void SetMaxVertexTransError(Double_t cut = 0.0050)
148  { StMuDst::instance()->SetMaxVertexTransError(cut); }
149  void SetVxXYrange(Double_t xmin = -0.3, Double_t xmax = 0.,
150  Double_t ymin = -0.27, Double_t ymax = -0.13)
151  { StMuDst::instance()->SetVxXYrange(xmin,xmax,ymin,ymax) ;}
152  void SetVxZrange(Double_t zmin = -70, Double_t zmax = 70.)
153  { StMuDst::instance()->SetVxZrange(zmin, zmax); }
154  void SetVxRmax(Double_t rmax = 2) { StMuDst::instance()->SetVxRmax(rmax); }
155  static StPicoDstMaker *instance() { return fgPicoDstMaker; }
156  TClonesArray** picoArrays() { return mPicoArrays; }
157 #else /* ! __TFG__VERSION__ */
158 
160  void setVtxMode(const PicoVtxMode vtxMode) { mVtxMode = vtxMode; }
161 #endif
162  void setCovMtxMode(const PicoCovMtxMode covMtxMode) { mCovMtxMode = covMtxMode; }
165  void setBEmcSmdMode(const PicoBEmcSmdMode bemcSmdMode) { mBEmcSmdMode = bemcSmdMode; }
166 
167  private:
168 
170  void streamerOff();
171 
173  void openWrite();
175  void write();
177  void closeWrite();
179  Int_t openRead();
181  void read();
183  void closeRead();
185  void setBranchAddresses(TChain*);
186 
188  void buildEmcIndex(StEmcCollection*);
190  void initEmc();
192  void finishEmc();
193 
195  Bool_t initMtd(Int_t const runnumber);
196 
198  void clearArrays();
200  void createArrays();
201 
202  Int_t MakeRead();
203  Int_t MakeWrite();
204 
206  void fillEventHeader() const;
207 
209  void fillTracks();
211  void fillEvent();
213  void fillEmcTrigger();
215  void fillMtdTrigger();
217  void fillBTowHits();
219  void fillBTofHits();
221  void fillMtdHits();
223  void fillEpdHits();
225  void fillBbcHits();
227  void fillETofHits();
229  void fillMcVertices();
231  void fillMcTracks();
232 
233 
254  Bool_t getBEMC(const StMuTrack* t, int* id, int* adc, float* ene, float* d, int* nep, int* towid);
256  Int_t setVtxModeAttr();
258  Int_t setCovMtxModeAttr();
260  Int_t setBEmcSmdModeAttr();
261 
262 #if defined (__TFG__VERSION__)
263  Bool_t selectVertex() { return StMuDst::instance()->selectVertex(); }
266 #else /* ! __TFG__VERSION__ */
267  Bool_t selectVertex();
271  Float_t mTpcVpdVzDiffCut;
272 #endif
273 
276  StMuDst* mMuDst;
277 
279  StPicoDst* mPicoDst;
280 
282  StEmcCollection* mEmcCollection;
284  StEmcPosition* mEmcPosition;
286  StEmcGeom* mEmcGeom[4];
288  StEmcRawHit* mEmcIndex[4800];
289 
291  Float_t mBField;
292 
293 #if !defined (__TFG__VERSION__)
294  PicoVtxMode mVtxMode;
296 #endif /* ! __TFG__VERSION__ */
297  PicoCovMtxMode mCovMtxMode;
300  PicoBEmcSmdMode mBEmcSmdMode;
301 
303  TString mInputFileName;
305  TString mOutputFileName;
307  TFile* mOutputFile;
308 
310  TChain* mChain;
312  TTree* mTTree;
313 
315  int mEventCounter;
316 
318  int mSplit;
320  int mCompression;
322  int mBufferSize;
323 
325  Int_t mModuleToQT[30][5];
327  Int_t mModuleToQTPos[30][5];
329  Int_t mQTtoModule[8][8];
331  Int_t mQTSlewBinEdge[8][16][8];
333  Int_t mQTSlewCorr[8][16][8];
334 
336  TClonesArray* mPicoArrays[StPicoArrays::NAllPicoArrays];
338  char mStatusArrays[StPicoArrays::NAllPicoArrays];
339 
341  StPicoFmsFiller mFmsFiller;
342 #if defined (__TFG__VERSION__)
343  static StPicoDstMaker *fgPicoDstMaker;
344 #endif
345 
347  virtual const char *GetCVS() const {
348  static const char cvs[]="Tag $Name: $ $Id: StPicoDstMaker.h,v 1.30 2021/02/23 17:27:01 gnigmat Exp $ built " __DATE__ " " __TIME__ ;
349  return cvs;
350  }
351 
352  ClassDef(StPicoDstMaker, 0)
353 };
354 
355 inline void StPicoDstMaker::setSplit(int split) { mSplit = split; }
356 inline void StPicoDstMaker::setCompression(int comp) { mCompression = comp; }
357 inline void StPicoDstMaker::setBufferSize(int buf) { mBufferSize = buf; }
358 
359 #endif
void setCompression(int comp=9)
virtual Int_t Finish()
Standard STAR Finish() function called from StChain.
Class that converts MuDst into PicoDst.
void printArrays()
Print pico arrays.
virtual Int_t Init()
Standard STAR Init() function called from StChain.
PicoBEmcSmdMode
Write or not write the BEmc SMD hits associated with a BHT2/3 trigger: 0-skip, 1-write.
virtual Int_t Make()
Standard STAR Make() function called from StChain.
virtual Int_t InitRun(Int_t const runnumber)
Init run.
TTree * tree()
Returns pointer to the current TTree, the top level io structure.
void SetStatus(char const *branchNameRegex, int enable)
Enables or disables branches matching a simple regex pattern in reading mode.
virtual ~StPicoDstMaker()
Destructor.
void setCovMtxMode(const PicoCovMtxMode covMtxMode)
Set to write or not to write covariant matrix.
void setBufferSize(int=65536 *4)
Sets the buffer size for all branches.
void setVtxMode(const PicoVtxMode vtxMode)
Set vertex selection mode.
void setSplit(int=99)
Main class that keeps TClonesArrays with main classes.
Definition: StPicoDst.h:40
StPicoDst * picoDst()
Returns null pointer if no StPicoDst.
StPicoDstMaker(char const *name="PicoDst")
Constructor.
PicoIoMode
Write/Read mode: 1-write, 2-read.
Stores global information about the event.
Definition: StPicoEvent.h:24
TChain * chain()
In read mode, returns pointer to the chain of .picoDst.root files.
virtual void Clear(Option_t *option="")
Clear.
Fills FMS information.
PicoCovMtxMode
Write or not write covariance matrix: 0-skip, 1-write.
void setBEmcSmdMode(const PicoBEmcSmdMode bemcSmdMode)
Set to write or not write BEmc Smd hits.