StFms  0.0.0
FMS software in the STAR framework
StMuDstMaker.cxx
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * $Id: StMuDstMaker.cxx,v 1.118 2013/12/04 19:56:32 jdb Exp $
4  * Author: Frank Laue, BNL, laue@bnl.gov
5  *
6  **************************************************************************/
7 #include "TRegexp.h"
8 #include "Stiostream.h"
9 #include "Stsstream.h"
10 #include "StChain.h"
11 #include "THack.h"
12 #include "StEvent/StEvent.h"
13 #include "StEvent/StTrack.h"
14 #include "StEvent/StTrackNode.h"
15 #include "StEvent/StRichSpectra.h"
16 #include "StEvent/StDetectorState.h"
17 #include "StEvent/StEventTypes.h"
18 #include "StEvent/StRunInfo.h"
19 #include "StEvent/StEventInfo.h"
20 #include "StEvent/StDcaGeometry.h"
21 #include "StEvent/StFgtCollection.h"
22 #include "StEvent/StFgtStrip.h"
23 #include "StEvent/StFgtHit.h"
24 #include "StEvent/StEnumerations.h"
25 #include "StFgtUtil/StFgtConsts.h"
26 #include "StEventUtilities/StuRefMult.hh"
27 #include "StEventUtilities/StuProbabilityPidAlgorithm.h"
28 
29 #include "StarClassLibrary/StPhysicalHelixD.hh"
30 #include "StarClassLibrary/StTimer.hh"
31 #include "StarClassLibrary/StMatrixF.hh"
32 
33 #include "StIOMaker/StIOMaker.h"
34 #include "StTreeMaker/StTreeMaker.h"
35 #ifndef __NO_STRANGE_MUDST__
36 #include "StStrangeMuDstMaker/StStrangeMuDstMaker.h"
37 #include "StStrangeMuDstMaker/StStrangeEvMuDst.hh"
38 #include "StStrangeMuDstMaker/StV0MuDst.hh"
39 #include "StStrangeMuDstMaker/StV0Mc.hh"
40 #include "StStrangeMuDstMaker/StXiMuDst.hh"
41 #include "StStrangeMuDstMaker/StXiMc.hh"
42 #include "StStrangeMuDstMaker/StKinkMuDst.hh"
43 #include "StStrangeMuDstMaker/StKinkMc.hh"
44 #include "StStrangeMuDstMaker/StStrangeCuts.hh"
45 #endif
46 
47 #include "StMuException.hh"
48 #include "StMuEvent.h"
49 #include "StMuPrimaryVertex.h"
50 #include "StMuRpsCollection.h"
51 #include "StMuMtdCollection.h"
52 #include "StMuMtdRawHit.h"
53 #include "StMuMtdHit.h"
54 #include "StMuMtdHeader.h"
55 #include "StMuTrack.h"
56 #include "StMuDebug.h"
57 #include "StMuCut.h"
58 #include "StMuFilter.h"
59 #include "StMuL3Filter.h"
60 #include "StMuChainMaker.h"
61 #include "StMuEmcCollection.h"
62 #include "StMuEmcUtil.h"
63 #include "StMuFmsCollection.h"
64 #include "StMuFmsUtil.h"
65 #include "StMuFmsHit.h"
66 #include "StMuFgtStrip.h"
67 #include "StMuFgtCluster.h"
68 #include "StMuFgtStripAssociation.h"
69 #include "StMuFgtAdc.h"
70 #include "StMuPmdCollection.h"
71 #include "StMuPmdUtil.h"
72 #include "StMuPmdHit.h"
73 #include "StMuPmdCluster.h"
74 #include "StMuTofHit.h"
75 #include "StMuTofHitCollection.h"
76 #include "StMuTofUtil.h"
78 #include "StEvent/StBTofCollection.h"
79 #include "StEvent/StBTofRawHit.h"
80 #include "StEvent/StBTofHeader.h"
81 #include "StMuBTofHit.h"
82 #include "StMuBTofHitCollection.h"
83 #include "StMuBTofUtil.h"
84 #include "StMuPrimaryTrackCovariance.h"
85 #include "StMuEzTree.h"
86 #include "EztEventHeader.h"
87 #include "EztEmcRawData.h"
88 #include "EztTrigBlob.h"
89 #include "EztFpdBlob.h"
90 
91 #include "StMuDstMaker.h"
92 #include "StMuDst.h"
93 
94 #include "TFile.h"
95 #include "TTree.h"
96 #include "TClass.h"
97 #include "TChain.h"
98 #include "TStreamerInfo.h"
99 #include "TClonesArray.h"
100 #include "TEventList.h"
101 
102 #include "THack.h"
103 #include "StMuMcVertex.h"
104 #include "StMuMcTrack.h"
105 #include "StG2TrackVertexMap.h"
106 
108 
109 #if !(ST_NO_NAMESPACES)
110  using namespace units;
111 #endif
112 
113 //-----------------------------------------------------------------------
114 //-----------------------------------------------------------------------
115 //-----------------------------------------------------------------------
125 StMuDstMaker::StMuDstMaker(const char* name) : StIOInterFace(name),
126  mStEvent(0), mStMuDst(0),
127 #ifndef __NO_STRANGE_MUDST__
128  mStStrangeMuDstMaker(0),
129 #endif
130  mIOMaker(0), mTreeMaker(0),
131  mIoMode(1), mIoNameMode((int)ioTreeMaker), mEventList(0),
132  mTrackType(256), mReadTracks(1),
133  mReadV0s(1), mReadXis(1), mReadKinks(1), mFinish(0),
134  mTrackFilter(0), mL3TrackFilter(0),
135  mCurrentFile(0),
136  mChain (0), mTTree(0),
137  mSplit(99), mCompression(9), mBufferSize(65536*4), mVtxList(100),
138  mProbabilityPidAlgorithm(0), mEmcCollectionArray(0), mEmcCollection(0),
139  mFmsCollection(0), mPmdCollectionArray(0), mPmdCollection(0)
140 
141 {
142  assignArrays();
143 
144  mDirName="./";
145  mFileName="";
146  streamerOff();
147  zeroArrays();
148  if (mIoMode==ioRead) openRead();
149  if (mIoMode==ioWrite) mProbabilityPidAlgorithm = new StuProbabilityPidAlgorithm();
150 
151  mEventCounter=0;
152  mStMuDst = new StMuDst();
153  mEmcUtil = new StMuEmcUtil();
154  mFmsUtil = new StMuFmsUtil();
155  mPmdUtil = new StMuPmdUtil();
156  mTofUtil = new StMuTofUtil();
157  mBTofUtil = new StMuBTofUtil();
158  mEzTree = new StMuEzTree();
159  if ( ! mStMuDst || ! mEmcUtil || ! mFmsUtil || ! mPmdUtil || ! mTofUtil || ! mBTofUtil || ! mEzTree )
160  throw StMuExceptionNullPointer("StMuDstMaker:: constructor. Something went horribly wrong, cannot allocate pointers",__PRETTYF__);
161 
162 
163  createArrays();
164 
165 
167  StMuL3Filter* l3Filter = new StMuL3Filter(); setL3TrackFilter(l3Filter);
168  StMuFilter* filter = new StMuFilter(); setTrackFilter(filter);
169  FORCEDDEBUGMESSAGE("ATTENTION: use standard MuFilter");
170  FORCEDDEBUGMESSAGE("ATTENTION: use standard l3 MuFilter");
171 
172 
173 }
174 
183 {
184  mArrays = mAArrays + 0;
185 #ifndef __NO_STRANGE_MUDST__
188 #else
190 #endif
199 }
200 
202 {
203  const int ezIndex=__NARRAYS__+
204 #ifndef __NO_STRANGE_MUDST__
206 #endif
211 
212  for ( int i=0; i<ezIndex; i++) {
213  mAArrays[i]->Clear();
215  }
216  // ezTree classes need Delete, because of TArrayS
217  for ( int i=ezIndex; i<__NALLARRAYS__; i++) {
218  mAArrays[i]->Delete();
220  }
221 }
222 
224 {
225  memset(mAArrays,0,sizeof(void*)*__NALLARRAYS__);
226  memset(mStatusArrays,(char)1,sizeof(mStatusArrays) ); //default all ON
227  // ezt arrays switched off
228  memset(&mStatusArrays[__NARRAYS__+
229 #ifndef __NO_STRANGE_MUDST__
231 #endif
236 
237 }
238 //-----------------------------------------------------------------------
239 //-----------------------------------------------------------------------
240 //-----------------------------------------------------------------------
269 void StMuDstMaker::SetStatus(const char *arrType,int status)
270 {
271 #ifndef __NO_STRANGE_MUDST__
272  static const char *specNames[]={"MuEventAll","StrangeAll","MCAll" ,"EmcAll","PmdAll","FMSAll","TofAll","BTofAll","MTDAll","FgtAll","EztAll",0};
273 #else
274  static const char *specNames[]={"MuEventAll","MCAll" ,"EmcAll","PmdAll","FMSAll","TofAll","BTofAll","MTDAll","FgtAll","EztAll",0};
275 #endif
276  static const int specIndex[]={
277  0,
278  __NARRAYS__,
279 #ifndef __NO_STRANGE_MUDST__
281  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__,
282  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__,
283  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__,
284  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__,
285  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__,
286  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__,
287  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__,
288  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__,
289  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__+__NFGTARRAYS__,
290  __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__+__NFGTARRAYS__,__NEZTARRAYS__,
291 #else
293  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__,
294  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__,
295  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__,
296  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__,
297  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__,
298  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__,
299  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__,
300  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__+__NFGTARRAYS__,
301  __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__+__NFGTARRAYS__+__NEZTARRAYS__,
302 #endif
303  -1};
304 
305  if (strncmp(arrType,"St",2)==0) arrType+=2; //Ignore first "St"
306  for (int i=0;specNames[i];i++) {
307  if (strcmp(arrType,specNames[i])) continue;
308  char *sta=mStatusArrays+specIndex[i];
309  int num=specIndex[i+1]-specIndex[i];
310  memset(sta,status,num);
311  LOG_INFO << "StMuDstMaker::SetStatus " << status << " to " << specNames[i] << endm;
312  if (mIoMode==ioRead)
314  return;
315  }
316 
317  TRegexp re(arrType,1);
318  for (int i=0;i<__NALLARRAYS__;i++) {
319  Ssiz_t len;
320  if (re.Index(StMuArrays::arrayNames[i],&len) < 0) continue;
321  LOG_INFO << "StMuDstMaker::SetStatus " << status << " to " << StMuArrays::arrayNames[i] << endm;
322  mStatusArrays[i]=status;
323  }
324  if (mIoMode==ioRead)
326 }
327 //-----------------------------------------------------------------------
328 //-----------------------------------------------------------------------
329 //-----------------------------------------------------------------------
330 StMuDstMaker::StMuDstMaker(int mode, int nameMode, const char* dirName, const char* fileName, const char* filter, int maxFiles, const char* name) :
331  StIOInterFace(name),
332  mStEvent(0), mStMuDst(0),
333 #ifndef __NO_STRANGE_MUDST__
334  mStStrangeMuDstMaker(0),
335 #endif
336  mIOMaker(0), mTreeMaker(0),
337  mIoMode(mode), mIoNameMode(nameMode),
338  mDirName(dirName), mFileName(fileName), mFilter(filter),
339  mMaxFiles(maxFiles), mEventList(0),
340  mTrackType(256), mReadTracks(1),
341  mReadV0s(1), mReadXis(1), mReadKinks(1), mFinish(0),
342  mTrackFilter(0), mL3TrackFilter(0), mCurrentFile(0),
343  mSplit(99), mCompression(9), mBufferSize(65536*4),
344  mProbabilityPidAlgorithm(0), mEmcCollectionArray(0), mEmcCollection(0),
345 mFmsCollection(0), mPmdCollectionArray(0), mPmdCollection(0)
346 {
347  assignArrays();
348  streamerOff();
349  zeroArrays();
350  createArrays();
351  if (mIoMode==ioRead) openRead();
352  if (mIoMode==ioWrite) mProbabilityPidAlgorithm = new StuProbabilityPidAlgorithm();
353 
355 
356  mEventCounter=0;
357  mStMuDst = new StMuDst();
358  mEmcUtil = new StMuEmcUtil();
359  mFmsUtil = new StMuFmsUtil();
360  mPmdUtil = new StMuPmdUtil();
361  mTofUtil = new StMuTofUtil();
362  mBTofUtil= new StMuBTofUtil();
363  mEzTree = new StMuEzTree();
364 }
365 //-----------------------------------------------------------------------
366 //-----------------------------------------------------------------------
367 //-----------------------------------------------------------------------
368 /*StMuDstMaker::StMuDstMaker(int mode, int nameMode, const char* dirName, int year) : StIOInterFace("MuDst"),
369  mStEvent(0), mStMuDst(0), mStStrangeMuDstMaker(0),
370  mIOMaker(0), mTreeMaker(0),
371  mIoMode(mode), mIoNameMode(nameMode),
372  mDirName(dirName), mFileName(""), mFilter("."),
373  mMaxFiles(10), mEventList(0),
374  mTrackType(256), mReadTracks(1),
375  mReadV0s(1), mReadXis(1), mReadKinks(1), mFinish(0),
376  mTrackFilter(0), mL3TrackFilter(0), mCurrentFile(0),
377  mSplit(99), mCompression(9), mBufferSize(65536*4),mStTriggerYear(year),
378  mProbabilityPidAlgorithm(0), mEmcCollectionArray(0), mEmcCollection(0),
379 mFmsCollection(0), mPmdCollectionArray(0), mPmdCollection(0)
380 {
381  assignArrays();
382  streamerOff();
383  zeroArrays();
384  createArrays();
385  if (mIoMode==ioRead) openRead();
386  if (mIoMode==ioWrite) mProbabilityPidAlgorithm = new StuProbabilityPidAlgorithm();
387 
388  setProbabilityPidFile();
389 
390  mEventCounter=0;
391  mStMuDst = new StMuDst();
392  mEmcUtil = new StMuEmcUtil();
393  mFmsUtil = new StMuFmsUtil();
394  mPmdUtil = new StMuPmdUtil();
395  mTofUtil = new StMuTofUtil();
396  mBTofUtil= new StMuBTofUtil(); /// dongx
397  mEzTree = new StMuEzTree();
398 }*/
399 //-----------------------------------------------------------------------
400 //-----------------------------------------------------------------------
401 //-----------------------------------------------------------------------
403  DEBUGMESSAGE1("");
404  //clear(999);
405  if (mStMuDst && mStMuDst->TestBit(kCanDelete)) SafeDelete(mStMuDst);
406  SafeDelete(mTofUtil);
407  SafeDelete(mBTofUtil);
408  DEBUGMESSAGE3("after arrays");
412  DEBUGMESSAGE3("after filter");
413  if (mIoMode== ioWrite ) closeWrite();
414  if (mIoMode== ioRead ) closeRead();
415  DEBUGMESSAGE3("after close");
417 //VP saveDelete(mTTree);
418  SafeDelete(mEmcCollectionArray);
419  SafeDelete(mPmdCollectionArray);
420  DEBUGMESSAGE3("out");
421 }
422 //-----------------------------------------------------------------------
423 //-----------------------------------------------------------------------
424 //-----------------------------------------------------------------------
430  StMuEvent::Class()->IgnoreTObjectStreamer();
431  StMuL3EventSummary::Class()->IgnoreTObjectStreamer();
432 #ifndef __NO_STRANGE_MUDST__
433  StStrangeMuDst::Class()->IgnoreTObjectStreamer();
434  StV0MuDst::Class()->IgnoreTObjectStreamer();
435  StXiMuDst::Class()->IgnoreTObjectStreamer();
436  StKinkMuDst::Class()->IgnoreTObjectStreamer();
437  StV0Mc::Class()->IgnoreTObjectStreamer();
438  StXiMc::Class()->IgnoreTObjectStreamer();
439  StKinkMc::Class()->IgnoreTObjectStreamer();
440 #endif
441  StMuMcVertex::Class()->IgnoreTObjectStreamer();
442  StMuMcTrack::Class()->IgnoreTObjectStreamer();
443  StMuTrack::Class()->IgnoreTObjectStreamer();
444  StMuPrimaryVertex::Class()->IgnoreTObjectStreamer();
445  // StDcaGeometry::Class()->IgnoreTObjectStreamer();
446  StMuPrimaryTrackCovariance::Class()->IgnoreTObjectStreamer();
447  StMuHelix::Class()->IgnoreTObjectStreamer();
448  StMuEmcHit::Class()->IgnoreTObjectStreamer();
449  StMuEmcTowerData::Class()->IgnoreTObjectStreamer();
450  StMuPmdHit::Class()->IgnoreTObjectStreamer();
451  StMuPmdCluster::Class()->IgnoreTObjectStreamer();
452  EztEventHeader::Class()->IgnoreTObjectStreamer();
453  EztTrigBlob::Class()->IgnoreTObjectStreamer();
454  EztFpdBlob::Class()->IgnoreTObjectStreamer();
455  EztEmcRawData::Class()->IgnoreTObjectStreamer();
456  StMuFgtStrip::Class()->IgnoreTObjectStreamer();
457  StMuFgtCluster::Class()->IgnoreTObjectStreamer();
458  StMuFgtStripAssociation::Class()->IgnoreTObjectStreamer();
459  StMuFgtAdc::Class()->IgnoreTObjectStreamer();
460 }
461 //-----------------------------------------------------------------------
462 //-----------------------------------------------------------------------
463 //-----------------------------------------------------------------------
466  for ( int i=0; i<__NALLARRAYS__; i++) {
467  DEBUGVALUE2(mAArrays[i]);
469  DEBUGVALUE2(mAArrays[i]);
470  }
471  mStMuDst->set(this);
472  // commented to include tof again (subhasis)
473  // mStMuDst->set(mArrays,mStrangeArrays,mEmcArrays,mPmdArrays);
474 }
475 //-----------------------------------------------------------------------
476 //-----------------------------------------------------------------------
477 //-----------------------------------------------------------------------
478 TClonesArray* StMuDstMaker::clonesArray(TClonesArray*& p, const char* type, int size, int& counter) {
479  DEBUGMESSAGE2("");
480  if (p) return p;
481  DEBUGVALUE2(type);
482  p = new TClonesArray(type, size);
483  counter=0;
484  return p;
485 }
486 //-----------------------------------------------------------------------
487 //-----------------------------------------------------------------------
488 //-----------------------------------------------------------------------
498  DEBUGMESSAGE2("");
499  mIOMaker = (StIOMaker*)GetMaker("IOMaker");
500  mTreeMaker = (StTreeMaker*)GetMaker("outputStream");
501 #ifndef __NO_STRANGE_MUDST__
502  mStStrangeMuDstMaker = (StStrangeMuDstMaker*)GetMaker("strangeMuDst");
503 #endif
504  TDataSet *muDstSet = AddObj(mStMuDst,".const");
505  if (muDstSet ) muDstSet ->SetName("muDst");
506 
507  return 0;
508 }
509 //-----------------------------------------------------------------------
510 //-----------------------------------------------------------------------
511 //-----------------------------------------------------------------------
512 void StMuDstMaker::Clear(const char *){
513  DEBUGMESSAGE2("");
514  // We need to clear the StMuFmsCluster array even when reading events, in
515  // order to clear the TRefArrays of hits and photons it holds. Otherwise
516  // the references from the previous event may be re-used.
517  const int fmsClusterIndex = __NARRAYS__ +
518 #ifndef __NO_STRANGE_MUDST__
520 #endif
521  // FMS arrays follow PMD arrays. Hits = 0th, clusters = 1st, photons = 2nd
523  mAArrays[fmsClusterIndex]->Clear("C"); // "C" calls StMuFmsCluster::Clear
524  if (mIoMode==ioRead)
525  return;
526  clearArrays();
527  if(mStMuDst->event()) mStMuDst->event()->fmsTriggerDetector().clearFlag(); //Clear flag for every event
528 
529  DEBUGMESSAGE3("out");
530 }
531 //-----------------------------------------------------------------------
532 //-----------------------------------------------------------------------
533 //-----------------------------------------------------------------------
541 
542  DEBUGMESSAGE2("");
543  int returnStarCode = kStOK;
544  StTimer timer;
545  timer.start();
546  if (mIoMode == ioWrite) returnStarCode = MakeWrite();
547  else if (mIoMode == ioRead) returnStarCode = MakeRead();
548  DEBUGVALUE2(timer.elapsedTime());
549  return returnStarCode;
550 
551 
552 }
553 //-----------------------------------------------------------------------
554 //-----------------------------------------------------------------------
555 //-----------------------------------------------------------------------
556 Int_t StMuDstMaker::MakeRead(const StUKey &RunEvent)
557 {
558  return MakeRead();
559 }
560 //-----------------------------------------------------------------------
561 //-----------------------------------------------------------------------
562 //-----------------------------------------------------------------------
564 {
565  int returnStarCode = kStOK;
566  if (mIoMode == ioRead) {
567  try {
568  read();
569  }
570  catch(StMuExceptionEOF e) {
571  e.print();
572  returnStarCode = kStEOF;
573  }
574  catch(StMuException e) {
575  e.print();
576  returnStarCode = kStERR;
577  }
578  }
579  return returnStarCode;
580 }
581 
582 //-----------------------------------------------------------------------
583 //-----------------------------------------------------------------------
584 //-----------------------------------------------------------------------
586  int returnStarCode = kStOK;
587  if (mIoMode == ioWrite) {
588  try {
589  write();
590  }
591  catch(StMuExceptionEOF e) {
592  e.print();
593  returnStarCode = kStEOF;
594  }
595  catch(StMuException e) {
596  e.print();
597  returnStarCode = kStERR;
598  }
599  }
600  return returnStarCode;
601 }
602 //-----------------------------------------------------------------------
603 //-----------------------------------------------------------------------
604 //-----------------------------------------------------------------------
606  DEBUGMESSAGE2("");
607  mStEvent = (StEvent*) GetInputDS("StEvent");
608  if (!mStEvent) {
609  DEBUGMESSAGE2("no StEvent");
610  throw StMuExceptionNullPointer("no StEvent",__PRETTYF__);
611  }
615  mProbabilityPidAlgorithm = new StuProbabilityPidAlgorithm(*mStEvent);
616  StMuTrack::setProbabilityPidAlgorithm(mProbabilityPidAlgorithm);
617  StMuTrack::setProbabilityPidCentrality(uncorrectedNumberOfNegativePrimaries(*mStEvent));
618  try {
620  }
621  catch(StMuException e) {
622  e.print();
623  throw e;
624  }
625 }
626 //-----------------------------------------------------------------------
627 //-----------------------------------------------------------------------
628 //-----------------------------------------------------------------------
630  DEBUGMESSAGE2("");
631  try {
632  fill();
633  }
634  catch (StMuException e) {
635  e.print();
636  return;
637  }
638 
639  string ioMakerFileName;
640  string theFileName("/dev/null");
641  DEBUGVALUE2(mIoNameMode);
642  switch (mIoNameMode) {
643  case ioFix:
644  DEBUGMESSAGE2("===> ioFix\n");
645  theFileName = buildFileName( mDirName+"/", basename(mFileName),".MuDst.root");
646  break;
647  case ioIOMaker:
648  DEBUGMESSAGE2("===> ioIOMaker\n");
649  ioMakerFileName = string(mIOMaker->GetFile());
650  DEBUGVALUE2(ioMakerFileName);
651  theFileName = buildFileName( mDirName+"/", basename(ioMakerFileName),".MuDst.root");
652  break;
653  case ioTreeMaker:
654  // ioMakerFileName = mTreeMaker->GetTree()->GetBaseName();
655  ioMakerFileName = mTreeMaker->GetTree()->GetBaseName();
656  theFileName = buildFileName(dirname(ioMakerFileName),basename(ioMakerFileName),".MuDst.root");
657  break;
658  default:
659  DEBUGMESSAGE("do not know where to get the filename from");
660  }
661 
662  DEBUGVALUE2(theFileName.c_str());
663 
664  if (theFileName != mCurrentFileName) {
665  closeWrite();
666  openWrite(theFileName);
667  mCurrentFileName = theFileName;
668  }
669 
670  DEBUGMESSAGE2("now fill tree");
671  mTTree->Fill(); THack::IsTreeWritable(mTTree);
672  DEBUGMESSAGE2("tree filled");
673 
674  return;
675 }
676 //-----------------------------------------------------------------------
677 //-----------------------------------------------------------------------
678 //-----------------------------------------------------------------------
680  DEBUGMESSAGE2("");
681  if (mFinish) {
682  for ( int i=0; i<10; i++) {
683  LOG_INFO << "why are you calling the Finish() again ???????" << endl;
684  LOG_INFO << "are you the stupid chain destructor ???????????" << endl;
685  }
686  }
687  else {
688  if (mIoMode== ioWrite ) closeWrite();
689  if (mIoMode== ioRead ) closeRead();
690  mFinish = true;
691  }
692  DEBUGMESSAGE3("out");
693  return 0;
694 }
695 //-----------------------------------------------------------------------
696 const char* StMuDstMaker::GetFile() const {
697  if (mIoMode== ioWrite ) return mCurrentFileName.c_str();
698  if (mIoMode== ioRead && mChain && mChain->GetFile())
699  return mChain->GetFile()->GetName();
700  return 0;
701 }
702 //-----------------------------------------------------------------------
703 //-----------------------------------------------------------------------
706 }
707 
708 void StMuDstMaker::setBranchAddresses(TChain* chain) {
709  // all stuff
710  if (!chain) return;
711  chain->SetBranchStatus("*",0);
712  TString ts;
713  Int_t emc_oldformat=0;
714  Int_t pmd_oldformat=0;
715  chain->BranchRef(); // Activate autoloading of TRef-referenced objects
716  for ( int i=0; i<__NALLARRAYS__; i++) {
717  if (mStatusArrays[i]==0) continue;
718  const char *bname=StMuArrays::arrayNames[i];
719  TBranch *tb = chain->GetBranch(bname);
720  if(!tb) {
721 #ifndef __NO_STRANGE_MUDST__
724  emc_oldformat=1;
725  continue;
726  }
727 
730  pmd_oldformat=1;
731  continue;
732  }
733 #else
734  if (i >= __NARRAYS__+__NMCARRAYS__ &&
736  emc_oldformat=1;
737  continue;
738  }
739 
742  pmd_oldformat=1;
743  continue;
744  }
745 #endif
746  Warning("setBranchAddresses","Branch name %s does not exist",bname);
747  continue;
748  }
749  ts = bname; ts +="*";
750  chain->SetBranchStatus (ts,1);
751  if (strstr("MuEvent",bname) && mChain->GetBranch("MuEvent.mQA.fX")) {
752  // Need to manually switch off Q-vector branches to avoid root warnings
753  // Note: the Q-vectors are only present in SL07b
754  mChain->SetBranchStatus("MuEvent.mQA*",0);
755  mChain->SetBranchStatus("MuEvent.mQB*",0);
756  mChain->SetBranchStatus("MuEvent.mQNegEastA*",0);
757  mChain->SetBranchStatus("MuEvent.mQNegEastB*",0);
758  mChain->SetBranchStatus("MuEvent.mQPosEastA*",0);
759  mChain->SetBranchStatus("MuEvent.mQPosEastB*",0);
760  mChain->SetBranchStatus("MuEvent.mQNegWestA*",0);
761  mChain->SetBranchStatus("MuEvent.mQNegWestB*",0);
762  mChain->SetBranchStatus("MuEvent.mQPosWestA*",0);
763  mChain->SetBranchStatus("MuEvent.mQPosWestB*",0);
764  }
765  chain->SetBranchAddress(bname,mAArrays+i);
766  assert(tb->GetAddress() == (char*)(mAArrays+i));
767  }
768  if (emc_oldformat) {
769  TBranch *branch=chain->GetBranch("EmcCollection");
770  if (branch) {
771  Warning("setBranchAddresses","Using backward compatibility mode for EMC");
772  if (!mEmcCollectionArray) {
773  mEmcCollectionArray=new TClonesArray("StMuEmcCollection",1);
774  }
775  chain->SetBranchStatus("EmcCollection*",1);
776  chain->SetBranchAddress("EmcCollection",&mEmcCollectionArray);
777  StMuEmcHit::Class()->IgnoreTObjectStreamer(0);
778  mStMuDst->set(this);
779  }
780  }
781  else if (!mEmcCollection) {
782  mEmcCollection=new StMuEmcCollection();
784  mStMuDst->set(this);
785  }
786 
787  if (!mFmsCollection) {
790  mStMuDst->set(this);
791  }
792 
793  if (pmd_oldformat) {
794  TBranch *branch=chain->GetBranch("PmdCollection");
795  if (branch) {
796  Warning("setBranchAddresses","Using backward compatibility mode for PMD");
797  if (!mPmdCollectionArray) {
798  mPmdCollectionArray=new TClonesArray("StMuPmdCollection",1);
799  }
800  chain->SetBranchStatus("PmdCollection*",1);
801  chain->SetBranchAddress("PmdCollection",&mPmdCollectionArray);
802  StMuPmdCluster::Class()->IgnoreTObjectStreamer(0);
803  mStMuDst->set(this);
804  }
805  }
806  else if (!mPmdCollection) {
807  mPmdCollection=new StMuPmdCollection();
809  mStMuDst->set(this);
810  }
811  mTTree = mChain->GetTree();
812 }
813 //-----------------------------------------------------------------------
814 //-----------------------------------------------------------------------
815 //-----------------------------------------------------------------------
817  DEBUGVALUE2(mDirName.c_str());
818  DEBUGVALUE2(mFileName.c_str());
819  DEBUGVALUE2(mFilter.c_str());
820 
821  StMuChainMaker chainMaker("MuDst");
822  mChain = chainMaker.make(mDirName, mFileName, mFilter, mMaxFiles);
823 
824  if (mChain){
825  DEBUGVALUE3(mChain);
827 
828  mStMuDst->set(this);
829  }
830 
831  return 0;
832 }
833 //-----------------------------------------------------------------------
834 //-----------------------------------------------------------------------
835 //-----------------------------------------------------------------------
837  if (!mChain){
838  DEBUGMESSAGE2("ATTENTION: No StMuChain ... results won't be exciting (nothing to do)");
839  throw StMuExceptionNullPointer("No input files",__PRETTYF__);
840  return;
841  }
842 
843  DEBUGMESSAGE2("");
844  if (mChain->GetCurrentFile()) {
845  DEBUGVALUE2(mChain->GetCurrentFile()->GetName());
846  }
847 
848  if ( !mEventList ) {
849  int bytes = mChain->GetEntry(mEventCounter++);
850  while (bytes<=0 ) {
851  DEBUGVALUE3(mEventCounter);
852  if ( mEventCounter >= mChain->GetEntriesFast() ) throw StMuExceptionEOF("end of input",__PRETTYF__);
853  bytes = mChain->GetEntry(mEventCounter++);
854  DEBUGVALUE3(bytes);
855  }
856  }
857  else {
858  int bytes = mChain->GetEntry( mEventList->GetEntry( mEventCounter++ ) );
859  while ( bytes<=0 ) {
860  DEBUGVALUE3(mEventCounter);
861  if ( mEventCounter >= mEventList->GetN() ) throw StMuExceptionEOF("end of event list",__PRETTYF__);
862  bytes = mChain->GetEntry( mEventList->GetEntry( mEventCounter++ ) );
863  DEBUGVALUE3(bytes);
864  }
865  }
866  if (GetDebug()>1) printArrays();
867  mStMuDst->set(this);
868  fillHddr();
869  mStMuDst->setVertexIndex(0);
870  mStMuDst->collectVertexTracks(); // Make temp list of tracks for current prim vtx
871  return;
872 }
873 //-----------------------------------------------------------------------
874 //-----------------------------------------------------------------------
875 //-----------------------------------------------------------------------
877  DEBUGMESSAGE2("");
878  if (mChain) mChain->Delete();
879  mChain = 0;
880  }
881 //-----------------------------------------------------------------------
882 //-----------------------------------------------------------------------
883 //-----------------------------------------------------------------------
884 void StMuDstMaker::openWrite(string fileName) {
885  DEBUGVALUE2(fileName.c_str());
886  // creat a Picoevent and and output file
887  DEBUGMESSAGE2("now create file");
888  mCurrentFile = new TFile(fileName.c_str(),"RECREATE","StMuDst");
889 
890  if (mCurrentFile->IsZombie()) throw StMuExceptionNullPointer("no file openend",__PRETTYF__);
891 
892  mCurrentFile->SetCompressionLevel(mCompression);
893 
894  // Create a ROOT Tree and one superbranch
895  DEBUGMESSAGE2("now create trees and branches");
896 
897  TBranch* branch;
898  int bufsize = mBufferSize;
899  if (mSplit) bufsize /= 4;
900  // all stuff
901  mTTree = new TTree("MuDst", "StMuDst",mSplit);
902  mTTree->BranchRef(); // Activate autoloading of TRef-referenced objects
903 #if ROOT_VERSION_CODE < ROOT_VERSION(5,26,0)
904  Long64_t MAXLONG=100000000000LL; // 100 GB
905  LOG_INFO << "Tree size MAX will be " << (float) MAXLONG/1000/1000/1000 << " GB " << endm;
906  mTTree->SetMaxTreeSize(MAXLONG); // limited to 1.9 GB - set to maximum
907 #endif
908  // mTTree->SetAutoSave(1000000); // autosave when 1 Mbyte written
909  DEBUGMESSAGE2("all arrays");
910  for ( int i=0; i<__NALLARRAYS__; i++) {
911  if (mStatusArrays[i]==0) continue;
912  branch = mTTree->Branch(StMuArrays::arrayNames[i],&mAArrays[i], bufsize, mSplit);
913  }
914  mCurrentFileName = fileName;
915 }
916 //-----------------------------------------------------------------------
917 //-----------------------------------------------------------------------
918 //-----------------------------------------------------------------------
920  DEBUGMESSAGE(__PRETTYF__);
921  if (mTTree && mCurrentFile) {
922  LOG_INFO << " ##### " << __PRETTYF__ << endm;
923  LOG_INFO << " ##### File=" << mCurrentFile->GetName() << " ";
924  LOG_INFO << " NumberOfEvents= " << mTTree->GetEntries() << " ";
925  LOG_INFO << " ##### " << endm;
926  }
927  //if (mTTree) mTTree->AutoSave();
928 
929  if (mCurrentFile) {
930  mCurrentFile->Write();
931  mCurrentFile->Close();
932  }
933  mTTree = 0;
934  mCurrentFile = 0;
935 }
936 //-----------------------------------------------------------------------
937 //-----------------------------------------------------------------------
938 //-----------------------------------------------------------------------
939 void StMuDstMaker::fillTrees(StEvent* ev, StMuCut* cut){
940 
941  DEBUGMESSAGE2("");
942  try {
943  fillMC();
944  }
945  catch(StMuException e) {
946  e.print();
947  throw e;
948  }
949 
950  try {
951  fillEvent(ev);
953  fillDetectorStates(ev);
954  fillEmc(ev);
955  fillPmd(ev);
956  fillFms(ev);
957  fillTof(ev);
958  fillBTof(ev);
959  fillMtd(ev);
960  fillFgt(ev);
961  fillEzt(ev);
962  }
963  catch(StMuException e) {
964  e.print();
965  throw e;
966  }
967 
968  try {
969  fillVertices(ev);
970  }
971  catch(StMuException e) {
972  e.print();
973  throw e;
974  }
975 
976  try {
977  fillpp2pp(ev);
978  }
979  catch(StMuException e) {
980  e.print();
981  throw e;
982  }
983 
984  try {
986  }
987  catch(StMuException e) {
988  e.print();
989  throw e;
990  }
991 
992  try {
994  }
995  catch(StMuException e) {
996  e.print();
997  throw e;
998  }
999 
1000 #ifndef __NO_STRANGE_MUDST__
1001  if (mStStrangeMuDstMaker) {
1002  try {
1004  }
1005  catch(StMuException e) {
1006  e.print();
1007  throw e;
1008  }
1009  }
1010 #endif
1011 
1012  //catch(StMuException e) {
1013  // e.print();
1014  // throw e;
1015  //}
1016 
1017  mStMuDst->set(this);
1018  mStMuDst->fixTofTrackIndices();
1019  mStMuDst->fixMtdTrackIndices();
1020  mStMuDst->fixTrackIndicesG(mStMuDst->numberOfPrimaryVertices());
1021 }
1022 
1023 
1024 
1025 //-----------------------------------------------------------------------
1026 //-----------------------------------------------------------------------
1027 //-----------------------------------------------------------------------
1028 void StMuDstMaker::fillEvent(StEvent* ev, StMuCut* cut) {
1029  DEBUGMESSAGE2("");
1030  StMuEvent *typeOfEvent=0;
1031  if (!ev) throw StMuExceptionNullPointer("no StEvent",__PRETTYF__);
1032  StTimer timer;
1033  timer.start();
1034  if (!cut || cut->pass(ev)) {
1035  DEBUGMESSAGE3("");
1036  addType(mArrays[muEvent],ev,typeOfEvent);
1037  }
1038  timer.stop();
1039  DEBUGVALUE2(timer.elapsedTime());
1040 }
1041 //-----------------------------------------------------------------------
1042 //-----------------------------------------------------------------------
1043 //-----------------------------------------------------------------------
1044 void StMuDstMaker::fillEmc(StEvent* ev) {
1045  DEBUGMESSAGE2("");
1046  StEmcCollection* emccol=(StEmcCollection*)ev->emcCollection();
1047  if (!emccol) return; //throw StMuExceptionNullPointer("no StEmcCollection",__PRETTYF__);
1048  StTimer timer;
1049  timer.start();
1050 
1051  TClonesArray *tca = mEmcArrays[muEmcTow];
1052  new((*tca)[0]) StMuEmcTowerData();
1053  if (!mEmcCollection) {
1054  mEmcCollection=new StMuEmcCollection();
1056  mStMuDst->set(this);
1057  }
1058  mEmcUtil->fillMuEmc(mEmcCollection,emccol);
1059 
1060  timer.stop();
1061  DEBUGVALUE2(timer.elapsedTime());
1062 }
1063 //-----------------------------------------------------------------------
1064 //-----------------------------------------------------------------------
1065 void StMuDstMaker::fillFms(StEvent* ev) {
1066  DEBUGMESSAGE2("");
1067  StFmsCollection* fmscol=(StFmsCollection*)ev->fmsCollection();
1068  if (!fmscol) return; //throw StMuExceptionNullPointer("no StFmsCollection",__PRETTYF__);
1069  StTimer timer;
1070  timer.start();
1071 
1072  if (!mFmsCollection) {
1075  mStMuDst->set(this);
1076  }
1077  LOG_DEBUG << "StMuDSTMaker filling StMuFmsCollection from StEvent" << endm;
1079 
1080  timer.stop();
1081  DEBUGVALUE2(timer.elapsedTime());
1082 }
1083 //-----------------------------------------------------------------------
1084 //-----------------------------------------------------------------------
1085 void StMuDstMaker::fillPmd(StEvent* ev) {
1086  DEBUGMESSAGE2("");
1087  StPhmdCollection* phmdColl=(StPhmdCollection*)ev->phmdCollection();
1088  if (!phmdColl) return; //throw StMuExceptionNullPointer("no StPhmdCollection",__PRETTYF__);
1089  StTimer timer;
1090  timer.start();
1091 
1092  if (!mPmdCollection) {
1093  mPmdCollection=new StMuPmdCollection();
1095  mStMuDst->set(this);
1096  }
1097  mPmdUtil->fillMuPmd(phmdColl,mPmdCollection);
1098 
1099  timer.stop();
1100  DEBUGVALUE2(timer.elapsedTime());
1101 }
1102 
1103 //-----------------------------------------------------------------------
1104 //-----------------------------------------------------------------------
1105 
1106 void StMuDstMaker::fillTof(StEvent* ev) {
1107  DEBUGMESSAGE2("");
1108  StTofCollection *tofcol = ev->tofCollection();
1109  // run 5 - dongx
1110  if( !ev || !tofcol || (!tofcol->dataPresent()&&!tofcol->rawdataPresent()) )
1111  return; //throw StMuExceptionNullPointer("no StTofDataCollection",__PRETTYF__);
1112  StTimer timer;
1113  timer.start();
1114 
1115  // fill tofHit
1116  StMuTofHitCollection muTofHitColl;
1117  mTofUtil->fillMuTofHit(&muTofHitColl, tofcol);
1118  for(size_t i=0; i < muTofHitColl.size(); i++) {
1119  StMuTofHit* tofMuHit = (StMuTofHit *)muTofHitColl.getHit(i);
1120  addType( mTofArrays[muTofHit], *tofMuHit );
1121  }
1122 
1123  // fill tofData
1124  StSPtrVecTofData &tofData = tofcol->tofData();
1125  for(size_t i=0; i < tofData.size(); i++) {
1126  addType( mTofArrays[muTofData], *tofData[i] );
1127  }
1128 
1129  // run 5 - dongx
1130  // fill tofRawData
1131  StSPtrVecTofRawData &tofRawData = tofcol->tofRawData();
1132  for(size_t i=0; i < tofRawData.size(); i++) {
1133  addType( mTofArrays[muTofRawData], *tofRawData[i] );
1134  }
1135 
1136  timer.stop();
1137  DEBUGVALUE2(timer.elapsedTime());
1138 }
1139 //-----------------------------------------------------------------------
1140 //-----------------------------------------------------------------------
1141 //-----------------------------------------------------------------------
1143 void StMuDstMaker::fillBTof(StEvent* ev) {
1144  DEBUGMESSAGE2("");
1145  StBTofCollection *btofcol = ev->btofCollection();
1146  if( !ev || !btofcol || !btofcol->rawHitsPresent() )
1147  return; //throw StMuExceptionNullPointer("no StBTofRawHitCollection",__PRETTYF__);
1148  StTimer timer;
1149  timer.start();
1150 
1151  // fill btofHit
1152  StMuBTofHitCollection muBTofHitColl;
1153  mBTofUtil->fillMuBTofHit(&muBTofHitColl, btofcol);
1154  for(size_t i=0; i < muBTofHitColl.size(); i++) {
1155  StMuBTofHit* btofMuHit = (StMuBTofHit *)muBTofHitColl.getHit(i);
1156  addType( mBTofArrays[muBTofHit], *btofMuHit );
1157  }
1158 
1159  // fill btofRawHit
1160  StSPtrVecBTofRawHit &btofRawHits = btofcol->tofRawHits();
1161  for(size_t i=0; i < btofRawHits.size(); i++) {
1162  addType( mBTofArrays[muBTofRawHit], *btofRawHits[i] );
1163  }
1164 
1165  // fill btofHeader
1166  StBTofHeader *btofHeader = btofcol->tofHeader();
1167  addType( mBTofArrays[muBTofHeader], *btofHeader);
1168 
1169  timer.stop();
1170  DEBUGVALUE2(timer.elapsedTime());
1171 }
1172 //-----------------------------------------------------------------------
1173 //-----------------------------------------------------------------------
1174 //-----------------------------------------------------------------------
1175 void StMuDstMaker::fillFgt(StEvent* ev) {
1176 
1177  const StFgtCollection* fgtCollPtr = 0;
1178  if( ev )
1179  fgtCollPtr = ev->fgtCollection();
1180 
1181  if( fgtCollPtr ){
1182  // assert existance of the arrays
1183  assert( mFgtArrays );
1184  assert( mFgtArrays[muFgtStrips] );
1185  assert( mFgtArrays[muFgtClusters] );
1187 
1188  // need pointer types to enforce conversions in StMuDstMaker::addType
1189  StMuFgtCluster* clusterClassType = 0;
1190 
1191  // need a map to keep track of the index of each strip.
1192  // Key = geoId, value = idx in muFgtStrips TClonesArray
1193  std::map< Int_t, Int_t > stripGeoIdIdxMap;
1194  std::map< Int_t, Int_t >::iterator stripGeoIdIdxIter;
1195 
1196  // iterate over discs
1197  for( UShort_t discIdx = 0; discIdx < kFgtNumDiscs; ++discIdx ){
1198 
1199  // copy strips
1200  const StSPtrVecFgtStrip& stripVec = fgtCollPtr->mStripCollection[ discIdx ].getStripVec();
1201  for( const_StFgtStripIterator stripIter = stripVec.begin(); stripIter != stripVec.end(); ++stripIter ){
1202  Short_t stripType = (*stripIter)->getClusterSeedType();
1203 
1204  // save only the strips with a certain type
1205  if( stripType == kFgtSeedType1 ||
1206  stripType == kFgtSeedType2 ||
1207  stripType == kFgtSeedType3 ||
1208  stripType == kFgtSeedType4 ||
1209  stripType == kFgtSeedType5 ||
1210  stripType == kFgtSeedTypeMax ||
1211  stripType == kFgtClusterPart ||
1212  stripType == kFgtNextToDeadGuy ||
1213  stripType == kFgtClusterEndUp ||
1214  stripType == kFgtClusterEndDown ||
1215  stripType == kFgtStripShared ||
1216  stripType == kFgtClusterTooBig ||
1217  stripType == kFgtClusterSeedInSeaOfNoise ||
1218  stripType == kFgtNextToCluster ||
1219  stripType == kFgtKeepStrip){
1220 
1221  // make the strip using the "casting" constructor
1222  StMuFgtStrip fgtStrip( *(*stripIter) );
1223 
1224  // Set the range for the time bins to save.
1225  // Note: for now, use the obvious. Update the
1226  // following two lines later.`1
1227  Int_t nTBstart = 0;
1228  Int_t nTBend = nTBstart + fgtCollPtr->getNumTimeBins();
1229 
1230  // to do: comment about ensuring tb in same range as StFgtStrip class in StEvent
1231 
1232  for( Int_t tb = nTBstart; tb < nTBend; ++tb ){
1233  // make an StMuFgtAdc object
1234  StMuFgtAdc fgtAdc( (*stripIter)->getAdc( tb ), tb );
1235 
1236  Int_t adcIdx = addType( mFgtArrays[muFgtAdcs], fgtAdc );
1237 
1238  // just the first time
1239  if( tb == nTBstart ){
1240 
1241  // set the strip to know where the first ADC is and how many there are
1242  fgtStrip.setAdcInfo( adcIdx, nTBend-nTBstart );
1243  };
1244  };
1245 
1246  // add strip to the TClonesArray
1247  Int_t idx = addType( mFgtArrays[muFgtStrips], fgtStrip );
1248 
1249  // add to the map
1250  stripGeoIdIdxMap[ (*stripIter)->getGeoId() ] = idx;
1251 
1252  };
1253  };
1254 
1255  // faster to declare iterator outside of the loop
1256  stripWeightMap_t::const_iterator wIter;
1257 
1258  // copy clusters
1259  const StSPtrVecFgtHit& hitVec = fgtCollPtr->mHitCollection[ discIdx ].getHitVec();
1260  for( const_StFgtHitIterator hitIter = hitVec.begin(); hitIter != hitVec.end(); ++hitIter ){
1261  if( (*hitIter)->charge() > 0 ){
1262  // add the cluster to the array
1263  Int_t clusIdx = addType( mFgtArrays[muFgtClusters], *(*hitIter), clusterClassType );
1264 
1265  // get the map of associations
1266  const stripWeightMap_t& wMap = (*hitIter)->getStripWeightMap();
1267 
1268  // iterate over associated strips and add the associations
1269  Bool_t isFirst = 1;
1270  for( wIter = wMap.begin(); wIter != wMap.end(); ++wIter ){
1271 
1272  Int_t geoId = wIter->first->getGeoId(); // first is a StFgtStrip, which knows its own geoId
1273  Float_t weight = wIter->second; // second is the weight
1274 
1275  // determine the stripIdx
1276  stripGeoIdIdxIter = stripGeoIdIdxMap.find( geoId );
1277 
1278  // make sure the strip was saved
1279  assert( stripGeoIdIdxIter != stripGeoIdIdxMap.end() );
1280 
1281  Int_t stripIdx = stripGeoIdIdxIter->second;
1282 
1283  // make the association
1284  StMuFgtStripAssociation association( clusIdx, stripIdx, weight );
1285 
1286  // add it to the array
1287  Int_t associationIdx = addType( mFgtArrays[muFgtStripAssociations], association );
1288 
1289  if( isFirst ){
1290  // change the flag state
1291  isFirst = 0;
1292 
1293  // set the index in the cluster
1294  StMuFgtCluster* clusPtr = (StMuFgtCluster*)mFgtArrays[muFgtClusters]->UncheckedAt( clusIdx );
1295  clusPtr->setFirstStripAssociationIndex( associationIdx );
1296  };
1297  };
1298  };
1299  };
1300  };
1301  };
1302 };
1303 
1304 void StMuDstMaker::fillMtd(StEvent* ev) {
1305  DEBUGMESSAGE2("");
1306  StTimer timer;
1307  timer.start();
1308 
1309 // StMuMtdCollection *typeOfMtd=0;
1310 
1311  const StMtdCollection *mtd=ev->mtdCollection();
1312  if(!mtd) return;
1313  StMuMtdCollection mMTD(*mtd);
1314 
1315  for(size_t i=0; i < (size_t)mMTD.hitsPresent(); i++) {
1316  StMuMtdHit* mtdHit = (StMuMtdHit*)mMTD.MtdHit(i);
1317  addType( mMtdArrays[muMTDHit], *mtdHit );
1318  }
1319 
1320  for(size_t i=0; i < (size_t)mMTD.rawHitsPresent(); i++) {
1321  StMtdRawHit* mtdHit = (StMtdRawHit*)mMTD.RawMtdHit(i);
1322  addType( mMtdArrays[muMTDRawHit], *mtdHit );
1323  }
1324  StMuMtdHeader *mtdHead = mMTD.mtdHeader();
1325  if(mtdHead) addType(mMtdArrays[muMTDHeader],*mtdHead);
1326 
1327  //if (mtd) addType( mArrays[muMtd], *mtd, typeOfMtd );
1328  timer.stop();
1329  DEBUGVALUE2(timer.elapsedTime());
1330 }
1331 
1332 //-----------------------------------------------------------------------
1333 //-----------------------------------------------------------------------
1334 //-----------------------------------------------------------------------
1335 void StMuDstMaker::fillEzt(StEvent* ev) {
1336  if (ev==0) return;
1337  char *eztArrayStatus=&mStatusArrays[__NARRAYS__+
1338 #ifndef __NO_STRANGE_MUDST__
1340 #endif
1343  if(eztArrayStatus[muEztHead]){
1344  EztEventHeader* header = mEzTree->copyHeader(ev);
1345  addType(mEztArrays[muEztHead], *header);
1346  }
1347 
1348  if(eztArrayStatus[muEztTrig]) {
1349  EztTrigBlob* trig = mEzTree->copyTrig(ev);
1350  if (trig)
1351  addType(mEztArrays[muEztTrig], *trig);
1352  }
1353 
1354  if(eztArrayStatus[muEztFpd]) {
1355  EztFpdBlob* fpd = mEzTree->copyFpd(ev);
1356  addType(mEztArrays[muEztFpd], *fpd);
1357  }
1358 
1359  if(eztArrayStatus[muEztETow] || eztArrayStatus[muEztESmd]) {
1360  StEmcCollection* emcCol=(StEmcCollection*)ev->emcCollection();
1361  if(emcCol==0){
1362  gMessMgr->Message("","W") << GetName()<<"::fillEzt(), missing StEmcCollection, EEMC raw data NOT saved in muDst" <<endm;
1363  } else { //........... EMC-Collection in StEvent exist
1364  StEmcRawData *eeRaw=emcCol->eemcRawData();
1365  if (eeRaw) {
1366  if(eztArrayStatus[muEztETow]) {
1367  EztEmcRawData* ETow = mEzTree->copyETow(eeRaw);
1368  addType(mEztArrays[muEztETow], *ETow);
1369  }
1370 
1371  if(eztArrayStatus[muEztESmd]) {
1372  EztEmcRawData* ESmd = mEzTree->copyESmd(eeRaw);
1373  addType(mEztArrays[muEztESmd], *ESmd);
1374  }
1375  }
1376  }
1377  }
1378 }
1379 //-----------------------------------------------------------------------
1380 //-----------------------------------------------------------------------
1381 //-----------------------------------------------------------------------
1383  DEBUGMESSAGE2("");
1384  if ( !ev->l3Trigger() ) return;
1385  if ( !ev->l3Trigger()->l3EventSummary()) return;
1386 
1387  StTimer timer;
1388  timer.start();
1389  StL3EventSummary* l3 = ev->l3Trigger()->l3EventSummary();
1390  int n = l3->numberOfAlgorithms();
1391  for (int i=0; i<n; i++) {
1392  if (l3->algorithms()[i]->accept())
1393  addType( mArrays[muAccept], *l3->algorithms()[i] );
1394  else
1395  addType( mArrays[muReject], *l3->algorithms()[i] );
1396  }
1397  timer.stop();
1398  DEBUGVALUE2(timer.elapsedTime());
1399 }
1400 //-----------------------------------------------------------------------
1401 //-----------------------------------------------------------------------
1402 //-----------------------------------------------------------------------
1403 void StMuDstMaker::fillVertices(StEvent* ev) {
1404  DEBUGMESSAGE2("");
1405  StTimer timer;
1406  timer.start();
1407 
1408  StMuPrimaryVertex *typeOfVertex=0;
1409  Int_t n_vtx = ev->numberOfPrimaryVertices();
1410  DEBUGVALUE2(n_vtx);
1411  mVtxList.Clear();
1412  for (Int_t i_vtx=0; i_vtx < n_vtx; i_vtx++) {
1413  const StPrimaryVertex *vtx=ev->primaryVertex(i_vtx);
1414  addType( mArrays[muPrimaryVertex], vtx, typeOfVertex );
1415  mVtxList.AddAtAndExpand(ev->primaryVertex(i_vtx),i_vtx);
1416  }
1417  timer.stop();
1418  DEBUGVALUE2(timer.elapsedTime());
1419 }
1420 
1421 
1422 void StMuDstMaker::fillpp2pp(StEvent* ev) {
1423  DEBUGMESSAGE2("");
1424  StTimer timer;
1425  timer.start();
1426 
1427  StMuRpsCollection *typeOfRps=0;
1428 
1429  const StRpsCollection *rps=ev->rpsCollection();
1430  if (rps) addType( mArrays[mupp2pp], *rps, typeOfRps );
1431  timer.stop();
1432  DEBUGVALUE2(timer.elapsedTime());
1433 }
1434 
1435 
1436 //-----------------------------------------------------------------------
1437 //-----------------------------------------------------------------------
1438 //-----------------------------------------------------------------------
1439 void StMuDstMaker::fillTracks(StEvent* ev, StMuCut* cut) {
1440  DEBUGMESSAGE2("");
1441  StTimer timer;
1442  timer.start();
1443 
1444  StSPtrVecTrackNode& nodes= ev->trackNodes();
1445  DEBUGVALUE2(nodes.size());
1446  for (StSPtrVecTrackNodeConstIterator iter=nodes.begin(); iter!=nodes.end(); iter++) {
1448  }
1449  timer.stop();
1450  DEBUGVALUE2(timer.elapsedTime());
1451 }
1452 //-----------------------------------------------------------------------
1453 //-----------------------------------------------------------------------
1454 //-----------------------------------------------------------------------
1455 void StMuDstMaker::fillL3Tracks(StEvent* ev, StMuCut* cut) {
1456  DEBUGMESSAGE2("");
1457  if (!ev->l3Trigger()) return;
1458 
1459  StTimer timer;
1460  timer.start();
1461  StSPtrVecTrackNode& nodes= ev->l3Trigger()->trackNodes();
1462  DEBUGVALUE2(nodes.size());
1463  for (StSPtrVecTrackNodeConstIterator iter=nodes.begin(); iter!=nodes.end(); iter++) {
1464  addTrackNode(ev, *iter, cut, mArrays[muL3], 0, 0, 0, 0, true );
1465  }
1466  timer.stop();
1467  DEBUGVALUE2(timer.elapsedTime());
1468 }
1469 //-----------------------------------------------------------------------
1470 //-----------------------------------------------------------------------
1471 //-----------------------------------------------------------------------
1473  DEBUGMESSAGE2("");
1474  StTimer timer;
1475  timer.start();
1476  for (int i=0; i<StMuArrays::arraySizes[muState]; i++) {
1477  StDetectorState* state = ev->detectorState((StDetectorId) i);
1478  if (state) {
1479  addType( mArrays[muState], *state );
1480  }
1481  }
1482  timer.stop();
1483  DEBUGVALUE2(timer.elapsedTime());
1484 }
1485 //-----------------------------------------------------------------------
1486 //-----------------------------------------------------------------------
1487 //-----------------------------------------------------------------------
1488 void StMuDstMaker::addTrackNode(const StEvent* ev, const StTrackNode* node, StMuCut* cut,
1489  TClonesArray* gTCA, TClonesArray* pTCA, TClonesArray* oTCA, TClonesArray* covgTCA, TClonesArray* covpTCA, bool l3) {
1490  DEBUGMESSAGE3("");
1491  const StTrack* tr=0;
1492 
1494  int index2Global =-1;
1495  if (gTCA) {
1496  const StTrack *pr_tr = node->track(primary);
1497  const StVertex *vtx = 0;
1498  if (pr_tr)
1499  vtx = pr_tr->vertex();
1500  if (vtx==0)
1501  vtx = ev->primaryVertex();
1502 
1503  tr= node->track(global);
1504  if (tr && !tr->bad()) index2Global = addTrack(gTCA, ev, tr, vtx, cut, -1, l3, covgTCA, covpTCA);
1505  }
1507  int index;
1508  if (pTCA) {
1509  tr = node->track(primary);
1510  if (tr && !tr->bad()) index = addTrack(pTCA, ev, tr, tr->vertex(), cut, index2Global, l3, covgTCA, covpTCA);
1511  }
1513  if (oTCA) {
1514  size_t nEntries = node->entries();
1515  for (size_t j=0; j<nEntries; j++) {
1516  tr = node->track(j);
1517  if (tr && !tr->bad() && (tr->type()!=global) && (tr->type()!=primary) ) {
1518  index = addTrack(oTCA, ev, tr, tr->vertex(), cut, index2Global, l3);
1519  }
1520  }
1521  }
1522 }
1523 //---------------------------------------------------------------------
1524 //---------------------------------------------------------------------
1525 //---------------------------------------------------------------------
1526 int StMuDstMaker::addTrack(TClonesArray* tca, const StEvent*event, const StTrack* track, const StVertex *vtx, StMuCut* cut, int index2Global, bool l3,
1527  TClonesArray* covgTCA, TClonesArray* covpTCA) {
1528  DEBUGMESSAGE3("");
1529  StRichSpectra typeOfStRichSpectra;
1530  int index = -1;
1531  int index2RichSpectra=-1;
1533  int counter = tca->GetEntries();
1534  try{
1535  if (cut && !cut->pass(track)) throw StMuExceptionBadValue("failed track cut",__PRETTYF__);
1536  // add StRichSpectra if StRichPidTraits are found
1537  // we have to do this more elegant
1538  StRichSpectra* rich = richSpectra(track);
1539  if (rich) {
1540  index2RichSpectra = addType( mArrays[muRich], *rich );
1541  }
1542  StMuTrack *muTrack = new((*tca)[counter]) StMuTrack(event, track, vtx, index2Global, index2RichSpectra, l3, &mVtxList);
1543  if (track->type() == primary) {
1544  if (covpTCA) {
1545  Int_t countCOVPTCA = covpTCA->GetEntries();
1546 #if 0
1547  const StMatrixF covMatrix = track->fitTraits().covariantMatrix();
1548  new((*covpTCA)[countCOVPTCA]) StMuPrimaryTrackCovariance(covMatrix);
1549 #else
1550  // cout << track->fitTraits().covariantMatrix() << endl;
1551  const Float_t* cov = track->fitTraits().covariance();
1552  new((*covpTCA)[countCOVPTCA]) StMuPrimaryTrackCovariance(cov);
1553 #endif
1554  muTrack->setIndex2Cov(countCOVPTCA);
1555  }
1556  }
1557  else {
1558  if (track->type() == global) {
1559  if (covgTCA) {
1560  Int_t countCOVGTCA = covgTCA->GetEntries();
1561  const StDcaGeometry *dcaGeometry = ((StGlobalTrack *)track)->dcaGeometry();
1562  if (dcaGeometry) {
1563  new((*covgTCA)[countCOVGTCA]) StDcaGeometry(*dcaGeometry);
1564  muTrack->setIndex2Cov(countCOVGTCA);
1565  }
1566  }
1567  }
1568  }
1569  index = counter;
1570  }
1571  catch (StMuException e) {
1572  IFDEBUG3(e.print());
1573  }
1574  return index;
1575 }
1576 //-----------------------------------------------------------------------
1577 //-----------------------------------------------------------------------
1578 //-----------------------------------------------------------------------
1579 StRichSpectra* StMuDstMaker::richSpectra(const StTrack* track) {
1580  DEBUGMESSAGE3("");
1581  const StPtrVecTrackPidTraits& traits = track->pidTraits(kRichId);
1582  for (StPtrVecTrackPidTraitsConstIterator traitIter=traits.begin();traitIter!=traits.end();++traitIter) {
1583  StRichPidTraits* pid = dynamic_cast<StRichPidTraits*>(*traitIter);
1584  if (pid) return pid->getRichSpectra();
1585  }
1586  return 0;
1587 }
1588 #ifndef __NO_STRANGE_MUDST__
1589 void StMuDstMaker::fillStrange(StStrangeMuDstMaker* maker) {
1590  DEBUGMESSAGE2("");
1592  if (!maker) throw StMuExceptionNullPointer("no StrangeMuDstMaker",__PRETTYF__);
1593 
1594  StStrangeEvMuDst *ev=0;
1595  StV0MuDst *v0=0;
1596  StStrangeAssoc *assoc=0;
1597  StXiMuDst *xi=0;
1598  StKinkMuDst *kink=0;
1599  StV0Mc *v0Mc=0;
1600  StXiMc *xiMc=0;
1601  StKinkMc *kinkMc=0;
1602  TCut *strangeCut=0;
1603 
1604  addType(maker->GetEvClonesArray(), mStrangeArrays[0],ev);
1605  addType(maker->GetEvMcArray(), mStrangeArrays[1],ev);
1606 
1607  addType(maker->GetV0ClonesArray(), mStrangeArrays[2],v0);
1608  addType(maker->GetV0McArray(), mStrangeArrays[3],v0Mc);
1609  addType(maker->GetV0AssocArray(), mStrangeArrays[4],assoc);
1610 
1611  addType(maker->GetXiClonesArray(), mStrangeArrays[5],xi);
1612  addType(maker->GetXiMcArray(), mStrangeArrays[6],xiMc);
1613  addType(maker->GetXiAssocArray(), mStrangeArrays[7],assoc);
1614 
1615  addType(maker->GetKinkClonesArray(),mStrangeArrays[8],kink);
1616  addType(maker->GetKinkMcArray(), mStrangeArrays[9],kinkMc);
1617  addType(maker->GetKinkAssocArray(), mStrangeArrays[10],assoc);
1618 
1619  addType(maker->GetCutsArray(), mStrangeArrays[11],strangeCut);
1620 
1621 }
1622 #endif
1623 //-----------------------------------------------------------------------
1625  St_g2t_track *g2t_track = (St_g2t_track *) GetDataSet("geant/g2t_track"); if (!g2t_track) return;
1626  St_g2t_vertex *g2t_vertex = (St_g2t_vertex *) GetDataSet("geant/g2t_vertex"); if (!g2t_vertex) return;
1627  StG2TrackVertexMap::instance(g2t_track,g2t_vertex);
1628  mStEvent->setIdTruth();
1629  StMuMcVertex *mcvx = 0;
1630  StMuMcTrack *mctr = 0;
1631  g2t_vertex_st *vertex = g2t_vertex->GetTable();
1632  UInt_t NV = g2t_vertex->GetNRows();
1633  for (UInt_t i = 0; i < NV; i++) addType(mMCArrays[MCVertex], vertex[i], mcvx);
1634  g2t_track_st *track = g2t_track->GetTable();
1635  UInt_t NT = g2t_track->GetNRows();
1636  for (UInt_t i = 0; i < NT; i++) addType(mMCArrays[MCTrack], track[i], mctr);
1637 
1638 }
1639 //-----------------------------------------------------------------------
1640 //-----------------------------------------------------------------------
1641 //-----------------------------------------------------------------------
1642 template <class T>
1643 int StMuDstMaker::addType(TClonesArray* tcaFrom, TClonesArray* &tcaTo ,T *t) {
1644  if (tcaFrom && tcaTo) {
1645  int n = tcaFrom->GetEntries();
1646  int counter = tcaTo->GetEntries();
1647  for (int i=0; i<n;i++) {
1648  // old new((*tcaTo)[counter++]) T( (T&)*tcaFrom->UncheckedAt(i) );
1649  new((*tcaTo)[counter++]) T( *(T*)(void*)tcaFrom->UncheckedAt(i) );
1650  }
1651  }
1652  return 0;
1653 }
1654 //-----------------------------------------------------------------------
1655 //-----------------------------------------------------------------------
1656 //-----------------------------------------------------------------------
1657 // int StMuDstMaker::addType(TClonesArray* tcaTo , StMuEmcCollection *t) {
1658 // int counter =-1;
1659 // if (tcaTo) {
1660 // counter = tcaTo->GetEntries();
1661 
1662 // new((*tcaTo)[counter]) StMuEmcCollection();
1663 // }
1664 // return counter;
1665 // }
1666 //-----------------------------------------------------------------------
1667 //-----------------------------------------------------------------------
1668 //-----------------------------------------------------------------------
1669 template <class T>
1670 int StMuDstMaker::addType(TClonesArray* tcaTo ,T &t) {
1671  int counter =-1;
1672  if (tcaTo) {
1673  counter = tcaTo->GetEntries();
1674  new((*tcaTo)[counter]) T( t );
1675  }
1676  return counter;
1677 }
1678 //-----------------------------------------------------------------------
1679 //-----------------------------------------------------------------------
1680 //-----------------------------------------------------------------------
1681 template <class T, class U>
1682 int StMuDstMaker::addType(TClonesArray* tcaTo ,U &u,T *t) {
1683  int counter =-1;
1684  if (tcaTo) {
1685  counter = tcaTo->GetEntries();
1686  DEBUGMESSAGE2("");
1687  new((*tcaTo)[counter]) T(u);
1688  }
1689  return counter;
1690 }
1691 //-----------------------------------------------------------------------
1692 //-----------------------------------------------------------------------
1693 //-----------------------------------------------------------------------
1694 string StMuDstMaker::buildFileName(string dir, string fileName, string extention){
1695  DEBUGMESSAGE3(dir.c_str());
1696  DEBUGMESSAGE3(fileName.c_str());
1697  DEBUGMESSAGE3(extention.c_str());
1698  fileName = dir + fileName + extention;
1699  while (fileName.find("//")!=string::npos) {
1700  int pos = fileName.find("//");
1701  fileName.erase(pos,1);
1702  }
1703  return fileName;
1704 }
1705 //-----------------------------------------------------------------------
1706 //-----------------------------------------------------------------------
1707 //-----------------------------------------------------------------------
1708 string StMuDstMaker::basename(string s){
1709  DEBUGVALUE3(s.c_str());
1710  string name(s);
1711  DEBUGVALUE3(name.c_str());
1712  size_t pos;
1713  pos = name.find_last_of("/");
1714  if (pos!=string::npos ) name.erase(0, pos );
1715  DEBUGVALUE3(name.c_str());
1716  pos = name.find_last_of(".");
1717  if (pos!=string::npos ) name.erase(pos,name.length()-pos );
1718  DEBUGVALUE3(name.c_str());
1719  pos = name.find_last_of(".");
1720  if (pos!=string::npos ) name.erase(pos,name.length()-pos );
1721  DEBUGVALUE3(name.c_str());
1722  return name;
1723 }
1724 //-----------------------------------------------------------------------
1725 //-----------------------------------------------------------------------
1726 //-----------------------------------------------------------------------
1727 string StMuDstMaker::dirname(string s){
1728  string name(s);
1729  DEBUGVALUE3(name.c_str());
1730  size_t pos;
1731  pos = name.find_last_of("/");
1732 
1733  if (pos != string::npos ) name.erase(pos, name.length());
1734  if (name == s) name =".";
1735 
1736  name=name+"/";
1737  DEBUGVALUE3(name);
1738  return name;
1739 }
1740 
1741 void StMuDstMaker::setProbabilityPidFile(const char* file) {
1742  ostrstream flnm;
1743 
1744  if ( ! file ){
1745  const char *PIDtable="PIDTableP01gl.root";
1746 
1747  flnm << getenv("STAR") << "/StarDb/dEdxModel/" << PIDtable << ends;
1748  FORCEDDEBUGMESSAGE("ATTENTION: pid table hardwired to " << flnm.str() );
1749 
1750  } else {
1751  flnm << file << ends;
1752  FORCEDDEBUGMESSAGE("Using pid table to user value " << flnm.str() );
1753  }
1754 
1755 
1757  mProbabilityPidAlgorithm->readParametersFromFile(flnm.str());
1758 }
1759 //-----------------------------------------------------------------------
1760 //-----------------------------------------------------------------------
1761 //-----------------------------------------------------------------------
1763 {
1764 // all stuff
1765  TClonesArray *tcl;
1766  for ( int i=0; i<__NALLARRAYS__; i++) {
1767  if (mStatusArrays[i]==0) continue;
1768  tcl = mAArrays[i];
1769  printf(" Array %s\t = %s::%s(%d)\n",
1771  tcl->ClassName(),tcl->GetName(),tcl->GetEntriesFast());
1772  }
1773 
1774 }
1775 //-----------------------------------------------------------------------
1777 {
1778  StMuEvent *me = mStMuDst->event();
1779  if (me==0)
1780  return;
1781  StEventInfo &ei = me->eventInfo();
1782  StRunInfo &ri = me->runInfo();
1783  StEvtHddr *hd = GetEvtHddr();
1784 
1785  hd->SetRunNumber(ei.runId()) ;
1786  hd->SetEventType(ei.type().Data());
1787  hd->SetTriggerMask(ei.triggerMask()) ;
1788 //hd->SetInputTriggerMask(???);
1789  hd->SetBunchCrossingNumber(ei.bunchCrossingNumber(0),ei.bunchCrossingNumber(1));
1790  hd->SetCenterOfMassEnergy(ri.centerOfMassEnergy());
1791 //hd->SetBImpact (float b) ;
1792 //hd->SetPhiImpact(float p) ;
1793 //hd->SetPhImpact (float p) ;
1794 //hd->SetAEast(int a) ;
1795 //hd->SetZEast(int z) ;
1796 //hd->SetAWest(int a) ;
1797 //hd->SetZWest(int z) ;
1798 //hd->SetLuminosity(float lu) ;
1799  hd->SetGMTime((unsigned int)ei.time());
1800  hd->SetProdDateTime(ri.productionTime());
1801 //hd->SetIventNumber(int iv) ;
1802  hd->SetEventSize(ei.eventSize());
1803  hd->SetEventNumber(ei.id()) ;
1804 //hd->SetGenerType(int g);
1805 }
1806 
1807 //-----------------------------------------------------------------------
1809  mEmcCollection->setTowerData((StMuEmcTowerData*)(*(mEmcArrays[muEmcTow]))[0]);
1810  mEmcCollection->setPrsArray(2,mEmcArrays[muEmcPrs]);
1811  mEmcCollection->setSmdArray(3,mEmcArrays[muEmcSmde]);
1812  mEmcCollection->setSmdArray(4,mEmcArrays[muEmcSmdp]);
1813  mEmcCollection->setPrsArray(6,mEmcArrays[muEEmcPrs]);
1814  mEmcCollection->setSmdArray(7,mEmcArrays[muEEmcSmdu]);
1815  mEmcCollection->setSmdArray(8,mEmcArrays[muEEmcSmdv]);
1816 }
1817 //-----------------------------------------------------------------------
1822 }
1823 //-----------------------------------------------------------------------
1825  mPmdCollection->setPmdHitArray(mPmdArrays[muPmdHit]);
1826  mPmdCollection->setCpvHitArray(mPmdArrays[muCpvHit]);
1827  mPmdCollection->setPmdClusterArray(mPmdArrays[muPmdCluster]);
1828  mPmdCollection->setCpvClusterArray(mPmdArrays[muCpvCluster]);
1829 }
1830 
1831 /***************************************************************************
1832  *
1833  * $Log: StMuDstMaker.cxx,v $
1834  * Revision 1.118 2013/12/04 19:56:32 jdb
1835  * Added StMuMtdPidTraits.{cxx, h} added Mtd items to StMuMtdHit.h, StMuDst.{cxx,h}, StMuDstMaker.cxx, StMuTrack.{cxx,h}
1836  *
1837  * Revision 1.117 2013/07/23 11:02:59 jeromel
1838  * Undo changes (KF and other)
1839  *
1840  * Revision 1.115 2013/04/10 19:28:35 jeromel
1841  * Step back to 04/04 version (van aware) - previous changes may be recoverred
1842  *
1843  * Revision 1.113 2013/01/08 22:57:33 sangalin
1844  * Merged in FGT changes allowing for a variable number of timebins to be read out for each strip.
1845  *
1846  * Revision 1.112 2012/12/12 00:36:03 sangalin
1847  * Merged in updated StMuFgtCluster class format from Anselm Vossen.
1848  *
1849  * Revision 1.111 2012/11/30 20:29:41 sangalin
1850  * Removed cout debug statements in fillMtd().
1851  *
1852  * Revision 1.110 2012/11/16 12:31:37 jeromel
1853  * Fix catch without try
1854  *
1855  * Revision 1.109 2012/11/15 22:26:13 sangalin
1856  * Added the FGT. Fixed bugs in array offsets for the MTD.
1857  *
1858  * Revision 1.108 2012/10/04 18:57:59 fisyak
1859  * Add protection for empty emc raw data
1860  *
1861  * Revision 1.107 2012/09/28 22:38:05 tone421
1862  * Changed array stucture of MTD upon request of the TOF group. MTD arrays now on top level, rather than within __NARRAYS__
1863  *
1864  * Revision 1.106 2012/05/07 14:47:06 fisyak
1865  * Add handles for track to fast detector matching
1866  *
1867  * Revision 1.105 2011/10/17 00:19:13 fisyak
1868  * Active handing of IdTruth
1869  *
1870  * Revision 1.104 2011/08/18 18:41:36 fisyak
1871  * set max. tree size = 100 GB
1872  *
1873  * Revision 1.103 2011/05/04 19:51:32 tone421
1874  * Added MTD infomation
1875  *
1876  * Revision 1.102 2011/04/19 22:50:08 fisyak
1877  * Use default size of TTree (100 GB) for ROOT >= 5.26.0
1878  *
1879  * Revision 1.101 2011/04/08 01:25:50 fisyak
1880  * Add branches for MC track and vertex information, add IdTruth to tracks and vertices, reserve a possiblity to remove Strange MuDst
1881  *
1882  * Revision 1.100 2010/05/28 19:47:51 tone421
1883  * Removed a cout needed for test purposes in StMuDstMaker. Made sure StTriggerData objects copied into the MuDst have a debug value of 0..
1884  *
1885  * Revision 1.99 2010/05/26 04:25:50 tone421
1886  * Added StTriggerData arrays in muevent and fixed an issue with PMD arrays being read....
1887  *
1888  * Revision 1.98 2010/03/08 19:06:51 tone421
1889  * Two things. Global tracks how are filled with an index to primary at birth. Added StMuDst::fixTrackIndicesG(), which is used for matching the primary track indices to global tracks. Previously, this was quite slow - see this post:
1890  *
1891  * http://www.star.bnl.gov/HyperNews-star/protected/get/starsoft/8092/1/1/1.html
1892  *
1893  * for more details.
1894  *
1895  * Revision 1.97 2010/01/25 18:46:16 fine
1896  * RT #1826. Add protection against of the zero rps pointer and add the safe version of the StMuRpsCollection(const StRpsCollection & rps) ctor
1897  *
1898  * Revision 1.96 2010/01/25 03:57:39 tone421
1899  * Added FMS and Roman pot arrays
1900  *
1901  * Revision 1.95 2010/01/21 02:08:17 fine
1902  * RT #1803: Restore the broken MakeRead/MakeWrite interface to fix Skip event method
1903  *
1904  * Revision 1.94 2009/12/01 21:56:35 tone421
1905  * Implemented changes as per http://www.star.bnl.gov/rt2/Ticket/Display.html?id=1734
1906  *
1907  * Revision 1.93 2009/05/22 23:48:18 fine
1908  * Test I/O errors after filling the TTree
1909  *
1910  * Revision 1.92 2009/05/22 22:25:31 fine
1911  * Add the Zombue test for TFile ctors
1912  *
1913  * Revision 1.91 2009/04/27 20:50:43 perev
1914  * Change type of DataSet
1915  *
1916  * Revision 1.90 2009/03/10 23:43:53 jeromel
1917  * Set tree size to max size
1918  *
1919  * Revision 1.89 2009/02/20 16:37:44 tone421
1920  * *** empty log message ***
1921  *
1922  * Revision 1.87 2008/10/03 17:50:42 tone421
1923  * Added mVtxList(100); see http://www.star.bnl.gov/HyperNews-star/protected/get/starsoft/7529.html
1924  *
1925  * Revision 1.86 2008/04/14 21:32:12 fisyak
1926  * Remove stripping TObject from StDcaGeometry, because StDcaGeometry is inherit from StObject and this stripping brakes schema evolution
1927  *
1928  * Revision 1.85 2008/03/19 14:51:03 fisyak
1929  * Add two clone arrays for global and primary track covariance matrices, remove mSigmaDcaD and mSigmaDcaZ
1930  *
1931  * Revision 1.84 2007/08/31 01:55:05 mvl
1932  * Added protection against corrupted files by checking for return code -1 from TTree:GetEntry(). StMuDstMaker will silently skip these events; StMuIOMaker returns kStWarn.
1933  *
1934  * Revision 1.83 2007/08/02 20:46:47 mvl
1935  * Switch off Q-vector branhces in StMuDstMaker and increase version number in StMuEvent.
1936  * This is to avoid wranings when reading P07ib data which has Q-vector information stored with more recent libraries.
1937  *
1938  * Revision 1.82 2007/05/16 18:50:48 mvl
1939  * Cleanup of output. Replaced cout with LOG_INFO etc.
1940  *
1941  * Revision 1.81 2007/04/27 17:07:01 mvl
1942  * Added protection against StEvent::triggerData() == 0 in EZTREE.
1943  *
1944  * Revision 1.80 2007/04/20 06:26:00 mvl
1945  * Removed Q-vector calculation. Will implement utility class instead.
1946  *
1947  * Revision 1.78 2007/02/07 07:53:09 mvl
1948  * Added SetEventList function to read only pre-selected events (by J. Webb)
1949  *
1950  * Revision 1.77 2006/12/20 21:53:15 mvl
1951  * Added warning when file list not found (read mode)
1952  *
1953  * Revision 1.76 2006/09/10 00:58:43 mvl
1954  * Roll-back of previous changes for ROOT 5.12. Problem has been resolved inside ROOT.
1955  *
1956  * Revision 1.75 2006/08/18 20:09:51 fine
1957  * ROOT 5.12 bug workaround See: STAR Bug 741
1958  *
1959  * Revision 1.74 2006/07/28 18:25:11 mvl
1960  * Added call to StMuDst::setVertexIndex(0) to StMuDstMaker::read() to reset the current vertex index to 0 for every event
1961  *
1962  * Revision 1.73 2006/02/08 23:35:36 mvl
1963  * Added overloaded version for StIOInterface::GetFile() to return name
1964  * of current input or output file (depending on read or write mode)
1965  * StIOInterface::GetFileName() is an alias for this function.
1966  *
1967  * Revision 1.72 2005/10/18 17:55:43 mvl
1968  * Fixed initialisation problem of mCurrentFile, leading to potential segvio when creating MuDst
1969  *
1970  * Revision 1.71 2005/10/06 01:30:30 mvl
1971  * Changed some of the logic in StMuChainMaker: Now files are no longer opened
1972  * and checked at the start of the job, but simply added to the TChain. TChain
1973  * automatically skips corrupted files (this is a new feature).
1974  *
1975  * Revision 1.70 2005/08/19 19:46:05 mvl
1976  * Further updates for multiple vertices. The main changes are:
1977  * 1) StMudst::primaryTracks() now returns a list (TObjArray*) of tracks
1978  * belonging to the 'current' primary vertex. The index number of the
1979  * 'current' vertex can be set using StMuDst::setCurrentVertex().
1980  * This also affects StMuDst::primaryTracks(int i) and
1981  * StMuDst::numberOfprimaryTracks().
1982  * 2) refMult is now stored for all vertices, in StMuPrimaryVertex. The
1983  * obvious way to access these numbers is from the StMuprimaryVertex structures,
1984  * but for ebakcward compatibility a function is provided in StMuEvent as well
1985  * (this is the only function taht works for existing MuDst)
1986  *
1987  * As an aside, I've also changes the internals of StMuDst::createStEvent and
1988  * StMuDst::fixTrackIndices() to be able to deal with a larger range of index numbers for tracks as generated by Ittf.
1989  *
1990  * BIG FAT WARNING: StMudst2StEventMaker and StMuDstFilterMaker
1991  * do not fully support the multiple vertex functionality yet.
1992  *
1993  * Revision 1.69 2005/07/15 21:45:08 mvl
1994  * Added support for multiple primary vertices (StMuPrimaryVertex). Track Dcas are now calculated with repect to the first vertex in the list (highest rank), but another vertex number can be specified. Tarcks also store the index of the vertex they belong to (StMuTrack::vertexIndex())
1995  *
1996  * Revision 1.68 2005/04/12 21:56:29 mvl
1997  * Changes by Xin Dong for year-5 TOF data format: extra TClonesArray and routines to fill it from StEvent (StTofRawData).
1998  *
1999  * Revision 1.67 2004/11/29 15:53:22 mvl
2000  * Additions by Jan for Fpd ezTree
2001  *
2002  * Revision 1.66 2004/11/15 18:20:25 mvl
2003  * Added call to StMuDst::set() for V0-event-pointers in read()
2004  *
2005  * Revision 1.65 2004/10/31 23:43:21 mvl
2006  * Removed some warnings for files without EMC, PMD info.
2007  * Prevent filling of empty event when no stevent pointer.
2008  *
2009  * Revision 1.64 2004/10/28 00:11:33 mvl
2010  * Added stuff to support ezTree mode of MuDstMaker.
2011  * This is a special mode for fast-online processing of fast-detector data.
2012  *
2013  * Revision 1.63 2004/10/21 02:58:17 mvl
2014  * Removed some code from Make() (backward compatible EMc mode), to fix StMuIOMaker
2015  *
2016  * Revision 1.62 2004/10/19 01:42:29 mvl
2017  * Changes for splitting Emc and Pmd collections. Emc clusters and points dropped
2018  *
2019  * Revision 1.61 2004/09/18 01:28:11 jeromel
2020  * *** empty log message ***
2021  *
2022  * Revision 1.60 2004/05/04 13:26:23 jeromel
2023  * Oops .. Conflict resolution fixed.
2024  *
2025  * Revision 1.59 2004/05/04 13:17:11 jeromel
2026  * Changed to the documentation in doxygen format
2027  *
2028  * Revision 1.58 2004/05/04 00:09:23 perev
2029  *
2030  * // Selecting SetBranchStatus for particular MuDst branches
2031  * // Special names:
2032  * // MuEventAll - all branches related to StMuEvent
2033  * // StrangeAll - all branches related to StrangeMuDst
2034  * // EmcAll - all branches related to Emc
2035  * // PmdAll - all branches related to Pmd
2036  * // TofAll - all branches related to Tof
2037  * // By default all branches of MuDst are read. If user wants to read only some of
2038  * // them, then:
2039  * // SetStatus("*",0) // all branches off
2040  * // SetStatus("MuEventAll",1) // all standard MuEvent branches ON
2041  * // SetStatus("StrangeAll",1) // all standard Strange branches ON
2042  * // SetStatus("EmcAll" ,1) // all standard Emc branches ON
2043  * // SetStatus("PmdAll" ,1) // all standard Pmd branches ON
2044  * // SetStatus("TofAll" ,1) // all standard Tof branches ON
2045  * //
2046  * // SetStatus("XiAssoc" ,1) // Strange branch "XiAssoc" is ON
2047  * // Names of branches look StMuArrays::arrayTypes[]
2048  * // It allows to speed up reading MuDst significantly
2049  *
2050  * Revision 1.57 2004/04/26 00:13:28 perev
2051  * Cleanup+simplification
2052  *
2053  * Revision 1.56 2004/04/20 18:42:47 perev
2054  * remove redundant arrays
2055  *
2056  * Revision 1.55 2004/04/15 00:25:49 perev
2057  * fillHddr() added to fill time stamp ...
2058  *
2059  * Revision 1.54 2004/04/14 17:15:56 subhasis
2060  * Xin's TOF reinclusion
2061  *
2062  * Revision 1.53 2004/04/09 22:03:50 subhasis
2063  * after tof createevent fix by Xin
2064  *
2065  * Revision 1.52 2004/04/09 03:36:14 jeromel
2066  * Removed TOF support entirely for now as we need a working version ... Will
2067  * revisit later.
2068  *
2069  * Revision 1.51 2004/04/06 01:48:09 perev
2070  * Small leak + incorrect filing StMuTofHitCollection
2071  *
2072  * Revision 1.50 2004/04/02 03:24:54 jeromel
2073  * Changes implements PMD and TOF. TOF is clearly incomplete.
2074  *
2075  * Revision 1.49 2004/02/17 05:05:35 jeromel
2076  * One more hidden one found post-commit
2077  *
2078  * Revision 1.48 2004/02/17 04:56:36 jeromel
2079  * Extended help, added crs support, restored __GNUC__ for PRETTY_FUNCTION(checked once
2080  * more and yes, it is ONLY defined in GCC and so is __FUCTION__), use of a consistent
2081  * internal __PRETTYF__, return NULL if no case selected (+message) and protected against
2082  * NULL mChain.
2083  *
2084  * Revision 1.47 2003/11/17 22:16:55 perev
2085  * THack::DeleteClonesArray used for deleting, to avoid ROOT bad features
2086  *
2087  * Revision 1.46 2003/11/10 04:07:47 perev
2088  * again clear improved to avoid leaks
2089  *
2090  * Revision 1.45 2003/11/09 01:02:59 perev
2091  * more sofisticated clear() to fix leaks
2092  *
2093  * Revision 1.44 2003/11/03 22:24:45 perev
2094  * TClones::Clear added into StMuDstMaker::clear to avoid empty ebjects writing
2095  *
2096  * Revision 1.43 2003/10/30 20:08:13 perev
2097  * Check of quality added
2098  *
2099  * Revision 1.42 2003/10/28 00:03:46 perev
2100  * remove some debug lines
2101  *
2102  * Revision 1.41 2003/10/27 23:54:33 perev
2103  * weird template bug fized and templates simplified
2104  *
2105  * Revision 1.40 2003/10/23 04:08:29 perev
2106  * use SetBranchStatus fixed
2107  *
2108  * Revision 1.39 2003/10/20 19:50:13 perev
2109  * workaround added for TClonesArray::Delete + some cleanup of MuEmc
2110  *
2111  * Revision 1.38 2003/10/15 17:34:16 laue
2112  * StMuDstMaker: Reading fixed. Delete() changed back to Clear()
2113  * StMuEmcCollection: Re-implemented the DeleteThis() function,
2114  * This hoopefully fixed the memory leak when
2115  * writing MuDst again.
2116  * StMuTimer: ClassDef/ClassImp
2117  *
2118  * Revision 1.37 2003/10/12 03:43:56 perev
2119  * LeakOff TClonesArray::Clear replaced to Delete
2120  *
2121  * Revision 1.36 2003/10/08 21:17:15 laue
2122  * StMuEmcUtil updates from Alex Suaide
2123  * StMuDst and StMuDstMaker fixes to take the double inheritance of the
2124  * StKinkMuDsts into account. A void* had to be introduced when casting
2125  * TObject* to StKinkMuDst*.
2126  *
2127  * Revision 1.35 2003/10/03 15:26:07 laue
2128  * some moe arrays initialized
2129  *
2130  * Revision 1.34 2003/09/28 21:10:59 jeromel
2131  * More data members zeroed (would cause a crash on exit)
2132  *
2133  * Revision 1.33 2003/09/19 01:45:18 jeromel
2134  * A few problems hopefully fixed i.e. one constructor lacked zeroing
2135  * emcArrays were not zeroed, mStMuDst not zeroed.
2136  * For maintainability zeroArrays() added.
2137  *
2138  * Revision 1.32 2003/09/07 03:49:03 perev
2139  * gcc 3.2 + WarnOff
2140  *
2141  * Revision 1.31 2003/09/02 17:58:44 perev
2142  * gcc 3.2 updates + WarnOff
2143  *
2144  * Revision 1.30 2003/08/04 14:38:10 laue
2145  * Alex Suaide's updated for the EMC. Now EEMC is included.
2146  *
2147  * Revision 1.29 2003/03/25 19:08:06 laue
2148  * added StMuDst into TDataSet so that Valeri can pick it up for his
2149  * StEventDisplayMaker
2150  *
2151  * Revision 1.28 2003/03/06 01:34:18 laue
2152  * StAddRunInfoMaker is a make helper maker to add the StRunInfo for the
2153  * only year1 Au+Au 130GeV data
2154  *
2155  * Revision 1.27 2003/02/20 15:29:42 laue
2156  * StMuTriggerIdCollection added
2157  *
2158  * Revision 1.26 2003/02/19 15:38:10 jeromel
2159  * Modifications made to account for the new location of the PIDTable file.
2160  * The setProbabilityPidFile() method has been modified to take care of a default
2161  * file loading if unspecified. Messages will be displayed appropriatly.
2162  * Macros mdoofied to not call the method (leave it handled through the default
2163  * file).
2164  *
2165  * Revision 1.25 2003/02/07 23:47:53 laue
2166  * New EMC code. TObject arrays replaced by TClonesArrays (thanks to Alex)
2167  *
2168  * Revision 1.23 2003/02/05 22:10:00 laue
2169  * delete emc collection after being copied (when creating mudst)
2170  *
2171  * Revision 1.21 2003/01/29 03:04:57 laue
2172  * !!DIRTY FIX FOR StMuEmcCollection
2173  * !! Was memor leaking. Leak fixed, but slow and dirty.
2174  * !! Propose to change the structure as soon as possible.
2175  *
2176  * Revision 1.20 2003/01/09 18:59:45 laue
2177  * initial check in of new EMC classes and the changes required
2178  *
2179  * Revision 1.19 2002/11/27 15:07:31 laue
2180  * fix to run with standard root
2181  *
2182  * Revision 1.18 2002/11/07 17:12:22 laue
2183  * Comment changed.
2184  *
2185  * Revision 1.17 2002/08/27 19:05:56 laue
2186  * Minor updates to make the muDst from simulation work
2187  *
2188  * Revision 1.16 2002/08/20 19:55:49 laue
2189  * Doxygen comments added
2190  *
2191  * Revision 1.15 2002/05/20 18:57:18 laue
2192  * update for Christof
2193  *
2194  * Revision 1.14 2002/05/20 17:23:31 laue
2195  * StStrangeCuts added
2196  *
2197  * Revision 1.13 2002/05/04 23:56:30 laue
2198  * some documentation added
2199  *
2200  * Revision 1.12 2002/04/26 21:02:56 jeromel
2201  * Bug fix in dirname(). Still cannot get the arg3 bla/test.root mechanism to work
2202  * (but it does neither for everything else). Will come back to it.
2203  *
2204  * Revision 1.11 2002/04/23 21:35:32 laue
2205  * Changed name of StStraMuDstMaker to 'strangeMuDst' so that it can get picked
2206  * from the bfc.
2207  *
2208  * Revision 1.9 2002/04/11 14:19:30 laue
2209  * - update for RH 7.2
2210  * - decrease default arrays sizes
2211  * - add data base readerfor number of events in a file
2212  *
2213  * Revision 1.8 2002/04/01 22:42:30 laue
2214  * improved chain filter options
2215  *
2216  * Revision 1.7 2002/03/28 05:10:34 laue
2217  * update for running in the production
2218  *
2219  * Revision 1.6 2002/03/27 03:47:27 laue
2220  * better filter options
2221  *
2222  * Revision 1.5 2002/03/27 00:50:11 laue
2223  * bux fix from earlier check in
2224  *
2225  * Revision 1.3 2002/03/20 16:04:11 laue
2226  * minor changes, mostly added access functions
2227  *
2228  * Revision 1.2 2002/03/08 20:04:31 laue
2229  * change from two trees to 1 tree per file
2230  *
2231  * Revision 1.1 2002/03/08 17:04:17 laue
2232  * initial revision
2233  *
2234  *
2235  **************************************************************************/
2236 
2237 
2238 
2239 
2240 
2241 
2242 
2243 
2244 
2245 
2246 
2247 
2248 
2249 
2250 
2251 
2252 
2253 
void fillL3Tracks(StEvent *ev, StMuCut *cut=0)
TChain * mChain
Definition: StMuDstMaker.h:239
TEventList * mEventList
Definition: StMuDstMaker.h:224
TFile * mCurrentFile
Definition: StMuDstMaker.h:236
void fillVertices(StEvent *ev)
static int arraySizes[__NALLARRAYS__]
< maximum sizes of the TClonesArrays
Definition: StMuArrays.h:107
void fillStrange(StStrangeMuDstMaker *)
TClonesArray ** mFgtArrays
Definition: StMuDstMaker.h:356
StMuCut * mTrackFilter
Definition: StMuDstMaker.h:233
void fillpp2pp(StEvent *ev)
static const char * arrayTypes[__NALLARRAYS__]
< names of the classes, the TClonesArrays are arrays of this type
Definition: StMuArrays.h:92
StTreeMaker * mTreeMaker
Definition: StMuDstMaker.h:208
void fillMtd(StEvent *ev)
TClonesArray ** mFmsArrays
Definition: StMuDstMaker.h:350
string mDirName
Definition: StMuDstMaker.h:219
void fillTrees(StEvent *ev, StMuCut *cut=0)
TTree * mTTree
Definition: StMuDstMaker.h:240
size of the tof arrays >
Definition: StMuArrays.h:59
StMuEzTree * mEzTree
Definition: StMuDstMaker.h:215
string mFileName
Definition: StMuDstMaker.h:220
virtual Int_t MakeRead()
void fillEvent(StEvent *ev, StMuCut *cut=0)
void assignArrays()
StMuFmsCollection * mFmsCollection
Definition: StMuDstMaker.h:362
void fillTof(StEvent *ev)
StMuEmcUtil * mEmcUtil
Definition: StMuDstMaker.h:209
virtual Int_t MakeWrite()
TClonesArray ** mEztArrays
Definition: StMuDstMaker.h:357
StRichSpectra * richSpectra(const StTrack *track)
TClonesArray ** mEmcArrays
Definition: StMuDstMaker.h:349
void setProbabilityPidFile(const char *file=NULL)
Set the file from where the PID probability tables should be read.
void connectFmsCollection()
virtual int Init()
StStrangeMuDstMaker * mStStrangeMuDstMaker
Definition: StMuDstMaker.h:205
virtual void openWrite(string fileName)
protected:
void setFmsPointArray(TClonesArray *array)
#define saveDelete(t)
Definition: StMuDstMaker.h:252
TClonesArray * clonesArray(TClonesArray *&p, const char *type, int size, int &counter)
StMuEmcCollection * mEmcCollection
Definition: StMuDstMaker.h:361
virtual void closeWrite()
TClonesArray * mEmcCollectionArray
Definition: StMuDstMaker.h:360
friend class StMuDst
Definition: StMuDstMaker.h:338
static const char * arrayNames[__NALLARRAYS__]
Definition: StMuArrays.h:77
size of the fms arrays, i.e. number of TClonesArrays
Definition: StMuArrays.h:57
size of the pmd arrays, i.e. number of TClonesArrays
Definition: StMuArrays.h:56
void fillPmd(StEvent *ev)
TObjArray mVtxList
Definition: StMuDstMaker.h:247
TClonesArray ** mMtdArrays
Definition: StMuDstMaker.h:355
void clearArrays()
void setL3TrackFilter(StMuCut *c)
Set the track filter used for L3 tracks when creating muDsts from StEvent and writing to disk...
Definition: StMuDstMaker.h:374
void SetStatus(const char *arrType, int status)
virtual const char * GetFile() const
Returns name of current input or output file, depending on mode (GetFileName does the same...
void setFmsHitArray(TClonesArray *array)
void streamerOff()
void fillFgt(StEvent *ev)
StMuCut * mL3TrackFilter
Definition: StMuDstMaker.h:234
StuProbabilityPidAlgorithm * mProbabilityPidAlgorithm
Definition: StMuDstMaker.h:249
void fillEzt(StEvent *ev)
ClassImp(StMuDstMaker) using namespace units
dongx
void createArrays()
void setFmsClusterArray(TClonesArray *array)
TClonesArray ** mMCArrays
Definition: StMuDstMaker.h:348
StMuDstMaker(const char *name="MuDst")
Default constructor.
TClonesArray ** mStrangeArrays
Definition: StMuDstMaker.h:346
string buildFileName(string dir, string fileName, string extention)
void setTrackFilter(StMuCut *c)
Set the track filter used for all tracks (except the L3 tracks) when creating muDsts from StEvent and...
Definition: StMuDstMaker.h:373
int addType(TClonesArray *tcaTo, U &u, T *t)
virtual void Clear(Option_t *option="")
int addTrack(TClonesArray *tca, const StEvent *event, const StTrack *track, const StVertex *vtx, StMuCut *cut, int index2Global, bool l3=false, TClonesArray *covgTCA=0, TClonesArray *covpTCA=0)
virtual void closeRead()
string mCurrentFileName
Definition: StMuDstMaker.h:237
static int arrayCounters[__NALLARRAYS__]
< number of entries in current event, currently not used
Definition: StMuArrays.h:122
size of the strangeness arrays, i.e. number of TClonesArrays
Definition: StMuArrays.h:52
StMuPmdUtil * mPmdUtil
Definition: StMuDstMaker.h:211
StMuPmdCollection * mPmdCollection
Definition: StMuDstMaker.h:364
void fillDetectorStates(StEvent *ev)
TClonesArray ** mTofArrays
Definition: StMuDstMaker.h:352
string mFilter
Definition: StMuDstMaker.h:221
size of the fgt arrays, i.e. number of TClonesArrays
Definition: StMuArrays.h:62
virtual void write()
void setBranchAddresses()
TClonesArray ** mArrays
Definition: StMuDstMaker.h:344
virtual int Make()
virtual int openRead()
void connectEmcCollection()
routine to set up connection between mEmcCollection and Emc arrays
size of the 'regular stuff' arrays, i.e. number of TClonesArrays (add two more for global and primary...
Definition: StMuArrays.h:50
string basename(string)
void fillFms(StEvent *ev)
char mStatusArrays[__NALLARRAYS__]
Definition: StMuDstMaker.h:359
void fillTracks(StEvent *ev, StMuCut *cut=0)
size of the emc arrays, i.e. number of TClonesArrays
Definition: StMuArrays.h:55
TClonesArray ** mBTofArrays
dongx
Definition: StMuDstMaker.h:354
StMuDst * mStMuDst
Definition: StMuDstMaker.h:203
StEvent * mStEvent
Definition: StMuDstMaker.h:202
StMuTofUtil * mTofUtil
Definition: StMuDstMaker.h:212
void fillL3AlgorithmInfo(StEvent *ev)
void connectPmdCollection()
TClonesArray * mAArrays[__NALLARRAYS__]
Definition: StMuDstMaker.h:343
size of the MCness arrays, i.e. number of TClonesArrays
Definition: StMuArrays.h:54
size of the ez arrays >
Definition: StMuArrays.h:63
virtual int Finish()
void addTrackNode(const StEvent *ev, const StTrackNode *node, StMuCut *cut, TClonesArray *gTCA=0, TClonesArray *pTCA=0, TClonesArray *oTCA=0, TClonesArray *covgTCA=0, TClonesArray *covpTCA=0, bool l3=false)
StIOMaker * mIOMaker
Definition: StMuDstMaker.h:207
void fillMuFms(StMuFmsCollection *, StFmsCollection *)
Definition: StMuFmsUtil.cxx:88
StMuBTofUtil * mBTofUtil
dongx
Definition: StMuDstMaker.h:214
virtual void read()
TClonesArray ** mPmdArrays
Definition: StMuDstMaker.h:351
TClonesArray * mPmdCollectionArray
Definition: StMuDstMaker.h:363
string dirname(string)
void fillEmc(StEvent *ev)
void fillBTof(StEvent *ev)
dongx
StMuFmsUtil * mFmsUtil
Definition: StMuDstMaker.h:210