BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
utility Class Reference

#include <utility.h>

Public Member Functions

HepLorentzVector getp4 (RecMdcKalTrack *mdcKalTrack, int pid)
 
HepLorentzVector vfit (string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
 
vector< double > SecondaryVFit (EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc)
 
HepLorentzVector getp4 (RecMdcKalTrack *mdcKalTrack, int pid)
 
HepLorentzVector vfit (string channel, vector< int > kaonid, vector< int > pionid, HepPoint3D vx, EvtRecTrackIterator charged_begin)
 
vector< double > SecondaryVFit (EvtRecVeeVertex *ks, IVertexDbSvc *vtxsvc)
 

Detailed Description

Member Function Documentation

◆ getp4() [1/2]

HepLorentzVector utility::getp4 ( RecMdcKalTrack mdcKalTrack,
int  pid 
)

Definition at line 3 of file utility.cxx.

3 {
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}
double mass
double sin(const BesAngle a)
double cos(const BesAngle a)

Referenced by vfit().

◆ getp4() [2/2]

HepLorentzVector utility::getp4 ( RecMdcKalTrack mdcKalTrack,
int  pid 
)

◆ SecondaryVFit() [1/2]

vector< double > utility::SecondaryVFit ( EvtRecVeeVertex ks,
IVertexDbSvc vtxsvc 
)

Definition at line 120 of file utility.cxx.

120 {
121
122 // by default: chi2 = -999, length = -999, error = 999
123 double vfitchi2 = -999;
124 double vfitlength = -999;
125 double vfiterror = 999;
126
127 vector<double> results;
128 results.push_back(vfitchi2);
129 results.push_back(vfitlength);
130 results.push_back(vfiterror);
131
132 // --------------------------------------------------
133 // Do a secondary vertex fit and check the flight significance
134 // --------------------------------------------------
135
136 EvtRecTrack* veeTrack1 = ks->pairDaughters().first;
137 RecMdcKalTrack* veeKalTrack1 = veeTrack1->mdcKalTrack();
138 WTrackParameter veeInitialWTrack1 = WTrackParameter(0.13957018, veeKalTrack1->getZHelix(), veeKalTrack1->getZError());
139
140 EvtRecTrack* veeTrack2 = ks->pairDaughters().second;
141 RecMdcKalTrack* veeKalTrack2 = veeTrack2->mdcKalTrack();
142 WTrackParameter veeInitialWTrack2 = WTrackParameter(0.13957018, veeKalTrack2->getZHelix(), veeKalTrack2->getZError());
143
144 VertexParameter wideVertex;
145 HepPoint3D vWideVertex(0., 0., 0.);
146 HepSymMatrix evWideVertex(3, 0);
147
148 evWideVertex[0][0] = 1.0e12;
149 evWideVertex[1][1] = 1.0e12;
150 evWideVertex[2][2] = 1.0e12;
151
152 wideVertex.setVx(vWideVertex);
153 wideVertex.setEvx(evWideVertex);
154
155 // First, perform a vertex fit
156 VertexFit* vtxfit = VertexFit::instance();
157 vtxfit->init();
158
159 // add the daughters
160 vtxfit->AddTrack(0,veeInitialWTrack1);
161 vtxfit->AddTrack(1,veeInitialWTrack2);
162 vtxfit->AddVertex(0,wideVertex,0,1);
163
164 // do the fit
165 vtxfit->Fit(0);
166 vtxfit->Swim(0);
167 vtxfit->BuildVirtualParticle(0);
168
169 // Now perform the secondary vertex fit
171 svtxfit->init();
172
173 // add the primary vertex
174 VertexParameter beamSpot;
175 HepPoint3D vBeamSpot(0., 0., 0.);
176 HepSymMatrix evBeamSpot(3, 0);
177
178 if(vtxsvc->isVertexValid()){
179 double* dbv = vtxsvc->PrimaryVertex();
180 double* vv = vtxsvc->SigmaPrimaryVertex();
181 for (unsigned int ivx = 0; ivx < 3; ivx++){
182 vBeamSpot[ivx] = dbv[ivx];
183 evBeamSpot[ivx][ivx] = vv[ivx] * vv[ivx];
184 }
185 }
186 else{
187 cout << "KSSELECTOR ERROR: Could not find a vertex from VertexDbSvc" << endl;
188 return results;
189 }
190
191 beamSpot.setVx(vBeamSpot);
192 beamSpot.setEvx(evBeamSpot);
193
194 VertexParameter primaryVertex(beamSpot);
195 svtxfit->setPrimaryVertex(primaryVertex);
196
197 // add the secondary vertex
198 svtxfit->setVpar(vtxfit->vpar(0));
199
200 // add the Ks or lambda
201 svtxfit->AddTrack(0,vtxfit->wVirtualTrack(0));
202
203 // do the second vertex fit
204 // if the fit fails, the default values will not be changed
205 if( !svtxfit->Fit() ) return results;
206
207 // save the new ks parameters
208 vfitlength = svtxfit->decayLength();
209 vfiterror = svtxfit->decayLengthError();
210 vfitchi2 = svtxfit->chisq();
211
212 results.clear();
213 results.push_back(vfitchi2);
214 results.push_back(vfitlength);
215 results.push_back(vfiterror);
216
217 return results;
218}
std::pair< SmartRef< EvtRecTrack >, SmartRef< EvtRecTrack > > & pairDaughters()
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
static SecondVertexFit * instance()
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
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 BuildVirtualParticle(int number)
Definition: VertexFit.cxx:619
bool Fit()
Definition: VertexFit.cxx:301

Referenced by ChargedDReconstruction::execute(), DsReconstruction::execute(), and NeutralDReconstruction::execute().

◆ SecondaryVFit() [2/2]

vector< double > utility::SecondaryVFit ( EvtRecVeeVertex ks,
IVertexDbSvc vtxsvc 
)

◆ vfit() [1/2]

HepLorentzVector utility::vfit ( string  channel,
vector< int >  kaonid,
vector< int >  pionid,
HepPoint3D  vx,
EvtRecTrackIterator  charged_begin 
)

Definition at line 57 of file utility.cxx.

57 {
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 vector<int> trkIdxCol;
97 trkIdxCol.clear();
98 for (int i = 0; i < nvalid; i++)
99 trkIdxCol.push_back(i);
100 vtxfit->AddVertex(0, vxpar, trkIdxCol);
101 if(!vtxfit->Fit(0))
102 return pchange;
103
104 vtxfit->Swim(0);
105
106 HepLorentzVector pnew(0,0,0,0);
107
108 for(int i=0; i<nvalid;++i){
109 WTrackParameter wtrk = vtxfit->wtrk(i);
110 HepVector trk_val = HepVector(7,0);
111 trk_val = wtrk.w();
112 HepLorentzVector P_trk(trk_val[0],trk_val[1],trk_val[2],trk_val[3]);
113 pnew+=P_trk;
114 }
115
116 return (pnew-pold);
117
118}
const double xmass[5]
Definition: Gam4pikp.cxx:50
HepLorentzVector getp4(RecMdcKalTrack *mdcKalTrack, int pid)
Definition: utility.cxx:3

Referenced by ChargedDReconstruction::execute(), DsReconstruction::execute(), and NeutralDReconstruction::execute().

◆ vfit() [2/2]

HepLorentzVector utility::vfit ( string  channel,
vector< int >  kaonid,
vector< int >  pionid,
HepPoint3D  vx,
EvtRecTrackIterator  charged_begin 
)

The documentation for this class was generated from the following files: