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//__________________________________________________________________________
126StatusCode CaloCellNoiseAlg::execute(const EventContext& ctx)
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 unsigned int lumiblock = ctx.eventID().lumi_block();
150
151 ATH_MSG_DEBUG ( " lumiblock " << lumiblock );
152
153 if ( lumiblock != m_lumiblockOld) {
154 float luminosity = this->getLuminosity();
155 ATH_MSG_INFO ( " New lumiblock seen " << lumiblock << " " << m_lumiblock << " " << luminosity << " " << m_treeData->m_luminosity << " m_first " << m_first );
156 // lumiblock, m_lumiblock are unsigned.
157 if ( ( lumiblock - m_lumiblock >= static_cast<unsigned int>(m_addlumiblock) ||
158 std::fabs(luminosity-m_treeData->m_luminosity)>(m_treeData->m_luminosity*m_deltaLumi) ||
159 m_first )
160 && m_doLumiFit)
161 {
162 if (!m_first) {
163 ATH_MSG_INFO ( " filling ntuple for lumiblock " << m_lumiblock << " until " << lumiblock << " (excluded) " );
164 if (this->fillNtuple().isFailure()) {
165 ATH_MSG_WARNING ( " failed to fill ntuple " );
166 return StatusCode::SUCCESS;
167 }
168 }
169 m_lumiblock = lumiblock;
170 m_treeData->m_luminosity = luminosity;
171 }
172 m_lumiblockOld = lumiblock;
173 }
174
175 if (m_first) {
176 m_ncell = m_calo_id->calo_cell_hash_max();
177 ATH_MSG_DEBUG ( " number of cells " << m_ncell );
178 if (m_ncell>200000) {
179 ATH_MSG_WARNING ( " too many cells " << m_ncell );
180 return StatusCode::SUCCESS;
181 }
182 m_CellList.reserve(m_ncell);
183
184 const CaloNoise* totalNoise = nullptr;
185 if (!m_totalNoiseKey.empty()) {
187 totalNoise = noiseH.cptr();
188 }
189
191 ATH_CHECK(caloMgrHandle.isValid());
192
193 for (int i=0;i<m_ncell;i++) {
194 IdentifierHash idHash=i;
195 Identifier id=m_calo_id->cell_id(idHash);
196 const CaloDetDescrElement* calodde = (*caloMgrHandle)->get_element(id);
197 CellInfo cell0{};
198 cell0.nevt = 0;
199 cell0.average = 0.;
200 cell0.rms = 0.;
201 cell0.identifier = id.get_identifier32().get_compact();
202 cell0.sampling = m_calo_id->calo_sample(id);
203 cell0.eta = calodde->eta();
204 cell0.phi = calodde->phi();
205 cell0.nevt_good=0;
206 if (totalNoise) {
208 if (m_calo_id->is_tile(id)) {
209 if (m_calo_id->calo_sample(id) == CaloSampling::TileGap3) gain=CaloGain::TILEONEHIGH;
210 else gain=CaloGain::TILEHIGHHIGH;
211 }
212 else {
213 if(m_calo_id->is_hec(id)) gain=CaloGain::LARMEDIUMGAIN;
214 else gain=CaloGain::LARHIGHGAIN;
215 }
216 cell0.reference = totalNoise->getNoise (id, gain);
217 }
218 else{
219 cell0.reference=0.;
220 }
221 m_CellList.push_back(cell0);
222 }
223
224 m_tree = new TTree("mytree","Calo Noise ntuple");
225 m_tree->Branch("luminosity",&m_treeData->m_luminosity,"luminosity/F");
226 m_tree->Branch("ncell",&m_treeData->m_ncell,"ncell/I");
227 m_tree->Branch("identifier",m_treeData->m_identifier,"identifier[ncell]/I");
228 m_tree->Branch("layer",m_treeData->m_layer,"layer[ncell]/I");
229 m_tree->Branch("eta",m_treeData->m_eta,"eta[ncell]/F");
230 m_tree->Branch("phi",m_treeData->m_phi,"phi[ncell]/F");
231 m_tree->Branch("nevt",m_treeData->m_nevt,"nevt[ncell]/I");
232 m_tree->Branch("nevt_good",m_treeData->m_nevt_good,"nevt[ncell]/I");
233 m_tree->Branch("average",m_treeData->m_average,"average[ncell]/F");
234 m_tree->Branch("rms",m_treeData->m_rms,"rms[ncell]/F");
235 m_tree->Branch("reference",m_treeData->m_reference,"reference[ncell]/F");
236
237 if( m_thistSvc->regTree("/file1/calonoise/mytree",m_tree).isFailure()) {
238 ATH_MSG_WARNING ( " cannot register ntuple " );
239 return StatusCode::SUCCESS;
240 }
241
242 m_first = false;
243 }
244
245
246 const CaloCellContainer* cell_container = nullptr;
247 if(evtStore()->retrieve(cell_container,"AllCalo").isFailure()) {
248 ATH_MSG_WARNING( " Could not get pointer to Cell Container " );
249 return StatusCode::SUCCESS;
250 }
251
252 CaloCellContainer::const_iterator first_cell = cell_container->begin();
253 CaloCellContainer::const_iterator end_cell = cell_container->end();
254 ATH_MSG_DEBUG ( "*** Start loop over CaloCells " );
255 for (; first_cell != end_cell; ++first_cell)
256 {
257
258 Identifier cellID = (*first_cell)->ID();
259 CaloGain::CaloGain gain = (*first_cell)->gain();
260
261 if (gain==CaloGain::LARHIGHGAIN || gain ==CaloGain::TILEHIGHHIGH ||
262 (gain==CaloGain::TILEONEHIGH && m_calo_id->calo_sample(cellID) == CaloSampling::TileGap3) ||
263 (gain==CaloGain::LARMEDIUMGAIN && m_calo_id->is_hec(cellID)) ) {
264
265 double energy= (*first_cell)->energy();
266
267 int isample = m_calo_id->calo_sample(cellID);
268 if (std::fabs(energy) < m_cuts.value()[isample] ) {
269
270 IdentifierHash idhash = m_calo_id->calo_cell_hash(cellID);
271 int index = (int) (idhash);
272
273 double oldN = (double) (m_CellList[index].nevt);
274 double oldAverage = m_CellList[index].average;
275 double oldRMS = m_CellList[index].rms;
276
277 double frac = oldN/(1.+oldN);
278 double Anew = 1.+oldN;
279 double newAverage = frac*oldAverage + energy/Anew;
280 double deltaE = (energy-oldAverage);
281 double newRMS = frac*(oldRMS + deltaE*deltaE/Anew);
282
283 m_CellList[index].nevt ++;
284 m_CellList[index].average = newAverage;
285 m_CellList[index].rms = newRMS;
286
287 if (!((*first_cell)->badcell())) m_CellList[index].nevt_good++;
288 }
289 }
290 }
291
292 return StatusCode::SUCCESS;
293}
294
295//---------------------------------------------
297{
298 ATH_MSG_INFO ( " in getLuminosity() " );
299
300 float luminosity = 0.;
301 const CondAttrListCollection* attrListColl = nullptr;
302 StatusCode sc = evtStore()->retrieve(attrListColl, m_lumiFolderName);
303 if (sc.isFailure() || !attrListColl) {
304 ATH_MSG_WARNING ( "attrrListColl not found for " << m_lumiFolderName );
305 return luminosity;
306 }
307 // Loop over collection
308 CondAttrListCollection::const_iterator first = attrListColl->begin();
309 CondAttrListCollection::const_iterator last = attrListColl->end();
310 for (; first != last; ++first) {
311 if ((*first).first == 0) {
312 std::ostringstream attrStr1;
313 (*first).second.toOutputStream( attrStr1 );
314 ATH_MSG_DEBUG ( "ChanNum " << (*first).first <<
315 " Attribute list " << attrStr1.str() );
316 const coral::AttributeList& attrList = (*first).second;
317 luminosity = attrList["LBAvInstLumi"].data<float>() *1e-3; // luminosity (from 10**30 units in db to 10*33 units)
318 break;
319 }
320 }
321 ATH_MSG_INFO ( " Luminosity (10**33 units) " << luminosity << " (10**27 units) " << 1e+6*luminosity );
322 return luminosity;
323
324}
325
326//____________________________________________
328{
329 ATH_MSG_INFO ( " in fillNtuple " );
330
331 m_treeData->m_ncell = m_ncell;
332 for (int i=0;i<m_ncell;i++) {
333 m_treeData->m_identifier[i] = m_CellList[i].identifier;
334 m_treeData->m_layer[i] = m_CellList[i].sampling;
335 m_treeData->m_eta[i] = m_CellList[i].eta;
336 m_treeData->m_phi[i] = m_CellList[i].phi;
337 m_treeData->m_nevt[i] = m_CellList[i].nevt;
338 m_treeData->m_nevt_good[i] = m_CellList[i].nevt_good;
339 m_treeData->m_average[i] = (float) (m_CellList[i].average);
340 m_treeData->m_rms[i] = (float) (std::sqrt(m_CellList[i].rms));
341 m_treeData->m_reference[i] = (float) (m_CellList[i].reference);
342 ATH_MSG_DEBUG ( " hash,Nevt,Average,RMS " << i << " " << m_treeData->m_nevt[i] << " " << m_treeData->m_average[i] << " " << m_treeData->m_rms[i] );
343 }
344 m_tree->Fill();
345
346 for (int i=0;i<m_ncell;i++) {
347 m_CellList[i].nevt=0;
348 m_CellList[i].nevt_good=0;
349 m_CellList[i].average=0;
350 m_CellList[i].rms=0;
351 }
352
353
354 return StatusCode::SUCCESS;
355}
356
357//______________________________________________
359{
360 return StatusCode::SUCCESS;
361}
362
363//_________________________________________________
365{
366 const EventContext& ctx = Gaudi::Hive::currentContext();
368 const LArOnOffIdMapping* cabling=(*cablingHdl);
369
370 ATH_MSG_INFO ( " in CaloCellNoiseAlg::fitNoise() " );
371
372 const ILArPedestal* pedestal = nullptr;
373 const ILArNoise* noise = nullptr;
374 if (m_doMC) {
376 noise = noiseH.cptr();
377 }
378 else {
380 pedestal = pedH.cptr();
381 }
382
383 const CaloNoise* elecNoise = nullptr;
384 if (!m_elecNoiseKey.empty()) {
386 elecNoise = noiseH.cptr();
387 }
388
390
391 FILE* fp = fopen("calonoise.txt","w");
392
393 TBranch* b1 = m_tree->GetBranch("luminosity");
394 TBranch* b2 = m_tree->GetBranch("nevt");
395 TBranch* b3 = m_tree->GetBranch("average");
396 TBranch* b4 = m_tree->GetBranch("rms");
397 TBranch* b5 = m_tree->GetBranch("nevt_good");
398 b1->SetAddress(&m_treeData->m_luminosity);
399 b2->SetAddress(&m_treeData->m_nevt);
400 b3->SetAddress(&m_treeData->m_average);
401 b4->SetAddress(&m_treeData->m_rms);
402 b5->SetAddress(&m_treeData->m_nevt_good);
403 int nentries = m_tree->GetEntries();
404 ATH_MSG_DEBUG ( " Number of entries in ntuple " << nentries );
405
406 std::vector<float> anoise;
407 std::vector<float> bnoise;
408 anoise.resize(m_ncell,0.);
409 bnoise.resize(m_ncell,0.);
410
411 for (int icell=0;icell<m_ncell;icell++) {
412 std::vector<float> x;
413 std::vector<float> y;
414 std::vector<float> ey;
415
416 for (int i=0;i<nentries;i++) {
417 b1->GetEntry(i);
418 b2->GetEntry(i);
419 b4->GetEntry(i);
420
421 if (m_treeData->m_nevt[icell]>m_nmin) {
422 x.push_back(std::sqrt(m_treeData->m_luminosity));
423 y.push_back(m_treeData->m_rms[icell]);
424 ey.push_back(m_treeData->m_rms[icell]/std::sqrt(2.*m_treeData->m_nevt[icell]));
425 }
426 }
427
428 if (x.size()<2) {
429 if (x.size()==1) anoise[icell]=y[0];
430 }
431 else {
432 HepMatrix alpha(2,2);
433 HepVector beta(2);
434
435 for (unsigned int i=0;i<2;i++) {
436 for (unsigned int j=0;j<2;j++) {
437 alpha[i][j]=0.;
438 for (unsigned int k=0;k<x.size();k++) {
439 alpha[i][j] += ((std::pow(x[k],i))*(std::pow(x[k],j))/(std::pow(ey[k],2)));
440 }
441 }
442 }
443 for (unsigned int i=0;i<2;i++) {
444 beta[i]=0.;
445 for (unsigned int k=0;k<x.size();k++) {
446 beta[i] += (y[k]*(std::pow(x[k],i))/(std::pow(ey[k],2)));
447 }
448 }
449 HepVector comp=solve(alpha,beta);
450 anoise[icell] = comp[0];
451 bnoise[icell] = comp[1];
452
453 }
454 if (msgLvl(MSG::DEBUG)) {
455 msg() << MSG::DEBUG << " cell " << icell << " lumi/noise ";
456 for (unsigned int i=0;i<x.size();i++) {
457 msg() << MSG::DEBUG << x[i] << " " << y[i] << " / ";
458 }
459 msg() << MSG::DEBUG << " " << endmsg;
460 ATH_MSG_DEBUG ( " fitted a,b " << anoise[icell] << " " << bnoise[icell] );
461 }
462 } // end first loop over cells to store anoise and bnoise
463
464// for LAR try phi patching for missing cells, just to be sure that DB is filled with reasonable entries in case
465// the cell come back to life
466 for (int icell=0;icell<m_ncell;icell++) {
467 if (anoise[icell]<3. || m_treeData->m_nevt_good[icell]==0) {
468 IdentifierHash idHash = icell;
469 Identifier id=m_calo_id->cell_id(idHash);
470 if (m_calo_id->is_lar(id)) {
471 ATH_MSG_DEBUG ( " cell with no noise found in LAr " << m_calo_id->show_to_string(id) );
472 Identifier regionId = m_calo_id->region_id(id);
473 int eta=m_calo_id->eta(id);
474 int phimin = m_calo_id->phi_min(regionId);
475 int phimax = m_calo_id->phi_max(regionId);
476 int nring=0;
477 float sum=0.;
478 ATH_MSG_DEBUG ( " regionId,eta,phimin,phimax " << regionId << " " << eta << " " << phimin << " " << phimax );
479 for (int phi=phimin;phi<=phimax;phi++) {
480 Identifier id2 = m_calo_id->cell_id(regionId,eta,phi);
481 if (id2.is_valid()) {
482 if(msgLvl(MSG::DEBUG))
483 msg() << MSG::DEBUG << " cell in ring " << m_calo_id->show_to_string(id2) ;
484 IdentifierHash idHash2 = m_calo_id->calo_cell_hash(id2);
485 int index = (int)(idHash2);
486 if (index>=0 && index<m_ncell) {
487 ATH_MSG_DEBUG( " noise " << anoise[index] );
488 if (anoise[index]>3. && m_treeData->m_nevt_good[index]>0) {
489 nring+=1;
490 sum+=anoise[index];
491 }
492 }
493 }
494 }
495 if (nring>0) {
496 float patched_noise = sum/((float)(nring));
497 if (patched_noise>anoise[icell]) anoise[icell] = patched_noise;
498 }
499 ATH_MSG_DEBUG( " corrected noise nring, anoise[icell] " << nring << " " << anoise[icell] );
500 }
501 }
502 }
503
504
505// extrapolate to other gains and write result
506 for (int icell=0;icell<m_ncell;icell++) {
507 IdentifierHash idHash = icell;
508 Identifier id=m_calo_id->cell_id(idHash);
509 HWIdentifier hwid=cabling->createSignalChannelID(id);
510 int subCalo;
511 IdentifierHash idSubHash = m_calo_id->subcalo_cell_hash (idHash, subCalo);
512
513 int iCool=-1;
514 if (m_calo_id->is_em(id)) { // EM calo
515 if (m_calo_id->is_em_barrel(id)) {
516 if (m_calo_id->pos_neg(id) > 0 )
517 iCool=2;
518 else
519 iCool=1;
520 }
521 if (m_calo_id->is_em_endcap(id)) {
522 if (m_calo_id->pos_neg(id) > 0 )
523 iCool=3;
524 else
525 iCool=0;
526 }
527
528 }
529 if (m_calo_id->is_hec(id)) { // HEC
530 iCool=16;
531 }
532 if (m_calo_id->is_fcal(id)) { // Fcal
533 iCool=32;
534 }
535 if (m_calo_id->is_tile(id)) { // Tile
536 iCool=48;
537 }
538 int ii = (int) (idSubHash);
539
540
541// if LAr
542 if (m_calo_id->is_lar(id)) {
543 for (int igain=0;igain<3;igain++) {
545 if (igain==0) gain=CaloGain::LARHIGHGAIN;
546 if (igain==1) gain=CaloGain::LARMEDIUMGAIN;
547 if (igain==2) gain=CaloGain::LARLOWGAIN;
548
549// extrapolate electronic noise part (a term) using ratio of electronic noise values
550// for HEC start from medium gain as reference
552 if (m_calo_id->is_hec(id)) gainref=CaloGain::LARMEDIUMGAIN;
553
554 float anoise_corr=anoise[icell];
555
556 if (gain != gainref) {
557
558// noise and ADC2MeV in gain ref
559 float noise0=-1.;
560 if (m_doMC) noise0 = noise->noise(hwid,gainref);
561 else {
562 float noise = pedestal->pedestalRMS(hwid,gainref);
563 if (noise>= (1.0+LArElecCalib::ERRORCODE)) noise0 = noise;
564 }
566 polynom_adc2mev0 = adc2mev->ADC2MEV(id,gainref);
567 float adc2mev0=-1;
568 if (polynom_adc2mev0.size()>1) adc2mev0=polynom_adc2mev0[1];
569
570// noise and ADC2MeV in gain
571
572 float noise1=-1;
573 if (m_doMC) noise1 = noise->noise(hwid,gain);
574 else {
575 float noise = pedestal->pedestalRMS(hwid,gain);
576 if (noise>= (1.0+LArElecCalib::ERRORCODE)) noise1 = noise;
577 }
579 polynom_adc2mev1 = adc2mev->ADC2MEV(hwid,gain);
580 float adc2mev1=-1;
581 if (polynom_adc2mev1.size()>1) adc2mev1=polynom_adc2mev1[1];
582
583 //if (m_calo_id->is_hec(id))
584 // std::cout << " Hec noise1,noise0,adc2mev1,adc2mev0 " << noise1 << " " << noise0 << " " << adc2mev1 << " " << adc2mev0 << std::endl;
585
586 if (noise0>0 && noise1>0 && adc2mev0>0 && adc2mev1>0.) {
587 anoise_corr = anoise[icell]*noise1/noise0 * adc2mev1/adc2mev0;
588 }
589 }
590
591 //if (m_calo_id->is_hec(id))
592 // std::cout << " Hec cell gain,noise " << igain << " " << anoise_corr << std::endl;
593
594 if (elecNoise) {
595 float adb = elecNoise->getNoise(id,gain);
596
597 // if no correct noise, use reference instead
598 if (anoise_corr<1. && adb>1e-6) {
599 anoise_corr = adb;
600 ATH_MSG_WARNING ( " No noise found for cell: " <<m_calo_id->show_to_string(id) << " gain: " << gain << " Use reference value: " << adb );
601 }
602 if (adb>1e-6) {
603 float delta = std::fabs((anoise_corr-adb)/adb);
604 if (delta>0.30 && gain==CaloGain::LARHIGHGAIN)
605 ATH_MSG_WARNING ( " Noise difference cell " << m_calo_id->show_to_string(id) << " gain: " << gain
606 << " computed " << anoise_corr << " reference " << adb );
607 }
608 }
609
610
611 fprintf(fp,"%5d %5d %5d %8.3f %8.3f\n",iCool,ii,gain,anoise_corr,bnoise[icell]);
612 }
613 }
614// if Tile
615 else {
616 for (int igain=0;igain<4;igain++) {
618 if (igain==0) gain=CaloGain::TILELOWLOW;
619 if (igain==1) gain=CaloGain::TILELOWHIGH;
620 if (igain==2) gain=CaloGain::TILEHIGHLOW;
621 if (igain==3) gain=CaloGain::TILEHIGHHIGH;
622 float anoise_corr = anoise[icell];
623 if (igain>0) {
624 }
625 fprintf(fp,"%5d %5d %5d %8.3f %8.3f\n",iCool,ii,gain,anoise_corr,bnoise[icell]);
626 }
627 }
628
629 } // loop over cells
630
631 fclose(fp);
632 return StatusCode::SUCCESS;
633}
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...
static Double_t sc
#define y
#define x
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
Container class for CaloCell.
SG::ReadCondHandleKey< ILArNoise > m_noiseKey
SG::ReadCondHandleKey< CaloNoise > m_elecNoiseKey
virtual StatusCode execute(const EventContext &ctx) override
standard Athena-Algorithm method
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
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