ATLAS Offline Software
CaloCalibClusterMomentsMaker2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //-----------------------------------------------------------------------
6 // File and Version Information:
7 // $Id: CaloCalibClusterMomentsMaker2.cxx,v 1.16 2009-05-18 16:16:49 pospelov Exp $
8 //
9 // Description: see CaloCalibClusterMomentsMaker2.h
10 //
11 // Environment:
12 // Software developed for the ATLAS Detector at CERN LHC
13 //
14 // Author List:
15 // Sven Menke
16 //
17 //-----------------------------------------------------------------------
18 
19 //-----------------------
20 // This Class's Header --
21 //-----------------------
23 
24 //---------------
25 // C++ Headers --
26 //---------------
27 #include <iterator>
28 #include <sstream>
29 #include <set>
30 
31 #include "CaloEvent/CaloCell.h"
37 
40 
41 #include "StoreGate/ReadHandle.h"
42 
43 #include "CLHEP/Units/SystemOfUnits.h"
44 
45 #include <CLHEP/Vector/LorentzVector.h>
46 #include <cmath>
47 
48 
49 using CLHEP::HepLorentzVector;
50 using CLHEP::MeV;
51 using CLHEP::cm;
52 
53 
54 //###############################################################################
55 
57  const std::string& name,
58  const IInterface* parent)
59  : AthAlgTool(type, name, parent),
60  m_calo_id(nullptr),
61  m_caloDM_ID(nullptr),
62  m_caloDmDescrManager(nullptr),
63  m_useParticleID(true),
64  m_energyMin(200*MeV),
65  m_energyMinCalib(20*MeV),
66  m_apars_alpha(0.5),
67  m_apars_r0(0.2),
68  m_MatchDmType(kMatchDmLoose)
69 {
70  declareInterface<CaloClusterCollectionProcessor> (this);
71  // Name(s) of Moments to calculate
72  declareProperty("MomentsNames",m_momentsNames);
73  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_TOT"),xAOD::CaloCluster::ENG_CALIB_TOT));
74  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_OUT_L"),xAOD::CaloCluster::ENG_CALIB_OUT_L));
75  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_OUT_M"),xAOD::CaloCluster::ENG_CALIB_OUT_M));
76  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_OUT_T"),xAOD::CaloCluster::ENG_CALIB_OUT_T));
77  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_EMB0"),xAOD::CaloCluster::ENG_CALIB_EMB0));
78  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_EME0"),xAOD::CaloCluster::ENG_CALIB_EME0));
79  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_TILEG3"),xAOD::CaloCluster::ENG_CALIB_TILEG3));
80  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_TOT"),xAOD::CaloCluster::ENG_CALIB_DEAD_TOT));
81  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_EMB0"),xAOD::CaloCluster::ENG_CALIB_DEAD_EMB0));
82  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_TILE0"),xAOD::CaloCluster::ENG_CALIB_DEAD_TILE0));
83  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_TILEG3"),xAOD::CaloCluster::ENG_CALIB_DEAD_TILEG3));
84  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_EME0"),xAOD::CaloCluster::ENG_CALIB_DEAD_EME0));
85  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_HEC0"),xAOD::CaloCluster::ENG_CALIB_DEAD_HEC0));
86  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_FCAL"),xAOD::CaloCluster::ENG_CALIB_DEAD_FCAL));
87  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_LEAKAGE"),xAOD::CaloCluster::ENG_CALIB_DEAD_LEAKAGE));
88  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_DEAD_UNCLASS"),xAOD::CaloCluster::ENG_CALIB_DEAD_UNCLASS));
89  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_FRAC_EM"),xAOD::CaloCluster::ENG_CALIB_FRAC_EM));
90  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_FRAC_HAD"),xAOD::CaloCluster::ENG_CALIB_FRAC_HAD));
91  m_validNames.push_back(moment_name_pair(std::string("ENG_CALIB_FRAC_REST"),xAOD::CaloCluster::ENG_CALIB_FRAC_REST));
92 
93  // Name(s) of Moments which can be stored on the AOD - all others go to ESD
94  m_momentsNamesAOD.emplace_back("ENG_CALIB_TOT");
95  m_momentsNamesAOD.emplace_back("ENG_CALIB_OUT_L");
96  m_momentsNamesAOD.emplace_back("ENG_CALIB_OUT_M");
97  m_momentsNamesAOD.emplace_back("ENG_CALIB_OUT_T");
98  m_momentsNamesAOD.emplace_back("ENG_CALIB_EMB0");
99  m_momentsNamesAOD.emplace_back("ENG_CALIB_EME0");
100  m_momentsNamesAOD.emplace_back("ENG_CALIB_TILEG3");
101  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_TOT");
102  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_EMB0");
103  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_TILE0");
104  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_TILEG3");
105  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_EME0");
106  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_HEC0");
107  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_FCAL");
108  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_LEAKAGE");
109  m_momentsNamesAOD.emplace_back("ENG_CALIB_DEAD_UNCLASS");
110  m_momentsNamesAOD.emplace_back("ENG_CALIB_FRAC_EM");
111  m_momentsNamesAOD.emplace_back("ENG_CALIB_FRAC_HAD");
112  m_momentsNamesAOD.emplace_back("ENG_CALIB_FRAC_REST");
113 
114  declareProperty("AODMomentsNames",m_momentsNamesAOD);
115  declareProperty("CalibrationHitContainerNames",m_CalibrationHitContainerNames);
116  declareProperty("DMCalibrationHitContainerNames",m_DMCalibrationHitContainerNames);
117  m_n_phi_out = 127; // not more than 127 since we store indices (-127,...-1,0,...,126) and have 8 bits only
118  m_n_eta_out = 127;
120  m_out_eta_max = 6;
121 
122  m_rmaxOut[0] = 1.0;
123  m_rmaxOut[1] = 0.5;
124  m_rmaxOut[2] = 0.3;
125 
126  for( int im=0;im<3;im++) {
127  m_i_phi_eta[im].resize(m_n_eta_out);
128  }
129  m_doDeadEnergySharing = false;
130  m_foundAllContainers = false;
131  m_doOutOfClusterL = false;
132  m_doOutOfClusterM = false;
133  m_doOutOfClusterT = false;
134  m_doDeadL = false;
135  m_doDeadM = false;
136  m_doDeadT = false;
137  m_doCalibFrac = false;
138 
139  declareProperty("MatchDmType",m_MatchDmType);
140 
141  declareProperty( "UseParticleID",m_useParticleID);
142 }
143 
144 
145 
146 //###############################################################################
147 
149 {
150  ATH_MSG_INFO( "Initializing " << name() );
151 
152  for (const std::string& name : m_momentsNames) {
153  bool isValid(false);
154  for (const moment_name_pair& vname : m_validNames) {
155  if ( name == vname.first ) {
156  m_validMoments.insert(vname);
157  isValid = true;
158  ATH_MSG_DEBUG( "Inserting " << name );
159  break;
160  }
161  }
162  if ( !isValid) {
163  msg() << MSG::ERROR << "Moment " << name
164  << " is not a valid Moment name and will be ignored! "
165  << "Valid names are:";
166  for (unsigned int i=0;i<m_validNames.size();i++)
167  msg() << (i==0?" ":", ") << m_validNames[i].first;
168  msg() << endmsg;
169  }
170  }
171 
172  // to switch on clever DeadMaterial assignment procedure
173  // and check if tight, medium and/or loose versions for out-of-cluster and
174  // simple dead-material assignment are wanted
175  for (const moment_name_pair& vname : m_validNames) {
176  switch (vname.second) {
178  m_doDeadEnergySharing = true;
179  break;
181  m_doOutOfClusterL = true;
182  break;
184  m_doOutOfClusterM = true;
185  break;
187  m_doOutOfClusterT = true;
188  break;
190  m_doCalibFrac = true;
191  break;
193  m_doCalibFrac = true;
194  break;
196  m_doCalibFrac = true;
197  break;
198  default:
199  break;
200  }
201  }
202 
204  ATH_MSG_INFO( "Usage of ParticleID was switched off (UseParticleID==False), no ENG_CALIB_FRAC_* moments will be available" );
205  m_doCalibFrac = false;
206  }
207 
208  for (const std::string& name : m_momentsNamesAOD) {
209  for (const moment_name_pair& vname : m_validNames) {
210  if ( vname.first == name ) {
211  m_momentsAOD.insert(vname.second);
212  break;
213  }
214  }
215  }
217  m_doDeadEnergySharing = true;
218  }
219 
220  // dead material identifier description manager
222 
223  ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") );
225 
226  // initialize distance tables
227  for(int jeta = 0;jeta<m_n_eta_out;jeta++) {
228  double eta0 = (jeta+0.5) * (m_out_eta_max)/m_n_eta_out;
229  HepLorentzVector middle(1,0,0,1);
230  middle.setREtaPhi(1./cosh(eta0),eta0,0);
231  double x_rmaxOut[3];
232  for (int im=0;im<3;im++) {
233  x_rmaxOut[im] = m_rmaxOut[im]*angle_mollier_factor(eta0);
234  }
235  for (int jp=-m_n_phi_out;jp<m_n_phi_out;jp++) {
236  double phi = (jp+0.5) * m_out_phi_max/m_n_phi_out;
237  int ietaMin[3] = {m_n_eta_out,m_n_eta_out,m_n_eta_out};
238  int ietaMax[3] = {-m_n_eta_out,-m_n_eta_out,-m_n_eta_out};
239  for(int je = -m_n_eta_out;je<m_n_eta_out;je++) {
240  double eta = (je+0.5) * m_out_eta_max/m_n_eta_out;
241  HepLorentzVector cpoint(1,0,0,1);
242  cpoint.setREtaPhi(1./cosh(eta),eta,phi);
243  double r = middle.angle(cpoint.vect());
244  for (int im=0;im<3;im++) {
245  if ( r < x_rmaxOut[im] ) {
246  if ( je < ietaMin[im] )
247  ietaMin[im] = je;
248  if ( je > ietaMax[im] )
249  ietaMax[im] = je;
250  }
251  }
252  }
253  for (int im=0;im<3;im++) {
254  if ( ietaMin[im] <= ietaMax[im] ) {
255  CalibHitIPhiIEtaRange theRange{};
256  theRange.iPhi = (char)jp;
257  theRange.iEtaMin = (char)ietaMin[im];
258  theRange.iEtaMax = (char)ietaMax[im];
259  m_i_phi_eta[im][jeta].push_back(theRange);
260  }
261  }
262  }
263  }
264 
267 
269 
271 
272  return StatusCode::SUCCESS;
273 }
274 
275 //###############################################################################
276 
279  xAOD::CaloClusterContainer *theClusColl) const
280 {
281 
282  ATH_MSG_DEBUG("Starting CaloCalibClusterMomentsMaker2::execute");
284  const CaloDetDescrManager* calo_dd_man = *caloMgrHandle;
285 
286  bool foundAllContainers (true);
287  std::vector<const CaloCalibrationHitContainer *> v_cchc;
290  {
292  if ( !cchc.isValid() ) {
293  if (m_foundAllContainers) {
294  // print ERROR message only if there was at least one event with
295  // all containers
296  msg(MSG::ERROR) << "SG does not contain calibration hit container " << key.key() << endmsg;
297  }
298  foundAllContainers = false;
299  }
300  else {
301  v_cchc.push_back(cchc.cptr());
302  }
303  }
304 
305  std::vector<const CaloCalibrationHitContainer *> v_dmcchc;
308  {
310  if ( !cchc.isValid() ) {
311  if (m_foundAllContainers) {
312  // print ERROR message only if there was at least one event with
313  // all containers
314  ATH_MSG_ERROR("SG does not contain DM calibration hit container " << key.key());
315  }
316  foundAllContainers = false;
317  }
318  else {
319  v_dmcchc.push_back(cchc.cptr());
320  }
321  }
322 
323  if ( !m_foundAllContainers && foundAllContainers )
324  m_foundAllContainers = true;
325 
326  if ( !foundAllContainers ) return StatusCode::SUCCESS;
327  ATH_MSG_DEBUG("SG has all containers ");
328 
329  // will contain detailed info about cluster calibration eneries
330  ClusInfo_t clusInfoVec (theClusColl->size());
331 
332  CellInfoSet_t cellInfo;
333 
334  /* ********************************************
335  filling the map with info which cell belongs to which cluster and what
336  is the cell weight in the cluster
337  ******************************************** */
338  xAOD::CaloClusterContainer::iterator clusIter = theClusColl->begin();
339  xAOD::CaloClusterContainer::iterator clusIterEnd = theClusColl->end();
340  int iClus = 0;
341  for( ;clusIter!=clusIterEnd;++clusIter,++iClus) {
342  const xAOD::CaloCluster * theCluster = (*clusIter);
343 
344  // loop over all cell members and fill cell vector for used cells
345  xAOD::CaloCluster::const_cell_iterator cellIter = theCluster->cell_begin();
346  xAOD::CaloCluster::const_cell_iterator cellIterEnd = theCluster->cell_end();
347  for(; cellIter != cellIterEnd; cellIter++ ){
348  const CaloCell* pCell = (*cellIter);
349  Identifier myId = pCell->ID();
350 
351  MyCellInfo info (iClus, cellIter.weight() );
352  CellInfoSet_t::iterator bookmark = cellInfo.lower_bound( myId );
353  if(bookmark == cellInfo.end() || bookmark->first != myId) {
354  // We haven't had a infohit in this cell before. Add it to our set.
355  if (bookmark != cellInfo.begin()) --bookmark;
356  cellInfo.emplace_hint (bookmark, myId, std::move(info));
357  }else{
358  // Update the existing hit.
359  bookmark->second.Add( info );
360  }
361  } // cellIter
362  } // iClus
363 
364 
365  /* ********************************************
366  calculate total calib energy inside clusters
367  ******************************************** */
368  unsigned int nHitsTotal = 0;
369  unsigned int nHitsWithoutParticleID = 0;
370  for (const CaloCalibrationHitContainer* cchc : v_cchc) {
371  //loop over cells in calibration container
372  for (const CaloCalibrationHit* hit : *cchc) {
373  Identifier myId = hit->cellID();
374 
375  CellInfoSet_t::iterator pos = cellInfo.find( myId );
376  if(pos != cellInfo.end() ) {
377  // i.e. given hit id belongs to one or more clusters
379  for ( const std::pair<int, double>& p : pos->second.m_ClusWeights) {
380  int iClus = p.first;
381  double weight = p.second;
382  if(m_useParticleID){
383  clusInfoVec[iClus].Add(weight * hit->energyTotal(), nsmp, hit->particleID());
384  }else{
385  clusInfoVec[iClus].Add(weight * hit->energyTotal(), nsmp);
386  }
387  }
388  }
389  if( m_useParticleID && hit->particleID() == 0) {
390  nHitsWithoutParticleID++;
391  }
392  nHitsTotal++;
393  }
394  }
395 
396  // if all calibration hits have ParticleID(i.e. barcode)==0 when simulation was done without ParticleID
397  bool doCalibFrac = m_doCalibFrac;
398  bool useParticleID = m_useParticleID;
399  if(m_useParticleID && (nHitsTotal == nHitsWithoutParticleID) ) {
400  msg(MSG::INFO) << "Calibration hits do not have ParticleID, i.e. barcode of particle caused hits is always 0. Continuing without ParticleID machinery."<< endmsg;
401  useParticleID = false;
402  }
403 
404  // reading particle information for later calcution of calibration enegry fraction caused
405  // by particles of different types
406  SG::ReadHandle<xAOD::TruthParticleContainer> truthParticleContainerReadHandle(m_truthParticleContainerKey, ctx);
407 
408  if (doCalibFrac && !truthParticleContainerReadHandle.isValid()){
409  ATH_MSG_WARNING("Invalid read handle to TruthParticleContainer with key: " << m_truthParticleContainerKey.key());
410  doCalibFrac = false;
411  }
412 
413  std::vector<double> engCalibOut[3];
414 
415  /* ****************************************************************
416  lists of clusters populating given area [eta*phi][iClus list]
417  **************************************************************** */
418  std::vector<std::vector <int > > clusListL;
419  std::vector<std::vector <int > > clusListM;
420  std::vector<std::vector <int > > clusListT;
422  clusListL.resize((2*m_n_phi_out+1)*(2*m_n_eta_out+1));
424  clusListM.resize((2*m_n_phi_out+1)*(2*m_n_eta_out+1));
426  clusListT.resize((2*m_n_phi_out+1)*(2*m_n_eta_out+1));
427 
428  for(unsigned int ii=0;ii<3;ii++) {
429  if ( (ii == 0 && (m_doOutOfClusterL || m_doDeadL || (m_doDeadEnergySharing && m_MatchDmType==kMatchDmLoose) ) ) ||
432  engCalibOut[ii].resize(theClusColl->size(),0);
433  iClus = -1;
434  for (const xAOD::CaloCluster * theCluster : *theClusColl) {
435  ++iClus;
436  MyClusInfo& clusInfo = clusInfoVec[iClus];
437 
438  if ( clusInfo.engCalibIn.engTot > 0 ) {
439  int iEtaSign = 1;
440  if ( theCluster->eta() < 0 ) iEtaSign = -1;
441  int jeta = (int)(floor(m_n_eta_out*(theCluster->eta()/(m_out_eta_max))));
442  int jphi = (int)(floor(m_n_phi_out*(theCluster->phi())/(m_out_phi_max)));
443  if ( jeta >= -m_n_eta_out && jeta < m_n_eta_out ) {
444  if ( jphi < -m_n_phi_out ) jphi += 2*m_n_phi_out;
445  if ( jphi >= m_n_phi_out ) jphi -= 2*m_n_phi_out;
446  unsigned int iEtaBin(jeta);
447  if ( jeta < 0 ) iEtaBin = abs(jeta)-1;
448  const std::vector<CalibHitIPhiIEtaRange>& bins
449  = m_i_phi_eta[ii][iEtaBin];
450  for (const CalibHitIPhiIEtaRange& range : bins) {
451  int jp = range.iPhi+jphi;
452  if ( jp < -m_n_phi_out ) jp += 2*m_n_phi_out;
453  if ( jp >= m_n_phi_out ) jp -= 2*m_n_phi_out;
454  int jEtaMin = iEtaSign<0?-range.iEtaMax-1:range.iEtaMin;
455  int jEtaMax = iEtaSign<0?-range.iEtaMin-1:range.iEtaMax;
456  for( int je = jEtaMin;je<=jEtaMax;je++ ) {
457  if(ii == 0 ) clusListL[(jp+m_n_phi_out)*(2*m_n_eta_out+1)+je+m_n_eta_out].push_back(iClus);
458  else if(ii == 1 ) clusListM[(jp+m_n_phi_out)*(2*m_n_eta_out+1)+je+m_n_eta_out].push_back(iClus);
459  else if(ii == 2 ) clusListT[(jp+m_n_phi_out)*(2*m_n_eta_out+1)+je+m_n_eta_out].push_back(iClus);
460  }
461  }
462  }
463  }
464  }
465  }
466  }
467 
468  /* ****************************************************************
469  calculate out-of-cluster energy of clusters
470  **************************************************************** */
472  for (const CaloCalibrationHitContainer* cchc : v_cchc) {
473  //loop over cells in calibration container
474  for (const CaloCalibrationHit* hit : *cchc) {
475  Identifier myId = hit->cellID();
476 
477  CellInfoSet_t::iterator pos = cellInfo.find( myId );
478  if(pos == cellInfo.end() ) {
479  // hit is not inside any cluster
480  const CaloDetDescrElement* myCDDE =
481  calo_dd_man->get_element(myId);
482  int pid(0);
483  if(useParticleID) pid = hit->particleID();
484  if ( myCDDE ) {
485  int jeO = (int)floor(m_n_eta_out*(myCDDE->eta()/m_out_eta_max));
486  if ( jeO >= -m_n_eta_out && jeO < m_n_eta_out ) {
487  int jpO = (int)floor(m_n_phi_out*(myCDDE->phi()/m_out_phi_max));
488  if ( jpO < -m_n_phi_out ) jpO += 2*m_n_phi_out;
489  if ( jpO >= m_n_phi_out ) jpO -= 2*m_n_phi_out;
490  for (unsigned int ii=0;ii<3;ii++) {
491  std::vector<std::vector <int > > *pClusList=nullptr;
492  if ( ii == 0 && m_doOutOfClusterL )
493  pClusList = &clusListL;
494  else if ( ii == 1 && m_doOutOfClusterM )
495  pClusList = &clusListM;
496  else if ( ii == 2 && m_doOutOfClusterT )
497  pClusList = &clusListT;
498  if ( pClusList) {
499  // loop over list of potential neighboring clusters
500  double hitClusNorm(0.);
501  std::vector<int> hitClusIndex;
502  std::vector<double > hitClusEffEnergy;
503  // loop over clusters which match given OOC hit
504  for(unsigned int i_cls=0; i_cls<(*pClusList)[(jpO+m_n_phi_out)*(2*m_n_eta_out+1)+jeO+m_n_eta_out].size(); i_cls++){
505  int iClus = (*pClusList)[(jpO+m_n_phi_out)*(2*m_n_eta_out+1)+jeO+m_n_eta_out][i_cls];
506  MyClusInfo& clusInfo = clusInfoVec[iClus];
507  // getting access to calibration energy inside cluster caused by same particleID (barcode)
508  // as given OOC hit
510  if(pos!=clusInfo.engCalibParticle.end()) {
511  // given cluster have some energy inside caused by same particle as given OOC hitClusEffEnergy
512  // so the hit will be assigned to this cluster with some weight
513  hitClusNorm += pos->second.engTot;
514  hitClusEffEnergy.push_back(pos->second.engTot);
515  hitClusIndex.push_back(iClus);
516  }
517  }
518  if ( hitClusNorm > 0 ) {
519  const double inv_hitClusNorm = 1. / hitClusNorm;
520  for(unsigned int i_cls=0; i_cls<hitClusIndex.size(); i_cls++){
521  int iClus = hitClusIndex[i_cls];
522  double w = hitClusEffEnergy[i_cls] * inv_hitClusNorm;
523  engCalibOut[ii][iClus] += w*hit->energyTotal();
524  }
525  }
526  }
527  }
528  }
529  }
530  } // hits not in cluster
531  }
532  }
533  }
534 
535  // ------------------------------------------------------------------------
536  // calculate dead-material energy of clusters (way2)
537  // + energy is shared among clusters within certain area
538  // + distance to clusters and energy in specific samplings are used as sharing criteria
539  // + calculations are done separately for different dead material areas
540  std::vector<std::vector <int > > *pClusList=nullptr;
541  if ( m_MatchDmType == kMatchDmLoose ) {
542  pClusList = &clusListL;
543  } else if ( m_MatchDmType == kMatchDmMedium ) {
544  pClusList = &clusListM;
545  } else if ( m_MatchDmType == kMatchDmTight ) {
546  pClusList = &clusListT;
547  }
548  if( m_doDeadEnergySharing && pClusList) {
549 
550  for (const CaloCalibrationHitContainer* dmcchc : v_dmcchc) {
551  for (const CaloCalibrationHit* hit : *dmcchc) {
552  Identifier myId = hit->cellID();
553  if (m_calo_id->is_lar_dm(myId) || m_calo_id->is_tile_dm(myId)) {
554  CaloDmDescrElement* myCDDE(nullptr);
555  myCDDE = m_caloDmDescrManager->get_element(myId);
556  if ( myCDDE ) {
557  int pid(0); // FIXME barcode-based
558  if(useParticleID) pid = hit->particleID(); // FIXME barcode-based - requires migrating CaloCalibrationHits away from barcodes
559 
560  int jeO = (int)floor(m_n_eta_out*(myCDDE->eta()/m_out_eta_max));
561  if ( jeO >= -m_n_eta_out && jeO < m_n_eta_out ) {
562  int jpO = (int)floor(m_n_phi_out*(myCDDE->phi()/m_out_phi_max));
563  if ( jpO < -m_n_phi_out ) jpO += 2*m_n_phi_out;
564  if ( jpO >= m_n_phi_out ) jpO -= 2*m_n_phi_out;
565 
566  /* ****************************************
567  share energy of DM hit among different clusters
568  ***************************************** */
569  int nDmArea = m_caloDmDescrManager->get_dm_area(myId);
570  const CaloDmRegion *dmRegion = m_caloDmDescrManager->get_dm_region(myId);
571  int hitClusVecIndex = 0;
572  std::vector<int> hitClusIndex(theClusColl->size());
573  std::vector<double > hitClusEffEnergy(theClusColl->size());
574  double hitClusNorm = 0.0;
575  // loop over clusters which match given DM hit
576  for(unsigned int i_cls=0; i_cls< (*pClusList)[(jpO+m_n_phi_out)*(2*m_n_eta_out+1)+jeO+m_n_eta_out].size(); i_cls++){
577  int iClus = (*pClusList)[(jpO+m_n_phi_out)*(2*m_n_eta_out+1)+jeO+m_n_eta_out][i_cls];
578  xAOD::CaloCluster * theCluster = theClusColl->at(iClus);
579 
580  MyClusInfo& clusInfo = clusInfoVec[iClus];
581  // getting access to calibration energy inside cluster caused by same particleID (barcode)
582  // as given OOC hit
583  std::map<int, MyClusInfo::ClusCalibEnergy>::iterator pos = clusInfo.engCalibParticle.find(pid); // FIXME barcode-based
584  if(pos!=clusInfo.engCalibParticle.end()) {
585  double engClusPidCalib = pos->second.engTot;
586 
587  if(engClusPidCalib > m_energyMinCalib && theCluster->e()>m_energyMin) {
588  double sum_smp_energy = 0.0;
589  // loop over calo sampling numbers registered for given DM area
590  for(unsigned int i_smp=0; i_smp<dmRegion->m_CaloSampleNeighbours.size(); i_smp++) {
592  if( (dmRegion->m_CaloSampleEtaMin[i_smp]-0.5) <= theCluster->eta() &&
593  theCluster->eta() <= (dmRegion->m_CaloSampleEtaMax[i_smp]+0.5) ){
594  //sum_smp_energy += theCluster->eSample(nsmp);
595  sum_smp_energy += pos->second.engSmp[nsmp];
596  }
597  }
598  if(sum_smp_energy > 0.0) {
599  double phi_diff=myCDDE->phi()-theCluster->phi();
600  if(phi_diff <= -M_PI){
601  phi_diff += 2.*M_PI;
602  } else if (phi_diff > M_PI){
603  phi_diff -= 2.*M_PI;
604  }
605  double eta_diff = (myCDDE->eta()-theCluster->eta());
606  float distance=sqrt(eta_diff * eta_diff + phi_diff * phi_diff);
607 
608  double effEner = pow(sum_smp_energy,m_apars_alpha)*exp(-distance/m_apars_r0);
609 
610  hitClusIndex [hitClusVecIndex] = iClus;
611  hitClusEffEnergy [hitClusVecIndex++]= effEner;
612  hitClusNorm += effEner;
613  }
614  } // good energetic cluster
615  } // we ve found a pid
616  } // loop over clusters in the list
617  hitClusIndex.resize(hitClusVecIndex);
618  hitClusEffEnergy.resize(hitClusVecIndex);
619 
620 
621  // now we have to calculate weight for assignment hit energy to cluster
622  if(hitClusNorm >0.0) {
623  const double inv_hitClusNorm = 1. / hitClusNorm;
624  for(unsigned int i_cls=0; i_cls<hitClusIndex.size(); i_cls++){
625  int iClus = hitClusIndex[i_cls];
626  double dm_weight = hitClusEffEnergy[i_cls] * inv_hitClusNorm;
627  if(dm_weight > 1.0 || dm_weight < 0.0 ){
628  std::cout << "CaloCalibClusterMomentsMaker2::execute() ->Error! Strange weight " << dm_weight<< std::endl;
629  std::cout << hitClusEffEnergy[i_cls] << " " << hitClusNorm << std::endl;
630  }
631  clusInfoVec[iClus].engCalibDeadInArea[nDmArea] += hit->energyTotal()*dm_weight;
632  clusInfoVec[iClus].engCalibDeadInArea[CaloDmDescrArea::DMA_ALL] += hit->energyTotal()*dm_weight;
633  }
634  } // hit clus norm
635 
636  } // loop over united ieta*iphi
637  } // myCDDE
638  } // tile and lar
639  } // eol over DM calibration hits
640  } //eol over containers
641 
642  } // doDeadEnergySharing
643 
644  // fraction of calibration energies caused by different particles
645  std::vector<double> engCalibFrac;
646  engCalibFrac.resize(kCalibFracMax, 0.0);
647 
648  std::map<unsigned int,int> truthBarcodeToPdgCodeMap; // FIXME barcode-based - requires CaloCalibrationHit migration
649 
650  //loop on truth particle container is slow, so put needed information in a map for faster key lookup in later loops
651  for ( const auto *thisTruthParticle : *truthParticleContainerReadHandle){
652 
653  if (!thisTruthParticle){
654  ATH_MSG_WARNING("Got invalid pointer to TruthParticle");
655  continue;
656  }
657 
658  truthBarcodeToPdgCodeMap[HepMC::barcode(thisTruthParticle)] = thisTruthParticle->pdgId(); // FIXME barcode-based
659  }//truth particle loop
660 
661  // assign moments
662  for( clusIter = theClusColl->begin(),iClus=0; clusIter!=clusIterEnd;++clusIter,++iClus) {
663  xAOD::CaloCluster * theCluster = *clusIter;
664  MyClusInfo& clusInfo = clusInfoVec[iClus];
665 
666  // total DM energy assigned to cluster
667  double eng_calib_dead_tot = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_ALL]
671  // DM energy before barrel presampler, inside it, and between presampler and strips
672  double eng_calib_dead_emb0 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EMB0]
675  // DM energy between barrel and tile
676  double eng_calib_dead_tile0 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EMB3_TILE0];
677  // DM energy before scintillator and inside scintillator
678  double eng_calib_dead_tileg3 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_SCN]
680  // DM energy beforee endcap presampler, inside it and between presampler and strips
681  double eng_calib_dead_eme0 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EME0]
684  // DM energy between emec and hec
685  double eng_calib_dead_hec0 = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_EME3_HEC0];
686  // DM energy before FCAL and between HEC and FCAL
687  double eng_calib_dead_fcal = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_FCAL0]
689  // DM leakage behind the calorimeter
690  double eng_calib_dead_leakage = clusInfo.engCalibDeadInArea[CaloDmDescrArea::DMA_LEAK];
691  // the rest of DM energy which remains unclassified
692  double eng_calib_dead_unclass = eng_calib_dead_tot - eng_calib_dead_emb0 - eng_calib_dead_tile0
693  - eng_calib_dead_tileg3 - eng_calib_dead_eme0 - eng_calib_dead_hec0 - eng_calib_dead_fcal
694  - eng_calib_dead_leakage;
695 
696  if(doCalibFrac){
697  get_calib_frac(truthBarcodeToPdgCodeMap, clusInfo, engCalibFrac);
698  }
699 
700  if ( !m_momentsNames.empty() ) {
701  std::vector<double> myMoments(m_validMoments.size(),0);
702  // assign moments
703  moment_name_set::const_iterator vMomentsIter = m_validMoments.begin();
704  moment_name_set::const_iterator vMomentsIterEnd = m_validMoments.end();
705 
706  int iMoment=0;
707  for(; vMomentsIter!=vMomentsIterEnd; ++vMomentsIter,++iMoment) {
708  // now calculate the actual moments
709  switch (vMomentsIter->second) {
711  ATH_MSG_DEBUG("Inserting ENG_CALIB_TOT");
712  myMoments[iMoment] = clusInfo.engCalibIn.engTot;
713  break;
715  myMoments[iMoment] = engCalibOut[0][iClus];
716  break;
718  myMoments[iMoment] = engCalibOut[1][iClus];
719  break;
721  myMoments[iMoment] = engCalibOut[2][iClus];
722  break;
724  myMoments[iMoment] = clusInfo.engCalibIn.engSmp[CaloSampling::PreSamplerB];
725  break;
727  myMoments[iMoment] = clusInfo.engCalibIn.engSmp[CaloSampling::PreSamplerE];
728  break;
730  myMoments[iMoment] = clusInfo.engCalibIn.engSmp[CaloSampling::TileGap3];
731  break;
733  myMoments[iMoment] = eng_calib_dead_tot;
734  break;
736  myMoments[iMoment] = eng_calib_dead_emb0;
737  break;
739  myMoments[iMoment] = eng_calib_dead_tile0;
740  break;
742  myMoments[iMoment] = eng_calib_dead_tileg3;
743  break;
745  myMoments[iMoment] = eng_calib_dead_eme0;
746  break;
748  myMoments[iMoment] = eng_calib_dead_hec0;
749  break;
751  myMoments[iMoment] = eng_calib_dead_fcal;
752  break;
754  myMoments[iMoment] = eng_calib_dead_leakage;
755  break;
757  myMoments[iMoment] = eng_calib_dead_unclass;
758  break;
760  myMoments[iMoment] = engCalibFrac[kCalibFracEM];
761  break;
763  myMoments[iMoment] = engCalibFrac[kCalibFracHAD];
764  break;
766  myMoments[iMoment] = engCalibFrac[kCalibFracREST];
767  break;
768  default:
769  // nothing to be done for other moments
770  break;
771  }
772 
773  theCluster->insertMoment(vMomentsIter->second, myMoments[iMoment]);
774  }
775  }
776  }
777 
778  return StatusCode::SUCCESS;
779 }
780 
781 
782 
783 /* ****************************************************************************
784 
785 **************************************************************************** */
787 {
788  double eta = fabs(x);
789  double ff;
790  if(eta<1.6){
791  ff = atan(5.0*1.7/(200.0*cosh(eta)));
792  }else if(eta<3.2){
793  ff = atan(5.0*1.6/(420./tanh(eta)));
794  }else{
795  ff = atan(5.0*0.95/(505./tanh(eta)));
796  }
797  return ff*(1./atan(5.0*1.7/200.0));
798 }
799 
800 
801 
802 /* ****************************************************************************
803 Calculation of energy fraction caused by particles of different types
804 **************************************************************************** */
805 void CaloCalibClusterMomentsMaker2::get_calib_frac(const std::map<unsigned int,int>& truthBarcodeToPdgCodeMap,
806  const MyClusInfo& clusInfo, std::vector<double> &engFrac) const
807 {
808  engFrac.assign(kCalibFracMax, 0.0);
809  if(clusInfo.engCalibIn.engTot <= 0.0) return;
810  // each MyClusInfo has a map of particle's barcode and particle calibration deposits in given cluster
811  for (const std::pair<const int, MyClusInfo::ClusCalibEnergy>& p : clusInfo.engCalibParticle) {
812  unsigned int barcode = p.first; // FIXME barcode-based
813  int pdg_id = 0;
814  try { pdg_id = truthBarcodeToPdgCodeMap.at(barcode); } // FIXME barcode-based
815  catch (const std::out_of_range& e){
816  ATH_MSG_WARNING("truthBarcodeToPdgCodeMap cannot find an entry with barcode " << barcode);
817  continue;
818  }
819 
820  if( abs(pdg_id) == 211) {
821  engFrac[kCalibFracHAD] += p.second.engTot;
822  }else if( pdg_id == 111 || pdg_id == 22 || abs(pdg_id)==11) {
823  engFrac[kCalibFracEM] += p.second.engTot;
824  }else{
825  engFrac[kCalibFracREST] += p.second.engTot;
826  }
827  }
828  for(unsigned int i=0; i<engFrac.size(); i++) engFrac[i] = engFrac[i]/clusInfo.engCalibIn.engTot;
829 }
830 
grepfile.info
info
Definition: grepfile.py:38
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CaloDmRegion::m_CaloSampleEtaMin
std::vector< float > m_CaloSampleEtaMin
Definition: CaloDmDescrManager.h:107
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
CaloCalibClusterMomentsMaker2::m_truthParticleContainerKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
ReadHandleKey for truth particle container.
Definition: CaloCalibClusterMomentsMaker2.h:199
CaloDmDescrArea::DMA_EMB3_TILE0
@ DMA_EMB3_TILE0
Definition: CaloDmDescrArea.h:28
beamspotman.r
def r
Definition: beamspotman.py:676
CaloCalibClusterMomentsMaker2::m_apars_r0
float m_apars_r0
Definition: CaloCalibClusterMomentsMaker2.h:236
CaloCalibrationHitContainer
Definition: CaloCalibrationHitContainer.h:25
CaloCalibClusterMomentsMaker2::m_caloDM_ID
const CaloDM_ID * m_caloDM_ID
Definition: CaloCalibClusterMomentsMaker2.h:206
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_UNCLASS
@ ENG_CALIB_DEAD_UNCLASS
Attached Calibration Hit energy in dead material in unclassified areas of the detector.
Definition: CaloCluster_v1.h:246
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
xAOD::CaloCluster_v1::cell_begin
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
Definition: CaloCluster_v1.h:812
CaloCalibrationHit.h
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
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCalibClusterMomentsMaker2::m_i_phi_eta
std::array< std::vector< std::vector< CalibHitIPhiIEtaRange > >, 3 > m_i_phi_eta
Definition: CaloCalibClusterMomentsMaker2.h:217
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
CaloDmDescrManager::get_element
CaloDmDescrElement * get_element(const Identifier &cellId) const
Definition: CaloDmDescrManager.cxx:133
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.App.bins
bins
Definition: App.py:410
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
TruthParticleContainer.h
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CaloDmDescrArea::DMA_EMB1
@ DMA_EMB1
Definition: CaloDmDescrArea.h:26
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_LEAKAGE
@ ENG_CALIB_DEAD_LEAKAGE
Attached Calibration Hit energy in dead material behind calorimeters.
Definition: CaloCluster_v1.h:243
CaloCalibClusterMomentsMaker2::m_rmaxOut
double m_rmaxOut[3]
Definition: CaloCalibClusterMomentsMaker2.h:215
CaloCalibClusterMomentsMaker2.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
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
CaloDmDescrArea::DMA_SCN
@ DMA_SCN
Definition: CaloDmDescrArea.h:29
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
CaloCalibClusterMomentsMaker2::m_calo_id
const CaloCell_ID * m_calo_id
Definition: CaloCalibClusterMomentsMaker2.h:204
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::CaloCluster_v1::ENG_CALIB_TILEG3
@ ENG_CALIB_TILEG3
Calibration Hit energy inside the cluster scintillator.
Definition: CaloCluster_v1.h:222
CaloCalibClusterMomentsMaker2::m_energyMin
float m_energyMin
Definition: CaloCalibClusterMomentsMaker2.h:233
python.atlas_oh.im
im
Definition: atlas_oh.py:167
xAOD::CaloCluster_v1::insertMoment
void insertMoment(MomentType type, double value)
Definition: CaloCluster_v1.cxx:754
CaloCell.h
xAOD::CaloCluster_v1::ENG_CALIB_OUT_M
@ ENG_CALIB_OUT_M
Attached Calibration Hit energy outside clusters but inside the calorimeter with medium matching (Ang...
Definition: CaloCluster_v1.h:200
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
xAOD::CaloCluster_v1::ENG_CALIB_EMB0
@ ENG_CALIB_EMB0
Calibration Hit energy inside the cluster barrel presampler.
Definition: CaloCluster_v1.h:218
CaloCell_Base_ID::calo_sample
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
Definition: CaloCell_Base_ID.cxx:141
CaloDmDescrArea::DMA_EME12
@ DMA_EME12
Definition: CaloDmDescrArea.h:33
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
CaloCalibClusterMomentsMaker2::m_doOutOfClusterL
bool m_doOutOfClusterL
Definition: CaloCalibClusterMomentsMaker2.h:225
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_TILE0
@ ENG_CALIB_DEAD_TILE0
Attached Calibration Hit energy in dead material between EMB3 and TILE0.
Definition: CaloCluster_v1.h:230
SG::ReadHandleKey< CaloCalibrationHitContainer >
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
x
#define x
CaloCalibClusterMomentsMaker2::CalibHitIPhiIEtaRange::iPhi
char iPhi
Definition: CaloCalibClusterMomentsMaker2.h:52
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
CaloCalibrationHitContainer.h
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
CaloCalibClusterMomentsMaker2::m_apars_alpha
float m_apars_alpha
Definition: CaloCalibClusterMomentsMaker2.h:235
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
CaloDmDescrManager::get_dm_region
CaloDmRegion * get_dm_region(const Identifier &cellId) const
Definition: CaloDmDescrManager.cxx:185
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
CaloDmDescrManager::instance
static const CaloDmDescrManager * instance()
Definition: CaloDmDescrManager.cxx:66
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
CaloCalibClusterMomentsMaker2::m_energyMinCalib
float m_energyMinCalib
Definition: CaloCalibClusterMomentsMaker2.h:234
CaloDmDescrArea::DMA_LEAK
@ DMA_LEAK
Definition: CaloDmDescrArea.h:44
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
CaloDmDescrArea::DMA_EMB0
@ DMA_EMB0
Definition: CaloDmDescrArea.h:25
CaloCalibClusterMomentsMaker2::CellInfoSet_t
std::map< Identifier, MyCellInfo > CellInfoSet_t
Definition: CaloCalibClusterMomentsMaker2.h:73
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
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
CaloCalibClusterMomentsMaker2::m_n_phi_out
int m_n_phi_out
Definition: CaloCalibClusterMomentsMaker2.h:210
CaloCalibClusterMomentsMaker2::m_DMCalibrationHitContainerNames
SG::ReadHandleKeyArray< CaloCalibrationHitContainer > m_DMCalibrationHitContainerNames
vector of dead material calibration hit container names to use.
Definition: CaloCalibClusterMomentsMaker2.h:196
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
CaloDmRegion
Definition: CaloDmDescrManager.h:79
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
CaloCalibClusterMomentsMaker2::MyClusInfo::engCalibDeadInArea
std::vector< double > engCalibDeadInArea
Definition: CaloCalibClusterMomentsMaker2.h:113
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
D3PDSizeSummary.ff
ff
Definition: D3PDSizeSummary.py:305
CaloDmDescrElement::phi
float phi() const
Definition: CaloDmDescrManager.h:59
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
xAOD::CaloCluster_v1::ENG_CALIB_TOT
@ ENG_CALIB_TOT
Calibration Hit energy inside the cluster.
Definition: CaloCluster_v1.h:195
CaloCalibClusterMomentsMaker2::kMatchDmTight
@ kMatchDmTight
Definition: CaloCalibClusterMomentsMaker2.h:221
xAOD::CaloCluster_v1::ENG_CALIB_FRAC_EM
@ ENG_CALIB_FRAC_EM
Calibration Hit energy inside the cluster caused by e/gamma/pi0.
Definition: CaloCluster_v1.h:248
CaloCalibClusterMomentsMaker2::kCalibFracREST
@ kCalibFracREST
Definition: CaloCalibClusterMomentsMaker2.h:222
AtlasDetectorID::is_tile_dm
bool is_tile_dm(Identifier id) const
Definition: AtlasDetectorID.h:748
xAOD::CaloCluster_v1::ENG_CALIB_FRAC_REST
@ ENG_CALIB_FRAC_REST
Calibration Hit energy inside the cluster caused by other particles.
Definition: CaloCluster_v1.h:253
CaloCalibClusterMomentsMaker2::MyClusInfo::ClusCalibEnergy::engTot
double engTot
Definition: CaloCalibClusterMomentsMaker2.h:82
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloCalibClusterMomentsMaker2::m_n_eta_out
int m_n_eta_out
Definition: CaloCalibClusterMomentsMaker2.h:211
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_FCAL
@ ENG_CALIB_DEAD_FCAL
Attached Calibration Hit energy in dead material before FCAL, between FCAL and HEC.
Definition: CaloCluster_v1.h:241
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloDmDescrElement::eta
float eta() const
Definition: CaloDmDescrManager.h:57
CaloDmDescrArea::DMA_FCAL0
@ DMA_FCAL0
Definition: CaloDmDescrArea.h:43
CaloCalibClusterMomentsMaker2::m_doDeadM
bool m_doDeadM
Definition: CaloCalibClusterMomentsMaker2.h:229
CaloDmDescrElement
Definition: CaloDmDescrManager.h:33
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CaloDM_ID.h
CaloDmDescrArea::DMA_HEC_FCAL
@ DMA_HEC_FCAL
Definition: CaloDmDescrArea.h:40
CaloDmRegion::m_CaloSampleEtaMax
std::vector< float > m_CaloSampleEtaMax
Definition: CaloDmDescrManager.h:108
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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
TruthParticle.h
CaloDmDescrArea::DMA_EME3_HEC0
@ DMA_EME3_HEC0
Definition: CaloDmDescrArea.h:37
CaloCalibClusterMomentsMaker2::m_CalibrationHitContainerNames
SG::ReadHandleKeyArray< CaloCalibrationHitContainer > m_CalibrationHitContainerNames
vector of calibration hit container names to use.
Definition: CaloCalibClusterMomentsMaker2.h:189
CaloCalibrationHit
Class to store calorimeter calibration hit.
Definition: CaloCalibrationHit.h:21
xAOD::CaloCluster_v1::ENG_CALIB_EME0
@ ENG_CALIB_EME0
Calibration Hit energy inside the cluster endcap presampler.
Definition: CaloCluster_v1.h:220
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloDmDescrArea::DMA_EME0
@ DMA_EME0
Definition: CaloDmDescrArea.h:31
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_HEC0
@ ENG_CALIB_DEAD_HEC0
Attached Calibration Hit energy in dead material between EME3 and HEC0.
Definition: CaloCluster_v1.h:238
CaloCalibClusterMomentsMaker2::MyCellInfo
Class to store cluster number and weight for calorimeter cells.
Definition: CaloCalibClusterMomentsMaker2.h:58
CaloCalibClusterMomentsMaker2::initialize
virtual StatusCode initialize() override
Definition: CaloCalibClusterMomentsMaker2.cxx:148
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCalibClusterMomentsMaker2::m_doOutOfClusterT
bool m_doOutOfClusterT
Definition: CaloCalibClusterMomentsMaker2.h:227
CaloCell::ID
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition: CaloCell.h:279
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
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_TILEG3
@ ENG_CALIB_DEAD_TILEG3
Attached Calibration Hit energy in dead material before scintillator.
Definition: CaloCluster_v1.h:232
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
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
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
AtlasDetectorID::is_lar_dm
bool is_lar_dm(Identifier id) const
LAr/Tile dead material:
Definition: AtlasDetectorID.h:736
CaloCalibClusterMomentsMaker2::kCalibFracMax
@ kCalibFracMax
Definition: CaloCalibClusterMomentsMaker2.h:222
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_TOT
@ ENG_CALIB_DEAD_TOT
Attached Calibration Hit energy in dead material.
Definition: CaloCluster_v1.h:224
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
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
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:534
CaloCalibClusterMomentsMaker2::m_out_phi_max
double m_out_phi_max
Definition: CaloCalibClusterMomentsMaker2.h:212
xAOD::CaloCluster_v1::cell_end
const_cell_iterator cell_end() const
Definition: CaloCluster_v1.h:813
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
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
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
xAOD::CaloCluster_v1::ENG_CALIB_FRAC_HAD
@ ENG_CALIB_FRAC_HAD
Calibration Hit energy inside the cluster caused by charged pi+ and pi-.
Definition: CaloCluster_v1.h:251
xAOD::CaloCluster_v1::ENG_CALIB_OUT_L
@ ENG_CALIB_OUT_L
Attached Calibration Hit energy outside clusters but inside the calorimeter with loose matching (Angl...
Definition: CaloCluster_v1.h:196
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_EME0
@ ENG_CALIB_DEAD_EME0
Attached Calibration Hit energy in dead material before EME0, between EME0 and EME1.
Definition: CaloCluster_v1.h:235
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
xAOD::CaloCluster_v1::ENG_CALIB_OUT_T
@ ENG_CALIB_OUT_T
Attached Calibration Hit energy outside clusters but inside the calorimeter with tight matching (Angl...
Definition: CaloCluster_v1.h:204
ReadHandle.h
Handle class for reading from StoreGate.
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
CaloDmDescrArea::DMA_ALL
@ DMA_ALL
Definition: CaloDmDescrArea.h:24
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
CaloCalibClusterMomentsMaker2::m_validMoments
moment_name_set m_validMoments
set of moments which will be calculated.
Definition: CaloCalibClusterMomentsMaker2.h:166
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
CaloDmRegion::m_CaloSampleNeighbours
std::vector< short > m_CaloSampleNeighbours
Definition: CaloDmDescrManager.h:106
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
xAOD::CaloCluster_v1::ENG_CALIB_DEAD_EMB0
@ ENG_CALIB_DEAD_EMB0
Attached Calibration Hit energy in dead material before EMB0, between EMB0 and EMB1.
Definition: CaloCluster_v1.h:227
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
CaloDmDescrManager::get_dm_area
int get_dm_area(const Identifier &cellId) const
Definition: CaloDmDescrManager.cxx:173
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37