DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
GenericEventHandler.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDEVE_GENERICEVENTHANDLER_H
14 #define DDEVE_GENERICEVENTHANDLER_H
15 
16 // Framework include files
17 #include "DDEve/EventHandler.h"
18 
19 // Forward declarations
20 
22 namespace dd4hep {
23 
25 
31  protected:
33  typedef std::set<EventConsumer*> Subscriptions;
34  std::map<std::string,EventHandler*> m_handlers;
38 
39  EventHandler* current() const;
40  public:
44  virtual ~GenericEventHandler();
46  virtual const TypedEventCollections& data() const override { return current()->data(); }
48  virtual long numEvents() const override;
50  virtual std::string datasourceName() const override;
52  virtual CollectionType collectionType(const std::string& collection) const override;
54  virtual size_t collectionLoop(const std::string& collection, DDEveHitActor& actor) override;
56  virtual size_t collectionLoop(const std::string& collection, DDEveParticleActor& actor) override;
58  virtual bool Open(const std::string& type, const std::string& file_name) override;
60  virtual bool NextEvent() override;
62  virtual bool PreviousEvent() override;
64  virtual bool GotoEvent(long event_number) override;
66  virtual void Subscribe(EventConsumer* display);
68  virtual void Unsubscribe(EventConsumer* display);
69 
70 #ifndef __CINT__
71  virtual void NotifySubscribers(void (EventConsumer::*pmf)(EventHandler&));
73 #endif
74 
76  };
77 } /* End namespace dd4hep */
78 
79 #endif // DDEVE_GENERICEVENTHANDLER_H
80 
dd4hep::DDEveParticleActor
Event data actor base class for particles. Used to extract data from concrete classes.
Definition: EventHandler.h:55
dd4hep::GenericEventHandler::ClassDefOverride
ClassDefOverride(GenericEventHandler, 0)
dd4hep::GenericEventHandler
Event handler base class. Interface to all DDEve I/O actions.
Definition: GenericEventHandler.h:30
dd4hep::GenericEventHandler::~GenericEventHandler
virtual ~GenericEventHandler()
Default destructor.
Definition: GenericEventHandler.cpp:36
dd4hep::EventHandler
Event handler base class: Interface to all DDEve I/O actions.
Definition: EventHandler.h:67
dd4hep::GenericEventHandler::collectionLoop
virtual size_t collectionLoop(const std::string &collection, DDEveHitActor &actor) override
Loop over collection and extract data.
Definition: GenericEventHandler.cpp:84
dd4hep::GenericEventHandler::Subscribe
virtual void Subscribe(EventConsumer *display)
Subscribe to notification of new data present.
Definition: GenericEventHandler.cpp:55
dd4hep::GenericEventHandler::GenericEventHandler
GenericEventHandler()
Standard constructor.
dd4hep::DDEveHitActor
Event data actor base class for hits. Used to extract data from concrete classes.
Definition: EventHandler.h:43
dd4hep::GenericEventHandler::datasourceName
virtual std::string datasourceName() const override
Access the data source name.
Definition: GenericEventHandler.cpp:71
dd4hep::GenericEventHandler::NotifySubscribers
virtual void NotifySubscribers(void(EventConsumer::*pmf)(EventHandler &))
Notfy all subscribers.
Definition: GenericEventHandler.cpp:49
dd4hep::GenericEventHandler::Subscriptions
std::set< EventConsumer * > Subscriptions
Subscriber set.
Definition: GenericEventHandler.h:33
dd4hep::GenericEventHandler::NextEvent
virtual bool NextEvent() override
Load the next event.
Definition: GenericEventHandler.cpp:147
dd4hep::EventConsumer
Event event consumer base class for DDEve: Interface class for event I/O.
Definition: EventHandler.h:127
dd4hep::GenericEventHandler::GotoEvent
virtual bool GotoEvent(long event_number) override
Goto a specified event in the file.
Definition: GenericEventHandler.cpp:182
dd4hep::GenericEventHandler::m_subscriptions
Subscriptions m_subscriptions
Data subscriptions (unordered)
Definition: GenericEventHandler.h:37
dd4hep::GenericEventHandler::data
virtual const TypedEventCollections & data() const override
Access the map of simulation data collections.
Definition: GenericEventHandler.h:46
dd4hep::GenericEventHandler::PreviousEvent
virtual bool PreviousEvent() override
User overloadable function: Load the previous event.
Definition: GenericEventHandler.cpp:171
EventHandler.h
dd4hep::EventHandler::CollectionType
CollectionType
Definition: EventHandler.h:69
dd4hep::GenericEventHandler::current
EventHandler * current() const
Definition: GenericEventHandler.cpp:41
dd4hep::GenericEventHandler::m_handlers
std::map< std::string, EventHandler * > m_handlers
Definition: GenericEventHandler.h:34
dd4hep::GenericEventHandler::collectionType
virtual CollectionType collectionType(const std::string &collection) const override
Access to the collection type by name.
Definition: GenericEventHandler.cpp:76
dd4hep::GenericEventHandler::Open
virtual bool Open(const std::string &type, const std::string &file_name) override
Open a new event data file.
Definition: GenericEventHandler.cpp:100
dd4hep::GenericEventHandler::numEvents
virtual long numEvents() const override
Access the number of events on the current input data source (-1 if no data source connected)
Definition: GenericEventHandler.cpp:66
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::GenericEventHandler::m_current
EventHandler * m_current
Definition: GenericEventHandler.h:35
dd4hep::EventHandler::TypedEventCollections
std::map< std::string, std::vector< Collection > > TypedEventCollections
Types collection: collections are grouped by type (class name)
Definition: EventHandler.h:80
dd4hep::GenericEventHandler::Unsubscribe
virtual void Unsubscribe(EventConsumer *display)
Unsubscribe from notification of new data present.
Definition: GenericEventHandler.cpp:60
dd4hep::EventHandler::data
virtual const TypedEventCollections & data() const =0
Access the map of simulation data collections.