136 {
137
138 setFilterPassed(false);
139
140 MsgStream log(
msgSvc(), name());
141 log << MSG::INFO << "in execute()" << endreq;
142
143 m_events++;
144
145 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
146 if(!eventHeader)
147 {
148 cout<<" eventHeader "<<endl;
149 return StatusCode::FAILURE;
150 }
151
152 int run=eventHeader->runNumber();
153 int event=eventHeader->eventNumber();
154 if(event%1000==0) cout<<" run,event: "<<run<<","<<event<<endl;
155
157 if(!evtRecEvent ) {
158 cout<<" evtRecEvent "<<endl;
159 return StatusCode::FAILURE;
160 }
161
162 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
163 << evtRecEvent->totalCharged() << " , "
164 << evtRecEvent->totalNeutral() << " , "
165 << evtRecEvent->totalTracks() <<endreq;
167 if(!evtRecTrkCol){
168 cout<<" evtRecTrkCol "<<endl;
169 return StatusCode::FAILURE;
170 }
171
173 iGood.clear();
174
175 double ene5x5,theta,phi,eseed;
176 double showerX,showerY,showerZ;
177 long int thetaIndex,phiIndex;
178
180 unsigned int npart;
181
184 ipim.clear();
186 ppip.clear();
187 ppim.clear();
188
189 vector<RecEmcShower* > GoodShowers;
190 GoodShowers.clear();
192 for(int i = 0; i< evtRecEvent->totalTracks(); i++) {
193 if(i>=evtRecTrkCol->size()) break;
195 if((*itTrk)->isEmcShowerValid()) {
200 ene5x5=theShower->
e5x5();
203 if (ene5x5>0.4&&ene5x5<4&&npart==1&&(m_BarrelOrEndcap==1)){
204 GoodShowers.push_back(theShower);
205 iGood.push_back((*itTrk)->trackId());
206 }
207 else if (ene5x5>0.4&&ene5x5<4&&(npart==2||npart==0)&&(m_BarrelOrEndcap==2)){
208 GoodShowers.push_back(theShower);
209 iGood.push_back((*itTrk)->trackId());
210 }
211 else if (ene5x5>0.4&&ene5x5<4&&(m_BarrelOrEndcap==0)){
212 GoodShowers.push_back(theShower);
213 iGood.push_back((*itTrk)->trackId());
214 }
215 }
216
217 }
218
219
220
221 double MaxE(0), MaxPhi, MaxThe;
222 int MaxId;
223 double SecE(0), SecPhi, SecThe;
224 for(int i=0; i<GoodShowers.size(); i++) {
226 double eraw = theShower->
energy();
227 if(eraw> MaxE) {
228 MaxId =i;
229 MaxE =eraw;
230 MaxPhi = theShower->
phi();
231 MaxThe = theShower->
theta();
232 }
233 }
234 for(int i=0; i<GoodShowers.size(); i++) {
236 double eraw = theShower->
energy();
237 if(i!=MaxId&&eraw>SecE) {
238 SecE =eraw;
239 SecPhi = theShower->
phi();
240 SecThe = theShower->
theta();
241 }
242 }
243
244 double dphi = (fabs(MaxPhi-SecPhi)-
PI)*180./
PI;
245 double dthe = (fabs(MaxThe+SecThe)-
PI)*180./
PI;
246 if(GoodShowers.size()>=2&&SecE>1.0&&dphi>-4&&dphi<2&&abs(dthe)<3&&
etot>2.7) {
247 setFilterPassed(true);
249 }
250
251 if(m_output) {
253 m_sh1_ene = MaxE;
254 m_sh1_theta = MaxThe;
255 m_sh1_phi = MaxPhi;
256 m_sh2_ene = SecE;
257 m_sh2_theta = SecThe;
258 m_sh2_phi = SecPhi;
259 m_di_phi = dphi;
260 m_di_the = dthe;
261 m_tuple1->write();
262 }
263
264 return StatusCode::SUCCESS;
265
266}
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
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.
RecEmcID getShowerId() const
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol