StMuDstMinvMaker.cxx 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. #include "StMuDstMinvMaker.h"
  2. #include "StBTofHeader.h"
  3. #include "TBranch.h"
  4. ClassImp(StMuDstMinvMaker)
  5. //
  6. // Set maximum file size to 1.9 GB (Root has a 2GB limit)
  7. //
  8. #define MAXFILESIZE 1900000000
  9. //_________________
  10. StMuDstMinvMaker::StMuDstMinvMaker(StMuDstMaker *muMaker,
  11. const Char_t *oFileName) {
  12. std::cout << "StMuDstMinvMaker::StMuDstMinvMaker - Creating an instance...";
  13. mMuDstMaker = muMaker;
  14. mEventIsGood = false;
  15. mNEventsIn = 0;
  16. mNEventsPassed = 0;
  17. mIsGoodTrack = false;
  18. mCurrentTrigger = 0;
  19. mFileName = oFileName;
  20. //
  21. // Initialize event cut variables
  22. //
  23. mPrimVtxZ[0] = -70.;
  24. mPrimVtxZ[1] = 70.;
  25. mPrimVtxR[0] = -1.;
  26. mPrimVtxR[1] = 10.;
  27. mPrimVtxVpdVzDiff[0] = -10.;
  28. mPrimVtxVpdVzDiff[1]= 10.;
  29. mPrimVtxXShift = 0.;
  30. mPrimVtxYShift = 0.;
  31. //
  32. // Initialize single-particle cut variables
  33. //
  34. mTrackP[0] = 0.1;
  35. mTrackP[1] = 2.;
  36. mTrackDca[0] = 0.;
  37. mTrackDca[1] = 5.;
  38. mTrackDcaGlobal[0] = 0.;
  39. mTrackDcaGlobal[1] = 5.;
  40. mTrackNHits[0] = 15;
  41. mTrackNHits[1] = 50;
  42. mTrackNHitsFit[0] = 15;
  43. mTrackNHitsFit[1] = 50;
  44. mTrackEta[0] = -1.1;
  45. mTrackEta[1] = 1.1;
  46. mTrackFlag[0] = 0;
  47. mTrackFlag[1] = 1000;
  48. /*
  49. //
  50. // Initialize TPC and TOF PID
  51. //
  52. mPionPionNSigma[0] = -3.; mPionPionNSigma[1] = 3.;
  53. mPionKaonNSigma[0] = 1.; mPionKaonNSigma[1] = -1.;
  54. */
  55. mTTTPThreshold = 0.7;
  56. std::cout << "\t[DONE]" << std::endl;
  57. }
  58. //_________________
  59. StMuDstMinvMaker::~StMuDstMinvMaker() {
  60. /* nothing to do */
  61. }
  62. //_________________
  63. Int_t StMuDstMinvMaker::Init() {
  64. std::cout << "StMuDstMinvMaker::Init - Initializing the maker"
  65. << std::endl;
  66. //
  67. // Create histograms and output file
  68. //
  69. mOutFile = new TFile(mFileName, "RECREATE");
  70. //
  71. // General event distributions
  72. //
  73. hR = new TH1F("hR", "R=#sqrt{v_{x}^{2} + v_{y}^{2}};R (cm);#",
  74. 200, 0., 2.);
  75. hVx = new TH1F("hVx", ";v_{x} (cm);#", 200, -1.5, 1.5);
  76. hVy = new TH1F("hVy", ";v_{y} (cm);#", 200, -1.5, 1.5);
  77. hVz = new TH1F("hVz", ";v_{z} (cm);#", 100, -70., 70.);
  78. hVxVsVy = new TH2F("hVxVsVy", ";v_{x} (cm); v_{y} (cm)",
  79. 600, -1.5, 1.5,
  80. 600, -1.5, 1.5);
  81. hVxVsVz = new TH2F("hVxVsVz", ";v_{x} (cm); v_{z} (cm)",
  82. 600, -1.5, 1.5,
  83. 600, -70., 70.);
  84. hVyVsVz = new TH2F("hVyVsVz", ";v_{y} (cm); v_{z} (cm)",
  85. 600, -1.5, 1.5,
  86. 600, -70., 70.);
  87. hNPrimTr = new TH1F("hNPrimTr", ";N_{primary tracks};#", 150, 0, 1500);
  88. hNGlobTr = new TH1F("hNGlobTr", ";N_{global tracks};#", 150, 0, 1500);
  89. hTofRefMult = new TH1F("hTofRefMult", ";TofRefMult;#", 100, 0, 1000);
  90. hTofRefMultVsRefMult = new TH2F("hTofRefMultVsRefMult", ";TofRefMult;RefMult",
  91. 500, 0., 1000,
  92. 500, 0., 1000);
  93. hVpd = new TH1F("hVpd", ";v_{z}^{vpd} (cm);#", 100, -70., 70.);
  94. hVpdVz = new TH1F("hVpdVz", ";v_{z}^{vpd}-v_{z}", 100, -10., 10.);
  95. hNPrimVtx = new TH1F("hNPrimVtx", ";N_{primary vertex};#", 10, 0, 10);
  96. //
  97. // General track distributions
  98. //
  99. hP = new TH1F("hP", ";p (GeV/c);#", 200, 0., 5.);
  100. hPt = new TH1F("hPt", ";p_{t} (GeV/c);#", 200, 0., 5.);
  101. hPx = new TH1F("hPx", ";p_{x} (GeV/c);#", 200, 0., 5.);
  102. hPy = new TH1F("hPy", ";p_{y} (GeV/c);#", 200, 0., 5.);
  103. hPz = new TH1F("hPz", ";p_{z} (GeV/c);#", 200, 0., 5.);
  104. hEta = new TH1F("hEta", ";#eta;#", 200, -2., 2.);
  105. hPAccept = new TH1F("hPAccept", "accepted tracks;p (GeV/c);#", 200, 0., 3.);
  106. hPtAccept = new TH1F("hPtAccept", "accepted tracks;p_{t} (GeV/c);#", 200, 0., 3.);
  107. hPxAccept = new TH1F("hPxAccept", "accepted tracks;p_{x} (GeV/c);#", 200, 0., 3.);
  108. hPyAccept = new TH1F("hPyAccept", "accepted tracks;p_{y} (GeV/c);#", 200, 0., 3.);
  109. hPzAccept = new TH1F("hPzAccept", "accepted tracks;p_{z} (GeV/c);#", 200, 0., 3.);
  110. hEtaAccept = new TH1F("hEtaAccept", "accepted tracks;#eta;#", 200, -2., 2.);
  111. hMassSqrVsPt = new TH2F("hMassSqrVsPt", ";p_{t}Q (GeV/c);m^{2} (GeV/c^{2})",
  112. 400, -2., 2.,
  113. 1000, -0.1, 1.5);
  114. hDedxVsPt = new TH2F("hDedxVsPt", ";p_{t}Q (GeV/c);dE/dx (keV/cm)",
  115. 400, -2., 2.,
  116. 400, 0., 20.);
  117. hInvBetaExpVsPt = new TH2F("hInvBetaExpVsPt", ";p_{t}Q (GeV/c);1/beta_{exp}",
  118. 400, -2., 2.,
  119. 200, 0., 2.);
  120. hInvBetaThVsPt = new TH2F("hInvBetaThVsPt", ";p_{t}Q (GeV/c);1/beta_{exp}",
  121. 400, -2., 2.,
  122. 200, 0., 2.);
  123. hTOF = new TH1F("hTOF", "time of flight;t ns;#", 100, 0., 50.);
  124. // Pion PID
  125. hNSigmaPionPion = new TH1F("hNSigmaPionPion", "#pi;n#sigma(#pi^{#pm});#",
  126. 100, -5., 5.);
  127. hNSigmaPionKaon = new TH1F("hNSigmaPionKaon", "#pi;n#sigma(#K^{#pm});#",
  128. 100, -5., 5.);
  129. hNSigmaPionProton = new TH1F("hNSigmaPionProton", "#pi;n#sigma(p);#",
  130. 100, -5., 5.);
  131. hNSigmaPionPionVsPt = new TH2F("hNSigmaPionPionVsPt",
  132. "#pi;p_{t}Q (GeV/c);n#sigma(#pi^{#pm})",
  133. 400, -2., 2.,
  134. 1000, -5., 5.);
  135. hNSigmaPionKaonVsPt = new TH2F("hNSigmaPionKaonVsPt",
  136. "#pi;p_{t}Q (GeV/c);n#sigma(K^{#pm})",
  137. 400, -2., 2.,
  138. 1000, -5., 5.);
  139. hNSigmaPionProtonVsPt = new TH2F("hNSigmaPionProtonVsPt",
  140. "#pi;p_{t}Q (GeV/c);n#sigma(p)",
  141. 400, -2., 2.,
  142. 1000, -5., 5.);
  143. hDMassSqrVsPtPionTPC = new TH2F("hDMassSqrVsPtPionTPC",
  144. "TPC PID;p_{t} (GeV/c);dM(#pi^{#pm}) (GeV/c^{2})",
  145. 400, -2., 2.,
  146. 500, -.5, .5);
  147. hDMassSqrVsPtPionTOF = new TH2F("hDMassSqrVsPtPionTOF",
  148. "TOF PID;p_{t} (GeV/c);dM(#pi^{#pm}) (GeV/c^{2})",
  149. 400, -2., 2.,
  150. 500, -.5, .5);
  151. hInvBetaExpThPionTNT = new TH2F("hInvBetaExpThPionTNT", "TPC and TOF #pi^{#pm} PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  152. 400, -2., 2.,
  153. 500, -0.5, 0.5);
  154. hInvBetaExpThPionTPC = new TH2F("hInvBetaExpThPionTPC", "only TPC #pi^{#pm} PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  155. 400, -2., 2.,
  156. 500, -0.5, 0.5);
  157. hInvBetaExpThPionTOF = new TH2F("hInvBetaExpThPionTOF", "only TOF #pi^{#pm} PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  158. 400, -2., 2.,
  159. 500, -0.5, 0.5);
  160. hInvBetaExpThPionTTT = new TH2F("hInvBetaExpThPionTTT",
  161. Form("if p #leq %.2f then TPC, else TOF #pi^{#pm} PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  162. mTTTPThreshold),
  163. 400, -2., 2.,
  164. 500, -0.5, 0.5);
  165. hInvBetaExpThPionINT = new TH2F("hInvBetaExpThPionINT",
  166. "#pi^{#pm};p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  167. 400, -2., 2.,
  168. 500, -5., 5.);
  169. // Kaon PID
  170. hNSigmaKaonPion = new TH1F("hNSigmaKaonPion", "K;n#sigma(#pi^{#pm}};#",
  171. 100, -5., 5.);
  172. hNSigmaKaonKaon = new TH1F("hNSigmaKaonKaon", "K;n#sigma(#K^{#pm}};#",
  173. 100, -5., 5.);
  174. hNSigmaKaonProton = new TH1F("hNSigmaKaonProton", "K;n#sigma(p);#",
  175. 100, -5., 5.);
  176. hNSigmaKaonPionVsPt = new TH2F("hNSigmaKaonPionVsPt",
  177. "K;p_{t}Q (GeV/c);n#sigma(#pi^{#pm})",
  178. 400, -2., 2.,
  179. 1000, -5., 5.);
  180. hNSigmaKaonKaonVsPt = new TH2F("hNSigmaKaonKaonVsPt",
  181. "K;p_{t}Q (GeV/c);n#sigma(K^{#pm})",
  182. 400, -2., 2.,
  183. 1000, -5., 5.);
  184. hNSigmaKaonProtonVsPt = new TH2F("hNSigmaKaonProtonVsPt",
  185. "K;p_{t}Q (GeV/c);n#sigma(p)",
  186. 400, -2., 2.,
  187. 1000, -5., 5.);
  188. hDMassSqrVsPtKaonTPC = new TH2F("hDMassSqrVsPtKaonTPC",
  189. "TPC PID;p_{t} (GeV/c);dM(K^{#pm}) (GeV/c^{2})",
  190. 400, -2., 2.,
  191. 500, -.5, .5);
  192. hDMassSqrVsPtKaonTOF = new TH2F("hDMassSqrVsPtKaonTOF",
  193. "TOF PID;p_{t} (GeV/c);dM(K^{#pm}) (GeV/c^{2})",
  194. 400, -2., 2.,
  195. 500, -.5, .5);
  196. hInvBetaExpThKaonTNT = new TH2F("hInvBetaExpThKaonTNT", "TPC and TOF K^{#pm} PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  197. 400, -2., 2.,
  198. 500, -0.5, 0.5);
  199. hInvBetaExpThKaonTPC = new TH2F("hInvBetaExpThKaonTPC", "only TPC K^{#pm} PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  200. 400, -2., 2.,
  201. 500, -0.5, 0.5);
  202. hInvBetaExpThKaonTOF = new TH2F("hInvBetaExpThKaonTOF", "only TOF K^{#pm} PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  203. 400, -2., 2.,
  204. 500, -0.5, 0.5);
  205. hInvBetaExpThKaonTTT = new TH2F("hInvBetaExpThKaonTTT",
  206. Form("if p #leq %.2f then TPC, else TOF K^{#pm} PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  207. mTTTPThreshold),
  208. 400, -2., 2.,
  209. 500, -0.5, 0.5);
  210. hInvBetaExpThKaonINT = new TH2F("hInvBetaExpThKaonINT",
  211. "K^{#pm};p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  212. 400, -2., 2.,
  213. 500, -5., 5.);
  214. // Proton PID
  215. hNSigmaProtonPion = new TH1F("hNSigmaProtonPion", "p;n#sigma(#pi^{#pm}};#",
  216. 100, -5., 5.);
  217. hNSigmaProtonKaon = new TH1F("hNSigmaProtonKaon", "p;n#sigma(#K^{#pm}};#",
  218. 100, -5., 5.);
  219. hNSigmaProtonProton = new TH1F("hNSigmaProtonProton", "p;n#sigma(p);#",
  220. 100, -5., 5.);
  221. hNSigmaProtonPionVsPt = new TH2F("hNSigmaProtonPionVsPt",
  222. "p;p_{t}Q (GeV/c);n#sigma(#pi^{#pm})",
  223. 400, -2., 2.,
  224. 1000, -5., 5.);
  225. hNSigmaProtonKaonVsPt = new TH2F("hNSigmaProtonKaonVsPt",
  226. "p;p_{t}Q (GeV/c);n#sigma(K^{#pm})",
  227. 400, -2., 2.,
  228. 1000, -5., 5.);
  229. hNSigmaProtonProtonVsPt = new TH2F("hNSigmaProtonProtonVsPt",
  230. "p;p_{t}Q (GeV/c);n#sigma(p)",
  231. 400, -2., 2.,
  232. 1000, -5., 5.);
  233. hDMassSqrVsPtProtonTPC = new TH2F("hDMassSqrVsPtProtonTPC",
  234. "TPC PID;p_{t} (GeV/c);dM(p) (GeV/c^{2})",
  235. 400, -2., 2.,
  236. 500, -.5, .5);
  237. hDMassSqrVsPtProtonTOF = new TH2F("hDMassSqrVsPtProtonTOF",
  238. "TOF PID;p_{t} (GeV/c);dM(p) (GeV/c^{2})",
  239. 400, -2., 2.,
  240. 500, -.5, .5);
  241. hInvBetaExpThProtonTNT = new TH2F("hInvBetaExpThProtonTNT", "TPC and TOF p PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  242. 400, -2., 2.,
  243. 500, -0.5, 0.5);
  244. hInvBetaExpThProtonTPC = new TH2F("hInvBetaExpThProtonTPC", "only TPC p PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  245. 400, -2., 2.,
  246. 500, -0.5, 0.5);
  247. hInvBetaExpThProtonTOF = new TH2F("hInvBetaExpThProtonTOF", "only TOF p PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  248. 400, -2., 2.,
  249. 500, -0.5, 0.5);
  250. hInvBetaExpThProtonTTT = new TH2F("hInvBetaExpThProtonTTT",
  251. Form("if p #leq %.2f then TPC, else TOF p PID;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  252. mTTTPThreshold),
  253. 400, -2., 2.,
  254. 500, -0.5, 0.5);
  255. hInvBetaExpThProtonINT = new TH2F("hInvBetaExpThProtonINT",
  256. "p;p_{t}Q (GeV/c);1/beta_{exp} - 1/beta_{th}",
  257. 400, -2., 2.,
  258. 500, -5., 5.);
  259. //
  260. // Any charge
  261. //
  262. hRefMult = new TH1F("hRefMult", ";RefMult;#", 100, 0., 1000.);
  263. hRefMultAccept = new TH1F("hRefMultAccept", ";RefMultAccept;#", 100, 0., 1000.);
  264. std::cout << "StMuDstMinvMaker::Init - Initialization has been finished"
  265. << std::endl;
  266. return StMaker::Init();
  267. }
  268. //________________
  269. void StMuDstMinvMaker::Clear(Option_t *option) {
  270. StMaker::Clear();
  271. }
  272. //________________
  273. Int_t StMuDstMinvMaker::Make() {
  274. mNEventsIn++;
  275. mMuDst = NULL;
  276. mMuEvent = NULL;
  277. //MuDstMaker initialization
  278. mMuDstMaker = (StMuDstMaker*)GetMaker("MuDst");
  279. if(!mMuDstMaker) {
  280. LOG_ERROR << "StMuDstMinvMaker::Make [ERROR] - Cannot find StMuDstMaker"
  281. << std::endl;
  282. return kStOk;
  283. }
  284. //Obtaining MuDst
  285. mMuDst = (StMuDst*)GetInputDS("MuDst");
  286. if(!mMuDst) {
  287. gMessMgr->Warning() << "StMuDstMinvMaker::Make [WARNING] - No MuDst has been found"
  288. << endm;
  289. return kStOk;
  290. }
  291. //Obtaining MuEvent
  292. mMuEvent = (StMuEvent*)mMuDst->event();
  293. if(!AcceptTrigger(mMuEvent)) { //If trigger is not found
  294. return kStOk;
  295. }
  296. //Multiplicity cannot be negative
  297. unsigned short refMult = mMuEvent->refMult();
  298. unsigned short refMultPos = 0;
  299. unsigned short refMultNeg = 0;
  300. if(refMult < 0) {
  301. return kStOk;
  302. }
  303. hRefMult->Fill(refMult);
  304. int mNVertices = mMuDst->numberOfPrimaryVertices();
  305. int mNPrimTracks = mMuDst->numberOfPrimaryTracks();
  306. int mNGlobTracks = mMuDst->numberOfGlobalTracks();
  307. //Some initializations of local variables
  308. mPrimVertex = NULL;
  309. StThreeVectorF mVertPosition;
  310. Float_t mVpdVz = 0.;
  311. Int_t mPrimVertIndex = -999;
  312. Float_t mRanking = -999.;
  313. //Clean index vectors
  314. CleanVariables();
  315. //Vertex loop
  316. unsigned short refMultAccept = 0;
  317. unsigned short tofRefMult = 0;
  318. unsigned short refMultAcceptPos = 0;
  319. unsigned short refMultAcceptNeg = 0;
  320. for(Int_t iVert=0; iVert<mNVertices; iVert++) {
  321. mEventIsGood = false;
  322. hNPrimVtx->Fill(mNVertices);
  323. if(iVert!=0) continue; // Not first primary vertex does not contain tracks with fast detectors (TOF)
  324. mPrimVertex = mMuDst->primaryVertex(iVert);
  325. //Positive ranking only
  326. if(mPrimVertex->ranking() <= 0) continue;
  327. //Not (0,0,0) position of the primary vertex
  328. if(mPrimVertex->position().x() == 0 &&
  329. mPrimVertex->position().y() == 0 &&
  330. mPrimVertex->position().z() == 0) continue;
  331. //Reasonable amount of tracks
  332. if(mNPrimTracks < 0 || mNPrimTracks > 10000) continue;
  333. mPrimVertIndex = iVert;
  334. mRanking = mPrimVertex->ranking();
  335. mVertPosition = mPrimVertex->position();
  336. mVpdVz = mMuDst->btofHeader()->vpdVz();
  337. if( !AcceptPrimVtx(mVertPosition, mVpdVz) ) continue;
  338. mEventIsGood = true;
  339. hNPrimTr->Fill(mNPrimTracks);
  340. hNGlobTr->Fill(mNGlobTracks);
  341. //
  342. //Loop over primary tracks
  343. //
  344. for(int iTrk = 0; iTrk < mNPrimTracks; iTrk++) {
  345. mPrimTrack = mMuDst->primaryTracks(iTrk);
  346. mGlobTrack = mMuDst->globalTracks(mPrimTrack->index2Global());
  347. short charge = mPrimTrack->charge() > 0 ? 1 : -1;
  348. float eta = mPrimTrack->eta();
  349. float pt = mPrimTrack->pt();
  350. float p = mPrimTrack->p().mag();
  351. float p2 = mPrimTrack->p().mag2();
  352. float px = mPrimTrack->p().x();
  353. float py = mPrimTrack->p().y();
  354. float pz = mPrimTrack->p().z();
  355. charge > 0 ? refMultPos++ : refMultNeg++;
  356. hP->Fill(p);
  357. hPt->Fill(pt);
  358. hPx->Fill(px);
  359. hPy->Fill(py);
  360. hPz->Fill(pz);
  361. hEta->Fill(eta);
  362. if( !AcceptTrack(mPrimTrack, iVert) ) continue;
  363. hPAccept->Fill(p);
  364. hPtAccept->Fill(pt);
  365. hPxAccept->Fill(px);
  366. hPyAccept->Fill(py);
  367. hPzAccept->Fill(pz);
  368. hEtaAccept->Fill(eta);
  369. refMultAccept++;
  370. charge > 0 ? refMultAcceptPos++ : refMultAcceptNeg++;
  371. float nSigmaPion = mPrimTrack->nSigmaPion();
  372. float nSigmaKaon = mPrimTrack->nSigmaKaon();
  373. float nSigmaProton = mPrimTrack->nSigmaProton();
  374. float dedx = mPrimTrack->dEdx();
  375. bool tofTrack = IsTofTrack(mGlobTrack);
  376. float betaExp;
  377. float massSqr;
  378. bool pionTPC = ((nSigmaPion >= mPionPionNSigma[0] || nSigmaPion <= mPionPionNSigma[1]) &&
  379. (nSigmaKaon < mPionKaonNSigma[0] || nSigmaKaon > mPionKaonNSigma[1]) &&
  380. (nSigmaProton < mPionProtonNSigma[0] || nSigmaProton > mPionProtonNSigma[1]));
  381. bool kaonTPC = ((nSigmaPion < mKaonPionNSigma[0] || nSigmaPion > mKaonPionNSigma[1]) &&
  382. (nSigmaKaon >= mKaonKaonNSigma[0] || nSigmaKaon <= mKaonKaonNSigma[1]) &&
  383. (nSigmaProton < mKaonProtonNSigma[0] || nSigmaProton > mKaonProtonNSigma[1]));
  384. bool protonTPC = ((nSigmaPion < mProtonPionNSigma[0] || nSigmaPion > mProtonPionNSigma[1]) &&
  385. (nSigmaKaon < mProtonKaonNSigma[0] || nSigmaKaon > mProtonKaonNSigma[1]) &&
  386. (nSigmaProton >= mProtonProtonNSigma[0] || nSigmaProton <= mProtonProtonNSigma[1]));
  387. bool pionTOF = false;
  388. bool kaonTOF = false;
  389. bool protonTOF = false;
  390. //
  391. // Pion TPC
  392. //
  393. if (pionTPC) {
  394. hNSigmaPionPion->Fill(nSigmaPion);
  395. hNSigmaPionKaon->Fill(nSigmaKaon);
  396. hNSigmaPionProton->Fill(nSigmaProton);
  397. hNSigmaPionPionVsPt->Fill(pt*charge, nSigmaPion);
  398. hNSigmaPionKaonVsPt->Fill(pt*charge, nSigmaKaon);
  399. hNSigmaPionProtonVsPt->Fill(pt*charge, nSigmaProton);
  400. }
  401. //
  402. // Kaon TPC
  403. //
  404. if (kaonTPC) {
  405. hNSigmaKaonPion->Fill(nSigmaPion);
  406. hNSigmaKaonKaon->Fill(nSigmaKaon);
  407. hNSigmaKaonProton->Fill(nSigmaProton);
  408. hNSigmaKaonPionVsPt->Fill(pt*charge, nSigmaPion);
  409. hNSigmaKaonKaonVsPt->Fill(pt*charge, nSigmaKaon);
  410. hNSigmaKaonProtonVsPt->Fill(pt*charge, nSigmaProton);
  411. }
  412. //
  413. // Proton TPC
  414. //
  415. if (protonTPC) {
  416. hNSigmaProtonPion->Fill(nSigmaPion);
  417. hNSigmaProtonKaon->Fill(nSigmaKaon);
  418. hNSigmaProtonProton->Fill(nSigmaProton);
  419. hNSigmaProtonPionVsPt->Fill(pt*charge, nSigmaPion);
  420. hNSigmaProtonKaonVsPt->Fill(pt*charge, nSigmaKaon);
  421. hNSigmaProtonProtonVsPt->Fill(pt*charge, nSigmaProton);
  422. }
  423. hDedxVsPt->Fill(pt*charge, dedx*1e6);
  424. if (tofTrack) {
  425. hTOF->Fill(mGlobTrack->btofPidTraits().timeOfFlight());
  426. float betaThPion = sqrt(p2/(PION_MASS*PION_MASS + p2));
  427. float betaThKaon = sqrt(p2/(KAON_MASS*KAON_MASS + p2));
  428. float betaThProton = sqrt(p2/(PROTON_MASS*PROTON_MASS + p2));
  429. tofRefMult++;
  430. betaExp = mGlobTrack->btofPidTraits().beta();
  431. massSqr = p2*(1./(betaExp*betaExp) - 1.);
  432. hMassSqrVsPt->Fill(pt*charge, massSqr);
  433. pionTOF = massSqr >= mPionMass[0] && massSqr <= mPionMass[1];
  434. kaonTOF = massSqr >= mKaonMass[0] && massSqr <= mKaonMass[1];
  435. protonTOF = massSqr >= mProtonMass[0] && massSqr <= mProtonMass[1];
  436. float dMpion = massSqr - PION_MASS*PION_MASS;
  437. float dMkaon = massSqr - KAON_MASS*KAON_MASS;
  438. float dMproton = massSqr - PROTON_MASS*PROTON_MASS;
  439. hInvBetaExpVsPt->Fill(pt*charge, 1./betaExp);
  440. //
  441. // TPC PID
  442. //
  443. if (pionTPC) {
  444. hInvBetaExpThPionTPC->Fill(pt*charge, 1./betaExp - 1./betaThPion);
  445. hDMassSqrVsPtPionTPC->Fill(pt*charge, dMpion);
  446. }
  447. else if (kaonTPC) {
  448. hInvBetaExpThKaonTPC->Fill(pt*charge, 1./betaExp - 1./betaThKaon);
  449. hDMassSqrVsPtKaonTPC->Fill(pt, dMkaon);
  450. }
  451. else if (protonTPC) {
  452. hInvBetaExpThProtonTPC->Fill(pt*charge, 1./betaExp - 1./betaThProton);
  453. hDMassSqrVsPtProtonTPC->Fill(pt, dMproton);
  454. }
  455. //
  456. // TOF PID
  457. //
  458. if (pionTOF) {
  459. hInvBetaExpThPionTOF->Fill(pt*charge, 1./betaExp - 1./betaThPion);
  460. hDMassSqrVsPtPionTOF->Fill(pt, dMpion);
  461. hInvBetaThVsPt->Fill(pt*charge, 1./betaThPion);
  462. hInvBetaExpThPionINT->Fill(pt*charge, 1./betaExp - 1./betaThPion);
  463. hInvBetaExpThPionINT->Fill(pt*charge, 1./betaExp - 1./betaThKaon);
  464. hInvBetaExpThPionINT->Fill(pt*charge, 1./betaExp - 1./betaThProton);
  465. }
  466. else if (kaonTOF) {
  467. hInvBetaExpThKaonTOF->Fill(pt*charge, 1./betaExp - 1./betaThKaon);
  468. hDMassSqrVsPtKaonTOF->Fill(pt, dMkaon);
  469. hInvBetaThVsPt->Fill(pt*charge, 1./betaThKaon);
  470. hInvBetaExpThKaonINT->Fill(pt*charge, 1./betaExp - 1./betaThPion);
  471. hInvBetaExpThKaonINT->Fill(pt*charge, 1./betaExp - 1./betaThKaon);
  472. hInvBetaExpThKaonINT->Fill(pt*charge, 1./betaExp - 1./betaThProton);
  473. }
  474. else if (protonTOF) {
  475. hInvBetaExpThProtonTOF->Fill(pt*charge, 1./betaExp - 1./betaThProton);
  476. hDMassSqrVsPtProtonTOF->Fill(pt, dMproton);
  477. hInvBetaThVsPt->Fill(pt*charge, 1./betaThProton);
  478. hInvBetaExpThProtonINT->Fill(pt*charge, 1./betaExp - 1./betaThPion);
  479. hInvBetaExpThProtonINT->Fill(pt*charge, 1./betaExp - 1./betaThKaon);
  480. hInvBetaExpThProtonINT->Fill(pt*charge, 1./betaExp - 1./betaThProton);
  481. }
  482. //
  483. // TNT PID
  484. //
  485. if (pionTOF && pionTPC) {
  486. hInvBetaExpThPionTNT->Fill(pt*charge, 1./betaExp - 1./betaThPion);
  487. }
  488. else if (kaonTOF && kaonTPC) {
  489. hInvBetaExpThKaonTNT->Fill(pt*charge, 1./betaExp - 1./betaThKaon);
  490. }
  491. else if (protonTOF && protonTPC) {
  492. hInvBetaExpThProtonTNT->Fill(pt*charge, 1./betaExp - 1./betaThProton);
  493. }
  494. //
  495. // TTT PID
  496. //
  497. if (p >= mTTTPThreshold) {
  498. if (pionTOF) {
  499. hInvBetaExpThPionTTT->Fill(pt*charge, 1./betaExp - 1./betaThPion);
  500. }
  501. else if (kaonTOF) {
  502. hInvBetaExpThKaonTTT->Fill(pt*charge, 1./betaExp - 1./betaThKaon);
  503. }
  504. else if (protonTOF) {
  505. hInvBetaExpThProtonTTT->Fill(pt*charge, 1./betaExp - 1./betaThProton);
  506. }
  507. } else {
  508. if (pionTPC) {
  509. hInvBetaExpThPionTTT->Fill(pt*charge, 1./betaExp - 1./betaThPion);
  510. }
  511. else if (kaonTPC) {
  512. hInvBetaExpThKaonTTT->Fill(pt*charge, 1./betaExp - 1./betaThKaon);
  513. }
  514. else if (protonTPC) {
  515. hInvBetaExpThProtonTTT->Fill(pt*charge, 1./betaExp - 1./betaThProton);
  516. }
  517. }
  518. }
  519. } //for(Int_t iTrk=0; iTrk<mNPrimTracks; iTrk++)
  520. } //for(Int_t iVert=0; iVert<mNVertices; iVert++)
  521. if (mEventIsGood) {
  522. hRefMultAccept->Fill(refMultAccept);
  523. hTofRefMult->Fill(tofRefMult);
  524. hTofRefMultVsRefMult->Fill(tofRefMult, refMultAccept);
  525. }
  526. return kStOk;
  527. }
  528. //_________________
  529. Bool_t StMuDstMinvMaker::AcceptTrigger(StMuEvent *muEvent) {
  530. Bool_t mIsGoodTrigger = false;
  531. if(mTriggerIdCollection.empty()) {
  532. mIsGoodTrigger = true;
  533. }
  534. else {
  535. for(UInt_t iTrg=0; iTrg<mTriggerIdCollection.size(); iTrg++) {
  536. if(muEvent->triggerIdCollection().nominal().isTrigger(mTriggerIdCollection.at(iTrg))) {
  537. mIsGoodTrigger = true;
  538. mCurrentTrigger = mTriggerIdCollection.at(iTrg);
  539. break;
  540. }
  541. } //for(UInt_t iTrg=0; iTrg<mTriggerIdCollection.size(); iTrg++)
  542. }
  543. return mIsGoodTrigger;
  544. }
  545. //_________________
  546. Bool_t StMuDstMinvMaker::AcceptPrimVtx(StThreeVectorF vtxPos,
  547. Float_t vpdVz) {
  548. Float_t mVtxX = vtxPos.x() - mPrimVtxXShift;
  549. Float_t mVtxY = vtxPos.y() - mPrimVtxYShift;
  550. Float_t mVtxZ = vtxPos.z();
  551. Float_t vtxR = TMath::Sqrt(mVtxX*mVtxX + mVtxY*mVtxY);
  552. Float_t vpdDiff = mVtxZ - vpdVz;
  553. hR->Fill(vtxR);
  554. hVx->Fill(mVtxX);
  555. hVy->Fill(mVtxY);
  556. hVz->Fill(mVtxZ);
  557. hVxVsVy->Fill(mVtxX, mVtxY);
  558. hVxVsVz->Fill(mVtxX, mVtxZ);
  559. hVyVsVz->Fill(mVtxY, mVtxZ);
  560. hVpd->Fill(vpdVz);
  561. hVpdVz->Fill(vpdDiff);
  562. return ( vtxPos.z() >= mPrimVtxZ[0] &&
  563. vtxPos.z() <= mPrimVtxZ[1] &&
  564. vtxR >= mPrimVtxR[0] &&
  565. vtxR <= mPrimVtxR[1] &&
  566. vpdDiff >= mPrimVtxVpdVzDiff[0] &&
  567. vpdDiff <= mPrimVtxVpdVzDiff[1] );
  568. }
  569. //_________________
  570. Bool_t StMuDstMinvMaker::AcceptTrack(StMuTrack *trk, UShort_t vtxInd) {
  571. float mom = trk->momentum().mag();
  572. float eta = trk->eta();
  573. unsigned short nHitsFit = trk->nHitsFit();
  574. float ratioH = (float)trk->nHitsFit()/(float)trk->nHitsPoss();
  575. short flag = trk->flag();
  576. float dca = trk->dcaGlobal(vtxInd).perp();
  577. bool isMomOk = ( mom >= mTrackP[0] &&
  578. mom <= mTrackP[1] );
  579. bool isEtaOk = ( eta >= mTrackEta[0] &&
  580. eta <= mTrackEta[1] );
  581. bool isNHitsFitOk = ( nHitsFit >= mTrackNHitsFit[0] &&
  582. nHitsFit <= mTrackNHitsFit[1] &&
  583. ratioH >= 0.51 );
  584. bool isFlagOk = ( flag >= mTrackFlag[0] &&
  585. flag <= mTrackFlag[1] );
  586. // bool isDcaOk = ( dca >= mTrackDcaGlobal[0] &&
  587. // dca <= mTrackDcaGlobal[1] );
  588. return ( isMomOk && isEtaOk && isNHitsFitOk && isFlagOk );
  589. }
  590. //_________________
  591. Int_t StMuDstMinvMaker::Finish() {
  592. std::cout << "*************************************" << std::endl
  593. << "StMuDstMinvMaker has been finished" << std::endl
  594. << "\t nEventsPassed : " << mNEventsPassed << std::endl
  595. << "\t nEventsProcessed: " << mNEventsIn << std::endl
  596. << "*************************************" << std::endl;
  597. mOutFile->cd();
  598. mOutFile->Write();
  599. mOutFile->Close();
  600. return kStOk;
  601. }
  602. //_________________
  603. void StMuDstMinvMaker::CleanVariables() {
  604. mEventIsGood = false;
  605. }
  606. //_________________
  607. void StMuDstMinvMaker::SetTriggerId(unsigned int id) {
  608. mTriggerIdCollection.push_back(id);
  609. }
  610. //_________________
  611. void StMuDstMinvMaker::SetMuDstMaker(StMuDstMaker *maker) {
  612. mMuDstMaker = maker;
  613. }
  614. //_________________
  615. void StMuDstMinvMaker::SetVtxZCut(float lo, float hi) {
  616. mPrimVtxZ[0] = lo;
  617. mPrimVtxZ[1] = hi;
  618. }
  619. //_________________
  620. void StMuDstMinvMaker::SetVtxRCut(float lo, float hi) {
  621. mPrimVtxR[0] = lo;
  622. mPrimVtxR[1] = hi;
  623. }
  624. //_________________
  625. void StMuDstMinvMaker::SetVtxShift(float xShift, float yShift) {
  626. mPrimVtxXShift = xShift;
  627. mPrimVtxYShift = yShift;
  628. }
  629. //_________________
  630. void StMuDstMinvMaker::SetVtxVpdVzDiffCut(float lo, float hi) {
  631. mPrimVtxVpdVzDiff[0] = lo;
  632. mPrimVtxVpdVzDiff[1] = hi;
  633. }
  634. //_________________
  635. void StMuDstMinvMaker::SetP(float lo, float hi) {
  636. mTrackP[0] = lo;
  637. mTrackP[1] = hi;
  638. }
  639. //_________________
  640. void StMuDstMinvMaker::SetPt(float lo, float hi) {
  641. mTrackPt[0] = lo;
  642. mTrackPt[1] = hi;
  643. }
  644. //_________________
  645. void StMuDstMinvMaker::SetTrackNHits(int lo, int hi) {
  646. mTrackNHits[0] = lo;
  647. mTrackNHits[1] = hi;
  648. }
  649. //_________________
  650. void StMuDstMinvMaker::SetTrackNHitsFit(int lo, int hi) {
  651. mTrackNHitsFit[0] = lo;
  652. mTrackNHitsFit[1] = hi;
  653. }
  654. //_________________
  655. void StMuDstMinvMaker::SetTrackEta(float lo, float hi) {
  656. mTrackEta[0] = lo;
  657. mTrackEta[1] = hi;
  658. }
  659. //_________________
  660. void StMuDstMinvMaker::SetTrackFlag(short lo, short hi) {
  661. mTrackFlag[0] = lo;
  662. mTrackFlag[1] = hi;
  663. }
  664. //_________________
  665. void StMuDstMinvMaker::SetTrackDCA(float lo, float hi) {
  666. mTrackDcaGlobal[0] = lo;
  667. mTrackDcaGlobal[1] = hi;
  668. }
  669. //_________________
  670. Bool_t StMuDstMinvMaker::IsTofTrack(StMuTrack *trk) { //Only for globals
  671. Bool_t isTofHit = false;
  672. if(trk->btofPidTraits().beta() > 0 &&
  673. trk->btofPidTraits().timeOfFlight() > 0) {
  674. isTofHit = true;
  675. }
  676. return isTofHit;
  677. }
  678. //_________________
  679. void StMuDstMinvMaker::SetPionPionNSigma(float lo, float hi) {
  680. mPionPionNSigma[0] = lo; mPionPionNSigma[1] = hi;
  681. }
  682. //_________________
  683. void StMuDstMinvMaker::SetPionKaonNSigma(float lo, float hi) {
  684. mPionKaonNSigma[0] = lo; mPionKaonNSigma[1] = hi;
  685. }
  686. //_________________
  687. void StMuDstMinvMaker::SetPionProtonNSigma(float lo, float hi) {
  688. mPionProtonNSigma[0] = lo; mPionProtonNSigma[1] = hi;
  689. }
  690. //_________________
  691. void StMuDstMinvMaker::SetKaonPionNSigma(float lo, float hi) {
  692. mKaonPionNSigma[0] = lo; mKaonPionNSigma[1] = hi;
  693. }
  694. //_________________
  695. void StMuDstMinvMaker::SetKaonKaonNSigma(float lo, float hi) {
  696. mKaonKaonNSigma[0] = lo; mKaonKaonNSigma[1] = hi;
  697. }
  698. //_________________
  699. void StMuDstMinvMaker::SetKaonProtonNSigma(float lo, float hi) {
  700. mKaonProtonNSigma[0] = lo; mKaonProtonNSigma[1] = hi;
  701. }
  702. //_________________
  703. void StMuDstMinvMaker::SetProtonPionNSigma(float lo, float hi) {
  704. mProtonPionNSigma[0] = lo; mProtonPionNSigma[1] = hi;
  705. }
  706. //_________________
  707. void StMuDstMinvMaker::SetProtonKaonNSigma(float lo, float hi) {
  708. mProtonKaonNSigma[0] = lo; mProtonKaonNSigma[1] = hi;
  709. }
  710. //_________________
  711. void StMuDstMinvMaker::SetProtonProtonNSigma(float lo, float hi) {
  712. mProtonProtonNSigma[0] = lo; mProtonProtonNSigma[1] = hi;
  713. }
  714. //_________________
  715. void StMuDstMinvMaker::SetPionMassSqr(float lo, float hi) {
  716. mPionMass[0] = lo; mPionMass[1] = hi;
  717. }
  718. //_________________
  719. void StMuDstMinvMaker::SetKaonMassSqr(float lo, float hi) {
  720. mKaonMass[0] = lo; mKaonMass[1] = hi;
  721. }
  722. //_________________
  723. void StMuDstMinvMaker::SetProtonMassSqr(float lo, float hi) {
  724. mProtonMass[0] = lo; mProtonMass[1] = hi;
  725. }
  726. //_________________
  727. void StMuDstMinvMaker::SetTTTPThreshold(float pThresh) {
  728. mTTTPThreshold = pThresh;
  729. }