ATLAS Offline Software
Loading...
Searching...
No Matches
CaloLCDeadMaterialTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#undef DEBUG_DMTHINGS
6#undef MAKE_MOMENTS
9
11
15#include "CxxUtils/prefetch.h"
16
18
20using namespace std::string_literals; //for suffix 's'
21
22#ifdef MAKE_MOMENTS
23void set_zero_moments(CaloCluster *theCluster);
24#endif
25
27
28/* ****************************************************************************
29- CaloLCDeadMaterialTool::initialize
30**************************************************************************** */
32{
33 if(m_interpolate) {
34 msg(MSG::INFO) << "Interpolation is ON, dimensions: ";
35 for(std::map<std::string, std::vector<std::string> >::iterator it=m_interpolateDimensionNames.begin(); it!=m_interpolateDimensionNames.end(); ++it){
36 msg(MSG::INFO) << " " << (*it).first << " (";
37 for(std::vector<std::string >::iterator it2 = (*it).second.begin(); it2!=(*it).second.end(); ++it2) {
38 msg() << (*it2) << " ";
39 }
40 msg() << ")";
41 }
42 msg() << endmsg;
43 for(std::map<std::string, std::vector<std::string> >::iterator it=m_interpolateDimensionNames.begin(); it!=m_interpolateDimensionNames.end(); ++it){
44 std::vector<int > *vtmp=nullptr;
45 if((*it).first == "AREA_DMFIT") {
47 }else if((*it).first == "AREA_DMLOOKUP") {
49 }else if((*it).first == "AREA_DMSMPW") {
51 }else{
52 ATH_MSG_WARNING("Unkown dead material area type '" << (*it).first << "'");
53 continue;
54 }
55 for(std::vector<std::string >::iterator it2 = (*it).second.begin(); it2!=(*it).second.end(); ++it2) {
58 vtmp->push_back(int(id));
59 }else{
60 ATH_MSG_WARNING( "Dimension '" << (*it2) << "' is invalid and will be excluded." );
61 }
62 }
63 }
64 } // m_interpolate
65
66 ATH_MSG_INFO( "Initializing " << name() );
67
68
69 ATH_CHECK(m_key.initialize());
70
71 return StatusCode::SUCCESS;
72}
73
74
75
76/* ****************************************************************************
77- DeadMaterialCorrectionTool2::execute
78**************************************************************************** */
79StatusCode CaloLCDeadMaterialTool::weight(CaloCluster* theCluster, const EventContext& ctx) const
80{
83
84 float wrong_dm_energy = 0.0;
85 float dm_total = 0.0;
86
87
88 double weightMom (1);
89 if (!theCluster->retrieveMoment(CaloCluster::DM_WEIGHT,weightMom)) {
90 ATH_MSG_WARNING ("Cannot find cluster moment DM_WEIGHT");
91 }
92 /* WTF?? re-setting the same moment??
93 theCluster->insertMoment(CaloClusterMoment::DM_WEIGHT,CaloClusterMoment(new_weight),true);
94 */
95
96 double eWeighted = theCluster->e();
97
98// // check desired reco status
99// float cls_em_fraction = 0.0;
100// if ( theCluster->checkRecoStatus(CaloRecoStatus::TAGGEDHAD)) {
101// cls_em_fraction = 0.25;
102// } else if( theCluster->checkRecoStatus(CaloRecoStatus::TAGGEDEM)) {
103// cls_em_fraction = 0.99;
104// }else {
105// log << MSG::DEBUG<<"Cluster was not selected for local DM calibration. Cluster reco status differs from TAGGEDHAD or TAGGEDEM."
106// << " Cluster energy " << theCluster->e() << " remains the same." << endmsg;
107// #ifdef MAKE_MOMENTS
108// set_zero_moments(theCluster);
109// #endif
110// return StatusCode::SUCCESS;
111// }
112
113 if ( theCluster->e() <= m_MinClusterEnergyToDeal) {
114 ATH_MSG_DEBUG("Cluster was not selected for local DM calibration, ecls < m_MinClusterEnergyToDeal (=" <<m_MinClusterEnergyToDeal << ").");
115#ifdef MAKE_MOMENTS
116 set_zero_moments(theCluster);
117#endif
118 return StatusCode::SUCCESS;
119 }
120
121 double pi0Prob = 0;
122 if ( m_useHadProbability) {
123 if (!theCluster->retrieveMoment(CaloCluster::EM_PROBABILITY,pi0Prob)) {
124 ATH_MSG_ERROR("Cannot retrieve EM_PROBABILITY cluster moment, "
125 << " cluster energy " << theCluster->e() << " remains the same." );
126 return StatusCode::FAILURE;
127 }
128 if ( pi0Prob < 0 ) {
129 pi0Prob = 0;
130 } else if ( pi0Prob > 1 ) {
131 pi0Prob = 1;
132 }
133 } else if (theCluster->recoStatus().checkStatus(CaloRecoStatus::TAGGEDEM)) {
134 pi0Prob = 1;
135 }
136
137 double center_lambda = 0;
138 if ( !theCluster->retrieveMoment(CaloCluster::CENTER_LAMBDA, center_lambda) ){
139 ATH_MSG_ERROR("Cannot retrieve CENTER_LAMBDA cluster moment, "
140 << " cluster energy " << theCluster->e() << " remains the same." );
141 return StatusCode::FAILURE;
142 }
143
144 const CaloLocalHadCoeff* data(nullptr);
146 data = *rch;
147 if(data==nullptr) {
148 ATH_MSG_ERROR("Unable to access conditions object");
149 return StatusCode::FAILURE;
150 }
151
152 ATH_MSG_DEBUG("Cluster is selected for local DM calibration."
153 << " Old cluster energy:" << theCluster->e()
154 << " m_weightModeDM:" << m_weightModeDM);
155
156 // calculation of specific cluster quantities for DM correction (i.e. core of procedure)
157 std::vector<Area> areas;
158 std::vector<Cell> cells;
159 float smp_energy[CaloSampling::Unknown];
160 float cls_unweighted_energy = 0;
161 StatusCode sc = prepare_for_cluster(theCluster, areas, cells,
162 smp_energy, cls_unweighted_energy, data);
163 if ( !sc.isSuccess() ) {
164#ifdef MAKE_MOMENTS
165 set_zero_moments(theCluster);
166#endif
167 ATH_MSG_ERROR( "prepare for cluster failed!" );
168 return sc;
169 }
170
171 float cls_initial_energy = theCluster->e();
172 float cls_side = (theCluster->eta()<0?-1.0:1.0);
173 float cls_eta = fabs(theCluster->eta());
174 float cls_phi = theCluster->phi();
175 float log10ener = 0.0;
176 if(cls_unweighted_energy > 0.0) {
177 log10ener = log10(cls_unweighted_energy);
178 }
179 float log10lambda;
180 if(center_lambda > 0.0) {
181 log10lambda = log10(center_lambda);
182 if(log10lambda >=4.0) log10lambda = 3.9999;
183 }else{
184 log10lambda = 0.0;
185 }
186#ifdef DEBUG_DMTHINGS
187 std::cout << " cls_initial_energy: " << cls_initial_energy << " cls_eta: " << cls_eta << std::endl;
188 std::cout << " log10ener: " << log10ener << " log10lambda: " << log10lambda << std::endl;
189 for(int i_smp=0; i_smp<CaloSampling::Unknown; i_smp++){
190 std::cout << " i_smp: " << i_smp << " smp_energy: " << smp_energy[i_smp] << std::endl;
191 }
192#endif
193
194 std::vector<float > vars;
195 vars.resize(6, 0.0);
196 vars[CaloLocalHadDefs::DIMD_EMFRAC] = pi0Prob;
197 vars[CaloLocalHadDefs::DIMD_SIDE] = cls_side;
198 vars[CaloLocalHadDefs::DIMD_ETA] = cls_eta;
199 vars[CaloLocalHadDefs::DIMD_PHI] = cls_phi;
200 vars[CaloLocalHadDefs::DIMD_ENER] = log10ener;
201 vars[CaloLocalHadDefs::DIMD_LAMBDA] = log10lambda;
202
203 size_t n_dm = data->getSizeAreaSet();
204
205 // loop over HAD/EM possibilities for mixing different correction types
206 for(int i_mix=0; i_mix<2; i_mix++){ // 0 - pure HAD case, 1-pure EM case
207 float mixWeight = (i_mix==0?(1-pi0Prob):pi0Prob);
208 if(mixWeight == 0) continue;
209
210 vars[CaloLocalHadDefs::DIMD_EMFRAC] = float(i_mix);
211
212 // loop over DM areas defined and calculation of cluster DM energy deposited in these areas
213 for(size_t i_dm=0; i_dm < n_dm; i_dm++){
214 if(areas[i_dm].eprep <= 0.0) continue; // no appropriate signal to reconstruct dm energy in this area
215
216 const CaloLocalHadCoeff::LocalHadArea *area = data->getArea(i_dm);
217 float emax = area->getDimension(CaloLocalHadDefs::DIMD_ENER)->getXmax();
218 if(log10ener > emax) log10ener = emax - 0.0001;
219 vars[CaloLocalHadDefs::DIMD_ENER] = log10ener;
220
221 const CaloLocalHadCoeff::LocalHadCoeff *pars = data->getCoeff(i_dm, vars);
222 if( !pars ) continue;
223
224 float edm = 0.0;
225 // if dm area is reconstructed using polynom fit approach
226 if(area->getType() == CaloLocalHadDefs::AREA_DMFIT) {
227 edm = (*pars)[CaloLocalHadDefs::BIN_P0] + (*pars)[CaloLocalHadDefs::BIN_P1]*areas[i_dm].eprep;
228 if(m_interpolate) {
229 bool isa = CaloLCCoeffHelper::Interpolate(data, i_dm, vars, parint, m_interpolateDimensionsFit, areas[i_dm].eprep);
230 // calculation of fitted values is done already in the interpolator
231 if(isa) edm = parint[CaloLocalHadDefs::BIN_P0];
232 }
233
234 // if dm area is reconstructed using lookup table approach
235 }else if(area->getType() == CaloLocalHadDefs::AREA_DMLOOKUP){
236 if( (*pars)[CaloLocalHadDefs::BIN_ENTRIES] > m_MinLookupBinNentry) edm = cls_unweighted_energy*((*pars)[CaloLocalHadDefs::BIN_WEIGHT] - 1.0 );
237 if(m_interpolate) {
239 if(isa && parint[CaloLocalHadDefs::BIN_ENTRIES] > m_MinLookupBinNentry) edm = cls_unweighted_energy*(parint[CaloLocalHadDefs::BIN_WEIGHT] - 1.0 );
240 }
241
242 // if dm area is reconstructed using new sampling weights
243 }else if(area->getType() == CaloLocalHadDefs::AREA_DMSMPW){
244 const int nSmp=pars->size()-1;
245 //std::cout << "size=" << nSmp << ", unkown value=" << CaloSampling::Unknown << ", minifcal=" << CaloSampling::MINIFCAL0 << std::endl;
246 double ecalonew = 0.0;
247 double ecaloold = 0.0;
248 for(int i_smp=0; i_smp<nSmp; i_smp++){
249 ecaloold += smp_energy[i_smp];
250 ecalonew += smp_energy[i_smp] * (*pars)[i_smp];
251 }
252 ecalonew += (*pars)[nSmp]; // const Used to be CaloSampling::Unknown but the value of this enum has changed to include the miniFCAL.
253 edm = ecalonew - ecaloold;
254
255// if(m_interpolate) {
256// bool isa = hp.Interpolate(data, i_dm, vars, parint, m_interpolateDimensionsSampling);
257// if(isa) {
258// ecalonew = 0.0;
259// ecaloold = 0.0;
260// for(int i_smp=0; i_smp<CaloSampling::Unknown; i_smp++){
261// ecaloold += smp_energy[i_smp];
262// ecalonew += smp_energy[i_smp] * parint[i_smp];
263// }
264// ecalonew += parint[CaloSampling::Unknown]; // const
265// edm = ecalonew - ecaloold;
266// }
267// }
268
269 } else{
270 std::cout << "CaloLCDeadMaterialTool -> Error! Unknown correction type " << area->getType()
271 << " with number of parameters " << area->getNpars() << std::endl;
272 }
273 wrong_dm_energy += areas[i_dm].edm_wrong;
274
275#ifdef DEBUG_DMTHINGS
276 std::cout << " result> edm: " << edm << " edm_wrong:" << edm_wrong << std::endl;
277#endif
278 edm -= areas[i_dm].edm_wrong;
279 if(edm > 0.0) {
280 areas[i_dm].erec = areas[i_dm].erec + edm*mixWeight;
281 dm_total += edm;
282 }
283 } // i_dm
284 } // i_mix
285
286 // giving of calculated DM energy to cluster by one of 3 methods
287 // m_weightModeDM=0 - simple setting of cluster energy to new value
288 // m_weightModeDM=1 - changing (increasing) of weights of cluster cells
289 // m_weightModeDM=2 - changing (increasing) of weights of cluster cells (which were invloved into DM calculation)
290
291#ifdef DEBUG_DMTHINGS
292 std::cout << "wc> calculation of weights" << std::endl;
293#endif
294
295 if(dm_total > 0.0) {
296 if (m_weightModeDM == 0) {
297 // method 0: setting cluster energy to new value without changing of cells weights
298 theCluster->setE(cls_initial_energy + dm_total - wrong_dm_energy);
299
300 } else if (m_weightModeDM == 1) {
301 // method1: calculation of weights of all cluster cells to treat DM energy.
302 // Weights of all cluster cells will be changed proportionally
303 float sub_ener_old = 0.0;
304 for(size_t i_c = 0; i_c < cells.size(); i_c++)
305 {
306 const Cell& cell = cells[i_c];
307 if (cell.energy <= m_MinCellEnergyToDeal) continue;
308 sub_ener_old += cell.weight*cell.energy;
309 }
310 if(sub_ener_old > 0.0) {
311 float corr = (sub_ener_old + dm_total)/sub_ener_old;
312 for(size_t i_c = 0; i_c < cells.size(); i_c++)
313 {
314 if(cells[i_c].energy <= m_MinCellEnergyToDeal) continue;
315 cells[i_c].weight *= corr;
316 }
317 }
318
319 } else if (m_weightModeDM == 2) {
320 // method2: calculation of weights of all cluster cells to treat DM energy.
321 // only weights for cells involved into DM calculation will be changed
322
323 for (size_t cell_index = 0; cell_index < cells.size(); ++cell_index)
324 {
325 const Cell& cell = cells[cell_index];
326 if (cell.energy <= m_MinCellEnergyToDeal) continue;
327 float we = cell.weight * cell.energy;
328 if (cell.dm != sDM)
329 areas[cell.dm].sub_ener_old += we;
330 areas[sDM_FCAL].sub_ener_old += we;
331 areas[sDM_LEAKAGE].sub_ener_old += we;
332 areas[sDM_UNCLASS].sub_ener_old += we;
333 }
334
335 for(size_t i_dm=0; i_dm < areas.size(); i_dm++) {
336 Area& dma = areas[i_dm];
337 float corrfac = 1;
338 if (i_dm >= n_dm || dma.eprep <= 0)
339 corrfac = 1;
340 else if (dma.sub_ener_old > 0)
341 corrfac = (dma.sub_ener_old + dma.erec) / dma.sub_ener_old;
342
343 if (i_dm < sDM_FCAL)
344 areas[sDM_FCAL].sub_ener_old += (corrfac-1)*dma.sub_ener_old;
345 if (i_dm < sDM_LEAKAGE)
346 areas[sDM_LEAKAGE].sub_ener_old += (corrfac-1)*dma.sub_ener_old;
347 if (i_dm < sDM_UNCLASS)
348 areas[sDM_UNCLASS].sub_ener_old += (corrfac-1)*dma.sub_ener_old;
349
350 dma.corr = corrfac;
351 }
352
353 float gblfac = areas[sDM_FCAL].corr * areas[sDM_LEAKAGE].corr * areas[sDM_UNCLASS].corr;
354 for (size_t cell_index = 0; cell_index < cells.size(); ++cell_index)
355 {
356 Cell& cell = cells[cell_index];
357 if (cell.energy <= m_MinCellEnergyToDeal) continue;
358 if (cell.dm != sDM)
359 cell.weight *= areas[cell.dm].corr;
360 cell.weight *= gblfac;
361 }
362 } else {
363 ATH_MSG_ERROR( "Unknown m_weightModeDM " << m_weightModeDM );
364 }
365
366 // setting of calculated weights to the cluster cells
367 if (m_weightModeDM == 1 || m_weightModeDM == 2){
368 int cell_index = 0;
369 CaloCluster::cell_iterator itrCell = theCluster->cell_begin();
370 CaloCluster::cell_iterator itrCellEnd = theCluster->cell_end();
371 for (;itrCell!=itrCellEnd; ++itrCell) {
372 //CaloPrefetch::nextDDE(itrCell, itrCellEnd); no DDE info needed
373 const float old_weight = itrCell.weight();
374 float new_weight = cells[cell_index].weight;
375 if( new_weight < m_MaxChangeInCellWeight*old_weight ){
376 theCluster->reweightCell(itrCell, new_weight);
377 }else{
378 new_weight = old_weight; //Why that? Just for the printout below?
379 }
380#ifdef DEBUG_DMTHINGS
381 std::cout << " cells> " << cell_index << " ener: " << cells[cell_index].energy << " old_w: " << old_weight << " new_w:" << new_weight << std::endl;
382 if( new_weight > 100) std::cout << "DeadMaterialCorrectionTool2 -> Panic! Too large weight" << std::endl;
383#endif
384 cell_index++;
385 }//end loop over cells
387 }//end if method 1 or 2
388
389 } // dm_total > 0.0
390
391 ATH_MSG_DEBUG("cls_initial_energy: " << cls_initial_energy
392 << " (contains wrongly estimated DM energy: " << wrong_dm_energy << ")"
393 << " calculated DM energy (to be added):" << dm_total
394 << " new cluster energy:" << theCluster->e());
395
396#ifdef MAKE_MOMENTS
397 // to save reconstructed energy in different DM areas as cluster moments
399 double xmom;
400 bool result = theCluster->retrieveMoment(xtype, xmom, false);
401
402 if(result) {
403 double x;
404 bool useLink = true;
405
406 x = (double)smp_energy[CaloSampling::PreSamplerB];
407 theCluster->insertMoment(CaloCluster::ENG_RECO_EMB0, x);
408
409 x = (double)smp_energy[CaloSampling::PreSamplerE];
410 theCluster->insertMoment(CaloCluster::ENG_RECO_EME0, x);
411
412 x = (double)smp_energy[CaloSampling::TileGap3];
413 theCluster->insertMoment(CaloCluster::ENG_RECO_TILEG3, x);
414
415 x = (double)(dm_total+wrong_dm_energy);
416 theCluster->insertMoment(CaloCluster::ENG_RECO_DEAD_TOT, x);
417
418 for(size_t i_dm=0; i_dm < areas.size(); i_dm++) {
419 Area& dma = areas[i_dm];
420 CaloCluster::MomentType m_type = (CaloCluster::MomentType) (int(CaloCluster::ENG_RECO_DEAD_EMB0)+i_dm);
421 x = (double)dma.erec;
422 if(i_dm == sDM_EMB0_EMB1 && smp_energy[CaloSampling::PreSamplerB]>0.0) x+= smp_energy[CaloSampling::PreSamplerB];
423 if(i_dm == sDM_EME0_EME12 && smp_energy[CaloSampling::PreSamplerE] > 0.0) x+= smp_energy[CaloSampling::PreSamplerE];
424 if(i_dm == sDM_SCN && smp_energy[CaloSampling::TileGap3] > 0.0) x+= smp_energy[CaloSampling::TileGap3];
425 theCluster->insertMoment(m_type, CaloClusterMoment(x));
426 }
427 }
428
429#endif
430
431 // assume that the weighting could be called more than once. In that
432 // case eWeighted is the result of the previous step and the current
433 // e/eWeighted ratio should be multiplied with the existing
434 // DM_WEIGHT moment
435
436 if ( eWeighted > 0 || eWeighted < 0 ) {
437 weightMom *= theCluster->e()/eWeighted;
438 }
439 theCluster->insertMoment(CaloCluster::DM_WEIGHT,weightMom);
440
441 return StatusCode::SUCCESS;
442}
443
444
445#ifdef MAKE_MOMENTS
446void set_zero_moments(CaloCluster *theCluster) {
448 double xmom;
449 bool result = theCluster->retrieveMoment(xtype, xmom);
450 if(result) {
451 theCluster->insertMoment(CaloCluster::ENG_RECO_EMB0, 0.0);
452 theCluster->insertMoment(CaloCluster::ENG_RECO_EME0, 0.0);
453 theCluster->insertMoment(CaloCluster::ENG_RECO_TILEG3, 0.0);
454 theCluster->insertMoment(CaloCluster::ENG_RECO_DEAD_TOT, 0.0);
455 for(size_t i_dm=0; i_dm < DeadMaterialCorrectionTool2::sDM; i_dm++) {
456 CaloCluster::MomentType m_type = (CaloCluster::MomentType) (int(CaloCluster::ENG_RECO_DEAD_EMB0)+i_dm);
457 theCluster->insertMoment(m_type, 0.0);
458 }
459 }
460}
461#endif
462
463
464
465/* ****************************************************************************
466- Finding energy and noise in different "areas" of cluster. Some of these areas
467 correspond to CaloSamplings, others are special.
468- Filling array m_eprep[sDM], it will be used later for reconstruction of DM
469 energy in different zones as m_dmrec[i] = fun(m_eprep[i]);
470**************************************************************************** */
471StatusCode
473 (const CaloCluster* theCluster,
474 std::vector<Area>& areas,
475 std::vector<Cell>& cells,
476 float* smp_energy,
477 float& cls_unweighted_energy, const CaloLocalHadCoeff* data) const
478{
479 areas.resize(data->getSizeAreaSet());
480 cells.reserve (theCluster->size());
481
482 bzero(smp_energy, CaloSampling::Unknown*sizeof(float));
483
484 // Finding of energy and noise in different "areas" of cluster. Some of these
485 // areas correspond to CaloSamplings, others are special.
486 CaloCluster::const_cell_iterator itrCell = theCluster->cell_begin();
487 CaloCluster::const_cell_iterator itrCellEnd = theCluster->cell_end();
488 cls_unweighted_energy = 0;
489 for (;itrCell!=itrCellEnd; ++itrCell) {
490 CxxUtils::prefetchNext(itrCell, itrCellEnd);
491 const CaloCell* thisCell = *itrCell;
492 //Identifier id = thisCell->ID();
493 CaloSampling::CaloSample nsmp=thisCell->caloDDE()->getSampling();
494 //CaloSampling::CaloSample nsmp = CaloSampling::CaloSample(m_calo_id->calo_sample(id));
495
496 float energy = thisCell->e();
497 float weight = itrCell.weight();
498 cls_unweighted_energy += energy;
499
500 Cell cell{};
501 cell.weight = weight;
502 cell.energy = energy;
503 cell.dm = sDM;
504
505 smp_energy[nsmp] += energy; // unweighted energy in samplings for given cluster
506
507 if(energy > m_MinCellEnergyToDeal) {
508
509 if ( nsmp == CaloSampling::PreSamplerB || nsmp == CaloSampling::EMB1) {
510 cell.dm = sDM_EMB0_EMB1;
511
512 } else if( nsmp == CaloSampling::TileGap3 ) {
513 cell.dm = sDM_SCN;
514
515 } else if ( nsmp == CaloSampling::PreSamplerE || nsmp == CaloSampling::EME1 ) {
516 cell.dm = sDM_EME0_EME12;
517
518 } else if (nsmp == CaloSampling::EME3) {
519 cell.dm = sDM_EME3_HEC0;
520
521 } else if (nsmp == CaloSampling::HEC0) {
522 cell.dm = sDM_EME3_HEC0;
523
524 } else if (nsmp == CaloSampling::EMB3) {
525 cell.dm = sDM_EMB3_TILE0;
526
527 } else if (nsmp == CaloSampling::TileBar0) {
528 cell.dm = sDM_EMB3_TILE0;
529 }
530
531 } // cell_ener > cell_min_energy
532 cells.push_back (cell);
533 } // itrCell
534
535// Realculate sampling energy as the abs value of the original cluster, if you summed up energies, fluctuations wouldn't cancel and sample energy would be huge
536 if(m_absOpt){
537
538 for(unsigned int i=0; i != CaloSampling::Unknown; ++ i) smp_energy[i] = fabs(theCluster->eSample((CaloSampling::CaloSample)i));
539
540 }
541
542
543 // calculation of 'signal' which will be used for DM energy estimation
544 float x(0), y(0);
545
546 // sDM_EMB0_EMB1: energy before EMB0 and between EMB0 and EMB1
547 x = smp_energy[CaloSampling::PreSamplerB];
548 if ( x > 0.) {
549 areas[sDM_EMB0_EMB1].eprep = x;
550 areas[sDM_EMB0_EMB1].edm_wrong = x;
551 }
552
553 // sDM_EMB3_TILE0: to correct energy between barrel and tile
554 x = smp_energy[CaloSampling::EMB3];
555 y = smp_energy[CaloSampling::TileBar0];
556 if ( x > 0. && y>0.) areas[sDM_EMB3_TILE0].eprep = sqrt(x*y);
557
558 // sDM_SCN: to correct energy before scintillator
559 x = smp_energy[CaloSampling::TileGap3];
560 if ( x > 0.) {
561 areas[sDM_SCN].eprep = x;
562 areas[sDM_SCN].edm_wrong = x;
563 }
564
565 // sDM_EME0_EME12: sum of energy before EME0 and between EME0 and EME1
566 x = smp_energy[CaloSampling::PreSamplerE];
567 if ( x > 0.) {
568 areas[sDM_EME0_EME12].eprep = x;
569 areas[sDM_EME0_EME12].edm_wrong = x;
570 }
571
572 // sDM_EME3_HEC0: to correct energy between EMEC and HEC
573 x = smp_energy[CaloSampling::EME3];
574 y = smp_energy[CaloSampling::HEC0];
575 if ( x > 0. && y>0.) areas[sDM_EME3_HEC0].eprep = sqrt(x*y);
576
577 areas[sDM_FCAL].eprep = cls_unweighted_energy;
578 areas[sDM_LEAKAGE].eprep = cls_unweighted_energy;
579 areas[sDM_UNCLASS].eprep = cls_unweighted_energy;
580
581 return StatusCode::SUCCESS;
582}
583
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
double area(double R)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t sc
#define y
#define x
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition CaloCell.h:333
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
static void calculateKine(xAOD::CaloCluster *clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria=false)
Helper class to calculate cluster kinematics based on cells.
defines enums and data types for different moments of CaloCluster
Principal data class for CaloCell clusters.
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
bool retrieveMoment(const moment_type &momType, moment_value &momValue, bool useLink=true) const
Retrieve individual moment.
virtual double e() const
Retrieve energy independent of signal state.
void insertMoment(const moment_type &momType, const moment_value &momValue, bool useLink=true)
Set individual moment.
virtual double eta() const
Retrieve eta independent of signal state.
virtual double phi() const
Retrieve phi independent of signal state.
virtual void setE(double e)
Set energy.
cell_iterator cell_end() const
Retrieve a STL-type end() iterator for the cell store.
void reweightCell(const CaloCell *pCell, double weight)
Reweight a cell with kinematic update.
cell_iterator cell_begin() const
Retrieve a STL-type begin() iterator for the cell store.
CaloCell_ID::CaloSample getSampling() const
cell sampling
static bool Interpolate(const CaloLocalHadCoeff *m_data, const unsigned int n_area, std::vector< float > &x, CaloLocalHadCoeff::LocalHadCoeff &pars, const std::vector< int > &dim, double xfit=0.)
static CaloLocalHadDefs::LocalHadDimensionId getDimensionId(const std::string &dimensionName)
virtual StatusCode weight(xAOD::CaloCluster *theCluster, const EventContext &ctx) const override
std::vector< int > m_interpolateDimensionsFit
actual set of dimension id's to interpolate (in the DM areas corrected with TProfile approach)
Gaudi::Property< bool > m_updateSamplingVars
update also sampling variables
std::vector< int > m_interpolateDimensionsSampling
actual set of dimension id's to interpolate (in the DM areas corrected with sampling weight approach)
StatusCode prepare_for_cluster(const xAOD::CaloCluster *theCluster, std::vector< Area > &areas, std::vector< Cell > &cells, float *smp_energy, float &cls_unweighted_energy, const CaloLocalHadCoeff *data) const
Gaudi::Property< int > m_weightModeDM
method of assignment of DM energy to cluster
std::vector< int > m_interpolateDimensionsLookup
actual set of dimension id's to interpolate (in the DM areas corrected with lookup approach)
virtual StatusCode initialize() override
Gaudi::Property< float > m_MaxChangeInCellWeight
maximum allowed change in cell weights
SG::ReadCondHandleKey< CaloLocalHadCoeff > m_key
name of the key for DM cell weights
Gaudi::Property< bool > m_absOpt
In Abs Option case, DM calculation has to be handled in a slightly different way.
Gaudi::Property< float > m_MinClusterEnergyToDeal
Minimum energy of clusters to apply correction.
Gaudi::Property< int > m_MinLookupBinNentry
minimum number of events in one lookup bin to use
virtual ~CaloLCDeadMaterialTool() override
Gaudi::Property< bool > m_interpolate
interpolate correction coefficients
Gaudi::Property< std::map< std::string, std::vector< std::string > > > m_interpolateDimensionNames
vector of names of dimensions to interpolate (for different correction types different set of dimensi...
Gaudi::Property< bool > m_useHadProbability
calculate DM energy using em-probability moment
Gaudi::Property< float > m_MinCellEnergyToDeal
minimum cell energy to deal
Definition of correction area.
Hold binned correction data for local hadronic calibration procedure.
std::vector< float > LocalHadCoeff
Correction parameters for one general bin.
CaloClusterCellLink::iterator cell_iterator
Iterator of the underlying CaloClusterCellLink (non-const version).
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version).
MomentType
Enums to identify different moments.
@ EM_PROBABILITY
Classification probability to be em-like.
@ DM_WEIGHT
Dead-material weight (E_dm/E_ooc).
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
@ ENG_CALIB_DEAD_TOT
Attached Calibration Hit energy in dead material.
void prefetchNext(Iter iter, Iter endIter)
Prefetch next object in sequence.
Definition prefetch.h:130
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Functions to prefetch blocks of memory.
LocalHadDimensionId
enums to identify user dimensions id number DIMC_* - classification, DIMW_*-weighting,...
MsgStream & msg
Definition testRead.cxx:32