MpdFemtoPicoEventCollectionVectorHideAway.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * \class MpdFemtoPicoEventCollectionVectorHideAway
  3. * \brief A helper class for managing many mixing buffers
  4. *
  5. * A helper class for managing many mixing buffers with up to
  6. * three variables used for binning.
  7. *
  8. * \author Grigory Nigmatkulov (NRNU MEPhI)
  9. * \date May 18, 2019
  10. * \email nigmatkulov@gmail.com
  11. */
  12. #ifndef MpdFemtoPicoEventCollectionVectorHideAway_h
  13. #define MpdFemtoPicoEventCollectionVectorHideAway_h
  14. // C++ headers
  15. #include <cmath>
  16. #include <limits>
  17. #include <float.h>
  18. // MpdFemtoMaker headers
  19. // Infrastructure
  20. #include "MpdFemtoPicoEvent.h"
  21. #include "MpdFemtoPicoEventCollection.h"
  22. #include "MpdFemtoPicoEventCollectionVector.h"
  23. //_________________
  24. class MpdFemtoPicoEventCollectionVectorHideAway {
  25. public:
  26. /// Constructor
  27. MpdFemtoPicoEventCollectionVectorHideAway(int bx = 1, double lx = -FLT_MAX, double ux = FLT_MAX,
  28. int by = 1, double ly = -FLT_MAX, double uy = FLT_MAX,
  29. int bz = 1, double lz = -FLT_MAX, double uz = FLT_MAX);
  30. /// Copy constructor
  31. MpdFemtoPicoEventCollectionVectorHideAway(const MpdFemtoPicoEventCollectionVectorHideAway &copy);
  32. /// Copy constructor
  33. MpdFemtoPicoEventCollectionVectorHideAway& operator=(const MpdFemtoPicoEventCollectionVectorHideAway& copy);
  34. /// Default destructor
  35. virtual ~MpdFemtoPicoEventCollectionVectorHideAway();
  36. /// Return pico event collection
  37. MpdFemtoPicoEventCollection* picoEventCollection(int, int, int);
  38. /// Return pico event collection
  39. MpdFemtoPicoEventCollection* picoEventCollection(double x, double y = 0, double z = 0);
  40. /// Return bin number on the x axis
  41. unsigned int binXNumber(double x) const {
  42. return (int) floor((x - mMinX) / mStepX);
  43. }
  44. /// Return bin number on the y axis
  45. unsigned int binYNumber(double y) const {
  46. return (int) floor((y - mMinY) / mStepY);
  47. }
  48. /// Return bin number on the z axis
  49. unsigned int binZNumber(double z) const {
  50. return (int) floor((z - mMinZ) / mStepZ);
  51. }
  52. private:
  53. /// Total number of bins
  54. int mBinsTot;
  55. /// Number of bins on x axis
  56. int mBinsX;
  57. /// Number of bins on y axis
  58. int mBinsY;
  59. /// Number of bins on z axis
  60. int mBinsZ;
  61. /// Minimal value on x axis
  62. double mMinX;
  63. /// Minimal value on y axis
  64. double mMinY;
  65. /// Minimal value on z axis
  66. double mMinZ;
  67. /// Maximal value on x axis
  68. double mMaxX;
  69. /// Maximal value on y axis
  70. double mMaxY;
  71. /// Maximal value on z axis
  72. double mMaxZ;
  73. /// Steps on x axis
  74. double mStepX;
  75. /// Steps on y axis
  76. double mStepY;
  77. /// Steps on z axis
  78. double mStepZ;
  79. /// Pico event collection
  80. MpdFemtoPicoEventCollection* mCollection;
  81. /// Collection vector
  82. MpdFemtoPicoEventCollectionVector mCollectionVector;
  83. ClassDef(MpdFemtoPicoEventCollectionVectorHideAway, 0)
  84. };
  85. #endif // #define MpdFemtoPicoEventCollectionVectorHideAway_h