41 m_bunchTime = bunchTime;
48 m_driftDist = driftDistance();
70 m_cgemCluster = cgemCluster;
78 m_flag = cgemCluster->
getflag();
80 m_bunchTime = bunchTime;
85 m_hitPosition.setZ(cgemCluster->
getRecZ()/10.);
107 m_cgemCluster = NULL;
110 m_mdcMcHit = mdcMcHit;
115 m_bunchTime = bunchTime;
143 m_cgemCluster = NULL;
145 m_cgemMcHit = cgemMcHit;
153 m_bunchTime = bunchTime;
178 m_hitID(other.m_hitID),
179 m_hitType(other.m_hitType),
180 m_cgemCluster(other.m_cgemCluster),
181 m_mdcDigi(other.m_mdcDigi),
182 m_cgemMcHit(other.m_cgemMcHit),
183 m_mdcMcHit(other.m_mdcMcHit),
186 m_flag(other.m_flag),
188 m_bunchTime(other.m_bunchTime),
189 m_rawTime(other.m_rawTime),
190 m_depositEnergy(other.m_depositEnergy),
191 m_hitPosition(other.m_hitPosition),
192 m_westPoint(other.m_westPoint),
193 m_eastPoint(other.m_eastPoint),
194 m_driftDist(other.m_driftDist),
195 m_residual(other.m_residual),
201 m_trkID(other.m_trkID),
203 m_pairHit(other.m_pairHit),
204 m_halfCircle(other.m_halfCircle),
205 m_position(other.m_position),
206 m_mdcHit(other.m_mdcHit)
211 m_hitID = other.m_hitID;
212 m_hitType = other.m_hitType;
213 m_cgemCluster = other.m_cgemCluster;
214 m_mdcDigi = other.m_mdcDigi;
215 m_cgemMcHit = other.m_cgemMcHit;
216 m_mdcMcHit = other.m_mdcMcHit;
217 m_layer = other.m_layer;
218 m_wire = other.m_wire;
219 m_flag = other.m_flag;
221 m_bunchTime = other.m_bunchTime;
222 m_rawTime = other.m_rawTime;
223 m_depositEnergy = other.m_depositEnergy;
224 m_hitPosition = other.m_hitPosition;
225 m_westPoint = other.m_westPoint;
226 m_eastPoint = other.m_eastPoint;
227 m_driftDist = other.m_driftDist;
228 m_residual = other.m_residual;
234 m_trkID = other.m_trkID;
236 m_pairHit = other.m_pairHit;
237 m_halfCircle = other.m_halfCircle;
238 m_position = other.m_position;
239 m_mdcHit =other.m_mdcHit;
291 if(nomShift>0)
return 1;
292 else if(nomShift<0)
return -1;
298 double ToF = 1.e9*sqrt(m_hitPosition.x()*m_hitPosition.x()+m_hitPosition.y()*m_hitPosition.y())/
Constants::c;
299 double Tprop = m_mdcCalibFunSvc->
getTprop(m_layer,m_hitPosition.z()*10.);
300 double Twalk = m_mdcCalibFunSvc->
getTimeWalk(m_layer, m_depositEnergy);
301 double T0 = m_mdcCalibFunSvc->
getT0(m_layer,m_wire);
302 double driftTime = m_rawTime - 1.e9*m_bunchTime - ToF - Tprop - Twalk -T0;
310double HoughHit::driftDistance()
314 if(fabs(driftT)>1500.||fabs(m_hitPosition.z()>150.)){
318 double driftDist(-1);
322 double entranceAngle = 0;
323 driftDist = 0.1 * m_mdcCalibFunSvc->
driftTimeToDist(driftT,m_layer,m_wire,lrCalib,entranceAngle);
331 case CGEMHIT : hitType =
"CGEMHIT";
break;
332 case MDCHIT : hitType =
"MDCHIT";
break;
333 case CGEMMCHIT : hitType =
"CGEMMCHIT";
break;
334 case MDCMCHIT : hitType =
"MDCMCHIT";
break;
335 default : hitType =
"";
337 cout<<
"ID:" <<setw(6)<<m_hitID;
338 cout<<
"(" <<setw(2)<<m_layer;
339 cout<<
"," <<setw(3)<<m_wire<<
") ";
340 cout<<
" flag:" <<setw(3)<<m_flag;
341 if(m_hitType==
CGEMHIT) {cout<<
" clusterId "<<m_cgemCluster->
getclusterid()<<
" pos: "<<m_hitPosition;}
345 cout<<
" trkID:"<<setw(3)<<(m_pairHit->
getTrkID())[0];
357 cout<<
" trkID:"<<setw(3)<<m_trkID[0];
358 cout<<
" McHit:("<<setw(10)<<m_hitPosition.x()<<
", "<<setw(10)<<m_hitPosition.y()<<
", "<<setw(10)<<m_hitPosition.z()<<
") ";
400 vector<int>::iterator it0 = m_trkID.begin();
401 vector<int>::iterator result = find(m_trkID.begin(),m_trkID.end(),trkID);
402 if(result!=m_trkID.end()) {
403 m_trkID.erase(result);
404 vector<double>::iterator itRes = m_vecResid.begin()+(result-it0);
405 if(itRes!=m_vecResid.end()) m_vecResid.erase(itRes);
411 if(
getFlag()==0)
return m_position;
416 double xc = track->
center().x();
417 double yc = track->
center().y();
418 double rTrack = track->
radius();
425 double xEast = eastPoint.x()/10.0;
426 double xWest = westPoint.x()/10.0;
427 double yEast = eastPoint.y()/10.0;
428 double yWest = westPoint.y()/10.0;
429 double zEast = eastPoint.z()/10.0;
430 double zWest = westPoint.z()/10.0;
434 double west2east = sqrt((xEast-xWest)*(xEast-xWest)+(yEast-yWest)*(yEast-yWest));
436 double slope = (yEast-yWest)/(xEast-xWest);
437 double intercept = (yWest-slope*xWest+yEast-slope*xEast)/2;
438 double a = 1+slope*slope;
439 double b = -2*(xc+slope*yc-slope*intercept);
440 double c1 = xc*xc+(yc-intercept)*(yc-intercept)-(rTrack+drift)*(rTrack+drift);
441 double c2 = xc*xc+(yc-intercept)*(yc-intercept)-(rTrack-drift)*(rTrack-drift);
444 double delta1 = (b*b-4*a*
c1);
445 double delta2 = (b*b-4*a*c2);
449 double x1 = (-b+sqrt(delta1))/(2*a);
450 double x2 = (-b-sqrt(delta1))/(2*a);
451 double y1 = slope*x1+intercept;
452 double y2 = slope*x2+intercept;
453 if((x1-xWest)*(x1-xEast)<0){
454 double l = sqrt((x1-xWest)*(x1-xWest)+(y1-yWest)*(y1-yWest));
455 z = zWest + l/west2east*fabs((zEast-zWest));
457 m_position.push_back(position);
459 if((x2-xWest)*(x2-xEast)<0){
460 double l = sqrt((x2-xWest)*(x2-xWest)+(y2-yWest)*(y2-yWest));
461 z = zWest + l/west2east*fabs((zEast-zWest));
463 m_position.push_back(position);
468 double x1 = (-b+sqrt(delta2))/(2*a);
469 double x2 = (-b-sqrt(delta2))/(2*a);
470 double y1 = slope*x1+intercept;
471 double y2 = slope*x2+intercept;
472 if((x1-xWest)*(x1-xEast)<0){
473 double l = sqrt((x1-xWest)*(x1-xWest)+(y1-yWest)*(y1-yWest));
474 z = zWest + l/west2east*fabs((zEast-zWest));
476 m_position.push_back(position);
478 if((x2-xWest)*(x2-xEast)<0){
481 double l = sqrt((x2-xWest)*(x2-xWest)+(y2-yWest)*(y2-yWest));
482 z = zWest + l/west2east*fabs((zEast-zWest));
484 m_position.push_back(position);
500 double distance = (circleCenter-hitPoint).perp();
502 double Rc = fabs(track->
radius());
507 residual = driftDist-fabs(distance - Rc);
512 double rCgem = hitPoint.perp();
515 phiTrkFlt = track->
judgeHalf(
this)*phiTrkFlt;
518 double phiCrossPoint = crossPoint.phi();
519 double phiMeasure = hitPoint.phi();
520 residual = phiMeasure - phiCrossPoint;
530 for(vector<HepPoint3D>::iterator posIt = position.begin();posIt!=position.end();posIt++){
533 double zTrk = track->
dz()+
s*track->
tanl();
534 double res = point.z() - zTrk;
536 if(fabs(res)<minRes){
543 double zTrk = track->
dz()+
s*track->
tanl();
544 residual = m_hitPosition.z() - zTrk;
557 for(vector<HepPoint3D>::iterator posIt = position.begin();posIt!=position.end();posIt++){
560 double zTrk = track->
dz()+
s*track->
tanl();
561 double res = point.z() - zTrk;
562 if(fabs(res)<minRes){
567 m_hitPosition = hitPoint;
568 m_driftDist = driftDistance();
579 MdcHit mdcHit(m_mdcDigi,mdcDetector);
582 double d0 = -track->
dr();
584 double omega = track->
kappa()/fabs(track->
alpha());
585 double z0 = track->
dz();
586 double tanl = track->
tanl();
600 double hitWireLength = m_hitPosition.z()-m_westPoint.z();
602 double trkFlightLength = track->
flightLength(m_hitPosition);
603 const HelixTraj helixTraj(trkExchangePar);
604 TrkPoca trkPoca(helixTraj,trkFlightLength,*wire,hitWireLength);
605 trkFlightLength = trkPoca.
flt1();
606 hitWireLength = trkPoca.
flt2();
607 double doca = trkPoca.
doca();
615 Hep3Vector wireDirection, trackDirection;
617 wire->
getInfo(hitWireLength, positionOnDetector, wireDirection);
618 helixTraj.
getInfo(trkFlightLength, positionOntrack, trackDirection);
619 residual = m_driftDist - fabs(doca);
635 double rCgem = m_hitPosition.perp();
638 phiTrkFlt = track->
judgeHalf(
this)*phiTrkFlt;
640 positionOntrack = track->
x(phiTrkFlt);
641 positionOnDetector = track->
x(phiTrkFlt);
643 double phiCrossPoint = positionOntrack.phi();
644 double phiMeasure = m_hitPosition.phi();
645 double dphi = phiMeasure - phiCrossPoint;
double sin(const BesAngle a)
double cos(const BesAngle a)
HepGeom::Point3D< double > HepPoint3D
NTuple::Array< double > m_wire
NTuple::Array< double > m_layer
double getMiddleROfGapD() const
double getVFromPhiZ(double phi, double z, bool checkRange=true) const
CgemGeoLayer * getCgemLayer(int i) const
CgemGeoReadoutPlane * getReadoutPlane(int iLayer, int iSheet) const
double GetPositionXOfPostPoint() const
double GetPositionYOfPrePoint() const
double GetPositionZOfPrePoint() const
double GetPositionXOfPrePoint() const
double GetPositionZOfPostPoint() const
double GetPositionYOfPostPoint() const
double getPositionZ() const
int getPositionFlag() const
double getDepositEnergy() const
unsigned int getTrackIndex() const
double getDriftDistance() const
double getPositionX() const
Identifier identify() const
double getPositionY() const
virtual void getInfo(double fltLen, HepPoint3D &pos, Hep3Vector &dir) const
double flightLength(HepPoint3D &hit) const
const HepPoint3D & center(void) const
returns position of helix center(z = 0.);
double IntersectCylinder(double r) const
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
double flightArc(HepPoint3D &hit) const
double radius(void) const
returns radious of helix.
double dr(void) const
returns an element of parameters.
const HepPoint3D & pivot(void) const
returns pivot position.
MdcGeomSvc * getMdcGeomSvc() const
double residual(HoughTrack *track)
void dropTrkID(int trkID)
double getDriftDist() const
vector< int > getTrkID() const
const MdcMcHit * getMdcMcHit() const
HepPoint3D getHitPosition() const
HitType getHitType() const
void updateVHit(HoughTrack *track)
vector< HepPoint3D > & VHitPosition(HoughTrack *track)
HoughHit & operator=(const HoughHit &other)
int judgeHalf(HoughHit *hit)
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
double nomShift(void) const
HepPoint3D Forward(void) const
HepPoint3D Backward(void) const
const MdcGeoWire *const Wire(unsigned id)
const MdcGeoLayer *const Layer(unsigned id)
const Trajectory * hitTraj() const
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
unsigned int getTimeChannel() const
double getenergydeposit(void) const
double getRecZ(void) const
int getclusterid(void) const
int getlayerid(void) const
double getrecphi(void) const
double getrecv(void) const
int getsheetid(void) const
virtual void getInfo(double fltLen, HepPoint3D &pos, Hep3Vector &direction) const =0