KFMCVertex.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //----------------------------------------------------------------------------
  2. // Implementation of the KFParticle class
  3. // .
  4. // @author I.Kisel, I.Kulakov, M.Zyzak
  5. // @version 1.0
  6. // @since 20.08.13
  7. //
  8. //
  9. // -= Copyright &copy ALICE HLT and CBM L1 Groups =-
  10. //____________________________________________________________________________
  11. #ifndef KFMCVERTEX_H
  12. #define KFMCVERTEX_H
  13. #include <iostream>
  14. #include <vector>
  15. /** @class KFMCVertex
  16. ** @brief A class to store information about simulated Monte Carlo primary vertices.
  17. ** @author M.Zyzak, I.Kisel
  18. ** @date 05.02.2019
  19. ** @version 1.0
  20. **
  21. ** The class contains coordinates of the vertex, indices of the Monte Carlo tracks produced
  22. ** at this vertex, classification flags, number of the reconstructed Monte Carlo tracks.
  23. **/
  24. class KFMCVertex
  25. {
  26. public:
  27. KFMCVertex();
  28. float Par( int i ) const { return fPar[i]; } ///< Returns parameter with index "i" from KFMCVertex::fPar
  29. float X() const { return fPar[0]; } ///< Returns X coordinate of the vertex.
  30. float Y() const { return fPar[1]; } ///< Returns Y coordinate of the vertex.
  31. float Z() const { return fPar[2]; } ///< Returns Z coordinate of the vertex.
  32. const float* GetPar() const { return fPar; } ///< Returns pointer to the parameters of the vertex KFMCVertex::fPar
  33. void SetPar( int i, float v ) { fPar[i] = v; } ///< Sets a value "v" to parameter "i".
  34. void SetX( float v ) { fPar[0] = v; } ///< Sets value "v" to the X coordinate.
  35. void SetY( float v ) { fPar[1] = v; } ///< Sets value "v" to the Y coordinate.
  36. void SetZ( float v ) { fPar[2] = v; } ///< Sets value "v" to the Z coordinate.
  37. int NDaughterTracks() const { return fDaughterTracks.size(); } ///< Returns number of Monte Carlo tracks produced at the current vertex.
  38. int NReconstructedDaughterTracks() const { return fNReconstructedDaughters; } ///< Returns number of reconstructed tracks from this vertex.
  39. void AddDaughterTrack( int iTr ) { fDaughterTracks.push_back(iTr); } ///< Adds unique id of the Monte Carlo track produced at the current vertex.
  40. int DaughterTrack( int iTr ) const
  41. {
  42. /** Returns unique id of the Monte Carlo track from this vertex with index "iTr".
  43. ** \param[in] iTr - index of the track.
  44. **/
  45. if(iTr >= NDaughterTracks())
  46. {
  47. std::cout << "ERROR!!!! MC PV contains only " << NDaughterTracks() << " tracks" << std::endl;
  48. return -1;
  49. }
  50. return fDaughterTracks[iTr];
  51. }
  52. bool IsMCReconstructable() const { return fIsMCReconstructable; } ///< Returns flag showing if the vertex can be found (definition is based on the MC tracks)
  53. bool IsReconstructable() const { return fIsReconstructable; } ///< Returns flag showing if the vertex can be found (definition is based on the reconstructed tracks)
  54. bool IsReconstructed() const { return fIsReconstructed; } ///< Returns flag showing if the vertex was reconstructed
  55. void SetReconstructable() { fIsReconstructable = 1; } ///< Defines the current vertex as such that can be reconstructed (based on the reconstructed tracks)
  56. void SetUnReconstructable() { fIsReconstructable = 0; } ///< Defines the current vertex as such that can not be reconstructed (based on the reconstructed tracks)
  57. void SetMCReconstructable() { fIsMCReconstructable = 1; } ///< Defines the current vertex as such that can be reconstructed (based on the MC tracks)
  58. void SetMCUnReconstructable() { fIsMCReconstructable = 0; } ///< Defines the current vertex as such that can not be reconstructed (based on the MC tracks)
  59. void SetReconstructed() { fIsReconstructed = 1; } ///< Defines the current vertex as such that was reconstructed
  60. void SetUnReconstructed() { fIsReconstructed = 0; } ///< Defines the current vertex as such that was not reconstructed
  61. void SetNReconstructedDaughters(int n) { fNReconstructedDaughters = n; } ///< Defines number of the reconstructed tracks produced at the current vertex.
  62. bool IsTriggerPV() const { return fIsTriggerPV; } ///< Returns flag showing if the vertex is considerred as tigger.
  63. void SetTriggerPV() { fIsTriggerPV = 1; } ///< Defines the current vertex as the trigger primary vertex.
  64. friend std::ostream& operator<<(std::ostream& out, const KFMCVertex &a);
  65. friend std::istream& operator>>(std::istream& in, KFMCVertex &a);
  66. protected:
  67. float fPar[3]; ///< Cartesian coordinates of the vertex: { X, Y, Z }.
  68. std::vector<int> fDaughterTracks; ///< Vector with unique ids of the Monte Carlo tracks produced at this vertex.
  69. bool fIsReconstructable; ///< Flag showing if the vertex considered as reconstructable based on the reconstructed tracks.
  70. bool fIsMCReconstructable; ///< Flag showing if the vertex considered as reconstructable based on the Monte Carlo tracks.
  71. bool fIsReconstructed; ///< Flag showing if vertex was reconstructed.
  72. int fNReconstructedDaughters; ///< Number of found tracks, produced at the current vertex.
  73. bool fIsTriggerPV; ///< Flag showing if the vertex was a trigger primary vertex.
  74. };
  75. #endif