391{
392
393
394
395
396
397
398
399
400
401
402
403
404
405 bool exact_angles = true;
406 bool x_y_correlation = true;
407 Float_t eTPb = 1000./1300.;
411 Float_t tx0 =
tr.TX();
412 Float_t ty0 =
tr.TY();
417 Float_t sxd=sx, syd=sy, stxd=stx, styd=sty;
418 Float_t x,y,z,tx,ty, xs, ys, txs, tys;
419 Float_t
dz, dzm, cost, r1, r2, teta0, zold, dzPb;
420 Float_t dx = 0., dy = 0., dtx = 0., dty = 0.;
421 Float_t dxs = 0., dys = 0., dtxs = 0., dtys = 0.;
422 Double_t Phi,CPhi,SPhi;
425 int segnum = 0;
426
427 if ( x0 <
lim[0] )
return;
428 if ( y0 <
lim[1] )
return;
429 if ( x0 >
lim[2] )
return;
430 if ( y0 >
lim[3] )
return;
431
433
434 Float_t
p = p0, pa = p0, pn, de = 0.,
DE = 0.;
435 Float_t e = TMath::Sqrt((
double)
p*(
double)
p+(
double)m*(
double)m);
436 x = x0;
437 y = y0;
438 tx = tx0;
439 ty = ty0;
442 int k = 0, dir = 0;
443 for (
int kc=0; kc<
npat; kc++ ) {
444 if (zlim[0] > zlim[1])
445 {
447 dir = -1;
448 }
449 else
450 {
451 k = kc;
452 dir = +1;
453 }
457
458 if ( dir > 0 ) if ( z < zlim[0] ) { continue; }
459 if ( dir > 0 ) if ( z > zlim[1] ) { continue; }
460 if ( dir < 0 ) if ( z > zlim[0] ) { continue; }
461 if ( dir < 0 ) if ( z < zlim[1] ) { continue; }
462 if ( dir > 0 ) if ( z < zold ) { continue; }
463 if ( dir < 0 ) if ( z >= zold ) { continue; }
464 if ( gRandom->Rndm() < (double)PGap) { continue; }
465
467 cost = TMath::Sqrt((double)1.+(double)tx*(double)tx+(double)ty*(double)ty);
468 if (cost >= 10.) break;
470 dzPb = eTPb*dzm;
472 {
474 if ( de < 0.) de = 0;
475 e = e - de;
476 if (e < m) e = m;
477 pn = TMath::Sqrt((double)e*(double)e - (double)m*(double)m);
481
482 }
484 {
486 if ( de < 0.) de = 0;
487 e = e - de;
488 if (e < m) e = m;
489 pn = TMath::Sqrt((double)e*(double)e - (double)m*(double)m);
493 }
494 if (kc)
495 {
497 teta0 = TMath::Sqrt(teta0);
498 do { r1 = gRandom->Gaus();} while (TMath::Abs(r1) > 50.);
499 do { r2 = gRandom->Gaus();} while (TMath::Abs(r1) > 50.);
500 dx = (0.5*r1+0.866025*r2)*dzm*teta0/1.73205;
501 dtx = r2*teta0;
502 do { r1 = gRandom->Gaus();} while (TMath::Abs(r1) > 50.);
503 do { r2 = gRandom->Gaus();} while (TMath::Abs(r1) > 50.);
504 dy = (0.5*r1+0.866025*r2)*dzm*teta0/1.73205;
505 dty = r2*teta0;
506 }
507 else
508 {
509 teta0 = 0.;
510 dx = 0.;
511 dy = 0.;
512 dtx = 0.;
513 dty = 0.;
514 }
517 if (exact_angles)
518 {
519 tx = TMath::Tan(TMath::ATan(tx) + dtx);
520 ty = TMath::Tan(TMath::ATan(ty) + dty);
521 }
522 else
523 {
524 tx = tx + dtx;
525 ty = ty + dty;
526 }
527 zold = z;
528 if ( x <
lim[0] )
break;
529 if ( y <
lim[1] )
break;
530 if ( x >
lim[2] )
break;
531 if ( y >
lim[3] )
break;
532 double theta = TMath::Sqrt(tx*tx + ty*ty);
533 do { r1 = gRandom->Gaus();} while (TMath::Abs(r1) > 50.);
536 dxs = sxd*r1;
537 do { r1 = gRandom->Gaus();} while (TMath::Abs(r1) > 50.);
540 dys = syd*r1;
541 do { r1 = gRandom->Gaus();} while (TMath::Abs(r1) > 50.);
544 dtxs = stxd*r1;
545 do { r1 = gRandom->Gaus();} while (TMath::Abs(r1) > 50.);
548 dtys = styd*r1;
549 if (x_y_correlation)
550 {
551 Phi = TMath::ATan2(ty,tx);
552 CPhi = TMath::Cos(Phi);
553 SPhi = TMath::Sin(Phi);
554 xs = x + dxs*CPhi - dys*SPhi;
555 ys = y + dxs*SPhi + dys*CPhi;
556 txs = tx + dtxs*CPhi - dtys*SPhi;
557 tys = ty + dtxs*SPhi + dtys*CPhi;
558 }
559 else
560 {
561 xs = x + dxs;
562 ys = y + dys;
563 txs = tx + dtxs;
564 tys = ty + dtys;
565 }
566 seg->
Set(segnum++, xs, ys, txs, tys, 25.,
tr.ID());
572 if (x_y_correlation)
573 seg->
SetErrorsCOV(sxd*sxd, syd*syd, 0., stxd*stxd, styd*styd, 0.);
574 else
575 seg->
SetErrors(sxd*sxd, syd*syd, 0., stxd*stxd, styd*styd, 0.);
576
578 if (
p <= 0.050)
break;
579 if (teta0 >= 1.00) break;
580 }
583
584 delete seg;
585}
double DE
Definition: RecDispMC_Profiles.C:465
float RadX0() const
Definition: EdbScanCond.h:58
void SetErrors()
Definition: EdbSegP.h:90
void SetErrorsCOV(float sx2, float sy2, float sz2, float stx2, float sty2, float sp2=1.)
Definition: EdbSegP.cxx:72
void SetMC(int mEvt, int mTrack)
Definition: EdbSegP.h:141
void SetDZ(float dz)
Definition: EdbSegP.h:126