1#include "MdcHoughFinder/HoughHit.h"
2#include "MdcHoughFinder/HoughGlobal.h"
3#include "RawEvent/RawDataUtil.h"
4#include "Identifier/MdcID.h"
5#include "MdcGeomSvc/IMdcGeomSvc.h"
6#include "MdcGeomSvc/MdcGeoWire.h"
7#include "MdcGeomSvc/MdcGeoLayer.h"
8#include "GaudiKernel/SvcFactory.h"
9#include "GaudiKernel/ISvcLocator.h"
10#include "GaudiKernel/StatusCode.h"
15double HoughHit::_bunchTime;
31 _layerPtr = _det->
Layer(_id);
32 _wirePtr = _det->
Wire(_id);
39 _rmid = _wirePtr->
rMid();
41 assert(_mdcGeomSvc!=NULL);
48 _midPoint = (eastP+westP)/2.;
55 _digiPtr(other._digiPtr),
57 _layerPtr(other._layerPtr), _wirePtr(other._wirePtr), _id(other._id),
58 _layer(other._layer), _wire(other._wire),
59 _rawTime(other._rawTime), _charge(other._charge),
60 _eastPoint(other._eastPoint),_westPoint(other._westPoint),_midPoint(other._midPoint),
61 _u(other._u),_v(other._v),
62 _type(other._type),_detectorType(other._detectorType),
63 _rmid(other._rmid), _slayerType(other._slayerType),
64 _cirlist(other._cirlist),_style(other._style),
65 _driftTime(other._driftTime), _driftDist(other._driftDist),
66 CF_drift(other.CF_drift),
67 vec_cfcir(other.vec_cfcir),
69 _truthU(other._truthU),
70 _truthV(other._truthV),
71 _truthR(other._truthR),
72 _truthlr(other._truthlr),
73 _truthPoint(other._truthPoint),
74 _truthDrift(other._truthDrift),
75 _deltad(other._deltad),
76 _flightLength(other._flightLength)
80 _digiPtr=(other._digiPtr);
82 _layerPtr=(other._layerPtr); _wirePtr=(other._wirePtr); _id=(other._id);
83 _layer=(other._layer); _wire=(other._wire);
84 _rawTime=(other._rawTime); _charge=(other._charge);
85 _eastPoint=(other._eastPoint);_westPoint=(other._westPoint);_midPoint=(other._midPoint);
86 _u=(other._u);_v=(other._v);
87 _type=(other._type);_detectorType=(other._detectorType);
88 _rmid=(other._rmid); _slayerType=(other._slayerType);
89 _cirlist=(other._cirlist);_style=(other._style);
90 _driftTime=(other._driftTime); _driftDist=(other._driftDist);
91 CF_drift = (other.CF_drift);
92 vec_cfcir = (other.vec_cfcir);
94 _truthU= (other._truthU);
95 _truthV= (other._truthV);
96 _truthR= (other._truthR);
97 _truthlr= (other._truthlr);
98 _truthDrift= (other._truthDrift);
99 _truthPoint= (other._truthPoint);
100 _deltad= (other._deltad);
101 _flightLength= (other._flightLength);
106 _truthDrift = aMcHit->getDriftDistance()/10.;
107 _truthPoint.setX(aMcHit->getPositionX()/10.);
108 _truthPoint.setY(aMcHit->getPositionY()/10.);
109 _truthPoint.setZ(aMcHit->getPositionZ()/10.);
111 int mcLR = aMcHit->getPositionFlag();
114 if (mcLR == 1) mcLR = -1;
115 if (mcLR == 0) mcLR = 1;
116 _truthId = aMcHit->getTrackIndex();
120 _truthU =
getConformal_u( _truthPoint.x(), _truthPoint.y(), _truthDrift );
121 _truthV =
getConformal_v( _truthPoint.y(), _truthPoint.x(), _truthDrift );
122 _truthR =
getConformal_r( _truthPoint.x(), _truthPoint.y(), _truthDrift );
130 _u = 2*
x/(
x*
x+
y*
y-r*r);
131 _v = 2*
y/(
x*
x+
y*
y-r*r);
132 CF_drift = 2*r/(
x*
x+
y*
y-r*r);
136 return 2*
x/(
x*
x+
y*
y-r*r);
139 return 2*
x/(
x*
x+
y*
y-r*r);
142 return 2*r/(
x*
x+
y*
y-r*r);
146 double tprop = _calibPtr->
getTprop(_layer,0);
147 double T0Walk = _calibPtr->
getT0(_layer,_wire) + _calibPtr->
getTimeWalk(_layer, _charge);
149 double driftT = _rawTime - T0Walk - 1.e9*_bunchTime- tprop;
153 double tprop = _calibPtr->
getTprop(_layer,z*10.);
154 double T0Walk = _calibPtr->
getT0(_layer,_wire) + _calibPtr->
getTimeWalk(_layer, _charge);
156 double driftT = _rawTime - T0Walk - 1.e9*tof - tprop;
164 return calDriftDist(bunchTime+crudeTof(), ambig, 0., 0., 0. );
173 if (ambig==1) lrCalib = 0;
174 else if (ambig==-1) lrCalib = 1;
177 if (fabs(z)>150. || fabs(
driftTime(tof,z))>1500.){
183 if (
abs(driftD)<0.00001) driftD = 0.00001;
188 std::cout<<
"("<<_layer<<
","<<_wire<<
") "<<std::endl;
192 std::cout<<
"("<<_layer<<
","<<_wire<<
") id "<<this->
digi()->
getTrackIndex()<<
" xyz "<<_midPoint<<endl;
195 std::cout<<
"("<<_layer<<
","<<_wire<<
") truth "<<_truthId<<
" xyz "<<_truthPoint<<
" uv "<<_truthU<<
","<<_truthV<<
") "<<
" cir list "<<_cirlist<<
" ambig "<<_truthlr<<std::endl;
202 if(nomShift>0)
return 1;
203 else if(nomShift<0)
return -1;
212 vector<CFCir>().swap(vec_cfcir);
213 for(
int i =0; i<
n; i++){
214 double phi_slice = (phi_last-phi_begin)/
n;
215 double phi = phi_begin + (1/2.+i)*phi_slice;
216 double x = _u + r*
cos(phi);
217 double y = _v + r*
sin(phi);
218 vec_cfcir.push_back(
CFCir(
x,
y,phi,
n,_u,_v,r) );
double sin(const BesAngle a)
double cos(const BesAngle a)
const MdcDigi * digi() const
void conformalTrans(double x, double y, double r)
const MdcLayer * layer() const
void makeCir(int n, double phi_begin, double phi_last, double r)
void setTruthInfo(const MdcMcHit *&mcHit)
int slayerType(int layer)
double getConformal_v(double, double, double)
double calDriftDist(double, int, double, double, double) const
double getConformal_r(double, double, double)
const MdcSWire * wire() const
HoughHit & operator=(const HoughHit &other)
double getConformal_u(double, double, double)
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
double nomShift(void) const
const MdcGeoWire *const Wire(unsigned id)
const MdcGeoLayer *const Layer(unsigned id)
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
static double MdcTime(int timeChannel)
virtual Identifier identify() const
unsigned int getChargeChannel() const
int getTrackIndex() const
unsigned int getTimeChannel() const