BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Kk.cxx
Go to the documentation of this file.
1//
2// Kk.cxx is the single D0 tag code to reconstruct D0 or anti-D0 through the final states of
3// KK from D0 decays. Kk.cxx was transfered from the Fortran routine "Kk.f" which was
4// orignally used for study of the D0D0-bar production and D0 decays at the BES-II
5// experiment during the time period from 2002 to 2008.
6//
7// The orignal Fortran routine "Kk.f" used at the BES-II experiment was coded by G. Rong in 2002.
8//
9// Kk.cxx was transfered by G. Rong and J. Liu in December, 2005.
10//
11// Since 2008, G. Rong and L.L. Jiang have been working on developing this code to analyze of
12// the data taken at 3.773 GeV with the BES-III detector at the BEPC-II collider.
13//
14// During developing this code, many People made significant contributions to this code. These are
15// G. Rong, L.L. Jiang, J. Liu, H.L. Ma, J.C. Chen, D.H. Zhang,
16// M.G. Zhao, B. Zheng, L. Li, Y. Fang, Z.Y. Yi, H.H. Liu, Z.Q. Liu et al.
17//
18// By G. Rong and L.L. Jiang
19// March, 2009
20//
21// ==========================================================================================
22//
23#include "SD0TagAlg/Kk.h"
24#include "SD0TagAlg/SingleBase.h"
25
27{}
28
30{}
31
32void Kk::MTotal(double event,SmartDataPtr<EvtRecTrackCol> evtRecTrkCol, Vint iGood,Vint
33 iGam, double Ebeam, int PID_flag, int Charge_candidate_D)
34{
35
36 int nGood=iGood.size();
37 int nGam=iGam.size();
38
39 iGoodtag.clear();
40 iGamtag.clear();
41
42 double mass_bcgg, delE_tag_temp;
43 int m_chargetag, m_chargek1,m_chargek2;
44 int ika1_temp,ika2_temp,ipi2_temp,ipi3_temp;
45 HepLorentzVector kmfit1,kmfit2,kmfit3,kmfit4,pddd;
46
47 HepLorentzVector pddd_temp;
48 IDataProviderSvc* eventSvc = NULL;
49 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
50 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc,EventModel::EvtRec::EvtRecEvent);
51 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
52
53 int runNo=eventHeader->runNumber();
54 int rec=eventHeader->eventNumber();
55
56 double xecm=2*Ebeam;
57
58 kkmd=false;
59 double tagmode=0;
60
61 if((evtRecEvent->totalCharged() < 2)){ return; }
62
63 double ecms = xecm;
64
65 ISimplePIDSvc* simple_pid;
66 Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
67
68 double deltaE_tem = 0.20;
69 int ncount1 = 0;
70
71 Hep3Vector xorigin(0,0,0);
72 IVertexDbSvc* vtxsvc;
73 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
74 if(vtxsvc->isVertexValid())
75 {
76 double* dbv = vtxsvc->PrimaryVertex();
77 double* vv = vtxsvc->SigmaPrimaryVertex();
78 xorigin.setX(dbv[0]);
79 xorigin.setY(dbv[1]);
80 xorigin.setZ(dbv[2]);
81 }
82
83 double xv=xorigin.x();
84 double yv=xorigin.y();
85 double zv=xorigin.z();
86
87 HepPoint3D point0(0.,0.,0.);
88 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
89 //////////////////////////////////////////////////////////////////
90
91 for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
92 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
93
94 int ika1= (*itTrk)->trackId();
95
96 if(!(*itTrk)->isMdcKalTrackValid()) continue;
97 RecMdcKalTrack* mdcKalTrk1 = (*itTrk)->mdcKalTrack();
99
100 m_chargek1=mdcKalTrk1->charge();
101 if(m_chargek1 != 1) continue;
102
103 /////////////////////////////////////////
104 HepVector a1 = mdcKalTrk1->getZHelixK();
105 HepSymMatrix Ea1 = mdcKalTrk1->getZErrorK();
106
107 VFHelix helixip3_1(point0,a1,Ea1);
108 helixip3_1.pivot(IP);
109 HepVector vecipa1 = helixip3_1.a();
110
111 double dr1 = fabs(vecipa1[0]);
112 double dz1 = fabs(vecipa1[3]);
113 double costheta1 = cos(mdcKalTrk1->theta());
114
115 if ( dr1 >= 1.0) continue;
116 if ( dz1 >= 10.0) continue;
117 if ( fabs(costheta1) >= 0.93) continue;
118 /////////////////////////////////////////
119 if(PID_flag == 5) {
120 simple_pid->preparePID(*itTrk);
121 if(simple_pid->probKaon() < 0.0 || simple_pid->probKaon() < simple_pid->probPion()) continue;
122 }
123 /////////////////////////////////////////
124 WTrackParameter kap(xmass[3],mdcKalTrk1->getZHelixK(),mdcKalTrk1->getZErrorK() );
125
126 //
127 // select K2
128 //
129 for(int j = 0; j< evtRecEvent->totalCharged();j++) {
130 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + j;
131
132 int ika2= (*itTrk)->trackId();
133 if(ika1==ika2) continue;
134
135 if(!(*itTrk)->isMdcKalTrackValid()) continue;
136 RecMdcKalTrack* mdcKalTrk2 = (*itTrk)->mdcKalTrack();
138
139 m_chargek2=mdcKalTrk2->charge();
140 if((m_chargek1 + m_chargek2) != 0) continue;
141
142 /////////////////////////////////////////
143 HepVector a2 = mdcKalTrk2->getZHelixK();
144 HepSymMatrix Ea2 = mdcKalTrk2->getZErrorK();
145 VFHelix helixip3_2(point0,a2,Ea2);
146 helixip3_2.pivot(IP);
147 HepVector vecipa2 = helixip3_2.a();
148
149 double dr2 = fabs(vecipa2[0]);
150 double dz2 = fabs(vecipa2[3]);
151 double costheta2 = cos(mdcKalTrk2->theta());
152 if ( dr2 >= 1.0) continue;
153 if ( dz2 >= 10.0) continue;
154 if ( fabs(costheta2) >= 0.93) continue;
155 /////////////////////////////////////////
156 if(PID_flag == 5) {
157 simple_pid->preparePID(*itTrk);
158 if(simple_pid->probKaon() < 0.0 || simple_pid->probKaon() < simple_pid->probPion()) continue;
159 }
160 /////////////////////////////////////////
161 WTrackParameter kam(xmass[3],mdcKalTrk2->getZHelixK(),mdcKalTrk2->getZErrorK() );
162
163 // all loop for the charged tracks overed here !!!!!!!
164
165 //////////////////////////////////////////////////////////////
166 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
167 HepSymMatrix Evx(3, 0);
168 double bx = 1E+6; Evx[0][0] = bx*bx;
169 double by = 1E+6; Evx[1][1] = by*by;
170 double bz = 1E+6; Evx[2][2] = bz*bz;
171 VertexParameter vxpar; vxpar.setVx(vx); vxpar.setEvx(Evx);
172 //////////////////////////////////////////////////////////////
173
174 VertexFit* vtxfit = VertexFit::instance();
175 vtxfit->init();
176 vtxfit->AddTrack(0, kap);
177 vtxfit->AddTrack(1, kam);
178 vtxfit->AddVertex(0, vxpar, 0, 1);
179 if(!vtxfit->Fit(0)) continue;
180 vtxfit->Swim(0);
181
182 WTrackParameter wkap = vtxfit->wtrk(0);
183 WTrackParameter wkam = vtxfit->wtrk(1);
184
185 HepVector kap_val = HepVector(7,0);
186 kap_val = wkap.w();
187 HepVector kam_val = HepVector(7,0);
188 kam_val = wkam.w();
189
190 HepLorentzVector P_KAP(kap_val[0],kap_val[1],kap_val[2],kap_val[3]);
191 HepLorentzVector P_KAM(kam_val[0],kam_val[1],kam_val[2],kam_val[3]);
192
193 P_KAP.boost(-0.011,0,0);
194 P_KAM.boost(-0.011,0,0);
195 pddd = P_KAP + P_KAM;
196
197 double pkk=pddd.rho();
198
199 double temp1 = (ecms/2)*(ecms/2)-pkk*pkk;
200 if(temp1<0) temp1 =0;
201 double mass_bc_tem = sqrt(temp1);
202 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89) continue;
203
204 double delE_tag_tag = ecms/2-pddd.e();
205
206 if(fabs(delE_tag_tag)<deltaE_tem){
207 deltaE_tem = fabs(delE_tag_tag);
208 delE_tag_temp = delE_tag_tag;
209 mass_bcgg = mass_bc_tem;
210
211 pddd_temp = pddd;
212 ika1_temp=ika1;
213 ika2_temp=ika2;
214 ncount1 = 1;
215 }
216 }
217 }
218
219 if(ncount1 == 1){
220 tagmode=15;
221 if(m_chargetag<0) tagmode=-15;
222 tagmd=tagmode;
223 mass_bc = mass_bcgg;
224 delE_tag = delE_tag_temp;
225 cqtm = -0.0;
226
227 iGoodtag.push_back(ika1_temp);
228 iGoodtag.push_back(ika2_temp);
229 iGamtag.push_back(9999);
230 iGamtag.push_back(9999);
231 iGamtag.push_back(9999);
232 iGamtag.push_back(9999);
233
234 ptag = pddd_temp;
235
236 kkmd = true;
237 }
238}
239
240
241
int runNo
Definition: DQA_TO_DB.cxx:12
const double xmass[5]
Definition: Gam4pikp.cxx:50
double cos(const BesAngle a)
virtual double probKaon()=0
virtual void preparePID(EvtRecTrack *track)=0
virtual double probPion()=0
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
~Kk()
Definition: Kk.cxx:29
void MTotal(double event, SmartDataPtr< EvtRecTrackCol > evtRecTrkCol, Vint iGood, Vint iGam, double Ebeam, int PID_flag, int Charge_candidate_D)
Definition: Kk.cxx:32
Kk()
Definition: Kk.cxx:26
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
Definition: TrackPool.cxx:22
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.
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
bool Fit()
Definition: VertexFit.cxx:301
const double ecms
Definition: inclkstar.cxx:42