MpdFemtoFxtTrackCutMonitor.cxx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. //
  2. // Track cut monitor for basic analysis
  3. //
  4. // MpdFemtoMaker headers
  5. #include "MpdFemtoTrack.h"
  6. #include "phys_constants.h"
  7. // MpdFemtoMakerUser headers
  8. #include "MpdFemtoFxtTrackCutMonitor.h"
  9. // C++ headers
  10. #include <cstdio>
  11. #include <string>
  12. // ROOT headers
  13. #include "TMath.h"
  14. ClassImp(MpdFemtoFxtTrackCutMonitor)
  15. //_________________
  16. MpdFemtoFxtTrackCutMonitor::MpdFemtoFxtTrackCutMonitor(const char* name,
  17. const double ParticleMass) :
  18. MpdFemtoBaseCutMonitor(),
  19. mDCAGlobal(nullptr),
  20. mNhits(nullptr),
  21. mP(nullptr),
  22. mPt(nullptr),
  23. mPtVsNsigmaPion(nullptr),
  24. mPtVsNsigmaKaon(nullptr),
  25. mPtVsNsigmaProton(nullptr),
  26. mPvsDedx(nullptr),
  27. mRapidity(nullptr),
  28. mPseudoRapidity(nullptr),
  29. mPvsMassSqr(nullptr),
  30. mPvsInvBeta(nullptr),
  31. mPtVsEta(nullptr),
  32. mInvBetaDiffPionVsP(nullptr),
  33. mInvBetaDiffKaonVsP(nullptr),
  34. mInvBetaDiffProtonVsP(nullptr),
  35. monMass(ParticleMass) {
  36. // Constructor
  37. string s("MpdFemtoFxtTrackCutMonitor");
  38. string n(name);
  39. mDCAGlobal = new TH1F((s + n + "mDCAGlobal").c_str(),
  40. "DCA Global; DCA Global (cm)",
  41. 100, 0., 5.);
  42. mNhits = new TH1F((s + n + "mNhits").c_str(), "nHits;nHits",
  43. 80, -0.5, 79.5);
  44. mP = new TH1F((s + n + "mP").c_str(), "Momentum;p (GeV/c);Entries",
  45. 76, 0., 1.9);
  46. mPt = new TH1F((s + n + "mPt").c_str(), "Transverse momentum;p_{T} (GeV/c);Entries",
  47. 76, 0., 1.9);
  48. mPtVsNsigmaPion = new TH2F((s + n + "mPtVsNsigmaPion").c_str(),
  49. "n#sigma(#pi) vs. p_{T};p_{T} (GeV/c);n#sigma(#pi)",
  50. 76, 0., 1.9, 100, -10., 10.);
  51. mPtVsNsigmaKaon = new TH2F((s + n + "mPtVsNsigmaKaon").c_str(),
  52. "n#sigma(K) vs. p_{T};p_{T} (GeV/c);n#sigma(K)",
  53. 76, 0., 1.9, 100, -10., 10.);
  54. mPtVsNsigmaProton = new TH2F((s + n + "mPtVsNsigmaProton").c_str(),
  55. "n#sigma(p) vs. p_{T};p_{T} (GeV/c);n#sigma(p)",
  56. 76, 0., 1.9, 100, -10., 10.);
  57. mPvsDedx = new TH2F((s + n + "mPvsDedx").c_str(),
  58. "dE/dx vs. momentum;p (GeV/c);dE/dx (keV/cm)",
  59. 76, 0.0, 1.9, 100, 0., 10.);
  60. mRapidity = new TH1F((s + n + "mRapidity").c_str(), "Rapidity;y;Entries",
  61. 56, -1.2, 1.2);
  62. mPseudoRapidity = new TH1F((s + n + "mPseudoRapidity").c_str(), "Pseudorapidity;#eta;Entries",
  63. 56, -1.2, 1.2);
  64. mPvsMassSqr = new TH2F((s + n + "mPvsMassSqr").c_str(),
  65. "m^{2} vs. p_{T};p_{T} (GeV/c);m^{2} (GeV/c^{2})^{2}",
  66. 76, 0., 1.9, 120, -0.1, 1.1);
  67. mPvsInvBeta = new TH2F((s + n + "mPvsInvBeta").c_str(),
  68. "1/#beta vs. p;p (GeV/c);1/#beta",
  69. 76, 0., 1.9, 60, 0.8, 2.);
  70. mPtVsEta = new TH2F((s + n + "mPtVsEta").c_str(), "#eta vs. p_{T};#eta;p_{T} (GeV/c)",
  71. 44, -1.1, 1.1, 76, 0., 1.9);
  72. mInvBetaDiffPionVsP = new TH2F((s + n + "mInvBetaDiffPionVsP").c_str(),
  73. "1/#beta-1/#beta(#pi) vs. p;p (GeV/c);1/#beta-1/#beta(#pi)",
  74. 76, 0., 1.9, 200, -0.1, 0.1);
  75. mInvBetaDiffKaonVsP = new TH2F((s + n + "mInvBetaDiffKaonVsP").c_str(),
  76. "1/#beta-1/#beta(K) vs. p;p (GeV/c);1/#beta-1/#beta(K)",
  77. 76, 0., 1.9, 200, -0.1, 0.1);
  78. mInvBetaDiffProtonVsP = new TH2F((s + n + "mInvBetaDiffProtonVsP").c_str(),
  79. "1/#beta-1/#beta(p) vs. p;p (GeV/c);1/#beta-1/#beta(p)",
  80. 76, 0., 1.9, 200, -0.1, 0.1);
  81. }
  82. //_________________
  83. MpdFemtoFxtTrackCutMonitor::MpdFemtoFxtTrackCutMonitor(const MpdFemtoFxtTrackCutMonitor& cutMoni) :
  84. MpdFemtoBaseCutMonitor(cutMoni) {
  85. // Copy constructor
  86. if (mDCAGlobal) delete mDCAGlobal;
  87. mDCAGlobal = new TH1F(*(cutMoni.mDCAGlobal));
  88. if (mNhits) delete mNhits;
  89. mNhits = new TH1F(*(cutMoni.mNhits));
  90. if (mP) delete mP;
  91. mP = new TH1F(*(cutMoni.mP));
  92. if (mPt) delete mPt;
  93. mPt = new TH1F(*(cutMoni.mPt));
  94. if (mPtVsNsigmaPion) delete mPtVsNsigmaPion;
  95. mPtVsNsigmaPion = new TH2F(*(cutMoni.mPtVsNsigmaPion));
  96. if (mPtVsNsigmaKaon) delete mPtVsNsigmaKaon;
  97. mPtVsNsigmaKaon = new TH2F(*(cutMoni.mPtVsNsigmaKaon));
  98. if (mPtVsNsigmaProton) delete mPtVsNsigmaProton;
  99. mPtVsNsigmaProton = new TH2F(*(cutMoni.mPtVsNsigmaProton));
  100. if (mPvsDedx) delete mPvsDedx;
  101. mPvsDedx = new TH2F(*(cutMoni.mPvsDedx));
  102. if (mRapidity) delete mRapidity;
  103. mRapidity = new TH1F(*(cutMoni.mRapidity));
  104. if (mPseudoRapidity) delete mPseudoRapidity;
  105. mPseudoRapidity = new TH1F(*(cutMoni.mPseudoRapidity));
  106. if (mPvsMassSqr) delete mPvsMassSqr;
  107. mPvsMassSqr = new TH2F(*(cutMoni.mPvsMassSqr));
  108. if (mPvsInvBeta) delete mPvsInvBeta;
  109. mPvsInvBeta = new TH2F(*(cutMoni.mPvsInvBeta));
  110. if (mPtVsEta) delete mPtVsEta;
  111. mPtVsEta = new TH2F(*(cutMoni.mPtVsEta));
  112. if (mInvBetaDiffPionVsP) delete mInvBetaDiffPionVsP;
  113. mInvBetaDiffPionVsP = new TH2F(*(cutMoni.mInvBetaDiffPionVsP));
  114. if (mInvBetaDiffKaonVsP) delete mInvBetaDiffKaonVsP;
  115. mInvBetaDiffKaonVsP = new TH2F(*(cutMoni.mInvBetaDiffKaonVsP));
  116. if (mInvBetaDiffProtonVsP) delete mInvBetaDiffProtonVsP;
  117. mInvBetaDiffProtonVsP = new TH2F(*(cutMoni.mInvBetaDiffProtonVsP));
  118. monMass = cutMoni.monMass;
  119. }
  120. //_________________
  121. MpdFemtoFxtTrackCutMonitor MpdFemtoFxtTrackCutMonitor::operator=(const MpdFemtoFxtTrackCutMonitor& cutMoni) {
  122. // Assignment operator
  123. if (this != &cutMoni) {
  124. if (mDCAGlobal) delete mDCAGlobal;
  125. mDCAGlobal = new TH1F(*(cutMoni.mDCAGlobal));
  126. if (mNhits) delete mNhits;
  127. mNhits = new TH1F(*(cutMoni.mNhits));
  128. if (mP) delete mP;
  129. mP = new TH1F(*(cutMoni.mP));
  130. if (mPt) delete mPt;
  131. mPt = new TH1F(*(cutMoni.mPt));
  132. if (mPtVsNsigmaPion) delete mPtVsNsigmaPion;
  133. mPtVsNsigmaPion = new TH2F(*(cutMoni.mPtVsNsigmaPion));
  134. if (mPtVsNsigmaKaon) delete mPtVsNsigmaKaon;
  135. mPtVsNsigmaKaon = new TH2F(*(cutMoni.mPtVsNsigmaKaon));
  136. if (mPtVsNsigmaProton) delete mPtVsNsigmaProton;
  137. mPtVsNsigmaProton = new TH2F(*(cutMoni.mPtVsNsigmaProton));
  138. if (mPvsDedx) delete mPvsDedx;
  139. mPvsDedx = new TH2F(*(cutMoni.mPvsDedx));
  140. if (mRapidity) delete mRapidity;
  141. mRapidity = new TH1F(*(cutMoni.mRapidity));
  142. if (mPseudoRapidity) delete mPseudoRapidity;
  143. mPseudoRapidity = new TH1F(*(cutMoni.mPseudoRapidity));
  144. if (mPvsMassSqr) delete mPvsMassSqr;
  145. mPvsMassSqr = new TH2F(*(cutMoni.mPvsMassSqr));
  146. if (mPvsInvBeta) delete mPvsInvBeta;
  147. mPvsInvBeta = new TH2F(*(cutMoni.mPvsInvBeta));
  148. if (mPtVsEta) delete mPtVsEta;
  149. mPtVsEta = new TH2F(*(cutMoni.mPtVsEta));
  150. if (mInvBetaDiffPionVsP) delete mInvBetaDiffPionVsP;
  151. mInvBetaDiffPionVsP = new TH2F(*(cutMoni.mInvBetaDiffPionVsP));
  152. if (mInvBetaDiffKaonVsP) delete mInvBetaDiffKaonVsP;
  153. mInvBetaDiffKaonVsP = new TH2F(*(cutMoni.mInvBetaDiffKaonVsP));
  154. if (mInvBetaDiffProtonVsP) delete mInvBetaDiffProtonVsP;
  155. mInvBetaDiffProtonVsP = new TH2F(*(cutMoni.mInvBetaDiffProtonVsP));
  156. monMass = cutMoni.monMass;
  157. } // if (this != &c)
  158. return *this;
  159. }
  160. //_________________
  161. MpdFemtoFxtTrackCutMonitor::~MpdFemtoFxtTrackCutMonitor() {
  162. if (mDCAGlobal) {
  163. delete mDCAGlobal;
  164. mDCAGlobal = nullptr;
  165. }
  166. if (mNhits) {
  167. delete mNhits;
  168. mNhits = nullptr;
  169. }
  170. if (mP) {
  171. delete mP;
  172. mP = nullptr;
  173. }
  174. if (mPt) {
  175. delete mPt;
  176. mPt = nullptr;
  177. }
  178. if (mPtVsNsigmaPion) {
  179. delete mPtVsNsigmaPion;
  180. mPtVsNsigmaPion = nullptr;
  181. }
  182. if (mPtVsNsigmaKaon) {
  183. delete mPtVsNsigmaKaon;
  184. mPtVsNsigmaKaon = nullptr;
  185. }
  186. if (mPtVsNsigmaProton) {
  187. delete mPtVsNsigmaProton;
  188. mPtVsNsigmaProton = nullptr;
  189. }
  190. if (mPvsDedx) {
  191. delete mPvsDedx;
  192. mPvsDedx = nullptr;
  193. }
  194. if (mRapidity) {
  195. delete mRapidity;
  196. mRapidity = nullptr;
  197. }
  198. if (mPseudoRapidity) {
  199. delete mPseudoRapidity;
  200. mPseudoRapidity = nullptr;
  201. }
  202. if (mPvsMassSqr) {
  203. delete mPvsMassSqr;
  204. mPvsMassSqr = nullptr;
  205. }
  206. if (mPvsInvBeta) {
  207. delete mPvsInvBeta;
  208. mPvsInvBeta = nullptr;
  209. }
  210. if (mPtVsEta) {
  211. delete mPtVsEta;
  212. mPtVsEta = nullptr;
  213. }
  214. if (mInvBetaDiffPionVsP) {
  215. delete mInvBetaDiffPionVsP;
  216. mInvBetaDiffPionVsP = nullptr;
  217. }
  218. if (mInvBetaDiffKaonVsP) {
  219. delete mInvBetaDiffKaonVsP;
  220. mInvBetaDiffKaonVsP = nullptr;
  221. }
  222. if (mInvBetaDiffProtonVsP) {
  223. delete mInvBetaDiffProtonVsP;
  224. mInvBetaDiffProtonVsP = nullptr;
  225. }
  226. }
  227. //_________________
  228. void MpdFemtoFxtTrackCutMonitor::fill(const MpdFemtoTrack* track) {
  229. /*
  230. float TPhi = atan2(track->P().y(),track->P().x());
  231. if(TPhi<0.0) { TPhi += 2.*TMath::Pi(); }
  232. TPhi *= 180./TMath::Pi();
  233. */
  234. mDCAGlobal->Fill(track->gDCA().Mag());
  235. mNhits->Fill(track->nHits());
  236. mP->Fill(track->p().Mag());
  237. mPt->Fill(track->pt());
  238. mPtVsNsigmaPion->Fill(track->pt(), track->nSigmaPion());
  239. mPtVsNsigmaKaon->Fill(track->pt(), track->nSigmaKaon());
  240. mPtVsNsigmaProton->Fill(track->pt(), track->nSigmaProton());
  241. mPvsDedx->Fill(track->ptot(), track->dEdxInKeV());
  242. mPseudoRapidity->Fill(track->eta());
  243. mPvsMassSqr->Fill(track->ptot(), track->massSqr());
  244. mPvsInvBeta->Fill(track->ptot(), (1. / track->beta()));
  245. mPtVsEta->Fill(track->eta(), track->pt());
  246. mInvBetaDiffPionVsP->Fill(track->ptot(),
  247. track->invBeta() -
  248. TMath::Sqrt(M_PION_PLUS * M_PION_PLUS +
  249. track->p().Mag2()) / track->ptot());
  250. mInvBetaDiffKaonVsP->Fill(track->ptot(),
  251. track->invBeta() -
  252. TMath::Sqrt(M_KAON_PLUS * M_KAON_PLUS +
  253. track->p().Mag2()) / track->ptot());
  254. mInvBetaDiffProtonVsP->Fill(track->ptot(),
  255. track->invBeta() -
  256. TMath::Sqrt(M_PROTON * M_PROTON +
  257. track->p().Mag2()) / track->ptot());
  258. }
  259. //_________________
  260. void MpdFemtoFxtTrackCutMonitor::writeOutHistos() {
  261. // Write all histograms
  262. mDCAGlobal->Write();
  263. mNhits->Write();
  264. mP->Write();
  265. mPt->Write();
  266. mPtVsNsigmaPion->Write();
  267. mPtVsNsigmaKaon->Write();
  268. mPtVsNsigmaProton->Write();
  269. mPvsDedx->Write();
  270. mRapidity->Write();
  271. mPseudoRapidity->Write();
  272. mPvsMassSqr->Write();
  273. mPvsInvBeta->Write();
  274. mPtVsEta->Write();
  275. mInvBetaDiffPionVsP->Write();
  276. mInvBetaDiffKaonVsP->Write();
  277. mInvBetaDiffProtonVsP->Write();
  278. }
  279. //_________________
  280. TList* MpdFemtoFxtTrackCutMonitor::getOutputList() {
  281. // Prepare ouput list with histograms
  282. TList *outputList = new TList();
  283. outputList->Add(mDCAGlobal);
  284. outputList->Add(mNhits);
  285. outputList->Add(mP);
  286. outputList->Add(mPt);
  287. outputList->Add(mPtVsNsigmaPion);
  288. outputList->Add(mPvsDedx);
  289. outputList->Add(mRapidity);
  290. outputList->Add(mPseudoRapidity);
  291. outputList->Add(mPvsMassSqr);
  292. outputList->Add(mPvsInvBeta);
  293. outputList->Add(mPtVsEta);
  294. outputList->Add(mInvBetaDiffPionVsP);
  295. outputList->Add(mInvBetaDiffKaonVsP);
  296. outputList->Add(mInvBetaDiffProtonVsP);
  297. return outputList;
  298. }