Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:15:55

0001 /**
0002  *  @file   PandoraSDK/include/Objects/MCParticle.h
0003  * 
0004  *  @brief  Header file for the mc particle class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_MC_PARTICLE_H
0009 #define PANDORA_MC_PARTICLE_H 1
0010 
0011 #include "Pandora/ObjectCreation.h"
0012 #include "Pandora/StatusCodes.h"
0013 
0014 namespace pandora
0015 {
0016 
0017 template<typename T> class InputObjectManager;
0018 template<typename T, typename S> class PandoraObjectFactory;
0019 
0020 //------------------------------------------------------------------------------------------------------------------------------------------
0021 
0022 /**
0023  *  @brief  MCParticle class
0024  */
0025 class MCParticle 
0026 {
0027 public:
0028     /**
0029      *  @brief  Whether the mc particle is a root particle
0030      * 
0031      *  @return boolean
0032      */
0033     bool IsRootParticle() const;
0034 
0035     /**
0036      *  @brief  Whether the mc particle is a pfo target
0037      * 
0038      *  @return boolean
0039      */
0040     bool IsPfoTarget() const;
0041 
0042     /**
0043      *  @brief  Get energy of mc particle, units GeV
0044      *
0045      *  @return the mc particle energy
0046      */
0047     float GetEnergy() const;
0048 
0049     /**
0050      *  @brief  Get momentum of mc particle, units GeV
0051      *
0052      *  @return the mc particle momentum
0053      */
0054     const CartesianVector &GetMomentum() const;
0055 
0056     /**
0057      *  @brief  Get the production vertex of the mc particle, units mm
0058      *
0059      *  @return the production vertex of the mc particle
0060      */
0061     const CartesianVector &GetVertex() const;
0062 
0063     /**
0064      *  @brief  Get the endpoint of the mc particle, units mm
0065      *
0066      *  @return the endpoint of the mc particle
0067      */
0068     const CartesianVector &GetEndpoint() const;
0069 
0070     /**
0071      *  @brief  Get inner radius of mc particle, units mm
0072      * 
0073      *  @return the mc particle inner radius
0074      */
0075     float GetInnerRadius() const;
0076 
0077     /**
0078      *  @brief  Get outer radius of mc particle, units mm
0079      *
0080      *  @return the mc particle outer radius
0081      */
0082     float GetOuterRadius() const;
0083 
0084     /**
0085      *  @brief  Get the PDG code of the mc particle
0086      *
0087      *  @return the PDG code of the mc particle
0088      */
0089     int GetParticleId() const;
0090 
0091     /**
0092      *  @brief  Get the type of the mc particle, e.g. vertex, 2D-projection, etc.
0093      *
0094      *  @return the type of the mc particle
0095      */
0096     MCParticleType GetMCParticleType() const;
0097 
0098     /**
0099      *  @brief  Whether the pfo target been set
0100      *
0101      *  @return boolean
0102      */
0103     bool IsPfoTargetSet() const;
0104 
0105     /**
0106      *  @brief  Get pfo target particle
0107      * 
0108      *  @return the address of the pfo target
0109      */
0110     const MCParticle *GetPfoTarget() const;
0111 
0112     /**
0113      *  @brief  Get the mc particle unique identifier
0114      * 
0115      *  @return the mc particle unique identifier
0116      */
0117     Uid GetUid() const;
0118 
0119     /**
0120      *  @brief  Get list of parents of mc particle
0121      * 
0122      *  @return the mc parent particle list
0123      */
0124     const MCParticleList &GetParentList() const;
0125 
0126     /**
0127      *  @brief  Get list of daughters of mc particle
0128      * 
0129      *  @return the mc daughter particle list
0130      */
0131     const MCParticleList &GetDaughterList() const;
0132 
0133     /**
0134      *  @brief  operator< sorting by vertex position, then energy
0135      * 
0136      *  @param  rhs the object for comparison
0137      * 
0138      *  @return boolean
0139      */
0140     bool operator< (const MCParticle &rhs) const;
0141 
0142 protected:
0143     /**
0144      *  @brief  Constructor
0145      * 
0146      *  @param  parameters the mc particle parameters
0147      */
0148     MCParticle(const object_creation::MCParticle::Parameters &parameters);
0149 
0150     /**
0151      *  @brief  Destructor
0152      */
0153     virtual ~MCParticle();
0154 
0155     /**
0156      *  @brief  Add daughter particle
0157      * 
0158      *  @param  mcParticle the daughter particle
0159      */
0160     StatusCode AddDaughter(const MCParticle *const pMCParticle);
0161 
0162     /**
0163      *  @brief  Add parent particle
0164      * 
0165      *  @param  mcParticle the parent particle
0166      */
0167     StatusCode AddParent(const MCParticle *const pMCParticle);
0168 
0169     /**
0170      *  @brief  Remove daughter particle
0171      * 
0172      *  @param  mcParticle the daughter particle
0173      */
0174     StatusCode RemoveDaughter(const MCParticle *const pMCParticle);
0175 
0176     /**
0177      *  @brief  Remove parent particle
0178      * 
0179      *  @param  mcParticle the parent particle
0180      */
0181     StatusCode RemoveParent(const MCParticle *const pMCParticle);
0182 
0183     /**
0184      *  @brief  Set pfo target particle
0185      * 
0186      *  @param  mcParticle the pfo target particle
0187      */
0188     StatusCode SetPfoTarget(const MCParticle *const pMCParticle);
0189 
0190     /**
0191      *  @brief  Remove pfo target particle
0192      */
0193     StatusCode RemovePfoTarget();
0194 
0195     const Uid               m_uid;                      ///< Unique identifier for the mc particle
0196     const float             m_energy;                   ///< The energy of the mc particle, units GeV
0197     const CartesianVector   m_momentum;                 ///< The momentum of the mc particle, units GeV
0198     const CartesianVector   m_vertex;                   ///< The production vertex of the mc particle, units mm
0199     const CartesianVector   m_endpoint;                 ///< The endpoint of the mc particle, units mm
0200     const float             m_innerRadius;              ///< Inner radius of the particle's path, units mm
0201     const float             m_outerRadius;              ///< Outer radius of the particle's path, units mm
0202     const int               m_particleId;               ///< The PDG code of the mc particle
0203     const MCParticleType    m_mcParticleType;           ///< The type of the mc particle, e.g. vertex, 2D-projection, etc.
0204     const MCParticle       *m_pPfoTarget;               ///< The address of the pfo target
0205     MCParticleList          m_daughterList;             ///< The list of mc daughter particles
0206     MCParticleList          m_parentList;               ///< The list of mc parent particles
0207 
0208     friend class MCManager;
0209     friend class InputObjectManager<MCParticle>;
0210     friend class PandoraObjectFactory<object_creation::MCParticle::Parameters, object_creation::MCParticle::Object>;
0211 };
0212 
0213 //------------------------------------------------------------------------------------------------------------------------------------------
0214 
0215 inline bool MCParticle::IsRootParticle() const
0216 {
0217     return m_parentList.empty();
0218 }
0219 
0220 //------------------------------------------------------------------------------------------------------------------------------------------
0221 
0222 inline bool MCParticle::IsPfoTarget() const
0223 {
0224     return (this == m_pPfoTarget);
0225 }
0226 
0227 //------------------------------------------------------------------------------------------------------------------------------------------
0228 
0229 inline bool MCParticle::IsPfoTargetSet() const
0230 {
0231     return (nullptr != m_pPfoTarget);
0232 }
0233 
0234 //------------------------------------------------------------------------------------------------------------------------------------------
0235 
0236 inline Uid MCParticle::GetUid() const
0237 {
0238    return m_uid;
0239 }
0240 
0241 //------------------------------------------------------------------------------------------------------------------------------------------
0242 
0243 inline float MCParticle::GetEnergy() const
0244 {
0245     return m_energy;
0246 }
0247 
0248 //------------------------------------------------------------------------------------------------------------------------------------------
0249 
0250 inline const CartesianVector &MCParticle::GetMomentum() const
0251 {
0252     return m_momentum;
0253 }
0254 
0255 //------------------------------------------------------------------------------------------------------------------------------------------
0256 
0257 inline const CartesianVector &MCParticle::GetVertex() const
0258 {
0259     return m_vertex;
0260 }
0261 
0262 //------------------------------------------------------------------------------------------------------------------------------------------
0263 
0264 inline const CartesianVector &MCParticle::GetEndpoint() const
0265 {
0266     return m_endpoint;
0267 }
0268 
0269 //------------------------------------------------------------------------------------------------------------------------------------------
0270 
0271 inline float MCParticle::GetInnerRadius() const
0272 {
0273     return m_innerRadius;
0274 }
0275 
0276 //------------------------------------------------------------------------------------------------------------------------------------------
0277 
0278 inline float MCParticle::GetOuterRadius() const
0279 {
0280     return m_outerRadius;
0281 }
0282 
0283 //------------------------------------------------------------------------------------------------------------------------------------------
0284 
0285 inline int MCParticle::GetParticleId() const
0286 {
0287     return m_particleId;
0288 }
0289 
0290 //------------------------------------------------------------------------------------------------------------------------------------------
0291 
0292 inline MCParticleType MCParticle::GetMCParticleType() const
0293 {
0294     return m_mcParticleType;
0295 }
0296 
0297 //------------------------------------------------------------------------------------------------------------------------------------------
0298 
0299 inline const MCParticleList &MCParticle::GetParentList() const
0300 {
0301     return m_parentList;
0302 }
0303 
0304 //------------------------------------------------------------------------------------------------------------------------------------------
0305 
0306 inline const MCParticleList &MCParticle::GetDaughterList() const
0307 {
0308     return m_daughterList;
0309 }
0310 
0311 } // namespace pandora
0312 
0313 #endif // #ifndef PANDORA_MC_PARTICLE_H