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

Calculate calibration hit based moments for CaloCluster objects using Primary Particle ID. More...

#include <CaloCalibClusterMomentsMaker2.h>

Inheritance diagram for CaloCalibClusterMomentsMaker2:

Classes

class  CalibHitIPhiIEtaRange
class  MyCellInfo
class  MyClusInfo

Public Types

typedef std::map< Identifier, MyCellInfoCellInfoSet_t
typedef std::vector< MyClusInfoClusInfo_t
using ClusList = std::vector<std::vector<int> >
typedef std::pair< std::string, xAOD::CaloCluster::MomentTypemoment_name_pair
typedef std::vector< moment_name_pairmoment_name_vector
typedef std::set< moment_name_pairmoment_name_set

Public Member Functions

 CaloCalibClusterMomentsMaker2 (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode execute (const EventContext &ctx, xAOD::CaloClusterContainer *theClusColl) const override
 Execute on an entire collection of clusters.
virtual StatusCode initialize () override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
 DeclareInterfaceID (CaloClusterCollectionProcessor, 1, 0)

Static Public Member Functions

static void initializeOutOfClusterDistanceTables (int n_phi_out, int n_eta_out, double out_phi_max, double out_eta_max, const double(&rmaxOut)[3], std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > &i_phi_eta)
 Precompute eta/phi lookup tables for quick out-of-cluster hit association to clusters.
static void buildCellInfoMap (const xAOD::CaloClusterContainer &theClusColl, CellInfoSet_t &cellInfo)
 Build a map of calorimeter cells contributing to clusters.
static void buildOutOfClusterClusterLists (const xAOD::CaloClusterContainer &theClusColl, const ClusInfo_t &clusInfoVec, int n_phi_out, int n_eta_out, double out_phi_max, double out_eta_max, const std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > &i_phi_eta, const std::array< bool, 3 > &doOutOfCluster, const std::array< ClusList *, 3 > &clusLists)
 Build lookup lists of clusters for out-of-cluster energy sharing.
template<class InvalidUniqueIdHandler>
static void accumulateClusterCalibHits (const std::vector< const CaloCalibrationHitContainer * > &v_cchc, const CellInfoSet_t &cellInfo, const CaloCell_ID &calo_id, ClusInfo_t &clusInfoVec, unsigned int &nHitsTotal, unsigned int &nHitsWithoutParticleUID, bool useParticleID, InvalidUniqueIdHandler &&invalidUniqueIdHandler)
 Accumulate calibration-hit energy inside clusters.
template<class AddOutOfClusterEnergy>
static void accumulateOutOfClusterEnergy (const std::vector< const CaloCalibrationHitContainer * > &v_cchc, const CellInfoSet_t &cellInfo, const CaloDetDescrManager &calo_dd_man, const ClusInfo_t &clusInfoVec, int n_phi_out, int n_eta_out, double out_phi_max, double out_eta_max, const std::array< bool, 3 > &doOutOfCluster, const std::array< const ClusList *, 3 > &clusLists, AddOutOfClusterEnergy &&addOutOfClusterEnergy)

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

enum  keys_dm_energy_sharing { kMatchDmOff , kMatchDmLoose , kMatchDmMedium , kMatchDmTight }
enum  keys_calib_frac_origin { kCalibFracEM , kCalibFracHAD , kCalibFracREST , kCalibFracMax }
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

template<class AddDeadMaterialEnergy>
void accumulateDeadMaterialEnergy (const std::vector< const CaloCalibrationHitContainer * > &v_dmcchc, const xAOD::CaloClusterContainer &theClusColl, const ClusInfo_t &clusInfoVec, const ClusList &clusList, bool useParticleID, AddDeadMaterialEnergy &&addDeadMaterialEnergy) const
 Accumulate dead-material calibration-hit energy assigned to clusters.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static double angle_mollier_factor (double x)

Private Attributes

std::vector< std::string > m_momentsNames
moment_name_vector m_validNames
moment_name_set m_validMoments
std::vector< std::string > m_momentsNamesAOD
std::set< xAOD::CaloCluster::MomentTypem_momentsAOD
SG::ReadHandleKeyArray< CaloCalibrationHitContainerm_CalibrationHitContainerNames
SG::ReadHandleKeyArray< CaloCalibrationHitContainerm_DMCalibrationHitContainerNames
SG::ReadHandleKey< xAOD::TruthParticleContainerm_truthParticleContainerKey {this,"TruthParticles","TruthParticles","ReadHandleKey for truth particle container"}
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloDetDescrMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
const CaloCell_IDm_calo_id {}
const CaloDM_IDm_caloDM_ID {}
const CaloDmDescrManagerm_caloDmDescrManager {}
int m_n_phi_out {}
int m_n_eta_out {}
double m_out_phi_max {}
double m_out_eta_max {}
double m_rmaxOut [3] {}
std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > m_i_phi_eta
std::atomic< bool > m_foundAllContainers {}
bool m_doDeadEnergySharing {}
bool m_doOutOfClusterL {}
bool m_doOutOfClusterM {}
bool m_doOutOfClusterT {}
bool m_doDeadL {}
bool m_doDeadM {}
bool m_doDeadT {}
bool m_useParticleID {}
bool m_doCalibFrac {}
float m_energyMin {}
float m_energyMinCalib {}
float m_apars_alpha {}
float m_apars_r0 {}
int m_MatchDmType {}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Calculate calibration hit based moments for CaloCluster objects using Primary Particle ID.

Version
Id
CaloCalibClusterMomentsMaker2.h,v 1.8 2009-05-18 16:16:48 pospelov Exp
Author
Sven Menke menke.nosp@m.@mpp.nosp@m.mu.mp.nosp@m.g.de, Gennady Pospelov guenn.nosp@m.adi..nosp@m.pospe.nosp@m.lov@.nosp@m.cern..nosp@m.ch
Date
17-June-2008

Definition at line 42 of file CaloCalibClusterMomentsMaker2.h.

Member Typedef Documentation

◆ CellInfoSet_t

◆ ClusInfo_t

◆ ClusList

using CaloCalibClusterMomentsMaker2::ClusList = std::vector<std::vector<int> >

Definition at line 85 of file CaloCalibClusterMomentsMaker2.h.

◆ moment_name_pair

◆ moment_name_set

◆ moment_name_vector

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ keys_calib_frac_origin

◆ keys_dm_energy_sharing

Constructor & Destructor Documentation

◆ CaloCalibClusterMomentsMaker2()

CaloCalibClusterMomentsMaker2::CaloCalibClusterMomentsMaker2 ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 104 of file CaloCalibClusterMomentsMaker2.cxx.

107 : AthAlgTool(type, name, parent),
108 m_calo_id(nullptr),
109 m_caloDM_ID(nullptr),
110 m_caloDmDescrManager(nullptr),
111 m_useParticleID(true),
112 m_energyMin(200*MeV),
114 m_apars_alpha(0.5),
115 m_apars_r0(0.2),
117{
118 declareInterface<CaloClusterCollectionProcessor>(this);
119 // Name(s) of Moments to calculate
120 declareProperty("MomentsNames", m_momentsNames);
121 m_validNames.reserve(s_validMomentNames.size());
122 for (const auto& [thisName, moment] : s_validMomentNames) {
123 m_validNames.emplace_back(thisName, moment);
124 }
125
126 // Name(s) of Moments which can be stored on the AOD - all others go to ESD
127 m_momentsNamesAOD.reserve(s_aodMomentNames.size());
128 for (const std::string_view thisName : s_aodMomentNames) {
129 m_momentsNamesAOD.emplace_back(thisName);
130 }
131
132 declareProperty("AODMomentsNames", m_momentsNamesAOD);
133 declareProperty("CalibrationHitContainerNames", m_CalibrationHitContainerNames);
134 declareProperty("DMCalibrationHitContainerNames", m_DMCalibrationHitContainerNames);
135 m_n_phi_out = 127; // not more than 127 since we store indices (-127,...-1,0,...,126) and have 8 bits only
136 m_n_eta_out = 127;
138 m_out_eta_max = 6;
139
140 m_rmaxOut[0] = 1.0;
141 m_rmaxOut[1] = 0.5;
142 m_rmaxOut[2] = 0.3;
143
144 for (int im = 0; im < 3; im++) {
145 m_i_phi_eta[im].resize(m_n_eta_out);
146 }
147 m_doDeadEnergySharing = false;
148 m_foundAllContainers = false;
149 m_doOutOfClusterL = false;
150 m_doOutOfClusterM = false;
151 m_doOutOfClusterT = false;
152 m_doDeadL = false;
153 m_doDeadM = false;
154 m_doDeadT = false;
155 m_doCalibFrac = false;
156
157 declareProperty("MatchDmType", m_MatchDmType);
158 declareProperty("UseParticleID", m_useParticleID);
159}
#define M_PI
static const double MeV
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadHandleKeyArray< CaloCalibrationHitContainer > m_DMCalibrationHitContainerNames
SG::ReadHandleKeyArray< CaloCalibrationHitContainer > m_CalibrationHitContainerNames
std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > m_i_phi_eta
const CaloDmDescrManager * m_caloDmDescrManager

Member Function Documentation

◆ accumulateClusterCalibHits()

template<class InvalidUniqueIdHandler>
void CaloCalibClusterMomentsMaker2::accumulateClusterCalibHits ( const std::vector< const CaloCalibrationHitContainer * > & v_cchc,
const CellInfoSet_t & cellInfo,
const CaloCell_ID & calo_id,
ClusInfo_t & clusInfoVec,
unsigned int & nHitsTotal,
unsigned int & nHitsWithoutParticleUID,
bool useParticleID,
InvalidUniqueIdHandler && invalidUniqueIdHandler )
inlinestatic

Accumulate calibration-hit energy inside clusters.

Loops over the input calibration hit containers and, for hits whose cells belong to one or more clusters, adds the corresponding weighted energy to the per-cluster calibration-energy bookkeeping.

If useParticleID is true, the per-particle contribution map is also filled and hits with undefined particle ID are counted. If false, only the total in-cluster calibration energy and per-sampling contributions are accumulated.

Template Parameters
InvalidUniqueIdHandlerCallable invoked when an invalid unique ID is encountered.
Parameters
v_cchcInput calibration hit containers.
cellInfoMap from cell Identifier to per-cluster contribution info.
calo_idCalorimeter cell identifier helper.
[out]clusInfoVecPer-cluster calibration information to be updated.
[out]nHitsTotalTotal number of calibration hits processed.
[out]nHitsWithoutParticleUIDNumber of hits with undefined particle ID.
useParticleIDFlag controlling whether truth particle IDs are used.
invalidUniqueIdHandlerCallback invoked when an invalid unique ID is found.

Definition at line 199 of file CaloCalibClusterMomentsMaker2.h.

208 {
209 for (const CaloCalibrationHitContainer* cchc : v_cchc) {
210 for (const CaloCalibrationHit* hit : *cchc) {
211 const Identifier myId = hit->cellID();
212 typename CellInfoSet_t::const_iterator pos = cellInfo.find(myId);
213
214 if (pos != cellInfo.end()) {
215 const CaloSampling::CaloSample nsmp =
217
218 for (const std::pair<int, double>& p : pos->second) {
219 const int iClus = p.first;
220 const double weight = p.second;
221
222 if (useParticleID) {
223 const int uniqueID = HepMC::uniqueID(hit);
224 if (uniqueID == HepMC::INVALID_PARTICLE_ID) {
225 invalidUniqueIdHandler();
226 break;
227 }
228 clusInfoVec[iClus].Add(weight * hit->energyTotal(),
229 nsmp,
230 static_cast<unsigned int>(uniqueID));
231 }
232 else {
233 clusInfoVec[iClus].Add(weight * hit->energyTotal(), nsmp);
234 }
235 }
236 }
237
238 if (useParticleID && HepMC::uniqueID(hit) == HepMC::UNDEFINED_ID) {
239 ++nHitsWithoutParticleUID;
240 }
241 ++nHitsTotal;
242 }
243 }
244 }
CaloCalibrationHitContainer
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
constexpr int INVALID_PARTICLE_ID
int uniqueID(const T &p)
constexpr int UNDEFINED_ID

◆ accumulateDeadMaterialEnergy()

template<class AddDeadMaterialEnergy>
void CaloCalibClusterMomentsMaker2::accumulateDeadMaterialEnergy ( const std::vector< const CaloCalibrationHitContainer * > & v_dmcchc,
const xAOD::CaloClusterContainer & theClusColl,
const ClusInfo_t & clusInfoVec,
const ClusList & clusList,
bool useParticleID,
AddDeadMaterialEnergy && addDeadMaterialEnergy ) const
inlineprivate

Accumulate dead-material calibration-hit energy assigned to clusters.

Reusable implementation of the MomentsMaker2 "way2" dead-material sharing algorithm. Dead-material hits are assigned to nearby clusters using the same sampling-neighbour, energy-threshold and distance-weighting criteria as ENG_CALIB_DEAD_* in CaloCalibClusterMomentsMaker2.

Template Parameters
AddDeadMaterialEnergyCallable with signature addDeadMaterialEnergy(int iClus, int uniqueID, int nDmArea, double energy).

Definition at line 337 of file CaloCalibClusterMomentsMaker2.h.

344 {
345 for (const CaloCalibrationHitContainer* dmcchc : v_dmcchc) {
346 for (const CaloCalibrationHit* hit : *dmcchc) {
347 const Identifier myId = hit->cellID();
348 if (!m_calo_id->is_lar_dm(myId) && !m_calo_id->is_tile_dm(myId)) {
349 continue;
350 }
351
352 const CaloDmDescrElement* myCDDE = m_caloDmDescrManager->get_element(myId);
353 if (!myCDDE) {
354 continue;
355 }
356
358 if (useParticleID) {
360 }
361
362 const int jeO = static_cast<int>(std::floor(m_n_eta_out * (myCDDE->eta() / m_out_eta_max)));
363 if (jeO < -m_n_eta_out || jeO >= m_n_eta_out) {
364 continue;
365 }
366
367 int jpO = static_cast<int>(std::floor(m_n_phi_out * (myCDDE->phi() / m_out_phi_max)));
368 if (jpO < -m_n_phi_out) {
369 jpO += 2 * m_n_phi_out;
370 }
371 if (jpO >= m_n_phi_out) {
372 jpO -= 2 * m_n_phi_out;
373 }
374
375 const int nDmArea = m_caloDmDescrManager->get_dm_area(myId);
376 const CaloDmRegion* dmRegion = m_caloDmDescrManager->get_dm_region(myId);
377 if (!dmRegion) {
378 continue;
379 }
380
381 std::vector<int> hitClusIndex;
382 std::vector<double> hitClusEffEnergy;
383 hitClusIndex.reserve(theClusColl.size());
384 hitClusEffEnergy.reserve(theClusColl.size());
385 double hitClusNorm = 0.0;
386
387 const std::vector<int>& matchingClusters =
388 clusList[(jpO + m_n_phi_out) * (2 * m_n_eta_out + 1) + jeO + m_n_eta_out];
389
390 for (int iClus : matchingClusters) {
391 const xAOD::CaloCluster* theCluster = theClusColl.at(iClus);
392 const MyClusInfo& clusInfo = clusInfoVec[iClus];
393 auto pos = clusInfo.engCalibParticle.find(uniqueID);
394 if (pos == clusInfo.engCalibParticle.end()) {
395 continue;
396 }
397
398 const double engClusTruthUniqueIDCalib = pos->second.engTot;
399 if (engClusTruthUniqueIDCalib <= m_energyMinCalib || theCluster->e() <= m_energyMin) {
400 continue;
401 }
402
403 double sum_smp_energy = 0.0;
404 for (unsigned int i_smp = 0; i_smp < dmRegion->m_CaloSampleNeighbours.size(); ++i_smp) {
405 const CaloSampling::CaloSample nsmp =
406 static_cast<CaloSampling::CaloSample>(dmRegion->m_CaloSampleNeighbours[i_smp]);
407 if ((dmRegion->m_CaloSampleEtaMin[i_smp] - 0.5) <= theCluster->eta() &&
408 theCluster->eta() <= (dmRegion->m_CaloSampleEtaMax[i_smp] + 0.5)) {
409 sum_smp_energy += pos->second.engSmp[nsmp];
410 }
411 }
412 if (sum_smp_energy <= 0.0) {
413 continue;
414 }
415
416 double phi_diff = myCDDE->phi() - theCluster->phi();
417 if (phi_diff <= -M_PI) {
418 phi_diff += 2. * M_PI;
419 }
420 else if (phi_diff > M_PI) {
421 phi_diff -= 2. * M_PI;
422 }
423 const double eta_diff = myCDDE->eta() - theCluster->eta();
424 const float distance = std::sqrt(eta_diff * eta_diff + phi_diff * phi_diff);
425 const double effEner = std::pow(sum_smp_energy, m_apars_alpha) * std::exp(-distance / m_apars_r0);
426
427 hitClusIndex.push_back(iClus);
428 hitClusEffEnergy.push_back(effEner);
429 hitClusNorm += effEner;
430 }
431
432 if (hitClusNorm <= 0.0) {
433 continue;
434 }
435
436 const double inv_hitClusNorm = 1.0 / hitClusNorm;
437 for (std::size_t i = 0; i < hitClusIndex.size(); ++i) {
438 const int iClus = hitClusIndex[i];
439 const double dm_weight = hitClusEffEnergy[i] * inv_hitClusNorm;
440 addDeadMaterialEnergy(iClus, uniqueID, nDmArea, hit->energyTotal() * dm_weight);
441 }
442 }
443 }
444 }
std::vector< short > m_CaloSampleNeighbours
std::vector< float > m_CaloSampleEtaMin
std::vector< float > m_CaloSampleEtaMax
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ accumulateOutOfClusterEnergy()

template<class AddOutOfClusterEnergy>
void CaloCalibClusterMomentsMaker2::accumulateOutOfClusterEnergy ( const std::vector< const CaloCalibrationHitContainer * > & v_cchc,
const CellInfoSet_t & cellInfo,
const CaloDetDescrManager & calo_dd_man,
const ClusInfo_t & clusInfoVec,
int n_phi_out,
int n_eta_out,
double out_phi_max,
double out_eta_max,
const std::array< bool, 3 > & doOutOfCluster,
const std::array< const ClusList *, 3 > & clusLists,
AddOutOfClusterEnergy && addOutOfClusterEnergy )
inlinestatic

Definition at line 247 of file CaloCalibClusterMomentsMaker2.h.

259 {
260 for (const CaloCalibrationHitContainer* cchc : v_cchc) {
261 for (const CaloCalibrationHit* hit : *cchc) {
262 const Identifier myId = hit->cellID();
263 typename CellInfoSet_t::const_iterator pos = cellInfo.find(myId);
264 if (pos != cellInfo.end()) {
265 continue;
266 }
267
268 const CaloDetDescrElement* myCDDE = calo_dd_man.get_element(myId);
269 const int uniqueID = HepMC::uniqueID(hit);
270 if (!myCDDE) {
271 continue;
272 }
273
274 const int jeO = static_cast<int>(std::floor(n_eta_out * (myCDDE->eta() / out_eta_max)));
275 if (jeO < -n_eta_out || jeO >= n_eta_out) {
276 continue;
277 }
278
279 int jpO = static_cast<int>(std::floor(n_phi_out * (myCDDE->phi() / out_phi_max)));
280 if (jpO < -n_phi_out) jpO += 2 * n_phi_out;
281 if (jpO >= n_phi_out) jpO -= 2 * n_phi_out;
282
283 for (unsigned int ii = 0; ii < 3; ++ii) {
284 const ClusList* pClusList = clusLists[ii];
285 if (!doOutOfCluster[ii] || pClusList == nullptr) {
286 continue;
287 }
288
289 double hitClusNorm = 0.0;
290 std::vector<int> hitClusIndex;
291 std::vector<double> hitClusEffEnergy;
292 const std::vector<int>& matchingClusters =
293 (*pClusList)[(jpO + n_phi_out) * (2 * n_eta_out + 1) + jeO + n_eta_out];
294
295 for (int iClus : matchingClusters) {
296 const MyClusInfo& clusInfo = clusInfoVec[iClus];
297 auto partPos = clusInfo.engCalibParticle.find(uniqueID);
298 if (partPos == clusInfo.engCalibParticle.end()) {
299 continue;
300 }
301 hitClusNorm += partPos->second.engTot;
302 hitClusEffEnergy.push_back(partPos->second.engTot);
303 hitClusIndex.push_back(iClus);
304 }
305
306 if (hitClusNorm <= 0.0) {
307 continue;
308 }
309
310 const double inv_hitClusNorm = 1.0 / hitClusNorm;
311 for (std::size_t i = 0; i < hitClusIndex.size(); ++i) {
312 const int iClus = hitClusIndex[i];
313 const double w = hitClusEffEnergy[i] * inv_hitClusNorm;
314 addOutOfClusterEnergy(ii, iClus, uniqueID, w * hit->energyTotal());
315 }
316 }
317 }
318 }
319 }
std::vector< std::vector< int > > ClusList
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier

◆ angle_mollier_factor()

double CaloCalibClusterMomentsMaker2::angle_mollier_factor ( double x)
staticprivate

Definition at line 787 of file CaloCalibClusterMomentsMaker2.cxx.

788{
789 double eta = fabs(x);
790 double ff;
791 if (eta < 1.6) {
792 ff = atan(5.0 * 1.7 / (200.0 * cosh(eta)));
793 } else if (eta < 3.2) {
794 ff = atan(5.0 * 1.6 / (420. / tanh(eta)));
795 } else {
796 ff = atan(5.0 * 0.95 / (505. / tanh(eta)));
797 }
798 return ff * (1. / atan(5.0 * 1.7 / 200.0));
799}
Scalar eta() const
pseudorapidity method
#define x

◆ buildCellInfoMap()

void CaloCalibClusterMomentsMaker2::buildCellInfoMap ( const xAOD::CaloClusterContainer & theClusColl,
CellInfoSet_t & cellInfo )
static

Build a map of calorimeter cells contributing to clusters.

Iterates over all clusters and their constituent cells and constructs a map keyed by cell Identifier. For each cell, stores the list of clusters it contributes to together with the corresponding weights.

This structure is used to efficiently associate calibration hits with clusters during subsequent accumulation steps.

Parameters
theClusCollInput container of calorimeter clusters.
[out]cellInfoMap from cell Identifier to per-cluster contribution info.

Definition at line 319 of file CaloCalibClusterMomentsMaker2.cxx.

322{
323 cellInfo.clear();
324
325 int iClus = 0;
326 for (const xAOD::CaloCluster* theCluster : theClusColl) {
327 xAOD::CaloCluster::const_cell_iterator cellIter = theCluster->cell_begin();
328 xAOD::CaloCluster::const_cell_iterator cellIterEnd = theCluster->cell_end();
329
330 for (; cellIter != cellIterEnd; ++cellIter) {
331 const CaloCell* pCell = *cellIter;
332 const Identifier myId = pCell->ID();
333
334 MyCellInfo info(iClus, cellIter.weight());
335 CellInfoSet_t::iterator bookmark = cellInfo.lower_bound(myId);
336 if (bookmark == cellInfo.end() || bookmark->first != myId) {
337 if (bookmark != cellInfo.begin()) {
338 --bookmark;
339 }
340 cellInfo.emplace_hint(bookmark, myId, std::move(info));
341 }
342 else {
343 bookmark->second.Add(info);
344 }
345 }
346
347 ++iClus;
348 }
349}
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition CaloCell.h:295
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version).

◆ buildOutOfClusterClusterLists()

void CaloCalibClusterMomentsMaker2::buildOutOfClusterClusterLists ( const xAOD::CaloClusterContainer & theClusColl,
const ClusInfo_t & clusInfoVec,
int n_phi_out,
int n_eta_out,
double out_phi_max,
double out_eta_max,
const std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > & i_phi_eta,
const std::array< bool, 3 > & doOutOfCluster,
const std::array< ClusList *, 3 > & clusLists )
static

Build lookup lists of clusters for out-of-cluster energy sharing.

For each working point (loose/medium/tight), constructs a grid-indexed lookup structure that maps (η, φ) bins to lists of nearby clusters. These lists are later used to distribute calibration hit energy to clusters lying within the configured angular distance.

The lookup is based on the precomputed tables from initializeOutOfClusterDistanceTables().

Parameters
theClusCollInput container of calorimeter clusters.
clusInfoVecPer-cluster calibration information.
n_phi_outNumber of φ bins in the lookup grid.
n_eta_outNumber of η bins in the lookup grid.
out_phi_maxMaximum |φ| range covered by the grid.
out_eta_maxMaximum |η| range covered by the grid.
i_phi_etaPrecomputed lookup tables for each working point.
doOutOfClusterFlags enabling each working point.
[out]clusListsOutput cluster index lists (non-owning pointers).

Definition at line 354 of file CaloCalibClusterMomentsMaker2.cxx.

364{
365 for (unsigned int ii = 0; ii < 3; ++ii) {
366 ClusList* pClusList = clusLists[ii];
367 if (!doOutOfCluster[ii] || pClusList == nullptr) {
368 continue;
369 }
370
371 int iClus = -1;
372 for (const xAOD::CaloCluster* theCluster : theClusColl) {
373 ++iClus;
374 const MyClusInfo& clusInfo = clusInfoVec[iClus];
375
376 if (clusInfo.engCalibIn.engTot <= 0.) {
377 continue;
378 }
379
380 int iEtaSign = 1;
381 if (theCluster->eta() < 0.) {
382 iEtaSign = -1;
383 }
384
385 const int jeta = static_cast<int>(std::floor(n_eta_out * (theCluster->eta() / out_eta_max)));
386 int jphi = static_cast<int>(std::floor(n_phi_out * (theCluster->phi() / out_phi_max)));
387
388 if (jeta < -n_eta_out || jeta >= n_eta_out) {
389 continue;
390 }
391
392 if (jphi < -n_phi_out) {
393 jphi += 2 * n_phi_out;
394 }
395 if (jphi >= n_phi_out) {
396 jphi -= 2 * n_phi_out;
397 }
398
399 unsigned int iEtaBin = static_cast<unsigned int>(jeta);
400 if (jeta < 0) {
401 iEtaBin = std::abs(jeta) - 1;
402 }
403
404 const std::vector<CalibHitIPhiIEtaRange>& bins = i_phi_eta[ii][iEtaBin];
405 for (const CalibHitIPhiIEtaRange& range : bins) {
406 int jp = range.iPhi + jphi;
407 if (jp < -n_phi_out) {
408 jp += 2 * n_phi_out;
409 }
410 if (jp >= n_phi_out) {
411 jp -= 2 * n_phi_out;
412 }
413
414 const int jEtaMin = (iEtaSign < 0) ? -range.iEtaMax - 1 : range.iEtaMin;
415 const int jEtaMax = (iEtaSign < 0) ? -range.iEtaMin - 1 : range.iEtaMax;
416
417 for (int je = jEtaMin; je <= jEtaMax; ++je) {
418 (*pClusList)[(jp + n_phi_out) * (2 * n_eta_out + 1) + je + n_eta_out].push_back(iClus);
419 }
420 }
421 }
422 }
423}
static const std::vector< std::string > bins

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ DeclareInterfaceID()

CaloClusterCollectionProcessor::DeclareInterfaceID ( CaloClusterCollectionProcessor ,
1 ,
0  )
inherited

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode CaloCalibClusterMomentsMaker2::execute ( const EventContext & ctx,
xAOD::CaloClusterContainer * collection ) const
overridevirtual

Execute on an entire collection of clusters.

Parameters
collectionThe container of clusters. param ctx The event context.

Implements CaloClusterCollectionProcessor.

Definition at line 429 of file CaloCalibClusterMomentsMaker2.cxx.

431{
432
433 ATH_MSG_DEBUG("Starting CaloCalibClusterMomentsMaker2::execute");
434 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloDetDescrMgrKey,ctx};
435 const CaloDetDescrManager* calo_dd_man = *caloMgrHandle;
436
437 bool foundAllContainers (true);
438 std::vector<const CaloCalibrationHitContainer *> v_cchc;
439 for (const SG::ReadHandleKey<CaloCalibrationHitContainer>& key :
441 {
442 SG::ReadHandle<CaloCalibrationHitContainer> cchc (key, ctx);
443 if ( !cchc.isValid() ) {
445 // print ERROR message only if there was at least one event with
446 // all containers
447 msg(MSG::ERROR) << "SG does not contain calibration hit container "
448 << key.key() << endmsg;
449 }
450 foundAllContainers = false;
451 }
452 else {
453 v_cchc.push_back(cchc.cptr());
454 }
455 }
456
457 std::vector<const CaloCalibrationHitContainer *> v_dmcchc;
458 for (const SG::ReadHandleKey<CaloCalibrationHitContainer>& key :
460 {
461 SG::ReadHandle<CaloCalibrationHitContainer> cchc (key, ctx);
462 if ( !cchc.isValid() ) {
464 // print ERROR message only if there was at least one event with
465 // all containers
466 ATH_MSG_ERROR("SG does not contain DM calibration hit container "
467 << key.key());
468 }
469 foundAllContainers = false;
470 }
471 else {
472 v_dmcchc.push_back(cchc.cptr());
473 }
474 }
475
476 if ( !m_foundAllContainers && foundAllContainers ) {
478 }
479
480 if ( !foundAllContainers ) {
481 return StatusCode::SUCCESS;
482 }
483 ATH_MSG_DEBUG("SG has all containers ");
484
485 // will contain detailed info about cluster calibration energies
486 ClusInfo_t clusInfoVec(theClusColl->size());
487
488 CellInfoSet_t cellInfo;
489 buildCellInfoMap(*theClusColl, cellInfo);
490
491 xAOD::CaloClusterContainer::iterator clusIter = theClusColl->begin();
492 xAOD::CaloClusterContainer::iterator clusIterEnd = theClusColl->end();
493
494 /* ********************************************
495 calculate total calib energy inside clusters
496 ******************************************** */
497 unsigned int nHitsTotal = 0;
498 unsigned int nHitsWithoutParticleUID = 0;
499
501 v_cchc,
502 cellInfo,
503 *m_calo_id,
504 clusInfoVec,
505 nHitsTotal,
506 nHitsWithoutParticleUID,
508 [this]() {
509 ATH_MSG_ERROR("Invalid uniqueID detected - this sample cannot be properly analysed.");
510 });
511
512 // if all calibration hits have ParticleUID (i.e. GenParticle::id()) == 0
513 // when simulation was done without ParticleUID
514 bool doCalibFrac = m_doCalibFrac;
515 bool useParticleID = m_useParticleID;
516 if (m_useParticleID && (nHitsTotal == nHitsWithoutParticleUID)) {
517 ATH_MSG_INFO("Calibration hits do not have ParticleUID, ids of particle-caused hits are always 0. Continuing without ParticleID machinery.");
518 useParticleID = false;
519 }
520
521 // reading particle information for later calculation of calibration energy fraction caused
522 // by particles of different types
523 SG::ReadHandle<xAOD::TruthParticleContainer> truthParticleContainerReadHandle(m_truthParticleContainerKey, ctx);
524
525 if (doCalibFrac && !truthParticleContainerReadHandle.isValid()) {
526 ATH_MSG_WARNING("Invalid read handle to TruthParticleContainer with key: "
528 doCalibFrac = false;
529 }
530
531 std::array<std::vector<double>, 3> engCalibOut;
532
533 /* ****************************************************************
534 lists of clusters populating given area [eta*phi][iClus list]
535 **************************************************************** */
536 std::array<ClusList, 3> clusLists;
537 const std::array<bool, 3> doOutOfCluster{{
539 }};
540 const std::array<bool, 3> doClusterLists{{
547 }};
548
549 for (unsigned int ii = 0; ii < 3; ++ii) {
550 if (doClusterLists[ii]) {
551 clusLists[ii].resize((2 * m_n_phi_out + 1) * (2 * m_n_eta_out + 1));
552 engCalibOut[ii].resize(theClusColl->size(), 0.0);
553 }
554 }
555
556 std::array<ClusList*, 3> clusListPtrs{{&clusLists[0], &clusLists[1], &clusLists[2]}};
558 *theClusColl,
559 clusInfoVec,
565 doClusterLists,
566 clusListPtrs);
567
568 /* ****************************************************************
569 calculate out-of-cluster energy of clusters
570 **************************************************************** */
572 std::array<const ClusList*, 3> constClusListPtrs{{
573 &clusLists[0], &clusLists[1], &clusLists[2]
574 }};
576 v_cchc,
577 cellInfo,
578 *calo_dd_man,
579 clusInfoVec,
584 doOutOfCluster,
585 constClusListPtrs,
586 [&engCalibOut](unsigned int ii, int iClus, int /*uniqueID*/, double energy) {
587 engCalibOut[ii][iClus] += energy;
588 });
589 }
590
591 // ------------------------------------------------------------------------
592 // calculate dead-material energy of clusters (way2)
593 // + energy is shared among clusters within certain area
594 // + distance to clusters and energy in specific samplings are used as sharing criteria
595 // + calculations are done separately for different dead material areas
596 ClusList* pClusList = nullptr;
597 if ( m_MatchDmType == kMatchDmLoose ) {
598 pClusList = &clusLists[0];
599 } else if ( m_MatchDmType == kMatchDmMedium ) {
600 pClusList = &clusLists[1];
601 } else if ( m_MatchDmType == kMatchDmTight ) {
602 pClusList = &clusLists[2];
603 }
604
605 if (m_doDeadEnergySharing && pClusList) {
607 v_dmcchc,
608 *theClusColl,
609 clusInfoVec,
610 *pClusList,
611 useParticleID,
612 [&clusInfoVec](int iClus, int /*uniqueID*/, int nDmArea, double energy) {
613 clusInfoVec[iClus].engCalibDeadInArea[nDmArea] += energy;
614 clusInfoVec[iClus].engCalibDeadInArea[CaloDmDescrArea::DMA_ALL] += energy;
615 });
616 } // doDeadEnergySharing
617
618 // fraction of calibration energies caused by different particles
619 std::vector<double> engCalibFrac;
620 engCalibFrac.resize(kCalibFracMax, 0.0);
621
622 std::map<unsigned int, int> truthIDToPdgCodeMap;
623
624 // loop on truth particle container is slow, so put needed information in a map for faster key lookup in later loops
625 for ( const auto *thisTruthParticle : *truthParticleContainerReadHandle ) {
626
627 if (!thisTruthParticle) {
628 ATH_MSG_WARNING("Got invalid pointer to TruthParticle");
629 continue;
630 }
631
632 truthIDToPdgCodeMap[HepMC::uniqueID(thisTruthParticle)] = thisTruthParticle->pdgId();
633 } // truth particle loop
634
635 // assign moments
636 int iClus = 0;
637 for (clusIter = theClusColl->begin(), iClus = 0;
638 clusIter != clusIterEnd;
639 ++clusIter, ++iClus) {
640 xAOD::CaloCluster * theCluster = *clusIter;
641 MyClusInfo& clusInfo = clusInfoVec[iClus];
642
643 // total DM energy assigned to cluster
644 double eng_calib_dead_tot = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_ALL]
645 + clusInfo.engCalibIn.engSmp[CaloSampling::PreSamplerB]
646 + clusInfo.engCalibIn.engSmp[CaloSampling::PreSamplerE]
647 + clusInfo.engCalibIn.engSmp[CaloSampling::TileGap3];
648 // DM energy before barrel presampler, inside it, and between presampler and strips
649 double eng_calib_dead_emb0 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EMB0]
650 + clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EMB1]
651 + clusInfo.engCalibIn.engSmp[CaloSampling::PreSamplerB];
652 // DM energy between barrel and tile
653 double eng_calib_dead_tile0 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EMB3_TILE0];
654 // DM energy before scintillator and inside scintillator
655 double eng_calib_dead_tileg3 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_SCN]
656 + clusInfo.engCalibIn.engSmp[CaloSampling::TileGap3];
657 // DM energy before endcap presampler, inside it and between presampler and strips
658 double eng_calib_dead_eme0 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EME0]
659 + clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EME12]
660 + clusInfo.engCalibIn.engSmp[CaloSampling::PreSamplerE];
661 // DM energy between emec and hec
662 double eng_calib_dead_hec0 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EME3_HEC0];
663 // DM energy before FCAL and between HEC and FCAL
664 double eng_calib_dead_fcal = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_FCAL0]
665 + clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_HEC_FCAL];
666 // DM leakage behind the calorimeter
667 double eng_calib_dead_leakage = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_LEAK];
668 // the rest of DM energy which remains unclassified
669 double eng_calib_dead_unclass = eng_calib_dead_tot - eng_calib_dead_emb0 - eng_calib_dead_tile0
670 - eng_calib_dead_tileg3 - eng_calib_dead_eme0 - eng_calib_dead_hec0 - eng_calib_dead_fcal
671 - eng_calib_dead_leakage;
672
673 if (doCalibFrac) {
674/*****************************************************************************
675Calculation of energy fraction caused by particles of different types
676*****************************************************************************/
677 engCalibFrac.assign(kCalibFracMax, 0.0);
678 if (clusInfo.engCalibIn.engTot > 0.0) {
679 // each MyClusInfo has a map of particle's uniqueID (GenParticle::id()) and particle calibration deposits in given cluster
680 for (const auto& p : clusInfo.engCalibParticle) {
681 int pdg_id = 0;
682 if (auto it = truthIDToPdgCodeMap.find(p.first); it != truthIDToPdgCodeMap.end()) {
683 pdg_id = it->second;
684 } else {
685 ATH_MSG_WARNING("truthIDToPdgCodeMap cannot find an entry with uniqueID " << p.first);
686 continue;
687 }
688 if (std::abs(pdg_id) == 211) {
689 engCalibFrac[kCalibFracHAD] += p.second.engTot;
690 } else if (pdg_id == 111 || pdg_id == 22 || std::abs(pdg_id) == 11) {
691 engCalibFrac[kCalibFracEM] += p.second.engTot;
692 } else {
693 engCalibFrac[kCalibFracREST] += p.second.engTot;
694 }
695 }
696 for (size_t i = 0; i < engCalibFrac.size(); i++) {
697 engCalibFrac[i] = engCalibFrac[i] / clusInfo.engCalibIn.engTot;
698 }
699 }
700 }
701
702 if ( !m_momentsNames.empty() ) {
703 std::vector<double> myMoments(m_validMoments.size(), 0);
704 // assign moments
705 moment_name_set::const_iterator vMomentsIter = m_validMoments.begin();
706 moment_name_set::const_iterator vMomentsIterEnd = m_validMoments.end();
707
708 int iMoment = 0;
709 for (; vMomentsIter != vMomentsIterEnd; ++vMomentsIter, ++iMoment) {
710 // now calculate the actual moments
711 switch (vMomentsIter->second) {
713 ATH_MSG_DEBUG("Inserting ENG_CALIB_TOT");
714 myMoments[iMoment] = clusInfo.engCalibIn.engTot;
715 break;
717 myMoments[iMoment] = engCalibOut[0][iClus];
718 break;
720 myMoments[iMoment] = engCalibOut[1][iClus];
721 break;
723 myMoments[iMoment] = engCalibOut[2][iClus];
724 break;
726 myMoments[iMoment] = clusInfo.engCalibIn.engSmp[CaloSampling::PreSamplerB];
727 break;
729 myMoments[iMoment] = clusInfo.engCalibIn.engSmp[CaloSampling::PreSamplerE];
730 break;
732 myMoments[iMoment] = clusInfo.engCalibIn.engSmp[CaloSampling::TileGap3];
733 break;
735 myMoments[iMoment] = eng_calib_dead_tot;
736 break;
738 myMoments[iMoment] = eng_calib_dead_emb0;
739 break;
741 myMoments[iMoment] = eng_calib_dead_tile0;
742 break;
744 myMoments[iMoment] = eng_calib_dead_tileg3;
745 break;
747 myMoments[iMoment] = eng_calib_dead_eme0;
748 break;
750 myMoments[iMoment] = eng_calib_dead_hec0;
751 break;
753 myMoments[iMoment] = eng_calib_dead_fcal;
754 break;
756 myMoments[iMoment] = eng_calib_dead_leakage;
757 break;
759 myMoments[iMoment] = eng_calib_dead_unclass;
760 break;
762 myMoments[iMoment] = engCalibFrac[kCalibFracEM];
763 break;
765 myMoments[iMoment] = engCalibFrac[kCalibFracHAD];
766 break;
768 myMoments[iMoment] = engCalibFrac[kCalibFracREST];
769 break;
770 default:
771 // nothing to be done for other moments
772 break;
773 }
774
775 theCluster->insertMoment(vMomentsIter->second, myMoments[iMoment]);
776 }
777 }
778 }
779
780 return StatusCode::SUCCESS;
781}
#define endmsg
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
MsgStream & msg() const
std::array< double, CaloDmDescrArea::DMA_MAX > engCalibDeadInArea
void accumulateDeadMaterialEnergy(const std::vector< const CaloCalibrationHitContainer * > &v_dmcchc, const xAOD::CaloClusterContainer &theClusColl, const ClusInfo_t &clusInfoVec, const ClusList &clusList, bool useParticleID, AddDeadMaterialEnergy &&addDeadMaterialEnergy) const
Accumulate dead-material calibration-hit energy assigned to clusters.
std::map< Identifier, MyCellInfo > CellInfoSet_t
static void accumulateClusterCalibHits(const std::vector< const CaloCalibrationHitContainer * > &v_cchc, const CellInfoSet_t &cellInfo, const CaloCell_ID &calo_id, ClusInfo_t &clusInfoVec, unsigned int &nHitsTotal, unsigned int &nHitsWithoutParticleUID, bool useParticleID, InvalidUniqueIdHandler &&invalidUniqueIdHandler)
Accumulate calibration-hit energy inside clusters.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
static void buildOutOfClusterClusterLists(const xAOD::CaloClusterContainer &theClusColl, const ClusInfo_t &clusInfoVec, int n_phi_out, int n_eta_out, double out_phi_max, double out_eta_max, const std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > &i_phi_eta, const std::array< bool, 3 > &doOutOfCluster, const std::array< ClusList *, 3 > &clusLists)
Build lookup lists of clusters for out-of-cluster energy sharing.
static void buildCellInfoMap(const xAOD::CaloClusterContainer &theClusColl, CellInfoSet_t &cellInfo)
Build a map of calorimeter cells contributing to clusters.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
static void accumulateOutOfClusterEnergy(const std::vector< const CaloCalibrationHitContainer * > &v_cchc, const CellInfoSet_t &cellInfo, const CaloDetDescrManager &calo_dd_man, const ClusInfo_t &clusInfoVec, int n_phi_out, int n_eta_out, double out_phi_max, double out_eta_max, const std::array< bool, 3 > &doOutOfCluster, const std::array< const ClusList *, 3 > &clusLists, AddOutOfClusterEnergy &&addOutOfClusterEnergy)
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
void insertMoment(MomentType type, double value)
@ ENG_CALIB_OUT_M
Attached Calibration Hit energy outside clusters but inside the calorimeter with medium matching (Ang...
@ ENG_CALIB_OUT_L
Attached Calibration Hit energy outside clusters but inside the calorimeter with loose matching (Angl...
@ ENG_CALIB_DEAD_UNCLASS
Attached Calibration Hit energy in dead material in unclassified areas of the detector.
@ ENG_CALIB_DEAD_HEC0
Attached Calibration Hit energy in dead material between EME3 and HEC0.
@ ENG_CALIB_DEAD_TILEG3
Attached Calibration Hit energy in dead material before scintillator.
@ ENG_CALIB_FRAC_REST
Calibration Hit energy inside the cluster caused by other particles.
@ ENG_CALIB_DEAD_EME0
Attached Calibration Hit energy in dead material before EME0, between EME0 and EME1.
@ ENG_CALIB_DEAD_TILE0
Attached Calibration Hit energy in dead material between EMB3 and TILE0.
@ ENG_CALIB_FRAC_EM
Calibration Hit energy inside the cluster caused by e/gamma/pi0.
@ ENG_CALIB_DEAD_FCAL
Attached Calibration Hit energy in dead material before FCAL, between FCAL and HEC.
@ ENG_CALIB_TOT
Calibration Hit energy inside the cluster.
@ ENG_CALIB_OUT_T
Attached Calibration Hit energy outside clusters but inside the calorimeter with tight matching (Angl...
@ ENG_CALIB_DEAD_LEAKAGE
Attached Calibration Hit energy in dead material behind calorimeters.
@ ENG_CALIB_FRAC_HAD
Calibration Hit energy inside the cluster caused by charged pi+ and pi-.
@ ENG_CALIB_EMB0
Calibration Hit energy inside the cluster barrel presampler.
@ ENG_CALIB_EME0
Calibration Hit energy inside the cluster endcap presampler.
@ ENG_CALIB_DEAD_EMB0
Attached Calibration Hit energy in dead material before EMB0, between EMB0 and EMB1.
@ ENG_CALIB_DEAD_TOT
Attached Calibration Hit energy in dead material.
@ ENG_CALIB_TILEG3
Calibration Hit energy inside the cluster scintillator.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode CaloCalibClusterMomentsMaker2::initialize ( )
overridevirtual

Definition at line 164 of file CaloCalibClusterMomentsMaker2.cxx.

165{
166 ATH_MSG_INFO("Initializing " << name());
167
168 for (const std::string& name : m_momentsNames) {
169 bool isValid(false);
170 for (const moment_name_pair& vname : m_validNames) {
171 if (name == vname.first) {
172 m_validMoments.insert(vname);
173 isValid = true;
174 ATH_MSG_DEBUG("Inserting " << name);
175 break;
176 }
177 }
178 if (!isValid) {
179 msg() << MSG::ERROR << "Moment " << name
180 << " is not a valid Moment name and will be ignored! "
181 << "Valid names are:";
182 for (unsigned int i = 0; i < m_validNames.size(); i++) {
183 msg() << (i == 0 ? " " : ", ") << m_validNames[i].first;
184 }
185 msg() << endmsg;
186 }
187 }
188
189 // to switch on clever DeadMaterial assignment procedure
190 // and check if tight, medium and/or loose versions for out-of-cluster and
191 // simple dead-material assignment are wanted
192 for (const moment_name_pair& vname : m_validNames) {
193 switch (vname.second) {
196 break;
198 m_doOutOfClusterL = true;
199 break;
201 m_doOutOfClusterM = true;
202 break;
204 m_doOutOfClusterT = true;
205 break;
207 m_doCalibFrac = true;
208 break;
210 m_doCalibFrac = true;
211 break;
213 m_doCalibFrac = true;
214 break;
215 default:
216 break;
217 }
218 }
219
221 ATH_MSG_INFO("Usage of ParticleID was switched off (UseParticleID==False), no ENG_CALIB_FRAC_* moments will be available");
222 m_doCalibFrac = false;
223 }
224
225 for (const std::string& name : m_momentsNamesAOD) {
226 for (const moment_name_pair& vname : m_validNames) {
227 if (vname.first == name) {
228 m_momentsAOD.insert(vname.second);
229 break;
230 }
231 }
232 }
235 }
236
237 // dead material identifier description manager
239
240 ATH_CHECK(detStore()->retrieve(m_calo_id, "CaloCell_ID"));
241 ATH_CHECK(detStore()->retrieve(m_caloDM_ID));
242
248 m_rmaxOut,
250
254 ATH_CHECK(m_caloDetDescrMgrKey.initialize());
255
256 return StatusCode::SUCCESS;
257}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
std::set< xAOD::CaloCluster::MomentType > m_momentsAOD
static void initializeOutOfClusterDistanceTables(int n_phi_out, int n_eta_out, double out_phi_max, double out_eta_max, const double(&rmaxOut)[3], std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > &i_phi_eta)
Precompute eta/phi lookup tables for quick out-of-cluster hit association to clusters.
std::pair< std::string, xAOD::CaloCluster::MomentType > moment_name_pair
static const CaloDmDescrManager * instance()

◆ initializeOutOfClusterDistanceTables()

void CaloCalibClusterMomentsMaker2::initializeOutOfClusterDistanceTables ( int n_phi_out,
int n_eta_out,
double out_phi_max,
double out_eta_max,
const double(&) rmaxOut[3],
std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > & i_phi_eta )
static

Precompute eta/phi lookup tables for quick out-of-cluster hit association to clusters.

Builds, for three search radius definitions (loose/medium/tight), a set of eta-dependent lookup tables that map relative (Δη, Δφ) regions to discrete index ranges. These tables are later used to efficiently find clusters within a given angular distance of a calibration hit.

The tables are organized as: [working point][eta bin] -> vector of (phi bin, eta min/max) ranges.

Parameters
n_phi_outNumber of bins in φ used for the lookup grid.
n_eta_outNumber of bins in η used for the lookup grid.
out_phi_maxMaximum |φ| range covered by the lookup grid.
out_eta_maxMaximum |η| range covered by the lookup grid.
rmaxOutArray of angular distance cuts (one per working point).
[out]i_phi_etaOutput lookup tables to be filled.

Definition at line 260 of file CaloCalibClusterMomentsMaker2.cxx.

267{
268 for (int im = 0; im < 3; ++im) {
269 i_phi_eta[im].clear();
270 i_phi_eta[im].resize(n_eta_out);
271 }
272
273 for (int jeta = 0; jeta < n_eta_out; ++jeta) {
274 const double eta0 = (jeta + 0.5) * out_eta_max / n_eta_out;
275 HepLorentzVector middle(1, 0, 0, 1);
276 middle.setREtaPhi(1. / std::cosh(eta0), eta0, 0.0);
277
278 double x_rmaxOut[3];
279 for (int im = 0; im < 3; ++im) {
280 x_rmaxOut[im] = rmaxOut[im] * angle_mollier_factor(eta0);
281 }
282
283 for (int jp = -n_phi_out; jp < n_phi_out; ++jp) {
284 const double phi = (jp + 0.5) * out_phi_max / n_phi_out;
285 int ietaMin[3] = {n_eta_out, n_eta_out, n_eta_out};
286 int ietaMax[3] = {-n_eta_out, -n_eta_out, -n_eta_out};
287
288 for (int je = -n_eta_out; je < n_eta_out; ++je) {
289 const double eta = (je + 0.5) * out_eta_max / n_eta_out;
290 HepLorentzVector cpoint(1, 0, 0, 1);
291 cpoint.setREtaPhi(1. / std::cosh(eta), eta, phi);
292 const double r = middle.angle(cpoint.vect());
293 for (int im = 0; im < 3; ++im) {
294 if (r < x_rmaxOut[im]) {
295 if (je < ietaMin[im]) {
296 ietaMin[im] = je;
297 }
298 if (je > ietaMax[im]) {
299 ietaMax[im] = je;
300 }
301 }
302 }
303 }
304
305 for (int im = 0; im < 3; ++im) {
306 if (ietaMin[im] <= ietaMax[im]) {
307 CalibHitIPhiIEtaRange theRange{};
308 theRange.iPhi = static_cast<char>(jp);
309 theRange.iEtaMin = static_cast<char>(ietaMin[im]);
310 theRange.iEtaMax = static_cast<char>(ietaMax[im]);
311 i_phi_eta[im][jeta].push_back(theRange);
312 }
313 }
314 }
315 }
316}
Scalar phi() const
phi method
int r
Definition globals.cxx:22

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_apars_alpha

float CaloCalibClusterMomentsMaker2::m_apars_alpha {}
private

Definition at line 478 of file CaloCalibClusterMomentsMaker2.h.

478{};

◆ m_apars_r0

float CaloCalibClusterMomentsMaker2::m_apars_r0 {}
private

Definition at line 479 of file CaloCalibClusterMomentsMaker2.h.

479{};

◆ m_CalibrationHitContainerNames

SG::ReadHandleKeyArray<CaloCalibrationHitContainer> CaloCalibClusterMomentsMaker2::m_CalibrationHitContainerNames
private

Definition at line 451 of file CaloCalibClusterMomentsMaker2.h.

◆ m_calo_id

const CaloCell_ID* CaloCalibClusterMomentsMaker2::m_calo_id {}
private

Definition at line 455 of file CaloCalibClusterMomentsMaker2.h.

455{};

◆ m_caloDetDescrMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> CaloCalibClusterMomentsMaker2::m_caloDetDescrMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
private

Definition at line 454 of file CaloCalibClusterMomentsMaker2.h.

454{this,"CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_caloDM_ID

const CaloDM_ID* CaloCalibClusterMomentsMaker2::m_caloDM_ID {}
private

Definition at line 456 of file CaloCalibClusterMomentsMaker2.h.

456{};

◆ m_caloDmDescrManager

const CaloDmDescrManager* CaloCalibClusterMomentsMaker2::m_caloDmDescrManager {}
private

Definition at line 457 of file CaloCalibClusterMomentsMaker2.h.

457{};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_DMCalibrationHitContainerNames

SG::ReadHandleKeyArray<CaloCalibrationHitContainer> CaloCalibClusterMomentsMaker2::m_DMCalibrationHitContainerNames
private

Definition at line 452 of file CaloCalibClusterMomentsMaker2.h.

◆ m_doCalibFrac

bool CaloCalibClusterMomentsMaker2::m_doCalibFrac {}
private

Definition at line 475 of file CaloCalibClusterMomentsMaker2.h.

475{};

◆ m_doDeadEnergySharing

bool CaloCalibClusterMomentsMaker2::m_doDeadEnergySharing {}
private

Definition at line 467 of file CaloCalibClusterMomentsMaker2.h.

467{};

◆ m_doDeadL

bool CaloCalibClusterMomentsMaker2::m_doDeadL {}
private

Definition at line 471 of file CaloCalibClusterMomentsMaker2.h.

471{};

◆ m_doDeadM

bool CaloCalibClusterMomentsMaker2::m_doDeadM {}
private

Definition at line 472 of file CaloCalibClusterMomentsMaker2.h.

472{};

◆ m_doDeadT

bool CaloCalibClusterMomentsMaker2::m_doDeadT {}
private

Definition at line 473 of file CaloCalibClusterMomentsMaker2.h.

473{};

◆ m_doOutOfClusterL

bool CaloCalibClusterMomentsMaker2::m_doOutOfClusterL {}
private

Definition at line 468 of file CaloCalibClusterMomentsMaker2.h.

468{};

◆ m_doOutOfClusterM

bool CaloCalibClusterMomentsMaker2::m_doOutOfClusterM {}
private

Definition at line 469 of file CaloCalibClusterMomentsMaker2.h.

469{};

◆ m_doOutOfClusterT

bool CaloCalibClusterMomentsMaker2::m_doOutOfClusterT {}
private

Definition at line 470 of file CaloCalibClusterMomentsMaker2.h.

470{};

◆ m_energyMin

float CaloCalibClusterMomentsMaker2::m_energyMin {}
private

Definition at line 476 of file CaloCalibClusterMomentsMaker2.h.

476{};

◆ m_energyMinCalib

float CaloCalibClusterMomentsMaker2::m_energyMinCalib {}
private

Definition at line 477 of file CaloCalibClusterMomentsMaker2.h.

477{};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_foundAllContainers

std::atomic<bool> CaloCalibClusterMomentsMaker2::m_foundAllContainers {}
mutableprivate

Definition at line 464 of file CaloCalibClusterMomentsMaker2.h.

464{};

◆ m_i_phi_eta

std::array<std::vector<std::vector<CalibHitIPhiIEtaRange> >, 3> CaloCalibClusterMomentsMaker2::m_i_phi_eta
private

Definition at line 463 of file CaloCalibClusterMomentsMaker2.h.

◆ m_MatchDmType

int CaloCalibClusterMomentsMaker2::m_MatchDmType {}
private

Definition at line 480 of file CaloCalibClusterMomentsMaker2.h.

480{};

◆ m_momentsAOD

std::set<xAOD::CaloCluster::MomentType> CaloCalibClusterMomentsMaker2::m_momentsAOD
private

Definition at line 450 of file CaloCalibClusterMomentsMaker2.h.

◆ m_momentsNames

std::vector<std::string> CaloCalibClusterMomentsMaker2::m_momentsNames
private

Definition at line 446 of file CaloCalibClusterMomentsMaker2.h.

◆ m_momentsNamesAOD

std::vector<std::string> CaloCalibClusterMomentsMaker2::m_momentsNamesAOD
private

Definition at line 449 of file CaloCalibClusterMomentsMaker2.h.

◆ m_n_eta_out

int CaloCalibClusterMomentsMaker2::m_n_eta_out {}
private

Definition at line 459 of file CaloCalibClusterMomentsMaker2.h.

459{};

◆ m_n_phi_out

int CaloCalibClusterMomentsMaker2::m_n_phi_out {}
private

Definition at line 458 of file CaloCalibClusterMomentsMaker2.h.

458{};

◆ m_out_eta_max

double CaloCalibClusterMomentsMaker2::m_out_eta_max {}
private

Definition at line 461 of file CaloCalibClusterMomentsMaker2.h.

461{};

◆ m_out_phi_max

double CaloCalibClusterMomentsMaker2::m_out_phi_max {}
private

Definition at line 460 of file CaloCalibClusterMomentsMaker2.h.

460{};

◆ m_rmaxOut

double CaloCalibClusterMomentsMaker2::m_rmaxOut[3] {}
private

Definition at line 462 of file CaloCalibClusterMomentsMaker2.h.

462{};

◆ m_truthParticleContainerKey

SG::ReadHandleKey<xAOD::TruthParticleContainer> CaloCalibClusterMomentsMaker2::m_truthParticleContainerKey {this,"TruthParticles","TruthParticles","ReadHandleKey for truth particle container"}
private

Definition at line 453 of file CaloCalibClusterMomentsMaker2.h.

453{this,"TruthParticles","TruthParticles","ReadHandleKey for truth particle container"};

◆ m_useParticleID

bool CaloCalibClusterMomentsMaker2::m_useParticleID {}
private

Definition at line 474 of file CaloCalibClusterMomentsMaker2.h.

474{};

◆ m_validMoments

moment_name_set CaloCalibClusterMomentsMaker2::m_validMoments
private

Definition at line 448 of file CaloCalibClusterMomentsMaker2.h.

◆ m_validNames

moment_name_vector CaloCalibClusterMomentsMaker2::m_validNames
private

Definition at line 447 of file CaloCalibClusterMomentsMaker2.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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