ATLAS Offline Software
CaloClusterMomentsMaker_DigiHSTruth.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 // File and Version Information:
6 //
7 // Description: see CaloClusterMomentsMaker.h
8 //
9 // Environment:
10 // Software developed for the ATLAS Detector at CERN LHC
11 //
12 // Author List:
13 // Sven Menke
14 //
15 //-----------------------------------------------------------------------
16 
18 #include "CaloEvent/CaloClusterContainer.h"
19 #include "CaloEvent/CaloCluster.h"
20 #include "CaloGeoHelpers/proxim.h"
21 #include "CaloEvent/CaloPrefetch.h"
25 
28 
29 #include "CLHEP/Units/SystemOfUnits.h"
30 #include "CxxUtils/prefetch.h"
31 #include <Eigen/Dense>
32 #include <cmath>
33 #include <cstdint>
34 #include <iterator>
35 #include <limits>
36 #include <sstream>
37 
38 
39 using CLHEP::deg;
40 using CLHEP::cm;
41 
42 namespace {
43 
44 
45  //FIXME, somehow make sure these names are in sync with the xAOD variable names
46 struct MomentName
47 {
48  const char* name;
50 };
51 
52 
53 // Must be sorted by name.
54 const MomentName moment_names[] = {
55  { "ENERGY_DigiHSTruth", xAOD::CaloCluster::ENERGY_DigiHSTruth },
56  { "ETA_DigiHSTruth", xAOD::CaloCluster::ETA_DigiHSTruth },
57  { "PHI_DigiHSTruth", xAOD::CaloCluster::PHI_DigiHSTruth },
58  { "AVG_LAR_Q_DigiHSTruth", xAOD::CaloCluster::AVG_LAR_Q_DigiHSTruth },
59  { "AVG_TILE_Q_DigiHSTruth", xAOD::CaloCluster::AVG_TILE_Q_DigiHSTruth },
60  { "BADLARQ_FRAC_DigiHSTruth", xAOD::CaloCluster::BADLARQ_FRAC_DigiHSTruth },
61  { "BAD_CELLS_CORR_E_DigiHSTruth", xAOD::CaloCluster::BAD_CELLS_CORR_E_DigiHSTruth },
62  { "CELL_SIGNIFICANCE_DigiHSTruth", xAOD::CaloCluster::CELL_SIGNIFICANCE_DigiHSTruth },
63  { "CELL_SIG_SAMPLING_DigiHSTruth", xAOD::CaloCluster::CELL_SIG_SAMPLING_DigiHSTruth },
64  { "CENTER_LAMBDA_DigiHSTruth", xAOD::CaloCluster::CENTER_LAMBDA_DigiHSTruth },
65  { "CENTER_MAG_DigiHSTruth", xAOD::CaloCluster::CENTER_MAG_DigiHSTruth },
66  { "CENTER_X_DigiHSTruth", xAOD::CaloCluster::CENTER_X_DigiHSTruth },
67  { "CENTER_Y_DigiHSTruth", xAOD::CaloCluster::CENTER_Y_DigiHSTruth },
68  { "CENTER_Z_DigiHSTruth", xAOD::CaloCluster::CENTER_Z_DigiHSTruth },
69  { "DELTA_ALPHA_DigiHSTruth", xAOD::CaloCluster::DELTA_ALPHA_DigiHSTruth },
70  { "DELTA_PHI_DigiHSTruth", xAOD::CaloCluster::DELTA_PHI_DigiHSTruth },
71  { "DELTA_THETA_DigiHSTruth", xAOD::CaloCluster::DELTA_THETA_DigiHSTruth },
72  { "ENG_BAD_CELLS_DigiHSTruth", xAOD::CaloCluster::ENG_BAD_CELLS_DigiHSTruth },
73  { "ENG_BAD_HV_CELLS_DigiHSTruth", xAOD::CaloCluster::ENG_BAD_HV_CELLS_DigiHSTruth },
74  { "ENG_FRAC_CORE_DigiHSTruth", xAOD::CaloCluster::ENG_FRAC_CORE_DigiHSTruth },
75  { "ENG_FRAC_EM_DigiHSTruth", xAOD::CaloCluster::ENG_FRAC_EM_DigiHSTruth },
76  { "ENG_FRAC_MAX_DigiHSTruth", xAOD::CaloCluster::ENG_FRAC_MAX_DigiHSTruth },
77  { "ENG_POS_DigiHSTruth", xAOD::CaloCluster::ENG_POS_DigiHSTruth },
78  { "FIRST_ENG_DENS_DigiHSTruth", xAOD::CaloCluster::FIRST_ENG_DENS_DigiHSTruth },
79  { "FIRST_ETA_DigiHSTruth", xAOD::CaloCluster::FIRST_ETA_DigiHSTruth },
80  { "FIRST_PHI_DigiHSTruth", xAOD::CaloCluster::FIRST_PHI_DigiHSTruth },
81  { "ISOLATION_DigiHSTruth", xAOD::CaloCluster::ISOLATION_DigiHSTruth },
82  { "LATERAL_DigiHSTruth", xAOD::CaloCluster::LATERAL_DigiHSTruth },
83  { "LONGITUDINAL_DigiHSTruth", xAOD::CaloCluster::LONGITUDINAL_DigiHSTruth },
84  { "N_BAD_CELLS_DigiHSTruth", xAOD::CaloCluster::N_BAD_CELLS_DigiHSTruth },
85  { "N_BAD_HV_CELLS_DigiHSTruth", xAOD::CaloCluster::N_BAD_HV_CELLS_DigiHSTruth },
86  { "N_BAD_CELLS_CORR_DigiHSTruth", xAOD::CaloCluster::N_BAD_CELLS_CORR_DigiHSTruth },
87  { "SECOND_ENG_DENS_DigiHSTruth", xAOD::CaloCluster::SECOND_ENG_DENS_DigiHSTruth },
88  { "SECOND_LAMBDA_DigiHSTruth", xAOD::CaloCluster::SECOND_LAMBDA_DigiHSTruth },
89  { "SECOND_R_DigiHSTruth", xAOD::CaloCluster::SECOND_R_DigiHSTruth },
90  { "SIGNIFICANCE_DigiHSTruth", xAOD::CaloCluster::SIGNIFICANCE_DigiHSTruth },
91 };
92 
93 const MomentName* const moment_names_end =
94  moment_names + sizeof(moment_names)/sizeof(moment_names[0]);
95 
96 #if 0
97 bool operator< (const std::string& v, const MomentName& m)
98 {
99  return strcmp (v.c_str(), m.name) < 0;
100 }
101 #endif
102 bool operator< (const MomentName& m, const std::string& v)
103 {
104  return strcmp (m.name, v.c_str()) < 0;
105 }
106 
107 
108 }
109 
110 
111 //###############################################################################
112 
114  const std::string& name,
115  const IInterface* parent)
117  m_calo_id(nullptr),
118  m_maxAxisAngle(20*deg),
119  m_minRLateral(4*cm),
120  m_minLLongitudinal(10*cm),
121  m_minBadLArQuality(4000),
122  m_calculateSignificance(false),
123  m_calculateIsolation(false),
124  m_calculateLArHVFraction(false),
125  m_twoGaussianNoise(false),
126  m_caloDepthTool("CaloDepthTool",this),
127  m_larHVFraction("LArHVFraction",this),
128  m_absOpt(false)
129 {
130  // Name(s) of Moments to calculate
131  declareProperty("MomentsNames",m_momentsNames);
132 
133  // Name(s) of Moments which can be stored on the AOD - all others go to ESD
134  // m_momentsNamesAOD.push_back(std::string("FIRST_PHI"));
135  // m_momentsNamesAOD.push_back(std::string("FIRST_ETA"));
136  // m_momentsNamesAOD.push_back(std::string("SECOND_R"));
137  // m_momentsNamesAOD.push_back(std::string("SECOND_LAMBDA"));
138  // m_momentsNamesAOD.push_back(std::string("CENTER_LAMBDA"));
139  // m_momentsNamesAOD.push_back(std::string("FIRST_ENG_DENS"));
140  // m_momentsNamesAOD.push_back(std::string("ENG_BAD_CELLS"));
141  // m_momentsNamesAOD.push_back(std::string("N_BAD_CELLS"));
142 
143  //declareProperty("AODMomentsNames",m_momentsNamesAOD);
144  // maximum allowed angle between shower axis and the vector pointing
145  // to the shower center from the IP in degrees. This property is need
146  // to protect against cases where all significant cells are in one sampling
147  // and the shower axis can not be defined from them
148  declareProperty("MaxAxisAngle",m_maxAxisAngle);
149  declareProperty("MinRLateral",m_minRLateral);
150  declareProperty("MinLLongitudinal",m_minLLongitudinal);
151  declareProperty("MinBadLArQuality",m_minBadLArQuality);
152  // use 2-gaussian noise for Tile
153  declareProperty("TwoGaussianNoise",m_twoGaussianNoise);
154  declareProperty("LArHVFraction",m_larHVFraction,"Tool Handle for LArHVFraction");
155 
157  declareProperty("AODMomentsNames",m_momentsNamesAOD);
158  // Use weighting of neg. clusters option?
159  declareProperty("WeightingOfNegClusters", m_absOpt);
160 }
161 
162 //###############################################################################
163 
165 {
166 
167  //FIXME: All that could be done at initialize!
168  m_calculateSignificance = false;
169  m_calculateIsolation = false;
170 
171  // translate all moment names specified in MomentsNames property to moment enums,
172  // check that they are all valid and there are no repeating names
173  for(const auto& name: m_momentsNames) {
174  const MomentName* it =
175  std::lower_bound (moment_names, moment_names_end, name);
176  //std::find(moment_names, moment_names_end, name);
177  //moment_names.find(name);
178 
179  for(const auto& testName: moment_names){
180  if(name == testName.name) it = &testName;
181  }
182  if (it != moment_names_end) {
183  m_validMoments.push_back (it->mom);
184  switch (it->mom) {
188  break;
190  m_calculateIsolation = true;
191  break;
194  default:
195  break;
196  }
197  }
198  else {
199  msg(MSG::ERROR) << "Moment " << name
200  << " is not a valid Moment name and will be ignored! "
201  << "Valid names are:";
202  int count = 0;
203  for (const MomentName& m : moment_names)
204  msg() << ((count++)==0?" ":", ") << m.name;
205  msg() << endmsg;
206  }
207  }
208 
209  // sort and remove duplicates, order is not required for any of the code below
210  // but still may be useful property
211  std::stable_sort(m_validMoments.begin(), m_validMoments.end());
212 /*
213  m_validMoments.erase(std::unique(m_validMoments.begin(),
214  m_validMoments.end()),
215  m_validMoments.end());
216 */
217 
218 
219  /*
220  // translate moment names in AODMomentsNames property into set of enums,
221  // only take valid names which are also in MomentsNames property
222  m_momentsAOD.reserve(m_momentsNamesAOD.size());
223  for(const auto& name: m_momentsNamesAOD) {
224  const MomentName* it =
225  std::lower_bound (moment_names, moment_names_end, name);
226  if (it != moment_names_end) {
227  if (std::find(m_validMoments.begin(), m_validMoments.end(), it->mom)
228  != m_validMoments.end())
229  {
230  m_momentsAOD.push_back(it->mom);
231  }
232  }
233  }
234  */
235 
236  ATH_CHECK(detStore()->retrieve(m_calo_id,"CaloCell_ID"));
237 
238  ATH_CHECK(m_caloDepthTool.retrieve());
240 
243  }
244 
246  ATH_CHECK(m_larHVFraction.retrieve());
247  }
248  else {
249  m_larHVFraction.disable();
250  }
251 
252  return StatusCode::SUCCESS;
253 
254 }
255 
256 //#############################################################################
257 
259 
260 struct cellinfo {
261  double x;
262  double y;
263  double z;
264  double energy;
265  double eta;
266  double phi;
267  double r;
268  double lambda;
269  double volume;
271 };
272 
273 } // namespace CaloClusterMomentsMaker_DigiHSTruth_detail
274 
277  xAOD::CaloClusterContainer *theClusColl)
278  const
279 {
280 
281  ATH_MSG_DEBUG("Executing " << name());
282 
284 
285  // Maps cell IdentifierHash to cluster index in cluster collection.
286  // Only used when cluster isolation moment is calculated.
287  using clusterIdx_t = std::uint16_t;
288  typedef std::pair<clusterIdx_t, clusterIdx_t> clusterPair_t;
289  std::vector<clusterPair_t> clusterIdx;
290  const clusterIdx_t noCluster = std::numeric_limits<clusterIdx_t>::max();
291 
292  const CaloNoise* noise=nullptr;
295  noise=*noiseHdl;
296  }
297 
299  const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
300 
301  // Counters for number of empty and non-empty neighbor cells per sampling layer
302  // Only used when cluster isolation moment is calculated.
303  int nbEmpty[CaloCell_ID::Unknown];
304  int nbNonEmpty[CaloCell_ID::Unknown];
305 
306  // prepare stuff from entire collection in case isolation moment
307  // should be calculated
308 
309  if ( m_calculateIsolation ) {
310 
311  if (theClusColl->size() >= noCluster) {
312  msg(MSG::ERROR) << "Too many clusters" << endmsg;
313  return StatusCode::FAILURE;
314  }
315 
316  // initialize with "empty" values
317  clusterIdx.resize(m_calo_id->calo_cell_hash_max(),
318  clusterPair_t(noCluster, noCluster));
319 
320  int iCluster = 0;
321  for (xAOD::CaloCluster* theCluster : *theClusColl) {
322  // loop over all cell members and fill cell vector for used cells
323  xAOD::CaloCluster::cell_iterator cellIter = theCluster->cell_begin();
324  xAOD::CaloCluster::cell_iterator cellIterEnd = theCluster->cell_end();
325  for(; cellIter != cellIterEnd; cellIter++ ){
326  CxxUtils::prefetchNext(cellIter, cellIterEnd);
327  const CaloCell* myCell = *cellIter;
328 
329  const CaloDetDescrElement * caloDDE = myCell->caloDDE();
330  IdentifierHash hashid=caloDDE->calo_hash() ;
331  if(! hashid.is_valid() ) continue;
332  if(hashid >= (signalCells)->size()) continue;
333  myCell = (*signalCells).findCell(hashid);
334  if(!myCell) continue;
335 
336 
337  Identifier myId = myCell->ID();
338  IdentifierHash myHashId = m_calo_id->calo_cell_hash(myId);
339  if ( clusterIdx[(unsigned int)myHashId].first != noCluster) {
340  // check weight and assign to current cluster if weight is > 0.5
341  double weight = cellIter.weight();
342  if ( weight > 0.5 )
343  clusterIdx[(unsigned int)myHashId].first = iCluster;
344  }
345  else {
346  clusterIdx[(unsigned int)myHashId].first = iCluster;
347  }
348  }
349  ++iCluster;
350  }
351  }
352 
353  // Move allocation of temporary arrays outside the cluster loop.
354  // That way, we don't need to delete and reallocate them
355  // each time through the loop.
356 
357  std::vector<CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo> cellinfo;
358  std::vector<double> maxSampE (CaloCell_ID::Unknown);
359  std::vector<double> myMoments(m_validMoments.size(),0);
360  std::vector<double> myNorms(m_validMoments.size(),0);
361  std::vector<IdentifierHash> theNeighbors;
362  // loop over individual clusters
363  xAOD::CaloClusterContainer::iterator clusIter = theClusColl->begin();
364  xAOD::CaloClusterContainer::iterator clusIterEnd = theClusColl->end();
365  int iClus = 0;
366  for( ;clusIter!=clusIterEnd;++clusIter,++iClus) {
367  xAOD::CaloCluster * theCluster = *clusIter;
368 
369  double w(0),xc(0),yc(0),zc(0);
370  double eBad(0),ebad_dac(0),ePos(0),eBadLArQ(0),sumSig2(0),maxAbsSig(0);
371  double eLAr2(0),eLAr2Q(0);
372  double eTile2(0),eTile2Q(0);
373  double eBadLArHV(0);
374  int nbad(0),nbad_dac(0),nBadLArHV(0);
375  unsigned int ncell(0),i,nSigSampl(0);
376  unsigned int theNumOfCells = theCluster->size();
377  double theClusterEnergy = 0;
378  double theClusterAbsEnergy = 0;
379  double theClusterEta = 0;
380  double theClusterPhi = 0;
381 
382  // these two are needed for the LATERAL moment
383  int iCellMax(-1);
384  int iCellScndMax(-1);
385 
386  if (cellinfo.capacity() == 0)
387  cellinfo.reserve (theNumOfCells*2);
388  cellinfo.resize (theNumOfCells);
389 
390  double phi0 = theCluster->phi();;
391  for(i=0;i<(unsigned int)CaloCell_ID::Unknown;i++)
392  maxSampE[i] = 0;
393 
394  if ( !m_momentsNames.empty() ) {
395  std::fill (myMoments.begin(), myMoments.end(), 0);
396  std::fill (myNorms.begin(), myNorms.end(), 0);
397  if ( m_calculateIsolation ) {
398  std::fill_n(nbNonEmpty, CaloCell_ID::Unknown, 0);
399  std::fill_n(nbEmpty, CaloCell_ID::Unknown, 0);
400  }
401 
402  // loop over all cell members and calculate the center of mass
403  xAOD::CaloCluster::cell_iterator cellIter = theCluster->cell_begin();
404  xAOD::CaloCluster::cell_iterator cellIterEnd = theCluster->cell_end();
405  for(; cellIter != cellIterEnd; cellIter++ ){
406  CaloPrefetch::nextDDE(cellIter, cellIterEnd);
407  const CaloCell* pCell = (*cellIter);
408  const CaloDetDescrElement * caloDDE = pCell->caloDDE();
409  IdentifierHash hashid=caloDDE->calo_hash() ;
410  if(! hashid.is_valid() ) continue;
411 
412  if(hashid >= (signalCells)->size()) continue;
413  pCell = (*signalCells).findCell(hashid);
414 
415  Identifier myId = pCell->ID();
416 
417  const CaloDetDescrElement* myCDDE = pCell->caloDDE();
418  double ene = pCell->e();
419  if(m_absOpt) ene = std::abs(ene);
420  double weight = cellIter.weight();//theCluster->getCellWeight(cellIter);
421 
422  double thePhi;
423  double cellPhi = myCDDE->phi();
424  thePhi = proxim (cellPhi, phi0);
425 
426  theClusterEnergy += weight * ene;
427  theClusterAbsEnergy += weight*std::abs(ene);
428  theClusterEta += weight*std::abs(ene)*pCell->eta();
429  theClusterPhi += weight*std::abs(ene)* thePhi;
430  if ( pCell->badcell() ) {
431  eBad += ene*weight;
432  nbad++;
433  if(ene!=0){
434  ebad_dac+=ene*weight;
435  nbad_dac++;
436  }
437  }
438  else {
439  if ( ! (myCDDE->is_tile())
440  && ((pCell->provenance() & 0x2000) == 0x2000)
441  && !((pCell->provenance() & 0x0800) == 0x0800)) {
442  if ( pCell->quality() > m_minBadLArQuality ) {
443  eBadLArQ += ene*weight;
444  }
445  eLAr2 += ene*weight*ene*weight;
446  eLAr2Q += ene*weight*ene*weight*pCell->quality();
447  }
448  if ( myCDDE->is_tile() ) {
449  uint16_t tq = pCell->quality();
450  uint8_t tq1 = (0xFF00&tq)>>8; // quality in channel 1
451  uint8_t tq2 = (0xFF&tq); // quality in channel 2
452  // reject cells with either 0xFF00 or 0xFF
453  if ( ((tq1&0xFF) != 0xFF) && ((tq2&0xFF) != 0xFF) ) {
454  eTile2 += ene*weight*ene*weight;
455  // take the worse of both qualities (one might be 0 in
456  // 1-channel cases)
457  eTile2Q += ene*weight*ene*weight*(tq1>tq2?tq1:tq2);
458  }
459  }
460  }
461  if ( ene > 0 ) {
462  ePos += ene*weight;
463  }
464  if ( m_calculateSignificance ) {
465  const float sigma = m_twoGaussianNoise ? \
466  noise->getEffectiveSigma(pCell->ID(),pCell->gain(),pCell->energy()) : \
467  noise->getNoise(pCell->ID(),pCell->gain());
468  sumSig2 += sigma*sigma;
469  // use geomtery weighted energy of cell for leading cell significance
470  double Sig = (sigma>0?ene*weight/sigma:0);
471  if ( std::abs(Sig) > std::abs(maxAbsSig) ) {
472  maxAbsSig = Sig;
473  nSigSampl = myCDDE->getSampling();
474  }
475  }
476  if ( m_calculateIsolation ) {
477  // get all 2D Neighbours if the cell is not inside another cluster with
478  // larger weight
479 
480  IdentifierHash myHashId = m_calo_id->calo_cell_hash(myId);
481  if ( clusterIdx[myHashId].first == iClus ) {
482  theNeighbors.clear();
483  m_calo_id->get_neighbours(myHashId, LArNeighbours::all2D, theNeighbors);
484  for (const auto& nhash: theNeighbors) {
485  clusterPair_t& idx = clusterIdx[nhash];
486 
487  // only need to look at each cell once per cluster
488  if ( idx.second == iClus ) continue;
489  idx.second = iClus;
490 
491  if ( idx.first == noCluster ) {
492  ++ nbEmpty[m_calo_id->calo_sample(nhash)];
493  } else if ( idx.first != iClus ) {
494  ++ nbNonEmpty[m_calo_id->calo_sample(nhash)];
495  }
496 
497  }
498  }
499  }
500 
501  if ( myCDDE && ene > 0. && weight > 0) {
502  // get all geometric information needed ...
504  ci.x = myCDDE->x();
505  ci.y = myCDDE->y();
506  ci.z = myCDDE->z();
507  ci.eta = myCDDE->eta();
508  ci.phi = myCDDE->phi();
509  ci.energy = ene*weight;
510  ci.volume = myCDDE->volume();
511  ci.sample = myCDDE->getSampling();
512  if ( ci.energy > maxSampE[(unsigned int)ci.sample] )
513  maxSampE[(unsigned int)ci.sample] = ci.energy;
514 
515  if (iCellMax < 0 || ci.energy > cellinfo[iCellMax].energy ) {
516  iCellScndMax = iCellMax;
517  iCellMax = ncell;
518  }
519  else if (iCellScndMax < 0 ||
520  ci.energy > cellinfo[iCellScndMax].energy )
521  {
522  iCellScndMax = ncell;
523  }
524 
525  xc += ci.energy*ci.x;
526  yc += ci.energy*ci.y;
527  zc += ci.energy*ci.z;
528  w += ci.energy;
529 
530  ncell++;
531  }
532  } //end of loop over all cells
533 
534  if ( w > 0 ) {
535  xc/=w;
536  yc/=w;
537  zc/=w;
538  Amg::Vector3D showerCenter(xc,yc,zc);
539  w=0;
540 
541 
542  //log << MSG::WARNING << "Found bad cells " << xbad_dac << " " << ybad_dac << " " << zbad_dac << " " << ebad_dac << endmsg;
543  //log << MSG::WARNING << "Found Cluster " << xbad_dac << " " << ybad_dac << " " << zbad_dac << " " << endmsg;
544  // shower axis is just the vector pointing from the IP to the shower center
545  // in case there are less than 3 cells in the cluster
546 
547  Amg::Vector3D showerAxis(xc,yc,zc);
548  Amg::setMag(showerAxis,1.0);
549 
550  // otherwise the principal direction with the largest absolute
551  // eigenvalue will be used unless it's angle w.r.t. the vector pointing
552  // from the IP to the shower center is larger than allowed by the
553  // property m_maxAxisAngle
554 
555  double angle(0),deltaPhi(0),deltaTheta(0);
556  if ( ncell > 2 ) {
557  Eigen::Matrix3d C=Eigen::Matrix3d::Zero();
558  for(i=0;i<ncell;i++) {
560  const double e2 = ci.energy * ci.energy;
561 
562  C(0,0) += e2*(ci.x-xc)*(ci.x-xc);
563  C(1,0) += e2*(ci.x-xc)*(ci.y-yc);
564  C(2,0) += e2*(ci.x-xc)*(ci.z-zc);
565 
566  C(1,1) += e2*(ci.y-yc)*(ci.y-yc);
567  C(2,1) += e2*(ci.y-yc)*(ci.z-zc);
568 
569  C(2,2) += e2*(ci.z-zc)*(ci.z-zc);
570  w += e2;
571  }
572 
573  C/=w;
574 
575 
576  Eigen::SelfAdjointEigenSolver<Eigen::Matrix3d> eigensolver(C);
577  if (eigensolver.info() != Eigen::Success) {
578  msg(MSG::WARNING) << "Failed to compute Eigenvalues -> Can't determine shower axis" << endmsg;
579  }
580  else {
581  // don't use the principal axes if at least one of the 3
582  // diagonal elements is 0
583 
584 
585  const Eigen::Vector3d& S=eigensolver.eigenvalues();
586  const Eigen::Matrix3d& U=eigensolver.eigenvectors();
587 
588  const double epsilon = 1.E-6;
589 
590  if ( std::abs(S[0]) >= epsilon && std::abs(S[1]) >= epsilon && std::abs(S[2]) >= epsilon ) {
591 
592  Amg::Vector3D prAxis(showerAxis);
593 
594  int iEigen = -1;
595 
596  for (i=0;i<3;i++) {
597  Amg::Vector3D tmpAxis=U.col(i);
598 
599  // calculate the angle
600  double tmpAngle=Amg::angle(tmpAxis,showerAxis);
601 
602  if ( tmpAngle > 90*deg ) {
603  tmpAngle = 180*deg - tmpAngle;
604  tmpAxis = -tmpAxis;
605  }
606 
607  if ( iEigen == -1 || tmpAngle < angle ) {
608  iEigen = i;
609  angle = tmpAngle;
610  prAxis = tmpAxis;
611  }
612 
613  }//end for loop
614 
615  // calculate theta and phi angle differences
616 
617  deltaPhi = CaloPhiRange::diff(showerAxis.phi(),prAxis.phi());
618 
619  deltaTheta = showerAxis.theta() - prAxis.theta();
620 
621  // check the angle
622 
623  if ( angle < m_maxAxisAngle ) {
624  showerAxis = prAxis;
625  }
626  else
627  ATH_MSG_DEBUG("principal Direction (" << prAxis[Amg::x] << ", "
628  << prAxis[Amg::y] << ", " << prAxis[Amg::z] << ") deviates more than "
629  << m_maxAxisAngle*(1./deg)
630  << " deg from IP-to-ClusterCenter-axis (" << showerAxis[Amg::x] << ", "
631  << showerAxis[Amg::y] << ", " << showerAxis[Amg::z] << ")");
632  }//end if !S[i]==0
633  }// end else got Eigenvalues
634  } //end if ncell>2
635 
636  ATH_MSG_DEBUG("Shower Axis = (" << showerAxis.x() << ", "
637  << showerAxis.y() << ", " << showerAxis.z() << ")");
638 
639  // calculate radial distance from and the longitudinal distance
640  // along the shower axis for each cell. The cluster center is
641  // at r=0 and lambda=0
642 
643  for (auto& ci : cellinfo) {
644  const Amg::Vector3D currentCell(ci.x,ci.y,ci.z);
645  // calculate distance from shower axis r
646  ci.r = ((currentCell-showerCenter).cross(showerAxis)).mag();
647  // calculate distance from shower center along shower axis
648  ci.lambda = (currentCell-showerCenter).dot(showerAxis);
649  }
650 
651  // loop over all positive energy cells and calculate all desired moments
652 
653  // define common norm for all simple moments
654  double commonNorm = 0;
655  double phi0 = ncell > 0 ? cellinfo[0].phi : 0;
656  for(i=0;i<ncell;i++) {
658  // loop over all valid moments
659  commonNorm += ci.energy;
660  for(size_t iMoment = 0, size = m_validMoments.size();
661  iMoment != size;
662  ++ iMoment)
663  {
664  // now calculate the actual moments
665  switch (m_validMoments[iMoment]) {
667  myMoments[iMoment] += ci.energy*ci.eta;
668  break;
670  // first cell decides the sign in order to avoid
671  // overlap problem at phi = -pi == +pi
672  // need to be normalized to the range [-pi,+pi] in the end
673  myMoments[iMoment] += ci.energy * proxim (ci.phi, phi0);
674  break;
676  myMoments[iMoment] += ci.energy*ci.r*ci.r;
677  break;
679  myMoments[iMoment] += ci.energy*ci.lambda*ci.lambda;
680  break;
682  if ( (int)i != iCellMax && (int)i != iCellScndMax ) {
683  myMoments[iMoment] += ci.energy*ci.r*ci.r;
684  myNorms[iMoment] += ci.energy*ci.r*ci.r;
685  }
686  else {
687  double rm = ci.r;
688  if ( rm < m_minRLateral )
689  rm = m_minRLateral;
690  myNorms[iMoment] += rm*rm*ci.energy;
691  }
692  break;
694  if ( (int)i != iCellMax && (int)i != iCellScndMax ) {
695  myMoments[iMoment] += ci.energy*ci.lambda*ci.lambda;
696  myNorms[iMoment] += ci.energy*ci.lambda*ci.lambda;
697  }
698  else {
699  double lm = ci.lambda;
700  if ( lm < m_minLLongitudinal )
701  lm = m_minLLongitudinal;
702  myNorms[iMoment] += lm*lm*ci.energy;
703  }
704  break;
706  if ( ci.volume > 0 ) {
707  myMoments[iMoment] += ci.energy*ci.energy/ci.volume;
708  myNorms[iMoment] += ci.energy;
709  }
710  break;
712  if ( ci.volume > 0 ) {
713  myMoments[iMoment] += ci.energy*std::pow(ci.energy/ci.volume,2);
714  myNorms[iMoment] += ci.energy;
715  }
716  break;
718  if ( ci.sample == CaloCell_ID::EMB1
719  || ci.sample == CaloCell_ID::EMB2
720  || ci.sample == CaloCell_ID::EMB3
721  || ci.sample == CaloCell_ID::EME1
722  || ci.sample == CaloCell_ID::EME2
723  || ci.sample == CaloCell_ID::EME3
724  || ci.sample == CaloCell_ID::FCAL0 )
725  myMoments[iMoment] += ci.energy;
726  break;
728  if ( (int)i == iCellMax )
729  myMoments[iMoment] = ci.energy;
730  break;
731  default:
732  // nothing to be done for other moments
733  break;
734  }
735  }
736  } //end of loop over cell
737 
738  const auto hvFrac=m_larHVFraction->getLArHVFrac(theCluster->getCellLinks(),ctx);
739  eBadLArHV= hvFrac.first;
740  nBadLArHV=hvFrac.second;
741 
742 
743  // assign moments which don't need the loop over the cells
744  for (size_t iMoment = 0, size = m_validMoments.size();
745  iMoment != size;
746  ++ iMoment)
747  {
748  // now calculate the actual moments
749  switch (m_validMoments[iMoment]) {
756  myNorms[iMoment] = commonNorm;
757  break;
759  myMoments[iMoment] = deltaPhi;
760  break;
762  myMoments[iMoment] = deltaTheta;
763  break;
765  myMoments[iMoment] = angle;
766  break;
768  myMoments[iMoment] = showerCenter.x();
769  break;
771  myMoments[iMoment] = showerCenter.y();
772  break;
774  myMoments[iMoment] = showerCenter.z();
775  break;
777  myMoments[iMoment] = showerCenter.mag();
778  break;
780  // calculate the longitudinal distance along the shower axis
781  // of the shower center from the calorimeter start
782 
783  // first need calo boundary at given eta phi try LAREM barrel
784  // first, then LAREM endcap OW, then LAREM endcap IW, then
785  // FCal
786  {
787  double r_calo(0),z_calo(0),lambda_c(0);
788  r_calo = m_caloDepthTool->get_entrance_radius(CaloCell_ID::EMB1,
789  showerCenter.eta(),
790  showerCenter.phi(),
791  caloDDMgr);
792  if ( r_calo == 0 ) {
793  z_calo = m_caloDepthTool->get_entrance_z(CaloCell_ID::EME1,
794  showerCenter.eta(),
795  showerCenter.phi(),
796  caloDDMgr);
797  if ( z_calo == 0 )
798  z_calo = m_caloDepthTool->get_entrance_z(CaloCell_ID::EME2,
799  showerCenter.eta(),
800  showerCenter.phi(),
801  caloDDMgr);
802  if ( z_calo == 0 )
803  z_calo = m_caloDepthTool->get_entrance_z(CaloCell_ID::FCAL0,
804  showerCenter.eta(),
805  showerCenter.phi(),
806  caloDDMgr);
807  if ( z_calo == 0 ) // for H6 TB without EMEC outer wheel
808  z_calo = m_caloDepthTool->get_entrance_z(CaloCell_ID::HEC0,
809  showerCenter.eta(),
810  showerCenter.phi(),
811  caloDDMgr);
812  if ( z_calo != 0 && showerAxis.z() != 0 ) {
813  lambda_c = std::abs((z_calo-showerCenter.z())/showerAxis.z());
814  }
815  }
816  else {
817  double r_s2 = showerAxis.x()*showerAxis.x()
818  +showerAxis.y()*showerAxis.y();
819  double r_cs = showerAxis.x()*showerCenter.x()
820  +showerAxis.y()*showerCenter.y();
821  double r_cr = showerCenter.x()*showerCenter.x()
822  +showerCenter.y()*showerCenter.y()-r_calo*r_calo;
823  if ( r_s2 > 0 ) {
824  double det = r_cs*r_cs/(r_s2*r_s2) - r_cr/r_s2;
825  if ( det > 0 ) {
826  det = sqrt(det);
827  double l1(-r_cs/r_s2);
828  double l2(l1);
829  l1 += det;
830  l2 -= det;
831  if ( std::abs(l1) < std::abs(l2) )
832  lambda_c = std::abs(l1);
833  else
834  lambda_c = std::abs(l2);
835  }
836  }
837  }
838  myMoments[iMoment] = lambda_c;
839  }
840  break;
842  for(i=0;i<(int)CaloCell_ID::Unknown;i++)
843  myMoments[iMoment] += maxSampE[i];
844  myNorms[iMoment] = commonNorm;
845  break;
847  {
848  // loop over empty and filled perimeter cells and
849  // get a weighted ratio by means of energy fraction per layer
850  for(unsigned int i=0; i != CaloSampling::Unknown; ++ i) {
852  if (theCluster->hasSampling(s)) {
853  const double eSample = theCluster->eSample(s);
854  if (eSample > 0) {
855  int nAll = nbEmpty[i]+nbNonEmpty[i];
856  if (nAll > 0) {
857  myMoments[iMoment] += (eSample*nbEmpty[i])/nAll;
858  myNorms[iMoment] += eSample;
859  }
860  }//end of eSample>0
861  }//end has sampling
862  }//end loop over samplings
863  }
864  break;
866  myMoments[iMoment] = eBad;
867  break;
869  myMoments[iMoment] = nbad;
870  break;
872  myMoments[iMoment] = nbad_dac;
873  break;
875  myMoments[iMoment] = ebad_dac;
876  break;
878  myMoments[iMoment] = eBadLArQ/(theCluster->e()!=0.?theCluster->e():1.);
879  break;
881  myMoments[iMoment] = ePos;
882  break;
884  myMoments[iMoment] = (sumSig2>0?theCluster->e()/sqrt(sumSig2):0.);
885  break;
887  myMoments[iMoment] = maxAbsSig;
888  break;
890  myMoments[iMoment] = nSigSampl;
891  break;
893  myMoments[iMoment] = eLAr2Q/(eLAr2>0?eLAr2:1);
894  break;
896  myMoments[iMoment] = eTile2Q/(eTile2>0?eTile2:1);
897  break;
899  myMoments[iMoment] = eBadLArHV;
900  break;
902  myMoments[iMoment] = nBadLArHV;
903  break;
905  myMoments[iMoment] = theClusterEnergy;
906  break;
908  if(theClusterAbsEnergy > 0)
909  myMoments[iMoment] = theClusterEta / theClusterAbsEnergy;
910  else{
911  myMoments[iMoment] = 0;
912  }
913  break;
915  if(theClusterAbsEnergy > 0)
916  myMoments[iMoment] = CaloPhiRange::fix(theClusterPhi / theClusterAbsEnergy);
917  else{
918  myMoments[iMoment] = 0;
919  }
920  break;
921  default:
922  // nothing to be done for other moments
923  break;
924  }
925  }
926  }
927 
928  // normalize moments and copy to Cluster Moment Store
929  size_t size= m_validMoments.size();
930  for (size_t iMoment = 0; iMoment != size; ++iMoment) {
932  if ( myNorms[iMoment] != 0 )
933  myMoments[iMoment] /= myNorms[iMoment];
935  myMoments[iMoment] = CaloPhiRange::fix(myMoments[iMoment]);
936 
937  theCluster->insertMoment(moment,myMoments[iMoment]);
938  }
939  }
940  }
941 
942  return StatusCode::SUCCESS;
943 }
944 
946 {
947  return StatusCode::SUCCESS;
948 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CaloClusterMomentsMaker_DigiHSTruth::m_noiseCDOKey
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Key of the CaloNoise Conditions data object.
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:133
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
xAOD::CaloCluster_v1::CENTER_MAG_DigiHSTruth
@ CENTER_MAG_DigiHSTruth
Definition: CaloCluster_v1.h:274
operator<
bool operator<(const DataVector< T > &a, const DataVector< T > &b)
Vector ordering relation.
xAOD::CaloCluster_v1::DELTA_PHI_DigiHSTruth
@ DELTA_PHI_DigiHSTruth
Definition: CaloCluster_v1.h:268
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
xAOD::CaloCluster_v1::FIRST_ETA_DigiHSTruth
@ FIRST_ETA_DigiHSTruth
First Moment in .
Definition: CaloCluster_v1.h:265
CaloPrefetch.h
xAOD::CaloCluster_v1::cell_begin
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
Definition: CaloCluster_v1.h:812
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
xAOD::CaloCluster_v1::LONGITUDINAL_DigiHSTruth
@ LONGITUDINAL_DigiHSTruth
Normalized longitudinal moment.
Definition: CaloCluster_v1.h:277
CaloCell_Base_ID::calo_cell_hash
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
max
#define max(a, b)
Definition: cfImp.cxx:41
xAOD::CaloCluster_v1::SECOND_LAMBDA_DigiHSTruth
@ SECOND_LAMBDA_DigiHSTruth
Second Moment in .
Definition: CaloCluster_v1.h:267
Amg::setMag
void setMag(Amg::Vector3D &v, double mag)
scales the vector length without changing the angles
Definition: GeoPrimitivesHelpers.h:104
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
xAOD::CaloCluster_v1::CaloSample
CaloSampling::CaloSample CaloSample
Definition: CaloCluster_v1.h:66
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
CaloDetDescrElement::y
float y() const
cell y
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:365
Amg::angle
double angle(const Amg::Vector3D &v1, const Amg::Vector3D &v2)
calculates the opening angle between two vectors
Definition: GeoPrimitivesHelpers.h:41
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
CaloClusterMomentsMaker_DigiHSTruth::m_momentsNames
std::vector< std::string > m_momentsNames
vector holding the input list of names of moments to calculate.
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:65
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
xAOD::CaloCluster_v1::ISOLATION_DigiHSTruth
@ ISOLATION_DigiHSTruth
Definition: CaloCluster_v1.h:283
DMTest::C
C_v1 C
Definition: C.h:26
proxim
double proxim(double b, double a)
Definition: proxim.h:17
Amg::y
@ y
Definition: GeoPrimitives.h:35
skel.it
it
Definition: skel.GENtoEVGEN.py:423
xAOD::CaloCluster_v1::BADLARQ_FRAC_DigiHSTruth
@ BADLARQ_FRAC_DigiHSTruth
Definition: CaloCluster_v1.h:288
CaloClusterMomentsMaker_DigiHSTruth::m_twoGaussianNoise
bool m_twoGaussianNoise
if set to true use 2-gaussian noise description for TileCal
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:119
deg
#define deg
Definition: SbPolyhedron.cxx:17
xAOD::CaloCluster_v1::insertMoment
void insertMoment(MomentType type, double value)
Definition: CaloCluster_v1.cxx:754
CaloCell::e
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition: CaloCell.h:317
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:260
CaloClusterMomentsMaker_DigiHSTruth::m_calculateIsolation
bool m_calculateIsolation
Set to true if cluster isolation is to be calculated.
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:111
xAOD::CaloCluster_v1::CENTER_Y_DigiHSTruth
@ CENTER_Y_DigiHSTruth
Cluster Centroid ( )
Definition: CaloCluster_v1.h:272
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
CaloCell::provenance
uint16_t provenance() const
get provenance (data member)
Definition: CaloCell.h:338
xAOD::CaloCluster_v1::LATERAL_DigiHSTruth
@ LATERAL_DigiHSTruth
Normalized lateral moment.
Definition: CaloCluster_v1.h:276
CaloClusterMomentsMaker_DigiHSTruth::m_maxAxisAngle
double m_maxAxisAngle
the maximal allowed deviation from the IP-to-ClusterCenter-axis.
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:79
xAOD::CaloCluster_v1::CENTER_Z_DigiHSTruth
@ CENTER_Z_DigiHSTruth
Cluster Centroid ( )
Definition: CaloCluster_v1.h:273
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
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
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
xAOD::CaloCluster_v1::MomentType
MomentType
Enums to identify different moments.
Definition: CaloCluster_v1.h:120
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
GeoPrimitives.h
ArenaPoolSTLAllocator.h
STL-style allocator wrapper for ArenaPoolAllocator.
proxim.h
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::lambda
double lambda
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:268
CaloClusterMomentsMaker_DigiHSTruth::execute
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *theClusColl) const override final
Execute on an entire collection of clusters.
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:276
Amg::z
@ z
Definition: GeoPrimitives.h:36
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
skel.l2
l2
Definition: skel.GENtoEVGEN.py:426
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
xAOD::CaloCluster_v1::ENG_POS_DigiHSTruth
@ ENG_POS_DigiHSTruth
Total positive Energy of this cluster.
Definition: CaloCluster_v1.h:289
CaloDetDescrElement::calo_hash
IdentifierHash calo_hash() const
cell calo hash
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:412
xAOD::CaloCluster_v1::SIGNIFICANCE_DigiHSTruth
@ SIGNIFICANCE_DigiHSTruth
Cluster significance.
Definition: CaloCluster_v1.h:290
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
xAOD::CaloCluster_v1::SECOND_ENG_DENS_DigiHSTruth
@ SECOND_ENG_DENS_DigiHSTruth
Second Moment in E/V.
Definition: CaloCluster_v1.h:282
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
CaloClusterMomentsMaker_DigiHSTruth::m_validMoments
std::vector< xAOD::CaloCluster::MomentType > m_validMoments
set of moments which will be calculated.
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:73
xAOD::CaloCluster_v1::ETA_DigiHSTruth
@ ETA_DigiHSTruth
Eta moment that I am trying to include.
Definition: CaloCluster_v1.h:257
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloClusterMomentsMaker_DigiHSTruth::initialize
virtual StatusCode initialize() override
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:164
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
xAOD::CaloCluster_v1::CENTER_LAMBDA_DigiHSTruth
@ CENTER_LAMBDA_DigiHSTruth
Shower depth at Cluster Centroid.
Definition: CaloCluster_v1.h:275
xAOD::CaloCluster_v1::CELL_SIG_SAMPLING_DigiHSTruth
@ CELL_SIG_SAMPLING_DigiHSTruth
Definition: CaloCluster_v1.h:292
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
xAOD::CaloCluster_v1::FIRST_ENG_DENS_DigiHSTruth
@ FIRST_ENG_DENS_DigiHSTruth
First Moment in E/V.
Definition: CaloCluster_v1.h:281
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
Amg::x
@ x
Definition: GeoPrimitives.h:34
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
WritePulseShapeToCool.det
det
Definition: WritePulseShapeToCool.py:204
CaloClusterMomentsMaker_DigiHSTruth::m_calculateLArHVFraction
bool m_calculateLArHVFraction
Set to true to calculate E and N of cells affected by LAr HV corrections.
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:114
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloCell::badcell
virtual bool badcell() const
check is cell is dead
Definition: CaloCell.cxx:210
xAOD::CaloCluster_v1::size
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
Definition: CaloCluster_v1.cxx:996
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
CaloPhiRange.h
CaloPhiRange class declaration.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloClusterMomentsMaker_DigiHSTruth::m_calo_id
const CaloCell_ID * m_calo_id
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:75
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CaloPhiRange::fix
static double fix(double phi)
Definition: CaloPhiRange.cxx:14
dot.dot
def dot(G, fn, nodesToHighlight=[])
Definition: dot.py:5
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Definition: CaloCluster_v1.cxx:905
CaloCell::quality
uint16_t quality() const
get quality (data member)
Definition: CaloCell.h:332
IdentifierHash::is_valid
bool is_valid() const
Check if id is in a valid state.
xAOD::CaloCluster_v1::ENG_BAD_HV_CELLS_DigiHSTruth
@ ENG_BAD_HV_CELLS_DigiHSTruth
Definition: CaloCluster_v1.h:295
CxxUtils::prefetchNext
void prefetchNext(Iter iter, Iter endIter)
Prefetch next object in sequence.
Definition: prefetch.h:130
CaloDetDescrElement::is_tile
bool is_tile() const
cell belongs to Tile
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:442
CaloClusterMomentsMaker_DigiHSTruth::m_signalCellKey
SG::ReadHandleKey< CaloCellContainer > m_signalCellKey
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:129
CaloNoise
Definition: CaloNoise.h:16
ReadCellNoiseFromCool.ncell
ncell
Definition: ReadCellNoiseFromCool.py:197
xAOD::CaloCluster_v1::N_BAD_CELLS_CORR_DigiHSTruth
@ N_BAD_CELLS_CORR_DigiHSTruth
Definition: CaloCluster_v1.h:286
CaloDetDescrElement::volume
float volume() const
cell volume
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:381
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
xAOD::CaloCluster_v1::N_BAD_CELLS_DigiHSTruth
@ N_BAD_CELLS_DigiHSTruth
number of bad cells
Definition: CaloCluster_v1.h:285
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
CaloClusterMomentsMaker_DigiHSTruth_detail
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:258
xAOD::CaloCluster_v1::N_BAD_HV_CELLS_DigiHSTruth
@ N_BAD_HV_CELLS_DigiHSTruth
number of cells with bad HV
Definition: CaloCluster_v1.h:296
CaloCell::gain
CaloGain::CaloGain gain() const
get gain (data member )
Definition: CaloCell.h:345
CaloCell_Base_ID::get_neighbours
int get_neighbours(const IdentifierHash caloHash, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found
Definition: CaloCell_Base_ID.cxx:190
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
xAOD::CaloCluster_v1::FIRST_PHI_DigiHSTruth
@ FIRST_PHI_DigiHSTruth
First Moment in .
Definition: CaloCluster_v1.h:264
xAOD::CaloCluster_v1::AVG_LAR_Q_DigiHSTruth
@ AVG_LAR_Q_DigiHSTruth
Definition: CaloCluster_v1.h:293
xAOD::CaloCluster_v1::PHI_DigiHSTruth
@ PHI_DigiHSTruth
phi moment I would like to have
Definition: CaloCluster_v1.h:258
CaloCell::ID
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition: CaloCell.h:279
xAOD::CaloCluster_v1::ENERGY_DigiHSTruth
@ ENERGY_DigiHSTruth
First Moment in .
Definition: CaloCluster_v1.h:256
CaloClusterMomentsMaker_DigiHSTruth::m_minRLateral
double m_minRLateral
the minimal in the definition of the Lateral moment
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:87
xAOD::CaloCluster_v1::ENG_BAD_CELLS_DigiHSTruth
@ ENG_BAD_CELLS_DigiHSTruth
Definition: CaloCluster_v1.h:284
CaloClusterMomentsMaker_DigiHSTruth.h
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::z
double z
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:263
CaloClusterMomentsMaker_DigiHSTruth::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:123
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::y
double y
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:262
CaloClusterMomentsMaker_DigiHSTruth::m_absOpt
bool m_absOpt
if set to true use abs E value of cells to calculate
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:141
CaloDetDescrElement::x
float x() const
cell x
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:363
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
xAOD::CaloCluster_v1::SECOND_R_DigiHSTruth
@ SECOND_R_DigiHSTruth
Second Moment in .
Definition: CaloCluster_v1.h:266
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::x
double x
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:261
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
python.PyAthena.v
v
Definition: PyAthena.py:157
xAOD::CaloCluster_v1::ENG_FRAC_EM_DigiHSTruth
@ ENG_FRAC_EM_DigiHSTruth
Energy fraction in EM calorimeters.
Definition: CaloCluster_v1.h:278
CaloClusterMomentsMaker_DigiHSTruth::m_momentsNamesAOD
std::string m_momentsNamesAOD
Not used anymore (with xAOD), but required when configured from COOL.
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:137
xAOD::CaloCluster_v1::eSample
float eSample(const CaloSample sampling) const
Definition: CaloCluster_v1.cxx:521
CaloClusterMomentsMaker_DigiHSTruth::m_caloDepthTool
ToolHandle< CaloDepthTool > m_caloDepthTool
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:121
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
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::eta
double eta
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:265
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
egammaEnergyPositionAllSamples::e2
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::r
double r
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:267
lumiFormat.fill
fill
Definition: lumiFormat.py:111
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::volume
double volume
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:269
CaloDetDescrElement::z
float z() const
cell z
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:367
GeoPrimitivesHelpers.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::CaloCluster_v1::DELTA_ALPHA_DigiHSTruth
@ DELTA_ALPHA_DigiHSTruth
Definition: CaloCluster_v1.h:270
DeMoScan.first
bool first
Definition: DeMoScan.py:534
CaloClusterMomentsMaker_DigiHSTruth::CaloClusterMomentsMaker_DigiHSTruth
CaloClusterMomentsMaker_DigiHSTruth(const std::string &type, const std::string &name, const IInterface *parent)
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:113
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
xAOD::CaloCluster_v1::DELTA_THETA_DigiHSTruth
@ DELTA_THETA_DigiHSTruth
Definition: CaloCluster_v1.h:269
CaloClusterMomentsMaker_DigiHSTruth::m_calculateSignificance
bool m_calculateSignificance
Set to true if significance moments are need.
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:108
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
xAOD::CaloCluster_v1::BAD_CELLS_CORR_E_DigiHSTruth
@ BAD_CELLS_CORR_E_DigiHSTruth
Definition: CaloCluster_v1.h:287
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
xAOD::CaloCluster_v1::ENG_FRAC_MAX_DigiHSTruth
@ ENG_FRAC_MAX_DigiHSTruth
Energy fraction of hottest cell.
Definition: CaloCluster_v1.h:279
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
skel.l1
l1
Definition: skel.GENtoEVGEN.py:425
AthAlgTool
Definition: AthAlgTool.h:26
IdentifierHash
Definition: IdentifierHash.h:38
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
xAOD::CaloCluster_v1::hasSampling
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
Definition: CaloCluster_v1.h:890
CaloClusterMomentsMaker_DigiHSTruth::m_minBadLArQuality
double m_minBadLArQuality
the minimal cell quality in the LAr for declaring a cell bad
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:105
xAOD::CaloCluster_v1::AVG_TILE_Q_DigiHSTruth
@ AVG_TILE_Q_DigiHSTruth
Definition: CaloCluster_v1.h:294
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::phi
double phi
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:266
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
CaloClusterMomentsMaker_DigiHSTruth::finalize
virtual StatusCode finalize() override
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:945
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::energy
double energy
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:264
CaloPrefetch::nextDDE
void nextDDE(Iter iter, Iter endIter)
Prefetch next CaloDDE.
Definition: CaloPrefetch.h:47
xAOD::CaloCluster_v1::ENG_FRAC_CORE_DigiHSTruth
@ ENG_FRAC_CORE_DigiHSTruth
Definition: CaloCluster_v1.h:280
CaloClusterMomentsMaker_DigiHSTruth_detail::cellinfo::sample
CaloCell_ID::CaloSample sample
Definition: CaloClusterMomentsMaker_DigiHSTruth.cxx:270
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:25
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
CaloClusterMomentsMaker_DigiHSTruth::m_larHVFraction
ToolHandle< ILArHVFraction > m_larHVFraction
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:134
LArNeighbours::all2D
@ all2D
Definition: LArNeighbours.h:18
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
xAOD::CaloCluster_v1::CENTER_X_DigiHSTruth
@ CENTER_X_DigiHSTruth
Cluster Centroid ( )
Definition: CaloCluster_v1.h:271
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:366
prefetch.h
Functions to prefetch blocks of memory.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
CaloPhiRange::diff
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
Definition: CaloPhiRange.cxx:22
CaloClusterMomentsMaker_DigiHSTruth::m_minLLongitudinal
double m_minLLongitudinal
the minimal in the definition of the Longitudinal moment
Definition: CaloClusterMomentsMaker_DigiHSTruth.h:97
xAOD::CaloCluster_v1::CELL_SIGNIFICANCE_DigiHSTruth
@ CELL_SIGNIFICANCE_DigiHSTruth
Definition: CaloCluster_v1.h:291
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size