CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
Kpi Class Reference

#include <Kpi.h>

Public Member Functions

 Kpi ()
 
 ~Kpi ()
 
bool Getkpimd ()
 
double Gettagmd ()
 
double Getmass_bc ()
 
double GetCQtm ()
 
double GetdelE_tag ()
 
Vint Gettagtrk1 ()
 
HepLorentzVector Gettagp1 ()
 
Vint GettagGam1 ()
 
void MTotal (double event, SmartDataPtr< EvtRecTrackCol > evtRecTrkCol, Vint iGood, Vint iGam, double Ebeam, int PID_flag, int Charge_candidate_D)
 

Detailed Description

Definition at line 20 of file Kpi.h.

Constructor & Destructor Documentation

◆ Kpi()

Kpi::Kpi ( )

Definition at line 27 of file Kpi.cxx.

28{}

◆ ~Kpi()

Kpi::~Kpi ( )

Definition at line 30 of file Kpi.cxx.

31{}

Member Function Documentation

◆ GetCQtm()

double Kpi::GetCQtm ( )
inline

Definition at line 30 of file Kpi.h.

30{ return cqtm; }

Referenced by Sing::Mdset().

◆ GetdelE_tag()

double Kpi::GetdelE_tag ( )
inline

Definition at line 31 of file Kpi.h.

31{ return delE_tag; }

Referenced by Sing::Mdset().

◆ Getkpimd()

bool Kpi::Getkpimd ( )
inline

Definition at line 27 of file Kpi.h.

27{ return kpimd; }

Referenced by Sing::Mdset().

◆ Getmass_bc()

double Kpi::Getmass_bc ( )
inline

Definition at line 29 of file Kpi.h.

29{ return mass_bc; }

Referenced by Sing::Mdset().

◆ GettagGam1()

Vint Kpi::GettagGam1 ( )
inline

Definition at line 34 of file Kpi.h.

34{ return iGamtag; }

Referenced by Sing::Mdset().

◆ Gettagmd()

double Kpi::Gettagmd ( )
inline

Definition at line 28 of file Kpi.h.

28{ return tagmd; }

Referenced by Sing::Mdset().

◆ Gettagp1()

HepLorentzVector Kpi::Gettagp1 ( )
inline

Definition at line 33 of file Kpi.h.

33{ return ptag; }

Referenced by Sing::Mdset().

◆ Gettagtrk1()

Vint Kpi::Gettagtrk1 ( )
inline

Definition at line 32 of file Kpi.h.

32{ return iGoodtag; }

Referenced by Sing::Mdset().

◆ MTotal()

void Kpi::MTotal ( double  event,
SmartDataPtr< EvtRecTrackCol evtRecTrkCol,
Vint  iGood,
Vint  iGam,
double  Ebeam,
int  PID_flag,
int  Charge_candidate_D 
)

Definition at line 33 of file Kpi.cxx.

35{
36
37 int nGood=iGood.size();
38 int nGam=iGam.size();
39
40 iGoodtag.clear();
41 iGamtag.clear();
42
43 double mass_bcgg, delE_tag_temp;
44 int m_chargetag, m_chargek,m_chargepi;
45 int ika_temp,ipi_temp,ipi2_temp,ipi3_temp;
46 HepLorentzVector kmfit1,kmfit2,kmfit3,kmfit4,pddd;
47
48 int cqtm_temp;
49 HepLorentzVector pddd_temp;
50 IDataProviderSvc* eventSvc = NULL;
51 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
52 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc,EventModel::EvtRec::EvtRecEvent);
53 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc,"/Event/EventHeader");
54
55 int runNo=eventHeader->runNumber();
56 int rec=eventHeader->eventNumber();
57
58 double xecm=2*Ebeam;
59
60 kpimd = false;
61 double tagmode=0;
62
63 if((evtRecEvent->totalCharged() < 2)){ return; }
64
65 double ecms = xecm; ;
66
67 ISimplePIDSvc* simple_pid;
68 Gaudi::svcLocator()->service("SimplePIDSvc", simple_pid);
69
70 double deltaE_tem = 0.20;
71 int ncount1 = 0;
72
73 Hep3Vector xorigin(0,0,0);
74 IVertexDbSvc* vtxsvc;
75 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
76 if(vtxsvc->isVertexValid())
77 {
78 double* dbv = vtxsvc->PrimaryVertex();
79 double* vv = vtxsvc->SigmaPrimaryVertex();
80 xorigin.setX(dbv[0]);
81 xorigin.setY(dbv[1]);
82 xorigin.setZ(dbv[2]);
83 }
84
85 double xv=xorigin.x();
86 double yv=xorigin.y();
87 double zv=xorigin.z();
88
89 HepPoint3D point0(0.,0.,0.);
90 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
91
92 HepLorentzVector ptrk1_temp, ptrk2_temp;
93 //////////////////////////////////////////////////////////////////
94 for(int i = 0; i < evtRecEvent->totalCharged(); i++) {
95 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + i;
96
97 int ika= (*itTrk)->trackId();
98
99 if(!(*itTrk)->isMdcKalTrackValid()) continue;
100 RecMdcKalTrack* mdcKalTrk1 = (*itTrk)->mdcKalTrack();
102 /////////////////////////////////////////
103 m_chargek=mdcKalTrk1->charge();
104 if(Charge_candidate_D != 0) {
105 if(m_chargek != -Charge_candidate_D) continue;
106 }
107 if(Charge_candidate_D == 0) {
108 if(abs(m_chargek) != 1) continue;
109 }
110 /////////////////////////////////////////
111 HepVector a1 = mdcKalTrk1->getZHelixK();
112 HepSymMatrix Ea1 = mdcKalTrk1->getZErrorK();
113 VFHelix helixip3_1(point0,a1,Ea1);
114 helixip3_1.pivot(IP);
115 HepVector vecipa1 = helixip3_1.a();
116
117 double dr1 = fabs(vecipa1[0]);
118 double dz1 = fabs(vecipa1[3]);
119 double costheta1 = cos(mdcKalTrk1->theta());
120 if ( dr1 >= 1.0) continue;
121 if ( dz1 >= 10.0) continue;
122 if ( fabs(costheta1) >= 0.93) continue;
123 /////////////////////////////////////////
124 if(PID_flag == 5) {
125 simple_pid->preparePID(*itTrk);
126 if(simple_pid->probKaon() < 0.0 || simple_pid->probKaon() < simple_pid->probPion()) continue;
127 }
128 /////////////////////////////////////////
129
130 WTrackParameter kam(xmass[3],mdcKalTrk1->getZHelixK(),mdcKalTrk1->getZErrorK() );
131
132 //
133 // select pi
134 //
135 for(int j = 0; j< evtRecEvent->totalCharged();j++) {
136 EvtRecTrackIterator itTrk = evtRecTrkCol->begin() + j;
137
138 int ipi= (*itTrk)->trackId();
139 if(ipi==ika) continue;
140
141 if(!(*itTrk)->isMdcKalTrackValid()) continue;
142 RecMdcKalTrack* mdcKalTrk2 = (*itTrk)->mdcKalTrack();
144
145 /////////////////////////////////////////
146 m_chargepi=mdcKalTrk2->charge();
147 if((m_chargek + m_chargepi) != 0) continue;
148 /////////////////////////////////////////
149 HepVector a2 = mdcKalTrk2->getZHelix();
150 HepSymMatrix Ea2 = mdcKalTrk2->getZError();
151 VFHelix helixip3_2(point0,a2,Ea2);
152 helixip3_2.pivot(IP);
153 HepVector vecipa2 = helixip3_2.a();
154
155 double dr2 = fabs(vecipa2[0]);
156 double dz2 = fabs(vecipa2[3]);
157 double costheta2 = cos(mdcKalTrk2->theta());
158 if ( dr2 >= 1.0) continue;
159 if ( dz2 >= 10.0) continue;
160 if ( fabs(costheta2) >= 0.93) continue;
161 /////////////////////////////////////////
162 if(PID_flag == 5) {
163 simple_pid->preparePID(*itTrk);
164 if(simple_pid->probPion() < 0.0 || simple_pid->probPion() < simple_pid->probKaon()) continue;
165 }
166 /////////////////////////////////////////
167
168 WTrackParameter pip(xmass[2], mdcKalTrk2->getZHelix(),mdcKalTrk2->getZError() );
169
170 //////////////////////////////////////////////////////////////
171 HepPoint3D vx(xorigin.x(), xorigin.y(), xorigin.z());
172 HepSymMatrix Evx(3, 0);
173 double bx = 1E+6; Evx[0][0] = bx*bx;
174 double by = 1E+6; Evx[1][1] = by*by;
175 double bz = 1E+6; Evx[2][2] = bz*bz;
176 VertexParameter vxpar; vxpar.setVx(vx); vxpar.setEvx(Evx);
177 //////////////////////////////////////////////////////////////
178
179 VertexFit* vtxfit = VertexFit::instance();
180 vtxfit->init();
181 vtxfit->AddTrack(0, kam);
182 vtxfit->AddTrack(1, pip);
183 vtxfit->AddVertex(0, vxpar, 0, 1);
184 if(!vtxfit->Fit(0)) continue;
185 vtxfit->Swim(0);
186
187 WTrackParameter wkam = vtxfit->wtrk(0);
188 WTrackParameter wpip = vtxfit->wtrk(1);
189
190 HepVector kam_val = HepVector(7,0);
191 kam_val = wkam.w();
192 HepVector pip_val = HepVector(7,0);
193 pip_val = wpip.w();
194
195 HepLorentzVector P_KAM(kam_val[0],kam_val[1],kam_val[2],kam_val[3]);
196 HepLorentzVector P_PIP(pip_val[0],pip_val[1],pip_val[2],pip_val[3]);
197
198 P_KAM.boost(-0.011,0,0);
199 P_PIP.boost(-0.011,0,0);
200 pddd = P_KAM + P_PIP;
201
202 double pkpi=pddd.rho();
203
204 double temp1 = (ecms/2)*(ecms/2)-pkpi*pkpi;
205 if(temp1<0) temp1 =0;
206 double mass_bc_tem = sqrt(temp1);
207
208 if(mass_bc_tem < 1.82 || mass_bc_tem > 1.89) continue;
209
210 double delE_tag_tag = ecms/2-pddd.e();
211
212
213 if(fabs(delE_tag_tag)<deltaE_tem) {
214 deltaE_tem = fabs(delE_tag_tag);
215 delE_tag_temp = delE_tag_tag;
216 mass_bcgg = mass_bc_tem;
217
218 pddd_temp = pddd;
219 cqtm_temp = m_chargek;
220 ika_temp=ika;
221 ipi_temp=ipi;
222 ncount1 = 1;
223 }
224 }
225 }
226
227 if(ncount1 == 1){
228 tagmode = 11;
229 if(cqtm_temp<0) tagmode=-11;
230 tagmd = tagmode;
231 mass_bc = mass_bcgg;
232 delE_tag = delE_tag_temp;
233 cqtm = -1.0*cqtm_temp;
234
235 // cqtm = +1 for D0-->K-Pi+; cqtm = -1 for D0-bar-->K+Pi-;
236 // cqtm = 0 for D0-->K+K- ect. ...; cqtm = 0 means that we do not
237 // know whether it s D0 or D0-bar decays;
238
239 iGoodtag.push_back(ika_temp);
240 iGoodtag.push_back(ipi_temp);
241
242 iGamtag.push_back(9999);
243 iGamtag.push_back(9999);
244 iGamtag.push_back(9999);
245 iGamtag.push_back(9999);
246
247 ptag = pddd_temp;
248
249 kpimd = true;
250
251 }
252}
double cos(const BesAngle a)
Definition: BesAngle.h:213
int runNo
double abs(const EvtComplex &c)
Definition: EvtComplex.hh:212
EvtRecTrackCol::iterator EvtRecTrackIterator
Definition: EvtRecTrack.h:131
const double xmass[5]
Definition: Gam4pikp.cxx:50
const double theta() const
static void setPidType(PidType pidType)
const int charge() const
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
const HepVector & getZHelix() const
HepVector & getZHelixK()
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
const double ecms
Definition: inclkstar.cxx:42
_EXTERN_ std::string EvtRecEvent
Definition: EventModel.h:134

Referenced by Sing::Mdset().


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