CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
utility.cxx
Go to the documentation of this file.
1#include "DTagAlg/utility.h"
2
3HepLorentzVector utility::getp4(RecMdcKalTrack* mdcKalTrack, int pid){
4
5 HepVector zhelix;
6 double mass=0;
7
8 if(pid==0){
9 zhelix=mdcKalTrack->getZHelixE();
10 mass=0.000511;
11 }
12 else if(pid==1){
13 zhelix=mdcKalTrack->getZHelixMu();
14 mass= 0.105658;
15 }
16 else if(pid==2){
17 zhelix=mdcKalTrack->getZHelix();
18 mass=0.139570;
19 }
20 else if(pid==3){
21 zhelix=mdcKalTrack->getZHelixK();
22 mass= 0.493677;
23 }
24 else{
25 zhelix=mdcKalTrack->getZHelixP();
26 mass= 0.938272;
27 }
28
29 double dr(0),phi0(0),kappa(0),dz(0),tanl(0);
30 dr=zhelix[0];
31 phi0=zhelix[1];
32 kappa=zhelix[2];
33 dz=zhelix[3];
34 tanl=zhelix[4];
35
36 int charge=0;
37 if (kappa > 0.0000000001)
38 charge = 1;
39 else if (kappa < -0.0000000001)
40 charge = -1;
41
42 double pxy=0;
43 if(kappa!=0) pxy = 1.0/fabs(kappa);
44
45 double px = pxy * (-sin(phi0));
46 double py = pxy * cos(phi0);
47 double pz = pxy * tanl;
48
49 double e = sqrt( pxy*pxy + pz*pz + mass*mass );
50
51 return HepLorentzVector(px, py, pz, e);
52
53
54}
55
56
57HepLorentzVector utility::vfit(string channel, vector<int> kaonid, vector<int> pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin){
58 //use charged tracks only, except pions from Ks
59
60 HepLorentzVector pchange(0,0,0,0);
61
62 int nvalid= kaonid.size()+pionid.size();
63 if(nvalid<=1)
64 return pchange;
65
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;
70 VertexParameter vxpar; vxpar.setVx(vx); vxpar.setEvx(Evx);
71 double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
72
73
75 vtxfit->init();
76
77
78 HepLorentzVector pold(0,0,0,0);
79
80 for(int i=0; i<kaonid.size();++i){
81 EvtRecTrackIterator itTrk=charged_begin + kaonid[i];
82 RecMdcKalTrack *mdcKalTrk = (*itTrk)->mdcKalTrack();
83 pold+=getp4(mdcKalTrk, 3);
84 WTrackParameter wtrk(xmass[3],mdcKalTrk->getZHelixK(),mdcKalTrk->getZErrorK() );
85 vtxfit->AddTrack(i, wtrk);
86 }
87
88 for(int i=0; i<pionid.size();++i){
89 EvtRecTrackIterator itTrk=charged_begin + pionid[i];
90 RecMdcKalTrack *mdcKalTrk = (*itTrk)->mdcKalTrack();
91 pold+=getp4(mdcKalTrk, 2);
92 WTrackParameter wtrk(xmass[2],mdcKalTrk->getZHelix(),mdcKalTrk->getZError() );
93 vtxfit->AddTrack(kaonid.size()+i, wtrk);
94 }
95
96
97 vtxfit->AddVertex(0, vxpar, 0, 1);
98 if(!vtxfit->Fit(0))
99 return pchange;
100
101 vtxfit->Swim(0);
102
103 HepLorentzVector pnew(0,0,0,0);
104
105 for(int i=0; i<nvalid;++i){
106 WTrackParameter wtrk = vtxfit->wtrk(i);
107 HepVector trk_val = HepVector(7,0);
108 trk_val = wtrk.w();
109 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
110 pnew+=P_trk;
111 }
112
113 return (pnew-pold);
114
115}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
double mass
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:131
const double xmass[5]
Definition: Gam4pikp.cxx:50
const HepVector & getZHelix() const
HepVector & getZHelixP()
HepVector & getZHelixK()
HepVector & getZHelixE()
HepVector & getZHelixMu()
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorK()
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
WTrackParameter wtrk(int n) const
Definition: VertexFit.h:78
void init()
Definition: VertexFit.cxx:29
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
Definition: VertexFit.cxx:89
static VertexFit * instance()
Definition: VertexFit.cxx:15
void Swim(int n)
Definition: VertexFit.h:58
bool Fit()
Definition: VertexFit.cxx:301
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
HepVector w() const
HepLorentzVector vfit(string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
Definition: utility.cxx:57
HepLorentzVector getp4(RecMdcKalTrack *mdcKalTrack, int pid)
Definition: utility.cxx:3