ATLAS Offline Software
Loading...
Searching...
No Matches
PFUnifiedRadialEnergyCalculatorTool Class Reference

#include <PFUnifiedRadialEnergyCalculatorTool.h>

Inheritance diagram for PFUnifiedRadialEnergyCalculatorTool:
Collaboration diagram for PFUnifiedRadialEnergyCalculatorTool:

Public Member Functions

 ~PFUnifiedRadialEnergyCalculatorTool ()
virtual StatusCode processPFlowData (const EventContext &ctx, PFData &thePFData) const override

Detailed Description

Definition at line 14 of file PFUnifiedRadialEnergyCalculatorTool.h.

Constructor & Destructor Documentation

◆ ~PFUnifiedRadialEnergyCalculatorTool()

PFUnifiedRadialEnergyCalculatorTool::~PFUnifiedRadialEnergyCalculatorTool ( )
inline

Definition at line 20 of file PFUnifiedRadialEnergyCalculatorTool.h.

20{};

Member Function Documentation

◆ processPFlowData()

StatusCode PFUnifiedRadialEnergyCalculatorTool::processPFlowData ( const EventContext & ctx,
PFData & thePFData ) const
overridevirtual

Definition at line 17 of file PFUnifiedRadialEnergyCalculatorTool.cxx.

17 {
18
19 ATH_MSG_DEBUG("Accessed radial energy profile function");
20
21 if (!thePFData.caloObjects) {
22 ATH_MSG_ERROR("PFData::caloObjects is null; caller must set it before invoking the radial energy calculator tool");
23 return StatusCode::FAILURE;
24 }
25
26 eflowCaloObjectContainer *theEflowCaloObjectContainer = thePFData.caloObjects;
27
28 for (auto thisEflowCaloObject : *theEflowCaloObjectContainer){
29
30 //If there are no clusters available then we cannot calculate any calorimeter shower profiles
31 if (thisEflowCaloObject->nClusters() < 1 ) continue;
32
33 const std::vector<std::pair<eflowTrackClusterLink*,std::pair<float,float> > > matchedTrackList = thisEflowCaloObject->efRecLink();
34
35 for( auto track: matchedTrackList){
36
37 eflowRecTrack* efRecTrack = (track.first)->getTrack();
38
39 std::vector<eflowRecCluster*> matchedClusters;
40 matchedClusters.clear();
41 std::vector<eflowTrackClusterLink*> links = efRecTrack->getClusterMatches();
42 for (auto *thisEFlowTrackClusterLink : links) matchedClusters.push_back(thisEFlowTrackClusterLink->getCluster());
43
44 std::vector<std::pair<xAOD::CaloCluster*, bool> > clusterSubtractionList;
45 clusterSubtractionList.reserve(matchedClusters.size());
46 for (auto *thisEFlowRecCluster : matchedClusters) clusterSubtractionList.emplace_back(thisEFlowRecCluster->getCluster(),false);
47
48 eflowCellList calorimeterCellList;
49 eflowSubtract::Subtractor::makeOrderedCellList(efRecTrack->getTrackCaloPoints(),clusterSubtractionList,calorimeterCellList);
50
51 std::vector<int> layerToStoreVector;
52 std::vector<float> radiusToStoreVector;
53 std::vector<float> avgEdensityToStoreVector;
54
55 //Loop over calorimeter layers and in each layer we will calculate radial energy profiles.
56 for (int i=0; i < eflowCalo::nRegions ;i++){
57
59 ATH_MSG_DEBUG("layer is "<<layer);
60 double ringThickness = eflowRingThicknesses::ringThickness((eflowCaloENUM)i);
61 ATH_MSG_DEBUG("ring thickness is "<<ringThickness);
62
63 double eta_extr = calorimeterCellList.etaFF(layer);
64 ATH_MSG_DEBUG("extrapolated eta ["<<layer<<"] is "<<eta_extr);
65 double phi_extr = calorimeterCellList.phiFF(layer);
66 ATH_MSG_DEBUG("extrapolated phi ["<<layer<<"] is "<<phi_extr);
67
68 if (eta_extr == -999.0){
69 continue;
70 }
71
72 //Loop over rings of calorimeter cells going out in increasing radius from the track impact point in this calorimeter layer
73 for (unsigned int indexOfRing = 0; indexOfRing < 100; indexOfRing++){
74
75 CellIt beginRing = calorimeterCellList.getLowerBound((eflowCaloENUM)i, ringThickness*(indexOfRing));
76 if(beginRing == calorimeterCellList.end()) break;
77
78 int totalCellsinRing = 0;
79 double totalEnergyPerRing = 0;
80 double energyDensityPerRing = 0;
81 double averageEnergyDensityPerRing = 0;
82
83 //Get the list of calorimeter cells in this cell ring
84 std::vector<std::pair<const CaloCell*,int> > tempVector = (*beginRing).second;
85
86 //Loop over the calorimeter cells in this cell ring and calculate total and average energy densities in this cell ring.
87 for (auto thisPair : tempVector){
88 const CaloDetDescrElement* DDE = (thisPair.first)->caloDDE();
89 CaloCell_ID::CaloSample sampling = DDE->getSampling();
90
91 if(eflowCalo::translateSampl(sampling)!=(eflowCaloENUM)i) break;
92
93 ATH_MSG_DEBUG(" cell eta and phi are " << (thisPair.first)->eta() << " and " << (thisPair.first)->phi() << " with index " << thisPair.second << " and sampling of " << sampling);
94 ATH_MSG_DEBUG(" cell energy is " << (thisPair.first)->energy());
95
96 totalCellsinRing += 1;
97
98 totalEnergyPerRing += (thisPair.first)->energy();
99 double totalEnergyCell = (thisPair.first)->energy();
100 ATH_MSG_DEBUG(" Total E per Cell is " << totalEnergyCell);
101 ATH_MSG_DEBUG(" Total E per Ring is " << totalEnergyPerRing);
102
103 double cellVolume = DDE->volume();
104 ATH_MSG_DEBUG(" cell volume is " << cellVolume/1000.);
105
106 double energyDensityCell = totalEnergyCell/(cellVolume/1000.);
107 ATH_MSG_DEBUG(" E density per Cell is " << energyDensityCell);
108 ATH_MSG_DEBUG(" Initial added E density per Cell is " << energyDensityPerRing);
109 energyDensityPerRing += energyDensityCell;
110 ATH_MSG_DEBUG(" Final added E density per Cell is " << energyDensityPerRing);
111 averageEnergyDensityPerRing = energyDensityPerRing/((totalCellsinRing)*(efRecTrack->getTrack()->e()/1000.));
112
113 }
114
115 ATH_MSG_DEBUG(" track eta is " << efRecTrack->getTrack()->eta());
116 ATH_MSG_DEBUG(" track E is " << efRecTrack->getTrack()->e()/1000.);
117 ATH_MSG_DEBUG(" Average E density per Ring is " << averageEnergyDensityPerRing);
118
119 //Fill up the vectors with energy density, layer and ring radii
120 if (averageEnergyDensityPerRing != 0){
121 avgEdensityToStoreVector.push_back(averageEnergyDensityPerRing);
122 int layerToStore = (eflowCaloENUM)i;
123 ATH_MSG_DEBUG("layerToStore is "<< layerToStore);
124 layerToStoreVector.push_back(layerToStore);
125 double radiusToStore = (indexOfRing)*ringThickness;
126 ATH_MSG_DEBUG("radiusToStore is "<< radiusToStore);
127 radiusToStoreVector.push_back(radiusToStore);
128 }
129 else {ATH_MSG_DEBUG("averageEnergyDensityPerRing = 0");}
130
131 }//loop over rings of calorimeter cells
132
133 }//loop over the calorimeter layers
134
135 //Add the vectors with energy density, layer and ring radii to this eflowRecTrack
136 efRecTrack->setLayerCellOrderVector(layerToStoreVector);
137 efRecTrack->setRadiusCellOrderVector(radiusToStoreVector);
138 efRecTrack->setAvgEDensityCellOrderVector(avgEdensityToStoreVector);
139
140 }//loop over tracks matched to clusters
141
142 }//loop on eflowCaloObjectContainer
143
144 return StatusCode::SUCCESS;
145}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
CaloCell_ID::CaloSample getSampling() const
cell sampling
static LAYER translateSampl(CaloCell_ID::CaloSample sampl)
static const int nRegions
double etaFF(eflowCaloENUM layer) const
double phiFF(eflowCaloENUM layer) const
CellIt getLowerBound(eflowCaloENUM layer, double r)
const std::vector< eflowTrackClusterLink * > & getClusterMatches() const
void setRadiusCellOrderVector(const std::vector< float > &radiusToStoreVector)
const xAOD::TrackParticle * getTrack() const
const eflowTrackCaloPoints & getTrackCaloPoints() const
void setLayerCellOrderVector(const std::vector< int > &layerToStoreVector)
void setAvgEDensityCellOrderVector(const std::vector< float > &avgEdensityToStoreVector)
static double ringThickness(const eflowCaloENUM &layer)
static void makeOrderedCellList(const eflowTrackCaloPoints &trackCalo, const std::vector< std::pair< xAOD::CaloCluster *, bool > > &clusters, eflowCellList &orderedCells)
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double e() const override final
The total energy of the particle.
std::map< eflowCellPosition, std::vector< std::pair< constCaloCell *, int > > >::iterator CellIt
eflowCalo::LAYER eflowCaloENUM
@ layer
Definition HitInfo.h:79
eflowCaloObjectContainer * caloObjects
Definition PFData.h:17

The documentation for this class was generated from the following files: