ATLAS Offline Software
TileCalorimeter
TileConditions
src
TileInfo.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
/**************************************************************************
6
Filename : TileInfo.cxx
7
Author : F. Merritt
8
Created : May, 2002
9
Last Modified : April 2006 - F Spano' (add covariance matrix for coherent
10
noise)
11
Version 00-01-22
12
13
:DESCRIPTION: see header file.
14
****************************************************************************/
15
//Gaudi includes
16
#include "GaudiKernel/MsgStream.h"
17
#include "GaudiKernel/Bootstrap.h"
18
#include "GaudiKernel/ISvcLocator.h"
19
#include "GaudiKernel/IMessageSvc.h"
20
#include "GaudiKernel/INTupleSvc.h"
21
#include "GaudiKernel/IDataProviderSvc.h"
22
#include "GaudiKernel/SmartDataPtr.h"
23
#include "
StoreGate/StoreGateSvc.h
"
24
25
#include "
TileConditions/TileInfo.h
"
26
#include "
TileConditions/TileCablingService.h
"
27
#include "
TileConditions/TilePulseShapes.h
"
28
#include "
TileConditions/TileWienerFilterWeights.h
"
29
30
#include "
TileCalibBlobObjs/TileCalibDrawerFlt.h
"
31
#include "
TileCalibBlobObjs/TileCalibUtils.h
"
32
33
#include "
CaloIdentifier/TileID.h
"
34
#include "
CaloIdentifier/TileTBID.h
"
35
#include "
TileIdentifier/TileHWID.h
"
36
#include "
TileIdentifier/TileFragHash.h
"
37
#include "
AthenaKernel/errorcheck.h
"
38
#include "GaudiKernel/IClassIDSvc.h"
39
40
#include <cmath>
41
#include <fstream>
42
#include <iostream>
43
#include <iomanip>
44
45
46
//
47
//_____________________________________________________________________________
48
TileInfo::TileInfo
()
49
: m_tileID(nullptr)
50
, m_tileHWID(nullptr)
51
, m_tileTBID(nullptr)
52
, m_cabling(nullptr)
53
, m_channel_context(nullptr)
54
, m_drawer_context(nullptr)
55
, m_ADCmax(0)
56
, m_ADCmaskValue(0)
57
, m_nSamples(0)
58
, m_iTrigSample(0)
59
, m_tileNoise(0)
60
, m_tileCoherNoise(0)
61
, m_tileZeroSuppress(0)
62
, m_thresholdRawChannel(0)
63
, m_thresholdDigits(0)
64
, m_ttL1Calib(0)
65
, m_ttL1NoiseSigma(0)
66
, m_ttL1Thresh(0)
67
, m_ttL1Ped(0)
68
, m_ttL1Max(0)
69
, m_MuRcvCalib(0)
70
, m_MuRcvNoiseSigma(0)
71
, m_MuRcvThresh(0)
72
, m_MuRcvPed(0)
73
, m_MuRcvMax(0)
74
, m_muL1Calib(0)
75
, m_muL1NoiseSigma(0)
76
, m_muL1Thresh(0)
77
, m_muL1Ped(0)
78
, m_muL1Max(0)
79
, m_mbtsL1Calib(0)
80
, m_mbtsL1NoiseSigma(0)
81
, m_mbtsL1Thresh(0)
82
, m_mbtsL1Ped(0)
83
, m_mbtsL1Max(0)
84
, m_ttL1CosmicsGain(0)
85
, m_ttL1CosmicsThresh(0)
86
, m_digitsNBinsHi(0)
87
, m_digitsNBinsLo(0)
88
, m_digitsTime0BinHi(0)
89
, m_digitsTime0BinLo(0)
90
, m_digitsBinsPerXHi(0)
91
, m_digitsBinsPerXLo(0)
92
, m_TTL1NBins(0)
93
, m_TTL1Time0Bin(0)
94
, m_TTL1BinsPerX(0)
95
, m_MuRcvNBins(0)
96
, m_MuRcvTime0Bin(0)
97
, m_MuRcvBinsPerX(0)
98
, m_MuL1NBins(0)
99
, m_MuL1Time0Bin(0)
100
, m_MuL1BinsPerX(0)
101
, m_pulseShapes(nullptr)
102
, m_WienerFilterWeights(nullptr)
103
, m_tileCablingSvc(
"TileCablingSvc"
,
"TileInfo"
)
104
{
105
//=== initialize TestBeam defaults
106
for
(
int
i
=0;
i
<32; ++
i
)
107
m_emscaleTB
[
i
] = 1.0;
108
109
for
(
int
i
=0;
i
<32; ++
i
)
110
m_mev2adcTB
[
i
] = 1.0;
111
112
// scale factors from ADC HF noise to Opt filter noise calculated by Luca Fiorini
113
m_noiseScaleFactor
[0] = 1.0;
// no scale at all
114
m_noiseScaleFactor
[1] = 1.14;
// opt filter without iterations
115
m_noiseScaleFactor
[2] = 1.28;
// opt filter with iterations
116
m_noiseScaleFactor
[3] = 1.27;
// fit method
117
118
m_noiseScaleIndex
= 1;
// by default noise for opt filter without iterations
119
}
120
121
122
//
123
//_____________________________________________________________________________
124
TileInfo::~TileInfo
()
125
{
126
if
(
m_channel_context
)
delete
m_channel_context
;
127
if
(
m_drawer_context
)
delete
m_drawer_context
;
128
129
int
sizepart=
m_decoCovaria
.size();
130
for
(
int
i
=0;
i
<sizepart; ++
i
){
131
int
sizemodu=(
m_decoCovaria
[
i
]).
size
();
132
for
(
int
j=0; j<sizemodu; ++j){
133
int
sizegain=(
m_decoCovaria
[
i
][j]).
size
();
134
for
(
int
k
=0;
k
<sizegain; ++
k
){
135
if
(
m_decoCovaria
[
i
][j][
k
])
delete
(TMatrixD*)(
m_decoCovaria
[
i
][j][
k
]);
136
}
137
m_decoCovaria
[
i
][j].clear();
138
}
139
m_decoCovaria
[
i
].clear();
140
}
141
m_decoCovaria
.clear();
142
143
}
144
145
146
//
147
//_____________________________________________________________________________
148
StatusCode
149
TileInfo::initialize
()
150
{
151
MsgStream
log
(
msgSvc
(),
"TileInfo"
);
152
MSG::Level
logLevel
=
log
.level();
153
bool
debug
= (
logLevel
<=
MSG::DEBUG
);
154
155
if
(
debug
)
log
<<
MSG::DEBUG
<<
"In TileInfo::initialize..."
<<
endmsg
;
156
157
//=== get TileCablingSvc
158
StatusCode
sc
=
m_tileCablingSvc
.retrieve();
159
if
(
sc
.isFailure()){
160
log
<< MSG::ERROR
161
<<
"Unable to retrieve "
<<
m_tileCablingSvc
<<
endmsg
;
162
return
StatusCode::FAILURE;
163
}
164
//=== cache pointers to cabling helpers
165
m_cabling
=
m_tileCablingSvc
->cablingService();
166
if
(!
m_cabling
){
167
log
<< MSG::ERROR
168
<<
"Pointer to TileCablingService is zero: "
<<
m_cabling
<<
endmsg
;
169
return
StatusCode::FAILURE;
170
171
}
172
m_tileID
=
m_cabling
->
getTileID
();
173
m_tileTBID
=
m_cabling
->
getTileTBID
();
174
m_tileHWID
=
m_cabling
->
getTileHWID
();
175
176
177
//=== initialize channel context
178
m_channel_context
=
new
IdContext
(
m_tileHWID
->
channel_context
());
179
//=== initialize drawer context
180
m_drawer_context
=
new
IdContext
(
m_tileHWID
->
drawer_context
());
181
182
//=== Initialize TilePulseShapes
183
if
(
m_pulseShapes
)
184
m_pulseShapes
->
load
(
log
);
185
186
//=== Read WienerFilter Weights in TileInfoLoader.cxx
187
if
(
m_WienerFilterWeights
) {
188
m_WienerFilterWeights
->
loadWeights
(
log
);
189
190
if
(!
m_WienerFilterWeights
->
loaded
()) {
191
log
<< MSG::ERROR
192
<<
"Unable to load WienerFilter weights"
<<
endmsg
;
193
return
StatusCode::FAILURE;
194
}
195
}
196
197
if
(
debug
)
log
<<
MSG::DEBUG
<<
" TileInfo initialization completed. "
<<
endmsg
;
198
return
StatusCode::SUCCESS;
199
}
200
201
//
202
//_____________________________________________________________________________
203
IMessageSvc*
204
TileInfo::msgSvc
()
const
205
{
206
return
Athena::getMessageSvc
();
207
}
208
209
//_____________________________________________________________________________
210
const
TMatrixD*
211
TileInfo::DecoCovariance
(
int
ros
,
int
drawer
,
int
hilo)
const
{
212
213
int
part
(0);
214
switch
(
ros
) {
215
case
TileHWID::EXTBAR_POS
:
part
=0;
break
;
// EBA
216
case
TileHWID::BARREL_POS
:
part
=1;
break
;
// LBA
217
case
TileHWID::BARREL_NEG
:
part
=2;
break
;
// LBC
218
case
TileHWID::EXTBAR_NEG
:
part
=3;
break
;
// EBC
219
}
220
221
int
gain
= (hilo) ? 0 : 1;
222
223
return
m_decoCovaria
[
part
][
drawer
][
gain
];
224
}
225
226
228
// Return shape vector of a TTL1 signal, to multiply by (summed) TTL1 Amplitude
229
// to construct a TTL1 object. phase is a phase shift, default=0.
230
//
231
//_____________________________________________________________________________
232
void
TileInfo::ttl1Shape
(
const
int
nsamp,
const
int
itrig,
const
double
phase
,std::vector<double> &ttl1shape)
const
{
233
234
//ttl1shape.resize(nsamp, 0.); // assume that resize already done in calling function
235
for
(
int
i
=0;
i
<nsamp; ++
i
) {
236
int
j =
m_TTL1Time0Bin
+ (
i
-itrig)*
m_TTL1BinsPerX
+(
int
)(
phase
*(
m_TTL1BinsPerX
*(1./25.0)));
237
if
(j<0) j = 0;
238
if
(j>=
m_TTL1NBins
) j =
m_TTL1NBins
-1;
239
ttl1shape[
i
] =
m_TTL1FullShape
[j];
240
}
241
#ifndef NDEBUG
242
MsgStream
log
(
msgSvc
(),
"TileInfo"
);
243
if
(
log
.level() <=
MSG::DEBUG
){
244
log
<<
MSG::DEBUG
<<
" Shaping profile at beam crossings: nsamp = "
<< nsamp <<
", itrig = "
<< itrig <<
endmsg
;
245
int
jc = 0;
246
for
(
int
i
=0;
i
<nsamp;
i
++) {
247
if
(jc==0)
log
<<
MSG::DEBUG
<<
" bin = "
<<
i
<<
" Shape factor ="
;
248
log
<<
MSG::DEBUG
<< std::setw(8) << std::setprecision(4) << ttl1shape[
i
] <<
" "
;
249
if
(++jc==5) {
250
log
<<
MSG::DEBUG
<<
endmsg
;
251
jc=0;
252
}
253
}
254
log
<<
MSG::DEBUG
<<
endmsg
;
255
}
256
#endif
257
}
259
// Returns the shape vector of the Muon Receiver Board input signal, to multiply by the channel amplitude
260
// to construct a Muon Receiver Board object. The phase is a phase shift (default=0).
261
//
262
//_____________________________________________________________________________
263
264
void
TileInfo::muRcvShape
(
const
int
nsamp,
const
int
itrig,
const
double
phase
,std::vector<double> &murcvshape)
const
{
265
266
for
(
int
i
=0;
i
<nsamp; ++
i
) {
267
int
j =
m_MuRcvTime0Bin
+ (
i
-itrig)*
m_MuRcvBinsPerX
+(
int
)(
phase
*(
m_MuRcvBinsPerX
*(1./25.0)));
268
if
(j<0) j = 0;
269
if
(j>=
m_MuRcvNBins
) j =
m_MuRcvNBins
-1;
270
murcvshape[
i
] =
m_MuRcvFullShape
[j];
271
}
272
273
}
LArG4FSStartPointFilter.part
part
Definition:
LArG4FSStartPointFilter.py:21
TileInfo::m_pulseShapes
TilePulseShapes * m_pulseShapes
Definition:
TileInfo.h:377
ReadOfcFromCool.phase
phase
Definition:
ReadOfcFromCool.py:127
TilePulseShapes::load
void load(MsgStream &log)
Definition:
TilePulseShapes.cxx:23
TileCalibDrawerFlt.h
TileInfo::m_tileTBID
const TileTBID * m_tileTBID
Definition:
TileInfo.h:293
TileWienerFilterWeights::loadWeights
void loadWeights(MsgStream &log)
Definition:
TileWienerFilterWeights.cxx:26
TileInfo::m_tileID
const TileID * m_tileID
Definition:
TileInfo.h:291
TileHWID::channel_context
IdContext channel_context(void) const
idContext for channels
Definition:
TileHWID.cxx:478
python.TrigPSCPythonDbSetup.logLevel
logLevel
If HLT PSK is set on command line read it from DB instead of COOL (ATR-25974)
Definition:
TrigPSCPythonDbSetup.py:27
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition:
CaloCondBlobAlgs_fillNoiseFromASCII.py:110
TileWienerFilterWeights.h
TileFragHash.h
TileInfo.h
TileCalibUtils.h
TileInfo::m_noiseScaleIndex
int m_noiseScaleIndex
Definition:
TileInfo.h:311
TileHWID::drawer_context
IdContext drawer_context(void) const
idContext for drawers
Definition:
TileHWID.cxx:471
TileCablingService::getTileTBID
const TileTBID * getTileTBID() const
Definition:
TileCablingService.h:272
TileInfo::m_TTL1Time0Bin
int m_TTL1Time0Bin
Definition:
TileInfo.h:362
TileInfo::TileInfo
TileInfo()
Definition:
TileInfo.cxx:48
Example_ReadSampleNoise.drawer
drawer
Definition:
Example_ReadSampleNoise.py:39
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition:
getMessageSvc.cxx:20
TileInfo::ttl1Shape
const std::vector< double > & ttl1Shape() const
Return bunch-X TTL1 shape vector.
Definition:
TileInfo.h:204
TileInfo::DecoCovariance
const TMatrixD * DecoCovariance(int ros, int drawer, int hilo) const
Returns the decomposed covariance matrix.
Definition:
TileInfo.cxx:211
TileID.h
AthenaPoolTestRead.sc
sc
Definition:
AthenaPoolTestRead.py:27
python.setupRTTAlg.size
int size
Definition:
setupRTTAlg.py:39
TileInfo::m_MuRcvNBins
int m_MuRcvNBins
Definition:
TileInfo.h:367
TilePulseShapes.h
TileTBID.h
TileInfo::m_MuRcvBinsPerX
int m_MuRcvBinsPerX
Definition:
TileInfo.h:369
TrigConf::MSGTC::Level
Level
Definition:
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
TileHWID.h
TileCablingService.h
lumiFormat.i
int i
Definition:
lumiFormat.py:85
TileInfo::m_tileCablingSvc
ServiceHandle< TileCablingSvc > m_tileCablingSvc
Definition:
TileInfo.h:384
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
TileInfo::muRcvShape
void muRcvShape(const int nsamp, const int itrig, const double phase, std::vector< double > &murcvshape) const
Definition:
TileInfo.cxx:264
TileInfo::m_noiseScaleFactor
double m_noiseScaleFactor[4]
scale factor from digital noise to Opt Filter noise for various opt filter algoritms 0 - reserved 1 -...
Definition:
TileInfo.h:310
TileHWID::EXTBAR_NEG
@ EXTBAR_NEG
Definition:
TileHWID.h:71
TileCablingService::getTileHWID
const TileHWID * getTileHWID() const
Definition:
TileCablingService.h:271
TileCablingService::getTileID
const TileID * getTileID() const
Definition:
TileCablingService.h:270
maskDeadModules.ros
ros
Definition:
maskDeadModules.py:35
debug
const bool debug
Definition:
MakeUncertaintyPlots.cxx:53
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileHWID::BARREL_NEG
@ BARREL_NEG
Definition:
TileHWID.h:69
TileHWID::EXTBAR_POS
@ EXTBAR_POS
Definition:
TileHWID.h:70
TileInfo::msgSvc
IMessageSvc * msgSvc() const
Returns a handle to the MessageSvc.
Definition:
TileInfo.cxx:204
TileHWID::BARREL_POS
@ BARREL_POS
Definition:
TileHWID.h:68
TileInfo::m_decoCovaria
std::vector< std::vector< std::vector< TMatrixD * > > > m_decoCovaria
Definition:
TileInfo.h:389
TileInfo::m_MuRcvFullShape
std::vector< double > m_MuRcvFullShape
Definition:
TileInfo.h:366
TileInfo::m_TTL1BinsPerX
int m_TTL1BinsPerX
Definition:
TileInfo.h:363
DEBUG
#define DEBUG
Definition:
page_access.h:11
TileWienerFilterWeights::loaded
bool loaded()
Definition:
TileWienerFilterWeights.h:28
python.CaloCondTools.log
log
Definition:
CaloCondTools.py:20
TileInfo::m_channel_context
const IdContext * m_channel_context
Definition:
TileInfo.h:295
TileInfo::~TileInfo
~TileInfo()
Definition:
TileInfo.cxx:124
TileInfo::initialize
StatusCode initialize()
Initialization of the TileInfo object.
Definition:
TileInfo.cxx:149
TileInfo::m_mev2adcTB
double m_mev2adcTB[32]
Definition:
TileInfo.h:382
TileInfo::m_drawer_context
const IdContext * m_drawer_context
Definition:
TileInfo.h:296
TileInfo::m_cabling
const TileCablingService * m_cabling
Definition:
TileInfo.h:294
TileInfo::m_tileHWID
const TileHWID * m_tileHWID
Definition:
TileInfo.h:292
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition:
IdContext.h:26
StoreGateSvc.h
TileInfo::m_TTL1NBins
int m_TTL1NBins
Definition:
TileInfo.h:361
TileInfo::m_emscaleTB
double m_emscaleTB[32]
Definition:
TileInfo.h:381
fitman.k
k
Definition:
fitman.py:528
TileInfo::m_MuRcvTime0Bin
int m_MuRcvTime0Bin
Definition:
TileInfo.h:368
TileInfo::m_TTL1FullShape
std::vector< double > m_TTL1FullShape
Definition:
TileInfo.h:360
TileInfo::m_WienerFilterWeights
TileWienerFilterWeights * m_WienerFilterWeights
Definition:
TileInfo.h:379
Generated on Thu Nov 7 2024 21:28:15 for ATLAS Offline Software by
1.8.18