24#include "MdcData/MdcHit.h"
25#include "Identifier/MdcID.h"
26#include "RawEvent/RawDataUtil.h"
27#include "TrkBase/TrkHitOnTrk.h"
28#include "TrkBase/TrkRecoTrk.h"
30bool MdcHit::m_cosmicFit =
false;
31bool MdcHit::m_countPropTime =
true;
34 :
TrkFundHit(), _digiPtr( aDigi ), _geomPtr( det ) {
37 assert( _digiPtr != NULL );
38 assert( _geomPtr != NULL );
40 _layerPtr = det->
Layer( _id );
41 _wirePtr = det->
Wire( _id );
42 assert( _layerPtr != NULL );
43 assert( _wirePtr != NULL );
44 m_mdcCalibFunSvc = NULL;
47 _iTdc = _digiPtr->getTimeChannel();
48 _iAdc = _digiPtr->getChargeChannel();
51 _rmid = _wirePtr->rMid();
52 _zlen = _layerPtr->zLength();
53 _phi = _wirePtr->phi();
54 _cosphi =
cos( _phi );
55 _sinphi =
sin( _phi );
61 , _digiPtr( other._digiPtr )
62 , _geomPtr( other._geomPtr )
63 , _layerPtr( other._layerPtr )
64 , _wirePtr( other._wirePtr )
66 , _layer( other._layer )
67 , _wire( other._wire )
68 , _iTdc( other._iTdc )
69 , _iAdc( other._iAdc )
70 , _rawTime( other._rawTime )
71 , _charge( other._charge )
72 , _rmid( other._rmid )
73 , _zlen( other._zlen )
75 , _cosphi( other._cosphi )
76 , _sinphi( other._sinphi )
77 , _status( other._status )
78 , _T0Walk( other._T0Walk ) {
79 m_mdcCalibFunSvc = other.m_mdcCalibFunSvc;
85 _digiPtr = other._digiPtr;
86 _geomPtr = other._geomPtr;
87 _layerPtr = other._layerPtr;
88 _wirePtr = other._wirePtr;
89 m_mdcCalibFunSvc = other.m_mdcCalibFunSvc;
91 _layer = other._layer;
95 _rawTime = other._rawTime;
96 _charge = other._charge;
97 _digiPtr = other._digiPtr;
101 _cosphi = other._cosphi;
102 _sinphi = other._sinphi;
103 _status = other._status;
104 _T0Walk = other._T0Walk;
119 bool removed =
_hitList[
count]->parentTrack()->hits()->removeHit(
this );
120 if ( !removed )
count++;
131 o <<
"Hit:(" << _layer <<
"," << _wire <<
") x:" <<
x() <<
" y:" <<
y()
138 _T0Walk = m_mdcCalibFunSvc->getT0( _layer, _wire ) +
139 m_mdcCalibFunSvc->getTimeWalk( _layer, _iAdc );
145 if ( m_countPropTime ) { tprop = m_mdcCalibFunSvc->getTprop( _layer, z * 10. ); }
148 double driftT = _rawTime - _T0Walk - 1.e9 * tof - tprop;
163 if ( ambig == 1 ) lrCalib = 0;
164 else if ( ambig == -1 ) lrCalib = 1;
167 if ( fabs( z ) > 150. || fabs(
driftTime( tof, z ) ) > 1500. ) {
return 9999.; }
168 driftD = 0.1 * m_mdcCalibFunSvc->driftTimeToDist(
driftTime( tof, z ), _layer, _wire,
169 lrCalib, entranceAngle );
180 return driftDist( bunchTime + crudeTof(), ambig, 0., 0., 0. );
183double MdcHit::sigma(
double driftdist,
int ambig,
double entranceAngle,
double dipAngle,
187#ifdef MDCPATREC_RESLAYER
188 if ( _layer == m_resLayer )
197 if ( m_mdcCalibFunSvc )
204 if ( ambig == 1 ) lrCalib = 0;
205 else if ( ambig == -1 ) lrCalib = 1;
210 sig = 0.1 * m_mdcCalibFunSvc->getSigma( _layer, lrCalib, driftdist * 10., entranceAngle,
211 tan( dipAngle ), z * 10.,
227 return sigma( driftdist, ambig, 0., 0., 0. );
DOUBLE_PRECISION count[3]
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
ostream & operator<<(ostream &o, const MdcHit &hit)
static const double epsilon
const MdcLayer * Layer(unsigned id) const
const MdcSWire * Wire(unsigned id) const
const MdcDigi * digi() const
MdcHit(const MdcDigi *&digi, const MdcDetector *&det)
unsigned wirenumber() const
void print(std::ostream &o) const
const IMdcCalibFunSvc * calibSvc() const
bool operator==(const MdcHit &) const
double driftTime(double tof, double z) const
double sigma(double, int, double, double, double) const
MdcHit & operator=(const MdcHit &)
const Trajectory * hitTraj() const
double driftDist(double, int, double, double, double) const
const MdcLayer * layer() const
void setCalibSvc(const IMdcCalibFunSvc *calibSvc)
void printAll(std::ostream &o) const
static int layer(const Identifier &id)
Values of different levels (failure returns 0).
static int wire(const Identifier &id)
const Trajectory * makeHitTrajInGlobalCoords(int wire, double z=0) const
static double MdcTime(int timeChannel)
static double MdcCharge(int chargeChannel)
virtual Identifier identify() const
int getTrackIndex() const
std::vector< const TrkHitOnTrk * > _hitList