Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MdcxHit Class Reference

#include <MdcxHit.h>

List of all members.

Public Member Functions

float d (float zh=0.0, float tof=0.0, float tzero=0.0, int wamb=0, float eang=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 d (MdcxHel &hel) const
std::vector< float > derivatives (MdcxHel &hel) const
std::vector< float > derivatives (MdcxHel &hel) const
float e (float dd=0.0) const
float e (float dd=0.0) const
const MdcDigigetDigi () const
const MdcDigigetDigi () const
const MdcHitgetMdcHit () const
const MdcHitgetMdcHit () const
int GetUsedOnHel () const
int GetUsedOnHel () const
int Layer () const
int Layer () const
 MdcxHit (const MdcHit *pdchhit, float c0=0, float cresol=.0180)
 MdcxHit (const MdcDigi *pdcdatum, float c0=0, float cresol=.0180)
 MdcxHit (const MdcHit *pdchhit, float c0=0, float cresol=.0180)
 MdcxHit (const MdcDigi *pdcdatum, float c0=0, float cresol=.0180)
float phiMid () const
float phiMid () const
void print (std::ostream &o, int i=0) const
void print (std::ostream &o, int i=0) const
void printAll (std::ostream &o, int i=0) const
void printAll (std::ostream &o, int i=0) const
float pull (MdcxHel &hel) const
float pull (MdcxHel &hel) const
float pw () const
float pw () const
float residual (MdcxHel &hel) const
float residual (MdcxHel &hel) const
void SetConstErr (int i)
void SetConstErr (int i)
void SetUsedOnHel (int i)
void SetUsedOnHel (int i)
float stereo () const
float stereo () const
int SuperLayer () const
int SuperLayer () const
float t () const
float t () const
float tcor (float zh=0.0, float tof=0.0, float tzero=0.0) const
float tcor (float zh=0.0, float tof=0.0, float tzero=0.0) const
int type () const
int type () const
float v () const
float v () const
int WireNo () const
int WireNo () const
float wx () const
float wx () const
float wy () const
float wy () const
float wz () const
float wz () const
float x () const
float x () const
float xneg () const
float xneg () const
float xpos () const
float xpos () const
float y () const
float y () const
float yneg () const
float yneg () const
float ypos () const
float ypos () const
virtual ~MdcxHit ()
virtual ~MdcxHit ()

Static Public Member Functions

void setCountPropTime (bool countPropTime)
void setCountPropTime (bool countPropTime)
void setMdcCalibFunSvc (const MdcCalibFunSvc *calibSvc)
void setMdcCalibFunSvc (const MdcCalibFunSvc *calibSvc)
void setMdcDetector (const MdcDetector *gm)
void setMdcDetector (const MdcDetector *gm)

Protected Member Functions

void process ()
void process ()

Protected Attributes

float _c0
int _consterr
float _cp
float _cresol
float _d
float _e
unsigned _iAdc
unsigned _iTdc
float _L
unsigned _layernumber
const MdcDigi_mdcDigi
const MdcDigi_mdcDigi
const MdcHit_mdcHit
const MdcHit_mdcHit
float _p
double _pw
float _q
float _r
float _s
float _sp
unsigned _superlayer
float _t
float _T0Walk
int _type
float _v
unsigned _wirenumber
double _wx
double _wy
double _wz
float _x
float _xneg
float _xpos
float _y
float _yneg
float _ypos
int usedonhel

Private Member Functions

double getSigma (float driftDist, int ambig=0, double entrAngle=0, double dipAngle=0, double z=0) const
double getSigma (float driftDist, int ambig=0, double entrAngle=0, double dipAngle=0, double z=0) const
 MdcxHit (const MdcxHit &)
 MdcxHit (const MdcxHit &)
MdcxHitoperator= (const MdcxHit &)
MdcxHitoperator= (const MdcxHit &)
bool operator== (const MdcxHit &) const
bool operator== (const MdcxHit &) const

Static Private Attributes

bool m_countPropTime = true
const MdcDetectorm_gm
const MdcDetectorm_gm = 0
const MdcCalibFunSvcm_mdcCalibFunSvc
const MdcCalibFunSvcm_mdcCalibFunSvc = 0


Constructor & Destructor Documentation

MdcxHit::MdcxHit const MdcDigi pdcdatum,
float  c0 = 0,
float  cresol = .0180
 

00049     :_mdcHit(0), _mdcDigi(pdcdatum), _c0(c0), _cresol(cresol)
00050 {
00051   process();
00052 }

MdcxHit::MdcxHit const MdcHit pdchhit,
float  c0 = 0,
float  cresol = .0180
 

00055     :_mdcHit(pdchhit),_mdcDigi(pdchhit->digi()), _c0(c0), _cresol(cresol)
00056 {
00057   process();
00058 }

virtual MdcxHit::~MdcxHit  )  [inline, virtual]
 

00050 { };

MdcxHit::MdcxHit const MdcxHit  )  [private]
 

MdcxHit::MdcxHit const MdcDigi pdcdatum,
float  c0 = 0,
float  cresol = .0180
 

MdcxHit::MdcxHit const MdcHit pdchhit,
float  c0 = 0,
float  cresol = .0180
 

virtual MdcxHit::~MdcxHit  )  [inline, virtual]
 

00050 { };

MdcxHit::MdcxHit const MdcxHit  )  [private]
 


Member Function Documentation

float MdcxHit::d float  zh = 0.0,
float  tof = 0.0,
float  tzero = 0.0,
int  wamb = 0,
float  eang = 0.0
const
 

float MdcxHit::d MdcxHel hel  )  const
 

float MdcxHit::d float  zh = 0.0,
float  tof = 0.0,
float  tzero = 0.0,
int  wamb = 0,
float  eang = 0.0
const
 

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   int lrCalib = 2;
00141   if (wamb==1)lrCalib = 0;
00142   else if (wamb==-1) lrCalib = 1;
00143   double eAngle = EntranceAngle(entranceAngle);
00144 
00145   double driftD = 0.1 * m_mdcCalibFunSvc->driftTimeToDist(t_corr,_layernumber,_wirenumber,lrCalib,eAngle);//to cm
00146 
00147 
00148   if (driftD<=0.0001) driftD = 0.001;
00149   return driftD;
00150 } 

float MdcxHit::d MdcxHel hel  )  const
 

00152                                    {
00153   float doca=hel.Doca(*this); // changes hel's internal state...
00154   return d(hel.Doca_Zh(),hel.Doca_Tof(),hel.T0(),
00155       hel.Doca_Wamb(),hel.Doca_Eang());
00156 }//endof d

std::vector<float> MdcxHit::derivatives MdcxHel hel  )  const
 

std::vector< float > MdcxHit::derivatives MdcxHel hel  )  const
 

00184                                                         {
00185   // compute derivatives for |hel|
00186   std::vector<float> deriv = hel.derivatives(*this);
00187   float dtemp = d(hel.Doca_Zh(), hel.Doca_Tof(), hel.T0(),
00188       hel.Doca_Wamb(), hel.Doca_Eang());
00189   //float dtemp = d(hel);
00190   deriv[0] = dtemp - deriv[0];
00191   //  deriv[0] -= v()*hel.T0();
00192   float ewire = e(dtemp);
00193   for (uint32_t i = 0; i < deriv.size(); i++) deriv[i] /= ewire;
00194   return deriv;
00195 }//endof derivatives

float MdcxHit::e float  dd = 0.0  )  const
 

float MdcxHit::e float  dd = 0.0  )  const
 

00158                               {
00159   //if (0!=_consterr) return _cresol;//yzhang delete 2009-11-03 
00160   float errTemp = fabs(getSigma(dd));
00161   //  protect against resolution = 0; set min resol to 1 nm
00162   float errMin = 1.0e-7;
00163   return errTemp<errMin?errMin:errTemp;
00164 }

const MdcDigi* MdcxHit::getDigi  )  const [inline]
 

00063 {return _mdcDigi;}

const MdcDigi* MdcxHit::getDigi  )  const [inline]
 

00063 {return _mdcDigi;}

const MdcHit* MdcxHit::getMdcHit  )  const [inline]
 

00064 {return _mdcHit;}

const MdcHit* MdcxHit::getMdcHit  )  const [inline]
 

00064 {return _mdcHit;}

double MdcxHit::getSigma float  driftDist,
int  ambig = 0,
double  entrAngle = 0,
double  dipAngle = 0,
double  z = 0
const [private]
 

double MdcxHit::getSigma float  driftDist,
int  ambig = 0,
double  entrAngle = 0,
double  dipAngle = 0,
double  z = 0
const [private]
 

