DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GenericEventHandler.h
Go to the documentation of this file.
1 // $Id: $
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 #ifndef DD4HEP_DDEVE_GENERICEVENTHANDLER_H
15 #define DD4HEP_DDEVE_GENERICEVENTHANDLER_H
16 
17 // Framework include files
18 #include "DDEve/EventHandler.h"
19 
20 // Forward declarations
21 
23 namespace DD4hep {
24 
26 
32  protected:
34  typedef std::set<EventConsumer*> Subscriptions;
35  std::map<std::string,EventHandler*> m_handlers;
39 
40  EventHandler* current() const;
41  public:
45  virtual ~GenericEventHandler();
47  virtual const TypedEventCollections& data() const { return current()->data(); }
49  virtual long numEvents() const;
51  virtual std::string datasourceName() const;
53  virtual CollectionType collectionType(const std::string& collection) const;
55  virtual size_t collectionLoop(const std::string& collection, DDEveHitActor& actor);
57  virtual size_t collectionLoop(const std::string& collection, DDEveParticleActor& actor);
59  virtual bool Open(const std::string& type, const std::string& file_name);
61  virtual bool NextEvent();
63  virtual bool PreviousEvent();
65  virtual bool GotoEvent(long event_number);
67  virtual void Subscribe(EventConsumer* display);
69  virtual void Unsubscribe(EventConsumer* display);
70 
71 #ifndef __CINT__
72  virtual void NotifySubscribers(void (EventConsumer::*pmf)(EventHandler*));
74 #endif
75 
77  };
78 } /* End namespace DD4hep */
79 
80 #endif /* DD4HEP_DDEVE_GENERICEVENTHANDLER_H */
81 
Event data actor base class for hits. Used to extract data from concrete classes. ...
Definition: EventHandler.h:44
virtual std::string datasourceName() const
Access the data source name.
virtual size_t collectionLoop(const std::string &collection, DDEveHitActor &actor)
Loop over collection and extract data.
virtual bool GotoEvent(long event_number)
Goto a specified event in the file.
virtual bool Open(const std::string &type, const std::string &file_name)
Open a new event data file.
Subscriptions m_subscriptions
Data subscriptions (unordered)
Event handler base class. Interface to all DDEve I/O actions.
Definition: EventHandler.h:66
virtual CollectionType collectionType(const std::string &collection) const
Access to the collection type by name.
EventHandler * current() const
virtual bool PreviousEvent()
User overloadable function: Load the previous event.
virtual const TypedEventCollections & data() const =0
Access the map of simulation data collections.
virtual void Subscribe(EventConsumer *display)
Subscribe to notification of new data present.
virtual const TypedEventCollections & data() const
Access the map of simulation data collections.
virtual void Unsubscribe(EventConsumer *display)
Unsubscribe from notification of new data present.
Event handler base class. Interface to all DDEve I/O actions.
std::set< EventConsumer * > Subscriptions
Subscriber set.
GenericEventHandler()
Standard constructor.
std::map< std::string, EventHandler * > m_handlers
virtual ~GenericEventHandler()
Default destructor.
virtual bool NextEvent()
Load the next event.
std::map< std::string, std::vector< Collection > > TypedEventCollections
Types collection: collections are grouped by type (class name)
Definition: EventHandler.h:79
virtual long numEvents() const
Access the number of events on the current input data source (-1 if no data source connected) ...
ClassDef(GenericEventHandler, 0)
Event data actor base class for particles. Used to extract data from concrete classes.
Definition: EventHandler.h:55
virtual void NotifySubscribers(void(EventConsumer::*pmf)(EventHandler *))
Notfy all subscribers.