16#include "MdcTrkRecon/MdcTrack.h"
21#include "MdcGeom/MdcLayer.h"
22#include "MdcData/MdcHitOnTrack.h"
23#include "MdcGeom/BesAngle.h"
24#include "MdcGeom/Constants.h"
25#include "CLHEP/Alist/AList.h"
26#include "TrkBase/TrkRep.h"
27#include "TrkFitter/TrkHelixRep.h"
28#include "TrkBase/TrkExchangePar.h"
29#include "TrkBase/TrkRecoTrk.h"
30#include "TrkFitter/TrkCircleMaker.h"
31#include "TrkBase/TrkContext.h"
33#include "MdcData/MdcRecoHitOnTrack.h"
34#include "BField/BField.h"
35#include "MdcData/MdcHit.h"
36#include "MdcData/MdcHitOnTrack.h"
37#include "MdcRawEvent/MdcDigi.h"
38#include "Identifier/Identifier.h"
39#include "Identifier/MdcID.h"
41#include "CgemData/CgemHitOnTrack.h"
48 _firstLayer = _lastLayer = 0;
57 _theTrack = maker.
makeTrack(par, chisq, context, trackT0);
58 _firstLayer = _lastLayer = 0;
76 if (tkFit == 0)
return -1;
79 double omega = par.
omega();
80 double phi0 = par.
phi0();
81 double r2d2 = radius * radius - d0 * d0;
82 if (r2d2 < 0)
return -1;
83 double rinv = 1./radius;
84 double k2dinv = 1./(1 + omega * d0);
86 double arg = d0 * rinv + 0.5*omega * rinv * r2d2 * k2dinv;
87 if (fabs(
arg) > 1.0)
return -1;
91 double arg = -d0 * rinv - 0.5*omega * rinv * r2d2 * k2dinv;
92 if (fabs(
arg) > 1.0)
return -1;
101 double &arcLength,
int lCurl)
const {
109 if (tkFit == 0)
return -1;
111 double d0 = par.
d0();
112 double omega = par.
omega();
113 double phi0 = par.
phi0();
114 double r2d2 = radius * radius - d0 * d0;
115 if (r2d2 < 0)
return -1;
116 double rinv = 1./radius;
117 double k2dinv = 1./(1 + omega * d0);
118 if (k2dinv < 0.0)
return -1;
122 arg = d0 * rinv + 0.5*omega * rinv * r2d2 * k2dinv;
123 if (fabs(
arg) > 1.0)
return -1;
127 arg = -d0 * rinv - 0.5*omega * rinv * r2d2 * k2dinv;
128 if (fabs(
arg) > 1.0)
return -1;
132 arg = 0.5*omega * sqrt(r2d2 * k2dinv);
133 arcLength = 2. * asin(
arg) / omega;
159 if (fitresult == 0)
return;
166 double Bz = theField.
bFieldZ();
183 nHits = aList->
nHit();
190 double chisq = fitresult->
chisq();
191 int nDof = fitresult->
nDof();
193 double fltLenPoca = 0.0;
196 double phi0 = helix.
phi0();
197 double tanDip = helix.
tanDip();
199 double d0 = helix.
d0();
212 double pxy = fitresult->
pt();
213 if (pxy == 0.) helixPar[2] = 9999.;
214 else helixPar[2] =
q/fabs(pxy);
215 if(pxy>9999.) helixPar[2] = 0.00001;
217 helixPar[3] = helix.
z0();
219 helixPar[4] = tanDip;
222 HepSymMatrix mS(helix.
params().num_row(),0);
225 mS[2][2]=-333.567/Bz;
228 HepSymMatrix mVy = helix.
covariance().similarity(mS);
231 for (
int ie = 0 ; ie < 5 ; ie ++){
232 for (
int je = ie ; je < 5 ; je ++) {
233 errorMat[k] = mVy[ie][je];
238 px = pxy * (-
sin(helixPar[1]));
239 py = pxy *
cos(helixPar[1]);
240 pz = pxy * helixPar[4];
241 p = sqrt(pxy*pxy + pz*pz);
243 double theta = acos(pz/p);
244 double phi = atan2(py,px);
249 recMdcTrack->
setPx(px);
250 recMdcTrack->
setPy(py);
251 recMdcTrack->
setPz(pz);
252 recMdcTrack->
setP(p);
256 recMdcTrack->
setX(poca.x());
257 recMdcTrack->
setY(poca.y());
258 recMdcTrack->
setZ(poca.z());
259 recMdcTrack->
setR(sqrt(poca.x()*poca.x() + poca.y()*poca.y()));
274 map<int,int> clusterFitStat;
278 double fiTerm = 999.;
281 for (;hot!=aList->
end();hot++){
289 recMdcHit->
setId(hitId);
301 double hotWireAmbig = recoHot->
wireAmbig();
302 double driftDist = fabs(recoHot->
drift());
303 double sigma = recoHot->
hitRms();
304 double doca = fabs(recoHot->
dcaToWire());
306 if ( hotWireAmbig == 1){
309 }
else if( hotWireAmbig == -1){
311 }
else if( hotWireAmbig == 0){
326 double res=999.,rese=999.;
327 if (recoHot->
resid(res,rese,
false)){
341 double fltLen = recoHot->
fltLen();
355 if (layerId >= maxLayerId){
356 maxLayerId = layerId;
359 if (layerId < minLayerId){
360 minLayerId = layerId;
372 hitList->push_back(recMdcHit);
373 SmartRef<RecMdcHit> refHit(recMdcHit);
374 hitRefVec.push_back(refHit);
382 clusterFitStat[clusterid] = stat;
385 clusterRefVec.push_back(recCgemCluster);
388 std::sort(clusterRefVec.begin(),clusterRefVec.end(),
sortCluster);
390 if (fiTermHot!=NULL){
391 fiTerm=(1./sqrt(1.+tanDip*tanDip))*fiTermHot->
fltLen()*helix.
omega();
406 trackList->push_back(recMdcTrack);
bool sortCluster(const RecCgemCluster *clusterA, const RecCgemCluster *clusterB)
double arg(const EvtComplex &c)
double sin(const BesAngle a)
double cos(const BesAngle a)
ObjectVector< RecMdcHit > RecMdcHitCol
SmartRefVector< RecCgemCluster > ClusterRefVec
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
bool sortCluster(const RecCgemCluster *clusterA, const RecCgemCluster *clusterB)
void setRad(const double)
const RecCgemCluster * baseHit() const
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
int getclusterid(void) const
int getlayerid(void) 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 setVecClusters(ClusterRefVec vecclusters)
void setPivot(const HepPoint3D &pivot)
void setVecHits(HitRefVec vechits)
void setFiTerm(double fiterm)
void setNcluster(int ncluster)
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