300 {
301
302 int debug = 0;
303
304 const MdcHit& h = *( hitUse.
mdcHit() );
305
310
312 if ( debug > 0 )
313 {
314 std::cout << "---------- " << std::endl;
315 h.
print( std::cout );
316
317 std::cout << "fp rp " << fp << " " << rp << std::endl;
318 std::cout << "Xmid " << X << std::endl;
319 }
321
322
323
324 double d0 = -
par.d0();
325 double phi0 = (
par.phi0() -
pi / 2 );
326 double _charge = -1;
327 if ( ( -1 ) *
par.omega() / Bz > 0 ) _charge = 1;
328
329 double r;
331 else r = 1 /
par.omega();
332
333 double xc =
sin(
par.phi0() ) * ( -d0 + r ) * -1.;
334 double yc = -1. *
cos(
par.phi0() ) * ( -d0 + r ) * -1;
336
339 double wwmag2 = ww.mag2();
340 double wwmag = sqrt( wwmag2 );
341 int ambig = hitUse.
ambig();
342
343 double driftdist = fabs( h.
driftDist( t0, ambig ) );
344 HepVector3D lr( driftdist / wwmag * ww.x(), driftdist / wwmag * ww.y(), 0. );
345 if ( debug > 0 )
346 {
347 std::cout << "xc " << xc << " yc " << yc << " drfitdist " << driftdist << std::endl;
348 std::cout << "r1 " << r << " d0 " << d0 << " phi0 " << phi0 << std::endl;
349 std::cout <<
"lr " << lr <<
" hit ambig " << hitUse.
ambig() <<
" ambig " << ambig
351 << std::endl;
352 }
353
354
356
357
358
359 if ( ambig == 0 ) lr =
ORIGIN;
360 if ( _charge * Bz < 0 )
361 {
362 if ( ambig == -1 )
363 {
364 lr = -lr;
365 }
366 }
367 else
368 {
369 if ( ambig == 1 )
370 {
371 lr = -lr;
372 }
373 }
374 X += lr;
375
376
377
381
384 double vmag2 =
v.mag2();
385
386
387
388 double wv =
w.dot(
v );
389
390 double d2 = wv * wv - vmag2 * (
w.mag2() - r * r );
391 if ( debug > 0 )
392 {
393 std::cout << "X_fix " << X << " center " << center << std::endl;
394 std::cout << "V " << V << std::endl;
395 std::cout <<
"w " <<
w <<
" v " <<
v << std::endl;
396 }
397
398
399 if ( d2 < 0. )
400 {
401
402 if ( debug > 0 )
403 {
404 std::cout <<
"in MdcSegInfoSterO !!! stereo: 0. > d2 = " << d2 <<
" " << hitUse.
ambig()
405 << std::endl;
406 }
407 return -1;
408 }
409 double d = sqrt( d2 );
410
411
412 double l[2];
413 if ( debug > 0 )
414 {
415 std::cout << "wv " << wv << " d " << d << " vmag2 " << vmag2 << std::endl;
416 }
417 l[0] = ( -wv + d ) / vmag2;
418 l[1] = ( -wv - d ) / vmag2;
419
420
421 bool ok[2];
422 ok[0] = true;
423 ok[1] = true;
424 double z[2];
425 z[0] = X.z() + l[0] * V.z();
426 z[1] = X.z() + l[1] * V.z();
427 if ( debug > 0 )
428 {
429 std::cout << "X.z " << X.z() << " V.z " << V.z() << std::endl;
430 std::cout << "l0, l1 = " << l[0] << ", " << l[1] << std::endl;
431 std::cout << "rpz " << rp.z() << " fpz " << fp.z() << std::endl;
432 std::cout << "z0 " << z[0] << " z1 " << z[1] << std::endl;
433 }
434
435 if ( hitUse.
ambig() == 0 )
436 {
437 if ( debug > 0 ) std::cout << " ambig = 0 " << std::endl;
438 if ( z[0] > rp.z() + 20. || z[0] < fp.z() - 20. ) { ok[0] = false; }
439 if ( z[1] > rp.z() + 20. || z[1] < fp.z() - 20. ) { ok[1] = false; }
440 }
441 else
442 {
443 if ( debug > 0 ) std::cout << " ambig != 0 " << std::endl;
444
445 if ( fabs( z[0] / rp.z() ) > 1.05 ) { ok[0] = false; }
446
447 if ( fabs( z[1] / rp.z() ) > 1.05 ) { ok[1] = false; }
448 }
449 if ( ( !ok[0] ) && ( !ok[1] ) )
450 {
451 if ( debug > 0 && ( hitUse.
ambig() != 0 ) && fabs( z[1] / rp.z() ) > 1.05 )
452 std::cout << " z[1] bad " << std::endl;
453 if ( debug > 0 && ( hitUse.
ambig() != 0 ) && fabs( z[0] / rp.z() ) > 1.05 )
454 std::cout << " z[0] bad " << std::endl;
455
456 if ( debug > 0 )
457 {
458 std::cout << " z[1] bad "
459 << "rpz " << rp.z() << " fpz " << fp.z() << "z0 " << z[0] << " z1 " << z[1]
460 << std::endl;
461 std::cout << " !ok[0] && !ok[1] return -2" << std::endl;
462 }
463 return -2;
464 }
465
466
470
471 if ( debug > 0 )
472 {
473 std::cout << __FILE__ << " " << __LINE__ << " p0 " << p[0].x() << " " << p[0].y()
474 << std::endl;
475 std::cout << __FILE__ << " " << __LINE__ << " p1 " << p[1].x() << " " << p[1].y()
476 << std::endl;
477 std::cout << __FILE__ << " " << __LINE__ << " c " << center.x() << " " << center.y() << " "
478 << _charge << std::endl;
479 std::cout << __FILE__ << " " << __LINE__ << " p0 centerx*y " << center.x() * p[0].y()
480 << " centery*x" << center.y() * p[0].x() << std::endl;
481 std::cout << __FILE__ << " " << __LINE__ << " p1 centerx*y " << center.x() * p[1].y()
482 << " centery*x" << center.y() * p[1].x() << std::endl;
483 }
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498 unsigned best = 0;
499 if ( ok[1] ) best = 1;
500
501
502
503 double cosdPhi = -center.dot( ( p[best] - center ).
unit() ) / center.mag();
504 double dPhi;
505 if ( fabs( cosdPhi ) <= 1.0 ) { dPhi = acos( cosdPhi ); }
506 else if ( cosdPhi > 1.0 ) { dPhi = 0.0; }
508
509
510 tmp.setX(
abs( r * dPhi ) );
511 tmp.setY( z[best] );
512
513
514
515 span->
y[hitFit] = z[best];
516
517
518
519 span->
x[hitFit] =
abs( r * dPhi );
520 if ( hitUse.
ambig() < 0 ) driftdist *= -1.;
522
523 if ( debug > 0 )
524 {
526 <<
" z " << span->
y[hitFit] << std::endl;
527 }
528 return 1;
529}
HepGeom::Vector3D< double > HepVector3D
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in !Latex Output unit
double sin(const BesAngle a)
double cos(const BesAngle a)
const HepPoint3D ORIGIN
Constants.
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
HepGeom::Point3D< double > HepPoint3D
static const double epsilon
unsigned layernumber() const
unsigned wirenumber() const
double sigma(double, int, double, double, double) const
double driftDist(double, int, double, double, double) const
const MdcSWire * wire() const
const Hep3Vector & zAxis(void) const
const HepPoint3D * getWestPoint(void) const
const HepPoint3D * getEastPoint(void) const