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