Execute method.
99{
101
104 int nHit = 0;
105 float Etot = 0.0;
106 int newHits = 0;
107 int sum_size = 0;
108 const double tile_radius[13] = { 2300.,
109 2400., 2500., 2600.,
110 2730., 2860., 2990.,
111 3140., 3290., 3440.,
112 3640., 3820.,
113 3820.01 };
114
115 const double M_PI_32 =
M_PI/32.;
116 const double M_PI_64 =
M_PI/64.;
117 const double TAN_PI_64 =
tan(
M_PI/64.);
118
119
120 const double size_correction = 2.75 + 1.5/2.;
121
122 const ISF_FCS_Parametrization::FCS_StepInfoCollection* inCollect = nullptr;
123 std::unique_ptr<TileHitVector> FCS_hits = std::make_unique<TileHitVector>();
124
125
127
128 IdContext pmt_context =
m_tileID->pmt_context();
129
130
131 for(const ISF_FCS_Parametrization::FCS_StepInfo* stepInfo : *inCollect) {
132 Identifier hit_id = stepInfo->identify();
134 double ene = stepInfo->energy();
135 double time = stepInfo->time();
136
137 IdentifierHash hit_idhash;
138 m_tileID->get_hash(hit_id, hit_idhash, &pmt_context);
139
141
143 m_allHits[hit_idhash] =
new TileHit(hit_id,ene,time);
144 ++newHits;
145
147 "Iterating over Steps: new hit with id " <<
m_tileID->to_string(hit_id,-1)
148 << " nHit=" << nHit << " energy=" << ene << " time=" << time);
149 } else {
151
153 "Iterating over Steps: extra hit with id " <<
m_tileID->to_string(hit_id,-1)
154 << " nHit=" << nHit << " energy=" << ene << " time=" << time);
155 }
156
157 } else {
158
163
164 bool Ecell = (
sample == 3);
166 ((module >= 38 && module <= 41) || (module >= 54 && module <= 57)));
167
168 if ( Ecell || spC10 ) {
170 m_allHits[hit_idhash] =
new TileHit(hit_id,ene,time);
171
173 "Iterating over Steps: new E/C10 hit with id " <<
m_tileID->to_string(hit_id,-1)
174 << " nHit=" << nHit << " energy=" << ene );
175 ++newHits;
176 } else {
178
180 "Iterating over Steps: extra E/C10 hit with id " <<
m_tileID->to_string(hit_id,-1)
181 << " nHit=" << nHit << " energy=" << ene );
182 }
183
184 } else {
185
186 double x = stepInfo->x();
187 double y = stepInfo->y();
189 double edep[2];
190 Identifier cell_id =
m_tileID->cell_id(hit_id);
191
192 double phi_module=(module + 0.5) * M_PI_32;
193 double phi_hit = atan2(
y,
x);
194 if (phi_hit<0) phi_hit += 2*
M_PI;
195 double dphi = phi_hit - phi_module;
196 if (dphi < -M_PI_64 || dphi > M_PI_64) {
198 <<
" x " <<
x <<
" y " <<
y
199 << " phi_module " << phi_module << " phi_hit " << phi_hit
200 << " dphi " << dphi );
201
202 dphi -= trunc(dphi/M_PI_64) * M_PI_64;
203 }
204
206 double radius_corrected =
radius *
cos(dphi);
209 double halfYLocal = radius_corrected * TAN_PI_64 - size_correction;
210 if (fabs(yLocal) > halfYLocal) {
212 <<
" x " <<
x <<
" y " <<
y
213 << " radius_corr " << radius_corrected
214 << " yLocal " << yLocal << " halfYlocal_corr " << halfYLocal
215 << " delta " << fabs(yLocal) - halfYLocal );
216
217 yLocal = copysign(halfYLocal,yLocal);
218 }
219
220
221 int tile_ind = std::lower_bound (tile_radius, tile_radius+12,radius_corrected)-tile_radius-1;
222 if (tile_ind < 0 || tile_ind > 10 ) {
224 <<
" x " <<
x <<
" y " <<
y
225 << " radius " << radius << " corrected " << radius_corrected
226 << " tile_index " << tile_ind );
227
228 if (tile_ind<0) tile_ind = 0;
229 if (tile_ind>10) tile_ind = 10;
230 }
231 TileHitData hitData;
235 m_calc->pmtEdepFromFCS_StepInfo(hitData, ene, yLocal, halfYLocal, zLocal,
m_uShape);
238
239 for (int pm=0; pm<2; ++pm) {
240
241 hit_id =
m_tileID->pmt_id(cell_id,pm);
242 m_tileID->get_hash(hit_id, hit_idhash, &pmt_context);
243
245 if (pm != pmt) {
246 const double ref_ind_tile = 1.59;
247 const double inv_speed = ref_ind_tile / CLHEP::c_light;
248 if (pmt) tim -= 2 * yLocal * inv_speed;
249 else tim += 2 * yLocal * inv_speed;
250 }
251
254 ++newHits;
255
257 "Iterating over Steps: new hit with id " <<
m_tileID->to_string(hit_id,-1)
258 << " nHit=" << nHit << " pmt " << pmt << " energy=" << edep[pm] << " time="
259 << time << " + " << tim-time << " = " << tim);
260 } else {
262
264 "Iterating over Steps: extra hit with id " <<
m_tileID->to_string(hit_id,-1)
265 << " nHit=" << nHit << " pmt " << pmt << " energy=" << edep[pm] << " time="
266 << time << " + " << tim-time << " = " << tim);
267 }
268 }
269
270 }
271
272 }
273
274 ++nHit;
275 Etot += ene;
276 }
277
278 }
279
280 ATH_MSG_DEBUG(
"End of Iterating over Steps: nHit=" << nHit <<
" newHits=" << newHits <<
" Etot=" << Etot );
281
282 nHit = 0;
283 Etot = 0.0;
284
285
286 std::vector<TileHit*>::const_iterator curr =
m_allHits.begin();
287 std::vector<TileHit*>::const_iterator iend =
m_allHits.end();
288 for ( ; curr != iend; ++curr) {
289 if (*curr) {
290 TileHit *pHit = (*curr);
291
292
294 "Iterating over Hits: nHit=" << nHit << " size="
295 << pHit->
size() <<
" energy=" << pHit->
energy() );
296 FCS_hits->push_back(*pHit);
297 ++nHit;
298 for (
int ii=0; ii<pHit->
size(); ++ii ) Etot += pHit->
energy(ii);
299 sum_size += pHit->
size();
300 }
301 }
302
303
305
306 ATH_MSG_DEBUG(
"Execution completed, nHit=" << nHit <<
" sum_size=" << sum_size <<
" Etot=" << Etot );
307
308
309 return StatusCode::SUCCESS;
310}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define CHECK(...)
Evaluate an expression and check for errors.
ServiceHandle< StoreGateSvc > & evtStore()
Gaudi::Property< std::string > m_hitVec
Gaudi::Property< float > m_deltaT
Gaudi::Property< std::string > m_FCS_StepInfo
std::vector< TileHit * > m_allHits
ServiceHandle< ITileCalculator > m_calc
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)