ATLAS Offline Software
LArMinBias2Ntuple.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 #include "GaudiKernel/INTupleSvc.h"
11 #include "GaudiKernel/NTuple.h"
12 #include "GaudiKernel/SmartDataPtr.h"
13 */
14 
15 //#include <fstream>
16 
17 LArMinBias2Ntuple::LArMinBias2Ntuple(const std::string& name, ISvcLocator* pSvcLocator):
18  LArCond2NtupleBase(name, pSvcLocator),
19  m_isPileup(false) {
20  declareProperty("ContainerKey",m_contKey="LArMinBias");
21  //declareProperty("IsMC",m_isMC = false);
22 
23  declareProperty("NtupleTitle",m_ntTitle="MinBias");
24  declareProperty("NtupleName",m_ntpath="/NTUPLES/FILE1/MINBIAS");
25 
26 }
27 
29 = default;
30 
32 
33  const ILArMinBias* LArMinBias = nullptr;
34  const ILArMinBiasAverage* LArMinBiasAv = nullptr;
35 
36  m_isPileup = m_contKey.find("Pileup") != std::string::npos;
37  if(!m_isPileup) ATH_CHECK( m_detStore->retrieve(LArMinBias,m_contKey) );
38  ATH_CHECK( m_detStore->retrieve(LArMinBiasAv,m_contKey+"Average") );
39 
40  NTuple::Item<float> minbias;
41  NTuple::Item<float> minbias_av;
42 
44  const LArOnOffIdMapping* cabling=*cablingHdl;
45  if(!cabling) {
46  ATH_MSG_WARNING( "Do not have cabling object LArOnOffIdMapping" );
47  return StatusCode::FAILURE;
48  }
49 
50  if(!m_isPileup) ATH_CHECK( m_nt->addItem("MinBias",minbias) );
51  ATH_CHECK( m_nt->addItem("MinBiasAv",minbias_av) );
52 
53  unsigned cellCounter=0;
54  for (const HWIdentifier hwid: m_onlineId->channel_range()) {
55  if ( cabling->isOnlineConnected(hwid)) {
56  fillFromIdentifier(hwid);
57  if(!m_isPileup) minbias = LArMinBias->minBiasRMS(hwid);
58  minbias_av = LArMinBiasAv->minBiasAverage(hwid);
59  ATH_CHECK( ntupleSvc()->writeRecord(m_nt) );
60  }//end if isConnected
61  cellCounter++;
62  }//end loop over online ID
63 
64  ATH_MSG_INFO( "LArMinBias2Ntuple has finished, " << cellCounter << " cells written." );
65  return StatusCode::SUCCESS;
66 }// end finalize-method.
67 
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArMinBiasMC.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArMinBias2Ntuple::m_contKey
std::string m_contKey
Definition: LArMinBias2Ntuple.h:22
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArMinBias2Ntuple.h
ILArMinBiasAverage
Definition: ILArMinBiasAverage.h:13
HWIdentifier
Definition: HWIdentifier.h:13
LArCond2NtupleBase
Definition: LArCond2NtupleBase.h:32
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
LArMinBias2Ntuple::stop
virtual StatusCode stop()
Definition: LArMinBias2Ntuple.cxx:31
LArMinBias2Ntuple::m_isPileup
bool m_isPileup
Definition: LArMinBias2Ntuple.h:23
LArOnlineID_Base::channel_range
id_range channel_range() const
Definition: LArOnlineID_Base.cxx:1932
ILArMinBiasAverage::minBiasAverage
virtual const float & minBiasAverage(const HWIdentifier &id) const =0
access to average of E in minimum bias events index by Identifier
LArMinBias2Ntuple::~LArMinBias2Ntuple
~LArMinBias2Ntuple()
LArCond2NtupleBase::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArCond2NtupleBase.h:89
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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
LArMinBias2Ntuple::LArMinBias2Ntuple
LArMinBias2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArMinBias2Ntuple.cxx:17
ILArMinBias
Definition: ILArMinBias.h:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition: LArCond2NtupleBase.h:65
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
ILArMinBias::minBiasRMS
virtual const float & minBiasRMS(const HWIdentifier &id) const =0
access to RMS of E in minimum bias events index by Identifier
LArMinBiasAverageMC.h
LArCond2NtupleBase::m_detStore
StoreGateSvc * m_detStore
Definition: LArCond2NtupleBase.h:81
CaloGain.h
ntupleSvc
INTupleSvc * ntupleSvc()
Definition: ServiceAccessor.h:14
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20