BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TTrack.h File Reference
#include <string>
#include "CLHEP/Vector/ThreeVector.h"
#include "TrackUtil/Helix.h"
#include "TrkReco/TBuilder0.h"
#include "TrkReco/TBuilderCosmic.h"
#include "TrkReco/TBuilderCurl.h"
#include "TrkReco/TMDCUtil.h"
#include "TrkReco/TMLink.h"
#include "TrkReco/TTrackBase.h"
#include "TrkReco/TPoint2D.h"
#include "GaudiKernel/IInterface.h"
#include "GaudiKernel/Kernel.h"
#include "GaudiKernel/Service.h"
#include "MagneticFieldSvc/IBesMagFieldSvc.h"
#include "TrkReco/T3DLine.h"
#include "TrkReco/TRunge.h"
#include "CLHEP/Geometry/Point3D.h"
#include "CLHEP/Matrix/SymMatrix.h"
#include "CLHEP/Matrix/Vector.h"
#include "CLHEP/Vector/LorentzVector.h"

Go to the source code of this file.

Classes

class  TTrack
 A class to represent a track in tracking. More...

Macros

#define TrackOldConformalFinder   1
#define TrackFastFinder   2
#define TrackSlowFinder   4
#define TrackCurlFinder   8
#define TrackTrackManager   16
#define TrackPMCurlFinder   32
#define TrackSVDAssociator   64
#define TrackFinderMask   255
#define TrackTypeUndefined   0
#define TrackTypeNormal   1
#define TrackTypeCurl   2
#define TrackTypeCircle   4
#define TrackTypeCosmic   8
#define TrackTypeIncomingCosmic   8
#define TrackTypeOutgoingCosmic   16
#define TrackTypeKink   32
#define TrackTypeSVDOnly   256
#define TrackQualityOutsideCurler   1
#define TrackQualityAfterKink   2
#define TrackQualityCosmic   4
#define TrackQuality2D   8
#define TrackQualityShift   8
#define TrackQualityMask   255
#define TrackFitGlobal   1
#define TrackFitCosmic   2
#define TrackFitCdcKalman   4
#define TrackFitSvdCdcKalman   8
#define TrackFitShift   16
#define TrackFitMask   255
#define TrackHasMother   1
#define TrackHasDaughter   2
#define TrackRelationShift   24
#define TrackRelationMask   255
#define OLD_STEREO   1
 calculates arc length and z for a stereo hit. uses these functions for curl tracks.
#define TTrack_INLINE_DEFINE_HERE

Typedefs

typedef HepGeom::Point3D< double > HepPoint3D

Functions

int SortByPt (const void *a, const void *b)
 Utility functions.
std::string TrackDump (const TTrack &)
 to dump a track.
std::string TrackType (const TTrack &)
 returns string of track type.
std::string TrackType (unsigned type)
std::string TrackStatus (const TTrack &)
 returns string of track status.
std::string TrackStatus (const MdcRec_trk &)
std::string TrackStatus (const MdcRec_trk_add &)
std::string TrackStatus (unsigned md, unsigned mk, unsigned mq, unsigned ms, unsigned mm, unsigned ma)
std::string TrackKinematics (const TTrack &)
std::string TrackKinematics (const Helix &)
std::string TrackInformation (const TTrack &)
std::string TrackInformation (const MdcRec_trk &)
std::string TrackInformation (unsigned nA, unsigned nS, unsigned n, float chisq)
std::string TrackLayerUsage (const TTrack &)
Helix Track2Helix (const MdcRec_trk &)
 returns helix.
Helix Track2Helix (const MdcTrk_localz &)
Helix Track2Helix (const Gen_hepevt &)
Helix Track2Helix (const Mdst_trk_fit &)
bool HelixHasNan (const Helix &)
 Helix parameter validity.
bool PositiveDefinite (const Helix &)
 Error matrix validity.

Macro Definition Documentation

◆ OLD_STEREO

#define OLD_STEREO   1

calculates arc length and z for a stereo hit. uses these functions for curl tracks.

Definition at line 250 of file Reconstruction/TrkReco/include/TrkReco/TTrack.h.

◆ TrackCurlFinder

#define TrackCurlFinder   8

