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);
98 vector<int> trkIdxCol;
100 for (
int i = 0; i < nvalid; i++)
101 trkIdxCol.push_back(i);
104 bool fitok = vtxfit->
Fit();
110 HepLorentzVector pnew(0,0,0,0);
112 for(
int i=0; i<nvalid;++i){
114 HepVector trk_val = HepVector(7,0);
116 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
127 HepLorentzVector pchange(0,0,0,0);
129 int nvalid= kaonid.size()+pionid.size()+protonid.size();
133 HepSymMatrix Evx(3, 0);
134 double bx = 1E+6; Evx[0][0] = bx*bx;
135 double by = 1E+6; Evx[1][1] = by*by;
136 double bz = 1E+6; Evx[2][2] = bz*bz;
138 double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
145 HepLorentzVector pold(0,0,0,0);
147 for(
int i=0; i<kaonid.size();++i){
150 pold+=
getp4(mdcKalTrk, 3);
155 for(
int i=0; i<pionid.size();++i){
158 pold+=
getp4(mdcKalTrk, 2);
163 for(
int i=0; i<protonid.size();++i){
166 pold+=
getp4(mdcKalTrk, 4);
171 vector<int> trkIdxCol;
173 for (
int i = 0; i < nvalid; i++)
174 trkIdxCol.push_back(i);
177 bool fitok = vtxfit->
Fit();
183 HepLorentzVector pnew(0,0,0,0);
185 for(
int i=0; i<nvalid;++i){
187 HepVector trk_val = HepVector(7,0);
189 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
202 double vfitchi2 = -999;
203 double vfitlength = -999;
204 double vfiterror = 999;
206 vector<double> results;
207 results.push_back(vfitchi2);
208 results.push_back(vfitlength);
209 results.push_back(vfiterror);
225 HepSymMatrix evWideVertex(3, 0);
227 evWideVertex[0][0] = 1.0e12;
228 evWideVertex[1][1] = 1.0e12;
229 evWideVertex[2][2] = 1.0e12;
231 wideVertex.
setVx(vWideVertex);
232 wideVertex.
setEvx(evWideVertex);
244 bool fitok = vtxfit->
Fit();
253 HepSymMatrix evBeamSpot(3, 0);
258 for (
unsigned int ivx = 0; ivx < 3; ivx++){
259 vBeamSpot[ivx] = dbv[ivx];
260 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
264 cout <<
"KSSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
268 beamSpot.
setVx(vBeamSpot);
269 beamSpot.
setEvx(evBeamSpot);
282 if( !svtxfit->
Fit() )
return results;
287 vfitchi2 = svtxfit->
chisq();
290 results.push_back(vfitchi2);
291 results.push_back(vfitlength);
292 results.push_back(vfiterror);
300 double vfitchi2 = -999;
301 double vfitlength = -999;
302 double vfiterror = 999;
304 vector<double> results;
305 results.push_back(vfitchi2);
306 results.push_back(vfitlength);
307 results.push_back(vfiterror);
309 int index[2] = {0, 1};
334 HepSymMatrix evWideVertex(3, 0);
336 evWideVertex[0][0] = 1.0e12;
337 evWideVertex[1][1] = 1.0e12;
338 evWideVertex[2][2] = 1.0e12;
340 wideVertex.
setVx(vWideVertex);
341 wideVertex.
setEvx(evWideVertex);
353 bool fitok = vtxfit->
Fit();
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);
409 HepLorentzVector pchange(0,0,0,0);
411 int nvalid= kaonid.size()+pionid.size();
415 HepSymMatrix Evx(3, 0);
416 double bx = 1E+6; Evx[0][0] = bx*bx;
417 double by = 1E+6; Evx[1][1] = by*by;
418 double bz = 1E+6; Evx[2][2] = bz*bz;
420 double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
427 HepLorentzVector pold(0,0,0,0);
429 for(
int i=0; i<kaonid.size();++i){
432 pold+=
getp4(mdcKalTrk, 3);
437 for(
int i=0; i<pionid.size();++i){
440 pold+=
getp4(mdcKalTrk, 2);
442 vtxfit->
AddTrack(kaonid.size()+i, wtrk);
445 vector<int> trkIdxCol;
447 for (
int i = 0; i < nvalid; i++)
448 trkIdxCol.push_back(i);
455 HepLorentzVector pnew(0,0,0,0);
457 for(
int i=0; i<nvalid;++i){
459 HepVector trk_val = HepVector(7,0);
461 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
472 HepLorentzVector pchange(0,0,0,0);
474 int nvalid= kaonid.size()+pionid.size()+protonid.size();
478 HepSymMatrix Evx(3, 0);
479 double bx = 1E+6; Evx[0][0] = bx*bx;
480 double by = 1E+6; Evx[1][1] = by*by;
481 double bz = 1E+6; Evx[2][2] = bz*bz;
483 double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
490 HepLorentzVector pold(0,0,0,0);
492 for(
int i=0; i<kaonid.size();++i){
495 pold+=
getp4(mdcKalTrk, 3);
500 for(
int i=0; i<pionid.size();++i){
503 pold+=
getp4(mdcKalTrk, 2);
505 vtxfit->
AddTrack(kaonid.size()+i, wtrk);
508 for(
int i=0; i<protonid.size();++i){
511 pold+=
getp4(mdcKalTrk, 4);
513 vtxfit->
AddTrack(kaonid.size()+pionid.size()+i, wtrk);
516 vector<int> trkIdxCol;
518 for (
int i = 0; i < nvalid; i++)
519 trkIdxCol.push_back(i);
526 HepLorentzVector pnew(0,0,0,0);
528 for(
int i=0; i<nvalid;++i){
530 HepVector trk_val = HepVector(7,0);
532 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
543 double vfitchi2 = -999;
544 double vfitlength = -999;
545 double vfiterror = 999;
547 vector<double> results;
548 results.push_back(vfitchi2);
549 results.push_back(vfitlength);
550 results.push_back(vfiterror);
566 HepSymMatrix evWideVertex(3, 0);
568 evWideVertex[0][0] = 1.0e12;
569 evWideVertex[1][1] = 1.0e12;
570 evWideVertex[2][2] = 1.0e12;
572 wideVertex.
setVx(vWideVertex);
573 wideVertex.
setEvx(evWideVertex);
580 vtxfit->
AddTrack(0,veeInitialWTrack1);
581 vtxfit->
AddTrack(1,veeInitialWTrack2);
596 HepSymMatrix evBeamSpot(3, 0);
601 for (
unsigned int ivx = 0; ivx < 3; ivx++){
602 vBeamSpot[ivx] = dbv[ivx];
603 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
607 cout <<
"KSSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
611 beamSpot.
setVx(vBeamSpot);
612 beamSpot.
setEvx(evBeamSpot);
625 if( !svtxfit->
Fit() )
return results;
630 vfitchi2 = svtxfit->
chisq();
633 results.push_back(vfitchi2);
634 results.push_back(vfitlength);
635 results.push_back(vfiterror);
643 double vfitchi2 = -999;
644 double vfitlength = -999;
645 double vfiterror = 999;
647 vector<double> results;
648 results.push_back(vfitchi2);
649 results.push_back(vfitlength);
650 results.push_back(vfiterror);
652 int index[2] = {0, 1};
677 HepSymMatrix evWideVertex(3, 0);
679 evWideVertex[0][0] = 1.0e12;
680 evWideVertex[1][1] = 1.0e12;
681 evWideVertex[2][2] = 1.0e12;
683 wideVertex.
setVx(vWideVertex);
684 wideVertex.
setEvx(evWideVertex);
707 HepSymMatrix evBeamSpot(3, 0);
712 for (
unsigned int ivx = 0; ivx < 3; ivx++){
713 vBeamSpot[ivx] = dbv[ivx];
714 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
718 cout <<
"LambdaSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
722 beamSpot.
setVx(vBeamSpot);
723 beamSpot.
setEvx(evBeamSpot);
736 if( !svtxfit->
Fit() )
return results;
741 vfitchi2 = svtxfit->
chisq();
744 results.push_back(vfitchi2);
745 results.push_back(vfitlength);
746 results.push_back(vfiterror);
755 double m_pxks = -999;
756 double m_pyks = -999;
757 double m_pzks = -999;
759 double m_chisq = -999;
760 double m_ifok = -999;
762 vector<double> results;
764 results.push_back(m_pxks);
765 results.push_back(m_pyks);
766 results.push_back(m_pzks);
767 results.push_back(m_Eks);
768 results.push_back(m_chisq);
769 results.push_back(m_ifok);
783 HepSymMatrix evWideVertex(3, 0);
785 evWideVertex[0][0] = 1.0e12;
786 evWideVertex[1][1] = 1.0e12;
787 evWideVertex[2][2] = 1.0e12;
791 HepSymMatrix evBeamSpot(3, 0);
796 for (
unsigned int ivx = 0; ivx < 3; ivx++){
797 vBeamSpot[ivx] = dbv[ivx];
798 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
802 cout <<
"UpdateKs ERROR: Could not find a vertex from VertexDbSvc" << endl;
810 wideVertex.
setVx(vWideVertex);
811 wideVertex.
setEvx(evWideVertex);
821 bool fitok = vtxfitr->
Fit();
824 double chisq = vtxfitr->
chisq(0);
825 HepLorentzVector pks = vtxfitr->
pfit(0);
839 wideVertex.
setVx(vWideVertex);
840 wideVertex.
setEvx(evWideVertex);
847 vtxfit->
AddTrack(0,veeInitialWTrack1);
848 vtxfit->
AddTrack(1,veeInitialWTrack2);
857 double chisq = vtxfit->
chisq(0);
858 HepLorentzVector pks = wks.
p();
872 results.push_back(m_pxks);
873 results.push_back(m_pyks);
874 results.push_back(m_pzks);
875 results.push_back(m_Eks);
876 results.push_back(m_chisq);
877 results.push_back(m_ifok);
885 double m_pxlambda = -999;
886 double m_pylambda = -999;
887 double m_pzlambda = -999;
888 double m_Elambda = -999;
889 double m_chisq = -999;
890 double m_ifok = -999;
892 vector<double> results;
894 results.push_back(m_pxlambda);
895 results.push_back(m_pylambda);
896 results.push_back(m_pzlambda);
897 results.push_back(m_Elambda);
898 results.push_back(m_chisq);
899 results.push_back(m_ifok);
901 int index[2] = {0, 1};
919 HepSymMatrix evWideVertex(3, 0);
921 evWideVertex[0][0] = 1.0e12;
922 evWideVertex[1][1] = 1.0e12;
923 evWideVertex[2][2] = 1.0e12;
927 HepSymMatrix evBeamSpot(3, 0);
932 for (
unsigned int ivx = 0; ivx < 3; ivx++){
933 vBeamSpot[ivx] = dbv[ivx];
934 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
938 cout <<
"UpdateLambda ERROR: Could not find a vertex from VertexDbSvc" << endl;
946 wideVertex.
setVx(vWideVertex);
947 wideVertex.
setEvx(evWideVertex);
957 bool fitok = vtxfitr->
Fit();
960 double chisq = vtxfitr->
chisq(0);
961 HepLorentzVector plambda = vtxfitr->
pfit(0);
963 m_pxlambda = plambda.px();
964 m_pylambda = plambda.py();
965 m_pzlambda = plambda.pz();
966 m_Elambda = plambda.e();
975 wideVertex.
setVx(vWideVertex);
976 wideVertex.
setEvx(evWideVertex);
993 double chisq = vtxfit->
chisq(0);
994 HepLorentzVector plambda = wlambda.
p();
996 m_pxlambda = plambda.px();
997 m_pylambda = plambda.py();
998 m_pzlambda = plambda.pz();
999 m_Elambda = plambda.e();
1008 results.push_back(m_pxlambda);
1009 results.push_back(m_pylambda);
1010 results.push_back(m_pzlambda);
1011 results.push_back(m_Elambda);
1012 results.push_back(m_chisq);
1013 results.push_back(m_ifok);
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 wVirtualTrack(int n) const
HepLorentzVector pfit(int n) const
void AddTrack(const int index, RecMdcKalTrack *p, const RecMdcKalTrack::PidType pid)
WTrackParameter wtrk(int n) const
static VertexFitRefine * instance()
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
VertexParameter vpar(int n) const
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 p() const
HepLorentzVector vfitref(string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
vector< double > SecondaryVFit_Lambdaref(EvtRecVeeVertex *lambda, IVertexDbSvc *vtxsvc)
vector< double > SecondaryVFit_Lambda(EvtRecVeeVertex *lambda, IVertexDbSvc *vtxsvc)
vector< double > SecondaryVFitref(EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc)
vector< double > UpdatedKsIfo(EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc, bool m_useVFrefine)
vector< double > UpdatedLambdaIfo(EvtRecVeeVertex *lambda, IVertexDbSvc *vtxsvc, bool m_useVFrefine)
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)