ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
McEventSelector Class Reference

#include <McEventSelector.h>

Inheritance diagram for McEventSelector:
Collaboration diagram for McEventSelector:

Public Member Functions

virtual StatusCode initialize () override
 
virtual StatusCode stop () override
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface) override
 
virtual StatusCode createContext (Context *&refpCtxt) const override
 
virtual StatusCode last (Context &refContext) const override
 
virtual StatusCode next (Context &refCtxt) const override
 
virtual StatusCode next (Context &refCtxt, int jump) const override
 
virtual StatusCode previous (Context &refCtxt) const override
 
virtual StatusCode previous (Context &refCtxt, int jump) const override
 
virtual StatusCode rewind (Context &refCtxt) const override
 
virtual StatusCode createAddress (const Context &refCtxt, IOpaqueAddress *&) const override
 
virtual StatusCode releaseContext (Context *&refCtxt) const override
 
virtual StatusCode resetCriteria (const std::string &cr, Context &c) const override
 
virtual StatusCode seek (Context &refCtxt, int) const override
 Seek to a given event number. More...
 
virtual int curEvent (const Context &refCtxt) const override
 return the current event number. More...
 
virtual int size (Context &refCtxt) const override
 Return the size of the collection, or -1 if we can't get the size. More...
 
 McEventSelector (const std::string &name, ISvcLocator *svcloc)
 Service Constructor. More...
 
 ~McEventSelector ()
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 
 DeclareInterfaceID (IEvtSelectorSeek, 1, 0)
 

Private Attributes

Gaudi::CheckedProperty< unsigned > m_runNo
 
Gaudi::CheckedProperty< unsigned long long > m_firstEventNo
 
Gaudi::CheckedProperty< unsigned long long > m_eventsPerRun
 
Gaudi::CheckedProperty< unsigned > m_firstLBNo
 
Gaudi::CheckedProperty< unsigned > m_eventsPerLB
 
Gaudi::CheckedProperty< unsigned > m_initTimeStamp
 
Gaudi::Property< unsigned > m_timeStampInterval
 
Gaudi::Property< bool > m_overrideRunNumber
 Flags to indicate override of run/event/time These are always true and are here for consistency with other event selectors which only optionally override these numbers. More...
 
Gaudi::Property< bool > m_overrideEventNumber
 
Gaudi::Property< bool > m_overrideLBNumber
 
Gaudi::Property< bool > m_overrideTimeStamp
 
McContextm_ctx
 

Detailed Description

Definition at line 42 of file McEventSelector.h.

Constructor & Destructor Documentation

◆ McEventSelector()

McEventSelector::McEventSelector ( const std::string &  name,
ISvcLocator *  svcloc 
)

Service Constructor.

Flags to indicate override of run/event/time These are always true and are here for consistency with other event selectors which only optionally override these numbers.

Definition at line 219 of file McEventSelector.cxx.

219  :
220  AthService( name, svcloc),
221  m_ctx(0)
222 {
223 
224  declareProperty( "RunNumber", m_runNo = 0 );
225  declareProperty( "EventsPerRun", m_eventsPerRun = 2000000000 );
226  declareProperty( "FirstEvent", m_firstEventNo = 1 );
227  m_firstEventNo.verifier().setLower( 1 );
228  declareProperty( "FirstLB", m_firstLBNo = 0);
229  declareProperty( "EventsPerLB", m_eventsPerLB = 1000 );
230  declareProperty( "InitialTimeStamp", m_initTimeStamp = 0);
231  declareProperty( "TimeStampInterval", m_timeStampInterval = 0 );
232 
237  declareProperty( "OverrideRunNumber", m_overrideRunNumber = true );
238  declareProperty( "OverrideEventNumber", m_overrideEventNumber = true );
239  declareProperty( "OverrideTimeStamp", m_overrideTimeStamp = true );
240  declareProperty( "OverrideLBNumber", m_overrideLBNumber = true );
241 
242 }

◆ ~McEventSelector()

McEventSelector::~McEventSelector ( )

Definition at line 244 of file McEventSelector.cxx.

244  {
245  // FIXME: who deletes the Context?
246 }

Member Function Documentation

◆ createAddress()

StatusCode McEventSelector::createAddress ( const Context &  refCtxt,
IOpaqueAddress *&  addr 
) const
overridevirtual

Definition at line 392 of file McEventSelector.cxx.

393  {
394 
395  ATH_MSG_DEBUG ("............. createAddress .............");
396 
397  const McContext* ctx = dynamic_cast<const McContext*>( &refCtxt );
398 
399  if (ctx != 0) {
400  addr = new McAddress(EventInfo::classID(), "McEventInfo",
401  ctx->runNumber(), ctx->eventNumber(),
402  ctx->lumiBlock(),ctx->timeStamp());
403  m_ctx = const_cast<McContext*> (ctx);
404  } else {
405  ATH_MSG_ERROR ("casting to a McContext");
406  return StatusCode::FAILURE;
407  }
408 
409  return StatusCode::SUCCESS;
410 
411 }

◆ createContext()

StatusCode McEventSelector::createContext ( Context *&  refpCtxt) const
overridevirtual

Definition at line 249 of file McEventSelector.cxx.

250 {
251  McContext* ctx = new McContext(this,
252  m_runNo.value( ),
253  (uint64_t) m_firstEventNo.value( ),
254  (uint64_t) m_eventsPerRun.value( ),
255  m_firstLBNo.value( ),
256  m_eventsPerLB.value( ),
257  m_initTimeStamp.value( ),
258  m_timeStampInterval.value( )
259  );
260  refpCtxt = ctx;
261 
262  m_ctx = ctx;
263 
264  return StatusCode::SUCCESS;
265 }

◆ curEvent()

int McEventSelector::curEvent ( const Context &  c) const
overridevirtual

return the current event number.

Returns
The current event number.

Implements IEvtSelectorSeek.

Definition at line 444 of file McEventSelector.cxx.

444  {
445 
446  ATH_MSG_DEBUG ("............. curEvent .............");
447 
448 
449  return m_ctx->serialEventNumber();
450 }

◆ DeclareInterfaceID()

IEvtSelectorSeek::DeclareInterfaceID ( IEvtSelectorSeek  ,
,
 
)
inherited

◆ initialize()

StatusCode McEventSelector::initialize ( )
overridevirtual

Definition at line 267 of file McEventSelector.cxx.

267  {
268  ATH_MSG_INFO (" Enter McEventSelector Initialization ");
269  return StatusCode::SUCCESS;
270 }

◆ last()

StatusCode McEventSelector::last ( Context &  refContext) const
overridevirtual

Definition at line 364 of file McEventSelector.cxx.

364  {
365  ATH_MSG_ERROR ("............. Last Event Not Implemented .............");
366  return StatusCode::FAILURE;
367 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Service >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Service >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Service >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ next() [1/2]

StatusCode McEventSelector::next ( Context &  refCtxt) const
overridevirtual

Definition at line 290 of file McEventSelector.cxx.

290  {
291  ATH_MSG_DEBUG ("............. Next Event .............");
292 
293  McContext* ct = dynamic_cast<McContext*>(&ctxt);
294  StatusCode sc(StatusCode::FAILURE);
295 
296  if (ct != 0 ) {
297  ct->next();
298  sc = StatusCode::SUCCESS;
299  } else {
300  ATH_MSG_ERROR ("Could not dcast to McContext");
301  }
302 
303  m_ctx = ct;
304 
305  return sc;
306 
307 }

◆ next() [2/2]

StatusCode McEventSelector::next ( Context &  refCtxt,
int  jump 
) const
overridevirtual

Definition at line 309 of file McEventSelector.cxx.

310 {
311  ATH_MSG_DEBUG ("............. Next (" << jump << ") .............");
312 
313  if ( jump > 0 ) {
314  for ( int i = 0; i < jump; ++i ) {
315  StatusCode status = next(ctxt);
316  if ( !status.isSuccess() ) {
317  return status;
318  }
319  }
320  return StatusCode::SUCCESS;
321  }
322  return StatusCode::FAILURE;
323 }

◆ previous() [1/2]

StatusCode McEventSelector::previous ( Context &  refCtxt) const
overridevirtual

Definition at line 328 of file McEventSelector.cxx.

328  {
329  ATH_MSG_DEBUG ("............. previous .............");
330 
331  McContext* ct = dynamic_cast<McContext*>(&ctxt);
332 
333  StatusCode sc(StatusCode::FAILURE);
334 
335  if (ct != 0 ) {
336  ct->previous();
337  sc = StatusCode::SUCCESS;
338  } else {
339  ATH_MSG_ERROR ("Could not dcast to McContext");
340  }
341 
342  m_ctx = ct;
343 
344  return sc;
345 
346 }

◆ previous() [2/2]

StatusCode McEventSelector::previous ( Context &  refCtxt,
int  jump 
) const
overridevirtual

Definition at line 349 of file McEventSelector.cxx.

350 {
351  if ( jump > 0 ) {
352  for ( int i = 0; i < jump; ++i ) {
353  StatusCode status = previous(ctxt);
354  if ( !status.isSuccess() ) {
355  return status;
356  }
357  }
358  return StatusCode::SUCCESS;
359  }
360  return StatusCode::FAILURE;
361 }

◆ queryInterface()

StatusCode McEventSelector::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
overridevirtual

Definition at line 204 of file McEventSelector.cxx.

205  {
206  if ( riid == IEvtSelector::interfaceID() ) {
207  *ppvIf = (IEvtSelector*)this;
208  addRef();
209  return StatusCode::SUCCESS;
210  } else if (riid == IEvtSelectorSeek::interfaceID() ) {
211  *ppvIf = dynamic_cast<IEvtSelectorSeek*>(this);
212  addRef();
213  return StatusCode::SUCCESS;
214  }
215  return AthService::queryInterface( riid, ppvIf );
216 }

◆ releaseContext()

StatusCode McEventSelector::releaseContext ( Context *&  refCtxt) const
overridevirtual

Definition at line 414 of file McEventSelector.cxx.

414  {
415 
416  // Nothing to do.
417  return StatusCode::SUCCESS;
418 
419 }

◆ resetCriteria()

StatusCode McEventSelector::resetCriteria ( const std::string &  cr,
Context &  c 
) const
overridevirtual

Definition at line 422 of file McEventSelector.cxx.

422  {
423 
424  ATH_MSG_ERROR ("............. resetCriteria Not Implemented .............");
425  return StatusCode::FAILURE;
426 
427 }

◆ rewind()

StatusCode McEventSelector::rewind ( Context &  refCtxt) const
overridevirtual

Definition at line 371 of file McEventSelector.cxx.

372 {
373  ATH_MSG_DEBUG ("............. rewind .............");
374 
375  McContext* ct = dynamic_cast<McContext*>(&ctxt);
376  StatusCode sc(StatusCode::FAILURE);
377 
378  if (ct != 0 ) {
379  ct->rewind();
380  sc = StatusCode::SUCCESS;
381  } else {
382  ATH_MSG_ERROR ("Could not dcast to McContext");
383  }
384 
385  m_ctx = ct;
386  return sc;
387 
388 }

◆ seek()

StatusCode McEventSelector::seek ( Context &  c,
int  evtnum 
) const
overridevirtual

Seek to a given event number.

Parameters
evtnumThe event number to which to seek.

Implements IEvtSelectorSeek.

Definition at line 430 of file McEventSelector.cxx.

430  {
431 
432  ATH_MSG_DEBUG ("............. seek(" << evtNum << ") .............");
433 
434  m_ctx->rewind();
435 
436  for (int i=0; i < evtNum; ++i) {
437  m_ctx->next();
438  }
439 
440  return StatusCode::SUCCESS;
441 }

◆ size()

int McEventSelector::size ( Context &  c) const
overridevirtual

Return the size of the collection, or -1 if we can't get the size.

Implements IEvtSelectorSeek.

Definition at line 453 of file McEventSelector.cxx.

454 {
455  return -1;
456 }

◆ stop()

StatusCode McEventSelector::stop ( )
overridevirtual

Definition at line 272 of file McEventSelector.cxx.

272  {
273  ATH_MSG_DEBUG ("............. stop .............");
274 
275  const bool createIf = true;
276  IIncidentSvc* incSvc = 0;
277  if ( !service("IncidentSvc", incSvc, createIf).isSuccess() || 0 == incSvc ) {
278  ATH_MSG_ERROR ("Could not retrieve IncidentSvc ");
279  return StatusCode::FAILURE;
280  }
281  Incident lastInputIncident(name(), "LastInput");
282  incSvc->fireIncident(lastInputIncident);
283 
284  return StatusCode::SUCCESS;
285 }

Member Data Documentation

◆ m_ctx

McContext* McEventSelector::m_ctx
mutableprivate

Definition at line 93 of file McEventSelector.h.

◆ m_eventsPerLB

Gaudi::CheckedProperty<unsigned> McEventSelector::m_eventsPerLB
private

Definition at line 80 of file McEventSelector.h.

◆ m_eventsPerRun

Gaudi::CheckedProperty<unsigned long long> McEventSelector::m_eventsPerRun
private

Definition at line 78 of file McEventSelector.h.

◆ m_firstEventNo

Gaudi::CheckedProperty<unsigned long long> McEventSelector::m_firstEventNo
private

Definition at line 77 of file McEventSelector.h.

◆ m_firstLBNo

Gaudi::CheckedProperty<unsigned> McEventSelector::m_firstLBNo
private

Definition at line 79 of file McEventSelector.h.

◆ m_initTimeStamp

Gaudi::CheckedProperty<unsigned> McEventSelector::m_initTimeStamp
private

Definition at line 81 of file McEventSelector.h.

◆ m_overrideEventNumber

Gaudi::Property<bool> McEventSelector::m_overrideEventNumber
private

Definition at line 89 of file McEventSelector.h.

◆ m_overrideLBNumber

Gaudi::Property<bool> McEventSelector::m_overrideLBNumber
private

Definition at line 90 of file McEventSelector.h.

◆ m_overrideRunNumber

Gaudi::Property<bool> McEventSelector::m_overrideRunNumber
private

Flags to indicate override of run/event/time These are always true and are here for consistency with other event selectors which only optionally override these numbers.

Definition at line 88 of file McEventSelector.h.

◆ m_overrideTimeStamp

Gaudi::Property<bool> McEventSelector::m_overrideTimeStamp
private

Definition at line 91 of file McEventSelector.h.

◆ m_runNo

Gaudi::CheckedProperty<unsigned> McEventSelector::m_runNo
private

Definition at line 76 of file McEventSelector.h.

◆ m_timeStampInterval

Gaudi::Property<unsigned> McEventSelector::m_timeStampInterval
private

Definition at line 82 of file McEventSelector.h.


The documentation for this class was generated from the following files:
AthService::AthService
AthService()
McEventSelector::m_runNo
Gaudi::CheckedProperty< unsigned > m_runNo
Definition: McEventSelector.h:76
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
McEventSelector::m_eventsPerRun
Gaudi::CheckedProperty< unsigned long long > m_eventsPerRun
Definition: McEventSelector.h:78
McEventSelector::m_overrideLBNumber
Gaudi::Property< bool > m_overrideLBNumber
Definition: McEventSelector.h:90
McEventSelector::m_overrideRunNumber
Gaudi::Property< bool > m_overrideRunNumber
Flags to indicate override of run/event/time These are always true and are here for consistency with ...
Definition: McEventSelector.h:88
McContext::eventNumber
uint64_t eventNumber() const
Definition: McEventSelector.cxx:144
McEventSelector::m_overrideTimeStamp
Gaudi::Property< bool > m_overrideTimeStamp
Definition: McEventSelector.h:91
McEventSelector::m_timeStampInterval
Gaudi::Property< unsigned > m_timeStampInterval
Definition: McEventSelector.h:82
McContext::serialEventNumber
int serialEventNumber() const
Definition: McEventSelector.cxx:147
McEventSelector::m_overrideEventNumber
Gaudi::Property< bool > m_overrideEventNumber
Definition: McEventSelector.h:89
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EventInfo::classID
static const CLID & classID()
Definition: EventInfo/EventInfo/EventInfo.h:302
McEventSelector::next
virtual StatusCode next(Context &refCtxt) const override
Definition: McEventSelector.cxx:290
McAddress
Definition: McAddress.h:27
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
McEventSelector::previous
virtual StatusCode previous(Context &refCtxt) const override
Definition: McEventSelector.cxx:328
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
McContext::runNumber
unsigned int runNumber() const
Definition: McEventSelector.cxx:143
McContext::timeStamp
unsigned int timeStamp() const
Definition: McEventSelector.cxx:146
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
McEventSelector::m_initTimeStamp
Gaudi::CheckedProperty< unsigned > m_initTimeStamp
Definition: McEventSelector.h:81
calibdata.ct
ct
Definition: calibdata.py:418
McContext::rewind
void rewind()
Definition: McEventSelector.cxx:82
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
McEventSelector::m_eventsPerLB
Gaudi::CheckedProperty< unsigned > m_eventsPerLB
Definition: McEventSelector.h:80
McContext::lumiBlock
unsigned int lumiBlock() const
Definition: McEventSelector.cxx:145
McEventSelector::m_firstEventNo
Gaudi::CheckedProperty< unsigned long long > m_firstEventNo
Definition: McEventSelector.h:77
McContext::next
void next()
Definition: McEventSelector.cxx:101
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
merge.status
status
Definition: merge.py:17
McContext
Definition: McEventSelector.cxx:38
McEventSelector::m_ctx
McContext * m_ctx
Definition: McEventSelector.h:93
IEvtSelectorSeek
Abstract interface for seeking for an event selector.
Definition: IEvtSelectorSeek.h:28
McEventSelector::m_firstLBNo
Gaudi::CheckedProperty< unsigned > m_firstLBNo
Definition: McEventSelector.h:79