◆ TrackFastFinder

#define TrackFastFinder   2

◆ TrackFinderMask

#define TrackFinderMask   255

◆ TrackFitCdcKalman

#define TrackFitCdcKalman   4

◆ TrackFitCosmic

#define TrackFitCosmic   2

◆ TrackFitGlobal

#define TrackFitGlobal   1

◆ TrackFitMask

#define TrackFitMask   255

◆ TrackFitShift

#define TrackFitShift   16

◆ TrackFitSvdCdcKalman

#define TrackFitSvdCdcKalman   8

◆ TrackHasDaughter

#define TrackHasDaughter   2

Definition at line 61 of file Reconstruction/TrkReco/include/TrkReco/TTrack.h.

Referenced by TTrack::daughter().

◆ TrackHasMother

#define TrackHasMother   1

Definition at line 60 of file Reconstruction/TrkReco/include/TrkReco/TTrack.h.

Referenced by TTrack::mother().

◆ TrackOldConformalFinder

#define TrackOldConformalFinder   1

◆ TrackPMCurlFinder

#define TrackPMCurlFinder   32

◆ TrackQuality2D

#define TrackQuality2D   8

Definition at line 47 of file Reconstruction/TrkReco/include/TrkReco/TTrack.h.

Referenced by TTrack::movePivot().

◆ TrackQualityAfterKink

#define TrackQualityAfterKink   2

◆ TrackQualityCosmic

#define TrackQualityCosmic   4

◆ TrackQualityMask

#define TrackQualityMask   255

◆ TrackQualityOutsideCurler

#define TrackQualityOutsideCurler   1

◆ TrackQualityShift

#define TrackQualityShift   8

◆ TrackRelationMask

#define TrackRelationMask   255

◆ TrackRelationShift

#define TrackRelationShift   24

◆ TrackSlowFinder

#define TrackSlowFinder   4

◆ TrackSVDAssociator

#define TrackSVDAssociator   64

◆ TrackTrackManager

#define TrackTrackManager   16

◆ TrackTypeCircle

#define TrackTypeCircle   4

◆ TrackTypeCosmic

#define TrackTypeCosmic   8

◆ TrackTypeCurl

#define TrackTypeCurl   2

◆ TrackTypeIncomingCosmic

#define TrackTypeIncomingCosmic   8

◆ TrackTypeKink

#define TrackTypeKink   32

◆ TrackTypeNormal

#define TrackTypeNormal   1

◆ TrackTypeOutgoingCosmic

#define TrackTypeOutgoingCosmic   16

◆ TrackTypeSVDOnly

#define TrackTypeSVDOnly   256

◆ TrackTypeUndefined

#define TrackTypeUndefined   0

◆ TTrack_INLINE_DEFINE_HERE

#define TTrack_INLINE_DEFINE_HERE

Typedef Documentation

◆ HepPoint3D

typedef HepGeom::Point3D<double> HepPoint3D

Function Documentation

◆ HelixHasNan()

bool HelixHasNan ( const Helix & h)

Helix parameter validity.

Definition at line 3939 of file TTrack.cxx.

3939 {
3940 const Vector& a = h.a();
3941 for ( unsigned i = 0; i < 5; i++ )
3942 // maqm if (isnan(a[i]))
3943 if ( std::isnan( a[i] ) ) return true;
3944 const SymMatrix& Ea = h.Ea();
3945 for ( unsigned i = 0; i < 5; i++ )
3946 for ( unsigned j = 0; j <= i; j++ )
3947 // maqm if (isnan(Ea[i][j]))
3948 if ( std::isnan( Ea[i][j] ) ) return true;
3949 return false;
3950}
const HepSymMatrix & Ea(void) const
returns error matrix.
const HepVector & a(void) const
returns helix parameters.

Referenced by TrackInformation(), and TrackInformation().

◆ PositiveDefinite()

bool PositiveDefinite ( const Helix & h)

Error matrix validity.

Definition at line 3924 of file TTrack.cxx.

3924 {
3925 const SymMatrix& e = h.Ea();
3926 SymMatrix e2 = e.sub( 1, 2 );
3927 SymMatrix e3 = e.sub( 1, 3 );
3928 SymMatrix e4 = e.sub( 1, 4 );
3929
3930 bool positive = true;
3931 if ( e[0][0] <= 0. ) positive = false;
3932 else if ( e2.determinant() <= 0. ) positive = false;
3933 else if ( e3.determinant() <= 0. ) positive = false;
3934 else if ( e4.determinant() <= 0. ) positive = false;
3935 else if ( e.determinant() <= 0. ) positive = false;
3936 return positive;
3937}
Double_t e2

Referenced by TrackInformation(), and TrackInformation().

◆ SortByPt()

int SortByPt ( const void * a,
const void * b )

Utility functions.

Definition at line 2514 of file TTrack.cxx.

2514 {
2515 const TTrack** a( (const TTrack**)av );
2516 const TTrack** b( (const TTrack**)bv );
2517 if ( ( *a )->pt() < ( *b )->pt() ) return 1;
2518 else if ( ( *a )->pt() == ( *b )->pt() ) return 0;
2519 else return -1;
2520}
A class to represent a track in tracking.

◆ Track2Helix() [1/4]

Helix Track2Helix ( const Gen_hepevt & t)

Definition at line 3952 of file TTrack.cxx.

3952 {
3953 float charge = 1;
3954 if ( t.idhep == 11 ) charge = -1;
3955 else if ( t.idhep == -11 ) charge = 1;
3956 else if ( t.idhep == 13 ) charge = -1;
3957 else if ( t.idhep == -13 ) charge = 1;
3958 else if ( t.idhep == 211 ) charge = 1;
3959 else if ( t.idhep == -211 ) charge = -1;
3960 else if ( t.idhep == 321 ) charge = 1;
3961 else if ( t.idhep == -321 ) charge = -1;
3962 else if ( t.idhep == 2212 ) charge = 1;
3963 else if ( t.idhep == -2212 ) charge = -1;
3964 else
3965 {
3966 std::cout << "Track2Helix(gen_hepevt) !!! charge of id=";
3967 std::cout << t.idhep << " is unknown" << std::endl;
3968 }
3969
3970 Hep3Vector mom( t.P[0], t.P[1], t.P[2] );
3971 Hep3Vector pos( t.V[0] / 10., t.V[1] / 10., t.V[2] / 10. );
3972 return Helix( pos, mom, charge );
3973}
int t()
Definition t.c:1

◆ Track2Helix() [2/4]

Helix Track2Helix ( const MdcRec_trk & t)

returns helix.

Definition at line 3707 of file TTrack.cxx.

3707 {
3708 HepVector a( 5 );
3709 Hep3Vector p( t.pivot[0], t.pivot[1], t.pivot[2] );
3710 HepSymMatrix er( 5, 0 );
3711 a( 1 ) = t.helix[0];
3712 a( 2 ) = t.helix[1];
3713 a( 3 ) = t.helix[2];
3714 a( 4 ) = t.helix[3];
3715 a( 5 ) = t.helix[4];
3716 er( 1, 1 ) = t.error[0];
3717 er( 2, 1 ) = t.error[1];
3718 er( 2, 2 ) = t.error[2];
3719 er( 3, 1 ) = t.error[3];
3720 er( 3, 2 ) = t.error[4];
3721 er( 3, 3 ) = t.error[5];
3722 er( 4, 1 ) = t.error[6];
3723 er( 4, 2 ) = t.error[7];
3724 er( 4, 3 ) = t.error[8];
3725 er( 4, 4 ) = t.error[9];
3726 er( 5, 1 ) = t.error[10];
3727 er( 5, 2 ) = t.error[11];
3728 er( 5, 3 ) = t.error[12];
3729 er( 5, 4 ) = t.error[13];
3730 er( 5, 5 ) = t.error[14];
3731 return Helix( p, a, er );
3732}

◆ Track2Helix() [3/4]

Helix Track2Helix ( const MdcTrk_localz & t)

Definition at line 3680 of file TTrack.cxx.

