33 Vint iGam,
double Ebeam,
int PID_flag,
int Charge_candidate_D ) {
35 int nGood = iGood.size();
36 int nGam = iGam.size();
40 double mass_bcgg, delE_tag_temp;
41 int m_chargetag, m_chargek, m_chargepi1, m_chargepi2, m_chargepi3;
42 int ika_temp, ipi1_temp, ipi2_temp, ipi3_temp, ipi4_temp, iGam1_temp, iGam2_temp;
43 HepLorentzVector kmfit1, kmfit2, kmfit3, kmfit4, pddd;
46 HepLorentzVector pddd_temp;
47 IDataProviderSvc* eventSvc = NULL;
48 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc );
50 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc,
"/Event/EventHeader" );
52 int runNo = eventHeader->runNumber();
53 int rec = eventHeader->eventNumber();
55 double xecm = 2 * Ebeam;
60 if ( ( evtRecEvent->totalCharged() < 4 || nGam < 2 ) ) {
return; }
65 Gaudi::svcLocator()->service(
"SimplePIDSvc", simple_pid );
67 double deltaE_tem = 0.20;
70 HepLorentzVector p2gfit;
71 HepLorentzVector p2gg;
73 Hep3Vector xorigin( 0, 0, 0 );
75 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc );
80 xorigin.setX( dbv[0] );
81 xorigin.setY( dbv[1] );
82 xorigin.setZ( dbv[2] );
85 double xv = xorigin.x();
86 double yv = xorigin.y();
87 double zv = xorigin.z();
89 HepPoint3D point0( 0., 0., 0. );
90 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
92 HepLorentzVector ptrk1_temp, ptrk2_temp, ptrk3_temp, ptrk4_temp, ptrk5_temp, ptrk6_temp,
95 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
99 int ika = ( *itTrk1 )->trackId();
101 if ( !( *itTrk1 )->isMdcKalTrackValid() )
continue;
105 m_chargek = mdcKalTrk1->
charge();
106 if ( Charge_candidate_D != 0 )
108 if ( m_chargek != -Charge_candidate_D )
continue;
110 if ( Charge_candidate_D == 0 )
112 if (
abs( m_chargek ) != 1 )
continue;
117 VFHelix helixip3_1( point0, a1, Ea1 );
118 helixip3_1.
pivot( IP );
119 HepVector vecipa1 = helixip3_1.
a();
121 double dr1 = fabs( vecipa1[0] );
122 double dz1 = fabs( vecipa1[3] );
123 double costheta1 =
cos( mdcKalTrk1->
theta() );
124 if ( dr1 >= 1.0 )
continue;
125 if ( dz1 >= 10.0 )
continue;
126 if ( fabs( costheta1 ) >= 0.93 )
continue;
142 for (
int j = 0; j < evtRecEvent->totalCharged(); j++ )
146 int ipi1 = ( *itTrk2 )->trackId();
147 if ( ipi1 == ika )
continue;
149 if ( !( *itTrk2 )->isMdcKalTrackValid() )
continue;
153 m_chargepi1 = mdcKalTrk2->
charge();
154 if ( ( m_chargek + m_chargepi1 ) != 0 )
continue;
157 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
158 VFHelix helixip3_2( point0, a2, Ea2 );
159 helixip3_2.
pivot( IP );
160 HepVector vecipa2 = helixip3_2.
a();
162 double dr2 = fabs( vecipa2[0] );
163 double dz2 = fabs( vecipa2[3] );
164 double costheta2 =
cos( mdcKalTrk2->
theta() );
165 if ( dr2 >= 1.0 )
continue;
166 if ( dz2 >= 10.0 )
continue;
167 if ( fabs( costheta2 ) >= 0.93 )
continue;
181 for (
int k = 0; k < evtRecEvent->totalCharged(); k++ )
185 int ipi2 = ( *itTrk3 )->trackId();
186 if ( ipi2 == ika || ipi2 == ipi1 )
continue;
188 if ( !( *itTrk3 )->isMdcKalTrackValid() )
continue;
192 m_chargepi2 = mdcKalTrk3->
charge();
193 if ( ( m_chargek + m_chargepi2 ) != 0 )
continue;
196 HepSymMatrix Ea3 = mdcKalTrk3->
getZError();
197 VFHelix helixip3_3( point0, a3, Ea3 );
198 helixip3_3.
pivot( IP );
199 HepVector vecipa3 = helixip3_3.
a();
201 double dr3 = fabs( vecipa3[0] );
202 double dz3 = fabs( vecipa3[3] );
203 double costheta3 =
cos( mdcKalTrk3->
theta() );
204 if ( dr3 >= 1.0 )
continue;
205 if ( dz3 >= 10.0 )
continue;
206 if ( fabs( costheta3 ) >= 0.93 )
continue;
211 if ( simple_pid->
probPion() < 0.0 ||
221 for (
int l = 0; l < evtRecEvent->totalCharged(); l++ )
225 int ipi3 = ( *itTrk4 )->trackId();
226 if ( ipi3 == ika || ipi3 == ipi1 || ipi3 == ipi2 )
continue;
228 if ( !( *itTrk4 )->isMdcKalTrackValid() )
continue;
232 m_chargepi3 = mdcKalTrk4->
charge();
233 if ( ( m_chargepi2 + m_chargepi3 ) != 0 )
continue;
236 HepSymMatrix Ea4 = mdcKalTrk4->
getZError();
237 VFHelix helixip3_4( point0, a4, Ea4 );
238 helixip3_4.
pivot( IP );
239 HepVector vecipa4 = helixip3_4.
a();
241 double dr4 = fabs( vecipa4[0] );
242 double dz4 = fabs( vecipa4[3] );
243 double costheta4 =
cos( mdcKalTrk4->
theta() );
244 if ( dr4 >= 1.0 )
continue;
245 if ( dz4 >= 10.0 )
continue;
246 if ( fabs( costheta4 ) >= 0.93 )
continue;
251 if ( simple_pid->
probPion() < 0.0 ||
258 for (
int m = 0; m < nGam - 1; m++ )
260 if ( iGam[m] == -1 )
continue;
261 RecEmcShower* g1Trk = ( *( evtRecTrkCol->begin() + iGam[m] ) )->emcShower();
262 double eraw1 = g1Trk->
energy();
264 double the1 = g1Trk->
theta();
265 HepLorentzVector ptrkg1, ptrkg10, ptrkg12;
266 ptrkg1.setPx( eraw1 *
sin( the1 ) *
cos(
phi1 ) );
267 ptrkg1.setPy( eraw1 *
sin( the1 ) *
sin(
phi1 ) );
268 ptrkg1.setPz( eraw1 *
cos( the1 ) );
269 ptrkg1.setE( eraw1 );
271 ptrkg12 = ptrkg1.boost( -0.011, 0, 0 );
273 for (
int n = m + 1;
n < nGam;
n++ )
275 if ( iGam[
n] == -1 )
continue;
276 RecEmcShower* g2Trk = ( *( evtRecTrkCol->begin() + iGam[
n] ) )->emcShower();
277 double eraw2 = g2Trk->
energy();
279 double the2 = g2Trk->
theta();
280 HepLorentzVector ptrkg2, ptrkg20, ptrkg22;
281 ptrkg2.setPx( eraw2 *
sin( the2 ) *
cos(
phi2 ) );
282 ptrkg2.setPy( eraw2 *
sin( the2 ) *
sin(
phi2 ) );
283 ptrkg2.setPz( eraw2 *
cos( the2 ) );
284 ptrkg2.setE( eraw2 );
286 ptrkg22 = ptrkg2.boost( -0.011, 0, 0 );
289 HepLorentzVector ptrkpi0;
290 ptrkpi0 = ptrkg12 + ptrkg22;
291 double m_xmpi0_tem = ptrkpi0.mag();
292 if ( m_xmpi0_tem > 0.150 || m_xmpi0_tem < 0.115 )
continue;
294 bool IsEndcap1 =
false;
295 bool IsEndcap2 =
false;
296 if ( fabs(
cos( the1 ) ) > 0.86 && fabs(
cos( the1 ) ) < 0.92 ) IsEndcap1 =
true;
297 if ( fabs(
cos( the2 ) ) > 0.86 && fabs(
cos( the2 ) ) < 0.92 ) IsEndcap2 =
true;
298 if ( IsEndcap1 && IsEndcap2 )
continue;
311 double pi0_chisq = kmfit->
chisq( 0 );
312 if ( pi0_chisq >= 2500 )
continue;
313 HepLorentzVector p2gfit = kmfit->
pfit( 0 ) + kmfit->
pfit( 1 );
314 p2gfit.boost( -0.011, 0, 0 );
317 HepPoint3D vx( xorigin.x(), xorigin.y(), xorigin.z() );
318 HepSymMatrix Evx( 3, 0 );
336 vtxfit->
AddVertex( 0, vxpar, 0, 1, 2, 3 );
337 if ( !vtxfit->
Fit( 0 ) )
continue;
345 HepVector kam_val = HepVector( 7, 0 );
346 HepVector pip1_val = HepVector( 7, 0 );
347 HepVector pip2_val = HepVector( 7, 0 );
348 HepVector pip3_val = HepVector( 7, 0 );
350 pip1_val = wpip1.
w();
351 pip2_val = wpip2.
w();
352 pip3_val = wpip3.
w();
354 HepLorentzVector P_KAM( kam_val[0], kam_val[1], kam_val[2], kam_val[3] );
355 HepLorentzVector P_PIP1( pip1_val[0], pip1_val[1], pip1_val[2], pip1_val[3] );
356 HepLorentzVector P_PIP2( pip2_val[0], pip2_val[1], pip2_val[2], pip2_val[3] );
357 HepLorentzVector P_PIP3( pip3_val[0], pip3_val[1], pip3_val[2], pip3_val[3] );
359 P_KAM.boost( -0.011, 0, 0 );
360 P_PIP1.boost( -0.011, 0, 0 );
361 P_PIP2.boost( -0.011, 0, 0 );
362 P_PIP3.boost( -0.011, 0, 0 );
363 pddd = P_KAM + P_PIP1 + P_PIP2 + P_PIP3 + p2gfit;
365 double pk3pipi0 = pddd.rho();
367 double temp1 = (
ecms / 2 ) * (
ecms / 2 ) - pk3pipi0 * pk3pipi0;
368 if ( temp1 < 0 ) temp1 = 0;
369 double mass_bc_tem = sqrt( temp1 );
370 if ( mass_bc_tem < 1.82 || mass_bc_tem > 1.89 )
continue;
372 double delE_tag_tag =
ecms / 2 - pddd.e();
374 if ( fabs( delE_tag_tag ) < deltaE_tem )
376 deltaE_tem = fabs( delE_tag_tag );
377 delE_tag_temp = delE_tag_tag;
378 mass_bcgg = mass_bc_tem;
381 cqtm_temp = m_chargek;
387 iGam1_temp = iGam[m];
388 iGam2_temp = iGam[
n];
401 if ( cqtm_temp < 0 ) tagmode = -24;
404 delE_tag = delE_tag_temp;
405 cqtm = -1.0 * cqtm_temp;
407 iGoodtag.push_back( ika_temp );
408 iGoodtag.push_back( ipi1_temp );
409 iGoodtag.push_back( ipi2_temp );
410 iGoodtag.push_back( ipi3_temp );
412 iGamtag.push_back( iGam1_temp );
413 iGamtag.push_back( iGam2_temp );
414 iGamtag.push_back( 9999 );
415 iGamtag.push_back( 9999 );