ATLAS Offline Software
Loading...
Searching...
No Matches
LArPedestals2Ntuple.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9
10LArPedestals2Ntuple::LArPedestals2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
11 LArCond2NtupleBase(name, pSvcLocator),
12 m_pedKey("Pedestal"){
13
14 declareProperty("ContainerKey",m_pedKey);
15 m_ntTitle="Pedestals";
16 m_ntpath="/NTUPLES/FILE1/PEDESTALS";
17
18}
19
21= default;
22
24 ATH_CHECK(m_pedKey.initialize());
26}
27
29{
30 // For compatibility with existing configurations, look in the detector
31 // store first, then in conditions.
32 const ILArPedestal* larPedestal =
33 detStore()->tryConstRetrieve<ILArPedestal> (m_pedKey.key());
34 if (!larPedestal) {
36 larPedestal = *pedHandle;
37 }
38
39 if (larPedestal==nullptr) {
40 ATH_MSG_ERROR( "Unable to retrieve ILArPedestal with key "
41 << m_pedKey.key() << " from DetectorStore");
42 return StatusCode::FAILURE;
43 }
44
45 NTuple::Item<long> cellIndex,gain;
46 NTuple::Item<double> ped;
47 NTuple::Item<double> rms;
48
49
50 StatusCode sc=m_nt->addItem("icell",cellIndex,0,200000);
51 if (sc!=StatusCode::SUCCESS)
52 {ATH_MSG_ERROR( "addItem 'Cell Index' failed" );
53 return StatusCode::FAILURE;
54 }
55
56 sc=m_nt->addItem("gain",gain,0,3);
57 if (sc!=StatusCode::SUCCESS) {
58 ATH_MSG_ERROR( "addItem 'gain' failed" );
59 return StatusCode::FAILURE;
60 }
61
62
63 sc=m_nt->addItem("ped",ped,-1000.,5000.);
64 if (sc!=StatusCode::SUCCESS) {
65 ATH_MSG_ERROR( "addItem 'ped' failed" );
66 return StatusCode::FAILURE;
67 }
68
69 sc=m_nt->addItem("rms",rms,0.,1e12);
70 if (sc!=StatusCode::SUCCESS) {
71 ATH_MSG_ERROR( "addItem 'rms' failed" );
72 return StatusCode::FAILURE;
73 }
74
75
76 unsigned cellCounter=0;
77 auto maxgain = CaloGain::LARNGAIN;
79
80 for(long igain=CaloGain::LARHIGHGAIN; igain<maxgain; igain++) {
81 for (const HWIdentifier hwid: m_onlineId->channel_range()) {
82 if (larPedestal->pedestal(hwid,igain)>ILArPedestal::ERRORCODE) {
83 fillFromIdentifier(hwid);
84 cellIndex = cellCounter;
85
86 ped=larPedestal->pedestal(hwid,igain);
87 rms=larPedestal->pedestalRMS(hwid,igain);
88 gain=igain;
89
90 sc=ntupleSvc()->writeRecord(m_nt);
91 if (sc!=StatusCode::SUCCESS) {
92 ATH_MSG_ERROR( "writeRecord failed" );
93 return StatusCode::FAILURE;
94 }
95 }// end if Pedestal exists for this channel
96 cellCounter++;
97 }//end loop over gains
98 }//end loop over online ID
99
100 ATH_MSG_INFO( "LArPedestals2Ntuple has finished." );
101 return StatusCode::SUCCESS;
102}// end finalize-method.
103
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
static Double_t sc
INTupleSvc * ntupleSvc()
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
virtual float pedestal(const HWIdentifier &id, int gain) const =0
virtual float pedestalRMS(const HWIdentifier &id, int gain) const =0
access to RMS of Pedestal index by Identifier, and gain setting
Gaudi::Property< bool > m_isSC
const LArOnlineID_Base * m_onlineId
bool fillFromIdentifier(const HWIdentifier &id)
LArCond2NtupleBase(const std::string &name, ISvcLocator *pSvcLocator)
LArPedestals2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode stop()
SG::ReadCondHandleKey< ILArPedestal > m_pedKey
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18