276 unsigned int SampleID =
cell->caloDDE()->getSampling();
280 double Layer1X(
exit->position().x()),Layer1Y(
exit->position().y()),Layer1Z(
exit->position().z());
283 double CellPhi(
cell->caloDDE()->phi()),CellDPhi(
cell->caloDDE()->dphi());
284 double CellPhimin = CellPhi-CellDPhi/2.;
285 double CellPhimax = CellPhi+CellDPhi/2.;
286 double CellEta(
cell->caloDDE()->eta());
287 double CellZ(
cell->caloDDE()->z()),CellDZ(
cell->caloDDE()->dz());
288 double CellZmin = CellZ-CellDZ/2.;
289 double CellZmax = CellZ+CellDZ/2.;
290 double CellR(
cell->caloDDE()->r()),CellDR(
cell->caloDDE()->dr());
291 double CellRmin = CellR-CellDR/2.;
292 double CellRmax = CellR+CellDR/2.;
295 double RLBAmin = 2300;
296 double RLBAmax = 2600;
297 double RLBBmin = 2600;
298 double RLBBmax = 2990;
299 double RLBCmin = 2990;
300 double RLBCmax = 3440;
301 double RLBDmin = 3440;
302 double RLBDmax = 3820;
304 double REBAmin = 2300;
305 double REBAmax = 2600;
306 double REBBmin = 2600;
307 double REBBmax = 3140;
308 double REBDmin = 3140;
309 double REBDmax = 3820;
311 double RITC_D4_min = 3630 - 380./2.;
312 double RITC_C10_min = 3215 - 450./2.;
313 double RITC_E1_min = 2803 - 313./2.;
314 double RITC_E2_min = 2476 - 341./2.;
315 double RITC_E3_min = 2066 - 478./2.;
316 double RITC_E4_min = 1646 - 362./2.;
318 double RITC_D4_max = 3630 + 380./2.;
319 double RITC_C10_max = 3215 + 450./2.;
320 double RITC_E1_max = 2803 + 313./2.;
321 double RITC_E2_max = 2476 + 341./2.;
322 double RITC_E3_max = 2066 + 478./2.;
323 double RITC_E4_max = 1646 + 362./2.;
325 double ZITC_D4_a = 3405;
326 double ZITC_C10_a = 3511;
327 double ZITC_E1_a = 3552;
329 double ZITC_E3_a = 3536;
332 double ZITC_D4_c = 3395;
333 double ZITC_C10_c = 3501;
334 double ZITC_E1_c = 3542;
336 double ZITC_E3_c = 3526;
339 double ZDITC_D4 = 309.;
340 double ZDITC_C10 = 95.;
341 double ZDITC_E1 = 12.;
343 double ZDITC_E3 = 6.;
346 double CellZB[9] = {141.495, 424.49, 707.485, 999.605, 1300.855, 1615.8, 1949., 2300.46, 2651.52};
347 double CellDZB[9] = {282.99, 283., 282.99, 301.25, 301.25, 328.64, 337.76, 365.16, 336.96};
348 double CellZC[9] = {159.755, 483.83, 812.465, 1150.23, 1497.125, 1857.71, 2241.12, 2628.695,0};
349 double CellDZC[9] = {319.51, 328.64, 328.63, 346.9, 346.89, 374.28, 392.54, 382.61,0};
351 double CellXimp[2], CellYimp[2], CellZimp[2];
353 double X(0),
Y(0),
Z(0),
R(0),
Phi(0);
358 float samplecellmap[81] = {
359 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
360 13, 13, 13, 13, 13, 13, 13, 13, 13,
362 16, 15, 17, 17, 17, 17,
366 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
367 13, 13, 13, 13, 13, 13, 13, 13, 13,
369 16, 15, 17, 17, 17, 17,
374 float etacellmap[81] = { 0.05,0.15,0.25,0.35,0.45,0.55,0.65,0.75,0.85,0.95,
375 0.05,0.15,0.25,0.35,0.45,0.55,0.65,0.75,0.85,
377 0.8579205,0.9583722,1.0589020,1.1593041,1.3098471,1.5103633,
378 1.1594202,1.2586680,1.3579534,1.4572804,1.556651,
379 1.0586925,1.1580252,1.2573844,1.3567756,1.4562022,
381 -0.05,-0.15,-0.25,-0.35,-0.45,-0.55,-0.65,-0.75,-0.85,-0.95,
382 -0.05,-0.15,-0.25,-0.35,-0.45,-0.55,-0.65,-0.75,-0.85,
384 -0.855940, -0.956279, -1.056676, -1.156978,-1.307385,-1.507772,
385 -1.157065,-1.256501,-1.355965,-1.455460,-1.554988,
386 -1.056519,-1.156018,-1.255538,-1.355081,-1.454651,
390 for(
int i=0;
i<81;
i++){
391 if(SampleID==samplecellmap[
i] && fabs(CellEta-etacellmap[
i])<0.001) etaInd =
i;
398 if(lBC==1 && (etaInd==18 || etaInd==59) )
break;
400 if(sqrt((Layer1X-Layer2X)*(Layer1X-Layer2X)+(Layer1Y-Layer2Y)*(Layer1Y-Layer2Y)) < 3818.5){
402 CellRmin = RITC_C10_min;
403 CellRmax = RITC_C10_max;
405 if(CellZmin < ZITC_C10_a-ZDITC_C10/2.) CellZmin = ZITC_C10_a-ZDITC_C10/2.;
406 if(CellZmax > ZITC_C10_a+ZDITC_C10/2.) CellZmax = ZITC_C10_a+ZDITC_C10/2.;
408 else if(CellEta < 0){
409 if(CellZmin < -ZITC_C10_c-ZDITC_C10/2.) CellZmin = -ZITC_C10_c-ZDITC_C10/2.;
410 if(CellZmax > -ZITC_C10_c+ZDITC_C10/2.) CellZmax = -ZITC_C10_c+ZDITC_C10/2.;
413 else if(SampleID == 16){
414 CellRmin=RITC_D4_min;
415 CellRmax=RITC_D4_max;
417 if(CellZmin < ZITC_D4_a-ZDITC_D4/2.) CellZmin = ZITC_D4_a-ZDITC_D4/2.;
418 if(CellZmax > ZITC_D4_a+ZDITC_D4/2.) CellZmax = ZITC_D4_a+ZDITC_D4/2.;
420 else if(CellEta < 0){
421 if(CellZmin < -ZITC_D4_c-ZDITC_D4/2.) CellZmin = -ZITC_D4_c-ZDITC_D4/2.;
422 if(CellZmax > -ZITC_D4_c+ZDITC_D4/2.) CellZmax = -ZITC_D4_c+ZDITC_D4/2.;
425 else if(SampleID == 17){
426 if( etaInd==25 || etaInd==65 ){
427 CellRmax = RITC_E1_max;
428 CellRmin = RITC_E1_min;
430 else if( etaInd==26 || etaInd==66 ){
431 CellRmax = RITC_E2_max;
432 CellRmin = RITC_E2_min;
434 else if( etaInd==27 || etaInd==67 ){
435 CellRmax = RITC_E3_max;
436 CellRmin = RITC_E3_min;
438 else if( etaInd==28 || etaInd==68 ){
439 CellRmax = RITC_E4_max;
440 CellRmin = RITC_E4_min;
442 if( (etaInd>=25 && etaInd<=26) || (etaInd>=65 && etaInd<=66) ){
444 if(CellZmin < ZITC_E1_a-ZDITC_E1/2.) CellZmin=ZITC_E1_a-ZDITC_E1/2.;
445 if(CellZmax > ZITC_E1_a+ZDITC_E1/2.) CellZmax=ZITC_E1_a+ZDITC_E1/2.;
447 else if(CellEta < 0){
448 if(CellZmin < -ZITC_E1_c-ZDITC_E1/2.) CellZmin= -ZITC_E1_c-ZDITC_E1/2.;
449 if(CellZmax > -ZITC_E1_c+ZDITC_E1/2.) CellZmax= -ZITC_E1_c+ZDITC_E1/2.;
452 else if( (etaInd>=27 && etaInd<=28) || (etaInd>=67 && etaInd<=68) ){
454 if(CellZmin < ZITC_E3_a-ZDITC_E3/2.) CellZmin=ZITC_E3_a-ZDITC_E3/2.;
455 if(CellZmax > ZITC_E3_a+ZDITC_E3/2.) CellZmax=ZITC_E3_a+ZDITC_E3/2.;
457 else if(CellEta < 0){
458 if(CellZmin < -ZITC_E3_c-ZDITC_E3/2.) CellZmin= -ZITC_E3_c-ZDITC_E3/2.;
459 if(CellZmax > -ZITC_E3_c+ZDITC_E3/2.) CellZmax= -ZITC_E3_c+ZDITC_E3/2.;
463 else if(SampleID == 12){
467 if(CellZmin <-2802.5439) CellZmin=-2802.5439;
468 if(CellZmax > 2802.5454) CellZmax=2802.5454;
470 else if(SampleID == 13 && lBC == 0){
473 int cpos = fabs(CellEta)/0.1;
474 CellZ = CellZB[cpos];
475 if(CellEta < 0) CellZ=-CellZ;
476 CellDZ = CellDZB[cpos];
477 CellZmin = CellZ-CellDZ/2;
478 CellZmax = CellZ+CellDZ/2;
479 if(CellZmin <-2802.5439) CellZmin=-2802.5439;
480 if(CellZmax > 2802.5454) CellZmax=2802.5454;
482 else if(SampleID == 13 && lBC == 1){
485 int cpos = fabs(CellEta)/0.1;
486 if(cpos >= 8)
return 0;
487 CellZ = CellZC[cpos];
488 if(CellEta < 0) CellZ=-CellZ;
489 CellDZ = CellDZC[cpos];
490 CellZmin = CellZ-CellDZ/2;
491 CellZmax = CellZ+CellDZ/2;
492 if(CellZmin <-2802.5439) CellZmin=-2802.5439;
493 if(CellZmax >2802.5454) CellZmax=2802.5454;
495 else if(SampleID == 14){
498 if(CellZmin <-2802.5439) CellZmin=-2802.5439;
499 if(CellZmax >2802.5454) CellZmax=2802.5454;
505 if(CellZmin <3574.5027) CellZmin=3574.4978;
506 if(CellZmax >6130.0039) CellZmax=6130.0039;
508 else if(CellEta < 0){
509 if(CellZmin <-6120.0018) CellZmin=-6120.0018;
510 if(CellZmax >-3564.5006) CellZmax=-3564.5006;
517 if(CellZmin <3574.5027) CellZmin=3574.4978;
518 if(CellZmax >6130.0039) CellZmax=6130.0039;
520 else if(CellEta < 0){
521 if(CellZmin <-6120.0018) CellZmin=-6120.0018;
522 if(CellZmax >-3564.5006) CellZmax=-3564.5006;
529 if(CellZmin <3574.5027) CellZmin=3574.4978;
530 if(CellZmax >6130.0039) CellZmax=6130.0039;
532 else if(CellEta < 0){
533 if(CellZmin <-6120.0018) CellZmin=-6120.0018;
534 if(CellZmax >-3564.5006) CellZmax=-3564.5006;
540 double Radius(CellRmin);
542 double x0int(
exit->position().x()), x1int(entrance->
position().x()),
543 y0int(
exit->position().y()), y1int(entrance->
position().y()),
544 z0int(
exit->position().z()), z1int(entrance->
position().z());
545 double S((y1int-y0int)/(x1int-x0int));
546 double a(1+
S*
S),
b(2*
S*y0int-2*
S*
S*x0int),
c(y0int*y0int-Radius*Radius+
S*
S*x0int*x0int-2*y0int*
S*x0int);
548 double y1(y0int+
S*(
x1-x0int)),
y2(y0int+
S*(
x2-x0int));
549 double S1 = ((z1int-z0int)/(x1int-x0int));
550 double z1(z0int+
S1*(
x1-x0int)), z2(z0int+
S1*(
x2-x0int));
556 if( ((
x1-x0int)*(
x1-x0int)+(
y1-y0int)*(
y1-y0int)+(z1-z0int)*(z1-z0int)) >
557 ((
x2-x0int)*(
x2-x0int)+(
y2-y0int)*(
y2-y0int)+(z2-z0int)*(z2-z0int)) ){
567 if(
Z>=CellZmin && Z<=CellZmax && Phi>=CellPhimin &&
Phi<=CellPhimax){
577 c = y0int*y0int-Radius*Radius+
S*
S*x0int*x0int-2*y0int*
S*x0int;
580 y1 = (y0int+
S*(
x1-x0int));
581 y2 = (y0int+
S*(
x2-x0int));
582 z1 = (z0int+
S1*(
x1-x0int));
583 z2 = (z0int+
S1*(
x2-x0int));
584 S1 = ((z1int-z0int)/(x1int-x0int));
590 if( ((
x1-x0int)*(
x1-x0int)+(
y1-y0int)*(
y1-y0int)+(z1-z0int)*(z1-z0int)) >
591 ((
x2-x0int)*(
x2-x0int)+(
y2-y0int)*(
y2-y0int)+(z2-z0int)*(z2-z0int)) ){
601 if(
Z>=CellZmin && Z<=CellZmax && Phi>=CellPhimin &&
Phi<=CellPhimax){
602 CellXimp[Np]=
X; CellYimp[Np]=
Y; CellZimp[Np]=
Z;
609 double Sxz = (Layer2X-Layer1X)/(Layer2Z-Layer1Z);
610 double Syz = (Layer2Y-Layer1Y)/(Layer2Z-Layer1Z);
612 X = Layer1X+Sxz*(
Z-Layer1Z);
613 Y = Layer1Y+Syz*(
Z-Layer1Z);
615 Phi = std::acos(
X/
R);
617 if(
R>=CellRmin && R<=CellRmax && Phi>=CellPhimin &&
Phi<=CellPhimax){
618 CellXimp[Np]=
X; CellYimp[Np]=
Y; CellZimp[Np]=
Z;
625 double Sxz = (Layer2X-Layer1X)/(Layer2Z-Layer1Z);
626 double Syz = (Layer2Y-Layer1Y)/(Layer2Z-Layer1Z);
628 X = Layer1X+Sxz*(
Z-Layer1Z);
629 Y = Layer1Y+Syz*(
Z-Layer1Z);
631 Phi = std::acos(
X/
R);
633 if(
R>=CellRmin && R<=CellRmax && Phi>=CellPhimin &&
Phi<=CellPhimax){
634 CellXimp[Np]=
X; CellYimp[Np]=
Y; CellZimp[Np]=
Z;
642 double Sxy=(Layer2X-Layer1X)/(Layer2Y-Layer1Y);
643 double Sxz=(Layer2X-Layer1X)/(Layer2Z-Layer1Z);
644 X = (Layer1X-Sxy*Layer1Y)/(1-Sxy*
tan(CellPhimin));
646 Z = Layer1Z+(1/Sxz)*(
X-Layer1X);
648 Phi = std::acos(
X/
R);
650 DeltaPhi=fabs(
Phi-CellPhimin);
651 if(DeltaPhi > 3.141593) DeltaPhi=fabs(
Phi+CellPhimin);
652 if(
R>=CellRmin && R<=CellRmax && Z>=CellZmin &&
Z<=CellZmax && DeltaPhi<0.0001){
653 CellXimp[Np]=
X; CellYimp[Np]=
Y; CellZimp[Np]=
Z;
658 double Sxy=(Layer2X-Layer1X)/(Layer2Y-Layer1Y);
659 double Sxz=(Layer2X-Layer1X)/(Layer2Z-Layer1Z);
660 X = (Layer1X-Sxy*Layer1Y)/(1-Sxy*
tan(CellPhimax));
662 Z = Layer1Z+(1/Sxz)*(
X-Layer1X);
666 DeltaPhi=fabs(
Phi-CellPhimax);
667 if(DeltaPhi > 3.141593) DeltaPhi=fabs(
Phi+CellPhimax);
668 if(
R>=CellRmin && R<=CellRmax && Z>=CellZmin &&
Z<=CellZmax && DeltaPhi<0.0001){
669 CellXimp[Np]=
X; CellYimp[Np]=
Y; CellZimp[Np]=
Z;
677 pathl += sqrt( (CellXimp[0]-CellXimp[1])*(CellXimp[0]-CellXimp[1]) +
678 (CellYimp[0]-CellYimp[1])*(CellYimp[0]-CellYimp[1]) +
679 (CellZimp[0]-CellZimp[1])*(CellZimp[0]-CellZimp[1]) );
682 if(SampleID == 13 && lBC == 0) ++lBC;
683 else compute =
false;