32void Kpi::MTotal(
double event, SmartDataPtr<EvtRecTrackCol> evtRecTrkCol,
Vint iGood,
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_chargek, m_chargepi;
43 int ika_temp, ipi_temp, ipi2_temp, ipi3_temp;
44 HepLorentzVector kmfit1, kmfit2, kmfit3, kmfit4, pddd;
47 HepLorentzVector pddd_temp;
48 IDataProviderSvc* eventSvc = NULL;
49 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc );
51 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc,
"/Event/EventHeader" );
53 int runNo = eventHeader->runNumber();
54 int rec = eventHeader->eventNumber();
56 double xecm = 2 * Ebeam;
61 if ( ( evtRecEvent->totalCharged() < 2 ) ) {
return; }
67 Gaudi::svcLocator()->service(
"SimplePIDSvc", simple_pid );
69 double deltaE_tem = 0.20;
72 Hep3Vector xorigin( 0, 0, 0 );
74 Gaudi::svcLocator()->service(
"VertexDbSvc", vtxsvc );
79 xorigin.setX( dbv[0] );
80 xorigin.setY( dbv[1] );
81 xorigin.setZ( dbv[2] );
84 double xv = xorigin.x();
85 double yv = xorigin.y();
86 double zv = xorigin.z();
88 HepPoint3D point0( 0., 0., 0. );
89 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
91 HepLorentzVector ptrk1_temp, ptrk2_temp;
93 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
97 int ika = ( *itTrk )->trackId();
99 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
103 m_chargek = mdcKalTrk1->
charge();
104 if ( Charge_candidate_D != 0 )
106 if ( m_chargek != -Charge_candidate_D )
continue;
108 if ( Charge_candidate_D == 0 )
110 if (
abs( m_chargek ) != 1 )
continue;
115 VFHelix helixip3_1( point0, a1, Ea1 );
116 helixip3_1.
pivot( IP );
117 HepVector vecipa1 = helixip3_1.
a();
119 double dr1 = fabs( vecipa1[0] );
120 double dz1 = fabs( vecipa1[3] );
121 double costheta1 =
cos( mdcKalTrk1->
theta() );
122 if ( dr1 >= 1.0 )
continue;
123 if ( dz1 >= 10.0 )
continue;
124 if ( fabs( costheta1 ) >= 0.93 )
continue;
139 for (
int j = 0; j < evtRecEvent->totalCharged(); j++ )
143 int ipi = ( *itTrk )->trackId();
144 if ( ipi == ika )
continue;
146 if ( !( *itTrk )->isMdcKalTrackValid() )
continue;
151 m_chargepi = mdcKalTrk2->
charge();
152 if ( ( m_chargek + m_chargepi ) != 0 )
continue;
155 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
156 VFHelix helixip3_2( point0, a2, Ea2 );
157 helixip3_2.
pivot( IP );
158 HepVector vecipa2 = helixip3_2.
a();
160 double dr2 = fabs( vecipa2[0] );
161 double dz2 = fabs( vecipa2[3] );
162 double costheta2 =
cos( mdcKalTrk2->
theta() );
163 if ( dr2 >= 1.0 )
continue;
164 if ( dz2 >= 10.0 )
continue;
165 if ( fabs( costheta2 ) >= 0.93 )
continue;
178 HepPoint3D vx( xorigin.x(), xorigin.y(), xorigin.z() );
179 HepSymMatrix Evx( 3, 0 );
196 if ( !vtxfit->
Fit( 0 ) )
continue;
202 HepVector kam_val = HepVector( 7, 0 );
204 HepVector pip_val = HepVector( 7, 0 );
207 HepLorentzVector P_KAM( kam_val[0], kam_val[1], kam_val[2], kam_val[3] );
208 HepLorentzVector P_PIP( pip_val[0], pip_val[1], pip_val[2], pip_val[3] );
210 P_KAM.boost( -0.011, 0, 0 );
211 P_PIP.boost( -0.011, 0, 0 );
212 pddd = P_KAM + P_PIP;
214 double pkpi = pddd.rho();
216 double temp1 = (
ecms / 2 ) * (
ecms / 2 ) - pkpi * pkpi;
217 if ( temp1 < 0 ) temp1 = 0;
218 double mass_bc_tem = sqrt( temp1 );
220 if ( mass_bc_tem < 1.82 || mass_bc_tem > 1.89 )
continue;
222 double delE_tag_tag =
ecms / 2 - pddd.e();
224 if ( fabs( delE_tag_tag ) < deltaE_tem )
226 deltaE_tem = fabs( delE_tag_tag );
227 delE_tag_temp = delE_tag_tag;
228 mass_bcgg = mass_bc_tem;
231 cqtm_temp = m_chargek;
242 if ( cqtm_temp < 0 ) tagmode = -11;
245 delE_tag = delE_tag_temp;
246 cqtm = -1.0 * cqtm_temp;
252 iGoodtag.push_back( ika_temp );
253 iGoodtag.push_back( ipi_temp );
255 iGamtag.push_back( 9999 );
256 iGamtag.push_back( 9999 );
257 iGamtag.push_back( 9999 );
258 iGamtag.push_back( 9999 );