BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
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/TrkSimpTraj.h"
20#include "TrkBase/TrkKalDeriv.h"
22#include <vector>
23#include <deque>
24
25#include <iosfwd>
26class TrkErrCode;
27
28class TrkDifPieceTraj : public TrkDifTraj , public TrkKalDeriv {
29public:
30
31//***
32// Constructors
33//***
34 TrkDifPieceTraj(const TrkSimpTraj&,const double lowlim ,const double hilim );
35// same as above, except it _TAKES OWNERSHIP_ of the traj
36 TrkDifPieceTraj(TrkSimpTraj*,const double lowlim ,const double hilim );
37 TrkDifPieceTraj(const TrkDifPieceTraj& ); // copy constructor
38// construct from a vector of simptrajs (which will be cloned). The first segment will define
39// the global flightlength origin, and subsequent global lengths will be computed using POCA.
40 TrkDifPieceTraj(const std::vector<TrkSimpTraj*>& trajs);
41 virtual ~TrkDifPieceTraj();
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 trajectories
92// from the piecetraj if those are found to overlap with the specified global range.
93//
94 const TrkErrCode& append(double gfltlen,const TrkSimpTraj&,double& gap);
95 const TrkErrCode& prepend(double gfltlen,const TrkSimpTraj&,double& gap);
96// ownership-taking versions of the above
97 const TrkErrCode& append(double gfltlen,TrkSimpTraj*,double& gap);
98 const TrkErrCode& prepend(double gfltlen,TrkSimpTraj*,double& gap);
99// append entire piecetrajs together. This will adjust the range of the first piece as
100// with the single piece append/prepend, but will leave the rest of the piecetraj as-is.
101 const TrkErrCode& append(double,const TrkDifPieceTraj&,double& gap);
102 const TrkErrCode& prepend(double,const TrkDifPieceTraj&,double& gap);
103// Insert the traj 'as-is', without trying to adjust the
104// local trajectories flight length to maximize continuity. The traj will be inserted
105// at the global range closest to its match with the nearest trajectory neighbors.
106// The input trajectory should be disjoint from the existing pieces, otherwise existing
107// pieces may get deleted. The input trajectory must have a valid flight range. 'Empty
108// spaces' in the global flightrange will be filed by clones of existing trajectories.
109// Index and localTraj functions will operate on the resultant piecetraj to find the
110// closest piece to the specified flightlength, although the returned local flight length
111// may be outside the localtrajs range.
112// This function _TAKES OWNERSHIP_ of the input traj.
113//
114 const TrkErrCode& append(TrkSimpTraj* traj,double& gap);
115 const TrkErrCode& prepend(TrkSimpTraj* traj,double& gap);
116//***
117// Real versions of the base class derrivative functions
118//***
119 HepMatrix derivDeflect(double fltlen,deflectDirection) const;
120 HepMatrix derivDisplace(double fltlen,deflectDirection idir) const;
121
122 HepMatrix derivPFract(double fltlen) const;
123protected:
124 int resize(double len,trkDirection); // extend/shorten the trajectory.
125// find the trajectory index given the global flight distance:
126 int trajIndex(const double& global,double& local) const;
127// global to local translation:
128 double localDist(int index,double globdist) const {
129 return _localtraj[index]->lowRange() + globdist - _globalrange[index];
130 }
131// local to global translation
132 double globalDist(int index,double locdist) const {
133 return _globalrange[index] + locdist - _localtraj[index]->lowRange();
134 }
135// Data Members
136 std::deque<TrkSimpTraj*> _localtraj; // Ordered vector of simptrajs
137 std::deque<double> _globalrange; // local/global flight range conversion
138 mutable int _lastIndex; // Cache of last index used to access traj -- speeds up
139 // searching (iff the same piece is queried repeatedly)
140};
141#endif
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
XmlRpcServer s
Definition: HelloServer.cpp:11
trkDirection
Definition: TrkDirection.h:23
deflectDirection
Definition: TrkKalDeriv.h:24
void printAll(std::ostream &os) const
HepPoint3D position(double) const
Hep3Vector direction(double) const
HepMatrix derivDeflect(double fltlen, deflectDirection) const
int trajIndex(const double &global, double &local) const
void getDFInfo(double fltLen, DifPoint &pos, DifVector &direction, DifVector &delDirect) const
TrkDifPieceTraj & invert()
std::deque< TrkSimpTraj * > _localtraj
void getInfo(double fltLen, HepPoint3D &, Hep3Vector &direction) const
int resize(double len, trkDirection)
double globalDist(int index, double locdist) const
std::deque< double > _globalrange
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 &)
bool locallyValid(double glen, double tol=0.0) const
void print(std::ostream &os) const
double localDist(int index, double globdist) const
Hep3Vector delDirect(double) const
double distTo1stError(double s, double tol, int pathDir) const
virtual ~TrkDifPieceTraj()
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)
TrkDifPieceTraj * clone() const
void setFlightRange(double newrange[2])
bool operator==(const TrkDifPieceTraj &other) const