CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemHitOnTrack.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: CgemHitOnTrack.h,v 1.2 2017/12/27 12:49:14 wangll 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 CGEMHITONTRACK_H
22#define CGEMHITONTRACK_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"
34//#include "KalFitAlg/helix/Helix.h"
35#ifndef ENABLE_BACKWARDS_COMPATIBILITY
36// backwards compatibility will be enabled ONLY in CLHEP 1.9
38#endif
39
40using CLHEP::Hep3Vector;
41class Trajectory;
42class RecCgemCluster;
43
45
46 public:
47 CgemHitOnTrack(const RecCgemCluster& baseHit, double fittime);
48 virtual ~CgemHitOnTrack();
49
50
51 // CgemHitOnTrack specific functions
52 double entranceAngleHit() const;
53 double entranceAngle() const;
54 double entranceAngle(const HepPoint3D pos, const Hep3Vector dir) const;
55 // the entrance Angle is the difference in phi between the *direction*
56 // of the track at the hit, and the phi of the *location* of hit
57 // Signing convention is such that tracks going to the 'left'
58 // are positive and the ones going to the 'right' are negative
59 // The definition was chosen so that radially outgoing tracks have
60 // zero entrance angle (by construction), regardless of 'doca'
61
62 double dipAngle() const;
63 // dipangle is just pi/2 - theta of the track at the location of the hit
64
65 // In general ambiguities are: -1 -> right, 0 -> don't know, +1 -> left
66 // note: maybe this should just be an 'enum' or even a seperate class...
67 // Note the special case of incoming tracks (i.e. |entranceAngle()|>pi/2)
68 // where a track having a wire on the LEFT ( ambig()=+1) has the hit on the
69 // RIGHT ( wireAmbig()=-1 ) of the wire
70 //int ambig() const { return _ambig; } // wire wrt track direction
71 //int wireAmbig() const;// { // hit wrt the wire location
72 //return fabs(entranceAngle())<Constants::pi/2?ambig():-ambig();}
73
74 double fitTime() const { return _fitTime; }
75 // note: drift is signed according to ambiguity...
76 // if ambiguity unknown, return the average of the
77 // absolute value of both ambiguities, i.e. pick a positive number...
78 //double drift() const { return _ambig!=0 ? _drift[_ambig<0 ? 0:1]
79 //: (_drift[1]-_drift[0])*0.5; }
80 double drift(double dca) const { return _drift[dca<0?0:1]; }
81 double dcaToWire() const;
82
83 double rawTime() const;
84
85 // generic virtual functions (required by TrkHitOnTrk)
86 virtual const Trajectory* hitTraj() const;
87 //const CgemHitOnTrack* cgemHitOnTrack() const;
88 virtual bool timeResid(double& t,double& tErr) const;
89 virtual bool timeAbsolute(double& t,double& tErr) const;
90
91 // specific virtual functions (required by CgemHitOnTrack)
92 //const RecCgemCluster* cgemCluster() const {return _dHit;}
93 unsigned tdcIndex() const { return -999;}//FIXME
94 unsigned status() const { return -999;}//FIXME
95
96 // Forwarded to RecCgemCluster
97 //int wire() const ;
98 //const MdcLayer* layer() const ;
99 //int layernumber() const ;
100 unsigned layerNumber() const{ return _dHit->getlayerid();}
101 //int whichView() const; // 0 for axial, +/- 1 for stereo
102 double charge() const;
103
105
106 // Set used during persistant -> transient and internally
107 //void setAmbig(int a) { _ambig = a<0?-1:a>0?1:0; }
108 void setT0(double t0);
109
110
111
112
113 virtual TrkHitOnTrk* clone(TrkRep *, const TrkDifTraj *trkTraj=0) const;
114 void setCgemGeomSvc(const CgemGeomSvc* svc) {_cgemGeomSvc = svc;}
115 void setCgemCalibFunSvc(const CgemCalibFunSvc* svc) {_cgemCalibFunSvc = svc;}
116 //static CgemGeomSvc* cgemGeomSvc;
117 //void print() const;
118 void print(std::ostream& ) const;
119 const RecCgemCluster* baseHit() const { return _dHit; }
120
121 //TrkErrCode getFitStuff(HepVector& derivs, double& deltaChi) const;
122 TrkErrCode getFitStuff(HepVector& derivs, HepVector &derivs2, double & sigma1, double & sigma2, double& deltaChi1, double& deltaChi2) const;
123 //TrkErrCode getFitStuff(double& deltaChi) const;
124 TrkErrCode getFitStuff(double & sigma1, double & sigma2, double& deltaChi1, double& deltaChi2) const;
125 TrkErrCode getFitStuff(HepVector &Xderivs, double &XdeltaChi, HepVector &Vderivs, double &VdeltaChi)const;
126 TrkErrCode getFitStuff(double &XdeltaChi, double &VdeltaChi)const;
127 //double IntersectCylinder(double r, KalmanFit::Helix helix)const;
128
129 protected:
130
132 double fittime, int layer, int wire);
133 CgemHitOnTrack(const CgemHitOnTrack &hitToBeCopied, TrkRep *newRep,
134 const TrkDifTraj* trkTraj,const RecCgemCluster *hb=0);
135
136 bool isBeyondEndflange() const
137 { return (hitLen() < _startLen || hitLen() > _endLen); }
138 // return forceIteration: ambiguity flipped && hit is active
139 bool updateAmbiguity(double dca);
140
141 virtual TrkErrCode updateMeasurement(const TrkDifTraj* traj, bool maintainAmbiguity);
142 //virtual TrkErrCode updateMeasurement(const TrkDifTraj* traj, bool maintainAmbiguity=false);
143
144 // Allow subclasses to query or replace the underlying hit pointer
145 void changeBase(RecCgemCluster* newBase);
146
147 private:
148 // friend class MdcHOTData;//yzhang del
149
150 void updateCorrections();
151 //double driftVelocity() const; // in cm/s
152 bool driftCurrent() const { return ambig()*_drift[ambig()<0?0:1]>0; }
153
154
155 //Data members
156 //int _ambig; // this is the LR ambiguity wrt the TRACK
157 // direction;
158 // carefull: the t->d calibration needs it wrt.
159 // the WIRE, and for INCOMING tracks the two are
160 // NOT the same.
161 double _drift[2]; // corrected version of what's in the FundHit,
162 // one for each ambiguity: left, right
163 const Trajectory* _hitTraj;
164 double _fitTime; // store last value used for the fit (for calib)
165 // cached information to improve code speed
166 double _startLen; // start hitlen traj
167 double _endLen; // end hitlen traj
168 const RecCgemCluster * _dHit;
169 double _clusterr;
170 static const CgemGeomSvc* _cgemGeomSvc;
171 static const CgemCalibFunSvc* _cgemCalibFunSvc;
172
173 // hide copy constructor and assignment operator
175 CgemHitOnTrack& operator=(const CgemHitOnTrack&);
176
177};
178
179#endif
HepGeom::Point3D< double > HepPoint3D
double sigma2(0)
double rawTime() const
void changeBase(RecCgemCluster *newBase)
double dcaToWire() const
double entranceAngleHit() const
double entranceAngle() const
double fitTime() const
void print(std::ostream &) const
virtual ~CgemHitOnTrack()
CgemHitOnTrack(const RecCgemCluster &baseHit, double fittime)
double dipAngle() const
TrkEnums::TrkViewInfo whatView() const
TrkErrCode getFitStuff(HepVector &derivs, HepVector &derivs2, double &sigma1, double &sigma2, double &deltaChi1, double &deltaChi2) const
virtual bool timeAbsolute(double &t, double &tErr) const
double drift(double dca) const
void setCgemCalibFunSvc(const CgemCalibFunSvc *svc)
bool updateAmbiguity(double dca)
unsigned layerNumber() const
virtual bool timeResid(double &t, double &tErr) const
const RecCgemCluster * baseHit() const
unsigned status() const
virtual const Trajectory * hitTraj() const
virtual TrkHitOnTrk * clone(TrkRep *, const TrkDifTraj *trkTraj=0) const
void setCgemGeomSvc(const CgemGeomSvc *svc)
double charge() const
bool isBeyondEndflange() const
unsigned tdcIndex() const
CgemHitOnTrack(const TrkFundHit *baseHit, int ambig, double fittime, int layer, int wire)
void setT0(double t0)
int getlayerid(void) const
friend class TrkBase::Functors::updateMeasurement
double hitLen() const
Definition TrkHitOnTrk.h:92
virtual int ambig() const
const TrkDifTraj * trkTraj() const
Definition TrkHitOnTrk.h:77
int t()
Definition t.c:1