BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
TTrack.cxx File Reference
#include <cfloat>
#include "CLHEP/String/Strings.h"
#include "CLHEP/Matrix/Vector.h"
#include "CLHEP/Matrix/SymMatrix.h"
#include "CLHEP/Matrix/DiagMatrix.h"
#include "CLHEP/Matrix/Matrix.h"
#include "TrkReco/TCircle.h"
#include "TrkReco/TMLine.h"
#include "TrkReco/TMLink.h"
#include "TrkReco/TMDCUtil.h"
#include "TrkReco/TMDCWire.h"
#include "TrkReco/TMDCWireHit.h"
#include "TrkReco/TMDCWireHitMC.h"
#include "TrkReco/TTrack.h"
#include "TrkReco/TSegment.h"
#include "MdcTables/MdcTables.h"
#include "MdcTables/TrkTables.h"
#include "MdcTables/MdstTables.h"
#include "MdcTables/HepevtTables.h"
#include "GaudiKernel/StatusCode.h"
#include "GaudiKernel/IInterface.h"
#include "GaudiKernel/Kernel.h"
#include "GaudiKernel/Service.h"
#include "GaudiKernel/ISvcLocator.h"
#include "GaudiKernel/SvcFactory.h"
#include "GaudiKernel/IDataProviderSvc.h"
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/SmartDataPtr.h"
#include "GaudiKernel/IMessageSvc.h"

Go to the source code of this file.

Macros

#define OPTNK
 
#define HEP_SHORT_NAMES
 
#define NEW_FIT2D   1
 
#define JJTEST   0
 
#define JJJTEST   0
 
#define t_dot(a, b)   (a[0]*b[0]+a[1]*b[1]+a[2]*b[2])
 
#define t_dot2(a, b)   (a[0]*b[0]+a[1]*b[1])
 
#define t_print(a, b)   std::cout << b << " = " << a[0] << " " << a[1] << " " << a[2] << std::endl;
 

Functions

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

Macro Definition Documentation

◆ HEP_SHORT_NAMES

#define HEP_SHORT_NAMES

Definition at line 33 of file TTrack.cxx.

◆ JJJTEST

#define JJJTEST   0

◆ JJTEST

#define JJTEST   0

◆ NEW_FIT2D

#define NEW_FIT2D   1

Definition at line 940 of file TTrack.cxx.

◆ OPTNK

#define OPTNK

Definition at line 1 of file TTrack.cxx.

◆ t_dot

#define t_dot (   a,
 
)    (a[0]*b[0]+a[1]*b[1]+a[2]*b[2])

Definition at line 3047 of file TTrack.cxx.

◆ t_dot2

#define t_dot2 (   a,
 
)    (a[0]*b[0]+a[1]*b[1])

Definition at line 3048 of file TTrack.cxx.

◆ t_print

#define t_print (   a,
 
)    std::cout << b << " = " << a[0] << " " << a[1] << " " << a[2] << std::endl;

Definition at line 3049 of file TTrack.cxx.

Function Documentation

◆ HelixHasNan()

bool HelixHasNan ( const Helix h)

Helix parameter validity.

Definition at line 3934 of file TTrack.cxx.

3934 {
3935 const Vector & a = h.a();
3936 for (unsigned i = 0; i < 5; i++)
3937 if (isnan(a[i]))
3938 return true;
3939 const SymMatrix & Ea = h.Ea();
3940 for (unsigned i = 0; i < 5; i++)
3941 for (unsigned j = 0; j <= i; j++)
3942 if (isnan(Ea[i][j]))
3943 return true;
3944 return false;
3945}
const HepSymMatrix & Ea(void) const
returns error matrix.
const HepVector & a(void) const
returns helix parameters.

Referenced by TTrackManager::goodTrack(), and TrackInformation().

◆ PositiveDefinite()

bool PositiveDefinite ( const Helix h)

Error matrix validity.

Definition at line 3918 of file TTrack.cxx.

