BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/MdcData/include/MdcData/MdcHitOnTrack.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: MdcHitOnTrack.h,v 1.11 2012/08/13 00:05:12 zhangy Exp $
4//
5// Description:
6// Contains drift chamber hit info, as hit is used on a particular track
7// Inherits from TrkHitOnTrk. The drift distance is stored as an
8// absolute value, but returned as |drift|*ambig. Ambiguity stored as +/- 1;
9// ambiguity = 0 => pick better value @ first call to updateMeasurement.
10//
11// Environment:
12// Software developed for the BaBar Detector at the SLAC B-Factory.
13//
14// Authors: Steve Schaffner
15//
16// Revision History:
17// 20011018 M. Kelsey -- Make "rawTime()" public.
18// 20030923 M. Kelsey -- Add function to replace _dHit pointer
19//------------------------------------------------------------------------
20
21#ifndef MDCHITONTRACK_H
22#define MDCHITONTRACK_H
23
24#include "CLHEP/Geometry/Point3D.h"
25#include "CLHEP/Matrix/Vector.h"
26#include "MdcGeom/Constants.h"
27#include "TrkBase/TrkEnums.h"
28#include "TrkBase/TrkHitOnTrk.h"
29#include <math.h>
30#ifndef ENABLE_BACKWARDS_COMPATIBILITY
31// backwards compatibility will be enabled ONLY in CLHEP 1.9
32typedef HepGeom::Point3D<double> HepPoint3D;
33#endif
34
35using CLHEP::Hep3Vector;
36class MdcHit;
37class MdcLayer;
38class Trajectory;
39
40class MdcHitOnTrack : public TrkHitOnTrk {
41
42public:
43 MdcHitOnTrack( const TrkFundHit& fundHit, const MdcHit& baseHit, int ambig, double fittime );
44 virtual ~MdcHitOnTrack();
45
46 // MdcHitOnTrack specific functions
47 double entranceAngleHit() const;
48 double entranceAngle() const;
49 double entranceAngle( const HepPoint3D pos, const Hep3Vector dir ) const;
50 // the entrance Angle is the difference in phi between the *direction*
51 // of the track at the hit, and the phi of the *location* of hit
52 // Signing convention is such that tracks going to the 'left'
53 // are positive and the ones going to the 'right' are negative
54 // The definition was chosen so that radially outgoing tracks have
55 // zero entrance angle (by construction), regardless of 'doca'
56
57 double dipAngle() const;
58 // dipangle is just pi/2 - theta of the track at the location of the hit
59
60 // In general ambiguities are: -1 -> right, 0 -> don't know, +1 -> left
61 // note: maybe this should just be an 'enum' or even a seperate class...
62 // Note the special case of incoming tracks (i.e. |entranceAngle()|>pi/2)
63 // where a track having a wire on the LEFT ( ambig()=+1) has the hit on the
64 // RIGHT ( wireAmbig()=-1 ) of the wire
65 int ambig() const { return _ambig; } // wire wrt track direction
66 int wireAmbig() const; // { // hit wrt the wire location
67 // return fabs(entranceAngle())<Constants::pi/2?ambig():-ambig();}
68
69 double fitTime() const { return _fitTime; }
70 // note: drift is signed according to ambiguity...
71 // if ambiguity unknown, return the average of the
72 // absolute value of both ambiguities, i.e. pick a positive number...
73 double drift() const {
74 return _ambig != 0 ? _drift[_ambig < 0 ? 0 : 1] : ( _drift[1] - _drift[0] ) * 0.5;
75 }
76 double drift( double dca ) const { return _drift[dca < 0 ? 0 : 1]; }
77 double dcaToWire() const;
78
79 double rawTime() const;
80
81 // generic virtual functions (required by TrkHitOnTrk)
82 virtual const Trajectory* hitTraj() const;
83 virtual const MdcHitOnTrack* mdcHitOnTrack() const;
84 virtual bool timeResid( double& t, double& tErr ) const;
85 virtual bool timeAbsolute( double& t, double& tErr ) const;
86
87 // specific virtual functions (required by MdcHitOnTrack)
88 virtual const MdcHit* mdcHit() const;
89 virtual unsigned tdcIndex() const = 0;
90 virtual unsigned status() const = 0;
91
92 // Forwarded to MdcHit
93 int wire() const;
94 const MdcLayer* layer() const;
95 int layernumber() const;
96 unsigned layerNumber() const;
97 int whichView() const; // 0 for axial, +/- 1 for stereo
98 double charge() const;
99
101
102 // Set used during persistant -> transient and internally
103 void setAmbig( int a ) { _ambig = a < 0 ? -1 : a > 0 ? 1 : 0; }
104 void setT0( double t0 );
105
106protected:
107 MdcHitOnTrack( const TrkFundHit* baseHit, int ambig, double fittime, int layer, int wire );
108 MdcHitOnTrack( const MdcHitOnTrack& hitToBeCopied, TrkRep* newRep, const TrkDifTraj* trkTraj,
109 const MdcHit* hb = 0 );
110
111 bool isBeyondEndflange() const { return ( hitLen() < _startLen || hitLen() > _endLen ); }
112 // return forceIteration: ambiguity flipped && hit is active
113 bool updateAmbiguity( double dca );
114
115 virtual TrkErrCode updateMeasurement( const TrkDifTraj* traj, bool maintainAmbiguity );
116 // virtual TrkErrCode updateMeasurement(const TrkDifTraj* traj, bool
117 // maintainAmbiguity=false);
118
119 // Allow subclasses to query or replace the underlying hit pointer
120 const MdcHit* baseHit() const { return _dHit; }
121 void changeBase( MdcHit* newBase );
122
123private:
124 // friend class MdcHOTData;//yzhang del
125
126 void updateCorrections();
127 double driftVelocity() const; // in cm/s
128 bool driftCurrent() const { return ambig() * _drift[ambig() < 0 ? 0 : 1] > 0; }
129
130 // Data members
131
132 // this is the LR ambiguity wrt the TRACK
133 // direction;
134 // carefull: the t->d calibration needs it wrt.
135 // the WIRE, and for INCOMING tracks the two are
136 // NOT the same.
137 int _ambig;
138
139 // corrected version of what's in the FundHit,
140 // one for each ambiguity: left, right
141 double _drift[2];
142
143 const Trajectory* _hitTraj;
144
145 // store last value used for the fit (for calib)
146 // cached information to improve code speed
147 double _fitTime;
148
149 double _startLen; // start hitlen traj
150 double _endLen; // end hitlen traj
151 const MdcHit* _dHit;
152
153 // hide copy constructor and assignment operator
155 MdcHitOnTrack& operator=( const MdcHitOnTrack& );
156};
157
158#endif
HepGeom::Point3D< double > HepPoint3D
void changeBase(MdcHit *newBase)
int wireAmbig() const
virtual const MdcHit * mdcHit() const
virtual ~MdcHitOnTrack()
MdcHitOnTrack(const MdcHitOnTrack &hitToBeCopied, TrkRep *newRep, const TrkDifTraj *trkTraj, const MdcHit *hb=0)
unsigned layerNumber() const
double entranceAngleHit() const
virtual unsigned tdcIndex() const =0
virtual bool timeAbsolute(double &t, double &tErr) const
bool updateAmbiguity(double dca)
int wire() const
double rawTime() const
double dcaToWire() const
virtual const MdcHitOnTrack * mdcHitOnTrack() const
double charge() const
virtual unsigned status() const =0
TrkEnums::TrkViewInfo whatView() const
virtual TrkErrCode updateMeasurement(const TrkDifTraj *traj, bool maintainAmbiguity)
double entranceAngle() const
int whichView() const
virtual bool timeResid(double &t, double &tErr) const
double dipAngle() const
MdcHitOnTrack(const TrkFundHit *baseHit, int ambig, double fittime, int layer, int wire)
const MdcLayer * layer() const
int layernumber() const
MdcHitOnTrack(const TrkFundHit &fundHit, const MdcHit &baseHit, int ambig, double fittime)
double entranceAngle(const HepPoint3D pos, const Hep3Vector dir) const
virtual const Trajectory * hitTraj() const
void setT0(double t0)
int t()
Definition t.c:1