ATLAS Offline Software
Loading...
Searching...
No Matches
LArNoise2Ntuple.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10
11LArNoise2Ntuple::LArNoise2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
12 LArCond2NtupleBase(name, pSvcLocator) {
13 declareProperty("ContainerKey",m_contKey);
14
15 m_ntTitle="Noise";
16 m_ntpath="/NTUPLES/FILE1/NOISE";
17
18}
19
21= default;
22
24 const ILArNoise* larNoise = nullptr;
25 StatusCode sc;
26 sc=m_detStore->retrieve(larNoise,m_contKey);
27 if (sc!=StatusCode::SUCCESS) {
28 ATH_MSG_ERROR( "Unable to retrieve ILArNoise with key "
29 << m_contKey << " from DetectorStore" );
30 return StatusCode::FAILURE;
31 }
32
33 NTuple::Item<long> cellIndex,gain;
34 NTuple::Item<float> noise;
35
36 sc=m_nt->addItem("icell",cellIndex,0,2000);
37 if (sc!=StatusCode::SUCCESS)
38 {ATH_MSG_ERROR( "addItem 'Cell Index' failed" );
39 return StatusCode::FAILURE;
40 }
41
42 sc=m_nt->addItem("gain",gain,0,3);
43 if (sc!=StatusCode::SUCCESS)
44 {ATH_MSG_ERROR( "addItem 'gain' failed" );
45 return StatusCode::FAILURE;
46 }
47
48
49 sc=m_nt->addItem("noise",noise);
50 if (sc!=StatusCode::SUCCESS)
51 {ATH_MSG_ERROR( "addItem 'noise' failed" );
52 return StatusCode::FAILURE;
53 }
54
56 const LArOnOffIdMapping* cabling=*cablingHdl;
57 if(!cabling) {
58 ATH_MSG_WARNING( "Do not have cabling object LArOnOffIdMapping" );
59 return StatusCode::FAILURE;
60 }
61
62 unsigned cellCounter=0;
63 for(long igain=CaloGain::LARHIGHGAIN; igain<CaloGain::LARNGAIN; igain++) {
64 for (const HWIdentifier hwid: m_onlineId->channel_range()) {
65 if ( cabling->isOnlineConnected(hwid)) {
66 fillFromIdentifier(hwid);
67 cellIndex = cellCounter;
68 gain=igain;
69 noise = larNoise->noise(hwid,igain);
70 sc=ntupleSvc()->writeRecord(m_nt);
71 if (sc!=StatusCode::SUCCESS) {
72 ATH_MSG_ERROR( "writeRecord failed" );
73 return StatusCode::FAILURE;
74 }
75 }//end if isConnected
76 cellCounter++;
77 }//end loop over online ID
78 } // ovr gains
79
80 ATH_MSG_INFO( "LArNoise2Ntuple has finished." );
81 return StatusCode::SUCCESS;
82}// end finalize-method.
83
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
INTupleSvc * ntupleSvc()
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
virtual const float & noise(const HWIdentifier &id, int gain) const =0
StoreGateSvc * m_detStore
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
const LArOnlineID_Base * m_onlineId
bool fillFromIdentifier(const HWIdentifier &id)
LArCond2NtupleBase(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode stop()
LArNoise2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
std::string m_contKey
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18