3918 {
3919 const SymMatrix & e = h.Ea();
3920 SymMatrix e2 = e.sub(1, 2);
3921 SymMatrix e3 = e.sub(1, 3);
3922 SymMatrix e4 = e.sub(1, 4);
3923
3924 bool positive = true;
3925 if (e[0][0] <= 0.) positive = false;
3926 else if (e2.determinant() <= 0.) positive = false;
3927 else if (e3.determinant() <= 0.) positive = false;
3928 else if (e4.determinant() <= 0.) positive = false;
3929 else if (e.determinant() <= 0.) positive = false;
3930 return positive;
3931}
Double_t e2

Referenced by TrackInformation().

◆ SortByPt()

int SortByPt ( const void *  av,
const void *  bv 
)

Utility functions.

Definition at line 2530 of file TTrack.cxx.

2530 {
2531 const TTrack ** a((const TTrack **)av);
2532 const TTrack ** b((const TTrack **)bv);
2533 if ((* a)->pt() < (* b)->pt()) return 1;
2534 else if
2535 ((* a)->pt() == (* b)->pt()) return 0;
2536 else return -1;
2537}
A class to represent a track in tracking.
Definition: TTrack.h:129

Referenced by TTrackManager::append2D().

◆ Track2Helix() [1/4]

Helix Track2Helix ( const Gen_hepevt t)

Definition at line 3948 of file TTrack.cxx.

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

◆ Track2Helix() [2/4]

Helix Track2Helix ( const MdcRec_trk t)

returns helix.

Definition at line 3684 of file TTrack.cxx.

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

◆ Track2Helix() [3/4]

Helix Track2Helix ( const MdcTrk_localz t)

Definition at line 3656 of file TTrack.cxx.

3656 {
3657 HepVector a(5);
3658 Hep3Vector p(t.pivot[0], t.pivot[1], t.pivot[2]);
3659 HepSymMatrix er(5,0);
3660 a(1) = t.helix[0];
3661 a(2) = t.helix[1];
3662 a(3) = t.helix[2];
3663 a(4) = t.helix[3];
3664 a(5) = t.helix[4];
3665 er(1,1) = t.error[0];
3666 er(2,1) = t.error[1];
3667 er(2,2) = t.error[2];
3668 er(3,1) = t.error[3];
3669 er(3,2) = t.error[4];
3670 er(3,3) = t.error[5];
3671 er(4,1) = t.error[6];
3672 er(4,2) = t.error[7];
3673 er(4,3) = t.error[8];
3674 er(4,4) = t.error[9];
3675 er(5,1) = t.error[10];
3676 er(5,2) = t.error[11];
3677 er(5,3) = t.error[12];
3678 er(5,4) = t.error[13];
3679 er(5,5) = t.error[14];
3680 return Helix(p, a, er);
3681}

Referenced by TrackInformation().

◆ Track2Helix() [4/4]

Helix Track2Helix ( const Mdst_trk_fit t)

Definition at line 3712 of file TTrack.cxx.

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

◆ TrackInformation() [1/3]

std::string TrackInformation ( const MdcRec_trk r)

Definition at line 3868 of file TTrack.cxx.

3868 {
3869 std::string p;
3870 if (PositiveDefinite(Track2Helix(r))) p = " posi";
3871 else p = " nega";
3872 if (HelixHasNan(Track2Helix(r))) p += " with NaN";
3873 return TrackInformation(r.nhits - r.nster,
3874 r.nster,
3875 r.nhits,
3876 r.chiSq) + p;
3877}
Helix Track2Helix(const MdcTrk_localz &t)
Definition: TTrack.cxx:3656
std::string TrackInformation(const TTrack &t)
Definition: TTrack.cxx:3856
bool PositiveDefinite(const Helix &h)
Error matrix validity.
Definition: TTrack.cxx:3918
bool HelixHasNan(const Helix &h)
Helix parameter validity.
Definition: TTrack.cxx:3934
float chiSq
Definition: MdcTables.h:406

◆ TrackInformation() [2/3]

std::string TrackInformation ( const TTrack t)

Definition at line 3856 of file TTrack.cxx.

