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