ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCellNoiseAlg.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#include "CaloCellNoiseAlg.h"
9#include "CaloDetDescr/CaloDetDescrElement.h"
11#include "CLHEP/Matrix/Matrix.h"
12#include "CLHEP/Matrix/Vector.h"
13//=== AttributeList
14#include "CoralBase/Blob.h"
16#include "GaudiKernel/ThreadLocalContext.h"
17
18
19using CLHEP::HepMatrix;
20using CLHEP::HepVector;
21
22
23//Constructor
24CaloCellNoiseAlg::CaloCellNoiseAlg(const std::string& name, ISvcLocator* pSvcLocator):
25 AthAlgorithm(name,pSvcLocator)
26{
27 std::vector<float> data(CaloSampling::Unknown);
28 data[CaloSampling::PreSamplerB] = 300.;
29 data[CaloSampling::EMB1] = 100.;
30 data[CaloSampling::EMB2] = 400.;
31 data[CaloSampling::EMB3] = 200.;
32 data[CaloSampling::PreSamplerE] = 500.;
33 data[CaloSampling::EME1] = 200.;
34 data[CaloSampling::EME2] = 800.;
35 data[CaloSampling::EME3] = 300.;
36 data[CaloSampling::HEC0] = 2000.;
37 data[CaloSampling::HEC1] = 2000.;
38 data[CaloSampling::HEC2] = 2000.;
39 data[CaloSampling::HEC3] = 2000.;
40 data[CaloSampling::TileBar0] = 9999.;
41 data[CaloSampling::TileBar1] = 9999.;
42 data[CaloSampling::TileBar2] = 9999.;
43 data[CaloSampling::TileExt0] = 9999.;
44 data[CaloSampling::TileExt1] = 9999.;
45 data[CaloSampling::TileExt2] = 9999.;
46 data[CaloSampling::TileGap1] = 9999.;
47 data[CaloSampling::TileGap2] = 9999.;
48 data[CaloSampling::TileGap3] = 9999.;
49 data[CaloSampling::FCAL0]=10000.;
50 data[CaloSampling::FCAL1]=10000.;
51 data[CaloSampling::FCAL2]=10000.;
52
53 m_cuts.setValue(data);
54}
55
56//__________________________________________________________________________
57//Destructor
59
60//__________________________________________________________________________
62{
63 ATH_MSG_DEBUG ("CaloCellNoiseAlg initialize()" );
64
65 m_treeData = std::make_unique<TreeData>();
66 const CaloIdManager* mgr = nullptr;
67 ATH_CHECK( detStore()->retrieve( mgr ) );
68 m_calo_id = mgr->getCaloCell_ID();
69
70 ATH_CHECK(m_caloMgrKey.initialize());
71
72 ATH_CHECK( m_noiseKey.initialize ( m_doMC) );
73 ATH_CHECK( m_pedestalKey.initialize (!m_doMC) );
74
75 ATH_CHECK( m_adc2mevKey.initialize() );
78
79
80 m_first = true;
81 m_lumiblock = 0;
82 m_treeData->m_luminosity = 0.;
84
85 ATH_CHECK( m_thistSvc.retrieve() );
86
87 if( !m_trigDecTool.empty() ) {
88 ATH_CHECK( m_trigDecTool.retrieve() );
89 ATH_MSG_INFO ( " --> Found AlgTool TrigDecisionTool" );
90 }
91
92 ATH_CHECK( m_cablingKey.initialize());
93
94 ATH_MSG_INFO ( " end of CaloCellNoiseAlg::initialize " );
95 return StatusCode::SUCCESS;
96}
97//__________________________________________________________________________
99{
100 ATH_MSG_INFO ("CaloCellNoiseAlg stop()" );
101
102 if (!m_readNtuple) {
103 if (this->fillNtuple().isFailure()) {
104 ATH_MSG_WARNING ( " failed to fill ntuple " );
105 return StatusCode::SUCCESS;
106 }
107 }
108 else {
109 if (CaloCellNoiseAlg::readNtuple().isFailure()) {
110 ATH_MSG_WARNING ( " failed to read ntuple " );
111 return StatusCode::SUCCESS;
112 }
113 }
114
115 if (m_doFit) {
116 if (this->fitNoise().isFailure()) {
117 ATH_MSG_WARNING ( " failed to perform fit " );
118 return StatusCode::SUCCESS;
119 }
120 }
121
122 return StatusCode::SUCCESS;
123}
124
125//__________________________________________________________________________
127{
128 if (m_readNtuple) return StatusCode::SUCCESS;
129
130// check trigger
131 if ( (!m_triggerChainProp.empty()) && (!m_trigDecTool.empty()) ) {
132
133 if (m_first) {
134 ATH_MSG_INFO ( " L1 items : " << m_trigDecTool->getChainGroup("L1_.*")->getListOfTriggers() );
135 }
136 bool passTrig = false;
137 if (!m_triggerChainProp.empty()) passTrig = m_trigDecTool->isPassed(m_triggerChainProp);
138
139 if (!passTrig) {
140 ATH_MSG_DEBUG ( " Failed trigger selection " );
141 return StatusCode::SUCCESS;
142 }
143 else {
144 ATH_MSG_DEBUG ( " Pass trigger selection " );
145 }
146
147 }
148
149 const EventContext& ctx = Gaudi::Hive::currentContext();
150 unsigned int lumiblock = ctx.eventID().lumi_block();
151
152 ATH_MSG_DEBUG ( " lumiblock " << lumiblock );
153
154 if ( lumiblock != m_lumiblockOld) {
155 float luminosity = this->getLuminosity();
156 ATH_MSG_INFO ( " New lumiblock seen " << lumiblock << " " << m_lumiblock << " " << luminosity << " " << m_treeData->m_luminosity << " m_first " << m_first );
157 // lumiblock, m_lumiblock are unsigned.
158 if ( ( lumiblock - m_lumiblock >= static_cast<unsigned int>(m_addlumiblock) ||
159 std::fabs(luminosity-m_treeData->m_luminosity)>(m_treeData->m_luminosity*m_deltaLumi) ||
160 m_first )
161 && m_doLumiFit)
162 {
163 if (!m_first) {
164 ATH_MSG_INFO ( " filling ntuple for lumiblock " << m_lumiblock << " until " << lumiblock << " (excluded) " );
165 if (this->fillNtuple().isFailure()) {
166 ATH_MSG_WARNING ( " failed to fill ntuple " );
167 return StatusCode::SUCCESS;
168 }
169 }
170 m_lumiblock = lumiblock;
171 m_treeData->m_luminosity = luminosity;
172 }
173 m_lumiblockOld = lumiblock;
174 }
175
176 if (m_first) {
177 m_ncell = m_calo_id->calo_cell_hash_max();
178 ATH_MSG_DEBUG ( " number of cells " << m_ncell );
179 if (m_ncell>200000) {
180 ATH_MSG_WARNING ( " too many cells " << m_ncell );
181 return StatusCode::SUCCESS;
182 }
183 m_CellList.reserve(m_ncell);
184
185 const CaloNoise* totalNoise = nullptr;
186 if (!m_totalNoiseKey.empty()) {
188 totalNoise = noiseH.cptr();
189 }
190
192 ATH_CHECK(caloMgrHandle.isValid());
193
194 for (int i=0;i<m_ncell;i++) {
195 IdentifierHash idHash=i;
196 Identifier id=m_calo_id->cell_id(idHash);
197 const CaloDetDescrElement* calodde = (*caloMgrHandle)->get_element(id);
198 CellInfo cell0{};
199 cell0.nevt = 0;
200 cell0.average = 0.;
201 cell0.rms = 0.;
202 cell0.identifier = id.get_identifier32().get_compact();
203 cell0.sampling = m_calo_id->calo_sample(id);
204 cell0.eta = calodde->eta();
205 cell0.phi = calodde->phi();
206 cell0.nevt_good=0;
207 if (totalNoise) {
209 if (m_calo_id->is_tile(id)) {
210 if (m_calo_id->calo_sample(id) == CaloSampling::TileGap3) gain=CaloGain::TILEONEHIGH;
211 else gain=CaloGain::TILEHIGHHIGH;
212 }
213 else {
214 if(m_calo_id->is_hec(id)) gain=CaloGain::LARMEDIUMGAIN;
215 else gain=CaloGain::LARHIGHGAIN;
216 }
217 cell0.reference = totalNoise->getNoise (id, gain);
218 }
219 else{
220 cell0.reference=0.;
221 }
222 m_CellList.push_back(cell0);
223 }
224
225 m_tree = new TTree("mytree","Calo Noise ntuple");
226 m_tree->Branch("luminosity",&m_treeData->m_luminosity,"luminosity/F");
227 m_tree->Branch("ncell",&m_treeData->m_ncell,"ncell/I");
228 m_tree->Branch("identifier",m_treeData->m_identifier,"identifier[ncell]/I");
229 m_tree->Branch("layer",m_treeData->m_layer,"layer[ncell]/I");
230 m_tree->Branch("eta",m_treeData->m_eta,"eta[ncell]/F");
231 m_tree->Branch("phi",m_treeData->m_phi,"phi[ncell]/F");
232 m_tree->Branch("nevt",m_treeData->m_nevt,"nevt[ncell]/I");
233 m_tree->Branch("nevt_good",m_treeData->m_nevt_good,"nevt[ncell]/I");
234 m_tree->Branch("average",m_treeData->m_average,"average[ncell]/F");
235 m_tree->Branch("rms",m_treeData->m_rms,"rms[ncell]/F");
236 m_tree->Branch("reference",m_treeData->m_reference,"reference[ncell]/F");
237
238 if( m_thistSvc->regTree("/file1/calonoise/mytree",m_tree).isFailure()) {
239 ATH_MSG_WARNING ( " cannot register ntuple " );
240 return StatusCode::SUCCESS;
241 }
242
243 m_first = false;
244 }
245
246
247 const CaloCellContainer* cell_container = nullptr;
248 if(evtStore()->retrieve(cell_container,"AllCalo").isFailure()) {
249 ATH_MSG_WARNING( " Could not get pointer to Cell Container " );
250 return StatusCode::SUCCESS;
251 }
252
253 CaloCellContainer::const_iterator first_cell = cell_container->begin();
254 CaloCellContainer::const_iterator end_cell = cell_container->end();
255 ATH_MSG_DEBUG ( "*** Start loop over CaloCells " );
256 for (; first_cell != end_cell; ++first_cell)
257 {
258
259 Identifier cellID = (*first_cell)->ID();
260 CaloGain::CaloGain gain = (*first_cell)->gain();
261
262 if (gain==CaloGain::LARHIGHGAIN || gain ==CaloGain::TILEHIGHHIGH ||
263 (gain==CaloGain::TILEONEHIGH && m_calo_id->calo_sample(cellID) == CaloSampling::TileGap3) ||
264 (gain==CaloGain::LARMEDIUMGAIN && m_calo_id->is_hec(cellID)) ) {
265
266 double energy= (*first_cell)->energy();
267
268 int isample = m_calo_id->calo_sample(cellID);
269 if (std::fabs(energy) < m_cuts.value()[isample] ) {
270
271 IdentifierHash idhash = m_calo_id->calo_cell_hash(cellID);
272 int index = (int) (idhash);
273
274 double oldN = (double) (m_CellList[index].nevt);
275 double oldAverage = m_CellList[index].average;
276 double oldRMS = m_CellList[index].rms;
277
278 double frac = oldN/(1.+oldN);
279 double Anew = 1.+oldN;
280 double newAverage = frac*oldAverage + energy/Anew;
281 double deltaE = (energy-oldAverage);
282 double newRMS = frac*(oldRMS + deltaE*deltaE/Anew);
283
284 m_CellList[index].nevt ++;
285 m_CellList[index].average = newAverage;
286 m_CellList[index].rms = newRMS;
287
288 if (!((*first_cell)->badcell())) m_CellList[index].nevt_good++;
289 }
290 }
291 }
292
293 return StatusCode::SUCCESS;
294}
295
296//---------------------------------------------
298{
299 ATH_MSG_INFO ( " in getLuminosity() " );
300
301 float luminosity = 0.;
302 const CondAttrListCollection* attrListColl = nullptr;
303 StatusCode sc = evtStore()->retrieve(attrListColl, m_lumiFolderName);
304 if (sc.isFailure() || !attrListColl) {
305 ATH_MSG_WARNING ( "attrrListColl not found for " << m_lumiFolderName );
306 return luminosity;
307 }
308 // Loop over collection
309 CondAttrListCollection::const_iterator first = attrListColl->begin();
310 CondAttrListCollection::const_iterator last = attrListColl->end();
311 for (; first != last; ++first) {
312 if ((*first).first == 0) {
313 std::ostringstream attrStr1;
314 (*first).second.toOutputStream( attrStr1 );
315 ATH_MSG_DEBUG ( "ChanNum " << (*first).first <<
316 " Attribute list " << attrStr1.str() );
317 const coral::AttributeList& attrList = (*first).second;
318 luminosity = attrList["LBAvInstLumi"].data<float>() *1e-3; // luminosity (from 10**30 units in db to 10*33 units)
319 break;
320 }
321 }
322 ATH_MSG_INFO ( " Luminosity (10**33 units) " << luminosity << " (10**27 units) " << 1e+6*luminosity );
323 return luminosity;
324
325}
326
327//____________________________________________
329{
330 ATH_MSG_INFO ( " in fillNtuple " );
331
332 m_treeData->m_ncell = m_ncell;
333 for (int i=0;i<m_ncell;i++) {
334 m_treeData->m_identifier[i] = m_CellList[i].identifier;
335 m_treeData->m_layer[i] = m_CellList[i].sampling;
336 m_treeData->m_eta[i] = m_CellList[i].eta;
337 m_treeData->m_phi[i] = m_CellList[i].phi;
338 m_treeData->m_nevt[i] = m_CellList[i].nevt;
339 m_treeData->m_nevt_good[i] = m_CellList[i].nevt_good;
340 m_treeData->m_average[i] = (float) (m_CellList[i].average);
341 m_treeData->m_rms[i] = (float) (std::sqrt(m_CellList[i].rms));
342 m_treeData->m_reference[i] = (float) (m_CellList[i].reference);
343 ATH_MSG_DEBUG ( " hash,Nevt,Average,RMS " << i << " " << m_treeData->m_nevt[i] << " " << m_treeData->m_average[i] << " " << m_treeData->m_rms[i] );
344 }
345 m_tree->Fill();
346
347 for (int i=0;i<m_ncell;i++) {
348 m_CellList[i].nevt=0;
349 m_CellList[i].nevt_good=0;
350 m_CellList[i].average=0;
351 m_CellList[i].rms=0;
352 }
353
354
355 return StatusCode::SUCCESS;
356}
357
358//______________________________________________
360{
361 return StatusCode::SUCCESS;
362}
363
364//_________________________________________________
366{
367 const EventContext& ctx = Gaudi::Hive::currentContext();
369 const LArOnOffIdMapping* cabling=(*cablingHdl);
370
371 ATH_MSG_INFO ( " in CaloCellNoiseAlg::fitNoise() " );
372
373 const ILArPedestal* pedestal = nullptr;
374 const ILArNoise* noise = nullptr;
375 if (m_doMC) {
377 noise = noiseH.cptr();
378 }
379 else {
381 pedestal = pedH.cptr();
382 }
383
384 const CaloNoise* elecNoise = nullptr;
385 if (!m_elecNoiseKey.empty()) {
387 elecNoise = noiseH.cptr();
388 }
389
391
392 FILE* fp = fopen("calonoise.txt","w");
393
394 TBranch* b1 = m_tree->GetBranch("luminosity");
395 TBranch* b2 = m_tree->GetBranch("nevt");
396 TBranch* b3 = m_tree->GetBranch("average");
397 TBranch* b4 = m_tree->GetBranch("rms");
398 TBranch* b5 = m_tree->GetBranch("nevt_good");
399 b1->SetAddress(&m_treeData->m_luminosity);
400 b2->SetAddress(&m_treeData->m_nevt);
401 b3->SetAddress(&m_treeData->m_average);
402 b4->SetAddress(&m_treeData->m_rms);
403 b5->SetAddress(&m_treeData->m_nevt_good);
404 int nentries = m_tree->GetEntries();
405 ATH_MSG_DEBUG ( " Number of entries in ntuple " << nentries );
406
407 std::vector<float> anoise;
408 std::vector<float> bnoise;
409 anoise.resize(m_ncell,0.);
410 bnoise.resize(m_ncell,0.);
411
412 for (int icell=0;icell<m_ncell;icell++) {
413 std::vector<float> x;
414 std::vector<float> y;
415 std::vector<float> ey;
416
417 for (int i=0;i<nentries;i++) {
418 b1->GetEntry(i);
419 b2->GetEntry(i);
420 b4->GetEntry(i);
421
422 if (m_treeData->m_nevt[icell]>m_nmin) {
423 x.push_back(std::sqrt(m_treeData->m_luminosity));
424 y.push_back(m_treeData->m_rms[icell]);
425 ey.push_back(m_treeData->m_rms[icell]/std::sqrt(2.*m_treeData->m_nevt[icell]));
426 }
427 }
428
429 if (x.size()<2) {
430 if (x.size()==1) anoise[icell]=y[0];
431 }
432 else {
433 HepMatrix alpha(2,2);
434 HepVector beta(2);
435
436 for (unsigned int i=0;i<2;i++) {
437 for (unsigned int j=0;j<2;j++) {
438 alpha[i][j]=0.;
439 for (unsigned int k=0;k<x.size();k++) {
440 alpha[i][j] += ((std::pow(x[k],i))*(std::pow(x[k],j))/(std::pow(ey[k],2)));
441 }
442 }
443 }
444 for (unsigned int i=0;i<2;i++) {
445 beta[i]=0.;
446 for (unsigned int k=0;k<x.size();k++) {
447 beta[i] += (y[k]*(std::pow(x[k],i))/(std::pow(ey[k],2)));
448 }
449 }
450 HepVector comp=solve(alpha,beta);
451 anoise[icell] = comp[0];
452 bnoise[icell] = comp[1];
453
454 }
455 if (msgLvl(MSG::DEBUG)) {
456 msg() << MSG::DEBUG << " cell " << icell << " lumi/noise ";
457 for (unsigned int i=0;i<x.size();i++) {
458 msg() << MSG::DEBUG << x[i] << " " << y[i] << " / ";
459 }
460 msg() << MSG::DEBUG << " " << endmsg;
461 ATH_MSG_DEBUG ( " fitted a,b " << anoise[icell] << " " << bnoise[icell] );
462 }
463 } // end first loop over cells to store anoise and bnoise
464
465// for LAR try phi patching for missing cells, just to be sure that DB is filled with reasonable entries in case
466// the cell come back to life
467 for (int icell=0;icell<m_ncell;icell++) {
468 if (anoise[icell]<3. || m_treeData->m_nevt_good[icell]==0) {
469 IdentifierHash idHash = icell;
470 Identifier id=m_calo_id->cell_id(idHash);
471 if (m_calo_id->is_lar(id)) {
472 ATH_MSG_DEBUG ( " cell with no noise found in LAr " << m_calo_id->show_to_string(id) );
473 Identifier regionId = m_calo_id->region_id(id);
474 int eta=m_calo_id->eta(id);
475 int phimin = m_calo_id->phi_min(regionId);
476 int phimax = m_calo_id->phi_max(regionId);
477 int nring=0;
478 float sum=0.;
479 ATH_MSG_DEBUG ( " regionId,eta,phimin,phimax " << regionId << " " << eta << " " << phimin << " " << phimax );
480 for (int phi=phimin;phi<=phimax;phi++) {
481 Identifier id2 = m_calo_id->cell_id(regionId,eta,phi);
482 if (id2.is_valid()) {
483 if(msgLvl(MSG::DEBUG))
484 msg() << MSG::DEBUG << " cell in ring " << m_calo_id->show_to_string(id2) ;
485 IdentifierHash idHash2 = m_calo_id->calo_cell_hash(id2);
486 int index = (int)(idHash2);
487 if (index>=0 && index<m_ncell) {
488 ATH_MSG_DEBUG( " noise " << anoise[index] );
489 if (anoise[index]>3. && m_treeData->m_nevt_good[index]>0) {
490 nring+=1;
491 sum+=anoise[index];
492 }
493 }
494 }
495 }
496 if (nring>0) {
497 float patched_noise = sum/((float)(nring));
498 if (patched_noise>anoise[icell]) anoise[icell] = patched_noise;
499 }
500 ATH_MSG_DEBUG( " corrected noise nring, anoise[icell] " << nring << " " << anoise[icell] );
501 }
502 }
503 }
504
505
506// extrapolate to other gains and write result
507 for (int icell=0;icell<m_ncell;icell++) {
508 IdentifierHash idHash = icell;
509 Identifier id=m_calo_id->cell_id(idHash);
510 HWIdentifier hwid=cabling->createSignalChannelID(id);
511 int subCalo;
512 IdentifierHash idSubHash = m_calo_id->subcalo_cell_hash (idHash, subCalo);
513
514 int iCool=-1;
515 if (m_calo_id->is_em(id)) { // EM calo
516 if (m_calo_id->is_em_barrel(id)) {
517 if (m_calo_id->pos_neg(id) > 0 )
518 iCool=2;
519 else
520 iCool=1;
521 }
522 if (m_calo_id->is_em_endcap(id)) {
523 if (m_calo_id->pos_neg(id) > 0 )
524 iCool=3;
525 else
526 iCool=0;
527 }
528
529 }
530 if (m_calo_id->is_hec(id)) { // HEC
531 iCool=16;
532 }
533 if (m_calo_id->is_fcal(id)) { // Fcal
534 iCool=32;
535 }
536 if (m_calo_id->is_tile(id)) { // Tile
537 iCool=48;
538 }
539 int ii = (int) (idSubHash);
540
541
542// if LAr
543 if (m_calo_id->is_lar(id)) {
544 for (int igain=0;igain<3;igain++) {
546 if (igain==0) gain=CaloGain::LARHIGHGAIN;
547 if (igain==1) gain=CaloGain::LARMEDIUMGAIN;
548 if (igain==2) gain=CaloGain::LARLOWGAIN;
549
550// extrapolate electronic noise part (a term) using ratio of electronic noise values
551// for HEC start from medium gain as reference
553 if (m_calo_id->is_hec(id)) gainref=CaloGain::LARMEDIUMGAIN;
554
555 float anoise_corr=anoise[icell];
556
557 if (gain != gainref) {
558
559// noise and ADC2MeV in gain ref
560 float noise0=-1.;
561 if (m_doMC) noise0 = noise->noise(hwid,gainref);
562 else {
563 float noise = pedestal->pedestalRMS(hwid,gainref);
564 if (noise>= (1.0+LArElecCalib::ERRORCODE)) noise0 = noise;
565 }
567 polynom_adc2mev0 = adc2mev->ADC2MEV(id,gainref);
568 float adc2mev0=-1;
569 if (polynom_adc2mev0.size()>1) adc2mev0=polynom_adc2mev0[1];
570
571// noise and ADC2MeV in gain
572
573 float noise1=-1;
574 if (m_doMC) noise1 = noise->noise(hwid,gain);
575 else {
576 float noise = pedestal->pedestalRMS(hwid,gain);
577 if (noise>= (1.0+LArElecCalib::ERRORCODE)) noise1 = noise;
578 }
580 polynom_adc2mev1 = adc2mev->ADC2MEV(hwid,gain);
581 float adc2mev1=-1;
582 if (polynom_adc2mev1.size()>1) adc2mev1=polynom_adc2mev1[1];
583
584 //if (m_calo_id->is_hec(id))
585 // std::cout << " Hec noise1,noise0,adc2mev1,adc2mev0 " << noise1 << " " << noise0 << " " << adc2mev1 << " " << adc2mev0 << std::endl;
586
587 if (noise0>0 && noise1>0 && adc2mev0>0 && adc2mev1>0.) {
588 anoise_corr = anoise[icell]*noise1/noise0 * adc2mev1/adc2mev0;
589 }
590 }
591
592 //if (m_calo_id->is_hec(id))
593 // std::cout << " Hec cell gain,noise " << igain << " " << anoise_corr << std::endl;
594
595 if (elecNoise) {
596 float adb = elecNoise->getNoise(id,gain);
597
598 // if no correct noise, use reference instead
599 if (anoise_corr<1. && adb>1e-6) {
600 anoise_corr = adb;
601 ATH_MSG_WARNING ( " No noise found for cell: " <<m_calo_id->show_to_string(id) << " gain: " << gain << " Use reference value: " << adb );
602 }
603 if (adb>1e-6) {
604 float delta = std::fabs((anoise_corr-adb)/adb);
605 if (delta>0.30 && gain==CaloGain::LARHIGHGAIN)
606 ATH_MSG_WARNING ( " Noise difference cell " << m_calo_id->show_to_string(id) << " gain: " << gain
607 << " computed " << anoise_corr << " reference " << adb );
608 }
609 }
610
611
612 fprintf(fp,"%5d %5d %5d %8.3f %8.3f\n",iCool,ii,gain,anoise_corr,bnoise[icell]);
613 }
614 }
615// if Tile
616 else {
617 for (int igain=0;igain<4;igain++) {
619 if (igain==0) gain=CaloGain::TILELOWLOW;
620 if (igain==1) gain=CaloGain::TILELOWHIGH;
621 if (igain==2) gain=CaloGain::TILEHIGHLOW;
622 if (igain==3) gain=CaloGain::TILEHIGHHIGH;
623 float anoise_corr = anoise[icell];
624 if (igain>0) {
625 }
626 fprintf(fp,"%5d %5d %5d %8.3f %8.3f\n",iCool,ii,gain,anoise_corr,bnoise[icell]);
627 }
628 }
629
630 } // loop over cells
631
632 fclose(fp);
633 return StatusCode::SUCCESS;
634}
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_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t sc
#define y
#define x
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
Container class for CaloCell.
SG::ReadCondHandleKey< ILArNoise > m_noiseKey
SG::ReadCondHandleKey< CaloNoise > m_elecNoiseKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
std::vector< CellInfo > m_CellList
SG::ReadCondHandleKey< ILArPedestal > m_pedestalKey
CaloCellNoiseAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
FloatArrayProperty m_cuts
Gaudi::Property< int > m_addlumiblock
virtual StatusCode execute() override
standard Athena-Algorithm method
unsigned int m_lumiblock
Gaudi::Property< std::string > m_lumiFolderName
Gaudi::Property< bool > m_doMC
virtual StatusCode stop() override
standard Athena-Algorithm method
virtual ~CaloCellNoiseAlg()
Default Destructor.
const CaloCell_ID * m_calo_id
SG::ReadCondHandleKey< CaloNoise > m_totalNoiseKey
Gaudi::Property< bool > m_doFit
Gaudi::Property< bool > m_readNtuple
Gaudi::Property< bool > m_doLumiFit
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
virtual StatusCode initialize() override
standard Athena-Algorithm method
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
ToolHandle< Trig::TrigDecisionTool > m_trigDecTool
TDT handle.
ServiceHandle< ITHistSvc > m_thistSvc
Gaudi::Property< std::string > m_triggerChainProp
unsigned int m_lumiblockOld
static StatusCode readNtuple()
Gaudi::Property< int > m_nmin
std::unique_ptr< TreeData > m_treeData
Gaudi::Property< float > m_deltaLumi
This class groups all DetDescr information related to a CaloCell.
This class initializes the Calo (LAr and Tile) offline identifiers.
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition CaloNoise.h:35
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
virtual float pedestalRMS(const HWIdentifier &id, int gain) const =0
access to RMS of Pedestal index by Identifier, and gain setting
This is a "hash" representation of an Identifier.
bool is_valid() const
Check if id is in a valid state.
Proxy for accessing a range of float values like a vector.
const_pointer_type cptr()
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ TILELOWLOW
Definition CaloGain.h:12
@ LARLOWGAIN
Definition CaloGain.h:18
@ TILEONEHIGH
Definition CaloGain.h:17
@ TILELOWHIGH
Definition CaloGain.h:13
@ TILEHIGHLOW
Definition CaloGain.h:14
@ UNKNOWNGAIN
Definition CaloGain.h:21
@ TILEHIGHHIGH
Definition CaloGain.h:15
@ LARHIGHGAIN
Definition CaloGain.h:18
Definition index.py:1