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/Track.h
0003  * 
0004  *  @brief  Header file for the track class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_TRACK_H
0009 #define PANDORA_TRACK_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  Track class
0024  */
0025 class Track 
0026 {
0027 public:
0028     /**
0029      *  @brief  Get the 2D impact parameter wrt (0,0)
0030      * 
0031      *  @return the 2D impact parameter wrt (0,0)
0032      */
0033     float GetD0() const;
0034 
0035     /**
0036      *  @brief  Get the z coordinate at the 2D distance of closest approach
0037      * 
0038      *  @return the z coordinate at the 2D distance of closest approach
0039      */
0040     float GetZ0() const;
0041 
0042     /**
0043      *  @brief  Get the PDG code of the tracked particle
0044      *
0045      *  @return the PDG code of the tracked particle
0046      */
0047     int GetParticleId() const; 
0048 
0049     /**
0050      *  @brief  Get the charge of the tracked particle
0051      * 
0052      *  @return the charge of the tracked particle
0053      */
0054     int GetCharge() const;
0055 
0056     /**
0057      *  @brief  Get the mass of the tracked particle, units GeV
0058      * 
0059      *  @return the mass of the tracked particle
0060      */
0061     float GetMass() const;
0062 
0063     /**
0064      *  @brief  Get the track momentum at the 2D distance of closest approach
0065      * 
0066      *  @return the track momentum at the 2D distance of closest approach
0067      */
0068     const CartesianVector &GetMomentumAtDca() const;
0069 
0070     /**
0071      *  @brief  Get the track energy at the 2D distance of closest approach
0072      * 
0073      *  @return the track energy at the 2D distance of closest approach
0074      */
0075     float GetEnergyAtDca() const;
0076 
0077     /**
0078      *  @brief  Get the track state at the start of the track
0079      * 
0080      *  @return the track state at the start of the track
0081      */
0082     const TrackState &GetTrackStateAtStart() const;
0083 
0084     /**
0085      *  @brief  Get the track state at the end of the track
0086      * 
0087      *  @return the track state at the end of the track
0088      */
0089     const TrackState &GetTrackStateAtEnd() const;
0090 
0091     /**
0092      *  @brief  Get the (sometimes projected) track state at the calorimeter
0093      * 
0094      *  @return the track state at the calorimeter
0095      */
0096     const TrackState &GetTrackStateAtCalorimeter() const;
0097 
0098     /**
0099      *  @brief  Get the (sometimes projected) time at the calorimeter
0100      * 
0101      *  @return the time at the calorimeter
0102      */
0103     float GetTimeAtCalorimeter() const;
0104 
0105     /**
0106      *  @brief  Whether the track reaches the calorimeter
0107      * 
0108      *  @return boolean
0109      */
0110     bool ReachesCalorimeter() const;
0111 
0112     /**
0113      *  @brief  Whether the calorimeter projection is to an endcap
0114      * 
0115      *  @return boolean
0116      */
0117     bool IsProjectedToEndCap() const;
0118 
0119     /**
0120      *  @brief  Whether track should form a pfo, if it has an associated cluster
0121      * 
0122      *  @return boolean
0123      */
0124     bool CanFormPfo() const;
0125 
0126     /**
0127      *  @brief  Whether track should form a pfo, even if it has no associated cluster
0128      * 
0129      *  @return boolean
0130      */
0131     bool CanFormClusterlessPfo() const;
0132 
0133     /**
0134      *  @brief  Whether the track has an associated cluster
0135      * 
0136      *  @return boolean
0137      */
0138     bool HasAssociatedCluster() const;
0139 
0140     /**
0141      *  @brief  Get address of the cluster associated with the track
0142      * 
0143      *  @return the address of the cluster
0144      */
0145     const Cluster *GetAssociatedCluster() const;
0146 
0147     /**
0148      *  @brief  Get mc particle weight map for the track
0149      * 
0150      *  @return the mc particle weight map
0151      */
0152     const MCParticleWeightMap &GetMCParticleWeightMap() const;
0153 
0154     /**
0155      *  @brief  Get the address of the parent track in the user framework
0156      *
0157      *  @param  the address of the parent track in the user framework
0158      */
0159     const void *GetParentAddress() const;
0160 
0161     /**
0162      *  @brief  Get the parent track list
0163      * 
0164      *  @return the parent track list
0165      */
0166     const TrackList &GetParentList() const;
0167 
0168     /**
0169      *  @brief  Get the sibling track list
0170      * 
0171      *  @return the sibling track list
0172      */
0173     const TrackList &GetSiblingList() const;
0174 
0175     /**
0176      *  @brief  Get the daughter track list
0177      * 
0178      *  @return the daughter track list
0179      */
0180     const TrackList &GetDaughterList() const;
0181 
0182     /**
0183      *  @brief  Whether the track is available to be added to a particle flow object
0184      * 
0185      *  @return boolean
0186      */
0187     bool IsAvailable() const;
0188 
0189     /**
0190      *  @brief  operator< sorting by position at calorimeter, then energy at the 2D distance of closest approach
0191      * 
0192      *  @param  rhs the object for comparison
0193      * 
0194      *  @return boolean
0195      */
0196     bool operator< (const Track &rhs) const;
0197 
0198 protected:
0199     /**
0200      *  @brief  Constructor
0201      * 
0202      *  @param  parameters the track parameters
0203      */
0204     Track(const object_creation::Track::Parameters &parameters);
0205 
0206     /**
0207      *  @brief  Destructor
0208      */
0209     virtual ~Track();
0210 
0211     /**
0212      *  @brief  Set the mc particles associated with the track
0213      * 
0214      *  @param  mcParticleWeightMap the mc particle weight map
0215      */
0216     void SetMCParticleWeightMap(const MCParticleWeightMap &mcParticleWeightMap);
0217 
0218     /**
0219      *  @brief  Remove the mc particles associated with the track
0220      */
0221     void RemoveMCParticles();
0222 
0223     /**
0224      *  @brief  Set the cluster associated with the track
0225      * 
0226      *  @param  pCluster the address of the associated cluster
0227      */
0228     StatusCode SetAssociatedCluster(const Cluster *const pCluster);
0229 
0230     /**
0231      *  @brief  Remove the association with a cluster
0232      *
0233      *  @param  pCluster the address of the cluster with which the track is no longer associated
0234      */
0235     StatusCode RemoveAssociatedCluster(const Cluster *const pCluster);
0236 
0237     /**
0238      *  @brief  Add a parent track to the parent track list
0239      * 
0240      *  @param  pTrack the address of the parent track
0241      */
0242     StatusCode AddParent(const Track *const pTrack);
0243 
0244     /**
0245      *  @brief  Add a daughter track to the daughter track list
0246      * 
0247      *  @param  pTrack the address of the daughter track
0248      */
0249     StatusCode AddDaughter(const Track *const pTrack);
0250 
0251     /**
0252      *  @brief  Add a sibling track to the sibling track list
0253      * 
0254      *  @param  pTrack the address of the sibling track
0255      */
0256     StatusCode AddSibling(const Track *const pTrack);
0257 
0258     /**
0259      *  @brief  Set availability of track to be added to a particle flow object
0260      * 
0261      *  @param  isAvailable the track availability
0262      */
0263     void SetAvailability(bool isAvailable);
0264 
0265     const float             m_d0;                       ///< The 2D impact parameter wrt (0,0), units mm
0266     const float             m_z0;                       ///< The z coordinate at the 2D distance of closest approach, units mm
0267     const int               m_particleId;               ///< The PDG code of the tracked particle
0268     const int               m_charge;                   ///< The charge of the tracked particle
0269     const float             m_mass;                     ///< The mass of the tracked particle, units GeV
0270     const CartesianVector   m_momentumAtDca;            ///< The momentum vector at the 2D distance of closest approach, units GeV
0271     const float             m_energyAtDca;              ///< The track energy at the 2D distance of closest approach, units GeV
0272     const TrackState        m_trackStateAtStart;        ///< The track state at the start of the track, units mm and GeV
0273     const TrackState        m_trackStateAtEnd;          ///< The track state at the end of the track, units mm and GeV
0274     const TrackState        m_trackStateAtCalorimeter;  ///< The (sometimes projected) track state at the calorimeter, units mm and GeV
0275     const float             m_timeAtCalorimeter;        ///< The (sometimes projected) time at the calorimeter, units ns
0276     const bool              m_reachesCalorimeter;       ///< Whether the track actually reaches the calorimeter
0277     const bool              m_isProjectedToEndCap;      ///< Whether the calorimeter projection is to an endcap
0278     const bool              m_canFormPfo;               ///< Whether track should form a pfo, if it has an associated cluster
0279     const bool              m_canFormClusterlessPfo;    ///< Whether track should form a pfo, even if it has no associated cluster
0280     const Cluster          *m_pAssociatedCluster;       ///< The address of an associated cluster
0281     MCParticleWeightMap     m_mcParticleWeightMap;      ///< The mc particle weight map
0282     const void             *m_pParentAddress;           ///< The address of the parent track in the user framework
0283     TrackList               m_parentTrackList;          ///< The list of parent track addresses
0284     TrackList               m_siblingTrackList;         ///< The list of sibling track addresses
0285     TrackList               m_daughterTrackList;        ///< The list of daughter track addresses
0286     bool                    m_isAvailable;              ///< Whether the track is available to be added to a particle flow object
0287 
0288     friend class TrackManager;
0289     friend class InputObjectManager<Track>;
0290     friend class PandoraObjectFactory<object_creation::Track::Parameters, object_creation::Track::Object>;
0291 };
0292 
0293 //------------------------------------------------------------------------------------------------------------------------------------------
0294 
0295 inline float Track::GetD0() const
0296 {
0297     return m_d0;
0298 }
0299 
0300 //------------------------------------------------------------------------------------------------------------------------------------------
0301 
0302 inline float Track::GetZ0() const
0303 {
0304     return m_z0;
0305 }
0306 
0307 //------------------------------------------------------------------------------------------------------------------------------------------
0308 
0309 inline int Track::GetParticleId() const
0310 {
0311     return m_particleId;
0312 }
0313 
0314 //------------------------------------------------------------------------------------------------------------------------------------------
0315 
0316 inline int Track::GetCharge() const
0317 {
0318     return m_charge;
0319 }
0320 
0321 //------------------------------------------------------------------------------------------------------------------------------------------
0322 
0323 inline float Track::GetMass() const
0324 {
0325     return m_mass;
0326 }
0327 
0328 //------------------------------------------------------------------------------------------------------------------------------------------
0329 
0330 inline const CartesianVector &Track::GetMomentumAtDca() const
0331 {
0332     return m_momentumAtDca;
0333 }
0334 
0335 //------------------------------------------------------------------------------------------------------------------------------------------
0336 
0337 inline float Track::GetEnergyAtDca() const
0338 {
0339     return m_energyAtDca;
0340 }
0341 
0342 //------------------------------------------------------------------------------------------------------------------------------------------
0343 
0344 inline const TrackState &Track::GetTrackStateAtStart() const
0345 {
0346     return m_trackStateAtStart;
0347 }
0348 
0349 //------------------------------------------------------------------------------------------------------------------------------------------
0350 
0351 inline const TrackState &Track::GetTrackStateAtEnd() const
0352 {
0353     return m_trackStateAtEnd;
0354 }
0355 
0356 //------------------------------------------------------------------------------------------------------------------------------------------
0357 
0358 inline const TrackState &Track::GetTrackStateAtCalorimeter() const
0359 {
0360     return m_trackStateAtCalorimeter;
0361 }
0362 
0363 //------------------------------------------------------------------------------------------------------------------------------------------
0364 
0365 inline float Track::GetTimeAtCalorimeter() const
0366 {
0367     return m_timeAtCalorimeter;
0368 }
0369 
0370 //------------------------------------------------------------------------------------------------------------------------------------------
0371 
0372 inline bool Track::ReachesCalorimeter() const
0373 {
0374     return m_reachesCalorimeter;
0375 }
0376 
0377 //------------------------------------------------------------------------------------------------------------------------------------------
0378 
0379 inline bool Track::IsProjectedToEndCap() const
0380 {
0381     return m_isProjectedToEndCap;
0382 }
0383 
0384 //------------------------------------------------------------------------------------------------------------------------------------------
0385 
0386 inline bool Track::CanFormPfo() const
0387 {
0388     return m_canFormPfo;
0389 }
0390 
0391 //------------------------------------------------------------------------------------------------------------------------------------------
0392 
0393 inline bool Track::CanFormClusterlessPfo() const
0394 {
0395     return m_canFormClusterlessPfo;
0396 }
0397 
0398 //------------------------------------------------------------------------------------------------------------------------------------------
0399 
0400 inline bool Track::HasAssociatedCluster() const
0401 {
0402     return (nullptr != m_pAssociatedCluster);
0403 }
0404 
0405 //------------------------------------------------------------------------------------------------------------------------------------------
0406 
0407 inline const MCParticleWeightMap &Track::GetMCParticleWeightMap() const
0408 {
0409     return m_mcParticleWeightMap;
0410 }
0411 
0412 //------------------------------------------------------------------------------------------------------------------------------------------
0413 
0414 inline const void *Track::GetParentAddress() const
0415 {
0416     return m_pParentAddress;
0417 }
0418 
0419 //------------------------------------------------------------------------------------------------------------------------------------------
0420 
0421 inline const TrackList &Track::GetParentList() const
0422 {
0423     return m_parentTrackList;
0424 }
0425 
0426 //------------------------------------------------------------------------------------------------------------------------------------------
0427 
0428 inline const TrackList &Track::GetSiblingList() const
0429 {
0430     return m_siblingTrackList;
0431 }
0432 
0433 //------------------------------------------------------------------------------------------------------------------------------------------
0434 
0435 inline const TrackList &Track::GetDaughterList() const
0436 {
0437     return m_daughterTrackList;
0438 }
0439 
0440 //------------------------------------------------------------------------------------------------------------------------------------------
0441 
0442 inline bool Track::IsAvailable() const
0443 {
0444     return m_isAvailable;
0445 }
0446 
0447 //------------------------------------------------------------------------------------------------------------------------------------------
0448 
0449 inline void Track::SetAvailability(bool isAvailable)
0450 {
0451     m_isAvailable = isAvailable;
0452 }
0453 
0454 } // namespace pandora
0455 
0456 #endif // #ifndef PANDORA_TRACK_H