16#include "MdcTrkRecon/MdcTrack.h"
20#include "MdcGeom/MdcLayer.h"
21#include "MdcData/MdcHitOnTrack.h"
22#include "MdcGeom/BesAngle.h"
23#include "MdcGeom/Constants.h"
24#include "CLHEP/Alist/AList.h"
25#include "TrkBase/TrkRep.h"
26#include "TrkFitter/TrkHelixRep.h"
27#include "TrkBase/TrkExchangePar.h"
28#include "TrkBase/TrkRecoTrk.h"
29#include "TrkFitter/TrkCircleMaker.h"
30#include "TrkBase/TrkContext.h"
32#include "MdcData/MdcRecoHitOnTrack.h"
33#include "BField/BField.h"
34#include "MdcData/MdcHit.h"
35#include "MdcData/MdcHitOnTrack.h"
36#include "MdcRawEvent/MdcDigi.h"
37#include "Identifier/Identifier.h"
38#include "Identifier/MdcID.h"
43 _firstLayer = _lastLayer = 0;
52 _theTrack = maker.
makeTrack(par, chisq, context, trackT0);
53 _firstLayer = _lastLayer = 0;
71 if (tkFit == 0)
return -1;
74 double omega = par.
omega();
75 double phi0 = par.
phi0();
76 double r2d2 = radius * radius - d0 * d0;
77 if (r2d2 < 0)
return -1;
78 double rinv = 1./radius;
79 double k2dinv = 1./(1 + omega * d0);
81 double arg = d0 * rinv + 0.5*omega * rinv * r2d2 * k2dinv;
82 if (fabs(
arg) > 1.0)
return -1;
86 double arg = -d0 * rinv - 0.5*omega * rinv * r2d2 * k2dinv;
87 if (fabs(
arg) > 1.0)
return -1;
96 double &arcLength,
int lCurl)
const {
104 if (tkFit == 0)
return -1;
106 double d0 = par.
d0();
107 double omega = par.
omega();
108 double phi0 = par.
phi0();
109 double r2d2 = radius * radius - d0 * d0;
110 if (r2d2 < 0)
return -1;
111 double rinv = 1./radius;
112 double k2dinv = 1./(1 + omega * d0);
113 if (k2dinv < 0.0)
return -1;
117 arg = d0 * rinv + 0.5*omega * rinv * r2d2 * k2dinv;
118 if (fabs(
arg) > 1.0)
return -1;
122 arg = -d0 * rinv - 0.5*omega * rinv * r2d2 * k2dinv;
123 if (fabs(
arg) > 1.0)
return -1;
127 arg = 0.5*omega * sqrt(r2d2 * k2dinv);
128 arcLength = 2. * asin(
arg) / omega;
150 if (fitresult == 0)
return;
157 double Bz = theField.
bFieldZ();
174 nHits = aList->
nHit();
181 double chisq = fitresult->
chisq();
182 int nDof = fitresult->
nDof();
184 double fltLenPoca = 0.0;
187 double phi0 = helix.
phi0();
188 double tanDip = helix.
tanDip();
190 double d0 = helix.
d0();
203 double pxy = fitresult->
pt();
204 if (pxy == 0.) helixPar[2] = 9999.;
205 else helixPar[2] =
q/fabs(pxy);
206 if(pxy>9999.) helixPar[2] = 0.00001;
208 helixPar[3] = helix.
z0();
210 helixPar[4] = tanDip;
213 HepSymMatrix mS(helix.
params().num_row(),0);
216 mS[2][2]=-333.567/Bz;
219 HepSymMatrix mVy = helix.
covariance().similarity(mS);
222 for (
int ie = 0 ; ie < 5 ; ie ++){
223 for (
int je = ie ; je < 5 ; je ++) {
224 errorMat[k] = mVy[ie][je];
229 px = pxy * (-
sin(helixPar[1]));
230 py = pxy *
cos(helixPar[1]);
231 pz = pxy * helixPar[4];
232 p = sqrt(pxy*pxy + pz*pz);
234 double theta = acos(pz/p);
235 double phi = atan2(py,px);
240 recMdcTrack->
setPx(px);
241 recMdcTrack->
setPy(py);
242 recMdcTrack->
setPz(pz);
243 recMdcTrack->
setP(p);
247 recMdcTrack->
setX(poca.x());
248 recMdcTrack->
setY(poca.y());
249 recMdcTrack->
setZ(poca.z());
250 recMdcTrack->
setR(sqrt(poca.x()*poca.x() + poca.y()*poca.y()));
268 double fiTerm = 999.;
271 for (;hot!=aList->
end();hot++){
277 recMdcHit->
setId(hitId);
289 double hotWireAmbig = recoHot->
wireAmbig();
290 double driftDist = fabs(recoHot->
drift());
291 double sigma = recoHot->
hitRms();
292 double doca = fabs(recoHot->
dcaToWire());
294 if ( hotWireAmbig == 1){
297 }
else if( hotWireAmbig == -1){
299 }
else if( hotWireAmbig == 0){
314 double res=999.,rese=999.;
315 if (recoHot->
resid(res,rese,
false)){
329 double fltLen = recoHot->
fltLen();
343 if (layerId >= maxLayerId){
344 maxLayerId = layerId;
347 if (layerId < minLayerId){
348 minLayerId = layerId;
360 hitList->push_back(recMdcHit);
361 SmartRef<RecMdcHit> refHit(recMdcHit);
362 hitRefVec.push_back(refHit);
367 if (fiTermHot!=NULL){
368 fiTerm=(1./sqrt(1.+tanDip*tanDip))*fiTermHot->
fltLen()*helix.
omega();
376 trackList->push_back(recMdcTrack);
double arg(const EvtComplex &c)
double sin(const BesAngle a)
double cos(const BesAngle a)
ObjectVector< RecMdcHit > RecMdcHitCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
SmartRefVector< RecMdcHit > HitRefVec
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
void setRad(const double)
void setFirstLayer(const int id)
void setPxy(const double pxy)
void setTrackId(const int trackId)
void setPy(const double py)
void setZ(const double z)
void setNster(const int ns)
void setX(const double x)
void setError(double err[15])
void setNdof(const int ndof)
void setTheta(const double theta)
void setStat(const int stat)
void setP(const double p)
void setHelix(double helix[5])
void setPoca(double poca[3])
void setR(const double r)
void setCharge(const int charge)
void setLastLayer(const int id)
void setY(const double y)
void setChi2(const double chi)
void setPhi(const double phi)
void setPz(const double pz)
void setPx(const double px)
value_type get_value() const
double entranceAngle() const
const MdcLayer * layer() const
const MdcDigi * digi() const
unsigned layernumber() const
unsigned wirenumber() const
unsigned adcIndex() const
double driftTime(double tof, double z) const
unsigned tdcIndex() const
const MdcHit * mdcHit() const
int projectToR(double radius, BesAngle &phiIntersect, int lCurl=0) const
bool operator==(const MdcTrack &tk) const
void storeTrack(int trackId, RecMdcTrackCol *trackList, RecMdcHitCol *hitList, int tkStat)
MdcTrack(TrkRecoTrk *aTrack)
virtual Identifier identify() const
void setMdcId(Identifier mdcid)
void setErrDriftDistRight(double erddr)
void setFltLen(double fltLen)
void setErrDriftDistLeft(double erddl)
void setDriftDistLeft(double ddl)
void setDoca(double doca)
void setChisqAdd(double pChisq)
void setZhit(double zhit)
void setDriftT(double driftT)
void setDriftDistRight(double ddr)
void setEntra(double entra)
void setPivot(const HepPoint3D &pivot)
void setVecHits(HitRefVec vechits)
void setFiTerm(double fiterm)
virtual void getInfo(double fltLen, HepPoint3D &pos, Hep3Vector &direction) const =0
virtual double pt(double fltL=0.) const =0
virtual double chisq() const =0
virtual int charge() const =0
virtual int nDof() const =0
virtual const TrkDifTraj & traj() const =0
virtual HepPoint3D position(double fltL) const =0
const HepVector & params() const
const HepSymMatrix & covariance() const
virtual TrkExchangePar helix(double fltL) const =0
hot_iterator begin() const
double resid(bool exclude=false) const
const TrkRep * getParentRep() const
TrkErrCode getFitStuff(HepVector &derivs, double &deltaChi) const
const BField & bField() const
const TrkFit * fitResult() const
virtual double arrivalTime(double fltL) const
TrkRecoTrk * makeTrack(const TrkExchangePar &helix, const double chi2, const TrkContext &, double trackT0) const