#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.
Defines | |
#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) |
#define HEP_SHORT_NAMES |
Definition at line 33 of file TTrack.cxx.
#define JJJTEST 0 |
#define JJTEST 0 |
#define NEW_FIT2D 1 |
Definition at line 940 of file TTrack.cxx.
#define OPTNK |
Definition at line 1 of file TTrack.cxx.
#define t_dot | ( | a, | |||
b | ) | (a[0]*b[0]+a[1]*b[1]+a[2]*b[2]) |
Definition at line 3047 of file TTrack.cxx.
#define t_dot2 | ( | a, | |||
b | ) | (a[0]*b[0]+a[1]*b[1]) |
Definition at line 3048 of file TTrack.cxx.
#define t_print | ( | a, | |||
b | ) | std::cout << b << " = " << a[0] << " " << a[1] << " " << a[2] << std::endl; |
Definition at line 3049 of file TTrack.cxx.
Helix parameter validity.
Definition at line 3934 of file TTrack.cxx.
References Helix::a(), and Helix::Ea().
Referenced by TTrackManager::goodTrack(), and TrackInformation().
03934 { 03935 const Vector & a = h.a(); 03936 for (unsigned i = 0; i < 5; i++) 03937 if (isnan(a[i])) 03938 return true; 03939 const SymMatrix & Ea = h.Ea(); 03940 for (unsigned i = 0; i < 5; i++) 03941 for (unsigned j = 0; j <= i; j++) 03942 if (isnan(Ea[i][j])) 03943 return true; 03944 return false; 03945 }
Error matrix validity.
Definition at line 3918 of file TTrack.cxx.
References Helix::Ea().
Referenced by TrackInformation().
03918 { 03919 const SymMatrix & e = h.Ea(); 03920 SymMatrix e2 = e.sub(1, 2); 03921 SymMatrix e3 = e.sub(1, 3); 03922 SymMatrix e4 = e.sub(1, 4); 03923 03924 bool positive = true; 03925 if (e[0][0] <= 0.) positive = false; 03926 else if (e2.determinant() <= 0.) positive = false; 03927 else if (e3.determinant() <= 0.) positive = false; 03928 else if (e4.determinant() <= 0.) positive = false; 03929 else if (e.determinant() <= 0.) positive = false; 03930 return positive; 03931 }
int SortByPt | ( | const void * | av, | |
const void * | bv | |||
) |
Utility functions.
Definition at line 2530 of file TTrack.cxx.
Referenced by TTrackManager::append2D().
02530 { 02531 const TTrack ** a((const TTrack **)av); 02532 const TTrack ** b((const TTrack **)bv); 02533 if ((* a)->pt() < (* b)->pt()) return 1; 02534 else if 02535 ((* a)->pt() == (* b)->pt()) return 0; 02536 else return -1; 02537 }
Helix Track2Helix | ( | const Gen_hepevt & | t | ) |
Definition at line 3948 of file TTrack.cxx.
03948 { 03949 float charge = 1; 03950 if (t.idhep == 11) charge = -1; 03951 else if (t.idhep == -11) charge = 1; 03952 else if (t.idhep == 13) charge = -1; 03953 else if (t.idhep == -13) charge = 1; 03954 else if (t.idhep == 211) charge = 1; 03955 else if (t.idhep == -211) charge = -1; 03956 else if (t.idhep == 321) charge = 1; 03957 else if (t.idhep == -321) charge = -1; 03958 else if (t.idhep == 2212) charge = 1; 03959 else if (t.idhep == -2212) charge = -1; 03960 else { 03961 std::cout << "Track2Helix(gen_hepevt) !!! charge of id="; 03962 std::cout << t.idhep << " is unknown" << std::endl; 03963 } 03964 03965 Hep3Vector mom(t.P[0], t.P[1], t.P[2]); 03966 Hep3Vector pos(t.V[0] / 10., t.V[1] / 10., t.V[2] / 10.); 03967 return Helix(pos, mom, charge); 03968 }
Helix Track2Helix | ( | const Mdst_trk_fit & | t | ) |
Definition at line 3712 of file TTrack.cxx.
03712 { 03713 HepVector a(5); 03714 Hep3Vector p(t.pivot_x, t.pivot_y, t.pivot_z); 03715 HepSymMatrix er(5,0); 03716 a(1) = t.helix[0]; 03717 a(2) = t.helix[1]; 03718 a(3) = t.helix[2]; 03719 a(4) = t.helix[3]; 03720 a(5) = t.helix[4]; 03721 er(1,1) = t.error[0]; 03722 er(2,1) = t.error[1]; 03723 er(2,2) = t.error[2]; 03724 er(3,1) = t.error[3]; 03725 er(3,2) = t.error[4]; 03726 er(3,3) = t.error[5]; 03727 er(4,1) = t.error[6]; 03728 er(4,2) = t.error[7]; 03729 er(4,3) = t.error[8]; 03730 er(4,4) = t.error[9]; 03731 er(5,1) = t.error[10]; 03732 er(5,2) = t.error[11]; 03733 er(5,3) = t.error[12]; 03734 er(5,4) = t.error[13]; 03735 er(5,5) = t.error[14]; 03736 return Helix(p, a, er); 03737 }
Helix Track2Helix | ( | const MdcRec_trk & | t | ) |
returns helix.
Definition at line 3684 of file TTrack.cxx.
03684 { 03685 HepVector a(5); 03686 Hep3Vector p(t.pivot[0], t.pivot[1], t.pivot[2]); 03687 HepSymMatrix er(5,0); 03688 a(1) = t.helix[0]; 03689 a(2) = t.helix[1]; 03690 a(3) = t.helix[2]; 03691 a(4) = t.helix[3]; 03692 a(5) = t.helix[4]; 03693 er(1,1) = t.error[0]; 03694 er(2,1) = t.error[1]; 03695 er(2,2) = t.error[2]; 03696 er(3,1) = t.error[3]; 03697 er(3,2) = t.error[4]; 03698 er(3,3) = t.error[5]; 03699 er(4,1) = t.error[6]; 03700 er(4,2) = t.error[7]; 03701 er(4,3) = t.error[8]; 03702 er(4,4) = t.error[9]; 03703 er(5,1) = t.error[10]; 03704 er(5,2) = t.error[11]; 03705 er(5,3) = t.error[12]; 03706 er(5,4) = t.error[13]; 03707 er(5,5) = t.error[14]; 03708 return Helix(p, a, er); 03709 }
Helix Track2Helix | ( | const MdcTrk_localz & | t | ) |
Definition at line 3656 of file TTrack.cxx.
Referenced by TrackInformation().
03656 { 03657 HepVector a(5); 03658 Hep3Vector p(t.pivot[0], t.pivot[1], t.pivot[2]); 03659 HepSymMatrix er(5,0); 03660 a(1) = t.helix[0]; 03661 a(2) = t.helix[1]; 03662 a(3) = t.helix[2]; 03663 a(4) = t.helix[3]; 03664 a(5) = t.helix[4]; 03665 er(1,1) = t.error[0]; 03666 er(2,1) = t.error[1]; 03667 er(2,2) = t.error[2]; 03668 er(3,1) = t.error[3]; 03669 er(3,2) = t.error[4]; 03670 er(3,3) = t.error[5]; 03671 er(4,1) = t.error[6]; 03672 er(4,2) = t.error[7]; 03673 er(4,3) = t.error[8]; 03674 er(4,4) = t.error[9]; 03675 er(5,1) = t.error[10]; 03676 er(5,2) = t.error[11]; 03677 er(5,3) = t.error[12]; 03678 er(5,4) = t.error[13]; 03679 er(5,5) = t.error[14]; 03680 return Helix(p, a, er); 03681 }
std::string TrackInformation | ( | unsigned | nA, | |
unsigned | nS, | |||
unsigned | n, | |||
float | chisq | |||
) |
Definition at line 3880 of file TTrack.cxx.
References s, and deljobs::string.
03880 { 03881 std::string s; 03882 03883 s += "a" + itostring(int(nA)); 03884 s += " s" + itostring(int(nS)); 03885 s += " n" + itostring(int(n)); 03886 // s += " ndf" + std::string(int(r.m_ndf)); 03887 float x = chisq; 03888 03889 if (x < 0.) s += " -"; 03890 else s += " "; 03891 03892 int y = int(fabs(x)); 03893 s += itostring(y) + "."; 03894 float z = fabs(x); 03895 for (unsigned j = 0; j < 1; j++) { 03896 z *= 10.; 03897 y = (int(z) % 10); 03898 s += itostring(y); 03899 } 03900 03901 return s; 03902 }
std::string TrackInformation | ( | const MdcRec_trk & | r | ) |
Definition at line 3868 of file TTrack.cxx.
03868 { 03869 std::string p; 03870 if (PositiveDefinite(Track2Helix(r))) p = " posi"; 03871 else p = " nega"; 03872 if (HelixHasNan(Track2Helix(r))) p += " with NaN"; 03873 return TrackInformation(r.nhits - r.nster, 03874 r.nster, 03875 r.nhits, 03876 r.chiSq) + p; 03877 }
std::string TrackInformation | ( | const TTrack & | t | ) |
Definition at line 3856 of file TTrack.cxx.
Referenced by TrackDump(), and TrackInformation().
03856 { 03857 const AList<TMLink> cores = t.cores(); 03858 unsigned n = cores.length(); 03859 unsigned nS = NStereoHits(cores); 03860 unsigned nA = n - nS; 03861 std::string p; 03862 if (! PositiveDefinite(t.helix())) p = " negative"; 03863 if (HelixHasNan(t.helix())) p += " NaN"; 03864 return TrackInformation(nA, nS, n, t.chi2()) + p; 03865 }
std::string TrackKinematics | ( | const Helix & | h | ) |
Definition at line 3740 of file TTrack.cxx.
References Helix::a(), Helix::pivot(), s, and deljobs::string.
Referenced by TrackDump(), and TrackKinematics().
03740 { 03741 static const HepPoint3D IP(0., 0., 0.); 03742 Helix hIp = h; 03743 hIp.pivot(IP); 03744 03745 float chrg = hIp.a()[2] / fabs(hIp.a()[2]); 03746 std::string s; 03747 if (chrg > 0.) s = "+"; 03748 else s = "-"; 03749 03750 float x[4]; 03751 x[0] = fabs(hIp.a()[0]); 03752 x[1] = hIp.a()[3]; 03753 x[2] = 1. / fabs(hIp.a()[2]); 03754 x[3] = (1. / fabs(hIp.a()[2])) * hIp.a()[4]; 03755 03756 if ((x[0] < 2.) && (fabs(x[1]) < 4.)) s += "i "; 03757 else s += " "; 03758 03759 for (unsigned i = 0; i < 4; i++) { 03760 if (i) s += " "; 03761 03762 if (x[i] < 0.) s += "-"; 03763 else s += " "; 03764 03765 int y = int(fabs(x[i])); 03766 s += itostring(y) + "."; 03767 float z = fabs(x[i]); 03768 for (unsigned j = 0; j < 3; j++) { 03769 z *= 10.; 03770 y = (int(z) % 10); 03771 s += itostring(y); 03772 } 03773 } 03774 03775 return s; 03776 }
std::string TrackLayerUsage | ( | const TTrack & | t | ) |
Definition at line 3905 of file TTrack.cxx.
References NHitsSuperLayer(), deljobs::string, and t().
03905 { 03906 unsigned n[11]; 03907 NHitsSuperLayer(t.links(), n); 03908 std::string nh; 03909 for (unsigned i = 0; i < 11; i++) { 03910 nh += itostring(n[i]); 03911 if (i % 2) nh += "-"; 03912 else if (i < 10) nh += ","; 03913 } 03914 return nh; 03915 }
std::string TrackStatus | ( | unsigned | md, | |
unsigned | mk, | |||
unsigned | mq, | |||
unsigned | ms, | |||
unsigned | mm, | |||
unsigned | ma | |||
) |
Definition at line 3806 of file TTrack.cxx.
References s, deljobs::string, TrackCurlFinder, TrackFastFinder, TrackFitCdcKalman, TrackFitCosmic, TrackFitGlobal, TrackFitSvdCdcKalman, TrackOldConformalFinder, TrackQuality2D, TrackQualityAfterKink, TrackQualityCosmic, TrackQualityOutsideCurler, TrackSlowFinder, TrackTrackManager, TrackTypeCircle, TrackTypeCurl, TrackTypeIncomingCosmic, TrackTypeKink, TrackTypeNormal, TrackTypeOutgoingCosmic, and TrackTypeSVDOnly.
03811 { 03812 03813 std::string f; 03814 if (md & TrackOldConformalFinder) f += "o"; 03815 if (md & TrackFastFinder) f += "f"; 03816 if (md & TrackSlowFinder) f += "s"; 03817 if (md & TrackCurlFinder) f += "c"; 03818 if (md & TrackTrackManager) f += "t"; 03819 if (f == "") f = "?"; 03820 03821 std::string k; 03822 if (mk & TrackTypeNormal) k += "Norm"; 03823 if (mk & TrackTypeCurl) k += "Curl"; 03824 if (mk & TrackTypeCircle) k += "Circ"; 03825 if (mk & TrackTypeIncomingCosmic) k += "Inco"; 03826 if (mk & TrackTypeOutgoingCosmic) k += "Outc"; 03827 if (mk & TrackTypeKink) k += "Kink"; 03828 if (mk & TrackTypeSVDOnly) k += "Svd"; 03829 if (k == "") k = "?"; 03830 03831 std::string b; 03832 if (mq & TrackQualityOutsideCurler) b += "Curlback"; 03833 if (mq & TrackQualityAfterKink) b += "Afterkink"; 03834 if (mq & TrackQualityCosmic) b += "Cosmic"; 03835 if (mq & TrackQuality2D) b += "2D"; 03836 if (b == "") b = "ok"; 03837 03838 std::string s; 03839 if (ms & TrackFitGlobal) s += "HFit"; 03840 if (ms & TrackFitCosmic) s += "CFit"; 03841 if (ms & TrackFitCdcKalman) s += "CKal"; 03842 if (ms & TrackFitSvdCdcKalman) s += "SKal"; 03843 if (s == "") s = "?"; 03844 03845 int m = mm; 03846 if (m) --m; 03847 03848 int d = ma; 03849 if (d) --d; 03850 03851 std::string p = " "; 03852 return f + p + k + p + b + p + s + p + itostring(m) + p + itostring(d); 03853 }
std::string TrackStatus | ( | const MdcRec_trk_add & | a | ) |
Definition at line 3796 of file TTrack.cxx.
03796 { 03797 // return TrackStatus(a.decision, 03798 // a.kind, 03799 // a.quality, 03800 // a.stat, 03801 // a.mother, 03802 // a.daughter); 03803 }
std::string TrackStatus | ( | const MdcRec_trk & | c | ) |
Definition at line 3789 of file TTrack.cxx.
03789 { 03790 // const reccdc_trk_add & a = 03791 // * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, c.m_ID, BBS_No_Index); 03792 // return TrackStatus(a); 03793 }
std::string TrackStatus | ( | const TTrack & | t | ) |
returns string of track status.
Definition at line 3779 of file TTrack.cxx.
Referenced by TrackDump(), and TrackStatus().
03779 { 03780 return TrackStatus(t.finder(), 03781 t.type(), 03782 t.quality(), 03783 t.fitting(), 03784 0, 03785 0); 03786 }
std::string TrackType | ( | unsigned | type | ) | [inline] |
Definition at line 3030 of file TTrack.cxx.
References deljobs::string, TrackTypeCircle, TrackTypeCosmic, TrackTypeCurl, TrackTypeNormal, and TrackTypeUndefined.
Referenced by TrackType().
03030 { 03031 switch (type) { 03032 case TrackTypeUndefined: 03033 return std::string("undefined"); 03034 case TrackTypeNormal: 03035 return std::string("normal"); 03036 case TrackTypeCurl: 03037 return std::string("curl "); 03038 case TrackTypeCircle: 03039 return std::string("circle"); 03040 case TrackTypeCosmic: 03041 return std::string("cosmic"); 03042 } 03043 return std::string("unknown "); 03044 }