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