ATLAS Offline Software
Loading...
Searching...
No Matches
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.
 ~McEventSelector ()

Private Attributes

Gaudi::CheckedProperty< uint32_t > m_runNo
Gaudi::CheckedProperty< uint64_t > m_firstEventNo
Gaudi::CheckedProperty< uint64_t > m_eventsPerRun
Gaudi::CheckedProperty< uint32_t > m_firstLBNo
Gaudi::CheckedProperty< uint32_t > m_eventsPerLB
Gaudi::CheckedProperty< uint32_t > m_initTimeStamp
Gaudi::Property< uint32_t > 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.
Gaudi::Property< bool > m_overrideEventNumber
Gaudi::Property< bool > m_overrideLBNumber
Gaudi::Property< bool > m_overrideTimeStamp
McContextm_ctx

Detailed Description

Definition at line 44 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}
Gaudi::CheckedProperty< uint32_t > m_runNo
McContext * m_ctx
Gaudi::CheckedProperty< uint64_t > m_eventsPerRun
Gaudi::Property< bool > m_overrideEventNumber
Gaudi::Property< uint32_t > m_timeStampInterval
Gaudi::CheckedProperty< uint32_t > m_initTimeStamp
Gaudi::CheckedProperty< uint32_t > m_firstLBNo
Gaudi::Property< bool > m_overrideTimeStamp
Gaudi::Property< bool > m_overrideRunNumber
Flags to indicate override of run/event/time These are always true and are here for consistency with ...
Gaudi::CheckedProperty< uint32_t > m_eventsPerLB
Gaudi::Property< bool > m_overrideLBNumber
Gaudi::CheckedProperty< uint64_t > m_firstEventNo

◆ ~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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
uint64_t eventNumber() const
unsigned int runNumber() const
unsigned int timeStamp() const
unsigned int lumiBlock() const

◆ 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}
#define ATH_MSG_INFO(x)

◆ 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}
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ 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}
virtual StatusCode next(Context &refCtxt) const override
status
Definition merge.py:16

◆ 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}
virtual StatusCode previous(Context &refCtxt) const override

◆ 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}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_ctx

McContext* McEventSelector::m_ctx
mutableprivate

Definition at line 93 of file McEventSelector.h.

◆ m_eventsPerLB

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

Definition at line 80 of file McEventSelector.h.

◆ m_eventsPerRun

Gaudi::CheckedProperty<uint64_t> McEventSelector::m_eventsPerRun
private

Definition at line 78 of file McEventSelector.h.

◆ m_firstEventNo

Gaudi::CheckedProperty<uint64_t> McEventSelector::m_firstEventNo
private

Definition at line 77 of file McEventSelector.h.

◆ m_firstLBNo

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

Definition at line 79 of file McEventSelector.h.

◆ m_initTimeStamp

Gaudi::CheckedProperty<uint32_t> 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<uint32_t> McEventSelector::m_runNo
private

Definition at line 76 of file McEventSelector.h.

◆ m_timeStampInterval

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

Definition at line 82 of file McEventSelector.h.


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