8 #include "Stiostream.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"
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"
29 #include "StarClassLibrary/StPhysicalHelixD.hh"
30 #include "StarClassLibrary/StTimer.hh"
31 #include "StarClassLibrary/StMatrixF.hh"
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"
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"
58 #include "StMuFilter.h"
59 #include "StMuL3Filter.h"
60 #include "StMuChainMaker.h"
61 #include "StMuEmcCollection.h"
62 #include "StMuEmcUtil.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"
98 #include "TStreamerInfo.h"
99 #include "TClonesArray.h"
100 #include "TEventList.h"
103 #include "StMuMcVertex.h"
104 #include "StMuMcTrack.h"
105 #include "StG2TrackVertexMap.h"
109 #if !(ST_NO_NAMESPACES)
110 using namespace units;
126 mStEvent(0), mStMuDst(0),
127 #ifndef __NO_STRANGE_MUDST__
128 mStStrangeMuDstMaker(0),
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),
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)
160 throw StMuExceptionNullPointer(
"StMuDstMaker:: constructor. Something went horribly wrong, cannot allocate pointers",__PRETTYF__);
169 FORCEDDEBUGMESSAGE(
"ATTENTION: use standard MuFilter");
170 FORCEDDEBUGMESSAGE(
"ATTENTION: use standard l3 MuFilter");
185 #ifndef __NO_STRANGE_MUDST__
204 #ifndef __NO_STRANGE_MUDST__
212 for (
int i=0; i<ezIndex; i++) {
229 #ifndef __NO_STRANGE_MUDST__
271 #ifndef __NO_STRANGE_MUDST__
272 static const char *specNames[]={
"MuEventAll",
"StrangeAll",
"MCAll" ,
"EmcAll",
"PmdAll",
"FMSAll",
"TofAll",
"BTofAll",
"MTDAll",
"FgtAll",
"EztAll",0};
274 static const char *specNames[]={
"MuEventAll",
"MCAll" ,
"EmcAll",
"PmdAll",
"FMSAll",
"TofAll",
"BTofAll",
"MTDAll",
"FgtAll",
"EztAll",0};
276 static const int specIndex[]={
279 #ifndef __NO_STRANGE_MUDST__
288 __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+
__NMTDARRAYS__,
289 __NARRAYS__+__NSTRANGEARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__+
__NFGTARRAYS__,
300 __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__+
__NFGTARRAYS__,
301 __NARRAYS__+__NMCARRAYS__+__NEMCARRAYS__+__NPMDARRAYS__+__NFMSARRAYS__+__NTOFARRAYS__+__NBTOFARRAYS__+__NMTDARRAYS__+__NFGTARRAYS__+
__NEZTARRAYS__,
305 if (strncmp(arrType,
"St",2)==0) arrType+=2;
306 for (
int i=0;specNames[i];i++) {
307 if (strcmp(arrType,specNames[i]))
continue;
309 int num=specIndex[i+1]-specIndex[i];
310 memset(sta,status,num);
311 LOG_INFO <<
"StMuDstMaker::SetStatus " << status <<
" to " << specNames[i] << endm;
317 TRegexp re(arrType,1);
330 StMuDstMaker::StMuDstMaker(
int mode,
int nameMode,
const char* dirName,
const char* fileName,
const char* filter,
int maxFiles,
const char* name) :
332 mStEvent(0), mStMuDst(0),
333 #ifndef __NO_STRANGE_MUDST__
334 mStStrangeMuDstMaker(0),
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)
408 DEBUGMESSAGE3(
"after arrays");
412 DEBUGMESSAGE3(
"after filter");
415 DEBUGMESSAGE3(
"after close");
420 DEBUGMESSAGE3(
"out");
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();
441 StMuMcVertex::Class()->IgnoreTObjectStreamer();
442 StMuMcTrack::Class()->IgnoreTObjectStreamer();
443 StMuTrack::Class()->IgnoreTObjectStreamer();
444 StMuPrimaryVertex::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();
482 p =
new TClonesArray(type, size);
499 mIOMaker = (StIOMaker*)GetMaker(
"IOMaker");
500 mTreeMaker = (StTreeMaker*)GetMaker(
"outputStream");
501 #ifndef __NO_STRANGE_MUDST__
504 TDataSet *muDstSet = AddObj(
mStMuDst,
".const");
505 if (muDstSet ) muDstSet ->SetName(
"muDst");
518 #ifndef __NO_STRANGE_MUDST__
523 mAArrays[fmsClusterIndex]->Clear(
"C");
529 DEBUGMESSAGE3(
"out");
543 int returnStarCode = kStOK;
548 DEBUGVALUE2(timer.elapsedTime());
549 return returnStarCode;
565 int returnStarCode = kStOK;
570 catch(StMuExceptionEOF e) {
572 returnStarCode = kStEOF;
574 catch(StMuException e) {
576 returnStarCode = kStERR;
579 return returnStarCode;
586 int returnStarCode = kStOK;
591 catch(StMuExceptionEOF e) {
593 returnStarCode = kStEOF;
595 catch(StMuException e) {
597 returnStarCode = kStERR;
600 return returnStarCode;
607 mStEvent = (StEvent*) GetInputDS(
"StEvent");
609 DEBUGMESSAGE2(
"no StEvent");
610 throw StMuExceptionNullPointer(
"no StEvent",__PRETTYF__);
617 StMuTrack::setProbabilityPidCentrality(uncorrectedNumberOfNegativePrimaries(*
mStEvent));
621 catch(StMuException e) {
634 catch (StMuException e) {
639 string ioMakerFileName;
640 string theFileName(
"/dev/null");
644 DEBUGMESSAGE2(
"===> ioFix\n");
648 DEBUGMESSAGE2(
"===> ioIOMaker\n");
649 ioMakerFileName = string(
mIOMaker->GetFile());
650 DEBUGVALUE2(ioMakerFileName);
655 ioMakerFileName =
mTreeMaker->GetTree()->GetBaseName();
659 DEBUGMESSAGE(
"do not know where to get the filename from");
662 DEBUGVALUE2(theFileName.c_str());
670 DEBUGMESSAGE2(
"now fill tree");
672 DEBUGMESSAGE2(
"tree filled");
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;
692 DEBUGMESSAGE3(
"out");
699 return mChain->GetFile()->GetName();
711 chain->SetBranchStatus(
"*",0);
713 Int_t emc_oldformat=0;
714 Int_t pmd_oldformat=0;
719 TBranch *tb = chain->GetBranch(bname);
721 #ifndef __NO_STRANGE_MUDST__
746 Warning(
"setBranchAddresses",
"Branch name %s does not exist",bname);
749 ts = bname; ts +=
"*";
750 chain->SetBranchStatus (ts,1);
751 if (strstr(
"MuEvent",bname) &&
mChain->GetBranch(
"MuEvent.mQA.fX")) {
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);
765 chain->SetBranchAddress(bname,
mAArrays+i);
766 assert(tb->GetAddress() == (
char*)(
mAArrays+i));
769 TBranch *branch=chain->GetBranch(
"EmcCollection");
771 Warning(
"setBranchAddresses",
"Using backward compatibility mode for EMC");
775 chain->SetBranchStatus(
"EmcCollection*",1);
777 StMuEmcHit::Class()->IgnoreTObjectStreamer(0);
794 TBranch *branch=chain->GetBranch(
"PmdCollection");
796 Warning(
"setBranchAddresses",
"Using backward compatibility mode for PMD");
800 chain->SetBranchStatus(
"PmdCollection*",1);
802 StMuPmdCluster::Class()->IgnoreTObjectStreamer(0);
821 StMuChainMaker chainMaker(
"MuDst");
838 DEBUGMESSAGE2(
"ATTENTION: No StMuChain ... results won't be exciting (nothing to do)");
839 throw StMuExceptionNullPointer(
"No input files",__PRETTYF__);
844 if (
mChain->GetCurrentFile()) {
845 DEBUGVALUE2(
mChain->GetCurrentFile()->GetName());
852 if (
mEventCounter >=
mChain->GetEntriesFast() )
throw StMuExceptionEOF(
"end of input",__PRETTYF__);
885 DEBUGVALUE2(fileName.c_str());
887 DEBUGMESSAGE2(
"now create file");
888 mCurrentFile =
new TFile(fileName.c_str(),
"RECREATE",
"StMuDst");
890 if (
mCurrentFile->IsZombie())
throw StMuExceptionNullPointer(
"no file openend",__PRETTYF__);
895 DEBUGMESSAGE2(
"now create trees and branches");
903 #if ROOT_VERSION_CODE < ROOT_VERSION(5,26,0)
904 Long64_t MAXLONG=100000000000LL;
905 LOG_INFO <<
"Tree size MAX will be " << (float) MAXLONG/1000/1000/1000 <<
" GB " << endm;
906 mTTree->SetMaxTreeSize(MAXLONG);
909 DEBUGMESSAGE2(
"all arrays");
920 DEBUGMESSAGE(__PRETTYF__);
922 LOG_INFO <<
" ##### " << __PRETTYF__ << endm;
923 LOG_INFO <<
" ##### File=" <<
mCurrentFile->GetName() <<
" ";
924 LOG_INFO <<
" NumberOfEvents= " <<
mTTree->GetEntries() <<
" ";
925 LOG_INFO <<
" ##### " << endm;
945 catch(StMuException e) {
963 catch(StMuException e) {
971 catch(StMuException e) {
979 catch(StMuException e) {
987 catch(StMuException e) {
995 catch(StMuException e) {
1000 #ifndef __NO_STRANGE_MUDST__
1005 catch(StMuException e) {
1030 StMuEvent *typeOfEvent=0;
1031 if (!ev)
throw StMuExceptionNullPointer(
"no StEvent",__PRETTYF__);
1034 if (!cut || cut->pass(ev)) {
1039 DEBUGVALUE2(timer.elapsedTime());
1046 StEmcCollection* emccol=(StEmcCollection*)ev->emcCollection();
1047 if (!emccol)
return;
1052 new((*tca)[0]) StMuEmcTowerData();
1061 DEBUGVALUE2(timer.elapsedTime());
1068 if (!fmscol)
return;
1077 LOG_DEBUG <<
"StMuDSTMaker filling StMuFmsCollection from StEvent" << endm;
1081 DEBUGVALUE2(timer.elapsedTime());
1087 StPhmdCollection* phmdColl=(StPhmdCollection*)ev->phmdCollection();
1088 if (!phmdColl)
return;
1100 DEBUGVALUE2(timer.elapsedTime());
1108 StTofCollection *tofcol = ev->tofCollection();
1110 if( !ev || !tofcol || (!tofcol->dataPresent()&&!tofcol->rawdataPresent()) )
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);
1124 StSPtrVecTofData &tofData = tofcol->tofData();
1125 for(
size_t i=0; i < tofData.size(); i++) {
1131 StSPtrVecTofRawData &tofRawData = tofcol->tofRawData();
1132 for(
size_t i=0; i < tofRawData.size(); i++) {
1137 DEBUGVALUE2(timer.elapsedTime());
1145 StBTofCollection *btofcol = ev->btofCollection();
1146 if( !ev || !btofcol || !btofcol->rawHitsPresent() )
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);
1160 StSPtrVecBTofRawHit &btofRawHits = btofcol->tofRawHits();
1161 for(
size_t i=0; i < btofRawHits.size(); i++) {
1166 StBTofHeader *btofHeader = btofcol->tofHeader();
1170 DEBUGVALUE2(timer.elapsedTime());
1177 const StFgtCollection* fgtCollPtr = 0;
1179 fgtCollPtr = ev->fgtCollection();
1189 StMuFgtCluster* clusterClassType = 0;
1193 std::map< Int_t, Int_t > stripGeoIdIdxMap;
1194 std::map< Int_t, Int_t >::iterator stripGeoIdIdxIter;
1197 for( UShort_t discIdx = 0; discIdx < kFgtNumDiscs; ++discIdx ){
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();
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){
1222 StMuFgtStrip fgtStrip( *(*stripIter) );
1228 Int_t nTBend = nTBstart + fgtCollPtr->getNumTimeBins();
1232 for( Int_t tb = nTBstart; tb < nTBend; ++tb ){
1234 StMuFgtAdc fgtAdc( (*stripIter)->getAdc( tb ), tb );
1239 if( tb == nTBstart ){
1242 fgtStrip.setAdcInfo( adcIdx, nTBend-nTBstart );
1250 stripGeoIdIdxMap[ (*stripIter)->getGeoId() ] = idx;
1256 stripWeightMap_t::const_iterator wIter;
1259 const StSPtrVecFgtHit& hitVec = fgtCollPtr->mHitCollection[ discIdx ].getHitVec();
1260 for( const_StFgtHitIterator hitIter = hitVec.begin(); hitIter != hitVec.end(); ++hitIter ){
1261 if( (*hitIter)->charge() > 0 ){
1263 Int_t clusIdx =
addType(
mFgtArrays[muFgtClusters], *(*hitIter), clusterClassType );
1266 const stripWeightMap_t& wMap = (*hitIter)->getStripWeightMap();
1270 for( wIter = wMap.begin(); wIter != wMap.end(); ++wIter ){
1272 Int_t geoId = wIter->first->getGeoId();
1273 Float_t weight = wIter->second;
1276 stripGeoIdIdxIter = stripGeoIdIdxMap.find( geoId );
1279 assert( stripGeoIdIdxIter != stripGeoIdIdxMap.end() );
1281 Int_t stripIdx = stripGeoIdIdxIter->second;
1284 StMuFgtStripAssociation association( clusIdx, stripIdx, weight );
1287 Int_t associationIdx =
addType(
mFgtArrays[muFgtStripAssociations], association );
1294 StMuFgtCluster* clusPtr = (StMuFgtCluster*)
mFgtArrays[muFgtClusters]->UncheckedAt( clusIdx );
1295 clusPtr->setFirstStripAssociationIndex( associationIdx );
1311 const StMtdCollection *mtd=ev->mtdCollection();
1313 StMuMtdCollection mMTD(*mtd);
1315 for(
size_t i=0; i < (size_t)mMTD.hitsPresent(); i++) {
1316 StMuMtdHit* mtdHit = (StMuMtdHit*)mMTD.MtdHit(i);
1320 for(
size_t i=0; i < (size_t)mMTD.rawHitsPresent(); i++) {
1321 StMtdRawHit* mtdHit = (StMtdRawHit*)mMTD.RawMtdHit(i);
1324 StMuMtdHeader *mtdHead = mMTD.mtdHeader();
1329 DEBUGVALUE2(timer.elapsedTime());
1338 #ifndef __NO_STRANGE_MUDST__
1344 EztEventHeader* header =
mEzTree->copyHeader(ev);
1349 EztTrigBlob* trig =
mEzTree->copyTrig(ev);
1355 EztFpdBlob* fpd =
mEzTree->copyFpd(ev);
1360 StEmcCollection* emcCol=(StEmcCollection*)ev->emcCollection();
1362 gMessMgr->Message(
"",
"W") << GetName()<<
"::fillEzt(), missing StEmcCollection, EEMC raw data NOT saved in muDst" <<endm;
1364 StEmcRawData *eeRaw=emcCol->eemcRawData();
1367 EztEmcRawData* ETow =
mEzTree->copyETow(eeRaw);
1371 if(eztArrayStatus[muEztESmd]) {
1372 EztEmcRawData* ESmd =
mEzTree->copyESmd(eeRaw);
1384 if ( !ev->l3Trigger() )
return;
1385 if ( !ev->l3Trigger()->l3EventSummary())
return;
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())
1398 DEBUGVALUE2(timer.elapsedTime());
1408 StMuPrimaryVertex *typeOfVertex=0;
1409 Int_t n_vtx = ev->numberOfPrimaryVertices();
1412 for (Int_t i_vtx=0; i_vtx < n_vtx; i_vtx++) {
1413 const StPrimaryVertex *vtx=ev->primaryVertex(i_vtx);
1415 mVtxList.AddAtAndExpand(ev->primaryVertex(i_vtx),i_vtx);
1418 DEBUGVALUE2(timer.elapsedTime());
1427 StMuRpsCollection *typeOfRps=0;
1429 const StRpsCollection *rps=ev->rpsCollection();
1432 DEBUGVALUE2(timer.elapsedTime());
1444 StSPtrVecTrackNode& nodes= ev->trackNodes();
1445 DEBUGVALUE2(nodes.size());
1446 for (StSPtrVecTrackNodeConstIterator iter=nodes.begin(); iter!=nodes.end(); iter++) {
1450 DEBUGVALUE2(timer.elapsedTime());
1457 if (!ev->l3Trigger())
return;
1461 StSPtrVecTrackNode& nodes= ev->l3Trigger()->trackNodes();
1462 DEBUGVALUE2(nodes.size());
1463 for (StSPtrVecTrackNodeConstIterator iter=nodes.begin(); iter!=nodes.end(); iter++) {
1467 DEBUGVALUE2(timer.elapsedTime());
1477 StDetectorState* state = ev->detectorState((StDetectorId) i);
1483 DEBUGVALUE2(timer.elapsedTime());
1489 TClonesArray* gTCA, TClonesArray* pTCA, TClonesArray* oTCA, TClonesArray* covgTCA, TClonesArray* covpTCA,
bool l3) {
1491 const StTrack* tr=0;
1494 int index2Global =-1;
1496 const StTrack *pr_tr = node->track(primary);
1497 const StVertex *vtx = 0;
1499 vtx = pr_tr->vertex();
1501 vtx = ev->primaryVertex();
1503 tr= node->track(global);
1504 if (tr && !tr->bad()) index2Global =
addTrack(gTCA, ev, tr, vtx, cut, -1, l3, covgTCA, covpTCA);
1509 tr = node->track(primary);
1510 if (tr && !tr->bad()) index =
addTrack(pTCA, ev, tr, tr->vertex(), cut, index2Global, l3, covgTCA, covpTCA);
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);
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) {
1529 StRichSpectra typeOfStRichSpectra;
1531 int index2RichSpectra=-1;
1533 int counter = tca->GetEntries();
1535 if (cut && !cut->pass(track))
throw StMuExceptionBadValue(
"failed track cut",__PRETTYF__);
1542 StMuTrack *muTrack =
new((*tca)[counter]) StMuTrack(event, track, vtx, index2Global, index2RichSpectra, l3, &
mVtxList);
1543 if (track->type() == primary) {
1545 Int_t countCOVPTCA = covpTCA->GetEntries();
1547 const StMatrixF covMatrix = track->fitTraits().covariantMatrix();
1548 new((*covpTCA)[countCOVPTCA]) StMuPrimaryTrackCovariance(covMatrix);
1551 const Float_t* cov = track->fitTraits().covariance();
1552 new((*covpTCA)[countCOVPTCA]) StMuPrimaryTrackCovariance(cov);
1554 muTrack->setIndex2Cov(countCOVPTCA);
1558 if (track->type() == global) {
1560 Int_t countCOVGTCA = covgTCA->GetEntries();
1561 const StDcaGeometry *dcaGeometry = ((StGlobalTrack *)track)->dcaGeometry();
1563 new((*covgTCA)[countCOVGTCA]) StDcaGeometry(*dcaGeometry);
1564 muTrack->setIndex2Cov(countCOVGTCA);
1571 catch (StMuException e) {
1572 IFDEBUG3(e.print());
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();
1588 #ifndef __NO_STRANGE_MUDST__
1592 if (!maker)
throw StMuExceptionNullPointer(
"no StrangeMuDstMaker",__PRETTYF__);
1594 StStrangeEvMuDst *ev=0;
1596 StStrangeAssoc *assoc=0;
1598 StKinkMuDst *kink=0;
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);
1629 StMuMcVertex *mcvx = 0;
1630 StMuMcTrack *mctr = 0;
1631 g2t_vertex_st *vertex = g2t_vertex->GetTable();
1632 UInt_t NV = g2t_vertex->GetNRows();
1634 g2t_track_st *track = g2t_track->GetTable();
1635 UInt_t NT = g2t_track->GetNRows();
1644 if (tcaFrom && tcaTo) {
1645 int n = tcaFrom->GetEntries();
1646 int counter = tcaTo->GetEntries();
1647 for (
int i=0; i<n;i++) {
1649 new((*tcaTo)[counter++]) T( *(T*)(
void*)tcaFrom->UncheckedAt(i) );
1673 counter = tcaTo->GetEntries();
1674 new((*tcaTo)[counter]) T( t );
1681 template <
class T,
class U>
1685 counter = tcaTo->GetEntries();
1687 new((*tcaTo)[counter]) T(u);
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);
1709 DEBUGVALUE3(s.c_str());
1711 DEBUGVALUE3(name.c_str());
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());
1729 DEBUGVALUE3(name.c_str());
1731 pos = name.find_last_of(
"/");
1733 if (pos != string::npos ) name.erase(pos, name.length());
1734 if (name == s) name =
".";
1745 const char *PIDtable=
"PIDTableP01gl.root";
1747 flnm << getenv(
"STAR") <<
"/StarDb/dEdxModel/" << PIDtable << ends;
1748 FORCEDDEBUGMESSAGE(
"ATTENTION: pid table hardwired to " << flnm.str() );
1751 flnm << file << ends;
1752 FORCEDDEBUGMESSAGE(
"Using pid table to user value " << flnm.str() );
1769 printf(
" Array %s\t = %s::%s(%d)\n",
1771 tcl->ClassName(),tcl->GetName(),tcl->GetEntriesFast());
1781 StEventInfo &ei = me->eventInfo();
1782 StRunInfo &ri = me->runInfo();
1783 StEvtHddr *hd = GetEvtHddr();
1785 hd->SetRunNumber(ei.runId()) ;
1786 hd->SetEventType(ei.type().Data());
1787 hd->SetTriggerMask(ei.triggerMask()) ;
1789 hd->SetBunchCrossingNumber(ei.bunchCrossingNumber(0),ei.bunchCrossingNumber(1));
1790 hd->SetCenterOfMassEnergy(ri.centerOfMassEnergy());
1799 hd->SetGMTime((
unsigned int)ei.time());
1800 hd->SetProdDateTime(ri.productionTime());
1802 hd->SetEventSize(ei.eventSize());
1803 hd->SetEventNumber(ei.id()) ;
void fillL3Tracks(StEvent *ev, StMuCut *cut=0)
void fillVertices(StEvent *ev)
static int arraySizes[__NALLARRAYS__]
< maximum sizes of the TClonesArrays
void fillStrange(StStrangeMuDstMaker *)
TClonesArray ** mFgtArrays
void fillpp2pp(StEvent *ev)
static const char * arrayTypes[__NALLARRAYS__]
< names of the classes, the TClonesArrays are arrays of this type
void fillMtd(StEvent *ev)
TClonesArray ** mFmsArrays
void fillTrees(StEvent *ev, StMuCut *cut=0)
void fillEvent(StEvent *ev, StMuCut *cut=0)
StMuFmsCollection * mFmsCollection
void fillTof(StEvent *ev)
virtual Int_t MakeWrite()
TClonesArray ** mEztArrays
StRichSpectra * richSpectra(const StTrack *track)
TClonesArray ** mEmcArrays
void setProbabilityPidFile(const char *file=NULL)
Set the file from where the PID probability tables should be read.
void connectFmsCollection()
StStrangeMuDstMaker * mStStrangeMuDstMaker
virtual void openWrite(string fileName)
protected:
void setFmsPointArray(TClonesArray *array)
TClonesArray * clonesArray(TClonesArray *&p, const char *type, int size, int &counter)
StMuEmcCollection * mEmcCollection
virtual void closeWrite()
TClonesArray * mEmcCollectionArray
static const char * arrayNames[__NALLARRAYS__]
size of the fms arrays, i.e. number of TClonesArrays
size of the pmd arrays, i.e. number of TClonesArrays
void fillPmd(StEvent *ev)
TClonesArray ** mMtdArrays
void setL3TrackFilter(StMuCut *c)
Set the track filter used for L3 tracks when creating muDsts from StEvent and writing to disk...
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 fillFgt(StEvent *ev)
StuProbabilityPidAlgorithm * mProbabilityPidAlgorithm
void fillEzt(StEvent *ev)
ClassImp(StMuDstMaker) using namespace units
dongx
void setFmsClusterArray(TClonesArray *array)
TClonesArray ** mMCArrays
StMuDstMaker(const char *name="MuDst")
Default constructor.
TClonesArray ** mStrangeArrays
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...
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)
static int arrayCounters[__NALLARRAYS__]
< number of entries in current event, currently not used
size of the strangeness arrays, i.e. number of TClonesArrays
StMuPmdCollection * mPmdCollection
void fillDetectorStates(StEvent *ev)
TClonesArray ** mTofArrays
size of the fgt arrays, i.e. number of TClonesArrays
void setBranchAddresses()
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...
void fillFms(StEvent *ev)
char mStatusArrays[__NALLARRAYS__]
void fillTracks(StEvent *ev, StMuCut *cut=0)
size of the emc arrays, i.e. number of TClonesArrays
TClonesArray ** mBTofArrays
dongx
void fillL3AlgorithmInfo(StEvent *ev)
void connectPmdCollection()
TClonesArray * mAArrays[__NALLARRAYS__]
size of the MCness arrays, i.e. number of TClonesArrays
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)
void fillMuFms(StMuFmsCollection *, StFmsCollection *)
StMuBTofUtil * mBTofUtil
dongx
TClonesArray ** mPmdArrays
TClonesArray * mPmdCollectionArray
void fillEmc(StEvent *ev)
void fillBTof(StEvent *ev)
dongx