Public Types | Public Member Functions | Private Attributes | List of all members
trkf::KFitTrack Class Reference

#include <KFitTrack.h>

Inheritance diagram for trkf::KFitTrack:
trkf::KETrack trkf::KTrack trkf::KHitsTrack trkf::KHitTrack

Public Types

enum  FitStatus {
  INVALID, UNKNOWN, FORWARD, FORWARD_PREDICTED,
  BACKWARD, BACKWARD_PREDICTED, OPTIMAL, OPTIMAL_PREDICTED
}
 Fit status enum. More...
 

Public Member Functions

 KFitTrack ()
 Default constructor. More...
 
 KFitTrack (const KETrack &tre, double s=0., double chisq=0., FitStatus stat=INVALID)
 Initializing constructor. More...
 
virtual ~KFitTrack ()
 Destructor. More...
 
double getPath () const
 Propagation distance. More...
 
double getChisq () const
 Fit chisquare. More...
 
FitStatus getStat () const
 Fit status. More...
 
void setPath (double path)
 Set propagation distance. More...
 
void setChisq (double chisq)
 Set chisquare. More...
 
void setStat (FitStatus stat)
 Set fit status. More...
 
bool combineFit (const KFitTrack &trf)
 Combine two tracks. More...
 
virtual std::ostream & Print (std::ostream &out, bool doTitle=true) const
 Printout. More...
 
- Public Member Functions inherited from trkf::KETrack
 KETrack ()
 Default constructor. More...
 
 KETrack (const std::shared_ptr< const Surface > &psurf)
 Constructor - specify surface only. More...
 
 KETrack (const std::shared_ptr< const Surface > &psurf, const TrackVector &vec, const TrackError &err, Surface::TrackDirection dir=Surface::UNKNOWN, int pdg=0)
 Constructor - surface + track parameters + error matrix. More...
 
 KETrack (const KTrack &trk, const TrackError &err)
 Constructor - KTrack + error matrix. More...
 
virtual ~KETrack ()
 Destructor. More...
 
const TrackErrorgetError () const
 Track error matrix. More...
 
double PointingError () const
 Pointing error (radians). More...
 
TrackErrorgetError ()
 Modifiable error matrix. More...
 
void setError (const TrackError &err)
 Set error matrix. More...
 
std::optional< double > combineTrack (const KETrack &tre)
 Combine two tracks. More...
 
- Public Member Functions inherited from trkf::KTrack
 KTrack ()
 Enum. More...
 
 KTrack (const std::shared_ptr< const Surface > &psurf)
 Constructor - specify surface only. More...
 
 KTrack (std::shared_ptr< const Surface > psurf, const TrackVector &vec, Surface::TrackDirection dir=Surface::UNKNOWN, int pdg=0)
 Constructor - surface + track parameters. More...
 
virtual ~KTrack ()
 Destructor. More...
 
const std::shared_ptr< const Surface > & getSurface () const
 Surface. More...
 
const TrackVectorgetVector () const
 Track state vector. More...
 
Surface::TrackDirection getDirection () const
 Track direction. More...
 
int PdgCode () const
 Pdg code. More...
 
double Mass () const
 Based on pdg code. More...
 
TrackVectorgetVector ()
 Modifiable state vector. More...
 
void setSurface (const std::shared_ptr< const Surface > &psurf)
 Set surface. More...
 
void setVector (const TrackVector &vec)
 Set state vector. More...
 
void setDirection (Surface::TrackDirection dir)
 Set direction. More...
 
void setPdgCode (int pdg)
 Set pdg code. More...
 
bool isValid () const
 Test if track is valid. More...
 
void getPosition (double xyz[3]) const
 Get position of track. More...
 
void getMomentum (double mom[3]) const
 Get momentum vector of track. More...
 
double XLatitude () const
 Get x-latitude. More...
 
double XLongitude () const
 Get x-longitude. More...
 

Private Attributes

double fPath
 Propagation distance. More...
 
double fChisq
 Fit chisquare. More...
 
FitStatus fStat
 Fit status. More...
 

Detailed Description

Definition at line 36 of file KFitTrack.h.

Member Enumeration Documentation

Fit status enum.

Enumerator
INVALID 
UNKNOWN 
FORWARD 
FORWARD_PREDICTED 
BACKWARD 
BACKWARD_PREDICTED 
OPTIMAL 
OPTIMAL_PREDICTED 

Definition at line 41 of file KFitTrack.h.

41  {
42  INVALID, // No valid fit information.
43  UNKNOWN, // Unknown.
44  FORWARD, // Fit based on past measurements, including current surface.
45  FORWARD_PREDICTED, // Fit based on past measurements, not including current surface.
46  BACKWARD, // Fit based on future measurements, including current surface.
47  BACKWARD_PREDICTED, // Fit based on future measurements, not including current surface.
48  OPTIMAL, // Fit based on all measurements, including current surface.
49  OPTIMAL_PREDICTED // Fit based on all measurements, except current surface.
50  };

Constructor & Destructor Documentation

trkf::KFitTrack::KFitTrack ( )

Default constructor.

Definition at line 17 of file KFitTrack.cxx.

17 : fPath(0.), fChisq(0.), fStat(INVALID) {}
FitStatus fStat
Fit status.
Definition: KFitTrack.h:88
double fChisq
Fit chisquare.
Definition: KFitTrack.h:87
double fPath
Propagation distance.
Definition: KFitTrack.h:86
trkf::KFitTrack::KFitTrack ( const KETrack tre,
double  s = 0.,
double  chisq = 0.,
FitStatus  stat = INVALID 
)

Initializing constructor.

Initializing constructor.

Arguments:

tre - KETrack. s - Path distance. chisq - Fit chisquare. stat - Fit status.

Definition at line 28 of file KFitTrack.cxx.

29  : KETrack(tre), fPath(s), fChisq(chisq), fStat(stat)
30  {}
KETrack()
Default constructor.
Definition: KETrack.cxx:18
FitStatus fStat
Fit status.
Definition: KFitTrack.h:88
double fChisq
Fit chisquare.
Definition: KFitTrack.h:87
double fPath
Propagation distance.
Definition: KFitTrack.h:86
static QCString * s
Definition: config.cpp:1042
trkf::KFitTrack::~KFitTrack ( )
virtual

Destructor.

Definition at line 33 of file KFitTrack.cxx.

33 {}

Member Function Documentation

bool trkf::KFitTrack::combineFit ( const KFitTrack trf)

Combine two tracks.

Combine two tracks.

Arguments:

trf - Another track.

Returns: True if success.

This method updates the current track to be the weighted average of itself and another track. Track parameters and error matrix are updated by method KETrack::combineTrack. The updated chissquare is the sum of the original chisquare, the chisquare from the other track, and the chisquare of the combination. The path distance is not updated.

The updated status is derived from the input status according to the following table.

FORWARD + BACKWARD_PREDICTED = OPTIMAL FORWARD_PREDICTED + BACKWARD = OPTIMAL FORWARD_PREDICTED + BACKWARD_PREDICTED = OPTIMAL_PREDICTED

Any other combination of input statuses will cause this method to return failure. This method can also return failure because of singular error matrices. In case of failure, the original track is not updated.

The two tracks being combined should be on the same surface (throw exception if not).

Definition at line 66 of file KFitTrack.cxx.

67  {
68  // Make sure that the two track surfaces are the same.
69  // Throw an exception if they are not.
70 
71  if (!getSurface()->isEqual(*trf.getSurface()))
72  throw cet::exception("KFitTrack") << "Track combination surfaces are not the same.\n";
73 
74  // Default result failure.
75 
76  bool result = false;
77 
78  // Make sure input statuses are compatible and figure out the
79  // updated status.
80 
81  FitStatus stat1 = getStat();
82  FitStatus stat2 = trf.getStat();
83  FitStatus statu = UNKNOWN;
84  if ((stat1 == FORWARD && stat2 == BACKWARD_PREDICTED) ||
85  (stat1 == FORWARD_PREDICTED && stat2 == BACKWARD) ||
86  (stat1 == BACKWARD && stat2 == FORWARD_PREDICTED) ||
87  (stat1 == BACKWARD_PREDICTED && stat2 == FORWARD))
88  statu = OPTIMAL;
89  else if (stat1 == FORWARD_PREDICTED && stat2 == BACKWARD_PREDICTED)
90  statu = OPTIMAL_PREDICTED;
91  else
92  statu = UNKNOWN;
93  if (statu != UNKNOWN) {
94 
95  // Update track parameters and error matrix.
96 
97  std::optional<double> chisq = combineTrack(trf);
98 
99  // Update status and chisquare.
100 
101  if (!!chisq) {
102  result = true;
103  fStat = statu;
104  fChisq = fChisq + trf.getChisq() + *chisq;
105  }
106  }
107 
108  // Done.
109 
110  return result;
111  }
bool isEqual(float x1, float x2)
const std::shared_ptr< const Surface > & getSurface() const
Surface.
Definition: KTrack.h:55
static QCString result
FitStatus
Fit status enum.
Definition: KFitTrack.h:41
FitStatus fStat
Fit status.
Definition: KFitTrack.h:88
std::optional< double > combineTrack(const KETrack &tre)
Combine two tracks.
Definition: KETrack.cxx:89
double fChisq
Fit chisquare.
Definition: KFitTrack.h:87
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
FitStatus getStat() const
Fit status.
Definition: KFitTrack.h:68
double trkf::KFitTrack::getChisq ( ) const
inline

Fit chisquare.

Definition at line 67 of file KFitTrack.h.

double trkf::KFitTrack::getPath ( ) const
inline

Propagation distance.

Definition at line 66 of file KFitTrack.h.

FitStatus trkf::KFitTrack::getStat ( ) const
inline

Fit status.

Definition at line 68 of file KFitTrack.h.

std::ostream & trkf::KFitTrack::Print ( std::ostream &  out,
bool  doTitle = true 
) const
virtual

Printout.

Reimplemented from trkf::KETrack.

Reimplemented in trkf::KHitsTrack, and trkf::KHitTrack.

Definition at line 115 of file KFitTrack.cxx.

116  {
117  if (doTitle) out << "KFitTrack:\n";
118 
119  // Print information specific to this class.
120 
121  out << " Distance = " << fPath << "\n";
122  out << " Chisquare = " << fChisq << "\n";
123  out << " Status = "
124  << (fStat == INVALID ?
125  "INVALID" :
126  (fStat == UNKNOWN ?
127  "UNKNOWN" :
128  (fStat == FORWARD ?
129  "FORWARD" :
130  (fStat == FORWARD_PREDICTED ?
131  "FORWARD_PREDICTED" :
132  (fStat == BACKWARD ?
133  "BACKWARD" :
134  (fStat == BACKWARD_PREDICTED ?
135  "BACKWARD_PREDICTED" :
136  (fStat == OPTIMAL ? "OPTIMAL" : "OPTIMAL_PREDICTED")))))))
137  << "\n";
138 
139  // Print base class.
140 
141  KETrack::Print(out, false);
142  return out;
143  }
FitStatus fStat
Fit status.
Definition: KFitTrack.h:88
double fChisq
Fit chisquare.
Definition: KFitTrack.h:87
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
Definition: KETrack.cxx:182
double fPath
Propagation distance.
Definition: KFitTrack.h:86
void trkf::KFitTrack::setChisq ( double  chisq)
inline

Set chisquare.

Definition at line 73 of file KFitTrack.h.

void trkf::KFitTrack::setPath ( double  path)
inline

Set propagation distance.

Definition at line 72 of file KFitTrack.h.

void trkf::KFitTrack::setStat ( FitStatus  stat)
inline

Set fit status.

Definition at line 74 of file KFitTrack.h.

Member Data Documentation

double trkf::KFitTrack::fChisq
private

Fit chisquare.

Definition at line 87 of file KFitTrack.h.

double trkf::KFitTrack::fPath
private

Propagation distance.

Definition at line 86 of file KFitTrack.h.

FitStatus trkf::KFitTrack::fStat
private

Fit status.

Definition at line 88 of file KFitTrack.h.


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