ATLAS Offline Software
Loading...
Searching...
No Matches
CaloNoiseCompCondAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
8// For Gaudi
9#include "GaudiKernel/MsgStream.h"
12#include "GaudiKernel/SystemOfUnits.h"
14
16
17// Exceptions
19
20using Gaudi::Units::GeV;
21
23
24CaloNoiseCompCondAlg::CaloNoiseCompCondAlg(const std::string& name, ISvcLocator* pSvcLocator):
25 AthCondAlgorithm( name, pSvcLocator),
26 m_atlas_id(nullptr),
27 m_calo_id_man(nullptr),
28 m_lar_em_id(nullptr),
29 m_lar_hec_id(nullptr),
30 m_lar_fcal_id(nullptr),
31 m_calocell_id(nullptr),
34 m_nsamples(0),
35 m_SigmaNoise(0.),
36 m_fSampl(0),
37 m_AdcPerMev(5.*GeV),
39
40{
41}
42
44
45StatusCode
47
48 ATH_CHECK( detStore()->retrieve( m_calo_id_man ) );
49 m_calosupercell_id = m_calo_id_man->getCaloCell_SuperCell_ID();
50 m_lar_em_id = m_isSC ? static_cast<const LArEM_Base_ID*>(m_calosupercell_id->em_idHelper()) :
51 static_cast<const LArEM_Base_ID*>(m_calo_id_man->getEM_ID());
52 m_lar_hec_id = m_isSC ? static_cast<const LArHEC_Base_ID*>(m_calosupercell_id->hec_idHelper()) :
53 static_cast<const LArHEC_Base_ID*>(m_calo_id_man->getHEC_ID());
54 m_lar_fcal_id = m_isSC ? static_cast<const LArFCAL_Base_ID*>(m_calosupercell_id->fcal_idHelper()) :
55 static_cast<const LArFCAL_Base_ID*>(m_calo_id_man->getFCAL_ID());
56
57 ATH_CHECK(m_LArOFCObjKey.initialize());
58 ATH_CHECK(m_shapeKey.initialize());
59 ATH_CHECK(m_fSamplKey.initialize());
60 ATH_CHECK(m_LArMinBiasObjKey.initialize());
61 ATH_CHECK(m_cablingKey.initialize());
62 ATH_CHECK(m_adc2mevKey.initialize());
63 ATH_CHECK(m_pedestalKey.initialize(m_noiseKey.empty()));
64 ATH_CHECK(m_noiseKey.initialize(!m_noiseKey.empty()));
65 ATH_CHECK(m_acorrKey.initialize());
66
67 //diagnostic
71
72 //set calohash maximums
73 m_LArHashMax =0;
74 m_LArHashMax = m_lar_em_id->channel_hash_max()
75 + m_lar_hec_id->channel_hash_max()
76 + m_lar_fcal_id->channel_hash_max();
78
79 //set calohash minimum
80 m_CaloHashMin = 0;
81
82 ATH_MSG_DEBUG( " => CaloHashMin= " <<m_CaloHashMin << " CaloHashMax= " <<m_CaloHashMax );
83 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
84 //gain-thresholds
85 m_LowGainThresh[CaloCell_ID::LAREM] = 3900;//ADC counts in MediumGain
86 m_HighGainThresh[CaloCell_ID::LAREM] = 1300;//ADC counts in MediumGain
87 m_LowGainThresh[CaloCell_ID::LARHEC] = 2500;//ADC counts in MediumGain
88 m_HighGainThresh[CaloCell_ID::LARHEC] = 0;//-> high-gain never used for HEC
89
90 m_LowGainThresh[CaloCell_ID::LARFCAL] = 2000.;//ADC counts
91 m_HighGainThresh[CaloCell_ID::LARFCAL] = 1100.;//ADC counts
92
95 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
100
101 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
102
103 ATH_CHECK(m_outputElecKey.initialize());
104 ATH_CHECK(m_outputPileupKey.initialize());
105
106 ATH_CHECK( m_caloMgrKey.initialize() );
107 ATH_CHECK( m_caloSCMgrKey.initialize(m_isSC) );
108
109 return StatusCode::SUCCESS;
110}
111
113
114StatusCode
116
117 const EventContext& ctx = Gaudi::Hive::currentContext();
118
119 if(m_isSC) {
121 if(!caloSCMgrHandle.isValid()) {
122 ATH_MSG_ERROR( "Do not have CaloSuperCellDetDescrMgr");
123 return StatusCode::FAILURE;
124 }
125
126 m_calo_dd_man = static_cast<const CaloDetDescrManager_Base*>(*caloSCMgrHandle);
127
128 } else {
130 if(!caloMgrHandle.isValid()) {
131 ATH_MSG_ERROR( "Do not have CaloDetDescrMgr");
132 return StatusCode::FAILURE;
133 }
134
135 m_calo_dd_man = static_cast<const CaloDetDescrManager_Base*>(*caloMgrHandle);
136 }
137 m_calocell_id = m_calo_dd_man->getCaloCell_ID();
138
139
140 //Set up write handles
143
144 if (writeElecHandle.isValid() && writePileupHandle.isValid()) {
145 ATH_MSG_DEBUG("Found valid write handles");
146 return StatusCode::SUCCESS;
147 }
148
149 //Start with infinite range and narrow it down
150 const EventIDRange fullRange=IOVInfiniteRange::infiniteMixed();
151 writeElecHandle.addDependency (fullRange);
152 writePileupHandle.addDependency (fullRange);
153
154 // Read input conditions
156 if(!cablingHdl.isValid()) {
157 ATH_MSG_ERROR( "Do not have cabling");
158 return StatusCode::FAILURE;
159 }
160 m_cabling=*cablingHdl;
161 writeElecHandle.addDependency (cablingHdl);
162 writePileupHandle.addDependency (cablingHdl);
163
165 const LArADC2MeV* adc2mev{*adc2mevHdl};
166 if(!adc2mev) {
167 ATH_MSG_ERROR( "Do not have adc2mev");
168 return StatusCode::FAILURE;
169 }
170 writeElecHandle.addDependency (adc2mevHdl);
171 writePileupHandle.addDependency (adc2mevHdl);
172
173 if(m_noiseKey.empty()) {
175 if(!pedHdl.isValid()){
176 ATH_MSG_ERROR( "Do not have pedestals");
177 return StatusCode::FAILURE;
178 }
179 m_ped=*pedHdl;
180 writeElecHandle.addDependency (pedHdl);
181 } else {
182 auto noiseHdl=SG::ReadCondHandle<ILArNoise>(m_noiseKey, ctx);
183 if(!noiseHdl.isValid()){
184 ATH_MSG_ERROR( "Do not have noise");
185 return StatusCode::FAILURE;
186 }
187 m_noise=*noiseHdl;
188 writeElecHandle.addDependency (noiseHdl);
189
190 }
191
193 if(!acorrHdl.isValid()){
194 ATH_MSG_ERROR( "Do not have autocorr");
195 return StatusCode::FAILURE;
196 }
197 m_acorr=*acorrHdl;
198 writeElecHandle.addDependency (acorrHdl);
199
201 if(!ofcHdl.isValid()){
202 ATH_MSG_ERROR( "Do not have ofc");
203 return StatusCode::FAILURE;
204 }
205 m_ofccond=*ofcHdl;
206 writeElecHandle.addDependency (ofcHdl);
207 writePileupHandle.addDependency (ofcHdl);
208
209 auto shapeHdl=SG::ReadCondHandle<ILArShape>(m_shapeKey, ctx);
210 if(!shapeHdl.isValid()){
211 ATH_MSG_ERROR( "Do not have shape");
212 return StatusCode::FAILURE;
213 }
214 m_shapecond=*shapeHdl;
215 writeElecHandle.addDependency (shapeHdl);
216 writePileupHandle.addDependency (shapeHdl);
217
218 auto fsamplHdl=SG::ReadCondHandle<ILArfSampl>(m_fSamplKey, ctx);
219 if(!fsamplHdl.isValid()){
220 ATH_MSG_ERROR( "Do not have fSampl");
221 return StatusCode::FAILURE;
222 }
223 m_fsamplcond=*fsamplHdl;
224 writePileupHandle.addDependency (fsamplHdl);
225
226
228 if(!minbiasHdl.isValid()){
229 ATH_MSG_ERROR( "Do not have minbias");
230 return StatusCode::FAILURE;
231 }
232 m_minbias=*minbiasHdl;
233 writePileupHandle.addDependency (minbiasHdl);
234
235 ATH_CHECK(this->initData(adc2mev));
236
237 //Create the CaloNoise CDO:
238 std::unique_ptr<CaloNoise> elecNoiseObj=std::make_unique<CaloNoise>(m_LArHashMax,m_nGains, 0,4,
240 std::unique_ptr<CaloNoise> pileupNoiseObj=std::make_unique<CaloNoise>(m_LArHashMax,m_nGains, 0,4,
242 //Get writeable access to underlying storage (boost::multi_array)
243 auto& elecnoise = elecNoiseObj->larStorage();
244 auto& pileupnoise = pileupNoiseObj->larStorage();
245
246 for(unsigned ihash=m_CaloHashMin; ihash < m_CaloHashMax; ++ihash) {
247
248 Identifier id=m_calocell_id->cell_id(ihash);
249 auto dde=m_calo_dd_man->get_element(id);
250 auto elec3gains = elecNoiseRMS3gains(dde);
251 auto pns = pileupNoiseRMS(dde,m_Nminbias);
252
253 for (unsigned igain=0;igain<m_nGains;++igain) {
254 elecnoise[igain][ihash] = elec3gains[igain];
255 pileupnoise[igain][ihash] = pns;
256 }
257 }
258
259 // store output
260 ATH_CHECK(writeElecHandle.record(std::move(elecNoiseObj)));
261 ATH_MSG_INFO("recorded new CaloNoise object with key " << writeElecHandle.key() << " and range " << writeElecHandle.getRange());
262
263 ATH_CHECK(writePileupHandle.record(std::move(pileupNoiseObj)));
264 ATH_MSG_INFO("recorded new CaloNoise object with key " << writePileupHandle.key() << " and range " << writePileupHandle.getRange());
265
266 return StatusCode::SUCCESS;
267}
268
269
270
272
273StatusCode
275{
276 //initialize the maps m_ElecNoiseContainer and m_ScaleContainer
277 //(assuming type of elements of the containers is the same for LAr)
278
279 ATH_MSG_INFO( "initContainers() begin " );
280
281 // intialise indices
282 ATH_CHECK(this->initIndex());
283
284 //::::::::::::::::::::::::::::::::::::::
289 //::::::::::::::::::::::::::::::::::::::
290 ATH_MSG_INFO( "initContainers() end : " <<" size of containers = " <<m_idSymmCaloHashContainer.size() );
291 return StatusCode::SUCCESS;
292}
293
295
296StatusCode
298 //::::::::::::::::::::::::::::::::::::::
299 m_indexContainer.clear();
301 static_cast<unsigned int> (-1));
302
303 //maybe the other container sould be reset
305 m_idSymmCaloHashContainer.reserve(5000);
306
307
308
309 for (unsigned int intIdCaloHash=m_CaloHashMin; intIdCaloHash<m_CaloHashMax;
310 ++intIdCaloHash)
311 {
312
313
314 IdentifierHash idCaloHash=static_cast<IdentifierHash>(intIdCaloHash);
315
316 // initialize the vector of indexes (big vector without symmetry)
317
318
319
320
321 // o idCaloHash -> id -> idSymm (symmetry phi->0 and z->|z|)
322 // o idSymm -> idSymmCaloHash
323 // o idSymmCaloHash stored in m_idSymmCaloHashContainer
324 // o an index is associated to an idSymmCaloHash
325 // o index stored in m_indexContainer
326
327 CaloCell_ID::SUBCALO iCalo = this->caloNum(idCaloHash);
328 Identifier id = m_calocell_id->cell_id(idCaloHash);
329 Identifier regId;
330 Identifier idSymm;
331 IdentifierHash idSymmCaloHash;
332
333 if(m_UseSymmetry){
334 if(iCalo==CaloCell_ID::LAREM)
335 {
336 int barrel_ec = m_lar_em_id->barrel_ec(id);
337 int sampling = m_lar_em_id->sampling(id);
338 int region = m_lar_em_id->region(id);
339 int eta = m_lar_em_id->eta(id);
340 regId = m_lar_em_id->region_id(abs(barrel_ec),sampling,region);
341 idSymm = m_lar_em_id->channel_id(regId,
342 eta,
343 m_calocell_id->phi_min(regId));
344 idSymmCaloHash= m_calocell_id->calo_cell_hash(idSymm);
345 }
346 else if(iCalo==CaloCell_ID::LARHEC)
347 {
348 int pos_neg = m_lar_hec_id->pos_neg(id);
349 int sampling = m_lar_hec_id->sampling(id);
350 int region = m_lar_hec_id->region(id);
351 int eta = m_lar_hec_id->eta(id);
352 regId = m_lar_hec_id->region_id(abs(pos_neg),sampling,region);
353 idSymm = m_lar_hec_id->channel_id(regId,
354 eta,
355 m_calocell_id->phi_min(regId));
356 idSymmCaloHash= m_calocell_id->calo_cell_hash(idSymm);
357 }
358 else if(iCalo==CaloCell_ID::LARFCAL)
359 {
360 int pos_neg = m_lar_fcal_id->pos_neg(id);
361 int module = m_lar_fcal_id->module(id);
362 int eta = m_lar_fcal_id->eta(id);
363 int phi = m_lar_fcal_id->phi(id);
364 if(phi>7) phi = phi-8; //as in LArMCSymTool
365 regId = m_lar_fcal_id->module_id(abs(pos_neg),module);
366 idSymm = m_lar_fcal_id->channel_id(regId,
367 eta,
368 phi);
369 idSymmCaloHash= m_calocell_id->calo_cell_hash(idSymm);
370 }
371 else if(iCalo==CaloCell_ID::TILE)
372 {
373 idSymm = id;
374 idSymmCaloHash = m_calocell_id->calo_cell_hash(idSymm);
375 }
376 else
377 {
378 ATH_MSG_WARNING("CaloNoiseCompCondAlg::chooseIndex wrong id ! " << m_lar_em_id->show_to_string(id));
379 continue ;
380 }
381
382 assert (idSymmCaloHash < m_CaloHashMax);
383 if (m_indexContainer[idSymmCaloHash] != static_cast<unsigned int>(-1)) {
384 m_indexContainer[idCaloHash] = m_indexContainer[idSymmCaloHash];
385 continue;
386 }
387 }
388 else idSymmCaloHash=idCaloHash;// no symmetry
389
390
391 if(iCalo!=CaloCell_ID::TILE) {
392 if(this->checkIfConnected(id)==false) {
393 continue;
394 }
395 }
396
397
398 /* cabling eta= 0 -> 0.8 (for private debug)
399 int samp = m_lar_em_id->sampling(id);
400 int region= m_lar_em_id->region(id);
401 int eta = m_lar_em_id->eta(id);
402 int phi = m_lar_em_id->phi(id);
403 if(samp==1 && eta>=256) return;
404 if(samp==1 && eta==0) return;
405 if(samp==2 && eta>=32) return;
406 if(samp==3 && eta>=16) return;
407 if(region>0) return;
408 */
409
410
411 //we come here if idSymmHash is not yet indexed (and is connected)
412 m_indexContainer[idCaloHash] =
413 m_indexContainer[idSymmCaloHash] =
415
416 m_idSymmCaloHashContainer.push_back(idSymmCaloHash);
417 }// loop on all cells
418
419 return StatusCode::SUCCESS;
420}
421
423
424bool
426{
427 try
428 {
429 HWIdentifier hwid = m_cabling->createSignalChannelID(id);
430 if(!m_cabling->isOnlineConnected(hwid))
431 {
432 return false;
433 }
434 }
435 catch(LArID_Exception & except)
436 {return false;}
437 return true;
438}
439
441
442int
444{
445 return m_indexContainer[idCaloHash];
446}
447
448
450
451StatusCode
453{
454
455 StatusCode sc ;
456 sc = this->initContainers();
457 if (sc.isFailure()) {
458 ATH_MSG_WARNING( "initContainers failed" ) ;
459 return sc;
460 }
461
462 // reset diagnostics
464 for(int igain=0;igain<maxgain;++igain)
465 {
466 m_nCellsWithProblem[igain]=0;
467 for(int i=0;i<5000;++i) m_nReason[i][igain]=0;
468 for(int i=0;i<10;++i) m_itReason[i][igain]=0;
469 }
470
471
472 //stores the Adc2MeV factors
473 sc = this->initAdc2MeV(adc2mev);
474 if (!sc.isSuccess())
475 ATH_MSG_ERROR( "initData(): error with initAdc2MeV() " );
476
477 //calculates and stores the electronic noise
478 sc = this->initElecNoise();
479 if (!sc.isSuccess())
480 ATH_MSG_ERROR( "initData(): error with initElecNoise() " );
481
482 //calculates and stores the pileup noise
483 sc = this->initPileUpNoise();
484 if (!sc.isSuccess())
485 ATH_MSG_ERROR( "initData(): error with initPileUpNoise() ");
486
487
488 return StatusCode::SUCCESS;
489}
490
492
493StatusCode
495{
496 ATH_MSG_INFO( "initAdc2MeV() begin " );
497 for (unsigned int it=0; it<m_adc2mevContainer.size(); ++it)
498 {
501 //::::::::::::::::::::::::::::::::::::::
502 //::::::::::::::::::::::::::::::::::::::
503 if(iCalo!=CaloCell_ID::TILE)
504 {
505 std::vector<float>& adc2mevVector = m_adc2mevContainer[it];
506 unsigned int maxgain = m_isSC ? CaloGain::LARMEDIUMGAIN : CaloGain::LARNGAIN;
507 adc2mevVector.reserve (maxgain);
508 for(unsigned int igain=0;igain<maxgain;++igain)
509 {
510 auto polynom_adc2mev = adc2mev->ADC2MEV(id,igain);
511 if(polynom_adc2mev.size()==0)
512 adc2mevVector.push_back(0.);
513 else
514 adc2mevVector.push_back(polynom_adc2mev[1]);
515 }
516 }
517 //::::::::::::::::::::::::::::::::::::::
518 }
519 ATH_MSG_INFO( "initAdc2MeV() end " );
520 return StatusCode::SUCCESS;
521}
522
524
525StatusCode
527{
528 // initialize the parameters (the same for each event for each Identifier)
529 // for the calculation of the electronic noise
530
531
532 MsgStream log( msgSvc(), name() );
533 ATH_MSG_DEBUG( "initElecNoise() begin " );
534
535 for (unsigned int it=0; it<m_elecNoiseCELLContainer.size(); ++it)
536 {
537 //::::::::::::::::::::::::::::::::::::::
540 //::::::::::::::::::::::::::::::::::::::
541 }
542 ATH_MSG_INFO("it filled");
543
544 //print diagnostic
546 for(int igain=0;igain<maxgain;++igain)
547 if(m_diagnostic[igain])
548 {
549 ATH_MSG_INFO("===== Diagnostic for gain "<<igain<<" =====");
550 for(int i=0;i<m_nCellsWithProblem[igain];++i)
551 {
552 Identifier id = m_calocell_id->cell_id(m_idHash[i][igain]);
553 log<<MSG::DEBUG<<m_idHash[i][igain]<<" "
554 <<m_lar_em_id->show_to_string(id)
555 <<" "<<m_nReason[i][igain]<<" : ";
556 for(int j=0;j<m_nReason[i][igain];++j)
557 log<<MSG::DEBUG<<m_reasonName[m_reason[i][j][igain]]<<" ";
558 log << MSG::DEBUG<<endmsg;
559 }
560 log<<MSG::DEBUG<<endmsg;
561 ATH_MSG_INFO("N cells with problem(s) = " <<m_nCellsWithProblem[igain]);
562 for(int i=0;i<10;++i)
563 if(m_itReason[i][igain]>0)
564 ATH_MSG_INFO( i<<" "<<m_reasonName[i] <<": for "<<m_itReason[i][igain]<<" cells" );
565 }
566
567 ATH_MSG_DEBUG( "initElecNoise() end " );
568 return StatusCode::SUCCESS;
569}
570
572
573StatusCode
575{
576 // initialize the parameters (the same for each event for each Identifier)
577 // for the calculation of the PileUp noise
578
579 ATH_MSG_DEBUG( "initPileUpNoise() begin " );
580 ATH_MSG_INFO( "N events of Minimum Bias per bunch crossing = " << m_Nminbias);
581 //::::::::::::::::::::::::::::::::::::::
582 for (unsigned int it=0; it<m_pileupNoiseContainer.size(); ++it)
585 //::::::::::::::::::::::::::::::::::::::
586 ATH_MSG_DEBUG( "initPileUpNoise() end " );
587 return StatusCode::SUCCESS;
588}
589
591
592std::vector<float>
594{
595 /*
596
597E=SUMi { OFCi * (short[ (PulseShapei*Ehit/Adc2MeV(gain) + Noisei(gain)
598 + pedestal) ]
599 - pedestal) * Adc2Mev(gain) ] }
600 with Noisei =SUMj { cij*Rndm } * m_SigmaNoise
601
602 NB: without short and with cij=identity (no autocorrelation)
603 E=SUMi { NOISEi(gain)*Rndm }
604 with NOISEi(gain) = Adc2MeV(gain) * OFCi * m_SigmaNoise(gain)
605
606 => Sigma^2=SUMi{NOISEi(gain)*NOISEj(gain)*cij} + quantification part
607 = NOISE(gain) + REST
608 Sigma = std::sqrt( NOISE(gain) + REST)
609
610
611*/
612
614 std::vector<float> sigmaVector (maxgain,BADVALUE);
615 float sigma;
616
617 Identifier id = m_calocell_id->cell_id(idCaloHash);
618
619 for(int igain=0;igain<maxgain;++igain)
620 {
621 bool noiseOK=true;
622 //::::::::::::::::::::::::::::::::::::::::::::::::::
623 //==== retrieve the database ====
624 //::::::::::::::::::::::::::::::::::::::::::::::::::
625
626 std::vector<bool> retrieve(nDATABASE,false);
627 retrieve[iADC2MEV]=true;
628 retrieve[iSIGMANOISE]=true;
629 retrieve[iAUTOCORR]=true;
630 retrieve[iOFC]=true;
631 //retrieve[iSHAPE]=true;
632 StatusCode sc=this->retrieveCellDatabase(idCaloHash,id,igain, retrieve);
633 //if(sc.isFailure()) continue;
634 //NOTE: if an element of the database is empty,
635 // leave the iteration (on gains) => value will be BADVALUE
636 //the interfaces take care of that !
637
638 //::::::::::::::::::::::::::::::::::::::::::::::::::
639 //==== calculations ====
640 //::::::::::::::::::::::::::::::::::::::::::::::::::
641
642 if(sc.isFailure()) {
643 sigma=float(BADVALUE_TO_RETURN);
644 }
645 else
646 {
647 float OFC_AC_OFC,OFC_OFC;
648 this->commonCalculations(OFC_AC_OFC,OFC_OFC,1);
649 //::::::::::::::::::::::::::::::::::::::
650 float NOISE= OFC_AC_OFC*m_SigmaNoise*m_SigmaNoise ;
651 float REST = OFC_OFC*(1./12.);// 12.=std::sqrt(12)*std::sqrt(12)
652 sigma=(NOISE+REST) * m_Adc2MeVFactor*m_Adc2MeVFactor;
653 //::::::::::::::::::::::::::::::::::::::
654 if(sigma>0) sigma=std::sqrt(sigma);
655 else
656 {
657 sigma=-std::sqrt(-sigma);
658 //:::::::::::::::::
659 // if(igain==0) log << MSG::ERROR
660 // <<m_lar_em_id->show_to_string(id)<<" gain "<<igain
661 // <<" : negative root square => WRONG noise "
662 // <<"(please check if OFC or AutoCorr are correct for this cell)"
663 // <<endreq;
664 }
665
666 //diagnostic
667 if(m_diagnostic[igain])
668 {
669 if(noiseOK && sigma<0)
670 this->updateDiagnostic(9,"sigma<0",igain, noiseOK);
671 if(!noiseOK)
672 {
673 m_idHash[m_nCellsWithProblem[igain]][igain]=idCaloHash;
674 ++m_nCellsWithProblem[igain];
675 m_nReason[m_nCellsWithProblem[igain]][igain]=0;
676 }
677 }
678 //::::::::::::::::::::::::::::::::::::::
679 if(noiseOK==false || sigma<0) sigma=float(BADVALUE_TO_RETURN);
680 }
681 sigmaVector[igain]=sigma;
682
683 }//loop on gains
684
685 return sigmaVector;
686}
687
689
690
691float
693 const float &Nminbias)
694{
695 if(Nminbias<=0.000001) return 0.;
696 //only on WorkMode==1
697 if(this->caloNum(idCaloHash)==CaloCell_ID::TILE) return 0.;
698 //no pile-up for tiles, for the moment ...
699
700 /*
701 SigmaPileUp^2 = ( SigmaE * std::sqrt(Nmb) )^2 * Ipileup/Tc
702 where:
703 - Ipileup = Tc * SUM(k=1->Nb) g(tk)^2
704 - Tc is the time between bunch crossings
705 - Nb is the number of bunch crossings
706 (over which the response function is non-zero)
707 - g is the shape
708 - SigmaE is the RMS of the energy in 1 minimum bias event
709 - Nmb is the number of minimum bias events (depending on the luminosity)
710 */
711
712 Identifier id = m_calocell_id->cell_id(idCaloHash);
713
714 //::::::::::::::::::::::::::::::::::::::
715
716 std::vector<bool> retrieve(nDATABASE,false);
717 retrieve[iAUTOCORR]=true;
718 retrieve[iOFC]=true;
719 retrieve[iSHAPE]=true;
720 retrieve[iMINBIASRMS]=true;
721 retrieve[iFSAMPL]=true;
722 StatusCode sc=this->retrieveCellDatabase(idCaloHash,id,
723 CaloGain::LARHIGHGAIN,retrieve);
724 if(sc.isFailure()) return 0.;
725
726 //::::::::::::::::::::::::::::::::::::::
727
728 //in the database, RMS is at the scale of the Hits,
729 // so we need to scale it at the e.m scale using the sampling fraction ...
731
732 //::::::::::::::::::::::::::::::::::::::
733
734// overall normalization factor
735 float PileUp=m_MinBiasRMS*std::sqrt(Nminbias);
736
737 //::::::::::::::::::::::::::::::::::::::
738
739 float OFC_AC_OFC,OFC_OFC;
740 unsigned int firstSample=m_firstSample;
741 // for HEC, always use firstSample=1 when the number of samples is 4
742 if (m_lar_hec_id->is_lar_hec(id) && m_nsamples==4 && m_firstSample==0u) firstSample=1;
743 this->commonCalculations(OFC_AC_OFC,OFC_OFC,2,firstSample);
744
745 //::::::::::::::::::::::::::::::::::::::
746
747 PileUp*=std::sqrt(OFC_AC_OFC);
748
749 return PileUp;
750}
751
753
754void
755CaloNoiseCompCondAlg::commonCalculations(float & OFC_AC_OFC,float & OFC_OFC,int icase, unsigned int firstSample)
756{
757
758 // case 1 electronic noise
759 if (icase==1) {
760 //calculate the matrix of autocorrelation
761 for(int i=0;i<m_nsamples;++i)
762 for(int j=0;j<m_nsamples;++j)
763 {
764 if(i==j) m_c[i][j] = 1.;
765 for(int k=1;k<m_nsamples;++k)
766 if(i==j-k || i==j+k)
767 m_c[i][j] = m_AutoCorr[k-1];
768 }
769 }
770// other case: pileup noise
771 else {
772 for (int i=0;i<m_nsamples;i++) {
773 for (int j=0;j<m_nsamples;j++)
774 {
775 m_c[i][j]=0.;
776 int nsize = m_Shape.size();
777 for (int k=0;k<nsize;k++) {
778 if ((j-i+k)>=0 && (j-i+k)<nsize) {
779 int ibunch=0;
780 if ((i+firstSample-k)%m_deltaBunch == 0 ) ibunch=1;
781 m_c[i][j] += ((double) (ibunch)) * (m_Shape[k]) * (m_Shape[j-i+k]);
782 }
783 }
784 }
785 }
786 }
787
788 //::::::::::::::::::::::::::::::::::::::
789 OFC_AC_OFC=0;
790 OFC_OFC=0;
791
792 float tmp;
793 for(int i=0;i<m_nsamples;++i)
794 {
795 tmp=0.;
796 for(int j=0;j<m_nsamples;++j)
797 tmp+=m_c[i][j]*m_OFC[j];
798 tmp*=m_OFC[i];
799 OFC_AC_OFC+=tmp;
800 OFC_OFC+= m_OFC[i] * m_OFC[i];
801 }
802 //::::::::::::::::::::::::::::::::::::::
803}
804
806
807StatusCode
809 const Identifier & id,
810 int igain,
811 std::vector<bool> &retrieve)
812{
813 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
814 //ADC2MEV
815 if(retrieve[iADC2MEV])
816 {
817 {
818 int index=this->index(idCaloHash);
820 }
821 }
822
823 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
824 //SIGMANOISE
825 if(retrieve[iSIGMANOISE])
826 {
827 if(m_ped) {
828 m_RMSpedestal = m_ped->pedestalRMS(m_cabling->createSignalChannelID(id),igain);
831 else
832 {
833 m_SigmaNoise = 0.;
834 }
835 } else {
836 m_SigmaNoise = m_noise->noise(m_cabling->createSignalChannelID(id),igain);
837
838 }
839 }
840
841 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
842 //AUTOCORR
843 if(retrieve[iAUTOCORR])
844 {
845 m_AutoCorr = m_acorr->autoCorr(m_cabling->createSignalChannelID(id),igain);
847 ATH_MSG_VERBOSE("AutoCorr= ");
848 for(unsigned int i=0;i<m_AutoCorr.size();++i)
850 }
851
852 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
853 //OFC
854 if(retrieve[iOFC])
855 {
856 m_OFC = m_ofccond->OFC_a(m_cabling->createSignalChannelID(id), igain) ;
858 ATH_MSG_VERBOSE("OFC= ");
859 for(unsigned int i=0;i<m_OFC.size();++i)
860 ATH_MSG_VERBOSE(m_OFC[i]<<" ");
861 }
862
863 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
864 //SHAPE
865 if(retrieve[iSHAPE])
866 {
867 m_Shape = m_shapecond->Shape(m_cabling->createSignalChannelID(id),0);
869 ATH_MSG_VERBOSE("Shape= ");
870 for(unsigned int i=0;i<m_Shape.size();++i)
871 ATH_MSG_VERBOSE(m_Shape[i]<<" ");
872 }
873
874 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
875 //MinimumBias RMS
876 if(retrieve[iMINBIASRMS])
877 {
878 m_MinBiasRMS = m_minbias->minBiasRMS(m_cabling->createSignalChannelID(id));
879 ATH_MSG_VERBOSE("MinBiasRMS="<<m_MinBiasRMS);
880 }
881
882 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
883 //SAMPLING FRACTION
884 if(retrieve[iFSAMPL])
885 {
886 m_fSampl = m_fsamplcond->FSAMPL(m_cabling->createSignalChannelID(id));
887 ATH_MSG_VERBOSE("fSampl="<<m_fSampl);
888 }
889
890 return this->checkCellDatabase(id,igain, retrieve);
891}
892
894
895StatusCode
896CaloNoiseCompCondAlg::checkCellDatabase(const Identifier & id, int igain, std::vector<bool> &retrieve)
897{
898 StatusCode StatusDatabase=StatusCode::SUCCESS;
899
900 ATH_MSG_DEBUG("checkCellDatabase starts for "<<id.get_identifier32().get_compact()<<" gain: "<<igain);
901 bool dummy=false;
902 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
903 //ADC2MEV
904 if(retrieve[iADC2MEV]) {
905 if(std::fabs(m_Adc2MeVFactor)<0.000001) {
906 StatusDatabase=StatusCode::FAILURE;
907 if(m_diagnostic[igain])
908 this->updateDiagnostic(0,"m_Adc2MeVFactor=0",igain,dummy);
909 }
910 }
911
912 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
913 //SIGMANOISE
914 if(retrieve[iSIGMANOISE]) {
915 if(std::fabs(m_SigmaNoise)<0.000001) {
916 StatusDatabase=StatusCode::FAILURE;
917 if(m_diagnostic[igain])
918 this->updateDiagnostic(1,"m_SigmaNoise=0",igain,dummy);
919 }
920 }
921
922 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
923 //AUTOCORR
924 if(retrieve[iAUTOCORR])
925 {
926 if (!m_AutoCorr.valid())
927 {
928 ATH_MSG_WARNING( " AutoCorr invalid for " <<m_lar_em_id->show_to_string(id)<<" at gain "<<igain);
929 StatusDatabase=StatusCode::FAILURE;
930 }
931 if (m_AutoCorr.size()==0)
932 {
933 StatusDatabase=StatusCode::FAILURE;
934 if(m_diagnostic[igain]) this->updateDiagnostic(2,"AC empty",igain,dummy);
935 }
936 // autocorr can be null (and it is for low-gain !), so allow it !
937 m_nsamples=m_AutoCorr.size()+1;
938 }
939
940 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
941 //OFC
942 if(retrieve[iOFC])
943 {
944 if (!m_OFC.valid())
945 {
946 ATH_MSG_WARNING( " OFC pointer null for " <<m_lar_em_id->show_to_string(id)<<" at gain "<<igain);
947 StatusDatabase=StatusCode::FAILURE;
948 }
949 if (m_OFC.size()==0)
950 {
951 StatusDatabase=StatusCode::FAILURE;
952 if(m_diagnostic[igain]) this->updateDiagnostic(4,"OFC empty",igain,dummy);
953 }
954 else
955 if(m_diagnostic[igain])
956 {
957 unsigned int n_OFCnull=0;
958 for(auto ofc : m_OFC)
959 if(std::fabs(ofc)<0.000001) ++n_OFCnull;
960 if(n_OFCnull==m_OFC.size()) this->updateDiagnostic(5,"OFC=0",igain,dummy);
961 }
962 m_nsamples=m_OFC.size();
963 }
964
965 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
966 //SHAPE
967 if(retrieve[iSHAPE])
968 {
969 if (!m_Shape.valid())
970 {
971 ATH_MSG_WARNING( " Shape pointer null -> PileUp will be 0 for " <<m_lar_em_id->show_to_string(id) );
972 StatusDatabase=StatusCode::FAILURE;
973 }
974 if (m_Shape.size()==0)
975 {
976 // log<<MSG::WARNING
977 // <<" Shape vector empty -> PileUp will be 0 for "
978 // <<m_lar_em_id->show_to_string(id)<<endreq;
979 StatusDatabase=StatusCode::FAILURE;
980 if(m_diagnostic[igain]) this->updateDiagnostic(6,"Shape empty",igain,dummy);
981 }
982 else
983 if(m_diagnostic[igain])
984 {
985 unsigned int n_SHAPEnull=0;
986 for(auto shp : m_Shape)
987 if(std::fabs(shp)<0.000001) ++n_SHAPEnull;
988 if(n_SHAPEnull==m_Shape.size())
989 this->updateDiagnostic(7,"Shape=0",igain,dummy);
990 }
991 }
992
993 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
994 //NSAMPLES
995 if(retrieve[iOFC] && retrieve[iAUTOCORR]
996 && m_OFC.size()!=m_AutoCorr.size()+1)
997 {
998 m_nsamples=std::min(m_OFC.size(),m_AutoCorr.size()+1);
999 ATH_MSG_DEBUG( "AutoCorr and OFC vectors have not the same " <<"number of elements" <<" ("<<m_AutoCorr.size()<<"/"<<m_OFC.size() <<" ) => will take into account only " << m_nsamples << " samples !" );
1000 }
1001
1002 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1003 if(retrieve[iOFC] && retrieve[iSHAPE] && m_OFC.size()==m_Shape.size())
1004 {
1005 float scalar=0;
1006 for(unsigned int i=0;i<m_Shape.size();++i)
1007 scalar+=m_Shape[i]*m_OFC[i];
1008 if((scalar-1)>0.05)
1009 this->updateDiagnostic(8,"[Shape].[OFC] not 1",igain,dummy);
1010 }
1011
1012 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1013 //SAMPLING FRACTION
1014 if(retrieve[iFSAMPL])
1015 {
1016 if (m_fSampl<0.000001)
1017 {
1018 ATH_MSG_WARNING(" fSampl null -> PileUp will be 0 for " <<m_lar_em_id->show_to_string(id) );
1019 StatusDatabase=StatusCode::FAILURE;
1020 }
1021 }
1022
1023 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1024 ATH_MSG_DEBUG("checkCellDatabase "<<id.get_identifier32().get_compact()<<" status: "<<StatusDatabase);
1025 return StatusDatabase;
1026}
1027
1029
1030void
1031CaloNoiseCompCondAlg::updateDiagnostic(int ireason,const std::string &nameReason,int igain, bool &noiseOK)
1032{
1033 int nTmp=m_nCellsWithProblem[igain];
1034 if (nTmp >= 5000) return;
1035 int nr = m_nReason[nTmp][igain];
1036 if (nr >= 10) return;
1037 m_reason[nTmp][nr][igain]=ireason;
1038 m_reasonName[ireason]=nameReason;
1039 ++m_nReason[nTmp][igain];
1040 ++m_itReason[ireason][igain];
1041 noiseOK=false;
1042}
1043
1045
1046
1047//======================== USER INTERFACES ===================================
1048
1049
1051
1052float
1054 const CaloGain::CaloGain gain)
1055{
1056
1057
1058 float sigma=0.;
1059
1060 const IdentifierHash idCaloHash = caloDDE->calo_hash();
1061 //CaloCell_ID::SUBCALO iCalo = this->caloNum(idCaloHash);
1062 CaloCell_ID::SUBCALO iCalo = caloDDE->getSubCalo();
1063 int index=this->index(idCaloHash);
1064
1065
1066 int igain=static_cast<int>(gain);//for LAr
1067 if(iCalo==CaloCell_ID::TILE) //for Tile
1068 {
1069 CaloGain::CaloGain convertedGain;
1070 switch(gain)
1071 {
1072 //convert Tile gain into LAr gain (the one used to store the noise in arrays)
1073 case CaloGain::TILEHIGHHIGH : convertedGain=CaloGain::LARHIGHGAIN; break;
1074 case CaloGain::TILEHIGHLOW : convertedGain=CaloGain::LARMEDIUMGAIN; break;
1075 case CaloGain::TILELOWHIGH : convertedGain=CaloGain::LARMEDIUMGAIN; break;
1076 case CaloGain::TILELOWLOW : convertedGain=CaloGain::LARLOWGAIN; break;
1077 case CaloGain::TILEONEHIGH : convertedGain=CaloGain::LARHIGHGAIN; break;
1078 case CaloGain::TILEONELOW : convertedGain=CaloGain::LARLOWGAIN; break;
1079 default: convertedGain = CaloGain::INVALIDGAIN;
1080 }
1081 igain=static_cast<int>(convertedGain);
1082 }
1083
1084 if (gain==CaloGain::INVALIDGAIN || gain==CaloGain::UNKNOWNGAIN) {
1085 ATH_MSG_WARNING( " ask noise for invalid/unknown gain, will return noise for high gain " );
1086 igain=static_cast<int>(CaloGain::LARHIGHGAIN);
1087 }
1088
1089 if (iCalo<0 || index<0)
1090 {
1091 ATH_MSG_WARNING( "CaloNoiseCompCondAlg::elecNoiseRMS wrong id ! " << "iCalo="<<iCalo << "index="<<index << "id:" << m_lar_em_id->show_to_string(caloDDE->identify()) );
1092 return 0.;
1093 }
1094 else
1095 {
1096 const std::vector<float>* sigmaVector = 0;
1097 sigmaVector = &m_elecNoiseCELLContainer[index];
1098
1099 bool retry=true;
1100 int shift_gain=0;
1101 int gain_wanted=igain;
1102 int gain_shifted=gain_wanted;
1103
1104 while(retry)
1105 {
1106 //:::::::::::::::::
1107 retry=false;
1108 //:::::::::::::::::
1109 gain_shifted=gain_wanted-shift_gain;
1110 //:::::::::::::::::
1111 sigma = (*sigmaVector)[gain_shifted];
1112 //:::::::::::::::::
1113 sigma = this->calculateElecNoiseForLAR(idCaloHash) [gain_shifted];
1114 //:::::::::::::::::
1115 if(this->isBadValue(sigma))
1116 {
1117 ++shift_gain;
1118 if(shift_gain<=igain) retry=true;
1119 ATH_MSG_WARNING( "noise is missing for this cell " << m_lar_em_id->show_to_string(caloDDE->identify()) << " at this gain (" <<gain_wanted<<"), return the noise at next gain (" <<gain_shifted<<")" );
1120 }
1121 //:::::::::::::::::
1122 }
1123 return sigma;
1124 }
1125}
1126
1127
1129
1130std::vector<float>
1132{
1133 std::vector<float> sigma;
1135 sigma.reserve (maxgain);
1136 for(int igain=0;igain<maxgain;++igain)
1137 sigma.push_back(this->elecNoiseRMS(caloDDE,
1138 static_cast<CaloGain::CaloGain>(igain)));
1139 for(int igain=0;igain<maxgain;++igain)
1140 if(this->isBadValue(sigma[igain]) &&
1141 igain!=CaloGain::LARHIGHGAIN)
1142 sigma[igain]=sigma[igain-1];//take the next gain (low->medium->high)
1143 return sigma;
1144}
1145
1146
1148
1149float
1151 const CaloDetDescrElement* caloDDE = theCell->caloDDE();
1152 CaloGain::CaloGain igain = theCell->gain();
1153 return this->elecNoiseRMS(caloDDE, igain);
1154}
1155
1156float
1157
1159 const float Nminbias) {
1160 const CaloDetDescrElement* caloDDE = theCell->caloDDE();
1161 return this->pileupNoiseRMS(caloDDE,Nminbias);
1162}
1163
1164float
1165
1167 const float Nminbias) {
1168 float elecNoiseRMS_tmp = this->elecNoiseRMS(theCell);
1169 float pileupNoiseRMS_tmp = this->pileupNoiseRMS(theCell,Nminbias);
1170
1171 if(elecNoiseRMS_tmp>=0)
1172 return std::sqrt((elecNoiseRMS_tmp*elecNoiseRMS_tmp) + (pileupNoiseRMS_tmp*pileupNoiseRMS_tmp));
1173 return(-1);
1174}
1175
1176
1178
1179
1180float
1182 const float Nminbias)
1183// << base class >>
1184{
1185
1186
1187 const IdentifierHash idCaloHash = caloDDE->calo_hash();
1188 CaloCell_ID::SUBCALO iCalo = this->caloNum(idCaloHash);
1189
1190 if(iCalo!=CaloCell_ID::TILE)
1191 {
1192 int index=this->index(idCaloHash);
1193 float PileUp;
1194 // check if noise stored in container was calcualted with this Nminbias
1195 if ((Nminbias==m_Nminbias) || (Nminbias<=0)) //default
1197 else
1198 PileUp=this->calculatePileUpNoise(idCaloHash,Nminbias);//slower !!
1199 return PileUp;
1200 }
1201 else//TILE
1202 {
1203 return 0.;
1204 }
1205}
1206
1208
1209
1210float
1212 const CaloGain::CaloGain gain,
1213 const float Nminbias)
1214{
1215 float elecNoiseRMS_tmp = this->elecNoiseRMS(caloDDE,gain);
1216 float pileupNoiseRMS_tmp = this->pileupNoiseRMS(caloDDE,Nminbias);
1217
1218 float totalNoiseRMS = -1;
1219
1220 // checks that elecNoise is valid
1221 if(elecNoiseRMS_tmp>0)
1222 totalNoiseRMS= std::sqrt((elecNoiseRMS_tmp*elecNoiseRMS_tmp) + (pileupNoiseRMS_tmp*pileupNoiseRMS_tmp) );
1223
1224 return totalNoiseRMS;
1225}
1226
1228
1229float
1231 const float Nminbias)
1232{
1233 return this->totalNoiseRMSHighestGain(caloCell->caloDDE(),Nminbias);
1234}
1235
1237
1238float
1240 const float Nminbias)
1241{
1242 //getSubCalo can return 999999 (CaloCell_ID::SUBCALO::NOT_VALID)
1243 CaloCell_ID::SUBCALO iCalo = caloDDE->getSubCalo();
1244 if (iCalo == CaloCell_ID::SUBCALO::NOT_VALID){
1245 throw std::runtime_error("Invalid CaloID in CaloNoiseCompCondAlg::totalNoiseRMSHighestGain");
1246 }
1247 CaloGain::CaloGain highestGain=m_highestGain[iCalo];
1248 return this->totalNoiseRMS(caloDDE,highestGain,Nminbias);
1249}
1250
1251
1254
1255float
1257 const CaloGain::CaloGain gain)
1258{
1259
1260 float factor=1.;
1261 IdentifierHash idCaloHash = caloDDE->calo_hash();
1262 CaloCell_ID::SUBCALO iCalo = this->caloNum(idCaloHash);
1263
1264 if(iCalo==CaloCell_ID::LAREM || iCalo==CaloCell_ID::LARHEC)
1265 {
1266 int index=this->index(idCaloHash);
1267 factor=(m_adc2mevContainer[index])[gain];
1268 }
1269 else if(iCalo==CaloCell_ID::LARFCAL)
1270 {
1271 int index=this->index(idCaloHash);
1272 factor=(m_adc2mevContainer[index])[gain];
1273 }
1274 else if(iCalo==CaloCell_ID::TILE)
1275 {
1276 //TILE_PART
1277 ATH_MSG_WARNING("CaloNoiseCompCondAlg::adc2mev(id,gain) : NOT IMPLEMENTED !" <<"for TILE (-> returns 1. for the moment)" );
1278 factor=1.;
1279 }
1280 else
1281 {
1282 MsgStream log( msgSvc(), name() );
1283 ATH_MSG_WARNING("CaloNoiseCompCondAlg::adc2mev(id,gain) wrong id ! " <<m_lar_em_id->show_to_string(caloDDE->identify()) );
1284 factor=0.;
1285 }
1286 return factor;
1287}
1288
1290
1291float
1293{
1294 return adc2mev(m_calo_dd_man->get_element(id),gain);
1295}
1296
1297
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#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_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helper class for offline supercell identifiers.
@ BADVALUE_TO_RETURN
@ iSIGMANOISE
@ iMINBIASRMS
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
Base class for conditions algorithms.
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
CaloGain::CaloGain gain() const
get gain (data member )
Definition CaloCell.h:361
This class groups all DetDescr information related to a CaloCell.
Identifier identify() const override final
cell identifier
virtual StatusCode stop() override final
CaloGain::CaloGain m_highestGain[m_nCalos]
void commonCalculations(float &OFC_AC_OFC, float &OFC_OFC, int icase, unsigned int firstSample=0)
StatusCode checkCellDatabase(const Identifier &id, int igain, std::vector< bool > &retrieve)
float adc2mev(const CaloDetDescrElement *caloDDE, const CaloGain::CaloGain gain)
float pileupNoiseRMS(const CaloCell *caloCell, const float Nminbias=-1)
virtual StatusCode initialize() override final
standard Athena-Algorithm method
StatusCode initData(const LArADC2MeV *adc2mev)
StatusCode retrieveCellDatabase(const IdentifierHash &idCaloHash, const Identifier &id, int igain, std::vector< bool > &retrieve)
int m_itReason[10][m_nGains]
const ILArPedestal * m_ped
std::vector< float > calculateElecNoiseForLAR(const IdentifierHash &idCaloHash)
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager > m_caloSCMgrKey
int index(const IdentifierHash &idCaloHash)
std::vector< float > elecNoiseRMS3gains(const CaloDetDescrElement *caloDDE)
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
void updateDiagnostic(int reason, const std::string &reason_name, int igain, bool &noiseOK)
int m_reason[5000][10][m_nGains]
float totalNoiseRMS(const CaloCell *caloCell, const float Nminbias=-1)
SG::WriteCondHandleKey< CaloNoise > m_outputPileupKey
int m_nReason[5000][m_nGains]
const ILArAutoCorr * m_acorr
VectorContainer m_elecNoiseCELLContainer
VectorContainer m_adc2mevContainer
float m_HighGainThresh[m_nCalos]
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
SG::ReadCondHandleKey< ILArNoise > m_noiseKey
const ILArfSampl * m_fsamplcond
SG::ReadCondHandleKey< ILArAutoCorr > m_acorrKey
SG::ReadCondHandleKey< ILArShape > m_shapeKey
int m_idHash[5000][m_nGains]
const LArOnOffIdMapping * m_cabling
StatusCode initAdc2MeV(const LArADC2MeV *adc2mev)
std::vector< IdentifierHash > m_idSymmCaloHashContainer
VectorContainer m_elecNoiseRAWContainer
float m_LowGainThresh[m_nCalos]
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
UnsignedIntegerProperty m_firstSample
SG::ReadCondHandleKey< ILArOFC > m_LArOFCObjKey
const LArEM_Base_ID * m_lar_em_id
const AtlasDetectorID * m_atlas_id
const ILArMinBias * m_minbias
static constexpr int m_nGains
SingleContainer m_pileupNoiseContainer
SG::WriteCondHandleKey< CaloNoise > m_outputElecKey
CaloCell_ID::SUBCALO caloNum(const IdentifierHash idCaloHash)
CaloNoiseCompCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
const CaloIdManager * m_calo_id_man
const ILArShape * m_shapecond
const CaloDetDescrManager_Base * m_calo_dd_man
float totalNoiseRMSHighestGain(const CaloCell *caloCell, const float Nminbias=-1)
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKey
SG::ReadCondHandleKey< ILArMinBias > m_LArMinBiasObjKey
const LArFCAL_Base_ID * m_lar_fcal_id
bool checkIfConnected(const Identifier &id)
bool isBadValue(float tested_value)
std::vector< IdentifierHash > m_indexContainer
const CaloCell_SuperCell_ID * m_calosupercell_id
const CaloCell_Base_ID * m_calocell_id
SG::ReadCondHandleKey< ILArfSampl > m_fSamplKey
float calculatePileUpNoise(const IdentifierHash &idCaloHash, const float &Nminbias)
const LArHEC_Base_ID * m_lar_hec_id
float elecNoiseRMS(const CaloCell *caloCell)
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
This is a "hash" representation of an Identifier.
This class factors out code common between LArEM_ID and LArEM_SuperCell_ID.
This class factors out code common between LArEM_ID and LArEM_SuperCell_ID.
Exception class for LAr Identifiers.
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ TILELOWLOW
Definition CaloGain.h:12
@ INVALIDGAIN
Definition CaloGain.h:18
@ LARLOWGAIN
Definition CaloGain.h:18
@ TILEONEHIGH
Definition CaloGain.h:17
@ TILEONELOW
Definition CaloGain.h:16
@ TILELOWHIGH
Definition CaloGain.h:13
@ TILEHIGHLOW
Definition CaloGain.h:14
@ UNKNOWNGAIN
Definition CaloGain.h:21
@ TILEHIGHHIGH
Definition CaloGain.h:15
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18
Definition index.py:1