71 MsgStream log(
msgSvc(), name() );
73 log << MSG::INFO <<
"in initialize()" << endmsg;
76 if ( service(
"THistSvc", m_thsvc ).isFailure() )
78 log << MSG::ERROR <<
"Couldn't get THistSvc" << endmsg;
79 return StatusCode::FAILURE;
84 TH1F* hks_dl =
new TH1F(
"ks_dl",
"ks_dl", 300, -5.0, 25.0 );
85 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hks_dl", hks_dl ).isFailure() )
86 { log << MSG::ERROR <<
"Couldn't register ks_dl" << endmsg; }
88 TH1F* hks_m =
new TH1F(
"ks_m",
"ks_m", 200, 0.4, 0.6 );
89 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hks_m", hks_m ).isFailure() )
90 { log << MSG::ERROR <<
"Couldn't register ks_m" << endmsg; }
92 TH1F* hkspi_m =
new TH1F(
"kspi_m",
"kspi_m", 200, 0.6, 2.6 );
93 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hkspi_m", hkspi_m ).isFailure() )
94 { log << MSG::ERROR <<
"Couldn't register kspi_m" << endmsg; }
96 TH1F* hks_p =
new TH1F(
"ks_p",
"ks_p", 100, 0.0, 1.5 );
97 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hks_p", hks_p ).isFailure() )
98 { log << MSG::ERROR <<
"Couldn't register ks_p" << endmsg; }
100 TH1F* hkpi_m =
new TH1F(
"kpi_m",
"kpi_m", 200, 0.6, 2.6 );
101 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpi/hkpi_m", hkpi_m ).isFailure() )
102 { log << MSG::ERROR <<
"Couldn't register kpi_m" << endmsg; }
107 NTuplePtr nt(
ntupleSvc(),
"DQAFILE/KsKpi" );
108 if ( nt ) m_tuple = nt;
111 m_tuple =
ntupleSvc()->book(
"DQAFILE/KsKpi", CLID_ColumnWiseTuple,
"KsKpi ntuple" );
114 status = m_tuple->addItem(
"runNo", m_runNo );
115 status = m_tuple->addItem(
"event", m_event );
119 status = m_tuple->addItem(
"npip", m_npip );
120 status = m_tuple->addItem(
"npim", m_npim );
121 status = m_tuple->addItem(
"nkp", m_nkp );
122 status = m_tuple->addItem(
"nkm", m_nkm );
123 status = m_tuple->addItem(
"np", m_np );
124 status = m_tuple->addItem(
"npb", m_npb );
126 status = m_tuple->addItem(
"vfits_chi", m_vfits_chi );
127 status = m_tuple->addItem(
"vfits_vx", m_vfits_vx );
128 status = m_tuple->addItem(
"vfits_vy", m_vfits_vy );
129 status = m_tuple->addItem(
"vfits_vz", m_vfits_vz );
130 status = m_tuple->addItem(
"vfits_vr", m_vfits_vr );
132 status = m_tuple->addItem(
"vfitp_chi", m_vfitp_chi );
133 status = m_tuple->addItem(
"vfitp_vx", m_vfitp_vx );
134 status = m_tuple->addItem(
"vfitp_vy", m_vfitp_vy );
135 status = m_tuple->addItem(
"vfitp_vz", m_vfitp_vz );
136 status = m_tuple->addItem(
"vfitp_vr", m_vfitp_vr );
138 status = m_tuple->addItem(
"vfit2_chi", m_vfit2_chi );
139 status = m_tuple->addItem(
"vfit2_mks", m_vfit2_mks );
140 status = m_tuple->addItem(
"vfit2_ct", m_vfit2_ct );
141 status = m_tuple->addItem(
"vfit2_dl", m_vfit2_dl );
142 status = m_tuple->addItem(
"vfit2_dle", m_vfit2_dle );
144 status = m_tuple->addItem(
"chi2_fs4c", m_chi2_fs4c );
145 status = m_tuple->addItem(
"mks_fs4c", m_mks_fs4c );
146 status = m_tuple->addItem(
"mkspi_fs4c", m_mkspi_fs4c );
147 status = m_tuple->addItem(
"mksk_fs4c", m_mksk_fs4c );
148 status = m_tuple->addItem(
"mkpi_fs4c", m_mkpi_fs4c );
150 status = m_tuple->addItem(
"4c_chi2", m_4c_chi2 );
151 status = m_tuple->addItem(
"4c_mks", m_4c_mks );
152 status = m_tuple->addItem(
"4c_mkspi", m_4c_mkspi );
153 status = m_tuple->addItem(
"4c_mksk", m_4c_mksk );
154 status = m_tuple->addItem(
"4c_mkpi", m_4c_mkpi );
155 status = m_tuple->addItem(
"4c_ks_px", m_4c_ks_px );
156 status = m_tuple->addItem(
"4c_ks_py", m_4c_ks_py );
157 status = m_tuple->addItem(
"4c_ks_pz", m_4c_ks_pz );
158 status = m_tuple->addItem(
"4c_ks_p", m_4c_ks_p );
159 status = m_tuple->addItem(
"4c_ks_cos", m_4c_ks_cos );
161 status = m_tuple->addItem(
"NGch", m_ngch, 0, 10 );
162 status = m_tuple->addIndexedItem(
"pidcode", m_ngch, m_pidcode );
163 status = m_tuple->addIndexedItem(
"pidprob", m_ngch, m_pidprob );
164 status = m_tuple->addIndexedItem(
"pidchiDedx", m_ngch, m_pidchiDedx );
165 status = m_tuple->addIndexedItem(
"pidchiTof1", m_ngch, m_pidchiTof1 );
166 status = m_tuple->addIndexedItem(
"pidchiTof2", m_ngch, m_pidchiTof2 );
168 status = m_tuple->addIndexedItem(
"charge", m_ngch, m_charge );
169 status = m_tuple->addIndexedItem(
"vx0", m_ngch, m_vx0 );
170 status = m_tuple->addIndexedItem(
"vy0", m_ngch, m_vy0 );
171 status = m_tuple->addIndexedItem(
"vz0", m_ngch, m_vz0 );
172 status = m_tuple->addIndexedItem(
"vr0", m_ngch, m_vr0 );
174 status = m_tuple->addIndexedItem(
"vx", m_ngch, m_vx );
175 status = m_tuple->addIndexedItem(
"vy", m_ngch, m_vy );
176 status = m_tuple->addIndexedItem(
"vz", m_ngch, m_vz );
177 status = m_tuple->addIndexedItem(
"vr", m_ngch, m_vr );
179 status = m_tuple->addIndexedItem(
"px", m_ngch, m_px );
180 status = m_tuple->addIndexedItem(
"py", m_ngch, m_py );
181 status = m_tuple->addIndexedItem(
"pz", m_ngch, m_pz );
182 status = m_tuple->addIndexedItem(
"p", m_ngch, m_p );
183 status = m_tuple->addIndexedItem(
"cost", m_ngch, m_cost );
185 status = m_tuple->addIndexedItem(
"probPH", m_ngch, m_probPH );
186 status = m_tuple->addIndexedItem(
"normPH", m_ngch, m_normPH );
187 status = m_tuple->addIndexedItem(
"chie", m_ngch, m_chie );
188 status = m_tuple->addIndexedItem(
"chimu", m_ngch, m_chimu );
189 status = m_tuple->addIndexedItem(
"chipi", m_ngch, m_chipi );
190 status = m_tuple->addIndexedItem(
"chik", m_ngch, m_chik );
191 status = m_tuple->addIndexedItem(
"chip", m_ngch, m_chip );
192 status = m_tuple->addIndexedItem(
"ghit", m_ngch, m_ghit );
193 status = m_tuple->addIndexedItem(
"thit", m_ngch, m_thit );
195 status = m_tuple->addIndexedItem(
"e_emc", m_ngch, m_e_emc );
197 status = m_tuple->addIndexedItem(
"qual_etof", m_ngch, m_qual_etof );
198 status = m_tuple->addIndexedItem(
"tof_etof", m_ngch, m_tof_etof );
199 status = m_tuple->addIndexedItem(
"te_etof", m_ngch, m_te_etof );
200 status = m_tuple->addIndexedItem(
"tmu_etof", m_ngch, m_tmu_etof );
201 status = m_tuple->addIndexedItem(
"tpi_etof", m_ngch, m_tpi_etof );
202 status = m_tuple->addIndexedItem(
"tk_etof", m_ngch, m_tk_etof );
203 status = m_tuple->addIndexedItem(
"tp_etof", m_ngch, m_tp_etof );
205 status = m_tuple->addIndexedItem(
"qual_btof1", m_ngch, m_qual_btof1 );
206 status = m_tuple->addIndexedItem(
"tof_btof1", m_ngch, m_tof_btof1 );
207 status = m_tuple->addIndexedItem(
"te_btof1", m_ngch, m_te_btof1 );
208 status = m_tuple->addIndexedItem(
"tmu_btof1", m_ngch, m_tmu_btof1 );
209 status = m_tuple->addIndexedItem(
"tpi_btof1", m_ngch, m_tpi_btof1 );
210 status = m_tuple->addIndexedItem(
"tk_btof1", m_ngch, m_tk_btof1 );
211 status = m_tuple->addIndexedItem(
"tp_btof1", m_ngch, m_tp_btof1 );
213 status = m_tuple->addIndexedItem(
"qual_btof2", m_ngch, m_qual_btof2 );
214 status = m_tuple->addIndexedItem(
"tof_btof2", m_ngch, m_tof_btof2 );
215 status = m_tuple->addIndexedItem(
"te_btof2", m_ngch, m_te_btof2 );
216 status = m_tuple->addIndexedItem(
"tmu_btof2", m_ngch, m_tmu_btof2 );
217 status = m_tuple->addIndexedItem(
"tpi_btof2", m_ngch, m_tpi_btof2 );
218 status = m_tuple->addIndexedItem(
"tk_btof2", m_ngch, m_tk_btof2 );
219 status = m_tuple->addIndexedItem(
"tp_btof2", m_ngch, m_tp_btof2 );
221 else { log << MSG::ERROR <<
"Can not book N-tuple:" << long( m_tuple ) << endmsg; }
226 log << MSG::INFO <<
"successfully return from initialize()" << endmsg;
227 return StatusCode::SUCCESS;
233 MsgStream log(
msgSvc(), name() );
234 log << MSG::INFO <<
"in execute()" << endmsg;
240 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
241 m_runNo = eventHeader->runNumber();
242 m_event = eventHeader->eventNumber();
243 log << MSG::DEBUG <<
"run, evtnum = " << m_runNo <<
" , " << m_event << endmsg;
248 log << MSG::DEBUG <<
"ncharg, nneu, tottks = " << evtRecEvent->totalCharged() <<
" , "
249 << evtRecEvent->totalNeutral() <<
" , " << evtRecEvent->totalTracks() << endmsg;
253 if ( evtRecEvent->totalNeutral() > 100 ) {
return StatusCode::SUCCESS; }
258 Hep3Vector xorigin( 0, 0, 0 );
261 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc ).ignore();
266 xorigin.setX( dbv[0] );
267 xorigin.setY( dbv[1] );
268 xorigin.setZ( dbv[2] );
269 log << MSG::INFO <<
"xorigin.x=" << xorigin.x() <<
", "
270 <<
"xorigin.y=" << xorigin.y() <<
", "
271 <<
"xorigin.z=" << xorigin.z() <<
", " << endmsg;
275 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
278 if ( !( *itTrk )->isMdcTrackValid() )
continue;
279 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
282 double pch = mdcTrk->
p();
283 double x0 = mdcTrk->
x();
284 double y0 = mdcTrk->
y();
285 double z0 = mdcTrk->
z();
286 double phi0 = mdcTrk->
helix( 1 );
287 double xv = xorigin.x();
288 double yv = xorigin.y();
289 double Rxy = fabs( ( x0 - xv ) *
cos( phi0 ) + ( y0 - yv ) *
sin( phi0 ) );
292 double vz0 = z0 - xorigin.z();
294 double Vct =
cos( mdcTrk->
theta() );
296 HepVector a = mdcTrk->
helix();
297 HepSymMatrix Ea = mdcTrk->
err();
299 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
300 VFHelix helixip( point0, a, Ea );
302 HepVector vecipa = helixip.
a();
303 double Rvxy0 = fabs( vecipa[0] );
304 double Rvz0 = vecipa[3];
305 double Rvphi0 = vecipa[1];
310 if ( fabs( Rvz0 ) >= m_vz0cut )
continue;
311 if ( Rvxy0 >= m_vr0cut )
continue;
314 iGood.push_back( i );
315 nCharge += mdcTrk->
charge();
321 int m_ngch = iGood.size();
322 log << MSG::DEBUG <<
"ngood, totcharge = " << m_ngch <<
" , " << nCharge << endmsg;
323 if ( ( m_ngch != 4 ) || ( nCharge != 0 ) ) {
return StatusCode::SUCCESS; }
327 Vint ipip, ipim, ikp, ikm, ipp, ipm;
335 Vp4 p_pip, p_pim, p_kp, p_km, p_pp, p_pm;
344 for (
int i = 0; i < m_ngch; i++ )
364 if ( ( *itTrk )->isMdcKalTrackValid() ) mdcKalTrk = ( *itTrk )->mdcKalTrack();
370 HepLorentzVector ptrk;
371 ptrk.setPx( mdcTrk->
px() );
372 ptrk.setPy( mdcTrk->
py() );
373 ptrk.setPz( mdcTrk->
pz() );
374 double p3 = ptrk.mag();
376 if ( prob_pi > prob_K && prob_pi > prob_p )
379 m_pidprob[i] = pid->
prob( 2 );
380 m_pidchiDedx[i] = pid->
chiDedx( 2 );
381 m_pidchiTof1[i] = pid->
chiTof1( 2 );
382 m_pidchiTof2[i] = pid->
chiTof2( 2 );
383 ptrk.setE( sqrt( p3 * p3 +
xmass[2] *
xmass[2] ) );
384 if ( mdcTrk->
charge() > 0 )
386 ipip.push_back( iGood[i] );
387 p_pip.push_back( ptrk );
389 if ( mdcTrk->
charge() < 0 )
391 ipim.push_back( iGood[i] );
392 p_pim.push_back( ptrk );
396 if ( prob_K > prob_pi && prob_K > prob_p )
399 m_pidprob[i] = pid->
prob( 3 );
400 m_pidchiDedx[i] = pid->
chiDedx( 3 );
401 m_pidchiTof1[i] = pid->
chiTof1( 3 );
402 m_pidchiTof2[i] = pid->
chiTof2( 3 );
403 ptrk.setE( sqrt( p3 * p3 +
xmass[3] *
xmass[3] ) );
404 if ( mdcTrk->
charge() > 0 )
406 ikp.push_back( iGood[i] );
407 p_kp.push_back( ptrk );
409 if ( mdcTrk->
charge() < 0 )
411 ikm.push_back( iGood[i] );
412 p_km.push_back( ptrk );
416 if ( prob_p > prob_pi && prob_p > prob_K )
419 m_pidprob[i] = pid->
prob( 4 );
420 m_pidchiDedx[i] = pid->
chiDedx( 4 );
421 m_pidchiTof1[i] = pid->
chiTof1( 4 );
422 m_pidchiTof2[i] = pid->
chiTof2( 4 );
423 ptrk.setE( sqrt( p3 * p3 +
xmass[4] *
xmass[4] ) );
424 if ( mdcTrk->
charge() > 0 )
426 ipp.push_back( iGood[i] );
427 p_pp.push_back( ptrk );
429 if ( mdcTrk->
charge() < 0 )
431 ipm.push_back( iGood[i] );
432 p_pm.push_back( ptrk );
437 m_npip = ipip.size();
438 m_npim = ipim.size();
445 if ( m_npip * m_npim != 2 ) {
return StatusCode::SUCCESS; }
447 if ( m_nkp + m_nkm != 1 ) {
return StatusCode::SUCCESS; }
452 HepSymMatrix Evx( 3, 0 );
468 RecMdcKalTrack *pi1KalTrk{
nullptr }, *pi2KalTrk{
nullptr }, *pi3KalTrk{
nullptr },
469 *k1KalTrk{
nullptr };
470 RecMdcKalTrack *pipKalTrk{
nullptr }, *pimKalTrk{
nullptr }, *piKalTrk{
nullptr },
474 double chi_temp = 999.0;
475 double mks_temp = 10.0;
477 for (
unsigned int i1 = 0; i1 < m_npip; i1++ )
479 RecMdcKalTrack* pi1KalTrk = ( *( evtRecTrkCol->begin() + ipip[i1] ) )->mdcKalTrack();
483 for (
unsigned int i2 = 0; i2 < m_npim; i2++ )
485 RecMdcKalTrack* pi2KalTrk = ( *( evtRecTrkCol->begin() + ipim[i2] ) )->mdcKalTrack();
494 if ( !( vtxfit_s->
Fit( 0 ) ) )
continue;
496 m_vfits_chi = vtxfit_s->
chisq( 0 );
500 m_vfits_vx = ( vparks.
Vx() )[0];
501 m_vfits_vy = ( vparks.
Vx() )[1];
502 m_vfits_vz = ( vparks.
Vx() )[2];
503 m_vfits_vr = sqrt( m_vfits_vx * m_vfits_vx + m_vfits_vy * m_vfits_vy );
508 int jj = ( i1 == 1 ) ? 0 : 1;
509 pi3KalTrk = ( *( evtRecTrkCol->begin() + ipip[jj] ) )->mdcKalTrack();
510 k1KalTrk = ( *( evtRecTrkCol->begin() + ikm[0] ) )->mdcKalTrack();
515 int jj = ( i2 == 1 ) ? 0 : 1;
516 pi3KalTrk = ( *( evtRecTrkCol->begin() + ipim[jj] ) )->mdcKalTrack();
517 k1KalTrk = ( *( evtRecTrkCol->begin() + ikp[0] ) )->mdcKalTrack();
530 if ( !( vtxfit_p->
Fit( 0 ) ) )
continue;
532 m_vfitp_chi = vtxfit_p->
chisq( 0 );
535 m_vfitp_vx = ( primaryVpar.
Vx() )[0];
536 m_vfitp_vy = ( primaryVpar.
Vx() )[1];
537 m_vfitp_vz = ( primaryVpar.
Vx() )[2];
538 m_vfitp_vr = sqrt( m_vfitp_vx * m_vfitp_vx + m_vfitp_vy * m_vfitp_vy );
544 if ( !vtxfit2->
Fit() )
continue;
546 if ( fabs( ( ( vtxfit2->
wpar() ).p() ).m() -
mks0 ) < mks_temp )
548 mks_temp = fabs( ( ( vtxfit2->
wpar() ).p() ).m() -
mks0 );
552 wks = vtxfit2->
wpar();
553 m_vfit2_mks = ( wks.
p() ).m();
554 m_vfit2_chi = vtxfit2->
chisq();
555 m_vfit2_ct = vtxfit2->
ctau();
559 pipKalTrk = pi1KalTrk;
560 pimKalTrk = pi2KalTrk;
561 piKalTrk = pi3KalTrk;
567 if ( !okloop ) {
return StatusCode::SUCCESS; }
577 pimKalTrk->getZError() );
585 for (
int j = 0; j < m_ngch; j++ )
587 m_charge[j] = 9999.0;
604 m_probPH[j] = 9999.0;
605 m_normPH[j] = 9999.0;
616 m_qual_etof[j] = 9999.0;
617 m_tof_etof[j] = 9999.0;
618 m_te_etof[j] = 9999.0;
619 m_tmu_etof[j] = 9999.0;
620 m_tpi_etof[j] = 9999.0;
621 m_tk_etof[j] = 9999.0;
622 m_tp_etof[j] = 9999.0;
624 m_qual_btof1[j] = 9999.0;
625 m_tof_btof1[j] = 9999.0;
626 m_te_btof1[j] = 9999.0;
627 m_tmu_btof1[j] = 9999.0;
628 m_tpi_btof1[j] = 9999.0;
629 m_tk_btof1[j] = 9999.0;
630 m_tp_btof1[j] = 9999.0;
632 m_qual_btof2[j] = 9999.0;
633 m_tof_btof2[j] = 9999.0;
634 m_te_btof2[j] = 9999.0;
635 m_tmu_btof2[j] = 9999.0;
636 m_tpi_btof2[j] = 9999.0;
637 m_tk_btof2[j] = 9999.0;
638 m_tp_btof2[j] = 9999.0;
640 m_pidcode[j] = 9999.0;
641 m_pidprob[j] = 9999.0;
642 m_pidchiDedx[j] = 9999.0;
643 m_pidchiTof1[j] = 9999.0;
644 m_pidchiTof2[j] = 99999.0;
647 for (
int i = 0; i < m_ngch; i++ )
651 if ( !( *itTrk )->isMdcTrackValid() )
continue;
655 if ( mdcKalTrk == pipKalTrk )
660 if ( mdcKalTrk == pimKalTrk )
665 if ( mdcKalTrk == piKalTrk )
670 if ( mdcKalTrk == kKalTrk )
676 m_charge[ii] = mdcTrk->
charge();
677 double x0 = mdcTrk->
x();
678 double y0 = mdcTrk->
y();
679 double z0 = mdcTrk->
z();
680 double phi0 = mdcTrk->
helix( 1 );
681 double xv = xorigin.x();
682 double yv = xorigin.y();
683 double zv = xorigin.z();
684 double rv = ( x0 - xv ) *
cos( phi0 ) + ( y0 - yv ) *
sin( phi0 );
694 rv = ( x0 - xv ) *
cos( phi0 ) + ( y0 - yv ) *
sin( phi0 );
701 m_px[ii] = mdcKalTrk->
px();
702 m_py[ii] = mdcKalTrk->
py();
703 m_pz[ii] = mdcKalTrk->
pz();
704 m_p[ii] = sqrt( m_px[ii] * m_px[ii] + m_py[ii] * m_py[ii] + m_pz[ii] * m_pz[ii] );
705 m_cost[ii] = m_pz[ii] / m_p[ii];
707 double ptrk = m_p[ii];
708 if ( ( *itTrk )->isMdcDedxValid() )
711 m_probPH[ii] = dedxTrk->
probPH();
712 m_normPH[ii] = dedxTrk->
normPH();
714 m_chie[ii] = dedxTrk->
chiE();
715 m_chimu[ii] = dedxTrk->
chiMu();
716 m_chipi[ii] = dedxTrk->
chiPi();
717 m_chik[ii] = dedxTrk->
chiK();
718 m_chip[ii] = dedxTrk->
chiP();
723 if ( ( *itTrk )->isEmcShowerValid() )
726 m_e_emc[ii] = emcTrk->
energy();
729 if ( ( *itTrk )->isTofTrackValid() )
731 SmartRefVector<RecTofTrack> tofTrkCol = ( *itTrk )->tofTrack();
733 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
735 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
738 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 gb = ptrk /
xmass[j];
754 double beta = gb / sqrt( 1 + gb * gb );
755 texp[j] = path / beta /
velc;
758 m_qual_etof[ii] = qual;
759 m_tof_etof[ii] = tof;
764 if ( status->
layer() == 1 )
766 double path = ( *iter_tof )->path();
767 double tof = ( *iter_tof )->tof();
768 double ph = ( *iter_tof )->ph();
769 double rhit = ( *iter_tof )->zrhit();
770 double qual = 0.0 + ( *iter_tof )->quality();
771 double cntr = 0.0 + ( *iter_tof )->tofID();
773 for (
int j = 0; j < 5; j++ )
775 double gb = ptrk /
xmass[j];
776 double beta = gb / sqrt( 1 + gb * gb );
777 texp[j] = path / beta /
velc;
780 m_qual_btof1[ii] = qual;
781 m_tof_btof1[ii] = tof;
784 if ( status->
layer() == 2 )
786 double path = ( *iter_tof )->path();
787 double tof = ( *iter_tof )->tof();
788 double ph = ( *iter_tof )->ph();
789 double rhit = ( *iter_tof )->zrhit();
790 double qual = 0.0 + ( *iter_tof )->quality();
791 double cntr = 0.0 + ( *iter_tof )->tofID();
793 for (
int j = 0; j < 5; j++ )
795 double gb = ptrk /
xmass[j];
796 double beta = gb / sqrt( 1 + gb * gb );
797 texp[j] = path / beta /
velc;
800 m_qual_btof2[ii] = qual;
801 m_tof_btof2[ii] = tof;
812 double chisq = 9999.;
829 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 );
841 pkspi.boost(
u_cms );
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 );
882 pkspi.boost(
u_cms );
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() )
902 { h->Fill( m_vfit2_dl ); }
903 else { log << MSG::ERROR <<
"Couldn't retrieve hks_dl" << endmsg; }
905 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hks_m", h ).isSuccess() ) { h->Fill( m_4c_mks ); }
906 else { log << MSG::ERROR <<
"Couldn't retrieve hks_m" << endmsg; }
908 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hkspi_m", h ).isSuccess() )
909 { h->Fill( m_4c_mkspi ); }
910 else { log << MSG::ERROR <<
"Couldn't retrieve hkspi_m" << endmsg; }
912 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hks_p", h ).isSuccess() ) { h->Fill( m_4c_ks_p ); }
913 else { log << MSG::ERROR <<
"Couldn't retrieve hks_p" << endmsg; }
915 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpi/hkpi_m", h ).isSuccess() )
916 { h->Fill( m_4c_mkpi ); }
917 else { log << MSG::ERROR <<
"Couldn't retrieve hkpi_m" << endmsg; }
924 if ( m_npip == 2 && m_npim == 1 )
926 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setPartId( 2 );
927 ( *( evtRecTrkCol->begin() + ipip[1] ) )->setPartId( 2 );
928 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setPartId( 2 );
929 ( *( evtRecTrkCol->begin() + ikm[0] ) )->setPartId( 4 );
931 if ( m_npip == 1 && m_npim == 2 )
933 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setPartId( 2 );
934 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setPartId( 2 );
935 ( *( evtRecTrkCol->begin() + ipim[1] ) )->setPartId( 2 );
936 ( *( evtRecTrkCol->begin() + ikp[0] ) )->setPartId( 4 );
943 if ( m_npip == 2 && m_npim == 1 )
945 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setQuality( 1 );
946 ( *( evtRecTrkCol->begin() + ipip[1] ) )->setQuality( 1 );
947 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setQuality( 1 );
948 ( *( evtRecTrkCol->begin() + ikm[0] ) )->setQuality( 1 );
950 if ( m_npip == 1 && m_npim == 2 )
952 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setQuality( 1 );
953 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setQuality( 1 );
954 ( *( evtRecTrkCol->begin() + ipim[1] ) )->setQuality( 1 );
955 ( *( evtRecTrkCol->begin() + ikp[0] ) )->setQuality( 1 );
960 setFilterPassed(
true );
963 m_tuple->write().ignore();
965 return StatusCode::SUCCESS;