3680 {
3681 HepVector a( 5 );
3682 Hep3Vector p( t.pivot[0], t.pivot[1], t.pivot[2] );
3683 HepSymMatrix er( 5, 0 );
3684 a( 1 ) = t.helix[0];
3685 a( 2 ) = t.helix[1];
3686 a( 3 ) = t.helix[2];
3687 a( 4 ) = t.helix[3];
3688 a( 5 ) = t.helix[4];
3689 er( 1, 1 ) = t.error[0];
3690 er( 2, 1 ) = t.error[1];
3691 er( 2, 2 ) = t.error[2];
3692 er( 3, 1 ) = t.error[3];
3693 er( 3, 2 ) = t.error[4];
3694 er( 3, 3 ) = t.error[5];
3695 er( 4, 1 ) = t.error[6];
3696 er( 4, 2 ) = t.error[7];
3697 er( 4, 3 ) = t.error[8];
3698 er( 4, 4 ) = t.error[9];
3699 er( 5, 1 ) = t.error[10];
3700 er( 5, 2 ) = t.error[11];
3701 er( 5, 3 ) = t.error[12];
3702 er( 5, 4 ) = t.error[13];
3703 er( 5, 5 ) = t.error[14];
3704 return Helix( p, a, er );
3705}

Referenced by TrackInformation().

◆ Track2Helix() [4/4]

Helix Track2Helix ( const Mdst_trk_fit & t)

Definition at line 3734 of file TTrack.cxx.

3734 {
3735 HepVector a( 5 );
3736 Hep3Vector p( t.pivot_x, t.pivot_y, t.pivot_z );
3737 HepSymMatrix er( 5, 0 );
3738 a( 1 ) = t.helix[0];
3739 a( 2 ) = t.helix[1];
3740 a( 3 ) = t.helix[2];
3741 a( 4 ) = t.helix[3];
3742 a( 5 ) = t.helix[4];
3743 er( 1, 1 ) = t.error[0];
3744 er( 2, 1 ) = t.error[1];
3745 er( 2, 2 ) = t.error[2];
3746 er( 3, 1 ) = t.error[3];
3747 er( 3, 2 ) = t.error[4];
3748 er( 3, 3 ) = t.error[5];
3749 er( 4, 1 ) = t.error[6];
3750 er( 4, 2 ) = t.error[7];
3751 er( 4, 3 ) = t.error[8];
3752 er( 4, 4 ) = t.error[9];
3753 er( 5, 1 ) = t.error[10];
3754 er( 5, 2 ) = t.error[11];
3755 er( 5, 3 ) = t.error[12];
3756 er( 5, 4 ) = t.error[13];
3757 er( 5, 5 ) = t.error[14];
3758 return Helix( p, a, er );
3759}

◆ TrackDump()

std::string TrackDump ( const TTrack & t)
inline

to dump a track.

Definition at line 547 of file Reconstruction/TrkReco/include/TrkReco/TTrack.h.

547 {
548 return t.name() + " " + TrackStatus( t ) + " " + TrackKinematics( t ) + " " +
550}
std::string TrackInformation(const TTrack &)
Definition TTrack.cxx:3867
std::string TrackStatus(const TTrack &)
returns string of track status.
Definition TTrack.cxx:3801
std::string TrackKinematics(const TTrack &)

◆ TrackInformation() [1/3]

std::string TrackInformation ( const MdcRec_trk & r)

Definition at line 3878 of file TTrack.cxx.

3878 {
3879 std::string p;
3880 if ( PositiveDefinite( Track2Helix( r ) ) ) p = " posi";
3881 else p = " nega";
3882 if ( HelixHasNan( Track2Helix( r ) ) ) p += " with NaN";
3883 return TrackInformation( r.nhits - r.nster, r.nster, r.nhits, r.chiSq ) + p;
3884}
Helix Track2Helix(const MdcTrk_localz &t)
Definition TTrack.cxx:3680
std::string TrackInformation(const TTrack &t)
Definition TTrack.cxx:3867
bool PositiveDefinite(const Helix &h)
Error matrix validity.
Definition TTrack.cxx:3924
bool HelixHasNan(const Helix &h)
Helix parameter validity.
Definition TTrack.cxx:3939

◆ TrackInformation() [2/3]

std::string TrackInformation ( const TTrack & t)

Definition at line 3867 of file TTrack.cxx.

