137{
138 StatusCode sc=StatusCode::SUCCESS;
139 m_event++;
140
141 MsgStream log(
msgSvc(),name());
142 log<<MSG::INFO<<"in execute()"<<endreq;
143 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
146
147 m_run = eventHeader->runNumber();
148 m_rec = eventHeader->eventNumber();
150 int event = m_rec;
151 int time = eventHeader->time();
152 if(m_event > 1 &&
runNo != m_runNo)
return sc;
155
156 if(m_rec%1000==0)cout<<"Run "<<m_run<<" Event "<<m_rec<<endl;
157
158 HepLorentzVector p4psip(0.011*m_ecms, 0.0, 0.005, m_ecms);
159 double psipBeta = (p4psip.vect()).mag()/(p4psip.e());
160
161 m_pass[0]+=1;
162
163 int NCharge = evtRecEvent->totalCharged();
164 if(NCharge != 0)return sc;
165
166 m_pass[1]+=1;
167
168 double Emax1=0.0;
169 double Emax2=0.0;
170 int Imax[2];
171
172 if(((evtRecEvent->totalTracks() - evtRecEvent->totalCharged() )<2) || ((evtRecEvent->totalTracks() - evtRecEvent->totalCharged() )>15)) return sc;
173 m_pass[2]+=1;
174
175 HepLorentzVector p4Gam_1;
176 HepLorentzVector p4Gam_2;
177
178 for(int i=evtRecEvent->totalCharged(); i<evtRecEvent->totalTracks(); i++)
179 {
181 if(!(*itTrk)->isEmcShowerValid()) continue;
183
184 HepLorentzVector p4Gam;
185 double Phi = emcTrk->
phi();
186 double Theta = emcTrk->
theta();
187 double Ener=emcTrk->
energy();
188
189 p4Gam.setPx(Ener *
sin(Theta) *
cos(
Phi));
190 p4Gam.setPy(Ener *
sin(Theta) *
sin(
Phi));
191 p4Gam.setPz(Ener *
cos(Theta));
192 p4Gam.setE(Ener);
193 p4Gam.boost(-0.011, 0 ,-0.005 * 1.0 / 3.686);
194
195 if(Ener>Emax2)
196 {
197 Emax2=Ener;
198 Imax[1]=i;
199 p4Gam_2 = p4Gam;
200 }
201 if(Ener>Emax1)
202 {
203 Emax2=Emax1;
204 p4Gam_2 = p4Gam_1;
205 Imax[1]=Imax[0];
206 Emax1=Ener;
207 p4Gam_1 = p4Gam;
208 Imax[0]=i;
209 }
210 }
211 m_e1_lab = Emax1;
212 m_e2_lab = Emax2;
213 m_e_lab = Emax1 + Emax2;
214 log << MSG::INFO << "Emax1 = " << Emax1 <<"Emax2= "<<Emax2<< endreq;
215 if(Emax1 < m_max1 || Emax2 < m_max2) return sc;
216 m_pass[3]+=1;
217
218
219 double emcphi[2],emctht[2];
220 for(int i = 0;i < 2; i++)
221 {
222 if(i>=evtRecTrkCol->size()) break;
224 if(!(*itTrk)->isEmcShowerValid()) continue;
226 emcphi[i]=emcTrk->
phi();
227 emctht[i]=emcTrk->
theta();
228 }
229 double dltphi_lab = (fabs(emcphi[0] - emcphi[1]) -
pai) * 180.0 /
pai;
230 double dlttheta_lab = (fabs(emctht[0] + emctht[1]) -
pai) * 180.0 /
pai;
231 m_costheta1_lab =
cos(emctht[0]);
232 m_costheta2_lab =
cos(emctht[1]);
233 m_phi1_lab = emcphi[0] * 180.0 /
pai;
234 m_phi2_lab = emcphi[1] * 180.0 /
pai;
235 m_dlttheta_lab = dlttheta_lab;
236 m_dltphi_lab = dltphi_lab;
237
238 if(fabs(m_costheta1_lab) > m_costheta || fabs(m_costheta2_lab) > m_costheta) return sc;
239 m_pass[4]+=1;
240
241
242
243 double px1 = p4Gam_1.px();
244 double py1 = p4Gam_1.py();
245 double pz1 = p4Gam_1.pz();
246 double pxy1 = sqrt(px1 * px1 + py1 * py1);
247 double e1 = p4Gam_1.e();
248
249 double px2 = p4Gam_2.px();
250 double py2 = p4Gam_2.py();
251 double pz2 = p4Gam_2.pz();
252 double pxy2 = sqrt(px2 * px2 + py2 * py2);
253 double e2 = p4Gam_2.e();
254
255
258 if(atan(py1 * 1.0 / px1) > 0){
259 if(px1 > 0)
phi1 = atan(py1 * 1.0 / px1);
260 else phi1 = -(
pai - atan(py1 * 1.0 / px1));
261 }
262 else{
263 if(px1 > 0)
phi1 = atan(py1 * 1.0 / px1);
264 else phi1 =
pai + atan(py1 * 1.0 / px1);
265 }
266
267 if(atan(py2 * 1.0 / px2) > 0){
268 if(px2 > 0)
phi2 = atan(py2 * 1.0 / px2);
269 else phi2 = -(
pai - atan(py2 * 1.0 / px2));
270 }
271 else{
272 if(px2 > 0)
phi2 = atan(py2 * 1.0 / px2);
273 else phi2 =
pai + atan(py2 * 1.0 / px2);
274 }
275
277
280
281 if(pz1 > 0)
theta1 = atan(pxy1 * 1.0 / pz1);
282 else theta1 = (
pai + atan(pxy1 * 1.0 / pz1));
283
284 if(pz2 > 0)
theta2 = atan(pxy2 * 1.0 / pz2);
285 else theta2 = (
pai + atan(pxy2 * 1.0 / pz2));
286
288
289 double xBoost = p4Gam_1.px() + p4Gam_2.px();
290 double yBoost = p4Gam_1.py() + p4Gam_2.py();
291 double zBoost = p4Gam_1.pz() + p4Gam_2.pz();
292 m_xBoost = xBoost;
293 m_yBoost = yBoost;
294 m_zBoost = zBoost;
295
300 m_dlttheta = dlttheta;
305
306
307 if(fabs(m_dltphi) < m_dphi1) Ndata1++;
308 if(fabs(m_dltphi) > m_dphi1 && fabs(m_dltphi) < m_dphi2) Ndata2++;
309
310
311 m_tuple1->write();
312
313
314 return StatusCode::SUCCESS;
315}
double sin(const BesAngle a)
double cos(const BesAngle a)
double Phi(RecMdcKalTrack *trk)
EvtRecTrackCol::iterator EvtRecTrackIterator
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol