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