117{
119
122 int nHit = 0;
123 float Etot = 0.0;
124 int newHits = 0;
125 int sum_size = 0;
126 const double tile_radius[13] = { 2300.,
127 2400., 2500., 2600.,
128 2730., 2860., 2990.,
129 3140., 3290., 3440.,
130 3640., 3820.,
131 3820.01 };
132
133 const double M_PI_32 =
M_PI/32.;
134 const double M_PI_64 =
M_PI/64.;
135 const double TAN_PI_64 =
tan(
M_PI/64.);
136
137
138 const double size_correction = 2.75 + 1.5/2.;
139
140 const ISF_FCS_Parametrization::FCS_StepInfoCollection* inCollect = nullptr;
141 std::unique_ptr<TileHitVector> FCS_hits = std::make_unique<TileHitVector>();
142
143
145
146 IdContext pmt_context =
m_tileID->pmt_context();
147
148
149 for(const ISF_FCS_Parametrization::FCS_StepInfo* stepInfo : *inCollect) {
150 Identifier hit_id = stepInfo->identify();
152 double ene = stepInfo->energy();
153 double time = stepInfo->time();
154
155 IdentifierHash hit_idhash;
156 m_tileID->get_hash(hit_id, hit_idhash, &pmt_context);
157
159
161 m_allHits[hit_idhash] =
new TileHit(hit_id,ene,time);
162 ++newHits;
163
165 "Iterating over Steps: new hit with id " <<
m_tileID->to_string(hit_id,-1)
166 << " nHit=" << nHit << " energy=" << ene << " time=" << time);
167 } else {
169
171 "Iterating over Steps: extra hit with id " <<
m_tileID->to_string(hit_id,-1)
172 << " nHit=" << nHit << " energy=" << ene << " time=" << time);
173 }
174
175 } else {
176
181
182 bool Ecell = (
sample == 3);
184 ((module >= 38 && module <= 41) || (module >= 54 && module <= 57)));
185
186 if ( Ecell || spC10 ) {
188 m_allHits[hit_idhash] =
new TileHit(hit_id,ene,time);
189
191 "Iterating over Steps: new E/C10 hit with id " <<
m_tileID->to_string(hit_id,-1)
192 << " nHit=" << nHit << " energy=" << ene );
193 ++newHits;
194 } else {
196
198 "Iterating over Steps: extra E/C10 hit with id " <<
m_tileID->to_string(hit_id,-1)
199 << " nHit=" << nHit << " energy=" << ene );
200 }
201
202 } else {
203
204 double x = stepInfo->x();
205 double y = stepInfo->y();
207 double edep[2];
208 Identifier cell_id =
m_tileID->cell_id(hit_id);
209
210 double phi_module=(module + 0.5) * M_PI_32;
211 double phi_hit = atan2(
y,
x);
212 if (phi_hit<0) phi_hit += 2*
M_PI;
213 double dphi = phi_hit - phi_module;
214 if (dphi < -M_PI_64 || dphi > M_PI_64) {
216 <<
" x " <<
x <<
" y " <<
y
217 << " phi_module " << phi_module << " phi_hit " << phi_hit
218 << " dphi " << dphi );
219
220 dphi -= trunc(dphi/M_PI_64) * M_PI_64;
221 }
222
224 double radius_corrected =
radius *
cos(dphi);
227 double halfYLocal = radius_corrected * TAN_PI_64 - size_correction;
228 if (fabs(yLocal) > halfYLocal) {
230 <<
" x " <<
x <<
" y " <<
y
231 << " radius_corr " << radius_corrected
232 << " yLocal " << yLocal << " halfYlocal_corr " << halfYLocal
233 << " delta " << fabs(yLocal) - halfYLocal );
234
235 yLocal = copysign(halfYLocal,yLocal);
236 }
237
238
239 int tile_ind = std::lower_bound (tile_radius, tile_radius+12,radius_corrected)-tile_radius-1;
240 if (tile_ind < 0 || tile_ind > 10 ) {
242 <<
" x " <<
x <<
" y " <<
y
243 << " radius " << radius << " corrected " << radius_corrected
244 << " tile_index " << tile_ind );
245
246 if (tile_ind<0) tile_ind = 0;
247 if (tile_ind>10) tile_ind = 10;
248 }
249 TileHitData hitData;
253 m_calc->pmtEdepFromFCS_StepInfo(hitData, ene, yLocal, halfYLocal, zLocal,
m_uShape);
256
257 for (int pm=0; pm<2; ++pm) {
258
259 hit_id =
m_tileID->pmt_id(cell_id,pm);
260 m_tileID->get_hash(hit_id, hit_idhash, &pmt_context);
261
263 if (pm != pmt) {
264 const double ref_ind_tile = 1.59;
265 const double inv_speed = ref_ind_tile / CLHEP::c_light;
266 if (pmt) tim -= 2 * yLocal * inv_speed;
267 else tim += 2 * yLocal * inv_speed;
268 }
269
272 ++newHits;
273
275 "Iterating over Steps: new hit with id " <<
m_tileID->to_string(hit_id,-1)
276 << " nHit=" << nHit << " pmt " << pmt << " energy=" << edep[pm] << " time="
277 << time << " + " << tim-time << " = " << tim);
278 } else {
280
282 "Iterating over Steps: extra hit with id " <<
m_tileID->to_string(hit_id,-1)
283 << " nHit=" << nHit << " pmt " << pmt << " energy=" << edep[pm] << " time="
284 << time << " + " << tim-time << " = " << tim);
285 }
286 }
287
288 }
289
290 }
291
292 ++nHit;
293 Etot += ene;
294 }
295
296 }
297
298 ATH_MSG_DEBUG(
"End of Iterating over Steps: nHit=" << nHit <<
" newHits=" << newHits <<
" Etot=" << Etot );
299
300 nHit = 0;
301 Etot = 0.0;
302
303
304 std::vector<TileHit*>::const_iterator curr =
m_allHits.begin();
305 std::vector<TileHit*>::const_iterator iend =
m_allHits.end();
306 for ( ; curr != iend; ++curr) {
307 if (*curr) {
308 TileHit *pHit = (*curr);
309
310
312 "Iterating over Hits: nHit=" << nHit << " size="
313 << pHit->
size() <<
" energy=" << pHit->
energy() );
314 FCS_hits->push_back(*pHit);
315 ++nHit;
316 for (
int ii=0; ii<pHit->
size(); ++ii ) Etot += pHit->
energy(ii);
317 sum_size += pHit->
size();
318 }
319 }
320
321
323
324 ATH_MSG_DEBUG(
"Execution completed, nHit=" << nHit <<
" sum_size=" << sum_size <<
" Etot=" << Etot );
325
326
327 return StatusCode::SUCCESS;
328}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define CHECK(...)
Evaluate an expression and check for errors.
ServiceHandle< StoreGateSvc > & evtStore()
float energy(int ind=0) const
Return energy of ind-th sub-hit.
int size(void) const
Return length of energy/time vectors.
time(flags, cells_name, *args, **kw)
retrieve(aClass, aKey=None)