33 Vint iGam,
double Ebeam,
int PID_flag,
int Charge_candidate_D ) {
35 int nGood = iGood.size();
36 int nGam = iGam.size();
41 double mass_bcgg, delE_tag_temp;
42 int m_chargetag, m_chargek1, m_chargek2;
43 int ik1_temp, ik2_temp, iGam1_temp, iGam2_temp;
44 HepLorentzVector pddd;
45 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() < 2 || nGam < 2 ) ) {
return; }
65 Gaudi::svcLocator()->service(
"SimplePIDSvc", simple_pid );
67 double deltaE_tem = 0.20;
70 Hep3Vector xorigin( 0, 0, 0 );
72 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc );
77 xorigin.setX( dbv[0] );
78 xorigin.setY( dbv[1] );
79 xorigin.setZ( dbv[2] );
82 double xv = xorigin.x();
83 double yv = xorigin.y();
84 double zv = xorigin.z();
86 HepPoint3D point0( 0., 0., 0. );
87 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
90 HepLorentzVector p2gfit;
91 HepLorentzVector p2gg;
93 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
97 int ik1 = ( *itTrk )->trackId();
99 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
103 m_chargek1 = mdcKalTrk1->
charge();
104 if (
abs( m_chargek1 ) != 1 )
continue;
110 VFHelix helixip3_1( point0, a1, Ea1 );
111 helixip3_1.
pivot( IP );
112 HepVector vecipa1 = helixip3_1.
a();
114 double dr1 = fabs( vecipa1[0] );
115 double dz1 = fabs( vecipa1[3] );
116 double costheta1 =
cos( mdcKalTrk1->
theta() );
118 if ( dr1 >= 1.0 )
continue;
119 if ( dz1 >= 10.0 )
continue;
120 if ( fabs( costheta1 ) >= 0.93 )
continue;
134 for (
int j = 0; j < evtRecEvent->totalCharged(); j++ )
138 int ik2 = ( *itTrk )->trackId();
139 if ( ik2 == ik1 )
continue;
141 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
145 m_chargek2 = mdcKalTrk2->
charge();
146 if ( ( m_chargek1 + m_chargek2 ) != 0 )
continue;
151 VFHelix helixip3_2( point0, a2, Ea2 );
152 helixip3_2.
pivot( IP );
153 HepVector vecipa2 = helixip3_2.
a();
155 double dr2 = fabs( vecipa2[0] );
156 double dz2 = fabs( vecipa2[3] );
157 double costheta2 =
cos( mdcKalTrk2->
theta() );
158 if ( dr2 >= 1.0 )
continue;
159 if ( dz2 >= 10.0 )
continue;
160 if ( fabs( costheta2 ) >= 0.93 )
continue;
171 for (
int m = 0; m < nGam - 1; m++ )
173 if ( iGam[m] == -1 )
continue;
174 RecEmcShower* g1Trk = ( *( evtRecTrkCol->begin() + iGam[m] ) )->emcShower();
175 double eraw1 = g1Trk->
energy();
177 double the1 = g1Trk->
theta();
178 HepLorentzVector ptrkg1, ptrkg10, ptrkg12;
179 ptrkg1.setPx( eraw1 *
sin( the1 ) *
cos(
phi1 ) );
180 ptrkg1.setPy( eraw1 *
sin( the1 ) *
sin(
phi1 ) );
181 ptrkg1.setPz( eraw1 *
cos( the1 ) );
182 ptrkg1.setE( eraw1 );
184 ptrkg12 = ptrkg1.boost( -0.011, 0, 0 );
186 for (
int n = m + 1;
n < nGam;
n++ )
188 if ( iGam[
n] == -1 )
continue;
189 RecEmcShower* g2Trk = ( *( evtRecTrkCol->begin() + iGam[
n] ) )->emcShower();
190 double eraw2 = g2Trk->
energy();
192 double the2 = g2Trk->
theta();
193 HepLorentzVector ptrkg2, ptrkg20, ptrkg22;
194 ptrkg2.setPx( eraw2 *
sin( the2 ) *
cos(
phi2 ) );
195 ptrkg2.setPy( eraw2 *
sin( the2 ) *
sin(
phi2 ) );
196 ptrkg2.setPz( eraw2 *
cos( the2 ) );
197 ptrkg2.setE( eraw2 );
199 ptrkg22 = ptrkg2.boost( -0.011, 0, 0 );
202 HepLorentzVector ptrkpi0;
203 ptrkpi0 = ptrkg12 + ptrkg22;
204 double m_xmpi0_tem = ptrkpi0.m();
205 if ( m_xmpi0_tem > 0.150 || m_xmpi0_tem < 0.115 )
continue;
207 bool IsEndcap1 =
false;
208 bool IsEndcap2 =
false;
209 if ( fabs(
cos( the1 ) ) > 0.86 && fabs(
cos( the1 ) ) < 0.92 ) IsEndcap1 =
true;
210 if ( fabs(
cos( the2 ) ) > 0.86 && fabs(
cos( the2 ) ) < 0.92 ) IsEndcap2 =
true;
211 if ( IsEndcap1 && IsEndcap2 )
continue;
223 double pi0_chisq = kmfit->
chisq( 0 );
224 if ( pi0_chisq >= 2500 )
continue;
225 HepLorentzVector p2gfit = kmfit->
pfit( 0 ) + kmfit->
pfit( 1 );
226 p2gfit.boost( -0.011, 0, 0 );
229 HepPoint3D vx( xorigin.x(), xorigin.y(), xorigin.z() );
230 HepSymMatrix Evx( 3, 0 );
247 if ( !vtxfit->
Fit( 0 ) )
continue;
253 HepVector kam_val = HepVector( 7, 0 );
255 HepVector kap_val = HepVector( 7, 0 );
258 HepLorentzVector P_KAM( kam_val[0], kam_val[1], kam_val[2], kam_val[3] );
259 HepLorentzVector P_KAP( kap_val[0], kap_val[1], kap_val[2], kap_val[3] );
261 P_KAM.boost( -0.011, 0, 0 );
262 P_KAP.boost( -0.011, 0, 0 );
263 pddd = P_KAM + P_KAP + p2gfit;
265 double pkkpi0 = pddd.rho();
267 double temp1 = (
ecms / 2 ) * (
ecms / 2 ) - pkkpi0 * pkkpi0;
268 if ( temp1 < 0 ) temp1 = 0;
269 double mass_bc_tem = sqrt( temp1 );
270 if ( mass_bc_tem < 1.82 || mass_bc_tem > 1.89 )
continue;
272 double delE_tag_tag =
ecms / 2 - pddd.e();
274 if ( fabs( delE_tag_tag ) < deltaE_tem )
276 deltaE_tem = fabs( delE_tag_tag );
277 delE_tag_temp = delE_tag_tag;
278 mass_bcgg = mass_bc_tem;
284 iGam1_temp = iGam[m];
285 iGam2_temp = iGam[
n];
296 if ( m_chargetag < 0 ) tagmode = -23;
299 delE_tag = delE_tag_temp;
302 iGoodtag.push_back( ik1_temp );
303 iGoodtag.push_back( ik2_temp );
305 iGamtag.push_back( iGam1_temp );
306 iGamtag.push_back( iGam2_temp );
307 iGamtag.push_back( 9999 );
308 iGamtag.push_back( 9999 );