ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibUtils
src
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
5
#include "
LArCalibUtils/LArRampCorr.h
"
6
#include "
LArIdentifier/LArOnlID_Exception.h
"
7
8
#include <fstream>
9
10
#include "
LArRawConditions/LArConditionsContainerDB.h
"
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
24
LArRampCorr::~LArRampCorr
()
25
=
default
;
26
27
StatusCode
LArRampCorr::initialize
()
28
{
29
ATH_CHECK
(
detStore
()->retrieve(
m_onlineHelper
,
"LArOnlineID"
) );
30
return
StatusCode::SUCCESS;
31
}
32
33
34
// ********************** EXECUTE ****************************
35
StatusCode
LArRampCorr::execute
(
const
EventContext&
/*ctx*/
)
36
{
37
return
StatusCode::SUCCESS;
38
}
39
40
// ********************** FINALIZE ****************************
41
StatusCode
LArRampCorr::stop
()
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!
90
LArRampComplete::LArCondObj
ramp;
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.
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
LArConditionsContainerDB.h
LArOnlID_Exception.h
LArRampCorr.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
HWIdentifier
Definition
HWIdentifier.h:13
LArConditionsContainer< LArRampP1 >::LArCondObj
LArRampP1 LArCondObj
Definition
LArConditionsContainer.h:69
LArOnlID_Exception
Exception class for LAr online Identifiers.
Definition
LArOnlID_Exception.h:16
LArRampCorr::m_inputStringIDs
std::vector< std::string > m_inputStringIDs
Definition
LArRampCorr.h:39
LArRampCorr::LArRampCorr
LArRampCorr(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArRampCorr.cxx:14
LArRampCorr::m_keyoutput
std::string m_keyoutput
Definition
LArRampCorr.h:33
LArRampCorr::initialize
StatusCode initialize()
Definition
LArRampCorr.cxx:27
LArRampCorr::~LArRampCorr
~LArRampCorr()
LArRampCorr::stop
StatusCode stop()
Definition
LArRampCorr.cxx:41
LArRampCorr::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition
LArRampCorr.h:41
LArRampCorr::m_groupingType
std::string m_groupingType
Definition
LArRampCorr.h:36
LArRampCorr::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
LArRampCorr.cxx:35
LArRampP1::m_vRamp
std::vector< float > m_vRamp
Definition
LArRampP1.h:30
Generated on
for ATLAS Offline Software by
1.17.0