MpdFemtoModelBPLCMS3DCorrFctn.cxx 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. //
  2. // Three-dimensional Bertsch-Pratt correlation function in LCMS for the model estimations
  3. //
  4. // MpdFemtoMaker headers
  5. #include "MpdFemtoModelGausLCMSFreezeOutGenerator.h"
  6. #include "MpdFemtoModelHiddenInfo.h"
  7. #include "MpdFemtoModelManager.h"
  8. #include "MpdFemtoPair.h"
  9. // MpdFemtoMakerUser headers
  10. #include "MpdFemtoModelBPLCMS3DCorrFctn.h"
  11. // ROOT headers
  12. #include "TMath.h"
  13. #include "TString.h"
  14. #include "TH3F.h"
  15. // C++ headers
  16. #include <cmath>
  17. ClassImp(MpdFemtoModelBPLCMS3DCorrFctnKt)
  18. //_________________
  19. MpdFemtoModelBPLCMS3DCorrFctnKt::MpdFemtoModelBPLCMS3DCorrFctnKt(const char* title, const int& nBins,
  20. const double& qLo, const double& qHi,
  21. const bool isUseDenominator) :
  22. MpdFemtoBaseCorrFctn(),
  23. mManager(nullptr) {
  24. // Parametrized constructor
  25. // Set general parameters
  26. setUseDenominator( isUseDenominator );
  27. // Define string parameters
  28. TString baseName, baseTitle;
  29. TString appendix = ";q_{out} (GeV/c);q_{side} (GeV/c);q_{long} (GeV/c)";
  30. // Numerator
  31. baseName = "hBPLCMSModel_num_";
  32. baseName += title;
  33. baseTitle = baseName;
  34. baseTitle += appendix;
  35. mNumerator = new TH3F( baseName.Data(), baseTitle.Data(),
  36. nBins, qLo, qHi, nBins, qLo, qHi, nBins, qLo, qHi );
  37. mNumerator->Sumw2();
  38. // Weighted numerator
  39. baseName = "hBPLCMSModel_numw_";
  40. baseName += title;
  41. baseTitle = baseName;
  42. baseTitle += appendix;
  43. mNumeratorWeighted = new TH3F( baseName.Data(), baseTitle.Data(),
  44. nBins, qLo, qHi, nBins, qLo, qHi, nBins, qLo, qHi );
  45. mNumeratorWeighted->Sumw2();
  46. // Qinv weighted numerator
  47. baseName = "hBPLCMSModel_qinvw_";
  48. baseName += title;
  49. baseTitle = baseName;
  50. baseTitle += appendix;
  51. mNumeratorQinvWeighted = new TH3F( baseName.Data(), baseTitle.Data(),
  52. nBins, qLo, qHi, nBins, qLo, qHi, nBins, qLo, qHi );
  53. mNumeratorQinvWeighted->Sumw2();
  54. if ( mIsUseDenominator ) {
  55. // Denominator
  56. baseName = "hBPLCMSModel_den_";
  57. baseName += title;
  58. baseTitle = baseName;
  59. baseTitle += appendix;
  60. mDenominator = new TH3F( baseName.Data(), baseTitle.Data(),
  61. nBins, qLo, qHi, nBins, qLo, qHi, nBins, qLo, qHi );
  62. mDenominator->Sumw2();
  63. // Weighted denominator
  64. baseName = "hBPLCMSModel_denw_";
  65. baseName += title;
  66. baseTitle = baseName;
  67. baseTitle += appendix;
  68. mDenominatorWeighted = new TH3F( baseName.Data(), baseTitle.Data(),
  69. nBins, qLo, qHi, nBins, qLo, qHi, nBins, qLo, qHi );
  70. mDenominatorWeighted->Sumw2();
  71. // Qinv weighted denominator
  72. baseName = "hBPLCMSModel_qinvw_";
  73. baseName += title;
  74. baseTitle = baseName;
  75. baseTitle += appendix;
  76. mDenominatorQinvWeighted = new TH3F( baseName.Data(), baseTitle.Data(),
  77. nBins, qLo, qHi, nBins, qLo, qHi, nBins, qLo, qHi );
  78. mDenominatorQinvWeighted->Sumw2();
  79. } // if ( mIsUseDenominator )
  80. }
  81. //_________________
  82. MpdFemtoModelBPLCMS3DCorrFctnKt::MpdFemtoModelBPLCMS3DCorrFctnKt(const MpdFemtoModelBPLCMS3DCorrFctnKt& copy) :
  83. MpdFemtoBaseCorrFctn( copy ),
  84. mManager( copy.mManager ),
  85. mIsUseDenominator( copy.mIsUseDenominator ) {
  86. // Copy constructor
  87. mNumerator = new TH3F( *copy.mNumerator );
  88. mNumeratorWeighted = new TH3F( *copy.mNumeratorWeighted );
  89. mNumeratorQinvWeighted = new TH3F( *copy.mNumeratorQinvWeighted );
  90. if ( mIsUseDenominator ) {
  91. mDenominator = new TH3F( *copy.mDenominator );
  92. mDenominatorWeighted = new TH3F( *copy.mDenominatorWeighted );
  93. mDenominatorQinvWeighted = new TH3F( *copy.mDenominatorQinvWeighted );
  94. }
  95. }
  96. //____________________________
  97. MpdFemtoModelBPLCMS3DCorrFctnKt::~MpdFemtoModelBPLCMS3DCorrFctnKt() {
  98. // Destructor
  99. if ( mNumerator ) delete mNumerator;
  100. if ( mNumeratorWeighted ) delete mNumeratorWeighted;
  101. if ( mNumeratorQinvWeighted ) delete mNumeratorQinvWeighted;
  102. if ( mDenominator ) delete mDenominator;
  103. if ( mDenominatorWeighted ) delete mDenominatorWeighted;
  104. if ( mDenominatorQinvWeighted ) delete mDenominatorQinvWeighted;
  105. }
  106. //_________________________
  107. MpdFemtoModelBPLCMS3DCorrFctnKt& MpdFemtoModelBPLCMS3DCorrFctnKt::operator=(const MpdFemtoModelBPLCMS3DCorrFctnKt& copy) {
  108. // Assignment operator
  109. if (this != &copy) {
  110. mManager = copy.mManager;
  111. mIsUseDenominator = copy.mIsUseDenominator;
  112. mNumerator = new TH3F( *copy.mNumerator );
  113. mNumeratorWeighted = new TH3F( *copy.mNumeratorWeighted );
  114. mNumeratorQinvWeighted = new TH3F( *copy.mNumeratorQinvWeighted );
  115. if ( mIsUseDenominator ) {
  116. mDenominator = new TH3F( *copy.mDenominator );
  117. mDenominatorWeighted = new TH3F( *copy.mDenominatorWeighted );
  118. mDenominatorQinvWeighted = new TH3F( *copy.mDenominatorQinvWeighted );
  119. }
  120. } // if (this != &copy)
  121. return *this;
  122. }
  123. //_________________
  124. void MpdFemtoModelBPLCMS3DCorrFctnKt::connectToManager(MpdFemtoModelManager *manager) {
  125. mManager = manager;
  126. }
  127. //_________________
  128. void MpdFemtoModelBPLCMS3DCorrFctnKt::eventBegin(const MpdFemtoEvent* /* event */) {
  129. /* empty */
  130. }
  131. //_________________
  132. void MpdFemtoModelBPLCMS3DCorrFctnKt::eventEnd(const MpdFemtoEvent* /* event */) {
  133. /* empty */
  134. }
  135. //_________________________
  136. void MpdFemtoModelBPLCMS3DCorrFctnKt::writeOutHistos() {
  137. // Write out all histograms to file
  138. if ( mNumerator ) mNumerator->Write();
  139. if ( mNumeratorWeighted ) mNumeratorWeighted->Write();
  140. if ( mNumeratorQinvWeighted ) mNumeratorQinvWeighted->Write();
  141. if ( mIsUseDenominator ) {
  142. if ( mDenominator ) mDenominator->Write();
  143. if ( mDenominatorWeighted ) mDenominatorWeighted->Write();
  144. if ( mDenominatorQinvWeighted ) mDenominatorQinvWeighted->Write();
  145. } // if ( mIsUseDenominator )
  146. }
  147. //______________________________
  148. TList* MpdFemtoModelBPLCMS3DCorrFctnKt::getOutputList() {
  149. // Prepare the list of objects to be written to the output
  150. TList *tOutputList = new TList();
  151. tOutputList->Add(mNumerator);
  152. tOutputList->Add(mNumeratorWeighted);
  153. tOutputList->Add(mNumeratorQinvWeighted);
  154. if ( mIsUseDenominator ) {
  155. tOutputList->Add(mDenominator);
  156. tOutputList->Add(mDenominatorWeighted);
  157. tOutputList->Add(mDenominatorQinvWeighted);
  158. }
  159. return tOutputList;
  160. }
  161. //_________________________
  162. void MpdFemtoModelBPLCMS3DCorrFctnKt::finish() {
  163. /* empty */
  164. }
  165. //____________________________
  166. MpdFemtoString MpdFemtoModelBPLCMS3DCorrFctnKt::report() {
  167. // Construct the report
  168. TString report("LCMS Frame Bertsch-Pratt 3D Correlation Function Report:\n");
  169. report += TString::Format("Number of entries in numerator:\t%E\n", mNumerator->GetEntries());
  170. if ( mIsUseDenominator ) {
  171. report += TString::Format("Number of entries in denominator:\t%E\n", mDenominator->GetEntries());
  172. }
  173. if (mPairCut) {
  174. report += "Here is the PairCut specific to this CorrFctn\n";
  175. report += mPairCut->report();
  176. }
  177. else {
  178. report += "No PairCut specific to this CorrFctn\n";
  179. }
  180. return MpdFemtoString((const char *)report);
  181. }
  182. //_________________
  183. void MpdFemtoModelBPLCMS3DCorrFctnKt::addRealPair(MpdFemtoPair* pair) {
  184. // Perform operations on real pairs
  185. // Check front-loaded pair cut
  186. if (mPairCut && !mPairCut->pass(pair)) {
  187. return;
  188. }
  189. mNumerator->Fill(pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS(), 1.);
  190. mNumeratorWeighted->Fill(pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS(), mManager->weight(pair));
  191. mNumeratorQinvWeighted->Fill(pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS(), pair->qInv());
  192. }
  193. //_________________
  194. void MpdFemtoModelBPLCMS3DCorrFctnKt::addMixedPair(MpdFemtoPair* pair) {
  195. if ( !mIsUseDenominator ) return;
  196. // Check front-loaded pair cut
  197. if (mPairCut && !mPairCut->pass(pair)) {
  198. return;
  199. }
  200. mDenominator->Fill(pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS(), 1.);
  201. mDenominatorWeighted->Fill(pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS(), mManager->weight(pair));
  202. mDenominatorQinvWeighted->Fill(pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS(), pair->qInv());
  203. }