1#include "DTagAlg/utility.h"
29 double dr(0),phi0(0),kappa(0),dz(0),tanl(0);
37 if (kappa > 0.0000000001)
39 else if (kappa < -0.0000000001)
43 if(kappa!=0) pxy = 1.0/fabs(kappa);
45 double px = pxy * (-
sin(phi0));
46 double py = pxy *
cos(phi0);
47 double pz = pxy * tanl;
49 double e = sqrt( pxy*pxy + pz*pz +
mass*
mass );
51 return HepLorentzVector(px, py, pz, e);
60 HepLorentzVector pchange(0,0,0,0);
62 int nvalid= kaonid.size()+pionid.size();
66 HepSymMatrix Evx(3, 0);
67 double bx = 1E+6; Evx[0][0] = bx*bx;
68 double by = 1E+6; Evx[1][1] = by*by;
69 double bz = 1E+6; Evx[2][2] = bz*bz;
71 double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
78 HepLorentzVector pold(0,0,0,0);
80 for(
int i=0; i<kaonid.size();++i){
83 pold+=
getp4(mdcKalTrk, 3);
88 for(
int i=0; i<pionid.size();++i){
91 pold+=
getp4(mdcKalTrk, 2);
93 vtxfit->
AddTrack(kaonid.size()+i, wtrk);
96 vector<int> trkIdxCol;
98 for (
int i = 0; i < nvalid; i++)
99 trkIdxCol.push_back(i);
106 HepLorentzVector pnew(0,0,0,0);
108 for(
int i=0; i<nvalid;++i){
110 HepVector trk_val = HepVector(7,0);
112 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
123 double vfitchi2 = -999;
124 double vfitlength = -999;
125 double vfiterror = 999;
127 vector<double> results;
128 results.push_back(vfitchi2);
129 results.push_back(vfitlength);
130 results.push_back(vfiterror);
146 HepSymMatrix evWideVertex(3, 0);
148 evWideVertex[0][0] = 1.0e12;
149 evWideVertex[1][1] = 1.0e12;
150 evWideVertex[2][2] = 1.0e12;
152 wideVertex.
setVx(vWideVertex);
153 wideVertex.
setEvx(evWideVertex);
160 vtxfit->
AddTrack(0,veeInitialWTrack1);
161 vtxfit->
AddTrack(1,veeInitialWTrack2);
176 HepSymMatrix evBeamSpot(3, 0);
181 for (
unsigned int ivx = 0; ivx < 3; ivx++){
182 vBeamSpot[ivx] = dbv[ivx];
183 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
187 cout <<
"KSSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
191 beamSpot.
setVx(vBeamSpot);
192 beamSpot.
setEvx(evBeamSpot);
205 if( !svtxfit->
Fit() )
return results;
210 vfitchi2 = svtxfit->
chisq();
213 results.push_back(vfitchi2);
214 results.push_back(vfitlength);
215 results.push_back(vfiterror);
EvtRecTrackCol::iterator EvtRecTrackIterator
double sin(const BesAngle a)
double cos(const BesAngle a)
RecMdcKalTrack * mdcKalTrack()
std::pair< SmartRef< EvtRecTrack >, SmartRef< EvtRecTrack > > & pairDaughters()
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
const HepVector & getZHelix() const
HepVector & getZHelixMu()
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorK()
void setPrimaryVertex(const VertexParameter vpar)
double decayLength() const
double decayLengthError() const
static SecondVertexFit * instance()
void setVpar(const VertexParameter vpar)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
WTrackParameter wtrk(int n) const
WTrackParameter wVirtualTrack(int n) const
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
static VertexFit * instance()
VertexParameter vpar(int n) const
void BuildVirtualParticle(int number)
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
HepLorentzVector vfit(string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
HepLorentzVector getp4(RecMdcKalTrack *mdcKalTrack, int pid)
vector< double > SecondaryVFit(EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc)