ATLAS Offline Software
PFCalcRadialEnergyProfiles.cxx
Go to the documentation of this file.
10 
12 
13  ATH_MSG_DEBUG("Accessed radial energy profile function");
14 
15  for (auto thisEflowCaloObject : *data.caloObjects){
16 
17  //If there are no clusters available then we cannot calculate any calorimeter shower profiles
18  if (thisEflowCaloObject->nClusters() < 1 ) continue;
19 
20  const std::vector<std::pair<eflowTrackClusterLink*,std::pair<float,float> > > matchedTrackList = thisEflowCaloObject->efRecLink();
21 
22  for( auto track: matchedTrackList){
23 
24  eflowRecTrack* efRecTrack = (track.first)->getTrack();
25 
26  std::vector<eflowRecCluster*> matchedClusters;
27  matchedClusters.clear();
28  std::vector<eflowTrackClusterLink*> links = efRecTrack->getClusterMatches();
29  for (auto *thisEFlowTrackClusterLink : links) matchedClusters.push_back(thisEFlowTrackClusterLink->getCluster());
30 
31  std::vector<std::pair<xAOD::CaloCluster*, bool> > clusterSubtractionList;
32  clusterSubtractionList.reserve(matchedClusters.size());
33 for (auto *thisEFlowRecCluster : matchedClusters) clusterSubtractionList.emplace_back(thisEFlowRecCluster->getCluster(),false);
34 
35  eflowCellList calorimeterCellList;
36  eflowSubtract::Subtractor::makeOrderedCellList(efRecTrack->getTrackCaloPoints(),clusterSubtractionList,calorimeterCellList);
37 
38  std::vector<int> layerToStoreVector;
39  std::vector<float> radiusToStoreVector;
40  std::vector<float> avgEdensityToStoreVector;
41 
42  //Loop over calorimeter layers and in each layer we will calculate radial energy profiles.
43  for (int i=0; i < eflowCalo::nRegions ;i++){
44 
46  ATH_MSG_DEBUG("layer is "<<layer);
47  double ringThickness = eflowRingThicknesses::ringThickness((eflowCaloENUM)i);
48  ATH_MSG_DEBUG("ring thickness is "<<ringThickness);
49 
50  double eta_extr = calorimeterCellList.etaFF(layer);
51  ATH_MSG_DEBUG("extrapolated eta ["<<layer<<"] is "<<eta_extr);
52  double phi_extr = calorimeterCellList.phiFF(layer);
53  ATH_MSG_DEBUG("extrapolated phi ["<<layer<<"] is "<<phi_extr);
54 
55  if (eta_extr == -999.0){
56  continue;
57  }
58 
59  //Loop over rings of calorimeter cells going out in increasing radius from the track impact point in this calorimeter layer
60  for (unsigned int indexOfRing = 0; indexOfRing < 100; indexOfRing++){
61 
62  CellIt beginRing = calorimeterCellList.getLowerBound((eflowCaloENUM)i, ringThickness*(indexOfRing));
63  if(beginRing == calorimeterCellList.end()) break;
64 
65  int totalCellsinRing = 0;
66  double totalEnergyPerRing = 0;
67  double energyDensityPerRing = 0;
68  double averageEnergyDensityPerRing = 0;
69 
70  //Get the list of calorimeter cells in this cell ring
71  std::vector<std::pair<const CaloCell*,int> > tempVector = (*beginRing).second;
72 
73  //Loop over the calorimeter cells in this cell ring and calculate total and average energy densities in this cell ring.
74  for (auto thisPair : tempVector){
75  const CaloDetDescrElement* DDE = (thisPair.first)->caloDDE();
76  CaloCell_ID::CaloSample sampling = DDE->getSampling();
77 
78  if(eflowCalo::translateSampl(sampling)!=(eflowCaloENUM)i) break;
79 
80  ATH_MSG_DEBUG(" cell eta and phi are " << (thisPair.first)->eta() << " and " << (thisPair.first)->phi() << " with index " << thisPair.second << " and sampling of " << sampling);
81  ATH_MSG_DEBUG(" cell energy is " << (thisPair.first)->energy());
82 
83  totalCellsinRing += 1;
84 
85  totalEnergyPerRing += (thisPair.first)->energy();
86  double totalEnergyCell = (thisPair.first)->energy();
87  ATH_MSG_DEBUG(" Total E per Cell is " << totalEnergyCell);
88  ATH_MSG_DEBUG(" Total E per Ring is " << totalEnergyPerRing);
89 
90  double cellVolume = DDE->volume();
91  ATH_MSG_DEBUG(" cell volume is " << cellVolume/1000.);
92 
93  double energyDensityCell = totalEnergyCell/(cellVolume/1000.);
94  ATH_MSG_DEBUG(" E density per Cell is " << energyDensityCell);
95  ATH_MSG_DEBUG(" Initial added E density per Cell is " << energyDensityPerRing);
96  energyDensityPerRing += energyDensityCell;
97  ATH_MSG_DEBUG(" Final added E density per Cell is " << energyDensityPerRing);
98  averageEnergyDensityPerRing = energyDensityPerRing/((totalCellsinRing)*(efRecTrack->getTrack()->e()/1000.));
99 
100  }
101 
102  ATH_MSG_DEBUG(" track eta is " << efRecTrack->getTrack()->eta());
103  ATH_MSG_DEBUG(" track E is " << efRecTrack->getTrack()->e()/1000.);
104  ATH_MSG_DEBUG(" Average E density per Ring is " << averageEnergyDensityPerRing);
105 
106  //Fill up the vectors with energy density, layer and ring radii
107  if (averageEnergyDensityPerRing != 0){
108  avgEdensityToStoreVector.push_back(averageEnergyDensityPerRing);
109  int layerToStore = (eflowCaloENUM)i;
110  ATH_MSG_DEBUG("layerToStore is "<< layerToStore);
111  layerToStoreVector.push_back(layerToStore);
112  double radiusToStore = (indexOfRing)*ringThickness;
113  ATH_MSG_DEBUG("radiusToStore is "<< radiusToStore);
114  radiusToStoreVector.push_back(radiusToStore);
115  }
116  else {ATH_MSG_DEBUG("averageEnergyDensityPerRing = 0");}
117 
118  }//loop over rings of calorimeter cells
119 
120  }//loop over the calorimeter layers
121 
122  //Add the vectors with energy density, layer and ring radii to this eflowRecTrack
123  efRecTrack->setLayerCellOrderVector(layerToStoreVector);
124  efRecTrack->setRadiusCellOrderVector(radiusToStoreVector);
125  efRecTrack->setAvgEDensityCellOrderVector(avgEdensityToStoreVector);
126 
127  }//loop over tracks matched to clusters
128 
129  }//loop on eflowCaloObjectContainer
130 
131 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
eflowRecTrack::setRadiusCellOrderVector
void setRadiusCellOrderVector(const std::vector< float > &radiusToStoreVector)
Definition: eflowRecTrack.h:110
eflowCellList::phiFF
double phiFF(eflowCaloENUM layer) const
Definition: eflowCellList.h:79
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
eflowRecTrack::setAvgEDensityCellOrderVector
void setAvgEDensityCellOrderVector(const std::vector< float > &avgEdensityToStoreVector)
Definition: eflowRecTrack.h:113
eflowSubtractor.h
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
eflowCellList::end
CellIt end()
Definition: eflowCellList.h:57
eflowRecTrack::setLayerCellOrderVector
void setLayerCellOrderVector(const std::vector< int > &layerToStoreVector)
Definition: eflowRecTrack.h:107
eflowCellList
Concrete class derived class from pure virtual eflowAbstractCellList.
Definition: eflowCellList.h:42
eflowCellList::etaFF
double etaFF(eflowCaloENUM layer) const
Definition: eflowCellList.h:78
PFCalcRadialEnergyProfiles.h
eflowRecTrack
This class extends the information about a xAOD::Track.
Definition: eflowRecTrack.h:45
eflowRingThicknesses.h
eflowRecTrack::getClusterMatches
const std::vector< eflowTrackClusterLink * > & getClusterMatches() const
Definition: eflowRecTrack.h:66
eflowRecTrack.h
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
eflowRingThicknesses::ringThickness
static double ringThickness(const eflowCaloENUM &layer)
Definition: eflowRingThicknesses.cxx:5
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloCluster.h
DMTest::links
links
Definition: CLinks_v1.cxx:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
PFCalcRadialEnergyProfiles::calculate
void calculate(const PFData &data) const
Definition: PFCalcRadialEnergyProfiles.cxx:11
eflowRecCluster.h
PFData
Definition: PFData.h:11
eflowCellList.h
eflowRecTrack::getTrack
const xAOD::TrackParticle * getTrack() const
Definition: eflowRecTrack.h:53
CaloDetDescrElement::volume
float volume() const
cell volume
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:381
eflowCaloObject.h
eflowCalo::nRegions
static const int nRegions
Definition: eflowCaloRegions.h:45
xAOD::TrackParticle_v1::e
virtual double e() const override final
The total energy of the particle.
Definition: TrackParticle_v1.cxx:109
CellIt
std::map< eflowCellPosition, std::vector< std::pair< const CaloCell *, int > > >::iterator CellIt
Definition: eflowAbstractCellList.h:25
eflowRecTrack::getTrackCaloPoints
const eflowTrackCaloPoints & getTrackCaloPoints() const
Definition: eflowRecTrack.h:55
eflowCalo::LAYER
LAYER
Definition: eflowCaloRegions.h:36
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
eflowSubtract::Subtractor::makeOrderedCellList
static void makeOrderedCellList(const eflowTrackCaloPoints &trackCalo, const std::vector< std::pair< xAOD::CaloCluster *, bool >> &clusters, eflowCellList &orderedCells)
Definition: eflowSubtractor.cxx:51
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
eflowCellList::getLowerBound
CellIt getLowerBound(eflowCaloENUM layer, double r)
Definition: eflowCellList.h:59
eflowCalo::translateSampl
static LAYER translateSampl(CaloCell_ID::CaloSample sampl)
Definition: eflowCaloRegions.cxx:45
eflowCaloENUM
eflowCalo::LAYER eflowCaloENUM
Definition: eflowCaloRegions.h:49