ATLAS Offline Software
MuidCaloEnergyMeas.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // MuidCaloEnergyMeas
7 // AlgTool to access the energy deposited by a muon in the
8 // calorimeters. The energy deposit is estimated according to
9 // the active measurements in the traversed calorimeter cells.
10 //
12 
13 //<<<<<< INCLUDES >>>>>>
14 
15 #include "MuidCaloEnergyMeas.h"
16 
17 #include "AthenaKernel/Units.h"
18 #include "CLHEP/Geometry/Vector3D.h"
19 #include "CaloEvent/CaloCell.h"
21 #include "CaloIdentifier/CaloID.h"
24 #include "CaloIdentifier/TileID.h"
25 #include "CaloUtils/CaloCellList.h"
27 #include "MuidEvent/CaloMeas.h"
29 //<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>>
30 
31 namespace Units = Athena::Units;
32 
33 namespace Rec {
34 
35  MuidCaloEnergyMeas::MuidCaloEnergyMeas(const std::string& type, const std::string& name, const IInterface* parent) :
37  m_tileID(nullptr),
38  m_emID(nullptr),
39  m_hecID(nullptr),
40  m_sigmasAboveNoise(4.),
41  m_sigmasAboveNoiseCore(1.5) {
42  declareInterface<IMuidCaloEnergyMeas>(this);
43  declareProperty("NoiseThresInSigmas", m_sigmasAboveNoise);
44  declareProperty("NoiseThresInSigmasCore", m_sigmasAboveNoiseCore);
45 
46  m_measurementConeTile = 0.15;
48  m_measurementConeLArEM = 0.075;
49  m_isolationConeTile = 0.3;
51  m_isolationConeLArEM = 0.15;
52  }
53 
55 
56  //<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS >>>>>>
57 
59  ATH_MSG_INFO("Initializing MuidCaloEnergyMeas AlgTool");
60 
61  // retrieve TileID helper and TileIfno from det store
63  ATH_MSG_VERBOSE("Accessed TileID helper");
64 
65  // retrieve LArEM helper
66  ATH_CHECK(detStore()->retrieve(m_emID, "LArEM_ID"));
67  ATH_MSG_VERBOSE("Accessed LArEM helper");
68 
69  // retrieve LArHEC helper
70  ATH_CHECK(detStore()->retrieve(m_hecID, "LArHEC_ID"));
71  ATH_MSG_VERBOSE("Accessed LArHEC helper");
72 
73  ATH_CHECK(m_caloParamTool.retrieve());
77  return StatusCode::SUCCESS;
78  }
79 
81  ATH_MSG_INFO("Finalizing MuidCaloEnergyMeas Tool");
82  ATH_MSG_INFO(" EM: selected " << m_totalSelectedEM << " from " << m_totalCoreCellsEM << " cells in core");
83  ATH_MSG_INFO(" Tile: selected " << m_totalSelectedTile << " from " << m_totalCoreCellsTile << " cells in core");
84  ATH_MSG_INFO(" HEC: selected " << m_totalSelectedHEC << " from " << m_totalCoreCellsHEC << " cells in core");
85  return StatusCode::SUCCESS;
86  }
87  std::unique_ptr<CaloMeas> MuidCaloEnergyMeas::energyMeasurement(const EventContext& ctx, double etaEM, double phiEM, double etaHad,
88  double phiHad) const {
90  if (!cellContainer.isPresent()) {
91  ATH_MSG_DEBUG("No calo cell container " << m_cellContainerLocation.key() << ", energy measurement is 0");
92  return nullptr;
93  }
94  if (!cellContainer.isValid()) {
95  ATH_MSG_WARNING("Calo cell container " << m_cellContainerLocation.key() << " not valid!");
96  return nullptr;
97  }
98 
100  if (!noiseHdl.isValid()) {
101  ATH_MSG_WARNING("Calo cell container " << m_noiseCDOKey.key() << " not valid!");
102  return nullptr;
103  }
104 
105  const CaloNoise* noiseCDO = *noiseHdl;
107  const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
108 
109  // set measured tile energy, measured sampling fraction and isolation energy into CaloMeas
110  std::unique_ptr<CaloMeas> caloMeas = std::make_unique<CaloMeas>();
111  energyInCalo(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaHad, phiHad, SubCaloId::TILE);
112  isolationEnergy(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaHad, phiHad, SubCaloId::TILE);
113 
114  // similar for LArHEC
115  energyInCalo(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaHad, phiHad, SubCaloId::LARHEC);
116  isolationEnergy(*caloMeas, cellContainer.cptr(), caloDDMgr,noiseCDO, etaHad, phiHad, SubCaloId::LARHEC);
117 
118  // and for the em calo
119  energyInCalo(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaEM, phiEM, SubCaloId::LAREM);
120  isolationEnergy(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaEM, phiEM, SubCaloId::LAREM);
121 
122  ATH_MSG_DEBUG(std::setiosflags(std::ios::fixed)
123  << " Tile energy (GeV) :" << std::setw(8) << std::setprecision(3) << caloMeas->Tile_EnergyMeasured() / Units::GeV
124  << " Material percent:" << std::setw(4) << std::setprecision(0) << 100. * caloMeas->Tile_SamplingFraction()
125  << " ISO :" << std::setw(8) << std::setprecision(3) << caloMeas->Tile_Isolation() / Units::GeV << endmsg
126  << " LArHEC energy (GeV):" << std::setw(8) << std::setprecision(3) << caloMeas->LArHEC_EnergyMeasured() / Units::GeV
127  << " Material percent:" << std::setw(4) << std::setprecision(0) << 100. * caloMeas->LArHEC_SamplingFraction()
128  << " ISO :" << std::setw(8) << std::setprecision(3) << caloMeas->LArHEC_Isolation() / Units::GeV << endmsg
129  << " EM energy :" << std::setw(8) << std::setprecision(3) << caloMeas->LArEM_EnergyMeasured() / Units::GeV
130  << " first compartment:" << std::setw(8) << std::setprecision(3)
131  << caloMeas->LArEM_FirstCompartmentEnergy() / Units::GeV << " Material percent:" << std::setw(4)
132  << std::setprecision(0) << 100. * caloMeas->LArEM_SamplingFraction() << " ISO :" << std::setw(8)
133  << std::setprecision(3) << caloMeas->LArEM_Isolation() / Units::GeV);
134 
135  return caloMeas;
136  }
137 
138  //<<<<<< PRIVATE MEMBER FUNCTION DEFINITIONS >>>>>>
139 
141  const CaloNoise* noiseCDO, double mu_eta, double mu_phi) const {
142  // int isubcalo = 2;
143  constexpr double lowest_threshold = 4 * 50.;
144 
146  CaloCellList myList(detMgr,cellContainer, iCalo); // Construct the list
147  myList.select(mu_eta, mu_phi, 0.2, 0.2);
148 
149  int count = 0;
150  for (const CaloCell* cell : myList) {
151  const double cellEnergy = cell->energy();
152  const double noise_rms = noiseCDO->getNoise(cell->ID(), cell->gain());
153 
154  if (cellEnergy > lowest_threshold && cellEnergy > noise_rms * m_sigmasAboveNoise) { count += 1; }
155  }
156 
157  ATH_MSG_DEBUG(" counted " << count << " cells over threshold out of a total of " << myList.ncells() << " cells");
158 
159  return count;
160  }
161 
162  int MuidCaloEnergyMeas::samplingID(const CaloCell* cell, int isubcalo) const {
163  if (isubcalo == SubCaloId::TILE) {
164  return m_tileID->sample(cell->ID());
165  } else if (isubcalo == SubCaloId::LARHEC) {
166  return m_hecID->sampling(cell->ID());
167  } else if (isubcalo == SubCaloId::LAREM) {
168  return m_emID->sampling(cell->ID());
169  }
170 
171  return -1;
172  }
173 
174  void MuidCaloEnergyMeas::energyInCalo(CaloMeas& caloMeas, const CaloCellContainer* cellContainer, const CaloDetDescrManager* detMgr,
175  const CaloNoise* noiseCDO, double muEta, double muPhi, int isubcalo) const {
176  /* -------------------------------------------
177  Tile Cal
178  sample_number
179  0 --> Sampling 1
180  1 --> Sampling 2
181  2 --> Sampling 3
182  3 --> ITC
183  ===========================================
184  LarHEC calorimeter
185  sample_number
186  0 --> Sampling 1
187  1 --> Sampling 2
188  2 --> Sampling 3
189  3 --> Sampling 4
190  ===========================================
191  LarEM calorimeter
192  sample_number
193  0 --> Presampler
194  1 --> Sampling 1
195  2 --> Sampling 2
196  3 --> Sampling 3
197  leadingEnergy is contribution from presampler and first compartment
198  -------------------------------------------*/
199 
200  double totalEnergy = 0.;
201  double leadingEnergy = 0.;
202  std::unique_ptr<CaloCellList> myList = nullptr;
203 
204  if (isubcalo == SubCaloId::TILE) {
206  myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
207  myList->select(muEta, muPhi, m_measurementConeTile, m_measurementConeTile);
208  } else if (isubcalo == SubCaloId::LARHEC) {
210  myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
212  } else if (isubcalo == SubCaloId::LAREM) {
214  myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
215  myList->select(muEta, muPhi, m_measurementConeLArEM, m_measurementConeLArEM);
216  }
217 
218  int countCoreCells = 0;
219  int countSelected = 0;
220  bool compartment[4] = {false, false, false, false};
221  double measuredSamplings = 0.;
222 
223  if (myList && myList->ncells()) {
224  // get last cell (as CaloCellList->back() method doesn't work)
225  const CaloCell* lastCell = *(myList->end() - 1);
226 
227  // flag core in each sampling
228  for (int coreSampling = 0; coreSampling != 4; ++coreSampling) {
229  const CaloCell* coreCell = nullptr;
230  double coreRadius = 0.;
231  for (const CaloCell* cell : *myList) {
232  int sampling = samplingID(cell, isubcalo);
233 
234  if (cell != lastCell && sampling != coreSampling) continue;
235 
236  const double deltaEta = cell->eta() - muEta;
237  const double deltaPhi = xAOD::P4Helpers::deltaPhi(cell->phi(), muPhi);
238  const double radius = deltaEta * deltaEta + deltaPhi * deltaPhi;
239 
240  if (sampling == coreSampling) {
241  if (!coreCell || radius < coreRadius) {
242  coreCell = cell;
243  coreRadius = radius;
244  }
245  }
246 
247  if (cell != lastCell || !coreCell) continue;
248 
249  for (const CaloCell* cell2 : *myList) {
250  sampling = samplingID(cell2, isubcalo);
251  if (sampling != coreSampling) continue;
252 
253  double cellEnergy = cell2->energy();
254  double noiseRms = noiseCDO->getNoise(cell2->ID(), cell2->gain());
255 
256  // looser selection for core cell where at least mip is expected
257  bool cellSelected = cellEnergy > m_sigmasAboveNoise * noiseRms;
258  if (cell2 == coreCell && cellEnergy > m_sigmasAboveNoiseCore * noiseRms) cellSelected = true;
259 
260  if (cellSelected) {
261  ++countSelected;
262  totalEnergy += cellEnergy;
263  compartment[coreSampling] = true;
264  if (coreSampling < 2) leadingEnergy += cellEnergy;
265  }
266  if (cell2 == coreCell) {
267  ++countCoreCells;
268  if (isubcalo == SubCaloId::TILE) {
270  if (cellSelected) ++m_totalSelectedTile;
271  } else if (isubcalo == SubCaloId::LARHEC) {
273  if (cellSelected) ++m_totalSelectedHEC;
274  } else if (isubcalo == SubCaloId::LAREM) {
276  if (cellSelected) ++m_totalSelectedEM;
277  }
278  }
279  if (msgLvl(MSG::DEBUG)) {
280  std::string info = "";
281  std::string type = " Tile ";
282  if (isubcalo == SubCaloId::LARHEC) {
283  type = " LArHEC";
284  } else if (isubcalo == SubCaloId::LAREM) {
285  type = " EM ";
286  }
287  if (cellSelected && cell2 == coreCell) {
288  info = " selected core cell# ";
289  } else if (cellSelected) {
290  info = " selected cell# ";
291  } else if (cell2 == coreCell) {
292  info = " cell in core NOT selected";
293  }
294 
295  if (info.empty()) {
296  ATH_MSG_VERBOSE(std::setiosflags(std::ios::fixed)
297  << type << " Sampling: " << std::setw(1) << coreSampling << " Radius :" << std::setw(6)
298  << std::setprecision(0) << cell2->caloDDE()->r() << " Eta : " << std::setw(6)
299  << std::setprecision(2) << cell2->eta() << " Phi : " << std::setw(6) << std::setprecision(2)
300  << cell2->phi() << " Noise level : " << std::setw(6) << std::setprecision(0) << noiseRms
301  << " Energy : " << std::setw(7) << std::setprecision(0) << cell2->energy() << info);
302  } else if (cellSelected) {
303  ATH_MSG_DEBUG(std::setiosflags(std::ios::fixed)
304  << type << " Sampling: " << std::setw(1) << coreSampling << " Radius :" << std::setw(6)
305  << std::setprecision(0) << cell2->caloDDE()->r() << " Eta : " << std::setw(6)
306  << std::setprecision(2) << cell2->eta() << " Phi : " << std::setw(6) << std::setprecision(2)
307  << cell2->phi() << " Noise level : " << std::setw(6) << std::setprecision(0) << noiseRms
308  << " Energy : " << std::setw(7) << std::setprecision(0) << cell2->energy() << info
309  << countSelected);
310  } else {
311  ATH_MSG_DEBUG(std::setiosflags(std::ios::fixed)
312  << type << " Sampling: " << std::setw(1) << coreSampling << " Radius :" << std::setw(6)
313  << std::setprecision(0) << cell2->caloDDE()->r() << " Eta : " << std::setw(6)
314  << std::setprecision(2) << cell2->eta() << " Phi : " << std::setw(6) << std::setprecision(2)
315  << cell2->phi() << " Noise level : " << std::setw(6) << std::setprecision(0) << noiseRms
316  << " Energy : " << std::setw(7) << std::setprecision(0) << cell2->energy() << info);
317  }
318  }
319  }
320  }
321  }
322 
323  if (msgLvl(MSG::DEBUG)) {
324  std::string info = "";
325  std::string type = " Tile ";
326  if (isubcalo == SubCaloId::LARHEC) {
327  type = " LArHEC";
328  } else if (isubcalo == SubCaloId::LAREM) {
329  type = " EM ";
330  }
331 
332  ATH_MSG_DEBUG(type << " at eta = " << muEta << " : selected " << countSelected << " from measured cone with "
333  << countCoreCells << " cells forming core");
334  }
335 
336  for (int i = 0; i < 4; ++i)
337  if (compartment[i]) measuredSamplings += m_caloParamTool->caloCompartmentDepth(isubcalo, i);
338 
339  // store result in caloMeas
340  if (isubcalo == SubCaloId::TILE) {
341  caloMeas.Tile_EnergyMeasured(totalEnergy);
342  caloMeas.Tile_SamplingFraction(measuredSamplings);
343  } else if (isubcalo == SubCaloId::LARHEC) {
344  caloMeas.LArHEC_EnergyMeasured(totalEnergy);
345  caloMeas.LArHEC_SamplingFraction(measuredSamplings);
346  } else if (isubcalo == SubCaloId::LAREM) {
347  caloMeas.LArEM_EnergyMeasured(totalEnergy);
348  caloMeas.LArEM_FirstCompartmentEnergy(leadingEnergy);
349  caloMeas.LArEM_SamplingFraction(measuredSamplings);
350  }
351  }
352  }
353 
354  void MuidCaloEnergyMeas::isolationEnergy(CaloMeas& caloMeas, const CaloCellContainer* cellContainer, const CaloDetDescrManager* detMgr,
355  const CaloNoise* noiseCDO, double muEta, double muPhi, int isubcalo) const {
356  double totalEnergy = 0.;
357 
358  // SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey, ctx};
359  // const CaloNoise* noiseCDO = *noiseHdl;
360 
361  std::unique_ptr<CaloCellList> myList;
362 
363  if (isubcalo == SubCaloId::TILE) {
365  myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
366  myList->select(muEta, muPhi, m_isolationConeTile, m_isolationConeTile);
367  } else if (isubcalo == SubCaloId::LARHEC) {
369  myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
370  myList->select(muEta, muPhi, m_isolationConeLArHEC, m_isolationConeLArHEC);
371  } else if (isubcalo == SubCaloId::LAREM) {
373  myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
374  myList->select(muEta, muPhi, m_isolationConeLArEM, m_isolationConeLArEM);
375  }
376 
377  if (myList && myList->ncells()) {
378  // get last cell (as CaloCellList->back() method doesn't work)
379  const CaloCell* lastCell = *(myList->end() - 1);
380 
381  // flag core in each sampling
382  for (int coreSampling = 0; coreSampling != 4; ++coreSampling) {
383  const CaloCell* coreCell = nullptr;
384  double coreRadius = 0.;
385  for (const CaloCell* cell : *myList) {
386  int sampling = samplingID(cell, isubcalo);
387 
388  if (cell != lastCell && sampling != coreSampling) continue;
389 
390  const double deltaEta = cell->eta() - muEta;
391  const double deltaPhi = xAOD::P4Helpers::deltaPhi(cell->phi(), muPhi);
392  const double radius = deltaEta * deltaEta + deltaPhi * deltaPhi;
393 
394  if (sampling == coreSampling) {
395  if (!coreCell || radius < coreRadius) {
396  coreCell = cell;
397  coreRadius = radius;
398  }
399  }
400 
401  if (cell != lastCell || !coreCell) continue;
402 
403  for (const CaloCell* cell2 : *myList) {
404  sampling = samplingID(cell2, isubcalo);
405  if (sampling != coreSampling) continue;
406 
407  double cellEnergy = cell2->energy();
408  double noiseRms = noiseCDO->getNoise(cell2->ID(), cell2->gain());
409  // looser selection for core cell where at least mip is expected
410  bool cellSelected = cellEnergy > m_sigmasAboveNoise * noiseRms;
411  if (cell2 == coreCell && cellEnergy > m_sigmasAboveNoiseCore * noiseRms) cellSelected = true;
412 
413  if (cellSelected) totalEnergy += cellEnergy;
414  }
415  }
416  }
417 
418  // store result in caloMeas
419  if (isubcalo == SubCaloId::TILE) {
420  caloMeas.Tile_Isolation(totalEnergy);
421  } else if (isubcalo == SubCaloId::LARHEC) {
422  caloMeas.LArHEC_Isolation(totalEnergy);
423  } else if (isubcalo == SubCaloId::LAREM) {
424  caloMeas.LArEM_Isolation(totalEnergy);
425  }
426  }
427  }
428 
429  double MuidCaloEnergyMeas::energyInTile(const CaloCellContainer* cellContainer, const CaloDetDescrManager* detMgr,
430  const CaloNoise* noiseCDO, double mu_eta, double mu_phi, int sample, int cone) const {
431  // Tile Cal
432  // sample_number
433  // 0 --> Sampling 1
434  // 1 --> Sampling 2
435  // 2 --> Sampling 3
436  // 3 --> ITC
437 
438  // int i,j,k;
439 
440  double tileTotalEnergy = 0.;
441  double tileTestEnergy = 0.;
442 
444  CaloCellList myList(detMgr,cellContainer, iCalo); // Construct the list
445  if (cone == SubCaloId::TILE) {
446  myList.select(mu_eta, mu_phi, 0.15, 0.15);
447  } else if (cone == SubCaloId::LARHEC) {
448  myList.select(mu_eta, mu_phi, 0.3, 0.3);
449  } else {
450  myList.select(mu_eta, mu_phi, 0., 0.);
451  }
452 
453  int count = 0;
454  double lowest_threshold = 0.;
455  for (const CaloCell* cell : myList) {
456  double cellEnergy = cell->energy();
457  double noise_rms = noiseCDO->getNoise(cell->ID(), cell->gain());
458 
459  if (cellEnergy > lowest_threshold && cellEnergy > noise_rms * m_sigmasAboveNoise && m_tileID->sample(cell->ID()) == sample) {
460  count += 1;
461 
462  ATH_MSG_DEBUG("Energy : " << cell->energy() << " Sampling: " << m_tileID->sample(cell->ID())
463  << " Radius :" << cell->caloDDE()->r() << " Eta : " << cell->eta() << " Phi : " << cell->phi()
464  << " Noise Level : " << noise_rms);
465 
466  tileTotalEnergy += cellEnergy;
467  } else {
468  tileTestEnergy += cellEnergy;
469  }
470  }
471 
472  ATH_MSG_DEBUG(" counted " << count << " test energy " << tileTestEnergy);
473 
474  return tileTotalEnergy;
475  }
476 
477  double MuidCaloEnergyMeas::energyInLArHEC(const CaloCellContainer* cellContainer, const CaloDetDescrManager* detMgr,
478  const CaloNoise* noiseCDO, double mu_eta, double mu_phi, int sample, int cone) const {
479  // Look in the LarHEC calorimeter
480  // i.e. loop over its cells
481  /* sample_number
482  0 --> Sampling 1
483  1 --> Sampling 2
484  2 --> Sampling 3
485  3 --> Sampling 4
486  */
487 
488  // int i,j,k;
489 
490  // SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey};
491  // const CaloNoise* noiseCDO = *noiseHdl;
492  double larhecTotal = 0.;
493 
495  CaloCellList myList(detMgr, cellContainer, iCalo); // Construct the list
496  if (cone == SubCaloId::LARHEC) {
497  myList.select(mu_eta, mu_phi, 0.15, 0.15);
498  } else if (cone == SubCaloId::LAREM) {
499  myList.select(mu_eta, mu_phi, 0.3, 0.3);
500  } else {
501  myList.select(mu_eta, mu_phi, 0., 0.);
502  }
503 
504  int count = 0;
505  constexpr double lowest_threshold = 4. * 150.;
506 
507  for (const CaloCell* cell : myList) {
508  double cellEnergy = cell->energy();
509  const double noise_rms = noiseCDO->getNoise(cell->ID(), cell->gain());
510  if (cellEnergy > lowest_threshold && cellEnergy > noise_rms * m_sigmasAboveNoise && m_hecID->sampling(cell->ID()) == sample) {
511  count += 1;
512  // new_cell_list.push_backcell;
513 
514  ATH_MSG_DEBUG("Energy : " << cell->energy() << " Sampling: " << m_hecID->sampling(cell->ID())
515  << " z :" << cell->caloDDE()->z() << " Eta : " << cell->eta() << " Phi : " << cell->phi()
516  << " Noise Level : " << noise_rms);
517 
518  larhecTotal += cell->energy();
519  }
520  }
521 
522  ATH_MSG_DEBUG("larhec counted " << count);
523 
524  return larhecTotal;
525  }
526 
527  double MuidCaloEnergyMeas::energyInLArEM(const CaloCellContainer* cellContainer, const CaloDetDescrManager* detMgr,
528  const CaloNoise* noiseCDO, double mu_eta, double mu_phi, int sample, int cone) const {
529  // Look in the LarEM calorimeter
530  // i.e. loop over its cells
531  /*
532  sample_number
533  0 --> Presampler
534  1 --> Sampling 1
535  2 --> Sampling 2
536  3 --> Sampling 3
537  */
538 
539  // int i,j,k;
540  double emTotalEnergy = 0.;
541 
543  CaloCellList myList(detMgr, cellContainer, iCalo); // Construct the list
544  if (cone == SubCaloId::LARHEC) {
545  myList.select(mu_eta, mu_phi, 0.075, 0.075); // 0.1 0.1
546  } else if (cone == SubCaloId::LAREM) {
547  myList.select(mu_eta, mu_phi, 0.15, 0.15);
548  } else {
549  myList.select(mu_eta, mu_phi, 0., 0.);
550  }
551 
552  // std::vector<const CaloCell*> new_cell_list;
553  int count = 0;
554 
555  double lowest_threshold = 4. * 50.;
556 
557  for (const CaloCell* cell : myList) {
558  double cellEnergy = cell->energy();
559  const double noise_rms = noiseCDO->getNoise(cell->ID(), cell->gain());
560 
561  if (cellEnergy > lowest_threshold && cellEnergy > noise_rms * m_sigmasAboveNoise && m_emID->sampling(cell->ID()) == sample) {
562  count += 1;
563  // new_cell_list.push_backcell;
564 
565  ATH_MSG_DEBUG("Energy : " << cell->energy() << " Sampling: " << m_emID->sampling(cell->ID())
566  << " Radius :" << cell->caloDDE()->r() << " z :" << cell->caloDDE()->z()
567  << " Eta : " << cell->eta() << " Phi : " << cell->phi() << " Noise Level : " << noise_rms);
568 
569  emTotalEnergy += cell->energy();
570  }
571  }
572 
573  ATH_MSG_DEBUG("larem counted " << count);
574 
575  return emTotalEnergy;
576  }
577 
578 } // namespace Rec
grepfile.info
info
Definition: grepfile.py:38
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
Rec::MuidCaloEnergyMeas::m_measurementConeLArHEC
double m_measurementConeLArHEC
Definition: MuidCaloEnergyMeas.h:114
Rec::MuidCaloEnergyMeas::m_isolationConeLArEM
double m_isolationConeLArEM
Definition: MuidCaloEnergyMeas.h:118
Rec::MuidCaloEnergyMeas::m_totalSelectedTile
std::atomic_int m_totalSelectedTile
Definition: MuidCaloEnergyMeas.h:128
Rec::MuidCaloEnergyMeas::m_isolationConeTile
double m_isolationConeTile
Definition: MuidCaloEnergyMeas.h:116
LArEM_ID.h
CaloCellList
Definition: CaloCellList.h:40
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
Rec::CaloMeas::Tile_Isolation
double Tile_Isolation(void) const
Definition: CaloMeas.h:64
Rec::MuidCaloEnergyMeas::m_totalCoreCellsEM
std::atomic_int m_totalCoreCellsEM
Definition: MuidCaloEnergyMeas.h:123
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCellList::select
void select(double eta, double phi, double deta, double dphi)
Definition: CaloCellList.cxx:67
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
Rec::MuidCaloEnergyMeas::initialize
StatusCode initialize() override
Definition: MuidCaloEnergyMeas.cxx:58
Rec::MuidCaloEnergyMeas::energyInLArHEC
double energyInLArHEC(const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int, int) const
Definition: MuidCaloEnergyMeas.cxx:477
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAODP4Helpers.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CaloCellList.h
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
Rec::CaloMeas::LArEM_EnergyMeasured
double LArEM_EnergyMeasured(void) const
Definition: CaloMeas.h:84
Rec::MuidCaloEnergyMeas::m_isolationConeLArHEC
double m_isolationConeLArHEC
Definition: MuidCaloEnergyMeas.h:117
CaloID.h
Tile_Base_ID::sample
int sample(const Identifier &id) const
Definition: Tile_Base_ID.cxx:171
CaloCell.h
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: xAODP4Helpers.h:69
LArEM_Base_ID::sampling
int sampling(const Identifier id) const
return sampling according to :
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
Rec::MuidCaloEnergyMeas::m_measurementConeTile
double m_measurementConeTile
Definition: MuidCaloEnergyMeas.h:113
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
LArHEC_ID.h
CaloNoise::getNoise
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition: CaloNoise.h:34
Rec::MuidCaloEnergyMeas::MuidCaloEnergyMeas
MuidCaloEnergyMeas(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuidCaloEnergyMeas.cxx:35
Rec::CaloMeas::LArHEC_EnergyMeasured
double LArHEC_EnergyMeasured(void) const
Definition: CaloMeas.h:72
Rec::MuidCaloEnergyMeas::m_hecID
const LArHEC_ID * m_hecID
Definition: MuidCaloEnergyMeas.h:103
Rec::MuidCaloEnergyMeas::energyMeasurement
std::unique_ptr< CaloMeas > energyMeasurement(const EventContext &ctx, double etaEM, double phiEM, double etaHad, double phiHad) const override
IMuidCaloEnergyMeas interface: get the muon energy loss measurement from the calorimeter,...
Definition: MuidCaloEnergyMeas.cxx:87
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
TileID.h
Rec::MuidCaloEnergyMeas::m_noiseCDOKey
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Definition: MuidCaloEnergyMeas.h:89
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
Rec::MuidCaloEnergyMeas::cellCounting
int cellCounting(const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi) const
Definition: MuidCaloEnergyMeas.cxx:140
CaloCellList::end
list_iterator end() const
Definition: CaloCellList.h:93
Rec::MuidCaloEnergyMeas::~MuidCaloEnergyMeas
virtual ~MuidCaloEnergyMeas()
Rec::CaloMeas::LArEM_FirstCompartmentEnergy
double LArEM_FirstCompartmentEnergy(void) const
Definition: CaloMeas.h:88
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
P4Helpers::deltaEta
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition: P4Helpers.h:53
Rec::CaloMeas
Definition: CaloMeas.h:19
lumiFormat.i
int i
Definition: lumiFormat.py:92
Rec::MuidCaloEnergyMeas::m_sigmasAboveNoise
double m_sigmasAboveNoise
Definition: MuidCaloEnergyMeas.h:120
Rec
Name: MuonSpContainer.h Package : offline/Reconstruction/MuonIdentification/muonEvent.
Definition: FakeTrackBuilder.h:10
Rec::CaloMeas::LArEM_Isolation
double LArEM_Isolation(void) const
Definition: CaloMeas.h:92
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
Rec::MuidCaloEnergyMeas::samplingID
int samplingID(const CaloCell *cell, int iSubCalo) const
Definition: MuidCaloEnergyMeas.cxx:162
CaloCell_Base_ID::SUBCALO
SUBCALO
enumeration of sub calorimeters
Definition: CaloCell_Base_ID.h:46
Rec::MuidCaloEnergyMeas::m_measurementConeLArEM
double m_measurementConeLArEM
Definition: MuidCaloEnergyMeas.h:115
Rec::MuidCaloEnergyMeas::m_tileID
const TileID * m_tileID
Definition: MuidCaloEnergyMeas.h:101
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Rec::MuidCaloEnergyMeas::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: MuidCaloEnergyMeas.h:111
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
Rec::MuidCaloEnergyMeas::m_sigmasAboveNoiseCore
double m_sigmasAboveNoiseCore
Definition: MuidCaloEnergyMeas.h:121
python.SUBCALO.LARHEC
int LARHEC
Definition: SUBCALO.py:9
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
Rec::MuidCaloEnergyMeas::energyInTile
double energyInTile(const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int, int) const
Definition: MuidCaloEnergyMeas.cxx:429
plotIsoValidation.mu_phi
mu_phi
Definition: plotIsoValidation.py:152
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Rec::MuidCaloEnergyMeas::m_totalCoreCellsHEC
std::atomic_int m_totalCoreCellsHEC
Definition: MuidCaloEnergyMeas.h:124
CaloMeas.h
CaloNoise
Definition: CaloNoise.h:16
Athena::Units
Definition: Units.h:45
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Rec::MuidCaloEnergyMeas::energyInLArEM
double energyInLArEM(const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int, int) const
Definition: MuidCaloEnergyMeas.cxx:527
Rec::CaloMeas::Tile_EnergyMeasured
double Tile_EnergyMeasured(void) const
Definition: CaloMeas.h:60
Rec::MuidCaloEnergyMeas::energyInCalo
void energyInCalo(CaloMeas &caloMeas, const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int iSubCalo) const
Definition: MuidCaloEnergyMeas.cxx:174
IMuidCaloEnergyParam.h
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
Rec::CaloMeas::LArHEC_Isolation
double LArHEC_Isolation(void) const
Definition: CaloMeas.h:76
TILE
@ TILE
Definition: RegSelEnums.h:30
Units.h
Wrapper to avoid constant divisions when using units.
Rec::MuidCaloEnergyMeas::finalize
StatusCode finalize() override
Definition: MuidCaloEnergyMeas.cxx:80
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
Rec::CaloMeas::Tile_SamplingFraction
double Tile_SamplingFraction(void) const
Definition: CaloMeas.h:68
Rec::MuidCaloEnergyMeas::m_caloParamTool
ToolHandle< IMuidCaloEnergyParam > m_caloParamTool
Definition: MuidCaloEnergyMeas.h:95
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
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuidCaloEnergyMeas.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
LArHEC_Base_ID::sampling
int sampling(const Identifier id) const
return sampling [0,3] (only 0 for supercells)
Rec::MuidCaloEnergyMeas::m_totalSelectedEM
std::atomic_int m_totalSelectedEM
Definition: MuidCaloEnergyMeas.h:126
CaloCellList::ncells
int ncells() const
Definition: CaloCellList.h:111
Rec::MuidCaloEnergyMeas::m_emID
const LArEM_ID * m_emID
Definition: MuidCaloEnergyMeas.h:102
plotIsoValidation.mu_eta
mu_eta
Definition: plotIsoValidation.py:151
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:397
Rec::MuidCaloEnergyMeas::m_totalCoreCellsTile
std::atomic_int m_totalCoreCellsTile
Definition: MuidCaloEnergyMeas.h:125
Rec::MuidCaloEnergyMeas::m_cellContainerLocation
SG::ReadHandleKey< CaloCellContainer > m_cellContainerLocation
Definition: MuidCaloEnergyMeas.h:104
Rec::MuidCaloEnergyMeas::m_totalSelectedHEC
std::atomic_int m_totalSelectedHEC
Definition: MuidCaloEnergyMeas.h:127
AthAlgTool
Definition: AthAlgTool.h:26
Rec::MuidCaloEnergyMeas::isolationEnergy
void isolationEnergy(CaloMeas &caloMeas, const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int iSubCalo) const
Definition: MuidCaloEnergyMeas.cxx:354
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
Rec::CaloMeas::LArEM_SamplingFraction
double LArEM_SamplingFraction(void) const
Definition: CaloMeas.h:96
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
python.SUBCALO.LAREM
int LAREM
Definition: SUBCALO.py:8
Rec::CaloMeas::LArHEC_SamplingFraction
double LArHEC_SamplingFraction(void) const
Definition: CaloMeas.h:80