27 m_totevent = m_currun = m_curevent = 0;
28 for(
int i = 0; i < 20; i++) m_cutpass[i] = 0;
29 m_subpass[0] = m_subpass[1] = m_subpass[2] = m_subpass[3] = 0;
32 m_propMgr.declareProperty(
"CmsEnergy", m_ecms = 3.686);
33 m_propMgr.declareProperty(
"Vr0Cut", m_vr0cut = 1.0);
34 m_propMgr.declareProperty(
"Vz0Cut", m_vz0cut = 5.0);
35 m_propMgr.declareProperty(
"PUpCut", m_pcut_up = 2.0);
36 m_propMgr.declareProperty(
"PDownCut", m_pcut_down = 0.5);
37 m_propMgr.declareProperty(
"PSymCut", m_psymcut = 0.5);
38 m_propMgr.declareProperty(
"TCut", m_tcut = 4);
39 m_propMgr.declareProperty(
"EUpCut", m_ecut_up = 1.0);
40 m_propMgr.declareProperty(
"EDownCut", m_ecut_down = 0.1);
41 m_propMgr.declareProperty(
"DThetaCut", m_dthetacut = 0.05);
42 m_propMgr.declareProperty(
"DPhiCut", m_dphicut = 0.4);
43 m_propMgr.declareProperty(
"PartSelect", m_partselect= 0);
44 m_propMgr.declareProperty(
"MuDigiCut", m_mudigicut = 6);
45 m_propMgr.declareProperty(
"MuTrkCut", m_mutrkcut = 1);
47 IJobOptionsSvc* jobSvc;
48 Gaudi::svcLocator()->service(
"JobOptionsSvc", jobSvc);
49 jobSvc->setMyProperties(
"DimuSelect", &m_propMgr);
102 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
103 MsgStream log(
msgSvc,
"DimuPreSelect");
105 IDataProviderSvc* eventSvc;
106 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
114 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(eventSvc,
"/Event/Recon/RecMdcTrackCol");
116 log << MSG::ERROR <<
"Could not find RecMdcTrackCol!" << endreq;
119 log << MSG::INFO <<
"MDC tracks:\t" << mdcTrackCol->size() << endreq;
121 if( mdcTrackCol->size() != 2 )
return 0;
125 double c1, c2, r1, r2, z1, z2,
p1,
p2;
126 c1 = c2 = r1 = r2 = z1 = z2 =
p1 =
p2 = 0.;
128 c1 = (*mdcTrackCol)[0]->charge(); c2 = (*mdcTrackCol)[1]->charge();
129 r1 = (*mdcTrackCol)[0]->r(); r2 = (*mdcTrackCol)[1]->r();
130 z1 = (*mdcTrackCol)[0]->z(); z2 = (*mdcTrackCol)[1]->z();
131 p1 = (*mdcTrackCol)[0]->p();
p2 = (*mdcTrackCol)[1]->p();
134 bool mdcflag1 = c1 + c2 == 0;
135 bool mdcflag2 = fabs(r1)<=m_vr0cut && fabs(z1)<m_vz0cut;
136 bool mdcflag3 = fabs(r2)<=m_vr0cut && fabs(z2)<m_vz0cut;
137 bool mdcflag4 =
p1<m_pcut_up &&
p2<m_pcut_up;
140 bool mdcflag5 = fabs(
p1-
p2 )/(
p1+
p2 ) < m_psymcut;
142 log << MSG::INFO <<
"r1:\t" << r1 <<
"\tz1:" << z1 << endreq;
143 log << MSG::INFO <<
"r2:\t" << r2 <<
"\tz2:" << z2 << endreq;
144 log << MSG::INFO <<
"p1:\t" <<
p1 <<
"\tp2:" <<
p2 << endreq;
146 double zeroCFlag,vtRZFlag,pLimFlag,pSymFlag;
147 if( mdcflag1 ) { m_cutpass[1] += 1; zeroCFlag = 1; }
148 if( mdcflag2 && mdcflag3 ) { m_cutpass[2] += 1; vtRZFlag = 1; }
149 if( mdcflag4 ) { m_cutpass[3] += 1; pLimFlag = 1; }
150 if( mdcflag5 ) { m_cutpass[4] += 1; pSymFlag = 1; }
152 if( mdcflag1 && mdcflag2 && mdcflag3 && mdcflag4 && mdcflag5 ) { m_mdcPass =
true; m_subpass[0] += 1; }
153 log << MSG::INFO <<
"MDC selection done!" << endreq;
156 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc,
"/Event/Recon/RecTofTrackCol");
158 log << MSG::ERROR <<
"Could not find RecTofTrackCol!" << endreq;
161 log << MSG::INFO <<
"TOF tracks:\t" << tofTrackCol->size() << endreq;
166 if(tofTrackCol->size() > 7 && tofTrackCol->size() < 21)
169 for(
int itof = 0; itof < tofTrackCol->size(); itof++)
172 status->
setStatus((*tofTrackCol)[itof]->status());
174 if( !(status->
is_cluster()) ) {
delete status;
continue; }
175 if(goodtof==0) t1 = (*tofTrackCol)[itof]->tof();
176 if(goodtof==1) t2 = (*tofTrackCol)[itof]->tof();
184 bool tofflag1 = fabs( t1-t2 ) < m_tcut;
185 log << MSG::INFO <<
"t1:\t" << t1 <<
"\tt2:" << t2 <<
"dt:\t" << fabs(t1-t2) << endreq;
186 if( tofflag1 ) { m_cutpass[5] += 1; tLimFlag = 1; m_tofPass =
true; m_subpass[1] += 1; }
187 log << MSG::INFO <<
"TOF selection done!" << endreq;
190 SmartDataPtr<RecEmcShowerCol> emcShowerCol(eventSvc,
"/Event/Recon/RecEmcShowerCol");
192 log << MSG::ERROR <<
"Could not find RecEmcShowerCol!" << endreq;
195 log << MSG::INFO <<
"EMC showers:\t" << emcShowerCol->size() << endreq;
197 if( emcShowerCol->size() < 2 )
return 0;
202 e1 = (*emcShowerCol)[0]->energy();
e2 = (*emcShowerCol)[1]->energy();
203 theta1 = (*emcShowerCol)[0]->theta();
theta2 = (*emcShowerCol)[1]->theta();
204 phi1 = (*emcShowerCol)[0]->phi();
phi2 = (*emcShowerCol)[1]->phi();
205 part = (*emcShowerCol)[0]->module();
209 bool emcFlag3 = fabs(
theta1 +
theta2 - CLHEP::pi) < m_dthetacut;
210 bool emcFlag4 = fabs(
phi1 -
phi2) - CLHEP::pi < m_dphicut;
211 bool emcFlag5 = !m_partselect || (m_partselect==1&&part==1) || (m_partselect==2&&part!=1);
213 log << MSG::INFO <<
"e1:\t" <<
e1 <<
"\te2:\t" <<
e2 << endreq;
214 log << MSG::INFO <<
"theta1:\t" <<
theta1 <<
"\ttheta2:\t" <<
theta2 << endreq;
215 log << MSG::INFO <<
"phi1:\t" <<
phi1 <<
"\tphi2:\t" <<
phi2 << endreq;
216 log << MSG::INFO <<
"part:\t" << part <<
"\tpartFlag:\t" << emcFlag5 << endreq;
218 double eLimFlag,eBBFlag,partFlag;
219 if( emcFlag1 && emcFlag2 ) { m_cutpass[6] += 1; eLimFlag = 1; }
220 if( emcFlag3 && emcFlag4 ) { m_cutpass[7] += 1; eBBFlag = 1; }
221 if( emcFlag5 ) { m_cutpass[8] += 1; partFlag = 1; }
222 if( emcFlag1 && emcFlag2 && emcFlag3 && emcFlag4 && emcFlag5 ) { m_emcPass =
true; m_subpass[2] += 1; }
223 log << MSG::INFO <<
"EMC selection done!" << endreq;
226 SmartDataPtr<MucDigiCol> mucDigiCol(eventSvc,
"/Event/Digi/MucDigiCol");
228 log << MSG::ERROR <<
"Could not find MucDigiCol!" << endreq;
231 SmartDataPtr<RecMucTrackCol> mucTrackCol(eventSvc,
"/Event/Recon/RecMucTrackCol");
233 log << MSG::ERROR <<
"Could not find RecMucTrackCol" << endreq;
237 int mudigiNum, mutrkNum;
238 mudigiNum = mutrkNum = 0;
239 mudigiNum = mucDigiCol->size(); mutrkNum = mucTrackCol->size();
241 bool mucflag1 = mudigiNum >= m_mudigicut;
242 bool mucflag2 = mutrkNum >= m_mutrkcut;
244 log << MSG::INFO <<
"MUC digi:\t" << mudigiNum <<
"\tMUC track:\t" << mutrkNum << endreq;
246 double mudigiFlag,mutrkFlag;
247 if( mucflag1 ) { m_cutpass[9] += 1; mudigiFlag = 1; }
248 if( mucflag2 ) { m_cutpass[10] += 1; mutrkFlag = 1; }
249 if( mucflag1 && mucflag2 ) { m_mucPass =
true; m_subpass[3] += 1; }
250 log << MSG::INFO <<
"MUC selection done!" << endreq;
253 m_c1 = c1; m_c2 = c2; m_r1 = r1; m_r2 = r2; m_z1 = z1; m_z2 = z2; m_p1 =
p1; m_p2 =
p2;
254 m_t1 = t1; m_t2 = t2;
257 m_mudigi = mudigiNum; m_mutrk = mutrkNum;
258 m_zeroCFlag = zeroCFlag; m_vtRZFlag = vtRZFlag; m_pLimFlag = pLimFlag; m_pSymFlag = pSymFlag;
259 m_tLimFlag = tLimFlag; m_eLimFlag = eLimFlag; m_eBBFlag = eBBFlag; m_partFlag = partFlag;
260 m_mudigiFlag = mudigiFlag; m_mutrkFlag = mutrkFlag;
262 m_mdcFlag = m_mdcPass; m_tofFlag = m_tofPass; m_emcFlag = m_emcPass; m_mucFlag = m_mucPass;
264 m_passtuple->write();
268 if( m_mdcPass && m_tofPass && m_emcPass && m_mucPass )
271 if( part==1 )
return 1;