ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellsDecorator.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7// TileCellsDecorator.cxx
8// Implementation file for class TileCellsDecorator
10
11// Tile includes
12#include "TileCellsDecorator.h"
13#include "TileEvent/TileCell.h"
15
16// Athena includes
19#include "xAODBase/IParticle.h"
20
21// Calo includes
23#include "CaloEvent/CaloCell.h"
25
26
27#include <vector>
28
29
30namespace DerivationFramework {
31
32
33 TileCellsDecorator::TileCellsDecorator( const std::string& type, const std::string& name, const IInterface* parent )
34 : AthAlgTool(type, name, parent)
35 {
36 }
37
38
40
41 ATH_CHECK( m_cablingSvc.retrieve() );
42 ATH_CHECK( detStore()->retrieve(m_tileID) );
43 ATH_CHECK( detStore()->retrieve(m_tileHWID) );
44
45 ATH_CHECK(m_muonContainer.initialize());
46
47 ATH_CHECK( m_cellsEnergyKey.initialize() );
48 ATH_CHECK( m_cellsEtKey.initialize() );
49 ATH_CHECK( m_cellsEtaKey.initialize() );
50 ATH_CHECK( m_cellsPhiKey.initialize() );
51 ATH_CHECK( m_cellsGainKey.initialize() );
52 ATH_CHECK( m_cellsBadKey.initialize() );
53 ATH_CHECK( m_cellsSamplingKey.initialize() );
54 ATH_CHECK( m_cellsTimeKey.initialize() );
55 ATH_CHECK( m_cellsQualityKey.initialize() );
56 ATH_CHECK( m_cellsSinThKey.initialize() );
57 ATH_CHECK( m_cellsCosThKey.initialize() );
58 ATH_CHECK( m_cellsCotThKey.initialize() );
59 ATH_CHECK( m_cellsXKey.initialize() );
60 ATH_CHECK( m_cellsYKey.initialize() );
61 ATH_CHECK( m_cellsZKey.initialize() );
62 ATH_CHECK( m_cellsRKey.initialize() );
63 ATH_CHECK( m_cellsDxKey.initialize() );
64 ATH_CHECK( m_cellsDyKey.initialize() );
65 ATH_CHECK( m_cellsDzKey.initialize() );
66 ATH_CHECK( m_cellsDrKey.initialize() );
67 ATH_CHECK( m_cellsVolumeKey.initialize() );
68 ATH_CHECK( m_cellsDetaKey.initialize() );
69 ATH_CHECK( m_cellsDphiKey.initialize() );
70 ATH_CHECK( m_cellsSideKey.initialize() );
71 ATH_CHECK( m_cellsSectionKey.initialize() );
72 ATH_CHECK( m_cellsModuleKey.initialize() );
73 ATH_CHECK( m_cellsTowerKey.initialize() );
74 ATH_CHECK( m_cellsSampleKey.initialize() );
75 ATH_CHECK( m_cellsPmt1RosKey.initialize() );
76 ATH_CHECK( m_cellsPmt2RosKey.initialize() );
77 ATH_CHECK( m_cellsPmt1DrawerKey.initialize() );
78 ATH_CHECK( m_cellsPmt2DrawerKey.initialize() );
79 ATH_CHECK( m_cellsPmt1ChannelKey.initialize() );
80 ATH_CHECK( m_cellsPmt2ChannelKey.initialize() );
81 ATH_CHECK( m_cellsPmt1EnergyKey.initialize() );
82 ATH_CHECK( m_cellsPmt2EnergyKey.initialize() );
83 ATH_CHECK( m_cellsPmt1TimeKey.initialize() );
84 ATH_CHECK( m_cellsPmt2TimeKey.initialize() );
85 ATH_CHECK( m_cellsPmt1QualityKey.initialize() );
86 ATH_CHECK( m_cellsPmt2QualityKey.initialize() );
87 ATH_CHECK( m_cellsPmt1QbitKey.initialize() );
88 ATH_CHECK( m_cellsPmt2QbitKey.initialize() );
89 ATH_CHECK( m_cellsPmt1BadKey.initialize() );
90 ATH_CHECK( m_cellsPmt2BadKey.initialize() );
91 ATH_CHECK( m_cellsPmt1GainKey.initialize() );
92 ATH_CHECK( m_cellsPmt2GainKey.initialize() );
93
94 return StatusCode::SUCCESS;
95 }
96
97 StatusCode TileCellsDecorator::decorate(const std::map<const xAOD::IParticle*, std::vector<const CaloCell*>>& muonCellsMap, const EventContext& ctx) const {
98
145
146 for (std::pair<const xAOD::IParticle*, const std::vector<const CaloCell*>> particleCellsPair : muonCellsMap) {
147
148 const xAOD::IParticle* particle = particleCellsPair.first;
149 const std::vector<const CaloCell*>& cells = particleCellsPair.second;
150
151 std::vector< float > cells_energy;
152 std::vector< float > cells_et;
153 std::vector< float > cells_eta;
154 std::vector< float > cells_phi;
155
156 std::vector< int > cells_gain;
157 std::vector< bool > cells_bad;
158 std::vector< int > cells_sampling;
159 std::vector< float > cells_time;
160 std::vector< unsigned short > cells_quality;
161
162 std::vector< float > cells_sinTh;
163 std::vector< float > cells_cosTh;
164 std::vector< float > cells_cotTh;
165 std::vector< float > cells_x;
166 std::vector< float > cells_y;
167 std::vector< float > cells_z;
168
169 std::vector< float > cells_r;
170 std::vector< float > cells_dx;
171 std::vector< float > cells_dy;
172 std::vector< float > cells_dz;
173 std::vector< float > cells_dr;
174 std::vector< float > cells_volume;
175 std::vector< float > cells_dphi;
176 std::vector< float > cells_deta;
177
178 std::vector< int > cells_side;
179 std::vector< unsigned short > cells_section;
180 std::vector< unsigned short > cells_module;
181 std::vector< unsigned short > cells_tower;
182 std::vector< unsigned short > cells_sample;
183
184 std::vector< unsigned short > cells_pmt1_ros;
185 std::vector< unsigned short > cells_pmt2_ros;
186 std::vector< unsigned short > cells_pmt1_drawer;
187 std::vector< unsigned short > cells_pmt2_drawer;
188 std::vector< unsigned short > cells_pmt1_channel;
189 std::vector< unsigned short > cells_pmt2_channel;
190
191 std::vector< float > cells_pmt1_energy;
192 std::vector< float > cells_pmt2_energy;
193 std::vector< float > cells_pmt1_time;
194 std::vector< float > cells_pmt2_time;
195
196 std::vector< unsigned short > cells_pmt1_quality;
197 std::vector< unsigned short > cells_pmt2_quality;
198 std::vector< unsigned short > cells_pmt1_qbit;
199 std::vector< unsigned short > cells_pmt2_qbit;
200
201 std::vector< bool > cells_pmt1_bad;
202 std::vector< bool > cells_pmt2_bad;
203 std::vector< unsigned short > cells_pmt1_gain;
204 std::vector< unsigned short > cells_pmt2_gain;
205
206
207 for (const CaloCell* cell : cells) {
208
209 const CaloDetDescrElement* cell_dde = cell->caloDDE();
210
211 // Cell energy and eta/phi
212 cells_energy.push_back( cell->energy() );
213 cells_et.push_back( cell->et() );
214 cells_eta.push_back( cell->eta() );
215 cells_phi.push_back( cell->phi() );
216
217
218 cells_gain.push_back( cell->gain() );
219 cells_bad.push_back( cell->badcell() );
220 cells_sampling.push_back( cell_dde->getSampling() );
221 cells_time.push_back( cell->time() );
222 cells_quality.push_back( cell->quality() );
223
224 // Cell positioning
225 cells_sinTh.push_back( cell->sinTh() );
226 cells_cosTh.push_back( cell->cosTh() );
227 cells_cotTh.push_back( cell->cotTh() );
228 cells_x.push_back( cell->x() );
229 cells_y.push_back( cell->y() );
230 cells_z.push_back( cell->z() );
231
232 // Cells dimensions
233 cells_r.push_back( cell_dde->r() );
234 cells_dx.push_back( cell_dde->dx() );
235 cells_dy.push_back( cell_dde->dy() );
236 cells_dz.push_back( cell_dde->dz() );
237 cells_dr.push_back( cell_dde->dr() );
238 cells_volume.push_back( cell_dde->volume() );
239 cells_dphi.push_back( cell_dde->dphi() );
240 cells_deta.push_back( cell_dde->deta() );
241
242 cells_side.push_back( m_tileID->side(cell->ID()) );
243 cells_section.push_back( m_tileID->section(cell->ID()) );
244 cells_module.push_back( m_tileID->module(cell->ID()) );
245 cells_tower.push_back( m_tileID->tower(cell->ID()) );
246 cells_sample.push_back( m_tileID->sample(cell->ID()) );
247
248 // Tile PMT information
249 const TileCell* tile_cell = dynamic_cast<const TileCell*> (cell);
250
251 IdentifierHash hash1 = cell_dde->onl1();
252 IdentifierHash hash2 = cell_dde->onl2();
253
254 // Tile cell positioning
255 int ros1 = -1;
256 int drawer1 = -1;
257 int channel1 = -1;
258 if (hash1 != TileHWID::NOT_VALID_HASH) {
259 ros1 = m_tileHWID->ros(m_tileHWID->adc_id(hash1, tile_cell->gain1()));
260 drawer1 = m_tileHWID->drawer(m_tileHWID->adc_id(hash1, tile_cell->gain1()));
261 channel1 = m_tileHWID->channel(m_tileHWID->adc_id(hash1, tile_cell->gain1()));
262 }
263
264 int ros2 = -1;
265 int drawer2 = -1;
266 int channel2 = -1;
267 if (hash2 != TileHWID::NOT_VALID_HASH) {
268 ros2 = m_tileHWID->ros(m_tileHWID->adc_id(hash2, tile_cell->gain2()));
269 drawer2 = m_tileHWID->drawer(m_tileHWID->adc_id(hash2, tile_cell->gain2()));
270 channel2 = m_tileHWID->channel(m_tileHWID->adc_id(hash2, tile_cell->gain2()));
271 }
272
273 cells_pmt1_ros.push_back( ros1 );
274 cells_pmt2_ros.push_back( ros2 );
275 cells_pmt1_drawer.push_back( drawer1 );
276 cells_pmt2_drawer.push_back( drawer2 );
277 cells_pmt1_channel.push_back( channel1 );
278 cells_pmt2_channel.push_back( channel2 );
279
280 cells_pmt1_energy.push_back( tile_cell->ene1() );
281 cells_pmt2_energy.push_back( tile_cell->ene2() );
282 cells_pmt1_time.push_back( tile_cell->time1() );
283 cells_pmt2_time.push_back( tile_cell->time2() );
284 cells_pmt1_quality.push_back( tile_cell->qual1() );
285 cells_pmt2_quality.push_back( tile_cell->qual2() );
286 cells_pmt1_qbit.push_back( tile_cell->qbit1() );
287 cells_pmt2_qbit.push_back( tile_cell->qbit2() );
288 cells_pmt1_bad.push_back( tile_cell->badch1() );
289 cells_pmt2_bad.push_back( tile_cell->badch2() );
290 cells_pmt1_gain.push_back( tile_cell->gain1() );
291 cells_pmt2_gain.push_back( tile_cell->gain2() );
292 }
293
294 cellsEnergy(*particle) = std::move(cells_energy);
295 cellsEt(*particle) = std::move(cells_et);
296 cellsEta(*particle) = std::move(cells_eta);
297 cellsPhi(*particle) = std::move(cells_phi);
298 cellsGain(*particle) = std::move(cells_gain);
299 cellsBad(*particle) = std::move(cells_bad);
300 cellsSampling(*particle) = std::move(cells_sampling);
301 cellsTime(*particle) = std::move(cells_time);
302 cellsQuality(*particle) = std::move(cells_quality);
303
304 cellsSinTh(*particle) = std::move(cells_sinTh);
305 cellsCosTh(*particle) = std::move(cells_cosTh);
306 cellsCotTh(*particle) = std::move(cells_cotTh);
307 cellsX(*particle) = std::move(cells_x);
308 cellsY(*particle) = std::move(cells_y);
309 cellsZ(*particle) = std::move(cells_z);
310 cellsR(*particle) = std::move(cells_r);
311 cellsDx(*particle) = std::move(cells_dx);
312 cellsDy(*particle) = std::move(cells_dy);
313 cellsDz(*particle) = std::move(cells_dz);
314 cellsDr(*particle) = std::move(cells_dr);
315 cellsVolume(*particle) = std::move(cells_volume);
316 cellsDeta(*particle) = std::move(cells_deta);
317 cellsDphi(*particle) = std::move(cells_dphi);
318 cellsSide(*particle) = std::move(cells_side);
319 cellsSection(*particle) = std::move(cells_section);
320 cellsModule(*particle) = std::move(cells_module);
321 cellsTower(*particle) = std::move(cells_tower);
322 cellsSample(*particle) = std::move(cells_sample);
323
324 cellsPmt1Ros(*particle) = std::move(cells_pmt1_ros);
325 cellsPmt2Ros(*particle) = std::move(cells_pmt2_ros);
326 cellsPmt1Drawer(*particle) = std::move(cells_pmt1_drawer);
327 cellsPmt2Drawer(*particle) = std::move(cells_pmt2_drawer);
328 cellsPmt1Channel(*particle) = std::move(cells_pmt1_channel);
329 cellsPmt2Channel(*particle) = std::move(cells_pmt2_channel);
330 cellsPmt1Energy(*particle) = std::move(cells_pmt1_energy);
331 cellsPmt2Energy(*particle) = std::move(cells_pmt2_energy);
332 cellsPmt1Time(*particle) = std::move(cells_pmt1_time);
333 cellsPmt2Time(*particle) = std::move(cells_pmt2_time);
334 cellsPmt1Quality(*particle) = std::move(cells_pmt1_quality);
335 cellsPmt2Quality(*particle) = std::move(cells_pmt2_quality);
336 cellsPmt1_Qbit(*particle) = std::move(cells_pmt1_qbit);
337 cellsPmt2_Qbit(*particle) = std::move(cells_pmt2_qbit);
338 cellsPmt1Bad(*particle) = std::move(cells_pmt1_bad);
339 cellsPmt2Bad(*particle) = std::move(cells_pmt2_bad);
340 cellsPmt1Gain(*particle) = std::move(cells_pmt1_gain);
341 cellsPmt2Gain(*particle) = std::move(cells_pmt2_gain);
342
343 }
344
345 return StatusCode::SUCCESS;
346 }
347
348}
#define ATH_CHECK
Evaluate an expression and check for errors.
Helpers for checking error return status codes and reporting errors.
Handle class for adding a decoration to an object.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
IdentifierHash onl2() const
cell online identifier 2
IdentifierHash onl1() const
cell online identifier 1
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsVolumeKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsCotThKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1DrawerKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2GainKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsTimeKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsEtKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1ChannelKey
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsSinThKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsXKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2TimeKey
TileCellsDecorator(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2BadKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPhiKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonContainer
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsQualityKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsSamplingKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsModuleKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsYKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2QbitKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsDxKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1GainKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsDzKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2EnergyKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsDrKey
StatusCode decorate(const std::map< const xAOD::IParticle *, std::vector< const CaloCell * > > &muonCellsMap, const EventContext &ctx) const
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsSectionKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2RosKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2DrawerKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2QualityKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1QualityKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsGainKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1QbitKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsSampleKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsSideKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsCosThKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsDetaKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsZKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsEnergyKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsEtaKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1BadKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsTowerKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsRKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1EnergyKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsDyKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsDphiKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1RosKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt2ChannelKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsPmt1TimeKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_cellsBadKey
This is a "hash" representation of an Identifier.
Handle class for adding a decoration to an object.
uint8_t qual1(void) const
get quality of first PMT (data member)
Definition TileCell.h:197
float time1(void) const
get time of first PMT
Definition TileCell.h:192
int gain2(void) const
get gain of second PMT
Definition TileCell.cxx:175
bool badch1(void) const
check if first PMT is in bad channel list and masked
Definition TileCell.h:209
uint8_t qbit2(void) const
get quality bits of second PMT (data member)
Definition TileCell.h:206
int gain1(void) const
get gain of first PMT
Definition TileCell.cxx:168
uint8_t qual2(void) const
get quality of second PMT (data member)
Definition TileCell.h:200
float ene1(void) const
get energy of first PMT
Definition TileCell.h:187
bool badch2(void) const
check if second PMT is in bad channel list and masked
Definition TileCell.h:212
float time2(void) const
get time of second PMT
Definition TileCell.h:194
uint8_t qbit1(void) const
get quality bits of first PMT (data member)
Definition TileCell.h:203
float ene2(void) const
get energy of second PMT
Definition TileCell.h:189
@ NOT_VALID_HASH
Definition TileHWID.h:314
Class providing the definition of the 4-vector interface.
THE reconstruction tool.