72 MsgStream log(
msgSvc(), name() );
74 log << MSG::INFO <<
"in initialize()" << endmsg;
77 if ( service(
"THistSvc", m_thsvc ).isFailure() )
79 log << MSG::ERROR <<
"Couldn't get THistSvc" << endmsg;
80 return StatusCode::FAILURE;
85 TH1F* hks_dl =
new TH1F(
"ks_dl",
"ks_dl", 300, -5.0, 25.0 );
86 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hks_dl", hks_dl ).isFailure() )
87 { log << MSG::ERROR <<
"Couldn't register ks_dl" << endmsg; }
89 TH1F* hks_m =
new TH1F(
"ks_m",
"ks_m", 200, 0.4, 0.6 );
90 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hks_m", hks_m ).isFailure() )
91 { log << MSG::ERROR <<
"Couldn't register ks_m" << endmsg; }
93 TH1F* hkspi_m =
new TH1F(
"kspi_m",
"kspi_m", 200, 0.6, 2.6 );
94 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hkspi_m", hkspi_m ).isFailure() )
95 { log << MSG::ERROR <<
"Couldn't register kspi_m" << endmsg; }
97 TH1F* hks_p =
new TH1F(
"ks_p",
"ks_p", 100, 0.0, 1.5 );
98 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hks_p", hks_p ).isFailure() )
99 { log << MSG::ERROR <<
"Couldn't register ks_p" << endmsg; }
101 TH1F* hkpi_m =
new TH1F(
"kpi_m",
"kpi_m", 200, 0.6, 2.6 );
102 if ( m_thsvc->regHist(
"/DQAHist/DQAKsKpiDEDX/hkpi_m", hkpi_m ).isFailure() )
103 { log << MSG::ERROR <<
"Couldn't register kpi_m" << endmsg; }
108 NTuplePtr nt(
ntupleSvc(),
"DQAFILE/KsKpiDEDX" );
109 if ( nt ) m_tuple = nt;
113 ntupleSvc()->book(
"DQAFILE/KsKpiDEDX", CLID_ColumnWiseTuple,
"KsKpiDEDX ntuple" );
116 status = m_tuple->addItem(
"runNo", m_runNo );
117 status = m_tuple->addItem(
"event", m_event );
121 status = m_tuple->addItem(
"npip", m_npip );
122 status = m_tuple->addItem(
"npim", m_npim );
123 status = m_tuple->addItem(
"nkp", m_nkp );
124 status = m_tuple->addItem(
"nkm", m_nkm );
125 status = m_tuple->addItem(
"np", m_np );
126 status = m_tuple->addItem(
"npb", m_npb );
128 status = m_tuple->addItem(
"vfits_chi", m_vfits_chi );
129 status = m_tuple->addItem(
"vfits_vx", m_vfits_vx );
130 status = m_tuple->addItem(
"vfits_vy", m_vfits_vy );
131 status = m_tuple->addItem(
"vfits_vz", m_vfits_vz );
132 status = m_tuple->addItem(
"vfits_vr", m_vfits_vr );
134 status = m_tuple->addItem(
"vfitp_chi", m_vfitp_chi );
135 status = m_tuple->addItem(
"vfitp_vx", m_vfitp_vx );
136 status = m_tuple->addItem(
"vfitp_vy", m_vfitp_vy );
137 status = m_tuple->addItem(
"vfitp_vz", m_vfitp_vz );
138 status = m_tuple->addItem(
"vfitp_vr", m_vfitp_vr );
140 status = m_tuple->addItem(
"vfit2_chi", m_vfit2_chi );
141 status = m_tuple->addItem(
"vfit2_mks", m_vfit2_mks );
142 status = m_tuple->addItem(
"vfit2_ct", m_vfit2_ct );
143 status = m_tuple->addItem(
"vfit2_dl", m_vfit2_dl );
144 status = m_tuple->addItem(
"vfit2_dle", m_vfit2_dle );
146 status = m_tuple->addItem(
"chi2_fs4c", m_chi2_fs4c );
147 status = m_tuple->addItem(
"mks_fs4c", m_mks_fs4c );
148 status = m_tuple->addItem(
"mkspi_fs4c", m_mkspi_fs4c );
149 status = m_tuple->addItem(
"mksk_fs4c", m_mksk_fs4c );
150 status = m_tuple->addItem(
"mkpi_fs4c", m_mkpi_fs4c );
152 status = m_tuple->addItem(
"4c_chi2", m_4c_chi2 );
153 status = m_tuple->addItem(
"4c_mks", m_4c_mks );
154 status = m_tuple->addItem(
"4c_mkspi", m_4c_mkspi );
155 status = m_tuple->addItem(
"4c_mksk", m_4c_mksk );
156 status = m_tuple->addItem(
"4c_mkpi", m_4c_mkpi );
157 status = m_tuple->addItem(
"4c_ks_px", m_4c_ks_px );
158 status = m_tuple->addItem(
"4c_ks_py", m_4c_ks_py );
159 status = m_tuple->addItem(
"4c_ks_pz", m_4c_ks_pz );
160 status = m_tuple->addItem(
"4c_ks_p", m_4c_ks_p );
161 status = m_tuple->addItem(
"4c_ks_cos", m_4c_ks_cos );
163 status = m_tuple->addItem(
"NGch", m_ngch, 0, 10 );
164 status = m_tuple->addIndexedItem(
"pidcode", m_ngch, m_pidcode );
165 status = m_tuple->addIndexedItem(
"pidprob", m_ngch, m_pidprob );
166 status = m_tuple->addIndexedItem(
"pidchiDedx", m_ngch, m_pidchiDedx );
167 status = m_tuple->addIndexedItem(
"pidchiTof1", m_ngch, m_pidchiTof1 );
168 status = m_tuple->addIndexedItem(
"pidchiTof2", m_ngch, m_pidchiTof2 );
170 status = m_tuple->addIndexedItem(
"charge", m_ngch, m_charge );
171 status = m_tuple->addIndexedItem(
"vx0", m_ngch, m_vx0 );
172 status = m_tuple->addIndexedItem(
"vy0", m_ngch, m_vy0 );
173 status = m_tuple->addIndexedItem(
"vz0", m_ngch, m_vz0 );
174 status = m_tuple->addIndexedItem(
"vr0", m_ngch, m_vr0 );
176 status = m_tuple->addIndexedItem(
"vx", m_ngch, m_vx );
177 status = m_tuple->addIndexedItem(
"vy", m_ngch, m_vy );
178 status = m_tuple->addIndexedItem(
"vz", m_ngch, m_vz );
179 status = m_tuple->addIndexedItem(
"vr", m_ngch, m_vr );
181 status = m_tuple->addIndexedItem(
"px", m_ngch, m_px );
182 status = m_tuple->addIndexedItem(
"py", m_ngch, m_py );
183 status = m_tuple->addIndexedItem(
"pz", m_ngch, m_pz );
184 status = m_tuple->addIndexedItem(
"p", m_ngch, m_p );
185 status = m_tuple->addIndexedItem(
"cost", m_ngch, m_cost );
187 status = m_tuple->addIndexedItem(
"probPH", m_ngch, m_probPH );
188 status = m_tuple->addIndexedItem(
"normPH", m_ngch, m_normPH );
189 status = m_tuple->addIndexedItem(
"chie", m_ngch, m_chie );
190 status = m_tuple->addIndexedItem(
"chimu", m_ngch, m_chimu );
191 status = m_tuple->addIndexedItem(
"chipi", m_ngch, m_chipi );
192 status = m_tuple->addIndexedItem(
"chik", m_ngch, m_chik );
193 status = m_tuple->addIndexedItem(
"chip", m_ngch, m_chip );
194 status = m_tuple->addIndexedItem(
"ghit", m_ngch, m_ghit );
195 status = m_tuple->addIndexedItem(
"thit", m_ngch, m_thit );
197 status = m_tuple->addIndexedItem(
"e_emc", m_ngch, m_e_emc );
199 status = m_tuple->addIndexedItem(
"qual_etof", m_ngch, m_qual_etof );
200 status = m_tuple->addIndexedItem(
"tof_etof", m_ngch, m_tof_etof );
201 status = m_tuple->addIndexedItem(
"te_etof", m_ngch, m_te_etof );
202 status = m_tuple->addIndexedItem(
"tmu_etof", m_ngch, m_tmu_etof );
203 status = m_tuple->addIndexedItem(
"tpi_etof", m_ngch, m_tpi_etof );
204 status = m_tuple->addIndexedItem(
"tk_etof", m_ngch, m_tk_etof );
205 status = m_tuple->addIndexedItem(
"tp_etof", m_ngch, m_tp_etof );
207 status = m_tuple->addIndexedItem(
"qual_btof1", m_ngch, m_qual_btof1 );
208 status = m_tuple->addIndexedItem(
"tof_btof1", m_ngch, m_tof_btof1 );
209 status = m_tuple->addIndexedItem(
"te_btof1", m_ngch, m_te_btof1 );
210 status = m_tuple->addIndexedItem(
"tmu_btof1", m_ngch, m_tmu_btof1 );
211 status = m_tuple->addIndexedItem(
"tpi_btof1", m_ngch, m_tpi_btof1 );
212 status = m_tuple->addIndexedItem(
"tk_btof1", m_ngch, m_tk_btof1 );
213 status = m_tuple->addIndexedItem(
"tp_btof1", m_ngch, m_tp_btof1 );
215 status = m_tuple->addIndexedItem(
"qual_btof2", m_ngch, m_qual_btof2 );
216 status = m_tuple->addIndexedItem(
"tof_btof2", m_ngch, m_tof_btof2 );
217 status = m_tuple->addIndexedItem(
"te_btof2", m_ngch, m_te_btof2 );
218 status = m_tuple->addIndexedItem(
"tmu_btof2", m_ngch, m_tmu_btof2 );
219 status = m_tuple->addIndexedItem(
"tpi_btof2", m_ngch, m_tpi_btof2 );
220 status = m_tuple->addIndexedItem(
"tk_btof2", m_ngch, m_tk_btof2 );
221 status = m_tuple->addIndexedItem(
"tp_btof2", m_ngch, m_tp_btof2 );
223 else { log << MSG::ERROR <<
"Can not book N-tuple:" << long( m_tuple ) << endmsg; }
228 log << MSG::INFO <<
"successfully return from initialize()" << endmsg;
229 return StatusCode::SUCCESS;
235 MsgStream log(
msgSvc(), name() );
236 log << MSG::INFO <<
"in execute()" << endmsg;
242 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
243 m_runNo = eventHeader->runNumber();
244 m_event = eventHeader->eventNumber();
245 log << MSG::DEBUG <<
"run, evtnum = " << m_runNo <<
" , " << m_event << endmsg;
250 log << MSG::DEBUG <<
"ncharg, nneu, tottks = " << evtRecEvent->totalCharged() <<
" , "
251 << evtRecEvent->totalNeutral() <<
" , " << evtRecEvent->totalTracks() << endmsg;
255 if ( evtRecEvent->totalNeutral() > 100 ) {
return StatusCode::SUCCESS; }
260 Hep3Vector xorigin( 0, 0, 0 );
263 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc ).ignore();
268 xorigin.setX( dbv[0] );
269 xorigin.setY( dbv[1] );
270 xorigin.setZ( dbv[2] );
271 log << MSG::INFO <<
"xorigin.x=" << xorigin.x() <<
", "
272 <<
"xorigin.y=" << xorigin.y() <<
", "
273 <<
"xorigin.z=" << xorigin.z() <<
", " << endmsg;
277 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
280 if ( !( *itTrk )->isMdcTrackValid() )
continue;
281 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
284 double pch = mdcTrk->
p();
285 double x0 = mdcTrk->
x();
286 double y0 = mdcTrk->
y();
287 double z0 = mdcTrk->
z();
288 double phi0 = mdcTrk->
helix( 1 );
289 double xv = xorigin.x();
290 double yv = xorigin.y();
291 double Rxy = fabs( ( x0 - xv ) *
cos( phi0 ) + ( y0 - yv ) *
sin( phi0 ) );
294 double vz0 = z0 - xorigin.z();
296 double Vct =
cos( mdcTrk->
theta() );
298 HepVector a = mdcTrk->
helix();
299 HepSymMatrix Ea = mdcTrk->
err();
301 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
302 VFHelix helixip( point0, a, Ea );
304 HepVector vecipa = helixip.
a();
305 double Rvxy0 = fabs( vecipa[0] );
306 double Rvz0 = vecipa[3];
307 double Rvphi0 = vecipa[1];
312 if ( fabs( Rvz0 ) >= m_vz0cut )
continue;
313 if ( fabs( Rvxy0 ) >= m_vr0cut )
continue;
317 iGood.push_back( i );
318 nCharge += mdcTrk->
charge();
324 int m_ngch = iGood.size();
325 log << MSG::DEBUG <<
"ngood, totcharge = " << m_ngch <<
" , " << nCharge << endmsg;
326 if ( ( m_ngch != 4 ) || ( nCharge != 0 ) ) {
return StatusCode::SUCCESS; }
330 Vint ipip, ipim, ikp, ikm, ipp, ipm;
338 Vp4 p_pip, p_pim, p_kp, p_km, p_pp, p_pm;
347 for (
int i = 0; i < m_ngch; i++ )
366 if ( ( *itTrk )->isMdcKalTrackValid() ) mdcKalTrk = ( *itTrk )->mdcKalTrack();
372 HepLorentzVector ptrk;
373 ptrk.setPx( mdcTrk->
px() );
374 ptrk.setPy( mdcTrk->
py() );
375 ptrk.setPz( mdcTrk->
pz() );
376 double p3 = ptrk.mag();
378 if ( prob_pi > prob_K && prob_pi > prob_p )
381 m_pidprob[i] = pid->
prob( 2 );
382 m_pidchiDedx[i] = pid->
chiDedx( 2 );
383 m_pidchiTof1[i] = pid->
chiTof1( 2 );
384 m_pidchiTof2[i] = pid->
chiTof2( 2 );
385 ptrk.setE( sqrt( p3 * p3 +
xmass[2] *
xmass[2] ) );
386 if ( mdcTrk->
charge() > 0 )
388 ipip.push_back( iGood[i] );
389 p_pip.push_back( ptrk );
391 if ( mdcTrk->
charge() < 0 )
393 ipim.push_back( iGood[i] );
394 p_pim.push_back( ptrk );
398 if ( prob_K > prob_pi && prob_K > prob_p )
401 m_pidprob[i] = pid->
prob( 3 );
402 m_pidchiDedx[i] = pid->
chiDedx( 3 );
403 m_pidchiTof1[i] = pid->
chiTof1( 3 );
404 m_pidchiTof2[i] = pid->
chiTof2( 3 );
405 ptrk.setE( sqrt( p3 * p3 +
xmass[3] *
xmass[3] ) );
406 if ( mdcTrk->
charge() > 0 )
408 ikp.push_back( iGood[i] );
409 p_kp.push_back( ptrk );
411 if ( mdcTrk->
charge() < 0 )
413 ikm.push_back( iGood[i] );
414 p_km.push_back( ptrk );
418 if ( prob_p > prob_pi && prob_p > prob_K )
421 m_pidprob[i] = pid->
prob( 4 );
422 m_pidchiDedx[i] = pid->
chiDedx( 4 );
423 m_pidchiTof1[i] = pid->
chiTof1( 4 );
424 m_pidchiTof2[i] = pid->
chiTof2( 4 );
425 ptrk.setE( sqrt( p3 * p3 +
xmass[4] *
xmass[4] ) );
426 if ( mdcTrk->
charge() > 0 )
428 ipp.push_back( iGood[i] );
429 p_pp.push_back( ptrk );
431 if ( mdcTrk->
charge() < 0 )
433 ipm.push_back( iGood[i] );
434 p_pm.push_back( ptrk );
439 m_npip = ipip.size();
440 m_npim = ipim.size();
447 if ( m_npip * m_npim != 2 ) {
return StatusCode::SUCCESS; }
449 if ( m_nkp + m_nkm != 1 ) {
return StatusCode::SUCCESS; }
454 HepSymMatrix Evx( 3, 0 );
470 RecMdcKalTrack *pi1KalTrk{
nullptr }, *pi2KalTrk{
nullptr }, *pi3KalTrk{
nullptr },
471 *k1KalTrk{
nullptr };
472 RecMdcKalTrack *pipKalTrk{
nullptr }, *pimKalTrk{
nullptr }, *piKalTrk{
nullptr },
476 double chi_temp = 999.0;
477 double mks_temp = 10.0;
479 for (
unsigned int i1 = 0; i1 < m_npip; i1++ )
481 RecMdcKalTrack* pi1KalTrk = ( *( evtRecTrkCol->begin() + ipip[i1] ) )->mdcKalTrack();
485 for (
unsigned int i2 = 0; i2 < m_npim; i2++ )
487 RecMdcKalTrack* pi2KalTrk = ( *( evtRecTrkCol->begin() + ipim[i2] ) )->mdcKalTrack();
496 if ( !( vtxfit_s->
Fit( 0 ) ) )
continue;
498 m_vfits_chi = vtxfit_s->
chisq( 0 );
502 m_vfits_vx = ( vparks.
Vx() )[0];
503 m_vfits_vy = ( vparks.
Vx() )[1];
504 m_vfits_vz = ( vparks.
Vx() )[2];
505 m_vfits_vr = sqrt( m_vfits_vx * m_vfits_vx + m_vfits_vy * m_vfits_vy );
510 int jj = ( i1 == 1 ) ? 0 : 1;
511 pi3KalTrk = ( *( evtRecTrkCol->begin() + ipip[jj] ) )->mdcKalTrack();
512 k1KalTrk = ( *( evtRecTrkCol->begin() + ikm[0] ) )->mdcKalTrack();
517 int jj = ( i2 == 1 ) ? 0 : 1;
518 pi3KalTrk = ( *( evtRecTrkCol->begin() + ipim[jj] ) )->mdcKalTrack();
519 k1KalTrk = ( *( evtRecTrkCol->begin() + ikp[0] ) )->mdcKalTrack();
532 if ( !( vtxfit_p->
Fit( 0 ) ) )
continue;
534 m_vfitp_chi = vtxfit_p->
chisq( 0 );
537 m_vfitp_vx = ( primaryVpar.
Vx() )[0];
538 m_vfitp_vy = ( primaryVpar.
Vx() )[1];
539 m_vfitp_vz = ( primaryVpar.
Vx() )[2];
540 m_vfitp_vr = sqrt( m_vfitp_vx * m_vfitp_vx + m_vfitp_vy * m_vfitp_vy );
546 if ( !vtxfit2->
Fit() )
continue;
548 if ( fabs( ( ( vtxfit2->
wpar() ).p() ).m() -
mks0 ) < mks_temp )
550 mks_temp = fabs( ( ( vtxfit2->
wpar() ).p() ).m() -
mks0 );
554 wks = vtxfit2->
wpar();
555 m_vfit2_mks = ( wks.
p() ).m();
556 m_vfit2_chi = vtxfit2->
chisq();
557 m_vfit2_ct = vtxfit2->
ctau();
561 pipKalTrk = pi1KalTrk;
562 pimKalTrk = pi2KalTrk;
563 piKalTrk = pi3KalTrk;
569 if ( !okloop ) {
return StatusCode::SUCCESS; }
579 pimKalTrk->getZError() );
587 for (
int j = 0; j < m_ngch; j++ )
589 m_charge[j] = 9999.0;
606 m_probPH[j] = 9999.0;
607 m_normPH[j] = 9999.0;
618 m_qual_etof[j] = 9999.0;
619 m_tof_etof[j] = 9999.0;
620 m_te_etof[j] = 9999.0;
621 m_tmu_etof[j] = 9999.0;
622 m_tpi_etof[j] = 9999.0;
623 m_tk_etof[j] = 9999.0;
624 m_tp_etof[j] = 9999.0;
626 m_qual_btof1[j] = 9999.0;
627 m_tof_btof1[j] = 9999.0;
628 m_te_btof1[j] = 9999.0;
629 m_tmu_btof1[j] = 9999.0;
630 m_tpi_btof1[j] = 9999.0;
631 m_tk_btof1[j] = 9999.0;
632 m_tp_btof1[j] = 9999.0;
634 m_qual_btof2[j] = 9999.0;
635 m_tof_btof2[j] = 9999.0;
636 m_te_btof2[j] = 9999.0;
637 m_tmu_btof2[j] = 9999.0;
638 m_tpi_btof2[j] = 9999.0;
639 m_tk_btof2[j] = 9999.0;
640 m_tp_btof2[j] = 9999.0;
642 m_pidcode[j] = 9999.0;
643 m_pidprob[j] = 9999.0;
644 m_pidchiDedx[j] = 9999.0;
645 m_pidchiTof1[j] = 9999.0;
646 m_pidchiTof2[j] = 99999.0;
649 for (
int i = 0; i < m_ngch; i++ )
653 if ( !( *itTrk )->isMdcTrackValid() )
continue;
657 if ( mdcKalTrk == pipKalTrk )
662 if ( mdcKalTrk == pimKalTrk )
667 if ( mdcKalTrk == piKalTrk )
672 if ( mdcKalTrk == kKalTrk )
678 m_charge[ii] = mdcTrk->
charge();
679 double x0 = mdcTrk->
x();
680 double y0 = mdcTrk->
y();
681 double z0 = mdcTrk->
z();
682 double phi0 = mdcTrk->
helix( 1 );
683 double xv = xorigin.x();
684 double yv = xorigin.y();
685 double zv = xorigin.z();
686 double rv = ( x0 - xv ) *
cos( phi0 ) + ( y0 - yv ) *
sin( phi0 );
696 rv = ( x0 - xv ) *
cos( phi0 ) + ( y0 - yv ) *
sin( phi0 );
703 m_px[ii] = mdcKalTrk->
px();
704 m_py[ii] = mdcKalTrk->
py();
705 m_pz[ii] = mdcKalTrk->
pz();
706 m_p[ii] = mdcKalTrk->
p();
707 m_cost[ii] = mdcKalTrk->
pz() / mdcKalTrk->
p();
709 double ptrk = mdcKalTrk->
p();
710 if ( ( *itTrk )->isMdcDedxValid() )
713 m_probPH[ii] = dedxTrk->
probPH();
714 m_normPH[ii] = dedxTrk->
normPH();
716 m_chie[ii] = dedxTrk->
chiE();
717 m_chimu[ii] = dedxTrk->
chiMu();
718 m_chipi[ii] = dedxTrk->
chiPi();
719 m_chik[ii] = dedxTrk->
chiK();
720 m_chip[ii] = dedxTrk->
chiP();
725 if ( ( *itTrk )->isEmcShowerValid() )
728 m_e_emc[ii] = emcTrk->
energy();
731 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++ )
740 status->
setStatus( ( *iter_tof )->status() );
745 if ( status->
layer() != 0 )
continue;
746 double path = ( *iter_tof )->path();
747 double tof = ( *iter_tof )->tof();
748 double ph = ( *iter_tof )->ph();
749 double rhit = ( *iter_tof )->zrhit();
750 double qual = 0.0 + ( *iter_tof )->quality();
751 double cntr = 0.0 + ( *iter_tof )->tofID();
753 for (
int j = 0; j < 5; j++ )
755 double gb = ptrk /
xmass[j];
756 double beta = gb / sqrt( 1 + gb * gb );
757 texp[j] = path / beta /
velc;
760 m_qual_etof[ii] = qual;
761 m_tof_etof[ii] = tof;
766 if ( status->
layer() == 1 )
768 double path = ( *iter_tof )->path();
769 double tof = ( *iter_tof )->tof();
770 double ph = ( *iter_tof )->ph();
771 double rhit = ( *iter_tof )->zrhit();
772 double qual = 0.0 + ( *iter_tof )->quality();
773 double cntr = 0.0 + ( *iter_tof )->tofID();
775 for (
int j = 0; j < 5; j++ )
777 double gb = ptrk /
xmass[j];
778 double beta = gb / sqrt( 1 + gb * gb );
779 texp[j] = path / beta /
velc;
782 m_qual_btof1[ii] = qual;
783 m_tof_btof1[ii] = tof;
786 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++ )
797 double gb = ptrk /
xmass[j];
798 double beta = gb / sqrt( 1 + gb * gb );
799 texp[j] = path / beta /
velc;
802 m_qual_btof2[ii] = qual;
803 m_tof_btof2[ii] = tof;
814 double chisq = 9999.;
831 bool oksq = kmfit->
Fit();
834 chisq = kmfit->
chisq();
836 HepLorentzVector pk = kmfit->
pfit( 1 );
837 HepLorentzVector pks = kmfit->
pfit( 2 );
838 HepLorentzVector pkspi = kmfit->
pfit( 0 ) + kmfit->
pfit( 2 );
839 HepLorentzVector pksk = kmfit->
pfit( 1 ) + kmfit->
pfit( 2 );
840 HepLorentzVector pkpi = kmfit->
pfit( 0 ) + kmfit->
pfit( 1 );
843 pkspi.boost(
u_cms );
849 m_4c_mkspi = pkspi.m();
850 m_4c_mksk = pksk.m();
851 m_4c_mkpi = pkpi.m();
853 m_4c_ks_px = pks.px();
854 m_4c_ks_py = pks.py();
855 m_4c_ks_pz = pks.pz();
856 m_4c_ks_p = ( pks.vect() ).mag();
857 m_4c_ks_cos = m_4c_ks_pz / m_4c_ks_p;
876 chisq = kmfit->
chisq();
878 HepLorentzVector pks = kmfit->
pfit( 0 ) + kmfit->
pfit( 1 );
879 HepLorentzVector pkspi = pks + kmfit->
pfit( 2 );
880 HepLorentzVector pksk = pks + kmfit->
pfit( 3 );
881 HepLorentzVector pkpi = kmfit->
pfit( 2 ) + kmfit->
pfit( 3 );
884 pkspi.boost(
u_cms );
889 m_mks_fs4c = pks.m();
890 m_mkspi_fs4c = pkspi.m();
891 m_mksk_fs4c = pksk.m();
892 m_mkpi_fs4c = pkpi.m();
896 if ( chisq > 20 ) {
return StatusCode::SUCCESS; }
897 if ( m_vfit2_dl < 0.5 ) {
return StatusCode::SUCCESS; }
898 if ( fabs( m_4c_mks -
mks0 ) > 0.01 ) {
return StatusCode::SUCCESS; }
899 if ( m_4c_mkspi < 1.25 ) {
return StatusCode::SUCCESS; }
903 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hks_dl", h ).isSuccess() )
904 { h->Fill( m_vfit2_dl ); }
905 else { log << MSG::ERROR <<
"Couldn't retrieve hks_dl" << endmsg; }
907 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hks_m", h ).isSuccess() )
908 { h->Fill( m_4c_mks ); }
909 else { log << MSG::ERROR <<
"Couldn't retrieve hks_m" << endmsg; }
911 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hkspi_m", h ).isSuccess() )
912 { h->Fill( m_4c_mkspi ); }
913 else { log << MSG::ERROR <<
"Couldn't retrieve hkspi_m" << endmsg; }
915 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hks_p", h ).isSuccess() )
916 { h->Fill( m_4c_ks_p ); }
917 else { log << MSG::ERROR <<
"Couldn't retrieve hks_p" << endmsg; }
919 if ( m_thsvc->getHist(
"/DQAHist/DQAKsKpiDEDX/hkpi_m", h ).isSuccess() )
920 { h->Fill( m_4c_mkpi ); }
921 else { log << MSG::ERROR <<
"Couldn't retrieve hkpi_m" << endmsg; }
928 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 )
937 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setPartId( 2 );
938 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setPartId( 2 );
939 ( *( evtRecTrkCol->begin() + ipim[1] ) )->setPartId( 2 );
940 ( *( evtRecTrkCol->begin() + ikp[0] ) )->setPartId( 4 );
947 if ( m_npip == 2 && m_npim == 1 )
949 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setQuality( 2 );
950 ( *( evtRecTrkCol->begin() + ipip[1] ) )->setQuality( 2 );
951 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setQuality( 2 );
952 ( *( evtRecTrkCol->begin() + ikm[0] ) )->setQuality( 2 );
954 if ( m_npip == 1 && m_npim == 2 )
956 ( *( evtRecTrkCol->begin() + ipip[0] ) )->setQuality( 2 );
957 ( *( evtRecTrkCol->begin() + ipim[0] ) )->setQuality( 2 );
958 ( *( evtRecTrkCol->begin() + ipim[1] ) )->setQuality( 2 );
959 ( *( evtRecTrkCol->begin() + ikp[0] ) )->setQuality( 2 );
964 setFilterPassed(
true );
967 m_tuple->write().ignore();
969 return StatusCode::SUCCESS;