129 {
130
131 MsgStream log(
msgSvc(), name());
132 log << MSG::INFO << "in execute()" << endreq;
133
134 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
135
136
137
138
139
140
141 int run=eventHeader->runNumber();
142 int event=eventHeader->eventNumber();
143
144 if(event%1000==0) cout<<" run,event: "<<run<<","<<event<<endl;
145
147 if(!evtRecEvent ) {
148 cout<<" evtRecEvent "<<endl;
149 return StatusCode::FAILURE;
150 }
151
152 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
153 << evtRecEvent->totalCharged() << " , "
154 << evtRecEvent->totalNeutral() << " , "
155 << evtRecEvent->totalTracks() <<endreq;
157 if(!evtRecTrkCol){
158 cout<<" evtRecTrkCol "<<endl;
159 return StatusCode::FAILURE;
160 }
161
162 m_events++;
163 setFilterPassed(false);
164
166 iGood.clear();
167
168 double ene5x5,theta,phi,eseed;
169 double showerX,showerY,showerZ;
170 long int thetaIndex,phiIndex;
171
173 unsigned int npart;
174
177 ipim.clear();
179 ppip.clear();
180 ppim.clear();
181
182 vector<RecEmcShower* > GoodShowers;
183 GoodShowers.clear();
185 for(int i = 0; i< evtRecEvent->totalTracks(); i++) {
186 if(i>=evtRecTrkCol->size()) break;
188 if((*itTrk)->isEmcShowerValid()) {
193 ene5x5=theShower->
e5x5();
196 if (ene5x5>0.4&&ene5x5<4&&npart==1&&(m_BarrelOrEndcap==1)){
197 GoodShowers.push_back(theShower);
198 iGood.push_back((*itTrk)->trackId());
199 }
200 else if (ene5x5>0.4&&ene5x5<4&&(npart==2||npart==0)&&(m_BarrelOrEndcap==2)){
201 GoodShowers.push_back(theShower);
202 iGood.push_back((*itTrk)->trackId());
203 }
204 else if (ene5x5>0.4&&ene5x5<4&&(m_BarrelOrEndcap==0)){
205 GoodShowers.push_back(theShower);
206 iGood.push_back((*itTrk)->trackId());
207 }
208 }
209
210 }
211
212
213
214 double MaxE(0), MaxPhi, MaxThe;
215 int MaxId;
216 double SecE(0), SecPhi, SecThe;
217 for(int i=0; i<GoodShowers.size(); i++) {
219 double eraw = theShower->
energy();
220 if(eraw> MaxE) {
221 MaxId =i;
222 MaxE =eraw;
223 MaxPhi = theShower->
phi();
224 MaxThe = theShower->
theta();
225 }
226 }
227 for(int i=0; i<GoodShowers.size(); i++) {
229 double eraw = theShower->
energy();
230 if(i!=MaxId&&eraw>SecE) {
231 SecE =eraw;
232 SecPhi = theShower->
phi();
233 SecThe = theShower->
theta();
234 }
235 }
236
237 double dphi = (fabs(MaxPhi-SecPhi)-
PI)*180./
PI;
238 double dthe = (fabs(MaxThe+SecThe)-
PI)*180./
PI;
239
240 int total1 = 0;
241 int total2 = 0;
242 if(GoodShowers.size()>=2 && MaxE>1.0 &&
abs(dthe)<3
243 && ((dphi>-25&&dphi<-4)||(dphi>2&&dphi<20)) &&
etot>2.7) {
244
245 double phi1 = MaxPhi<0 ? MaxPhi+CLHEP::twopi : MaxPhi;
246 double phi2 = SecPhi<0 ? SecPhi+CLHEP::twopi : SecPhi;
247
248
251 double phi12=(phi11+phi22-CLHEP::pi)*0.5;
252 double phi21=(phi11+phi22+CLHEP::pi)*0.5;
253 if(phi12<0.) phi12 += CLHEP::twopi;
254 if(phi21>CLHEP::twopi) phi21 -= CLHEP::twopi;
255
256 SmartDataPtr<MdcDigiCol> mdcDigiCol(evtSvc(), "/Event/Digi/MdcDigiCol");
257 if (!mdcDigiCol) {
258 log << MSG::FATAL << "Could not find MdcDigiCol!" << endreq;
259 return StatusCode::FAILURE;
260 }
261 int hitnum = mdcDigiCol->size();
262 for (int i = 0;i< hitnum;i++ ) {
263 MdcDigi* digi=
dynamic_cast<MdcDigi*
>(mdcDigiCol->containedObject(i));
266 if (
time == 0x7FFFFFFF || charge == 0x7FFFFFFF)
continue;
270 if(ilayer>=43)
271 log << MSG::ERROR << "MDC(" << ilayer <<","<<iphi <<")"<<endreq;
272 double phi=CLHEP::twopi*iphi/idmax[ilayer];
275
276
277 }
278
279 if ( (m_BarrelOrEndcap==1&&total1>15 &&total2>15)
280 || (m_BarrelOrEndcap!=1&&total1>5 &&total2>5) ) {
281 setFilterPassed(true);
283 }
284 }
285
286 if(m_output) {
288 m_mdc_hit1=total1;
289 m_mdc_hit2=total2;
290 m_sh1_ene = MaxE;
291 m_sh1_theta = MaxThe;
292 m_sh1_phi = MaxPhi;
293 m_sh2_ene = SecE;
294 m_sh2_theta = SecThe;
295 m_sh2_phi = SecPhi;
296 m_di_phi = dphi;
297 m_di_the = dthe;
298 m_tuple1->write();
299 }
300
301 return StatusCode::SUCCESS;
302
303}
double abs(const EvtComplex &c)
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
bool WhetherSector(double, double=0., double=CLHEP::twopi)
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
void clear()
Reset to invalid state.
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
virtual Identifier identify() const
unsigned int getChargeChannel() const
unsigned int getTimeChannel() const
RecEmcID getShowerId() const
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol