31 double dr(0),phi0(0),kappa(0),dz(0),tanl(0);
39 if (kappa > 0.0000000001)
41 else if (kappa < -0.0000000001)
45 if(kappa!=0) pxy = 1.0/fabs(kappa);
47 double px = pxy * (-
sin(phi0));
48 double py = pxy *
cos(phi0);
49 double pz = pxy * tanl;
51 double e = sqrt( pxy*pxy + pz*pz +
mass*
mass );
53 return HepLorentzVector(px, py, pz, e);
62 HepLorentzVector pchange(0,0,0,0);
64 int nvalid= kaonid.size()+pionid.size();
68 HepSymMatrix Evx(3, 0);
69 double bx = 1E+6; Evx[0][0] = bx*bx;
70 double by = 1E+6; Evx[1][1] = by*by;
71 double bz = 1E+6; Evx[2][2] = bz*bz;
73 double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
80 HepLorentzVector pold(0,0,0,0);
82 for(
int i=0; i<kaonid.size();++i){
85 pold+=
getp4(mdcKalTrk, 3);
90 for(
int i=0; i<pionid.size();++i){
93 pold+=
getp4(mdcKalTrk, 2);
95 vtxfit->
AddTrack(kaonid.size()+i, wtrk);
98 vector<int> trkIdxCol;
100 for (
int i = 0; i < nvalid; i++)
101 trkIdxCol.push_back(i);
108 HepLorentzVector pnew(0,0,0,0);
110 for(
int i=0; i<nvalid;++i){
112 HepVector trk_val = HepVector(7,0);
114 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
125 HepLorentzVector pchange(0,0,0,0);
127 int nvalid= kaonid.size()+pionid.size()+protonid.size();
131 HepSymMatrix Evx(3, 0);
132 double bx = 1E+6; Evx[0][0] = bx*bx;
133 double by = 1E+6; Evx[1][1] = by*by;
134 double bz = 1E+6; Evx[2][2] = bz*bz;
136 double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
143 HepLorentzVector pold(0,0,0,0);
145 for(
int i=0; i<kaonid.size();++i){
148 pold+=
getp4(mdcKalTrk, 3);
153 for(
int i=0; i<pionid.size();++i){
156 pold+=
getp4(mdcKalTrk, 2);
158 vtxfit->
AddTrack(kaonid.size()+i, wtrk);
161 for(
int i=0; i<protonid.size();++i){
164 pold+=
getp4(mdcKalTrk, 4);
166 vtxfit->
AddTrack(kaonid.size()+pionid.size()+i, wtrk);
169 vector<int> trkIdxCol;
171 for (
int i = 0; i < nvalid; i++)
172 trkIdxCol.push_back(i);
179 HepLorentzVector pnew(0,0,0,0);
181 for(
int i=0; i<nvalid;++i){
183 HepVector trk_val = HepVector(7,0);
185 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
198 double vfitchi2 = -999;
199 double vfitlength = -999;
200 double vfiterror = 999;
202 vector<double> results;
203 results.push_back(vfitchi2);
204 results.push_back(vfitlength);
205 results.push_back(vfiterror);
221 HepSymMatrix evWideVertex(3, 0);
223 evWideVertex[0][0] = 1.0e12;
224 evWideVertex[1][1] = 1.0e12;
225 evWideVertex[2][2] = 1.0e12;
227 wideVertex.
setVx(vWideVertex);
228 wideVertex.
setEvx(evWideVertex);
235 vtxfit->
AddTrack(0,veeInitialWTrack1);
236 vtxfit->
AddTrack(1,veeInitialWTrack2);
251 HepSymMatrix evBeamSpot(3, 0);
256 for (
unsigned int ivx = 0; ivx < 3; ivx++){
257 vBeamSpot[ivx] = dbv[ivx];
258 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
262 cout <<
"KSSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
266 beamSpot.
setVx(vBeamSpot);
267 beamSpot.
setEvx(evBeamSpot);
280 if( !svtxfit->
Fit() )
return results;
285 vfitchi2 = svtxfit->
chisq();
288 results.push_back(vfitchi2);
289 results.push_back(vfitlength);
290 results.push_back(vfiterror);
298 double vfitchi2 = -999;
299 double vfitlength = -999;
300 double vfiterror = 999;
302 vector<double> results;
303 results.push_back(vfitchi2);
304 results.push_back(vfitlength);
305 results.push_back(vfiterror);
307 int index[2] = {0, 1};
332 HepSymMatrix evWideVertex(3, 0);
334 evWideVertex[0][0] = 1.0e12;
335 evWideVertex[1][1] = 1.0e12;
336 evWideVertex[2][2] = 1.0e12;
338 wideVertex.
setVx(vWideVertex);
339 wideVertex.
setEvx(evWideVertex);
362 HepSymMatrix evBeamSpot(3, 0);
367 for (
unsigned int ivx = 0; ivx < 3; ivx++){
368 vBeamSpot[ivx] = dbv[ivx];
369 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
373 cout <<
"LambdaSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
377 beamSpot.
setVx(vBeamSpot);
378 beamSpot.
setEvx(evBeamSpot);
391 if( !svtxfit->
Fit() )
return results;
396 vfitchi2 = svtxfit->
chisq();
399 results.push_back(vfitchi2);
400 results.push_back(vfitlength);
401 results.push_back(vfiterror);
double sin(const BesAngle a)
double cos(const BesAngle a)
EvtRecTrackCol::iterator EvtRecTrackIterator
LocalLambdaSelector lambdaSelector
static void setPidType(PidType pidType)
RecMdcKalTrack * mdcKalTrack()
std::pair< SmartRef< EvtRecTrack >, SmartRef< EvtRecTrack > > & pairDaughters()
SmartRef< EvtRecTrack > & daughter(int i)
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
const HepVector & getZHelix() const
HepVector & getZHelixMu()
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorP()
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)
vector< double > SecondaryVFit_Lambda(EvtRecVeeVertex *lambda, IVertexDbSvc *vtxsvc)
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)