24 #include "GaudiKernel/SystemOfUnits.h"
25 #include "CLHEP/Units/SystemOfUnits.h"
44 #include "CLHEP/Units/PhysicalConstants.h"
51 , m_geoModSvc(
"GeoModelSvc",
name)
52 , m_FCS_StepInfo (
"MergedEventSteps")
53 , m_hitVec (
"TileHitVec_FCS")
54 , m_infoName (
"TileInfo")
58 , m_calc(
"TileGeoG4SDCalc",
name)
103 return StatusCode::SUCCESS;
109 return (tileDetectorTool) ? tileDetectorTool->
uShape() : 0;
126 const double tile_radius[13] = { 2300.,
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.);
138 const double size_correction = 2.75 + 1.5/2.;
141 std::unique_ptr<TileHitVector> FCS_hits = std::make_unique<TileHitVector>();
152 double ene = stepInfo->energy();
153 double time = stepInfo->time();
166 <<
" nHit=" << nHit <<
" energy=" << ene <<
" time=" <<
time);
172 <<
" nHit=" << nHit <<
" energy=" << ene <<
" time=" <<
time);
182 bool Ecell = (
sample == 3);
186 if ( Ecell || spC10 ) {
192 <<
" nHit=" << nHit <<
" energy=" << ene );
198 "Iterating over Steps: extra E/C10 hit with id " <<
m_tileID->
to_string(hit_id,-1)
199 <<
" nHit=" << nHit <<
" energy=" << ene );
204 double x = stepInfo->x();
205 double y = stepInfo->y();
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 );
220 dphi -= trunc(dphi/M_PI_64) * M_PI_64;
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 );
235 yLocal = copysign(halfYLocal,yLocal);
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 );
246 if (tile_ind<0) tile_ind = 0;
247 if (tile_ind>10) tile_ind = 10;
253 m_calc->pmtEdepFromFCS_StepInfo(hitData, ene, yLocal, halfYLocal, zLocal,
m_uShape);
257 for (
int pm=0; pm<2; ++pm) {
264 const double ref_ind_tile = 1.59;
266 if (
pmt) tim -= 2 * yLocal * inv_speed;
267 else tim += 2 * yLocal * inv_speed;
276 <<
" nHit=" << nHit <<
" pmt " <<
pmt <<
" energy=" << edep[pm] <<
" time="
277 <<
time <<
" + " << tim-
time <<
" = " << tim);
283 <<
" nHit=" << nHit <<
" pmt " <<
pmt <<
" energy=" << edep[pm] <<
" time="
284 <<
time <<
" + " << tim-
time <<
" = " << tim);
298 ATH_MSG_DEBUG(
"End of Iterating over Steps: nHit=" << nHit <<
" newHits=" << newHits <<
" Etot=" << Etot );
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) {
312 "Iterating over Hits: nHit=" << nHit <<
" size="
313 << pHit->
size() <<
" energy=" << pHit->
energy() );
316 for (
int ii=0; ii<pHit->
size(); ++ii ) Etot += pHit->
energy(ii);
317 sum_size += pHit->
size();
324 ATH_MSG_DEBUG(
"Execution completed, nHit=" << nHit <<
" sum_size=" << sum_size <<
" Etot=" << Etot );
327 return StatusCode::SUCCESS;
337 return StatusCode::SUCCESS;