LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
NViewDeltaRayMatchingAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_N_VIEW_DELTA_RAY_MATCHING_ALGORITHM_H
9 #define LAR_N_VIEW_DELTA_RAY_MATCHING_ALGORITHM_H 1
10 
12 
14 
16 
17 namespace lar_content
18 {
22 template <typename T>
24 {
25 public:
26  typedef std::map<const pandora::CaloHit *, const pandora::Cluster *> HitToClusterMap;
27  typedef std::map<const pandora::Cluster *, const pandora::ParticleFlowObject *> ClusterToPfoMap;
28  typedef std::map<const pandora::Cluster *, pandora::ClusterList> ClusterProximityMap;
29 
32  typedef std::vector<HitKDNode2D> HitKDNode2DList;
33 
34  typedef std::vector<pandora::HitType> HitTypeVector;
35 
40 
50  pandora::StatusCode GetMuonCluster(
51  const pandora::PfoList &commonMuonPfoList, const pandora::HitType hitType, const pandora::Cluster *&pMuonCluster) const;
52 
63  pandora::StatusCode PerformThreeViewMatching(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2,
64  const pandora::Cluster *const pCluster3, float &reducedChiSquared) const;
65 
79  pandora::StatusCode PerformThreeViewMatching(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV,
80  const pandora::Cluster *const pClusterW, float &chiSquaredSum, unsigned int &nSamplingPoints, unsigned int &nMatchedSamplingPoints,
81  XOverlap &XOverlap) const;
82 
93  pandora::StatusCode PerformThreeViewMatching(const pandora::CaloHitList &pCluster1, const pandora::CaloHitList &pCluster2,
94  const pandora::CaloHitList &pCluster3, float &reducedChiSquared) const;
95 
109  pandora::StatusCode PerformThreeViewMatching(const pandora::CaloHitList &clusterU, const pandora::CaloHitList &clusterV,
110  const pandora::CaloHitList &clusterW, float &chiSquaredSum, unsigned int &nSamplingPoints, unsigned int &nMatchedSamplingPoints,
111  XOverlap &XOverlap) const;
112 
122  pandora::StatusCode ProjectMuonPositions(const pandora::HitType &thirdViewHitType, const pandora::ParticleFlowObject *const pParentMuon,
123  pandora::CartesianPointVector &projectedPositions) const;
124 
134  pandora::StatusCode GetProjectedPositions(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2,
135  pandora::CartesianPointVector &projectedPositions) const;
136 
150  pandora::StatusCode CollectHitsFromMuon(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2,
151  const pandora::Cluster *const pThirdViewCluster, const pandora::ParticleFlowObject *const pParentMuon,
152  const float minDistanceFromMuon, const float maxDistanceToCollected, pandora::CaloHitList &collectedHits) const;
153 
165  void CollectHitsFromMuon(const pandora::CartesianVector &positionOnMuon, const pandora::CartesianVector &muonDirection,
166  const pandora::Cluster *const pMuonCluster, const pandora::CartesianPointVector &deltaRayProjectedPositions,
167  const float &minDistanceFromMuon, const float maxDistanceToCollected, pandora::CaloHitList &collectedHits) const;
168 
179  pandora::StatusCode ParameteriseMuon(const pandora::ParticleFlowObject *const pParentMuon, const pandora::Cluster *const pDeltaRayCluster,
180  pandora::CartesianVector &positionOnMuon, pandora::CartesianVector &muonDirection) const;
181 
193  pandora::StatusCode ParameteriseMuon(const pandora::ParticleFlowObject *const pParentMuon, const pandora::CartesianPointVector &deltaRayProjectedPositions,
194  const pandora::HitType hitType, pandora::CartesianVector &positionOnMuon, pandora::CartesianVector &muonDirection) const;
195 
204  void SplitMuonCluster(const std::string &clusterListName, const pandora::Cluster *const pMuonCluster,
205  const pandora::CaloHitList &collectedHits, const pandora::Cluster *&pDeltaRayCluster) const;
206 
214  bool CreatePfos(ProtoParticleVector &protoParticleVector);
215 
222  void UpdateForNewClusters(const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector);
223 
224  void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster);
225  void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const;
226  void PrepareInputClusters(pandora::ClusterList &preparedClusterList);
227 
228 protected:
236  virtual bool DoesClusterPassTensorThreshold(const pandora::Cluster *const pCluster) const = 0;
237 
243  void FillStrayClusterList(const pandora::HitType hitType);
244 
252  void GetNearbyMuonPfos(const pandora::Cluster *const pCluster, pandora::ClusterList &consideredClusters, pandora::PfoList &nearbyMuonPfos) const;
253 
261  void GetClusterSpanX(const pandora::CaloHitList &caloHitList, float &xMin, float &xMax) const;
262 
272  pandora::StatusCode GetClusterSpanZ(const pandora::CaloHitList &caloHitList, const float xMin, const float xMax, float &zMin, float &zMax) const;
273 
282  void CollectStrayClusters(const pandora::Cluster *const pClusterToEnlarge, const float rangeMinX, const float rangeMaxX,
283  pandora::ClusterList &collectedClusters);
284 
291  void AddInStrayClusters(const pandora::Cluster *const pClusterToEnlarge, const pandora::ClusterList &collectedClusters);
292 
293  void TidyUp();
294  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
295 
296  std::string m_muonPfoListName;
297  pandora::ClusterList m_strayClusterListU;
298  pandora::ClusterList m_strayClusterListV;
299  pandora::ClusterList m_strayClusterListW;
304  unsigned int m_minMatchedPoints;
305  unsigned int m_minProjectedPositions;
310 };
311 
312 } // namespace lar_content
313 
314 #endif // #ifndef LAR_N_VIEW_DELTA_RAY_MATCHING_ALGORITHM_H
void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
Select a subset of input clusters for processing in this algorithm.
std::vector< ProtoParticle > ProtoParticleVector
Header file for the kd tree linker algo template class.
std::map< const pandora::Cluster *, pandora::ClusterList > ClusterProximityMap
NViewMatchingAlgorithm class.
pandora::StatusCode GetProjectedPositions(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, pandora::CartesianPointVector &projectedPositions) const
Use two clusters from different views to calculate projected positions in the remaining third view...
pandora::StatusCode GetClusterSpanZ(const pandora::CaloHitList &caloHitList, const float xMin, const float xMax, float &zMin, float &zMax) const
Calculate the zSpan of a list of CaloHits in a specified x range.
unsigned int m_minProjectedPositions
The threshold number of projected points for a good projection.
pandora::StatusCode CollectHitsFromMuon(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pThirdViewCluster, const pandora::ParticleFlowObject *const pParentMuon, const float minDistanceFromMuon, const float maxDistanceToCollected, pandora::CaloHitList &collectedHits) const
In one view, pull out any hits from a cosmic ray cluster that belong to the child delta ray cluster...
pandora::ClusterList m_strayClusterListU
The list of U clusters that do not pass the tensor threshold requirement.
Header file for the delta ray matching containers class.
void UpdateForNewClusters(const pandora::ClusterVector &newClusterVector, const pandora::PfoVector &pfoVector)
Add a new cluster to algorithm ownership maps and, if it a delta ray cluster, to the underlying match...
void TidyUp()
Tidy member variables in derived class.
float m_pseudoChi2Cut
Pseudo chi2 cut for three view matching.
KDTreeLinkerAlgo< const pandora::CaloHit *, 2 > HitKDTree2D
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
void PrepareInputClusters(pandora::ClusterList &preparedClusterList)
Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results...
void CollectStrayClusters(const pandora::Cluster *const pClusterToEnlarge, const float rangeMinX, const float rangeMaxX, pandora::ClusterList &collectedClusters)
Collect the stray clusters that are close to a specified cluster and that lie within a given x range...
Header file for the n view matching algorithm class.
void GetClusterSpanX(const pandora::CaloHitList &caloHitList, float &xMin, float &xMax) const
Calculate the xSpan of a list of CaloHits.
Data stored in each KDTree node. The dim1/dim2 fields are usually the duplication of some PFRecHit va...
pandora::StatusCode PerformThreeViewMatching(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3, float &reducedChiSquared) const
To determine how well three clusters (one in each view) map onto one another expressing this in terms...
float m_xOverlapWindow
The maximum allowed displacement in x position.
std::string m_muonPfoListName
The list of reconstructed cosmic ray pfos.
virtual bool DoesClusterPassTensorThreshold(const pandora::Cluster *const pCluster) const =0
To check whether a given cluster meets the requirements to be added into the matching container (tens...
pandora::StatusCode ParameteriseMuon(const pandora::ParticleFlowObject *const pParentMuon, const pandora::Cluster *const pDeltaRayCluster, pandora::CartesianVector &positionOnMuon, pandora::CartesianVector &muonDirection) const
Parameterise the projection of a cosmic ray track in order to avoid poor/sparse projections.
void FillStrayClusterList(const pandora::HitType hitType)
Fill the stray cluster list with clusters that do not pass the tensor threshold requirement.
pandora::ClusterList m_strayClusterListV
The list of V clusters that do not pass the tensor threshold requirement.
pandora::ClusterList m_strayClusterListW
The list of W clusters that do not pass the tensor threshold requirement.
void SplitMuonCluster(const std::string &clusterListName, const pandora::Cluster *const pMuonCluster, const pandora::CaloHitList &collectedHits, const pandora::Cluster *&pDeltaRayCluster) const
Move a list of hits from a cosmic ray cluster into the given child delta ray cluster.
void AddInStrayClusters(const pandora::Cluster *const pClusterToEnlarge, const pandora::ClusterList &collectedClusters)
Merge in the collected stray clusters of a given delta ray cluster.
KDTreeNodeInfoT< const pandora::CaloHit *, 2 > HitKDNode2D
float m_strayClusterSeparation
The maximum allowed separation of a stray cluster and a delta ray cluster for merge.
void GetNearbyMuonPfos(const pandora::Cluster *const pCluster, pandora::ClusterList &consideredClusters, pandora::PfoList &nearbyMuonPfos) const
Use the cluster proximity map to travel along paths of nearby clusters finding the cosmic ray cluster...
float m_maxDistanceToReferencePoint
the maximum distance of a projected point to the cosmic ray vertex used when parameterising the cosmi...
HitType
Definition: HitType.h:12
std::map< const pandora::Cluster *, const pandora::ParticleFlowObject * > ClusterToPfoMap
std::vector< art::Ptr< recob::Cluster > > ClusterVector
float m_maxCosmicRayHitFraction
The maximum allowed fraction of hits to be removed from the cosmic ray track.
bool CreatePfos(ProtoParticleVector &protoParticleVector)
Create delta ray pfos maxmising completeness by searching for and merging in any stray clusters...
pandora::StatusCode ProjectMuonPositions(const pandora::HitType &thirdViewHitType, const pandora::ParticleFlowObject *const pParentMuon, pandora::CartesianPointVector &projectedPositions) const
Use two views of a cosmic ray pfo to calculate projected positions in a given the third view...
DeltaRayMatchingContainers m_deltaRayMatchingContainers
The class of hit, cluster and pfo ownership and proximity maps.
XOverlap class.
Definition: LArXOverlap.h:17
std::map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
pandora::StatusCode GetMuonCluster(const pandora::PfoList &commonMuonPfoList, const pandora::HitType hitType, const pandora::Cluster *&pMuonCluster) const
Return the cluster of the common cosmic ray pfo in a given view (function demands there to be only on...
float m_minMatchedFraction
The threshold matched fraction of sampling points for a good match.
unsigned int m_minMatchedPoints
The threshold number of matched sampling points for a good match.
float m_maxDistanceToCluster
the maximum distance of a projected point to the cosmic ray cluster used when parameterising the cosm...