DD4hep  1.38.0
Detector Description Toolkit for High Energy Physics
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
dd4hep::GenericEventHandler Class Reference

Event handler base class. Interface to all DDEve I/O actions. More...

#include <GenericEventHandler.h>

Inheritance diagram for dd4hep::GenericEventHandler:
dd4hep::EventHandler

Public Member Functions

 GenericEventHandler ()
 Standard constructor. More...
 
virtual ~GenericEventHandler ()
 Default destructor. More...
 
virtual const TypedEventCollections & data () const override
 Access the map of simulation data collections. More...
 
virtual long numEvents () const override
 Access the number of events on the current input data source (-1 if no data source connected) More...
 
virtual std::string datasourceName () const override
 Access the data source name. More...
 
virtual CollectionType collectionType (const std::string &collection) const override
 Access to the collection type by name. More...
 
virtual size_t collectionLoop (const std::string &collection, DDEveHitActor &actor) override
 Loop over collection and extract data. More...
 
virtual size_t collectionLoop (const std::string &collection, DDEveParticleActor &actor) override
 Loop over collection and extract particle data. More...
 
virtual bool Open (const std::string &type, const std::string &file_name) override
 Open a new event data file. More...
 
virtual bool NextEvent () override
 Load the next event. More...
 
virtual bool PreviousEvent () override
 User overloadable function: Load the previous event. More...
 
virtual bool GotoEvent (long event_number) override
 Goto a specified event in the file. More...
 
virtual void Subscribe (EventConsumer *display)
 Subscribe to notification of new data present. More...
 
virtual void Unsubscribe (EventConsumer *display)
 Unsubscribe from notification of new data present. More...
 
virtual void NotifySubscribers (void(EventConsumer::*pmf)(EventHandler &))
 Notfy all subscribers. More...
 
 ClassDefOverride (GenericEventHandler, 0)
 
- Public Member Functions inherited from dd4hep::EventHandler
 EventHandler ()=default
 Standard constructor. More...
 
virtual ~EventHandler ()
 Default destructor. More...
 
virtual bool hasEvent () const
 Check if an event is present in memory. More...
 
virtual bool hasFile () const
 Check if a data file is connected to the handler. More...
 
 ClassDef (EventHandler, 0)
 

Protected Types

typedef std::set< EventConsumer * > Subscriptions
 Subscriber set. More...
 

Protected Member Functions

EventHandler * current () const
 

Protected Attributes

std::map< std::string, EventHandler * > m_handlers
 
EventHandler * m_current
 
Subscriptions m_subscriptions
 Data subscriptions (unordered) More...
 
- Protected Attributes inherited from dd4hep::EventHandler
bool m_hasFile = false
 Flag to indicate that a file is opened. More...
 
bool m_hasEvent = false
 Flag to indicate that an event is loaded. More...
 

Additional Inherited Members

- Public Types inherited from dd4hep::EventHandler
enum  CollectionType {
  NO_COLLECTION =1<<0, PARTICLE_COLLECTION =1<<1, TRACK_COLLECTION =1<<2, CALO_HIT_COLLECTION =1<<3,
  TRACKER_HIT_COLLECTION =1<<4, HIT_COLLECTION =CALO_HIT_COLLECTION|TRACKER_HIT_COLLECTION
}
 
typedef std::pair< const char *, size_t > Collection
 Collection definition: name, size. More...
 
typedef std::map< std::string, std::vector< Collection > > TypedEventCollections
 Types collection: collections are grouped by type (class name) More...
 

Detailed Description

Event handler base class. Interface to all DDEve I/O actions.

Author
M.Frank
Version
1.0

Definition at line 30 of file GenericEventHandler.h.

Member Typedef Documentation

◆ Subscriptions

Subscriber set.

Definition at line 33 of file GenericEventHandler.h.

Constructor & Destructor Documentation

◆ GenericEventHandler()

dd4hep::GenericEventHandler::GenericEventHandler ( )

Standard constructor.

◆ ~GenericEventHandler()

GenericEventHandler::~GenericEventHandler ( )
virtual

Default destructor.

Definition at line 36 of file GenericEventHandler.cpp.

Member Function Documentation

◆ ClassDefOverride()

dd4hep::GenericEventHandler::ClassDefOverride ( GenericEventHandler  ,
0   
)

◆ collectionLoop() [1/2]

std::size_t GenericEventHandler::collectionLoop ( const std::string &  collection,
DDEveHitActor &  actor 
)
overridevirtual

Loop over collection and extract data.

Implements dd4hep::EventHandler.

Definition at line 84 of file GenericEventHandler.cpp.

◆ collectionLoop() [2/2]

std::size_t GenericEventHandler::collectionLoop ( const std::string &  collection,
DDEveParticleActor &  actor 
)
overridevirtual

Loop over collection and extract particle data.

Implements dd4hep::EventHandler.

Definition at line 92 of file GenericEventHandler.cpp.

◆ collectionType()

EventHandler::CollectionType GenericEventHandler::collectionType ( const std::string &  collection) const
overridevirtual

Access to the collection type by name.

Implements dd4hep::EventHandler.

Definition at line 76 of file GenericEventHandler.cpp.

◆ current()

EventHandler * GenericEventHandler::current ( ) const
protected

Definition at line 41 of file GenericEventHandler.cpp.

◆ data()

virtual const TypedEventCollections& dd4hep::GenericEventHandler::data ( ) const
inlineoverridevirtual

Access the map of simulation data collections.

Implements dd4hep::EventHandler.

Definition at line 46 of file GenericEventHandler.h.

◆ datasourceName()

std::string GenericEventHandler::datasourceName ( ) const
overridevirtual

Access the data source name.

Implements dd4hep::EventHandler.

Definition at line 71 of file GenericEventHandler.cpp.

◆ GotoEvent()

bool GenericEventHandler::GotoEvent ( long  event_number)
overridevirtual

Goto a specified event in the file.

Implements dd4hep::EventHandler.

Definition at line 182 of file GenericEventHandler.cpp.

◆ NextEvent()

bool GenericEventHandler::NextEvent ( )
overridevirtual

Load the next event.

Implements dd4hep::EventHandler.

Definition at line 147 of file GenericEventHandler.cpp.

◆ NotifySubscribers()

void GenericEventHandler::NotifySubscribers ( void(EventConsumer::*)(EventHandler &)  pmf)
virtual

Notfy all subscribers.

Definition at line 49 of file GenericEventHandler.cpp.

◆ numEvents()

long GenericEventHandler::numEvents ( ) const
overridevirtual

Access the number of events on the current input data source (-1 if no data source connected)

Implements dd4hep::EventHandler.

Definition at line 66 of file GenericEventHandler.cpp.

◆ Open()

bool GenericEventHandler::Open ( const std::string &  type,
const std::string &  file_name 
)
overridevirtual

Open a new event data file.

Implements dd4hep::EventHandler.

Definition at line 100 of file GenericEventHandler.cpp.

◆ PreviousEvent()

bool GenericEventHandler::PreviousEvent ( )
overridevirtual

User overloadable function: Load the previous event.

Implements dd4hep::EventHandler.

Definition at line 171 of file GenericEventHandler.cpp.

◆ Subscribe()

void GenericEventHandler::Subscribe ( EventConsumer *  display)
virtual

Subscribe to notification of new data present.

Definition at line 55 of file GenericEventHandler.cpp.

◆ Unsubscribe()

void GenericEventHandler::Unsubscribe ( EventConsumer *  display)
virtual

Unsubscribe from notification of new data present.

Definition at line 60 of file GenericEventHandler.cpp.

Member Data Documentation

◆ m_current

EventHandler* dd4hep::GenericEventHandler::m_current
protected

Definition at line 35 of file GenericEventHandler.h.

◆ m_handlers

std::map<std::string,EventHandler*> dd4hep::GenericEventHandler::m_handlers
protected

Definition at line 34 of file GenericEventHandler.h.

◆ m_subscriptions

Subscriptions dd4hep::GenericEventHandler::m_subscriptions
protected

Data subscriptions (unordered)

Definition at line 37 of file GenericEventHandler.h.


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