3867 {
3868 const AList<TMLink> cores = t.cores();
3869 unsigned n = cores.length();
3870 unsigned nS = NStereoHits( cores );
3871 unsigned nA = n - nS;
3872 std::string p;
3873 if ( !PositiveDefinite( t.helix() ) ) p = " negative";
3874 if ( HelixHasNan( t.helix() ) ) p += " NaN";
3875 return TrackInformation( nA, nS, n, t.chi2() ) + p;
3876}
const Int_t n

Referenced by TrackDump(), TrackInformation(), and TrackInformation().

◆ TrackInformation() [3/3]

std::string TrackInformation ( unsigned nA,
unsigned nS,
unsigned n,
float chisq )

Definition at line 3886 of file TTrack.cxx.

3886 {
3887 std::string s;
3888
3889 s += "a" + std::to_string( int( nA ) );
3890 s += " s" + std::to_string( int( nS ) );
3891 s += " n" + std::to_string( int( n ) );
3892 // s += " ndf" + std::string(int(r.m_ndf));
3893 float x = chisq;
3894
3895 if ( x < 0. ) s += " -";
3896 else s += " ";
3897
3898 int y = int( fabs( x ) );
3899 s += std::to_string( y ) + ".";
3900 float z = fabs( x );
3901 for ( unsigned j = 0; j < 1; j++ )
3902 {
3903 z *= 10.;
3904 y = ( int( z ) % 10 );
3905 s += std::to_string( y );
3906 }
3907
3908 return s;
3909}
XmlRpcServer s

◆ TrackKinematics() [1/2]

std::string TrackKinematics ( const Helix & h)

Definition at line 3761 of file TTrack.cxx.

3761 {
3762 static const HepPoint3D IP( 0., 0., 0. );
3763 Helix hIp = h;
3764 hIp.pivot( IP );
3765
3766 float chrg = hIp.a()[2] / fabs( hIp.a()[2] );
3767 std::string s;
3768 if ( chrg > 0. ) s = "+";
3769 else s = "-";
3770
3771 float x[4];
3772 x[0] = fabs( hIp.a()[0] );
3773 x[1] = hIp.a()[3];
3774 x[2] = 1. / fabs( hIp.a()[2] );
3775 x[3] = ( 1. / fabs( hIp.a()[2] ) ) * hIp.a()[4];
3776
3777 if ( ( x[0] < 2. ) && ( fabs( x[1] ) < 4. ) ) s += "i ";
3778 else s += " ";
3779
3780 for ( unsigned i = 0; i < 4; i++ )
3781 {
3782 if ( i ) s += " ";
3783
3784 if ( x[i] < 0. ) s += "-";
3785 else s += " ";
3786
3787 int y = int( fabs( x[i] ) );
3788 s += std::to_string( y ) + ".";
3789 float z = fabs( x[i] );
3790 for ( unsigned j = 0; j < 3; j++ )
3791 {
3792 z *= 10.;
3793 y = ( int( z ) % 10 );
3794 s += std::to_string( y );
3795 }
3796 }
3797
3798 return s;
3799}
HepGeom::Point3D< double > HepPoint3D
const HepPoint3D & pivot(void) const
returns pivot position.

◆ TrackKinematics() [2/2]

std::string TrackKinematics ( const TTrack & t)
inline

Definition at line 545 of file Reconstruction/TrkReco/include/TrkReco/TTrack.h.

545{ return TrackKinematics( t.helix() ); }

Referenced by TrackDump(), and TrackKinematics().

◆ TrackLayerUsage()

std::string TrackLayerUsage ( const TTrack & t)

Definition at line 3911 of file TTrack.cxx.

3911 {
3912 unsigned n[11];
3913 NHitsSuperLayer( t.links(), n );
3914 std::string nh;
3915 for ( unsigned i = 0; i < 11; i++ )
3916 {
3917 nh += std::to_string( n[i] );
3918 if ( i % 2 ) nh += "-";
3919 else if ( i < 10 ) nh += ",";
3920 }
3921 return nh;
3922}

◆ TrackStatus() [1/4]

std::string TrackStatus ( const MdcRec_trk & c)

Definition at line 3805 of file TTrack.cxx.

