ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibTools
src
LArShape2Ntuple.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArCalibTools/LArShape2Ntuple.h
"
6
#include "
LArRawConditions/LArShapeComplete.h
"
7
#include "
LArRawConditions/LArShape32MC.h
"
8
#include "
LArCOOLConditions/LArShapeFlat.h
"
9
#include "
LArCOOLConditions/LArShapeSC.h
"
10
#include "
CaloIdentifier/CaloGain.h
"
11
12
LArShape2Ntuple::LArShape2Ntuple
(
const
std::string& name, ISvcLocator* pSvcLocator):
13
LArCond2NtupleBase
(name, pSvcLocator)
14
{
15
declareProperty
(
"NtupleName"
,
m_ntName
=
"SHAPE"
);
16
declareProperty
(
"NtupleFile"
,
m_ntFile
=
"FILE1"
);
17
declareProperty
(
"isComplete"
,
m_isComplete
=
false
);
18
19
}
20
21
LArShape2Ntuple::~LArShape2Ntuple
()
22
=
default
;
23
24
25
StatusCode
LArShape2Ntuple::initialize
() {
26
ATH_CHECK
(
m_contKey
.initialize());
27
m_ntTitle
=
"Pulse Shape"
;
28
m_ntpath
=std::string(
"/NTUPLES/"
)+
m_ntFile
+std::string(
"/"
)+
m_ntName
;
29
return
LArCond2NtupleBase::initialize
();
30
}
31
32
33
StatusCode
LArShape2Ntuple::stop
() {
34
const
EventContext& ctx = Gaudi::Hive::currentContext();
35
// Ntuple booking: Specific
36
NTuple::Item<long> gain, phase, nSamples;
37
NTuple::Item<float> timeOffset, phasetime;
38
NTuple::Array<float> Shape, ShapeDer;
39
40
41
ATH_CHECK
(
m_nt
->addItem(
"Gain"
,gain,-1,2));
42
43
//Specific:
44
if
(
m_isComplete
) {
45
ATH_CHECK
(
m_nt
->addItem(
"TimeOffset"
,timeOffset,0,100));
46
ATH_CHECK
(
m_nt
->addItem(
"Phase"
,phase,0,49));
47
ATH_CHECK
(
m_nt
->addItem(
"PhaseTime"
,phasetime,0,800));
48
}
49
ATH_CHECK
(
m_nt
->addItem(
"nSamples"
,nSamples,0,100));
50
ATH_CHECK
(
m_nt
->addItem(
"Shape"
,nSamples,Shape));
51
ATH_CHECK
(
m_nt
->addItem(
"ShapeDer"
,nSamples,ShapeDer));
52
53
const
ILArShape
* larShape = nullptr ;
54
const
LArShapeComplete
* larShapeComplete = nullptr ;
55
56
if
(
m_isComplete
) {
57
ATH_CHECK
(
detStore
()->retrieve(larShapeComplete,
m_contKey
.key()));
58
larShape=larShapeComplete;
//Cast to base-class
59
}
60
else
{
//Use just the abstract interface (works also for LArShapeFlat and LArShapeMC)
61
// For compatibility with existing configurations, look in the detector
62
// store first, then in conditions.
63
larShape=
detStore
()->tryConstRetrieve<
ILArShape
> (
m_contKey
.key());
64
if
(!larShape) {
65
SG::ReadCondHandle<ILArShape>
shapeHandle{
m_contKey
};
66
larShape=*shapeHandle;
67
}
68
}
69
70
const
LArOnOffIdMapping
*cabling=
nullptr
;
71
if
(
m_isSC
) {
72
ATH_MSG_DEBUG
(
"LArOFC2Ntuple: using SC cabling"
);
73
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingSCKey
, ctx};
74
cabling=*cablingHdl;
75
}
else
{
76
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingKey
, ctx};
77
cabling=*cablingHdl;
78
}
79
80
81
if
(!cabling) {
82
ATH_MSG_WARNING
(
"Do not have cabling object LArOnOffIdMapping"
);
83
return
StatusCode::FAILURE;
84
}
85
86
87
unsigned
cellCounter=0;
88
for
(
int
igain=
CaloGain::LARHIGHGAIN
;
89
igain<
m_NGains
.value() ; ++igain )
90
{
91
for
(
HWIdentifier
chid :
m_onlineId
->channel_range()) {
92
if
(!cabling->isOnlineConnected(chid))
continue
;
93
unsigned
nPhase=1;
94
if
(larShapeComplete) nPhase=larShapeComplete->
nTimeBins
(chid,gain);
95
for
(
unsigned
iphase=0;iphase<nPhase;iphase++) {
96
ATH_MSG_VERBOSE
(
"Dumping Shape for channel "
<<
m_onlineId
->channel_name(chid) <<
", gain "
<< gain <<
", phase "
<< iphase);
97
ILArShape::ShapeRef_t
shape=larShape->
Shape
(chid,igain);
98
ILArShape::ShapeRef_t
shapeder =larShape->
ShapeDer
(chid,igain);
99
fillFromIdentifier
(chid);
100
gain = (long)igain ;
101
nSamples=shape.size();
102
for
(
int
k=0;k<nSamples;k++ ) {
103
Shape[k] = shape[k] ;
104
ShapeDer[k] = shapeder[k] ;
105
}
106
if
(larShapeComplete) {
107
timeOffset = larShapeComplete->
timeOffset
(chid,igain);
108
phasetime = phase*larShapeComplete->
timeBinWidth
(chid,igain);
109
phase = (long)iphase ;
110
}
111
112
ATH_CHECK
(
ntupleSvc
()->writeRecord(
m_nt
));
113
cellCounter++;
114
}
//loop over phases
115
}
//loop over channels
116
}
//loop over gains
117
118
ATH_MSG_INFO
(
"Total number of cells = "
<< cellCounter );
119
ATH_MSG_INFO
(
"LArShape2Ntuple has finished."
);
120
return
StatusCode::SUCCESS;
121
}
// end finalize-method.
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloGain.h
LArShape2Ntuple.h
LArShape32MC.h
LArShapeComplete.h
LArShapeFlat.h
LArShapeSC.h
ntupleSvc
INTupleSvc * ntupleSvc()
Definition
ServiceAccessor.h:14
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
ILArShape
Definition
ILArShape.h:13
ILArShape::ShapeRef_t
LArVectorProxy ShapeRef_t
This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype...
Definition
ILArShape.h:26
ILArShape::Shape
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
ILArShape::ShapeDer
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
LArCond2NtupleBase::initialize
StatusCode initialize()
Definition
LArCond2NtupleBase.cxx:33
LArCond2NtupleBase::m_isSC
Gaudi::Property< bool > m_isSC
Definition
LArCond2NtupleBase.h:57
LArCond2NtupleBase::m_cablingSCKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingSCKey
Definition
LArCond2NtupleBase.h:93
LArCond2NtupleBase::m_ntTitle
std::string m_ntTitle
Definition
LArCond2NtupleBase.h:68
LArCond2NtupleBase::m_NGains
Gaudi::Property< int > m_NGains
Definition
LArCond2NtupleBase.h:64
LArCond2NtupleBase::m_nt
NTuple::Tuple * m_nt
Definition
LArCond2NtupleBase.h:71
LArCond2NtupleBase::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition
LArCond2NtupleBase.h:92
LArCond2NtupleBase::m_onlineId
const LArOnlineID_Base * m_onlineId
Definition
LArCond2NtupleBase.h:88
LArCond2NtupleBase::m_ntpath
std::string m_ntpath
Definition
LArCond2NtupleBase.h:68
LArCond2NtupleBase::fillFromIdentifier
bool fillFromIdentifier(const HWIdentifier &id)
Definition
LArCond2NtupleBase.cxx:290
LArCond2NtupleBase::LArCond2NtupleBase
LArCond2NtupleBase(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArCond2NtupleBase.cxx:15
LArOnOffIdMapping
Definition
LArOnOffIdMapping.h:20
LArShape2Ntuple::stop
virtual StatusCode stop()
Definition
LArShape2Ntuple.cxx:33
LArShape2Ntuple::m_contKey
SG::ReadCondHandleKey< ILArShape > m_contKey
Definition
LArShape2Ntuple.h:37
LArShape2Ntuple::initialize
StatusCode initialize()
Definition
LArShape2Ntuple.cxx:25
LArShape2Ntuple::m_isComplete
bool m_isComplete
Definition
LArShape2Ntuple.h:40
LArShape2Ntuple::~LArShape2Ntuple
~LArShape2Ntuple()
LArShape2Ntuple::LArShape2Ntuple
LArShape2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArShape2Ntuple.cxx:12
LArShape2Ntuple::m_ntName
std::string m_ntName
Definition
LArShape2Ntuple.h:38
LArShape2Ntuple::m_ntFile
std::string m_ntFile
Definition
LArShape2Ntuple.h:39
LArShapeComplete
This class implements the ILArShape interface.
Definition
LArShapeComplete.h:26
LArShapeComplete::timeBinWidth
virtual float timeBinWidth(const HWIdentifier &CellID, int gain) const
Definition
LArShapeComplete.cxx:83
LArShapeComplete::nTimeBins
virtual unsigned nTimeBins(const HWIdentifier &CellID, int gain) const
Definition
LArShapeComplete.cxx:72
LArShapeComplete::timeOffset
virtual float timeOffset(const HWIdentifier &CellID, int gain) const
Definition
LArShapeComplete.cxx:59
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition
CaloGain.h:18
Generated on
for ATLAS Offline Software by
1.17.0