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 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
 
virtual int curEvent (const Context &refCtxt) const override
 
virtual int size (Context &refCtxt) const override
 
 McEventSelector (const std::string &name, ISvcLocator *svcloc)
 Service Constructor. More...
 
 ~McEventSelector ()
 

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 203 of file McEventSelector.cxx.

203  :
204  base_class( name, svcloc),
205  m_ctx(0)
206 {
207 
208  declareProperty( "RunNumber", m_runNo = 0 );
209  declareProperty( "EventsPerRun", m_eventsPerRun = 2000000000 );
210  declareProperty( "FirstEvent", m_firstEventNo = 1 );
211  m_firstEventNo.verifier().setLower( 1 );
212  declareProperty( "FirstLB", m_firstLBNo = 0);
213  declareProperty( "EventsPerLB", m_eventsPerLB = 1000 );
214  declareProperty( "InitialTimeStamp", m_initTimeStamp = 0);
215  declareProperty( "TimeStampInterval", m_timeStampInterval = 0 );
216 
221  declareProperty( "OverrideRunNumber", m_overrideRunNumber = true );
222  declareProperty( "OverrideEventNumber", m_overrideEventNumber = true );
223  declareProperty( "OverrideTimeStamp", m_overrideTimeStamp = true );
224  declareProperty( "OverrideLBNumber", m_overrideLBNumber = true );
225 
226 }

◆ ~McEventSelector()

McEventSelector::~McEventSelector ( )

Definition at line 228 of file McEventSelector.cxx.

228  {
229  // FIXME: who deletes the Context?
230 }

Member Function Documentation

◆ createAddress()

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

Definition at line 373 of file McEventSelector.cxx.

374  {
375 
376  ATH_MSG_DEBUG ("............. createAddress .............");
377 
378  const McContext* ctx = dynamic_cast<const McContext*>( &refCtxt );
379 
380  if (ctx != 0) {
381  addr = new McAddress(EventInfo::classID(), "McEventInfo",
382  ctx->runNumber(), ctx->eventNumber(),
383  ctx->lumiBlock(),ctx->timeStamp());
384  m_ctx = const_cast<McContext*> (ctx);
385  } else {
386  ATH_MSG_ERROR ("casting to a McContext");
387  return StatusCode::FAILURE;
388  }
389 
390  return StatusCode::SUCCESS;
391 
392 }

◆ createContext()

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

Definition at line 233 of file McEventSelector.cxx.

234 {
235  McContext* ctx = new McContext(this,
236  m_runNo.value( ),
237  (uint64_t) m_firstEventNo.value( ),
238  (uint64_t) m_eventsPerRun.value( ),
239  m_firstLBNo.value( ),
240  m_eventsPerLB.value( ),
241  m_initTimeStamp.value( ),
242  m_timeStampInterval.value( )
243  );
244  refpCtxt = ctx;
245 
246  m_ctx = ctx;
247 
248  return StatusCode::SUCCESS;
249 }

◆ curEvent()

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

Definition at line 425 of file McEventSelector.cxx.

425  {
426 
427  ATH_MSG_DEBUG ("............. curEvent .............");
428 
429 
430  return m_ctx->serialEventNumber();
431 }

◆ initialize()

StatusCode McEventSelector::initialize ( )
overridevirtual

Definition at line 251 of file McEventSelector.cxx.

251  {
252  ATH_MSG_INFO (" Enter McEventSelector Initialization ");
253  return StatusCode::SUCCESS;
254 }

◆ last()

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

Definition at line 345 of file McEventSelector.cxx.

345  {
346  ATH_MSG_ERROR ("............. Last Event Not Implemented .............");
347  return StatusCode::FAILURE;
348 }

◆ next() [1/2]

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

Definition at line 271 of file McEventSelector.cxx.

271  {
272  ATH_MSG_DEBUG ("............. Next Event .............");
273 
274  McContext* ct = dynamic_cast<McContext*>(&ctxt);
275  StatusCode sc(StatusCode::FAILURE);
276 
277  if (ct != 0 ) {
278  ct->next();
279  sc = StatusCode::SUCCESS;
280  } else {
281  ATH_MSG_ERROR ("Could not dcast to McContext");
282  }
283 
284  m_ctx = ct;
285 
286  return sc;
287 
288 }

◆ next() [2/2]

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

Definition at line 290 of file McEventSelector.cxx.

291 {
292  ATH_MSG_DEBUG ("............. Next (" << jump << ") .............");
293 
294  if ( jump > 0 ) {
295  for ( int i = 0; i < jump; ++i ) {
296  StatusCode status = next(ctxt);
297  if ( !status.isSuccess() ) {
298  return status;
299  }
300  }
301  return StatusCode::SUCCESS;
302  }
303  return StatusCode::FAILURE;
304 }

◆ previous() [1/2]

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

Definition at line 309 of file McEventSelector.cxx.

309  {
310  ATH_MSG_DEBUG ("............. previous .............");
311 
312  McContext* ct = dynamic_cast<McContext*>(&ctxt);
313 
314  StatusCode sc(StatusCode::FAILURE);
315 
316  if (ct != 0 ) {
317  ct->previous();
318  sc = StatusCode::SUCCESS;
319  } else {
320  ATH_MSG_ERROR ("Could not dcast to McContext");
321  }
322 
323  m_ctx = ct;
324 
325  return sc;
326 
327 }

◆ previous() [2/2]

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

Definition at line 330 of file McEventSelector.cxx.

331 {
332  if ( jump > 0 ) {
333  for ( int i = 0; i < jump; ++i ) {
334  StatusCode status = previous(ctxt);
335  if ( !status.isSuccess() ) {
336  return status;
337  }
338  }
339  return StatusCode::SUCCESS;
340  }
341  return StatusCode::FAILURE;
342 }

◆ releaseContext()

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

Definition at line 395 of file McEventSelector.cxx.

395  {
396 
397  // Nothing to do.
398  return StatusCode::SUCCESS;
399 
400 }

◆ resetCriteria()

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

Definition at line 403 of file McEventSelector.cxx.

403  {
404 
405  ATH_MSG_ERROR ("............. resetCriteria Not Implemented .............");
406  return StatusCode::FAILURE;
407 
408 }

◆ rewind()

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

Definition at line 352 of file McEventSelector.cxx.

353 {
354  ATH_MSG_DEBUG ("............. rewind .............");
355 
356  McContext* ct = dynamic_cast<McContext*>(&ctxt);
357  StatusCode sc(StatusCode::FAILURE);
358 
359  if (ct != 0 ) {
360  ct->rewind();
361  sc = StatusCode::SUCCESS;
362  } else {
363  ATH_MSG_ERROR ("Could not dcast to McContext");
364  }
365 
366  m_ctx = ct;
367  return sc;
368 
369 }

◆ seek()

StatusCode McEventSelector::seek ( Context &  refCtxt,
int  evtNum 
) const
overridevirtual

Definition at line 411 of file McEventSelector.cxx.

411  {
412 
413  ATH_MSG_DEBUG ("............. seek(" << evtNum << ") .............");
414 
415  m_ctx->rewind();
416 
417  for (int i=0; i < evtNum; ++i) {
418  m_ctx->next();
419  }
420 
421  return StatusCode::SUCCESS;
422 }

◆ size()

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

Definition at line 434 of file McEventSelector.cxx.

435 {
436  return -1;
437 }

◆ stop()

StatusCode McEventSelector::stop ( )
overridevirtual

Definition at line 256 of file McEventSelector.cxx.

256  {
257  ATH_MSG_DEBUG ("............. stop .............");
258 
259  ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", name());
260  ATH_CHECK( incSvc.retrieve() );
261 
262  Incident lastInputIncident(name(), "LastInput");
263  incSvc->fireIncident(lastInputIncident);
264 
265  return StatusCode::SUCCESS;
266 }

Member Data Documentation

◆ m_ctx

McContext* McEventSelector::m_ctx
mutableprivate

Definition at line 91 of file McEventSelector.h.

◆ m_eventsPerLB

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

Definition at line 78 of file McEventSelector.h.

◆ m_eventsPerRun

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

Definition at line 76 of file McEventSelector.h.

◆ m_firstEventNo

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

Definition at line 75 of file McEventSelector.h.

◆ m_firstLBNo

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

Definition at line 77 of file McEventSelector.h.

◆ m_initTimeStamp

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

Definition at line 79 of file McEventSelector.h.

◆ m_overrideEventNumber

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

Definition at line 87 of file McEventSelector.h.

◆ m_overrideLBNumber

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

Definition at line 88 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 86 of file McEventSelector.h.

◆ m_overrideTimeStamp

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

Definition at line 89 of file McEventSelector.h.

◆ m_runNo

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

Definition at line 74 of file McEventSelector.h.

◆ m_timeStampInterval

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

Definition at line 80 of file McEventSelector.h.


The documentation for this class was generated from the following files:
McEventSelector::m_runNo
Gaudi::CheckedProperty< unsigned > m_runNo
Definition: McEventSelector.h:74
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:76
McEventSelector::m_overrideLBNumber
Gaudi::Property< bool > m_overrideLBNumber
Definition: McEventSelector.h:88
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:86
McContext::eventNumber
uint64_t eventNumber() const
Definition: McEventSelector.cxx:144
McEventSelector::m_overrideTimeStamp
Gaudi::Property< bool > m_overrideTimeStamp
Definition: McEventSelector.h:89
McEventSelector::m_timeStampInterval
Gaudi::Property< unsigned > m_timeStampInterval
Definition: McEventSelector.h:80
McContext::serialEventNumber
int serialEventNumber() const
Definition: McEventSelector.cxx:147
McEventSelector::m_overrideEventNumber
Gaudi::Property< bool > m_overrideEventNumber
Definition: McEventSelector.h:87
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EventInfo::classID
static const CLID & classID()
Definition: EventInfo/EventInfo/EventInfo.h:316
McEventSelector::next
virtual StatusCode next(Context &refCtxt) const override
Definition: McEventSelector.cxx:271
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:309
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
McEventSelector::m_initTimeStamp
Gaudi::CheckedProperty< unsigned > m_initTimeStamp
Definition: McEventSelector.h:79
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:221
McEventSelector::m_eventsPerLB
Gaudi::CheckedProperty< unsigned > m_eventsPerLB
Definition: McEventSelector.h:78
McContext::lumiBlock
unsigned int lumiBlock() const
Definition: McEventSelector.cxx:145
McEventSelector::m_firstEventNo
Gaudi::CheckedProperty< unsigned long long > m_firstEventNo
Definition: McEventSelector.h:75
McContext::next
void next()
Definition: McEventSelector.cxx:101
merge.status
status
Definition: merge.py:17
McContext
Definition: McEventSelector.cxx:38
McEventSelector::m_ctx
McContext * m_ctx
Definition: McEventSelector.h:91
ServiceHandle< IIncidentSvc >
McEventSelector::m_firstLBNo
Gaudi::CheckedProperty< unsigned > m_firstLBNo
Definition: McEventSelector.h:77