7 #include <unordered_map>
14 #include "TClonesArray.h"
17 #include "TObjectSet.h"
20 #include "StChain/StChain.h"
21 #include "StChain/StChainOpt.h"
22 #include "St_base/StMessMgr.h"
23 #include "StarRoot/TAttr.h"
24 #include "StarRoot/THelixTrack.h"
25 #include "StarClassLibrary/StThreeVector.hh"
26 #include "StarClassLibrary/StThreeVectorF.hh"
27 #include "StarClassLibrary/StThreeVectorD.hh"
28 #include "StarClassLibrary/StHelix.hh"
29 #include "StarClassLibrary/StPhysicalHelix.hh"
30 #include "StarClassLibrary/PhysicalConstants.h"
32 #include "StEvent/StEvent.h"
33 #include "StEvent/StBTofHeader.h"
34 #include "StEvent/StDcaGeometry.h"
35 #include "StEvent/StEmcCollection.h"
36 #include "StEvent/StEmcCluster.h"
37 #include "StEvent/StEmcDetector.h"
38 #include "StEvent/StEmcModule.h"
39 #include "StEvent/StEmcRawHit.h"
40 #include "StEvent/StTriggerData.h"
42 #include "StEvent/StL0Trigger.h"
44 #include "StMuDSTMaker/COMMON/StMuDst.h"
45 #include "StMuDSTMaker/COMMON/StMuEvent.h"
46 #include "StMuDSTMaker/COMMON/StMuBTofHit.h"
47 #include "StMuDSTMaker/COMMON/StMuTrack.h"
48 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
49 #include "StMuDSTMaker/COMMON/StMuMtdHit.h"
50 #include "StMuDSTMaker/COMMON/StMuMtdPidTraits.h"
51 #include "StMuDSTMaker/COMMON/StMuMtdHeader.h"
52 #include "StMuDSTMaker/COMMON/StMuEmcCollection.h"
53 #include "StMuDSTMaker/COMMON/StMuEmcPoint.h"
54 #include "StMuDSTMaker/COMMON/StMuEmcUtil.h"
55 #include "StMuDSTMaker/COMMON/StMuFmsUtil.h"
56 #include "StMuDSTMaker/COMMON/StMuEpdHit.h"
57 #include "StMuDSTMaker/COMMON/StMuETofHit.h"
58 #include "StMuDSTMaker/COMMON/StMuETofDigi.h"
59 #include "StMuDSTMaker/COMMON/StMuETofHeader.h"
60 #include "StMuDSTMaker/COMMON/StMuMcTrack.h"
61 #include "StMuDSTMaker/COMMON/StMuMcVertex.h"
63 #include "StTriggerUtilities/StTriggerSimuMaker.h"
64 #include "StTriggerUtilities/Bemc/StBemcTriggerSimu.h"
66 #include "StEmcUtil/geometry/StEmcGeom.h"
67 #include "StEmcUtil/others/emcDetectorName.h"
68 #include "StEmcUtil/projection/StEmcPosition.h"
69 #include "StEmcRawMaker/defines.h"
70 #include "StEmcRawMaker/StBemcTables.h"
72 #include "StFmsDbMaker/StFmsDbMaker.h"
74 #include "tables/St_mtdModuleToQTmap_Table.h"
75 #include "tables/St_mtdQTSlewingCorr_Table.h"
76 #include "tables/St_mtdQTSlewingCorrPart2_Table.h"
79 #include "StPicoEvent/StPicoEvent.h"
80 #include "StPicoEvent/StPicoTrack.h"
81 #include "StPicoEvent/StPicoEmcTrigger.h"
82 #include "StPicoEvent/StPicoMtdTrigger.h"
83 #include "StPicoEvent/StPicoBbcHit.h"
84 #include "StPicoEvent/StPicoEpdHit.h"
85 #include "StPicoEvent/StPicoBTowHit.h"
86 #include "StPicoEvent/StPicoBTofHit.h"
87 #include "StPicoEvent/StPicoMtdHit.h"
88 #include "StPicoEvent/StPicoFmsHit.h"
89 #include "StPicoEvent/StPicoBEmcPidTraits.h"
90 #include "StPicoEvent/StPicoBTofPidTraits.h"
91 #include "StPicoEvent/StPicoMtdPidTraits.h"
92 #include "StPicoEvent/StPicoTrackCovMatrix.h"
93 #include "StPicoEvent/StPicoBEmcSmdEHit.h"
94 #include "StPicoEvent/StPicoBEmcSmdPHit.h"
95 #include "StPicoEvent/StPicoETofHit.h"
96 #include "StPicoEvent/StPicoETofPidTraits.h"
97 #include "StPicoEvent/StPicoMcVertex.h"
98 #include "StPicoEvent/StPicoMcTrack.h"
99 #include "StPicoEvent/StPicoArrays.h"
100 #include "StPicoEvent/StPicoDst.h"
101 #include "StPicoDstMaker/StPicoDstMaker.h"
103 #if defined (__TFG__VERSION__)
104 #include "StarRoot/TDirIter.h"
105 #include "StMuDSTMaker/COMMON/StMuProbPidTraits.h"
108 static Int_t _debug = 0;
111 #include "StPicoDstMaker/StPicoUtilities.h"
116 #if !defined (__TFG__VERSION__)
117 mTpcVpdVzDiffCut(6.),
119 mMuDst(nullptr), mPicoDst(new
StPicoDst()),
120 mEmcCollection(nullptr), mEmcPosition(nullptr),
121 mEmcGeom{}, mEmcIndex{},
123 #if !defined (__TFG__VERSION__)
124 mVtxMode(PicoVtxMode::NotSet),
126 mCovMtxMode(PicoCovMtxMode::Skip),
127 mBEmcSmdMode(PicoBEmcSmdMode::SmdSkip),
128 mInputFileName(), mOutputFileName(), mOutputFile(
nullptr),
129 mChain(
nullptr), mTTree(
nullptr), mEventCounter(0), mSplit(99), mCompression(9), mBufferSize(65536 * 4),
130 mModuleToQT{}, mModuleToQTPos{}, mQTtoModule{}, mQTSlewBinEdge{}, mQTSlewCorr{},
131 mPicoArrays{}, mStatusArrays{},
132 mFmsFiller(*mPicoDst) {
136 std::fill_n(mStatusArrays,
sizeof(mStatusArrays) /
sizeof(mStatusArrays[0]), 1);
138 #if defined (__TFG__VERSION__)
139 fgPicoDstMaker =
this;
148 mInputFileName = fileName;
156 #if defined (__TFG__VERSION__)
162 void StPicoDstMaker::clearArrays() {
163 for(Int_t i=0; i<StPicoArrays::NAllPicoArrays; i++) {
164 mPicoArrays[i]->Clear();
183 if(strncmp(branchNameRegex,
"St", 2) == 0) {
184 branchNameRegex += 2;
187 TRegexp re(branchNameRegex, 1);
188 for(Int_t i=0; i<StPicoArrays::NAllPicoArrays; i++) {
193 LOG_INFO <<
"StPicoDstMaker::SetStatus " << enable <<
" to "
195 mStatusArrays[i] = enable;
199 setBranchAddresses(mChain);
204 void StPicoDstMaker::setBranchAddresses(TChain* chain) {
206 chain->SetBranchStatus(
"*", 0);
208 for (
int i = 0; i < StPicoArrays::NAllPicoArrays; ++i) {
209 if (mStatusArrays[i] == 0)
continue;
211 TBranch* tb = chain->GetBranch(bname);
213 LOG_WARN <<
"setBranchAddress: Branch name " << bname
214 <<
" does not exist!" << endm;
219 chain->SetBranchStatus(ts, 1);
220 chain->SetBranchAddress(bname, mPicoArrays + i);
221 assert(tb->GetAddress() == (
char*)(mPicoArrays + i));
223 mTTree = mChain->GetTree();
227 void StPicoDstMaker::streamerOff() {
230 StPicoEvent::Class()->IgnoreTObjectStreamer();
231 StPicoTrack::Class()->IgnoreTObjectStreamer();
232 StPicoBTofHit::Class()->IgnoreTObjectStreamer();
233 StPicoBTowHit::Class()->IgnoreTObjectStreamer();
234 StPicoMtdHit::Class()->IgnoreTObjectStreamer();
235 StPicoBbcHit::Class()->IgnoreTObjectStreamer();
236 StPicoEpdHit::Class()->IgnoreTObjectStreamer();
237 StPicoFmsHit::Class()->IgnoreTObjectStreamer();
238 StPicoBEmcSmdEHit::Class()->IgnoreTObjectStreamer();
239 StPicoBEmcSmdPHit::Class()->IgnoreTObjectStreamer();
240 StPicoEmcTrigger::Class()->IgnoreTObjectStreamer();
241 StPicoMtdTrigger::Class()->IgnoreTObjectStreamer();
242 StPicoBTofPidTraits::Class()->IgnoreTObjectStreamer();
243 StPicoBEmcPidTraits::Class()->IgnoreTObjectStreamer();
244 StPicoMtdPidTraits::Class()->IgnoreTObjectStreamer();
245 StPicoTrackCovMatrix::Class()->IgnoreTObjectStreamer();
246 StPicoETofHit::Class()->IgnoreTObjectStreamer();
247 StPicoETofPidTraits::Class()->IgnoreTObjectStreamer();
248 StPicoMcVertex::Class()->IgnoreTObjectStreamer();
249 StPicoMcTrack::Class()->IgnoreTObjectStreamer();
253 void StPicoDstMaker::createArrays() {
255 for (Int_t i = 0; i < (StPicoArrays::NAllPicoArrays); ++i) {
259 mPicoDst->
set(mPicoArrays);
265 #if defined (__TFG__VERSION__)
271 case PicoIoMode::IoWrite:
273 #if defined (__TFG__VERSION__)
274 if (StMuDst::vtxMode() == PicoVtxMode::NotSet) {
276 if (mVtxMode == PicoVtxMode::NotSet) {
279 if (setVtxModeAttr() !=
kStOK) {
280 LOG_ERROR <<
"Pico Vertex Mode is not set ... " << endm;
286 if (setCovMtxModeAttr() !=
kStOK) {
287 LOG_ERROR <<
"Pico covariance matrix I/O mode is not set ..." << endm;
292 if (setBEmcSmdModeAttr() !=
kStOk) {
293 LOG_ERROR <<
"Pico BEmc Smd I/O mode is not set ..." << endm;
297 #if !defined (__TFG__VERSION__)
299 if (mInputFileName.Length() == 0) {
301 mOutputFileName = GetChainOpt()->GetFileOut();
302 mOutputFileName.ReplaceAll(
".root",
".picoDst.root");
305 mInputFileName = gSystem->BaseName(mInputFileName);
306 mOutputFileName = mInputFileName;
307 mOutputFileName.ReplaceAll(
"MuDst.root",
"picoDst.root");
309 if (mOutputFileName == mInputFileName) {
310 LOG_ERROR <<
"Input file is not a MuDst ... " << endm;
315 if (mInputFileName.Length() == 0) mInputFileName = GetChainOpt()->GetFileOut();
316 file = gSystem->BaseName(mInputFileName);
318 if (l < 0) l = file.Length();
319 mInputFileName = mInputFileName(mInputFileName.Index(
"st_"), mInputFileName.Length());
320 mOutputFileName = TString(file.Data(),l);
321 mOutputFileName +=
".picoDst.root";
328 case PicoIoMode::IoRead:
333 LOG_ERROR <<
"Pico IO mode is not set ... " << endm;
337 #if defined (__TFG__VERSION__)
338 #if defined (__HIST_PV__)
341 hists[0] =
new TH1F(
"dca3D",
"global track dca3D wrt best Vx",2000,0,200);
342 hists[1] =
new TH1F(
"dca3DLam",
"global track from Lambda",2000,0,200);
343 hists[2] =
new TH1F(
"dca3DK0s",
"global track from K0s",2000,0,200);
344 pVrZ =
new TH2F(
"pVrZ",
"rho VS Z for primary Vertex",200,-20,20,100,0,2);
345 pVxy =
new TH2F(
"pVxy",
"Y Vs X for primary Vertex",2000,-2,2,2000,-2,2);
354 Int_t StPicoDstMaker::setVtxModeAttr(){
357 Float_t cut = DAttr(
"TpcVpdVzDiffCut");
358 #if defined (__TFG__VERSION__)
359 if ( cut != 0.0) StMuDst::instance()->SetTpcVpdVzDiffCut(cut);
360 LOG_INFO <<
" StMuDst::instance()->TpcVpdVzDiffCut() = " << StMuDst::instance()->TpcVpdVzDiffCut() << endm;
362 if ( cut != 0.0) mTpcVpdVzDiffCut = cut;
363 LOG_INFO <<
" mTpcVpdVzDiffCut = " << mTpcVpdVzDiffCut << endm;
366 if (strcasecmp(SAttr(
"PicoVtxMode"),
"PicoVtxDefault") == 0) {
368 LOG_INFO <<
" PicoVtxDefault is being used " << endm;
371 else if (strcasecmp(SAttr(
"PicoVtxMode"),
"PicoVtxVpd") == 0) {
373 LOG_INFO <<
" PicoVtxVpd is being used " << endm;
376 else if (strcasecmp(SAttr(
"PicoVtxMode"),
"PicoVtxVpdOrDefault") == 0) {
378 LOG_INFO <<
" PicoVtxVpdOrDefault is being used " << endm;
381 else if (strcasecmp(SAttr(
"PicoVtxMode"),
"PicoVtxFXT") == 0) {
383 LOG_INFO <<
" PicoVtxFXT is being used " << endm;
386 #if !defined (__TFG__VERSION__)
387 else if (strcasecmp(SAttr(
"PicoVtxMode"),
"PicoVtxMtd") == 0) {
389 LOG_INFO <<
" PicoVtxMtd is being used " << endm;
398 Int_t StPicoDstMaker::setCovMtxModeAttr() {
402 if (strcasecmp(SAttr(
"PicoCovMtxMode"),
"PicoCovMtxWrite") == 0) {
404 LOG_INFO <<
" PicoCovMtxWrite is being used " << endm;
407 else if ( (strcasecmp(SAttr(
"PicoCovMtxMode"),
"") == 0) ||
408 (strcasecmp(SAttr(
"PicoCovMtxMode"),
"PicoCovMtxSkip") == 0) ){
410 LOG_INFO <<
" PicoCovMtxSkip is being used " << endm;
431 Int_t StPicoDstMaker::setBEmcSmdModeAttr() {
434 if (strcasecmp(SAttr(
"PicoBEmcSmdMode"),
"PicoBEmcSmdWrite") == 0) {
436 LOG_INFO <<
" PicoBEmcSmdWrite is being used " << endm;
439 else if ( (strcasecmp(SAttr(
"PicoBEmcSmdMode"),
"") == 0) ||
440 (strcasecmp(SAttr(
"PicoBEmcSmdMode"),
"PicoBEmcSmdSkip") == 0) ){
442 LOG_INFO <<
" PicoBEmcSmdSkip is being used " << endm;
452 if (!initMtd(runnumber)) {
453 LOG_ERROR <<
" MTD initialization error!!! " << endm;
461 Bool_t StPicoDstMaker::initMtd(Int_t
const runnumber) {
464 int year = runnumber / 1e6 + 1999;
465 if ((runnumber % 1000000) / 1000 >= 273) year += 1;
466 LOG_INFO <<
"Run = " << runnumber <<
" year = " << year << endm;
469 for (Int_t i = 0; i < 30; ++i) {
470 for (Int_t j = 0; j < 5; ++j) {
471 mModuleToQT[i][j] = -1;
472 mModuleToQTPos[i][j] = -1;
475 for (Int_t i = 0; i < 8; ++i) {
476 for (Int_t j = 0; j < 8; ++j) {
477 mQTtoModule[i][j] = -1;
481 LOG_INFO <<
"Retrieving mtdModuleToQTmap table from database ..." << endm;
482 TDataSet* dataset = GetDataBase(
"Geometry/mtd/mtdModuleToQTmap");
484 LOG_ERROR <<
"No database (mtdModuleToQTmap) was found" << endm;
487 St_mtdModuleToQTmap* mtdModuleToQTmap =
static_cast<St_mtdModuleToQTmap*
>(dataset->
Find(
"mtdModuleToQTmap"));
488 if (!mtdModuleToQTmap) {
489 LOG_ERROR <<
"No mtdModuleToQTmap table was found in database" << endm;
492 mtdModuleToQTmap_st* mtdModuleToQTtable =
static_cast<mtdModuleToQTmap_st*
>(mtdModuleToQTmap->GetTable());
493 if(!mtdModuleToQTtable) {
494 LOG_ERROR <<
"No mtdModuleToQTtable was found in mtdModuleToQTmap" << endm;
498 for (Int_t i = 0; i < 30; ++i) {
499 for (Int_t j = 0; j < 5; ++j) {
500 Int_t index = i * 5 + j;
501 Int_t qt = mtdModuleToQTtable->qtBoardId[index];
502 Int_t channel = mtdModuleToQTtable->qtChannelId[index];
503 mModuleToQT[i][j] = qt;
505 mModuleToQTPos[i][j] = channel;
508 if (channel % 8 == 1) {
509 mModuleToQTPos[i][j] = 1 + channel / 8 * 2;
512 mModuleToQTPos[i][j] = 2 + channel / 8 * 2;
515 if (mModuleToQT[i][j] > 0 && mModuleToQTPos[i][j] > 0) {
516 mQTtoModule[mModuleToQT[i][j] - 1][mModuleToQTPos[i][j] - 1] = j + 1;
522 for (
int j = 0; j < 8; ++j) {
523 for (
int i = 0; i < 16; ++i) {
524 for (Int_t k = 0; k < 8; ++k) {
525 mQTSlewBinEdge[j][i][k] = -1;
526 mQTSlewCorr[j][i][k] = -1;
531 LOG_INFO <<
"Retrieving mtdQTSlewingCorr table from database ..." << endm;
532 dataset = GetDataBase(
"Calibrations/mtd/mtdQTSlewingCorr");
533 St_mtdQTSlewingCorr* mtdQTSlewingCorr = dataset ?
static_cast<St_mtdQTSlewingCorr*
>(dataset->
Find(
"mtdQTSlewingCorr")) :
nullptr;
534 if (!mtdQTSlewingCorr) {
535 LOG_ERROR <<
"No mtdQTSlewingCorr table found in database" << endm;
538 mtdQTSlewingCorr_st* mtdQTSlewingCorrtable =
static_cast<mtdQTSlewingCorr_st*
>(mtdQTSlewingCorr->GetTable());
539 for (
int j = 0; j < 4; ++j) {
540 for (
int i = 0; i < 16; ++i) {
541 for (Int_t k = 0; k < 8; ++k) {
542 Int_t index = j * 16 * 8 + i * 8 + k;
543 mQTSlewBinEdge[j][i][k] = (int) mtdQTSlewingCorrtable->slewingBinEdge[index];
544 mQTSlewCorr[j][i][k] = (
int) mtdQTSlewingCorrtable->slewingCorr[index];
549 dataset = GetDataBase(
"Calibrations/mtd/mtdQTSlewingCorrPart2");
550 St_mtdQTSlewingCorrPart2* mtdQTSlewingCorr2 = dataset ?
static_cast<St_mtdQTSlewingCorrPart2*
>(dataset->
Find(
"mtdQTSlewingCorrPart2")) :
nullptr;
551 if (!mtdQTSlewingCorr2) {
552 LOG_ERROR <<
"No mtdQTSlewingCorr2 table found in database for year " << year << endm;
555 mtdQTSlewingCorrPart2_st* mtdQTSlewingCorrtable2 =
static_cast<mtdQTSlewingCorrPart2_st*
>(mtdQTSlewingCorr2->GetTable());
556 for (
int j = 0; j < 4; ++j) {
557 for (
int i = 0; i < 16; ++i) {
558 for (Int_t k = 0; k < 8; ++k) {
559 Int_t index = j * 16 * 8 + i * 8 + k;
560 mQTSlewBinEdge[j + 4][i][k] = (int) mtdQTSlewingCorrtable2->slewingBinEdge[index];
561 mQTSlewCorr[j + 4][i][k] = (
int) mtdQTSlewingCorrtable2->slewingCorr[index];
584 Int_t StPicoDstMaker::openRead() {
586 if (!mChain) mChain =
new TChain(
"PicoDst");
588 string const dirFile = mInputFileName.Data();
589 if (dirFile.find(
".list") != string::npos) {
590 ifstream inputStream(dirFile.c_str());
593 LOG_ERROR <<
"ERROR: Cannot open list file " << dirFile << endm;
600 while ( getline(inputStream, file) ) {
604 pos = file.find_first_of(
" ");
605 if (pos!=string::npos ) file.erase(pos,file.length()-pos);
608 if (file.find(
".picoDst.root") != string::npos) {
609 TFile* ftmp = TFile::Open(file.c_str());
610 if (ftmp && !ftmp->IsZombie() && ftmp->GetNkeys()) {
611 LOG_INFO <<
" Read in picoDst file " << file << endm;
612 mChain->Add(file.c_str());
616 if (ftmp) ftmp->Close();
620 LOG_INFO <<
" Total " << nFile <<
" files have been read in. " << endm;
623 else if (dirFile.find(
".picoDst.root") != string::npos) {
624 mChain->Add(dirFile.c_str());
627 #if defined (__TFG__VERSION__)
631 while ((name = (Char_t *) Dir.NextFile())) {
632 TFile* ftmp = TFile::Open(name);
633 if (ftmp && !ftmp->IsZombie() && ftmp->GetNkeys()) {
634 LOG_INFO <<
" Read in picoDst file " << name << endm;
638 if (ftmp) ftmp->Close();
642 LOG_WARN <<
" No good input file to read ... " << endm;
644 #ifdef __TFG__VERSION__
650 setBranchAddresses(mChain);
651 mChain->SetCacheSize(50e6);
652 mChain->AddBranchToCache(
"*");
653 mPicoDst->
set(mPicoArrays);
659 void StPicoDstMaker::openWrite() {
661 mOutputFile =
new TFile(mOutputFileName.Data(),
"RECREATE");
662 LOG_INFO <<
" Output file: " << mOutputFileName.Data() <<
" created." << endm;
663 mOutputFile->SetCompressionLevel(mCompression);
664 int bufsize = mBufferSize;
665 if (mSplit) bufsize /= 4;
666 mTTree =
new TTree(
"PicoDst",
"StPicoDst", mSplit);
667 mTTree->SetAutoSave(1000000);
668 for (
int i = 0; i < StPicoArrays::NAllPicoArrays; ++i) {
669 if (mStatusArrays[i] == 0) {
679 void StPicoDstMaker::initEmc() {
684 for (
int i = 0; i < 4; ++i) {
685 mEmcGeom[i] = StEmcGeom::getEmcGeom(detname[i].Data());
693 StEmcDetector* mEmcDet = emcColl->detector(kBarrelEmcTowerId);
695 std::fill_n(mEmcIndex,
sizeof(mEmcIndex) /
sizeof(mEmcIndex[0]),
nullptr);
697 if (!mEmcDet)
return;
700 for (
size_t iMod = 1; iMod <= mEmcDet->numberOfModules(); ++iMod) {
702 StSPtrVecEmcRawHit& modHits = mEmcDet->module(iMod)->hits();
705 for (
size_t iHit = 0; iHit < modHits.size(); ++iHit) {
711 if(!rawHit)
continue;
713 UInt_t softId = rawHit->softId(1);
714 if (mEmcGeom[0]->checkId(softId) == 0) {
719 mEmcIndex[softId - 1] = rawHit;
726 void StPicoDstMaker::finishEmc() {
728 mEmcPosition =
nullptr;
730 std::fill_n(mEmcGeom, 4,
nullptr);
741 void StPicoDstMaker::closeRead() {
747 void StPicoDstMaker::closeWrite() {
750 mOutputFile->Write();
751 mOutputFile->Close();
759 int returnStarCode =
kStOK;
762 returnStarCode = MakeWrite();
765 returnStarCode = MakeRead();
766 #if defined (__TFG__VERSION__)
767 if ( !mPicoDst->IsGoodTrigger())
return kStSkip;
771 return returnStarCode;
775 Int_t StPicoDstMaker::MakeRead() {
778 LOG_WARN <<
" No input files ... ! EXIT" << endm;
782 int bytes = mChain->GetEntry(mEventCounter++);
784 if( mEventCounter >= mChain->GetEntriesFast() ) {
788 LOG_WARN <<
"Encountered invalid entry or I/O error while reading event "
789 << mEventCounter <<
" from \"" << mChain->GetName() <<
"\" input tree\n";
790 bytes = mChain->GetEntry(mEventCounter++);
799 Int_t StPicoDstMaker::MakeWrite() {
801 #if defined (__TFG__VERSION__)
802 mMuDst = StMuDst::instance();
804 StMaker::WhiteBoard(
"muDst", &mMuDst);
808 LOG_ERROR <<
"No \"StMuDst\" object found in this event. It is usually created by StMuDstMaker" << endm;
816 LOG_WARN <<
" No MuEvent " << endm;
822 #if defined (__TFG__VERSION__)
823 if (! mMuDst->numberOfMcVertices()) {
826 if (!selectVertex()) {
828 #if defined (__TFG__VERSION__)
829 static Int_t count = 0;
834 LOG_INFO <<
"Vertex is not valid" << endm;
836 #if defined (__TFG__VERSION__)
844 #if defined (__TFG__VERSION__)
847 static Int_t count = 0;
850 LOG_INFO <<
"Vertex is not valid" << endm;
857 mBField = muEvent->magneticField();
859 #if !defined (__TFG__VERSION__)
862 Bool_t isFromDaq = kFALSE;
863 if ( !mEmcCollection ) {
870 mEmcCollection = evt->emcCollection();
875 if (mEmcCollection) {
877 buildEmcIndex(mEmcCollection);
904 mFmsFiller.
fill(*mMuDst);
911 mEmcCollection =
nullptr;
920 void StPicoDstMaker::fillEventHeader()
const {
928 header->SetRunNumber(event->runId());
929 header->SetEventNumber(event->eventId());
930 header->SetGMTime( (UInt_t) (event->time()) );
934 void StPicoDstMaker::fillMcVertices() {
937 TClonesArray *mcVertices = mMuDst->mcArray(0);
940 for (Int_t iVtx=0; iVtx<mcVertices->GetEntriesFast(); iVtx++) {
946 int counter = mPicoArrays[StPicoArrays::McVertex]->GetEntries();
949 new((*(mPicoArrays[StPicoArrays::McVertex]))[counter])
StPicoMcVertex();
954 picoMcVtx->
setId( mcVertex->Id() );
958 picoMcVtx->
setTime( mcVertex->Time() );
959 picoMcVtx->
setPosition( mcVertex->XyzV().x(), mcVertex->XyzV().y(), mcVertex->XyzV().z() );
965 void StPicoDstMaker::fillMcTracks() {
968 TClonesArray *mcTracks = mMuDst->mcArray(1);
971 for (Int_t iVtx=0; iVtx<mcTracks->GetEntriesFast(); iVtx++) {
976 if ( !mcTrack )
continue;
979 int counter = mPicoArrays[StPicoArrays::McTrack]->GetEntries();
982 new((*(mPicoArrays[StPicoArrays::McTrack]))[counter])
StPicoMcTrack();
987 picoMcTrk->
setId( mcTrack->Id() );
989 picoMcTrk->
setCharge( mcTrack->Charge() );
990 picoMcTrk->
setP( mcTrack->Pxyz().x(),
992 mcTrack->Pxyz().z() );
993 picoMcTrk->
setE( mcTrack->E() );
998 for (Int_t iDet=StMuMcTrack::EHIT::ktpc; iDet<StMuMcTrack::EHIT::ktot; iDet++) {
999 picoMcTrk->
setNHits( iDet, mcTrack->NoHits(iDet) );
1006 void StPicoDstMaker::fillTracks() {
1008 #if defined (__TFG__VERSION__)
1015 std::unordered_map<unsigned int, unsigned int> index2Primary;
1018 Int_t nPrimarys = mMuDst->numberOfPrimaryTracks();
1021 for (
int i = 0; i < nPrimarys; ++i) {
1025 #if defined (__TFG__VERSION__)
1026 if ( !mMuDst->Accept(pTrk) )
continue;
1029 index2Primary[pTrk->
id()] = i;
1033 Int_t nGlobals = mMuDst->numberOfGlobalTracks();
1036 for (
int i = 0; i < nGlobals; ++i) {
1042 if( !gTrk )
continue;
1043 if( gTrk->
type()!=global )
continue;
1046 StMuTrack const*
const pTrk = index2Primary.find(gTrk->
id()) != index2Primary.end() ?
1052 if (pTrk->
type() != primary)
continue;
1053 if (pTrk->
id() != gTrk->
id())
continue;
1057 if(gTrk->index2Cov() < 0)
continue;
1060 StDcaGeometry* dcaG = mMuDst->covGlobTracks(gTrk->index2Cov());
1062 LOG_WARN <<
"No dca Geometry for this track !!! " << i << endm;
1066 #if defined (__TFG__VERSION__)
1067 if ( StMuDst::dca3Dmax()>0 ) {
1071 Double_t dca3D = t.
Dca(V.xyz());
1072 #if defined (__HIST_PV__)
1074 hists[0]->Fill(dca3D);
1075 Int_t IdMc = gTrk->idTruth();
1077 StMuMcTrack *mcTrk = StMuDst::instance()->MCtrack(IdMc-1);
1079 assert(IdMc == mcTrk->Id());
1080 Int_t IdVx = mcTrk->IdVx();
1082 StMuMcVertex *MuVx = StMuDst::instance()->MCvertex(IdVx-1);
1084 Int_t IdParentTk = MuVx->IdParTrk();
1086 StMuMcTrack *mcParentTrk = StMuDst::instance()->MCtrack(IdParentTk-1);
1087 assert(mcParentTrk);
1089 Int_t pdg = mcParentTrk->Pdg();
1091 if (TMath::Abs(pdg) == 3122) {
1092 hists[1]->Fill(dca3D);
1093 }
else if (pdg == 310) {
1094 hists[2]->Fill(dca3D);
1097 Int_t gePid = mcParentTrk->GePid();
1098 if (gePid == 18 || gePid == 26) {
1099 hists[1]->Fill(dca3D);
1100 }
else if (gePid == 16) {
1101 hists[2]->Fill(dca3D);
1108 if (dca3D > StMuDst::dca3Dmax())
continue;
1114 int counter = mPicoArrays[StPicoArrays::Track]->GetEntries();
1117 new((*(mPicoArrays[StPicoArrays::Track]))[counter])
StPicoTrack();
1129 #if !defined (__TFG__VERSION__)
1130 static TString Production(mMuDst->
event()->runInfo().productionVersion());
1131 static TString prodYear(Production.Data()+2,2);
1132 static Int_t defY = prodYear.Atoi();
1133 static StDedxMethod defaultdEdxMethod = (defY > 0 && defY < 14) ? kTruncatedMeanId : kLikelihoodFitId;
1135 static StDedxMethod defaultdEdxMethod = kLikelihoodFitId;
1137 if (defaultdEdxMethod == kTruncatedMeanId) {
1159 Int_t flag = gTrk->
flag();
1160 if (flag / 100 < 7) {
1165 if (gTrk->
helix().momentum(mBField * kilogauss).pseudoRapidity() > 0.) {
1184 for(UInt_t iMap=0; iMap<StPicoTrack::eTopologyMap; iMap++) {
1187 #if !defined (__TFG__VERSION__)
1196 Double_t vtx[3] = {pvert[0],pvert[1],pvert[2]};
1198 thelix.
Move(thelix.Path(vtx));
1199 const Double_t *pos = thelix.Pos();
1200 const Double_t *mom = thelix.Dir();
1202 momAtDca *= dcaG->momentum().mag();
1204 picoTrk->
setOrigin( pos[0], pos[1], pos[2] );
1243 picoTrk->
setMcTruth( gTrk->idTruth(), gTrk->qaTruth() );
1246 if( mCovMtxMode == PicoCovMtxMode::Write ) {
1249 Int_t cov_index = mPicoArrays[StPicoArrays::TrackCovMatrix]->GetEntries();
1257 const Float_t* parDCA = dcaG->params();
1258 const Float_t* errorMatrix = dcaG->errMatrix();
1261 covMatrix->
setImp( parDCA[0] );
1262 covMatrix->
setZ( parDCA[1] );
1263 covMatrix->
setPsi( parDCA[2] );
1264 covMatrix->
setPti( parDCA[3] );
1265 covMatrix->
setTan( parDCA[4] );
1266 covMatrix->
setCurv( parDCA[5] );
1268 Float_t SigmaArr[5];
1269 Float_t CorrArr[10];
1271 for(Int_t iVal=0; iVal<5; iVal++) {
1272 SigmaArr[iVal] = TMath::Sqrt( errorMatrix[ii] );
1273 for(Int_t j=0; j<iVal; j++) {
1274 Int_t ij = (ii - iVal - 1) + (j + 1);
1275 Int_t ij1 = ij - iVal;
1276 CorrArr[ij1] = errorMatrix[ij] / ( SigmaArr[iVal] * SigmaArr[j] );
1287 #if defined (__TFG__VERSION__)
1289 std::cout <<
"StPicoDstMaker::fillTracks: MuTrack "
1290 << Form(
"%4i %8.3f %8.3f %8.3f", i, gTrk->
p().x(), gTrk->
p().y(), gTrk->
p().z() )
1291 << Form(
"\te/pi/K/p\t%8.3f %8.3f %8.3f %8.3f",
1297 << Form(
"%4i %8.3f %8.3f %8.3f",
1298 i, picoTrk->
gMom().x(), picoTrk->
gMom().y(), picoTrk->
gMom().z() )
1299 << Form(
"\te/pi/K/p\t%8.3f %8.3f %8.3f %8.3f",
1310 if (mEmcCollection) {
1319 StEmcGeom* mBemcGeom = StEmcGeom::instance(
"bemc");
1320 Double_t bemc_radius = mBemcGeom->Radius();
1323 Double_t mBField_tesla = mBField / 10.0;
1329 Int_t h_m, h_e, h_s = 0;
1333 Bool_t close_match =
false;
1338 if ( mEmcPosition->
projTrack(&bemc_pos, &bemc_mom, gTrk, mBField_tesla, bemc_radius) ) {
1343 if ( fabs(bemc_pos.pseudoRapidity()) < mBemcGeom->EtaMin() ) {
1344 Double_t unsigned_eta = mBemcGeom->EtaMin() + 0.001;
1345 Double_t unsigned_theta = 2.0 * atan(exp(-1.0 * unsigned_eta));
1346 Double_t signed_theta = (bemc_pos.pseudoRapidity() >= 0 ? 1.0 : -1.0) * unsigned_theta;
1347 bemc_pos.setTheta(signed_theta);
1350 else if ( fabs(bemc_pos.pseudoRapidity()) > mBemcGeom->EtaMax() &&
1351 fabs(bemc_pos.pseudoRapidity()) < 1.0 ) {
1352 Double_t unsigned_eta = mBemcGeom->EtaMax() - 0.001;
1353 Double_t unsigned_theta = 2.0 * atan(exp(-1.0 * unsigned_eta));
1354 Double_t signed_theta = (bemc_pos.pseudoRapidity() >= 0 ? 1.0 : -1.0) * unsigned_theta;
1355 bemc_pos.setTheta(signed_theta);
1361 if ( mBemcGeom->
getBin(bemc_pos.phi(),bemc_pos.pseudoRapidity(),h_m,h_e,h_s) == 0 ) {
1366 mBemcGeom->getId(h_m,h_e,h_s,tow_id);
1380 Double_t dphi = (TMath::Pi() / 60.0) - 0.0495324;
1386 bemc_pos_shift_pos.setPhi(bemc_pos_shift_pos.phi() + dphi);
1388 bemc_pos_shift_neg.setPhi(bemc_pos_shift_neg.phi() - dphi);
1390 if ( mBemcGeom->
getBin(bemc_pos_shift_pos.phi(),
1391 bemc_pos_shift_pos.pseudoRapidity(),
1392 h_m,h_e,h_s) == 0 && h_s != -1 ) {
1393 mBemcGeom->getId(h_m,h_e,h_s,tow_id);
1396 else if ( mBemcGeom->
getBin(bemc_pos_shift_neg.phi(),
1397 bemc_pos_shift_neg.pseudoRapidity(),
1398 h_m,h_e,h_s) == 0 && h_s != -1 ) {
1399 mBemcGeom->getId(h_m,h_e,h_s,tow_id);
1413 getBEMC(gTrk, &
id, &adc0, e, dist, nhit, ntow);
1416 Int_t bemc_index = mPicoArrays[StPicoArrays::BEmcPidTraits]->GetEntries();
1417 new((*(mPicoArrays[StPicoArrays::BEmcPidTraits]))[bemc_index])
StPicoBEmcPidTraits(counter,
id, adc0, e, dist, nhit, ntow);
1423 if (gTrk->tofHit()) {
1426 Int_t btof_index = mPicoArrays[StPicoArrays::BTofPidTraits]->GetEntries();
1443 Int_t tray = btofHit->tray();
1444 Int_t module = btofHit->module();
1445 Int_t cell = btofHit->cell();
1451 btofPidTraits->
setBeta( gTrk->btofPidTraits().beta() );
1461 btofPidTraits->
setYLocal( gTrk->btofPidTraits().yLocal() );
1462 btofPidTraits->
setZLocal( gTrk->btofPidTraits().zLocal() );
1466 btofPidTraits->
setNSigmaPion( gTrk->btofPidTraits().sigmaPion() );
1467 btofPidTraits->
setNSigmaKaon( gTrk->btofPidTraits().sigmaKaon() );
1468 btofPidTraits->
setNSigmaProton( gTrk->btofPidTraits().sigmaProton() );
1473 #if defined (__TFG__VERSION__)
1475 Float_t beta = (pTrk) && ! TMath::IsNaN(btofPid.beta()) ? btofPid.beta() : -999.;
1479 double lengthTof = btofPid.pathLength();
1480 if (lengthTof < 0.) {
1482 if (StMuDst::instance()->currentVertexIndex() >= 0) {
1483 const StThreeVectorF & dcaPoint = gTrk->
dca(StMuDst::instance()->currentVertexIndex());
1486 dcaPoint.y(), dcaPoint.z()) ) );
1490 tofPoint.y(), еofPoint.z()) ) );
1492 double l = gTrk->
length();
1493 lengthTof = l + dlDCA + dlTOF;
1495 if (timeTof > 0. && lengthTof > 0.) {
1496 beta = lengthTof/timeTof/(1e-9*TMath::Ccgs());
1498 btofPidTraits->
setBeta( beta );
1506 Int_t etof_index = mPicoArrays[StPicoArrays::ETofPidTraits]->GetEntries();
1554 if (gTrk->mtdHit()) {
1557 Int_t mtd_index = mPicoArrays[StPicoArrays::MtdPidTraits]->GetEntries();
1568 mtdPidTraits->
setDeltaY( gTrk->mtdPidTraits().deltaY() );
1569 mtdPidTraits->
setDeltaZ( gTrk->mtdPidTraits().deltaZ() );
1571 gTrk->mtdPidTraits().expTimeOfFlight() );
1572 mtdPidTraits->
setBeta( gTrk->mtdPidTraits().pathLength() /
1573 gTrk->mtdPidTraits().expTimeOfFlight() * 1e9 / c_light );
1577 gTrk->mtdHit()->module(),
1578 gTrk->mtdHit()->cell() );
1588 bool StPicoDstMaker::getBEMC(
const StMuTrack* t,
int*
id,
int* adc,
float* ene,
float* d,
int* nep,
int* towid) {
1593 std::fill(ene, ene+5, 0.);
1594 std::fill(d, d+4, 1.e9);
1595 std::fill(nep, nep+2, 0);
1596 std::fill(towid, towid+3, -1);
1598 if (!mEmcCollection) {
1599 LOG_WARN <<
" No Emc Collection for this event " << endm;
1607 double magneticField = mBField * kilogauss / tesla;
1610 bool okBSMDE =
false;
1611 bool okBSMDP =
false;
1614 ok = mEmcPosition->
projTrack(&position, &momentum, t, magneticField, mEmcGeom[0]->Radius());
1615 okBSMDE = mEmcPosition->
projTrack(&positionBSMDE, &momentumBSMDE, t, magneticField, mEmcGeom[2]->Radius());
1616 okBSMDP = mEmcPosition->
projTrack(&positionBSMDP, &momentumBSMDP, t, magneticField, mEmcGeom[3]->Radius());
1620 LOG_WARN <<
" Projection failed for this track ... " << endm;
1624 if (ok && okBSMDE && okBSMDP) {
1626 Int_t mod = 0, eta = 0, sub = 0;
1627 StSPtrVecEmcPoint& bEmcPoints = mEmcCollection->barrelPoints();
1629 float mindist = 1.e9;
1630 mEmcGeom[0]->
getBin(positionBSMDP.phi(), positionBSMDE.pseudoRapidity(), mod, eta, sub);
1633 for (StSPtrVecEmcPointIterator it = bEmcPoints.begin(); it != bEmcPoints.end(); ++it, ++index) {
1635 bool associated =
false;
1637 StPtrVecEmcCluster& bEmcClusters = (*it)->cluster(kBarrelEmcTowerId);
1638 if (bEmcClusters.size() == 0)
continue;
1639 if (bEmcClusters[0] == NULL)
continue;
1642 for (StPtrVecEmcClusterIterator cIter = bEmcClusters.begin(); cIter != bEmcClusters.end(); ++cIter) {
1644 StPtrVecEmcRawHit& bEmcHits = (*cIter)->hit();
1647 for (StPtrVecEmcRawHitIterator hIter = bEmcHits.begin(); hIter != bEmcHits.end(); ++hIter) {
1650 if (mod == (Int_t)(*hIter)->module() && eta == (Int_t)(*hIter)->eta() && sub == (Int_t)(*hIter)->sub()) {
1659 for (StPtrVecEmcRawHitIterator hitit = bEmcHits.begin(); hitit != bEmcHits.end(); ++hitit) {
1661 if ((*hitit)->energy() > ene[0]) ene[0] = (*hitit)->energy();
1663 if ((
int)(*hitit)->adc() > (*adc)) *adc = (*hitit)->adc();
1668 StPtrVecEmcCluster& smdeClusters = (*it)->cluster(kBarrelSmdEtaStripId);
1669 StPtrVecEmcCluster& smdpClusters = (*it)->cluster(kBarrelSmdPhiStripId);
1673 ene[1] = ene[1] + (*it)->energy();
1675 float deltaphi = (*it)->position().phi() - positionBSMDP.phi();
1676 if (deltaphi >= TMath::Pi()) deltaphi = deltaphi - TMath::TwoPi();
1677 if (deltaphi < -TMath::Pi()) deltaphi = deltaphi + TMath::TwoPi();
1679 float rsmdp = mEmcGeom[3]->Radius();
1680 float pointz = (*it)->position().z();
1681 float deltaz = pointz - positionBSMDE.z();
1682 if (sqrt(deltaphi * deltaphi * rsmdp * rsmdp + deltaz * deltaz) < mindist) {
1685 if (smdeClusters.size() >= 1) nep[0] = smdeClusters[0]->nHits();
1686 if (smdpClusters.size() >= 1) nep[1] = smdpClusters[0]->nHits();
1687 mindist = sqrt(deltaphi * deltaphi * rsmdp * rsmdp + deltaz * deltaz);
1696 int localTowerId = -1;
1699 double energy1 = 0, energy2 = 0;
1700 double energyTemp = 0;
1701 double dist1 = 1000, dist2 = 1000;
1702 double distTemp = 0;
1703 Float_t etaTemp = 0, phiTemp = 0;
1705 if (mEmcGeom[0]->getId(position.phi(), position.pseudoRapidity(), towerId) == 1)
return kTRUE;
1707 for (
int ieta = -1; ieta < 2; ++ieta) {
1708 for (
int iphi = -1; iphi < 2; ++iphi) {
1710 int nextTowerId = mEmcPosition->
getNextTowerId(towerId, ieta, iphi);
1711 if (nextTowerId < 1 || nextTowerId > 4800)
continue;
1713 if (emcHit == 0)
continue;
1714 if (emcHit->energy() < 0.2)
continue;
1716 if (ieta == 0 && iphi == 0) {
1717 mEmcGeom[0]->getEta(nextTowerId, etaTemp);
1718 mEmcGeom[0]->getPhi(nextTowerId, phiTemp);
1719 ene[2] = emcHit->energy();
1720 d[2] = position.pseudoRapidity() - etaTemp;
1721 d[3] = position.phi() - phiTemp;
1724 energyTemp = emcHit->energy();
1725 mEmcGeom[0]->getEta(nextTowerId, etaTemp);
1726 mEmcGeom[0]->getPhi(nextTowerId, phiTemp);
1727 distTemp = sqrt((etaTemp - position.pseudoRapidity()) * (etaTemp - position.pseudoRapidity()) +
1728 (phiTemp - position.phi()) * (phiTemp - position.phi()));
1734 if (distTemp < dist1) {
1738 energy1 = energyTemp;
1739 localId2 = localId1;
1740 localId1 = localTowerId;
1742 else if (distTemp < dist2) {
1744 energy2 = energyTemp;
1745 localId2 = localTowerId;
1752 towid[1] = localId1;
1754 towid[2] = localId2;
1756 LOG_DEBUG <<
" ====== BEMC results ====== " <<
"\n"
1757 <<
" Energy = " << ene[0] <<
" " << ene[1] <<
" " << ene[2] <<
" " << ene[3] <<
" " << ene[4] <<
"\n"
1758 <<
" BSMD = " << nep[0] <<
" " << nep[1] <<
"\n"
1759 <<
" TowerId = " << towid[0] <<
" " << towid[1] <<
" " << towid[2] << endm;
1765 void StPicoDstMaker::fillEvent() {
1768 int counter = mPicoArrays[StPicoArrays::Event]->GetEntries();
1770 new((*(mPicoArrays[StPicoArrays::Event]))[counter])
StPicoEvent();
1779 picoEvent->
setRunId( ev->runNumber() );
1781 picoEvent->
setFillId( ev->runInfo().beamFillNumber( blue ) );
1782 picoEvent->
setBField( ev->magneticField() );
1783 picoEvent->
setTime( ev->eventInfo().time() );
1790 ev->primaryVertexErrors().y(),
1791 ev->primaryVertexErrors().z() );
1796 picoEvent->setNumberOfBTOFMatch( pv->nBTOFMatch() );
1800 picoEvent->
setTriggerIds( ev->triggerIdCollection().nominal().triggerIds() );
1809 using namespace StPicoUtilities;
1810 auto custom_refMult = StPicoUtilities::calculateRefMult(*mMuDst);
1815 picoEvent->setRefMult3NegEast( custom_refMult[RefMult3NegEast] );
1816 picoEvent->setRefMult3PosEast( custom_refMult[RefMult3PosEast] );
1817 picoEvent->setRefMult3NegWest( custom_refMult[RefMult3NegWest] );;
1818 picoEvent->setRefMult3PosWest( custom_refMult[RefMult3PosWest] );
1819 picoEvent->setRefMult4NegEast( custom_refMult[RefMult4NegEast] );
1820 picoEvent->setRefMult4PosEast( custom_refMult[RefMult4PosEast] );
1821 picoEvent->setRefMult4NegWest( custom_refMult[RefMult4NegWest] );
1822 picoEvent->setRefMult4PosWest( custom_refMult[RefMult4PosWest] );
1840 unsigned short nUseableETofDigis = 0;
1841 for(
int i=0; i<ev->etofDigiMultiplicity(); i++ ) {
1843 if( !digi )
continue;
1846 nUseableETofDigis++;
1851 picoEvent->
setNHitsHFT( 0, ev->numberOfPxlInnerHits() );
1852 picoEvent->
setNHitsHFT( 1, ev->numberOfPxlOuterHits() );
1853 picoEvent->
setNHitsHFT( 2, ev->numberOfIstHits() );
1854 picoEvent->
setNHitsHFT( 3, ev->numberOfSsdHits() );
1860 picoEvent->
setNTofT0( header->nTzero() );
1861 picoEvent->
setVzVpd( header->vpdVz() );
1863 picoEvent->
setTStart( header->tStart() );
1877 picoEvent->
setZDCx( ev->runInfo().zdcCoincidenceRate() );
1878 picoEvent->
setBBCx( ev->runInfo().bbcCoincidenceRate() );
1891 if ( ev->triggerData() ) {
1897 for(
int iStrip=1; iStrip<9; ++iStrip) {
1898 if( ZDC.zdcSmd(east, 1, iStrip) ) {
1901 if( ZDC.zdcSmd(east, 0, iStrip) ) {
1904 if( ZDC.zdcSmd(west, 1, iStrip) ) {
1907 if( ZDC.zdcSmd(west, 0, iStrip) ) {
1916 for(UInt_t iPMT=0; iPMT<bbc.numberOfPMTs(); ++iPMT) {
1918 UInt_t
const eastWest = (iPMT<24) ? 0 : 1;
1919 UInt_t
const pmtId = iPMT % 24;
1930 picoEvent->
setBunchId( ev->l0Trigger().bunchCrossingId() );
1934 void StPicoDstMaker::fillEmcTrigger() {
1938 if (!trigSimu)
return;
1939 if (!trigSimu->bemc)
return;
1942 int bht0 = trigSimu->bemc->barrelHighTowerTh(0);
1943 int bht1 = trigSimu->bemc->barrelHighTowerTh(1);
1944 int bht2 = trigSimu->bemc->barrelHighTowerTh(2);
1945 int bht3 = trigSimu->bemc->barrelHighTowerTh(3);
1946 LOG_INFO <<
" bht thresholds " << bht0 <<
" " << bht1 <<
" " << bht2 <<
" " << bht3 << endm;
1947 for (
int i = 0; i < 4; ++i) {
1951 if( bht0>0 || bht1>0 || bht2>0 || bht3>0 ) {
1954 for(Int_t towerId=1; towerId<=4800; towerId++) {
1956 trigSimu->bemc->getTables()->
getStatus(BTOW, towerId, status);
1957 Int_t adc = trigSimu->bemc->barrelHighTowerAdc(towerId);
1959 vector<unsigned short> smdEHits;
1960 vector<unsigned short> smdPHits;
1963 LOG_DEBUG <<
" id = " << towerId <<
" adc = " << adc << endm;
1968 LOG_DEBUG <<
" id = " << towerId <<
" adc = " << adc << endm;
1972 if( mBEmcSmdMode == PicoBEmcSmdMode::SmdWrite ) {
1973 StEmcDetector* smde = mEmcCollection->detector(kBarrelSmdEtaStripId);
1974 StEmcDetector* smdp = mEmcCollection->detector(kBarrelSmdPhiStripId);
1977 Float_t trigEta, trigPhi;
1978 mEmcGeom[0]->getEtaPhi(towerId, trigEta, trigPhi);
1981 float towerSideLength = 0.05;
1983 float towerDiagonal = towerSideLength*TMath::Sqrt(2);
1985 float radius = 1.5 * towerDiagonal;
1991 for (
unsigned int i=1; i<=smde->numberOfModules(); i++) {
1994 StSPtrVecEmcRawHit& aHit = module->hits();
1996 if (aHit.size() < 1)
continue;
1998 for (
unsigned int j=0; j<aHit.size(); j++) {
2000 Float_t smdPhi = 0.;
2001 Float_t smdEta = 0.;
2002 mEmcGeom[2]->getId(i, aHit[j]->eta(), aHit[j]->sub(),
id);
2003 mEmcGeom[2]->getEtaPhi(
id, smdEta, smdPhi);
2005 float deltaphi = (smdPhi - trigPhi);
2006 if (deltaphi >= TMath::Pi()) {
2007 deltaphi = deltaphi - TMath::TwoPi();
2009 if (deltaphi < -TMath::Pi()) {
2010 deltaphi = deltaphi + TMath::TwoPi();
2012 float dr = TMath::Sqrt( (smdEta - trigEta)*(smdEta - trigEta) +
2013 deltaphi * deltaphi );
2016 Int_t adc = aHit[j]->adc();
2017 Int_t counterSmde = mPicoArrays[StPicoArrays::BEmcSmdEHit]->GetEntries();
2018 smdEHits.push_back( (
unsigned char)counterSmde );
2019 Float_t smdEnergy = aHit[j]->energy();
2020 new( ( *(mPicoArrays[StPicoArrays::BEmcSmdEHit]) )[counterSmde])
StPicoBEmcSmdEHit(
id, adc, smdEnergy);
2026 for (
unsigned int i=1; i<=smdp->numberOfModules(); i++) {
2029 StSPtrVecEmcRawHit& aHit = module->hits();
2031 if (aHit.size() < 1)
continue;
2033 for (
unsigned int j=0; j<aHit.size(); j++) {
2035 Float_t smdPhi = 0.;
2036 Float_t smdEta = 0.;
2037 mEmcGeom[3]->getId(i, aHit[j]->eta(), aHit[j]->sub(),
id);
2038 mEmcGeom[3]->getEtaPhi(
id, smdEta, smdPhi);
2040 float deltaphi = (smdPhi - trigPhi);
2041 if (deltaphi >= TMath::Pi()) {
2042 deltaphi = deltaphi - TMath::TwoPi();
2044 if (deltaphi < -TMath::Pi()) {
2045 deltaphi = deltaphi + TMath::TwoPi();
2048 float dr = TMath::Sqrt( (smdEta - trigEta)*(smdEta - trigEta) +
2049 deltaphi * deltaphi );
2052 int adc = aHit[j]->adc();
2053 Int_t counterSmdp = mPicoArrays[StPicoArrays::BEmcSmdPHit]->GetEntries();
2054 smdPHits.push_back( (
unsigned char)counterSmdp );
2055 Float_t smdEnergy = aHit[j]->energy();
2056 new( ( *(mPicoArrays[StPicoArrays::BEmcSmdPHit]) ) [counterSmdp])
StPicoBEmcSmdPHit(
id, adc, smdEnergy);
2066 LOG_DEBUG <<
" id = " << towerId <<
" adc = " << adc << endm;
2071 Int_t counter = mPicoArrays[StPicoArrays::EmcTrigger]->GetEntries();
2072 new((*(mPicoArrays[StPicoArrays::EmcTrigger]))[counter])
StPicoEmcTrigger(flag, towerId, adc, smdEHits, smdPHits);
2079 int const bjpth0 = trigSimu->bemc->barrelJetPatchTh(0);
2080 int const bjpth1 = trigSimu->bemc->barrelJetPatchTh(1);
2081 int const bjpth2 = trigSimu->bemc->barrelJetPatchTh(2);
2083 LOG_INFO <<
" bjp thresholds " << bjpth0 <<
" " << bjpth0 <<
" " << bjpth1 <<
" " << bjpth2 << endm;
2085 for (
int i = 0; i < 3; ++i) {
2089 if ( bjpth0 > 0 || bjpth1 > 0 || bjpth2 > 0 ) {
2092 for (
int jp = 0; jp < 18; ++jp) {
2095 int const jpAdc = trigSimu->bemc->barrelJetPatchAdc(jp);
2097 unsigned char flag = 0;
2098 if (jpAdc > bjpth0) {
2102 if (jpAdc > bjpth1) {
2106 if (jpAdc > bjpth2) {
2111 int counter = mPicoArrays[StPicoArrays::EmcTrigger]->GetEntries();
2112 new((*(mPicoArrays[StPicoArrays::EmcTrigger]))[counter])
StPicoEmcTrigger(flag, jp, jpAdc);
2120 void StPicoDstMaker::fillMtdTrigger() {
2123 int counter = mPicoArrays[StPicoArrays::MtdTrigger]->GetEntries();
2126 new((*(mPicoArrays[StPicoArrays::MtdTrigger]))[counter])
StPicoMtdTrigger();
2135 mtdTrigger->
setTHUBtime(0, 25 * ( muMtdHeader->triggerTime(1) & 0xfff ) );
2136 mtdTrigger->
setTHUBtime(1, 25 * ( muMtdHeader->triggerTime(2) & 0xfff ) );
2142 LOG_WARN <<
"No trigger data bank available!" << endm;
2147 mtdTrigger->
setVpdTacSum(trigger->vpdEarliestTDCHighThr(east) + trigger->vpdEarliestTDCHighThr(west) );
2150 const int runnumber = mMuDst->
event()->runNumber();
2151 int year = runnumber / 1e6 + 1999;
2153 if ((runnumber % 1000000) / 1000 >= 273) year += 1;
2156 const int kNQTboard = 8;
2157 UShort_t mtdQTadc[kNQTboard][16], mtdQTtac[kNQTboard][16];
2158 memset(mtdQTadc, 0,
sizeof(mtdQTadc));
2159 memset(mtdQTtac, 0,
sizeof(mtdQTtac));
2161 for (Int_t i = 0; i < 32; i++){
2162 Int_t type = (i / 4) % 2;
2165 mtdQTtac[0][i - i / 4 * 2 - 2] = trigger->mtdAtAddress(i, 0);
2166 mtdQTtac[1][i - i / 4 * 2 - 2] = trigger->mtdgemAtAddress(i, 0);
2167 mtdQTtac[2][i - i / 4 * 2 - 2] = trigger->mtd3AtAddress(i, 0);
2168 mtdQTtac[3][i - i / 4 * 2 - 2] = trigger->mtd4AtAddress(i, 0);
2171 mtdQTadc[0][i - i / 4 * 2] = trigger->mtdAtAddress(i, 0);
2172 mtdQTadc[1][i - i / 4 * 2] = trigger->mtdgemAtAddress(i, 0);
2173 mtdQTadc[2][i - i / 4 * 2] = trigger->mtd3AtAddress(i, 0);
2174 mtdQTadc[3][i - i / 4 * 2] = trigger->mtd4AtAddress(i, 0);
2178 for (
int im = 0; im < kNQTboard; im++){
2179 if (year != 2016 && im>=4)
continue;
2180 if (type == 0) mtdQTadc[im][i - i / 4 * 2] = trigger->mtdQtAtCh(im + 1, i, 0);
2181 else mtdQTtac[im][i - i / 4 * 2 - 2] = trigger->mtdQtAtCh(im + 1, i, 0);
2186 mtdTrigger->
setQTtacSum(runnumber, mtdQTadc, mtdQTtac, mQTtoModule,
2187 mQTSlewBinEdge, mQTSlewCorr);
2190 UShort_t mt101Tac[kNQTboard][2], mt101Id[kNQTboard][2];
2191 for (Int_t i = 0; i < kNQTboard; i++) {
2194 idx = i / 2 * 3 + i % 2 * 16;
2199 mt101Tac[i][0] = (trigger->mtdDsmAtCh(idx, 0)) + ((trigger->mtdDsmAtCh(idx + 1, 0) & 0x3) << 8);
2200 mt101Id[i][0] = (trigger->mtdDsmAtCh(idx + 1, 0) & 0xc) >> 2;
2201 mt101Tac[i][1] = (trigger->mtdDsmAtCh(idx + 1, 0) >> 4) + ((trigger->mtdDsmAtCh(idx + 2, 0) & 0x3f) << 4);
2202 mt101Id[i][1] = (trigger->mtdDsmAtCh(idx + 2, 0) & 0xc0) >> 6;
2204 mtdTrigger->
setMT101(mt101Tac, mt101Id);
2207 UInt_t dsmBit1 = trigger->dsmTF201Ch(0);
2210 dsmBit2 = trigger->dsmTF201Ch(6);
2216 void StPicoDstMaker::fillBTowHits() {
2219 if (!mEmcCollection)
return;
2222 for (Int_t iTower = 0; iTower < 4800; iTower++) {
2231 Float_t energy = -2.;
2235 energy = aHit->energy();
2238 Int_t counter = mPicoArrays[StPicoArrays::BTowHit]->GetEntries();
2239 new((*(mPicoArrays[StPicoArrays::BTowHit]))[counter])
StPicoBTowHit(adc, energy);
2244 void StPicoDstMaker::fillBTofHits() {
2247 for (
unsigned int i = 0; i < mMuDst->numberOfBTofHit(); ++i) {
2251 if (!aHit)
continue;
2253 if (aHit->tray() > 120)
continue;
2254 int cellId = (aHit->tray() - 1) * 192 + (aHit->module() - 1) * 6 + (aHit->cell() - 1);
2256 int counter = mPicoArrays[StPicoArrays::BTofHit]->GetEntries();
2257 new((*(mPicoArrays[StPicoArrays::BTofHit]))[counter])
StPicoBTofHit(cellId);
2262 void StPicoDstMaker::fillETofHits() {
2265 std::map< Int_t, Int_t > muTrackId2picoHitIndex;
2268 for (
size_t i = 0; i < mMuDst->numberOfETofHit(); ++i) {
2272 if (!aHit)
continue;
2274 unsigned int geomId = (aHit->
sector() - 13) * 9 + (aHit->
zPlane() - 1) * 3 + aHit->
counter();
2297 int counter = mPicoArrays[StPicoArrays::ETofHit]->GetEntries();
2298 new((*(mPicoArrays[StPicoArrays::ETofHit]))[counter])
StPicoETofHit(picoHit);
2306 for(
size_t i = 0; i < (size_t)mPicoArrays[StPicoArrays::ETofPidTraits]->GetEntriesFast(); ++i ) {
2309 int trackId = etofPidTraits->
hitIndex();
2311 if( muTrackId2picoHitIndex.count( trackId ) ) {
2312 etofPidTraits->
setHitIndex( muTrackId2picoHitIndex.at( trackId ) );
2332 void StPicoDstMaker::fillBbcHits() {
2340 for (
int ew=-1; ew<2; ew+=2) {
2341 StBeamDirection dir = (ew<0) ? east : west;
2343 for (
int pmt=1; pmt<17; pmt++) {
2344 int adc = trg->bbcADC(dir,pmt);
2346 int tdc = trg->bbcTDC5bit(dir,pmt);
2347 int tac = trg->bbcTDC(dir,pmt);
2348 bool trueval = kTRUE;
2349 int counter = mPicoArrays[StPicoArrays::BbcHit]->GetEntries();
2350 new((*(mPicoArrays[StPicoArrays::BbcHit]))[counter])
StPicoBbcHit(pmt,ew,adc,tac,tdc,trueval,trueval);
2358 void StPicoDstMaker::fillEpdHits() {
2360 for (
unsigned int i=0; i < mMuDst->numberOfEpdHit(); i++) {
2362 if (!aHit)
continue;
2363 int counter = mPicoArrays[StPicoArrays::EpdHit]->GetEntries();
2369 void StPicoDstMaker::fillMtdHits() {
2372 Int_t nMtdHits = mMuDst->numberOfMTDHit();
2375 for (Int_t iHit = 0; iHit < nMtdHits; ++iHit) {
2381 Int_t counter = mPicoArrays[StPicoArrays::MtdHit]->GetEntries();
2383 new((*(mPicoArrays[StPicoArrays::MtdHit]))[counter])
StPicoMtdHit();
2408 for (
unsigned int iPidHit = 0; iPidHit < nMtdPidTraits; ++iPidHit) {
2414 for (
unsigned int iHit = 0; iHit < nHits; ++iHit) {
2430 #if defined (__TFG__VERSION__)
2431 static Int_t count = 0;
2434 LOG_ERROR <<
"There are " << mPicoDst->
numberOfMtdTriggers() <<
" MTD trigger. Check it!" << endm;
2437 LOG_ERROR <<
"There are " << mPicoDst->
numberOfMtdTriggers() <<
" MTD trigger. Check it!" << endm;
2444 Int_t triggerQT[8][2];
2445 Bool_t triggerBit[8][8];
2446 Int_t pos1 = 0, pos2 = 0;
2448 for (Int_t i = 0; i < 8; ++i) {
2449 for (Int_t j = 0; j < 2; ++j) {
2450 triggerQT[i][j] = 0;
2452 for (Int_t j = 0; j < 8; ++j) {
2453 triggerBit[i][j] = kFALSE;
2457 triggerQT[i][0] = pos1;
2458 triggerQT[i][1] = pos2;
2459 for (Int_t j = 0; j < 2; ++j) {
2461 triggerBit[i][triggerQT[i][j] - 1] = kTRUE;
2466 vector<Int_t> triggerPos;
2467 vector<Int_t> hitIndex;
2470 for (
unsigned int i = 0; i < nHits; ++i) {
2472 Int_t backleg = hit->
backleg();
2473 Int_t module = hit->
module();
2474 Int_t qt = mModuleToQT[backleg - 1][module - 1];
2475 Int_t pos = mModuleToQTPos[backleg - 1][module - 1];
2476 if (qt >= 1 && qt <= 8 && pos > 0 && triggerBit[qt - 1][pos - 1]) {
2477 triggerPos.push_back(qt * 10 + pos);
2478 hitIndex.push_back(i);
2487 while (triggerPos.size() > 0) {
2490 for (Int_t j = 1; j < (Int_t)triggerPos.size(); ++j) {
2491 if (triggerPos[j] == triggerPos[0]) {
2496 for (Int_t k = (Int_t)hits.size() - 1; k > -1; k--) {
2499 triggerPos.erase(triggerPos.begin() + hits[k]);
2500 hitIndex.erase(hitIndex.begin() + hits[k]);
2505 #if !defined (__TFG__VERSION__)
2520 bool StPicoDstMaker::selectVertex() {
2528 if ( mVtxMode == PicoVtxMode::Default ) {
2534 else if ( mVtxMode == PicoVtxMode::FXT ) {
2537 for (
unsigned int iVtx = 0; iVtx < mMuDst->numberOfPrimaryVertices(); ++iVtx) {
2544 if (vtx->position().z() > 198. && vtx->position().z() < 202.) {
2554 else if ( mVtxMode == PicoVtxMode::Vpd || mVtxMode == PicoVtxMode::VpdOrDefault ) {
2558 if( mVtxMode == PicoVtxMode::VpdOrDefault ) {
2566 if ( mBTofHeader && fabs(mBTofHeader->vpdVz()) < 200. ) {
2569 float vzVpd = mBTofHeader->vpdVz();
2572 for (
unsigned int iVtx = 0; iVtx < mMuDst->numberOfPrimaryVertices(); ++iVtx) {
2579 if (fabs(vzVpd - vtx->position().z()) <
2580 #
if defined(__TFG__VERSION__)
2581 StMuDst::instance()->TpcVpdVzDiffCut()
2596 else if ( mVtxMode == PicoVtxMode::Mtd ) {
2602 for(
unsigned int iVtx=0; iVtx<mMuDst->numberOfPrimaryVertices(); iVtx++) {
2608 int nMtdMatched = 0;
2611 for(
unsigned int iTrk=0; iTrk<mMuDst->numberOfPrimaryTracks(); iTrk++) {
2617 if( !pTrack )
continue;
2620 if( pTrack->index2MtdHit()<0 )
continue;
2628 if( nMtdMatched >= 2 ) {
2642 LOG_ERROR <<
"Pico Vtx Mode not set!" << endm;
2646 return selectedVertex ?
true :
false;
void setE(Float_t e)
Set energy.
void setEventId(Int_t id)
Set event ID.
static StMuPrimaryVertex * primaryVertex()
return pointer to current primary vertex
void fill(const StMuDst &muDst, const StFmsDbMaker *fmsDbMaker=nullptr)
Fill FMS info.
void setNSigmaKaon(Float_t ns)
Set nSigma(kaon)
short type() const
Returns the track type: 0=global, 1=primary, etc (see StEvent manual for type information) ...
static StPicoMtdHit * mtdHit(Int_t i)
Return pointer to i-th mtd hit.
double localY() const
Y-position.
void setImp(Float_t imp)
Set impact.
unsigned int zPlane() const
ZPlane.
void setBBCx(Float_t bbcCoinRate)
Set BBC coincidence rate.
virtual Int_t Finish()
Standard STAR Finish() function called from StChain.
void setPti(Float_t pti)
Set pti.
static StMuBTofHit * btofHit(int i)
returns pointer to the i-th muBTofHit
static TObjArray * globalTracks()
returns pointer to the global tracks list
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in 'physical events'. Therefore there is only 1 primary vert...
Holds information about MTD-matched track.
unsigned short refMultNeg(int vtx_id=-1)
Reference multiplicity of negative particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
void setStatus(Char_t k=0)
Set status of the track (0 - not fitted to any vertex, 1 - fitted to a vertex)
unsigned int sector() const
Sector.
void setTrackIndex(const Int_t index2PicoTrack)
Set associated track index.
void setBbcYellowBackgroundRate(Float_t bbcYellowBckgRate)
Set "yellow"-beam background rate.
Class that converts MuDst into PicoDst.
void setIdVtxStop(Int_t id)
Set stop MC vertex index.
void setZdcSmdEastVertical(Int_t strip, Float_t zdcSmdEastVertical)
Set ZDC for the east vertical ZDC i-th strip.
Float_t nSigmaKaon() const
Return nSigma(kaon)
void setDeltaX(const Float_t &deltaX)
Set difference between track intersection and eTOF hit in local X coordinate (cm) across strips...
void setClusterSize(Int_t clusterSize)
Set cluster size of eTOF hit.
void setRefMult2NegWest(UShort_t mult)
Set negative RefMult2 west ( 0.5<eta<1 )
void setNumberOfPrimaryTracks(UShort_t mult)
Set number of primary tracks.
unsigned int clusterSize() const
Cluster size.
static UInt_t numberOfMtdHits()
Return number of MTD hits.
void setTriggerIds(std::vector< unsigned int > ids)
Set trigger id (pass STL vector with trigger IDs)
void setRefMultPos(UShort_t mult)
Set RefMult positive (|eta|<0.5)
Holds information about Monte Carlo vertex.
Float_t nSigmaPion() const
Return nSigma(pion)
double time() const
Time.
void setBackgroundRate(Float_t bckgRate)
Set background rate.
Holds information about BEMC tower.
void setZLocal(Float_t zLocal)
Set zLocal.
void setNSigmaProton(Float_t sigma)
Set nsigma(proton)
void setZdcUnAttenuatedEast(Float_t adc)
Set unattenuated east ZDC signal.
void setShouldHaveRejectEvent(Int_t val)
Set should have reject event (retrieve from mtdHeader)
void setBField(Double_t bField)
Set magnetic field.
void setNVpdWGoodHits(Int_t vpdWGoodHits)
Set total number of in-time VPDW hits.
virtual Int_t Init()
Standard STAR Init() function called from StChain.
void setNumberOfGlobalTracks(UShort_t mult)
Set number of global tracks reconstructed in the event.
void setBbcWestRate(Float_t bbcWestRate)
Set west BBC rate.
void setTopologyMap(Int_t id, UInt_t word)
Set topology map (2 words)
short id() const
Returns the track id(or key), is unique for a track node, i.e. global and primary tracks have the sam...
void setHitChannel(Int_t backleg, Int_t module, Int_t cell)
Encode global channel number as: (backleg-1) * 60 + (module-1) * 12 + cell.
void setDedx(Float_t dEdx)
Set dE/dx of the track.
unsigned char matchFlag() const
Matching information.
UShort_t nHitsDedx() const
Return number of hits used for dEdx.
static void recoverMuFmsCollection(StMuDst &muDst, const StFmsDbMaker *=nullptr)
static StMuETofHeader * etofHeader()
returns pointer to the StMuETofHeader
Int_t gChannel() const
Return hit channel.
void setNSigmaProton(Float_t ns)
Set nSigma(proton)
void setBTofCellId(Int_t tray, Int_t module, Int_t cell)
Set TOF cell ID which encodes tray, module and cell IDs.
virtual Int_t Make()
Standard STAR Make() function called from StChain.
void setClosestVpdEHit(Double_t closestVpdEHit)
Set closest VPDE hit to start time.
Double_t length() const
Returns length of track (cm) from primary vertex to last measured point.
unsigned int counter() const
Counter.
void setLocalY(Float_t localY)
Set local Y coordinate (cm) along strips w.r.t. center of eTOF counter volume.
void setFillId(Int_t id)
Set fill ID.
void setiTpcTopologyMap(ULong64_t map)
Set iTPC topology map.
void setNumberOfDaughters(Int_t ntrk)
Set number of daughter tracks.
Class storing MTD trigger information including VPD, QT, MT101, TF201.
void setRefMult2PosWest(UShort_t mult)
Set positive RefMult2 west ( 0.5<eta<1 )
unsigned int sector() const
Sector.
void setDeltaZ(Float_t dz)
Set delta Z.
Holds BEMC SmdEta hit information.
void setQTtacSum(Int_t runnumber, UShort_t mtdQTadc[8][16], UShort_t mtdQTtac[8][16], const Int_t QTtoModule[8][8], const Int_t QTSlewBinEdge[8][16][8], const Int_t QTSlewCorr[8][16][8])
Set TAC sum (j2+j3) for each position in each QT board.
void setLeadingEdgeTime(std::pair< Float_t, Float_t > leadingEdgeTime)
Set leading edge time.
void setZdcSumAdcEast(Float_t zdcSumAdcEast)
Set sum of east ZDC ADC.
Double_t chi2() const
Returns chi2 of fit.
static StMuETofHit * etofHit(int i)
returns pointer to the i-th StMuETofHit
double dEdxFit() const
returns the fitted dEdx value
void getMaximumQTtac(const Int_t qt, Int_t &pos1, Int_t &pos2)
Holds EMC trigger information.
void setRefMult2NegEast(UShort_t mult)
Set negative RefMult2 east ( -1<eta<-0.5 )
void setZdcUnAttenuatedWest(Float_t adc)
Set unattenuated west ZDC signal.
virtual Int_t InitRun(Int_t const runnumber)
Init run.
void setPosition(Float_t x, Float_t y, Float_t z)
Set vertex position.
unsigned int strip() const
Strip.
void setETofDigiMultiplicity(UShort_t mult)
Set total number of digis in ETOF modules.
const StMuETofPidTraits & etofPidTraits() const
dongx
void setTrailingEdgeTime(std::pair< Float_t, Float_t > trailingEdgeTime)
Set trailing edge time.
void setHitIndex(const Int_t index2Hit)
Set index of corrsponding eTOF hit.
Int_t hitIndex() const
Return index of corrsponding eTOF hit.
void setDeltaY(const Float_t &deltaY)
Set difference between track intersection and eTOF hit in local Y coordinate (cm) along strips...
unsigned short refMultFtpcWest(int vtx_id=-1)
Reference multiplicity of particles in the west FTPC as defined in StEventUtilities/StuFtpcRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
void SetStatus(char const *branchNameRegex, int enable)
Enables or disables branches matching a simple regex pattern in reading mode.
Hold information about eTOF-matched tracks.
void setMcTruth(Int_t index, Int_t qa)
Set index of the corresonding MC track.
void setNSigmaPion(Float_t ns)
Set nSigma(pion)
void setRefMultHalfNegWest(UShort_t mult)
TPC refMultHalf neg (eta>0)
void setClosestVpdWHit(Double_t closestVpdWHit)
Set closest VPDW hit to start time.
static TClonesArray * primaryVertices()
returns pointer to the primary vertex list
void setMtdPidTraitsIndex(Int_t index)
Set index to MTD PID traits.
void setTime(Float_t time)
Set GEANT production time (ns)
TVector3 gMom() const
Return momentum (GeV/c) of the global tracks at the point of DCA to the primary vertex.
static StPicoEvent * event()
Return pointer to current StPicoEvent (class holding the event wise information)
void setRefMultFtpcEast(UShort_t mult)
Set east RefMult (-1<eta<0.5) estimated by FTPC.
void setBbcAdcWest(Int_t iPMT, Float_t bbcAdcWest)
Set i-th PMT of east BBC.
void setIsFromShower(Bool_t isFrom)
Set flag if track comes from shower.
void setHitPositionXYZ(Float_t x, Float_t y, Float_t z)
Set hit position (x,y,z)
void setOrigin(Double_t x, Double_t y, Double_t z)
Set origin of the track (DCA point to the primary vertex)
void setChi2(Float_t chi2)
Set chi2 of the track.
void setTime(Float_t time)
Set leading edge time (ns) of eTOF hit.
void setZdcSmdEastHorizontal(Int_t strip, Float_t zdcSmdEastHorizontal)
Set ZDC for the east horizontal ZDC i-th strip.
void setRefMultHalfNegEast(UShort_t mult)
TPC refMultHalf neg (eta<0)
static const char * picoArrayNames[NAllPicoArrays]
Names of the TBranches in the TTree/File.
void setSigmas(Float_t sigmas[5])
Set 5 sigma parameters.
void setTStart(Double_t startTime)
Set event start time.
void setPrimaryVertexRanking(Float_t ranking)
Set primary vertex ranking.
void setNVpdEGoodHits(Int_t vpdEGoodHits)
Set total number of in-time VPDE hits.
unsigned char matchFlag() const
Matching information.
void setPrimaryVertexPositionError(Float_t x, Float_t y, Float_t z)
Set primary vertex position error (ex,ey,ez)
void setRunId(Int_t id)
Set run ID.
Holds information about track parameters.
unsigned int zPlane() const
ZPlane.
void setTrackIndex(Int_t idx2PicoTrack)
Set assiciated track index.
void setMT101(UShort_t mt101Tac[8][2], UShort_t mt101Id[8][2])
Set two largest TACsum for all QT boards.
void setNTofT0Can(Int_t t0Can)
Set number of particles before T0 outlier rejection.
Int_t backleg() const
Return backleg number (1-30) of the MTD hit.
void setCorrelations(Float_t corr[10])
Set 10 correlation parameters.
virtual ~StPicoDstMaker()
Destructor.
void setHighTowerThreshold(const Int_t i, const Int_t th)
Set threshold for the high tower.
UInt_t getTF201TriggerBit() const
void setZdcWestRate(Float_t zdcWestRate)
Set west ZDC rate.
void setTot(Float_t tot)
Set time over threshold (ns) of eTOF hit.
void setTriggerFlag(Int_t const flag)
static int picoArraySizes[NAllPicoArrays]
Maximum sizes of the TClonesArrays.
void setNSigmaElectron(Float_t ns)
Set nSigma(electron)
void setCovMtxMode(const PicoCovMtxMode covMtxMode)
Set to write or not to write covariant matrix.
void setBbcAdcEast(Int_t iPMT, Float_t bbcAdcEast)
Set i-th PMT of east BBC.
void setCrossingPos(const Float_t &x, const Float_t &y, const Float_t &z)
Set global position (cm) of the track intersection with an eTOF volume.
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
void setZdcSmdWestVertical(Int_t strip, Float_t zdcSmdWestVertical)
Set ZDC for the west vertical ZDC i-th strip.
StPhysicalHelixD helix() const
Returns inner helix (first measured point)
void setTime(Int_t time)
Set time stamp.
UShort_t nHitsFit() const
Return total number of hits used in fit.
void setRefMultHalfPosWest(UShort_t mult)
TPC refMultHalf pos (eta>0)
double calibTime() const
calibrated time
static StPicoMtdPidTraits * mtdPidTraits(Int_t i)
Return pointer to i-th mtd pidTraits.
Int_t module() const
Return module number (1-5) of the MTD hit.
void setRefMultNeg(UShort_t mult)
Set RefMult negative (|eta|<0.5)
static const char * picoArrayTypes[NAllPicoArrays]
Names of the classes, the TClonesArrays are arrays of this type.
void setDedxError(Float_t dEdxError)
Set dE/dx error of the track.
Float_t nSigmaElectron() const
Return nSigma(electron)
void setNHitsFit(Int_t nhits)
Set nHitsFit ( charge * nHitsFit )
short flag() const
Returns flag, (see StEvent manual for type information)
Short_t charge() const
Returns charge.
void setTCanFirst(Double_t tFirst)
Set time of earliest candidate particle in T0 calculation.
void setNHitsHFT(Int_t layer, UShort_t word)
Set number of hits in i-th HFT layers (PXL, PXL, IST, SSD)
static void set(TClonesArray **)
Set the pointers to the TClonesArrays.
void setNTofT0(Int_t t0)
Set number of T0 particles in BTOF self calibration.
void setTHUBtime(Int_t thubID, UInt_t word)
Set THUB time.
void setRefMultHalfPosEast(UShort_t mult)
TPC refMultHalf pos (eta<0)
void setETofPidTraitsIndex(Int_t index)
Set index to ETOF PID traits.
void setRefMultFtpcWest(UShort_t mult)
Set west RefMult (-1<eta<0.5) estimated by FTPC.
void setId(Int_t id)
Set MC track ID (primary key/GEANT track ID)
const StThreeVectorF & p() const
Returns 3-momentum at dca to primary vertex.
void setBunchId(Int_t id)
Set bunch crossing ID.
void setVtxMode(const PicoVtxMode vtxMode)
Set vertex selection mode.
void setNSigmaElectron(Float_t sigma)
Set nsigma(electron)
void setNHitsMax(Int_t nhits)
Set nHitsPoss.
void setVzVpd(Float_t vpdVz)
Set Vz of the primary vertex reconstructed by VPD.
Double_t nSigmaPion() const
Returns Craig's distance to the calculated dE/dx band for pions in units of sigma.
double dNdxErrorFit() const
returns the fitted dNdx resolution value
Stores BTOF hit information.
void setBTofPidTraitsIndex(Int_t index)
Set index to BTOF PID traits.
const StMuProbPidTraits & probPidTraits() const
Returns Yuri Fisyak new pid probabilities.
Main class that keeps TClonesArrays with main classes.
void setRefMult2PosEast(UShort_t mult)
Set positive RefMult2 east ( -1<eta<-0.5 )
void setHitChannel(Int_t backleg, Int_t module, Int_t cell)
Set hit channel: (backleg-1) * 60 + (module-1) * 12 + cell.
Keep information about Barrel ElectroMagnetic Calorimeter (BEMC) matched tracks.
void setNHits(Int_t k, UChar_t n)
void setTof(const Float_t &tof)
Set time of flight.
int associatedTrackId() const
id to the track which has been matched to this hit
void setTF201TriggerBit(Int_t year, UInt_t dsmBit1, UInt_t dsmBit2)
Set trigger bit in TCU that used for online trigger.
Int_t getNextTowerId(Float_t eta, Float_t phi, Int_t nTowersdEta, Int_t nTowersdPhi) const
Return neighbor tower id's.
void setNSigmaKaon(Float_t sigma)
Set nsigma(kaon)
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
void setZ(Float_t z)
Set z.
void setTOF(Float_t tof)
Set time of flight.
static StPicoMtdTrigger * mtdTrigger(Int_t i)
Return pointer to i-th MTD trigger data.
void setZdcSmdWestHorizontal(Int_t strip, Float_t zdcSmdWestHorizontal)
Set ZDC for the west horizontal ZDC i-th strip.
void setNHitsDedx(Int_t nhits)
Set nHitsDedx.
void setBEmcPidTraitsIndex(Int_t index)
Set index to BEMC PID traits.
void setDndx(Float_t dNdx)
Set dN/dx of the track.
Double_t nSigmaElectron() const
Returns Craig's distance to the calculated dE/dx band for electrons in units of sigma.
const StThreeVector< double > & origin() const
-sign(q*B);
void setDeltaY(Float_t dy)
Set delta Y.
static UInt_t numberOfMtdPidTraits()
Return number of MTD traits.
double localX() const
X-position.
UShort_t nHitsPoss() const
Return number of possible hits on track.
void setBeta(Float_t beta)
Set beta.
void setNSigmaPion(Float_t sigma)
Set nsigma(pion)
void setMatchFlag(Char_t flag)
Set match flag.
void setETofGoodEventFlag(bool flag, UShort_t iSector, UShort_t iModule, UShort_t iCounter, UShort_t iGet4)
Set goodEventFlag for a specific eTOF counter.
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
float timeOfFlight() const
timing for PID
void setEarliestVpdEHit(Double_t earliestVpdEHit)
Set earliest VPDE hit compared to start time.
Holds information about Monte Carlo track parameters.
void setBTofMatchFlag(UChar_t flag)
Set TOF-matching flag.
const StThreeVectorF & momentum() const
Returns 3-momentum at dca to primary vertex.
Holds information about the hit from MTD.
static StMuETofDigi * etofDigi(int i)
returns pointer to the i-th StMuEtofDigi
void setBbcBlueBackgroundRate(Float_t bbcBlueBckgRate)
Set "blue"-beam background rate.
void setIsIntermediate(Int_t interim)
Set flag of the intermediate vertex.
static void printTracks()
Print track info.
float timeOfFlight() const
timing for PID
void setGlobalMomentum(Double_t px, Double_t py, Double_t pz)
Set momentum of the global track.
void setGRefMult(UShort_t mult)
Set RefMult estimated by global tracks.
void setIdOfParentTrack(Int_t id)
Set ID of the parent track.
StPicoDstMaker(char const *name="PicoDst")
Constructor.
void setEarliestVpdWHit(Double_t earliestVpdWHit)
Set earliest VPDW hit compared to start time.
void setbTofTrayMultiplicity(UShort_t mult)
Set total number of hits in TOF trays.
StThreeVectorF dca(Int_t vtx_id=-1) const
Returns 3D distance of closest approach to primary vertex.
Float_t nSigmaProton() const
Return nSigma(proton)
PicoIoMode
Write/Read mode: 1-write, 2-read.
void setZdcSumAdcWest(Float_t zdcSumAdcWest)
Set sum of west ZDC ADC.
void setId(Int_t id)
Set track ID.
void setZDCx(Float_t zdcCoinRate)
Set ZDC coincidence rate.
void setMtdHitIndex(Int_t index)
Set MTD hit index.
double totalTot() const
Total Tot.
void setTrackIndex(Int_t index)
Set track index of the associated track.
void setPrimaryMomentum(Double_t px, Double_t py, Double_t pz)
Set momentum of the primary track.
void setBeta(Float_t beta)
Set beta.
Stores eTOF hit information.
Holds BEMC SmdPhi hit information.
void setNVpdHitsWest(UShort_t nHits)
Set number of hits in the west VPD.
double dEdxErrorFit() const
returns the fitted dEdx resolution value
Stores global information about the event.
void setPrimaryVertexPosition(Float_t x, Float_t y, Float_t z)
Set primary vertex position (x,y,z)
void setZdcEastRate(Float_t zdcEastRate)
Set east ZDC rate.
void setLatestVpdWHit(Double_t latestVpdWHit)
Set furthest VPDW hit compared to start time.
double dEdxErrorTruncated() const
returns the truncated 70% dEdx resolution value
Float_t nMIP()
gain calibrated energy loss in tile, in units of Landau MPV for one MIP
static StBTofHeader * btofHeader()
returns pointer to the btofHeader - dongx
void setNumberOfBEMCMatch(Int_t n)
Set number of BEMC-matched tracks.
const StMuTrack * primaryTrack() const
Returns pointer to associated primary track. Null pointer if no global track available.
void setTan(Float_t tan)
Set tangent.
Int_t getBin(const Float_t phi, const Float_t eta, Int_t &m, Int_t &e, Int_t &s) const
void setBEmcMatchedTowerIndex(Int_t index)
Set index of the BEMC tower that matches the track.
Double_t nSigmaProton() const
Returns Craig's distance to the calculated dE/dx band for protons in units of sigma.
static StEmcCollection * emcCollection()
returns pointer to current StEmcCollection
void setVpdTacSum(UShort_t tacSum)
Set VPD TAC sum.
void getStatus(Int_t det, Int_t softId, Int_t &status, const char *option="") const
Return status.
float timeOfFlight() const
timing for PID
Bool_t projTrack(StThreeVectorD *atFinal, StThreeVectorD *momentumAtFinal, const StTrack *const track, Double_t magField, Double_t radius=225.405, Int_t option=1) const
Track projection utility.
void setId(Int_t id)
Set vertex ID.
void setPsi(Float_t psi)
Set psi.
void setGeomId(Int_t geomId)
Set geometry ID of the hit.
void setBeta(const Float_t &beta)
Set beta.
float sigmaElectron() const
PID functions.
double dNdxFit() const
returns the fitted dNdx value
void setETofHitMultiplicity(UShort_t mult)
Set total number of hits in ETOF modules.
void setBbcEastRate(Float_t bbcEastRate)
Set east BBC rate.
void setIdVtxStart(Int_t id)
Set start MC vertex index.
void setCurv(Float_t curv)
Set curvature.
virtual void Clear(Option_t *option="")
Clear.
static Int_t currentVertexIndex()
Get the index number of the current primary vertex.
virtual void moveOrigin(double s)
move the origin along the helix to s which becomes then s=0
double dEdxTruncated() const
returns the truncated 70% dEdx value
Double_t nSigmaKaon() const
Returns Craig's distance to the calculated dE/dx band for kaons in units of sigma.
double Move(double step)
Move along helix.
void setYLocal(Float_t yLocal)
Set yLocal.
StPhysicalHelixD outerHelix() const
Returns outer helix (last measured point)
void setDeltaTimeOfFlight(Float_t t)
Set difference between measured and expected time of flight.
void setTCanLast(Double_t tLast)
Set time of last candidate particle in T0 calculation.
static void setVertexIndex(Int_t vtx_id)
Set the index number of the current primary vertex (used by both primaryTracks() functions and for St...
void setNVpdHitsEast(UShort_t nHits)
Set number of hits in the east VPD.
const StMuETofHit * etofHit() const
dongx
double calibTot() const
Getter for calibrated Tot.
StTrackTopologyMap topologyMap() const
Returns topology map.
void setIdVtxItrmd(Int_t id)
Set first intermediate MC vertex index.
unsigned int counter() const
Counter.
static UInt_t numberOfMtdTriggers()
Return number of MTD triggers.
void setJetPatchThreshold(const Int_t i, const Int_t th)
Set threshold for jet patch.
void setBEmcSmdMode(const PicoBEmcSmdMode bemcSmdMode)
Set to write or not write BEmc Smd hits.
void setDndxError(Float_t dNdxError)
Set dN/dx error of the track.
void setMatchFlag(const Char_t flag)
Set match flag.
void setGeantId(Int_t id)
Set GEANT ID (according to GPART)
unsigned short refMultPos(int vtx_id=-1)
Reference multiplicity of positive particles as defined in StEventUtilities/StuRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
void setLatestVpdEHit(Double_t latestVpdEHit)
Set furthest VPDE hit compared to start time.
virtual TDataSet * Find(const char *path) const
void setCharge(Int_t charge)
Set particle charge.
unsigned short refMultFtpcEast(int vtx_id=-1)
Reference multiplicity of particles in the east FTPC as defined in StEventUtilities/StuFtpcRefMult.hh for vertex vtx_id (-1 is default index from StMuDst)
void setP(Float_t px, Float_t py, Float_t pz)
Set three-momentum.
double Dca(const double point[3], double *dcaErr=0) const
DCA to given space point (with error matrix)
void setLocalX(Float_t localX)
Set local X coordinate (cm) across strips w.r.t. center of eTOF counter volume.
unsigned short matchFlag() const
matching information