Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
9 LArRinj2Ntuple::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  const ILArRinj* LArRinj = nullptr;
19  if (sc!=StatusCode::SUCCESS) {
20  ATH_MSG_ERROR( "Unable to retrieve ILArRinj with key "
21  << m_contKey << " from DetectorStore try ConditionsStore" );
22 
25  LArRinj = *rinjHdl;
26  if(!LArRinj) {
27  ATH_MSG_ERROR( "Unable to retrieve ILArRinj with key "
28  << m_contKey << " from ConditionsStore as well" );
29  return StatusCode::FAILURE;
30  }
31  }
32 
33  NTuple::Item<long> cellIndex;
34  NTuple::Item<float> rinj;
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 
43  sc=m_nt->addItem("rinj",rinj,-1000.,2.);
44  if (sc!=StatusCode::SUCCESS) {
45  ATH_MSG_ERROR( "addItem 'rinj' failed" );
46  return StatusCode::FAILURE;
47  }
48 
49 
50  ATH_MSG_DEBUG( "LArRinj2Ntuple: using LAr cell cabling" );
52  const LArOnOffIdMapping *cabling=*cablingHdl;
53  if(!cabling) {
54  ATH_MSG_WARNING( "Do not have cabling object LArOnOffIdMapping" );
55  return StatusCode::FAILURE;
56  }
57 
58  //=================
59 
60  const LArOnlineID* ll;
61  sc = detStore()->retrieve(ll, "LArOnlineID");
62  if (sc.isFailure()) {
63  msg(MSG::ERROR) << "Could not get LArOnlineID helper !" << endmsg;
64  return StatusCode::FAILURE;
65  }
66  else {
67  m_onlineId = (const LArOnlineID_Base*)ll;
68  ATH_MSG_DEBUG(" Found the LAr cell LArOnlineID helper. ");
69  }
70 
71  // ==============
72 
73  unsigned cellCounter=0;
74  for (const HWIdentifier hwid: m_onlineId->channel_range()) {
75  if ( cabling->isOnlineConnected(hwid)) {
76  fillFromIdentifier(hwid);
77  cellIndex = cellCounter;
78  rinj = LArRinj->Rinj(hwid);
79  sc=ntupleSvc()->writeRecord(m_nt);
80  if (sc!=StatusCode::SUCCESS) {
81  ATH_MSG_ERROR( "writeRecord failed" );
82  return StatusCode::FAILURE;
83  }
84  cellCounter++;
85  }//end if isConnected
86  }//end loop over online ID
87  ATH_MSG_INFO("LArRinj2Ntuple: filled "<<cellCounter);
88  ATH_MSG_INFO( "LArRinj2Ntuple has finished." );
89  return StatusCode::SUCCESS;
90 }// end finalize-method.
91 
LArRinj2Ntuple::stop
virtual StatusCode stop() override
Definition: LArRinj2Ntuple.cxx:16
detail::ll
long long ll
Definition: PrimitiveHelpers.h:47
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArRinj2Ntuple::m_contKey
SG::ReadCondHandleKey< LArRinjComplete > m_contKey
Definition: LArRinj2Ntuple.h:23
ILArRinj::Rinj
virtual const float & Rinj(const HWIdentifier &id) const =0
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HWIdentifier
Definition: HWIdentifier.h:13
LArCond2NtupleBase
Definition: LArCond2NtupleBase.h:32
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
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
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
ILArRinj
Definition: ILArRinj.h:12
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArOnlineID_Base::channel_range
id_range channel_range() const
Definition: LArOnlineID_Base.cxx:1932
LArCond2NtupleBase::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArCond2NtupleBase.h:89
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArCond2NtupleBase::m_ntpath
std::string m_ntpath
Definition: LArCond2NtupleBase.h:65
LArCond2NtupleBase::m_nt
NTuple::Tuple * m_nt
Definition: LArCond2NtupleBase.h:68
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition: LArCond2NtupleBase.h:65
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArOnlineID
Definition: LArOnlineID.h:20
LArCond2NtupleBase::m_onlineId
const LArOnlineID_Base * m_onlineId
Definition: LArCond2NtupleBase.h:85
LArCond2NtupleBase::fillFromIdentifier
bool fillFromIdentifier(const HWIdentifier &id)
Definition: LArCond2NtupleBase.cxx:288
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArRinj2Ntuple::LArRinj2Ntuple
LArRinj2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArRinj2Ntuple.cxx:9
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LArCond2NtupleBase::m_detStore
StoreGateSvc * m_detStore
Definition: LArCond2NtupleBase.h:81
LArRinj2Ntuple.h
ntupleSvc
INTupleSvc * ntupleSvc()
Definition: ServiceAccessor.h:14
LArOnlineID.h
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20