44 const SimplePoint &mypoint = pointValueIter->second;
178 xmin = std::numeric_limits<float>::max();
179 xmax = -std::numeric_limits<float>::max();
183 for (CaloHitList::const_iterator hIter = ochIter->second->begin(); hIter != ochIter->second->end(); ++hIter)
185 const CaloHit *
const pCaloHit = *hIter;
187 xmin = std::min(hit.
GetX(), xmin);
188 xmax = std::max(hit.
GetX(), xmax);
205 zmin = std::numeric_limits<float>::max();
206 zmax = -std::numeric_limits<float>::max();
208 bool foundHits(
false);
212 for (CaloHitList::const_iterator hIter = ochIter->second->begin(), hIterEnd = ochIter->second->end(); hIter != hIterEnd; ++hIter)
214 const CaloHit *
const pCaloHit = *hIter;
217 if (hit.
GetX() < xmin || hit.
GetX() > xmax)
220 zmin = std::min(hit.
GetZ(), zmin);
221 zmax = std::max(hit.
GetZ(), zmax);
234 m_nPossibleMipHits(0),
235 m_nCaloHitsInOuterLayer(0),
236 m_electromagneticEnergy(0),
238 m_isolatedElectromagneticEnergy(0),
239 m_isolatedHadronicEnergy(0),
241 m_pTrackSeed(parameters.m_pTrack.IsInitialized() ? parameters.m_pTrack.Get() : nullptr),
242 m_initialDirection(0.f, 0.f, 0.f),
243 m_isDirectionUpToDate(false),
244 m_isFitUpToDate(false),
247 if (parameters.m_caloHitList.empty() && parameters.m_isolatedCaloHitList.empty() && !parameters.m_pTrack.IsInitialized())
250 if (parameters.m_pTrack.IsInitialized())
256 for (
const CaloHit *
const pCaloHit : parameters.m_caloHitList)
261 for (
const CaloHit *
const pCaloHit : parameters.m_isolatedCaloHitList)
277 if (metadata.m_particleId.IsInitialized())
283 return STATUS_CODE_SUCCESS;
335 return STATUS_CODE_SUCCESS;
385 return STATUS_CODE_SUCCESS;
393 return STATUS_CODE_ALREADY_PRESENT;
404 return STATUS_CODE_SUCCESS;
414 return STATUS_CODE_NOT_FOUND;
426 return STATUS_CODE_SUCCESS;
451 for (
const CaloHit *
const pCaloHit : *pCaloHitList)
452 initialDirection += pCaloHit->GetExpectedDirection();
469 for (
const CaloHit *
const pCaloHit : *listIter->second)
471 HitTypeToEnergyMap::iterator mapIter = hitTypeToEnergyMap.find(pCaloHit->GetHitType());
473 if (hitTypeToEnergyMap.end() != mapIter)
475 mapIter->second += pCaloHit->GetHadronicEnergy();
479 if (!hitTypeToEnergyMap.insert(HitTypeToEnergyMap::value_type(pCaloHit->GetHitType(), pCaloHit->GetHadronicEnergy())).second)
483 float highestEnergy(0.f);
485 for (HitTypeToEnergyMap::value_type &mapEntry : hitTypeToEnergyMap)
487 if (mapEntry.second > highestEnergy)
489 layerHitType = mapEntry.first;
490 highestEnergy = mapEntry.second;
502 float correctedElectromagneticEnergy(0.f), correctedHadronicEnergy(0.f), trackComparisonEnergy(0.f);
504 correctedHadronicEnergy));
508 trackComparisonEnergy = correctedElectromagneticEnergy;
512 trackComparisonEnergy = correctedHadronicEnergy;
526 const bool passPhotonId(
pandora.GetPlugins()->GetParticleId()->IsPhoton(
this));
538 unsigned int showerStartLayer(std::numeric_limits<unsigned int>::max());
551 float showerProfileStart(std::numeric_limits<float>::max()), showerProfileDiscrepancy(std::numeric_limits<float>::max());
582 return STATUS_CODE_SUCCESS;
610 if (
this == pCluster)
611 return STATUS_CODE_NOT_ALLOWED;
617 for (
const CaloHit *
const pCaloHit : isolatedCaloHitList)
620 return STATUS_CODE_ALREADY_PRESENT;
637 const unsigned int pseudoLayer(layerEntry.first);
661 return STATUS_CODE_SUCCESS;
669 return STATUS_CODE_INVALID_PARAMETER;
672 return STATUS_CODE_ALREADY_PRESENT;
675 return STATUS_CODE_SUCCESS;
685 return STATUS_CODE_NOT_FOUND;
688 return STATUS_CODE_SUCCESS;
Header file for the calo hit class.
Header file for the cluster class.
Header file for the calo hit plugin class.
Header file for the pandora class.
Header file for the particle id plugin class.
Header file for the pandora plugin manager class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Header file for the track class.
float GetElectromagneticEnergy() const
Get the calibrated electromagnetic energy measure.
bool IsInOuterSamplingLayer() const
Whether cell is in one of the outermost detector sampling layers.
unsigned int GetPseudoLayer() const
Get pseudo layer for the calo hit.
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
bool IsPossibleMip() const
Whether the calo hit is flagged as a possible mip hit.
float GetHadronicEnergy() const
Get the calibrated hadronic energy measure.
void SetValues(float x, float y, float z)
Set the values of cartesian vector components.
float GetX() const
Get the cartesian x coordinate.
CartesianVector GetUnitVector() const
Get a unit vector in the direction of the cartesian vector.
float GetZ() const
Get the cartesian z coordinate.
float GetY() const
Get the cartesian y coordinate.
static StatusCode FitFullCluster(const Cluster *const pCluster, ClusterFitResult &clusterFitResult)
Fit all points in a cluster.
void Reset()
Reset the cluster fit result.
double m_isolatedElectromagneticEnergy
Sum of electromagnetic energy measures of isolated calo hits, units GeV.
unsigned int m_nCaloHitsInOuterLayer
Keep track of the number of calo hits in the outermost layers.
StatusCode AddHitsFromSecondCluster(const Cluster *const pCluster)
Add the calo hits from a second cluster to this.
void UpdatePhotonIdCache(const Pandora &pandora) const
Update photon if flag.
double m_xyzPositionSums[3]
The sum of the x, y and z hit positions in the pseudo layer.
unsigned int m_nHits
The number of hits in the pseudo layer.
InputFloat m_showerProfileStart
The cluster shower profile start, units radiation lengths.
const CartesianVector & GetInitialDirection() const
Get the initial direction of the cluster.
const Track * m_pTrackSeed
Address of the track with which the cluster is seeded.
bool m_isFitUpToDate
Whether the fit to all calo hits is up to date.
InputUInt m_innerPseudoLayer
The innermost pseudo layer in the cluster.
void UpdateShowerProfileCache(const Pandora &pandora) const
Update shower profile and comparison with expectation for a photon.
float GetHadronicEnergy() const
Get the sum of hadronic energy measures of all constituent calo hits, units GeV.
float GetCorrectedElectromagneticEnergy(const Pandora &pandora) const
Get the corrected electromagnetic estimate of the cluster energy, units GeV.
int m_particleId
The particle id flag.
InputFloat m_xMin
Cached cluster minimum in x.
bool m_isDirectionUpToDate
Whether the initial direction of the cluster is up to date.
unsigned int GetNCaloHits() const
Get the number of calo hits in the cluster.
double m_hadronicEnergy
The sum of hadronic energy measures of constituent calo hits, units GeV.
bool PassPhotonId(const Pandora &pandora) const
Whether the cluster passes the photon id.
CaloHitList m_isolatedCaloHitList
The list of isolated hits, which contribute only towards cluster energy.
std::map< HitType, float > HitTypeToEnergyMap
The hit type to energy map typedef.
void UpdateFitToAllHitsCache() const
Update result of linear fit to all calo hits in cluster.
unsigned int GetNHitsInOuterLayer() const
Get the number of hits in the outer sampling layers.
unsigned int GetNPossibleMipHits() const
Get the number of calo hits in the cluster that have been flagged as possible mip hits.
InputFloat m_correctedElectromagneticEnergy
The corrected electromagnetic estimate of the cluster energy, units GeV.
virtual ~Cluster()
Destructor.
StatusCode AlterMetadata(const object_creation::Cluster::Metadata &metadata)
Alter the metadata information stored in a cluster.
float GetShowerProfileStart(const Pandora &pandora) const
Get the cluster shower profile start, units radiation lengths.
const CartesianVector GetCentroid(const unsigned int pseudoLayer) const
Get unweighted centroid for cluster at a particular pseudo layer, calculated using cached values of h...
float GetElectromagneticEnergy() const
Get the sum of electromagnetic energy measures of all constituent calo hits, units GeV.
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
PointByPseudoLayerMap m_sumXYZByPseudoLayer
Construct to allow rapid calculation of centroid in each pseudolayer.
InputBool m_passPhotonId
Whether the cluster passes the photon id.
StatusCode AddTrackAssociation(const Track *const pTrack)
Add an association between the cluster and a track.
StatusCode RemoveIsolatedCaloHit(const CaloHit *const pCaloHit)
Remove an isolated calo hit from the cluster.
InputFloat m_correctedHadronicEnergy
The corrected hadronic estimate of the cluster energy, units GeV.
void UpdateShowerLayerCache(const Pandora &pandora) const
Update the pseudo layer at which shower commences.
HitType GetOuterLayerHitType() const
Get the typical outer layer hit type.
double m_electromagneticEnergy
The sum of electromagnetic energy measures of constituent calo hits, units GeV.
TrackList m_associatedTrackList
The list of tracks associated with the cluster.
StatusCode AddCaloHit(const CaloHit *const pCaloHit)
Add a calo hit to the cluster.
InputHitType m_outerLayerHitType
The typical outer layer hit type.
CartesianVector m_initialDirection
The initial direction of the cluster.
void RemoveTrackSeed()
Remove the track seed, changing the initial direction measurement.
InputHitType m_innerLayerHitType
The typical inner layer hit type.
float GetTrackComparisonEnergy(const Pandora &pandora) const
Get the best energy estimate to use when comparing cluster energy to associated track momentum,...
Cluster(const object_creation::Cluster::Parameters ¶meters)
Constructor.
StatusCode RemoveTrackAssociation(const Track *const pTrack)
Remove an association between the cluster and a track.
HitType GetInnerLayerHitType() const
Get the typical inner layer hit type.
void UpdateEnergyCorrectionsCache(const Pandora &pandora) const
Update cluster corrected energy values.
float GetCorrectedHadronicEnergy(const Pandora &pandora) const
Get the corrected hadronic estimate of the cluster energy, units GeV.
const ClusterFitResult & GetFitToAllHitsResult() const
Get the result of a linear fit to all calo hits in the cluster.
const Track * GetTrackSeed() const
Get the address of the track with which the cluster is seeded.
const CaloHitList & GetIsolatedCaloHitList() const
Get the isolated calo hit list.
StatusCode AddIsolatedCaloHit(const CaloHit *const pCaloHit)
Add an isolated calo hit to the cluster.
StatusCode ResetProperties()
Reset all cluster properties.
void GetClusterSpanX(float &xmin, float &xmax) const
Get minimum and maximum X positions of the calo hits in this cluster.
unsigned int m_nCaloHits
The number of calo hits.
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.
InputFloat m_trackComparisonEnergy
The appropriate corrected energy to use in comparisons with track momentum, units GeV.
float GetShowerProfileDiscrepancy(const Pandora &pandora) const
Get the cluster shower profile discrepancy.
InputUInt m_outerPseudoLayer
The outermost pseudo layer in the cluster.
void ResetOutdatedProperties()
Reset those cluster properties that must be recalculated upon addition/removal of a calo hit.
InputFloat m_xMax
Cached cluster maximum in x.
unsigned int m_nPossibleMipHits
The number of calo hits that have been flagged as possible mip hits.
double m_isolatedHadronicEnergy
Sum of hadronic energy measures of isolated calo hits, units GeV.
void UpdateInitialDirectionCache() const
Update cluster initial direction.
ClusterFitResult m_fitToAllHitsResult
The result of a linear fit to all calo hits in the cluster.
unsigned int GetShowerStartLayer(const Pandora &pandora) const
Get the pseudo layer at which shower commences.
void UpdateLayerHitTypeCache(const unsigned int pseudoLayer, InputHitType &layerHitType) const
Update typical hit type for specified layer.
InputFloat m_showerProfileDiscrepancy
The cluster shower profile discrepancy.
OrderedCaloHitList m_orderedCaloHitList
The ordered calo hit list.
StatusCode RemoveCaloHit(const CaloHit *const pCaloHit)
Remove a calo hit from the cluster.
InputUInt m_showerStartLayer
The pseudo layer at which shower commences.
StatusCode MakeEnergyCorrections(const Cluster *const pCluster, float &correctedElectromagneticEnergy, float &correctedHadronicEnergy) const
Make an ordered list of energy corrections to a cluster.
Calo hit lists arranged by pseudo layer.
const_iterator end() const
Returns a const iterator referring to the past-the-end element in the ordered calo hit list.
const_iterator begin() const
Returns a const iterator referring to the first element in the ordered calo hit list.
void Reset()
Reset the ordered calo hit list, emptying its contents.
StatusCode Remove(const OrderedCaloHitList &rhs)
Remove the hits in a second ordered calo hit list from this list.
TheList::const_iterator const_iterator
const_reverse_iterator rbegin() const
Returns a const reverse iterator referring to the first element in the ordered calo hit list.
StatusCode Add(const OrderedCaloHitList &rhs)
Add the hits from a second ordered calo hit list to this list.
bool empty() const
Returns whether the map container is empty (i.e. whether its size is 0)
const_iterator find(const unsigned int index) const
Searches the container for an element with specified layer and returns an iterator to it if found,...
TheList::value_type value_type
bool IsEmShower(const T *const pT) const
Provide identification of whether a cluster or pfo is an electromagnetic shower.
ShowerProfilePlugin class.
virtual void CalculateShowerStartLayer(const Cluster *const pCluster, unsigned int &showerStartLayer) const =0
Get the layer at which shower can be considered to start; this function evaluates the the starting po...
virtual void CalculateLongitudinalProfile(const Cluster *const pCluster, float &profileStart, float &profileDiscrepancy) const =0
Calculate longitudinal shower profile for a cluster and compare it with the expected profile for a ph...
StatusCodeException class.
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.