ATLAS Offline Software
Loading...
Searching...
No Matches
LArHitFillerTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
11
12
13#include "LArHitFillerTool.h"
14#include "CaloEvent/CaloCell.h"
16#include "GaudiKernel/ServiceHandle.h"
24#include "CaloDetDescr/CaloDetDescrElement.h"
25#include <sstream>
26
27
28namespace D3PD {
29
30
38 (const std::string& type,
39 const std::string& name,
40 const IInterface* parent)
41 : BlockFillerTool<LArHit> (type, name, parent),
42 m_emid(0),
43 m_fcalid(0),
44 m_hecid(0),
45 m_tileid(0),
46 m_onlineid(0)
47{
48 // declareProperty ("SelectedCells", m_writeSelectedCells=true);
49 LArHitFillerTool::book().ignore();
50}
51
52
57{
58 ServiceHandle<StoreGateSvc> detStore("DetectorStore", name());
59 ATH_CHECK ( detStore.retrieve() );
60
61 ATH_CHECK ( m_caloMgrKey.initialize() );
62 ATH_CHECK ( detStore->retrieve(m_emid) );
63 ATH_CHECK ( detStore->retrieve(m_fcalid) );
64 ATH_CHECK ( detStore->retrieve(m_hecid) );
65 ATH_CHECK ( detStore->retrieve(m_tileid) );
66 ATH_CHECK ( detStore->retrieve(m_onlineid));
67
68 return StatusCode::SUCCESS;
69}
70
71
76{
77 CHECK( addVariable ("eta", m_eta) );
78 CHECK( addVariable ("phi", m_phi) );
79 CHECK( addVariable ("E", m_e) );
80 CHECK( addVariable ("Time",m_time) );
81 CHECK( addVariable ("ID", m_id) );
82 return StatusCode::SUCCESS;
83}
84
85
94StatusCode LArHitFillerTool::fill (const LArHit& p)
95{
96
97 Identifier id = p.cellID();
98
99 //bool fcal = m_tileid->is_lar_fcal(id);
100
101 *m_e = p.energy();
102 *m_time = p.time();
104 ATH_CHECK(caloMgrHandle.isValid());
105 const CaloDetDescrElement* dde = (*caloMgrHandle)->get_element(id);
106 *m_eta = dde->eta();
107 *m_phi = dde->phi();
109
110 return StatusCode::SUCCESS;
111}
112
113
114
116{
117 // AtlasID bit (4)
118 // 1 : lar_em
119 // 2 : lar_hec
120 // 3 : lar_fcal
121 // 4 : tile
122 unsigned ATbit1 = m_emid->is_lar_em(cellID) ? (1<<0) : 0;
123 unsigned ATbit2 = m_hecid->is_lar_hec(cellID) ? (1<<1) : 0;
124 unsigned ATbit3 = m_fcalid->is_lar_fcal(cellID) ? (1<<2) : 0;
125 unsigned ATbit4 = m_tileid->is_tile(cellID) ? (1<<3) : 0;
126 unsigned ATbit = (ATbit1 | ATbit2 | ATbit3 | ATbit4);
127
128 //std::cout << "ATLAS Calo(EM,HEC,FCal,Tile) : " << ATbit1 << " " << ATbit2 << " " << ATbit3 << " " << ATbit4 << std::endl;
129
130 // EM bit (5)
131 // 1-2 : sampling
132 // 0,1,2,3
133 // 0 presampler
134 // 1,2,3 each layer
135 // 3 : barrel
136 // 4 : endcap_inner
137 // 5 : endcap_outer
138 unsigned EMbit1 = 0;
139 unsigned EMbit3 = 0;
140 unsigned EMbit4 = 0;
141 unsigned EMbit5 = 0;
142 if (ATbit1) {
143 EMbit1 = unsigned(m_emid->sampling(cellID));
144 EMbit3 = m_emid->is_em_barrel(cellID) ? (1<<2) : 0;
145 EMbit4 = m_emid->is_em_endcap_inner(cellID) ? (1<<3) : 0;
146 EMbit5 = m_emid->is_em_endcap_outer(cellID) ? (1<<4) : 0;
147 }
148 unsigned EMbit = (EMbit1 | EMbit3 | EMbit4 | EMbit5);
149
150 //std::cout << "EM : " << EMbit1 << " " << EMbit3 << " " << EMbit4 << " " << EMbit5 << std::endl;
151
152 // HEC (2)
153 // 1-2: sampling
154 // 0,1 = first wheel
155 // 2,3 = second wheel
156 unsigned HCbit1 = 0;
157 if (ATbit2) {
158 HCbit1 = unsigned(m_hecid->sampling(cellID));
159 }
160 unsigned HCbit = HCbit1;
161
162 //std::cout << "HEC : " << HCbit1 << std::endl;
163
164 // FCal (2)
165 // 1-2 : module
166 // 1,2,3
167 // 1 EM
168 // 2,3 Hadronic
169 //
170 unsigned FCbit1 = 0;
171 if (ATbit3) {
172 FCbit1 = unsigned(m_fcalid->module(cellID));
173 }
174 unsigned FCbit = FCbit1;
175
176 //std::cout << "FCal : " << FCbit1 << std::endl;
177
178 // Tile bit (8)
179 // 1-3 : sample
180 // 0 = SAMP_A
181 // 1 = SAMP_B, SAMP_BC, SAMP_C
182 // 2 = SAMP_D
183 // 3 = SAMP_E
184 // 4 = SAMP_X
185 // 4 : barrel
186 // 5 : extbarrel
187 // 6 : gap
188 // 7 : gapscin
189 unsigned TLbit1 = 0;
190 unsigned TLbit4 = 0;
191 unsigned TLbit5 = 0;
192 unsigned TLbit6 = 0;
193 unsigned TLbit7 = 0;
194 if (ATbit4) {
195 TLbit1 = unsigned(m_tileid->sample(cellID));
196 TLbit4 = m_tileid->is_tile_barrel(cellID) ? (1<<3) : 0;
197 TLbit5 = m_tileid->is_tile_extbarrel(cellID) ? (1<<4) : 0;
198 TLbit6 = m_tileid->is_tile_gap(cellID) ? (1<<5) : 0;
199 TLbit7 = m_tileid->is_tile_gapscin(cellID) ? (1<<6) : 0;
200 }
201 unsigned TLbit = (TLbit1 | TLbit4 | TLbit5 | TLbit6 | TLbit7);
202
203 //std::cout << "Tile : " << TLbit1 << " " << TLbit4 << " " << TLbit5 << " " << TLbit6 << " " << TLbit7 << std::endl;
204
205 unsigned int CombBit = (ATbit | (EMbit<<4) | (HCbit<<9) |
206 (FCbit<<11) | (TLbit<<13));
207
208 return CombBit;
209}
210
211
212
213} // namespace D3PD
#define ATH_CHECK
Evaluate an expression and check for errors.
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
This class groups all DetDescr information related to a CaloCell.
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Type-safe wrapper for block filler tools.
const LArHEC_ID * m_hecid
const LArEM_ID * m_emid
virtual StatusCode fill(const LArHit &p) override
Fill one block — type-safe version.
LArHitFillerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
unsigned int CaloCell_GetDetectorInfo(Identifier &cellID)
const LArFCAL_ID * m_fcalid
const LArOnlineID * m_onlineid
virtual StatusCode initialize() override
Standard Gaudi initialize method.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
float * m_eta
Variable: time, quality and id.
virtual StatusCode book() override
Book variables for this block.
Class to store hit energy and time in LAr cell from G4 simulation.
Definition LArHit.h:25
Block filler tool for noisy FEB information.