Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:16

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 #ifndef DDEVE_LCIO_LCIOEVENTHANDLER_H
0014 #define DDEVE_LCIO_LCIOEVENTHANDLER_H
0015 
0016 // Framework include files
0017 #include "DDEve/EventHandler.h"
0018 #include "lcio.h"
0019 
0020 // C/C++ include files
0021 #include <map>
0022 #include <string>
0023 
0024 // Forward declarations
0025 
0026 /*
0027  *   dd4hep namespace declaration
0028  */
0029 namespace dd4hep {
0030 
0031   /// LCIO input event handler for DDEve: Interface class for event I/O
0032   /** @class LCIOEventHandler  LCIOEventHandler.h DDEve/LCIOEventHandler.h
0033    *
0034    * @author  M.Frank
0035    * @version 1.0
0036    */
0037   class LCIOEventHandler : public EventHandler  {
0038   public:
0039     typedef std::map<std::string,lcio::LCCollection*> Branches;
0040     typedef const void* (*HitAccessor_t)(const lcio::LCObject*, DDEveHit*);
0041   protected:
0042     /// Reference to data file reader
0043     lcio::LCReader* m_lcReader;
0044     /// Reference to the current LCIO event
0045     lcio::LCEvent*  m_event;
0046     /// Input file name
0047     std::string     m_fileName;
0048     /// Branch map
0049     Branches        m_branches;
0050     /// Data collection map
0051     TypedEventCollections m_data;
0052 
0053   public:
0054     /// Standard constructor
0055     LCIOEventHandler();
0056     /// Default destructor
0057     virtual ~LCIOEventHandler();
0058 
0059     /// Access the map of simulation data collections
0060     virtual const TypedEventCollections& data()  const   { return m_data;  }
0061     /// Access the data source name
0062     std::string datasourceName() const { return hasFile() ? m_fileName : std::string("UNKNOWN"); }
0063     /// Access the number of events on the current input data source (-1 if no data source connected)
0064     virtual long numEvents() const;
0065     /// Access to the collection type by name
0066     virtual CollectionType collectionType(const std::string& collection) const;
0067     /// Call functor on hit collection
0068     virtual size_t collectionLoop(const std::string& collection, DDEveHitActor& actor);
0069     /// Loop over collection and extract particle data
0070     virtual size_t collectionLoop(const std::string& collection, DDEveParticleActor& actor);
0071     /// Open new data file
0072     virtual bool Open(const std::string& type, const std::string& file_name);
0073     /// User overloadable function: Load the next event
0074     virtual bool NextEvent();
0075     /// User overloadable function: Load the previous event
0076     virtual bool PreviousEvent();
0077     /// Goto a specified event in the file
0078     virtual bool GotoEvent(long event_number);
0079   };
0080 
0081 } /* End namespace dd4hep   */
0082 
0083 #endif // DDEVE_LCIO_LCIOEVENTHANDLER_H
0084