MpdFemtoFxtEventCutMonitor.cxx 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. //
  2. // Event cut monitor for basic analysis
  3. //
  4. // MpdFemtoMaker headers
  5. #include "MpdFemtoEvent.h"
  6. #include "MpdFemtoTypes.h"
  7. // MpdFemtoMakerUser headers
  8. #include "MpdFemtoFxtEventCutMonitor.h"
  9. // C++ headers
  10. #include <cstdio>
  11. #include <cmath>
  12. ClassImp(MpdFemtoFxtEventCutMonitor)
  13. //_________________
  14. MpdFemtoFxtEventCutMonitor::MpdFemtoFxtEventCutMonitor() :
  15. MpdFemtoBaseCutMonitor(),
  16. mVertexZ(nullptr),
  17. mRefMult(nullptr),
  18. mVertexYvsVertexX(nullptr),
  19. mVpdVzDiff(nullptr),
  20. mBTofTrayMultVsRefMult(nullptr),
  21. mBTofMatchedVsRefMult(nullptr) {
  22. // Constructor
  23. mVertexYvsVertexX = new TH2F("VertexYvsVertexX",
  24. "VertexYvsVertexX;x (cm);y (cm)",
  25. 300, -6., 6., 300, -6., 6.);
  26. mVertexZ = new TH1F("VertexZ", "VertexZ; z (cm)",
  27. 480, -120., 120.);
  28. mRefMult = new TH1F("RefMult", "RefMult;RefMult",
  29. 600, -0.5, 599.5);
  30. mVpdVzDiff = new TH1F("VpdVzDiff", "mVpdVzDiff",
  31. 80, -20., 20.);
  32. mBTofTrayMultVsRefMult = new TH2F("mBTofTrayMultVsRefMult",
  33. "mBTofTrayMultVsRefMult;RefMult;BTof tray multiplicity",
  34. 600, -0.5, 599.5, 600, -0.5, 599.5);
  35. mBTofMatchedVsRefMult = new TH2F("mBTofMatchedVsRefMult",
  36. "mBTofMatchedVsRefMult;RefMult;BTof-matched multiplicity",
  37. 600, -0.5, 599.5, 600, -0.5, 599.5);
  38. }
  39. //_________________
  40. MpdFemtoFxtEventCutMonitor::MpdFemtoFxtEventCutMonitor(const char* title1, const char* title2) :
  41. MpdFemtoBaseCutMonitor(),
  42. mVertexZ(nullptr),
  43. mRefMult(nullptr),
  44. mVertexYvsVertexX(nullptr),
  45. mVpdVzDiff(nullptr),
  46. mBTofTrayMultVsRefMult(nullptr),
  47. mBTofMatchedVsRefMult(nullptr) {
  48. // Parametrized constructor
  49. char tit1[100];
  50. sprintf(tit1, "%s%s_VertexYvsVertexX", title1, title2);
  51. mVertexYvsVertexX = new TH2F(tit1, "VertexYvsVertexX;x (cm);y (cm)",
  52. 300, -6., 6., 300, -6., 6.);
  53. sprintf(tit1, "%s%s_VertexZ", title1, title2);
  54. mVertexZ = new TH1F(tit1, "VertexZ;z (cm);Entries",
  55. 480, -120., 120.);
  56. sprintf(tit1, "%s%s_RefMult", title1, title2);
  57. mRefMult = new TH1F(tit1, "RefMult;RefMult;Entries",
  58. 600, -0.5, 599.5);
  59. sprintf(tit1, "%s%s_VpdVzDiff", title1, title2);
  60. mVpdVzDiff = new TH1F(tit1, "VpdVzDiff", 40, -20., 20.);
  61. sprintf(tit1, "%s%s_BTofTrayMultVsRefMult", title1, title2);
  62. mBTofTrayMultVsRefMult = new TH2F(tit1, "mBTofTrayMultVsRefMult;RefMult;BTof tray multiplicity",
  63. 600, -0.5, 599.5, 600, -0.5, 599.5);
  64. sprintf(tit1, "%s%s_BTofMatchedVsRefMult", title1, title2);
  65. mBTofMatchedVsRefMult = new TH2F(tit1, "mBTofMatchedVsRefMult;RefMult;BTof-matched multiplicity",
  66. 600, -0.5, 599.5, 600, -0.5, 599.5);
  67. }
  68. //_________________
  69. MpdFemtoFxtEventCutMonitor::MpdFemtoFxtEventCutMonitor(const MpdFemtoFxtEventCutMonitor& c) : MpdFemtoBaseCutMonitor(c) {
  70. // Copy constructor
  71. if (mVertexZ) delete mVertexZ;
  72. mVertexZ = new TH1F(*c.mVertexZ);
  73. if (mRefMult) delete mRefMult;
  74. mRefMult = new TH1F(*c.mRefMult);
  75. if (mVertexYvsVertexX) delete mVertexYvsVertexX;
  76. mVertexYvsVertexX = new TH2F(*c.mVertexYvsVertexX);
  77. if (mVpdVzDiff) delete mVpdVzDiff;
  78. mVpdVzDiff = new TH1F(*c.mVpdVzDiff);
  79. if (mBTofTrayMultVsRefMult) delete mBTofTrayMultVsRefMult;
  80. mBTofTrayMultVsRefMult = new TH2F(*c.mBTofTrayMultVsRefMult);
  81. if (mBTofMatchedVsRefMult) delete mBTofMatchedVsRefMult;
  82. mBTofMatchedVsRefMult = new TH2F(*c.mBTofMatchedVsRefMult);
  83. }
  84. //_________________
  85. MpdFemtoFxtEventCutMonitor MpdFemtoFxtEventCutMonitor::operator=(const MpdFemtoFxtEventCutMonitor& c) {
  86. // Assignment operator
  87. if (this != &c) {
  88. if (mVertexZ) delete mVertexZ;
  89. mVertexZ = new TH1F(*(c.mVertexZ));
  90. if (mRefMult) delete mRefMult;
  91. mRefMult = new TH1F(*(c.mRefMult));
  92. if (mVertexYvsVertexX) delete mVertexYvsVertexX;
  93. mVertexYvsVertexX = new TH2F(*(c.mVertexYvsVertexX));
  94. if (mVpdVzDiff) delete mVpdVzDiff;
  95. mVpdVzDiff = new TH1F(*(c.mVpdVzDiff));
  96. if (mBTofTrayMultVsRefMult) delete mBTofTrayMultVsRefMult;
  97. mBTofTrayMultVsRefMult = new TH2F(*(c.mBTofTrayMultVsRefMult));
  98. if (mBTofMatchedVsRefMult) delete mBTofMatchedVsRefMult;
  99. mBTofMatchedVsRefMult = new TH2F(*(c.mBTofMatchedVsRefMult));
  100. }
  101. return *this;
  102. }
  103. //_________________
  104. MpdFemtoFxtEventCutMonitor::~MpdFemtoFxtEventCutMonitor() {
  105. // Destructor
  106. if (mVertexYvsVertexX) {
  107. delete mVertexYvsVertexX;
  108. mVertexYvsVertexX = nullptr;
  109. }
  110. if (mVertexZ) {
  111. delete mVertexZ;
  112. mVertexZ = nullptr;
  113. }
  114. if (mRefMult) {
  115. delete mRefMult;
  116. mRefMult = nullptr;
  117. }
  118. if (mVpdVzDiff) {
  119. delete mVpdVzDiff;
  120. mVpdVzDiff = nullptr;
  121. }
  122. if (mBTofTrayMultVsRefMult) {
  123. delete mBTofTrayMultVsRefMult;
  124. mBTofTrayMultVsRefMult = nullptr;
  125. }
  126. if (mBTofMatchedVsRefMult) {
  127. delete mBTofMatchedVsRefMult;
  128. mBTofMatchedVsRefMult = nullptr;
  129. }
  130. }
  131. //_________________
  132. void MpdFemtoFxtEventCutMonitor::fill(const MpdFemtoEvent* event) {
  133. // Fill monitor histograms
  134. mVertexYvsVertexX->Fill(event->primaryVertex().x(), event->primaryVertex().y());
  135. mVertexZ->Fill(event->primaryVertex().z());
  136. mRefMult->Fill(event->refMult());
  137. mVpdVzDiff->Fill(event->vpdVzDiff());
  138. mBTofTrayMultVsRefMult->Fill(event->refMult(), event->btofTrayMultiplicity());
  139. mBTofMatchedVsRefMult->Fill(event->refMult(), event->numberOfBTofMatched());
  140. }
  141. //_________________
  142. void MpdFemtoFxtEventCutMonitor::finish() {
  143. std::cout << " entries in histogram mVertexYvsVertexX : "
  144. << mVertexYvsVertexX->Integral() << std::endl;
  145. std::cout << " entries in histogram mVertexZ : "
  146. << mVertexZ->Integral() << std::endl;
  147. std::cout << " entries in histogram mRefMult : "
  148. << mRefMult->Integral() << std::endl;
  149. std::cout << " entries in histogram mVpdVzDiff : "
  150. << mVpdVzDiff->Integral() << std::endl;
  151. std::cout << " entries in histogram mBTofTrayMultVsRefMult : "
  152. << mBTofTrayMultVsRefMult->Integral() << std::endl;
  153. std::cout << " entries in histogram mBTofMatchedVsRefMult : "
  154. << mBTofMatchedVsRefMult->Integral() << std::endl;
  155. }
  156. //_________________
  157. MpdFemtoString MpdFemtoFxtEventCutMonitor::report() {
  158. string Stemp;
  159. char Ctemp[100];
  160. sprintf(Ctemp, " MpdFemtoFxtEventCutMonitor");
  161. Stemp = Ctemp;
  162. MpdFemtoString returnThis = Stemp;
  163. return returnThis;
  164. }
  165. //_________________
  166. void MpdFemtoFxtEventCutMonitor::writeOutHistos() {
  167. // Write all histograms
  168. mVertexYvsVertexX->Write();
  169. mVertexZ->Write();
  170. mRefMult->Write();
  171. mVpdVzDiff->Write();
  172. mBTofTrayMultVsRefMult->Write();
  173. mBTofMatchedVsRefMult->Write();
  174. }
  175. //_________________
  176. TList* MpdFemtoFxtEventCutMonitor::getOutputList() {
  177. // Prepare ouput list with histograms
  178. TList *outputList = new TList();
  179. outputList->Add(mVertexYvsVertexX);
  180. outputList->Add(mVertexZ);
  181. outputList->Add(mRefMult);
  182. outputList->Add(mVpdVzDiff);
  183. outputList->Add(mBTofTrayMultVsRefMult);
  184. outputList->Add(mBTofMatchedVsRefMult);
  185. return outputList;
  186. }