MpdFemtoBaseEventReader.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /**
  2. * \class MpdFemtoBaseEventReader
  3. * \brief The pure virtual base class for femto event readers
  4. *
  5. * All event readers must inherit from this one
  6. *
  7. * \author Grigory Nigmatkulov (NRNU MEPhI)
  8. * \date May 18, 2019
  9. * \email nigmatkulov@gmail.com
  10. */
  11. #ifndef MpdFemtoBaseEventReader_h
  12. #define MpdFemtoBaseEventReader_h
  13. // C++ headers
  14. #include <iostream>
  15. // Forward declarations
  16. class MpdFemtoEvent;
  17. class MpdFemtoBaseEventCut;
  18. class MpdFemtoBaseTrackCut;
  19. class MpdFemtoBaseV0Cut;
  20. class MpdFemtoBaseXiCut;
  21. class MpdFemtoBaseKinkCut;
  22. // MpdFemtoMaker headers
  23. #include "MpdFemtoString.h"
  24. //_________________
  25. class MpdFemtoBaseEventReader {
  26. public:
  27. /// Default constructor
  28. ///
  29. /// Even though it's only a base class and never constructed, if you don't
  30. /// have an implementation, you get "AliFemtoEventReader type_info node" upon
  31. /// dynamical loading
  32. ///
  33. /// All pointers are set to NULL, the status is set to 0 (good), and debug is
  34. /// set to 1 (print debug information in methods which run once)
  35. ///
  36. MpdFemtoBaseEventReader();
  37. /// Copy constructor
  38. ///
  39. /// This performs a shallow copy, so both the origial and new event readers
  40. /// point to the same cut objects.
  41. MpdFemtoBaseEventReader(const MpdFemtoBaseEventReader& copy);
  42. /// Assignment Operator
  43. /// Performs shallow copy of members
  44. MpdFemtoBaseEventReader& operator=(const MpdFemtoBaseEventReader& copy);
  45. /// Destructor
  46. ///
  47. /// No members are deleted - it is up to the entity creating the cuts to
  48. /// delete them after the event reader has run its course
  49. virtual ~MpdFemtoBaseEventReader() {
  50. /* empty */
  51. }
  52. /// Concrete subclasses MUST implement this method, which creates the MpdFemtoEvent
  53. virtual MpdFemtoEvent* returnHbtEvent() = 0;
  54. /// User-written method to return string describing reader
  55. /// including whatever "early" cuts are being done
  56. virtual MpdFemtoString report();
  57. /// Next method does NOT need to be implemented, in which case the
  58. /// "default" method below is executed
  59. virtual int writeHbtEvent(MpdFemtoEvent* /* event */) {
  60. std::cout << "No WriteHbtEvent implemented" << std::endl;
  61. return 0;
  62. }
  63. // Next two are optional but would make sense for, e.g., opening and closing a file
  64. /// Initialization
  65. virtual int init(const char* ReadWrite, MpdFemtoString& Message);
  66. /// Finalization
  67. virtual void finish() {
  68. /* empty */
  69. }
  70. /// MpdFemtoManager looks at this for guidance if it gets null pointer from ReturnHbtEvent
  71. int status() {
  72. return mReaderStatus;
  73. }
  74. /// Set event cut
  75. virtual void setEventCut(MpdFemtoBaseEventCut* ecut) {
  76. mEventCut = ecut;
  77. }
  78. /// Set track cut
  79. virtual void setTrackCut(MpdFemtoBaseTrackCut* pcut) {
  80. mTrackCut = pcut;
  81. }
  82. /// Set v0 cut
  83. virtual void setV0Cut(MpdFemtoBaseV0Cut* pcut) {
  84. mV0Cut = pcut;
  85. }
  86. /// Set xi cut
  87. virtual void setXiCut(MpdFemtoBaseXiCut* pcut) {
  88. mXiCut = pcut;
  89. }
  90. /// Set kink cut
  91. virtual void setKinkCut(MpdFemtoBaseKinkCut* pcut) {
  92. mKinkCut = pcut;
  93. }
  94. /// Return pointer to event cut
  95. virtual MpdFemtoBaseEventCut* eventCut() {
  96. return mEventCut;
  97. }
  98. /// Return pointer to track cut
  99. virtual MpdFemtoBaseTrackCut* trackCut() {
  100. return mTrackCut;
  101. }
  102. /// Return pointer to V0 cut
  103. virtual MpdFemtoBaseV0Cut* v0Cut() {
  104. return mV0Cut;
  105. }
  106. /// Return pointer to V0 cut
  107. virtual MpdFemtoBaseXiCut* xiCut() {
  108. return mXiCut;
  109. }
  110. /// Return pointer to kink cut
  111. virtual MpdFemtoBaseKinkCut* kinkCut() {
  112. return mKinkCut;
  113. }
  114. /**
  115. * Controls the amount of debug information printed.
  116. * The code indicates which functions should print debug statements:
  117. *
  118. * 0: no output at all
  119. * 1: once (e.g. in constructor, finsh
  120. * 2: once per event
  121. * 3: once per track
  122. * 4: once per pair
  123. */
  124. int debug() {
  125. return mDebug;
  126. }
  127. /**
  128. * Set debug level:
  129. * 0: no output at all
  130. * 1: once (e.g. in constructor, finsh
  131. * 2: once per event
  132. * 3: once per track
  133. * 4: once per pair
  134. */
  135. void setDebug(int d) {
  136. mDebug = d;
  137. }
  138. protected:
  139. /// Link to the front-loaded event cut
  140. MpdFemtoBaseEventCut *mEventCut; //!<!
  141. /// Link to the front-loaded track cut
  142. MpdFemtoBaseTrackCut *mTrackCut; //!<!
  143. /// Link to the front-loaded V0 cut
  144. MpdFemtoBaseV0Cut *mV0Cut; //!<!
  145. /// Link to the front-loaded Xi cut
  146. MpdFemtoBaseXiCut *mXiCut; //!<!
  147. /// Link to the front-loaded Kink cut
  148. MpdFemtoBaseKinkCut *mKinkCut; //!<!
  149. /// status: 0 - good
  150. int mReaderStatus; ///<
  151. /**
  152. * Debug level:
  153. * 0: no output at all
  154. * 1: once (e.g. in constructor, finsh
  155. * 2: once per event
  156. * 3: once per track
  157. * 4: once per pair
  158. */
  159. int mDebug; ///<
  160. ClassDef(MpdFemtoBaseEventReader, 0)
  161. };
  162. #endif // #define MpdFemtoBaseEventReader_h