LArSoft  v09_93_00
Liquid Argon Software toolkit - https://larsoft.org/
TestBeamCosmicRayTaggingTool.h
Go to the documentation of this file.
1 
8 #ifndef LAR_TEST_BEAM_COSMIC_RAY_TAGGING_TOOL_H
9 #define LAR_TEST_BEAM_COSMIC_RAY_TAGGING_TOOL_H 1
10 
13 
15 
16 #include <unordered_map>
17 
18 namespace lar_content
19 {
20 
25 {
26 public:
31 
32  pandora::StatusCode Initialize();
40  void FindAmbiguousPfos(const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm);
41 
42 private:
47  {
48  public:
56  CRCandidate(const pandora::Pandora &pandora, const pandora::ParticleFlowObject *const pPfo, const unsigned int sliceId);
57 
58  const pandora::ParticleFlowObject *const m_pPfo;
59  unsigned int m_sliceId;
60  bool m_canFit;
61  pandora::CartesianVector m_endPoint1;
62  pandora::CartesianVector m_endPoint2;
63  double m_length;
64  double m_curvature;
65  double m_theta;
66 
67  private:
73  void CalculateFitVariables(const ThreeDSlidingFitResult &slidingFitResult);
74  };
75 
76  typedef std::list<CRCandidate> CRCandidateList;
77 
86  bool GetValid3DCluster(const pandora::ParticleFlowObject *const pPfo, const pandora::Cluster *&pCluster3D) const;
87 
88  typedef std::unordered_map<const pandora::ParticleFlowObject *, pandora::PfoList> PfoToPfoListMap;
89 
96  void GetPfoAssociations(const pandora::PfoList &parentCosmicRayPfos, PfoToPfoListMap &pfoAssociationMap) const;
97 
108  bool CheckAssociation(const pandora::CartesianVector &endPoint1, const pandora::CartesianVector &endDir1,
109  const pandora::CartesianVector &endPoint2, const pandora::CartesianVector &endDir2) const;
110 
111  typedef std::unordered_map<const pandora::ParticleFlowObject *, unsigned int> PfoToSliceIdMap;
112 
120  void SliceEvent(const pandora::PfoList &parentCosmicRayPfos, const PfoToPfoListMap &pfoAssociationMap, PfoToSliceIdMap &pfoToSliceIdMap) const;
121 
129  void FillSlice(const pandora::ParticleFlowObject *const pPfo, const PfoToPfoListMap &pfoAssociationMap, pandora::PfoList &slice) const;
130 
138  void GetCRCandidates(const pandora::PfoList &parentCosmicRayPfos, const PfoToSliceIdMap &pfoToSliceIdMap, CRCandidateList &candidates) const;
139 
140  typedef std::unordered_map<const pandora::ParticleFlowObject *, bool> PfoToBoolMap;
141 
148  void CheckIfOutOfTime(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsCosmicRayMap) const;
149 
156  void CheckIfTopToBottom(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsCosmicRayMap) const;
157 
164  void CheckIfTopEntering(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsCosmicRayMap) const;
165 
172  void CheckIfInVetoedTPC(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsCosmicRayMap) const;
173 
174  typedef std::set<unsigned int> UIntSet;
175  typedef std::unordered_map<int, bool> IntBoolMap;
176 
177  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
178 
179  typedef std::pair<const ThreeDSlidingFitResult, const ThreeDSlidingFitResult> SlidingFitPair;
180  typedef std::unordered_map<const pandora::ParticleFlowObject *, SlidingFitPair> PfoToSlidingFitsMap;
181  typedef std::vector<pandora::PfoList> SliceList;
182 
186 
187  unsigned int m_minimumHits;
188 
191  float m_marginY;
192 
196 
198  std::vector<unsigned int> m_vetoedTPCs;
199 
200  float m_face_Xa;
201  float m_face_Xc;
202  float m_face_Yb;
203  float m_face_Yt;
204  float m_face_Zu;
205  float m_face_Zd;
206 };
207 
208 } // namespace lar_content
209 
210 #endif // #ifndef LAR_TETS_BEAM_COSMIC_RAY_TAGGING_TOOL_H
bool m_canFit
If there are a sufficient number of 3D hits to perform a fitting.
const pandora::ParticleFlowObject *const m_pPfo
Address of the candidate Pfo.
void GetCRCandidates(const pandora::PfoList &parentCosmicRayPfos, const PfoToSliceIdMap &pfoToSliceIdMap, CRCandidateList &candidates) const
Make a list of CRCandidates.
CosmicRayTaggingBaseTool class.
std::unordered_map< const pandora::ParticleFlowObject *, bool > PfoToBoolMap
pandora::CartesianVector m_endPoint2
Second fitted end point in 3D.
float m_marginY
The minimum distance from a detector Y-face for a Pfo to be associated.
void FindAmbiguousPfos(const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm)
Find the list of ambiguous pfos (could represent cosmic-ray muons or neutrinos)
float m_angularUncertainty
The uncertainty in degrees for the angle of a Pfo.
double m_length
Straight line length of the linear fit.
void CheckIfInVetoedTPC(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsCosmicRayMap) const
Check if each candidate has its highest value in one of the vetoed TPC volumes.
double m_curvature
Measure of the curvature of the track.
void SliceEvent(const pandora::PfoList &parentCosmicRayPfos, const PfoToPfoListMap &pfoAssociationMap, PfoToSliceIdMap &pfoToSliceIdMap) const
Break the event up into slices of associated Pfos.
CRCandidate(const pandora::Pandora &pandora, const pandora::ParticleFlowObject *const pPfo, const unsigned int sliceId)
Constructor.
bool GetValid3DCluster(const pandora::ParticleFlowObject *const pPfo, const pandora::Cluster *&pCluster3D) const
Get the 3D calo hit cluster associated with a given Pfo, and check if it has sufficient hits...
void GetPfoAssociations(const pandora::PfoList &parentCosmicRayPfos, PfoToPfoListMap &pfoAssociationMap) const
Get mapping between Pfos that are associated with each other by pointing.
Header file for the master algorithm class.
unsigned int m_minimumHits
The minimum number of hits for a Pfo to be considered.
bool CheckAssociation(const pandora::CartesianVector &endPoint1, const pandora::CartesianVector &endDir1, const pandora::CartesianVector &endPoint2, const pandora::CartesianVector &endDir2) const
Check whethe two Pfo endpoints are associated by distance of closest approach.
float m_inTimeMargin
The maximum distance outside of the physical detector volume that a Pfo may be to still be considered...
Header file for the lar three dimensional sliding fit result class.
bool m_tagOutOfTime
Whether to tag all out-of-time particles as cosmic rays.
float m_inTimeMaxX0
The maximum pfo x0 (determined from shifted vertex) to allow pfo to still be considered in time...
void FillSlice(const pandora::ParticleFlowObject *const pPfo, const PfoToPfoListMap &pfoAssociationMap, pandora::PfoList &slice) const
Fill a slice iteratively using Pfo associations.
Header file for the cosmic ray tagging tool base class.
bool m_tagTopEntering
Whether to tag all top entering particles as cosmic rays.
MasterAlgorithm class.
std::unordered_map< const pandora::ParticleFlowObject *, pandora::PfoList > PfoToPfoListMap
std::pair< const ThreeDSlidingFitResult, const ThreeDSlidingFitResult > SlidingFitPair
float m_maxAssociationDist
The maximum distance from endpoint to point of closest approach, typically a multiple of LAr radiatio...
pandora::CartesianVector m_endPoint1
First fitted end point in 3D.
bool m_tagInVetoedTPCs
Whether to tag all particles with their highest position in vetoed TPCs as cosmic rays...
std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToSliceIdMap
void CalculateFitVariables(const ThreeDSlidingFitResult &slidingFitResult)
Calculate all variables which require a fit.
Class to encapsulate the logic required determine if a Pfo should or shouldn&#39;t be tagged as a cosmic ...
void CheckIfTopEntering(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsCosmicRayMap) const
Check if each candidate enters from the top of the detector.
void CheckIfOutOfTime(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsCosmicRayMap) const
Check if each candidate is "in time".
bool m_tagTopToBottom
Whether to tag all top-to-bottom particles as cosmic rays.
std::vector< unsigned int > m_vetoedTPCs
List of vetoed TPCs for tagging cosmic rays.
void CheckIfTopToBottom(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsCosmicRayMap) const
Check if each candidate is "top to bottom".
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::unordered_map< const pandora::ParticleFlowObject *, SlidingFitPair > PfoToSlidingFitsMap
float m_positionalUncertainty
The uncertainty in cm for the position of Pfo endpoint in 3D.