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