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"
8#include "GaudiKernel/Bootstrap.h"
19#include "CLHEP/Vector/ThreeVector.h"
20#include "CLHEP/Vector/LorentzVector.h"
21#include "CLHEP/Vector/TwoVector.h"
33#include "GaudiKernel/INTupleSvc.h"
34#include "GaudiKernel/NTuple.h"
35#include "GaudiKernel/Bootstrap.h"
36#include "GaudiKernel/ISvcLocator.h"
37#include "GaudiKernel/ITHistSvc.h"
40using CLHEP::Hep3Vector;
41using CLHEP::Hep2Vector;
42using CLHEP::HepLorentzVector;
43#include "CLHEP/Geometry/Point3D.h"
44#ifndef ENABLE_BACKWARDS_COMPATIBILITY
57const double mpi = 0.13957;
58const double mk = 0.493677;
59const double mks0 = 0.497648;
60const double xmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
61const double velc = 299.792458;
62typedef std::vector<int>
Vint;
63typedef std::vector<HepLorentzVector>
Vp4;
66const HepLorentzVector
p_cms(0.034067, 0.0, 0.0, 3.097);
69static int counter[10]={0,0,0,0,0,0,0,0,0,0};
74 Algorithm(name, pSvcLocator) {
77 declareProperty(
"Vr0cut", m_vr0cut=5.0);
78 declareProperty(
"Vz0cut", m_vz0cut=20.0);
79 declareProperty(
"Vr1cut", m_vr1cut=1.0);
80 declareProperty(
"Vz1cut", m_vz1cut=5.0);
81 declareProperty(
"Vctcut", m_cthcut=0.93);
82 declareProperty(
"EnergyThreshold", m_energyThreshold=0.04);
83 declareProperty(
"GammaAngCut", m_gammaAngCut=20.0);
89 MsgStream log(
msgSvc(), name());
91 log << MSG::INFO <<
"in initialize()" << endmsg;
94 if(service(
"THistSvc", m_thsvc).isFailure()) {
95 log << MSG::ERROR <<
"Couldn't get THistSvc" << endreq;
96 return StatusCode::FAILURE;
101 TH1F* hks_dl =
new TH1F(
"ks_dl",
"ks_dl", 300, -5.0, 25.0);
102 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hks_dl", hks_dl).isFailure()) {
103 log << MSG::ERROR <<
"Couldn't register ks_dl" << endreq;
106 TH1F* hks_m =
new TH1F(
"ks_m",
"ks_m", 200,0.4, 0.6);
107 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hks_m", hks_m).isFailure()) {
108 log << MSG::ERROR <<
"Couldn't register ks_m" << endreq;
111 TH1F* hkspi_m =
new TH1F(
"kspi_m",
"kspi_m", 200,0.6, 2.6);
112 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hkspi_m", hkspi_m).isFailure()) {
113 log << MSG::ERROR <<
"Couldn't register kspi_m" << endreq;
116 TH1F* hks_p =
new TH1F(
"ks_p",
"ks_p", 100,0.0, 1.5);
117 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hks_p", hks_p).isFailure()) {
118 log << MSG::ERROR <<
"Couldn't register ks_p" << endreq;
121 TH1F* hkpi_m =
new TH1F(
"kpi_m",
"kpi_m", 200,0.6, 2.6);
122 if(m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hkpi_m", hkpi_m).isFailure()) {
123 log << MSG::ERROR <<
"Couldn't register kpi_m" << endreq;
129 NTuplePtr nt(
ntupleSvc(),
"DQAFILE/KsKpi");
130 if ( nt ) m_tuple = nt;
132 m_tuple =
ntupleSvc()->book(
"DQAFILE/KsKpi", CLID_ColumnWiseTuple,
"KsKpi ntuple");
134 status = m_tuple->addItem(
"runNo", m_runNo);
135 status = m_tuple->addItem(
"event", m_event);
139 status = m_tuple->addItem(
"npip", m_npip);
140 status = m_tuple->addItem(
"npim", m_npim);
141 status = m_tuple->addItem(
"nkp", m_nkp);
142 status = m_tuple->addItem(
"nkm", m_nkm);
143 status = m_tuple->addItem(
"np", m_np);
144 status = m_tuple->addItem(
"npb", m_npb);
146 status = m_tuple->addItem(
"vfits_chi", m_vfits_chi);
147 status = m_tuple->addItem(
"vfits_vx", m_vfits_vx);
148 status = m_tuple->addItem(
"vfits_vy", m_vfits_vy);
149 status = m_tuple->addItem(
"vfits_vz", m_vfits_vz);
150 status = m_tuple->addItem(
"vfits_vr", m_vfits_vr);
152 status = m_tuple->addItem(
"vfitp_chi", m_vfitp_chi);
153 status = m_tuple->addItem(
"vfitp_vx", m_vfitp_vx);
154 status = m_tuple->addItem(
"vfitp_vy", m_vfitp_vy);
155 status = m_tuple->addItem(
"vfitp_vz", m_vfitp_vz);
156 status = m_tuple->addItem(
"vfitp_vr", m_vfitp_vr);
158 status = m_tuple->addItem(
"vfit2_chi", m_vfit2_chi);
159 status = m_tuple->addItem(
"vfit2_mks", m_vfit2_mks);
160 status = m_tuple->addItem(
"vfit2_ct", m_vfit2_ct);
161 status = m_tuple->addItem(
"vfit2_dl", m_vfit2_dl);
162 status = m_tuple->addItem(
"vfit2_dle", m_vfit2_dle);
164 status = m_tuple->addItem(
"chi2_fs4c", m_chi2_fs4c);
165 status = m_tuple->addItem(
"mks_fs4c", m_mks_fs4c);
166 status = m_tuple->addItem(
"mkspi_fs4c",m_mkspi_fs4c);
167 status = m_tuple->addItem(
"mksk_fs4c", m_mksk_fs4c);
168 status = m_tuple->addItem(
"mkpi_fs4c", m_mkpi_fs4c);
170 status = m_tuple->addItem(
"4c_chi2", m_4c_chi2);
171 status = m_tuple->addItem(
"4c_mks", m_4c_mks);
172 status = m_tuple->addItem(
"4c_mkspi", m_4c_mkspi);
173 status = m_tuple->addItem(
"4c_mksk", m_4c_mksk);
174 status = m_tuple->addItem(
"4c_mkpi", m_4c_mkpi);
175 status = m_tuple->addItem(
"4c_ks_px", m_4c_ks_px);
176 status = m_tuple->addItem(
"4c_ks_py", m_4c_ks_py);
177 status = m_tuple->addItem(
"4c_ks_pz", m_4c_ks_pz);
178 status = m_tuple->addItem(
"4c_ks_p", m_4c_ks_p);
179 status = m_tuple->addItem(
"4c_ks_cos", m_4c_ks_cos);
181 status = m_tuple->addItem(
"NGch", m_ngch, 0, 10);
182 status = m_tuple->addIndexedItem(
"pidcode", m_ngch, m_pidcode);
183 status = m_tuple->addIndexedItem(
"pidprob", m_ngch, m_pidprob);
184 status = m_tuple->addIndexedItem(
"pidchiDedx", m_ngch, m_pidchiDedx);
185 status = m_tuple->addIndexedItem(
"pidchiTof1", m_ngch, m_pidchiTof1);
186 status = m_tuple->addIndexedItem(
"pidchiTof2", m_ngch, m_pidchiTof2);
188 status = m_tuple->addIndexedItem(
"charge",m_ngch, m_charge);
189 status = m_tuple->addIndexedItem(
"vx0", m_ngch, m_vx0);
190 status = m_tuple->addIndexedItem(
"vy0", m_ngch, m_vy0);
191 status = m_tuple->addIndexedItem(
"vz0", m_ngch, m_vz0);
192 status = m_tuple->addIndexedItem(
"vr0", m_ngch, m_vr0);
194 status = m_tuple->addIndexedItem(
"vx", m_ngch, m_vx);
195 status = m_tuple->addIndexedItem(
"vy", m_ngch, m_vy);
196 status = m_tuple->addIndexedItem(
"vz", m_ngch, m_vz);
197 status = m_tuple->addIndexedItem(
"vr", m_ngch, m_vr);
199 status = m_tuple->addIndexedItem(
"px", m_ngch, m_px);
200 status = m_tuple->addIndexedItem(
"py", m_ngch, m_py);
201 status = m_tuple->addIndexedItem(
"pz", m_ngch, m_pz);
202 status = m_tuple->addIndexedItem(
"p", m_ngch, m_p);
203 status = m_tuple->addIndexedItem(
"cost", m_ngch, m_cost);
205 status = m_tuple->addIndexedItem(
"probPH", m_ngch, m_probPH);
206 status = m_tuple->addIndexedItem(
"normPH", m_ngch, m_normPH);
207 status = m_tuple->addIndexedItem(
"chie", m_ngch, m_chie);
208 status = m_tuple->addIndexedItem(
"chimu", m_ngch, m_chimu);
209 status = m_tuple->addIndexedItem(
"chipi", m_ngch, m_chipi);
210 status = m_tuple->addIndexedItem(
"chik", m_ngch, m_chik);
211 status = m_tuple->addIndexedItem(
"chip", m_ngch, m_chip);
212 status = m_tuple->addIndexedItem(
"ghit", m_ngch, m_ghit);
213 status = m_tuple->addIndexedItem(
"thit", m_ngch, m_thit);
215 status = m_tuple->addIndexedItem(
"e_emc", m_ngch, m_e_emc);
217 status = m_tuple->addIndexedItem(
"qual_etof", m_ngch, m_qual_etof);
218 status = m_tuple->addIndexedItem(
"tof_etof", m_ngch, m_tof_etof);
219 status = m_tuple->addIndexedItem(
"te_etof", m_ngch, m_te_etof);
220 status = m_tuple->addIndexedItem(
"tmu_etof", m_ngch, m_tmu_etof);
221 status = m_tuple->addIndexedItem(
"tpi_etof", m_ngch, m_tpi_etof);
222 status = m_tuple->addIndexedItem(
"tk_etof", m_ngch, m_tk_etof);
223 status = m_tuple->addIndexedItem(
"tp_etof", m_ngch, m_tp_etof);
225 status = m_tuple->addIndexedItem(
"qual_btof1", m_ngch, m_qual_btof1);
226 status = m_tuple->addIndexedItem(
"tof_btof1", m_ngch, m_tof_btof1);
227 status = m_tuple->addIndexedItem(
"te_btof1", m_ngch, m_te_btof1);
228 status = m_tuple->addIndexedItem(
"tmu_btof1", m_ngch, m_tmu_btof1);
229 status = m_tuple->addIndexedItem(
"tpi_btof1", m_ngch, m_tpi_btof1);
230 status = m_tuple->addIndexedItem(
"tk_btof1", m_ngch, m_tk_btof1);
231 status = m_tuple->addIndexedItem(
"tp_btof1", m_ngch, m_tp_btof1);
233 status = m_tuple->addIndexedItem(
"qual_btof2", m_ngch, m_qual_btof2);
234 status = m_tuple->addIndexedItem(
"tof_btof2", m_ngch, m_tof_btof2);
235 status = m_tuple->addIndexedItem(
"te_btof2", m_ngch, m_te_btof2);
236 status = m_tuple->addIndexedItem(
"tmu_btof2", m_ngch, m_tmu_btof2);
237 status = m_tuple->addIndexedItem(
"tpi_btof2", m_ngch, m_tpi_btof2);
238 status = m_tuple->addIndexedItem(
"tk_btof2", m_ngch, m_tk_btof2);
239 status = m_tuple->addIndexedItem(
"tp_btof2", m_ngch, m_tp_btof2);
242 log << MSG::ERROR <<
"Can not book N-tuple:" << long(m_tuple) << endreq;
248 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
249 return StatusCode::SUCCESS;
256 MsgStream log(
msgSvc(), name());
257 log << MSG::INFO <<
"in execute()" << endreq;
263 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
264 m_runNo = eventHeader->runNumber();
265 m_event=eventHeader->eventNumber();
266 log << MSG::DEBUG <<
"run, evtnum = "
273 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
274 << evtRecEvent->totalCharged() <<
" , "
275 << evtRecEvent->totalNeutral() <<
" , "
276 << evtRecEvent->totalTracks() <<endreq;
280 if(evtRecEvent->totalNeutral()>100) {
281 return StatusCode::SUCCESS;
287 Hep3Vector xorigin(0,0,0);
290 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc);
294 xorigin.setX(dbv[0]);
295 xorigin.setY(dbv[1]);
296 xorigin.setZ(dbv[2]);
298 <<
"xorigin.x="<<xorigin.x()<<
", "
299 <<
"xorigin.y="<<xorigin.y()<<
", "
300 <<
"xorigin.z="<<xorigin.z()<<
", "
305 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
307 if(!(*itTrk)->isMdcTrackValid())
continue;
308 if (!(*itTrk)->isMdcKalTrackValid())
continue;
311 double pch =mdcTrk->
p();
312 double x0 =mdcTrk->
x();
313 double y0 =mdcTrk->
y();
314 double z0 =mdcTrk->
z();
315 double phi0=mdcTrk->
helix(1);
316 double xv=xorigin.x();
317 double yv=xorigin.y();
318 double Rxy=fabs((x0-xv)*
cos(phi0)+(y0-yv)*
sin(phi0));
321 double vz0 = z0-xorigin.z();
325 HepVector a = mdcTrk->
helix();
326 HepSymMatrix Ea = mdcTrk->
err();
328 HepPoint3D IP(xorigin[0],xorigin[1],xorigin[2]);
331 HepVector vecipa = helixip.
a();
332 double Rvxy0=fabs(vecipa[0]);
333 double Rvz0=vecipa[3];
334 double Rvphi0=vecipa[1];
339 if(fabs(Rvz0) >= m_vz0cut)
continue;
340 if(Rvxy0 >= m_vr0cut)
continue;
344 nCharge += mdcTrk->
charge();
350 int m_ngch = iGood.size();
351 log << MSG::DEBUG <<
"ngood, totcharge = " << m_ngch <<
" , " << nCharge << endreq;
352 if((m_ngch != 4)||(nCharge!=0)){
353 return StatusCode::SUCCESS;
358 Vint ipip, ipim, ikp, ikm, ipp, ipm;
366 Vp4 p_pip, p_pim, p_kp, p_km, p_pp, p_pm ;
375 for(
int i = 0; i < m_ngch; i++) {
393 if((*itTrk)->isMdcKalTrackValid()) mdcKalTrk = (*itTrk)->mdcKalTrack();
399 HepLorentzVector ptrk;
400 ptrk.setPx(mdcTrk->
px()) ;
401 ptrk.setPy(mdcTrk->
py()) ;
402 ptrk.setPz(mdcTrk->
pz()) ;
403 double p3 = ptrk.mag() ;
405 if (prob_pi > prob_K && prob_pi > prob_p) {
407 m_pidprob[i]=pid->
prob(2);
408 m_pidchiDedx[i]=pid->
chiDedx(2);
409 m_pidchiTof1[i]=pid->
chiTof1(2);
410 m_pidchiTof2[i]=pid->
chiTof2(2);
412 if(mdcTrk->
charge() > 0) {
413 ipip.push_back(iGood[i]);
414 p_pip.push_back(ptrk);
416 if (mdcTrk->
charge() < 0) {
417 ipim.push_back(iGood[i]);
418 p_pim.push_back(ptrk);
422 if (prob_K > prob_pi && prob_K > prob_p) {
424 m_pidprob[i]=pid->
prob(3);
425 m_pidchiDedx[i]=pid->
chiDedx(3);
426 m_pidchiTof1[i]=pid->
chiTof1(3);
427 m_pidchiTof2[i]=pid->
chiTof2(3);
429 if(mdcTrk->
charge() > 0) {
430 ikp.push_back(iGood[i]);
431 p_kp.push_back(ptrk);
433 if (mdcTrk->
charge() < 0) {
434 ikm.push_back(iGood[i]);
435 p_km.push_back(ptrk);
439 if (prob_p > prob_pi && prob_p > prob_K) {
441 m_pidprob[i]=pid->
prob(4);
442 m_pidchiDedx[i]=pid->
chiDedx(4);
443 m_pidchiTof1[i]=pid->
chiTof1(4);
444 m_pidchiTof2[i]=pid->
chiTof2(4);
446 if(mdcTrk->
charge() > 0) {
447 ipp.push_back(iGood[i]);
448 p_pp.push_back(ptrk);
450 if (mdcTrk->
charge() < 0) {
451 ipm.push_back(iGood[i]);
452 p_pm.push_back(ptrk);
457 m_npip= ipip.size() ;
458 m_npim= ipim.size() ;
465 if( m_npip*m_npim != 2 ) {
466 return StatusCode::SUCCESS;
469 if( m_nkp+m_nkm != 1 ) {
470 return StatusCode::SUCCESS;
476 HepSymMatrix Evx(3, 0);
496 double chi_temp = 999.0;
497 double mks_temp = 10.0 ;
499 for(
unsigned int i1 = 0; i1 < m_npip; i1++) {
500 RecMdcKalTrack *pi1KalTrk = (*(evtRecTrkCol->begin()+ipip[i1]))-> mdcKalTrack();
504 for(
unsigned int i2 = 0; i2 < m_npim; i2++) {
505 RecMdcKalTrack *pi2KalTrk = (*(evtRecTrkCol->begin()+ipim[i2]))-> mdcKalTrack();
514 if(!(vtxfit_s->
Fit(0)))
continue;
516 m_vfits_chi = vtxfit_s->
chisq(0);
520 m_vfits_vx = (vparks.
Vx())[0];
521 m_vfits_vy = (vparks.
Vx())[1];
522 m_vfits_vz = (vparks.
Vx())[2];
523 m_vfits_vr = sqrt(m_vfits_vx*m_vfits_vx + m_vfits_vy*m_vfits_vy) ;
527 int jj = ( i1 == 1 ) ? 0 : 1;
528 pi3KalTrk = (*(evtRecTrkCol->begin()+ipip[jj]))->mdcKalTrack();
529 k1KalTrk = (*(evtRecTrkCol->begin()+ikm[0]))->mdcKalTrack();
533 int jj = ( i2 == 1 ) ? 0 : 1;
534 pi3KalTrk = (*(evtRecTrkCol->begin()+ipim[jj]))->mdcKalTrack();
535 k1KalTrk = (*(evtRecTrkCol->begin()+ikp[0]))->mdcKalTrack();
548 if(!(vtxfit_p->
Fit(0)))
continue;
550 m_vfitp_chi = vtxfit_p->
chisq(0) ;
553 m_vfitp_vx = (primaryVpar.
Vx())[0];
554 m_vfitp_vy = (primaryVpar.
Vx())[1];
555 m_vfitp_vz = (primaryVpar.
Vx())[2];
556 m_vfitp_vr = sqrt(m_vfitp_vx*m_vfitp_vx + m_vfitp_vy*m_vfitp_vy);
562 if(!vtxfit2->
Fit())
continue;
564 if ( fabs(((vtxfit2->
wpar()).p()).m()-
mks0) < mks_temp ) {
565 mks_temp = fabs(((vtxfit2->
wpar()).p()).m()-
mks0) ;
569 wks = vtxfit2->
wpar();
570 m_vfit2_mks = (wks.
p()).m();
571 m_vfit2_chi = vtxfit2->
chisq();
572 m_vfit2_ct = vtxfit2->
ctau();
576 pipKalTrk = pi1KalTrk ;
577 pimKalTrk = pi2KalTrk ;
578 piKalTrk = pi3KalTrk ;
586 return StatusCode::SUCCESS;
603 for(
int j=0; j<m_ngch; j++){
604 m_charge[j] = 9999.0;
621 m_probPH[j] = 9999.0;
622 m_normPH[j] = 9999.0;
633 m_qual_etof[j] = 9999.0;
634 m_tof_etof[j] = 9999.0;
635 m_te_etof[j] = 9999.0;
636 m_tmu_etof[j] = 9999.0;
637 m_tpi_etof[j] = 9999.0;
638 m_tk_etof[j] = 9999.0;
639 m_tp_etof[j] = 9999.0;
641 m_qual_btof1[j] = 9999.0;
642 m_tof_btof1[j] = 9999.0;
643 m_te_btof1[j] = 9999.0;
644 m_tmu_btof1[j] = 9999.0;
645 m_tpi_btof1[j] = 9999.0;
646 m_tk_btof1[j] = 9999.0;
647 m_tp_btof1[j] = 9999.0;
649 m_qual_btof2[j] = 9999.0;
650 m_tof_btof2[j] = 9999.0;
651 m_te_btof2[j] = 9999.0;
652 m_tmu_btof2[j] = 9999.0;
653 m_tpi_btof2[j] = 9999.0;
654 m_tk_btof2[j] = 9999.0;
655 m_tp_btof2[j] = 9999.0;
657 m_pidcode[j] = 9999.0;
658 m_pidprob[j] = 9999.0;
659 m_pidchiDedx[j] = 9999.0;
660 m_pidchiTof1[j] = 9999.0;
661 m_pidchiTof2[j] = 99999.0;
664 for(
int i = 0; i < m_ngch; i++ ){
667 if(!(*itTrk)->isMdcTrackValid())
continue;
671 if ( mdcKalTrk == pipKalTrk ) {
675 if ( mdcKalTrk == pimKalTrk ) {
679 if ( mdcKalTrk == piKalTrk ) {
683 if ( mdcKalTrk == kKalTrk ) {
688 m_charge[ii] = mdcTrk->
charge();
689 double x0=mdcTrk->
x();
690 double y0=mdcTrk->
y();
691 double z0=mdcTrk->
z();
692 double phi0=mdcTrk->
helix(1);
693 double xv=xorigin.x();
694 double yv=xorigin.y();
695 double zv=xorigin.z();
696 double rv=(x0-xv)*
cos(phi0)+(y0-yv)*
sin(phi0);
706 rv=(x0-xv)*
cos(phi0)+(y0-yv)*
sin(phi0);
713 m_px[ii] = mdcKalTrk->
px();
714 m_py[ii] = mdcKalTrk->
py();
715 m_pz[ii] = mdcKalTrk->
pz();
716 m_p[ii] = mdcKalTrk->
p();
717 m_cost[ii] = mdcKalTrk->
pz()/mdcKalTrk->
p();
719 double ptrk = mdcKalTrk->
p() ;
720 if((*itTrk)->isMdcDedxValid()) {
722 m_probPH[ii]= dedxTrk->
probPH();
723 m_normPH[ii]= dedxTrk->
normPH();
725 m_chie[ii] = dedxTrk->
chiE();
726 m_chimu[ii] = dedxTrk->
chiMu();
727 m_chipi[ii] = dedxTrk->
chiPi();
728 m_chik[ii] = dedxTrk->
chiK();
729 m_chip[ii] = dedxTrk->
chiP();
734 if((*itTrk)->isEmcShowerValid()) {
736 m_e_emc[ii] = emcTrk->
energy();
739 if((*itTrk)->isTofTrackValid()) {
740 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
742 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
744 for(;iter_tof != tofTrkCol.end(); iter_tof++ ) {
746 status->
setStatus((*iter_tof)->status());
750 if( status->
layer()!=0 )
continue;
751 double path=(*iter_tof)->path();
752 double tof = (*iter_tof)->tof();
753 double ph = (*iter_tof)->ph();
754 double rhit = (*iter_tof)->zrhit();
755 double qual = 0.0 + (*iter_tof)->quality();
756 double cntr = 0.0 + (*iter_tof)->tofID();
758 for(
int j = 0; j < 5; j++) {
759 double gb = ptrk/
xmass[j];
760 double beta = gb/sqrt(1+gb*gb);
761 texp[j] = path /beta/
velc;
764 m_qual_etof[ii] = qual;
765 m_tof_etof[ii] = tof ;
769 if(status->
layer()==1){
770 double path=(*iter_tof)->path();
771 double tof = (*iter_tof)->tof();
772 double ph = (*iter_tof)->ph();
773 double rhit = (*iter_tof)->zrhit();
774 double qual = 0.0 + (*iter_tof)->quality();
775 double cntr = 0.0 + (*iter_tof)->tofID();
777 for(
int j = 0; j < 5; j++) {
778 double gb = ptrk/
xmass[j];
779 double beta = gb/sqrt(1+gb*gb);
780 texp[j] = path /beta/
velc;
783 m_qual_btof1[ii] = qual;
784 m_tof_btof1[ii] = tof ;
787 if(status->
layer()==2){
788 double path=(*iter_tof)->path();
789 double tof = (*iter_tof)->tof();
790 double ph = (*iter_tof)->ph();
791 double rhit = (*iter_tof)->zrhit();
792 double qual = 0.0 + (*iter_tof)->quality();
793 double cntr = 0.0 + (*iter_tof)->tofID();
795 for(
int j = 0; j < 5; j++) {
796 double gb = ptrk/
xmass[j];
797 double beta = gb/sqrt(1+gb*gb);
798 texp[j] = path /beta/
velc;
801 m_qual_btof2[ii] = qual;
802 m_tof_btof2[ii] = tof ;
813 double chisq = 9999.;
830 bool oksq = kmfit->
Fit();
832 chisq = kmfit->
chisq();
834 HepLorentzVector pk = kmfit->
pfit(1);
835 HepLorentzVector pks = kmfit->
pfit(2);
836 HepLorentzVector pkspi = kmfit->
pfit(0) + kmfit->
pfit(2);
837 HepLorentzVector pksk = kmfit->
pfit(1) + kmfit->
pfit(2);
838 HepLorentzVector pkpi = kmfit->
pfit(0) + kmfit->
pfit(1);
847 m_4c_mkspi = pkspi.m();
848 m_4c_mksk = pksk.m();
849 m_4c_mkpi = pkpi.m();
851 m_4c_ks_px = pks.px() ;
852 m_4c_ks_py = pks.py() ;
853 m_4c_ks_pz = pks.pz() ;
854 m_4c_ks_p = (pks.vect()).mag() ;
855 m_4c_ks_cos = m_4c_ks_pz/m_4c_ks_p ;
874 chisq = kmfit->
chisq();
876 HepLorentzVector pks = kmfit->
pfit(0) + kmfit->
pfit(1);
877 HepLorentzVector pkspi = pks + kmfit->
pfit(2);
878 HepLorentzVector pksk = pks + kmfit->
pfit(3);
879 HepLorentzVector pkpi = kmfit->
pfit(2) + kmfit->
pfit(3);
886 m_chi2_fs4c = chisq ;
887 m_mks_fs4c = pks.m();
888 m_mkspi_fs4c = pkspi.m();
889 m_mksk_fs4c = pksk.m();
890 m_mkpi_fs4c = pkpi.m();
894 if(chisq > 20) {
return StatusCode::SUCCESS; }
895 if(m_vfit2_dl < 0.5) {
return StatusCode::SUCCESS; }
896 if(fabs(m_4c_mks-
mks0) > 0.01) {
return StatusCode::SUCCESS; }
897 if(m_4c_mkspi < 1.25) {
return StatusCode::SUCCESS; }
901 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hks_dl", h).isSuccess()) {
904 log << MSG::ERROR <<
"Couldn't retrieve hks_dl" << endreq;
907 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hks_m", h).isSuccess()) {
910 log << MSG::ERROR <<
"Couldn't retrieve hks_m" << endreq;
913 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hkspi_m", h).isSuccess()) {
916 log << MSG::ERROR <<
"Couldn't retrieve hkspi_m" << endreq;
919 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hks_p", h).isSuccess()) {
922 log << MSG::ERROR <<
"Couldn't retrieve hks_p" << endreq;
925 if (m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hkpi_m", h).isSuccess()) {
928 log << MSG::ERROR <<
"Couldn't retrieve hkpi_m" << endreq;
936 if(m_npip==2 && m_npim==1){
937 (*(evtRecTrkCol->begin()+ipip[0]))->setPartId(2);
938 (*(evtRecTrkCol->begin()+ipip[1]))->setPartId(2);
939 (*(evtRecTrkCol->begin()+ipim[0]))->setPartId(2);
940 (*(evtRecTrkCol->begin()+ikm[0]))->setPartId(4);
942 if(m_npip==1 && m_npim==2){
943 (*(evtRecTrkCol->begin()+ipip[0]))->setPartId(2);
944 (*(evtRecTrkCol->begin()+ipim[0]))->setPartId(2);
945 (*(evtRecTrkCol->begin()+ipim[1]))->setPartId(2);
946 (*(evtRecTrkCol->begin()+ikp[0]))->setPartId(4);
953 if(m_npip==2 && m_npim==1){
954 (*(evtRecTrkCol->begin()+ipip[0]))->setQuality(1);
955 (*(evtRecTrkCol->begin()+ipip[1]))->setQuality(1);
956 (*(evtRecTrkCol->begin()+ipim[0]))->setQuality(1);
957 (*(evtRecTrkCol->begin()+ikm[0]))->setQuality(1);
959 if(m_npip==1 && m_npim==2){
960 (*(evtRecTrkCol->begin()+ipip[0]))->setQuality(1);
961 (*(evtRecTrkCol->begin()+ipim[0]))->setQuality(1);
962 (*(evtRecTrkCol->begin()+ipim[1]))->setQuality(1);
963 (*(evtRecTrkCol->begin()+ikp[0]))->setQuality(1);
968 setFilterPassed(
true);
973 return StatusCode::SUCCESS;
980 MsgStream log(
msgSvc(), name());
981 log << MSG::INFO <<
"in finalize()" << endmsg;
982 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
DQAKsKpi(const std::string &name, ISvcLocator *pSvcLocator)
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