33 {
34
35 int nGood = iGood.size();
36 int nGam = iGam.size();
37
38 iGoodtag.clear();
39 iGamtag.clear();
40
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;
45
46 int cqtm_temp;
47 HepLorentzVector pddd_temp;
48 IDataProviderSvc* eventSvc = NULL;
49 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc );
51 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc, "/Event/EventHeader" );
52
53 int runNo = eventHeader->runNumber();
54 int rec = eventHeader->eventNumber();
55
56 double xecm = 2 * Ebeam;
57
58 kpimd = false;
59 double tagmode = 0;
60
61 if ( ( evtRecEvent->totalCharged() < 2 ) ) { return; }
62
64 ;
65
66 ISimplePIDSvc* simple_pid;
67 Gaudi::svcLocator()->service( "SimplePIDSvc", simple_pid );
68
69 double deltaE_tem = 0.20;
70 int ncount1 = 0;
71
72 Hep3Vector xorigin( 0, 0, 0 );
73 IVertexDbSvc* vtxsvc;
74 Gaudi::svcLocator()->service( "VertexDbSvc", vtxsvc );
76 {
79 xorigin.setX( dbv[0] );
80 xorigin.setY( dbv[1] );
81 xorigin.setZ( dbv[2] );
82 }
83
84 double xv = xorigin.x();
85 double yv = xorigin.y();
86 double zv = xorigin.z();
87
89 HepPoint3D IP( xorigin[0], xorigin[1], xorigin[2] );
90
91 HepLorentzVector ptrk1_temp, ptrk2_temp;
92
93 for ( int i = 0; i < evtRecEvent->totalCharged(); i++ )
94 {
96
97 int ika = ( *itTrk )->trackId();
98
99 if ( !( *itTrk )->isMdcKalTrackValid() ) continue;
100 RecMdcKalTrack* mdcKalTrk1 = ( *itTrk )->mdcKalTrack();
102
103 m_chargek = mdcKalTrk1->
charge();
104 if ( Charge_candidate_D != 0 )
105 {
106 if ( m_chargek != -Charge_candidate_D ) continue;
107 }
108 if ( Charge_candidate_D == 0 )
109 {
110 if (
abs( m_chargek ) != 1 )
continue;
111 }
112
115 VFHelix helixip3_1( point0, a1, Ea1 );
116 helixip3_1.pivot( IP );
117 HepVector vecipa1 = helixip3_1.a();
118
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;
125
126 if ( PID_flag == 5 )
127 {
130 continue;
131 }
132
133
135
136
137
138
139 for ( int j = 0; j < evtRecEvent->totalCharged(); j++ )
140 {
142
143 int ipi = ( *itTrk )->trackId();
144 if ( ipi == ika ) continue;
145
146 if ( !( *itTrk )->isMdcKalTrackValid() ) continue;
147 RecMdcKalTrack* mdcKalTrk2 = ( *itTrk )->mdcKalTrack();
149
150
151 m_chargepi = mdcKalTrk2->
charge();
152 if ( ( m_chargek + m_chargepi ) != 0 ) continue;
153
155 HepSymMatrix Ea2 = mdcKalTrk2->
getZError();
156 VFHelix helixip3_2( point0, a2, Ea2 );
157 helixip3_2.pivot( IP );
158 HepVector vecipa2 = helixip3_2.a();
159
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;
166
167 if ( PID_flag == 5 )
168 {
171 continue;
172 }
173
174
176
177
178 HepPoint3D vx( xorigin.x(), xorigin.y(), xorigin.z() );
179 HepSymMatrix Evx( 3, 0 );
180 double bx = 1E+6;
181 Evx[0][0] = bx * bx;
182 double by = 1E+6;
183 Evx[1][1] = by * by;
184 double bz = 1E+6;
185 Evx[2][2] = bz * bz;
186 VertexParameter vxpar;
189
190
196 if ( !vtxfit->
Fit( 0 ) )
continue;
198
199 WTrackParameter wkam = vtxfit->
wtrk( 0 );
200 WTrackParameter wpip = vtxfit->
wtrk( 1 );
201
202 HepVector kam_val = HepVector( 7, 0 );
204 HepVector pip_val = HepVector( 7, 0 );
206
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] );
209
210 P_KAM.boost( -0.011, 0, 0 );
211 P_PIP.boost( -0.011, 0, 0 );
212 pddd = P_KAM + P_PIP;
213
214 double pkpi = pddd.rho();
215
216 double temp1 = (
ecms / 2 ) * (
ecms / 2 ) - pkpi * pkpi;
217 if ( temp1 < 0 ) temp1 = 0;
218 double mass_bc_tem = sqrt( temp1 );
219
220 if ( mass_bc_tem < 1.82 || mass_bc_tem > 1.89 ) continue;
221
222 double delE_tag_tag =
ecms / 2 - pddd.e();
223
224 if ( fabs( delE_tag_tag ) < deltaE_tem )
225 {
226 deltaE_tem = fabs( delE_tag_tag );
227 delE_tag_temp = delE_tag_tag;
228 mass_bcgg = mass_bc_tem;
229
230 pddd_temp = pddd;
231 cqtm_temp = m_chargek;
232 ika_temp = ika;
233 ipi_temp = ipi;
234 ncount1 = 1;
235 }
236 }
237 }
238
239 if ( ncount1 == 1 )
240 {
241 tagmode = 11;
242 if ( cqtm_temp < 0 ) tagmode = -11;
243 tagmd = tagmode;
244 mass_bc = mass_bcgg;
245 delE_tag = delE_tag_temp;
246 cqtm = -1.0 * cqtm_temp;
247
248
249
250
251
252 iGoodtag.push_back( ika_temp );
253 iGoodtag.push_back( ipi_temp );
254
255 iGamtag.push_back( 9999 );
256 iGamtag.push_back( 9999 );
257 iGamtag.push_back( 9999 );
258 iGamtag.push_back( 9999 );
259
260 ptag = pddd_temp;
261
262 kpimd = true;
263 }
264}
HepGeom::Point3D< double > HepPoint3D
EvtRecTrackCol::iterator EvtRecTrackIterator
double cos(const BesAngle a)
const double theta() const
static void setPidType(PidType pidType)
virtual double probKaon()=0
virtual void preparePID(EvtRecTrack *track)=0
virtual double probPion()=0
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorK()
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
WTrackParameter wtrk(int n) const
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
static VertexFit * instance()
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
_EXTERN_ std::string EvtRecEvent