00209                                      {
00210   int lrCalib = 2;
00211   if (ambig != 0) lrCalib = (ambig == 1) ? 0 : 1;
00212   double eAngle = EntranceAngle(entranceAngle); 
00213   double sig = 0.1 * m_mdcCalibFunSvc->getSigma(_layernumber, lrCalib,
00214       driftDist*10., eAngle, tan(dipAngle), z*10., _iAdc);
00215   //double sig = 0.1 * m_mdcCalibFunSvc->getSigma(_layernumber, _wirenumber, lrCalib,
00216       //driftDist*10., eAngle, tan(dipAngle), z*10., _iAdc);
00217 #ifdef MDCXRECO_RESLAYER
00218   if (Layer() == g_resLayer) {
00219     //give a huge sigma to skip this layer when fit track
00220     return 9999.;
00221   }
00222 #endif 
00223   return sig;
00224 }

int MdcxHit::GetUsedOnHel  )  const [inline]
 

00103 {return usedonhel;}

int MdcxHit::GetUsedOnHel  )  const [inline]
 

00103 {return usedonhel;}

int MdcxHit::Layer void   )  const [inline]
 

00067 {return _layernumber;}// layer#

int MdcxHit::Layer void   )  const [inline]
 

00067 {return _layernumber;}// layer#

MdcxHit& MdcxHit::operator= const MdcxHit  )  [private]
 

MdcxHit& MdcxHit::operator= const MdcxHit  )  [private]
 

bool MdcxHit::operator== const MdcxHit  )  const [private]
 

bool MdcxHit::operator== const MdcxHit  )  const [private]
 

float MdcxHit::phiMid  )  const [inline]
 

00079 {return _pw;} //yzhang add

float MdcxHit::phiMid  )  const [inline]
 

00079 {return _pw;} //yzhang add

void MdcxHit::print std::ostream o,
int  i = 0
const
 

void MdcxHit::print std::ostream o,
int  i = 0
const
 

00197                                            {
00198   o << " (" << Layer() << "," << WireNo() << ") " ;
00199 }

void MdcxHit::printAll std::ostream o,
int  i = 0
const
 

void MdcxHit::printAll std::ostream o,
int  i = 0
const
 

00201                                               {
00202   o << " hit" << i << " (" << Layer() << "," << WireNo() << ")  ";
00203   if (getMdcHit()) o << " phi "<< getMdcHit()->phi();
00204   o << "dd " << d() << " dde "
00205     << e() << " rt " << t() << endl;
00206 }

void MdcxHit::process  )  [protected]
 

void MdcxHit::process  )  [protected]
 

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
 

float MdcxHit::pull MdcxHel hel  )  const
 

00166                                       {
00167   // compute pulls for |hel|
00168   float doca=hel.Doca(*this); if(hel.Mode() == 0)doca=fabs(doca);
00169   return (d(hel.Doca_Zh(),hel.Doca_Tof(),hel.T0(),
00170         hel.Doca_Wamb(),hel.Doca_Eang())-doca)/e(doca);
00171   //return residual(hel)/e();
00172 }

float MdcxHit::pw  )  const [inline]
 

00078 {return _pw;} 

float MdcxHit::pw  )  const [inline]
 

00078 {return _pw;} 

float MdcxHit::residual MdcxHel hel  )  const
 

float MdcxHit::residual MdcxHel hel  )  const
 

00174                                           {
00175   // compute residuals for |hel|
00176   float doca = hel.Doca(_wx, _wy, _wz, _x, _y);
00177   if(hel.Mode() == 0) doca = fabs(doca);
00178   doca += v()*hel.T0();
00179   return d(hel.Doca_Zh(),hel.Doca_Tof(),hel.T0(),
00180       hel.Doca_Wamb(),hel.Doca_Eang())-doca;
00181   //return d(hel) - doca;
00182 }

void MdcxHit::SetConstErr int  i  )  [inline]
 

00085 {_consterr = i;}

void MdcxHit::SetConstErr int  i  )  [inline]
 

00085 {_consterr = i;}

void MdcxHit::setCountPropTime bool  countPropTime  )  [static]
 

void MdcxHit::setCountPropTime bool  countPropTime  )  [static]
 

00064                                                  {
00065   m_countPropTime = countPropTime;
00066 }

