22#include "CLHEP/Alist/AIterator.h"
23#include "EventModel/Event.h"
24#include "GaudiKernel/Bootstrap.h"
25#include "GaudiKernel/IDataProviderSvc.h"
26#include "GaudiKernel/IService.h"
27#include "GaudiKernel/ISvcLocator.h"
28#include "GaudiKernel/SmartDataPtr.h"
29#include "Identifier/MdcID.h"
30#include "MdcData/MdcHit.h"
31#include "MdcGeom/Constants.h"
32#include "MdcGeom/EntranceAngle.h"
33#include "MdcRawEvent/MdcDigi.h"
34#include "MdcxReco/MdcxHel.h"
35#include "MdcxReco/MdcxHits.h"
36#include "RawEvent/RawDataUtil.h"
41#ifdef MDCXRECO_RESLAYER
45bool MdcxHit::m_countPropTime =
true;
59 m_mdcCalibFunSvc = calibSvc;
68 assert( m_mdcCalibFunSvc );
90 double pw = atan2(
_y,
_x );
94 _wz = ( tst * tst < 1.0 ) ? sqrt( 1.0 - tst * tst ) : 0.0;
113 if ( m_countPropTime ) { tprop = m_mdcCalibFunSvc->getTprop(
_layernumber, z * 10 ); }
129float MdcxHit::d(
float z,
float tof,
float tzero,
int wamb,
float entranceAngle )
const {
133 float t_corr =
tcor( z, tof, tzero );
137 if ( fabs( z ) > 150. || fabs( t_corr ) > 1500. || fabs( eAngle ) > 999 ) {
return 9999.; }
141 if ( wamb == 1 ) lrCalib = 0;
142 else if ( wamb == -1 ) lrCalib = 1;
151 if ( fabs( driftD ) <= 0.0001 ) driftD = 0.001;
156 float doca = hel.
Doca( *
this );
162 float errTemp = fabs( getSigma( dd ) );
164 float errMin = 1.0e-7;
165 return errTemp < errMin ? errMin : errTemp;
170 float doca = hel.
Doca( *
this );
171 if ( hel.
Mode() == 0 ) doca = fabs( doca );
181 if ( hel.
Mode() == 0 ) doca = fabs( doca );
182 doca +=
v() * hel.
T0();
189 std::vector<float> deriv = hel.
derivatives( *
this );
192 deriv[0] = dtemp - deriv[0];
194 float ewire =
e( dtemp );
195 for ( uint32_t i = 0; i < deriv.size(); i++ ) deriv[i] /= ewire;
204 o <<
" hit" << i <<
" (" <<
Layer() <<
"," <<
WireNo() <<
") ";
206 o <<
"dd " <<
d() <<
" dde " <<
e() <<
" rt " <<
t() << endl;
209double MdcxHit::getSigma(
float driftDist,
int ambig,
double entranceAngle,
double dipAngle,
212 if ( ambig != 0 ) lrCalib = ( ambig == 1 ) ? 0 : 1;
213 double eAngle = EntranceAngle( entranceAngle );
217 double sig = 0.1 * m_mdcCalibFunSvc->getSigma(
_layernumber, lrCalib, driftDist * 10.,
218 eAngle,
tan( dipAngle ), z * 10.,
_iAdc );
221#ifdef MDCXRECO_RESLAYER
222 if (
Layer() == g_resLayer )
double tan(const BesAngle a)
double sin(const BesAngle a)
double cos(const BesAngle a)
static const int viewOfsLayer[11]
static int layer(const Identifier &id)
Values of different levels (failure returns 0).
static int wire(const Identifier &id)
double yWire(int cell) const
double phiOffset(void) const
double zLength(void) const
double stereo(void) const
double xWire(int cell) const
double Doca(double WX, double WY, double WZ, double X, double Y, double Z=0.0)
std::vector< float > derivatives(const MdcxHit &h)
float d(MdcxHel &hel) const
float pull(MdcxHel &hel) const
const MdcDigi * getDigi() const
void printAll(std::ostream &o, int i=0) const
static void setMdcCalibFunSvc(const IMdcCalibFunSvc *calibSvc)
float tcor(float zh=0.0, float tof=0.0, float tzero=0.0) const
std::vector< float > derivatives(MdcxHel &hel) const
float e(float dd=0.0) const
void print(std::ostream &o, int i=0) const
static void setMdcDetector(const MdcDetector *gm)
float residual(MdcxHel &hel) const
MdcxHit(const MdcDigi *pdcdatum, float c0=0, float cresol=.0180)
const MdcHit * getMdcHit() const
static void setCountPropTime(bool countPropTime)
static double MdcTime(int timeChannel)
static double MdcCharge(int chargeChannel)
int getTrackIndex() const