152 {
153 MsgStream log(
msgSvc(), name());
154 log << MSG::INFO << "in execute()" << endreq;
156 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
157 runNo=eventHeader->runNumber();
158 int event=eventHeader->eventNumber();
159 log<<MSG::INFO<<"run,evtnum="<<runNo<<","<<event<<endreq;
160 m_run = eventHeader->runNumber();
161 m_rec = eventHeader->eventNumber();
162
164 log<<MSG::INFO<<"ncharg,nneu,tottks="
165 <<evtRecEvent->totalCharged()<<","
166 <<evtRecEvent->totalNeutral()<<","
167 <<evtRecEvent->totalTracks()<<endreq;
169 std::vector<int> iGam;
170 iGam.clear();
172 for(int i=evtRecEvent->totalCharged();i< evtRecEvent->totalTracks();i++){
174 if(!(*itTrk)->isEmcShowerValid()) continue;
176 if(emcTrk->
energy()<0.6)
continue;
177 if(fabs(
cos(emcTrk->
theta()))>0.83)
continue;
178 iGam.push_back((*itTrk)->trackId());
179 }
180 if(iGam.size()<2)return StatusCode::SUCCESS;
182 double energy1=0.5;
183 double energy2=0.5;
184 int gam1=-9999;
185 int gam2=-9999;
186 for(int i=0;i<iGam.size();i++){
189
190 if(emcTrk->
energy()>energy1){
191 energy2=energy1;
192 gam2=gam1;
194 gam1=iGam[i];
195 }
196 else if(emcTrk->
energy()>energy2){
198 gam2=iGam[i];
199 }
200 }
201 if(gam1==-9999 || gam2==-9999)return StatusCode::SUCCESS;
203 m_tot=energy1+energy2;
204 RecEmcShower* maxEmc=(*(evtRecTrkCol->begin()+gam1))->emcShower();
205 RecEmcShower* minEmc=(*(evtRecTrkCol->begin()+gam2))->emcShower();
208 m_maxTheta=maxEmc->
theta();
209 m_minTheta=minEmc->
theta();
210 m_maxPhi=maxEmc->
phi();
211 m_minPhi=minEmc->
phi();
212 m_delPhi=(fabs(m_maxPhi-m_minPhi)-
pai)*180./
pai;
213 m_delTheta=(fabs(m_maxTheta+m_minTheta)-
pai)*180./
pai;
214
215 HepLorentzVector max,min;
216 max.setPx(m_maxE*
sin(m_maxTheta)*
cos(m_maxPhi));
217 max.setPy(m_maxE*
sin(m_maxTheta)*
sin(m_maxPhi));
218 max.setPz(m_maxE*
cos(m_maxTheta));
219 max.setE(m_maxE);
220 min.setPx(m_minE*
sin(m_minTheta)*
cos(m_minPhi));
221 min.setPy(m_minE*
sin(m_minTheta)*
sin(m_minPhi));
222 min.setPz(m_minE*
cos(m_minTheta));
223 min.setE(m_minE);
224 m_angle=max.angle(min.vect())*180./
pai;
225 m_m=(max+min).m();
226 m_IM=max.invariantMass(min);
227
228 if(m_minE>=boostMinEmin && m_delPhi>dPhiMin && m_delPhi<dPhiMax && m_minE<=boostMinEmax)tot++;
229 if(m_minE>=boostMinEmin && m_delPhi>dPhiMinSig && m_delPhi<dPhiMaxSig && m_minE<=boostMinEmax)signal++;
230
231
232
233 HepLorentzVector boost1=max.boost(-0.011,0,0);
234 HepLorentzVector boost2=min.boost(-0.011,0,0);
235 m_boostAngle=boost1.angle(boost2.vect())*180./
pai;
236 m_boostMaxE=boost1.e();
237 m_boostMinE=boost2.e();
238 m_boostDelPhi=(fabs(boost1.phi()-boost2.phi())-
pai)*180./
pai;
239 m_boostDelTheta=(fabs(boost1.theta()+boost2.theta())-
pai)*180./
pai;
240 m_boostM=(boost1+boost2).m();
241 m_boostIM=boost1.invariantMass(boost2);
242 log << MSG::INFO << "num Good Photon " << iGam.size()<<endreq;
243 if(m_boostMinE>=boostMinEmin && m_boostMinE<=boostMinEmax && fabs(m_boostDelPhi)<=boostPhimin)boost_signal++;
244 if(m_boostMinE>=boostMinEmin && m_boostMinE<=boostMinEmax && fabs(m_boostDelPhi)<=boostPhimax)boost_tot++;
245
246 if (eventHeader->runNumber()<0)
247 {
248 SmartDataPtr<Event::McParticleCol> mcParticleCol(eventSvc(), "/Event/MC/McParticleCol");
249 int m_numParticle = 0;
250 if (!mcParticleCol)
251 {
252
253 return StatusCode::FAILURE;
254 }
255 else
256 {
257 bool jpsipDecay = false;
258 int rootIndex = -1;
259 Event::McParticleCol::iterator iter_mc = mcParticleCol->begin();
260 for (; iter_mc != mcParticleCol->end(); iter_mc++)
261 {
262 if ((*iter_mc)->primaryParticle()) continue;
263 if (!(*iter_mc)->decayFromGenerator()) continue;
264
265 if ((*iter_mc)->particleProperty()==443)
266 {
267 jpsipDecay = true;
268 rootIndex = (*iter_mc)->trackIndex();
269 }
270 if (!jpsipDecay) continue;
271 int mcidx = ((*iter_mc)->mother()).trackIndex() - rootIndex;
272 int pdgid = (*iter_mc)->particleProperty();
273 m_pdgid[m_numParticle] = pdgid;
274 m_motheridx[m_numParticle] = mcidx;
275 m_numParticle += 1;
276 }
277 }
278 m_idxmc = m_numParticle;
279 }
281 m_tuple2->write();
282 return StatusCode::SUCCESS;
283}
EvtRecTrackCol::iterator EvtRecTrackIterator
double sin(const BesAngle a)
double cos(const BesAngle a)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol