ATLAS Offline Software
CaloCalibClusterMomentsMaker2.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef CALOCALIBHITREC_CALOCALIBCLUSTERMOMENTSMAKER2_H
6 #define CALOCALIBHITREC_CALOCALIBCLUSTERMOMENTSMAKER2_H
7 
18 class CaloCell_ID;
19 class CaloDM_ID;
20 class CaloDmDescrManager;
22 class McEventCollection;
24 
25 #include "GaudiKernel/ToolHandle.h"
26 
28 #include "CaloGeoHelpers/CaloSampling.h"
33 
35 
36 #include <string>
37 #include <vector>
38 #include <set>
39 #include <map>
40 #include <atomic>
41 #include <array>
42 
44 {
45  public:
46 
51  public:
53  };
54 
58  class MyCellInfo {
59  public:
60  MyCellInfo(int iClus, double w)
61  {
62  m_ClusWeights.emplace_back(iClus, w);
63  }
64  void Add(const MyCellInfo& other)
65  {
66  for (const std::pair<int, double>& p : other.m_ClusWeights) {
67  m_ClusWeights.push_back( p );
68  }
69  }
70  std::vector<std::pair<int, double> > m_ClusWeights;
71  };
72 
73  typedef std::map<Identifier, MyCellInfo> CellInfoSet_t;
74 
78  class MyClusInfo {
79  public:
81  public:
82  double engTot;
83  std::vector<double > engSmp;
85  void Add(double eng, int nsmp)
86  {
87  engTot += eng;
88  engSmp[nsmp] +=eng;
89  }
90  };
91 
94  engCalibParticle.clear();
95  }
96 
97  void Add(double eng, int nsmp, int pid = 0)
98  {
99  engCalibIn.Add(eng, nsmp);
101  if(pos != engCalibParticle.end()) {
102  pos->second.Add(eng, nsmp);
103  }else{
105  tmp.Add(eng, nsmp);
107  }
108  }
109 
111  double engCalibOut;
112  double engCalibDead;
113  std::vector<double > engCalibDeadInArea;
114  std::map<int, ClusCalibEnergy > engCalibParticle;
115  };
116  typedef std::vector<MyClusInfo> ClusInfo_t;
117 
118 
121  typedef std::pair<std::string,xAOD::CaloCluster::MomentType>
123 
125  typedef std::vector<moment_name_pair> moment_name_vector;
126 
128  typedef std::set<moment_name_pair> moment_name_set;
129 
130  CaloCalibClusterMomentsMaker2(const std::string& type, const std::string& name,
131  const IInterface* parent);
132 
133 
135  virtual StatusCode execute(const EventContext& ctx,
136  xAOD::CaloClusterContainer* theClusColl) const override;
137  virtual StatusCode initialize() override;
138 
139  private:
140 
147  std::vector<std::string> m_momentsNames;
148 
159 
167 
174  std::vector<std::string> m_momentsNamesAOD;
175 
182  std::set<xAOD::CaloCluster::MomentType> m_momentsAOD;
183 
190 
197 
199  SG::ReadHandleKey<xAOD::TruthParticleContainer> m_truthParticleContainerKey{this,"TruthParticles","TruthParticles","ReadHandleKey for truth particle container"};
200 
202  SG::ReadCondHandleKey<CaloDetDescrManager> m_caloDetDescrMgrKey{this,"CaloDetDescrManager", "CaloDetDescrManager"};
203 
205 
207 
209 
214 
215  double m_rmaxOut[3];
216 
217  std::array<std::vector<std::vector<CalibHitIPhiIEtaRange>>,3> m_i_phi_eta;
218 
219  mutable std::atomic<bool> m_foundAllContainers{};
220 
223 
228  bool m_doDeadL;
229  bool m_doDeadM;
230  bool m_doDeadT;
233  float m_energyMin;
236  float m_apars_r0;
238 
239  static double angle_mollier_factor(double x) ;
240  void get_calib_frac(const std::map<unsigned int,int>& truthBarcodeToPdgCodeMap,
241  const MyClusInfo& clusInfo, std::vector<double> &engFrac) const;
242 };
243 
244 #endif // CALOCALIBCLUSTERMOMENTSMAKER2_H
245 
246 
247 
248 
249 
250 
ReadHandleKeyArray.h
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CaloCalibClusterMomentsMaker2::m_truthParticleContainerKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
ReadHandleKey for truth particle container.
Definition: CaloCalibClusterMomentsMaker2.h:199
CaloCalibClusterMomentsMaker2::m_apars_r0
float m_apars_r0
Definition: CaloCalibClusterMomentsMaker2.h:236
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
CaloCalibClusterMomentsMaker2::m_caloDM_ID
const CaloDM_ID * m_caloDM_ID
Definition: CaloCalibClusterMomentsMaker2.h:206
CaloCalibClusterMomentsMaker2::kCalibFracHAD
@ kCalibFracHAD
Definition: CaloCalibClusterMomentsMaker2.h:222
CaloCalibClusterMomentsMaker2::execute
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *theClusColl) const override
Execute on an entire collection of clusters.
Definition: CaloCalibClusterMomentsMaker2.cxx:278
CaloCalibClusterMomentsMaker2::moment_name_vector
std::vector< moment_name_pair > moment_name_vector
vector of pairs defined above.
Definition: CaloCalibClusterMomentsMaker2.h:125
CaloCalibClusterMomentsMaker2::moment_name_pair
std::pair< std::string, xAOD::CaloCluster::MomentType > moment_name_pair
typedef for a pair to index the enums defined in CaloClusterMoment with a string.
Definition: CaloCalibClusterMomentsMaker2.h:122
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
CaloCalibClusterMomentsMaker2::MyClusInfo::MyClusInfo
MyClusInfo()
Definition: CaloCalibClusterMomentsMaker2.h:92
CaloCalibClusterMomentsMaker2::m_i_phi_eta
std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > m_i_phi_eta
Definition: CaloCalibClusterMomentsMaker2.h:217
CaloCalibClusterMomentsMaker2::MyClusInfo::ClusCalibEnergy::Add
void Add(double eng, int nsmp)
Definition: CaloCalibClusterMomentsMaker2.h:85
CaloCalibClusterMomentsMaker2::m_momentsAOD
std::set< xAOD::CaloCluster::MomentType > m_momentsAOD
set holding the list of moment enums which go in the first store i.e.
Definition: CaloCalibClusterMomentsMaker2.h:182
CaloCalibClusterMomentsMaker2::m_rmaxOut
double m_rmaxOut[3]
Definition: CaloCalibClusterMomentsMaker2.h:215
CaloCalibClusterMomentsMaker2::moment_name_set
std::set< moment_name_pair > moment_name_set
set of pairs defined above.
Definition: CaloCalibClusterMomentsMaker2.h:128
TruthParticleContainer.h
CaloClusterCollectionProcessor::execute
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *collection) const =0
Execute on an entire collection of clusters.
CaloCalibClusterMomentsMaker2::m_calo_id
const CaloCell_ID * m_calo_id
Definition: CaloCalibClusterMomentsMaker2.h:204
CaloCalibClusterMomentsMaker2::m_energyMin
float m_energyMin
Definition: CaloCalibClusterMomentsMaker2.h:233
CaloCalibClusterMomentsMaker2::MyClusInfo::ClusCalibEnergy::ClusCalibEnergy
ClusCalibEnergy()
Definition: CaloCalibClusterMomentsMaker2.h:84
CaloClusterCollectionProcessor
Definition: CaloClusterCollectionProcessor.h:32
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
CaloCalibClusterMomentsMaker2::m_useParticleID
bool m_useParticleID
Definition: CaloCalibClusterMomentsMaker2.h:231
CaloCalibClusterMomentsMaker2::m_momentsNamesAOD
std::vector< std::string > m_momentsNamesAOD
vector holding the list of moment names which go in the first store i.e.
Definition: CaloCalibClusterMomentsMaker2.h:174
CaloCalibClusterMomentsMaker2::m_doOutOfClusterL
bool m_doOutOfClusterL
Definition: CaloCalibClusterMomentsMaker2.h:225
SG::ReadHandleKey< xAOD::TruthParticleContainer >
TruthParticleContainer
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleContainer.h:42
x
#define x
CaloCalibClusterMomentsMaker2::CalibHitIPhiIEtaRange::iPhi
char iPhi
Definition: CaloCalibClusterMomentsMaker2.h:52
CaloCalibrationHitContainer.h
CaloCalibClusterMomentsMaker2::m_apars_alpha
float m_apars_alpha
Definition: CaloCalibClusterMomentsMaker2.h:235
CaloCell_ID.h
CaloCalibClusterMomentsMaker2::m_energyMinCalib
float m_energyMinCalib
Definition: CaloCalibClusterMomentsMaker2.h:234
CaloCalibClusterMomentsMaker2::MyClusInfo::Add
void Add(double eng, int nsmp, int pid=0)
Definition: CaloCalibClusterMomentsMaker2.h:97
CaloCalibClusterMomentsMaker2::CellInfoSet_t
std::map< Identifier, MyCellInfo > CellInfoSet_t
Definition: CaloCalibClusterMomentsMaker2.h:73
CaloCalibClusterMomentsMaker2::MyClusInfo::ClusCalibEnergy
Definition: CaloCalibClusterMomentsMaker2.h:80
CaloCalibClusterMomentsMaker2::m_MatchDmType
int m_MatchDmType
Definition: CaloCalibClusterMomentsMaker2.h:237
CaloCalibClusterMomentsMaker2::CaloCalibClusterMomentsMaker2
CaloCalibClusterMomentsMaker2(const std::string &type, const std::string &name, const IInterface *parent)
Definition: CaloCalibClusterMomentsMaker2.cxx:56
CaloCalibClusterMomentsMaker2::m_n_phi_out
int m_n_phi_out
Definition: CaloCalibClusterMomentsMaker2.h:210
CaloCalibClusterMomentsMaker2::MyClusInfo::engCalibDead
double engCalibDead
Definition: CaloCalibClusterMomentsMaker2.h:112
CaloCalibClusterMomentsMaker2::m_DMCalibrationHitContainerNames
SG::ReadHandleKeyArray< CaloCalibrationHitContainer > m_DMCalibrationHitContainerNames
vector of dead material calibration hit container names to use.
Definition: CaloCalibClusterMomentsMaker2.h:196
CaloCalibClusterMomentsMaker2::kCalibFracEM
@ kCalibFracEM
Definition: CaloCalibClusterMomentsMaker2.h:222
CaloCalibClusterMomentsMaker2::ClusInfo_t
std::vector< MyClusInfo > ClusInfo_t
Definition: CaloCalibClusterMomentsMaker2.h:116
CaloCalibClusterMomentsMaker2::m_doOutOfClusterM
bool m_doOutOfClusterM
Definition: CaloCalibClusterMomentsMaker2.h:226
CaloCalibClusterMomentsMaker2::MyClusInfo::engCalibDeadInArea
std::vector< double > engCalibDeadInArea
Definition: CaloCalibClusterMomentsMaker2.h:113
CaloDmDescrManager.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloCalibClusterMomentsMaker2::kMatchDmTight
@ kMatchDmTight
Definition: CaloCalibClusterMomentsMaker2.h:221
CaloCalibClusterMomentsMaker2::kCalibFracREST
@ kCalibFracREST
Definition: CaloCalibClusterMomentsMaker2.h:222
CaloCalibClusterMomentsMaker2::MyClusInfo::ClusCalibEnergy::engTot
double engTot
Definition: CaloCalibClusterMomentsMaker2.h:82
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
CaloCalibClusterMomentsMaker2::MyClusInfo::engCalibOut
double engCalibOut
Definition: CaloCalibClusterMomentsMaker2.h:111
CaloDmDescrManager
Definition: CaloDmDescrManager.h:131
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloCalibClusterMomentsMaker2::m_n_eta_out
int m_n_eta_out
Definition: CaloCalibClusterMomentsMaker2.h:211
CaloCalibClusterMomentsMaker2::MyCellInfo::Add
void Add(const MyCellInfo &other)
Definition: CaloCalibClusterMomentsMaker2.h:64
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
CaloCalibClusterMomentsMaker2::m_doDeadM
bool m_doDeadM
Definition: CaloCalibClusterMomentsMaker2.h:229
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CaloCalibClusterMomentsMaker2::m_doDeadEnergySharing
bool m_doDeadEnergySharing
Definition: CaloCalibClusterMomentsMaker2.h:224
CaloCalibClusterMomentsMaker2::MyClusInfo::engCalibIn
ClusCalibEnergy engCalibIn
Definition: CaloCalibClusterMomentsMaker2.h:110
CaloCalibClusterMomentsMaker2::m_caloDmDescrManager
const CaloDmDescrManager * m_caloDmDescrManager
Definition: CaloCalibClusterMomentsMaker2.h:208
CaloCalibClusterMomentsMaker2::m_CalibrationHitContainerNames
SG::ReadHandleKeyArray< CaloCalibrationHitContainer > m_CalibrationHitContainerNames
vector of calibration hit container names to use.
Definition: CaloCalibClusterMomentsMaker2.h:189
CaloCalibClusterMomentsMaker2::keys_dm_energy_sharing
keys_dm_energy_sharing
Definition: CaloCalibClusterMomentsMaker2.h:221
CaloCalibClusterMomentsMaker2
Calculate calibration hit based moments for CaloCluster objects using Primary Particle ID.
Definition: CaloCalibClusterMomentsMaker2.h:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloCalibClusterMomentsMaker2::MyCellInfo::MyCellInfo
MyCellInfo(int iClus, double w)
Definition: CaloCalibClusterMomentsMaker2.h:60
CaloCalibClusterMomentsMaker2::MyCellInfo
Class to store cluster number and weight for calorimeter cells.
Definition: CaloCalibClusterMomentsMaker2.h:58
CaloClusterCollectionProcessor.h
Base class for cluster processing tools called from CaloClusterMaker.
CaloDmDescrArea::DMA_MAX
@ DMA_MAX
Definition: CaloDmDescrArea.h:47
CaloCalibClusterMomentsMaker2::initialize
virtual StatusCode initialize() override
Definition: CaloCalibClusterMomentsMaker2.cxx:148
CaloCalibClusterMomentsMaker2::m_doOutOfClusterT
bool m_doOutOfClusterT
Definition: CaloCalibClusterMomentsMaker2.h:227
CaloCalibClusterMomentsMaker2::m_foundAllContainers
std::atomic< bool > m_foundAllContainers
Definition: CaloCalibClusterMomentsMaker2.h:219
CaloCalibClusterMomentsMaker2::CalibHitIPhiIEtaRange
Class to define range of valid bins in eta x phi plane.
Definition: CaloCalibClusterMomentsMaker2.h:50
CaloCalibClusterMomentsMaker2::m_caloDetDescrMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
Conditions Handle Key to access the CaloDetDescrManager.
Definition: CaloCalibClusterMomentsMaker2.h:202
CaloCalibClusterMomentsMaker2::kMatchDmMedium
@ kMatchDmMedium
Definition: CaloCalibClusterMomentsMaker2.h:221
CaloCalibClusterMomentsMaker2::kMatchDmLoose
@ kMatchDmLoose
Definition: CaloCalibClusterMomentsMaker2.h:221
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
SG::ReadCondHandleKey< CaloDetDescrManager >
CaloCalibClusterMomentsMaker2::m_validNames
moment_name_vector m_validNames
vector holding the names of valid moments which can be calculated.
Definition: CaloCalibClusterMomentsMaker2.h:158
CaloCalibClusterMomentsMaker2::angle_mollier_factor
static double angle_mollier_factor(double x)
Definition: CaloCalibClusterMomentsMaker2.cxx:786
CaloCalibClusterMomentsMaker2::MyClusInfo
Class to store cluster's calibration energies.
Definition: CaloCalibClusterMomentsMaker2.h:78
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CaloCalibClusterMomentsMaker2::kCalibFracMax
@ kCalibFracMax
Definition: CaloCalibClusterMomentsMaker2.h:222
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
CaloCalibClusterMomentsMaker2::MyClusInfo::ClusCalibEnergy::engSmp
std::vector< double > engSmp
Definition: CaloCalibClusterMomentsMaker2.h:83
CaloCalibClusterMomentsMaker2::m_doDeadT
bool m_doDeadT
Definition: CaloCalibClusterMomentsMaker2.h:230
CaloCalibClusterMomentsMaker2::MyClusInfo::engCalibParticle
std::map< int, ClusCalibEnergy > engCalibParticle
Definition: CaloCalibClusterMomentsMaker2.h:114
CaloCalibClusterMomentsMaker2::CalibHitIPhiIEtaRange::iEtaMax
char iEtaMax
Definition: CaloCalibClusterMomentsMaker2.h:52
CaloDM_ID
Helper class for Calo Dead Material offline identifiers.
Definition: CaloDM_ID.h:102
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloCalibClusterMomentsMaker2::keys_calib_frac_origin
keys_calib_frac_origin
Definition: CaloCalibClusterMomentsMaker2.h:222
CaloCalibClusterMomentsMaker2::m_out_phi_max
double m_out_phi_max
Definition: CaloCalibClusterMomentsMaker2.h:212
CaloCalibClusterMomentsMaker2::MyCellInfo::m_ClusWeights
std::vector< std::pair< int, double > > m_ClusWeights
Definition: CaloCalibClusterMomentsMaker2.h:70
CaloCalibClusterMomentsMaker2::m_out_eta_max
double m_out_eta_max
Definition: CaloCalibClusterMomentsMaker2.h:213
CaloCalibClusterMomentsMaker2::get_calib_frac
void get_calib_frac(const std::map< unsigned int, int > &truthBarcodeToPdgCodeMap, const MyClusInfo &clusInfo, std::vector< double > &engFrac) const
Definition: CaloCalibClusterMomentsMaker2.cxx:805
CaloCalibClusterMomentsMaker2::m_doDeadL
bool m_doDeadL
Definition: CaloCalibClusterMomentsMaker2.h:228
CaloCalibClusterMomentsMaker2::CalibHitIPhiIEtaRange::iEtaMin
char iEtaMin
Definition: CaloCalibClusterMomentsMaker2.h:52
CaloCalibClusterMomentsMaker2::m_momentsNames
std::vector< std::string > m_momentsNames
vector holding the input list of names of moments to calculate.
Definition: CaloCalibClusterMomentsMaker2.h:147
AthAlgTool
Definition: AthAlgTool.h:26
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
CaloCalibClusterMomentsMaker2::m_doCalibFrac
bool m_doCalibFrac
Definition: CaloCalibClusterMomentsMaker2.h:232
CaloCalibClusterMomentsMaker2::m_validMoments
moment_name_set m_validMoments
set of moments which will be calculated.
Definition: CaloCalibClusterMomentsMaker2.h:166
CaloCalibClusterMomentsMaker2::kMatchDmOff
@ kMatchDmOff
Definition: CaloCalibClusterMomentsMaker2.h:221