73 MsgStream log(
msgSvc(), name());
74 log << MSG::INFO <<
"in initialize()" << endmsg;
79 NTuplePtr nt1(
ntupleSvc(),
"FILEBbEmc/bbEmc");
80 if ( nt1 ) m_tuple1 = nt1;
82 m_tuple1 =
ntupleSvc()->book (
"FILEBbEmc/bbEmc", CLID_ColumnWiseTuple,
"BbEmc N-Tuple example");
84 status = m_tuple1->addItem (
"run", m_run);
85 status = m_tuple1->addItem (
"event", m_event);
86 status = m_tuple1->addItem (
"numCtrk", m_num_Ctrk);
87 status = m_tuple1->addItem (
"numNtrk", m_num_Ntrk);
88 status = m_tuple1->addItem (
"numGtrk", m_num_Gtrk);
90 status = m_tuple1->addItem (
"trigindex", m_trig_index, 0, 48);
91 status = m_tuple1->addIndexedItem(
"trigcond", m_trig_index, m_trig_cond);
92 status = m_tuple1->addIndexedItem(
"trigchan", m_trig_index, m_trig_chan);
93 status = m_tuple1->addItem (
"timewindow", m_trig_timewindow);
94 status = m_tuple1->addItem (
"timetype", m_trig_timetype);
95 status = m_tuple1->addItem (
"hlttype", m_hlt_type );
97 status = m_tuple1->addItem (
"estime", m_est_start);
98 status = m_tuple1->addItem (
"status", m_est_status);
99 status = m_tuple1->addItem (
"quality", m_est_quality);
101 status = m_tuple1->addItem (
"dang", m_dang);
102 status = m_tuple1->addItem (
"index", m_index,0,2);
103 status = m_tuple1->addIndexedItem (
"theta", m_index, m_theta);
104 status = m_tuple1->addIndexedItem (
"phi", m_index, m_phi);
105 status = m_tuple1->addIndexedItem (
"ene", m_index, m_ene);
107 log << MSG::ERROR <<
"Cannot book N-tuple theone"<<endmsg;
108 return StatusCode::FAILURE;
112 log << MSG::INFO <<
"end initialize()" << endmsg;
116 return StatusCode::SUCCESS;
123 MsgStream log(
msgSvc(),name());
124 log<<MSG::INFO<<
"in execute()"<<endreq;
128 setFilterPassed(
false);
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;
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;
143 SmartDataPtr<EvtRecTrackCol> evtRecTrkCol(eventSvc(),
"/Event/EvtRec/EvtRecTrackCol");
144 if((evtRecEvent->totalTracks()<2) || (evtRecEvent->totalTracks()>30)){
145 return StatusCode::SUCCESS;
152 SmartDataPtr<HltInf> hlt(eventSvc(),
"/Event/Hlt/HltInf");
155 log << MSG::WARNING <<
"Could not find Event HltInf, try DstHltInf now" << endreq;
156 SmartDataPtr<DstHltInf> hltDst(eventSvc(),
"/Event/Hlt/DstHltInf");
158 log << MSG::ERROR <<
"Could not find Event DstHltInf too, please re-generate data" << endreq;
159 return StatusCode::FAILURE;
168 for(
int i=0; i<32; i++){
169 if(temp_type & mask){
178 SmartDataPtr<TrigData> trigData(eventSvc(),
"/Event/Trig/TrigData");
179 if(m_trigger_flag & runNum>0){
181 log << MSG::FATAL <<
"Could not find TrigData in TDS" << endreq;
182 return StatusCode::FAILURE;
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;
194 SmartDataPtr<RecEsTimeCol> recEstimeCol(eventSvc(),
"/Event/Recon/RecEsTimeCol");
195 if(m_est_flag & runNum>0){
197 log << MSG::WARNING <<
"Can not get RecEsTimeCol" << endreq;
198 return StatusCode::SUCCESS;
200 log << MSG::DEBUG <<
"size of EsTime: " << recEstimeCol->size() << endreq;
205 HepLorentzVector m_lv_ele;
206 for(
int i=0; i<evtRecEvent->totalTracks(); i++){
207 if(i>=evtRecTrkCol->size())
break;
210 if(!(*itTrk)->isEmcShowerValid())
continue;
213 if(emcTrk->
energy()<m_energy_cut)
continue;
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);
222 if(vGood.size() - 2)
return SUCCESS;
226 double dang = vGood[0].vect().angle(vGood[1].vect());
227 if(dang < m_dangCut)
return SUCCESS;
230 if(vGood[0].e() > vGood[1].e()) swap(vGood[0],vGood[1]);
234 double d0,z0,cosTheta,phi,mom;
235 Vint iGood; iGood.clear();
236 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
240 itTrk=evtRecTrkCol->begin() + i;
241 if(!(*itTrk)->isMdcKalTrackValid())
continue;
246 if(!(*itTrk)->isMdcTrackValid())
continue;
251 if(fabs(m_vz) >= m_vz0cut)
continue;
252 if(m_vr >= m_vr0cut)
continue;
260 m_num_Ctrk = evtRecEvent->totalCharged();
261 m_num_Ntrk = evtRecEvent->totalNeutral();
262 m_num_Gtrk = iGood.size();
264 for(
int trig_id=0; trig_id < 48; trig_id++){
265 m_trig_index = trig_id;
267 m_trig_chan[m_trig_index] = trigData->getTrigChannel(m_trig_index);
269 m_trig_cond[m_trig_index] = trigData->getTrigCondition(m_trig_index);
271 m_trig_timewindow = trigData->getTimeWindow();
272 m_trig_timetype = trigData->getTimingType();
275 m_hlt_type = hlt_type;
278 m_est_start = (*(recEstimeCol->begin()))->getTest();
279 m_est_status = (*(recEstimeCol->begin()))->getStat();
280 m_est_quality = (*(recEstimeCol->begin()))->getQuality();
284 for(
int i=0; i<2; 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();
294 setFilterPassed(
true);
296 return StatusCode::SUCCESS;