PfoCreator.h
Go to the documentation of this file.
1 #ifndef PFO_CREATOR_H
2 #define PFO_CREATOR_H 1
3 
5 
6 #include "Api/PandoraApi.h"
7 
9 
14 
15 #include "RecoAlg/ClusterShapes.h"
16 
17 namespace gar {
18  namespace gar_pandora {
19 
20  class PfoCreator
21  {
22  public:
23 
24  typedef std::unique_ptr< std::vector<rec::PFParticle> > PFParticleCollection;
25  typedef std::unique_ptr< std::vector<rec::Cluster> > ClusterCollection;
26 
27  class Settings
28  {
29  public:
30  Settings();
31 
32  float m_emStochasticTerm = 0; ///< The stochastic term for EM shower energy resolution
33  float m_emConstantTerm = 0; ///< The constant term for EM shower energy resolution
34  float m_hadStochasticTerm = 0; ///< The stochastic term for HAD shower energy resolution
35  float m_hadConstantTerm = 0; ///< The constant term for HAD shower energy resolution
36  };
37 
38  PfoCreator(const Settings &settings, const pandora::Pandora *const pPandora, const RotationTransformation *const pRotation);
39 
40  ~PfoCreator();
41 
42  pandora::StatusCode CreateParticleFlowObjects(art::Event &pEvent);
43 
44  private:
45  /**
46  * @brief initialise sub detector name strings
47  *
48  * @param subDetectorNames to receive the list of sub detector names
49  */
50  void InitialiseSubDetectorNames(pandora::StringVector &subDetectorNames) const;
51 
52  /**
53  * @brief Set sub detector energies for a cluster
54  *
55  * @param subDetectorNames the list of sub detector names
56  * @param pLcioCluster the address of the lcio cluster to be set sub detector energies
57  * @param pandoraCaloHitList the pandora calorimeter hit list
58  * @param hitE the vector to receive the energy of hits
59  * @param hitX the vector to receive the x position of hits
60  * @param hitY the vector to receive the y position of hits
61  * @param hitZ the vector to receive the z position of hits
62  */
63  void SetClusterSubDetectorEnergies(const pandora::StringVector &subDetectorNames, const pandora::CaloHitList &pandoraCaloHitList, pandora::FloatVector &hitE, pandora::FloatVector &hitX, pandora::FloatVector &hitY, pandora::FloatVector &hitZ) const;
64 
65  /**
66  * @brief Set cluster energies and errors
67  *
68  * @param pPandoraPfo the address of the pandora pfo
69  * @param pPandoraCluster the address of the pandora cluster
70  * @param pLcioCluster the address of the lcio cluster to be set energies and erros
71  * @param clusterCorrectEnergy a number to receive the cluster correct energy
72  */
73  void SetClusterEnergyAndError(const pandora::ParticleFlowObject *const pPandoraPfo, const pandora::Cluster *const pPandoraCluster, gar::rec::Cluster &pCluster, float &clusterCorrectEnergy) const;
74 
75  /**
76  * @brief Set cluster position, errors and other shape info, by calculating culster shape first
77  *
78  * @param nHitsInCluster number of hits in cluster
79  * @param hitE the vector of the energy of hits
80  * @param hitX the vector of the x position of hits
81  * @param hitY the vector of the y position of hits
82  * @param hitZ the vector of the z position of hits
83  * @param pLcioCluster the lcio cluster to be set positions and errors
84  * @param clusterPosition a CartesianVector to receive the cluster position
85  */
86  void SetClusterPositionAndError(const unsigned int nHitsInCluster, pandora::FloatVector &hitE, pandora::FloatVector &hitX, pandora::FloatVector &hitY, pandora::FloatVector &hitZ, gar::rec::Cluster &pCluster, pandora::CartesianVector &clusterPositionVec) const;
87 
88  /**
89  * @brief Calculate reference point for pfo with tracks
90  *
91  * @param pPandoraPfo the address of the pandora pfo
92  * @param referencePoint a CartesianVector to receive the reference point
93  */
94  pandora::StatusCode CalculateTrackBasedReferencePoint(const pandora::ParticleFlowObject *const pPandoraPfo, pandora::CartesianVector &referencePoint) const;
95 
96  /**
97  * @brief Set reference point of the reconstructed particle
98  *
99  * @param referencePoint a CartesianVector of the reference point
100  * @param pReconstructedParticle the address of the reconstructed particle to be reference point
101  */
102  void SetRecoParticleReferencePoint(const pandora::CartesianVector &referencePoint, gar::rec::PFParticle &pReconstructedParticle) const;
103 
104  /**
105  * @brief Add tracks to reconstructed particle
106  *
107  * @param pPandoraPfo the address of the pandora pfo
108  * @param pReconstructedParticle the address of the reconstructed particle to be added tracks
109  */
110  void AddTracksToRecoParticle(const pandora::ParticleFlowObject *const pPandoraPfo, gar::rec::PFParticle &pReconstructedParticle) const;
111 
112  /**
113  * @brief Set properties of reconstructed particle from pandora pfo
114  *
115  * @param pPandoraPfo the address of the pandora pfo
116  * @param pReconstructedParticle the address of the reconstructed particle to be set properties
117  */
118  void SetRecoParticlePropertiesFromPFO(const pandora::ParticleFlowObject *const pPandoraPfo, gar::rec::PFParticle &pReconstructedParticle) const;
119 
120  /**
121  * @brief Whether parent and daughter tracks are associated with the same pfo
122  *
123  * @param pPandoraTrack the address of the pandora track
124  * @param allTrackList list of all tracks associated with reconstructed particle
125  *
126  * @return boolean
127  */
128  bool IsValidParentTrack(const pandora::Track *const pPandoraTrack, const pandora::TrackList &allTrackList) const;
129 
130  /**
131  * @brief Whether sibling tracks are associated with the same pfo
132  *
133  * @param pPandoraTrack the address of the pandora track
134  * @param allTrackList list of all tracks associated with reconstructed particle
135  *
136  * @return boolean
137  */
138  bool HasValidSiblingTrack(const pandora::Track *const pPandoraTrack, const pandora::TrackList &allTrackList) const;
139 
140  /**
141  * @brief Whether the track is the closest (of those associated with the same pfo) to the interaction point
142  *
143  * @param pPandoraTrack the address of the pandora track
144  * @param allTrackList list of all tracks associated to reconstructed particle
145  *
146  * @return boolean
147  */
148  bool IsClosestTrackToIP(const pandora::Track *const pPandoraTrack, const pandora::TrackList &allTrackList) const;
149 
150  /**
151  * @brief Whether at least one track sibling track is associated to the reconstructed particle
152  *
153  * @param pPandoraTrack the address of the pandora track
154  * @param allTrackList list of all tracks associated to reconstructed particle
155  *
156  * @return boolean
157  */
158  bool AreAnyOtherSiblingsInList(const pandora::Track *const pPandoraTrack, const pandora::TrackList &allTrackList) const;
159 
160  const Settings m_settings; ///< The pfo creator settings
161  const pandora::Pandora &m_pandora; ///< Reference to the pandora object from which to extract the pfos
163  };
164  }
165 }
166 
167 #endif // #ifndef PFO_CREATOR_H
void SetRecoParticleReferencePoint(const pandora::CartesianVector &referencePoint, gar::rec::PFParticle &pReconstructedParticle) const
Set reference point of the reconstructed particle.
Definition: PfoCreator.cxx:356
bool AreAnyOtherSiblingsInList(const pandora::Track *const pPandoraTrack, const pandora::TrackList &allTrackList) const
Whether at least one track sibling track is associated to the reconstructed particle.
Definition: PfoCreator.cxx:341
bool IsClosestTrackToIP(const pandora::Track *const pPandoraTrack, const pandora::TrackList &allTrackList) const
Whether the track is the closest (of those associated with the same pfo) to the interaction point...
Definition: PfoCreator.cxx:319
std::unique_ptr< std::vector< rec::PFParticle > > PFParticleCollection
Definition: PfoCreator.h:24
pandora::StatusCode CalculateTrackBasedReferencePoint(const pandora::ParticleFlowObject *const pPandoraPfo, pandora::CartesianVector &referencePoint) const
Calculate reference point for pfo with tracks.
Definition: PfoCreator.cxx:204
float m_hadConstantTerm
The constant term for HAD shower energy resolution.
Definition: PfoCreator.h:35
bool IsValidParentTrack(const pandora::Track *const pPandoraTrack, const pandora::TrackList &allTrackList) const
Whether parent and daughter tracks are associated with the same pfo.
Definition: PfoCreator.cxx:273
void SetClusterEnergyAndError(const pandora::ParticleFlowObject *const pPandoraPfo, const pandora::Cluster *const pPandoraCluster, gar::rec::Cluster &pCluster, float &clusterCorrectEnergy) const
Set cluster energies and errors.
Definition: PfoCreator.cxx:164
PfoCreator(const Settings &settings, const pandora::Pandora *const pPandora, const RotationTransformation *const pRotation)
Definition: PfoCreator.cxx:20
std::set< const gar::rec::Track * > TrackList
Definition: TrackCreator.h:14
float m_hadStochasticTerm
The stochastic term for HAD shower energy resolution.
Definition: PfoCreator.h:34
const pandora::Pandora & m_pandora
Reference to the pandora object from which to extract the pfos.
Definition: PfoCreator.h:161
const RotationTransformation & m_rotation
Definition: PfoCreator.h:162
float m_emConstantTerm
The constant term for EM shower energy resolution.
Definition: PfoCreator.h:33
void SetRecoParticlePropertiesFromPFO(const pandora::ParticleFlowObject *const pPandoraPfo, gar::rec::PFParticle &pReconstructedParticle) const
Set properties of reconstructed particle from pandora pfo.
Definition: PfoCreator.cxx:377
bool HasValidSiblingTrack(const pandora::Track *const pPandoraTrack, const pandora::TrackList &allTrackList) const
Whether sibling tracks are associated with the same pfo.
Definition: PfoCreator.cxx:298
void SetClusterSubDetectorEnergies(const pandora::StringVector &subDetectorNames, const pandora::CaloHitList &pandoraCaloHitList, pandora::FloatVector &hitE, pandora::FloatVector &hitX, pandora::FloatVector &hitY, pandora::FloatVector &hitZ) const
Set sub detector energies for a cluster.
Definition: PfoCreator.cxx:140
float m_emStochasticTerm
The stochastic term for EM shower energy resolution.
Definition: PfoCreator.h:32
void SetClusterPositionAndError(const unsigned int nHitsInCluster, pandora::FloatVector &hitE, pandora::FloatVector &hitX, pandora::FloatVector &hitY, pandora::FloatVector &hitZ, gar::rec::Cluster &pCluster, pandora::CartesianVector &clusterPositionVec) const
Set cluster position, errors and other shape info, by calculating culster shape first.
Definition: PfoCreator.cxx:182
General GArSoft Utilities.
void InitialiseSubDetectorNames(pandora::StringVector &subDetectorNames) const
initialise sub detector name strings
Definition: PfoCreator.cxx:133
void AddTracksToRecoParticle(const pandora::ParticleFlowObject *const pPandoraPfo, gar::rec::PFParticle &pReconstructedParticle) const
Add tracks to reconstructed particle.
Definition: PfoCreator.cxx:364
pandora::StatusCode CreateParticleFlowObjects(art::Event &pEvent)
Definition: PfoCreator.cxx:35
std::vector< string > StringVector
Definition: fcldump.cxx:29
std::unique_ptr< std::vector< rec::Cluster > > ClusterCollection
Definition: PfoCreator.h:25
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Definition: Track.h:1036
Dft::FloatVector FloatVector
const Settings m_settings
The pfo creator settings.
Definition: PfoCreator.h:160