152{
153 if(m_selectFlag==false) return( StatusCode::SUCCESS );
154
155 MsgStream log(
msgSvc(),name());
156 log<<MSG::INFO<<"in execute()"<<endreq;
157
158 m_totevent ++;
159 if(m_totevent%1000==0) std::cout << m_totevent << "\tdone!" <<std::endl;
160
161 setFilterPassed(false);
162 m_mdcPass = m_tofPass = m_emcPass = m_mucPass = false;
163 for(int i=0; i<4; i++) m_passFlag[i] = false;
164
165 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
166 m_currun = eventHeader->runNumber();
167 m_curevent = eventHeader->eventNumber();
168 if( m_output ) { m_run = m_currun; m_event = m_curevent; }
169
170
171 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
172 if(!mdcTrackCol) {
173 log << MSG::FATAL << "Could not find RecMdcTrackCol!" << endreq;
174 return( StatusCode::FAILURE);
175 }
176 log << MSG::INFO << "MDC tracks:\t" << mdcTrackCol->size() << endreq;
177
178 if( mdcTrackCol->size() != 2 ) return ( StatusCode::SUCCESS );
179
180 m_cutpass[0] += 1;
181
182 double c1, c2, r1, r2, z1, z2, p1,
p2;
183 c1 = c2 = r1 = r2 = z1 = z2 = p1 =
p2 = 0.;
184
185 c1 = (*mdcTrackCol)[0]->charge(); c2 = (*mdcTrackCol)[1]->charge();
186 r1 = (*mdcTrackCol)[0]->r(); r2 = (*mdcTrackCol)[1]->r();
187 z1 = (*mdcTrackCol)[0]->z(); z2 = (*mdcTrackCol)[1]->z();
188 p1 = (*mdcTrackCol)[0]->p();
p2 = (*mdcTrackCol)[1]->p();
189
190 if( m_output ) { m_c1 = c1; m_c2 = c2; m_r1 = r1; m_r2 = r2; m_z1 = z1; m_z2 = z2; m_p1 = p1; m_p2 =
p2; }
191
192 bool mdcflag1 = c1 + c2 == 0;
193 bool mdcflag2 = fabs(r1)<=m_vr0cut && fabs(z1)<m_vz0cut;
194 bool mdcflag3 = fabs(r2)<=m_vr0cut && fabs(z2)<m_vz0cut;
195 bool mdcflag4 = p1<m_pcut_up &&
p2<m_pcut_up;
196
197
198 bool mdcflag5 = fabs( p1-
p2 )/( p1+
p2 ) < m_psymcut;
199
200 log << MSG::INFO << "r1:\t" << r1 << "\tz1:" << z1 << endreq;
201 log << MSG::INFO << "r2:\t" << r2 << "\tz2:" << z2 << endreq;
202 log << MSG::INFO <<
"p1:\t" << p1 <<
"\tp2:" <<
p2 << endreq;
203
204 if( mdcflag1 ) { m_cutpass[1] += 1; if(m_output) m_zeroCFlag = 1; }
205 if( mdcflag2 && mdcflag3 ) { m_cutpass[2] += 1; if(m_output) m_vtRZFlag = 1; }
206 if( mdcflag4 ) { m_cutpass[3] += 1; if(m_output) m_pLimFlag = 1; }
207 if( mdcflag5 ) { m_cutpass[4] += 1; if(m_output) m_pSymFlag = 1; }
208 if( mdcflag1 && mdcflag2 && mdcflag3 && mdcflag4 && mdcflag5 ) { m_mdcPass = true; m_subpass[0] += 1; }
209 if( !m_useFlag[0] ) m_passFlag[0] = true;
210 else m_passFlag[0] = m_mdcPass;
211 log << MSG::INFO << "MDC selection done!" << endreq;
212
213
214 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),"/Event/Recon/RecTofTrackCol");
215 if(!tofTrackCol) {
216 log << MSG::FATAL << "Could not find RecTofTrackCol!" << endreq;
217 return( StatusCode::FAILURE);
218 }
219 log << MSG::INFO << "TOF tracks:\t" << tofTrackCol->size() << endreq;
220
221 double t1, t2;
222 t1 = 0., t2 = 1000;
223
224 if(tofTrackCol->size() > 7 && tofTrackCol->size() < 21)
225 {
226 int goodtof = 0;
227 for(int itof = 0; itof < tofTrackCol->size(); itof++)
228 {
230 status->
setStatus((*tofTrackCol)[itof]->status());
231
232 if( !(status->
is_cluster()) ) {
delete status;
continue; }
233 if(goodtof==0) t1 = (*tofTrackCol)[itof]->tof();
234 if(goodtof==1) t2 = (*tofTrackCol)[itof]->tof();
235
236 goodtof++;
237 delete status;
238 }
239 }
240
241 if( m_output ) { m_t1 = t1; m_t2 = t2; }
242
243 bool tofflag1 = fabs( t1-t2 ) < m_tcut;
244 log << MSG::INFO << "t1:\t" << t1 << "\tt2:" << t2 << "dt:\t" << fabs(t1-t2) << endreq;
245 if( tofflag1 ) { m_cutpass[5] += 1; if(m_output) m_tLimFlag = 1; m_tofPass = true; m_subpass[1] += 1; }
246 if( !m_useFlag[1] ) m_passFlag[1] = true;
247 else m_passFlag[1] = m_tofPass;
248 log << MSG::INFO << "TOF selection done!" << endreq;
249
250
251 SmartDataPtr<RecEmcShowerCol> emcShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol");
252 if (!emcShowerCol) {
253 log << MSG::FATAL << "Could not find RecEmcShowerCol!" << endreq;
254 return( StatusCode::FAILURE);
255 }
256 log << MSG::INFO << "EMC showers:\t" << emcShowerCol->size() << endreq;
257
258 if( emcShowerCol->size() < 2 ) return ( StatusCode::SUCCESS );
259
261 int part;
262
263 e1 = (*emcShowerCol)[0]->energy();
e2 = (*emcShowerCol)[1]->energy();
264 theta1 = (*emcShowerCol)[0]->theta();
theta2 = (*emcShowerCol)[1]->theta();
265 phi1 = (*emcShowerCol)[0]->phi();
phi2 = (*emcShowerCol)[1]->phi();
266 part = (*emcShowerCol)[0]->module();
267
269 m_part = part;
270 }
271
272 bool emcFlag1 = e1 < m_ecut_up && e1 > m_ecut_down;
273 bool emcFlag2 = e2 < m_ecut_up && e2 > m_ecut_down;
275 bool emcFlag4 = fabs(
phi1 -
phi2) -
PI < m_dphicut;
276 bool emcFlag5 = !m_partselect || (m_partselect==1&&part==1) || (m_partselect==2&&part!=1);
277
278 log << MSG::INFO <<
"e1:\t" <<
e1 <<
"\te2:\t" <<
e2 << endreq;
279 log << MSG::INFO <<
"theta1:\t" <<
theta1 <<
"\ttheta2:\t" <<
theta2 << endreq;
280 log << MSG::INFO <<
"phi1:\t" <<
phi1 <<
"\tphi2:\t" <<
phi2 << endreq;
281 log << MSG::INFO << "part:\t" << part << "\tpartFlag:\t" << emcFlag5 << endreq;
282
283 if( emcFlag1 && emcFlag2 ) { m_cutpass[6] += 1; if(m_output) m_eLimFlag = 1; }
284 if( emcFlag3 && emcFlag4 ) { m_cutpass[7] += 1; if(m_output) m_eBBFlag = 1; }
285 if( emcFlag5 ) { m_cutpass[8] += 1; if(m_output) m_partFlag = 1; }
286 if( emcFlag1 && emcFlag2 && emcFlag3 && emcFlag4 && emcFlag5 ) { m_emcPass = true; m_subpass[2] += 1; }
287 if( !m_useFlag[2] ) m_passFlag[2] = true;
288 else m_passFlag[2] = m_emcPass;
289 log << MSG::INFO << "EMC selection done!" << endreq;
290
291
292 SmartDataPtr<MucDigiCol> mucDigiCol(eventSvc(),"/Event/Digi/MucDigiCol");
293 if(!mucDigiCol) {
294 log << MSG::FATAL << "Could not find MucDigiCol!" << endreq;
295 return( StatusCode::FAILURE);
296 }
297 SmartDataPtr<RecMucTrackCol> mucTrackCol(eventSvc(),"/Event/Recon/RecMucTrackCol");
298 if (!mucTrackCol) {
299 log << MSG::FATAL << "Could not find RecMucTrackCol" << endreq;
300 return( StatusCode::FAILURE);
301 }
302
303 int mudigiNum, mutrkNum;
304 double depth = 0;
305 mudigiNum = mutrkNum = 0;
306 mudigiNum = mucDigiCol->size(); mutrkNum = mucTrackCol->size();
307 RecMucTrackCol::iterator mutrkIter = mucTrackCol->begin();
308 for(; mutrkIter != mucTrackCol->end(); mutrkIter++) {
309 if( 0 == (*mutrkIter)->trackId() || 1 == (*mutrkIter)->trackId() ) depth += (*mutrkIter)->depth();
310 }
311
312 if(m_output) { m_mudigi = mudigiNum; m_mutrk = mutrkNum; m_depth = depth; }
313
314 bool mucflag1 = mudigiNum >= m_mudigicut;
315 bool mucflag2 = mutrkNum >= m_mutrkcut;
316 bool mucflag3 = depth > m_depthcut;
317
318 log << MSG::INFO << "MUC digi:\t" << mudigiNum << "\tMUC track:\t" << mutrkNum << endreq;
319
320 if( mucflag1 ) { m_cutpass[9] += 1; if(m_output) m_mudigiFlag = 1; }
321 if( mucflag2 ) { m_cutpass[10] += 1; if(m_output) m_mutrkFlag = 1; }
322 if( mucflag3 ) { m_cutpass[11] += 1; if(m_output) m_depthFlag = 1; }
323 if( mucflag1 && mucflag2 && mucflag3 ) { m_mucPass = true; m_subpass[3] += 1; }
324 if( !m_useFlag[3] ) m_passFlag[3] = true;
325 else m_passFlag[3] = m_mucPass;
326 log << MSG::INFO << "MUC selection done!" << endreq;
327
328
329
330 if( m_passFlag[0] && m_passFlag[1] && m_passFlag[2] && m_passFlag[3] )
331 {
332 m_totalpass += 1;
333 setFilterPassed(true);
334 }
335 log << MSG::INFO << "Set filter passed!" << endreq;
336
337 if(m_output) { m_mdcFlag = m_mdcPass; m_tofFlag = m_tofPass; m_emcFlag = m_emcPass; m_mucFlag = m_mucPass; }
338
339 if( m_output ) m_passtuple->write();
340
341 return StatusCode::SUCCESS;
342}
void setStatus(unsigned int status)