Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
Cluster.h
Go to the documentation of this file.
1
8#ifndef PANDORA_CLUSTER_H
9#define PANDORA_CLUSTER_H 1
10
12
14
16#include "Pandora/StatusCodes.h"
17
18namespace pandora
19{
20
21class Pandora;
22template<typename T> class AlgorithmObjectManager;
23template<typename T, typename S> class PandoraObjectFactory;
24
25//------------------------------------------------------------------------------------------------------------------------------------------
26
31{
32public:
39
46
52 unsigned int GetNCaloHits() const;
53
59 unsigned int GetNIsolatedCaloHits() const;
60
66 unsigned int GetNPossibleMipHits() const;
67
73 float GetMipFraction() const;
74
80 unsigned int GetNHitsInOuterLayer() const;
81
87 float GetElectromagneticEnergy() const;
88
94 float GetHadronicEnergy() const;
95
102
108 float GetIsolatedHadronicEnergy() const;
109
115 int GetParticleId() const;
116
122 bool IsTrackSeeded() const;
123
129 const Track *GetTrackSeed() const;
130
136 unsigned int GetInnerPseudoLayer() const;
137
143 unsigned int GetOuterPseudoLayer() const;
144
152 const CartesianVector GetCentroid(const unsigned int pseudoLayer) const;
153
160
167
174
181
187 const TrackList &GetAssociatedTrackList() const;
188
194 bool IsAvailable() const;
195
204
212 float GetCorrectedHadronicEnergy(const Pandora &pandora) const;
213
223 float GetTrackComparisonEnergy(const Pandora &pandora) const;
224
232 bool PassPhotonId(const Pandora &pandora) const;
233
241 unsigned int GetShowerStartLayer(const Pandora &pandora) const;
242
250 float GetShowerProfileStart(const Pandora &pandora) const;
251
259 float GetShowerProfileDiscrepancy(const Pandora &pandora) const;
260
267 void GetClusterSpanX(float &xmin, float &xmax) const;
268
277 void GetClusterSpanZ(const float xmin, const float xmax, float &zmin, float &zmax) const;
278
279protected:
286
290 virtual ~Cluster();
291
298
304 StatusCode AddCaloHit(const CaloHit *const pCaloHit);
305
311 StatusCode RemoveCaloHit(const CaloHit *const pCaloHit);
312
318 StatusCode AddIsolatedCaloHit(const CaloHit *const pCaloHit);
319
325 StatusCode RemoveIsolatedCaloHit(const CaloHit *const pCaloHit);
326
330 void UpdateFitToAllHitsCache() const;
331
335 void UpdateInitialDirectionCache() const;
336
343 void UpdateLayerHitTypeCache(const unsigned int pseudoLayer, InputHitType &layerHitType) const;
344
351
357 void UpdatePhotonIdCache(const Pandora &pandora) const;
358
364 void UpdateShowerLayerCache(const Pandora &pandora) const;
365
371 void UpdateShowerProfileCache(const Pandora &pandora) const;
372
377
382
388 StatusCode AddHitsFromSecondCluster(const Cluster *const pCluster);
389
395 StatusCode AddTrackAssociation(const Track *const pTrack);
396
402 StatusCode RemoveTrackAssociation(const Track *const pTrack);
403
407 void RemoveTrackSeed();
408
414 void SetAvailability(bool isAvailable);
415
420 {
421 public:
423 unsigned int m_nHits;
424 };
425
426 typedef std::map<unsigned int, SimplePoint> PointByPseudoLayerMap;
427 typedef std::map<HitType, float> HitTypeToEnergyMap;
428
431 unsigned int m_nCaloHits;
432 unsigned int m_nPossibleMipHits;
443
447 mutable bool m_isFitUpToDate;
459
462
463 friend class ClusterManager;
464 friend class AlgorithmObjectManager<Cluster>;
466};
467
468//------------------------------------------------------------------------------------------------------------------------------------------
469
471{
472 return m_orderedCaloHitList;
473}
474
475//------------------------------------------------------------------------------------------------------------------------------------------
476
478{
480}
481
482//------------------------------------------------------------------------------------------------------------------------------------------
483
484inline unsigned int Cluster::GetNCaloHits() const
485{
486 return m_nCaloHits;
487}
488
489//------------------------------------------------------------------------------------------------------------------------------------------
490
491inline unsigned int Cluster::GetNIsolatedCaloHits() const
492{
494}
495
496//------------------------------------------------------------------------------------------------------------------------------------------
497
498inline unsigned int Cluster::GetNPossibleMipHits() const
499{
500 return m_nPossibleMipHits;
501}
502
503//------------------------------------------------------------------------------------------------------------------------------------------
504
505inline float Cluster::GetMipFraction() const
506{
507 return ((0 != m_nCaloHits) ? static_cast<float> (m_nPossibleMipHits) / static_cast<float> (m_nCaloHits) : 0);
508}
509
510//------------------------------------------------------------------------------------------------------------------------------------------
511
512inline unsigned int Cluster::GetNHitsInOuterLayer() const
513{
515}
516
517//------------------------------------------------------------------------------------------------------------------------------------------
518
520{
521 return static_cast<float>(m_electromagneticEnergy);
522}
523
524//------------------------------------------------------------------------------------------------------------------------------------------
525
526inline float Cluster::GetHadronicEnergy() const
527{
528 return static_cast<float>(m_hadronicEnergy);
529}
530
531//------------------------------------------------------------------------------------------------------------------------------------------
532
534{
535 return static_cast<float>(m_isolatedElectromagneticEnergy);
536}
537
538//------------------------------------------------------------------------------------------------------------------------------------------
539
541{
542 return static_cast<float>(m_isolatedHadronicEnergy);
543}
544
545//------------------------------------------------------------------------------------------------------------------------------------------
546
547inline int Cluster::GetParticleId() const
548{
549 return m_particleId;
550}
551
552//------------------------------------------------------------------------------------------------------------------------------------------
553
554inline bool Cluster::IsTrackSeeded() const
555{
556 return (nullptr != m_pTrackSeed);
557}
558
559//------------------------------------------------------------------------------------------------------------------------------------------
560
561inline unsigned int Cluster::GetInnerPseudoLayer() const
562{
563 return m_innerPseudoLayer.Get();
564}
565
566//------------------------------------------------------------------------------------------------------------------------------------------
567
568inline unsigned int Cluster::GetOuterPseudoLayer() const
569{
570 return m_outerPseudoLayer.Get();
571}
572
573//------------------------------------------------------------------------------------------------------------------------------------------
574
576{
578}
579
580//------------------------------------------------------------------------------------------------------------------------------------------
581
582inline bool Cluster::IsAvailable() const
583{
584 return m_isAvailable;
585}
586
587//------------------------------------------------------------------------------------------------------------------------------------------
588
589inline void Cluster::SetAvailability(bool isAvailable)
590{
591 m_isAvailable = isAvailable;
592}
593
594} // namespace pandora
595
596#endif // #ifndef PANDORA_CLUSTER_H
Header file for the cluster fit helper class.
Header file for pandora object creation classes.
Header file for the ordered calo hit list class.
Header file defining status codes and relevant preprocessor macros.
AlgorithmObjectManager class.
CaloHit class.
Definition CaloHit.h:26
CartesianVector class.
ClusterFitResult class.
Cluster class.
Definition Cluster.h:31
double m_isolatedElectromagneticEnergy
Sum of electromagnetic energy measures of isolated calo hits, units GeV.
Definition Cluster.h:436
unsigned int m_nCaloHitsInOuterLayer
Keep track of the number of calo hits in the outermost layers.
Definition Cluster.h:433
StatusCode AddHitsFromSecondCluster(const Cluster *const pCluster)
Add the calo hits from a second cluster to this.
Definition Cluster.cc:608
bool IsAvailable() const
Whether the cluster is available to be added to a particle flow object.
Definition Cluster.h:582
void UpdatePhotonIdCache(const Pandora &pandora) const
Update photon if flag.
Definition Cluster.cc:524
double m_xyzPositionSums[3]
The sum of the x, y and z hit positions in the pseudo layer.
Definition Cluster.h:422
unsigned int m_nHits
The number of hits in the pseudo layer.
Definition Cluster.h:423
unsigned int GetOuterPseudoLayer() const
Get the outermost pseudo layer in the cluster.
Definition Cluster.h:568
InputFloat m_showerProfileStart
The cluster shower profile start, units radiation lengths.
Definition Cluster.h:453
const CartesianVector & GetInitialDirection() const
Get the initial direction of the cluster.
Definition Cluster.cc:56
const Track * m_pTrackSeed
Address of the track with which the cluster is seeded.
Definition Cluster.h:439
float GetIsolatedHadronicEnergy() const
Get the sum of hadronic energy measures of isolated constituent calo hits, units GeV.
Definition Cluster.h:540
bool m_isFitUpToDate
Whether the fit to all calo hits is up to date.
Definition Cluster.h:447
InputUInt m_innerPseudoLayer
The innermost pseudo layer in the cluster.
Definition Cluster.h:441
void UpdateShowerProfileCache(const Pandora &pandora) const
Update shower profile and comparison with expectation for a photon.
Definition Cluster.cc:547
float GetHadronicEnergy() const
Get the sum of hadronic energy measures of all constituent calo hits, units GeV.
Definition Cluster.h:526
bool m_isAvailable
Whether the cluster is available to be added to a particle flow object.
Definition Cluster.h:461
float GetCorrectedElectromagneticEnergy(const Pandora &pandora) const
Get the corrected electromagnetic estimate of the cluster energy, units GeV.
Definition Cluster.cc:96
int m_particleId
The particle id flag.
Definition Cluster.h:438
InputFloat m_xMin
Cached cluster minimum in x.
Definition Cluster.h:457
bool m_isDirectionUpToDate
Whether the initial direction of the cluster is up to date.
Definition Cluster.h:445
unsigned int GetNCaloHits() const
Get the number of calo hits in the cluster.
Definition Cluster.h:484
std::map< unsigned int, SimplePoint > PointByPseudoLayerMap
The point by pseudo layer typedef.
Definition Cluster.h:426
double m_hadronicEnergy
The sum of hadronic energy measures of constituent calo hits, units GeV.
Definition Cluster.h:435
bool PassPhotonId(const Pandora &pandora) const
Whether the cluster passes the photon id.
Definition Cluster.cc:126
CaloHitList m_isolatedCaloHitList
The list of isolated hits, which contribute only towards cluster energy.
Definition Cluster.h:430
std::map< HitType, float > HitTypeToEnergyMap
The hit type to energy map typedef.
Definition Cluster.h:427
void UpdateFitToAllHitsCache() const
Update result of linear fit to all calo hits in cluster.
Definition Cluster.cc:431
unsigned int GetNIsolatedCaloHits() const
Get the number of isolated calo hits in the cluster.
Definition Cluster.h:491
unsigned int GetNHitsInOuterLayer() const
Get the number of hits in the outer sampling layers.
Definition Cluster.h:512
unsigned int GetNPossibleMipHits() const
Get the number of calo hits in the cluster that have been flagged as possible mip hits.
Definition Cluster.h:498
InputFloat m_correctedElectromagneticEnergy
The corrected electromagnetic estimate of the cluster energy, units GeV.
Definition Cluster.h:448
unsigned int GetInnerPseudoLayer() const
Get the innermost pseudo layer in the cluster.
Definition Cluster.h:561
bool IsTrackSeeded() const
Whether the cluster is track seeded.
Definition Cluster.h:554
virtual ~Cluster()
Destructor.
Definition Cluster.cc:269
StatusCode AlterMetadata(const object_creation::Cluster::Metadata &metadata)
Alter the metadata information stored in a cluster.
Definition Cluster.cc:275
void SetAvailability(bool isAvailable)
Set availability of cluster to be added to a particle flow object.
Definition Cluster.h:589
float GetShowerProfileStart(const Pandora &pandora) const
Get the cluster shower profile start, units radiation lengths.
Definition Cluster.cc:149
const CartesianVector GetCentroid(const unsigned int pseudoLayer) const
Get unweighted centroid for cluster at a particular pseudo layer, calculated using cached values of h...
Definition Cluster.cc:37
float GetElectromagneticEnergy() const
Get the sum of electromagnetic energy measures of all constituent calo hits, units GeV.
Definition Cluster.h:519
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
Definition Cluster.h:470
PointByPseudoLayerMap m_sumXYZByPseudoLayer
Construct to allow rapid calculation of centroid in each pseudolayer.
Definition Cluster.h:440
InputBool m_passPhotonId
Whether the cluster passes the photon id.
Definition Cluster.h:451
StatusCode AddTrackAssociation(const Track *const pTrack)
Add an association between the cluster and a track.
Definition Cluster.cc:666
StatusCode RemoveIsolatedCaloHit(const CaloHit *const pCaloHit)
Remove an isolated calo hit from the cluster.
Definition Cluster.cc:409
InputFloat m_correctedHadronicEnergy
The corrected hadronic estimate of the cluster energy, units GeV.
Definition Cluster.h:449
void UpdateShowerLayerCache(const Pandora &pandora) const
Update the pseudo layer at which shower commences.
Definition Cluster.cc:534
HitType GetOuterLayerHitType() const
Get the typical outer layer hit type.
Definition Cluster.cc:86
double m_electromagneticEnergy
The sum of electromagnetic energy measures of constituent calo hits, units GeV.
Definition Cluster.h:434
TrackList m_associatedTrackList
The list of tracks associated with the cluster.
Definition Cluster.h:460
StatusCode AddCaloHit(const CaloHit *const pCaloHit)
Add a calo hit to the cluster.
Definition Cluster.cc:288
InputHitType m_outerLayerHitType
The typical outer layer hit type.
Definition Cluster.h:456
CartesianVector m_initialDirection
The initial direction of the cluster.
Definition Cluster.h:444
void RemoveTrackSeed()
Remove the track seed, changing the initial direction measurement.
Definition Cluster.cc:693
InputHitType m_innerLayerHitType
The typical inner layer hit type.
Definition Cluster.h:455
float GetTrackComparisonEnergy(const Pandora &pandora) const
Get the best energy estimate to use when comparing cluster energy to associated track momentum,...
Definition Cluster.cc:116
StatusCode RemoveTrackAssociation(const Track *const pTrack)
Remove an association between the cluster and a track.
Definition Cluster.cc:680
HitType GetInnerLayerHitType() const
Get the typical inner layer hit type.
Definition Cluster.cc:76
void UpdateEnergyCorrectionsCache(const Pandora &pandora) const
Update cluster corrected energy values.
Definition Cluster.cc:497
float GetCorrectedHadronicEnergy(const Pandora &pandora) const
Get the corrected hadronic estimate of the cluster energy, units GeV.
Definition Cluster.cc:106
const ClusterFitResult & GetFitToAllHitsResult() const
Get the result of a linear fit to all calo hits in the cluster.
Definition Cluster.cc:66
const Track * GetTrackSeed() const
Get the address of the track with which the cluster is seeded.
Definition Cluster.cc:27
const CaloHitList & GetIsolatedCaloHitList() const
Get the isolated calo hit list.
Definition Cluster.h:477
StatusCode AddIsolatedCaloHit(const CaloHit *const pCaloHit)
Add an isolated calo hit to the cluster.
Definition Cluster.cc:390
StatusCode ResetProperties()
Reset all cluster properties.
Definition Cluster.cc:560
int GetParticleId() const
Get the particle id flag.
Definition Cluster.h:547
void GetClusterSpanX(float &xmin, float &xmax) const
Get minimum and maximum X positions of the calo hits in this cluster.
Definition Cluster.cc:169
unsigned int m_nCaloHits
The number of calo hits.
Definition Cluster.h:431
void GetClusterSpanZ(const float xmin, const float xmax, float &zmin, float &zmax) const
Get upper and lower Z positions of the calo hits in a cluster in range xmin to xmax.
Definition Cluster.cc:198
float GetIsolatedElectromagneticEnergy() const
Get the sum of electromagnetic energy measures of isolated constituent calo hits, units GeV.
Definition Cluster.h:533
InputFloat m_trackComparisonEnergy
The appropriate corrected energy to use in comparisons with track momentum, units GeV.
Definition Cluster.h:450
float GetShowerProfileDiscrepancy(const Pandora &pandora) const
Get the cluster shower profile discrepancy.
Definition Cluster.cc:159
InputUInt m_outerPseudoLayer
The outermost pseudo layer in the cluster.
Definition Cluster.h:442
float GetMipFraction() const
Get fraction of constituent calo hits that have been flagged as possible mip hits.
Definition Cluster.h:505
void ResetOutdatedProperties()
Reset those cluster properties that must be recalculated upon addition/removal of a calo hit.
Definition Cluster.cc:587
InputFloat m_xMax
Cached cluster maximum in x.
Definition Cluster.h:458
unsigned int m_nPossibleMipHits
The number of calo hits that have been flagged as possible mip hits.
Definition Cluster.h:432
const TrackList & GetAssociatedTrackList() const
Get the list of tracks associated with the cluster.
Definition Cluster.h:575
double m_isolatedHadronicEnergy
Sum of hadronic energy measures of isolated calo hits, units GeV.
Definition Cluster.h:437
void UpdateInitialDirectionCache() const
Update cluster initial direction.
Definition Cluster.cc:439
ClusterFitResult m_fitToAllHitsResult
The result of a linear fit to all calo hits in the cluster.
Definition Cluster.h:446
unsigned int GetShowerStartLayer(const Pandora &pandora) const
Get the pseudo layer at which shower commences.
Definition Cluster.cc:139
void UpdateLayerHitTypeCache(const unsigned int pseudoLayer, InputHitType &layerHitType) const
Update typical hit type for specified layer.
Definition Cluster.cc:460
InputFloat m_showerProfileDiscrepancy
The cluster shower profile discrepancy.
Definition Cluster.h:454
OrderedCaloHitList m_orderedCaloHitList
The ordered calo hit list.
Definition Cluster.h:429
StatusCode RemoveCaloHit(const CaloHit *const pCaloHit)
Remove a calo hit from the cluster.
Definition Cluster.cc:340
InputUInt m_showerStartLayer
The pseudo layer at which shower commences.
Definition Cluster.h:452
SimplePoint class.
Definition Cluster.h:420
ClusterManager class.
Calo hit lists arranged by pseudo layer.
unsigned int size() const
Returns the number of elements in the container.
Pandora class.
Definition Pandora.h:40
const T & Get() const
Get the value held by the pandora type.
PandoraObjectFactory class.
Track class.
Definition Track.h:26
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const CaloHit * > CaloHitList
MANAGED_CONTAINER< const Track * > TrackList
StatusCode
The StatusCode enum.