ATLAS Offline Software
LArRinj2Ntuple.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
9 
10 
11 LArRinj2Ntuple::LArRinj2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
12  LArCond2NtupleBase(name, pSvcLocator) {
13  declareProperty("ContainerKey",m_contKey);
14  m_ntTitle="Rinj";
15  m_ntpath="/NTUPLES/FILE1/RINJ";
16 
17 }
18 
20 = default;
21 
23  const ILArRinj* LArRinj = nullptr;
24  StatusCode sc;
25  sc=m_detStore->retrieve(LArRinj,m_contKey);
26  if (sc!=StatusCode::SUCCESS) {
27  ATH_MSG_ERROR( "Unable to retrieve ILArRinj with key "
28  << m_contKey << " from DetectorStore try ConditionsStore" );
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 = (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 
detail::ll
long long ll
Definition: PrimitiveHelpers.h:46
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArRinj2Ntuple::m_contKey
std::string m_contKey
Definition: LArRinj2Ntuple.h:23
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
ILArRinj::Rinj
virtual const float & Rinj(const HWIdentifier &id) const =0
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*.
LArRinjComplete.h
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
LArRinj2Ntuple::~LArRinj2Ntuple
~LArRinj2Ntuple()
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:221
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition: LArCond2NtupleBase.h:65
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:11
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
LArRinj2Ntuple::stop
virtual StatusCode stop()
Definition: LArRinj2Ntuple.cxx:22
LArOnlineID.h
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20