24#include "MdcData/MdcHit.h"
25#include "TrkBase/TrkHitOnTrk.h"
26#include "TrkBase/TrkRecoTrk.h"
27#include "RawEvent/RawDataUtil.h"
28#include "Identifier/MdcID.h"
30bool MdcHit::m_cosmicFit=
false;
31bool MdcHit::m_countPropTime =
true;
38 assert( _digiPtr != NULL);
39 assert( _geomPtr != NULL);
41 _layerPtr = det->
Layer(_id);
42 _wirePtr = det->
Wire(_id);
43 assert( _layerPtr != NULL);
44 assert( _wirePtr != NULL);
45 m_mdcCalibFunSvc = NULL;
52 _rmid = _wirePtr->
rMid();
54 _phi = _wirePtr->
phi();
61 TrkFundHit() , _digiPtr(other._digiPtr), _geomPtr(other._geomPtr),
62 _layerPtr(other._layerPtr), _wirePtr(other._wirePtr), _id(other._id),
63 _layer(other._layer), _wire(other._wire),
64 _iTdc(other._iTdc), _iAdc(other._iAdc),
65 _rawTime(other._rawTime), _charge(other._charge),
66 _rmid(other._rmid), _zlen(other._zlen),
67 _phi(other._phi), _cosphi(other._cosphi), _sinphi(other._sinphi),
68 _status(other._status), _T0Walk(other._T0Walk)
70 m_mdcCalibFunSvc = other.m_mdcCalibFunSvc;
76 _digiPtr = other._digiPtr;
77 _geomPtr = other._geomPtr;
78 _layerPtr = other._layerPtr;
79 _wirePtr = other._wirePtr;
80 m_mdcCalibFunSvc = other.m_mdcCalibFunSvc;
82 _layer = other._layer;
86 _rawTime = other._rawTime;
87 _charge = other._charge;
88 _digiPtr = other._digiPtr;
92 _cosphi = other._cosphi;
93 _sinphi = other._sinphi;
94 _status = other._status;
95 _T0Walk = other._T0Walk;
110 bool removed =
_hitList[count]->parentTrack()->hits()->removeHit(
this);
111 if (!removed) count++;
117 return (
this == &rhs);
127 o <<
"Hit:(" << _layer <<
"," << _wire
128 <<
") x:" <<
x() <<
" y:" <<
y()
138 _T0Walk = m_mdcCalibFunSvc->
getT0(_layer,_wire) + 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;
157 double ,
double z)
const
163 if (ambig==1) lrCalib = 0;
164 else if (ambig==-1) lrCalib = 1;
167 if (fabs(z)>150. || fabs(
driftTime(tof,z))>1500.){
179 return driftDist(bunchTime+crudeTof(), ambig, 0., 0., 0. );
185 double dipAngle,
double z)
const {
188#ifdef MDCPATREC_RESLAYER
189 if (_layer == m_resLayer){
197 if ( m_mdcCalibFunSvc ) {
203 if (ambig==1) lrCalib = 0;
204 else if (ambig==-1) lrCalib = 1;
208 sig = 0.1 * m_mdcCalibFunSvc->
getSigma(_layer,lrCalib,driftdist*10.,entranceAngle,
209 tan(dipAngle),z*10.,_iAdc);
227 return sigma(driftdist, ambig, 0., 0., 0.);
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
double getSigma(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getT0(int layid, int cellid) const
double driftTimeToDist(double drifttime, int layid, int cellid, int lr, double entrance=0.0) const
double getTprop(int lay, double z) const
double getTimeWalk(int layid, double Q) const
const MdcLayer * Layer(unsigned id) const
const MdcSWire * Wire(unsigned id) const
const MdcDigi * digi() const
MdcHit(const MdcDigi *&digi, const MdcDetector *&det)
void setCalibSvc(const MdcCalibFunSvc *calibSvc)
unsigned wirenumber() const
void print(std::ostream &o) const
bool operator==(const MdcHit &) const
const MdcCalibFunSvc * calibSvc() 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 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
double zLength(void) const
static double MdcTime(int timeChannel)
static double MdcCharge(int chargeChannel)
virtual Identifier identify() const
unsigned int getChargeChannel() const
int getTrackIndex() const
unsigned int getTimeChannel() const
std::vector< const TrkHitOnTrk * > _hitList