APRILContent
Algorithm of Particle Reconstruction for ILC - implementation with PandoraSDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations
ShowerProfilePlugin.h
Go to the documentation of this file.
1 
8 #ifndef APRIL_SHOWER_PROFILE_PLUGIN_H
9 #define APRIL_SHOWER_PROFILE_PLUGIN_H 1
10 
12 
13 namespace april_content
14 {
18 class APRILShowerProfilePlugin : public pandora::ShowerProfilePlugin
19 {
20 public:
25 
26  void CalculateShowerStartLayer(const pandora::Cluster *const pCluster, unsigned int &showerStartLayer) const;
27  void CalculateLongitudinalProfile(const pandora::Cluster *const pCluster, float &profileStart, float &profileDiscrepancy) const;
28  void CalculateTransverseProfile(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, ShowerPeakList &showerPeakList) const;
29  void CalculateTransverseProfile(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, ShowerPeakList &showerPeakList,
30  const bool inclusiveMode) const;
31  void CalculateTrackBasedTransverseProfile(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, const pandora::Track *const pMinTrack,
32  const pandora::TrackVector &trackVector, ShowerPeakList &showerPeakListPhoton, ShowerPeakList &showerPeakListNonPhoton) const;
33 
34 private:
39  {
40  public:
45 
47  float m_energy;
48  pandora::CaloHitList m_caloHitList;
50  pandora::CaloHitList m_unusedCaloHitList;
51  };
52 
53  typedef std::pair<int, int> TwoDBin;
54  typedef std::vector<TwoDBin > TwoDBinVector;
55 
60  {
61  public:
65  ShowerPeakObject(const float energy, const int uBin, const int vBin);
66 
72  float GetPeakEnergy() const;
73 
79  int GetPeakUBin() const;
80 
86  int GetPeakVBin() const;
87 
91 
92  private:
93  float m_energy;
94  int m_uBin;
95  int m_vBin;
96  };
97 
98  typedef std::vector<ShowerProfileEntry> ShowerProfile;
99  typedef std::vector<ShowerProfile> TwoDShowerProfile;
100  typedef std::vector<ShowerPeakObject> ShowerPeakObjectVector;
101 
110  void CalculateTracklessTransverseShowers(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, TwoDShowerProfile &showerProfile,
111  ShowerPeakObjectVector &showerPeakObjectVector) const;
112 
124  void CalculateTrackNearbyTransverseShowers(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, const pandora::Track *const pMinTrack,
125  const pandora::TrackVector &trackVector, TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector, TwoDBinVector &trackProjectionVector) const;
126 
132  void CreateEmptyTwoDShowerProfile(TwoDShowerProfile &showerProfile) const;
133 
141  void InitialiseTransverseProfile(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, TwoDShowerProfile &showerProfile) const;
142 
153  void InitialiseTransverseProfileWithTracks(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, const pandora::Track *const pMinTrack,
154  const pandora::TrackVector &trackVector, TwoDShowerProfile &showerProfile, TwoDBinVector &trackProjectionVector) const;
155 
165  void CalculateProjectionAxes(const pandora::Cluster *const pCluster, pandora::CartesianVector &innerLayerCentroid, pandora::CartesianVector &uAxis,
166  pandora::CartesianVector &vAxis, const pandora::Track *const pMinTrack = NULL) const;
167 
178  void InitialiseTwoDShowerProfile(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, const pandora::CartesianVector &innerLayerCentroid,
179  const pandora::CartesianVector &uAxis, const pandora::CartesianVector &vAxis, TwoDShowerProfile &showerProfile) const;
180 
191  void FindTracksProjection(const pandora::Cluster *const pCluster, const pandora::TrackVector &trackVector, const pandora::CartesianVector &innerLayerCentroid,
192  const pandora::CartesianVector &uAxis, const pandora::CartesianVector &vAxis, TwoDBinVector &trackProjectionVector) const;
193 
201  float GetCellLengthScale(const pandora::Cluster *const pCluster) const;
202 
208  void MaskLowHeightRegions(TwoDShowerProfile &showerProfile) const;
209 
216  void FindRawPeaksInTwoDShowerProfile(TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const;
217 
224  void AssociateUnavailableBinsToPeaks(const TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const;
225 
232  void AssociateBinsToPeaks(const TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const;
233 
240  void AssociateBinsToPeaks(const TwoDBinVector &twoDBinVector, ShowerPeakObjectVector &showerPeakObjectVector) const;
241 
248  void ApplyQualityCutPeakNBin(ShowerPeakObjectVector &showerPeakObjectVector, TwoDBinVector &twoDBinVector) const;
249 
257  bool PassQualityCutPeakNBin(const ShowerPeakObject &showerPeakObject) const;
258 
265  void MarkPeaksCloseToTracks(const TwoDBinVector &trackProjectionVector, ShowerPeakObjectVector &showerPeakObjectVector) const;
266 
273  void MatchPeaksInTwoSlices(const ShowerPeakObjectVector &showerPeakObjectVectorFirst, ShowerPeakObjectVector &showerPeakObjectVectorNext) const;
274 
281  void ProcessShowerProfile(TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const;
282 
292  void ConvertBinsToShowerLists(const TwoDShowerProfile &showerProfile, const ShowerPeakObjectVector &showerPeakObjectVector,
293  ShowerPeakList &showerPeakListPhoton, ShowerPeakList &showerPeakListNonPhoton, const bool inclusiveMode) const;
294 
307  void FindHitPositionProjection(const pandora::CartesianVector &hitPosition, const pandora::CartesianVector &innerLayerCentroid, const pandora::CartesianVector &uAxis,
308  const pandora::CartesianVector &vAxis, const int nOffsetBins, const float cellLengthScale, int &uBin, int &vBin) const;
309 
322  void FindBoundaryBins(const int uBin, const int vBin, const int uEdgeLow, const int uEdgeHigh, const int vEdgeLow, const int vEdgeHigh, int &uEdgeBin, int &vEdgeBin) const;
323 
333  bool IsPeak(TwoDShowerProfile &showerProfile, const int uBin, const int vBin ) const;
334 
344  bool Check8NeighbourFull(TwoDShowerProfile &showerProfile, const int uBin, const int vBin) const;
345 
355  bool Check8NeighbourFast(TwoDShowerProfile &showerProfile, const int uBin, const int vBin) const;
356 
365  float CalculatePeakFindingMetric(const float distance, const float energy) const;
366 
375  void CalculateBestPeakUsingMetric(ShowerPeakObjectVector &showerPeakObjectVector, const int uBin, const int vBin, ShowerPeakObject *&bestShowerPeakObject) const;
376 
384  bool HasPhotonCandidate(const ShowerPeakObjectVector &showerPeakObjectVector) const;
385 
394  static bool SortShowerPeakListByEnergy(const ShowerPeak &lhs, const ShowerPeak &rhs);
395 
396  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
397 
400 
402  unsigned int m_longProfileNBins;
408 
416 };
417 
418 //------------------------------------------------------------------------------------------------------------------------------------------
419 
420 inline void APRILShowerProfilePlugin::CalculateTransverseProfile(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, ShowerPeakList &showerPeakList) const
421 {
422  return CalculateTransverseProfile(pCluster, maxPseudoLayer, showerPeakList, false);
423 }
424 
425 //------------------------------------------------------------------------------------------------------------------------------------------
426 
428  m_isAvailable(true),
429  m_energy(0.f),
430  m_potentialPeak(true)
431 {
432 }
433 
434 //------------------------------------------------------------------------------------------------------------------------------------------
435 
436 inline APRILShowerProfilePlugin::ShowerPeakObject::ShowerPeakObject(const float energy, const int uBin, const int vBin) :
437  m_isAvailable(true),
438  m_isPhotonCandidate(true),
439  m_energy(energy),
440  m_uBin(uBin),
441  m_vBin(vBin)
442 {
443  m_associatedBins.push_back(std::make_pair(uBin,vBin));
444 }
445 
446 //------------------------------------------------------------------------------------------------------------------------------------------
447 
449 {
450  return m_energy;
451 }
452 
453 //------------------------------------------------------------------------------------------------------------------------------------------
454 
456 {
457  return m_uBin;
458 }
459 
460 //------------------------------------------------------------------------------------------------------------------------------------------
461 
463 {
464  return m_vBin;
465 }
466 
467 }
468 
469 #endif
void ConvertBinsToShowerLists(const TwoDShowerProfile &showerProfile, const ShowerPeakObjectVector &showerPeakObjectVector, ShowerPeakList &showerPeakListPhoton, ShowerPeakList &showerPeakListNonPhoton, const bool inclusiveMode) const
Convert 2D bins to shower lists.
Definition: ShowerProfilePlugin.cc:782
bool HasPhotonCandidate(const ShowerPeakObjectVector &showerPeakObjectVector) const
True for showerPeakObjectVector contains photon candiates.
Definition: ShowerProfilePlugin.cc:953
float m_longProfileCriticalEnergy
Critical energy, used to calculate argument for gamma function.
Definition: ShowerProfilePlugin.h:404
float CalculatePeakFindingMetric(const float distance, const float energy) const
Calculate the metric for peak association.
Definition: ShowerProfilePlugin.cc:903
ShowerPeakObject class.
Definition: ShowerProfilePlugin.h:59
float m_transProfileMinDisTrackMatch
The maximum allowed shift of 2D distance of the peak position through the slices. ...
Definition: ShowerProfilePlugin.h:415
int m_vBin
The u bin of the peak.
Definition: ShowerProfilePlugin.h:95
int GetPeakVBin() const
Get peak v bin.
Definition: ShowerProfilePlugin.h:462
void MatchPeaksInTwoSlices(const ShowerPeakObjectVector &showerPeakObjectVectorFirst, ShowerPeakObjectVector &showerPeakObjectVectorNext) const
Mark bins shifted too much between slices not photon candidate.
Definition: ShowerProfilePlugin.cc:692
bool m_isAvailable
Whether this is avaiable.
Definition: ShowerProfilePlugin.h:89
void CalculateTrackNearbyTransverseShowers(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, const pandora::Track *const pMinTrack, const pandora::TrackVector &trackVector, TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector, TwoDBinVector &trackProjectionVector) const
Calculate transverse shower peak objects for a cluster and get the list of peaks identified in the pr...
Definition: ShowerProfilePlugin.cc:409
unsigned int m_showerStartNonMipLayers
Number of successive shower-like layers to identify shower start.
Definition: ShowerProfilePlugin.h:399
float GetPeakEnergy() const
Get peak energy.
Definition: ShowerProfilePlugin.h:448
void AssociateBinsToPeaks(const TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const
Associate bins to peaks, using TwoDShowerProfile.
Definition: ShowerProfilePlugin.cc:608
void InitialiseTwoDShowerProfile(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, const pandora::CartesianVector &innerLayerCentroid, const pandora::CartesianVector &uAxis, const pandora::CartesianVector &vAxis, TwoDShowerProfile &showerProfile) const
Initialise 2D shower profile implementation given porject axes.
Definition: ShowerProfilePlugin.cc:468
void MarkPeaksCloseToTracks(const TwoDBinVector &trackProjectionVector, ShowerPeakObjectVector &showerPeakObjectVector) const
Mark bins close to tracks not photon candidate.
Definition: ShowerProfilePlugin.cc:666
APRILShowerProfilePlugin class.
Definition: ShowerProfilePlugin.h:18
float m_longProfileParameter0
Parameter0, used to calculate argument for gamma function.
Definition: ShowerProfilePlugin.h:405
pandora::CaloHitList m_caloHitList
The list of calo hits associated with the shower profile entry.
Definition: ShowerProfilePlugin.h:48
bool PassQualityCutPeakNBin(const ShowerPeakObject &showerPeakObject) const
True for passing the quality cuts for minimum number of bins.
Definition: ShowerProfilePlugin.cc:659
std::vector< ShowerProfileEntry > ShowerProfile
The shower profile typedef.
Definition: ShowerProfilePlugin.h:98
void CalculateBestPeakUsingMetric(ShowerPeakObjectVector &showerPeakObjectVector, const int uBin, const int vBin, ShowerPeakObject *&bestShowerPeakObject) const
Find the best shower peak to associate bins.
Definition: ShowerProfilePlugin.cc:925
unsigned int m_transProfileMinNBinsCut
The minimum number for bins of a substantial peak.
Definition: ShowerProfilePlugin.h:412
void CalculateTracklessTransverseShowers(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const
Calculate transverse shower peak objects for a cluster and get the list of peaks identified in the pr...
Definition: ShowerProfilePlugin.cc:400
unsigned int m_transProfilePeakFindingMetric
The metric for peak association.
Definition: ShowerProfilePlugin.h:411
std::vector< TwoDBin > TwoDBinVector
The two dimensional bin vector typedef.
Definition: ShowerProfilePlugin.h:54
bool Check8NeighbourFast(TwoDShowerProfile &showerProfile, const int uBin, const int vBin) const
True if the peak is a local maxima implementaion, fast.
Definition: ShowerProfilePlugin.cc:876
Header file for the shower profile plugin class.
float GetCellLengthScale(const pandora::Cluster *const pCluster) const
Get cell length scale.
Definition: ShowerProfilePlugin.cc:532
void FindRawPeaksInTwoDShowerProfile(TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const
Find raw peaks in 2D profile, based on local maxima.
Definition: ShowerProfilePlugin.cc:568
pandora::CaloHitList m_unusedCaloHitList
The list of calo hits unused for shower peak finding, needed for inclusive mode.
Definition: ShowerProfilePlugin.h:50
void CreateEmptyTwoDShowerProfile(TwoDShowerProfile &showerProfile) const
Calculate empty 2D shower profile.
Definition: ShowerProfilePlugin.cc:419
int GetPeakUBin() const
Get peak u bin.
Definition: ShowerProfilePlugin.h:455
void FindBoundaryBins(const int uBin, const int vBin, const int uEdgeLow, const int uEdgeHigh, const int vEdgeLow, const int vEdgeHigh, int &uEdgeBin, int &vEdgeBin) const
Find the cloest boundary bin for a point outside the square.
Definition: ShowerProfilePlugin.cc:749
void FindHitPositionProjection(const pandora::CartesianVector &hitPosition, const pandora::CartesianVector &innerLayerCentroid, const pandora::CartesianVector &uAxis, const pandora::CartesianVector &vAxis, const int nOffsetBins, const float cellLengthScale, int &uBin, int &vBin) const
Find projection of a 3D point.
Definition: ShowerProfilePlugin.cc:734
void InitialiseTransverseProfileWithTracks(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, const pandora::Track *const pMinTrack, const pandora::TrackVector &trackVector, TwoDShowerProfile &showerProfile, TwoDBinVector &trackProjectionVector) const
Initialise 2D shower profile for clusters close to tracks.
Definition: ShowerProfilePlugin.cc:435
std::pair< int, int > TwoDBin
The two dimensional bin typedef.
Definition: ShowerProfilePlugin.h:53
int m_transProfileNBins
Number of bins used to construct transverse profile.
Definition: ShowerProfilePlugin.h:409
float m_longProfileBinWidth
Bin width used to construct longitudinal profile, units radiation lengths.
Definition: ShowerProfilePlugin.h:401
ShowerProfileEntry class.
Definition: ShowerProfilePlugin.h:38
float m_transProfilePeakThreshold
Minimum energy for a bin to consider.
Definition: ShowerProfilePlugin.h:410
float m_longProfileMinCosAngle
Min angular correction used to adjust radiation length measures.
Definition: ShowerProfilePlugin.h:403
unsigned int m_longProfileNBins
Number of bins used to construct longitudinal profile.
Definition: ShowerProfilePlugin.h:402
float m_longProfileMaxDifference
Max difference between current and best longitudinal profile comparisons.
Definition: ShowerProfilePlugin.h:407
std::vector< ShowerPeakObject > ShowerPeakObjectVector
The shower peak object vector.
Definition: ShowerProfilePlugin.h:100
bool m_isPhotonCandidate
Whether this is photon candidate.
Definition: ShowerProfilePlugin.h:90
void ApplyQualityCutPeakNBin(ShowerPeakObjectVector &showerPeakObjectVector, TwoDBinVector &twoDBinVector) const
Apply quality cuts to peaks.
Definition: ShowerProfilePlugin.cc:644
static bool SortShowerPeakListByEnergy(const ShowerPeak &lhs, const ShowerPeak &rhs)
Sort shower peak list by desending energy.
Definition: ShowerProfilePlugin.cc:968
void MaskLowHeightRegions(TwoDShowerProfile &showerProfile) const
Mark region with low height unavailable.
Definition: ShowerProfilePlugin.cc:551
bool m_potentialPeak
Whether the shower profile is a potential peak (to speed up looping)
Definition: ShowerProfilePlugin.h:49
float m_transProfileMinTrackToPeakCut
The minimum 2D distance of a track to the peak postion.
Definition: ShowerProfilePlugin.h:414
APRILShowerProfilePlugin()
Default constructor.
Definition: ShowerProfilePlugin.cc:19
float m_energy
The energy associated with the shower profile entry.
Definition: ShowerProfilePlugin.h:93
void AssociateUnavailableBinsToPeaks(const TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const
Associate unavailable bins to peaks, using TwoDShowerProfile, for inclusive modes.
Definition: ShowerProfilePlugin.cc:587
float m_longProfileParameter1
Parameter1, used to calculate argument for gamma function.
Definition: ShowerProfilePlugin.h:406
std::vector< ShowerProfile > TwoDShowerProfile
The two dimensional shower profile typedef.
Definition: ShowerProfilePlugin.h:99
void FindTracksProjection(const pandora::Cluster *const pCluster, const pandora::TrackVector &trackVector, const pandora::CartesianVector &innerLayerCentroid, const pandora::CartesianVector &uAxis, const pandora::CartesianVector &vAxis, TwoDBinVector &trackProjectionVector) const
Find all tracks projections on 2D shower profile.
Definition: ShowerProfilePlugin.cc:510
void InitialiseTransverseProfile(const pandora::Cluster *const pCluster, const unsigned int maxPseudoLayer, TwoDShowerProfile &showerProfile) const
Initialise 2D shower profile for clusters not close to tracks.
Definition: ShowerProfilePlugin.cc:426
TwoDBinVector m_associatedBins
The bins associated to this peak.
Definition: ShowerProfilePlugin.h:88
unsigned int m_transProfileTrackNearbyNSlices
The number of slices to analyse the EM shower.
Definition: ShowerProfilePlugin.h:413
int m_uBin
The u bin of the peak.
Definition: ShowerProfilePlugin.h:94
float m_showerStartMipFraction
Max layer mip-fraction to declare layer as shower-like.
Definition: ShowerProfilePlugin.h:398
bool Check8NeighbourFull(TwoDShowerProfile &showerProfile, const int uBin, const int vBin) const
True if the peak is a local maxima implementaion.
Definition: ShowerProfilePlugin.cc:847
bool IsPeak(TwoDShowerProfile &showerProfile, const int uBin, const int vBin) const
True if the peak is a local maxima.
Definition: ShowerProfilePlugin.cc:839
float m_energy
The energy associated with the shower profile entry.
Definition: ShowerProfilePlugin.h:47
ShowerProfileEntry()
Default constructor.
Definition: ShowerProfilePlugin.h:427
ShowerPeakObject(const float energy, const int uBin, const int vBin)
Default constructor.
Definition: ShowerProfilePlugin.h:436
void CalculateProjectionAxes(const pandora::Cluster *const pCluster, pandora::CartesianVector &innerLayerCentroid, pandora::CartesianVector &uAxis, pandora::CartesianVector &vAxis, const pandora::Track *const pMinTrack=NULL) const
Find axes of projection.
Definition: ShowerProfilePlugin.cc:446
void ProcessShowerProfile(TwoDShowerProfile &showerProfile, ShowerPeakObjectVector &showerPeakObjectVector) const
Process the quality cuts and association of bins to peaks.
Definition: ShowerProfilePlugin.cc:722
bool m_isAvailable
Whether shower profile entry is available (prevent double counting)
Definition: ShowerProfilePlugin.h:46