145 const std::vector<const CaloCell*>& cells,
156 ATH_MSG_DEBUG(
"EntryExitLayerMap " << entryExitLayerMap.size());
162 ATH_MSG_DEBUG(
"Getting cells intersections using cells " << cells.size());
163 for (
const auto* cell : cells) {
167 auto pos = entryExitLayerMap.find(sample);
168 if (pos == entryExitLayerMap.end())
176 if (sample == CaloSampling::PreSamplerB) {
177 pos2 = entryExitLayerMap.find(CaloSampling::EMB1);
178 if (pos2 == entryExitLayerMap.end()) {
185 double drFix = cell->caloDDE()->dr();
186 double dzFix = cell->caloDDE()->dz();
189 int isample = cell->caloDDE()->getSampling();
193 if (sample == CaloSampling::PreSamplerB || sample == CaloSampling::EMB1 ||
194 sample == CaloSampling::EMB2 || sample == CaloSampling::EMB3)
197 double drTG = fabs((pos->second.first - pos2->second.second).perp());
198 double dzTG = fabs((pos->second.first - pos2->second.second).z());
202 << cell->caloDDE()->getSampling() <<
" dr "
203 << cell->caloDDE()->dr() <<
" drTG " << drTG);
206 << cell->caloDDE()->getSampling() <<
" dz "
207 << cell->caloDDE()->dz() <<
" dzTG " << dzTG);
214 if (cell->caloDDE()->deta() > 0) {
215 double theta = atan2(cell->caloDDE()->r(), cell->z());
217 2 * cell->caloDDE()->deta() * sin(
theta / 2.) * cos(
theta / 2);
220 fabs(cell->z() * tan(
theta + dtheta) - cell->z() * tan(
theta));
223 -log(tan((
theta + dtheta) / 2.)) + log(tan((
theta) / 2.));
225 << cell->caloDDE()->getSampling() <<
" deta "
226 << cell->caloDDE()->deta() <<
" detaCheck "
227 << detaCheck <<
" drFix " << drFix);
230 <<
theta <<
" dtheta " << dtheta <<
" sum/pi "
231 << (
theta + dtheta) * M_1_PI <<
" deta "
232 << cell->caloDDE()->deta());
238 double drMin = 100000.;
242 const CaloCell* cellFound =
nullptr;
243 for (
const auto* celln : cells) {
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());
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);
269 << cellFound->
caloDDE()->
x() <<
" y "
270 << cellFound->
caloDDE()->
y() <<
" z "
271 << cellFound->
caloDDE()->
z() <<
" dr "
272 << cellFound->
caloDDE()->
dr() <<
" dscut " << dscut
273 <<
" drFix " << drFix);
281 if (cell->caloDDE()->deta() > 0) {
282 double theta = atan2(cell->caloDDE()->r(), cell->z());
284 2 * cell->caloDDE()->deta() * sin(
theta / 2.) * cos(
theta / 2);
286 double dz = fabs(cell->caloDDE()->r() / tan(
theta + dtheta) -
287 cell->caloDDE()->r() / tan(
theta));
291 <<
theta <<
" dtheta " << dtheta <<
" sum/pi "
292 << (
theta + dtheta) * M_1_PI <<
" deta "
293 << cell->caloDDE()->deta());
296 -log(tan((
theta + dtheta) / 2.)) + log(tan((
theta) / 2.));
298 << cell->caloDDE()->getSampling() <<
" deta "
299 << cell->caloDDE()->deta() <<
" detaCheck "
300 << detaCheck <<
" dtheta " << dtheta <<
" dzFix "
303 double dzMin = 100000.;
307 const CaloCell* cellFound =
nullptr;
308 for (
const auto* celln : cells) {
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());
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);
334 << cellFound->
caloDDE()->
x() <<
" y "
335 << cellFound->
caloDDE()->
y() <<
" z "
336 << cellFound->
caloDDE()->
z() <<
" dz "
337 << cellFound->
caloDDE()->
dz() <<
" dscut " << dscut
338 <<
" dzFix " << dzFix);
346 if (cell->energy() > 50.)
348 << cell->caloDDE()->getSampling() <<
" cell energy "
349 << cell->energy() <<
" dzFix " << dzFix <<
" dzTG " << dzTG
350 <<
" drFix " << drFix <<
" drTG " << drTG <<
" barrel "
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);
369 ATH_MSG_DEBUG(
" cell dr " << cell->caloDDE()->dr() <<
" cell dz "
370 << cell->caloDDE()->dz() <<
" deta "
371 << cell->caloDDE()->deta());
379 path2 =
pathInsideCell(*cell, pos->second.first, pos2->second.second);
381 if (path2 <= 0. && path <= 0.)
385 auto eLossPair = eLossLayerMap.find(sample);
390 if (eLossPair != eLossLayerMap.end()) {
391 eLoss = eLossPair->second;
392 if (sample == CaloSampling::PreSamplerB) {
393 auto eLossPair2 = eLossLayerMap.find(CaloSampling::EMB1);
394 if (eLossPair2 != eLossLayerMap.end()) {
395 eLoss = 0.5 * (eLossPair->second) + 0.5 * (eLossPair2->second);
397 }
else if (sample == CaloSampling::EMB1) {
398 auto eLossPair2 = eLossLayerMap.find(CaloSampling::PreSamplerB);
399 if (eLossPair2 != eLossLayerMap.end()) {
400 eLoss = 0.5 * (eLossPair->second) + 0.5 * (eLossPair2->second);
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());
417 cellIntersections.emplace_back(
420 ATH_MSG_DEBUG(
" added cell intersections " << cellIntersections.size());
std::vector< std::pair< const CaloCell *, ParticleCellIntersection * > > CellIntersections
typedef for vector of cell intersections