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