3856 {
3857 const AList<TMLink> cores = t.cores();
3858 unsigned n = cores.length();
3859 unsigned nS = NStereoHits(cores);
3860 unsigned nA = n - nS;
3861 std::string p;
3862 if (! PositiveDefinite(t.helix())) p = " negative";
3863 if (HelixHasNan(t.helix())) p += " NaN";
3864 return TrackInformation(nA, nS, n, t.chi2()) + p;
3865}
const Int_t n

Referenced by TrackDump(), and TrackInformation().

◆ TrackInformation() [3/3]

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

Definition at line 3880 of file TTrack.cxx.

3880 {
3881 std::string s;
3882
3883 s += "a" + itostring(int(nA));
3884 s += " s" + itostring(int(nS));
3885 s += " n" + itostring(int(n));
3886 // s += " ndf" + std::string(int(r.m_ndf));
3887 float x = chisq;
3888
3889 if (x < 0.) s += " -";
3890 else s += " ";
3891
3892 int y = int(fabs(x));
3893 s += itostring(y) + ".";
3894 float z = fabs(x);
3895 for (unsigned j = 0; j < 1; j++) {
3896 z *= 10.;
3897 y = (int(z) % 10);
3898 s += itostring(y);
3899 }
3900
3901 return s;
3902}
Double_t x[10]
XmlRpcServer s
Definition: HelloServer.cpp:11

◆ TrackKinematics()

std::string TrackKinematics ( const Helix h)

Definition at line 3740 of file TTrack.cxx.

3740 {
3741 static const HepPoint3D IP(0., 0., 0.);
3742 Helix hIp = h;
3743 hIp.pivot(IP);
3744
3745 float chrg = hIp.a()[2] / fabs(hIp.a()[2]);
3746 std::string s;
3747 if (chrg > 0.) s = "+";
3748 else s = "-";
3749
3750 float x[4];
3751 x[0] = fabs(hIp.a()[0]);
3752 x[1] = hIp.a()[3];
3753 x[2] = 1. / fabs(hIp.a()[2]);
3754 x[3] = (1. / fabs(hIp.a()[2])) * hIp.a()[4];
3755
3756 if ((x[0] < 2.) && (fabs(x[1]) < 4.)) s += "i ";
3757 else s += " ";
3758
3759 for (unsigned i = 0; i < 4; i++) {
3760 if (i) s += " ";
3761
3762 if (x[i] < 0.) s += "-";
3763 else s += " ";
3764
3765 int y = int(fabs(x[i]));
3766 s += itostring(y) + ".";
3767 float z = fabs(x[i]);
3768 for (unsigned j = 0; j < 3; j++) {
3769 z *= 10.;
3770 y = (int(z) % 10);
3771 s += itostring(y);
3772 }
3773 }
3774
3775 return s;
3776}
const HepPoint3D & pivot(void) const
returns pivot position.

◆ TrackLayerUsage()

std::string TrackLayerUsage ( const TTrack t)

Definition at line 3905 of file TTrack.cxx.

3905 {
3906 unsigned n[11];
3907 NHitsSuperLayer(t.links(), n);
3908 std::string nh;
3909 for (unsigned i = 0; i < 11; i++) {
3910 nh += itostring(n[i]);
3911 if (i % 2) nh += "-";
3912 else if (i < 10) nh += ",";
3913 }
3914 return nh;
3915}

◆ TrackStatus() [1/4]

std::string TrackStatus ( const MdcRec_trk c)

Definition at line 3789 of file TTrack.cxx.

3789 {
3790// const reccdc_trk_add & a =
3791// * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, c.m_ID, BBS_No_Index);
3792// return TrackStatus(a);
3793}

◆ TrackStatus() [2/4]

std::string TrackStatus ( const MdcRec_trk_add a)

Definition at line 3796 of file TTrack.cxx.

3796 {
3797// return TrackStatus(a.decision,
3798// a.kind,
3799// a.quality,
3800// a.stat,
3801// a.mother,
3802// a.daughter);
3803}

◆ TrackStatus() [3/4]

std::string TrackStatus ( const TTrack t)

returns string of track status.

Definition at line 3779 of file TTrack.cxx.

3779 {
3780 return TrackStatus(t.finder(),
3781 t.type(),
3782 t.quality(),
3783 t.fitting(),
3784 0,
3785 0);
3786}
std::string TrackStatus(const TTrack &t)
returns string of track status.
Definition: TTrack.cxx:3779

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 3806 of file TTrack.cxx.

3811 {
3812
3813 std::string f;
3814 if (md & TrackOldConformalFinder) f += "o";
3815 if (md & TrackFastFinder) f += "f";
3816 if (md & TrackSlowFinder) f += "s";
3817 if (md & TrackCurlFinder) f += "c";
3818 if (md & TrackTrackManager) f += "t";
3819 if (f == "") f = "?";
3820
3821 std::string k;
3822 if (mk & TrackTypeNormal) k += "Norm";
3823 if (mk & TrackTypeCurl) k += "Curl";
3824 if (mk & TrackTypeCircle) k += "Circ";
3825 if (mk & TrackTypeIncomingCosmic) k += "Inco";
3826 if (mk & TrackTypeOutgoingCosmic) k += "Outc";
3827 if (mk & TrackTypeKink) k += "Kink";
3828 if (mk & TrackTypeSVDOnly) k += "Svd";
3829 if (k == "") k = "?";
3830
3831 std::string b;
3832 if (mq & TrackQualityOutsideCurler) b += "Curlback";
3833 if (mq & TrackQualityAfterKink) b += "Afterkink";
3834 if (mq & TrackQualityCosmic) b += "Cosmic";
3835 if (mq & TrackQuality2D) b += "2D";
3836 if (b == "") b = "ok";
3837
3838 std::string s;
3839 if (ms & TrackFitGlobal) s += "HFit";
3840 if (ms & TrackFitCosmic) s += "CFit";
3841 if (ms & TrackFitCdcKalman) s += "CKal";
3842 if (ms & TrackFitSvdCdcKalman) s += "SKal";
3843 if (s == "") s = "?";
3844
3845 int m = mm;
3846 if (m) --m;
3847
3848 int d = ma;
3849 if (d) --d;
3850
3851 std::string p = " ";
3852 return f + p + k + p + b + p + s + p + itostring(m) + p + itostring(d);
3853}
const double mk
Definition: Gam4pikp.cxx:48
#define TrackFitCosmic
Definition: TTrack.h:53
#define TrackFitCdcKalman
Definition: TTrack.h:54
#define TrackFitSvdCdcKalman
Definition: TTrack.h:55
#define TrackQualityAfterKink
Definition: TTrack.h:45
#define TrackTypeCircle
Definition: TTrack.h:36
#define TrackFastFinder
Definition: TTrack.h:24
#define TrackCurlFinder
Definition: TTrack.h:26
#define TrackTypeNormal
Definition: TTrack.h:34
#define TrackQuality2D
Definition: TTrack.h:47
#define TrackQualityCosmic
Definition: TTrack.h:46
#define TrackTypeKink
Definition: TTrack.h:40
#define TrackTrackManager
Definition: TTrack.h:27
#define TrackSlowFinder
Definition: TTrack.h:25
#define TrackTypeCurl
Definition: TTrack.h:35
#define TrackTypeIncomingCosmic
Definition: TTrack.h:38
#define TrackOldConformalFinder
Definition: TTrack.h:23
#define TrackTypeSVDOnly
Definition: TTrack.h:41
#define TrackQualityOutsideCurler
Definition: TTrack.h:44
#define TrackTypeOutgoingCosmic
Definition: TTrack.h:39
#define TrackFitGlobal
Definition: TTrack.h:52

◆ TrackType()

std::string TrackType ( unsigned  type)
inline

Definition at line 3030 of file TTrack.cxx.

3030 {
3031 switch (type) {
3032 case TrackTypeUndefined:
3033 return std::string("undefined");
3034 case TrackTypeNormal:
3035 return std::string("normal");
3036 case TrackTypeCurl:
3037 return std::string("curl ");
3038 case TrackTypeCircle:
3039 return std::string("circle");
3040 case TrackTypeCosmic:
3041 return std::string("cosmic");
3042 }
3043 return std::string("unknown ");
3044}
#define TrackTypeUndefined
Definition: TTrack.h:33
#define TrackTypeCosmic
Definition: TTrack.h:37