ATLAS Offline Software
Loading...
Searching...
No Matches
LArfSampl2Ntuple.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
10LArfSampl2Ntuple::LArfSampl2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
11 LArCond2NtupleBase(name, pSvcLocator) {
12 m_ntTitle="fSampl";
13 m_ntpath="/NTUPLES/FILE1/FSAMPL";
14
15}
16
18= default;
19
21 ATH_CHECK(m_contKey.initialize());
23}
24
26
27 // For compatibility with existing configurations, look in the detector
28 // store first, then in conditions store
29 const ILArfSampl* larfSampl = detStore()->tryConstRetrieve<ILArfSampl>(m_contKey.key());
30 if (!larfSampl){
32 larfSampl=*fsamplHdl;
33 }
34
35 StatusCode sc;
36
37 NTuple::Item<long> cellIndex;
38 NTuple::Item<float> fsampl;
39
40 sc=m_nt->addItem("icell",cellIndex,0,2000);
41 if (sc!=StatusCode::SUCCESS)
42 {ATH_MSG_ERROR( "addItem 'Cell Index' failed" );
43 return StatusCode::FAILURE;
44 }
45
46 sc=m_nt->addItem("fsampl",fsampl);
47 if (sc!=StatusCode::SUCCESS)
48 {ATH_MSG_ERROR( "addItem 'fsampl' failed" );
49 return StatusCode::FAILURE;
50 }
51
53 const LArOnOffIdMapping* cabling=*cablingHdl;
54 if(!cabling) {
55 ATH_MSG_WARNING( "Do not have cabling object LArOnOffIdMapping" );
56 return StatusCode::FAILURE;
57 }
58
59 unsigned cellCounter=0;
60 for (const HWIdentifier hwid: m_onlineId->channel_range()) {
61 if ( cabling->isOnlineConnected(hwid)) {
62 fillFromIdentifier(hwid);
63 cellIndex = cellCounter;
64 fsampl = larfSampl->FSAMPL(hwid);
65 sc=ntupleSvc()->writeRecord(m_nt);
66 if (sc!=StatusCode::SUCCESS) {
67 ATH_MSG_ERROR( "writeRecord failed" );
68 return StatusCode::FAILURE;
69 }
70 }//end if isConnected
71 cellCounter++;
72 }//end loop over online ID
73
74 ATH_MSG_INFO( "LArfSampl2Ntuple has finished." );
75 return StatusCode::SUCCESS;
76}// end finalize-method.
77
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
INTupleSvc * ntupleSvc()
const ServiceHandle< StoreGateSvc > & detStore() const
virtual const float & FSAMPL(const HWIdentifier &id) const =0
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
const LArOnlineID_Base * m_onlineId
bool fillFromIdentifier(const HWIdentifier &id)
LArCond2NtupleBase(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize()
virtual StatusCode stop()
SG::ReadCondHandleKey< ILArfSampl > m_contKey
LArfSampl2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)