BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
CheckEFResult Class Reference

#include <CheckEFResult.h>

+ Inheritance diagram for CheckEFResult:

Public Member Functions

 CheckEFResult (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~CheckEFResult ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 CheckEFResult (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~CheckEFResult ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Constructor & Destructor Documentation

◆ CheckEFResult() [1/2]

CheckEFResult::CheckEFResult ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 16 of file CheckEFResult.cxx.

16 :
17 Algorithm(name, pSvcLocator),
18 m_notpass()
19{
20 declareProperty("FilterOutput",m_outfile="lv2");
21}

◆ ~CheckEFResult() [1/2]

CheckEFResult::~CheckEFResult ( )
virtual

Definition at line 23 of file CheckEFResult.cxx.

24{
25}

◆ CheckEFResult() [2/2]

CheckEFResult::CheckEFResult ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~CheckEFResult() [2/2]

virtual CheckEFResult::~CheckEFResult ( )
virtual

Member Function Documentation

◆ execute() [1/2]

StatusCode CheckEFResult::execute ( )

Definition at line 106 of file CheckEFResult.cxx.

106 {
107
108 MsgStream log(msgSvc(), name());
109 //log << MSG::INFO << "in execute()" << endreq;
110
111 EFResult* efResult;
112 StatusCode sc = m_HltStoreSvc->get("EFResult", efResult);
113 if ( sc.isFailure() ) {
114 log << MSG::ERROR << " Could not find EFResult" << endreq;
115 return sc;
116 }
117
118 if (efResult->getAnswerIndex() == -1) {
119 log << MSG::ERROR << " Unvalid efResult(AnswerIndex==-1)" << endreq;
120 return StatusCode::FAILURE;
121 }
122
123 std::string answer = efResult->getAnswer();
124 // answer should be "Accepted" or "Rejected" (or "Error")
125 log << MSG::INFO << "this event is " << answer << endreq;
126
127 if (answer == "Accepted") {
128 EFResult* evtType;
129 sc = m_HltStoreSvc->get("EventType", evtType);
130 if ( sc.isFailure() ) {
131 log << MSG::ERROR << " Could not find EventType" << endreq;
132 return sc;
133 }
134 if (evtType->getAnswerIndex() == -1) {
135 log << MSG::ERROR << " Unvalid evtType(AnswerIndex==-1)" << endreq;
136 return StatusCode::FAILURE;
137 }
138 std::string typeStr = evtType->getAnswer();
139 log << MSG::INFO << " ==> it's marked as " << typeStr << endreq;
140
141 // Event Type
142 if(typeStr=="Junk") m_evttype=0;
143 else if(typeStr=="GJunk") m_evttype=1;
144 else if(typeStr=="Beamgas") m_evttype=2;
145 else if(typeStr=="GBeamgas") m_evttype=3;
146 else if(typeStr=="Cosmic") m_evttype=4;
147 else if(typeStr=="GCosmic") m_evttype=5;
148 else if(typeStr=="EBhabha") m_evttype=6;
149 else if(typeStr=="GEBhabha") m_evttype=7;
150 else if(typeStr=="BBhabha") m_evttype=8;
151 else if(typeStr=="GBBhabha") m_evttype=9;
152 else if(typeStr=="Dimuon") m_evttype=10;
153 else if(typeStr=="GDimuon") m_evttype=11;
154 else if(typeStr=="Diphoton") m_evttype=12;
155 else if(typeStr=="GDiphoton") m_evttype=13;
156 else if(typeStr=="Hadron") m_evttype=14;
157 else if(typeStr=="GHadron") m_evttype=15;
158 else if(typeStr=="Twophoton") m_evttype=16;
159 else if(typeStr=="GTwophoton") m_evttype=17;
160 else if(typeStr=="RandomTrg") m_evttype=31;
161 else if(typeStr=="Error") m_evttype=30;
162 else if(typeStr=="Other") m_evttype=29;
163 else m_evttype=-1;
164 }
165 log << MSG::DEBUG << "get event type info: " << m_evttype << endreq;
166 //Event No.
167 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
168 if (!eventHeader) {
169 log << MSG::FATAL << "Could not find Event Header" << endreq;
170 return (StatusCode::FAILURE);
171 }
172 m_nevt= eventHeader->eventNumber();
173 log << MSG::INFO << "EventNo: " << m_nevt <<endl;
174 if(m_evttype==1||m_evttype==3||m_evttype==5) m_notpass.push_back(eventHeader->eventNumber());
175
176 // Run time
177 //m_timer[1]->stop();
178 //m_filtertime = m_timer[1]->elapsed();
179
180 //if(pBesTimer){
181 // pBesTimer->stop();
182 // m_CPUtime = pBesTimer->elapsed();
183 //}
184
185 // Detector information
186 float nmdc,ntof,nemc,nmuc,nshower,ntrk,nsec;
187 float etot,ebar,eend,ebal,acop,emax1,emax2,dtof1,dphi1,dtof2,dphi2,acol,mbal,pmax1,pmax2;
188
189 CriteriaItemValue* pcri;
190
191 sc = m_HltStoreSvc->get("nmdc", pcri);
192 if ( sc.isFailure() ) nmdc=-9;
193 else pcri->getValue(nmdc);
194 sc = m_HltStoreSvc->get("nmuc", pcri);
195 if ( sc.isFailure() ) nmuc=-9;
196 else pcri->getValue(nmuc);
197 sc = m_HltStoreSvc->get("ntof", pcri);
198 if ( sc.isFailure() ) ntof=-9;
199 else pcri->getValue(ntof);
200 sc = m_HltStoreSvc->get("nemc", pcri);
201 if ( sc.isFailure() ) nemc=-9;
202 else pcri->getValue(nemc);
203
204 sc = m_HltStoreSvc->get("nshw", pcri);
205 if ( sc.isFailure() ) nshower=-9;
206 else pcri->getValue(nshower);
207 sc = m_HltStoreSvc->get("ntrk", pcri);
208 if ( sc.isFailure() ) ntrk=-9;
209 else pcri->getValue(ntrk);
210 sc = m_HltStoreSvc->get("etot", pcri);
211 if ( sc.isFailure() ) etot=-9;
212 else pcri->getValue(etot);
213 sc = m_HltStoreSvc->get("ebar", pcri);
214 if ( sc.isFailure() ) ebar=-9;
215 else pcri->getValue(ebar);
216 sc = m_HltStoreSvc->get("eend", pcri);
217 if ( sc.isFailure() ) eend=-9;
218 else pcri->getValue(eend);
219 sc = m_HltStoreSvc->get("ebal", pcri);
220 if ( sc.isFailure() ) ebal=-9;
221 else pcri->getValue(ebal);
222 sc = m_HltStoreSvc->get("acop", pcri);
223 if ( sc.isFailure() ) acop=-9;
224 else pcri->getValue(acop);
225 sc = m_HltStoreSvc->get("emax1", pcri);
226 if ( sc.isFailure() ) emax1=-9;
227 else pcri->getValue(emax1);
228 sc = m_HltStoreSvc->get("emax2", pcri);
229 if ( sc.isFailure() ) emax2=-9;
230 else pcri->getValue(emax2);
231 sc = m_HltStoreSvc->get("dtof1", pcri);
232 if ( sc.isFailure() ) dtof1=-999;
233 else pcri->getValue(dtof1);
234 sc = m_HltStoreSvc->get("dphi1", pcri);
235 if ( sc.isFailure() ) dphi1=-9;
236 else pcri->getValue(dphi1);
237 sc = m_HltStoreSvc->get("dtof2", pcri);
238 if ( sc.isFailure() ) dtof2=-999;
239 else pcri->getValue(dtof2);
240 sc = m_HltStoreSvc->get("dphi2", pcri);
241 if ( sc.isFailure() ) dphi2=-9;
242 else pcri->getValue(dphi2);
243 sc = m_HltStoreSvc->get("acol", pcri);
244 if ( sc.isFailure() ) acol=-9;
245 else pcri->getValue(acol);
246 sc = m_HltStoreSvc->get("pmax1", pcri);
247 if ( sc.isFailure() ) pmax1=-9;
248 else pcri->getValue(pmax1);
249 sc = m_HltStoreSvc->get("pmax2", pcri);
250 if ( sc.isFailure() ) pmax2=-9;
251 else pcri->getValue(pmax2);
252 sc = m_HltStoreSvc->get("nsec", pcri);
253 if ( sc.isFailure() ) nsec=-9;
254 else pcri->getValue(nsec);
255 sc = m_HltStoreSvc->get("mbal", pcri);
256 if ( sc.isFailure() ) mbal=-9;
257 else pcri->getValue(mbal);
258 m_nmdc=long(nmdc);
259 m_ntof=long(ntof);
260 m_nemc=long(nemc);
261 m_nmuc=long(nmuc);
262 m_nshower=long(nshower);
263 m_ntrk=long(ntrk);
264 m_nsec=long(nsec);
265 m_etot=etot;
266 m_ebarrel=ebar;
267 m_eendcap=eend;
268 m_ebalance=ebal;
269 m_acop=acop;
270 m_emax1=emax1;
271 m_emax2=emax2;
272 m_dtof1=dtof1;
273 m_dphi1=dphi1;
274 m_dtof2=dtof2;
275 m_dphi2=dphi2;
276 m_acol=acol;
277 m_mbalance=mbal;
278 m_pmax1=pmax1;
279 m_pmax2=pmax2;
280
281 std::vector<uint32_t> efVec=efResult->getEFVec();
282 m_alg =efVec[0];
283 /*
284 m_nmuc =efVec[1];
285 m_etot =efVec[4];
286 m_emax1=efVec[5];
287 m_emax2=efVec[6];
288 m_acop =efVec[7];
289 m_ebalance=efVec[8];
290 m_ebarrel=efVec[9];
291 m_eendcap=efVec[10];
292 m_ntrk =efVec[11];
293 m_pmax1=efVec[12];
294 m_pmax2=efVec[13];
295 m_acol =efVec[14];
296 m_cost1=efVec[15];
297 m_cost2=efVec[16];
298 m_dtof1 =efVec[19];
299 m_dphi1 =efVec[20];
300 m_dtof2 =efVec[19];
301 m_dphi2 =efVec[20];
302 */
303 log<< MSG::INFO<<efVec<<endreq;
304 log<< MSG::INFO<<acol<<" "<<etot<<endreq;
305 if(m_tuple){
306 StatusCode status = m_tuple->write();
307 if (!status.isSuccess()) {
308 log << MSG::ERROR << "Can't fill ntuple!" << endreq;
309 }
310 }
311
312 //m_timer[1]->start();
313
314 return StatusCode::SUCCESS;
315}
Double_t etot
const std::string getAnswer() const
Definition: EFResult.cxx:166
const int getAnswerIndex() const
Definition: EFResult.cxx:168
const std::vector< uint32_t > getEFVec() const
Definition: EFResult.cxx:51

◆ execute() [2/2]

StatusCode CheckEFResult::execute ( )

◆ finalize() [1/2]

StatusCode CheckEFResult::finalize ( )

Definition at line 317 of file CheckEFResult.cxx.

317 {
318
319 MsgStream log(msgSvc(), name());
320 log << MSG::INFO << "in finalize()" << endreq;
321
322 //m_timersvc->print();
323 if(m_notpass.size()>0&&m_outfile!="lv2"){
324 ofstream outfile;
325 outfile.open(m_outfile.c_str(),ios_base::out);
326 for(unsigned int i=0;i<m_notpass.size();i++){
327 outfile << m_notpass[i] <<endl;
328 }
329 outfile.close();
330 }
331
332 return StatusCode::SUCCESS;
333}

◆ finalize() [2/2]

StatusCode CheckEFResult::finalize ( )

◆ initialize() [1/2]

StatusCode CheckEFResult::initialize ( )

Definition at line 27 of file CheckEFResult.cxx.

27 {
28
29 MsgStream log(msgSvc(), name());
30 log << MSG::INFO << "in initialize()" << endreq;
31
32 StatusCode sc = service( "HltStoreSvc", m_HltStoreSvc);
33 if( sc.isFailure() ) {
34 log << MSG::FATAL << name() << ": Unable to locate Service HltStoreSvc" << endreq;
35 return sc;
36 }
37
38 sc = serviceLocator()->service("EventDataSvc", m_evtDataSvc, true);
39 if (!sc.isSuccess()) {
40 log << MSG::FATAL << "Error retrieving EventDataSvc interface IDataProviderSvc." << endreq;
41 return sc;
42 }
43
44 NTuplePtr nt(ntupleSvc(),"FILE123/EventFilter");
45 if ( nt ) m_tuple = nt;
46 else {
47 m_tuple=ntupleSvc()->book("FILE123/EventFilter",CLID_ColumnWiseTuple,"EventFilter");
48 if( m_tuple ) {
49 m_tuple->addItem ("alg", m_alg);
50 m_tuple->addItem ("nevt", m_nevt);
51
52 m_tuple->addItem ("ntof", m_ntof);
53 m_tuple->addItem ("nemc", m_nemc);
54 m_tuple->addItem ("nmdc", m_nmdc);
55 m_tuple->addItem ("nshw", m_nshower);
56 m_tuple->addItem ("nsec", m_nsec);
57 m_tuple->addItem ("mbal", m_mbalance);
58 m_tuple->addItem ("type", m_evttype);
59 //m_tuple->addItem ("time", m_filtertime);
60 //m_tuple->addItem ("CPUt", m_CPUtime);
61
62 m_tuple->addItem ("nmuc", m_nmuc);
63 m_tuple->addItem ("etot", m_etot);
64 m_tuple->addItem ("emax1", m_emax1);
65 m_tuple->addItem ("emax2", m_emax2);
66 m_tuple->addItem ("acop", m_acop);
67 m_tuple->addItem ("ebal", m_ebalance);
68 m_tuple->addItem ("ebar", m_ebarrel);
69 m_tuple->addItem ("eend", m_eendcap);
70 m_tuple->addItem ("ntrk", m_ntrk);
71 m_tuple->addItem ("pmax1", m_pmax1);
72 m_tuple->addItem ("pmax2", m_pmax2);
73 m_tuple->addItem ("acol", m_acol);
74 m_tuple->addItem ("cost1", m_cost1);
75 m_tuple->addItem ("cost2", m_cost2);
76 m_tuple->addItem ("dtof1", m_dtof1);
77 m_tuple->addItem ("dphi1", m_dphi1);
78 m_tuple->addItem ("dtof2", m_dtof2);
79 m_tuple->addItem ("dphi2", m_dphi2);
80 }
81 else { // did not manage to book the N tuple....
82 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple) << endmsg;
83 return StatusCode::FAILURE;
84 }
85 }
86
87 /*
88 sc = service( "BesTimerSvc", m_timersvc);
89 if( sc.isFailure() ) {
90 log << MSG::WARNING << name() << ": Unable to locate BesTimer Service" << endreq;
91 return StatusCode::FAILURE;
92 }
93
94 m_timer[0] = m_timersvc->addItem("PrueHandler");
95 m_timer[0]->propName("nPrueHandler");
96 pBesTimer=m_timer[0];
97 m_timer[1] = m_timersvc->addItem("WholePro");
98 m_timer[1]->propName("nWholePro");
99 m_timer[1]->start();
100
101 log << MSG::INFO << pBesTimer<<endreq;
102 */
103 return StatusCode::SUCCESS;
104}

◆ initialize() [2/2]

StatusCode CheckEFResult::initialize ( )

The documentation for this class was generated from the following files: