LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
CosmicRayTaggingTool.h
Go to the documentation of this file.
1 
8 #ifndef LAR_COSMIC_RAY_TAGGING_TOOL_H
9 #define LAR_COSMIC_RAY_TAGGING_TOOL_H 1
10 
12 
14 
15 #include <unordered_map>
16 
17 namespace lar_content
18 {
19 
24 {
25 public:
30 
31  pandora::StatusCode Initialize();
32  void FindAmbiguousPfos(const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm);
33 
34 private:
39  {
40  public:
48  CRCandidate(const pandora::Pandora &pandora, const pandora::ParticleFlowObject *const pPfo, const unsigned int sliceId);
49 
50  const pandora::ParticleFlowObject * const m_pPfo;
51  unsigned int m_sliceId;
52  bool m_canFit;
53  pandora::CartesianVector m_endPoint1;
54  pandora::CartesianVector m_endPoint2;
55  double m_length;
56  double m_curvature;
57  double m_theta;
58 
59  private:
65  void CalculateFitVariables(const ThreeDSlidingFitResult &slidingFitResult);
66  };
67 
68  typedef std::list<CRCandidate> CRCandidateList;
69 
78  bool GetValid3DCluster(const pandora::ParticleFlowObject *const pPfo, const pandora::Cluster *&pCluster3D) const;
79 
80  typedef std::unordered_map<const pandora::ParticleFlowObject *, pandora::PfoList> PfoToPfoListMap;
81 
88  void GetPfoAssociations(const pandora::PfoList &parentCosmicRayPfos, PfoToPfoListMap &pfoAssociationMap) const;
89 
100  bool CheckAssociation(const pandora::CartesianVector &endPoint1, const pandora::CartesianVector &endDir1, const pandora::CartesianVector &endPoint2,
101  const pandora::CartesianVector &endDir2) const;
102 
103  typedef std::unordered_map<const pandora::ParticleFlowObject *, unsigned int> PfoToSliceIdMap;
104 
112  void SliceEvent(const pandora::PfoList &parentCosmicRayPfos, const PfoToPfoListMap &pfoAssociationMap, PfoToSliceIdMap &pfoToSliceIdMap) const;
113 
121  void FillSlice(const pandora::ParticleFlowObject *const pPfo, const PfoToPfoListMap &pfoAssociationMap, pandora::PfoList &slice) const;
122 
130  void GetCRCandidates(const pandora::PfoList &parentCosmicRayPfos, const PfoToSliceIdMap &pfoToSliceIdMap, CRCandidateList &candidates) const;
131 
132  typedef std::unordered_map<const pandora::ParticleFlowObject *, bool> PfoToBoolMap;
133 
140  void CheckIfInTime(const CRCandidateList &candidates, PfoToBoolMap &pfoToInTimeMap) const;
141 
148  void CheckIfContained(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsContainedMap) const;
149 
156  void CheckIfTopToBottom(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsTopToBottomMap) const;
157 
158  typedef std::set<unsigned int> UIntSet;
159 
168  void GetNeutrinoSlices(const CRCandidateList &candidates, const PfoToBoolMap &pfoToInTimeMap, const PfoToBoolMap &pfoToIsContainedMap,
169  UIntSet &neutrinoSliceSet) const;
170 
180  void TagCRMuons(const CRCandidateList &candidates, const PfoToBoolMap &pfoToInTimeMap, const PfoToBoolMap &pfoToIsTopToBottomMap,
181  const UIntSet &neutrinoSliceSet, PfoToBoolMap &pfoToIsLikelyCRMuonMap) const;
182 
183  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
184 
185  typedef std::pair<const ThreeDSlidingFitResult, const ThreeDSlidingFitResult> SlidingFitPair;
186  typedef std::unordered_map<const pandora::ParticleFlowObject *, SlidingFitPair> PfoToSlidingFitsMap;
187  typedef std::vector<pandora::PfoList> SliceList;
188 
194  std::string m_cutMode;
195 
199 
200  unsigned int m_minimumHits;
201 
204  float m_marginY;
205  float m_marginZ;
209 
210  float m_face_Xa;
211  float m_face_Xc;
212  float m_face_Yb;
213  float m_face_Yt;
214  float m_face_Zu;
215  float m_face_Zd;
216 };
217 
218 } // namespace lar_content
219 
220 #endif // #ifndef LAR_COSMIC_RAY_TAGGING_TOOL_H
std::unordered_map< const pandora::ParticleFlowObject *, pandora::PfoList > PfoToPfoListMap
std::unordered_map< const pandora::ParticleFlowObject *, bool > PfoToBoolMap
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)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void TagCRMuons(const CRCandidateList &candidates, const PfoToBoolMap &pfoToInTimeMap, const PfoToBoolMap &pfoToIsTopToBottomMap, const UIntSet &neutrinoSliceSet, PfoToBoolMap &pfoToIsLikelyCRMuonMap) const
Tag Pfos which are likely to be a CR muon.
std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToSliceIdMap
float m_maxNeutrinoCosTheta
The maximum cos(theta) that a Pfo can have to be classified as a likely neutrino. ...
CosmicRayTaggingBaseTool class.
void SliceEvent(const pandora::PfoList &parentCosmicRayPfos, const PfoToPfoListMap &pfoAssociationMap, PfoToSliceIdMap &pfoToSliceIdMap) const
Break the event up into slices of associated Pfos.
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.
CosmicRayTaggingTool class.
float m_positionalUncertainty
The uncertainty in cm for the position of Pfo endpoint in 3D.
void CheckIfTopToBottom(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsTopToBottomMap) const
Check if each candidate is "top to bottom".
double m_theta
Direction made with vertical.
bool m_canFit
If there are a sufficient number of 3D hits to perform a fitting.
Class to encapsulate the logic required determine if a Pfo should or shouldn&#39;t be tagged as a cosmic ...
void CheckIfContained(const CRCandidateList &candidates, PfoToBoolMap &pfoToIsContainedMap) const
Check if each candidate is "contained" (contained = no associations to Y or Z detector faces...
float m_angularUncertainty
The uncertainty in degrees for the angle of a Pfo.
CRCandidate(const pandora::Pandora &pandora, const pandora::ParticleFlowObject *const pPfo, const unsigned int sliceId)
Constructor.
void FillSlice(const pandora::ParticleFlowObject *const pPfo, const PfoToPfoListMap &pfoAssociationMap, pandora::PfoList &slice) const
Fill a slice iteratively using Pfo associations.
std::string m_cutMode
Choose a set of cuts using a keyword - "cautious" = remove as few neutrinos as possible "nominal" = o...
std::list< CRCandidate > CRCandidateList
double m_length
Straight line length of the linear fit.
float m_inTimeMaxX0
The maximum pfo x0 (determined from shifted vertex) to allow pfo to still be considered in time...
Header file for the master algorithm class.
void CheckIfInTime(const CRCandidateList &candidates, PfoToBoolMap &pfoToInTimeMap) const
Check if each candidate is "in time".
CosmicRayTaggingTool()
Default constructor.
pandora::CartesianVector m_endPoint2
Second fitted end point in 3D.
float m_inTimeMargin
The maximum distance outside of the physical detector volume that a Pfo may be to still be considered...
double m_curvature
Measure of the curvature of the track.
void CalculateFitVariables(const ThreeDSlidingFitResult &slidingFitResult)
Calculate all variables which require a fit.
void GetPfoAssociations(const pandora::PfoList &parentCosmicRayPfos, PfoToPfoListMap &pfoAssociationMap) const
Get mapping between Pfos that are associated with it other by pointing.
float m_minCosmicCosTheta
The minimum cos(theta) that a Pfo can have to be classified as a likely CR muon.
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...
Header file for the lar three dimensional sliding fit result class.
std::vector< pandora::PfoList > SliceList
float m_marginZ
The minimum distance from a detector Z-face for a Pfo to be associated.
float m_marginY
The minimum distance from a detector Y-face for a Pfo to be associated.
float m_maxCosmicCurvature
The maximum curvature that a Pfo can have to be classified as a likely CR muon.
MasterAlgorithm class.
float m_maxAssociationDist
The maximum distance from endpoint to point of closest approach, typically a multiple of LAr radiatio...
unsigned int m_minimumHits
The minimum number of hits for a Pfo to be considered.
std::unordered_map< const pandora::ParticleFlowObject *, SlidingFitPair > PfoToSlidingFitsMap
std::pair< const ThreeDSlidingFitResult, const ThreeDSlidingFitResult > SlidingFitPair
void GetCRCandidates(const pandora::PfoList &parentCosmicRayPfos, const PfoToSliceIdMap &pfoToSliceIdMap, CRCandidateList &candidates) const
Make a list of CRCandidates.
void GetNeutrinoSlices(const CRCandidateList &candidates, const PfoToBoolMap &pfoToInTimeMap, const PfoToBoolMap &pfoToIsContainedMap, UIntSet &neutrinoSliceSet) const
Get the slice indices which contain a likely neutrino Pfo.
pandora::CartesianVector m_endPoint1
First fitted end point in 3D.
const pandora::ParticleFlowObject *const m_pPfo
Address of the candidate Pfo.