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