ATLAS Offline Software
Loading...
Searching...
No Matches
LArRinj2Ntuple.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8
9LArRinj2Ntuple::LArRinj2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
10 LArCond2NtupleBase(name, pSvcLocator) {
11 m_ntTitle="Rinj";
12 m_ntpath="/NTUPLES/FILE1/RINJ";
13
14}
15
17 ATH_CHECK(m_contKey.initialize() );
19}
20
22 const ILArRinj* LArRinj = nullptr;
23 StatusCode sc;
24 sc=m_detStore->retrieve(LArRinj,m_contKey.key());
25 if (sc!=StatusCode::SUCCESS) {
26 ATH_MSG_ERROR( "Unable to retrieve ILArRinj with key "
27 << m_contKey << " from DetectorStore try ConditionsStore" );
28 const EventContext& ctx = Gaudi::Hive::currentContext();
30 LArRinj = *rinjHdl;
31 if(!LArRinj) {
32 ATH_MSG_ERROR( "Unable to retrieve ILArRinj with key "
33 << m_contKey << " from ConditionsStore as well" );
34 return StatusCode::FAILURE;
35 }
36 }
37
38 NTuple::Item<long> cellIndex;
39 NTuple::Item<float> rinj;
40
41 sc=m_nt->addItem("icell",cellIndex,0,2000);
42 if (sc!=StatusCode::SUCCESS)
43 {ATH_MSG_ERROR( "addItem 'Cell Index' failed" );
44 return StatusCode::FAILURE;
45 }
46
47
48 sc=m_nt->addItem("rinj",rinj,-1000.,2.);
49 if (sc!=StatusCode::SUCCESS) {
50 ATH_MSG_ERROR( "addItem 'rinj' failed" );
51 return StatusCode::FAILURE;
52 }
53
54
55 ATH_MSG_DEBUG( "LArRinj2Ntuple: using LAr cell cabling" );
57 const LArOnOffIdMapping *cabling=*cablingHdl;
58 if(!cabling) {
59 ATH_MSG_WARNING( "Do not have cabling object LArOnOffIdMapping" );
60 return StatusCode::FAILURE;
61 }
62
63 //=================
64
65 const LArOnlineID* ll;
66 sc = detStore()->retrieve(ll, "LArOnlineID");
67 if (sc.isFailure()) {
68 msg(MSG::ERROR) << "Could not get LArOnlineID helper !" << endmsg;
69 return StatusCode::FAILURE;
70 }
71 else {
72 m_onlineId = static_cast<const LArOnlineID_Base*>(ll);
73 ATH_MSG_DEBUG(" Found the LAr cell LArOnlineID helper. ");
74 }
75
76 // ==============
77
78 unsigned cellCounter=0;
79 for (const HWIdentifier hwid: m_onlineId->channel_range()) {
80 if ( cabling->isOnlineConnected(hwid)) {
81 fillFromIdentifier(hwid);
82 cellIndex = cellCounter;
83 rinj = LArRinj->Rinj(hwid);
84 sc=ntupleSvc()->writeRecord(m_nt);
85 if (sc!=StatusCode::SUCCESS) {
86 ATH_MSG_ERROR( "writeRecord failed" );
87 return StatusCode::FAILURE;
88 }
89 cellCounter++;
90 }//end if isConnected
91 }//end loop over online ID
92 ATH_MSG_INFO("LArRinj2Ntuple: filled "<<cellCounter);
93 ATH_MSG_INFO( "LArRinj2Ntuple has finished." );
94 return StatusCode::SUCCESS;
95}// end finalize-method.
96
#define endmsg
#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)
#define ATH_MSG_DEBUG(x)
static Double_t sc
INTupleSvc * ntupleSvc()
const ServiceHandle< StoreGateSvc > & detStore() const
virtual const float & Rinj(const HWIdentifier &id) 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)
Helper for the Liquid Argon Calorimeter cell identifiers.
LArRinj2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode stop()
virtual StatusCode initialize()
SG::ReadCondHandleKey< LArRinjComplete > m_contKey
MsgStream & msg
Definition testRead.cxx:32