ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PFCalcRadialEnergyProfiles Class Reference

#include <PFCalcRadialEnergyProfiles.h>

Inheritance diagram for PFCalcRadialEnergyProfiles:
Collaboration diagram for PFCalcRadialEnergyProfiles:

Public Member Functions

 PFCalcRadialEnergyProfiles ()
 
 ~PFCalcRadialEnergyProfiles ()=default
 
void calculate (const PFData &data) const
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 12 of file PFCalcRadialEnergyProfiles.h.

Constructor & Destructor Documentation

◆ PFCalcRadialEnergyProfiles()

PFCalcRadialEnergyProfiles::PFCalcRadialEnergyProfiles ( )
inline

Definition at line 16 of file PFCalcRadialEnergyProfiles.h.

17  : asg::AsgMessaging("PFCalcRadialEnergyProfiles")
18  {
19  }

◆ ~PFCalcRadialEnergyProfiles()

PFCalcRadialEnergyProfiles::~PFCalcRadialEnergyProfiles ( )
default

Member Function Documentation

◆ calculate()

void PFCalcRadialEnergyProfiles::calculate ( const PFData data) const

Definition at line 11 of file PFCalcRadialEnergyProfiles.cxx.

11  {
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 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49  {
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
53  return m_msg;
54 #endif // not XAOD_STANDALONE
55  }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level  lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57  {
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
61  m_msg << lvl;
62  return m_msg;
63 #endif // not XAOD_STANDALONE
64  }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level  lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41  {
42 #ifndef XAOD_STANDALONE
43  return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45  return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
47  }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
eflowRecTrack::setRadiusCellOrderVector
void setRadiusCellOrderVector(const std::vector< float > &radiusToStoreVector)
Definition: eflowRecTrack.h:97
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:100
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:94
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
eflowCellList
Concrete class derived class from pure virtual eflowAbstractCellList.
Definition: eflowCellList.h:42
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
eflowCellList::etaFF
double etaFF(eflowCaloENUM layer) const
Definition: eflowCellList.h:78
eflowRecTrack
This class extends the information about a xAOD::Track.
Definition: eflowRecTrack.h:46
eflowRecTrack::getClusterMatches
const std::vector< eflowTrackClusterLink * > & getClusterMatches() const
Definition: eflowRecTrack.h:67
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
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:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
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
eflowRecTrack::getTrack
const xAOD::TrackParticle * getTrack() const
Definition: eflowRecTrack.h:54
CaloDetDescrElement::volume
float volume() const
cell volume
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:381
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
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:56
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
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
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
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
eflowCaloENUM
eflowCalo::LAYER eflowCaloENUM
Definition: eflowCaloRegions.h:49