ATLAS Offline Software
LArRampCorr.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include <fstream>
9 
11 
12 //#define LARRAMPBUILDER_DEBUGOUTPUT
13 
14 LArRampCorr::LArRampCorr(const std::string& name, ISvcLocator* pSvcLocator)
15  : AthAlgorithm(name, pSvcLocator),
16  m_onlineHelper(nullptr)
17 {
18  m_inputStringIDs.resize(0);
19  declareProperty("KeyOutput", m_keyoutput="LArRampCorr");
20  declareProperty("GroupingType", m_groupingType="SubDetector");
21  declareProperty("Corrections", m_inputStringIDs);
22 }
23 
25 = default;
26 
28 {
29  ATH_CHECK( detStore()->retrieve(m_onlineHelper, "LArOnlineID") );
30  return StatusCode::SUCCESS;
31 }
32 
33 
34 // ********************** EXECUTE ****************************
36 {
37  return StatusCode::SUCCESS;
38 }
39 
40 // ********************** FINALIZE ****************************
42 {
43  ATH_MSG_INFO ( "in stop." );
44 
45  auto larRampCorr = std::make_unique<LArRampComplete>();
46  ATH_CHECK( larRampCorr->setGroupingType(m_groupingType,msg()) );
47  ATH_CHECK( larRampCorr->initialize() );
48 
49  std::vector<float> coeffs;
50 
51  std::vector<std::string>::const_iterator itrStringID=m_inputStringIDs.begin();
52  for (;itrStringID!=m_inputStringIDs.end();++itrStringID) {
53 
54  const std::string& theString=*itrStringID;
55  std::stringstream is;
56  is << theString << std::endl;
57  int iBarrel,iSide,iFT,iSlot,iChannel,iGain;
58  float slope;
59 
60  is >>iBarrel >> iSide >> iFT >> iSlot >> iChannel >> iGain >> slope;
61 
62  HWIdentifier chid;
63  try {
64  chid = m_onlineHelper->channel_Id (iBarrel,
65  iSide,
66  iFT,
67  iSlot,
68  iChannel );
69  }
70  catch(LArOnlID_Exception & except){
71 
72 
73  ATH_MSG_ERROR( " LArOnlId exception creating chid "
74  << (std::string)except
75  << " barrel_ec, side, feedthrough, slot, channel= " << iBarrel << " "
76  << iSide << " "
77  << iFT << " "
78  << iSlot << " "
79  << iChannel );
80  }
81 
82  coeffs.resize(2,0);
83  coeffs[0]=0.;
84  coeffs[1]=slope;
85 
86  std::cout << " Fix channel " << iBarrel << " " << iSide << " " << iFT << " " << iSlot << " "
87  << " " << iChannel << " Gain = " << iGain << " New Slope " << slope << std::endl;
88 
89  //LArRampP ramp; // avoid direct use of payload object!
91 
92  ramp.m_vRamp = coeffs;
93  ATH_CHECK ( larRampCorr->insertCorrection(chid,ramp,iGain) );
94  }
95 
96  ATH_CHECK( detStore()->record(std::move(larRampCorr),m_keyoutput) );
97  ATH_MSG_INFO ( "LArRampCorr has finished." );
98 
99  return StatusCode::SUCCESS;
100 }// end finalize-method.
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArConditionsContainerDB.h
LArRampCorr::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition: LArRampCorr.h:41
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArRampCorr::m_keyoutput
std::string m_keyoutput
Definition: LArRampCorr.h:33
LArRampCorr::m_groupingType
std::string m_groupingType
Definition: LArRampCorr.h:36
LArRampP1
Persistent data for LArRamp Copied from LAr.
Definition: LArRampP1.h:24
LArOnlID_Exception.h
LArRampCorr::m_inputStringIDs
std::vector< std::string > m_inputStringIDs
Definition: LArRampCorr.h:39
LArRampCorr::execute
StatusCode execute()
Definition: LArRampCorr.cxx:35
LArRampCorr.h
HWIdentifier
Definition: HWIdentifier.h:13
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
perfmonmt-refit.coeffs
coeffs
Definition: perfmonmt-refit.py:105
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArRampCorr::LArRampCorr
LArRampCorr(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArRampCorr.cxx:14
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArOnlID_Exception
Exception class for LAr online Identifiers.
Definition: LArOnlID_Exception.h:16
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArRampCorr::~LArRampCorr
~LArRampCorr()
AthAlgorithm
Definition: AthAlgorithm.h:47
LArRampCorr::stop
StatusCode stop()
Definition: LArRampCorr.cxx:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
LArRampCorr::initialize
StatusCode initialize()
Definition: LArRampCorr.cxx:27
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24