122 {
123
124 MsgStream log(
msgSvc(),name());
125 log<<MSG::INFO<<"in execute()"<<endreq;
126 m_cout_all++;
127
128
129 setFilterPassed(false);
130
131 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
132 int runNum= eventHeader->runNumber();
133 int eventNum= eventHeader->eventNumber();
134 if(m_cout_all %1000 ==0) {
135 std::cout<<name()<<"::"<< m_cout_all <<" events executed"<<std::endl;
136 }
137
138 SmartDataPtr<EvtRecEvent> evtRecEvent(eventSvc(), "/Event/EvtRec/EvtRecEvent");
139 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
140 << evtRecEvent->totalCharged() << " , "
141 << evtRecEvent->totalNeutral() << " , "
142 << evtRecEvent->totalTracks() <<endreq;
143
144 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(),"/Event/EvtRec/EvtRecTrackCol");
145 if((evtRecEvent->totalTracks()<2) || (evtRecEvent->totalTracks()>30)){
146 return StatusCode::SUCCESS;
147 }
149
150
151 int hlt_type=0;
152 if(m_hlt_flag){
153 SmartDataPtr<HltInf> hlt(eventSvc(),"/Event/Hlt/HltInf");
155 if(!hlt) {
156 log << MSG::WARNING << "Could not find Event HltInf, try DstHltInf now" << endreq;
157 SmartDataPtr<DstHltInf> hltDst(eventSvc(),"/Event/Hlt/DstHltInf");
158 if(!hltDst){
159 log << MSG::ERROR << "Could not find Event DstHltInf too, please re-generate data" << endreq;
160 return StatusCode::FAILURE;
161 } else {
162 aHlt=hltDst;
163 }
164 } else {
165 aHlt=hlt;
166 }
168 int mask(1);
169 for(int i=0; i<32; i++){
170 if(temp_type & mask){
171 hlt_type = i;
172 break;
173 }
174 temp_type >>= 1;
175 }
176 }
177
178
179 SmartDataPtr<TrigData> trigData(eventSvc(),"/Event/Trig/TrigData");
180 if(m_trigger_flag & runNum>0){
181 if (!trigData) {
182 log << MSG::FATAL << "Could not find TrigData in TDS" << endreq;
183 return StatusCode::FAILURE;
184 }
185
186 log << MSG::DEBUG << "Trigger conditions: " << endreq;
187 for(int trig_id=0; trig_id < 48; trig_id++){
188 log << MSG::DEBUG << "i:" << trig_id
189 << " name:" << trigData->getTrigCondName(trig_id)
190 << " cond:" << trigData->getTrigCondition(trig_id) << endreq;
191 }
192 }
193
194
195 SmartDataPtr<RecEsTimeCol> recEstimeCol(eventSvc(), "/Event/Recon/RecEsTimeCol");
196 if(m_est_flag & runNum>0){
197 if(!recEstimeCol){
198 log << MSG::WARNING << "Can not get RecEsTimeCol" << endreq;
199 return StatusCode::SUCCESS;
200 }
201 log << MSG::DEBUG <<"size of EsTime: " << recEstimeCol->size() << endreq;
202 }
203
204
206 HepLorentzVector m_lv_ele;
207 for(int i=0; i<evtRecEvent->totalTracks(); i++){
208 if(i>=evtRecTrkCol->size()) break;
209
211 if(!(*itTrk)->isEmcShowerValid()) continue;
212
214 if(emcTrk->
energy()<m_energy_cut)
continue;
215
216 Hep3Vector emcpos(emcTrk->
x(), emcTrk->
y(), emcTrk->
z());
217 m_lv_ele.setVect(emcpos);
218 m_lv_ele.setE(emcTrk->
energy());
219 vGood.push_back(m_lv_ele);
220 }
221
222
223 if(vGood.size() - 2) return SUCCESS;
225
226
227 double dang = vGood[0].vect().angle(vGood[1].vect());
228 if(dang < m_dangCut) return SUCCESS;
230
231 if(vGood[0].e() > vGood[1].e()) swap(vGood[0],vGood[1]);
232
233
234
235 double d0,z0,cosTheta,phi,mom;
236 Vint iGood; iGood.clear();
237 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
238 double m_vz,m_vr;
240 if (m_kalTrk_flag){
241 itTrk=evtRecTrkCol->begin() + i;
242 if(!(*itTrk)->isMdcKalTrackValid()) continue;
246 }else{
247 if(!(*itTrk)->isMdcTrackValid()) continue;
251 }
252 if(fabs(m_vz) >= m_vz0cut) continue;
253 if(m_vr >= m_vr0cut) continue;
254 iGood.push_back(i);
255 }
256
257 if (m_hist){
258 m_run = runNum;
259 m_event = eventNum;
260
261 m_num_Ctrk = evtRecEvent->totalCharged();
262 m_num_Ntrk = evtRecEvent->totalNeutral();
263 m_num_Gtrk = iGood.size();
264 if (trigData){
265 for(int trig_id=0; trig_id < 48; trig_id++){
266 m_trig_index = trig_id;
267 if(m_trig_index<16){
268 m_trig_chan[m_trig_index] = trigData->getTrigChannel(m_trig_index);
269 }
270 m_trig_cond[m_trig_index] = trigData->getTrigCondition(m_trig_index);
271 }
272 m_trig_timewindow = trigData->getTimeWindow();
273 m_trig_timetype = trigData->getTimingType();
274 }
275
276 m_hlt_type = hlt_type;
277
278 if (recEstimeCol){
279 m_est_start = (*(recEstimeCol->begin()))->getTest();
280 m_est_status = (*(recEstimeCol->begin()))->getStat();
281 m_est_quality = (*(recEstimeCol->begin()))->getQuality();
282 }
283
284 m_dang = dang;
285 for(int i=0; i<2; i++){
286 m_index = i;
287 m_theta[m_index] = vGood[m_index].vect().theta();
288 m_phi[m_index] = vGood[m_index].vect().phi();
289 m_ene[m_index] = vGood[m_index].e();
290 }
291
292 m_tuple1->write();
293 }
294
295 setFilterPassed(true);
296
297 return StatusCode::SUCCESS;
298}
static long m_cout_good(0)
static long m_cout_tracks(0)
static long m_cout_dang(0)
EvtRecTrackCol::iterator EvtRecTrackIterator
std::vector< HepLorentzVector > Vp4
uint32_t getEventType() const