105 {
106
107 MsgStream log(
msgSvc(), name() );
108 log << MSG::INFO << "in execute()" << endmsg;
109
110
111
112
113 setFilterPassed( false );
114
115 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
116 m_runNo = eventHeader->runNumber();
117 m_event = eventHeader->eventNumber();
118 log << MSG::DEBUG << "run, evtnum = " << m_runNo << " , " << m_event << endmsg;
119
121 log << MSG::DEBUG << "ncharg, nneu, tottks = " << evtRecEvent->totalCharged() << " , "
122 << evtRecEvent->totalNeutral() << " , " << evtRecEvent->totalTracks() << endmsg;
123
125
126 if ( evtRecEvent->totalNeutral() > 100 ) { return StatusCode::SUCCESS; }
127
128 Vint iGood, iplus, iminus;
129 iGood.clear();
130 iplus.clear();
131 iminus.clear();
133 ppip.clear();
134 ppim.clear();
135
136 Hep3Vector xorigin( 0, 0, 0 );
137
138 IVertexDbSvc* vtxsvc;
139 Gaudi::svcLocator()->service( "VertexDbSvc", vtxsvc ).ignore();
141 {
144 xorigin.setX( dbv[0] );
145 xorigin.setY( dbv[1] );
146 xorigin.setZ( dbv[2] );
147 }
148
149 int nCharge = 0;
150 for ( int i = 0; i < evtRecEvent->totalCharged(); i++ )
151 {
153 if ( !( *itTrk )->isMdcTrackValid() ) continue;
154 if ( !( *itTrk )->isMdcKalTrackValid() ) continue;
155 RecMdcTrack* mdcTrk = ( *itTrk )->mdcTrack();
156
157 double pch = mdcTrk->
p();
158 double x0 = mdcTrk->
x();
159 double y0 = mdcTrk->
y();
160 double z0 = mdcTrk->
z();
161 double phi0 = mdcTrk->
helix( 1 );
162 double xv = xorigin.x();
163 double yv = xorigin.y();
164 double Rxy = fabs( ( x0 - xv ) *
cos( phi0 ) + ( y0 - yv ) *
sin( phi0 ) );
165
166 if ( fabs( z0 ) >= m_vz0cut ) continue;
167 if ( Rxy >= m_vr0cut ) continue;
168
169
170
171 TH1* h( 0 );
172 if ( m_thsvc->getHist( "/DQAHist/JsiLL/hrxy", h ).isSuccess() ) { h->Fill( Rxy ); }
173 else { log << MSG::ERROR << "Couldn't retrieve hrxy" << endmsg; }
174 if ( m_thsvc->getHist( "/DQAHist/JsiLL/hz", h ).isSuccess() ) { h->Fill( z0 ); }
175 else { log << MSG::ERROR << "Couldn't retrieve hz" << endmsg; }
176
177
178 iGood.push_back( i );
179 nCharge += mdcTrk->
charge();
180 if ( mdcTrk->
charge() > 0 ) { iplus.push_back( i ); }
181 else { iminus.push_back( i ); }
182 }
183
184
185
186
187 int nGood = iGood.size();
188 log << MSG::DEBUG << "ngood, totcharge = " << nGood << " , " << nCharge << endmsg;
189 if ( ( nGood != 4 ) || ( nCharge != 0 ) ) { return StatusCode::SUCCESS; }
190
191
192
193
194
195
196
197 int pidp0 = 5, pidp1 = 3, pidm0 = 5, pidm1 = 3;
198
199 RecMdcKalTrack* itTrkp = ( *( evtRecTrkCol->begin() + iplus[0] ) )->mdcKalTrack();
200 RecMdcKalTrack* itTrkpip = ( *( evtRecTrkCol->begin() + iplus[1] ) )->mdcKalTrack();
201 RecMdcKalTrack* itTrkpb = ( *( evtRecTrkCol->begin() + iminus[0] ) )->mdcKalTrack();
202 RecMdcKalTrack* itTrkpim = ( *( evtRecTrkCol->begin() + iminus[1] ) )->mdcKalTrack();
203
204
205 double tmppp, tmpppb, tmpppip, tmpppim;
206 tmppp = sqrt( itTrkp->
px() * itTrkp->
px() + itTrkp->
py() * itTrkp->
py() +
207 itTrkp->
pz() * itTrkp->
pz() );
208 tmpppb = sqrt( itTrkpb->
px() * itTrkpb->
px() + itTrkpb->
py() * itTrkpb->
py() +
209 itTrkpb->
pz() * itTrkpb->
pz() );
210 tmpppip = sqrt( itTrkpip->
px() * itTrkpip->
px() + itTrkpip->
py() * itTrkpip->
py() +
211 itTrkpip->
pz() * itTrkpip->
pz() );
212 tmpppim = sqrt( itTrkpim->
px() * itTrkpim->
px() + itTrkpim->
py() * itTrkpim->
py() +
213 itTrkpim->
pz() * itTrkpim->
pz() );
214
215 if ( tmppp < tmpppip )
216 {
217 itTrkp = ( *( evtRecTrkCol->begin() + iplus[1] ) )->mdcKalTrack();
218 itTrkpip = ( *( evtRecTrkCol->begin() + iplus[0] ) )->mdcKalTrack();
219 pidp0 = 3;
220 pidp1 = 5;
221 double tmp;
222 tmp = tmppp;
223 tmppp = tmpppip;
224 tmpppip = tmp;
225 }
226 if ( tmpppb < tmpppim )
227 {
228 itTrkpb = ( *( evtRecTrkCol->begin() + iminus[1] ) )->mdcKalTrack();
229 itTrkpim = ( *( evtRecTrkCol->begin() + iminus[0] ) )->mdcKalTrack();
230 pidm0 = 3;
231 pidm1 = 5;
232 double tmp;
233 tmp = tmpppb;
234 tmpppb = tmpppim;
235 tmpppim = tmp;
236 }
237
238 if ( tmppp < 0.7 || tmppp > 1.1 ) return StatusCode::SUCCESS;
239 if ( tmpppb < 0.7 || tmpppb > 1.1 ) return StatusCode::SUCCESS;
240 if ( tmpppip > 0.35 ) return StatusCode::SUCCESS;
241 if ( tmpppim > 0.35 ) return StatusCode::SUCCESS;
242
247
248 m_chisq = 9999.0;
249
251 HepSymMatrix Evx( 3, 0 );
252 double bx = 1E+6;
253 double by = 1E+6;
254 double bz = 1E+6;
255 Evx[0][0] = bx * bx;
256 Evx[1][1] = by * by;
257 Evx[2][2] = bz * bz;
258
259 VertexParameter vxpar;
262
268
272 WTrackParameter wpb =
274
279 if ( !vtxfita0->
Fit( 0 ) )
return StatusCode::SUCCESS;
285 if ( !vtxfita->
Fit() )
return StatusCode::SUCCESS;
286
287 WTrackParameter wLambda = vtxfita->
wpar();
288
293 if ( !vtxfitb0->
Fit( 0 ) )
return StatusCode::SUCCESS;
296
300 if ( !vtxfitb->
Fit() )
return StatusCode::SUCCESS;
301
302 WTrackParameter wLambdabar = vtxfitb->
wpar();
303
308 if ( !vtxfit->
Fit( 0 ) )
return StatusCode::SUCCESS;
310 WTrackParameter wwLambda = vtxfit->
wtrk( 0 );
311 WTrackParameter wwLambdabar = vtxfit->
wtrk( 1 );
312
313
314
316
317 HepLorentzVector
ecms( 0.034065, 0.0, 0.0, 3.0969 );
318 const Hep3Vector
u_cms = -
ecms.boostVector();
319
324
325 if ( !kmfit->
Fit() )
return StatusCode::SUCCESS;
326 m_chisq = kmfit->
chisq();
327 if ( m_chisq > 50 ) return StatusCode::SUCCESS;
328 HepLorentzVector kmf_pLambda = kmfit->
pfit( 0 );
329 HepLorentzVector kmf_pLambdabar = kmfit->
pfit( 1 );
330
331 kmf_pLambda.boost(
u_cms );
332 kmf_pLambdabar.boost(
u_cms );
333 m_mLambda = kmf_pLambda.m();
334 m_mLambdabar = kmf_pLambdabar.m();
335 m_pLambda = kmf_pLambda.rho();
336 m_pLambdabar = kmf_pLambdabar.rho();
337
338 if ( fabs( m_mLambda - 1.1157 ) > 0.003 || fabs( m_mLambdabar - 1.1157 ) > 0.003 )
339 return StatusCode::SUCCESS;
340
341
342 m_tuple->write().ignore();
343
344
345
346
347
348
349
350 ( *( evtRecTrkCol->begin() + iplus[0] ) )->setPartId( pidp0 );
351 ( *( evtRecTrkCol->begin() + iplus[1] ) )->setPartId( pidp1 );
352 ( *( evtRecTrkCol->begin() + iminus[0] ) )->setPartId( pidm0 );
353 ( *( evtRecTrkCol->begin() + iminus[1] ) )->setPartId( pidm1 );
354
355
356
357
358
359 ( *( evtRecTrkCol->begin() + iplus[0] ) )->setQuality( 0 );
360 ( *( evtRecTrkCol->begin() + iplus[1] ) )->setQuality( 0 );
361 ( *( evtRecTrkCol->begin() + iminus[0] ) )->setQuality( 0 );
362 ( *( evtRecTrkCol->begin() + iminus[1] ) )->setQuality( 0 );
363
364
365
366
367 setFilterPassed( true );
368
369
370 return StatusCode::SUCCESS;
371}
HepGeom::Point3D< double > HepPoint3D
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
double sin(const BesAngle a)
double cos(const BesAngle a)
static void setPidType(PidType pidType)
const HepVector helix() const
......
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0
static KinematicFit * instance()
void AddFourMomentum(int number, HepLorentzVector p4)
HepLorentzVector pfit(int n) const
const HepVector & getZHelix() const
const HepSymMatrix & getZError() const
HepSymMatrix & getZErrorP()
static SecondVertexFit * instance()
void setVpar(const VertexParameter vpar)
WTrackParameter wpar() const
void AddTrack(const int number, const double mass, const RecMdcTrack *trk)
WTrackParameter wtrk(int n) const
WTrackParameter wVirtualTrack(int n) const
void AddVertex(int number, VertexParameter vpar, std::vector< int > lis)
static VertexFit * instance()
VertexParameter vpar(int n) const
void BuildVirtualParticle(int number)
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol