BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/TrkBase/include/TrkBase/TrkDifPieceTraj.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkDifPieceTraj.h,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $
4//
5// Description:
6// Differential form of the Piecewise compound trajectory class. Note that this
7// is now a FULLY IMPLEMENTED CLASS, which completely and generally satisfies
8// the Kalman track interface. Note also that it's now possible to have a
9// heterogenous collection of TrkSimpTrajs (IE you can append difLines on to
10// difHelixes).
11//
12// Copyright Information:
13// Copyright (C) 1996 Lawrence Berkeley Laboratory
14//
15// Authors: Dave Brown, 3/17/97
16//-----------------------------------------------------------------------------
17#ifndef TRKDIFPIECETRAJ_HH
18#define TRKDIFPIECETRAJ_HH
19#include "TrkBase/TrkDirection.h"
20#include "TrkBase/TrkKalDeriv.h"
21#include "TrkBase/TrkSimpTraj.h"
22#include <deque>
23#include <vector>
24
25#include <iosfwd>
26class TrkErrCode;
27
28class TrkDifPieceTraj : public TrkDifTraj, public TrkKalDeriv {
29public:
30 //***
31 // Constructors
32 //***
33 TrkDifPieceTraj( const TrkSimpTraj&, const double lowlim, const double hilim );
34 // same as above, except it _TAKES OWNERSHIP_ of the traj
35 TrkDifPieceTraj( TrkSimpTraj*, const double lowlim, const double hilim );
36 TrkDifPieceTraj( const TrkDifPieceTraj& ); // copy constructor
37 // construct from a vector of simptrajs (which will be cloned). The first segment will
38 // define the global flightlength origin, and subsequent global lengths will be computed
39 // using POCA.
40 TrkDifPieceTraj( const std::vector<TrkSimpTraj*>& trajs );
43 // validation test
44 bool operator==( const TrkDifPieceTraj& other ) const;
45 // inversion function, which keeps the same 'trajectory' but reverses the flightlength.
46 // this is done in-place, and returns itself
48 TrkDifPieceTraj* clone() const { return new TrkDifPieceTraj( *this ); }
49
50 //***
51 // Differential functions: all are implemented here as call downs
52 //***
53 void getDFInfo( double fltLen, DifPoint& pos, DifVector& direction,
54 DifVector& delDirect ) const;
55 void getDFInfo2( double fltlen, DifPoint& pos, DifVector& direction ) const;
56
57 //***
58 // Normal trajectory functions: these are all fully implemented as call downs
59 //***
60 HepPoint3D position( double ) const;
61 Hep3Vector direction( double ) const;
62 double curvature( double f = 0. ) const;
63 Hep3Vector delDirect( double ) const;
64 void getInfo( double fltLen, HepPoint3D&, Hep3Vector& direction ) const;
65 void getInfo( double fltLen, HepPoint3D&, Hep3Vector& direction,
66 Hep3Vector& delDirect ) const;
67 double distTo1stError( double s, double tol, int pathDir ) const;
68 double distTo2ndError( double s, double tol, int pathDir ) const;
69
70 //***
71 // DifPieceTraj specific functions
72 //***
73 const TrkSimpTraj* localTrajectory( double, double& ) const; // const version
74 // test validity of the local range given a global flightlength.
75 bool locallyValid( double glen, double tol = 0.0 ) const;
76 // Overwrite the range functions, to allow local ranges to be
77 // updated as well
78
79 void setFlightRange( double newrange[2] );
80
81 //***
82 // print functions
83 //***
84
85 void print( std::ostream& os ) const;
86 void printAll( std::ostream& os ) const;
87
88 // append/prepend new trajectory pieces. These will adjust the local range of the
89 // appended trajectory to match as best as possible (smallest gap) with the existing
90 // trajectory, at the specified global flight length. The return value is the magnitude
91 // of the gap at the append point. Note that this function will remove existing
92 // trajectories from the piecetraj if those are found to overlap with the specified global
93 // range.
94 //
95 const TrkErrCode& append( double gfltlen, const TrkSimpTraj&, double& gap );
96 const TrkErrCode& prepend( double gfltlen, const TrkSimpTraj&, double& gap );
97 // ownership-taking versions of the above
98 const TrkErrCode& append( double gfltlen, TrkSimpTraj*, double& gap );
99 const TrkErrCode& prepend( double gfltlen, TrkSimpTraj*, double& gap );
100 // append entire piecetrajs together. This will adjust the range of the first piece as
101 // with the single piece append/prepend, but will leave the rest of the piecetraj as-is.
102 const TrkErrCode& append( double, const TrkDifPieceTraj&, double& gap );
103 const TrkErrCode& prepend( double, const TrkDifPieceTraj&, double& gap );
104 // Insert the traj 'as-is', without trying to adjust the
105 // local trajectories flight length to maximize continuity. The traj will be inserted
106 // at the global range closest to its match with the nearest trajectory neighbors.
107 // The input trajectory should be disjoint from the existing pieces, otherwise existing
108 // pieces may get deleted. The input trajectory must have a valid flight range. 'Empty
109 // spaces' in the global flightrange will be filed by clones of existing trajectories.
110 // Index and localTraj functions will operate on the resultant piecetraj to find the
111 // closest piece to the specified flightlength, although the returned local flight length
112 // may be outside the localtrajs range.
113 // This function _TAKES OWNERSHIP_ of the input traj.
114 //
115 const TrkErrCode& append( TrkSimpTraj* traj, double& gap );
116 const TrkErrCode& prepend( TrkSimpTraj* traj, double& gap );
117 //***
118 // Real versions of the base class derrivative functions
119 //***
120 HepMatrix derivDeflect( double fltlen, deflectDirection ) const;
121 HepMatrix derivDisplace( double fltlen, deflectDirection idir ) const;
122
123 HepMatrix derivPFract( double fltlen ) const;
124
125protected:
126 int resize( double len, trkDirection ); // extend/shorten the trajectory.
127 // find the trajectory index given the global flight distance:
128 int trajIndex( const double& global, double& local ) const;
129 // global to local translation:
130 double localDist( int index, double globdist ) const {
131 return _localtraj[index]->lowRange() + globdist - _globalrange[index];
132 }
133 // local to global translation
134 double globalDist( int index, double locdist ) const {
135 return _globalrange[index] + locdist - _localtraj[index]->lowRange();
136 }
137 // Data Members
138 std::deque<TrkSimpTraj*> _localtraj; // Ordered vector of simptrajs
139 std::deque<double> _globalrange; // local/global flight range conversion
140 mutable int _lastIndex; // Cache of last index used to access traj -- speeds up
141 // searching (iff the same piece is queried repeatedly)
142};
143#endif
HepGeom::Point3D< double > HepPoint3D
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
XmlRpcServer s
void printAll(std::ostream &os) const
TrkDifPieceTraj(const TrkDifPieceTraj &)
TrkDifPieceTraj(const TrkSimpTraj &, const double lowlim, const double hilim)
HepPoint3D position(double) const
Hep3Vector direction(double) const
HepMatrix derivDeflect(double fltlen, deflectDirection) const
int trajIndex(const double &global, double &local) const
virtual ~TrkDifPieceTraj()
const TrkErrCode & append(TrkSimpTraj *traj, double &gap)
const TrkErrCode & append(double, const TrkDifPieceTraj &, double &gap)
TrkDifPieceTraj(const std::vector< TrkSimpTraj * > &trajs)
void getDFInfo(double fltLen, DifPoint &pos, DifVector &direction, DifVector &delDirect) const
void getInfo(double fltLen, HepPoint3D &, Hep3Vector &direction, Hep3Vector &delDirect) const
TrkDifPieceTraj & invert()
const TrkErrCode & prepend(double, const TrkDifPieceTraj &, double &gap)
void getInfo(double fltLen, HepPoint3D &, Hep3Vector &direction) const
int resize(double len, trkDirection)
const TrkErrCode & append(double gfltlen, TrkSimpTraj *, double &gap)
void getDFInfo2(double fltlen, DifPoint &pos, DifVector &direction) const
double curvature(double f=0.) const
double distTo2ndError(double s, double tol, int pathDir) const
TrkDifPieceTraj & operator=(const TrkDifPieceTraj &)
TrkDifPieceTraj(TrkSimpTraj *, const double lowlim, const double hilim)
const TrkErrCode & prepend(TrkSimpTraj *traj, double &gap)
bool locallyValid(double glen, double tol=0.0) const
void print(std::ostream &os) const
const TrkErrCode & prepend(double gfltlen, TrkSimpTraj *, double &gap)
Hep3Vector delDirect(double) const
double distTo1stError(double s, double tol, int pathDir) const
const TrkErrCode & append(double gfltlen, const TrkSimpTraj &, double &gap)
HepMatrix derivPFract(double fltlen) const
const TrkSimpTraj * localTrajectory(double, double &) const
HepMatrix derivDisplace(double fltlen, deflectDirection idir) const
const TrkErrCode & prepend(double gfltlen, const TrkSimpTraj &, double &gap)
void setFlightRange(double newrange[2])
bool operator==(const TrkDifPieceTraj &other) const