void MdcxHit::setMdcCalibFunSvc const MdcCalibFunSvc calibSvc  )  [static]
 

void MdcxHit::setMdcCalibFunSvc const MdcCalibFunSvc calibSvc  )  [static]
 

00060                                                               {
00061   m_mdcCalibFunSvc = calibSvc;
00062 }

void MdcxHit::setMdcDetector const MdcDetector gm  )  [static]
 

void MdcxHit::setMdcDetector const MdcDetector gm  )  [static]
 

00068                                                   {
00069   m_gm = gm;
00070 }

void MdcxHit::SetUsedOnHel int  i  )  [inline]
 

00102 {usedonhel=i;}

void MdcxHit::SetUsedOnHel int  i  )  [inline]
 

00102 {usedonhel=i;}

float MdcxHit::stereo void   )  const [inline]
 

00080 {return _s;} // stereo angle of wire

float MdcxHit::stereo void   )  const [inline]
 

00080 {return _s;} // stereo angle of wire

int MdcxHit::SuperLayer  )  const [inline]
 

00065 {return _superlayer;} //SuperLayer#

int MdcxHit::SuperLayer  )  const [inline]
 

00065 {return _superlayer;} //SuperLayer#

float MdcxHit::t  )  const [inline]
 

00068 {return _t;} // drift time

float MdcxHit::t  )  const [inline]
 

00068 {return _t;} // drift time

float MdcxHit::tcor float  zh = 0.0,
float  tof = 0.0,
float  tzero = 0.0
const
 

float MdcxHit::tcor float  zh = 0.0,
float  tof = 0.0,
float  tzero = 0.0
const
 

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]
 

00082 {return _type;} // flags |MdcxHit|

int MdcxHit::type void   )  const [inline]
 

00082 {return _type;} // flags |MdcxHit|

float MdcxHit::v void   )  const [inline]
 

00081 {return _v;} // drift velocity

float MdcxHit::v  )  const [inline]
 

00081 {return _v;} // drift velocity

int MdcxHit::WireNo void   )  const [inline]
 

00066 {return _wirenumber;} // Wire#

int MdcxHit::WireNo void   )  const [inline]
 

00066 {return _wirenumber;} // Wire#

float MdcxHit::wx  )  const [inline]
 

00075 {return _wx;} 

float MdcxHit::wx  )  const [inline]
 

00075 {return _wx;} 

float MdcxHit::wy  )  const [inline]
 

00076 {return _wy;} 

float MdcxHit::wy  )  const [inline]
 

00076 {return _wy;} 

float MdcxHit::wz  )  const [inline]
 

00077 {return _wz;} 

float MdcxHit::wz  )  const [inline]
 

00077 {return _wz;} 

float MdcxHit::x void   )  const [inline]
 

00069 {return _x;} // x of wire

float MdcxHit::x void   )  const [inline]
 

00069 {return _x;} // x of wire

float MdcxHit::xneg  )  const [inline]
 

00073 {return _xneg;} 

float MdcxHit::xneg  )  const [inline]
 

00073 {return _xneg;} 

float MdcxHit::xpos  )  const [inline]
 

00071 {return _xpos;}  

float MdcxHit::xpos  )  const [inline]
 

00071 {return _xpos;}  

float MdcxHit::y void   )  const [inline]
 

00070 {return _y;} // y of wire

float MdcxHit::y void   )  const [inline]
 

00070 {return _y;} // y of wire

float MdcxHit::yneg  )  const [inline]
 

00074 {return _yneg;} 

float MdcxHit::yneg  )  const [inline]
 

00074 {return _yneg;} 

float MdcxHit::ypos  )  const [inline]
 

00072 {return _ypos;} 

float MdcxHit::ypos  )  const [inline]
 

00072 {return _ypos;} 


Member Data Documentation

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 MdcDigi* MdcxHit::_mdcDigi [protected]
 

const MdcHit* MdcxHit::_mdcHit [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 [static, private]
 

const MdcDetector * MdcxHit::m_gm = 0 [static, private]
 

const MdcCalibFunSvc* MdcxHit::m_mdcCalibFunSvc [static, private]
 

const MdcCalibFunSvc * MdcxHit::m_mdcCalibFunSvc = 0 [static, private]
 

int MdcxHit::usedonhel [protected]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:30:50 2011 for BOSS6.5.5 by  doxygen 1.3.9.1