ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileRecAlgs
src
TileRawChannelToHit.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//*****************************************************************************
6
// Filename : TileRawChannelToHit.cxx
7
// Author : Alexander Solodkov
8
// Created : Feb, 2005
9
//
10
// DESCRIPTION:
11
// Implementation comments only. Class level comments go in .h file.
12
//
13
// HISTORY:
14
//
15
// BUGS:
16
//
17
//*****************************************************************************
18
19
// Tile includes
20
#include "
TileRawChannelToHit.h
"
21
22
#include "
TileIdentifier/TileHWID.h
"
23
#include "
TileIdentifier/TileFragHash.h
"
24
#include "
TileCalibBlobObjs/TileCalibUtils.h
"
25
#include "
TileConditions/TileInfo.h
"
26
#include "
TileSimEvent/TileHit.h
"
27
#include "
TileEvent/TileRawChannel.h
"
28
29
// Calo includes
30
#include "
CaloIdentifier/TileID.h
"
31
32
// Atlas includes
33
#include "
StoreGate/ReadHandle.h
"
34
#include "
StoreGate/WriteHandle.h
"
35
#include "
StoreGate/ReadCondHandle.h
"
36
#include "
AthenaKernel/errorcheck.h
"
37
// access all RawChannels inside container
38
#include "
EventContainers/SelectAllObject.h
"
39
40
#include <memory>
41
42
//
43
// Constructor
44
//
45
TileRawChannelToHit::TileRawChannelToHit
(
const
std::string& name, ISvcLocator* pSvcLocator)
46
:
AthAlgorithm
(name, pSvcLocator)
47
{
48
}
49
50
TileRawChannelToHit::~TileRawChannelToHit
()
51
{}
52
53
//****************************************************************************
54
//* Initialization
55
//****************************************************************************
56
57
StatusCode
TileRawChannelToHit::initialize
() {
58
59
if
(
m_useSamplFract
)
60
ATH_MSG_INFO
(
"Sampling fraction is taken into account for TileHit energy"
);
61
else
62
ATH_MSG_INFO
(
"TileHit will contain CELL energy (not divided by sampling fraction)"
);
63
64
// retrieve TileID helper and TileIfno from det store
65
ATH_CHECK
(
detStore
()->retrieve(
m_tileID
) );
66
ATH_CHECK
(
detStore
()->retrieve(
m_tileHWID
) );
67
68
//=== get TileCondToolEmscale
69
ATH_CHECK
(
m_tileToolEmscale
.retrieve() );
70
71
ATH_CHECK
(
m_rawChannelContainerKey
.initialize() );
72
ATH_CHECK
(
m_hitVectorKey
.initialize() );
73
74
ATH_CHECK
(
m_samplingFractionKey
.initialize(
m_useSamplFract
) );
75
76
ATH_MSG_INFO
(
"TileRawChannelToHit initialization completed"
);
77
78
return
StatusCode::SUCCESS;
79
}
80
81
82
//****************************************************************************
83
//* Execution
84
//****************************************************************************
85
86
StatusCode
TileRawChannelToHit::execute
(
const
EventContext& ctx) {
87
88
/* zero all counters and sums */
89
int
nHit = 0;
90
int
nChan = 0;
91
float
eCh = 0.0;
92
float
eHitTot = 0.0;
93
94
const
TileSamplingFraction
* samplingFraction =
nullptr
;
95
if
(
m_useSamplFract
) {
96
SG::ReadCondHandle<TileSamplingFraction>
samplingFractionHandle(
m_samplingFractionKey
, ctx);
97
ATH_CHECK
( samplingFractionHandle.
isValid
() );
98
samplingFraction = samplingFractionHandle.
cptr
();
99
}
100
101
SG::WriteHandle<TileHitVector>
hitVector
(
m_hitVectorKey
, ctx);
102
103
/* Register the set of TileHits to the event store. */
104
ATH_CHECK
(
hitVector
.record(std::make_unique<TileHitVector>()) );
105
106
//**
107
//* Get TileRawChannels
108
//**
109
SG::ReadHandle<TileRawChannelContainer>
rawChannelContainer(
m_rawChannelContainerKey
, ctx);
110
111
if
(!rawChannelContainer.isValid()) {
112
ATH_MSG_WARNING
(
" Could not find container "
<<
m_rawChannelContainerKey
.key() );
113
ATH_MSG_WARNING
(
" creating empty TileHitVector container "
);
114
115
}
else
{
116
117
TileRawChannelUnit::UNIT
rChUnit = rawChannelContainer->get_unit();
118
//TileFragHash::TYPE rChType = rawChannelContainer->get_type();
119
120
// iterate over all collections in a container
121
for
(
const
TileRawChannelCollection
* rawChannelCollection : *rawChannelContainer) {
122
123
HWIdentifier
drawer_id =
m_tileHWID
->drawer_id(rawChannelCollection->identify());
124
int
ros =
m_tileHWID
->ros(drawer_id);
125
int
drawer =
m_tileHWID
->drawer(drawer_id);
126
int
drawerIdx =
TileCalibUtils::getDrawerIdx
(ros, drawer);
127
128
bool
is_calibration = (rawChannelCollection->size() == 96);
129
if
(is_calibration)
130
ATH_MSG_DEBUG
(
"Calibration mode, ignore high gain"
);
131
132
// iterate over all raw channels in a collection, creating new TileHits
133
// Add each new TileHit to the TileHitContainer.
134
135
for
(
const
TileRawChannel
* rawChannel : *rawChannelCollection) {
136
137
HWIdentifier
adc_id = rawChannel->adc_HWID();
138
int
channel =
m_tileHWID
->channel(adc_id);
139
int
adc =
m_tileHWID
->adc(adc_id);
140
141
// skip high gain in calibration mode
142
if
(is_calibration &&
TileHWID::HIGHGAIN
== adc)
143
continue
;
144
145
float
amp = rawChannel->amplitude();
146
float
time = rawChannel->time();
147
148
++nChan;
149
eCh += amp;
150
151
Identifier
pmt_id = rawChannel->pmt_ID();
152
if
(pmt_id.
is_valid
()) {
153
154
float
ener =
m_tileToolEmscale
->channelCalib(drawerIdx, channel, adc,
155
amp, rChUnit,
156
TileRawChannelUnit::MegaElectronVolts
);
157
158
if
(
m_useSamplFract
) {
// divide by sampling fraction (about 40)
159
ener /= samplingFraction->
getSamplingFraction
(drawerIdx, channel);
160
}
161
162
TileHit
hit
(pmt_id, ener, time);
163
eHitTot += ener;
164
++nHit;
165
166
ATH_MSG_VERBOSE
(
"TileRawChannelToHit: "
167
<<
" pmt_id="
<<
m_tileID
->to_string(pmt_id, -1)
168
<<
" adc_id="
<<
m_tileHWID
->to_string(adc_id)
169
<<
" nHit="
<< nHit
170
<<
" amp="
<< amp
171
<<
" ene="
<< ener
172
<<
" time="
<< time );
173
174
hitVector
->push_back(
hit
);
175
176
}
else
{
177
178
ATH_MSG_VERBOSE
(
"TileRawChannelToHit: "
179
<<
" channel with adc_id="
<<
m_tileHWID
->to_string(adc_id)
180
<<
" is not connected"
);
181
}
182
}
183
}
184
}
185
186
187
188
189
// Execution completed.
190
ATH_MSG_DEBUG
(
"TileRawChannelToHit execution completed."
);
191
ATH_MSG_DEBUG
(
" nChan="
<< nChan
192
<<
" RawChSum="
<< eCh
193
<<
" nHit="
<< nHit
194
<<
" eneTot="
<< eHitTot );
195
196
197
ATH_MSG_VERBOSE
(
"TileHitVector container registered to the TES with name"
198
<<
m_hitVectorKey
.key() );
199
200
return
StatusCode::SUCCESS;
201
}
202
203
//************************************************************************
204
205
206
//****************************************************************************
207
//* Finalize
208
//****************************************************************************
209
210
StatusCode
TileRawChannelToHit::finalize
() {
211
212
ATH_MSG_INFO
(
"TileRawChannelToHit::finalize() end"
);
213
214
return
StatusCode::SUCCESS;
215
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x,...)
Definition
AthMsgStreamMacros.h:42
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
errorcheck.h
Helpers for checking error return status codes and reporting errors.
hitVector
std::vector< FPGATrackSimHit > hitVector
Definition
FPGATrackSimCluster.h:22
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
ReadCondHandle.h
SelectAllObject.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
TileCalibUtils.h
TileFragHash.h
TileHWID.h
TileID.h
TileInfo.h
TileRawChannelToHit.h
TileRawChannel.h
TileHit.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
SG::ReadCondHandle
Definition
ReadCondHandle.h:39
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:204
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition
ReadCondHandle.h:66
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:71
TileCalibUtils::getDrawerIdx
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
Definition
TileCalibUtils.cxx:60
TileHWID::HIGHGAIN
@ HIGHGAIN
Definition
TileHWID.h:73
TileHit
Definition
TileSimEvent/TileSimEvent/TileHit.h:30
TileRawChannelCollection
Definition
TileRawChannelCollection.h:12
TileRawChannelToHit::m_hitVectorKey
SG::WriteHandleKey< TileHitVector > m_hitVectorKey
Definition
TileRawChannelToHit.h:75
TileRawChannelToHit::~TileRawChannelToHit
virtual ~TileRawChannelToHit()
Definition
TileRawChannelToHit.cxx:50
TileRawChannelToHit::m_tileHWID
const TileHWID * m_tileHWID
Definition
TileRawChannelToHit.h:91
TileRawChannelToHit::m_rawChannelContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Definition
TileRawChannelToHit.h:71
TileRawChannelToHit::finalize
StatusCode finalize()
Definition
TileRawChannelToHit.cxx:210
TileRawChannelToHit::m_samplingFractionKey
SG::ReadCondHandleKey< TileSamplingFraction > m_samplingFractionKey
Name of TileSamplingFraction in condition store.
Definition
TileRawChannelToHit.h:82
TileRawChannelToHit::m_tileToolEmscale
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
main Tile Calibration tool
Definition
TileRawChannelToHit.h:93
TileRawChannelToHit::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
TileRawChannelToHit.cxx:86
TileRawChannelToHit::initialize
StatusCode initialize()
Definition
TileRawChannelToHit.cxx:57
TileRawChannelToHit::TileRawChannelToHit
TileRawChannelToHit(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TileRawChannelToHit.cxx:45
TileRawChannelToHit::m_useSamplFract
Gaudi::Property< bool > m_useSamplFract
Definition
TileRawChannelToHit.h:88
TileRawChannelToHit::m_tileID
const TileID * m_tileID
Definition
TileRawChannelToHit.h:90
TileRawChannelUnit::UNIT
UNIT
Definition
TileRawChannelUnit.h:16
TileRawChannelUnit::MegaElectronVolts
@ MegaElectronVolts
Definition
TileRawChannelUnit.h:20
TileRawChannel
Definition
TileRawChannel.h:35
TileSamplingFraction
Condition object to keep and provide Tile Calorimeter sampling fraction and number of photoelectrons.
Definition
TileSamplingFraction.h:16
TileSamplingFraction::getSamplingFraction
float getSamplingFraction(unsigned int drawerIdx, unsigned int channel) const
Return Tile Calorimeter sampling fraction.
Definition
TileSamplingFraction.h:53
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0