Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
Cluster.cc
Go to the documentation of this file.
1
10
11#include "Objects/CaloHit.h"
12#include "Objects/Cluster.h"
13#include "Objects/Track.h"
14
15#include "Pandora/Pandora.h"
16#include "Pandora/PdgTable.h"
17
21
22#include <algorithm>
23
24namespace pandora
25{
26
28{
29 if (!m_pTrackSeed)
30 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
31
32 return m_pTrackSeed;
33}
34
35//------------------------------------------------------------------------------------------------------------------------------------------
36
37const CartesianVector Cluster::GetCentroid(const unsigned int pseudoLayer) const
38{
39 PointByPseudoLayerMap::const_iterator pointValueIter = m_sumXYZByPseudoLayer.find(pseudoLayer);
40
41 if (m_sumXYZByPseudoLayer.end() == pointValueIter)
42 throw StatusCodeException(STATUS_CODE_FAILURE);
43
44 const SimplePoint &mypoint = pointValueIter->second;
45
46 if (0 == mypoint.m_nHits)
47 throw StatusCodeException(STATUS_CODE_FAILURE);
48
49 return CartesianVector(static_cast<float>(mypoint.m_xyzPositionSums[0] / static_cast<float>(mypoint.m_nHits)),
50 static_cast<float>(mypoint.m_xyzPositionSums[1] / static_cast<float>(mypoint.m_nHits)),
51 static_cast<float>(mypoint.m_xyzPositionSums[2] / static_cast<float>(mypoint.m_nHits)));
52}
53
54//------------------------------------------------------------------------------------------------------------------------------------------
55
63
64//------------------------------------------------------------------------------------------------------------------------------------------
65
73
74//------------------------------------------------------------------------------------------------------------------------------------------
75
83
84//------------------------------------------------------------------------------------------------------------------------------------------
85
93
94//------------------------------------------------------------------------------------------------------------------------------------------
95
103
104//------------------------------------------------------------------------------------------------------------------------------------------
105
113
114//------------------------------------------------------------------------------------------------------------------------------------------
115
123
124//------------------------------------------------------------------------------------------------------------------------------------------
125
127{
128 if (PHOTON == m_particleId)
129 return true;
130
132 this->UpdatePhotonIdCache(pandora);
133
134 return m_passPhotonId.Get();
135}
136
137//------------------------------------------------------------------------------------------------------------------------------------------
138
140{
142 this->UpdateShowerLayerCache(pandora);
143
144 return m_showerStartLayer.Get();
145}
146
147//------------------------------------------------------------------------------------------------------------------------------------------
148
150{
152 this->UpdateShowerProfileCache(pandora);
153
154 return m_showerProfileStart.Get();
155}
156
157//------------------------------------------------------------------------------------------------------------------------------------------
158
166
167//------------------------------------------------------------------------------------------------------------------------------------------
168
169void Cluster::GetClusterSpanX(float &xmin, float &xmax) const
170{
172 {
173 xmin = m_xMin.Get();
174 xmax = m_xMax.Get();
175 }
176 else
177 {
178 xmin = std::numeric_limits<float>::max();
179 xmax = -std::numeric_limits<float>::max();
180
182 {
183 for (CaloHitList::const_iterator hIter = ochIter->second->begin(); hIter != ochIter->second->end(); ++hIter)
184 {
185 const CaloHit *const pCaloHit = *hIter;
186 const CartesianVector &hit(pCaloHit->GetPositionVector());
187 xmin = std::min(hit.GetX(), xmin);
188 xmax = std::max(hit.GetX(), xmax);
189 }
190 }
191 m_xMin.Set(xmin);
192 m_xMax.Set(xmax);
193 }
194}
195
196//------------------------------------------------------------------------------------------------------------------------------------------
197
198void Cluster::GetClusterSpanZ(const float xmin, const float xmax, float &zmin, float &zmax) const
199{
200 if (xmin > xmax)
201 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
202
203 const OrderedCaloHitList &orderedCaloHitList(this->GetOrderedCaloHitList());
204
205 zmin = std::numeric_limits<float>::max();
206 zmax = -std::numeric_limits<float>::max();
207
208 bool foundHits(false);
209
210 for (OrderedCaloHitList::const_iterator ochIter = orderedCaloHitList.begin(), ochIterEnd = orderedCaloHitList.end(); ochIter != ochIterEnd; ++ochIter)
211 {
212 for (CaloHitList::const_iterator hIter = ochIter->second->begin(), hIterEnd = ochIter->second->end(); hIter != hIterEnd; ++hIter)
213 {
214 const CaloHit *const pCaloHit = *hIter;
215 const CartesianVector &hit(pCaloHit->GetPositionVector());
216
217 if (hit.GetX() < xmin || hit.GetX() > xmax)
218 continue;
219
220 zmin = std::min(hit.GetZ(), zmin);
221 zmax = std::max(hit.GetZ(), zmax);
222 foundHits = true;
223 }
224 }
225
226 if (!foundHits)
227 throw StatusCodeException(STATUS_CODE_NOT_FOUND);
228}
229
230//------------------------------------------------------------------------------------------------------------------------------------------
231
233 m_nCaloHits(0),
234 m_nPossibleMipHits(0),
235 m_nCaloHitsInOuterLayer(0),
236 m_electromagneticEnergy(0),
237 m_hadronicEnergy(0),
238 m_isolatedElectromagneticEnergy(0),
239 m_isolatedHadronicEnergy(0),
240 m_particleId(UNKNOWN_PARTICLE_TYPE),
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),
245 m_isAvailable(true)
246{
247 if (parameters.m_caloHitList.empty() && parameters.m_isolatedCaloHitList.empty() && !parameters.m_pTrack.IsInitialized())
248 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
249
250 if (parameters.m_pTrack.IsInitialized())
251 {
252 m_initialDirection = parameters.m_pTrack.Get()->GetTrackStateAtCalorimeter().GetMomentum().GetUnitVector();
254 }
255
256 for (const CaloHit *const pCaloHit : parameters.m_caloHitList)
257 {
258 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->AddCaloHit(pCaloHit));
259 }
260
261 for (const CaloHit *const pCaloHit : parameters.m_isolatedCaloHitList)
262 {
263 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->AddIsolatedCaloHit(pCaloHit));
264 }
265}
266
267//------------------------------------------------------------------------------------------------------------------------------------------
268
272
273//------------------------------------------------------------------------------------------------------------------------------------------
274
276{
277 if (metadata.m_particleId.IsInitialized())
278 {
280 m_particleId = metadata.m_particleId.Get();
281 }
282
283 return STATUS_CODE_SUCCESS;
284}
285
286//------------------------------------------------------------------------------------------------------------------------------------------
287
289{
290 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, m_orderedCaloHitList.Add(pCaloHit));
291
293
294 ++m_nCaloHits;
295
296 if (pCaloHit->IsPossibleMip())
298
299 if (pCaloHit->IsInOuterSamplingLayer())
301
302 const float x(pCaloHit->GetPositionVector().GetX());
303 const float y(pCaloHit->GetPositionVector().GetY());
304 const float z(pCaloHit->GetPositionVector().GetZ());
305
307 m_hadronicEnergy += pCaloHit->GetHadronicEnergy();
308
309 const unsigned int pseudoLayer(pCaloHit->GetPseudoLayer());
311
312 if ((m_orderedCaloHitList.end() != iter) && (iter->second->size() > 1))
313 {
314 SimplePoint &mypoint = m_sumXYZByPseudoLayer[pseudoLayer];
315 mypoint.m_xyzPositionSums[0] += x;
316 mypoint.m_xyzPositionSums[1] += y;
317 mypoint.m_xyzPositionSums[2] += z;
318 ++mypoint.m_nHits;
319 }
320 else
321 {
322 SimplePoint &mypoint = m_sumXYZByPseudoLayer[pseudoLayer];
323 mypoint.m_xyzPositionSums[0] = x;
324 mypoint.m_xyzPositionSums[1] = y;
325 mypoint.m_xyzPositionSums[2] = z;
326 mypoint.m_nHits = 1;
327 }
328
329 if (!m_innerPseudoLayer.IsInitialized() || (pseudoLayer < m_innerPseudoLayer.Get()))
330 m_innerPseudoLayer = pseudoLayer;
331
332 if (!m_outerPseudoLayer.IsInitialized() || (pseudoLayer > m_outerPseudoLayer.Get()))
333 m_outerPseudoLayer = pseudoLayer;
334
335 return STATUS_CODE_SUCCESS;
336}
337
338//------------------------------------------------------------------------------------------------------------------------------------------
339
341{
342 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, m_orderedCaloHitList.Remove(pCaloHit));
343
345 return this->ResetProperties();
346
348
349 --m_nCaloHits;
350
351 if (pCaloHit->IsPossibleMip())
353
354 if (pCaloHit->IsInOuterSamplingLayer())
356
357 const float x(pCaloHit->GetPositionVector().GetX());
358 const float y(pCaloHit->GetPositionVector().GetY());
359 const float z(pCaloHit->GetPositionVector().GetZ());
360
362 m_hadronicEnergy -= pCaloHit->GetHadronicEnergy();
363
364 const unsigned int pseudoLayer(pCaloHit->GetPseudoLayer());
365
367 {
368 SimplePoint &mypoint = m_sumXYZByPseudoLayer[pseudoLayer];
369 mypoint.m_xyzPositionSums[0] -= x;
370 mypoint.m_xyzPositionSums[1] -= y;
371 mypoint.m_xyzPositionSums[2] -= z;
372 --mypoint.m_nHits;
373 }
374 else
375 {
376 m_sumXYZByPseudoLayer.erase(pseudoLayer);
377 }
378
379 if (pseudoLayer <= m_innerPseudoLayer.Get())
381
382 if (pseudoLayer >= m_outerPseudoLayer.Get())
384
385 return STATUS_CODE_SUCCESS;
386}
387
388//------------------------------------------------------------------------------------------------------------------------------------------
389
391{
392 if (m_isolatedCaloHitList.end() != std::find(m_isolatedCaloHitList.begin(), m_isolatedCaloHitList.end(), pCaloHit))
393 return STATUS_CODE_ALREADY_PRESENT;
394
395 m_isolatedCaloHitList.push_back(pCaloHit);
396 const float electromagneticEnergy(pCaloHit->GetElectromagneticEnergy());
397 const float hadronicEnergy(pCaloHit->GetHadronicEnergy());
398
399 m_electromagneticEnergy += electromagneticEnergy;
400 m_hadronicEnergy += hadronicEnergy;
401 m_isolatedElectromagneticEnergy += electromagneticEnergy;
402 m_isolatedHadronicEnergy += hadronicEnergy;
403
404 return STATUS_CODE_SUCCESS;
405}
406
407//------------------------------------------------------------------------------------------------------------------------------------------
408
410{
411 CaloHitList::iterator iter = std::find(m_isolatedCaloHitList.begin(), m_isolatedCaloHitList.end(), pCaloHit);
412
413 if (m_isolatedCaloHitList.end() == iter)
414 return STATUS_CODE_NOT_FOUND;
415
416 m_isolatedCaloHitList.erase(iter);
417
418 const float electromagneticEnergy(pCaloHit->GetElectromagneticEnergy());
419 const float hadronicEnergy(pCaloHit->GetHadronicEnergy());
420
421 m_electromagneticEnergy -= electromagneticEnergy;
422 m_hadronicEnergy -= hadronicEnergy;
423 m_isolatedElectromagneticEnergy -= electromagneticEnergy;
424 m_isolatedHadronicEnergy -= hadronicEnergy;
425
426 return STATUS_CODE_SUCCESS;
427}
428
429//------------------------------------------------------------------------------------------------------------------------------------------
430
436
437//------------------------------------------------------------------------------------------------------------------------------------------
438
440{
442 {
443 m_initialDirection.SetValues(0.f, 0.f, 0.f);
444 m_isDirectionUpToDate = false;
445 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
446 }
447
448 CartesianVector initialDirection(0.f, 0.f, 0.f);
449 CaloHitList *const pCaloHitList(m_orderedCaloHitList.begin()->second);
450
451 for (const CaloHit *const pCaloHit : *pCaloHitList)
452 initialDirection += pCaloHit->GetExpectedDirection();
453
454 m_initialDirection = initialDirection.GetUnitVector();
456}
457
458//------------------------------------------------------------------------------------------------------------------------------------------
459
460void Cluster::UpdateLayerHitTypeCache(const unsigned int pseudoLayer, InputHitType &layerHitType) const
461{
463
464 if ((m_orderedCaloHitList.end() == listIter) || (listIter->second->empty()))
465 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
466
467 HitTypeToEnergyMap hitTypeToEnergyMap;
468
469 for (const CaloHit *const pCaloHit : *listIter->second)
470 {
471 HitTypeToEnergyMap::iterator mapIter = hitTypeToEnergyMap.find(pCaloHit->GetHitType());
472
473 if (hitTypeToEnergyMap.end() != mapIter)
474 {
475 mapIter->second += pCaloHit->GetHadronicEnergy();
476 continue;
477 }
478
479 if (!hitTypeToEnergyMap.insert(HitTypeToEnergyMap::value_type(pCaloHit->GetHitType(), pCaloHit->GetHadronicEnergy())).second)
480 throw StatusCodeException(STATUS_CODE_FAILURE);
481 }
482
483 float highestEnergy(0.f);
484
485 for (HitTypeToEnergyMap::value_type &mapEntry : hitTypeToEnergyMap)
486 {
487 if (mapEntry.second > highestEnergy)
488 {
489 layerHitType = mapEntry.first;
490 highestEnergy = mapEntry.second;
491 }
492 }
493}
494
495//------------------------------------------------------------------------------------------------------------------------------------------
496
498{
499 const EnergyCorrections *const pEnergyCorrections(pandora.GetPlugins()->GetEnergyCorrections());
500 const ParticleId *const pParticleId(pandora.GetPlugins()->GetParticleId());
501
502 float correctedElectromagneticEnergy(0.f), correctedHadronicEnergy(0.f), trackComparisonEnergy(0.f);
503 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, pEnergyCorrections->MakeEnergyCorrections(this, correctedElectromagneticEnergy,
504 correctedHadronicEnergy));
505
506 if (pParticleId->IsEmShower(this))
507 {
508 trackComparisonEnergy = correctedElectromagneticEnergy;
509 }
510 else
511 {
512 trackComparisonEnergy = correctedHadronicEnergy;
513 }
514
515 if (!(m_correctedElectromagneticEnergy = correctedElectromagneticEnergy) || !(m_correctedHadronicEnergy = correctedHadronicEnergy) ||
516 !(m_trackComparisonEnergy = trackComparisonEnergy))
517 {
518 throw StatusCodeException(STATUS_CODE_FAILURE);
519 }
520}
521
522//------------------------------------------------------------------------------------------------------------------------------------------
523
525{
526 const bool passPhotonId(pandora.GetPlugins()->GetParticleId()->IsPhoton(this));
527
528 if (!(m_passPhotonId = passPhotonId))
529 throw StatusCodeException(STATUS_CODE_FAILURE);
530}
531
532//------------------------------------------------------------------------------------------------------------------------------------------
533
535{
536 const ShowerProfilePlugin *const pShowerProfilePlugin(pandora.GetPlugins()->GetShowerProfilePlugin());
537
538 unsigned int showerStartLayer(std::numeric_limits<unsigned int>::max());
539 pShowerProfilePlugin->CalculateShowerStartLayer(this, showerStartLayer);
540
541 if (!(m_showerStartLayer = showerStartLayer))
542 throw StatusCodeException(STATUS_CODE_FAILURE);
543}
544
545//------------------------------------------------------------------------------------------------------------------------------------------
546
548{
549 const ShowerProfilePlugin *const pShowerProfilePlugin(pandora.GetPlugins()->GetShowerProfilePlugin());
550
551 float showerProfileStart(std::numeric_limits<float>::max()), showerProfileDiscrepancy(std::numeric_limits<float>::max());
552 pShowerProfilePlugin->CalculateLongitudinalProfile(this, showerProfileStart, showerProfileDiscrepancy);
553
554 if (!(m_showerProfileStart = showerProfileStart) || !(m_showerProfileDiscrepancy = showerProfileDiscrepancy))
555 throw StatusCodeException(STATUS_CODE_FAILURE);
556}
557
558//------------------------------------------------------------------------------------------------------------------------------------------
559
561{
564
565 m_isolatedCaloHitList.clear();
566
567 m_nCaloHits = 0;
570
571 m_sumXYZByPseudoLayer.clear();
572
575
578
580
582 return STATUS_CODE_SUCCESS;
583}
584
585//------------------------------------------------------------------------------------------------------------------------------------------
586
605
606//------------------------------------------------------------------------------------------------------------------------------------------
607
609{
610 if (this == pCluster)
611 return STATUS_CODE_NOT_ALLOWED;
612
613 const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
614 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, m_orderedCaloHitList.Add(orderedCaloHitList));
615
616 const CaloHitList &isolatedCaloHitList(pCluster->GetIsolatedCaloHitList());
617 for (const CaloHit *const pCaloHit : isolatedCaloHitList)
618 {
619 if (m_isolatedCaloHitList.end() != std::find(m_isolatedCaloHitList.begin(), m_isolatedCaloHitList.end(), pCaloHit))
620 return STATUS_CODE_ALREADY_PRESENT;
621
622 m_isolatedCaloHitList.push_back(pCaloHit);
623 }
624
626
627 m_nCaloHits += pCluster->GetNCaloHits();
630
632 m_hadronicEnergy += pCluster->GetHadronicEnergy();
633
634 // Loop over pseudo layers in second cluster
635 for (const OrderedCaloHitList::value_type &layerEntry : orderedCaloHitList)
636 {
637 const unsigned int pseudoLayer(layerEntry.first);
639
640 SimplePoint &mypoint = m_sumXYZByPseudoLayer[pseudoLayer];
641 const SimplePoint &theirpoint = pCluster->m_sumXYZByPseudoLayer.at(pseudoLayer);
642
643 if ((m_orderedCaloHitList.end() != currentIter) && (currentIter->second->size() > 1))
644 {
645 mypoint.m_xyzPositionSums[0] += theirpoint.m_xyzPositionSums[0];
646 mypoint.m_xyzPositionSums[1] += theirpoint.m_xyzPositionSums[1];
647 mypoint.m_xyzPositionSums[2] += theirpoint.m_xyzPositionSums[2];
648 mypoint.m_nHits += theirpoint.m_nHits;
649 }
650 else
651 {
652 mypoint.m_xyzPositionSums[0] = theirpoint.m_xyzPositionSums[0];
653 mypoint.m_xyzPositionSums[1] = theirpoint.m_xyzPositionSums[1];
654 mypoint.m_xyzPositionSums[2] = theirpoint.m_xyzPositionSums[2];
655 mypoint.m_nHits = theirpoint.m_nHits;
656 }
657 }
658
661 return STATUS_CODE_SUCCESS;
662}
663
664//------------------------------------------------------------------------------------------------------------------------------------------
665
667{
668 if (!pTrack)
669 return STATUS_CODE_INVALID_PARAMETER;
670
671 if (m_associatedTrackList.end() != std::find(m_associatedTrackList.begin(), m_associatedTrackList.end(), pTrack))
672 return STATUS_CODE_ALREADY_PRESENT;
673
674 m_associatedTrackList.push_back(pTrack);
675 return STATUS_CODE_SUCCESS;
676}
677
678//------------------------------------------------------------------------------------------------------------------------------------------
679
681{
682 TrackList::iterator iter = std::find(m_associatedTrackList.begin(), m_associatedTrackList.end(), pTrack);
683
684 if (m_associatedTrackList.end() == iter)
685 return STATUS_CODE_NOT_FOUND;
686
687 m_associatedTrackList.erase(iter);
688 return STATUS_CODE_SUCCESS;
689}
690
691//------------------------------------------------------------------------------------------------------------------------------------------
692
694{
695 m_pTrackSeed = nullptr;
697}
698
699} // namespace pandora
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)
Definition StatusCodes.h:43
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
Header file for the track class.
CaloHit class.
Definition CaloHit.h:26
float GetElectromagneticEnergy() const
Get the calibrated electromagnetic energy measure.
Definition CaloHit.h:483
bool IsInOuterSamplingLayer() const
Whether cell is in one of the outermost detector sampling layers.
Definition CaloHit.h:469
unsigned int GetPseudoLayer() const
Get pseudo layer for the calo hit.
Definition CaloHit.h:462
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
Definition CaloHit.h:350
bool IsPossibleMip() const
Whether the calo hit is flagged as a possible mip hit.
Definition CaloHit.h:504
float GetHadronicEnergy() const
Get the calibrated hadronic energy measure.
Definition CaloHit.h:490
CartesianVector class.
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.
ClusterFitResult class.
void Reset()
Reset the cluster fit result.
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
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
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
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
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
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 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
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
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
Cluster(const object_creation::Cluster::Parameters &parameters)
Constructor.
Definition Cluster.cc:232
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
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
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
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
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
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,...
Pandora class.
Definition Pandora.h:40
void Set(const T &t)
Set the value held by the pandora type.
void Reset()
Reset the pandora type.
bool IsInitialized() const
Whether the pandora type is initialized.
const T & Get() const
Get the value held by the pandora type.
ParticleId class.
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.
Track class.
Definition Track.h:26
HitType
Calorimeter hit type enum.
@ UNKNOWN_PARTICLE_TYPE
Definition PdgTable.h:103
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.