MpdFemtoKtPairCut.cxx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // Simple cut to select pairs within the given kT range
  3. //
  4. // MpdFemtoMakerUser headers
  5. #include "MpdFemtoKtPairCut.h"
  6. // ROOT headers
  7. #include <TMath.h>
  8. // C++ headers
  9. #include <string>
  10. ClassImp(MpdFemtoKtPairCut);
  11. //_________________
  12. MpdFemtoKtPairCut::MpdFemtoKtPairCut() : MpdFemtoBasePairCut() {
  13. // Default constructor
  14. fKtRange[0] = 0.f;
  15. fKtRange[1] = 1e6;
  16. fPhiRange[0] = -1e6;
  17. fPhiRange[1] = 1e6;
  18. }
  19. //_________________
  20. MpdFemtoKtPairCut::MpdFemtoKtPairCut(double ktLo, double ktHi,
  21. double phiLo, double phiHi): MpdFemtoBasePairCut() {
  22. // Parametrized constructor
  23. fKtRange[0] = ktLo;
  24. fKtRange[1] = ktHi;
  25. fPhiRange[0] = phiLo;
  26. fPhiRange[1] = phiHi;
  27. }
  28. //_________________
  29. MpdFemtoKtPairCut::MpdFemtoKtPairCut(const MpdFemtoKtPairCut& c):
  30. MpdFemtoBasePairCut(c) {
  31. // Copy constructor
  32. fKtRange[0] = c.fKtRange[0];
  33. fKtRange[1] = c.fKtRange[1];
  34. fPhiRange[0] = c.fPhiRange[0];
  35. fPhiRange[1] = c.fPhiRange[1];
  36. }
  37. //_________________
  38. MpdFemtoKtPairCut::~MpdFemtoKtPairCut() {
  39. // Destructor
  40. /* emtpy */
  41. }
  42. //_________________
  43. MpdFemtoKtPairCut& MpdFemtoKtPairCut::operator=(const MpdFemtoKtPairCut& c) {
  44. // Assignment operator
  45. if (this != &c) {
  46. MpdFemtoBasePairCut::operator=(c);
  47. fKtRange[0] = c.fKtRange[0];
  48. fKtRange[1] = c.fKtRange[1];
  49. fPhiRange[0] = c.fPhiRange[0];
  50. fPhiRange[1] = c.fPhiRange[1];
  51. }
  52. return *this;
  53. }
  54. //_________________
  55. MpdFemtoString MpdFemtoKtPairCut::report() {
  56. // Prepare a report from the execution
  57. MpdFemtoString report = "MpdFemtoKtPairCut \n";
  58. report += Form("Accept pair with kT in range %4.2f , %4.2f", fKtRange[0], fKtRange[1] );
  59. report += Form("Accept pair with angle in range %4.2f , %4.2f", fPhiRange[0], fPhiRange[1] );
  60. return report;
  61. }
  62. //_________________
  63. TList *MpdFemtoKtPairCut::listSettings() {
  64. // Return a list of settings in a writable form
  65. TList *settings = new TList();
  66. settings->AddVector(
  67. new TObjString( TString::Format("MpdFemtoKtPairCut.ktmax=%4.2f", fKtRange[0] ) ),
  68. new TObjString( TString::Format("MpdFemtoKtPairCut.ktmin=%4.2f", fKtRange[1] ) ),
  69. new TObjString( TString::Format("MpdFemtoKtPairCut.phimax=%4.2f", fPhiRange[0] ) ),
  70. new TObjString( TString::Format("MpdFemtoKtPairCut.phimin=%4.2f", fPhiRange[1] ) ),
  71. nullptr
  72. );
  73. return settings;
  74. }
  75. //_________________
  76. bool MpdFemtoKtPairCut::pass(const MpdFemtoPair* pair) {
  77. bool isGoodPair = false;
  78. // Apply kT pair cut ( IMPORTANT: a <= x < b )
  79. isGoodPair = ( fKtRange[0] <= pair->kT() && pair->kT() < fKtRange[1] ) ? true : false;
  80. /*
  81. // To be filled with phi cut
  82. double rpangle = pair->GetPairAngleEP();
  83. if (rpangle > 180.0) rpangle -= 180.0;
  84. if (rpangle < 0.0) rpangle += 180.0;
  85. // note: handle "wrap around" if the minimum phi is negative
  86. if (fPhiMin < 0.0) {
  87. return (rpangle < fPhiMax) || (180.0+fPhiMin <= rpangle);
  88. }
  89. // return whether angle is within phi-range
  90. return (fPhiMin <= rpangle) && (rpangle < fPhiMax);
  91. */
  92. return isGoodPair;
  93. }
  94. //_________________
  95. bool MpdFemtoKtPairCut::pass(const MpdFemtoPair* pair, double aRPAngle) {
  96. // The same as above, but it is defined with RP Angle as input in
  97. // all the correlation function classes.
  98. return ( (aRPAngle > 0.) && pass(pair) ) ;
  99. }