MpdFemtoBPLCMS3DCorrFctn.cxx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. //
  2. // A class that calculates 3D correlation function of identical particles
  3. //
  4. // MpdFemtoMakerUser headers
  5. #include "MpdFemtoBPLCMS3DCorrFctn.h"
  6. #include "MpdFemtoKtPairCut.h"
  7. //#include "MpdFemtoAnalysisReactionPlane.h"
  8. // ROOT headers
  9. #include "TH3F.h"
  10. #include "TList.h"
  11. #include "TString.h"
  12. ClassImp(MpdFemtoBPLCMS3DCorrFctn);
  13. //_________________
  14. MpdFemtoBPLCMS3DCorrFctn::MpdFemtoBPLCMS3DCorrFctn(const char* ctitle, const int& nbins,
  15. const double& qLo, const double& qHi):
  16. MpdFemtoBaseCorrFctn(),
  17. mNumerator( nullptr ),
  18. mDenominator( nullptr ),
  19. mQinvHisto( nullptr ) {
  20. // Parametrized constructor
  21. TString name, title;
  22. TString appendix = ";q_{out} (GeV/c);q_{side} (GeV/c);q_{long} (GeV/c)";
  23. // Numerator
  24. name = "hBPLCMS_num_";
  25. name += ctitle;
  26. title = name;
  27. title += appendix;
  28. mNumerator = new TH3F( name.Data(), title.Data(),
  29. nbins, qLo, qHi, nbins, qLo, qHi, nbins, qLo, qHi );
  30. // Denominator
  31. name = "hBPLCMS_den_";
  32. name += ctitle;
  33. title = name;
  34. title += apendix;
  35. mDenominator = new TH3F( name.Data(), title.Data(),
  36. nbins, qLo, qHi, nbins, qLo, qHi, nbins, qLo, qHi );
  37. // qInv weighted denominator
  38. name = "hBPLCMS_qinvw_";
  39. name += ctitle;
  40. title = name;
  41. title += appendix;
  42. mQinvHisto = new TH3F( name.Data(), title.Data(),
  43. nbins, qLo, qHi, nbins, qLo, qHi, nbins, qLo, qHi );
  44. // Weight histograms
  45. mNumerator->Sumw2();
  46. mDenominator->Sumw2();
  47. mQinvHisto->Sumw2();
  48. }
  49. //_________________
  50. MpdFemtoBPLCMS3DCorrFctn::MpdFemtoBPLCMS3DCorrFctn(const MpdFemtoBPLCMS3DCorrFctn& c):
  51. MpdFemtoBaseCorrFctn( c ),
  52. mNumerator( nullptr ),
  53. mDenominator( nullptr ),
  54. mQinvHisto( nullptr ) {
  55. // Copy constructor
  56. mNumerator = new TH3F( *c.mNumerator );
  57. mDenominator = new TH3F( *c.mDenominator );
  58. mQinvHisto = new TH3F( *c.mQinvHisto );
  59. }
  60. //_________________
  61. MpdFemtoBPLCMS3DCorrFctn::~MpdFemtoBPLCMS3DCorrFctn() {
  62. // Destructor
  63. if (mNumerator) delete mNumerator;
  64. if (mDenominator) delete mDenominator;
  65. if (mQinvHisto) delete mQinvHisto;
  66. }
  67. //_________________
  68. MpdFemtoBPLCMS3DCorrFctn& MpdFemtoBPLCMS3DCorrFctn::operator=(const MpdFemtoBPLCMS3DCorrFctn& c) {
  69. // Assignment operator
  70. if (this != &c) {
  71. if (mNumerator) delete mNumerator;
  72. mNumerator = new TH3F( *c.mNumerator );
  73. if (mDenominator) delete mDenominator;
  74. mDenominator = new TH3F( *c.mDenominator );
  75. if (mQinvHisto) delete mQinvHisto;
  76. mQinvHisto = new TH3F( *c.mQinvHisto );
  77. }
  78. return *this;
  79. }
  80. //_________________
  81. void MpdFemtoBPLCMS3DCorrFctn::writeOutHistos() {
  82. // Write out all histograms to file
  83. if (mNumerator) mNumerator->Write();
  84. if (mDenominator) mDenominator->Write();
  85. if (mQinvHisto) mQinvHisto->Write();
  86. }
  87. //_________________
  88. TList* MpdFemtoBPLCMS3DCorrFctn::getOutputList() {
  89. // Prepare the list of objects to be written to the output
  90. TList *tOutputList = new TList();
  91. tOutputList->Add(mNumerator);
  92. tOutputList->Add(mDenominator);
  93. tOutputList->Add(mQinvHisto);
  94. return tOutputList;
  95. }
  96. //_________________________
  97. void MpdFemtoBPLCMS3DCorrFctn::finish() {
  98. /* empty */
  99. }
  100. //_________________
  101. MpdFemtoString MpdFemtoBPLCMS3DCorrFctn::report() {
  102. // Construct the report
  103. TString report("LCMS Frame Bertsch-Pratt 3D Correlation Function Report:\n");
  104. report += TString::Format("Number of entries in numerator:\t%E\n", mNumerator->GetEntries());
  105. report += TString::Format("Number of entries in denominator:\t%E\n", mDenominator->GetEntries());
  106. if (mPairCut) {
  107. report += "Here is the PairCut specific to this CorrFctn\n";
  108. report += mPairCut->report();
  109. }
  110. else {
  111. report += "No PairCut specific to this CorrFctn\n";
  112. }
  113. return MpdFemtoString((const char *)report);
  114. }
  115. //_________________
  116. void MpdFemtoBPLCMS3DCorrFctn::addRealPair( MpdFemtoPair* pair) {
  117. // Perform operations on real pairs
  118. if ( mPairCut && !mPairCut->pass(pair) ) {
  119. return;
  120. }
  121. mNumerator->Fill( pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS() );
  122. }
  123. //____________________________
  124. void MpdFemtoBPLCMS3DCorrFctn::addMixedPair( MpdFemtoPair* pair) {
  125. // Perform operations on mixed pairs
  126. if ( mPairCut && !mPairCut->pass(pair) ) {
  127. return;
  128. }
  129. mDenominator->Fill( pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS(), 1.);
  130. mQinvHisto->Fill( pair->qOutCMS(), pair->qSideCMS(), pair->qLongCMS(), pair->qInv() );
  131. }