3805 {
3806 // const reccdc_trk_add & a =
3807 // * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, c.m_ID, BBS_No_Index);
3808 // return TrackStatus(a);
3809 return std::string( "" );
3810}

◆ TrackStatus() [2/4]

std::string TrackStatus ( const MdcRec_trk_add & a)

Definition at line 3812 of file TTrack.cxx.

3812 {
3813 // return TrackStatus(a.decision,
3814 // a.kind,
3815 // a.quality,
3816 // a.stat,
3817 // a.mother,
3818 // a.daughter);
3819 return std::string( "" );
3820}

◆ TrackStatus() [3/4]

std::string TrackStatus ( const TTrack & t)

returns string of track status.

Definition at line 3801 of file TTrack.cxx.

3801 {
3802 return TrackStatus( t.finder(), t.type(), t.quality(), t.fitting(), 0, 0 );
3803}
std::string TrackStatus(const TTrack &t)
returns string of track status.
Definition TTrack.cxx:3801

Referenced by TrackDump(), and TrackStatus().

◆ TrackStatus() [4/4]

std::string TrackStatus ( unsigned md,
unsigned mk,
unsigned mq,
unsigned ms,
unsigned mm,
unsigned ma )

Definition at line 3822 of file TTrack.cxx.

3823 {
3824
3825 std::string f;
3826 if ( md & TrackOldConformalFinder ) f += "o";
3827 if ( md & TrackFastFinder ) f += "f";
3828 if ( md & TrackSlowFinder ) f += "s";
3829 if ( md & TrackCurlFinder ) f += "c";
3830 if ( md & TrackTrackManager ) f += "t";
3831 if ( f == "" ) f = "?";
3832
3833 std::string k;
3834 if ( mk & TrackTypeNormal ) k += "Norm";
3835 if ( mk & TrackTypeCurl ) k += "Curl";
3836 if ( mk & TrackTypeCircle ) k += "Circ";
3837 if ( mk & TrackTypeIncomingCosmic ) k += "Inco";
3838 if ( mk & TrackTypeOutgoingCosmic ) k += "Outc";
3839 if ( mk & TrackTypeKink ) k += "Kink";
3840 if ( mk & TrackTypeSVDOnly ) k += "Svd";
3841 if ( k == "" ) k = "?";
3842
3843 std::string b;
3844 if ( mq & TrackQualityOutsideCurler ) b += "Curlback";
3845 if ( mq & TrackQualityAfterKink ) b += "Afterkink";
3846 if ( mq & TrackQualityCosmic ) b += "Cosmic";
3847 if ( mq & TrackQuality2D ) b += "2D";
3848 if ( b == "" ) b = "ok";
3849
3850 std::string s;
3851 if ( ms & TrackFitGlobal ) s += "HFit";
3852 if ( ms & TrackFitCosmic ) s += "CFit";
3853 if ( ms & TrackFitCdcKalman ) s += "CKal";
3854 if ( ms & TrackFitSvdCdcKalman ) s += "SKal";
3855 if ( s == "" ) s = "?";
3856
3857 int m = mm;
3858 if ( m ) --m;
3859
3860 int d = ma;
3861 if ( d ) --d;
3862
3863 std::string p = " ";
3864 return f + p + k + p + b + p + s + p + std::to_string( m ) + p + std::to_string( d );
3865}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
const double mk
Definition Gam4pikp.cxx:33

◆ TrackType() [1/2]

std::string TrackType ( const TTrack & t)
inline

returns string of track type.

Definition at line 543 of file Reconstruction/TrkReco/include/TrkReco/TTrack.h.

543{ return TrackType( t.type() ); }

◆ TrackType() [2/2]

std::string TrackType ( unsigned type)
inline

Definition at line 3055 of file TTrack.cxx.

3055 {
3056 switch ( type )
3057 {
3058 case TrackTypeUndefined: return std::string( "undefined" );
3059 case TrackTypeNormal: return std::string( "normal" );
3060 case TrackTypeCurl: return std::string( "curl " );
3061 case TrackTypeCircle: return std::string( "circle" );
3062 case TrackTypeCosmic: return std::string( "cosmic" );
3063 }
3064 return std::string( "unknown " );
3065}