StFemtoDstMaker_HFT.cxx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. #include "StFemtoDstMaker_HFT.h"
  2. #include "StBTofHeader.h"
  3. #include "TBranch.h"
  4. #include "StPhysicalHelixD.hh"
  5. #include "StDcaGeometry.h"
  6. ClassImp(StFemtoDstMaker_HFT)
  7. //
  8. // Set maximum file size to 1.9 GB (Root has a 2GB limit)
  9. //
  10. #define MAXFILESIZE 1900000000
  11. //_________________
  12. StFemtoDstMaker_HFT::StFemtoDstMaker_HFT(StMuDstMaker *muMaker,
  13. const Char_t *oFileName) {
  14. std::cout << "StFemtoDstMaker_HFT::StFemtoDstMaker_HFT - Creating an instance...";
  15. mOutFileName = oFileName;
  16. mMuDstMaker = muMaker;
  17. mRefMultCorrUtil = NULL;
  18. mCompression = 9;
  19. mCollisionType = false; // 0-pp, 1-AuAu
  20. mEventIsGood = false;
  21. mNEventsIn = 0;
  22. mNEventsPassed = 0;
  23. mAuAuCorrectZdc = true;
  24. mIsGoodTrack = false;
  25. mCurrentTrigger = 0;
  26. matrix = new TMatrixTSym<double>(2); // Transverse
  27. mPtCut = 0.1; // sphericity
  28. //
  29. // Default cut values
  30. //
  31. // initialize event cut variables
  32. mPrimVtxZ[0] = -70.;
  33. mPrimVtxZ[1] = 70.;
  34. mPrimVtxR[0] = -1.;
  35. mPrimVtxR[1] = 10.;
  36. mPrimVtxVpdVzDiff[0] = -10.;
  37. mPrimVtxVpdVzDiff[1]= 10.;
  38. mPrimVtxXShift = 0.;
  39. mPrimVtxYShift = 0.;
  40. // initialize single-particle cut variables
  41. mTrackMomentum[0] = 0.1;
  42. mTrackMomentum[1] = 2.;
  43. mTrackDca[0] = 0.;
  44. mTrackDca[1] = 3.;
  45. mTrackNHits[0] = 15;
  46. mTrackNHits[1] = 50;
  47. mTrackEta[0] = -1.1;
  48. mTrackEta[1] = 1.1;
  49. mTrackFlag[0] = 0;
  50. mTrackFlag[1] = 1000;
  51. // flags and cuts for exclusion
  52. mRemovePions = false;
  53. mRemoveKaons = false;
  54. mRemoveProtons = false;
  55. mPthresh = 0.4;
  56. mTpcPionNSigma[0] = -1.5;
  57. mTpcPionNSigma[1] = 1.5;
  58. mTofPionMassSqr[0] = -0.1;
  59. mTofPionMassSqr[1] = 0.15;
  60. mTpcKaonNSigma[0] = -1.5;
  61. mTpcKaonNSigma[1] = 1.5;
  62. mTofKaonMassSqr[0] = 0.2;
  63. mTofKaonMassSqr[1] = 0.35;
  64. mTpcProtonNSigma[0] = -1.5;
  65. mTpcProtonNSigma[1] = 1.5;
  66. mTofProtonMassSqr[0] = 0.7;
  67. mTofProtonMassSqr[1] = 1.1;
  68. std::cout << "\t[DONE]" << std::endl;
  69. }
  70. //_________________
  71. StFemtoDstMaker_HFT::~StFemtoDstMaker_HFT() {
  72. delete matrix;
  73. }
  74. //_________________
  75. Int_t StFemtoDstMaker_HFT::Init() {
  76. std::cout << "StFemtoDstMaker_HFT::Init - Initializing the maker"
  77. << std::endl
  78. << "Creating output file: " << mOutFileName;
  79. mFemtoEvent = new StFemtoEvent();
  80. mOutFile = new TFile(mOutFileName, "RECREATE");
  81. mOutFile->SetCompressionLevel(mCompression);
  82. std::cout << "\t[DONE]" << std::endl;
  83. mTree = new TTree("StFemtoDst","StFemtoDst");
  84. mTree->SetMaxTreeSize(MAXFILESIZE);
  85. //mTree->SetAutoSave(1000000);
  86. mTree->Branch("StFemtoEvent","StFemtoEvent", &mFemtoEvent);
  87. if(mCollisionType == true) { // for AuAu only
  88. if(!mRefMultCorrUtil) {
  89. std::cout << "StFemtoDstMaker_HFT::Init - Initializing StRefMultCorr...";
  90. mRefMultCorrUtil = new StRefMultCorr("refmult");
  91. std::cout << "\t[DONE]" << endl;
  92. }
  93. }
  94. mNBytes = 0;
  95. std::cout << "StFemtoDstMaker_HFT::Init - Initialization has been finished"
  96. << std::endl;
  97. return StMaker::Init();
  98. }
  99. //________________
  100. void StFemtoDstMaker_HFT::Clear(Option_t *option) {
  101. StMaker::Clear();
  102. }
  103. //________________
  104. Int_t StFemtoDstMaker_HFT::Make() {
  105. mNEventsIn++;
  106. mMuDst = NULL;
  107. mMuEvent = NULL;
  108. //
  109. // MuDstMaker initialization
  110. //
  111. if(!mMuDstMaker) {
  112. mMuDstMaker = (StMuDstMaker*)GetMaker("MuDst");
  113. if (!mMuDstMaker) {
  114. LOG_ERROR << "StFemtoDstMaker_HFT::Make [ERROR] - Cannot find StMuDstMaker"
  115. << std::endl;
  116. return kStOk;
  117. }
  118. }
  119. //
  120. // Obtaining MuDst
  121. //
  122. mMuDst = mMuDstMaker->muDst();
  123. if (!mMuDst) {
  124. mMuDst = (StMuDst*)GetInputDS("MuDst");
  125. if (!mMuDst) {
  126. gMessMgr->Warning() << "StFemtoDstMaker_HFT::Make [WARNING] - No MuDst has been found"
  127. << endm;
  128. return kStOk;
  129. }
  130. }
  131. //
  132. // obtaining MuEvent
  133. //
  134. mMuEvent = (StMuEvent*)mMuDst->event();
  135. if(!AcceptTrigger(mMuEvent)) { // if trigger is not found
  136. return kStOk;
  137. }
  138. if(mMuEvent->refMult() < 0) { // multiplicity cannot be negative
  139. return kStOk;
  140. }
  141. Int_t mNVertices = mMuDst->numberOfPrimaryVertices();
  142. Int_t mNPrimTracks = mMuDst->numberOfPrimaryTracks();
  143. Int_t mNGlobTracks = mMuDst->numberOfGlobalTracks();
  144. //
  145. // Some initializations of local variables
  146. //
  147. mPrimVertex = NULL;
  148. StThreeVectorF mVertPosition;
  149. Float_t mVpdVz = 0.;
  150. StBTofHeader* mTofHeader = mMuDst->btofHeader();
  151. Int_t mCent16;
  152. Double_t mCentWeight;
  153. Double_t mRefMultCorrVal = 0.;
  154. Double_t mBeta;
  155. Double_t mMassSqr;
  156. Int_t mPrimVertIndex = -999;
  157. Float_t mRanking = -999.;
  158. if(mCollisionType == false) { // pp collisions means false state
  159. mCent16 = -1;
  160. mCentWeight = -999.;
  161. }
  162. //Calculate the amount of the pile-up vertices
  163. UShort_t mNVtxInBunchCross = 0;
  164. for(UShort_t iVert=0; iVert<mMuDst->numberOfPrimaryVertices(); iVert++) {
  165. mPrimVertex = mMuDst->primaryVertex(iVert);
  166. if(!mPrimVertex || !mTofHeader) continue;
  167. if(mPrimVertex->ranking() <= 0.) continue;
  168. if(TMath::Abs(mPrimVertex->position().x()) < 1e-5 &&
  169. TMath::Abs(mPrimVertex->position().y()) < 1e-5 &&
  170. TMath::Abs(mPrimVertex->position().z()) < 1e-5) {
  171. continue;
  172. }
  173. if(TMath::Abs( mPrimVertex->position().z() - mTofHeader->vpdVz()) < 5. ) {
  174. mNVtxInBunchCross++;
  175. }
  176. } //for(unsigned short iVert=0; iVert<mNVertices; iVert++)
  177. //There should be only one primary vertex that caused the trigger
  178. if(mNVtxInBunchCross > 1) {
  179. return kStOk;
  180. }
  181. CleanVariables(); // clean index vectors
  182. //
  183. // Vertex loop
  184. //
  185. for(Int_t iVert=0; iVert<mNVertices; iVert++) {
  186. mEventIsGood = false;
  187. if(iVert!=0) break; // not first primary vertex does not contain tracks
  188. // with fast detectors (TOF)
  189. mPrimVertex = mMuDst->primaryVertex(iVert);
  190. if(mPrimVertex->ranking() <= 0) // positive ranking only
  191. continue;
  192. //
  193. // Check that position of the primary vertex if not (0,0,0)
  194. //
  195. if(mPrimVertex->position().x() == 0 &&
  196. mPrimVertex->position().y() == 0 &&
  197. mPrimVertex->position().z() == 0) continue;
  198. if(mNPrimTracks < 0 || mNPrimTracks > 10000) // reasonable amount of tracks
  199. continue;
  200. mPrimVertIndex = iVert;
  201. mRanking = mPrimVertex->ranking();
  202. mVertPosition = mPrimVertex->position();
  203. if(mTofHeader)
  204. mVpdVz = mTofHeader->vpdVz();
  205. else
  206. mVpdVz = mVertPosition.z();
  207. if( !AcceptPrimVtx(mVertPosition, mVpdVz) )
  208. continue;
  209. mEventIsGood = true;
  210. //
  211. // Set StRefMultCorr
  212. //
  213. if(mCollisionType == true) { // AuAu collisions means true state
  214. mRefMultCorrUtil->init(mMuEvent->runId());
  215. if(mAuAuCorrectZdc == true) {
  216. mRefMultCorrUtil->initEvent(mMuEvent->refMult(),
  217. mVertPosition.z(),
  218. mMuEvent->runInfo().zdcCoincidenceRate());
  219. }
  220. else {
  221. mRefMultCorrUtil->initEvent(mMuEvent->refMult(),
  222. mVertPosition.z());
  223. }
  224. mCent16 = mRefMultCorrUtil->getCentralityBin16();
  225. if(mCent16 < 0) // some AuAu collisions have -1 value
  226. continue;
  227. mCentWeight = mRefMultCorrUtil->getWeight();
  228. mRefMultCorrVal = mRefMultCorrUtil->getRefMultCorr();
  229. } //if(mCollisionType == true)
  230. mNEventsPassed++;
  231. mFemtoEvent->SetEventId(mMuEvent->eventId());
  232. mFemtoEvent->SetRunId(mMuEvent->runId());
  233. mFemtoEvent->SetCollisionType(mCollisionType);
  234. mFemtoEvent->SetCent16(mCent16);
  235. //mFemtoEvent->SetZDCe(mMuEvent->zdcTriggerDetector().adc(4));
  236. //mFemtoEvent->SetZDCw(mMuEvent->zdcTriggerDetector().adc(0));
  237. mFemtoEvent->SetNumberOfBTofHit(mMuDst->numberOfBTofHit());
  238. mFemtoEvent->SetNumberOfPrimaryTracks(mNPrimTracks);
  239. mFemtoEvent->SetNumberOfGlobalTracks(mNGlobTracks);
  240. mFemtoEvent->SetMagneticField(mMuEvent->magneticField());
  241. mFemtoEvent->SetPrimaryVertexPosition(mVertPosition.x(),
  242. mVertPosition.y(),
  243. mVertPosition.z());
  244. mFemtoEvent->SetVpdVz(mVpdVz);
  245. mFemtoEvent->SetTriggerId(mCurrentTrigger);
  246. mFemtoEvent->SetPrimaryVertexRanking(mRanking);
  247. UInt_t refMult2 = 0;
  248. UInt_t refMult2Pos = 0;
  249. UShort_t refMult = 0;
  250. UShort_t refMultPos = 0;
  251. StFemtoTrack *mFTrack = NULL;
  252. //
  253. // Calculate sphericity
  254. //
  255. float sph = -999.;
  256. float pt_full = 0.0;
  257. matrix->Zero();
  258. for (int i = 0; i < mNPrimTracks; i++)
  259. {
  260. mPrimTrack = mMuDst->primaryTracks(i);
  261. if (mPrimTrack->vertexIndex() != 0) return kStOk;
  262. float pt = mPrimTrack->pt();
  263. const StThreeVectorF &p = mPrimTrack->p();
  264. if (fabs(mPrimTrack->eta()) < 1.0 && pt > mPtCut)
  265. {
  266. float px = p.x();
  267. float py = p.y();
  268. (*matrix)(0, 0) += px*px/pt;
  269. (*matrix)(1, 1) += py*py/pt;
  270. (*matrix)(0, 1) += px*py/pt;
  271. (*matrix)(1, 0) += px*py/pt;
  272. pt_full += pt;
  273. }
  274. }
  275. *matrix *= 1./pt_full;
  276. TMatrixDSymEigen death_machine(*matrix);
  277. TVectorD eigen = death_machine.GetEigenValues();
  278. sph = 2.*eigen.Min()/(eigen[0] + eigen[1]);
  279. mFemtoEvent->SetSphericity(sph);
  280. //
  281. // Loop over primary tracks
  282. //
  283. for(Int_t iTrk=0; iTrk < mNGlobTracks; iTrk++) {
  284. mGlobTrack = mMuDst->globalTracks(iTrk);
  285. mPrimTrack = (StMuTrack *)mGlobTrack->primaryTrack();
  286. CalcDca(mGlobTrack->helix(), mPrimVertex->position());
  287. if (AcceptRefMult2(mGlobTrack)) {
  288. refMult2++;
  289. if(mGlobTrack->charge() > 0) refMult2Pos++;
  290. }
  291. if (AcceptRefMult(mGlobTrack)) {
  292. refMult++;
  293. if(mGlobTrack->charge() > 0) refMultPos++;
  294. }
  295. if(!AcceptTrack(mGlobTrack))
  296. continue;
  297. double nSigmaElectron = mGlobTrack->nSigmaElectron();
  298. double nSigmaPion = mGlobTrack->nSigmaPion();
  299. double nSigmaKaon = mGlobTrack->nSigmaKaon();
  300. double nSigmaProton = mGlobTrack->nSigmaProton();
  301. Bool_t mIsTofTrack = IsTofTrack(mGlobTrack);
  302. if(mIsTofTrack) {
  303. mBeta = mGlobTrack->btofPidTraits().beta();
  304. mMassSqr = mGlobTrack->momentum().mag2()*(1./(mBeta*mBeta) - 1.);
  305. } //if(mIsTofTrack)
  306. else {
  307. mBeta = -999.;
  308. mMassSqr = -999.;
  309. }
  310. mFTrack = mFemtoEvent->AddFemtoTrack();
  311. mFTrack->SetId( mGlobTrack->id() );
  312. mFTrack->SetNHits( (Char_t)(mGlobTrack->charge()*mGlobTrack->nHits()) );
  313. mFTrack->SetNHitsPoss( mGlobTrack->nHitsPoss() );
  314. mFTrack->SetNSigmaElectron(nSigmaElectron);
  315. mFTrack->SetNSigmaPion(nSigmaPion);
  316. mFTrack->SetNSigmaKaon(nSigmaKaon);
  317. mFTrack->SetNSigmaProton(nSigmaProton);
  318. mFTrack->SetDedx(mGlobTrack->dEdx() );
  319. mFTrack->SetMap0(mGlobTrack->topologyMap().data(0));
  320. mFTrack->SetMap1(mGlobTrack->topologyMap().data(1));
  321. if (mPrimTrack)
  322. mFTrack->SetP(mPrimTrack->p().x(),
  323. mPrimTrack->p().y(),
  324. mPrimTrack->p().z());
  325. else
  326. mFTrack->SetP(0.0, 0.0, 0.0);
  327. mFTrack->SetDCAxGlobal(mDca.x());
  328. mFTrack->SetDCAyGlobal(mDca.y());
  329. mFTrack->SetDCAzGlobal(mDca.z());
  330. mFTrack->SetGlobalP(mGlobTrack->p().x(),
  331. mGlobTrack->p().y(),
  332. mGlobTrack->p().z());
  333. mFTrack->SetBeta(mBeta);
  334. }
  335. mFemtoEvent->SetRefMult(refMult);
  336. mFemtoEvent->SetRefMultCorr(mCollisionType ? mRefMultCorrVal : refMult);
  337. mFemtoEvent->SetRefMultCorrWeight(mCentWeight);
  338. mFemtoEvent->SetRefMultPos(refMultPos);
  339. mFemtoEvent->SetRefMult2(refMult2);
  340. mFemtoEvent->SetRefMult2Pos(refMult2Pos);
  341. if(mEventIsGood) {
  342. mNBytes += mTree->Fill();
  343. mFemtoEvent->Clear();
  344. }
  345. }
  346. return kStOk;
  347. }
  348. //_________________
  349. Bool_t StFemtoDstMaker_HFT::AcceptTrigger(StMuEvent *muEvent) {
  350. //We will store the bit mask for the list of triggers.
  351. //The list of triggers should be the same and in the same
  352. //order, in order to read it later
  353. Bool_t mIsGoodTrigger = false;
  354. mCurrentTrigger = 0;
  355. if(mTriggerIdCollection.empty()) {
  356. mIsGoodTrigger = true;
  357. }
  358. else {
  359. for (UInt_t iTrg = 0; iTrg < mTriggerIdCollection.size(); iTrg++) {
  360. if(muEvent->triggerIdCollection().nominal().isTrigger(mTriggerIdCollection.at(iTrg))) {
  361. mIsGoodTrigger = true;
  362. mCurrentTrigger |= (1<<iTrg);
  363. break;
  364. }
  365. } //for(UInt_t iTrg=0; iTrg<mTriggerIdCollection.size(); iTrg++)
  366. }
  367. return mIsGoodTrigger;
  368. }
  369. //_________________
  370. Bool_t StFemtoDstMaker_HFT::AcceptPrimVtx(StThreeVectorF vtxPos,
  371. Float_t vpdVz) {
  372. Float_t mVtxX = vtxPos.x() - mPrimVtxXShift;
  373. Float_t mVtxY = vtxPos.y() - mPrimVtxYShift;
  374. Float_t vtxR = TMath::Sqrt(mVtxX*mVtxX + mVtxY*mVtxY);
  375. Float_t vpdDiff = vtxPos.z() - vpdVz;
  376. Bool_t mIsGoodVtx = vtxPos.z() >= mPrimVtxZ[0] &&
  377. vtxPos.z() <= mPrimVtxZ[1] &&
  378. vtxR >= mPrimVtxR[0] &&
  379. vtxR <= mPrimVtxR[1] &&
  380. vpdDiff >= mPrimVtxVpdVzDiff[0] &&
  381. vpdDiff <= mPrimVtxVpdVzDiff[1];
  382. return mIsGoodVtx;
  383. }
  384. //_________________
  385. Bool_t StFemtoDstMaker_HFT::AcceptTrack(StMuTrack *trk) {
  386. Bool_t mIsGoodTrack = trk->momentum().mag() >= mTrackMomentum[0] &&
  387. trk->momentum().mag() <= mTrackMomentum[1] &&
  388. trk->type() == 0 && // 0 - global, 1 - primary
  389. trk->eta() >= mTrackEta[0] && trk->eta() <= mTrackEta[1] &&
  390. trk->nHits() >= mTrackNHits[0] && trk->nHits() <= mTrackNHits[1] &&
  391. trk->flag() >= mTrackFlag[0] && trk->flag() <= mTrackFlag[1];
  392. return mIsGoodTrack;
  393. }
  394. //_________________
  395. Bool_t StFemtoDstMaker_HFT::AcceptRefMult2(StMuTrack *trk) {
  396. Bool_t mIsGoodTrack = trk->flag()> 0 &&
  397. trk->charge() != 0 &&
  398. trk->nHits() >= 10 &&
  399. mDca.mag() < 3. &&
  400. trk->momentum().mag() >= 1e-10 &&
  401. TMath::Abs(trk->eta()) <= 1.0;
  402. return mIsGoodTrack;
  403. }
  404. //_________________
  405. Bool_t StFemtoDstMaker_HFT::AcceptRefMult(StMuTrack *trk) {
  406. Bool_t mIsGoodTrack = trk->flag()> 0 && // trk->flag() <= 700 pile tracks
  407. trk->charge() != 0 &&
  408. trk->nHits() >= 10 &&
  409. mDca.mag() < 3. &&
  410. trk->momentum().mag() >= 1e-10 &&
  411. TMath::Abs(trk->eta()) <= 0.5;
  412. return mIsGoodTrack;
  413. }
  414. //_________________
  415. Bool_t StFemtoDstMaker_HFT::IsTofTrack(StMuTrack *trk) { //Only for globals
  416. Bool_t mIsTofHit = trk->btofPidTraits().beta() > 0 &&
  417. trk->btofPidTraits().timeOfFlight() > 0;
  418. return mIsTofHit;
  419. }
  420. //_________________
  421. Int_t StFemtoDstMaker_HFT::Finish() {
  422. mOutFile->cd();
  423. mOutFile->Write();
  424. //mTree->Write();
  425. mOutFile->Close();
  426. std::cout << "*************************************" << std::endl
  427. << "StFemtoDstMaker_HFT has been finished" << std::endl
  428. << "\t nEventsPassed : " << mNEventsPassed << std::endl
  429. << "\t nEventsProcessed: " << mNEventsIn << std::endl
  430. << "*************************************" << std::endl;
  431. return kStOk;
  432. }
  433. //_________________
  434. void StFemtoDstMaker_HFT::CleanVariables() {
  435. mEventIsGood = false;
  436. }
  437. //_________________
  438. Bool_t StFemtoDstMaker_HFT::IsTpcPion(StMuTrack *pTrk) {
  439. Bool_t isPion = false;
  440. if( pTrk->momentum().mag() <= mPthresh &&
  441. pTrk->nSigmaPion() >= mTpcPionNSigma[0] &&
  442. pTrk->nSigmaPion() <= mTpcPionNSigma[1] ) {
  443. isPion = true;
  444. }
  445. return isPion;
  446. }
  447. //_________________
  448. Bool_t StFemtoDstMaker_HFT::IsTpcKaon(StMuTrack *pTrk) {
  449. Bool_t isKaon = false;
  450. if( pTrk->momentum().mag() <= mPthresh &&
  451. pTrk->nSigmaKaon() >= mTpcKaonNSigma[0] &&
  452. pTrk->nSigmaKaon() <= mTpcKaonNSigma[1] ) {
  453. isKaon = true;
  454. }
  455. return isKaon;
  456. }
  457. //_________________
  458. Bool_t StFemtoDstMaker_HFT::IsTpcProton(StMuTrack *pTrk) {
  459. Bool_t isProton = false;
  460. if( pTrk->momentum().mag() <= mPthresh &&
  461. pTrk->nSigmaProton() >= mTpcProtonNSigma[0] &&
  462. pTrk->nSigmaProton() <= mTpcProtonNSigma[1] ) {
  463. isProton = true;
  464. }
  465. return isProton;
  466. }
  467. //_________________
  468. Bool_t StFemtoDstMaker_HFT::IsTofPion(StMuTrack *gTrk) {
  469. Bool_t isPion = false;
  470. Float_t beta = -999.;
  471. Float_t mSqr = -999.;
  472. if( gTrk->btofPidTraits().beta() > 0 &&
  473. gTrk->momentum().mag() > mPthresh ) {
  474. beta = gTrk->btofPidTraits().beta();
  475. mSqr = gTrk->momentum().mag2() * (1./(beta*beta) - 1.);
  476. if(mSqr >= mTofPionMassSqr[0] &&
  477. mSqr <= mTofPionMassSqr[1]) {
  478. isPion = true;
  479. }
  480. }
  481. return isPion;
  482. }
  483. //_________________
  484. Bool_t StFemtoDstMaker_HFT::IsTofKaon(StMuTrack *gTrk) {
  485. Bool_t isKaon = false;
  486. Float_t beta = -999.;
  487. Float_t mSqr = -999.;
  488. if( gTrk->btofPidTraits().beta() > 0 &&
  489. gTrk->momentum().mag() > mPthresh ) {
  490. beta = gTrk->btofPidTraits().beta();
  491. mSqr = gTrk->momentum().mag2() * (1./(beta*beta) - 1.);
  492. if(mSqr >= mTofKaonMassSqr[0] &&
  493. mSqr <= mTofKaonMassSqr[1]) {
  494. isKaon = true;
  495. }
  496. }
  497. return isKaon;
  498. }
  499. //_________________
  500. StMuTrack *StFemtoDstMaker_HFT::FindPrimaryTrack(int idGlob, int nPrimTracks) {
  501. StMuTrack *track;
  502. for (int iTrk = 0; iTrk < nPrimTracks; iTrk++) {
  503. if ((track = mMuDst->primaryTracks(iTrk))->id() == idGlob)
  504. return track;
  505. }
  506. return 0;
  507. }
  508. //_________________
  509. Bool_t StFemtoDstMaker_HFT::IsTofProton(StMuTrack *gTrk) {
  510. Bool_t isProton = false;
  511. Float_t beta = -999.;
  512. Float_t mSqr = -999.;
  513. if(gTrk->btofPidTraits().beta() > 0 &&
  514. gTrk->momentum().mag() > 0.5 ) {
  515. //gTrk->momentum().mag() > mPthresh ) {
  516. beta = gTrk->btofPidTraits().beta();
  517. mSqr = gTrk->momentum().mag2() * (1./(beta*beta) - 1.);
  518. if(mSqr >= mTofProtonMassSqr[0] &&
  519. mSqr <= mTofProtonMassSqr[1]) {
  520. isProton = true;
  521. }
  522. }
  523. return isProton;
  524. }
  525. //_________________
  526. void StFemtoDstMaker_HFT::SetTriggerId(const UInt_t &id) {
  527. mTriggerIdCollection.push_back(id);
  528. }
  529. //_________________
  530. //
  531. // This method calculates the distance of the closes approach (DCA) from the
  532. // one track to a 3D-point (B point, see below).
  533. //
  534. // For this methods we needs only two arguments
  535. // the helix of the track itself and the 3D-coord of the point (for example
  536. // primary vertex position).
  537. //
  538. void StFemtoDstMaker_HFT::CalcDca(const StPhysicalHelixD &helix,
  539. const StThreeVectorF &vtxPos) {
  540. double pathLen = helix.pathLength(vtxPos, false); // this method returns the path length
  541. // along the helix to the point A
  542. // of the DCA. We need it further
  543. mDca = helix.at(pathLen) - vtxPos; // here we take the 3D-vector of the point A
  544. // on the helix and subtract the B point,
  545. // which is the coordinate of the, for example,
  546. // primary vertex.
  547. }