ATLAS Offline Software
LArRawChannelBuilderToolBaseClass.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LARROD_LARRAWCHANNELBUILDERTOOLBASECLASS
6 #define LARROD_LARRAWCHANNELBUILDERTOOLBASECLASS
7 
8 #include "GaudiKernel/MsgStream.h"
9 
13 
14 #include <iomanip>
15 #include <cmath>
16 
18  const std::string& name,
19  const IInterface* parent):
21  m_parent(nullptr),
22  m_helper(nullptr),
23  m_isSC(false)
24 {
25 declareProperty("IsSuperCell", m_isSC = false);
26 }
27 
29  delete m_helper;
30 }
31 
32 void
34 {
35  MsgStream log(msgSvc(), name());
36  ulonglong sum=0;
37  for( unsigned int i=0; i<m_helper->returnMaxErrors(); i++ )
39 
40  log << MSG::INFO << "Printing Summary for tool " << name() << " :" << endmsg;
41  log << MSG::INFO
42  << std::setw(40) << " " << " : "
43  << std::setw(12) << " total "
44  << std::setw(10) << " percent " << " "
45  << std::setw(12) << " per event "
46  << std::setw(12) << " RMS "
47  << endmsg;
48 
49  double inv_sum = sum > 0 ? 1./sum : 1;
50  for( unsigned int i=0; i<m_helper->returnMaxErrors(); i++ )
51  {
52  double fraction = 0.0;
53  double perEvent = 0.0;
54  double rmsPerEv = 0.0;
55  if(sum>0)
56  fraction=100 * double(m_helper->returnErrorCount(i)) * inv_sum;
57  if(m_helper->returnEvents()>0)
58  {
61  rmsPerEv = sqrt(std::max(0.,rmsPerEv-perEvent*perEvent));
62  }
63 
64  log << MSG::INFO
65  << std::setw(40)
66  << m_helper->returnErrorString(i) << " : "
67  << std::setw(12)
69  << std::setw(10)
70  << std::fixed
71  << std::setprecision(4)
72  << fraction
73  << " %"
74  << std::setw(12)
75  << std::fixed
76  << std::setprecision(4)
77  << perEvent
78  << std::setw(12)
79  << std::fixed
80  << std::setprecision(4)
81  << rmsPerEv
82  << endmsg;
83  }
84 }
85 
86 void
88 {
90  finalEvent();
91 }
92 
95 {
96  const LArOnOffIdMapping *cabling=nullptr;
97  if(m_isSC) {
99  cabling = *cablingHdl;
100  } else {
102  cabling = *cablingHdl;
103  }
104  if(!cabling) {
105  m_parent->curr_id=0;
106  } else {
107  if(m_parent->curr_id==0) {
108  try {
109  m_parent->curr_id = cabling->cnvToIdentifier(m_parent->curr_chid);
110  } catch ( LArID_Exception & except ) {
111  ATH_MSG_INFO("Cabling exception was caught for channel 0x!"
112  << MSG::hex << m_parent->curr_chid.get_compact() << MSG::dec );
113  m_parent->curr_id=0;
114  }
115  }
116  }
117  return m_parent->curr_id;
118 }
119 
120 
121 #endif
LArRawChannelBuilderToolBaseClass.h
max
#define max(a, b)
Definition: cfImp.cxx:41
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArRawChannelBuilderToolBaseClass::LArRawChannelBuilderToolBaseClass
LArRawChannelBuilderToolBaseClass(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArRawChannelBuilderToolBaseClass.cxx:17
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArRawChannelBuilderParams::curr_id
Identifier curr_id
Definition: LArRawChannelBuilderParams.h:23
LArRawChannelBuilderToolBaseClass::finalEventHidden
virtual void finalEventHidden()
Definition: LArRawChannelBuilderToolBaseClass.cxx:87
LArRawChannelBuilderToolBaseClass::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArRawChannelBuilderToolBaseClass.h:77
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArRawChannelBuilderToolBaseClass::finalEvent
virtual void finalEvent()
Definition: LArRawChannelBuilderToolBaseClass.h:63
LArRawChannelBuilderToolBaseClass::printSummary
virtual void printSummary()
Definition: LArRawChannelBuilderToolBaseClass.cxx:33
LArRawChannelBuilderToolBaseClass::m_cablingKeySC
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
Definition: LArRawChannelBuilderToolBaseClass.h:78
LArRawChannelBuilderStatistics::returnErrorCount
ulonglong returnErrorCount(unsigned int nerr)
Definition: LArRawChannelBuilderStatistics.cxx:43
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArRawChannelBuilderStatistics::returnErrorCountSqPerEvent
ulonglong returnErrorCountSqPerEvent(unsigned int nerr)
Definition: LArRawChannelBuilderStatistics.cxx:57
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LArRawChannelBuilderToolBaseClass::~LArRawChannelBuilderToolBaseClass
~LArRawChannelBuilderToolBaseClass()
Definition: LArRawChannelBuilderToolBaseClass.cxx:28
LArRawChannelBuilderToolBaseClass::m_helper
LArRawChannelBuilderStatistics * m_helper
Definition: LArRawChannelBuilderToolBaseClass.h:82
LArRawChannelBuilderStatistics::returnEvents
unsigned long returnEvents() const
Definition: LArRawChannelBuilderStatistics.cxx:64
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
LArRawChannelBuilderStatistics::returnErrorCountPerEvent
ulonglong returnErrorCountPerEvent(unsigned int nerr)
Definition: LArRawChannelBuilderStatistics.cxx:50
LArRawChannelBuilderDriver.h
LArRawChannelBuilderStatistics::resetErrorcountPerEvent
void resetErrorcountPerEvent()
Definition: LArRawChannelBuilderStatistics.cxx:90
LArRawChannelBuilderToolBaseClass::m_isSC
bool m_isSC
Definition: LArRawChannelBuilderToolBaseClass.h:84
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
LArRawChannelBuilderStatistics::returnMaxErrors
unsigned int returnMaxErrors() const
Definition: LArRawChannelBuilderStatistics.cxx:80
LArRawChannelBuilderToolBaseClass::currentID
Identifier currentID()
Definition: LArRawChannelBuilderToolBaseClass.cxx:94
Identifier::get_compact
value_type get_compact(void) const
Get the compact id.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArRawChannelBuilderStatistics.h
LArRawChannelBuilderStatistics::returnErrorString
std::string returnErrorString(unsigned int nerr)
Definition: LArRawChannelBuilderStatistics.cxx:74
AthAlgTool
Definition: AthAlgTool.h:26
LArRawChannelBuilderParams::curr_chid
HWIdentifier curr_chid
Definition: LArRawChannelBuilderParams.h:24
LArRawChannelBuilderToolBaseClass::m_parent
LArRawChannelBuilderParams * m_parent
Definition: LArRawChannelBuilderToolBaseClass.h:80
LArID_Exception
Exception class for LAr Identifiers.
Definition: LArID_Exception.h:20
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20