BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcUtilitySvc Class Reference

#include <MdcUtilitySvc.h>

Inheritance diagram for MdcUtilitySvc:

Public Member Functions

 MdcUtilitySvc (const std::string &name, ISvcLocator *svcloc)
 ~MdcUtilitySvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
int nLayerTrackPassed (const HepVector helix) const
int nLayerTrackPassed (const double helix[5]) const
HepVector patPar2BesPar (const HepVector &helixPar) const
HepSymMatrix patErr2BesErr (const HepSymMatrix &err) const
HepVector besPar2PatPar (const HepVector &helixPar) const
HepSymMatrix besErr2PatErr (const HepSymMatrix &err) const
double doca (int layer, int cell, const HepVector helix, const HepSymMatrix errMat, bool passCellRequired=true, bool doSag=true) const
double doca (int layer, int cell, HepPoint3D eastP, HepPoint3D westP, const HepVector helixBes, const HepSymMatrix errMatBes, bool passCellRequired=true, bool doSag=true) const
double doca (int layer, int cell, const MdcSWire *sWire, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired=true) const
double docaPatPar (int layer, int cell, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired=true, bool doSag=true) const
double docaPatPar (int layer, int cell, HepPoint3D eastP, HepPoint3D westP, const HepVector helixBes, const HepSymMatrix errMatBes, bool passCellRequired=true, bool doSag=true) const
double docaPatPar (int layer, int cell, const MdcSWire *sWire, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired=true) const
HepPoint3D pointOnHelix (const HepVector helixPar, int lay, int innerOrOuter) const
HepPoint3D pointOnHelixPatPar (const HepVector helixPat, int lay, int innerOrOuter) const
bool cellTrackPassedByPhi (const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
bool cellTrackPassedByPhiPatPar (const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
bool cellTrackPassed (const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
bool cellTrackPassedPatPar (const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
HepPoint3D Hel (HepPoint3D piv, double dr, double phi0, double Alpha_L, double kappa, double dz, double dphi, double tanl) const
double p_cms (HepVector helix, int runNo, double mass) const
Hep3Vector momentum (const RecMdcTrack *trk) const
double probab (const int &ndof, const double &chisq) const
MdcDigiVec getMdcDigiVec () const
void getHelixOfMcParticle (const Event::McParticle *mcParticle, Helix &helix)
float getChargeOfMcParticle (const Event::McParticle *mcParticle)
void getMomPosOfMcParticle (const Event::McParticle *mcParticle, HepVector3D &pos, HepVector3D &mom)
void getMdcDigiOnMcParticle (int trackIndex, const std::map< int, std::map< MdcDigi *, Event::MdcMcHit * > > mdcMCAssociation, MdcDigiVec &mdcDigiInput, MdcDigiVec &mdcDigiAssociated)
void getMdcMCAssoiciation (int trackIndex, const std::vector< MdcDigi * > mdcDigiVecInput, std::map< int, std::map< MdcDigi *, Event::MdcMcHit * > > &mdcMCAssociation)
 Get association of MdcDigi and MdcMcHit according to track id.

Detailed Description

Definition at line 40 of file MdcUtilitySvc.h.

Constructor & Destructor Documentation

◆ MdcUtilitySvc()

MdcUtilitySvc::MdcUtilitySvc ( const std::string & name,
ISvcLocator * svcloc )

Definition at line 25 of file MdcUtilitySvc.cxx.

26 : base_class( name, svcloc ) {
27 declareProperty( "debug", m_debug = 0 );
28}

Referenced by MdcUtilitySvc().

◆ ~MdcUtilitySvc()

MdcUtilitySvc::~MdcUtilitySvc ( )

Definition at line 30 of file MdcUtilitySvc.cxx.

30{}

Member Function Documentation

◆ besErr2PatErr()

HepSymMatrix MdcUtilitySvc::besErr2PatErr ( const HepSymMatrix & err) const

Definition at line 838 of file MdcUtilitySvc.cxx.

838 {
839 // error matrix
840 // std::cout<<" err1 "<<err<<" "<<err.num_row()<<std::endl;
841 // V(Y)=S * V(X) * ST , mS = S , mVy = V(Y) , err() = V(X)
842 // int n = err.num_row();
843 HepSymMatrix mS( err.num_row(), 0 );
844 mS[0][0] = -1.; // dr0=-d0
845 mS[1][1] = 1.;
846 mS[2][2] = Bz() / -333.567; // pxy -> cpa
847 mS[3][3] = 1.;
848 mS[4][4] = 1.;
849 HepSymMatrix mVy = err.similarity( mS );
850 // std::cout<<" err2 "<<n<<" "<<mVy<<std::endl;
851 return mVy;
852}

Referenced by doca(), doca(), and doca().

◆ besPar2PatPar()

HepVector MdcUtilitySvc::besPar2PatPar ( const HepVector & helixPar) const

Definition at line 822 of file MdcUtilitySvc.cxx.

822 {
823 HepVector helix( 5, 0 );
824 double d0 = -helixPar[0]; // cm
825 double phi0 = helixPar[1] + CLHEP::halfpi;
826 double omega = Bz() * helixPar[2] / -333.567;
827 double z0 = helixPar[3]; // cm
828 double tanl = helixPar[4];
829 helix[0] = d0;
830 helix[1] = phi0;
831 helix[2] = omega;
832 helix[3] = z0;
833 helix[4] = tanl;
834 return helix;
835}

Referenced by cellTrackPassedByPhi(), doca(), doca(), doca(), nLayerTrackPassed(), and pointOnHelix().

◆ cellTrackPassed()

bool MdcUtilitySvc::cellTrackPassed ( const HepVector helix,
int layer,
int & cellId_in,
int & cellId_out ) const

Definition at line 651 of file MdcUtilitySvc.cxx.

652 {
653 int charge, type, nCell;
654 double dr0, phi0, kappa, dz0, tanl;
655 double ALPHA_loc, rho, phi, cosphi0, sinphi0, x_hc, y_hc, z_hc;
656 double dphi0, IO_phi, C_alpha, xx, yy;
657 double inlow, inup, outlow, outup, phi_in, phi_out, phi_bin;
658 double rCize1, rCize2, rLay, length, phioffset, slant, shift;
659 double m_crio[2], phi_io[2], stphi[2], phioff[2], dphi[2];
660
661 dr0 = helixBes[0];
662 phi0 = helixBes[1];
663 kappa = helixBes[2];
664 dz0 = helixBes[3];
665 tanl = helixBes[4];
666
667 ALPHA_loc = 1000 / ( 2.99792458 * Bz() ); // magnetic field const
668 charge = ( kappa >= 0 ) ? 1 : -1;
669 rho = ALPHA_loc / kappa;
670 double pi = Constants::pi;
671 phi = fmod( phi0 + 4 * pi, 2 * pi );
672 cosphi0 = cos( phi );
673 sinphi0 = ( 1.0 - cosphi0 ) * ( 1.0 + cosphi0 );
674 sinphi0 = sqrt( ( sinphi0 > 0. ) ? sinphi0 : 0. );
675 if ( phi > pi ) sinphi0 = -sinphi0;
676
677 x_hc = 0. + ( dr0 + rho ) * cosphi0;
678 y_hc = 0. + ( dr0 + rho ) * sinphi0;
679 z_hc = 0. + dz0;
680
681 HepPoint3D piv( 0., 0., 0. );
682 HepPoint3D hcenter( x_hc, y_hc, 0.0 );
683
684 double m_c_perp( hcenter.perp() );
685 Hep3Vector m_c_unit( (HepPoint3D)hcenter.unit() );
686 HepPoint3D IO = ( -1 ) * charge * m_c_unit;
687
688 dphi0 = fmod( IO.phi() + 4 * pi, 2 * pi ) - phi;
689 IO_phi = fmod( IO.phi() + 4 * pi, 2 * pi );
690
691 if ( dphi0 > pi ) dphi0 -= 2 * pi;
692 else if ( dphi0 < -pi ) dphi0 += 2 * pi;
693
694 phi_io[0] = -( 1 + charge ) * pi / 2 - charge * dphi0;
695 phi_io[1] = phi_io[0] + 1.5 * pi;
696
697 bool outFlag = false;
698 // retrieve Mdc geometry information
699 rCize1 = 0.1 * m_mdcGeomSvc->Layer( lay )->RCSiz1(); // mm -> cm
700 rCize2 = 0.1 * m_mdcGeomSvc->Layer( lay )->RCSiz2(); // mm -> cm
701 rLay = 0.1 * m_mdcGeomSvc->Layer( lay )->Radius(); // mm -> cm
702 length = 0.1 * m_mdcGeomSvc->Layer( lay )->Length(); // mm -> cm
703 // double halfLength=length/2.;
704 //(conversion of the units mm(mc)->cm(rec))
705 nCell = m_mdcGeomSvc->Layer( lay )->NCell();
706 phioffset = m_mdcGeomSvc->Layer( lay )->Offset();
707 slant = m_mdcGeomSvc->Layer( lay )->Slant();
708 shift = m_mdcGeomSvc->Layer( lay )->Shift();
709 type = m_mdcGeomSvc->Layer( lay )->Sup()->Type();
710
711 m_crio[0] = rLay - rCize1; // radius of inner field wir ( beam pipe)
712 m_crio[1] = rLay + rCize2; // radius of outer field wir ( beam pipe)
713
714 int sign = -1; // assumed the first half circle
715
716 Hep3Vector iocand[2];
717 Hep3Vector cell_IO[2];
718
719 for ( int ii = 0; ii < 2; ii++ )
720 {
721 // By law of cosines to calculate the alpha(up and down field wir_Ge)
722 double cos_alpha = ( m_c_perp * m_c_perp + m_crio[ii] * m_crio[ii] - rho * rho ) /
723 ( 2 * m_c_perp * m_crio[ii] );
724 if ( fabs( cos_alpha ) > 1 && ( ii == 0 ) )
725 {
726 cos_alpha = -1;
727 outFlag = true;
728 }
729 if ( fabs( cos_alpha ) > 1 && ( ii == 1 ) )
730 {
731 cos_alpha = ( m_c_perp * m_c_perp + m_crio[0] * m_crio[0] - rho * rho ) /
732 ( 2 * m_c_perp * m_crio[0] );
733 C_alpha = 2 * pi - acos( cos_alpha );
734 }
735 else { C_alpha = acos( cos_alpha ); }
736
737 iocand[ii] = m_c_unit;
738 iocand[ii].rotateZ( charge * sign * C_alpha );
739 iocand[ii] *= m_crio[ii];
740
741 xx = iocand[ii].x() - x_hc;
742 yy = iocand[ii].y() - y_hc;
743
744 dphi[ii] = atan2( yy, xx ) - phi0 - 0.5 * pi * ( 1 - charge );
745 dphi[ii] = fmod( dphi[ii] + 8.0 * pi, 2 * pi );
746
747 if ( dphi[ii] < phi_io[0] ) { dphi[ii] += 2 * pi; }
748 else if ( dphi[ii] > phi_io[1] )
749 { // very very nausea
750 dphi[ii] -= 2 * pi;
751 }
752
753 cell_IO[ii] = Hel( piv, dr0, phi, ALPHA_loc, kappa, dz0, dphi[ii], tanl );
754
755 // cout<<" cell_IO["<<ii<<"] : "<<cell_IO[ii]<<endl;
756 if ( ( cell_IO[ii].x() == 0 ) && ( cell_IO[ii].y() == 0 ) && ( cell_IO[ii].z() == 0 ) )
757 continue;
758 }
759 // if(((fabs(cell_IO[0].z())*10-halfLength)>-7.) &&
760 // ((fabs(cell_IO[1].z())*10-halfLength)>-7.))return true; //Out sensitive area
761
762 cellId_in = cellId_out = -1;
763 phi_in = cell_IO[0].phi();
764 phi_in = fmod( phi_in + 4 * pi, 2 * pi );
765 phi_out = cell_IO[1].phi();
766 phi_out = fmod( phi_out + 4 * pi, 2 * pi );
767 phi_bin = 2.0 * pi / nCell;
768
769 // determine the in/out cell id
770 stphi[0] = shift * phi_bin * ( 0.5 - cell_IO[0].z() / length );
771 stphi[1] = shift * phi_bin * ( 0.5 - cell_IO[1].z() / length );
772 // stphi[0],stphi[1] to position fo z axis ,the angle of deflxsion in x_Y
773
774 phioff[0] = phioffset + stphi[0];
775 phioff[1] = phioffset + stphi[1];
776
777 for ( int kk = 0; kk < nCell; kk++ )
778 {
779 // for stereo layer
780 inlow = phioff[0] + phi_bin * kk - phi_bin * 0.5;
781 inlow = fmod( inlow + 4.0 * pi, 2.0 * pi );
782 inup = phioff[0] + phi_bin * kk + phi_bin * 0.5;
783 inup = fmod( inup + 4.0 * pi, 2.0 * pi );
784 outlow = phioff[1] + phi_bin * kk - phi_bin * 0.5;
785 outlow = fmod( outlow + 4.0 * pi, 2.0 * pi );
786 outup = phioff[1] + phi_bin * kk + phi_bin * 0.5;
787 outup = fmod( outup + 4.0 * pi, 2.0 * pi );
788
789 if ( ( phi_in >= inlow && phi_in <= inup ) ) cellId_in = kk;
790 if ( ( phi_out >= outlow && phi_out < outup ) ) cellId_out = kk;
791 if ( inlow > inup )
792 {
793 if ( ( phi_in >= inlow && phi_in < 2.0 * pi ) || ( phi_in >= 0.0 && phi_in < inup ) )
794 cellId_in = kk;
795 }
796 if ( outlow > outup )
797 {
798 if ( ( phi_out >= outlow && phi_out <= 2.0 * pi ) ||
799 ( phi_out >= 0.0 && phi_out < outup ) )
800 cellId_out = kk;
801 }
802 } // end of nCell loop
803
804 return ( cellId_in == cellId_out );
805}
Double_t x[10]
double pi
HepGeom::Point3D< double > HepPoint3D
HepPoint3D Hel(HepPoint3D piv, double dr, double phi0, double Alpha_L, double kappa, double dz, double dphi, double tanl) const

Referenced by cellTrackPassedPatPar().

◆ cellTrackPassedByPhi()

bool MdcUtilitySvc::cellTrackPassedByPhi ( const HepVector helix,
int layer,
int & cellId_in,
int & cellId_out ) const

Definition at line 590 of file MdcUtilitySvc.cxx.

591 {
592 HepVector helixPat = besPar2PatPar( helixBes );
593 return cellTrackPassedByPhiPatPar( helixPat, layer, cellId_in, cellId_out );
594}
HepVector besPar2PatPar(const HepVector &helixPar) const
bool cellTrackPassedByPhiPatPar(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const

◆ cellTrackPassedByPhiPatPar()

bool MdcUtilitySvc::cellTrackPassedByPhiPatPar ( const HepVector helix,
int layer,
int & cellId_in,
int & cellId_out ) const

Definition at line 600 of file MdcUtilitySvc.cxx.

601 {
602 int nCell = m_mdcGeomSvc->Layer( layer )->NCell();
603
604 double dPhiz = ( m_mdcGeomSvc->Wire( layer, 0 )->Forward().phi() -
605 m_mdcGeomSvc->Wire( layer, 0 )->Backward().phi() ) *
606 0.5;
607 double rEnd = m_mdcGeomSvc->Wire( layer, 0 )->Backward().rho() / 10.; // mm2cm
608 double rMid = rEnd * cos( dPhiz );
609 // std::cout<<"( cell "<<0<<" westPphi "<<m_mdcGeomSvc->Wire(layer,0)->Forward().phi() <<"
610 // eastPphi "
611 //<<m_mdcGeomSvc->Wire(layer,0)->Backward().phi()<<" twist "<<dPhiz<<" rend
612 //"<<rEnd<<std::endl;
613 double fltLenIn = rMid;
614 double phiIn = helixPat[1] + helixPat[2] * fltLenIn; // phi0 + omega * L
615
616 double phiEPOffset =
617 m_mdcGeomSvc->Wire( layer, 0 )->Backward().phi(); // east.phi()= BackWard.phi
618 BesAngle tmp( phiIn - phiEPOffset );
619 if ( m_debug )
620 std::cout << "cellTrackPassed nCell " << nCell << " layer " << layer << " fltLenIn "
621 << fltLenIn << " phiEPOffset " << phiEPOffset << std::endl;
622 // BesAngle tmp(phiIn - layPtr->phiEPOffset());
623 int wlow = (int)floor( nCell * tmp.rad() / twopi );
624 int wbig = (int)ceil( nCell * tmp.rad() / twopi );
625 if ( tmp == 0 )
626 {
627 wlow = -1;
628 wbig = 1;
629 }
630
631 if ( ( wlow % nCell ) < 0 ) wlow += nCell;
632 cellId_in = wlow;
633
634 if ( ( wbig % nCell ) < 0 ) wbig += nCell;
635 cellId_out = wbig;
636
637 bool passedOneCell = ( cellId_in == cellId_out );
638
639 return passedOneCell; // pass more than one cell
640}

Referenced by cellTrackPassedByPhi(), and docaPatPar().

◆ cellTrackPassedPatPar()

bool MdcUtilitySvc::cellTrackPassedPatPar ( const HepVector helix,
int layer,
int & cellId_in,
int & cellId_out ) const

Definition at line 643 of file MdcUtilitySvc.cxx.

644 {
645 HepVector helixBes = patPar2BesPar( helixPat );
646 return cellTrackPassed( helixBes, layer, cellId_in, cellId_out );
647}
HepVector patPar2BesPar(const HepVector &helixPar) const
bool cellTrackPassed(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const

◆ doca() [1/3]

double MdcUtilitySvc::doca ( int layer,
int cell,
const HepVector helix,
const HepSymMatrix errMat,
bool passCellRequired = true,
bool doSag = true ) const

Definition at line 401 of file MdcUtilitySvc.cxx.

403 {
404 HepVector helixPat = besPar2PatPar( helixBes );
405 HepSymMatrix errMatPat = besErr2PatErr( errMatBes );
406
407 return docaPatPar( layer, cell, helixPat, errMatPat, passCellRequired, doSag ); // call 4.
408}
HepSymMatrix besErr2PatErr(const HepSymMatrix &err) const
double docaPatPar(int layer, int cell, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired=true, bool doSag=true) const

Referenced by docaPatPar(), docaPatPar(), and docaPatPar().

◆ doca() [2/3]

double MdcUtilitySvc::doca ( int layer,
int cell,
const MdcSWire * sWire,
const HepVector helixPat,
const HepSymMatrix errMatPat,
bool passCellRequired = true ) const

Definition at line 424 of file MdcUtilitySvc.cxx.

426 {
427 HepVector helixPat = besPar2PatPar( helixBes );
428 HepSymMatrix errMatPat = besErr2PatErr( errMatBes );
429
430 return docaPatPar( layer, cell, sWire, helixPat, errMatPat, passCellRequired ); // call 6.
431}

◆ doca() [3/3]

double MdcUtilitySvc::doca ( int layer,
int cell,
HepPoint3D eastP,
HepPoint3D westP,
const HepVector helixBes,
const HepSymMatrix errMatBes,
bool passCellRequired = true,
bool doSag = true ) const

Definition at line 412 of file MdcUtilitySvc.cxx.

414 {
415 HepVector helixPat = besPar2PatPar( helixBes );
416 HepSymMatrix errMatPat = besErr2PatErr( errMatBes );
417
418 return docaPatPar( layer, cell, eastP, westP, helixPat, errMatPat, passCellRequired,
419 doSag ); // call 5.
420}

◆ docaPatPar() [1/3]

double MdcUtilitySvc::docaPatPar ( int layer,
int cell,
const HepVector helixPat,
const HepSymMatrix errMatPat,
bool passCellRequired = true,
bool doSag = true ) const

Definition at line 435 of file MdcUtilitySvc.cxx.

437 {
438
439 const MdcGeoWire* geowir = m_mdcGeomSvc->Wire( layer, cell );
440 int id = geowir->Id();
441 double sag = 0.;
442 if ( doSag ) sag = geowir->Sag() / 10.; // mm2cm
443 HepPoint3D eastP = geowir->Backward() / 10.0; // mm2cm
444 HepPoint3D westP = geowir->Forward() / 10.0; // mm2cm
445 const MdcSWire* sWire = new MdcSWire( eastP, westP, sag, id, cell );
446
447 double doca =
448 docaPatPar( layer, cell, sWire, helixPat, errMat, passCellRequired ); // call 6.
449
450 delete sWire;
451 return doca;
452}
const double Sag(void) const
double doca(int layer, int cell, const HepVector helix, const HepSymMatrix errMat, bool passCellRequired=true, bool doSag=true) const

Referenced by doca(), doca(), doca(), docaPatPar(), and docaPatPar().

◆ docaPatPar() [2/3]

double MdcUtilitySvc::docaPatPar ( int layer,
int cell,
const MdcSWire * sWire,
const HepVector helixPat,
const HepSymMatrix errMatPat,
bool passCellRequired = true ) const

Definition at line 475 of file MdcUtilitySvc.cxx.

477 {
478
479 if ( m_debug ) std::cout << " helixPat " << helixPat << std::endl;
480 if ( m_debug ) std::cout << " layer " << layer << " cell " << cell << std::endl;
481 //-----cell track passed
482 int cellId_in = -1;
483 int cellId_out = -1;
484
485 // cellTrackPassedPatPar(helixPat,layer,cellId_in,cellId_out);//yzhang FIXME 2012-07-11
486 cellTrackPassedByPhiPatPar( helixPat, layer, cellId_in,
487 cellId_out ); // yzhang FIXME 2012-07-11
488
489 if ( m_debug )
490 {
491 std::cout << " cellId in " << cellId_in << " out " << cellId_out << std::endl;
492 cout << "cell = " << cell << ", cellId_in = " << cellId_in
493 << ", cellId_out = " << cellId_out << endl;
494 }
495 if ( passCellRequired && ( cell < cellId_in && cell > cellId_out ) ) return -999.;
496
497 //-----helix trajectory
498 HelixTraj* helixTraj = new HelixTraj( helixPat, errMat );
499 const Trajectory* trajHelix = dynamic_cast<const Trajectory*>( helixTraj );
500
501 //-----pointOnHelix
502 int innerOrOuter = 1;
503 Hep3Vector cell_IO = pointOnHelixPatPar( helixPat, layer, innerOrOuter );
504 double fltTrack = 0.1 * m_mdcGeomSvc->Layer( layer )->Radius();
505 if ( m_debug )
506 {
507 std::cout << " cell_IO " << cell_IO << std::endl;
508 std::cout << " fltTrack " << fltTrack << std::endl;
509 }
510
511 //------wire trajectory
512 const MdcSagTraj* m_wireTraj = sWire->getTraj();
513 const Trajectory* trajWire = dynamic_cast<const Trajectory*>( m_wireTraj );
514 const HepPoint3D* start_In = sWire->getEastPoint();
515 // const HepPoint3D* stop_In = sWire->getWestPoint();
516 if ( m_debug )
517 {
518 std::cout << " sag " << m_wireTraj->sag() << std::endl;
519 std::cout << " east -------- " << start_In->x() << "," << start_In->y() << ","
520 << start_In->z() << std::endl;
521 }
522 // std::cout<< " west -------- "<< stop_In->x()<<","<<stop_In->y()<<","<<stop_In->z()
523 // <<std::endl;
524
525 //------calc poca
526 double doca = -999.;
527 TrkPoca* trkPoca;
528 double zWire = cell_IO.z();
529 // HepPoint3D pos_in(zWire,sWire->xWireDC(zWire),sWire->yWireDC(zWire)) ;
530 HepPoint3D pos_in( sWire->xWireDC( zWire ), sWire->yWireDC( zWire ), zWire );
531 if ( m_debug )
532 std::cout << " zWire " << zWire << " zEndDC " << sWire->zEndDC() << std::endl;
533 // if(m_debug) std::cout<<"pos_in "<<pos_in<<" fltWire "<<fltWire<<std::endl;
534
535 double fltWire = sqrt( ( pos_in.x() - start_In->x() ) * ( pos_in.x() - start_In->x() ) +
536 ( pos_in.y() - start_In->y() ) * ( pos_in.y() - start_In->y() ) +
537 ( pos_in.z() - start_In->z() ) * ( pos_in.z() - start_In->z() ) );
538 trkPoca = new TrkPoca( *trajHelix, fltTrack, *trajWire, fltWire );
539 doca = trkPoca->doca();
540
541 double hitLen = trkPoca->flt2();
542 double startLen = trajWire->lowRange() - 5.;
543 double endLen = trajWire->hiRange() + 5.;
544 if ( hitLen < startLen || hitLen > endLen )
545 {
546 if ( m_debug )
547 std::cout << "WARNING MdcUtilitySvc::docaPatPar() isBeyondEndflange! hitLen=" << hitLen
548 << " startLen=" << startLen << " endLen " << endLen << std::endl;
549 doca = -998.;
550 }
551 // std::cout<<" hitLen "<<hitLen<<" startLen "<<startLen<<" endLen "<<endLen <<" doca
552 // "<<doca<<std::endl;
553
554 if ( m_debug ) std::cout << " doca " << doca << std::endl;
555 delete helixTraj;
556 delete trkPoca;
557
558 return doca;
559
560} //----------end of calculatng the doca ---------------------------------//
HepPoint3D pointOnHelixPatPar(const HepVector helixPat, int lay, int innerOrOuter) const

◆ docaPatPar() [3/3]

double MdcUtilitySvc::docaPatPar ( int layer,
int cell,
HepPoint3D eastP,
HepPoint3D westP,
const HepVector helixBes,
const HepSymMatrix errMatBes,
bool passCellRequired = true,
bool doSag = true ) const

Definition at line 456 of file MdcUtilitySvc.cxx.

458 {
459
460 const MdcGeoWire* geowir = m_mdcGeomSvc->Wire( layer, cell );
461 int id = geowir->Id();
462 double sag = 0.;
463 if ( doSag ) sag = geowir->Sag() / 10.; // mm2cm
464 const MdcSWire* sWire = new MdcSWire( eastP, westP, sag, id, cell ); // cm
465
466 double doca =
467 docaPatPar( layer, cell, sWire, helixPat, errMat, passCellRequired ); // call 6.
468
469 delete sWire;
470 return doca;
471}

◆ finalize()

StatusCode MdcUtilitySvc::finalize ( )
virtual

Definition at line 74 of file MdcUtilitySvc.cxx.

74 {
75 MsgStream log( msgSvc(), name() );
76 log << MSG::INFO << "MdcUtilitySvc::finalize()" << endmsg;
77
78 return StatusCode::SUCCESS;
79}
IMessageSvc * msgSvc()

◆ getChargeOfMcParticle()

float MdcUtilitySvc::getChargeOfMcParticle ( const Event::McParticle * mcParticle)

Definition at line 958 of file MdcUtilitySvc.cxx.

958 {
959 // get PartPropSvc
960 IPartPropSvc* partPropSvc;
961 static const bool CREATEIFNOTTHERE( true );
962 StatusCode sc = service( "PartPropSvc", partPropSvc, CREATEIFNOTTHERE );
963 if ( !sc.isSuccess() || nullptr == partPropSvc )
964 { cout << " Could not initialize Particle Properties Service" << endl; }
965 HepPDT::ParticleDataTable* particleTable = partPropSvc->PDT();
966 if ( particleTable->particle( mcParticle->particleProperty() ) )
967 { return particleTable->particle( mcParticle->particleProperty() )->charge(); }
968 return -1e6;
969}
StdHepId particleProperty() const
Retrieve particle property.
Definition McParticle.cxx:7

Referenced by getHelixOfMcParticle().

◆ getHelixOfMcParticle()

void MdcUtilitySvc::getHelixOfMcParticle ( const Event::McParticle * mcParticle,
Helix & helix )

Definition at line 982 of file MdcUtilitySvc.cxx.

982 {
983 if ( nullptr == mcParticle ) return;
984 Hep3Vector pos, mom;
985 pos.setX( mcParticle->initialPosition().x() );
986 pos.setY( mcParticle->initialPosition().y() );
987 pos.setZ( mcParticle->initialPosition().z() );
988 mom.setX( mcParticle->initialFourMomentum().px() );
989 mom.setY( mcParticle->initialFourMomentum().py() );
990 mom.setZ( mcParticle->initialFourMomentum().pz() );
991
992 Helix helixTemp( pos, mom, getChargeOfMcParticle( mcParticle ) );
993 helixTemp.pivot( HepPoint3D( 0, 0, 0 ) );
994 helix.set( helixTemp.pivot(), helixTemp.a(), helixTemp.Ea() );
995}
const HepLorentzVector & initialPosition() const
Retrieve pointer to the start, end vertex positions.
const HepLorentzVector & initialFourMomentum() const
void set(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
sets helix pivot position, parameters, and error matrix.
float getChargeOfMcParticle(const Event::McParticle *mcParticle)

◆ getMdcDigiOnMcParticle()

void MdcUtilitySvc::getMdcDigiOnMcParticle ( int trackIndex,
const std::map< int, std::map< MdcDigi *, Event::MdcMcHit * > > mdcMCAssociation,
MdcDigiVec & mdcDigiInput,
MdcDigiVec & mdcDigiAssociated )

Definition at line 997 of file MdcUtilitySvc.cxx.

999 {
1000 MdcDigiVec::iterator iter = mdcDigiInput.begin();
1001 // auto iter=mdcDigiVecInput.begin();
1002 for ( ; iter != mdcDigiInput.end(); iter++ )
1003 {
1004 std::map<int, std::map<MdcDigi*, MdcMcHit*>>::const_iterator itMap0 =
1005 mdcMCAssociation.find( trackIndex );
1006 if ( itMap0 != mdcMCAssociation.end() )
1007 {
1008 std::map<MdcDigi*, MdcMcHit*>::const_iterator itMap = ( *itMap0 ).second.find( *iter );
1009 MdcMcHit* mcHit = nullptr;
1010 if ( itMap != ( *itMap0 ).second.end() ) { mcHit = itMap->second; }
1011 if ( ( trackIndex == mcHit->getTrackIndex() ) &&
1012 ( mcHit->getCreatorProcess() == "Generator" ||
1013 mcHit->getCreatorProcess() == "Decay" ) )
1014 { mdcDigiAssociated.push_back( *iter ); }
1015 }
1016 }
1017}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
unsigned int getTrackIndex() const
Definition MdcMcHit.cxx:38

◆ getMdcDigiVec()

vector< MdcDigi * > MdcUtilitySvc::getMdcDigiVec ( ) const

Definition at line 81 of file MdcUtilitySvc.cxx.

81 {
82 uint32_t getDigiFlag = 0;
83
84 MdcDigiVec mdcDigiVec = m_RawDataProviderSvc->getMdcDigiVec( getDigiFlag );
85 cout << "MdcUtilitySvc::getMdcDigiVec() get " << mdcDigiVec.size()
86 << " MDC digis from RawDataProviderSvc" << endl;
87
88 return mdcDigiVec;
89}

◆ getMdcMCAssoiciation()

void MdcUtilitySvc::getMdcMCAssoiciation ( int trackIndex,
const std::vector< MdcDigi * > mdcDigiVecInput,
std::map< int, std::map< MdcDigi *, Event::MdcMcHit * > > & mdcMCAssociation )

Get association of MdcDigi and MdcMcHit according to track id.

—get MDC MC hits and make a map vs wire id

loop over MdcDigi

Definition at line 1019 of file MdcUtilitySvc.cxx.

1021 {
1022
1023 ///---get MDC MC hits and make a map vs wire id
1024 IDataProviderSvc* eventSvc = NULL;
1025 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc );
1026 SmartDataPtr<Event::MdcMcHitCol> mdcMcHitCol( eventSvc, "/Event/MC/MdcMcHitCol" );
1027 if ( !mdcMcHitCol )
1028 {
1029 std::cout << "MdcUtilitySvc::getMdcMCAssoiciation() does not find MdcMcHitCol!"
1030 << std::endl;
1031 return;
1032 }
1033 std::map<int, Event::MdcMcHit*> mdcMcHitMap;
1034 Event::MdcMcHitCol::iterator iterMdcMcHit = mdcMcHitCol->begin();
1035 for ( ; iterMdcMcHit != mdcMcHitCol->end(); iterMdcMcHit++ )
1036 {
1037 int id = m_mdcGeomSvc
1038 ->Wire( MdcID::layer( ( *iterMdcMcHit )->identify() ),
1039 MdcID::wire( ( *iterMdcMcHit )->identify() ) )
1040 ->Id();
1041 mdcMcHitMap.insert( std::pair<int, Event::MdcMcHit*>( id, *iterMdcMcHit ) );
1042 }
1043
1044 /// loop over MdcDigi
1045 MdcDigiVec::const_iterator iterMdcDigi = mdcDigiVecInput.begin();
1046 for ( ; iterMdcDigi != mdcDigiVecInput.end(); iterMdcDigi++ )
1047 {
1048 int digiTrackIndex = ( *iterMdcDigi )->getTrackIndex();
1049 std::cout << __FILE__ << " " << __LINE__ << " " << digiTrackIndex << std::endl;
1050 if ( digiTrackIndex > 999 ) digiTrackIndex -= 1000; // FIXME
1051 if ( digiTrackIndex != digiTrackIndex ) continue;
1052 int id = m_mdcGeomSvc
1053 ->Wire( MdcID::layer( ( *iterMdcMcHit )->identify() ),
1054 MdcID::wire( ( *iterMdcMcHit )->identify() ) )
1055 ->Id();
1056 std::map<MdcDigi*, MdcMcHit*> temp;
1057 std::map<int, Event::MdcMcHit*>::iterator itMdcMcHit = mdcMcHitMap.find( id );
1058 if ( itMdcMcHit != mdcMcHitMap.end() )
1059 {
1060 temp.insert( make_pair( *iterMdcDigi, ( *itMdcMcHit ).second ) );
1061 mdcMCAssociation.insert( make_pair( trackIndex, temp ) );
1062 // mdcMCAssociation.insert(std::pair<int,std::map<MdcDigi*,MdcMcHit*> >
1063 //(trackIndex,make_pair(*iterMdcDigi,mdcMcHitMap[id])));
1064 }
1065 }
1066
1067} // end of getMdcMCAssoiciation
static int layer(const Identifier &id)
Values of different levels (failure returns 0).
Definition MdcID.cxx:47
static int wire(const Identifier &id)
Definition MdcID.cxx:52

◆ getMomPosOfMcParticle()

void MdcUtilitySvc::getMomPosOfMcParticle ( const Event::McParticle * mcParticle,
HepVector3D & pos,
HepVector3D & mom )

Definition at line 971 of file MdcUtilitySvc.cxx.

972 {
973 if ( nullptr == mcParticle ) return;
974 pos.setX( mcParticle->initialPosition().x() );
975 pos.setY( mcParticle->initialPosition().y() );
976 pos.setZ( mcParticle->initialPosition().z() );
977 mom.setX( mcParticle->initialFourMomentum().px() );
978 mom.setY( mcParticle->initialFourMomentum().py() );
979 mom.setZ( mcParticle->initialFourMomentum().pz() );
980}

◆ Hel()

HepPoint3D MdcUtilitySvc::Hel ( HepPoint3D piv,
double dr,
double phi0,
double Alpha_L,
double kappa,
double dz,
double dphi,
double tanl ) const

Definition at line 807 of file MdcUtilitySvc.cxx.

808 {
809 double x =
810 piv.x() + dr * cos( phi0 ) + ( Alpha_L / kappa ) * ( cos( phi0 ) - cos( phi0 + dphi ) );
811 double y =
812 piv.y() + dr * sin( phi0 ) + ( Alpha_L / kappa ) * ( sin( phi0 ) - sin( phi0 + dphi ) );
813 double z = piv.z() + dz - ( Alpha_L / kappa ) * dphi * tanl;
814 // cout<<"HepPoint3D(x, y, z) = "<<HepPoint3D(x, y, z)<<endl;
815 if ( ( x > -1000. && x < 1000. ) || ( y > -1000. && y < 1000. ) ||
816 ( z > -1000. && z < 1000. ) )
817 { return HepPoint3D( x, y, z ); }
818 else { return HepPoint3D( 0, 0, 0 ); }
819}

Referenced by cellTrackPassed().

◆ initialize()

StatusCode MdcUtilitySvc::initialize ( )
virtual

Definition at line 32 of file MdcUtilitySvc.cxx.

32 {
33 MsgStream log( msgSvc(), name() );
34 log << MSG::INFO << "MdcUtilitySvc::initialize()" << endmsg;
35
36 StatusCode sc = Service::initialize();
37 if ( sc.isFailure() )
38 {
39 log << MSG::ERROR << "Service::initialize() failure" << endmsg;
40 return sc;
41 }
42
43 // Initalze magnetic flied
44
45 sc = service( "MagneticFieldSvc", m_pIMF );
46 if ( !m_pIMF )
47 {
48 log << MSG::FATAL << " ERROR Unable to open Magnetic field service " << endmsg;
49 return StatusCode::FAILURE;
50 }
51
52 // Initialize MdcGeomSvc
53 IMdcGeomSvc* imdcGeomSvc;
54 sc = service( "MdcGeomSvc", imdcGeomSvc );
55 m_mdcGeomSvc = imdcGeomSvc;
56 if ( !imdcGeomSvc )
57 {
58 log << MSG::FATAL << " Could not load MdcGeomSvc! " << endmsg;
59 return StatusCode::FAILURE;
60 }
61
62 IRawDataProviderSvc* irawDataProviderSvc;
63 sc = service( "RawDataProviderSvc", irawDataProviderSvc );
64 m_RawDataProviderSvc = irawDataProviderSvc;
65 if ( sc.isFailure() )
66 {
67 log << MSG::FATAL << name() << " Could not load RawDataProviderSvc!" << endmsg;
68 return StatusCode::FAILURE;
69 }
70
71 return StatusCode::SUCCESS;
72}

◆ momentum()

Hep3Vector MdcUtilitySvc::momentum ( const RecMdcTrack * trk) const

Definition at line 883 of file MdcUtilitySvc.cxx.

883 {
884 // double dr = trk->helix(0);
885 double fi0 = trk->helix( 1 );
886 double cpa = trk->helix( 2 );
887 double tanl = trk->helix( 4 );
888
889 double pxy = 0.;
890 if ( cpa != 0 ) pxy = 1 / fabs( cpa );
891
892 double px = pxy * ( -sin( fi0 ) );
893 double py = pxy * cos( fi0 );
894 double pz = pxy * tanl;
895
896 Hep3Vector p;
897 p.set( px, py, pz ); // MeV/c
898 return p;
899}
const HepVector helix() const
......

◆ nLayerTrackPassed() [1/2]

int MdcUtilitySvc::nLayerTrackPassed ( const double helix[5]) const

Definition at line 257 of file MdcUtilitySvc.cxx.

257 {
258
259 HepVector helixBesParam( 5, 0 );
260 for ( int i = 0; i < 5; ++i ) helixBesParam[i] = helixBes[i];
261
262 return nLayerTrackPassed( helixBesParam );
263}
int nLayerTrackPassed(const HepVector helix) const

◆ nLayerTrackPassed() [2/2]

int MdcUtilitySvc::nLayerTrackPassed ( const HepVector helix) const

Definition at line 266 of file MdcUtilitySvc.cxx.

266 {
267 HepVector helix = besPar2PatPar( helixBes );
268
269 int nLayer = 0;
270
271 for ( unsigned iLayer = 0; iLayer < 43; iLayer++ )
272 {
273 // flightLength is the path length of track in the x-y plane
274 // guess flightLength by the radius in middle of the wire.
275 double rMidLayer = m_mdcGeomSvc->Layer( iLayer )->Radius();
276 double flightLength = rMidLayer;
277
278 HepPoint3D pivot( 0., 0., 0. );
279 double dz = helix[3];
280 double c = CLHEP::c_light * 100.; // unit from m/s to cm/s
281 double alpha = 1 / ( c * Bz() ); //~333.567
282 double kappa = helix[2];
283 double rc = ( -1. ) * alpha / kappa;
284 // std::cout<<"MdcUtilitySvc alpha "<<alpha<<std::endl;
285 double tanl = helix[4];
286 double phi0 = helix[1];
287 double phi = flightLength / rc + phi0; // turning angle
288 double z = pivot.z() + dz - ( alpha / kappa ) * tanl * phi;
289
290 double layerHalfLength = m_mdcGeomSvc->Layer( iLayer )->Length() / 2.;
291
292 // std::cout<<"MdcUtilitySvc length "<<layerHalfLength<<std::endl;
293
294 if ( fabs( z ) < fabs( layerHalfLength ) ) ++nLayer;
295 }
296
297 return nLayer;
298}
double alpha

Referenced by nLayerTrackPassed().

◆ p_cms()

double MdcUtilitySvc::p_cms ( HepVector helix,
int runNo,
double mass ) const

Definition at line 854 of file MdcUtilitySvc.cxx.

854 {
855 HepLorentzVector p4;
856 p4.setPx( -sin( helix[1] ) / fabs( helix[2] ) );
857 p4.setPy( cos( helix[1] ) / fabs( helix[2] ) );
858 p4.setPz( helix[4] / fabs( helix[2] ) );
859 double p3 = p4.mag();
860 mass = 0.000511;
861 p4.setE( sqrt( p3 * p3 + mass * mass ) );
862
863 double ecm;
864 if ( runNo > 9815 ) { ecm = 3.097; }
865 else { ecm = 3.68632; }
866 double zboost = 0.0075;
867 // HepLorentzVector psip(0.011 * 3.68632, 0, 0.0075, 3.68632);
868 HepLorentzVector psip( 0.011 * ecm, 0, zboost, ecm );
869 // cout << setw(15) << ecm << setw(15) << zboost << endl;
870 Hep3Vector boostv = psip.boostVector();
871
872 // std::cout<<__FILE__<<" boostv "<<boostv<< std::endl;
873 p4.boost( -boostv );
874
875 // std::cout<<__FILE__<<" p4 "<<p4<< std::endl;
876 double p_cms = p4.rho();
877 // phicms = p4.phi();
878 // p4.boost(boostv);
879
880 return p_cms;
881}
double mass
int runNo
Definition DQA_TO_DB.cxx:13
double p_cms(HepVector helix, int runNo, double mass) const

Referenced by p_cms().

◆ patErr2BesErr()

HepSymMatrix MdcUtilitySvc::patErr2BesErr ( const HepSymMatrix & err) const

Definition at line 318 of file MdcUtilitySvc.cxx.

318 {
319 // error matrix
320 // std::cout<<" err1 "<<err<<" "<<err.num_row()<<std::endl;
321 // V(Y)=S * V(X) * ST , mS = S , mVy = V(Y) , err() = V(X)
322 // int n = err.num_row();
323 HepSymMatrix mS( err.num_row(), 0 );
324 mS[0][0] = -1.; // dr0=-d0
325 mS[1][1] = 1.;
326
327 mS[2][2] = Bz() / -333.567; // pxy -> cpa
328 mS[3][3] = 1.;
329 mS[4][4] = 1.;
330 HepSymMatrix mVy = err.similarity( mS );
331 // std::cout<<" err2 "<<n<<" "<<mVy<<std::endl;
332 return mVy;
333}

◆ patPar2BesPar()

HepVector MdcUtilitySvc::patPar2BesPar ( const HepVector & helixPar) const

Definition at line 301 of file MdcUtilitySvc.cxx.

301 {
302 HepVector helix( 5, 0 );
303 double d0 = -helixPar[0]; // cm
304 double phi0 = helixPar[1] + CLHEP::halfpi;
305 double omega = Bz() * helixPar[2] / -333.567;
306 double z0 = helixPar[3]; // cm
307 double tanl = helixPar[4];
308 helix[0] = d0;
309 helix[1] = phi0;
310 helix[2] = omega;
311 helix[3] = z0;
312 helix[4] = tanl;
313 // std::cout<<"helix "<<helix<<std::endl;
314 return helix;
315}

Referenced by cellTrackPassedPatPar().

◆ pointOnHelix()

HepPoint3D MdcUtilitySvc::pointOnHelix ( const HepVector helixPar,
int lay,
int innerOrOuter ) const

Definition at line 337 of file MdcUtilitySvc.cxx.

338 {
339 HepVector helixPat = besPar2PatPar( helixBes );
340 return pointOnHelixPatPar( helixPat, layer, innerOrOuter );
341}

◆ pointOnHelixPatPar()

HepPoint3D MdcUtilitySvc::pointOnHelixPatPar ( const HepVector helixPat,
int lay,
int innerOrOuter ) const

Definition at line 345 of file MdcUtilitySvc.cxx.

346 {
347
348 double rInner, rOuter;
349 // retrieve Mdc geometry information
350 double rCize1 = 0.1 * m_mdcGeomSvc->Layer( layer )->RCSiz1(); // mm -> cm
351 double rCize2 = 0.1 * m_mdcGeomSvc->Layer( layer )->RCSiz2(); // mm -> cm
352 double rLay = 0.1 * m_mdcGeomSvc->Layer( layer )->Radius(); // mm -> cm
353
354 //(conversion of the units mm(mc)->cm(rec))
355 rInner = rLay - rCize1; // radius of inner field wire
356 rOuter = rLay + rCize2; // radius of outer field wire
357
358 // int sign = -1; //assumed the first half circle
359 HepPoint3D piv( 0., 0., 0. );
360 double r;
361 if ( innerOrOuter ) r = rInner;
362 else r = rOuter;
363
364 double d0 = helixPat[0];
365 double phi0 = helixPat[1];
366 double omega = helixPat[2];
367 double z0 = helixPat[3];
368 double tanl = helixPat[4];
369
370 double rc;
371 if ( abs( omega ) < Constants::epsilon ) rc = 9999.;
372 else rc = 1. / omega;
373 double xc = piv.x() + ( d0 + rc ) * cos( phi0 );
374 double yc = piv.y() + ( d0 + rc ) * sin( phi0 );
375 HepPoint3D helixCenter( xc, yc, 0.0 );
376 rc = sqrt( xc * xc + yc * yc ); //?
377 double a, b, c;
378 a = r;
379 b = d0 + rc;
380 c = rc;
381 double dphi = acos( ( a * a - b * b - c * c ) / ( -2. * b * c ) );
382 double fltlen = dphi * rc;
383 double phi = phi0 * omega * fltlen;
384 double x = piv.x() + d0 * sin( phi ) - ( rc + d0 ) * sin( phi0 );
385 double y = piv.y() + d0 * cos( phi ) + ( rc + d0 ) * cos( phi0 );
386 double z = piv.z() + z0 + fltlen * tanl;
387 // std::cout<<" xc yc "<<xc<<" "<<yc
388 if ( m_debug )
389 {
390 std::cout << " abc " << a << " " << b << " " << c << " omega " << omega << " r " << r
391 << " rc " << rc << " dphi " << dphi << " piv " << piv.z() << " z0 " << z0
392 << " fltlen " << fltlen << " tanl " << tanl << std::endl;
393 std::cout << " pointOnHelixPatPar in Hel " << helixPat << std::endl;
394 cout << "HepPoint3D(x, y, z) = " << HepPoint3D( x, y, z ) << endl;
395 }
396 return HepPoint3D( x, y, z );
397}

Referenced by docaPatPar(), and pointOnHelix().

◆ probab()

double MdcUtilitySvc::probab ( const int & ndof,
const double & chisq ) const

Definition at line 901 of file MdcUtilitySvc.cxx.

901 {
902
903 // constants
904 double srtopi = 2.0 / sqrt( 2.0 * M_PI );
905 double upl = 100.0;
906
907 double prob = 0.0;
908 if ( ndof <= 0 ) { return prob; }
909 if ( chisq < 0.0 ) { return prob; }
910 if ( ndof <= 60 )
911 {
912 // full treatment
913 if ( chisq > upl ) { return prob; }
914 double sum = exp( -0.5 * chisq );
915 double term = sum;
916
917 int m = ndof / 2;
918 if ( 2 * m == ndof )
919 {
920 if ( m == 1 ) { return sum; }
921 for ( int i = 2; i <= m; i++ )
922 {
923 term = 0.5 * term * chisq / ( i - 1 );
924 sum += term;
925 } //(int i=2; i<=m)
926 return sum;
927 // even
928 }
929 else
930 {
931 // odd
932 double srty = sqrt( chisq );
933 double temp = srty / M_SQRT2;
934 prob = erfc( temp );
935 if ( ndof == 1 ) { return prob; }
936 if ( ndof == 3 ) { return ( srtopi * srty * sum + prob ); }
937 m = m - 1;
938 for ( int i = 1; i <= m; i++ )
939 {
940 term = term * chisq / ( 2 * i + 1 );
941 sum += term;
942 } //(int i=1; i<=m; i++)
943 return ( srtopi * srty * sum + prob );
944
945 } //(2*m==ndof)
946 }
947 else
948 {
949 // asymtotic Gaussian approx
950 double srty = sqrt( chisq ) - sqrt( ndof - 0.5 );
951 if ( srty < 12.0 ) { prob = 0.5 * erfc( srty ); };
952
953 } // ndof<30
954
955 return prob;
956} // endof probab
EvtComplex exp(const EvtComplex &c)
#define M_PI
Definition TConstant.h:4

The documentation for this class was generated from the following files: