ATLAS Offline Software
Loading...
Searching...
No Matches
FixLArElecCalib.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
80
81
82#include "FixLArElecCalib.h"
83#include "Gaudi/Property.h"
84#include "GaudiKernel/IToolSvc.h"
85
91
101
103
104
105#include "TTree.h"
106#include "TFile.h"
107
109#include "CoralBase/Blob.h"
110
111#include <fstream>
112#include <cstdint>
113
114
115FixLArElecCalib::FixLArElecCalib(const std::string& name, ISvcLocator* pSvcLocator) :
116 AthAlgorithm(name,pSvcLocator),
117 m_em_idhelper(nullptr),
118 m_hec_idhelper(nullptr),
119 m_fcal_idhelper(nullptr),
120 m_online_idhelper(nullptr),
121 m_sem_idhelper(nullptr),
122 m_shec_idhelper(nullptr),
123 m_sonline_idhelper(nullptr),
124 m_scell_idhelper(nullptr)
125{
126
127}
128
130 ATH_MSG_INFO ( " in initialize " );
131
132 ATH_CHECK( detStore()->retrieve(m_em_idhelper) );
133 ATH_CHECK( detStore()->retrieve(m_hec_idhelper) );
134 ATH_CHECK( detStore()->retrieve(m_fcal_idhelper) );
135 ATH_CHECK( detStore()->retrieve(m_sem_idhelper) );
136 ATH_CHECK( detStore()->retrieve(m_shec_idhelper) );
137 ATH_CHECK( detStore()->retrieve(m_online_idhelper) );
138 ATH_CHECK( detStore()->retrieve(m_sonline_idhelper) );
139 ATH_CHECK( detStore()->retrieve(m_scell_idhelper) );
140
141 ATH_CHECK( m_cablingKey.initialize() );
142 ATH_CHECK( m_CLKey.initialize() );
143
144 return StatusCode::SUCCESS;
145}
146
148
149 const EventContext& ctx = Gaudi::Hive::currentContext();
150
152 const LArOnOffIdMapping* cabling{*cablingHdl};
153 if(!cabling) {
154 ATH_MSG_WARNING( "Do not have cabling mapping from key " << m_cablingKey.key() );
155 }
156 if(m_fixFlag==13)
157 return fix13(cabling);
158
159 return StatusCode::SUCCESS;
160}
161
162StatusCode FixLArElecCalib::stop ATLAS_NOT_THREAD_SAFE () {
163
164 ATH_MSG_INFO ( " in stop " );
165
166 const EventContext& ctx = Gaudi::Hive::currentContext();
167
168 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey, ctx};
169 const LArOnOffIdMapping* cabling{*cablingHdl};
170 if(!cabling) {
171 ATH_MSG_ERROR( "Do not have cabling mapping from key " << m_cablingKey.key() );
172 return StatusCode::FAILURE;
173 }
174 SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_CLKey, ctx};
175 const LArCalibLineMapping *clCont {*clHdl};
176 if(!clCont) {
177 ATH_MSG_ERROR( "Do not have calib line mapping !!!" );
178 return StatusCode::FAILURE;
179 }
180
181
182 if(m_fixFlag==1)
183 return fix1(cabling);
184 if(m_fixFlag==2)
185 return fix2(cabling);
186 if(m_fixFlag==3)
187 return fix3(cabling);
188 if(m_fixFlag==4)
189 return fix4(cabling);
190 if(m_fixFlag==5)
191 return fix5(cabling);
192 if(m_fixFlag==6)
193 return fix6(cabling);
194 if(m_fixFlag==7)
195 return fix7(cabling);
196 if(m_fixFlag==8)
197 return fix8(cabling);
198 if(m_fixFlag==9)
199 return fix9(cabling);
200 if(m_fixFlag==10)
201 return fix10(cabling);
202 if(m_fixFlag==11)
203 return fix11(cabling);
204 if(m_fixFlag==12)
205 return fix12(cabling);
206 if(m_fixFlag==13)
207 return fix13(cabling);
208 if(m_fixFlag==14)
209 return fix14(cabling);
210 if(m_fixFlag==15)
211 return fix15();
212 if(m_fixFlag==16)
213 return fix16();
214 if(m_fixFlag==17)
215 return fix17(cabling);
216 if(m_fixFlag==18)
217 return fix18(clCont);
218
219 return StatusCode::SUCCESS;
220
221}
222
223StatusCode FixLArElecCalib::fix1(const LArOnOffIdMapping *cabling) {
224
225 ATH_MSG_INFO ( " in fix1() " );
226
227 // Fix1 is for updating the EM DAC2uA, assuming symmetry.
228 // Input should be MC Conditions data with DetDescrVersion=ATLAS-DC3-05
229
230 // Pointer to StoreGate
231 const LArEM_ID* em_idhelper = nullptr;
232 ATH_CHECK( detStore()->retrieve(em_idhelper) );
233
234 const LArOnlineID* online_idhelper = nullptr;
235 ATH_CHECK( detStore()->retrieve(online_idhelper) );
236
237 // retrieve DetDescrManager
238 SmartIF<IToolSvc> toolSvc{Gaudi::svcLocator()->service("ToolSvc")};
239 ATH_CHECK(toolSvc.isValid());
240
241 LArDAC2uAMC * dac2ua = nullptr;
242 ATH_CHECK( detStore()->retrieve(dac2ua) );
243
244 // read in the file
245
246 std::ifstream infile("barrel_dac2ua_oct06.txt") ;
247 if(! infile.good() )
248 {
249 ATH_MSG_ERROR(" fail to open file ");
250 return StatusCode::FAILURE;
251 }
252
253
254 int det,samp,reg,eta;
255 float value ;
256 int n = 0;
257 while ( infile>>det>>samp>>reg>>eta>>value )
258 {
259 ++n;
260 ATH_MSG_DEBUG(" det,samp,reg,eta,value="
261 <<det<<" "
262 <<samp<<" "
263 <<reg<<" "
264 <<eta<<" "
265 <<value<<" " );
266
267 Identifier id ;
268 if ( det==1 && samp==1 && reg==0 && eta==0 ){
269 // eta=0 for strip, not connected, but keep it
270 // Removed disconnected channels: 03/2016 RDS
271 // ATH_MSG_DEBUG(" disconnected strip ");
272 // id = em_idhelper->disc_channel_id(det,samp,reg,eta,0);
273 }else
274 id = em_idhelper->channel_id(det,samp,reg,eta,0);
275
276 HWIdentifier hid = cabling->createSignalChannelID(id);
277 LArDAC2uAComplete::LArCondObj & t = dac2ua->get(hid,0);
278 ATH_MSG_DEBUG(" online id = "<<online_idhelper->print_to_string(hid));
279
280 if( t.isEmpty() )
281 {
282 ATH_MSG_WARNING(" No existing conditions data " );
283 continue ;
284 }
285 ATH_MSG_DEBUG(" Old DAC2uA = "<< t.m_data<< " " );
286
287 t.m_data = value ;
288
289 const LArDAC2uAComplete::LArCondObj & t3 = dac2ua->get(hid,0);
290 ATH_MSG_DEBUG(" New DAC2uA = "<< t3.m_data << " " );
291
292 }
293
294 ATH_MSG_DEBUG(" Number of entries changes = " <<n );
295 return StatusCode::SUCCESS;
296}
297
298
299StatusCode FixLArElecCalib::fix2(const LArOnOffIdMapping *cabling) {
300
301 ATH_MSG_INFO ( " in fix2() " );
302
303 // Fix2 is for updating the FCAL conditions data after IdFix7
304 // Input should be MC Conditions data with DetDescrVersion=ATLAS-DC3-05
305
306 const LArFCAL_ID* fcal_idhelper = nullptr;
307 ATH_CHECK( detStore()->retrieve(fcal_idhelper) );
308
309 const LArOnlineID* online_idhelper = nullptr;
310 ATH_CHECK( detStore()->retrieve(online_idhelper) );
311
312 // retrieve DetDescrManager
313 SmartIF<IToolSvc> toolSvc{Gaudi::svcLocator()->service("ToolSvc")};
314 ATH_CHECK(toolSvc.isValid());
315
316 LArDAC2uAMC * dac2ua = nullptr;
317 ATH_CHECK( detStore()->retrieve(dac2ua) );
318
319 LAruA2MeVMC * ua2mev = nullptr;
320 ATH_CHECK( detStore()->retrieve(ua2mev) );
321
322 LArRampMC * ramp = nullptr;
323 ATH_CHECK( detStore()->retrieve(ramp) );
324
325 LArShape32MC * shape = nullptr;
326 ATH_CHECK( detStore()->retrieve(shape) );
327
328 LArNoiseMC * noise = nullptr;
329 ATH_CHECK( detStore()->retrieve(noise) );
330
331 LArfSamplMC * fsampl = nullptr;
332 ATH_CHECK( detStore()->retrieve(fsampl) );
333
334 LArMinBiasMC * minbias = nullptr;
335 ATH_CHECK( detStore()->retrieve(minbias) );
336
337 LArAutoCorrMC * ac = nullptr;
338 ATH_CHECK( detStore()->retrieve(ac) );
339
340
341 for( unsigned int gain=0;gain<3;++gain)
342 {
343 // loop over all the old data
345 LArRampMC::ConditionsMapIterator it_e = ramp->end(gain);
346
347 int n=0;
348 for (; it!=it_e;++it)
349 {
350 HWIdentifier hid = it.channelId();
351 if( (*it).isEmpty() ) continue;
352 if(cabling->isOnlineConnected(hid)){
353 continue;
354 }else
355 {
356 ATH_MSG_DEBUG(" unconnected channel"
357 << online_idhelper->print_to_string(hid) );
358 ac->get(hid,gain) = LArAutoCorrComplete::LArCondObj();
359 ramp->get(hid,gain) = LArRampComplete::LArCondObj();
360 shape->get(hid,gain) = LArShape32MC::LArCondObj();
361 noise->get(hid,gain) = LArNoiseComplete::LArCondObj();
362 if(gain==0){
363 dac2ua->get(hid,gain) = LArDAC2uAComplete::LArCondObj();
364 ua2mev->get(hid,gain) = LAruA2MeVComplete::LArCondObj();
365 fsampl->get(hid,gain) = LArfSamplComplete::LArCondObj();
366 minbias->get(hid,gain) = LArMinBiasComplete::LArCondObj();
367 }
368 ++n ;
369 }
370
371 }
372 ATH_MSG_DEBUG(" Gain="<<gain<<
373 " Number of entries removed = " <<n );
374 }
375
376
377 HWIdentifier hid_mod[3];
378 hid_mod[0] = online_idhelper->channel_Id(1,1,6,1,33);
379 hid_mod[1] = online_idhelper->channel_Id(1,1,6,10,12);
380 hid_mod[2] = online_idhelper->channel_Id(1,1,6,14,12);
381
382 // loop over all FCAL channels
383 std::vector<Identifier>::const_iterator it= fcal_idhelper->fcal_begin();
384 std::vector<Identifier>::const_iterator it_e= fcal_idhelper->fcal_end();
385 int n = 0;
386 for(;it!=it_e; ++it)
387 {
388 Identifier id = *it;
389 int pn = fcal_idhelper->pos_neg(id);
390 if(pn!=2) continue;
391 int phi = fcal_idhelper->phi(id);
392 if (phi>7) continue;
393
394 int module = fcal_idhelper->module(id)-1;
395
396 HWIdentifier hid = cabling->createSignalChannelID(id);
397
398 for(unsigned int gain = 0;gain<3;++gain){
399
400 LArRampComplete::LArCondObj& rampP = ramp->get(hid,gain) ;
401 if (!rampP.isEmpty()) continue ;
402
403 ATH_MSG_DEBUG(" channel needs repair "
404 << online_idhelper->print_to_string(hid) );
405 ATH_MSG_DEBUG ( fcal_idhelper->print_to_string(id) );
406 ATH_MSG_DEBUG ( "module = "<<module );
407
408 ++n;
409
410 LArRampComplete::LArCondObj ramp_std = ramp->get(hid_mod[module],gain) ;
411 ramp->setPdata(hid,ramp_std,gain);
412
413 LArAutoCorrComplete::LArCondObj ac_std = ac->get(hid_mod[module],gain) ;
414 ac->setPdata(hid,ac_std,gain);
415
416 LArShape32MC::LArCondObj shape_std = shape->get(hid_mod[module],gain) ;
417 shape->setPdata(hid,shape_std,gain);
418
419 LArNoiseComplete::LArCondObj noise_std = noise->get(hid_mod[module],gain) ;
420 noise->setPdata(hid,noise_std,gain);
421
422 if(gain==0){
423
424 LAruA2MeVComplete::LArCondObj ua2mev_std = ua2mev->get(hid_mod[module],gain) ;
425 ua2mev->setPdata(hid,ua2mev_std,gain);
426
427 LArDAC2uAComplete::LArCondObj dac2ua_std = dac2ua->get(hid_mod[module],gain) ;
428 dac2ua->setPdata(hid,dac2ua_std,gain);
429
430 LArfSamplComplete::LArCondObj fsampl_std = fsampl->get(hid_mod[module],gain) ;
431 fsampl->setPdata(hid,fsampl_std,gain);
432
433 LArMinBiasComplete::LArCondObj minbias_std = minbias->get(hid_mod[module],gain) ;
434 minbias->setPdata(hid,minbias_std,gain);
435
436 }
437
438 }
439 }
440
441 ATH_MSG_DEBUG( " Number of entries fixed " <<n );
442 return StatusCode::SUCCESS;
443}
444
445StatusCode FixLArElecCalib::fix3 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
446
447 ATH_MSG_INFO ( " in fix3() " );
448 std::string filename ;
449
450 // updated for 13.0.20
451 if(m_g4Phys=="QGSP_EMV"){
452 filename = "fsampl_1302_qgsp-emv.txt";
453 }
454 else
455 if( m_g4Phys=="QGSP_BERT"){
456 filename = "fsampl_1303_qgsp-bert.txt";
457 }
458 else {
459 ATH_MSG_ERROR ( " wrong option "<<m_g4Phys );
460 return StatusCode::FAILURE;
461 }
462
463 // Fix3 is for updating the FCAL conditions data after IdFix7
464 // Input should be MC Conditions data with DetDescrVersion=ATLAS-DC3-05
465
466 ATH_CHECK( updateEMfSampl(filename, cabling ) );
467 ATH_CHECK( updateHADfSampl(cabling) );
468 return StatusCode::SUCCESS;
469}
470
471
472StatusCode FixLArElecCalib::fix4 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
473 ATH_MSG_INFO ( " in fix4() " );
474 return updateEM_DACuAMeV( "dac2ua_ua2mev_rel13.txt", cabling );
475}
476
477StatusCode FixLArElecCalib::updateHADfSampl ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
478
479 float fsampl_fcal1,fsampl_fcal2,fsampl_fcal3;
480 float fsampl_hec1,fsampl_hec2;
481
482 if(m_g4Phys=="QGSP_EMV"){
483 fsampl_hec1=0.04355;
484 fsampl_hec2=0.021775;
485
486
487 // numbers for G4.8.3
488 fsampl_fcal1=0.01366;
489 fsampl_fcal2=0.00854;
490 fsampl_fcal3=0.01107;
491 // numbers for G4.8.2
492 //fsampl_fcal1=0.01412;
493 //fsampl_fcal2=0.00894;
494 //fsampl_fcal3=0.01149;
495 }
496 else
497 if( m_g4Phys=="QGSP_BERT"){
498 fsampl_hec1=0.0447;
499 fsampl_hec2=0.02235;
500
501 // for G4.8.3
502 fsampl_fcal1=0.01591;
503 fsampl_fcal2=0.01144;
504 fsampl_fcal3=0.01405;
505
506 // for G4.8.2
507 //fsampl_fcal1=0.01512 ;
508 //fsampl_fcal2=0.01086;
509 //fsampl_fcal3=0.01352;
510 }
511 else {
512 ATH_MSG_ERROR ( " wrong option "<<m_g4Phys );
513 return StatusCode::FAILURE;
514 }
515
516
517 const LArfSamplMC * fsampl_c = nullptr;
518 ATH_CHECK( detStore()->retrieve(fsampl_c) );
519
520 LArfSamplMC* fsampl = const_cast<LArfSamplMC*>(fsampl_c);
521
522 // loop over all the old data
524 LArfSamplMC::ConditionsMapIterator it_e = fsampl->end(0);
525 int n_hec=0;
526 int n_fcal=0;
527
528 for (; it!=it_e;++it){
529
530 HWIdentifier hid = it.channelId();
531 if( (*it).isEmpty() ) continue;
532 if(!cabling->isOnlineConnected(hid)){
533 continue;
534 }
535
537
538 Identifier id = cabling->cnvToIdentifier(hid);
539
540
541 if(m_hec_idhelper->is_lar_hec(id)){
542 ATH_MSG_INFO(" HEC Old fsampl = "<< t2.m_fSampl<< " " );
543 int sam = m_hec_idhelper->sampling(id);
544
545 if(sam<=1){
546 t2.m_fSampl = fsampl_hec1;
547 }else
548 {
549 t2.m_fSampl = fsampl_hec2;
550 }
551
552 const LArfSamplComplete::LArCondObj & t3 = fsampl->get(hid,0);
553 ATH_MSG_INFO(" New fSampl = "<< t3.m_fSampl<< " " );
554
555 ++n_hec;
556 }
557 if(m_fcal_idhelper->is_lar_fcal(id)){
558 ATH_MSG_INFO(" FCAL Old fsampl = "<< t2.m_fSampl<< " " );
559 int sam = m_fcal_idhelper->module(id);
560
561 if(sam==1){
562 t2.m_fSampl = fsampl_fcal1;
563 }else
564 if(sam==2){
565 t2.m_fSampl = fsampl_fcal2;
566 }else
567 {
568 t2.m_fSampl = fsampl_fcal3;
569 }
570
571 const LArfSamplComplete::LArCondObj & t3 = fsampl->get(hid,0);
572 ATH_MSG_INFO(" New fSampl = "<< t3.m_fSampl<< " " );
573
574 ++n_fcal;
575 }
576
577 }
578
579 ATH_MSG_INFO(" number of hec cells "<<n_hec);
580 ATH_MSG_INFO(" number of fcal cells "<<n_fcal);
581
582 return StatusCode::SUCCESS;
583}
584
585
586StatusCode FixLArElecCalib::updateEMfSampl ATLAS_NOT_THREAD_SAFE (const std::string& filename, const LArOnOffIdMapping *cabling) {
587
588 ATH_MSG_INFO ( " in updateEMfSampl() " );
589
590 // this method updates the EM fSample, assuming symmetry.
591 // input is the text file.
592
593 const LArfSamplMC * fsampl_c = nullptr;
594 ATH_CHECK( detStore()->retrieve(fsampl_c) );
595 LArfSamplMC* fsampl = const_cast<LArfSamplMC*>(fsampl_c);
596
597 // read in the file
598
599 ATH_MSG_INFO(" opening file "<< filename );
600 std::ifstream infile( filename);
601 if(! infile.good() )
602 {
603 ATH_MSG_ERROR(" fail to open file ");
604 return StatusCode::FAILURE;
605 }
606 int det,samp,reg,eta;
607 float value ;
608 int n = 0;
609 while ( infile>>det>>samp>>reg>>eta>>value )
610 {
611 ++n;
612 ATH_MSG_INFO(" det,samp,reg,eta,value="
613 <<det<<" "
614 <<samp<<" "
615 <<reg<<" "
616 <<eta<<" "
617 <<value<<" " );
618
619 Identifier id ;
620 if ( det==1 && samp==1 && reg==0 && eta==0 ){
621 // eta=0 for strip, not connected, but keep it
622 // Removed disconnected channels: 03/2016 RDS
623 // ATH_MSG_INFO(" disconnected strip ");
624 // id = m_em_idhelper->disc_channel_id(det,samp,reg,eta,0);
625 }else
626 id = m_em_idhelper->channel_id(det,samp,reg,eta,0);
627
628 HWIdentifier hid = cabling->createSignalChannelID(id);
629 const LArfSamplComplete::LArCondObj & t = fsampl->get(hid,0);
630 std::string id_str = m_online_idhelper->print_to_string(hid);
631 ATH_MSG_INFO(" online id = "<<id_str);
632
633 if( t.isEmpty() )
634 {
635 ATH_MSG_ERROR(" No existing conditions data " );
636 ATH_MSG_ERROR( m_em_idhelper->print_to_string(id) );
637 // return StatusCode::FAILURE ;
638 continue ;
639 }
640 ATH_MSG_INFO(" Old fsampl = "<< t.m_fSampl<< " " );
641
643 t2.m_fSampl = value ;
644
645 const LArfSamplComplete::LArCondObj & t3 = fsampl->get(hid,0);
646 ATH_MSG_INFO(" New fSampl = "<< t3.m_fSampl<< " " );
647 }
648
649 ATH_MSG_INFO(" Number of entries changes = " <<n );
650 return StatusCode::SUCCESS;
651}
652
653
654StatusCode FixLArElecCalib::updateEM_DACuAMeV ATLAS_NOT_THREAD_SAFE (const std::string& filename, const LArOnOffIdMapping *cabling) {
655 // read in the file
656
657 const LArDAC2uAMC * dac2ua_c = nullptr;
658 ATH_CHECK( detStore()->retrieve(dac2ua_c) );
659 LArDAC2uAMC* dac2uaMC = const_cast<LArDAC2uAMC*>(dac2ua_c);
660
661 const LAruA2MeVMC * ua2mev_c = nullptr;
662 ATH_CHECK( detStore()->retrieve(ua2mev_c) );
663 LAruA2MeVMC* ua2mevMC = const_cast<LAruA2MeVMC*>(ua2mev_c);
664
665 std::ifstream infile(filename) ;
666
667 if(! infile.good() )
668 {
669 ATH_MSG_ERROR(" fail to open file ");
670 return StatusCode::FAILURE;
671 }
672
673
674 char s[200];
675 infile.getline(s,200);
676 ATH_MSG_INFO(" first line of the file "<<s);
677
678 int det,samp,reg,eta;
679 int n = 0;
680 float dac2ua0, ua2mev0,attenuation,dac2ua,ua2mev;
681 while ( infile>>det>>samp>>reg>>eta>>
682 dac2ua0>>ua2mev0>>attenuation>>dac2ua>>ua2mev )
683 {
684 ++n;
685 ATH_MSG_DEBUG(" det,samp,reg,eta,values="
686 <<det<<" "
687 <<samp<<" "
688 <<reg<<" "
689 <<eta<<" "
690 <<dac2ua<<" "
691 <<ua2mev<<" " );
692
693 Identifier id ;
694 if ( det==1 && samp==1 && reg==0 && eta==0 ){
695 // eta=0 for strip, not connected, but keep it
696 // Removed disconnected channels: 03/2016 RDS
697 // ATH_MSG_DEBUG(" disconnected strip ");
698 // id = m_em_idhelper->disc_channel_id(det,samp,reg,eta,0);
699 }else
700 id = m_em_idhelper->channel_id(det,samp,reg,eta,0);
701
702 HWIdentifier hid = cabling->createSignalChannelID(id);
703
704 const LArDAC2uAComplete::LArCondObj & t = dac2uaMC->get(hid,0);
705 std::string id_str = m_online_idhelper->print_to_string(hid);
706 std::string id_str_off = m_em_idhelper->print_to_string(id);
707 ATH_MSG_DEBUG(" online id = "<<id_str);
708 ATH_MSG_DEBUG(" offline id = "<<id_str_off);
709
710 if( t.isEmpty() )
711 {
712 ATH_MSG_WARNING(" No existing conditions data " );
713 continue ;
714 }
715 ATH_MSG_DEBUG(" Old DAC2uA = "<< t.m_data<< " " );
716
718 t2.m_data= dac2ua ;
719
720 const LArDAC2uAComplete::LArCondObj & t3 = dac2uaMC->get(hid,0);
721 ATH_MSG_DEBUG(" New DAC2uA = "<< t3.m_data<< " " );
722
723 /**************************/
724
725 const LAruA2MeVComplete::LArCondObj & u = ua2mevMC->get(hid,0);
726
727 if( u.isEmpty() )
728 {
729 ATH_MSG_ERROR(" No existing conditions data " );
730 // return StatusCode::FAILURE ;
731 continue ;
732 }
733 ATH_MSG_DEBUG(" Old uA2MeV = "<< u.m_data<< " " );
734
736 u2.m_data = ua2mev ;
737
738 const LAruA2MeVComplete::LArCondObj & u3 = ua2mevMC->get(hid,0);
739 ATH_MSG_DEBUG(" New uA2MeV = "<< u3.m_data<< " " );
740
741 }
742
743 ATH_MSG_DEBUG(" Number of entries changes = " <<n );
744 return StatusCode::SUCCESS;
745}
746
747
748
749StatusCode FixLArElecCalib::fix5 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
750
751 ATH_MSG_INFO ( " in fix5() " );
752
753 // update EM
754 ATH_CHECK( updateMinBias("mbrms_em_rel12.txt", cabling) );
755 ATH_CHECK( updateMinBias("mbrms_hec_rel12.txt", cabling) );
756
757 // Fix5 is for updating the FCAL noise and MinBiasRMS data using
758 // Sven Menke's file.
759
760 const LArNoiseMC * noise_c = nullptr;
761 ATH_CHECK( detStore()->retrieve(noise_c) );
762 LArNoiseMC* noise = const_cast<LArNoiseMC*>(noise_c);
763
764 const LArMinBiasMC * minbias_c = nullptr;
765 ATH_CHECK( detStore()->retrieve(minbias_c) );
766 LArMinBiasMC* minbias = const_cast<LArMinBiasMC*>(minbias_c);
767
768 int ndisc=0;
769 int nconn=0;
770 for( unsigned int gain=0;gain<3;++gain)
771 {
772 // loop over all the old data
775
776 for (; it!=it_e;++it)
777 {
778 HWIdentifier hid = it.channelId();
779 if( (*it).isEmpty() ) continue;
780
781 Identifier id = cabling->cnvToIdentifier(hid);
782 if(!m_fcal_idhelper->is_lar_fcal(id)) continue;
783
784 if(cabling->isOnlineConnected(hid)){
785 ++nconn;
786 }else {
787 ATH_MSG_ERROR(" unconnected channel"
788 << m_online_idhelper->print_to_string(hid) );
789
790 ++ndisc ;
791 }
792
793 }
794
795 ATH_MSG_INFO(" Gain="<<gain<<
796 " Number of connected and disconnected = " <<nconn<<" " <<ndisc );
797
798 }
799
800
801 int n=0;
802
803 std::string filename("FCal_noise_minbias.txt");
804
805 std::ifstream infile(filename ) ;
806
807 if(! infile.good() )
808 {
809 ATH_MSG_ERROR(" fail to open file "<<filename);
810 return StatusCode::FAILURE;
811 }
812
813
814 char s[200];
815
816 ATH_MSG_INFO("Opened FCAL file");
817 for(int i = 0;i<11;++i){
818 infile.getline(s,200);
819 ATH_MSG_INFO(s);
820 }
821
822 std::string str_id;
823
824 float vol,noise_p,noise_h, noise_m,noise_l;
825
826 while ( infile>>str_id >>vol>>noise_p>>noise_h>>noise_m>>noise_l )
827 {
828 const char* ch_id = str_id.c_str();
829 if(ch_id[0] != 'A') {
830 ATH_MSG_DEBUG(" skipping string"<<str_id);
831 continue;
832 }
833
834 int mod,phi,eta;
835 std::sscanf(ch_id, "A%d.%d.%d", &mod,&phi,&eta);
836 if(phi>7){
837 ATH_MSG_DEBUG(" skipping phi"<<str_id<<" phi="<<phi);
838 continue;
839 }
840 ++n;
841
842 ATH_MSG_INFO(" Setting channel "<<str_id);
843 Identifier id = m_fcal_idhelper->channel_id(2,mod,eta,phi);
844 HWIdentifier hid = cabling->createSignalChannelID(id);
845
846 const LArMinBiasComplete::LArCondObj& t1 = minbias->get(hid,0) ;
848 ATH_MSG_INFO(" minBiasRMS, old new "<<t2.m_MinBiasRMS<<" " <<noise_p);
849 t2.m_MinBiasRMS = noise_p;
850
851 LArNoiseComplete::LArCondObj& u0 = const_cast<LArNoiseComplete::LArCondObj&>(noise->get(hid,0));
852 if(u0.m_Noise!=noise_h)
853 ATH_MSG_INFO(" noise, old new "<<u0.m_Noise<<" " <<noise_h);
854 u0.m_Noise=noise_h;
855
856 LArNoiseComplete::LArCondObj& u1 = const_cast<LArNoiseComplete::LArCondObj&>(noise->get(hid,1));
857 if(u1.m_Noise!=noise_m)
858 ATH_MSG_INFO(" noise, old new "<<u1.m_Noise<<" " <<noise_m);
859 u1.m_Noise=noise_m;
860
861 LArNoiseComplete::LArCondObj& u2 = const_cast<LArNoiseComplete::LArCondObj&>(noise->get(hid,2));
862 if(u2.m_Noise!=noise_l)
863 ATH_MSG_INFO(" noise, old new "<<u2.m_Noise<<" " <<noise_l);
864 u2.m_Noise=noise_l;
865
866 }
867
868 ATH_MSG_INFO(" number of channels in file ="<<n);
869
870 return StatusCode::SUCCESS;
871}
872
873StatusCode FixLArElecCalib::updateMinBias ATLAS_NOT_THREAD_SAFE (const std::string& filename, const LArOnOffIdMapping *cabling) {
874
875 ATH_MSG_INFO ( " in updateMinBias(), filename = "<<filename );
876
877 // this method updates the EM MinBias
878 // input is the text file.
879
880 const LArMinBiasMC * minbias_c = nullptr;
881 ATH_CHECK( detStore()->retrieve(minbias_c) );
882 LArMinBiasMC* minbias = const_cast<LArMinBiasMC*>(minbias_c);
883
884 // read in the file
885
886 ATH_MSG_INFO(" opening file "<< filename );
887 std::ifstream infile( filename);
888 if(! infile.good() )
889 {
890 ATH_MSG_ERROR(" fail to open file ");
891 return StatusCode::FAILURE;
892 }
893
894 int lar,tp,det,samp,reg,eta,phi;
895 //tp=1 for EM, 2=HEC
896
897 float value ;
898 int n = 0;
899 while ( infile>>lar>>tp>>det>>samp>>reg>>eta>>phi>>value )
900 {
901 ++n;
902 ATH_MSG_INFO(" det,samp,reg,eta,value="
903 <<det<<" "
904 <<samp<<" "
905 <<reg<<" "
906 <<eta<<" "
907 <<value<<" " );
908
909 Identifier id ;
910 if ( det==1 && samp==1 && reg==0 && eta==0 ){
911 // eta=0 for strip, not connected, but keep it
912 // Removed disconnected channels: 03/2016 RDS
913 // ATH_MSG_INFO(" disconnected strip ");
914 // id = m_em_idhelper->disc_channel_id(det,samp,reg,eta,0);
915 }else
916 {
917 if (tp==1){
918 id = m_em_idhelper->channel_id(det,samp,reg,eta,0);
919 }else
920 if(tp==2)
921 {
922 id = m_hec_idhelper->channel_id(det,samp,reg,eta,0);
923 }
924 else
925 {
926 ATH_MSG_ERROR(" unknown type "<<tp);
927 continue;
928 }
929 }
930
931 HWIdentifier hid = cabling->createSignalChannelID(id);
932 const LArMinBiasComplete::LArCondObj & t = minbias->get(hid,0);
933 ATH_MSG_INFO(" online id = "<<m_online_idhelper->print_to_string(hid));
934
935 if( t.isEmpty() )
936 {
937 ATH_MSG_ERROR(" No existing conditions data " );
938 ATH_MSG_ERROR( m_em_idhelper->print_to_string(id) );
939 // return StatusCode::FAILURE ;
940 continue ;
941 }
942 ATH_MSG_INFO(" Old MinBias = "<< t.m_MinBiasRMS<< " " );
943
945 t2.m_MinBiasRMS = value ;
946
947 const LArMinBiasComplete::LArCondObj & t3 = minbias->get(hid,0);
948 ATH_MSG_INFO(" New MinBias = "<< t3.m_MinBiasRMS<< " " );
949
950 }
951
952 ATH_MSG_INFO(" Number of entries changes = " <<n );
953 return StatusCode::SUCCESS;
954}
955
956
957StatusCode FixLArElecCalib::fix6 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
958
959 ATH_MSG_INFO ( " in fix6() " );
960
961 // update FCAL noise and gain
962 // Fix6 is for updating the FCAL noise and ADC2DAC, uA2MeV and DAC2uA.
963
964 const LArNoiseMC * noise_c = nullptr;
965 ATH_CHECK( detStore()->retrieve(noise_c) );
966 LArNoiseMC* noise = const_cast<LArNoiseMC*>(noise_c);
967
968 const LArRampMC * ramp_c = nullptr;
969 ATH_CHECK( detStore()->retrieve(ramp_c) );
970 LArRampMC* ramp = const_cast<LArRampMC*>(ramp_c);
971
972 const LAruA2MeVMC * ua2MeV_c = nullptr;
973 ATH_CHECK( detStore()->retrieve(ua2MeV_c) );
974 LAruA2MeVMC* ua2MeV = const_cast<LAruA2MeVMC*>(ua2MeV_c);
975
976 const LArDAC2uAMC * dac2uA_c = nullptr;
977 ATH_CHECK( detStore()->retrieve(dac2uA_c) );
978 LArDAC2uAMC* dac2uA = const_cast<LArDAC2uAMC*>(dac2uA_c);
979
980 int ndisc=0;
981 int nconn=0;
982 for( unsigned int gain=0;gain<3;++gain)
983 {
984 // loop over all the old data
987
988 for (; it!=it_e;++it)
989 {
990 HWIdentifier hid = it.channelId();
991 if( (*it).isEmpty() ) continue;
992
993 Identifier id = cabling->cnvToIdentifier(hid);
994 if(!m_fcal_idhelper->is_lar_fcal(id)) continue;
995
996 if(cabling->isOnlineConnected(hid)){
997 ++nconn;
998 continue;
999 }else
1000 {
1001 ATH_MSG_ERROR(" unconnected channel"
1002 << m_online_idhelper->print_to_string(hid) );
1003
1004 ++ndisc ;
1005 }
1006
1007 }
1008
1009 ATH_MSG_INFO(" Gain="<<gain<<
1010 " Number of connected and disconnected = " <<nconn<<" " <<ndisc );
1011
1012 }
1013
1014
1015 int n=0;
1016
1017 std::string filename("FCal_noise_minbias_adc2mev.txt");
1018 std::ifstream infile(filename) ;
1019
1020 if(! infile.good() )
1021 {
1022 ATH_MSG_ERROR(" fail to open file "<<filename);
1023 return StatusCode::FAILURE;
1024 }
1025
1026
1027 char s[200];
1028
1029 ATH_MSG_INFO("Opened FCAL file");
1030 for(int i = 0;i<27;++i){
1031 infile.getline(s,200);
1032 ATH_MSG_INFO(s);
1033 }
1034
1035 std::string str_id;
1036
1037 float vol,noise_p,noise_h, noise_m,noise_l;
1038 float ramp_val,ua2MeV_val,dac2uA_val;
1039 std::string channel_type;
1040 while ( infile>>str_id >>vol>>noise_p >> noise_h>>noise_m>>noise_l
1041 >>channel_type>> ramp_val>>ua2MeV_val>>dac2uA_val )
1042 {
1043 const char* ch_id = str_id.c_str();
1044
1045 if(str_id.substr(0,1)!=std::string("A")){
1046 ATH_MSG_INFO(" skipping string"<<str_id);
1047 continue;
1048 }
1049
1050 int mod,phi,eta;
1051 sscanf(ch_id, "A%d.%d.%d", &mod,&phi,&eta);
1052 if(phi>7){
1053 ATH_MSG_INFO(" skipping phi"<<str_id<<" phi="<<phi);
1054 continue;
1055 }
1056
1057 ++n;
1058
1059 ATH_MSG_INFO(" Setting channel "<<str_id);
1060 Identifier id = m_fcal_idhelper->channel_id(2,mod,eta,phi);
1061 HWIdentifier hid = cabling->createSignalChannelID(id);
1062
1063 const LArNoiseComplete::LArCondObj& noise0 = noise->get(hid,0) ;
1065 if(u0.m_Noise!=noise_h)
1066 ATH_MSG_INFO(" noise, old new "<<u0.m_Noise<<" " <<noise_h);
1067 u0.m_Noise=noise_h;
1068
1069 const LArNoiseComplete::LArCondObj& noise1 = noise->get(hid,1) ;
1071 if(u1.m_Noise!=noise_m)
1072 ATH_MSG_INFO(" noise, old new "<<u1.m_Noise<<" " <<noise_m);
1073 u1.m_Noise=noise_m;
1074
1075 const LArNoiseComplete::LArCondObj& noise2 = noise->get(hid,2) ;
1077 if(u2.m_Noise!=noise_l)
1078 ATH_MSG_INFO(" noise, old new "<<u2.m_Noise<<" " <<noise_l);
1079 u2.m_Noise=noise_l;
1080
1081 LArRampComplete::LArCondObj& ramp0 = const_cast<LArRampComplete::LArCondObj&>(ramp->get(hid,0));
1082 LArRampComplete::LArCondObj& ramp1 = const_cast<LArRampComplete::LArCondObj&>(ramp->get(hid,1));
1083 LArRampComplete::LArCondObj& ramp2 = const_cast<LArRampComplete::LArCondObj&>(ramp->get(hid,2));
1084
1085 ramp0.m_vRamp={0., ramp_val};
1086
1087 ramp1.m_vRamp={0., ramp_val/(float)9.96};
1088
1089 ramp2.m_vRamp={0., ramp_val/(float)9.96/(float)9.67};
1090
1091 LAruA2MeVComplete::LArCondObj& ua2MeV0 = const_cast<LAruA2MeVComplete::LArCondObj&>(ua2MeV->get(hid,0));
1092 ua2MeV0.m_data=ua2MeV_val;
1093
1094 LArDAC2uAComplete::LArCondObj& dac2ua0 = const_cast<LArDAC2uAComplete::LArCondObj&>(dac2uA->get(hid,0));
1095 dac2ua0.m_data = dac2uA_val;
1096
1097 }
1098
1099 ATH_MSG_INFO(" number of channels in file ="<<n);
1100 return StatusCode::SUCCESS;
1101}
1102
1103
1104StatusCode FixLArElecCalib::fix7 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
1105
1106 ATH_MSG_INFO ( " in fix7() " );
1107 std::string filename ;
1108
1109 // updating fSampl from 13.0.30 for QGSP_BERT
1110 if( m_g4Phys=="QGSP_BERT"){
1111 filename = "fsampl_1303_qgsp-bert.txt";
1112 }
1113 else {
1114 ATH_MSG_ERROR ( " wrong option "<<m_g4Phys );
1115 return StatusCode::FAILURE;
1116 }
1117
1118 ATH_CHECK( updateEMfSampl(filename, cabling ) );
1119 return StatusCode::SUCCESS;
1120}
1121
1122StatusCode FixLArElecCalib::fix8 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
1123
1124 ATH_MSG_INFO ( " in fix8() " );
1125 // update EM/HEC 7 data objects.
1126
1127 ATH_CHECK( addMphysOverMcal(cabling) );
1128
1129 // withGain , nvar
1130 ATH_CHECK( update_EM_HEC<LArNoiseMC>("noise_em.txt","noise_hec.txt", cabling, true, 1 ) );
1131 ATH_CHECK( update_EM_HEC<LArAutoCorrMC>("","autocorr_hec.txt", cabling, true, 4 ) );
1132
1133 ATH_CHECK( update_EM_HEC<LArAutoCorrMC>("autocorr_em.txt","", cabling, true,5) );
1134 ATH_CHECK( update_EM_HEC<LArRampMC>("ramp_em.txt","ramp_hec.txt", cabling, true, 1 ) );
1135 ATH_CHECK( update_EM_HEC<LAruA2MeVMC>("ua2mev_em.txt","ua2mev_hec.txt", cabling, false, 1 ) );
1136 ATH_CHECK( update_EM_HEC<LArDAC2uAMC>("dac2ua_em.txt","dac2ua_hec.txt", cabling, false, 1 ) );
1137 ATH_CHECK( update_EM_HEC<LArShape32MC>("shape_em.txt","shape_hec.txt", cabling, true, 64 ) );
1138 ATH_CHECK( update_EM_HEC<LArMphysOverMcalMC>("mphys_em.txt","", cabling, true, 1 ) );
1139
1140 // additional fix for LArDAC2uA and LAruA2MeV
1141 ATH_CHECK( fixDACuAMeV() );
1142 return StatusCode::SUCCESS;
1143}
1144
1145
1146StatusCode FixLArElecCalib::ReadFile(const std::string& filename, const LArOnOffIdMapping *cabling, bool EM, bool withGain, int nvar ) {
1147
1148 std::ifstream infile(filename) ;
1149
1150 if(! infile.good() )
1151 {
1152 ATH_MSG_ERROR(" fail to open file "<<filename );
1153 return StatusCode::FAILURE;
1154 }
1155
1156 ATH_MSG_INFO(" Opened file "<<filename );
1157
1158 m_cache[0].clear();
1159 m_cache[1].clear();
1160 m_cache[2].clear();
1161
1162 char s[200];
1163 infile.getline(s,200);
1164 ATH_MSG_INFO(" first line of the file "<<s);
1165
1166 int det=2;
1167 int samp,reg,eta;
1168 int first;
1169 while ( infile>>first )
1170 {
1171 if (EM) {
1172 det = first;
1173 infile>>samp>>reg>>eta;
1174 }else
1175 {
1176 samp=first;
1177 infile>>reg>>eta;
1178 }
1179
1180 int gain=0;
1181 if(withGain) infile>>gain ;
1182 std::vector<float> vfl;
1183 float x;
1184
1185 for (int i=0;i<nvar;++i)
1186 {
1187 infile>>x;
1188 vfl.push_back(x);
1189 }
1190 ATH_MSG_DEBUG(" det,samp,reg,eta,values="
1191 <<det<<" "
1192 <<samp<<" "
1193 <<reg<<" "
1194 <<eta<<" " );
1195
1196 Identifier id ;
1197 if (EM)
1198 {
1199 if ( det==1 && samp==1 && reg==0 && eta==0 ){
1200 // eta=0 for strip, not connected, but keep it
1201 // Removed disconnected channels: 03/2016 RDS
1202 ATH_MSG_DEBUG(" disconnected strip ");
1203 }else
1204 id = m_em_idhelper->channel_id(det,samp,reg,eta,0);
1205 }else //HEC
1206 {
1207 id = m_hec_idhelper->channel_id(2,samp,reg,eta,0);
1208 }
1209 HWIdentifier hid = cabling->createSignalChannelID(id);
1210
1211 if (gain >= 0 && gain < 3)
1212 m_cache[gain].push_back(ROW_t(hid,vfl));
1213 }
1214
1215 return StatusCode::SUCCESS;
1216}
1217
1218StatusCode FixLArElecCalib::ReadFileAll(const std::string& filename, const LArOnOffIdMapping *cabling, bool withGain, int nvar ) {
1219
1220 std::ifstream infile(filename) ;
1221
1222 if(! infile.good() )
1223 {
1224 ATH_MSG_ERROR(" fail to open file "<<filename );
1225 return StatusCode::FAILURE;
1226 }
1227
1228 ATH_MSG_INFO(" Opened file "<<filename );
1229
1230 m_cache[0].clear();
1231 m_cache[1].clear();
1232 m_cache[2].clear();
1233
1234 char s[200];
1235 infile.getline(s,200);
1236 ATH_MSG_INFO(" first line of the file "<<s);
1237
1238 int det=0,samp=0,reg=0,eta=0;
1239 int first=0;
1240 while ( infile>>first>>samp>>reg>>eta ) {
1241 Identifier id ;
1242 int gain=0;
1243 float x;
1244 if(first <= 2) { // Calo 0,1,2 is EM
1245 det = first+1;
1246 if ( det==1 && samp==1 && reg==0 && eta==0 ){
1247 // eta=0 for strip, not connected, but keep it
1248 // Removed disconnected channels: 03/2016 RDS
1249 ATH_MSG_DEBUG(" disconnected strip ");
1250 // id = m_em_idhelper->disc_channel_id(det,samp,reg,eta,0);
1251 }else
1252 id = m_em_idhelper->channel_id(det,samp,reg,eta,0);
1253 } else if (first == 3) { // HEC
1254 id = m_hec_idhelper->channel_id(2,samp,reg,eta,0);
1255 } else if (first == 4) { // FCAL
1256 id = m_fcal_idhelper->channel_id(2,samp+1,eta,0);
1257 } else {
1258 ATH_MSG_WARNING(" Wrong calo number "<<first<<" skipping !!!");
1259 if(withGain) infile>>gain ;
1260 for (int i=0;i<nvar;++i) infile>>x;
1261 continue;
1262 }
1263 if(withGain) infile>>gain ;
1264 std::vector<float> vfl;
1265
1266 for (int i=0;i<nvar;++i)
1267 {
1268 infile>>x;
1269 vfl.push_back(x);
1270 }
1271 ATH_MSG_DEBUG(" first, det,samp,reg,eta,values="
1272 <<first<<" " <<det<<" " <<samp<<" " <<reg<<" " <<eta<<" " );
1273
1274 HWIdentifier hid = cabling->createSignalChannelID(id);
1275
1276 if (gain >= 0 && gain < 3) m_cache[gain].push_back(ROW_t(hid,vfl));
1277 else {
1278 ATH_MSG_WARNING(" Wrong gain " <<gain<<" skipping !");
1279 }
1280 }// while
1281
1282 return StatusCode::SUCCESS;
1283}
1284
1286{
1287 if( obj.isEmpty()){
1288 ATH_MSG_INFO(" LArNoiseMC " << msg << " is empty" );
1289 }else
1290 ATH_MSG_DEBUG(" LArNoiseMC" << msg << obj.m_Noise );
1291 return ;
1292}
1293
1294void FixLArElecCalib::set_object(LArNoiseMC::LArCondObj& obj, const std::vector<float>& v )
1295{
1296 if (v.size()!=1)
1297 {
1298 ATH_MSG_ERROR ("for LArNoiseMC, size of vector = "<< v.size() <<" differs from one");
1299 return ;
1300 }
1301 obj.m_Noise = v[0];
1302 return;
1303}
1304
1306{
1307 if( obj.isEmpty()){
1308 ATH_MSG_INFO(" LArAutoCorrMC " << s << " is empty" );
1309 }else
1310 {
1311 msg()<<MSG::DEBUG<<" LArAutoCorrMC" << s ;
1312 for (unsigned int i =0 ; i<obj.m_vAutoCorr.size();++i)
1313 msg()<< " " << obj.m_vAutoCorr[i];
1314 msg()<<endmsg;
1315 }
1316 return ;
1317}
1318
1319void FixLArElecCalib::set_object(LArAutoCorrMC::LArCondObj& obj, const std::vector<float>& v )
1320{
1321 if (v.size()<4 )
1322 {
1323 ATH_MSG_ERROR( "for LArAutoCorrMC, size of vector = "<< v.size()<<" is less then 4" );
1324 return ;
1325 }
1326
1327 obj.m_vAutoCorr.resize(4);
1328 std::copy_n(v.begin(), 4, obj.m_vAutoCorr.begin());
1329 return;
1330}
1331
1332void FixLArElecCalib::print_object(std::string_view s, const LArRampMC::LArCondObj& obj)
1333{
1334 if( obj.isEmpty()){
1335 ATH_MSG_INFO(" LArRampMC " << s << " is empty" );
1336 }else
1337 {
1338 msg()<<MSG::DEBUG<<" LArRampMC" << s ;
1339 for (unsigned int i =0 ; i<obj.m_vRamp.size();++i)
1340 msg()<< " " << obj.m_vRamp[i];
1341 msg()<<endmsg;
1342 }
1343 return ;
1344}
1345
1346void FixLArElecCalib::set_object(LArRampMC::LArCondObj& obj, const std::vector<float>& v )
1347{
1348 if (v.size()!=1 )
1349 {
1350 ATH_MSG_ERROR ("for LArRampMC, size of vector = "<< v.size());
1351 return ;
1352 }
1353 obj.m_vRamp.resize(3);
1354 obj.m_vRamp[0]=0;
1355 obj.m_vRamp[1]=v[0];
1356 obj.m_vRamp[2]=0;
1357
1358 return;
1359}
1360
1362{
1363 if( obj.isEmpty()){
1364 ATH_MSG_INFO(" LArShape32MC " << s << " is empty" );
1365 }else
1366 {
1367 msg()<<MSG::DEBUG<<" LArShape" << s ;
1368 for (unsigned int i =0 ; i<obj.m_vShape.size();++i)
1369 msg()<< " " << obj.m_vShape[i];
1370 msg()<<endmsg;
1371
1372 msg()<<MSG::DEBUG<<" LArShapeDer" << s ;
1373 for (unsigned int i =0 ; i<obj.m_vShapeDer.size();++i)
1374 msg()<< " " << obj.m_vShapeDer[i];
1375 msg()<<endmsg;
1376 }
1377 return ;
1378}
1379
1380void FixLArElecCalib::set_object(LArShape32MC::LArCondObj& obj, const std::vector<float>& v )
1381{
1382
1383 if (v.size()!=64 && v.size()!=32 )
1384 {
1385 ATH_MSG_ERROR ("for LArShape32MC, size of vector = "<< v.size());
1386 return ;
1387 }
1388
1389 unsigned int size = 32;
1390 obj.m_vShape.resize(size);
1391 obj.m_vShapeDer.resize(size);
1392
1393 for(unsigned int i=0;i<size;++i){
1394 obj.m_vShape[i]=v[i];
1395 if(v.size() == 64 ) obj.m_vShapeDer[i]=v[i+size]; else obj.m_vShapeDer[i]=0.;
1396 }
1397
1398 return;
1399}
1400
1401
1402
1403
1404
1405void FixLArElecCalib::print_object(std::string_view msg, const LArSingleFloatP& obj)
1406{
1407 if( obj.isEmpty()){
1408 ATH_MSG_INFO(" LArSingleFloatP " << msg << " is empty" );
1409 }else
1410 ATH_MSG_DEBUG(" LArSingleFloatP " << msg << obj.m_data );
1411 return ;
1412}
1413
1414void FixLArElecCalib::set_object(LArSingleFloatP& obj, const std::vector<float>& v )
1415{
1416 if (v.size()!=1)
1417 {
1418 ATH_MSG_ERROR( "for LArSingleFloatP, size of vector = "<< v.size() );
1419 return ;
1420 }
1421 obj.m_data = v[0];
1422 return;
1423}
1424
1425
1426
1427
1429 // add the contain to DetStore.
1430 // fill 1 for all FCAL/HEC channels
1431
1432 ATH_MSG_INFO ( " addMphysOverMcal() " );
1433 // create LArMphysOverMcal with FCAL numbers = 1.
1434
1435 std::unique_ptr<LArMphysOverMcalMC> mphys = std::make_unique<LArMphysOverMcalMC>();
1436 mphys->setGroupingType(LArConditionsContainerBase::SingleGroup);
1437 ATH_CHECK( mphys->initialize() );
1438
1439 int n=0;
1440
1441 std::string filename("FCal_noise_minbias_adc2mev.txt");
1442
1443 std::ifstream infile(filename ) ;
1444
1445 if(! infile.good() )
1446 {
1447 ATH_MSG_ERROR(" fail to open file "<<filename);
1448 return StatusCode::FAILURE;
1449 }
1450
1451
1452 char s[200];
1453
1454 ATH_MSG_INFO("Opened FCAL file");
1455 for(int i = 0;i<27;++i){
1456 infile.getline(s,200);
1457 ATH_MSG_INFO(s);
1458 }
1459
1460 std::string str_id;
1461
1462 float vol,noise_p,noise_h, noise_m,noise_l;
1463 float ramp_val,ua2MeV_val,dac2uA_val;
1464 std::string channel_type;
1465 while ( infile>>str_id >>vol>>noise_p >> noise_h>>noise_m>>noise_l
1466 >>channel_type>> ramp_val>>ua2MeV_val>>dac2uA_val )
1467 {
1468 const char* ch_id = str_id.c_str();
1469
1470 if(str_id.substr(0,1)!=std::string("A")){
1471 ATH_MSG_INFO(" skipping string"<<str_id);
1472 continue;
1473 }
1474
1475 int mod,phi,eta;
1476 sscanf(ch_id, "A%d.%d.%d", &mod,&phi,&eta);
1477 if(phi>7){
1478 ATH_MSG_INFO(" skipping phi"<<str_id<<" phi="<<phi);
1479 continue;
1480 }
1481
1482 ++n;
1483
1484 ATH_MSG_INFO(" Setting channel "<<str_id);
1485 Identifier id = m_fcal_idhelper->channel_id(2,mod,eta,phi);
1486 HWIdentifier hid = cabling->createSignalChannelID(id);
1487
1489 t.m_data =1. ;
1490 mphys->setPdata(hid,t,0);
1491 mphys->setPdata(hid,t,1);
1492 mphys->setPdata(hid,t,2);
1493 }
1494
1495 ATH_MSG_INFO(" MphysOverMcal added "<<n<<" FCAL channels");
1496
1497 bool EM=false ;
1498 bool withGain=false;
1499 int nvar = 1;
1500 std::string hec_filename("mphys_hec.txt");
1501 ATH_CHECK( ReadFile(hec_filename,cabling,EM,withGain,nvar) );
1502
1503 int igain=0;
1504 n=0;
1505 for( ROW_t &it : m_cache[igain])
1506 {
1507 HWIdentifier hid = it.first;
1509 t.m_data =1. ;
1510 mphys->setPdata(hid,t,0);
1511 mphys->setPdata(hid,t,1);
1512 mphys->setPdata(hid,t,2);
1513 ++n;
1514
1515 }
1516
1517 ATH_CHECK( detStore()->record(std::move(mphys),"LArMphysOverMcal") );
1518 ILArMphysOverMcal* imphys=nullptr;
1519 ATH_CHECK (detStore()->symLink(mphys.get(),imphys) );
1520
1521 ATH_MSG_ERROR(" Number of HEC channel added "<<n <<" per gain ");
1522 return StatusCode::SUCCESS ;
1523}
1524
1525
1526StatusCode FixLArElecCalib::fixDACuAMeV ATLAS_NOT_THREAD_SAFE ()
1527{
1528 // the old data has -10000000 for invalid. change it to {ERRORCODE = -999};
1529
1530 const LArDAC2uAMC * dac2ua_c = nullptr;
1531 ATH_CHECK( detStore()->retrieve(dac2ua_c) );
1532 LArDAC2uAMC* dac2uaMC = const_cast<LArDAC2uAMC*>(dac2ua_c);
1533
1534 const LAruA2MeVMC * ua2mev_c = nullptr;
1535 ATH_CHECK( detStore()->retrieve(ua2mev_c) );
1536 LAruA2MeVMC* ua2mevMC = const_cast<LAruA2MeVMC*>(ua2mev_c);
1537
1538 int n=0;
1539
1540 LAruA2MeVMC::ConditionsMapIterator it = ua2mevMC->begin(0);
1541 LAruA2MeVMC::ConditionsMapIterator it_e = ua2mevMC->end(0);
1542
1543 for(;it!=it_e;++it){
1544 HWIdentifier hid = it.channelId();
1545 const LAruA2MeVComplete::LArCondObj & u = (*it);
1546
1547 if( u.m_data> -990)
1548 {
1549 ATH_MSG_DEBUG(" ua2MeV channel OK "<<u.m_data );
1550 continue ;
1551 }
1552
1553 ATH_MSG_DEBUG(" Old uA2MeV = "<< u.m_data<< " " );
1554
1557
1558 const LAruA2MeVComplete::LArCondObj & u3 = ua2mevMC->get(hid,0);
1559 ATH_MSG_DEBUG(" New uA2MeV = "<< u3.m_data<< " " );
1560
1561 ++n;
1562 }
1563
1564 ATH_MSG_DEBUG(" Number of uA2MeV entries changes = " <<n );
1565
1566 for(unsigned int igain=0;igain<3;++igain)
1567 {
1568 LArDAC2uAMC::ConditionsMapIterator it = dac2uaMC->begin(igain);
1569 LArDAC2uAMC::ConditionsMapIterator it_e = dac2uaMC->end(igain);
1570
1571 n=0;
1572 for( ;it!=it_e;++it){
1573 HWIdentifier hid = it.channelId();
1574 const LArDAC2uAMC::LArCondObj & u = (*it);
1575
1576 if( u.m_data> -990.)
1577 {
1578 ATH_MSG_DEBUG(" DAC2uA channel OK "<<u.m_data );
1579 continue ;
1580 }
1581
1582 ATH_MSG_DEBUG(" Old DAC2uA = "<< u.m_data<< " " );
1583
1586
1587 const LArDAC2uAMC::LArCondObj & u3 = dac2uaMC->get(hid,igain);
1588 ATH_MSG_DEBUG(" New DACuA2 = "<< u3.m_data << " " );
1589 ++n;
1590 }
1591
1592 }
1593
1594 ATH_MSG_DEBUG(" Number of DAC2uA entries changes = " <<n );
1595 return StatusCode::SUCCESS;
1596}
1597
1598
1599StatusCode FixLArElecCalib::fix9 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
1600
1601 ATH_MSG_INFO ( " in fix9(), replace FCAL AutoCorr " );
1602
1603 std::vector<float> fcal_autoCorr[3][3] ; //[module][gain]
1604 fcal_autoCorr[0][0] = {-0.01, -0.30, -0.09, 0.08};
1605 fcal_autoCorr[0][1] = { 0.01, -0.07, -0.01, 0.03};
1606 fcal_autoCorr[0][2] = { 0.2, 0.2, 0.2, 0.2};
1607 fcal_autoCorr[1][0] = { -0.02, -0.31, -0.06, 0.06};
1608 fcal_autoCorr[1][1] = { 0.0, -0.08, -0.01, 0.02};
1609 fcal_autoCorr[1][2] = { 0.02, 0.01, 0.02, 0.02};
1610 fcal_autoCorr[2][0] = { -0.03, -0.31, -0.05, 0.07};
1611 fcal_autoCorr[2][1] = { 0.01, -0.07, -0.01, 0.02};
1612 fcal_autoCorr[2][2] = { 0.02, 0.02, 0.02, 0.02};
1613
1614 // Fix9 is for updating the FCAL AutoCorr conditions data
1615 // Input should be MC Conditions data with DetDescrVersion=ATLAS-CSC-02-00-00
1616
1617 const LArAutoCorrMC * ac_c = nullptr;
1618 ATH_CHECK( detStore()->retrieve(ac_c) );
1619 LArAutoCorrMC* ac = const_cast<LArAutoCorrMC*>(ac_c);
1620
1621
1622 for( unsigned int gain=0;gain<3;++gain)
1623 {
1624 // loop over all the old data
1627
1628 int n=0;
1629 for (; it!=it_e;++it)
1630 {
1631 HWIdentifier hid = it.channelId();
1632 const LArAutoCorrMC::LArCondObj & u = (*it);
1633 if( (*it).isEmpty() ) continue;
1634
1635 Identifier id = cabling->cnvToIdentifier(hid);
1636 if(! m_fcal_idhelper->is_lar_fcal(id)) continue ;
1637 int module = m_fcal_idhelper->module(id) - 1;
1638
1639 ATH_MSG_DEBUG("module= " << module << " Old AutoCorr = "
1640 << u.m_vAutoCorr[0]<< " "
1641 << u.m_vAutoCorr[1]<< " "
1642 << u.m_vAutoCorr[2]<< " "
1643 << u.m_vAutoCorr[3]<< " " );
1644
1646 u2.m_vAutoCorr = fcal_autoCorr[module][gain] ;
1647
1648 const LArAutoCorrMC::LArCondObj & u3 = ac->get(hid,gain);
1649 ATH_MSG_DEBUG(" New AutoCorr = "
1650 << u3.m_vAutoCorr[0]<< " "
1651 << u3.m_vAutoCorr[1]<< " "
1652 << u3.m_vAutoCorr[2]<< " "
1653 << u3.m_vAutoCorr[3]<< " " );
1654 ++n;
1655
1656 }
1657 ATH_MSG_DEBUG(" Gain="<<gain<<
1658 " Number of entries modified = " <<n );
1659 }
1660
1661 return StatusCode::SUCCESS;
1662}
1663
1664
1665StatusCode FixLArElecCalib::fix10 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
1666
1667 ATH_MSG_INFO ( " in fix10() " );
1668 // fix medium and low gain ramp
1669
1670 const LArRampMC * ramp_c = nullptr;
1671 ATH_CHECK( detStore()->retrieve(ramp_c) );
1672 LArRampMC* ramp = const_cast<LArRampMC*>(ramp_c);
1673
1675 LArRampMC::ConditionsMapIterator it_e = ramp->end(0);
1676
1677 int n=0;
1678 int ndisc=0;
1679 for (; it!=it_e;++it)
1680 {
1681 HWIdentifier hid = it.channelId();
1682 if( (*it).isEmpty() ) continue;
1683
1684 Identifier id = cabling->cnvToIdentifier(hid);
1685 if(!m_fcal_idhelper->is_lar_fcal(id)) continue;
1686
1687 if( ! cabling->isOnlineConnected(hid)){
1688 ATH_MSG_ERROR(" unconnected channel"
1689 << m_online_idhelper->print_to_string(hid) );
1690 ++ndisc ;
1691 continue ;
1692 }
1693
1694
1695 const LArRampComplete::LArCondObj& ramp0_c = ramp->get(hid,0) ;
1696 const LArRampComplete::LArCondObj& ramp1_c = ramp->get(hid,1) ;
1697 const LArRampComplete::LArCondObj& ramp2_c = ramp->get(hid,2) ;
1698 LArRampComplete::LArCondObj& ramp0 = const_cast<LArRampComplete::LArCondObj&>(ramp0_c);
1699 LArRampComplete::LArCondObj& ramp1 = const_cast<LArRampComplete::LArCondObj&>(ramp1_c);
1700 LArRampComplete::LArCondObj& ramp2 = const_cast<LArRampComplete::LArCondObj&>(ramp2_c);
1701
1702 float ramp_high = ramp0.m_vRamp[1];
1703
1704 ramp1.m_vRamp.assign ({0, ramp_high*9.96f});
1705 ramp2.m_vRamp.assign ({0, ramp_high*9.96f*9.67f});
1706 ++n;
1707
1708 ATH_MSG_DEBUG(" ramp hi,med,low"<< ramp0.m_vRamp[1]<< " "<<ramp1.m_vRamp[1]<< " " <<
1709 ramp2.m_vRamp[1]);
1710
1711 }
1712
1713 ATH_MSG_INFO( " Number of channels updated = " <<n );
1714 ATH_MSG_INFO( " Number of disconnected = " <<ndisc );
1715
1716 return StatusCode::SUCCESS;
1717}
1718
1719
1720StatusCode FixLArElecCalib::fix11 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
1721
1722 ATH_MSG_INFO ( " in fix8() " );
1723 // update EM/HEC 7 data objects.
1724
1725 ATH_CHECK( update_EM_HEC<LArRampMC>("","ramp_hec_june2008.txt", cabling, true, 1 ) );
1726 return StatusCode::SUCCESS;
1727}
1728
1729
1730StatusCode FixLArElecCalib::fix13(const LArOnOffIdMapping *cabling) {
1731
1732 ATH_MSG_INFO ( " in fix13() " );
1733 // update EM/HEC 7 data objects.
1734
1735 ToolHandle<ICaloSuperCellIDTool> scidtool("CaloSuperCellIDTool");
1736 if ( scidtool.retrieve().isFailure() ) {
1737 ATH_MSG_ERROR ( " Could not retrieve scitool " );
1738 }
1739
1740 std::set<Identifier> scidset;
1741 std::map<HWIdentifier,int> sslot_schannel_idx;
1742 std::vector<unsigned int> OrderOnlHash_OffID;
1743 std::vector<unsigned int> OrderOffHash_OnlID;
1744 OrderOnlHash_OffID.resize(40000,0);
1745 OrderOffHash_OnlID.resize(40000,0);
1746
1747 Identifier::size_type channel_size = m_em_idhelper->channel_hash_max();
1748 unsigned int min_onl_hash = 999999;
1749 unsigned int max_onl_hash = 0;
1750 unsigned int min_off_hash = 999999;
1751 unsigned int max_off_hash = 0;
1752 std::ofstream hashes("AllHashChannels_All.txt");
1753 std::ofstream of("AllChannels_EM.txt");
1754
1755 for(size_t i = 0; i < channel_size ; i++) {
1756 Identifier chid = m_em_idhelper->channel_id(i);
1757 bool isEM = ( m_em_idhelper->is_em_barrel( chid ) || m_em_idhelper->is_em_endcap( chid ) ) ;
1758 if ( ! isEM ) continue;
1759 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1760 if ( scidset.find(SCID) == scidset.end() && (m_scell_idhelper->calo_cell_hash( SCID ).value() < 99999) )
1761 scidset.insert(SCID);
1762 else continue;
1763 HWIdentifier hwid = cabling->createSignalChannelID(chid);
1764 if ( i == 0 ){
1765 of << "Off ID\t\tSCID\t\tOnl ID\t\tFT\tslot\tB-E pos_neg\tSamp\teta\tphi\tFEB_ID\t\tSHWID\t" << std::endl;
1766 }
1767 of << chid.get_identifier32().get_compact() << "\t0x" <<
1768 SCID.get_identifier32().get_compact() << "\t0x" <<
1769 hwid.get_identifier32().get_compact() ;
1770 Identifier regId = m_em_idhelper->region_id( chid );
1771 int reg = m_em_idhelper->region( chid );
1772 IdentifierHash regHash = m_em_idhelper->region_hash( regId );
1773 int samp = m_em_idhelper->sampling( chid );
1774 int feedthrough = m_online_idhelper->feedthrough( hwid );
1775 int bar_ec = m_online_idhelper->barrel_ec( hwid );
1776 int pos_neg = m_online_idhelper->pos_neg( hwid );
1777 int slot = m_online_idhelper->slot( hwid );
1778 float etaG = m_em_idhelper->etaGranularity(regHash);
1779 float phiG = m_em_idhelper->phiGranularity(regHash);
1780 float eta0 = m_em_idhelper->eta0(regHash);
1781 float phi0 = m_em_idhelper->phi0(regHash);
1782 float eta = etaG*m_em_idhelper->eta( chid ) + eta0;
1783 float phi = phiG*m_em_idhelper->phi( chid ) + phi0;
1784 char etaChar[10];
1785 char phiChar[10];
1786 sprintf(etaChar,"%5.4f",eta);
1787 sprintf(phiChar,"%5.4f",phi);
1788 of << std::dec << "\t" << feedthrough << "\t" << slot;
1789 of << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1790 of << etaChar << " " << phiChar << "\t0x";
1791 HWIdentifier feb_id = m_online_idhelper->feb_Id(hwid);
1792 int sslot=1;
1793 bool InSlot= m_em_idhelper->is_em_endcap_inner ( chid );
1794 bool OutSlot= m_em_idhelper->is_em_endcap_outer ( chid ) ;
1795 bool secondOutSlot=false;
1796 if ( OutSlot ) {
1797 if ( (samp==1) && (reg==5) ) secondOutSlot=true;
1798 if ( (samp==2) && (reg==1) && ( m_em_idhelper->eta( chid )>=39 ) )
1799 secondOutSlot=true;
1800 if ( (samp==3) && (reg==0) && ( m_em_idhelper->eta( chid )>=18 ) )
1801 secondOutSlot=true;
1802 }
1803 HWIdentifier sfeb_id = m_sonline_idhelper->feb_Id(bar_ec,pos_neg,feedthrough,sslot);
1804
1805 if ( InSlot ) {
1806 sfeb_id = m_sonline_idhelper->feb_Id(bar_ec,pos_neg,feedthrough-1,sslot+1);
1807 }
1808 if ( secondOutSlot ) {
1809 sfeb_id = m_sonline_idhelper->feb_Id(bar_ec,pos_neg,feedthrough,sslot+1);
1810 }
1811 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1812 sslot_schannel_idx[sfeb_id]=0;
1813 else sslot_schannel_idx[sfeb_id]++;
1814 HWIdentifier shwid = m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]);
1815 unsigned int onl_hash = m_sonline_idhelper->channel_Hash( shwid ).value();
1816 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1817 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1818 unsigned int off_hash = m_scell_idhelper->calo_cell_hash( SCID ).value();
1819 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1820 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1821 of << std::hex;
1822 of << feb_id.get_identifier32().get_compact();
1823 of << "\t0x" << shwid.get_identifier32().get_compact();
1824 of << " " << m_online_idhelper->channel_name(hwid) << " " << m_sonline_idhelper->channel_name(shwid);
1825 of << std::dec;
1826 of << " " << onl_hash << " " << off_hash;
1827 of << std::endl;
1828
1829 if ( m_scell_idhelper->calo_cell_hash( SCID ).value() < 40000 )
1830 OrderOffHash_OnlID[m_scell_idhelper->calo_cell_hash( SCID ).value()] = shwid.get_identifier32().get_compact();
1831 if ( m_sonline_idhelper->channel_Hash( shwid ).value() < 40000 )
1832 OrderOnlHash_OffID[m_sonline_idhelper->channel_Hash( shwid ).value()] = SCID.get_identifier32().get_compact();
1833 }
1834 of << "Hash check. Onl : " << min_onl_hash << " " << max_onl_hash;
1835 of << "; Off : " << min_off_hash << " " << max_off_hash << std::endl;;
1836 of.close();
1837
1838 channel_size = m_hec_idhelper->channel_hash_max();
1839 min_onl_hash = 999999;
1840 max_onl_hash = 0;
1841 min_off_hash = 999999;
1842 max_off_hash = 0;
1843 std::ofstream of1("AllChannels_HEC.txt");
1844
1845 of1 << "Off ID\t\tSCID\t\tOnl ID\t\tFT\tslot\tB-E pos_neg\tSamp\teta\tphi\tFEB_ID\t\tSHWID\t" << std::endl;
1846 for(size_t i = 0; i < channel_size ; i++) {
1847 Identifier chid = m_hec_idhelper->channel_id(i);
1848 if ( ! ( m_hec_idhelper->is_lar_hec( chid ) ) ) continue;
1849 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1850 if ( scidset.find(SCID) == scidset.end() )
1851 scidset.insert(SCID);
1852 else continue;
1853 HWIdentifier hwid = cabling->createSignalChannelID(chid);
1854 of1 << chid.get_identifier32().get_compact() << "\t0x" <<
1855 SCID.get_identifier32().get_compact() << "\t0x" <<
1856 hwid.get_identifier32().get_compact() ;
1857 Identifier regId = m_hec_idhelper->region_id( chid );
1858 IdentifierHash regHash = m_hec_idhelper->region_hash( regId );
1859 int samp = m_hec_idhelper->sampling( chid );
1860 int feedthrough = m_online_idhelper->feedthrough( hwid );
1861 int bar_ec = m_online_idhelper->barrel_ec( hwid );
1862 int pos_neg = m_online_idhelper->pos_neg( hwid );
1863 int slot = m_online_idhelper->slot( hwid );
1864 float etaG = m_hec_idhelper->etaGranularity(regHash);
1865 float phiG = m_hec_idhelper->phiGranularity(regHash);
1866 float eta0 = m_hec_idhelper->eta0(regHash);
1867 float phi0 = m_hec_idhelper->phi0(regHash);
1868 float eta = etaG*m_hec_idhelper->eta( chid ) + eta0;
1869 float phi = phiG*m_hec_idhelper->phi( chid ) + phi0;
1870 char etaChar[10];
1871 char phiChar[10];
1872 sprintf(etaChar,"%5.4f",eta);
1873 sprintf(phiChar,"%5.4f",phi);
1874 of1 << std::dec << "\t" << feedthrough << "\t" << slot;
1875 of1 << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1876 of1 << etaChar << " " << phiChar << "\t0x";
1877 HWIdentifier feb_id = m_online_idhelper->feb_Id(hwid);
1878 int sslot=1;
1879 int subtract=0;
1880 HWIdentifier sfeb_id = m_sonline_idhelper->feb_Id(bar_ec,pos_neg,feedthrough,sslot);
1881 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1882 sslot_schannel_idx[sfeb_id]=0;
1883 else sslot_schannel_idx[sfeb_id]++;
1884 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
1885 sfeb_id = m_sonline_idhelper->feb_Id(bar_ec,pos_neg,feedthrough,sslot+1);
1886 subtract=192;
1887 }
1888 HWIdentifier shwid = m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]-subtract);
1889 unsigned int onl_hash = m_sonline_idhelper->channel_Hash( shwid ).value();
1890 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1891 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1892 unsigned int off_hash = m_scell_idhelper->calo_cell_hash( SCID ).value();
1893 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1894 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1895 of1 << std::hex;
1896 of1 << feb_id.get_identifier32().get_compact();
1897 of1 << "\t0x" << shwid.get_identifier32().get_compact();
1898 of1 << " " << m_online_idhelper->channel_name(hwid) << " " << m_sonline_idhelper->channel_name(shwid);
1899 of1 << std::dec;
1900 of1 << " " << onl_hash << " " << off_hash;
1901 of1 << std::endl;
1902
1903 OrderOffHash_OnlID[m_scell_idhelper->calo_cell_hash( SCID ).value()] = shwid.get_identifier32().get_compact();
1904 OrderOnlHash_OffID[m_sonline_idhelper->channel_Hash( shwid ).value()] = SCID.get_identifier32().get_compact();
1905 }
1906
1907 channel_size = m_fcal_idhelper->channel_hash_max();
1908 min_onl_hash = 999999;
1909 max_onl_hash = 0;
1910 min_off_hash = 999999;
1911 max_off_hash = 0;
1912 std::ofstream of3("AllChannels_FCAL.txt");
1913
1914 of3 << "Off ID\t\tSCID\t\tOnl ID\t\tFT\tslot\tB-E pos_neg\tSamp\teta\tphi\tFEB_ID\t\tSHWID\t" << std::endl;
1915 for(size_t i = 0; i < channel_size ; i++) {
1916 Identifier chid = m_fcal_idhelper->channel_id(i);
1917 if ( ! ( m_fcal_idhelper->is_lar_fcal( chid ) ) ) continue;
1918 Identifier SCID = scidtool->offlineToSuperCellID(chid);
1919 if ( scidset.find(SCID) == scidset.end() )
1920 scidset.insert(SCID);
1921 else continue;
1922 HWIdentifier hwid = cabling->createSignalChannelID(chid);
1923 of3 << chid.get_identifier32().get_compact() << "\t0x" <<
1924 SCID.get_identifier32().get_compact() << "\t0x" <<
1925 hwid.get_identifier32().get_compact() ;
1926 int samp = 0;
1927 int feedthrough = m_online_idhelper->feedthrough( hwid );
1928 int bar_ec = m_online_idhelper->barrel_ec( hwid );
1929 int pos_neg = m_online_idhelper->pos_neg( hwid );
1930 int slot = m_online_idhelper->slot( hwid );
1931 of3 << std::dec << "\t" << feedthrough << "\t" << slot;
1932 of3 << "\t" << bar_ec << " " << pos_neg << "\t\t" << samp << "\t";
1933 HWIdentifier feb_id = m_online_idhelper->feb_Id(hwid);
1934 int sslot=1;
1935 HWIdentifier sfeb_id = m_sonline_idhelper->feb_Id(bar_ec,pos_neg,feedthrough,sslot);
1936 if ( (feedthrough==6) && (bar_ec==1) && (slot>9) ) {
1937 sfeb_id = m_sonline_idhelper->feb_Id(bar_ec,pos_neg,feedthrough,sslot+1);
1938 }
1939 if ( sslot_schannel_idx.find(sfeb_id) == sslot_schannel_idx.end() )
1940 sslot_schannel_idx[sfeb_id]=0;
1941 else sslot_schannel_idx[sfeb_id]++;
1942 HWIdentifier shwid = m_sonline_idhelper->channel_Id(sfeb_id,sslot_schannel_idx[sfeb_id]);
1943 unsigned int onl_hash = m_sonline_idhelper->channel_Hash( shwid ).value();
1944 if ( onl_hash > max_onl_hash ) max_onl_hash = onl_hash;
1945 if ( onl_hash < min_onl_hash ) min_onl_hash = onl_hash;
1946 unsigned int off_hash = m_scell_idhelper->calo_cell_hash( SCID ).value();
1947 if ( off_hash > max_off_hash ) max_off_hash = off_hash;
1948 if ( off_hash < min_off_hash ) min_off_hash = off_hash;
1949 of3 << std::hex;
1950 of3 << feb_id.get_identifier32().get_compact();
1951 of3 << "\t0x" << shwid.get_identifier32().get_compact();
1952 of3 << " " << m_online_idhelper->channel_name(hwid) << " " << m_sonline_idhelper->channel_name(shwid);
1953 of3 << std::dec;
1954 of3 << " " << onl_hash << " " << off_hash;
1955 of3 << std::endl;
1956
1957 OrderOffHash_OnlID[m_scell_idhelper->calo_cell_hash( SCID ).value()] = shwid.get_identifier32().get_compact();
1958 OrderOnlHash_OffID[m_sonline_idhelper->channel_Hash( shwid ).value()] = SCID.get_identifier32().get_compact();
1959 }
1960
1961 of3 << "Hash check. Onl : " << min_onl_hash << " " << max_onl_hash;
1962 of3 << "; Off : " << min_off_hash << " " << max_off_hash << std::endl;;
1963 of3.close();
1964
1965
1966
1967 const uint32_t onlHashMax=m_sonline_idhelper->channelHashMax();
1968 coral::AttributeListSpecification *spec_onOff = new coral::AttributeListSpecification();
1969 spec_onOff->extend("OnlineHashToOfflineId", "blob");
1970 spec_onOff->extend<unsigned>("version");
1971 std::unique_ptr<AthenaAttributeList> al_onOff = std::make_unique<AthenaAttributeList>(*spec_onOff);
1972 coral::Blob& blobOnOff=(*al_onOff)["OnlineHashToOfflineId"].data<coral::Blob>();
1973 (*al_onOff)["version"].setValue(0U);
1974 blobOnOff.resize(onlHashMax*sizeof(uint32_t));
1975 uint32_t* pBlobOnOff=static_cast<uint32_t*>(blobOnOff.startingAddress());
1976 unsigned nConn=0;
1977
1978 const uint32_t emptyId=Identifier().get_identifier32().get_compact();
1979 for(size_t ii=0;ii<onlHashMax;ii++) {
1980 if (OrderOnlHash_OffID[ii] != 0) {
1981 pBlobOnOff[ii]=OrderOnlHash_OffID[ii];
1982 nConn++;
1983 }
1984 else
1985 pBlobOnOff[ii]=emptyId;
1986 }
1987
1988 ATH_MSG_INFO ( "HashMax=" << onlHashMax << ", connected=" << nConn );
1989
1990 ATH_CHECK( detStore()->record(std::move(al_onOff),"/LAR/IdentifierOfl/OnOffIdMap_SC") );
1991
1992 hashes << "idx \t Off2OnlId \t Onl2OffId" << std::endl;
1993 for(size_t ii=0;ii<40000;ii++)
1994 if ( (OrderOffHash_OnlID[ii] != 0) || ( OrderOnlHash_OffID[ii] != 0 ) )
1995 hashes << std::dec << ii << std::hex << " \t " << OrderOffHash_OnlID[ii] << " \t\t " << OrderOnlHash_OffID[ii] << std::endl;
1996 hashes.close();
1997
1998 return StatusCode::SUCCESS;
1999}
2000
2001StatusCode FixLArElecCalib::fix12(const LArOnOffIdMapping *cabling) {
2002
2003 ATH_MSG_INFO ( " in fix12() " );
2004
2005 // Fix12 is for filling the MinBiasRMS and MinBiasAverage from ntuple
2006
2007 // Create new container
2008 std::unique_ptr<LArMinBiasMC> minbias = std::make_unique<LArMinBiasMC>();
2009 ATH_CHECK( minbias->setGroupingType("Single", msg()) );
2010 ATH_CHECK( minbias->initialize() );
2011 std::unique_ptr<LArMinBiasAverageMC> minbias_av = std::make_unique<LArMinBiasAverageMC>();
2012 ATH_CHECK( minbias_av->setGroupingType("Single", msg()) );
2013 ATH_CHECK( minbias_av->initialize() );
2014 //
2015 std::unique_ptr<TFile> fin= std::make_unique<TFile>("ntuple_av.root");
2016 TTree *tin=dynamic_cast<TTree*>(fin->Get("m_tree"));
2017 if (!tin) {
2018 ATH_MSG_ERROR("Can't read tree m_tree");
2019 return StatusCode::FAILURE;
2020 }
2021 const int nindex=1833;
2022 int ncell;
2023 std::vector<int> identifier(2862);
2024 std::vector<int> layer(2862);
2025 std::vector<int> region(2862);
2026 std::vector<int> ieta(2862);
2027 std::vector<float> eta(2862);
2028 std::vector<double> average(2862);
2029 std::vector<double> rms(2862);
2030 TBranch *b_ncell;
2031 TBranch *b_identifier;
2032 TBranch *b_layer;
2033 TBranch *b_region;
2034 TBranch *b_ieta;
2035 TBranch *b_eta;
2036 TBranch *b_average;
2037 TBranch *b_rms;
2038 tin->SetMakeClass(1);
2039 tin->SetBranchAddress("ncell", &ncell, &b_ncell);
2040 tin->SetBranchAddress("identifier", identifier.data(), &b_identifier);
2041 tin->SetBranchAddress("layer", layer.data(), &b_layer);
2042 tin->SetBranchAddress("region", region.data(), &b_region);
2043 tin->SetBranchAddress("ieta", ieta.data(), &b_ieta);
2044 tin->SetBranchAddress("eta", eta.data(), &b_eta);
2045 tin->SetBranchAddress("average", average.data(), &b_average);
2046 tin->SetBranchAddress("rms", rms.data(), &b_rms);
2047 tin->GetEntry(0);
2048
2049 if(ncell>nindex) ncell=nindex;
2050 for(int icell=0; icell<ncell; ++icell) {
2051
2052 Identifier32 id32(identifier[icell]);
2053 Identifier id(id32);
2054 HWIdentifier hid = cabling->createSignalChannelID(id);
2055
2056 minbias->set(hid, rms[icell]);
2057 minbias_av->set(hid, average[icell]);
2058
2059 }
2060
2061 ATH_MSG_INFO(" number of channels in intuple ="<<ncell);
2062
2063 ATH_MSG_INFO ( "Stored container " << minbias->totalNumberOfConditions() << " conditions, key LArMinBias " );
2064 ATH_CHECK( detStore()->record(std::move(minbias),"LArMinBias") );
2065 //ATH_CHECK( detStore()->symLink(minbias.get(), dynamic_cast<ILArMinBias*>(minbias.get())) );
2067 ATH_MSG_INFO ( "Stored container " << minbias_av->totalNumberOfConditions() << " conditions, key LArMinBiasAverage " );
2068 ATH_CHECK( detStore()->record(std::move(minbias_av),"LArMinBiasAverage") );
2069 //ATH_CHECK( detStore()->symLink(minbias_av.get(), dynamic_cast<ILArMinBiasAverage*>(minbias_av.get())) );
2071
2072 return StatusCode::SUCCESS;
2073}
2074
2075StatusCode FixLArElecCalib::fix14(const LArOnOffIdMapping *cabling) {
2076
2077 ATH_MSG_INFO ( " in fix14() " );
2078
2079 // Fix14 is for filling the LArPileupAverage from ntuple
2080
2081 const ILArfSampl* larfSampl = nullptr;
2082 ATH_CHECK( detStore()->retrieve(larfSampl,"") );
2083 // Will try to regenerate from scratch
2084 // Create new container
2085 std::unique_ptr<LArMinBiasAverageMC> minbias_av = std::make_unique<LArMinBiasAverageMC>();
2086 ATH_CHECK( minbias_av->setGroupingType("Single", msg()) );
2087 ATH_CHECK( minbias_av->initialize() );
2088 //
2089 std::unique_ptr<TFile> fin= std::make_unique<TFile>(m_infile.value().c_str());
2090 TTree *tin=dynamic_cast<TTree*>(fin->Get("m_tree"));
2091 if (!tin) {
2092 ATH_MSG_ERROR("Can't read tree m_tree");
2093 return StatusCode::FAILURE;
2094 }
2095 int ncell;
2096 std::vector<int> identifier(2862);
2097 std::vector<int> layer(2862);
2098 std::vector<int> region(2862);
2099 std::vector<int> ieta(2862);
2100 std::vector<float> eta(2862);
2101 std::vector<double> average(2862);
2102 std::vector<double> rms(2862);
2103 TBranch *b_ncell;
2104 TBranch *b_identifier;
2105 TBranch *b_layer;
2106 TBranch *b_region;
2107 TBranch *b_ieta;
2108 TBranch *b_eta;
2109 TBranch *b_average;
2110 TBranch *b_rms;
2111 tin->SetMakeClass(1);
2112 tin->SetBranchAddress("ncell", &ncell, &b_ncell);
2113 tin->SetBranchAddress("identifier", identifier.data(), &b_identifier);
2114 tin->SetBranchAddress("layer", layer.data(), &b_layer);
2115 tin->SetBranchAddress("region", region.data(), &b_region);
2116 tin->SetBranchAddress("ieta", ieta.data(), &b_ieta);
2117 tin->SetBranchAddress("eta", eta.data(), &b_eta);
2118 tin->SetBranchAddress("average", average.data(), &b_average);
2119 tin->SetBranchAddress("rms", rms.data(), &b_rms);
2120 tin->GetEntry(0);
2121
2122
2123 for(int icell=0; icell<ncell; ++icell) {
2124
2125 Identifier32 id32(identifier[icell]);
2126 Identifier id(id32);
2127 HWIdentifier hid = cabling->createSignalChannelID(id);
2128 float fsampl = larfSampl->FSAMPL(hid);
2129 minbias_av->set(hid, 6.31*average[icell]/fsampl);
2130
2131 }
2132
2133 ATH_MSG_INFO(" number of channels in intuple ="<<ncell);
2134
2135 ATH_MSG_INFO ( "Stored container " << minbias_av->totalNumberOfConditions() << " conditions, key LArPileupAverage " );
2136 ATH_CHECK( detStore()->record(std::move(minbias_av),"LArPileupAverage") );
2137 ATH_CHECK( detStore()->symLink(minbias_av.get(), dynamic_cast<ILArMinBiasAverage*>(minbias_av.get())) );
2138
2139 return StatusCode::SUCCESS;
2140}
2141
2142StatusCode FixLArElecCalib::fix15 ATLAS_NOT_THREAD_SAFE () {
2143
2144 ATH_MSG_INFO ( " in fix15 " );
2145
2146 // this method updates the EM MinBias
2147 // input is the text file.
2148
2149 const LArMinBiasAverageMC * minbias_c = nullptr;
2150 ATH_CHECK( detStore()->retrieve(minbias_c,"LArPileupAverage") );
2151 LArMinBiasAverageMC* minbias = const_cast<LArMinBiasAverageMC*>(minbias_c);
2152
2153
2154 // here some iterator loop is needed
2155 int n=0;
2156
2159
2160 for(;it!=it_e;++it){
2161 HWIdentifier hid = it.channelId();
2162 const LArMinBiasAverageComplete::LArCondObj & u = (*it);
2163
2164 ATH_MSG_INFO(" Old pileup = "<< u.m_MinBiasAverage<< " " );
2165
2167
2168 u2.m_MinBiasAverage *= 1.0838; // correction value
2169
2170
2171 const LArMinBiasAverageComplete::LArCondObj & t3 = minbias->get(hid,0);
2172 ATH_MSG_INFO(" New Pileup = "<< t3.m_MinBiasAverage<< " " );
2173
2174 }
2175
2176 ATH_MSG_INFO(" Number of entries changes = " <<n );
2177 return StatusCode::SUCCESS;
2178}
2179
2180StatusCode FixLArElecCalib::fix16 ATLAS_NOT_THREAD_SAFE () {
2181
2182 ATH_MSG_INFO ( " in fix16() " );
2183
2184 std::string onOffIdKey="/LAR/Identifier/OnOffIdMap";
2185 const AthenaAttributeList *attrOnOff=nullptr;
2186 StatusCode sc=detStore()->retrieve(attrOnOff,onOffIdKey);
2187 if (sc.isFailure()) {
2188 ATH_MSG_ERROR("Failed to read AthenaAttributeList with key " << onOffIdKey);
2189 return StatusCode::FAILURE;
2190 }
2191 const coral::Blob& blobOnOff=(*attrOnOff)["OnlineHashToOfflineId"].data<coral::Blob>();
2192 unsigned nChan=blobOnOff.size()/sizeof(uint32_t);
2193 uint32_t* pBlobOnOff=const_cast<uint32_t*>(static_cast<const uint32_t*>(blobOnOff.startingAddress()));
2194
2195
2196 if (nChan!=m_online_idhelper->channelHashMax()) {
2197 ATH_MSG_WARNING("Number of channels read from DB (" << nChan << ") does not match online hash max ("
2198 <<m_online_idhelper->channelHashMax() << ")");
2199 nChan=std::min(nChan,static_cast<unsigned int>(m_online_idhelper->channelHashMax()));
2200 }
2201 std::vector<std::pair<unsigned int, unsigned int> > swapindex(8, std::make_pair(nChan+10,nChan+10)); // here we store, which indexes to swap
2202 // loop over all online hashes
2203 for (unsigned i=0;i<nChan;++i) {
2204 const HWIdentifier hwid = m_online_idhelper->channel_Id(IdentifierHash(i));
2205 if(m_online_idhelper->isEMECchannel(hwid) && m_online_idhelper->pos_neg(hwid) == 1 && m_online_idhelper->feedthrough(hwid) == 7 && m_online_idhelper->slot(hwid) == 11) { //EMEC-A FT 7, Slot 11
2206 if(m_online_idhelper->channel(hwid)>=96 && m_online_idhelper->channel(hwid)<=103) swapindex[m_online_idhelper->channel(hwid)-96].first=i;
2207 if(m_online_idhelper->channel(hwid)>=112 && m_online_idhelper->channel(hwid)<=129) swapindex[m_online_idhelper->channel(hwid)-112].second=i;
2208 }
2209 }
2210 for(unsigned i=0; i<8; ++i) {
2211 }
2212 // now do swaping
2213 for(unsigned i=0; i<8; ++i) {
2214 // check consistency of swapindex
2215 if (swapindex[i].first > nChan || swapindex[i].second > nChan ) {
2216 ATH_MSG_ERROR("Problem in swapindex: "<< i << " : " << swapindex[i].first << " " << swapindex[i].second);
2217 return StatusCode::FAILURE;
2218 }
2219 uint32_t id = pBlobOnOff[swapindex[i].first];
2220 pBlobOnOff[swapindex[i].first] = pBlobOnOff[swapindex[i].second];
2221 pBlobOnOff[swapindex[i].second] = id;
2222 }
2223 // and now record the changed blob to SG
2224 ATH_CHECK(detStore()->record(const_cast<AthenaAttributeList *>(attrOnOff),"/LAR/Identifier/OnOffIdMapNew"));
2225
2226 return StatusCode::SUCCESS;
2227}
2228
2229StatusCode FixLArElecCalib::fix17 ATLAS_NOT_THREAD_SAFE (const LArOnOffIdMapping *cabling) {
2230
2231 ATH_MSG_INFO ( " in fix17() " );
2232
2233 // withGain , nvar
2234 ATH_CHECK( update_All<LArShape32MC>(m_infile.value(), cabling, true, 32 ) );
2235
2236 return StatusCode::SUCCESS;
2237}
2238
2240
2241 ATH_MSG_INFO ( " in fix18() " );
2242
2243 const uint32_t onlHashMax=m_online_idhelper->channelHashMax();
2244
2245 coral::AttributeListSpecification* spec_calib = new coral::AttributeListSpecification();
2246 spec_calib->extend("OnlineHashToCalibIds", "blob");
2247 spec_calib->extend<unsigned>("version");
2248 std::unique_ptr<AthenaAttributeList> al_calib = std::make_unique<AthenaAttributeList>(*spec_calib);
2249 coral::Blob& blobCalib=(*al_calib)["OnlineHashToCalibIds"].data<coral::Blob>();
2250 (*al_calib)["version"].setValue(0U);
2251 blobCalib.resize(onlHashMax*sizeof(uint32_t)*4); //Bigger than necessary
2252
2253 spec_calib->release();
2254 // cppcheck-suppress memleak
2255 spec_calib = nullptr;
2256
2257 uint32_t* pBlobCalib=static_cast<uint32_t*>(blobCalib.startingAddress());
2258 size_t calibIndex=0;
2259
2260
2261 // loop over all online hashes
2262 for (unsigned i=0;i<onlHashMax;++i) {
2263 const HWIdentifier hwid = m_online_idhelper->channel_Id(IdentifierHash(i));
2264
2265 const std::vector<HWIdentifier>& calibIDs=cabling->calibSlotLine(hwid);
2266 const size_t nCalibLines=calibIDs.size();
2267
2268 if (m_online_idhelper->isEMBchannel(hwid) && m_online_idhelper->pos_neg(hwid) == 1 && m_online_idhelper->feedthrough(hwid) == 0 ) { // EMB-A FT 0
2269 if(nCalibLines > 1) { //should not be in our channels
2270 ATH_MSG_ERROR("Wrong number of CL in our channels");
2271 return StatusCode::FAILURE;
2272 }
2273 if(nCalibLines==0) {
2274 pBlobCalib[calibIndex++]=0;
2275 } else {
2276 const HWIdentifier cmodule = m_online_idhelper->calib_module_Id(calibIDs[0]);
2277 const HWIdentifier newcl = m_online_idhelper->calib_channel_Id(cmodule, m_online_idhelper->channel(hwid) );
2278 if(!m_online_idhelper->isCalibration(newcl)) {
2279 ATH_MSG_ERROR("Something wrong, new CL not a calibration");
2280 ATH_MSG_ERROR("Channel: "<<hwid.get_identifier32().get_compact()<<" old CL: "<< calibIDs[0].get_identifier32().get_compact()<<" new CL: "<<newcl.get_identifier32().get_compact());
2281 return StatusCode::FAILURE;
2282 }
2283 ATH_MSG_INFO("Channel: "<<hwid.get_identifier32().get_compact()<<" old CL: "<< calibIDs[0].get_identifier32().get_compact()<<" new CL: "<<newcl.get_identifier32().get_compact());
2284 pBlobCalib[calibIndex++]=1;
2285 pBlobCalib[calibIndex++]=newcl.get_identifier32().get_compact();
2286 }
2287 } else {
2288 pBlobCalib[calibIndex++]=nCalibLines;
2289 for(uint32_t iCalib=0;iCalib<nCalibLines;++iCalib)
2290 pBlobCalib[calibIndex++]=calibIDs[iCalib].get_identifier32().get_compact();
2291 }
2292 }
2293 blobCalib.resize(calibIndex*sizeof(uint32_t)); //Size down to actual size
2294 ATH_MSG_INFO( "BlobSize CalibId:" << calibIndex);
2295
2296 // and now record the blob to SG
2297 ATH_CHECK(detStore()->record(std::move(al_calib),"/LAR/Identifier/CalibIdMap_EMF"));
2298
2299 return StatusCode::SUCCESS;
2300}
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_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helper class for offline supercell identifiers.
StatusCode FixLArElecCalib::stop ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
static Double_t sc
size_t size() const
Number of registered mappings.
#define x
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() const
An AttributeList represents a logical row of attributes in a metadata table.
std::string print_to_string(Identifier id, const IdContext *context=0) const
or provide the printout in string form
StatusCode fix13(const LArOnOffIdMapping *cabling)
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
StatusCode fix12(const LArOnOffIdMapping *cabling)
void set_object(LArNoiseMC::LArCondObj &obj, const std::vector< float > &v)
StatusCode ReadFile(const std::string &filename, const LArOnOffIdMapping *cabling, bool EM, bool withGain, int nvar)
const LArOnline_SuperCellID * m_sonline_idhelper
virtual StatusCode initialize() override
StatusCode fix2(const LArOnOffIdMapping *cabling)
const LArEM_SuperCell_ID * m_sem_idhelper
StringProperty m_infile
StatusCode fix1(const LArOnOffIdMapping *cabling)
virtual StatusCode execute() override
StatusCode fix18(const LArCalibLineMapping *clmap)
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
const LArHEC_ID * m_hec_idhelper
IntegerProperty m_fixFlag
const LArOnlineID * m_online_idhelper
void print_object(std::string_view msg, const LArNoiseMC::LArCondObj &obj)
const LArFCAL_ID * m_fcal_idhelper
const CaloCell_SuperCell_ID * m_scell_idhelper
const LArEM_ID * m_em_idhelper
std::pair< HWIdentifier, std::vector< float > > ROW_t
StatusCode fix14(const LArOnOffIdMapping *cabling)
StatusCode addMphysOverMcal(const LArOnOffIdMapping *cabling)
const LArHEC_SuperCell_ID * m_shec_idhelper
StatusCode ReadFileAll(const std::string &filename, const LArOnOffIdMapping *cabling, bool withGain, int nvar)
FixLArElecCalib(const std::string &name, ISvcLocator *pSvcLocator)
virtual const float & FSAMPL(const HWIdentifier &id) const =0
value_type get_compact() const
Get the compact id.
This is a "hash" representation of an Identifier.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Implementation of the interface ILArAutoCorr for MC Derives from LArAutoCorrComplete,...
std::vector< float > m_vAutoCorr
void setPdata(const HWIdentifier id, const T &payload, unsigned int gain=0)
put payload in persistent data
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
get data with online identifier
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
Implementation of the interface ILArDAC2uA for MC Derives from LArDAC2uAComplete, and implements the ...
Definition LArDAC2uAMC.h:21
Identifier channel_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
id_iterator fcal_end() const
end iterator over full set of Fcal Identifiers for channels
id_iterator fcal_begin() const
begin iterator over full set of Fcal Identifiers for channels
int phi(const Identifier id) const
phi [0,15]
int pos_neg(const Identifier id) const
pos_neg : +/- 2 (A/C side)
Helper class for LArFCAL offline identifiers.
Definition LArFCAL_ID.h:49
Implementation of the interface ILArMinBiasAverage for MC Derives from LArMinBiasAverageComplete,...
Implementation of the interface ILArMinBias for MC Derives from LArMinBiasComplete,...
Implementation of the interface ILArNoise for MC Derives from LArNoiseComplete, and implements the ph...
Definition LArNoiseMC.h:20
float m_Noise
Definition LArNoiseP.h:17
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
Implementation of the interface ILArRamp for MC Derives from LArRampComplete, and implements the phi-...
Definition LArRampMC.h:22
std::vector< float > m_vRamp
Definition LArRampP1.h:30
bool isEmpty() const
Definition LArRampP1.h:29
This class implements the ILArShape interface.
Implementation of the interface ILArfSampl for MC Derives from LArfSamplComplete, and implements the ...
Definition LArfSamplMC.h:23
Implementation of the interface ILAruA2MeV for MC Derives from LAruA2MeVComplete, and implements the ...
Definition LAruA2MeVMC.h:22
std::vector< ALFA_RawDataContainer_p1 > t2
std::vector< ALFA_RawDataCollection_p1 > t1
::StatusCode StatusCode
StatusCode definition for legacy code.
std::vector< LUCID_RawData_p1 > t3
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77
setEventNumber uint32_t