MpdFemtoBaseEventCut.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * \class MpdFemtoBaseEventCut
  3. * \brief The pure virtual base class for the event cut
  4. *
  5. * All event cuts must inherit from this one and implement the pass() and
  6. * report() methods. The ::clone() function simply returns nullptr, so if
  7. * users want their cuts to behave as expected, they should also write
  8. * their own.
  9. *
  10. * \author Grigory Nigmatkulov (NRNU MEPhI)
  11. * \date May 18, 2019
  12. * \email nigmatkulov@gmail.com
  13. */
  14. #ifndef MpdFemtoBaseEventCut_h
  15. #define MpdFemtoBaseEventCut_h
  16. // Forward declarations
  17. class MpdFemtoEvent;
  18. class MpdFemtoBaseAnalysis;
  19. // MpdFemtoMaker headers
  20. #include "MpdFemtoCutMonitorHandler.h"
  21. #include "MpdFemtoString.h"
  22. // ROOT headers
  23. #include "TList.h"
  24. #include "TString.h"
  25. //_________________
  26. class MpdFemtoBaseEventCut : public MpdFemtoCutMonitorHandler {
  27. public:
  28. /// Default constructor
  29. MpdFemtoBaseEventCut();
  30. /// Copy constructor
  31. MpdFemtoBaseEventCut(const MpdFemtoBaseEventCut& copy);
  32. /// Assignment operator
  33. MpdFemtoBaseEventCut& operator=(const MpdFemtoBaseEventCut& copy);
  34. /// Default destructor
  35. virtual ~MpdFemtoBaseEventCut() { /* no-op */ }
  36. /// True if event has passed the cut and false if not
  37. virtual bool pass(const MpdFemtoEvent* event) = 0;
  38. /// Return new settings list.
  39. ///
  40. /// This method creates a new list of TObjStrings describing cut parameters.
  41. /// The default implementation automatically calls the AppendSettings method
  42. /// to fill the list, so users only need to overload that method.
  43. virtual TList* listSettings() const;
  44. /// Appends cut settings to a TList
  45. ///
  46. /// This method should be overloaded by the user to add any relevent settings
  47. /// of the cut to the list
  48. ///
  49. /// No settings are added by this class. Simply returns the incoming TList.
  50. ///
  51. /// \param A list to append settings to.
  52. /// \param prefix An optional prefix to prepend to the beginning of each setting
  53. /// \return The same pointer as the parameter
  54. virtual TList* appendSettings(TList*, const TString& prefix = "") const;
  55. /// User-written method to return string describing cuts
  56. virtual MpdFemtoString report() = 0;
  57. /// Default clone
  58. virtual MpdFemtoBaseEventCut* clone() const = 0;
  59. /// The following allows "back-pointing" from the CorrFctn
  60. ///to the "parent" Analysis
  61. friend class MpdFemtoBaseAnalysis;
  62. /// Return a pointer to the analysis
  63. MpdFemtoBaseAnalysis* hbtAnalysis() {
  64. return mBaseAnalysis;
  65. }
  66. /// Set analysis
  67. void setAnalysis(MpdFemtoBaseAnalysis* a) {
  68. mBaseAnalysis = a;
  69. }
  70. protected:
  71. /// Pointer to the base analysis
  72. MpdFemtoBaseAnalysis* mBaseAnalysis; //!<!
  73. ClassDef(MpdFemtoBaseEventCut, 0)
  74. };
  75. //_________________
  76. inline MpdFemtoBaseEventCut::MpdFemtoBaseEventCut() : MpdFemtoCutMonitorHandler(), mBaseAnalysis(nullptr) {
  77. /* empty */
  78. }
  79. //_________________
  80. inline MpdFemtoBaseEventCut::MpdFemtoBaseEventCut(const MpdFemtoBaseEventCut& c) :
  81. MpdFemtoCutMonitorHandler(c), mBaseAnalysis(c.mBaseAnalysis) {
  82. /* empty */
  83. }
  84. //_________________
  85. inline MpdFemtoBaseEventCut& MpdFemtoBaseEventCut::operator=(const MpdFemtoBaseEventCut& c) {
  86. if (this != &c) {
  87. mBaseAnalysis = c.mBaseAnalysis;
  88. }
  89. return *this;
  90. }
  91. //_________________
  92. inline TList* MpdFemtoBaseEventCut::listSettings() const {
  93. return appendSettings(new TList());
  94. }
  95. //_________________
  96. inline TList* MpdFemtoBaseEventCut::appendSettings(TList *listOfSettings, const TString& /* prefix */) const {
  97. return listOfSettings;
  98. }
  99. #endif // #define MpdFemtoBaseEventCut_h