#include <MdcxHit.h>
Public Member Functions | |
MdcxHit (const MdcDigi *pdcdatum, float c0=0, float cresol=.0180) | |
MdcxHit (const MdcHit *pdchhit, float c0=0, float cresol=.0180) | |
virtual | ~MdcxHit () |
const MdcDigi * | getDigi () const |
const MdcHit * | getMdcHit () const |
int | SuperLayer () const |
int | WireNo () const |
int | Layer () const |
float | t () const |
float | x () const |
float | y () const |
float | xpos () const |
float | ypos () const |
float | xneg () const |
float | yneg () const |
float | wx () const |
float | wy () const |
float | wz () const |
float | pw () const |
float | phiMid () const |
float | stereo () const |
float | v () const |
int | type () const |
void | SetConstErr (int i) |
float | tcor (float zh=0.0, float tof=0.0, float tzero=0.0) const |
float | d (MdcxHel &hel) const |
float | d (float zh=0.0, float tof=0.0, float tzero=0.0, int wamb=0, float eang=0.0) const |
float | e (float dd=0.0) const |
float | pull (MdcxHel &hel) const |
float | residual (MdcxHel &hel) const |
std::vector< float > | derivatives (MdcxHel &hel) const |
void | print (std::ostream &o, int i=0) const |
void | printAll (std::ostream &o, int i=0) const |
void | SetUsedOnHel (int i) |
int | GetUsedOnHel () const |
Static Public Member Functions | |
static void | setMdcCalibFunSvc (const MdcCalibFunSvc *calibSvc) |
static void | setCountPropTime (bool countPropTime) |
static void | setMdcDetector (const MdcDetector *gm) |
Protected Member Functions | |
void | process () |
Protected Attributes | |
unsigned | _wirenumber |
unsigned | _layernumber |
unsigned | _superlayer |
float | _t |
float | _q |
unsigned | _iTdc |
unsigned | _iAdc |
float | _T0Walk |
float | _x |
float | _y |
float | _r |
float | _s |
float | _L |
float | _d |
float | _v |
int | _type |
float | _e |
float | _xpos |
float | _ypos |
float | _xneg |
float | _yneg |
float | _p |
float | _sp |
float | _cp |
double | _pw |
double | _wx |
double | _wy |
double | _wz |
const MdcHit * | _mdcHit |
const MdcDigi * | _mdcDigi |
int | _consterr |
int | usedonhel |
float | _c0 |
float | _cresol |
Private Member Functions | |
MdcxHit (const MdcxHit &) | |
MdcxHit & | operator= (const MdcxHit &) |
bool | operator== (const MdcxHit &) const |
double | getSigma (float driftDist, int ambig=0, double entrAngle=0, double dipAngle=0, double z=0) const |
Static Private Attributes | |
static const MdcCalibFunSvc * | m_mdcCalibFunSvc = 0 |
static const MdcDetector * | m_gm = 0 |
static bool | m_countPropTime = true |
Definition at line 42 of file MdcxHit.h.
MdcxHit::MdcxHit | ( | const MdcDigi * | pdcdatum, | |
float | c0 = 0 , |
|||
float | cresol = .0180 | |||
) |
MdcxHit::MdcxHit | ( | const MdcHit * | pdchhit, | |
float | c0 = 0 , |
|||
float | cresol = .0180 | |||
) |
MdcxHit::MdcxHit | ( | const MdcxHit & | ) | [private] |
float MdcxHit::d | ( | float | zh = 0.0 , |
|
float | tof = 0.0 , |
|||
float | tzero = 0.0 , |
|||
int | wamb = 0 , |
|||
float | eang = 0.0 | |||
) | const |
Definition at line 135 of file MdcxHit.cxx.
References _layernumber, _wirenumber, MdcCalibFunSvc::driftTimeToDist(), m_mdcCalibFunSvc, and tcor().
00135 { 00136 00137 //std::cout<<__FILE__<<" "<<__LINE__<<" call entrance "<< entranceAngle<< std::endl; 00138 //tof = hel.Doca_Tof();//yzhang delete for csmc temp FIXME 00139 float t_corr = tcor(z,tof,tzero); 00140 double eAngle = EntranceAngle(entranceAngle); 00141 00142 //yzhang add for 64-bit 00143 if (fabs(z)>150. || fabs(t_corr)>1500. || fabs(eAngle)>999){ 00144 return 9999.; 00145 } 00146 //zhangy 00147 00148 int lrCalib = 2; 00149 if (wamb==1)lrCalib = 0; 00150 else if (wamb==-1) lrCalib = 1; 00151 00152 double driftD = 0.1 * m_mdcCalibFunSvc->driftTimeToDist(t_corr,_layernumber,_wirenumber,lrCalib,eAngle);//to cm 00153 //std::cout<<"MdcxHit ("<<_layernumber<<","<<_wirenumber<<" dd "<<driftD<<" dt "<<t_corr<<" lr "<<lrCalib<<" eAngle "<<eAngle<<std::endl; 00154 00155 00156 if (fabs(driftD)<=0.0001) driftD = 0.001; 00157 return driftD; 00158 }
float MdcxHit::d | ( | MdcxHel & | hel | ) | const |
Definition at line 160 of file MdcxHit.cxx.
References MdcxHel::Doca(), MdcxHel::Doca_Eang(), MdcxHel::Doca_Tof(), MdcxHel::Doca_Wamb(), MdcxHel::Doca_Zh(), and MdcxHel::T0().
Referenced by derivatives(), process(), pull(), residual(), and MdcxFindSegs::trial().
00160 { 00161 float doca=hel.Doca(*this); // changes hel's internal state... 00162 return d(hel.Doca_Zh(),hel.Doca_Tof(),hel.T0(), 00163 hel.Doca_Wamb(),hel.Doca_Eang()); 00164 }//endof d
std::vector< float > MdcxHit::derivatives | ( | MdcxHel & | hel | ) | const |
Definition at line 192 of file MdcxHit.cxx.
References d(), MdcxHel::derivatives(), MdcxHel::Doca_Eang(), MdcxHel::Doca_Tof(), MdcxHel::Doca_Wamb(), MdcxHel::Doca_Zh(), e(), genRecEmupikp::i, and MdcxHel::T0().
00192 { 00193 // compute derivatives for |hel| 00194 std::vector<float> deriv = hel.derivatives(*this); 00195 float dtemp = d(hel.Doca_Zh(), hel.Doca_Tof(), hel.T0(), 00196 hel.Doca_Wamb(), hel.Doca_Eang()); 00197 //float dtemp = d(hel); 00198 deriv[0] = dtemp - deriv[0]; 00199 // deriv[0] -= v()*hel.T0(); 00200 float ewire = e(dtemp); 00201 for (uint32_t i = 0; i < deriv.size(); i++) deriv[i] /= ewire; 00202 return deriv; 00203 }//endof derivatives
float MdcxHit::e | ( | float | dd = 0.0 |
) | const |
Definition at line 166 of file MdcxHit.cxx.
References getSigma().
Referenced by derivatives(), and pull().
00166 { 00167 //if (0!=_consterr) return _cresol;//yzhang delete 2009-11-03 00168 float errTemp = fabs(getSigma(dd)); 00169 // protect against resolution = 0; set min resol to 1 nm 00170 float errMin = 1.0e-7; 00171 return errTemp<errMin?errMin:errTemp; 00172 }
const MdcDigi* MdcxHit::getDigi | ( | ) | const [inline] |
const MdcHit* MdcxHit::getMdcHit | ( | ) | const [inline] |
double MdcxHit::getSigma | ( | float | driftDist, | |
int | ambig = 0 , |
|||
double | entrAngle = 0 , |
|||
double | dipAngle = 0 , |
|||
double | z = 0 | |||
) | const [private] |
Definition at line 216 of file MdcxHit.cxx.
References _iAdc, _layernumber, MdcCalibFunSvc::getSigma(), Layer(), m_mdcCalibFunSvc, and tan().
Referenced by e().
00217 { 00218 int lrCalib = 2; 00219 if (ambig != 0) lrCalib = (ambig == 1) ? 0 : 1; 00220 double eAngle = EntranceAngle(entranceAngle); 00221 //std::cout<<_layernumber<<" "<<lrCalib<<" dd "<<driftDist<<" "<<eAngle<<" "<<dipAngle<<" "<<z<<" "<<_iAdc<<std::endl; 00222 double sig = 0.1 * m_mdcCalibFunSvc->getSigma(_layernumber, lrCalib, 00223 driftDist*10., eAngle, tan(dipAngle), z*10., _iAdc); 00224 //double sig = 0.1 * m_mdcCalibFunSvc->getSigma(_layernumber, _wirenumber, lrCalib, 00225 //driftDist*10., eAngle, tan(dipAngle), z*10., _iAdc); 00226 #ifdef MDCXRECO_RESLAYER 00227 if (Layer() == g_resLayer) { 00228 //give a huge sigma to skip this layer when fit track 00229 return 9999.; 00230 } 00231 #endif 00232 return sig; 00233 }
int MdcxHit::GetUsedOnHel | ( | ) | const [inline] |
Definition at line 103 of file MdcxHit.h.
References usedonhel.
Referenced by MdcxAddHits::GetAssociates().
00103 {return usedonhel;}
int MdcxHit::Layer | ( | void | ) | const [inline] |
Definition at line 67 of file MdcxHit.h.
References _layernumber.
Referenced by MdcxAddHits::GetAssociates(), and getSigma().
00067 {return _layernumber;}// layer#
float MdcxHit::phiMid | ( | ) | const [inline] |
void MdcxHit::print | ( | std::ostream & | o, | |
int | i = 0 | |||
) | const |
Referenced by MdcxAddHits::GetAssociates().
void MdcxHit::printAll | ( | std::ostream & | o, | |
int | i = 0 | |||
) | const |
void MdcxHit::process | ( | ) | [protected] |
Definition at line 72 of file MdcxHit.cxx.
References _c0, _consterr, _cp, _cresol, _d, _e, _iAdc, _iTdc, _L, _layernumber, _mdcDigi, _p, _pw, _q, _r, _s, _sp, _superlayer, _t, _T0Walk, _type, _v, _wirenumber, _wx, _wy, _wz, _x, _xneg, _xpos, _y, _yneg, _ypos, cos(), d(), MdcLayer::dPhi(), RawData::getChargeChannel(), MdcCalibFunSvc::getT0(), RawData::getTimeChannel(), MdcCalibFunSvc::getTimeWalk(), MdcDetector::Layer(), MdcID::layer(), m_gm, m_mdcCalibFunSvc, RawDataUtil::MdcCharge(), RawDataUtil::MdcTime(), MdcLayer::phiOffset(), pw(), sin(), MdcLayer::stereo(), usedonhel, Constants::viewOfsLayer, MdcID::wire(), MdcLayer::xWire(), MdcLayer::yWire(), and MdcLayer::zLength().
Referenced by MdcxHit().
00072 { 00073 assert(m_gm); 00074 assert(m_mdcCalibFunSvc); 00075 Identifier _id = (*_mdcDigi).identify(); 00076 _layernumber=MdcID::layer(_id); 00077 _wirenumber=MdcID::wire(_id); 00078 _superlayer=(_layernumber)/4; 00079 _iTdc = _mdcDigi->getTimeChannel(); 00080 _iAdc = _mdcDigi->getChargeChannel(); 00081 _t = RawDataUtil::MdcTime(_iTdc); 00082 _q = RawDataUtil::MdcCharge(_iAdc); 00083 _T0Walk = m_mdcCalibFunSvc->getT0(_layernumber,_wirenumber) 00084 + m_mdcCalibFunSvc->getTimeWalk(_layernumber,_iAdc); 00085 // pointer to layer 00086 const MdcLayer* layerPtr= m_gm->Layer(_layernumber); 00087 _L = layerPtr->zLength(); 00088 _x = layerPtr->xWire(_wirenumber); 00089 _y = layerPtr->yWire(_wirenumber); 00090 _r = sqrt(_x*_x + _y*_y); 00091 _s = layerPtr->stereo(); 00092 _p = layerPtr->phiOffset() + _wirenumber*layerPtr->dPhi(); 00093 //double deltaz = m_gm->zOffSet(); //yzhang to BESIII 00094 //double deltaz = 0.0; 00095 double tst = _s; 00096 double pw = atan2(_y, _x); 00097 _pw = pw; 00098 _wx = -tst*sin(pw); 00099 _wy = tst*cos(pw); 00100 _wz = (tst*tst < 1.0) ? sqrt(1.0-tst*tst) : 0.0; 00101 _sp = sin(_p); 00102 _cp = cos(_p); 00103 _consterr = 0; //zoujh FIXME 00104 _e = _cresol; 00105 _d = d(); 00106 // note _v is a total cludge 00107 _v = (_t-_c0 > 0.0) ? _d/(_t-_c0) : 0.0013;//yzhang 2009-11-03 00108 _xneg = _x + _d*_sp; 00109 _yneg = _y - _d*_cp; 00110 _xpos = _x - _d*_sp; 00111 _ypos = _y + _d*_cp; 00112 usedonhel = 0; 00113 _type = Constants::viewOfsLayer[_superlayer]; 00114 }
float MdcxHit::pull | ( | MdcxHel & | hel | ) | const |
Definition at line 174 of file MdcxHit.cxx.
References d(), MdcxHel::Doca(), MdcxHel::Doca_Eang(), MdcxHel::Doca_Tof(), MdcxHel::Doca_Wamb(), MdcxHel::Doca_Zh(), e(), MdcxHel::Mode(), and MdcxHel::T0().
Referenced by MdcxAddHits::GetAssociates().
00174 { 00175 // compute pulls for |hel| 00176 float doca=hel.Doca(*this); if(hel.Mode() == 0)doca=fabs(doca); 00177 return (d(hel.Doca_Zh(),hel.Doca_Tof(),hel.T0(), 00178 hel.Doca_Wamb(),hel.Doca_Eang())-doca)/e(doca); 00179 //return residual(hel)/e(); 00180 }
float MdcxHit::pw | ( | ) | const [inline] |
float MdcxHit::residual | ( | MdcxHel & | hel | ) | const |
Definition at line 182 of file MdcxHit.cxx.
References _wx, _wy, _wz, _x, _y, d(), MdcxHel::Doca(), MdcxHel::Doca_Eang(), MdcxHel::Doca_Tof(), MdcxHel::Doca_Wamb(), MdcxHel::Doca_Zh(), MdcxHel::Mode(), MdcxHel::T0(), and v().
00182 { 00183 // compute residuals for |hel| 00184 float doca = hel.Doca(_wx, _wy, _wz, _x, _y); 00185 if(hel.Mode() == 0) doca = fabs(doca); 00186 doca += v()*hel.T0(); 00187 return d(hel.Doca_Zh(),hel.Doca_Tof(),hel.T0(), 00188 hel.Doca_Wamb(),hel.Doca_Eang())-doca; 00189 //return d(hel) - doca; 00190 }
void MdcxHit::SetConstErr | ( | int | i | ) | [inline] |
void MdcxHit::setCountPropTime | ( | bool | countPropTime | ) | [static] |
Definition at line 64 of file MdcxHit.cxx.
References m_countPropTime.
Referenced by MdcxTrackFinder::initialize().
00064 { 00065 m_countPropTime = countPropTime; 00066 }
void MdcxHit::setMdcCalibFunSvc | ( | const MdcCalibFunSvc * | calibSvc | ) | [static] |
Definition at line 60 of file MdcxHit.cxx.
References m_mdcCalibFunSvc.
Referenced by MdcxTrackFinder::initialize().
00060 { 00061 m_mdcCalibFunSvc = calibSvc; 00062 }
void MdcxHit::setMdcDetector | ( | const MdcDetector * | gm | ) | [static] |
Definition at line 68 of file MdcxHit.cxx.
References m_gm.
Referenced by MdcxTrackFinder::beginRun().
00068 { 00069 m_gm = gm; 00070 }
void MdcxHit::SetUsedOnHel | ( | int | i | ) | [inline] |
float MdcxHit::stereo | ( | void | ) | const [inline] |
int MdcxHit::SuperLayer | ( | ) | const [inline] |
Definition at line 65 of file MdcxHit.h.
References _superlayer.
00065 {return _superlayer;} //SuperLayer#
float MdcxHit::t | ( | ) | const [inline] |
float MdcxHit::tcor | ( | float | zh = 0.0 , |
|
float | tof = 0.0 , |
|||
float | tzero = 0.0 | |||
) | const |
Definition at line 116 of file MdcxHit.cxx.
References _c0, _layernumber, _t, _T0Walk, dt, MdcCalibFunSvc::getTprop(), m_countPropTime, and m_mdcCalibFunSvc.
Referenced by d().
00116 { 00117 //drift time 00118 double tprop = 0.; 00119 if (m_countPropTime){ tprop = m_mdcCalibFunSvc->getTprop(_layernumber,z*10); } 00120 double dt = (_t - _T0Walk -_c0 - tprop - tof - tzero); 00121 /* 00122 std::cout<<"("<<_layernumber<<","<<_wirenumber<<") dt "<<dt 00123 <<" rt "<<_t 00124 <<" t0walk "<< _T0Walk 00125 <<" z "<<z 00126 <<" _c0 "<<_c0 00127 <<" tzero "<<tzero 00128 <<" tof "<<tof 00129 <<" tprop "<<tprop 00130 <<std::endl; 00131 */ 00132 return dt; 00133 }
int MdcxHit::type | ( | void | ) | const [inline] |
float MdcxHit::v | ( | ) | const [inline] |
Definition at line 81 of file MdcxHit.h.
References _v.
Referenced by MdcxHel::derivatives(), and residual().
00081 {return _v;} // drift velocity
int MdcxHit::WireNo | ( | void | ) | const [inline] |
Definition at line 66 of file MdcxHit.h.
References _wirenumber.
00066 {return _wirenumber;} // Wire#
float MdcxHit::wx | ( | ) | const [inline] |
Definition at line 75 of file MdcxHit.h.
References _wx.
Referenced by MdcxHel::Doca().
00075 {return _wx;}
float MdcxHit::wy | ( | ) | const [inline] |
Definition at line 76 of file MdcxHit.h.
References _wy.
Referenced by MdcxHel::Doca().
00076 {return _wy;}
float MdcxHit::wz | ( | ) | const [inline] |
Definition at line 77 of file MdcxHit.h.
References _wz.
Referenced by MdcxHel::Doca().
00077 {return _wz;}
float MdcxHit::x | ( | void | ) | const [inline] |
Definition at line 69 of file MdcxHit.h.
References _x.
Referenced by MdcxHel::Doca(), and MdcxFindSegs::trial().
00069 {return _x;} // x of wire
float MdcxHit::xneg | ( | ) | const [inline] |
Definition at line 73 of file MdcxHit.h.
References _xneg.
Referenced by MdcxFindSegs::trial().
00073 {return _xneg;}
float MdcxHit::xpos | ( | ) | const [inline] |
Definition at line 71 of file MdcxHit.h.
References _xpos.
Referenced by MdcxFindSegs::trial().
00071 {return _xpos;}
float MdcxHit::y | ( | void | ) | const [inline] |
Definition at line 70 of file MdcxHit.h.
References _y.
Referenced by MdcxHel::Doca(), and MdcxFindSegs::trial().
00070 {return _y;} // y of wire
float MdcxHit::yneg | ( | ) | const [inline] |
Definition at line 74 of file MdcxHit.h.
References _yneg.
Referenced by MdcxFindSegs::trial().
00074 {return _yneg;}
float MdcxHit::ypos | ( | ) | const [inline] |
Definition at line 72 of file MdcxHit.h.
References _ypos.
Referenced by MdcxFindSegs::trial().
00072 {return _ypos;}
float MdcxHit::_c0 [protected] |
int MdcxHit::_consterr [protected] |
float MdcxHit::_cp [protected] |
float MdcxHit::_cresol [protected] |
float MdcxHit::_d [protected] |
float MdcxHit::_e [protected] |
unsigned MdcxHit::_iAdc [protected] |
unsigned MdcxHit::_iTdc [protected] |
float MdcxHit::_L [protected] |
unsigned MdcxHit::_layernumber [protected] |
const MdcDigi* MdcxHit::_mdcDigi [protected] |
const MdcHit* MdcxHit::_mdcHit [protected] |
float MdcxHit::_p [protected] |
double MdcxHit::_pw [protected] |
float MdcxHit::_q [protected] |
float MdcxHit::_r [protected] |
float MdcxHit::_s [protected] |
float MdcxHit::_sp [protected] |
unsigned MdcxHit::_superlayer [protected] |
float MdcxHit::_t [protected] |
float MdcxHit::_T0Walk [protected] |
int MdcxHit::_type [protected] |
float MdcxHit::_v [protected] |
unsigned MdcxHit::_wirenumber [protected] |
double MdcxHit::_wx [protected] |
double MdcxHit::_wy [protected] |
double MdcxHit::_wz [protected] |
float MdcxHit::_x [protected] |
float MdcxHit::_xneg [protected] |
float MdcxHit::_xpos [protected] |
float MdcxHit::_y [protected] |
float MdcxHit::_yneg [protected] |
float MdcxHit::_ypos [protected] |
bool MdcxHit::m_countPropTime = true [static, private] |
const MdcDetector * MdcxHit::m_gm = 0 [static, private] |
const MdcCalibFunSvc * MdcxHit::m_mdcCalibFunSvc = 0 [static, private] |
Definition at line 140 of file MdcxHit.h.
Referenced by d(), getSigma(), process(), setMdcCalibFunSvc(), and tcor().
int MdcxHit::usedonhel [protected] |
Definition at line 134 of file MdcxHit.h.
Referenced by GetUsedOnHel(), process(), and SetUsedOnHel().