ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArMonitoring
src
LArCalibDelayMonAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArCalibDelayMonAlg.h
"
6
#include "
LArIdentifier/LArOnlineID.h
"
7
#include "
AthenaMonitoringKernel/Monitored.h
"
8
#include <set>
9
#include <algorithm>
10
11
12
/*---------------------------------------------------------*/
13
LArCalibDelayMonAlg::LArCalibDelayMonAlg
(
const
std::string& name,ISvcLocator* pSvcLocator )
14
:
AthMonitorAlgorithm
(name,pSvcLocator),
15
m_onlineHelper
(nullptr)
16
{}
17
18
/*---------------------------------------------------------*/
19
StatusCode
LArCalibDelayMonAlg::initialize
() {
20
ATH_MSG_INFO
(
"Initialize LArCalibDelayMonAlg"
);
21
22
/*For pedestal run ONLY, not delay and ramp*/
23
ATH_MSG_INFO
(
"m_accCalibDigitContainerKey.empty() "
<<
m_accCalibDigitContainerKey
.empty() );
24
ATH_CHECK
(
m_accCalibDigitContainerKey
.initialize(
SG::AllowEmpty
));
25
if
(
m_accCalibDigitContainerKey
.empty()) {
26
ATH_MSG_FATAL
(
"LArAccumulatedCalibDigitContainerKey must be set"
);
27
return
StatusCode::FAILURE;
28
}
29
30
StatusCode
sc
=
detStore
()->retrieve(
m_onlineHelper
,
"LArOnlineID"
);
31
if
(
sc
.isFailure()) {
32
ATH_MSG_ERROR
(
"Could not get LArOnlineID helper !"
);
33
return
StatusCode::FAILURE;
34
}
35
36
m_histoGroups
.reserve(
m_SubDetNames
.size());
37
for
(
unsigned
i=0; i<
m_SubDetNames
.size(); ++i) {
38
std::vector<std::string>
part
;
39
part
.push_back(
m_partitions
[2*i]);
40
part
.push_back(
m_partitions
[2*i+1]);
41
m_histoGroups
.push_back(
Monitored::buildToolMap<int>
(
m_tools
,
m_SubDetNames
[i],
part
));
42
}
43
44
return
AthMonitorAlgorithm::initialize
();
45
}
46
47
48
/*---------------------------------------------------------*/
49
StatusCode
LArCalibDelayMonAlg::fillHistograms
(
const
EventContext& ctx )
const
{
50
51
ATH_MSG_DEBUG
(
"in fillHists()"
);
52
53
//get digit container
54
SG::ReadHandle<LArAccumulatedCalibDigitContainer>
pLArAccCalibDigitContainer;
55
56
std::unordered_set<unsigned int> chanids;
57
58
auto
dac =
Monitored::Scalar<int>
(
"dac"
,0);
59
auto
delay
=
Monitored::Scalar<int>
(
"delay"
,0);
60
auto
sample_max =
Monitored::Scalar<double>
(
"sample_max"
,0.);
61
auto
sample_max30 =
Monitored::Scalar<double>
(
"sample_max30"
,0.);
62
auto
sample_min =
Monitored::Scalar<double>
(
"sample_min"
,0.);
63
auto
chid =
Monitored::Scalar<unsigned int>
(
"chid"
,-1);
64
auto
slot =
Monitored::Scalar<int>
(
"slot"
,-1);
65
auto
ft =
Monitored::Scalar<int>
(
"FT"
,-1);
66
auto
slot30 =
Monitored::Scalar<int>
(
"slot30"
,-1);
67
auto
ft30 =
Monitored::Scalar<int>
(
"FT30"
,-1);
68
auto
febchid =
Monitored::Scalar<int>
(
"febchid"
,-1);
69
70
if
(!
m_accCalibDigitContainerKey
.empty()) {
71
72
pLArAccCalibDigitContainer=
SG::ReadHandle<LArAccumulatedCalibDigitContainer>
{
m_accCalibDigitContainerKey
,ctx};
73
if
(pLArAccCalibDigitContainer.
isValid
()){
74
ATH_MSG_DEBUG
(
"Got LArAccumulatedCalibDigitContainer with key "
<<
m_accCalibDigitContainerKey
.key());
75
}
else
{
76
ATH_MSG_WARNING
(
"Do not have LArAcumulatedCalibDigitContainer with key "
<<
m_accCalibDigitContainerKey
.key());
77
}
78
if
(pLArAccCalibDigitContainer->empty())
return
StatusCode::SUCCESS;
// Nothing to fill
79
81
for
(
auto
ijDig: * pLArAccCalibDigitContainer) {
82
HWIdentifier
id
= ijDig->hardwareID();
83
chid = (ijDig->hardwareID()).
get_identifier32
().
get_compact
();
84
chanids.emplace(chid);
//inserts if the chid does not exist
85
86
febchid =
m_onlineHelper
->channel(
id
);
87
88
unsigned
ntriggers = ijDig->nTriggers();
89
std::vector <double> sample;
90
91
// transform sampleSum vector from uint32_t to double
92
std::vector <double> samplesum;
93
94
for
(
auto
samplesum_it: ijDig->sampleSum()) {
95
samplesum.push_back((
double
)(samplesum_it));
96
// Get the vector of sample values
97
sample.push_back((
double
)(samplesum_it)/ntriggers);
98
}
99
100
// Get highest and lowest energy samples
101
double
samplemax = * std::max_element(sample.begin(), sample.end());
102
double
samplemin = * std::min_element(sample.begin(), sample.end());
103
// Get dac and delay
104
dac = ijDig->DAC();
105
delay
= ijDig->delay();
106
107
// Then fill histo about max/min sample
108
sample_max = samplemax;
109
sample_min = samplemin;
110
fill
(
m_MonGroupName
, sample_max, sample_min, febchid, dac,
delay
, chid);
111
112
slot =
m_onlineHelper
->slot(
id
);
113
ft =
m_onlineHelper
->feedthrough(
id
);
114
int
barrel_ec =
m_onlineHelper
->barrel_ec(
id
);
115
int
pos_neg =
m_onlineHelper
->pos_neg(
id
);
116
unsigned
int
partitionNb =
returnPartition
(barrel_ec,pos_neg,ft,slot);
117
unsigned
int
subdet = partitionNb / 2;
118
119
fill
(
m_tools
[
m_histoGroups
.at(subdet).at(
m_partitions
[partitionNb])],slot,ft,sample_max,sample_min);
120
121
if
(samplemax <= 3000.) {
122
sample_max30 = samplemax;
123
slot30 =
m_onlineHelper
->slot(
id
);
124
ft30 =
m_onlineHelper
->feedthrough(
id
);
125
fill
(
m_tools
[
m_histoGroups
.at(subdet).at(
m_partitions
[partitionNb])],slot30,ft30,sample_max30);
126
}
127
128
}
//end loop over pLArAccCalibDigitContainer
129
130
ATH_MSG_DEBUG
(
"Filling nbChan: "
<<chanids.size());
131
auto
nbchan =
Monitored::Scalar<unsigned int>
(
"nbChan"
,chanids.size());
132
fill
(
m_MonGroupName
,nbchan);
133
}
134
135
return
StatusCode::SUCCESS;
136
}
137
138
unsigned
int
LArCalibDelayMonAlg::returnPartition
(
int
be,
int
pn,
int
ft,
int
sl)
const
{
139
// partitionNb = 0 : EMBC / 1 : EMBA / 2 : EMECC / 3 : EMECA / 4 : HECC / 5 : HECA / 6 : FCALC / 7 : FCALA
140
unsigned
int
part
= be*2+pn;
141
if
(be == 1){
142
// This is a HEC FEB - Dirty method as IsHECOnlineFEBId is buggy!
143
if
((ft == 3 || ft == 10 || ft == 16 || ft == 22) && (sl > 2))
part
= be*2+pn + 2;
144
if
(ft == 6)
part
= be*2 + pn + 4;
// This is FCAL FEB
145
}
146
return
part
;
147
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
delay
double delay(std::size_t d)
Definition
JetTrigTimerTest.cxx:11
LArCalibDelayMonAlg.h
LArOnlineID.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition
AthMonitorAlgorithm.cxx:22
AthMonitorAlgorithm::AthMonitorAlgorithm
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthMonitorAlgorithm.cxx:8
AthMonitorAlgorithm::m_tools
ToolHandleArray< GenericMonitoringTool > m_tools
Array of Generic Monitoring Tools.
Definition
AthMonitorAlgorithm.h:341
HWIdentifier
Definition
HWIdentifier.h:13
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition
Identifier32.h:47
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
LArCalibDelayMonAlg::m_histoGroups
std::vector< std::map< std::string, int > > m_histoGroups
Definition
LArCalibDelayMonAlg.h:51
LArCalibDelayMonAlg::initialize
virtual StatusCode initialize() override
Overwrite dummy method from AlgTool.
Definition
LArCalibDelayMonAlg.cxx:19
LArCalibDelayMonAlg::LArCalibDelayMonAlg
LArCalibDelayMonAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArCalibDelayMonAlg.cxx:13
LArCalibDelayMonAlg::returnPartition
unsigned int returnPartition(int be, int pn, int ft, int sl) const
Definition
LArCalibDelayMonAlg.cxx:138
LArCalibDelayMonAlg::m_partitions
Gaudi::Property< std::vector< std::string > > m_partitions
Definition
LArCalibDelayMonAlg.h:47
LArCalibDelayMonAlg::m_MonGroupName
Gaudi::Property< std::string > m_MonGroupName
Definition
LArCalibDelayMonAlg.h:44
LArCalibDelayMonAlg::m_accCalibDigitContainerKey
SG::ReadHandleKey< LArAccumulatedCalibDigitContainer > m_accCalibDigitContainerKey
Definition
LArCalibDelayMonAlg.h:41
LArCalibDelayMonAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition
LArCalibDelayMonAlg.cxx:49
LArCalibDelayMonAlg::m_SubDetNames
Gaudi::Property< std::vector< std::string > > m_SubDetNames
Definition
LArCalibDelayMonAlg.h:48
LArCalibDelayMonAlg::m_onlineHelper
const LArOnlineID * m_onlineHelper
Definition
LArCalibDelayMonAlg.h:56
LArCalibDelayMonAlg.part
str part
Definition
LArCalibDelayMonAlg.py:152
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Monitored::buildToolMap
std::vector< V > buildToolMap(const ToolHandleArray< GenericMonitoringTool > &tools, const std::string &baseName, int nHist)
Builds an array of indices (base case).
Definition
MonitoredGroup.h:148
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
fill
void fill(H5::Group &out_file, size_t iterations)
Definition
test-half-precision.cxx:64
Generated on
for ATLAS Offline Software by
1.17.0