147{
148
149
150 bool use3D = true;
151
152 cellIntersections.reserve(extension.caloLayerIntersections().size() * 1.3);
153
157
161
163 for (const auto* cell : cells) {
164
166
169 continue;
170
171
172
173
174
176 if (sample == CaloSampling::PreSamplerB) {
180 }
181 }
184
185 double drFix =
cell->caloDDE()->dr();
186 double dzFix =
cell->caloDDE()->dz();
187
188
189 int isample =
cell->caloDDE()->getSampling();
193 if (sample == CaloSampling::PreSamplerB || sample == CaloSampling::EMB1 ||
194 sample == CaloSampling::EMB2 || sample == CaloSampling::EMB3)
196
197 double drTG = fabs((
pos->second.first - pos2->second.second).perp());
198 double dzTG = fabs((
pos->second.first - pos2->second.second).z());
199
202 <<
cell->caloDDE()->getSampling() <<
" dr "
203 <<
cell->caloDDE()->dr() <<
" drTG " << drTG);
206 <<
cell->caloDDE()->getSampling() <<
" dz "
207 <<
cell->caloDDE()->dz() <<
" dzTG " << dzTG);
208
209 if (drFix == 0.) {
210
211
212
213
214 if (
cell->caloDDE()->deta() > 0) {
216 double dtheta =
221 drFix = fabs(dr);
222 double detaCheck =
225 <<
cell->caloDDE()->getSampling() <<
" deta "
226 <<
cell->caloDDE()->deta() <<
" detaCheck "
227 << detaCheck << " drFix " << drFix);
228 } else {
230 <<
theta <<
" dtheta " << dtheta <<
" sum/pi "
231 << (
theta + dtheta) * M_1_PI <<
" deta "
232 <<
cell->caloDDE()->deta());
233 }
234
235
236
237 } else {
238 double drMin = 100000.;
239 int dscut = 1;
241 dscut = 0;
242 const CaloCell* cellFound = nullptr;
243 for (const auto* celln : cells) {
244 if (cell == celln)
245 continue;
246 if (
cell->caloDDE()->getSubCalo() == celln->caloDDE()->getSubCalo()) {
247 int dsample = isample - celln->caloDDE()->getSampling();
248 if (abs(dsample) == dscut) {
249 double drNew = fabs(
cell->caloDDE()->r() - celln->caloDDE()->r());
250 if (drNew < 1)
251 continue;
252 if (drNew < drMin) {
253 drMin = drNew;
254 cellFound = celln;
255 }
256 }
257 }
258 }
259 drFix = drMin;
261 <<
cell->caloDDE()->getSampling() <<
" x "
262 <<
cell->caloDDE()->x() <<
" y " <<
cell->caloDDE()->y()
263 <<
" z " <<
cell->caloDDE()->z() <<
" dr "
264 <<
cell->caloDDE()->dr() <<
" drFix " << drFix
265 << " drTG " << drTG);
266 if (cellFound)
269 << cellFound->
caloDDE()->
x() <<
" y "
270 << cellFound->
caloDDE()->
y() <<
" z "
271 << cellFound->
caloDDE()->
z() <<
" dr "
272 << cellFound->
caloDDE()->
dr() <<
" dscut " << dscut
273 << " drFix " << drFix);
274 }
275 }
276
277 if (dzFix == 0.) {
278
279
280
281 if (
cell->caloDDE()->deta() > 0) {
283 double dtheta =
286 double dz = fabs(
cell->caloDDE()->r() /
tan(
theta + dtheta) -
288 dzFix = dz;
289 } else {
291 <<
theta <<
" dtheta " << dtheta <<
" sum/pi "
292 << (
theta + dtheta) * M_1_PI <<
" deta "
293 <<
cell->caloDDE()->deta());
294 }
295 double detaCheck =
298 <<
cell->caloDDE()->getSampling() <<
" deta "
299 <<
cell->caloDDE()->deta() <<
" detaCheck "
300 << detaCheck << " dtheta " << dtheta << " dzFix "
301 << dzFix);
302 } else {
303 double dzMin = 100000.;
304 int dscut = 1;
306 dscut = 0;
307 const CaloCell* cellFound = nullptr;
308 for (const auto* celln : cells) {
309 if (cell == celln)
310 continue;
311 if (
cell->caloDDE()->getSubCalo() == celln->caloDDE()->getSubCalo()) {
312 int isample2 = celln->caloDDE()->getSampling();
313 if (abs(isample - isample2) == dscut) {
314 double dzNew = fabs(
cell->caloDDE()->z() - celln->caloDDE()->z());
315 if (dzNew < 1)
316 continue;
317 if (dzNew < dzMin) {
318 dzMin = dzNew;
319 cellFound = celln;
320 }
321 }
322 }
323 }
324 dzFix = dzMin;
326 <<
cell->caloDDE()->getSampling() <<
" x "
327 <<
cell->caloDDE()->x() <<
" y " <<
cell->caloDDE()->y()
328 <<
" z " <<
cell->caloDDE()->z() <<
" dz "
329 <<
cell->caloDDE()->dz() <<
" dzFix " << dzFix
330 << " dzTG " << dzTG);
331 if (cellFound)
334 << cellFound->
caloDDE()->
x() <<
" y "
335 << cellFound->
caloDDE()->
y() <<
" z "
336 << cellFound->
caloDDE()->
z() <<
" dz "
337 << cellFound->
caloDDE()->
dz() <<
" dscut " << dscut
338 << " dzFix " << dzFix);
339 }
340 }
341
342
343
344
345
346 if (
cell->energy() > 50.)
348 <<
cell->caloDDE()->getSampling() <<
" cell energy "
349 <<
cell->energy() <<
" dzFix " << dzFix <<
" dzTG " << dzTG
350 << " drFix " << drFix << " drTG " << drTG << " barrel "
352
354 dzFix = dzTG;
356 drFix = drTG;
357
358 if (use3D) {
359
361 *cell,
pos->second.first, pos2->second.second, drFix, dzFix);
362 double totpath = (
pos->second.first - pos2->second.second).
mag();
363 path = totpath != 0 ? pathInMM / totpath : 0.;
364 if (path > 0 ||
cell->energy() > 50.) {
366 <<
cell->caloDDE()->getSampling() <<
" cell energy "
367 <<
cell->energy() <<
" drFix " << drFix <<
" dzFix "
368 << dzFix << " path " << path << " length TG " << totpath);
370 <<
cell->caloDDE()->dz() <<
" deta "
371 <<
cell->caloDDE()->deta());
372 }
373 }
374
376 double path2 = 0.;
377
378 if (!use3D)
380
381 if (path2 <= 0. && path <= 0.)
382 continue;
383
384
386 double eLoss = 0.;
387
388
389
391 eLoss = eLossPair->second;
392 if (sample == CaloSampling::PreSamplerB) {
395 eLoss = 0.5 * (eLossPair->second) + 0.5 * (eLossPair2->second);
396 }
397 } else if (sample == CaloSampling::EMB1) {
398 auto eLossPair2 =
eLossLayerMap.find(CaloSampling::PreSamplerB);
400 eLoss = 0.5 * (eLossPair->second) + 0.5 * (eLossPair2->second);
401 }
402 }
403 }
404
406 << path << " PATH2D = " << path2 << " eLoss " << eLoss
407 <<
" cell energy " << (cell)->
energy() <<
" radius "
408 <<
cell->caloDDE()->r() <<
" phi " <<
cell->caloDDE()->phi()
409 <<
" dr " <<
cell->caloDDE()->dr() <<
" dphi "
410 <<
cell->caloDDE()->dphi() <<
" x " <<
cell->caloDDE()->x()
411 <<
" y " <<
cell->caloDDE()->y() <<
" z "
412 <<
cell->caloDDE()->z() <<
" dx " <<
cell->caloDDE()->dx()
413 <<
" dy " <<
cell->caloDDE()->dy() <<
" dz "
414 <<
cell->caloDDE()->dz() <<
" volume "
415 <<
cell->caloDDE()->volume());
416
417 cellIntersections.emplace_back(
418 cell, new ParticleCellIntersection(*cell, eLoss, use3D ? path : path2));
419 }
420 ATH_MSG_DEBUG(
" added cell intersections " << cellIntersections.size());
421}
Scalar theta() const
theta method
Scalar mag() const
mag method
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double pathInsideCell(const CaloCell &cell, const Amg::Vector3D &entry, const Amg::Vector3D &exit)
Return the % of path length crossed by the track inside a cell in Z for a ladder shaped cell.
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
CaloCell_ID::CaloSample getSampling() const
cell sampling
static double get3DPathLength(const CaloCell &cell, const Amg::Vector3D &entry, const Amg::Vector3D &exit, double drFix, double dzFix)
void entryExitLayerMap(const Trk::CaloExtension &extension, EntryExitLayerMap &result, const LayersToSelect *selection=nullptr)
std::map< CaloSampling::CaloSample, double > ScalarLayerMap
void pathLenLayerMap(const Trk::CaloExtension &extension, ScalarLayerMap &result)
void eLossLayerMap(const Trk::CaloExtension &extension, ScalarLayerMap &result)
std::map< CaloSampling::CaloSample, std::pair< Amg::Vector3D, Amg::Vector3D > > EntryExitLayerMap
path
python interpreter configuration --------------------------------------—