1#include "GaudiKernel/SmartDataPtr.h"
14 Algorithm(name, pSvcLocator) {
17 declareProperty(
"OutputLevel", m_outputLevel = MSG::NIL);
25 MsgStream log(
msgSvc(), name());
26 log << MSG::INFO <<
"in initialize()" << endreq;
29 StatusCode status=StatusCode::SUCCESS;
30 NTuplePtr nt1(
ntupleSvc(),
"FILE1/EventFilter");
31 if ( nt1 ) m_tuple = nt1;
33 m_tuple =
ntupleSvc()->book (
"FILE1/EventFilter", CLID_ColumnWiseTuple,
"EventFilter N-Tuple");
35 status = m_tuple->addItem (
"type", m_type);
36 status = m_tuple->addItem (
"alg", m_alg);
37 status = m_tuple->addItem (
"endEE", m_endEE);
38 status = m_tuple->addItem (
"version", m_version);
39 status = m_tuple->addItem (
"etot", m_etot);
40 status = m_tuple->addItem (
"nMDCdata", m_nmdc0);
41 status = m_tuple->addItem (
"nTOFdata", m_ntof0);
42 status = m_tuple->addItem (
"nEMCdata", m_nemc0);
43 status = m_tuple->addItem (
"nMUCdata", m_nmuc0);
44 status = m_tuple->addItem (
"nCONdata", m_ncon0);
49 status = m_tuple->addItem (
"nCONfill", m_ncon, 0, 100 );
50 status = m_tuple->addIndexedItem (
"MDCdata", m_nmdc, m_mdcData);
51 status = m_tuple->addIndexedItem (
"TOFdata", m_ntof, m_tofData);
52 status = m_tuple->addIndexedItem (
"EMCdata", m_nemc, m_emcData);
53 status = m_tuple->addIndexedItem (
"MUCdata", m_nmuc, m_mucData);
54 status = m_tuple->addIndexedItem (
"CONdata", m_ncon, m_conData);
56 log << MSG::ERROR <<
" Cannot add item into N-tuple" << endreq;
61 log << MSG::ERROR <<
" Cannot book N-tuple:" << long(m_tuple) << endreq;
62 return StatusCode::FAILURE;
66 return StatusCode::SUCCESS;
71 MsgStream log(
msgSvc(), name());
72 log << MSG::INFO <<
"in execute()" << endreq;
76 log << MSG::DEBUG <<
"this event refused by event filter: "
83 log << MSG::DEBUG <<
"this event accepteded by event filter: "
88 SmartDataPtr<HltInf> hlt(eventSvc(),
"/Event/Hlt/HltInf");
91 log << MSG::WARNING <<
"Could not find Event HltInf (try DstHltInf now)" << endreq;
92 SmartDataPtr<DstHltInf> hltDst(eventSvc(),
"/Event/Hlt/DstHltInf");
94 log << MSG::FATAL <<
"Could not find Event DstHltInf too ( please re-generate data)" << endreq;
95 return( StatusCode::FAILURE);
103 uint32_t type = hlt->getEventType();
104 for(
int i=0;i<32;i++) {
105 if((1<<i)&type) m_type=i;
107 m_alg = hlt->getAlgProcess();
108 m_endEE = hlt->getCriteriaTable();
109 m_version = hlt->getVersion();
110 m_etot = hlt->getTotalEnergy();
111 m_nmdc0 = hlt->getNMDC();
112 m_ntof0 = hlt->getNTOF();
113 m_nemc0 = hlt->getNEMC();
114 m_nmuc0 = hlt->getNMUC();
115 m_ncon0 = hlt->getNCON();
122 vector<uint32_t>::iterator it;
124 vector<uint32_t> mdcData= hlt->getDataVec(
HltID::MDC);
125 it = mdcData.begin();
126 for(;it!=mdcData.end();it++,m_nmdc++){
127 if(m_nmdc>1) m_mdcData[m_nmdc]= *((
float*) &(*it));
128 else m_mdcData[m_nmdc]= *it;
131 vector<uint32_t> tofData= hlt->getDataVec(
HltID::TOF);
132 it = tofData.begin();
133 for(;it!=tofData.end();it++,m_ntof++){
134 if(m_ntof>0) m_tofData[m_ntof]= *((
float*) &(*it));
135 else m_tofData[m_ntof]= *it;
138 vector<uint32_t> emcData= hlt->getDataVec(
HltID::EMC);
139 it = emcData.begin();
140 for(;it!=emcData.end();it++,m_nemc++){
141 if(!(m_nemc==0||m_nemc==7||m_nemc==8)) m_emcData[m_nemc]= *((
float*) &(*it));
142 else m_emcData[m_nemc]= *it;
145 vector<uint32_t> mucData= hlt->getDataVec(
HltID::MUC);
146 it = mucData.begin();
147 for(;it!=mucData.end();it++,m_nmuc++){
148 if(m_nmuc>1) m_mucData[m_nmuc]= *((
float*) &(*it));
149 else m_mucData[m_nmuc]= *it;
152 vector<uint32_t> conData= hlt->getDataVec(
HltID::CON);
153 it = conData.begin();
154 for(;it!=conData.end();it++,m_ncon++){
155 m_conData[m_ncon]= *it;
161 return StatusCode::SUCCESS ;
166 MsgStream log(
msgSvc(), name());
167 log << MSG::INFO <<
"in finalize()" << endreq;
171 log << MSG::ALWAYS <<
"=========================================" <<endreq
172 <<
"total "<< ntot <<
" events with " << npass <<
" effective events " <<endreq
173 <<
"========================================="<< endreq;
176 return StatusCode::SUCCESS;
EFTest(const std::string &name, ISvcLocator *pSvcLocator)
static long unsigned getNEvt()
static long unsigned getNPass()
static const std::string & getName()
static unsigned int getID_MUC_MAX()
static unsigned int getID_EMC_MAX()
static unsigned int getID_MDC_MAX()
static unsigned int getID_TOF_MAX()