ATLAS Offline Software
Loading...
Searching...
No Matches
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
14LArRampCorr::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.
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() const
Exception class for LAr online Identifiers.
std::vector< std::string > m_inputStringIDs
Definition LArRampCorr.h:39
LArRampCorr(const std::string &name, ISvcLocator *pSvcLocator)
std::string m_keyoutput
Definition LArRampCorr.h:33
StatusCode initialize()
StatusCode stop()
const LArOnlineID * m_onlineHelper
Definition LArRampCorr.h:41
StatusCode execute()
std::string m_groupingType
Definition LArRampCorr.h:36
std::vector< float > m_vRamp
Definition LArRampP1.h:30