BOSS 8.0.0
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 ()

Detailed Description

Definition at line 18 of file CheckEFResult.h.

Constructor & Destructor Documentation

◆ CheckEFResult()

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

Definition at line 16 of file CheckEFResult.cxx.

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

Referenced by CheckEFResult().

◆ ~CheckEFResult()

CheckEFResult::~CheckEFResult ( )
virtual

Definition at line 21 of file CheckEFResult.cxx.

21{}

Member Function Documentation

◆ execute()

StatusCode CheckEFResult::execute ( )

Definition at line 107 of file CheckEFResult.cxx.

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

◆ finalize()

StatusCode CheckEFResult::finalize ( )

Definition at line 325 of file CheckEFResult.cxx.

325 {
326
327 MsgStream log( msgSvc(), name() );
328 log << MSG::INFO << "in finalize()" << endmsg;
329
330 // m_timersvc->print();
331 if ( m_notpass.size() > 0 && m_outfile != "lv2" )
332 {
333 ofstream outfile;
334 outfile.open( m_outfile.c_str(), ios_base::out );
335 for ( unsigned int i = 0; i < m_notpass.size(); i++ ) { outfile << m_notpass[i] << endl; }
336 outfile.close();
337 }
338
339 return StatusCode::SUCCESS;
340}

◆ initialize()

StatusCode CheckEFResult::initialize ( )

Definition at line 23 of file CheckEFResult.cxx.

23 {
24
25 MsgStream log( msgSvc(), name() );
26 log << MSG::INFO << "in initialize()" << endmsg;
27
28 StatusCode sc = service( "HltStoreSvc", m_HltStoreSvc );
29 if ( sc.isFailure() )
30 {
31 log << MSG::FATAL << name() << ": Unable to locate Service HltStoreSvc" << endmsg;
32 return sc;
33 }
34
35 sc = serviceLocator()->service( "EventDataSvc", m_evtDataSvc, true );
36 if ( !sc.isSuccess() )
37 {
38 log << MSG::FATAL << "Error retrieving EventDataSvc interface IDataProviderSvc." << endmsg;
39 return sc;
40 }
41
42 NTuplePtr nt( ntupleSvc(), "FILE123/EventFilter" );
43 if ( nt ) m_tuple = nt;
44 else
45 {
46 m_tuple = ntupleSvc()->book( "FILE123/EventFilter", CLID_ColumnWiseTuple, "EventFilter" );
47 if ( m_tuple )
48 {
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
82 { // did not manage to book the N tuple....
83 log << MSG::ERROR << "Cannot book N-tuple:" << long( m_tuple ) << endmsg;
84 return StatusCode::FAILURE;
85 }
86 }
87
88 /*
89 sc = service( "BesTimerSvc", m_timersvc);
90 if( sc.isFailure() ) {
91 log << MSG::WARNING << name() << ": Unable to locate BesTimer Service" << endmsg;
92 return StatusCode::FAILURE;
93 }
94
95 m_timer[0] = m_timersvc->addItem("PrueHandler");
96 m_timer[0]->propName("nPrueHandler");
97 pBesTimer=m_timer[0];
98 m_timer[1] = m_timersvc->addItem("WholePro");
99 m_timer[1]->propName("nWholePro");
100 m_timer[1]->start();
101
102 log << MSG::INFO << pBesTimer<<endmsg;
103 */
104 return StatusCode::SUCCESS;
105}
INTupleSvc * ntupleSvc()

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