#include <string>
#include "CLHEP/Vector/ThreeVector.h"
#include "TrackUtil/Helix.h"
#include "TrkReco/TMDCUtil.h"
#include "TrkReco/TTrackBase.h"
#include "TrkReco/TMLink.h"
#include "TrkReco/TBuilder0.h"
#include "TrkReco/TBuilderCosmic.h"
#include "TrkReco/TBuilderCurl.h"
#include "TrkReco/TPoint2D.h"
#include "TrkReco/T3DLine.h"
#include "GaudiKernel/IInterface.h"
#include "GaudiKernel/Kernel.h"
#include "GaudiKernel/Service.h"
#include "MagneticField/IMagneticFieldSvc.h"
#include "MagneticField/MagneticFieldSvc.h"
#include "CLHEP/Matrix/Vector.h"
#include "CLHEP/Matrix/SymMatrix.h"
#include "CLHEP/Vector/LorentzVector.h"
#include "CLHEP/Geometry/Point3D.h"
Go to the source code of this file.
Classes | |
class | TTrack |
A class to represent a track in tracking. More... | |
Defines | |
#define | HEP_SHORT_NAMES |
#define | OLD_STEREO 1 |
calculates arc length and z for a stereo hit. uses these functions for curl tracks. | |
#define | TrackCurlFinder 8 |
#define | TrackFastFinder 2 |
#define | TrackFinderMask 255 |
#define | TrackFitCdcKalman 4 |
#define | TrackFitCosmic 2 |
#define | TrackFitGlobal 1 |
#define | TrackFitMask 255 |
#define | TrackFitShift 16 |
#define | TrackFitSvdCdcKalman 8 |
#define | TrackHasDaughter 2 |
#define | TrackHasMother 1 |
#define | TrackOldConformalFinder 1 |
#define | TrackPMCurlFinder 32 |
#define | TrackQuality2D 8 |
#define | TrackQualityAfterKink 2 |
#define | TrackQualityCosmic 4 |
#define | TrackQualityMask 255 |
#define | TrackQualityOutsideCurler 1 |
#define | TrackQualityShift 8 |
#define | TrackRelationMask 255 |
#define | TrackRelationShift 24 |
#define | TrackSlowFinder 4 |
#define | TrackSVDAssociator 64 |
#define | TrackTrackManager 16 |
#define | TrackTypeCircle 4 |
#define | TrackTypeCosmic 8 |
#define | TrackTypeCurl 2 |
#define | TrackTypeIncomingCosmic 8 |
#define | TrackTypeKink 32 |
#define | TrackTypeNormal 1 |
#define | TrackTypeOutgoingCosmic 16 |
#define | TrackTypeSVDOnly 256 |
#define | TrackTypeUndefined 0 |
#define | TTrack_INLINE_DEFINE_HERE |
Typedefs | |
typedef HepGeom::Point3D< double > | HepPoint3D |
Functions | |
bool | HelixHasNan (const Helix &) |
Helix parameter validity. | |
bool | PositiveDefinite (const Helix &) |
Error matrix validity. | |
int | SortByPt (const void *a, const void *b) |
Utility functions. | |
Helix | Track2Helix (const Mdst_trk_fit &) |
Helix | Track2Helix (const Gen_hepevt &) |
Helix | Track2Helix (const MdcTrk_localz &) |
Helix | Track2Helix (const MdcRec_trk &) |
returns helix. | |
std::string | TrackDump (const TTrack &) |
to dump a track. | |
std::string | TrackInformation (unsigned nA, unsigned nS, unsigned n, float chisq) |
std::string | TrackInformation (const MdcRec_trk &) |
std::string | TrackInformation (const TTrack &) |
std::string | TrackKinematics (const Helix &) |
std::string | TrackKinematics (const TTrack &) |
std::string | TrackLayerUsage (const TTrack &) |
std::string | TrackStatus (unsigned md, unsigned mk, unsigned mq, unsigned ms, unsigned mm, unsigned ma) |
std::string | TrackStatus (const MdcRec_trk_add &) |
std::string | TrackStatus (const MdcRec_trk &) |
std::string | TrackStatus (const TTrack &) |
returns string of track status. | |
std::string | TrackType (unsigned type) |
std::string | TrackType (const TTrack &) |
returns string of track type. |
|
|
|
calculates arc length and z for a stereo hit. uses these functions for curl tracks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Helix parameter validity.
03862 { 03863 const Vector & a = h.a(); 03864 for (unsigned i = 0; i < 5; i++) 03865 if (isnan(a[i])) 03866 return true; 03867 const SymMatrix & Ea = h.Ea(); 03868 for (unsigned i = 0; i < 5; i++) 03869 for (unsigned j = 0; j <= i; j++) 03870 if (isnan(Ea[i][j])) 03871 return true; 03872 return false; 03873 }
|
|
Error matrix validity.
03846 { 03847 const SymMatrix & e = h.Ea(); 03848 SymMatrix e2 = e.sub(1, 2); 03849 SymMatrix e3 = e.sub(1, 3); 03850 SymMatrix e4 = e.sub(1, 4); 03851 03852 bool positive = true; 03853 if (e[0][0] <= 0.) positive = false; 03854 else if (e2.determinant() <= 0.) positive = false; 03855 else if (e3.determinant() <= 0.) positive = false; 03856 else if (e4.determinant() <= 0.) positive = false; 03857 else if (e.determinant() <= 0.) positive = false; 03858 return positive; 03859 }
|
|
Utility functions.
02511 { 02512 const TTrack ** a((const TTrack **)av); 02513 const TTrack ** b((const TTrack **)bv); 02514 if ((* a)->pt() < (* b)->pt()) return 1; 02515 else if 02516 ((* a)->pt() == (* b)->pt()) return 0; 02517 else return -1; 02518 }
|
|
03640 { 03641 HepVector a(5); 03642 Hep3Vector p(t.pivot_x, t.pivot_y, t.pivot_z); 03643 HepSymMatrix er(5,0); 03644 a(1) = t.helix[0]; 03645 a(2) = t.helix[1]; 03646 a(3) = t.helix[2]; 03647 a(4) = t.helix[3]; 03648 a(5) = t.helix[4]; 03649 er(1,1) = t.error[0]; 03650 er(2,1) = t.error[1]; 03651 er(2,2) = t.error[2]; 03652 er(3,1) = t.error[3]; 03653 er(3,2) = t.error[4]; 03654 er(3,3) = t.error[5]; 03655 er(4,1) = t.error[6]; 03656 er(4,2) = t.error[7]; 03657 er(4,3) = t.error[8]; 03658 er(4,4) = t.error[9]; 03659 er(5,1) = t.error[10]; 03660 er(5,2) = t.error[11]; 03661 er(5,3) = t.error[12]; 03662 er(5,4) = t.error[13]; 03663 er(5,5) = t.error[14]; 03664 return Helix(p, a, er); 03665 }
|
|
03876 { 03877 float charge = 1; 03878 if (t.idhep == 11) charge = -1; 03879 else if (t.idhep == -11) charge = 1; 03880 else if (t.idhep == 13) charge = -1; 03881 else if (t.idhep == -13) charge = 1; 03882 else if (t.idhep == 211) charge = 1; 03883 else if (t.idhep == -211) charge = -1; 03884 else if (t.idhep == 321) charge = 1; 03885 else if (t.idhep == -321) charge = -1; 03886 else if (t.idhep == 2212) charge = 1; 03887 else if (t.idhep == -2212) charge = -1; 03888 else { 03889 std::cout << "Track2Helix(gen_hepevt) !!! charge of id="; 03890 std::cout << t.idhep << " is unknown" << std::endl; 03891 } 03892 03893 Hep3Vector mom(t.P[0], t.P[1], t.P[2]); 03894 Hep3Vector pos(t.V[0] / 10., t.V[1] / 10., t.V[2] / 10.); 03895 return Helix(pos, mom, charge); 03896 }
|
|
03584 { 03585 HepVector a(5); 03586 Hep3Vector p(t.pivot[0], t.pivot[1], t.pivot[2]); 03587 HepSymMatrix er(5,0); 03588 a(1) = t.helix[0]; 03589 a(2) = t.helix[1]; 03590 a(3) = t.helix[2]; 03591 a(4) = t.helix[3]; 03592 a(5) = t.helix[4]; 03593 er(1,1) = t.error[0]; 03594 er(2,1) = t.error[1]; 03595 er(2,2) = t.error[2]; 03596 er(3,1) = t.error[3]; 03597 er(3,2) = t.error[4]; 03598 er(3,3) = t.error[5]; 03599 er(4,1) = t.error[6]; 03600 er(4,2) = t.error[7]; 03601 er(4,3) = t.error[8]; 03602 er(4,4) = t.error[9]; 03603 er(5,1) = t.error[10]; 03604 er(5,2) = t.error[11]; 03605 er(5,3) = t.error[12]; 03606 er(5,4) = t.error[13]; 03607 er(5,5) = t.error[14]; 03608 return Helix(p, a, er); 03609 }
|
|
returns helix.
03612 { 03613 HepVector a(5); 03614 Hep3Vector p(t.pivot[0], t.pivot[1], t.pivot[2]); 03615 HepSymMatrix er(5,0); 03616 a(1) = t.helix[0]; 03617 a(2) = t.helix[1]; 03618 a(3) = t.helix[2]; 03619 a(4) = t.helix[3]; 03620 a(5) = t.helix[4]; 03621 er(1,1) = t.error[0]; 03622 er(2,1) = t.error[1]; 03623 er(2,2) = t.error[2]; 03624 er(3,1) = t.error[3]; 03625 er(3,2) = t.error[4]; 03626 er(3,3) = t.error[5]; 03627 er(4,1) = t.error[6]; 03628 er(4,2) = t.error[7]; 03629 er(4,3) = t.error[8]; 03630 er(4,4) = t.error[9]; 03631 er(5,1) = t.error[10]; 03632 er(5,2) = t.error[11]; 03633 er(5,3) = t.error[12]; 03634 er(5,4) = t.error[13]; 03635 er(5,5) = t.error[14]; 03636 return Helix(p, a, er); 03637 }
|
|
to dump a track.
|
|
03808 { 03809 std::string s; 03810 03811 s += "a" + itostring(int(nA)); 03812 s += " s" + itostring(int(nS)); 03813 s += " n" + itostring(int(n)); 03814 // s += " ndf" + std::string(int(r.m_ndf)); 03815 float x = chisq; 03816 03817 if (x < 0.) s += " -"; 03818 else s += " "; 03819 03820 int y = int(fabs(x)); 03821 s += itostring(y) + "."; 03822 float z = fabs(x); 03823 for (unsigned j = 0; j < 1; j++) { 03824 z *= 10.; 03825 y = (int(z) % 10); 03826 s += itostring(y); 03827 } 03828 03829 return s; 03830 }
|
|
03796 { 03797 std::string p; 03798 if (PositiveDefinite(Track2Helix(r))) p = " posi"; 03799 else p = " nega"; 03800 if (HelixHasNan(Track2Helix(r))) p += " with NaN"; 03801 return TrackInformation(r.nhits - r.nster, 03802 r.nster, 03803 r.nhits, 03804 r.chiSq) + p; 03805 }
|
|
03784 { 03785 const AList<TMLink> cores = t.cores(); 03786 unsigned n = cores.length(); 03787 unsigned nS = NStereoHits(cores); 03788 unsigned nA = n - nS; 03789 std::string p; 03790 if (! PositiveDefinite(t.helix())) p = " negative"; 03791 if (HelixHasNan(t.helix())) p += " NaN"; 03792 return TrackInformation(nA, nS, n, t.chi2()) + p; 03793 }
|
|
03668 { 03669 static const HepPoint3D IP(0., 0., 0.); 03670 Helix hIp = h; 03671 hIp.pivot(IP); 03672 03673 float chrg = hIp.a()[2] / fabs(hIp.a()[2]); 03674 std::string s; 03675 if (chrg > 0.) s = "+"; 03676 else s = "-"; 03677 03678 float x[4]; 03679 x[0] = fabs(hIp.a()[0]); 03680 x[1] = hIp.a()[3]; 03681 x[2] = 1. / fabs(hIp.a()[2]); 03682 x[3] = (1. / fabs(hIp.a()[2])) * hIp.a()[4]; 03683 03684 if ((x[0] < 2.) && (fabs(x[1]) < 4.)) s += "i "; 03685 else s += " "; 03686 03687 for (unsigned i = 0; i < 4; i++) { 03688 if (i) s += " "; 03689 03690 if (x[i] < 0.) s += "-"; 03691 else s += " "; 03692 03693 int y = int(fabs(x[i])); 03694 s += itostring(y) + "."; 03695 float z = fabs(x[i]); 03696 for (unsigned j = 0; j < 3; j++) { 03697 z *= 10.; 03698 y = (int(z) % 10); 03699 s += itostring(y); 03700 } 03701 } 03702 03703 return s; 03704 }
|
|
|
|
03833 { 03834 unsigned n[11]; 03835 NHitsSuperLayer(t.links(), n); 03836 std::string nh; 03837 for (unsigned i = 0; i < 11; i++) { 03838 nh += itostring(n[i]); 03839 if (i % 2) nh += "-"; 03840 else if (i < 10) nh += ","; 03841 } 03842 return nh; 03843 }
|
|
03739 { 03740 03741 std::string f; 03742 if (md & TrackOldConformalFinder) f += "o"; 03743 if (md & TrackFastFinder) f += "f"; 03744 if (md & TrackSlowFinder) f += "s"; 03745 if (md & TrackCurlFinder) f += "c"; 03746 if (md & TrackTrackManager) f += "t"; 03747 if (f == "") f = "?"; 03748 03749 std::string k; 03750 if (mk & TrackTypeNormal) k += "Norm"; 03751 if (mk & TrackTypeCurl) k += "Curl"; 03752 if (mk & TrackTypeCircle) k += "Circ"; 03753 if (mk & TrackTypeIncomingCosmic) k += "Inco"; 03754 if (mk & TrackTypeOutgoingCosmic) k += "Outc"; 03755 if (mk & TrackTypeKink) k += "Kink"; 03756 if (mk & TrackTypeSVDOnly) k += "Svd"; 03757 if (k == "") k = "?"; 03758 03759 std::string b; 03760 if (mq & TrackQualityOutsideCurler) b += "Curlback"; 03761 if (mq & TrackQualityAfterKink) b += "Afterkink"; 03762 if (mq & TrackQualityCosmic) b += "Cosmic"; 03763 if (mq & TrackQuality2D) b += "2D"; 03764 if (b == "") b = "ok"; 03765 03766 std::string s; 03767 if (ms & TrackFitGlobal) s += "HFit"; 03768 if (ms & TrackFitCosmic) s += "CFit"; 03769 if (ms & TrackFitCdcKalman) s += "CKal"; 03770 if (ms & TrackFitSvdCdcKalman) s += "SKal"; 03771 if (s == "") s = "?"; 03772 03773 int m = mm; 03774 if (m) --m; 03775 03776 int d = ma; 03777 if (d) --d; 03778 03779 std::string p = " "; 03780 return f + p + k + p + b + p + s + p + itostring(m) + p + itostring(d); 03781 }
|
|
03724 { 03725 // return TrackStatus(a.decision, 03726 // a.kind, 03727 // a.quality, 03728 // a.stat, 03729 // a.mother, 03730 // a.daughter); 03731 }
|
|
03717 { 03718 // const reccdc_trk_add & a = 03719 // * (reccdc_trk_add *) BsGetEnt(RECMDC_TRK_ADD, c.m_ID, BBS_No_Index); 03720 // return TrackStatus(a); 03721 }
|
|
returns string of track status.
03707 { 03708 return TrackStatus(t.finder(), 03709 t.type(), 03710 t.quality(), 03711 t.fitting(), 03712 0, 03713 0); 03714 }
|
|
03009 { 03010 switch (type) { 03011 case TrackTypeUndefined: 03012 return std::string("undefined"); 03013 case TrackTypeNormal: 03014 return std::string("normal"); 03015 case TrackTypeCurl: 03016 return std::string("curl "); 03017 case TrackTypeCircle: 03018 return std::string("circle"); 03019 case TrackTypeCosmic: 03020 return std::string("cosmic"); 03021 } 03022 return std::string("unknown "); 03023 }
|
|
returns string of track type.
|