166 {
167 MsgStream log(
msgSvc(), name());
168 log << MSG::INFO << "in execute()" << endreq;
170 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
171 runNo=eventHeader->runNumber();
172 int event=eventHeader->eventNumber();
173 log<<MSG::INFO<<"run,evtnum="<<runNo<<","<<event<<endreq;
174 m_run = eventHeader->runNumber();
175 m_rec = eventHeader->eventNumber();
176
177 if(flag == true)
178 {
179 flag = false;
180 log << MSG::DEBUG << "setting parameter" << endreq;
181
182 m_BeamEnergySvc->getBeamEnergyInfo();
183 if ( ! m_BeamEnergySvc->isRunValid() ) return StatusCode::FAILURE;
184 E_cms = 2*m_BeamEnergySvc->getbeamE();
185 log << MSG::DEBUG << "cms energy is " << E_cms << endreq;
186
187 Parameter *func = new Parameter();
189
195 }
196
198 log<<MSG::INFO<<"ncharg,nneu,tottks="
199 <<evtRecEvent->totalCharged()<<","
200 <<evtRecEvent->totalNeutral()<<","
201 <<evtRecEvent->totalTracks()<<endreq;
203 std::vector<int> iGam;
204 iGam.clear();
206 for(int i=evtRecEvent->totalCharged();i< evtRecEvent->totalTracks();i++){
208 if(!(*itTrk)->isEmcShowerValid()) continue;
209 RecEmcShower *emcTrk = (*itTrk)->emcShower();
210 if(emcTrk->
energy()<0.6)
continue;
211 if(fabs(
cos(emcTrk->
theta()))>0.83)
continue;
212 iGam.push_back((*itTrk)->trackId());
213 }
214 if(iGam.size()<2)return StatusCode::SUCCESS;
216 double energy1=0.5;
217 double energy2=0.5;
218 int gam1=-9999;
219 int gam2=-9999;
220 for(int i=0;i<iGam.size();i++){
222 RecEmcShower *emcTrk = (*itTrk)->emcShower();
223
224 if(emcTrk->
energy()>energy1){
225 energy2=energy1;
226 gam2=gam1;
228 gam1=iGam[i];
229 }
230 else if(emcTrk->
energy()>energy2){
232 gam2=iGam[i];
233 }
234 }
235 if(gam1==-9999 || gam2==-9999)return StatusCode::SUCCESS;
237 m_tot=energy1+energy2;
238 RecEmcShower* maxEmc=(*(evtRecTrkCol->begin()+gam1))->emcShower();
239 RecEmcShower* minEmc=(*(evtRecTrkCol->begin()+gam2))->emcShower();
242 m_maxTheta=maxEmc->
theta();
243 m_minTheta=minEmc->
theta();
244 m_maxPhi=maxEmc->
phi();
245 m_minPhi=minEmc->
phi();
246 m_delPhi=(fabs(m_maxPhi-m_minPhi)-
pai)*180./
pai;
247 m_delTheta=(fabs(m_maxTheta+m_minTheta)-
pai)*180./
pai;
248
250 max.setPx(m_maxE*
sin(m_maxTheta)*
cos(m_maxPhi));
251 max.setPy(m_maxE*
sin(m_maxTheta)*
sin(m_maxPhi));
252 max.setPz(m_maxE*
cos(m_maxTheta));
254 min.setPx(m_minE*
sin(m_minTheta)*
cos(m_minPhi));
255 min.setPy(m_minE*
sin(m_minTheta)*
sin(m_minPhi));
256 min.setPz(m_minE*
cos(m_minTheta));
260 m_IM=
max.invariantMass(
min);
261
262 if(m_minE>=boostMinEmin && m_delPhi>dPhiMin && m_delPhi<dPhiMax && m_minE<=boostMinEmax)tot++;
263 if(m_minE>=boostMinEmin && m_delPhi>dPhiMinSig && m_delPhi<dPhiMaxSig && m_minE<=boostMinEmax)signal++;
264
265
266
267 HepLorentzVector boost1=
max.boost(-0.011,0,0);
268 HepLorentzVector boost2=
min.boost(-0.011,0,0);
269 m_boostAngle=boost1.angle(boost2.vect())*180./
pai;
270 m_boostMaxE=boost1.e();
271 m_boostMinE=boost2.e();
272 m_boostDelPhi=(fabs(boost1.phi()-boost2.phi())-
pai)*180./
pai;
273 m_boostDelTheta=(fabs(boost1.theta()+boost2.theta())-
pai)*180./
pai;
274 m_boostM=(boost1+boost2).m();
275 m_boostIM=boost1.invariantMass(boost2);
276 log << MSG::INFO << "num Good Photon " << iGam.size()<<endreq;
277 if(m_boostMinE>=boostMinEmin && m_boostMinE<=boostMinEmax && fabs(m_boostDelPhi)<=boostPhimin)boost_signal++;
278 if(m_boostMinE>=boostMinEmin && m_boostMinE<=boostMinEmax && fabs(m_boostDelPhi)<=boostPhimax)boost_tot++;
279
280 if (eventHeader->runNumber()<0)
281 {
282 SmartDataPtr<Event::McParticleCol> mcParticleCol(eventSvc(), "/Event/MC/McParticleCol");
283 int m_numParticle = 0;
284 if (!mcParticleCol)
285 {
286
287 return StatusCode::FAILURE;
288 }
289 else
290 {
291 bool jpsipDecay = false;
292 int rootIndex = -1;
293 Event::McParticleCol::iterator iter_mc = mcParticleCol->begin();
294 for (; iter_mc != mcParticleCol->end(); iter_mc++)
295 {
296 if ((*iter_mc)->primaryParticle()) continue;
297 if (!(*iter_mc)->decayFromGenerator()) continue;
298
299 if ((*iter_mc)->particleProperty()==443)
300 {
301 jpsipDecay = true;
302 rootIndex = (*iter_mc)->trackIndex();
303 }
304 if (!jpsipDecay) continue;
305 int mcidx = ((*iter_mc)->mother()).trackIndex() - rootIndex;
306 int pdgid = (*iter_mc)->particleProperty();
307 m_pdgid[m_numParticle] = pdgid;
308 m_motheridx[m_numParticle] = mcidx;
309 m_numParticle += 1;
310 }
311 }
312 m_idxmc = m_numParticle;
313 }
315 m_tuple2->write();
316 return StatusCode::SUCCESS;
317}
double sin(const BesAngle a)
double cos(const BesAngle a)
EvtRecTrackCol::iterator EvtRecTrackIterator
void parameters(double E_cms)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol