1#include "GaudiKernel/MsgStream.h"
2#include "GaudiKernel/AlgFactory.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/SmartDataPtr.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "GaudiKernel/PropertyMgr.h"
7#include "GaudiKernel/Bootstrap.h"
19#include "CLHEP/Vector/ThreeVector.h"
20#include "CLHEP/Vector/LorentzVector.h"
21#include "CLHEP/Vector/TwoVector.h"
30#include "GaudiKernel/INTupleSvc.h"
31#include "GaudiKernel/NTuple.h"
32#include "GaudiKernel/Bootstrap.h"
33#include "GaudiKernel/ISvcLocator.h"
34#include "GaudiKernel/ITHistSvc.h"
37using CLHEP::Hep3Vector;
38using CLHEP::Hep2Vector;
39using CLHEP::HepLorentzVector;
40#include "CLHEP/Geometry/Point3D.h"
41#ifndef ENABLE_BACKWARDS_COMPATIBILITY
49const double mpi = 0.13957;
50const double mk = 0.493677;
51const double mks0 = 0.497648;
52const double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
53const double velc = 299.792458;
54typedef std::vector<int>
Vint;
55typedef std::vector<HepLorentzVector>
Vp4;
58const HepLorentzVector
p_cms(0.034067, 0.0, 0.0, 3.097);
61static int counter[10]={0,0,0,0,0,0,0,0,0,0};
66 Algorithm(name, pSvcLocator) {
69 declareProperty(
"Vr0cut", m_vr0cut=5.0);
70 declareProperty(
"Vz0cut", m_vz0cut=20.0);
71 declareProperty(
"Vr1cut", m_vr1cut=1.0);
72 declareProperty(
"Vz1cut", m_vz1cut=5.0);
73 declareProperty(
"Vctcut", m_cthcut=0.93);
74 declareProperty(
"EnergyThreshold", m_energyThreshold=0.04);
75 declareProperty(
"GammaAngCut", m_gammaAngCut=20.0);
81 MsgStream log(
msgSvc(), name());
83 log << MSG::INFO <<
"in initialize()" << endmsg;
86 if(service(
"THistSvc", m_thsvc).isFailure()) {
87 log << MSG::ERROR <<
"Couldn't get THistSvc" << endreq;
88 return StatusCode::FAILURE;
93 TH1F* hks_dl =
new TH1F(
"ks_dl",
"ks_dl", 300, -5.0, 25.0);
94 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hks_dl", hks_dl).isFailure()) {
95 log << MSG::ERROR <<
"Couldn't register ks_dl" << endreq;
98 TH1F* hks_m =
new TH1F(
"ks_m",
"ks_m", 200,0.4, 0.6);
99 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hks_m", hks_m).isFailure()) {
100 log << MSG::ERROR <<
"Couldn't register ks_m" << endreq;
103 TH1F* hkspi_m =
new TH1F(
"kspi_m",
"kspi_m", 200,0.6, 2.6);
104 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hkspi_m", hkspi_m).isFailure()) {
105 log << MSG::ERROR <<
"Couldn't register kspi_m" << endreq;
108 TH1F* hks_p =
new TH1F(
"ks_p",
"ks_p", 100,0.0, 1.5);
109 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hks_p", hks_p).isFailure()) {
110 log << MSG::ERROR <<
"Couldn't register ks_p" << endreq;
113 TH1F* hkpi_m =
new TH1F(
"kpi_m",
"kpi_m", 200,0.6, 2.6);
114 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hkpi_m", hkpi_m).isFailure()) {
115 log << MSG::ERROR <<
"Couldn't register kpi_m" << endreq;
121 NTuplePtr nt(
ntupleSvc(),
"DQAFILE/KsKpiDEDX");
122 if ( nt ) m_tuple = nt;
124 m_tuple =
ntupleSvc()->book(
"DQAFILE/KsKpiDEDX", CLID_ColumnWiseTuple,
"KsKpiDEDX ntuple");
126 status = m_tuple->addItem(
"runNo", m_runNo);
127 status = m_tuple->addItem(
"event", m_event);
131 status = m_tuple->addItem(
"npip", m_npip);
132 status = m_tuple->addItem(
"npim", m_npim);
133 status = m_tuple->addItem(
"nkp", m_nkp);
134 status = m_tuple->addItem(
"nkm", m_nkm);
135 status = m_tuple->addItem(
"np", m_np);
136 status = m_tuple->addItem(
"npb", m_npb);
138 status = m_tuple->addItem(
"vfits_chi", m_vfits_chi);
139 status = m_tuple->addItem(
"vfits_vx", m_vfits_vx);
140 status = m_tuple->addItem(
"vfits_vy", m_vfits_vy);
141 status = m_tuple->addItem(
"vfits_vz", m_vfits_vz);
142 status = m_tuple->addItem(
"vfits_vr", m_vfits_vr);
144 status = m_tuple->addItem(
"vfitp_chi", m_vfitp_chi);
145 status = m_tuple->addItem(
"vfitp_vx", m_vfitp_vx);
146 status = m_tuple->addItem(
"vfitp_vy", m_vfitp_vy);
147 status = m_tuple->addItem(
"vfitp_vz", m_vfitp_vz);
148 status = m_tuple->addItem(
"vfitp_vr", m_vfitp_vr);
150 status = m_tuple->addItem(
"vfit2_chi", m_vfit2_chi);
151 status = m_tuple->addItem(
"vfit2_mks", m_vfit2_mks);
152 status = m_tuple->addItem(
"vfit2_ct", m_vfit2_ct);
153 status = m_tuple->addItem(
"vfit2_dl", m_vfit2_dl);
154 status = m_tuple->addItem(
"vfit2_dle", m_vfit2_dle);
156 status = m_tuple->addItem(
"chi2_fs4c", m_chi2_fs4c);
157 status = m_tuple->addItem(
"mks_fs4c", m_mks_fs4c);
158 status = m_tuple->addItem(
"mkspi_fs4c",m_mkspi_fs4c);
159 status = m_tuple->addItem(
"mksk_fs4c", m_mksk_fs4c);
160 status = m_tuple->addItem(
"mkpi_fs4c", m_mkpi_fs4c);
162 status = m_tuple->addItem(
"4c_chi2", m_4c_chi2);
163 status = m_tuple->addItem(
"4c_mks", m_4c_mks);
164 status = m_tuple->addItem(
"4c_mkspi", m_4c_mkspi);
165 status = m_tuple->addItem(
"4c_mksk", m_4c_mksk);
166 status = m_tuple->addItem(
"4c_mkpi", m_4c_mkpi);
167 status = m_tuple->addItem(
"4c_ks_px", m_4c_ks_px);
168 status = m_tuple->addItem(
"4c_ks_py", m_4c_ks_py);
169 status = m_tuple->addItem(
"4c_ks_pz", m_4c_ks_pz);
170 status = m_tuple->addItem(
"4c_ks_p", m_4c_ks_p);
171 status = m_tuple->addItem(
"4c_ks_cos", m_4c_ks_cos);
173 status = m_tuple->addItem(
"NGch", m_ngch, 0, 10);
174 status = m_tuple->addIndexedItem(
"pidcode", m_ngch, m_pidcode);
175 status = m_tuple->addIndexedItem(
"pidprob", m_ngch, m_pidprob);
176 status = m_tuple->addIndexedItem(
"pidchiDedx", m_ngch, m_pidchiDedx);
177 status = m_tuple->addIndexedItem(
"pidchiTof1", m_ngch, m_pidchiTof1);
178 status = m_tuple->addIndexedItem(
"pidchiTof2", m_ngch, m_pidchiTof2);
180 status = m_tuple->addIndexedItem(
"charge",m_ngch, m_charge);
181 status = m_tuple->addIndexedItem(
"vx0", m_ngch, m_vx0);
182 status = m_tuple->addIndexedItem(
"vy0", m_ngch, m_vy0);
183 status = m_tuple->addIndexedItem(
"vz0", m_ngch, m_vz0);
184 status = m_tuple->addIndexedItem(
"vr0", m_ngch, m_vr0);
186 status = m_tuple->addIndexedItem(
"vx", m_ngch, m_vx);
187 status = m_tuple->addIndexedItem(
"vy", m_ngch, m_vy);
188 status = m_tuple->addIndexedItem(
"vz", m_ngch, m_vz);
189 status = m_tuple->addIndexedItem(
"vr", m_ngch, m_vr);
191 status = m_tuple->addIndexedItem(
"px", m_ngch, m_px);
192 status = m_tuple->addIndexedItem(
"py", m_ngch, m_py);
193 status = m_tuple->addIndexedItem(
"pz", m_ngch, m_pz);
194 status = m_tuple->addIndexedItem(
"p", m_ngch, m_p);
195 status = m_tuple->addIndexedItem(
"cost", m_ngch, m_cost);
197 status = m_tuple->addIndexedItem(
"probPH", m_ngch, m_probPH);
198 status = m_tuple->addIndexedItem(
"normPH", m_ngch, m_normPH);
199 status = m_tuple->addIndexedItem(
"chie", m_ngch, m_chie);
200 status = m_tuple->addIndexedItem(
"chimu", m_ngch, m_chimu);
201 status = m_tuple->addIndexedItem(
"chipi", m_ngch, m_chipi);
202 status = m_tuple->addIndexedItem(
"chik", m_ngch, m_chik);
203 status = m_tuple->addIndexedItem(
"chip", m_ngch, m_chip);
204 status = m_tuple->addIndexedItem(
"ghit", m_ngch, m_ghit);
205 status = m_tuple->addIndexedItem(
"thit", m_ngch, m_thit);
207 status = m_tuple->addIndexedItem(
"e_emc", m_ngch, m_e_emc);
209 status = m_tuple->addIndexedItem(
"qual_etof", m_ngch, m_qual_etof);
210 status = m_tuple->addIndexedItem(
"tof_etof", m_ngch, m_tof_etof);
211 status = m_tuple->addIndexedItem(
"te_etof", m_ngch, m_te_etof);
212 status = m_tuple->addIndexedItem(
"tmu_etof", m_ngch, m_tmu_etof);
213 status = m_tuple->addIndexedItem(
"tpi_etof", m_ngch, m_tpi_etof);
214 status = m_tuple->addIndexedItem(
"tk_etof", m_ngch, m_tk_etof);
215 status = m_tuple->addIndexedItem(
"tp_etof", m_ngch, m_tp_etof);
217 status = m_tuple->addIndexedItem(
"qual_btof1", m_ngch, m_qual_btof1);
218 status = m_tuple->addIndexedItem(
"tof_btof1", m_ngch, m_tof_btof1);
219 status = m_tuple->addIndexedItem(
"te_btof1", m_ngch, m_te_btof1);
220 status = m_tuple->addIndexedItem(
"tmu_btof1", m_ngch, m_tmu_btof1);
221 status = m_tuple->addIndexedItem(
"tpi_btof1", m_ngch, m_tpi_btof1);
222 status = m_tuple->addIndexedItem(
"tk_btof1", m_ngch, m_tk_btof1);
223 status = m_tuple->addIndexedItem(
"tp_btof1", m_ngch, m_tp_btof1);
225 status = m_tuple->addIndexedItem(
"qual_btof2", m_ngch, m_qual_btof2);
226 status = m_tuple->addIndexedItem(
"tof_btof2", m_ngch, m_tof_btof2);
227 status = m_tuple->addIndexedItem(
"te_btof2", m_ngch, m_te_btof2);
228 status = m_tuple->addIndexedItem(
"tmu_btof2", m_ngch, m_tmu_btof2);
229 status = m_tuple->addIndexedItem(
"tpi_btof2", m_ngch, m_tpi_btof2);
230 status = m_tuple->addIndexedItem(
"tk_btof2", m_ngch, m_tk_btof2);
231 status = m_tuple->addIndexedItem(
"tp_btof2", m_ngch, m_tp_btof2);
234 log << MSG::ERROR <<
"Can not book N-tuple:" << long(m_tuple) << endreq;
240 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
241 return StatusCode::SUCCESS;
248 MsgStream log(
msgSvc(), name());
249 log << MSG::INFO <<
"in execute()" << endreq;
255 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
256 m_runNo = eventHeader->runNumber();
257 m_event=eventHeader->eventNumber();
258 log << MSG::DEBUG <<
"run, evtnum = "
265 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
266 << evtRecEvent->totalCharged() <<
" , "
267 << evtRecEvent->totalNeutral() <<
" , "
268 << evtRecEvent->totalTracks() <<endreq;
272 if(evtRecEvent->totalNeutral()>100) {
273 return StatusCode::SUCCESS;
279 Hep3Vector xorigin(0,0,0);
282 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
286 xorigin.setX(dbv[0]);
287 xorigin.setY(dbv[1]);
288 xorigin.setZ(dbv[2]);
290 <<
"xorigin.x="<<xorigin.x()<<
", "
291 <<
"xorigin.y="<<xorigin.y()<<
", "
292 <<
"xorigin.z="<<xorigin.z()<<
", "
297 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
299 if(!(*itTrk)->isMdcTrackValid())
continue;
300 if (!(*itTrk)->isMdcKalTrackValid())
continue;
303 double pch =mdcTrk->
p();
304 double x0 =mdcTrk->
x();
305 double y0 =mdcTrk->
y();
306 double z0 =mdcTrk->
z();
307 double phi0=mdcTrk->
helix(1);
308 double xv=xorigin.x();
309 double yv=xorigin.y();
310 double Rxy=fabs((x0-xv)*
cos(phi0)+(y0-yv)*
sin(phi0));
313 double vz0 = z0-xorigin.z();
317 HepVector a = mdcTrk->
helix();
318 HepSymMatrix Ea = mdcTrk->
err();
320 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
323 HepVector vecipa = helixip.
a();
324 double Rvxy0=fabs(vecipa[0]);
325 double Rvz0=vecipa[3];
326 double Rvphi0=vecipa[1];
331 if(fabs(Rvz0) >= m_vz0cut)
continue;
332 if(fabs(Rvxy0) >= m_vr0cut)
continue;
337 nCharge += mdcTrk->
charge();
343 int m_ngch = iGood.size();
344 log << MSG::DEBUG <<
"ngood, totcharge = " << m_ngch <<
" , " << nCharge << endreq;
345 if((m_ngch != 4)||(nCharge!=0)){
346 return StatusCode::SUCCESS;
351 Vint ipip, ipim, ikp, ikm, ipp, ipm;
359 Vp4 p_pip, p_pim, p_kp, p_km, p_pp, p_pm ;
368 for(
int i = 0; i < m_ngch; i++) {
386 if((*itTrk)->isMdcKalTrackValid()) mdcKalTrk = (*itTrk)->mdcKalTrack();
392 HepLorentzVector
ptrk;
393 ptrk.setPx(mdcTrk->
px()) ;
394 ptrk.setPy(mdcTrk->
py()) ;
395 ptrk.setPz(mdcTrk->
pz()) ;
398 if (prob_pi > prob_K && prob_pi > prob_p) {
400 m_pidprob[i]=pid->
prob(2);
401 m_pidchiDedx[i]=pid->
chiDedx(2);
402 m_pidchiTof1[i]=pid->
chiTof1(2);
403 m_pidchiTof2[i]=pid->
chiTof2(2);
405 if(mdcTrk->
charge() > 0) {
406 ipip.push_back(iGood[i]);
407 p_pip.push_back(
ptrk);
409 if (mdcTrk->
charge() < 0) {
410 ipim.push_back(iGood[i]);
411 p_pim.push_back(
ptrk);
415 if (prob_K > prob_pi && prob_K > prob_p) {
417 m_pidprob[i]=pid->
prob(3);
418 m_pidchiDedx[i]=pid->
chiDedx(3);
419 m_pidchiTof1[i]=pid->
chiTof1(3);
420 m_pidchiTof2[i]=pid->
chiTof2(3);
422 if(mdcTrk->
charge() > 0) {
423 ikp.push_back(iGood[i]);
424 p_kp.push_back(
ptrk);
426 if (mdcTrk->
charge() < 0) {
427 ikm.push_back(iGood[i]);
428 p_km.push_back(
ptrk);
432 if (prob_p > prob_pi && prob_p > prob_K) {
434 m_pidprob[i]=pid->
prob(4);
435 m_pidchiDedx[i]=pid->
chiDedx(4);
436 m_pidchiTof1[i]=pid->
chiTof1(4);
437 m_pidchiTof2[i]=pid->
chiTof2(4);
439 if(mdcTrk->
charge() > 0) {
440 ipp.push_back(iGood[i]);
441 p_pp.push_back(
ptrk);
443 if (mdcTrk->
charge() < 0) {
444 ipm.push_back(iGood[i]);
445 p_pm.push_back(
ptrk);
450 m_npip= ipip.size() ;
451 m_npim= ipim.size() ;
458 if( m_npip*m_npim != 2 ) {
459 return StatusCode::SUCCESS;
462 if( m_nkp+m_nkm != 1 ) {
463 return StatusCode::SUCCESS;
469 HepSymMatrix Evx(3, 0);
489 double chi_temp = 999.0;
490 double mks_temp = 10.0 ;
492 for(
unsigned int i1 = 0; i1 < m_npip; i1++) {
493 RecMdcKalTrack *pi1KalTrk = (*(evtRecTrkCol->begin()+ipip[i1]))-> mdcKalTrack();
497 for(
unsigned int i2 = 0; i2 < m_npim; i2++) {
498 RecMdcKalTrack *pi2KalTrk = (*(evtRecTrkCol->begin()+ipim[i2]))-> mdcKalTrack();
507 if(!(vtxfit_s->
Fit(0)))
continue;
509 m_vfits_chi = vtxfit_s->
chisq(0);
513 m_vfits_vx = (vparks.
Vx())[0];
514 m_vfits_vy = (vparks.
Vx())[1];
515 m_vfits_vz = (vparks.
Vx())[2];
516 m_vfits_vr = sqrt(m_vfits_vx*m_vfits_vx + m_vfits_vy*m_vfits_vy) ;
520 int jj = ( i1 == 1 ) ? 0 : 1;
521 pi3KalTrk = (*(evtRecTrkCol->begin()+ipip[jj]))->mdcKalTrack();
522 k1KalTrk = (*(evtRecTrkCol->begin()+ikm[0]))->mdcKalTrack();
526 int jj = ( i2 == 1 ) ? 0 : 1;
527 pi3KalTrk = (*(evtRecTrkCol->begin()+ipim[jj]))->mdcKalTrack();
528 k1KalTrk = (*(evtRecTrkCol->begin()+ikp[0]))->mdcKalTrack();
541 if(!(vtxfit_p->
Fit(0)))
continue;
543 m_vfitp_chi = vtxfit_p->
chisq(0) ;
546 m_vfitp_vx = (primaryVpar.
Vx())[0];
547 m_vfitp_vy = (primaryVpar.
Vx())[1];
548 m_vfitp_vz = (primaryVpar.
Vx())[2];
549 m_vfitp_vr = sqrt(m_vfitp_vx*m_vfitp_vx + m_vfitp_vy*m_vfitp_vy);
555 if(!vtxfit2->
Fit())
continue;
557 if ( fabs(((vtxfit2->
wpar()).p()).m()-
mks0) < mks_temp ) {
558 mks_temp = fabs(((vtxfit2->
wpar()).p()).m()-
mks0) ;
562 wks = vtxfit2->
wpar();
563 m_vfit2_mks = (wks.
p()).m();
564 m_vfit2_chi = vtxfit2->
chisq();
565 m_vfit2_ct = vtxfit2->
ctau();
569 pipKalTrk = pi1KalTrk ;
570 pimKalTrk = pi2KalTrk ;
571 piKalTrk = pi3KalTrk ;
579 return StatusCode::SUCCESS;
596 for(
int j=0; j<m_ngch; j++){
597 m_charge[j] = 9999.0;
614 m_probPH[j] = 9999.0;
615 m_normPH[j] = 9999.0;
626 m_qual_etof[j] = 9999.0;
627 m_tof_etof[j] = 9999.0;
628 m_te_etof[j] = 9999.0;
629 m_tmu_etof[j] = 9999.0;
630 m_tpi_etof[j] = 9999.0;
631 m_tk_etof[j] = 9999.0;
632 m_tp_etof[j] = 9999.0;
634 m_qual_btof1[j] = 9999.0;
635 m_tof_btof1[j] = 9999.0;
636 m_te_btof1[j] = 9999.0;
637 m_tmu_btof1[j] = 9999.0;
638 m_tpi_btof1[j] = 9999.0;
639 m_tk_btof1[j] = 9999.0;
640 m_tp_btof1[j] = 9999.0;
642 m_qual_btof2[j] = 9999.0;
643 m_tof_btof2[j] = 9999.0;
644 m_te_btof2[j] = 9999.0;
645 m_tmu_btof2[j] = 9999.0;
646 m_tpi_btof2[j] = 9999.0;
647 m_tk_btof2[j] = 9999.0;
648 m_tp_btof2[j] = 9999.0;
650 m_pidcode[j] = 9999.0;
651 m_pidprob[j] = 9999.0;
652 m_pidchiDedx[j] = 9999.0;
653 m_pidchiTof1[j] = 9999.0;
654 m_pidchiTof2[j] = 99999.0;
657 for(
int i = 0; i < m_ngch; i++ ){
660 if(!(*itTrk)->isMdcTrackValid())
continue;
664 if ( mdcKalTrk == pipKalTrk ) {
668 if ( mdcKalTrk == pimKalTrk ) {
672 if ( mdcKalTrk == piKalTrk ) {
676 if ( mdcKalTrk == kKalTrk ) {
681 m_charge[ii] = mdcTrk->
charge();
682 double x0=mdcTrk->
x();
683 double y0=mdcTrk->
y();
684 double z0=mdcTrk->
z();
685 double phi0=mdcTrk->
helix(1);
686 double xv=xorigin.x();
687 double yv=xorigin.y();
688 double zv=xorigin.z();
689 double rv=(x0-xv)*
cos(phi0)+(y0-yv)*
sin(phi0);
699 rv=(x0-xv)*
cos(phi0)+(y0-yv)*
sin(phi0);
706 m_px[ii] = mdcKalTrk->
px();
707 m_py[ii] = mdcKalTrk->
py();
708 m_pz[ii] = mdcKalTrk->
pz();
709 m_p[ii] = mdcKalTrk->
p();
710 m_cost[ii] = mdcKalTrk->
pz()/mdcKalTrk->
p();
712 double ptrk = mdcKalTrk->
p() ;
713 if((*itTrk)->isMdcDedxValid()) {
715 m_probPH[ii]= dedxTrk->
probPH();
716 m_normPH[ii]= dedxTrk->
normPH();
718 m_chie[ii] = dedxTrk->
chiE();
719 m_chimu[ii] = dedxTrk->
chiMu();
720 m_chipi[ii] = dedxTrk->
chiPi();
721 m_chik[ii] = dedxTrk->
chiK();
722 m_chip[ii] = dedxTrk->
chiP();
727 if((*itTrk)->isEmcShowerValid()) {
729 m_e_emc[ii] = emcTrk->
energy();
732 if((*itTrk)->isTofTrackValid()) {
733 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
735 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
737 for(;iter_tof != tofTrkCol.end(); iter_tof++ ) {
739 status->
setStatus((*iter_tof)->status());
743 if( status->
layer()!=0 )
continue;
744 double path=(*iter_tof)->path();
745 double tof = (*iter_tof)->tof();
746 double ph = (*iter_tof)->ph();
747 double rhit = (*iter_tof)->zrhit();
748 double qual = 0.0 + (*iter_tof)->quality();
749 double cntr = 0.0 + (*iter_tof)->tofID();
751 for(
int j = 0; j < 5; j++) {
753 double beta = gb/sqrt(1+gb*gb);
754 texp[j] = path /beta/
velc;
757 m_qual_etof[ii] = qual;
758 m_tof_etof[ii] = tof ;
762 if(status->
layer()==1){
763 double path=(*iter_tof)->path();
764 double tof = (*iter_tof)->tof();
765 double ph = (*iter_tof)->ph();
766 double rhit = (*iter_tof)->zrhit();
767 double qual = 0.0 + (*iter_tof)->quality();
768 double cntr = 0.0 + (*iter_tof)->tofID();
770 for(
int j = 0; j < 5; j++) {
772 double beta = gb/sqrt(1+gb*gb);
773 texp[j] = path /beta/
velc;
776 m_qual_btof1[ii] = qual;
777 m_tof_btof1[ii] = tof ;
780 if(status->
layer()==2){
781 double path=(*iter_tof)->path();
782 double tof = (*iter_tof)->tof();
783 double ph = (*iter_tof)->ph();
784 double rhit = (*iter_tof)->zrhit();
785 double qual = 0.0 + (*iter_tof)->quality();
786 double cntr = 0.0 + (*iter_tof)->tofID();
788 for(
int j = 0; j < 5; j++) {
790 double beta = gb/sqrt(1+gb*gb);
791 texp[j] = path /beta/
velc;
794 m_qual_btof2[ii] = qual;
795 m_tof_btof2[ii] = tof ;
806 double chisq = 9999.;
823 bool oksq = kmfit->
Fit();
825 chisq = kmfit->
chisq();
827 HepLorentzVector pk = kmfit->
pfit(1);
828 HepLorentzVector pks = kmfit->
pfit(2);
829 HepLorentzVector pkspi = kmfit->
pfit(0) + kmfit->
pfit(2);
830 HepLorentzVector pksk = kmfit->
pfit(1) + kmfit->
pfit(2);
831 HepLorentzVector pkpi = kmfit->
pfit(0) + kmfit->
pfit(1);
840 m_4c_mkspi = pkspi.m();
841 m_4c_mksk = pksk.m();
842 m_4c_mkpi = pkpi.m();
844 m_4c_ks_px = pks.px() ;
845 m_4c_ks_py = pks.py() ;
846 m_4c_ks_pz = pks.pz() ;
847 m_4c_ks_p = (pks.vect()).mag() ;
848 m_4c_ks_cos = m_4c_ks_pz/m_4c_ks_p ;
867 chisq = kmfit->
chisq();
869 HepLorentzVector pks = kmfit->
pfit(0) + kmfit->
pfit(1);
870 HepLorentzVector pkspi = pks + kmfit->
pfit(2);
871 HepLorentzVector pksk = pks + kmfit->
pfit(3);
872 HepLorentzVector pkpi = kmfit->
pfit(2) + kmfit->
pfit(3);
879 m_chi2_fs4c = chisq ;
880 m_mks_fs4c = pks.m();
881 m_mkspi_fs4c = pkspi.m();
882 m_mksk_fs4c = pksk.m();
883 m_mkpi_fs4c = pkpi.m();
887 if(chisq > 20) {
return StatusCode::SUCCESS; }
888 if(m_vfit2_dl < 0.5) {
return StatusCode::SUCCESS; }
889 if(fabs(m_4c_mks-
mks0) > 0.01) {
return StatusCode::SUCCESS; }
890 if(m_4c_mkspi < 1.25) {
return StatusCode::SUCCESS; }
894 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hks_dl", h).isSuccess()) {
897 log << MSG::ERROR <<
"Couldn't retrieve hks_dl" << endreq;
900 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hks_m", h).isSuccess()) {
903 log << MSG::ERROR <<
"Couldn't retrieve hks_m" << endreq;
906 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hkspi_m", h).isSuccess()) {
909 log << MSG::ERROR <<
"Couldn't retrieve hkspi_m" << endreq;
912 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hks_p", h).isSuccess()) {
915 log << MSG::ERROR <<
"Couldn't retrieve hks_p" << endreq;
918 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hkpi_m", h).isSuccess()) {
921 log << MSG::ERROR <<
"Couldn't retrieve hkpi_m" << endreq;
929 if(m_npip==2 && m_npim==1){
930 (*(evtRecTrkCol->begin()+ipip[0]))->setPartId(2);
931 (*(evtRecTrkCol->begin()+ipip[1]))->setPartId(2);
932 (*(evtRecTrkCol->begin()+ipim[0]))->setPartId(2);
933 (*(evtRecTrkCol->begin()+ikm[0]))->setPartId(4);
935 if(m_npip==1 && m_npim==2){
936 (*(evtRecTrkCol->begin()+ipip[0]))->setPartId(2);
937 (*(evtRecTrkCol->begin()+ipim[0]))->setPartId(2);
938 (*(evtRecTrkCol->begin()+ipim[1]))->setPartId(2);
939 (*(evtRecTrkCol->begin()+ikp[0]))->setPartId(4);
946 if(m_npip==2 && m_npim==1){
947 (*(evtRecTrkCol->begin()+ipip[0]))->setQuality(2);
948 (*(evtRecTrkCol->begin()+ipip[1]))->setQuality(2);
949 (*(evtRecTrkCol->begin()+ipim[0]))->setQuality(2);
950 (*(evtRecTrkCol->begin()+ikm[0]))->setQuality(2);
952 if(m_npip==1 && m_npim==2){
953 (*(evtRecTrkCol->begin()+ipip[0]))->setQuality(2);
954 (*(evtRecTrkCol->begin()+ipim[0]))->setQuality(2);
955 (*(evtRecTrkCol->begin()+ipim[1]))->setQuality(2);
956 (*(evtRecTrkCol->begin()+ikp[0]))->setQuality(2);
961 setFilterPassed(
true);
966 return StatusCode::SUCCESS;
973 MsgStream log(
msgSvc(), name());
974 log << MSG::INFO <<
"in finalize()" << endmsg;
975 return StatusCode::SUCCESS;
double sin(const BesAngle a)
double cos(const BesAngle a)
const HepLorentzVector p_cms(0.034067, 0.0, 0.0, 3.097)
HepGeom::Point3D< double > HepPoint3D
std::vector< HepLorentzVector > Vp4
const HepLorentzVector p_cms(0.034067, 0.0, 0.0, 3.097)
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
static void setPidType(PidType pidType)
const double theta() const
const HepSymMatrix err() const
const HepVector helix() const
......
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
static KinematicFit * instance()
void AddFourMomentum(int number, HepLorentzVector p4)
HepLorentzVector pfit(int n) const
int methodProbability() const
int onlyPionKaonProton() const
void setChiMinCut(const double chi=4)
void setRecTrack(EvtRecTrack *trk)
void setMethod(const int method)
double chiTof2(int n) const
void identify(const int pidcase)
void usePidSys(const int pidsys)
static ParticleID * instance()
bool IsPidInfoValid() const
double chiTof1(int n) const
double probProton() const
double chiDedx(int n) const
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorK()
void setPrimaryVertex(const VertexParameter vpar)
double decayLength() const
double decayLengthError() const
static SecondVertexFit * instance()
void setVpar(const VertexParameter vpar)
WTrackParameter wpar() const
unsigned int layer() const
void setStatus(unsigned int status)
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
const HepPoint3D & pivot(void) const
returns pivot position.
const HepVector & a(void) const
returns helix parameters.
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
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol