DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
LCIOEventHandler.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_LCIO_LCIOEVENTHANDLER_H
14 #define DDEVE_LCIO_LCIOEVENTHANDLER_H
15 
16 // Framework include files
17 #include "DDEve/EventHandler.h"
18 #include "lcio.h"
19 
20 // C/C++ include files
21 #include <map>
22 #include <string>
23 
24 // Forward declarations
25 
26 /*
27  * dd4hep namespace declaration
28  */
29 namespace dd4hep {
30 
32 
37  class LCIOEventHandler : public EventHandler {
38  public:
39  typedef std::map<std::string,lcio::LCCollection*> Branches;
40  typedef const void* (*HitAccessor_t)(const lcio::LCObject*, DDEveHit*);
41  protected:
43  lcio::LCReader* m_lcReader;
45  lcio::LCEvent* m_event;
47  std::string m_fileName;
52 
53  public:
57  virtual ~LCIOEventHandler();
58 
60  virtual const TypedEventCollections& data() const { return m_data; }
62  std::string datasourceName() const { return hasFile() ? m_fileName : std::string("UNKNOWN"); }
64  virtual long numEvents() const;
66  virtual CollectionType collectionType(const std::string& collection) const;
68  virtual size_t collectionLoop(const std::string& collection, DDEveHitActor& actor);
70  virtual size_t collectionLoop(const std::string& collection, DDEveParticleActor& actor);
72  virtual bool Open(const std::string& type, const std::string& file_name);
74  virtual bool NextEvent();
76  virtual bool PreviousEvent();
78  virtual bool GotoEvent(long event_number);
79  };
80 
81 } /* End namespace dd4hep */
82 
83 #endif // DDEVE_LCIO_LCIOEVENTHANDLER_H
84 
dd4hep::DDEveParticleActor
Event data actor base class for particles. Used to extract data from concrete classes.
Definition: EventHandler.h:55
dd4hep::DDEveHit
DDEve event classes: Basic hit.
Definition: DDEveEventData.h:29
dd4hep::LCIOEventHandler::Branches
std::map< std::string, lcio::LCCollection * > Branches
Definition: LCIOEventHandler.h:39
dd4hep::LCIOEventHandler::m_branches
Branches m_branches
Branch map.
Definition: LCIOEventHandler.h:49
dd4hep::LCIOEventHandler::datasourceName
std::string datasourceName() const
Access the data source name.
Definition: LCIOEventHandler.h:62
dd4hep::EventHandler
Event handler base class: Interface to all DDEve I/O actions.
Definition: EventHandler.h:67
dd4hep::LCIOEventHandler::Open
virtual bool Open(const std::string &type, const std::string &file_name)
Open new data file.
Definition: LCIOEventHandler.cpp:146
dd4hep::LCIOEventHandler::numEvents
virtual long numEvents() const
Access the number of events on the current input data source (-1 if no data source connected)
Definition: LCIOEventHandler.cpp:85
dd4hep::DDEveHitActor
Event data actor base class for hits. Used to extract data from concrete classes.
Definition: EventHandler.h:43
dd4hep::LCIOEventHandler::m_event
lcio::LCEvent * m_event
Reference to the current LCIO event.
Definition: LCIOEventHandler.h:45
dd4hep::LCIOEventHandler::GotoEvent
virtual bool GotoEvent(long event_number)
Goto a specified event in the file.
Definition: LCIOEventHandler.cpp:188
dd4hep::EventHandler::hasFile
virtual bool hasFile() const
Check if a data file is connected to the handler.
Definition: EventHandler.h:95
dd4hep::LCIOEventHandler::NextEvent
virtual bool NextEvent()
User overloadable function: Load the next event.
Definition: LCIOEventHandler.cpp:158
EventHandler.h
dd4hep::EventHandler::CollectionType
CollectionType
Definition: EventHandler.h:69
dd4hep::LCIOEventHandler::LCIOEventHandler
LCIOEventHandler()
Standard constructor.
Definition: LCIOEventHandler.cpp:75
dd4hep::LCIOEventHandler::data
virtual const TypedEventCollections & data() const
Access the map of simulation data collections.
Definition: LCIOEventHandler.h:60
dd4hep::LCIOEventHandler::m_data
TypedEventCollections m_data
Data collection map.
Definition: LCIOEventHandler.h:51
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::LCIOEventHandler
LCIO input event handler for DDEve: Interface class for event I/O.
Definition: LCIOEventHandler.h:37
dd4hep::LCIOEventHandler::PreviousEvent
virtual bool PreviousEvent()
User overloadable function: Load the previous event.
Definition: LCIOEventHandler.cpp:182
dd4hep::LCIOEventHandler::~LCIOEventHandler
virtual ~LCIOEventHandler()
Default destructor.
Definition: LCIOEventHandler.cpp:80
dd4hep::LCIOEventHandler::m_lcReader
lcio::LCReader * m_lcReader
Reference to data file reader.
Definition: LCIOEventHandler.h:43
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::LCIOEventHandler::m_fileName
std::string m_fileName
Input file name.
Definition: LCIOEventHandler.h:47
dd4hep::LCIOEventHandler::collectionType
virtual CollectionType collectionType(const std::string &collection) const
Access to the collection type by name.
Definition: LCIOEventHandler.cpp:93
dd4hep::LCIOEventHandler::collectionLoop
virtual size_t collectionLoop(const std::string &collection, DDEveHitActor &actor)
Call functor on hit collection.
Definition: LCIOEventHandler.cpp:104