41 return StatusCode::SUCCESS;
48 return StatusCode::SUCCESS;
55 std::unique_ptr<Trk::CaloExtension> extension =
62 std::map<CaloSampling::CaloSample,const Trk::CurvilinearParameters*>
Samplings;
77 if(!
Samplings[sampling]) {
return nullptr ;}
78 else {
return std::make_unique<const Trk::CurvilinearParameters> (*(
Samplings[sampling]));}
86 std::vector<double> coordinates;
88 std::unique_ptr<Trk::CaloExtension> extension =
95 std::map<CaloSampling::CaloSample,const Trk::TrackParameters*>
Samplings;
110 if(!(
Samplings[sampling]))
return coordinates;
111 coordinates.push_back(
Samplings[sampling]->position().
x());
112 coordinates.push_back(
Samplings[sampling]->position().
y());
113 coordinates.push_back(
Samplings[sampling]->position().
z());
114 coordinates.push_back(
Samplings[sampling]->position().
eta());
115 coordinates.push_back(
Samplings[sampling]->position().
phi());
124 std::vector<double> coordinates;
129 if(!dde)
return coordinates;
139 std::vector< std::vector<double> > coordinates(11);
143 std::vector<double> TrkPars(5);
145 TrkPars[0] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[0] ;
146 TrkPars[1] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[1] ;
147 TrkPars[2] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[2] ;
148 TrkPars[3] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[3] ;
149 TrkPars[4] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[4] ;
159 else if(
sample==16) {lay=6;}
160 else if(
sample==8 ){lay=7;}
161 else if(
sample==9 ){lay=8;}
162 else if(
sample==10 ){lay=9;}
163 else if(
sample==11 ){lay=10;}
164 if(lay!=-1) coordinates[lay] = TrkPars;
173 std::vector< std::vector<double> > coordinates;
175 for(
unsigned int s=0 ;
s<21; ++
s)
177 std::vector<double> TrkPars(5);
179 TrkPars[0] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[0] ;
180 TrkPars[1] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[1] ;
181 TrkPars[2] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[2] ;
182 TrkPars[3] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[3] ;
183 TrkPars[4] = ( XYZEtaPhi.size()!=5 ) ? -9999. : XYZEtaPhi[4] ;
184 coordinates.push_back(TrkPars);
196 bool includelar)
const {
211 if(coordinates.size()!=5)
continue;
239 int sampling_entrance = 0;
240 int sampling_exit = 0;
247 sampling_entrance = 12;
248 if (cell_tower>=0 && cell_tower<=6) sampling_exit = 14;
249 else if (cell_tower==7) sampling_exit = 13;
250 else if (cell_tower>=8 && cell_tower<=9) sampling_exit = 20;
253 sampling_entrance = 12;
254 if (cell_tower>=0 && cell_tower<=6) sampling_exit = 14;
255 else if (cell_tower==7) sampling_exit = 13;
256 else if (cell_tower==8) sampling_exit = 20;
258 case 14: sampling_entrance = 12; sampling_exit = 14;
break;
259 case 15: sampling_entrance = 12; sampling_exit = 20;
break;
260 case 16: sampling_entrance = 12; sampling_exit = 13;
break;
262 sampling_entrance = 17;
263 if (cell_tower == 10) {
265 }
else if (cell_tower == 11) {
267 else sampling_exit = 19;
268 }
else if ((cell_tower == 13) || (cell_tower == 15)) {
270 else sampling_exit = 18;
274 sampling_entrance = 18;
275 if (cell_tower>=11 && cell_tower<=13) sampling_exit = 20;
276 else if (cell_tower>=14 && cell_tower<=15) sampling_exit = 19;
279 if (cell_tower==10) {sampling_entrance = 19; sampling_exit = 20;}
280 else if (cell_tower>=11 && cell_tower<=13) {sampling_entrance = 18; sampling_exit = 20;}
281 else if (cell_tower==14) {sampling_entrance = 18; sampling_exit = 19;}
284 if (cell_tower==10) {sampling_entrance = 19; sampling_exit = 20;}
285 else if (cell_tower==12) {sampling_entrance = 18; sampling_exit = 20;}
292 case 12: sampling_entrance = 12; sampling_exit = 14;
break;
293 case 13: sampling_entrance = 12; sampling_exit = 14;
break;
294 case 14: sampling_entrance = 12; sampling_exit = 14;
break;
295 case 15: sampling_entrance = 13; sampling_exit = 14;
break;
296 case 16: sampling_entrance = 12; sampling_exit = 13;
break;
297 case 17: sampling_entrance = 17; sampling_exit = 19;
break;
298 case 18: sampling_entrance = 18; sampling_exit = 20;
break;
299 case 19: sampling_entrance = 18; sampling_exit = 20;
break;
300 case 20: sampling_entrance = 18; sampling_exit = 20;
break;
305 std::unique_ptr<const Trk::TrackParameters> pars_entrance =
307 std::unique_ptr<const Trk::TrackParameters> pars_exit =
310 if( !pars_entrance || !pars_exit )
return 0.;
312 return getPath(
cell, pars_entrance.get(), pars_exit.get());
321 unsigned int sampleID =
cell->caloDDE()->getSampling();
325 double layer1X =
exit->position().x();
326 double layer1Y =
exit->position().y();
327 double layer1Z =
exit->position().z();
328 double layer2X = entrance->
position().x();
329 double layer2Y = entrance->
position().y();
330 double layer2Z = entrance->
position().z();
332 double cellPhi =
cell->caloDDE()->phi();
333 double cellDPhi =
cell->caloDDE()->dphi();
334 double cellPhimin = cellPhi - cellDPhi / 2.;
335 double cellPhimax = cellPhi + cellDPhi / 2.;
336 double cellZ =
cell->caloDDE()->z();
337 double cellDZ =
cell->caloDDE()->dz();
338 double cellZmin = cellZ - cellDZ / 2.;
339 double cellZmax = cellZ + cellDZ / 2.;
340 double cellR =
cell->caloDDE()->r();
341 double cellDR =
cell->caloDDE()->dr();
342 double cellRmin = cellR - cellDR / 2.;
343 double cellRmax = cellR + cellDR / 2.;
345 double cellXimp[2], cellYimp[2], cellZimp[2];
346 double x(0),
y(0),
z(0),
r(0),
phi(0);
355 if(std::sqrt((layer1X - layer2X) * (layer1X - layer2X) + (layer1Y - layer2Y) * (layer1Y - layer2Y)) < 3818.5){
374 double x0int =
exit->position().x();
375 double x1int = entrance->
position().x();
376 double y0int =
exit->position().y();
377 double y1int = entrance->
position().y();
378 double z0int =
exit->position().z();
379 double z1int = entrance->
position().z();
380 double s = (y1int - y0int) / (x1int - x0int);
381 double a = 1 +
s *
s;
382 double b = 2 *
s * y0int - 2 *
s *
s * x0int;
383 double c = y0int * y0int -
radius *
radius +
s *
s * x0int * x0int - 2 * y0int *
s * x0int;
384 double x1 = (-
b + std::sqrt(
b *
b - 4 *
a *
c)) / (2 *
a);
385 double x2 = (-
b - std::sqrt(
b *
b - 4 *
a *
c)) / (2 *
a);
386 double y1 = y0int +
s * (
x1 - x0int);
387 double y2 = y0int +
s * (
x2 - x0int);
388 double s1 = (z1int - z0int) / (x1int - x0int);
389 double z1 = z0int + s1 * (
x1 - x0int);
390 double z2 = z0int + s1 * (
x2 - x0int);
396 if( ((
x1 - x0int) * (
x1 - x0int) + (
y1 - y0int) * (
y1 - y0int) + (z1 - z0int) * (z1 - z0int)) >
397 ((
x2 - x0int) * (
x2 - x0int) + (
y2 - y0int) * (
y2 - y0int) + (z2 - z0int) * (z2 - z0int)) ){
403 phi = std::acos(
x / std::sqrt(
x *
x +
y *
y));
407 if(
z >= cellZmin && z <= cellZmax && phi >= cellPhimin &&
phi <= cellPhimax){
417 c = y0int * y0int -
radius *
radius +
s *
s * x0int * x0int - 2 * y0int *
s * x0int;
418 x1 = ((-
b + std::sqrt(
b *
b - 4 *
a *
c)) / (2 *
a));
419 x2 = ((-
b - std::sqrt(
b *
b - 4 *
a *
c)) / (2 *
a));
420 y1 = (y0int +
s * (
x1 - x0int));
421 y2 = (y0int +
s * (
x2 - x0int));
422 z1 = (z0int + s1 * (
x1 - x0int));
423 z2 = (z0int + s1 * (
x2 - x0int));
424 s1 = ((z1int - z0int) / (x1int - x0int));
430 if( ((
x1 - x0int) * (
x1 - x0int) + (
y1 - y0int) * (
y1 - y0int) + (z1 - z0int) * (z1 - z0int)) >
431 ((
x2 - x0int) * (
x2 - x0int) + (
y2 - y0int) * (
y2 - y0int) + (z2 - z0int) * (z2 - z0int)) ){
437 phi = std::acos(
x / std::sqrt(
x *
x +
y *
y));
441 if(
z >= cellZmin && z <= cellZmax && phi >= cellPhimin &&
phi <= cellPhimax){
451 double sxz = (layer2X - layer1X) / (layer2Z - layer1Z);
452 double syz = (layer2Y - layer1Y) / (layer2Z - layer1Z);
454 x = layer1X + sxz * (
z - layer1Z);
455 y = layer1Y + syz * (
z - layer1Z);
456 r = std::sqrt(
x *
x +
y *
y);
457 phi = std::acos(
x /
r);
459 if(
r >= cellRmin && r <= cellRmax && phi >= cellPhimin &&
phi <= cellPhimax){
469 double sxz = (layer2X - layer1X) / (layer2Z - layer1Z);
470 double syz = (layer2Y - layer1Y) / (layer2Z - layer1Z);
472 x = layer1X + sxz * (
z - layer1Z);
473 y = layer1Y + syz * (
z - layer1Z);
474 r = std::sqrt(
x *
x +
y *
y);
475 phi = std::acos(
x /
r);
477 if(
r >= cellRmin && r <= cellRmax && phi >= cellPhimin &&
phi <= cellPhimax){
488 double sxy = (layer2X - layer1X) / (layer2Y - layer1Y);
489 double sxz = (layer2X - layer1X) / (layer2Z - layer1Z);
490 x = (layer1X - sxy * layer1Y) / (1 - sxy *
tan(cellPhimin));
492 z = layer1Z + (1 / sxz) * (
x - layer1X);
493 r = std::sqrt(
x *
x +
y *
y);
494 phi = std::acos(
x /
r);
498 if(
r >= cellRmin && r <= cellRmax && z >= cellZmin &&
z <= cellZmax &&
deltaPhi < 0.0001){
506 double sxy = (layer2X - layer1X) / (layer2Y - layer1Y);
507 double sxz = (layer2X - layer1X) / (layer2Z - layer1Z);
508 x = (layer1X - sxy * layer1Y) / (1 - sxy *
tan(cellPhimax));
510 z = layer1Z + (1 / sxz) * (
x - layer1X);
511 r = std::sqrt(
x *
x +
y *
y);
512 phi = std::acos(
x /
r);
516 if(
r >= cellRmin && r <= cellRmax && z >= cellZmin &&
z <= cellZmax &&
deltaPhi < 0.0001){
527 pathl += std::sqrt( (cellXimp[0] - cellXimp[1]) * (cellXimp[0] - cellXimp[1]) +
528 (cellYimp[0] - cellYimp[1]) * (cellYimp[0] - cellYimp[1]) +
529 (cellZimp[0] - cellZimp[1]) * (cellZimp[0] - cellZimp[1]) );
532 if(sampleID == 13 && lBC == 0) ++lBC;
533 else compute =
false;
543 float etamap[81] = { -0.95,-0.85,-0.75,-0.65,-0.55,-0.45,-0.35,-0.25,-0.15,-0.05,
544 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95,
545 -0.85,-0.75,-0.65,-0.55,-0.45,-0.35,-0.25,-0.15,-0.05,
546 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85,
548 0.00, 0.20, 0.40, 0.60,
551 -1.507772,-1.307385,-1.156978,-1.056676,
552 1.0589020,1.1593041,1.3098471,1.5103633,
553 -1.554988,-1.455460,-1.355965,-1.256501,-1.157065,
554 1.1594202,1.258668,1.3579534,1.4572804,1.5566510,
555 -1.454651,-1.355081,-1.255538,-1.156018,-1.056519,
556 1.0586925,1.1580252,1.2573844,1.3567756,1.4562022,
558 1.0074122,1.2063241};
560 int index(999),i_start(999),i_end(999);
562 case 12: i_start = 0; i_end = 19;
break;
563 case 13: i_start = 20; i_end = 37;
break;
564 case 14: i_start = 38; i_end = 44;
break;
565 case 15: i_start = 45; i_end = 46;
break;
566 case 16: i_start = 47; i_end = 48;
break;
567 case 17: i_start = 49; i_end = 56;
break;
568 case 18: i_start = 57; i_end = 66;
break;
569 case 19: i_start = 67; i_end = 76;
break;
570 case 20: i_start = 77; i_end = 80;
break;
574 if(i_start==999 || i_end==999)
return -1;