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

Event I/O handler class for the dd4hep event display. More...

#include <DDG4EventHandler.h>

Inheritance diagram for dd4hep::DDG4EventHandler:
dd4hep::EventHandler

Public Types

typedef std::map< std::string, std::pair< TBranch *, void * > > Branches
 
typedef void *(* ParticleAccessor_t) (void *, DDEveParticle *)
 
typedef void *(* HitAccessor_t) (void *, DDEveHit *)
 
- 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...
 

Public Member Functions

 DDG4EventHandler ()
 Standard constructor. More...
 
virtual ~DDG4EventHandler ()
 Default destructor. More...
 
virtual const TypedEventCollectionsdata () 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...
 
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
 Call functor on hit collection. 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 new data file. More...
 
virtual bool NextEvent () override
 User overloadable function: 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...
 
Int_t ReadEvent (Long64_t n)
 Load the specified event. More...
 
 ClassDefOverride (DDG4EventHandler, 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 Attributes

std::pair< TFile *, TTree * > m_file
 Reference to data file. More...
 
Branches m_branches
 Branch map. More...
 
Long64_t m_entry
 File entry number. More...
 
HitAccessor_t m_simhitConverter
 Function pointer to interprete hits. More...
 
ParticleAccessor_t m_particleConverter
 Function pointer to interprete particles. More...
 
TypedEventCollections m_data
 Data collection map. 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...
 

Detailed Description

Event I/O handler class for the dd4hep event display.

Definition at line 38 of file DDG4EventHandler.h.

Member Typedef Documentation

◆ Branches

typedef std::map<std::string,std::pair<TBranch*,void*> > dd4hep::DDG4EventHandler::Branches

Definition at line 40 of file DDG4EventHandler.h.

◆ HitAccessor_t

typedef void*(* dd4hep::DDG4EventHandler::HitAccessor_t) (void *, DDEveHit *)

Definition at line 42 of file DDG4EventHandler.h.

◆ ParticleAccessor_t

typedef void*(* dd4hep::DDG4EventHandler::ParticleAccessor_t) (void *, DDEveParticle *)

Definition at line 41 of file DDG4EventHandler.h.

Constructor & Destructor Documentation

◆ DDG4EventHandler()

DDG4EventHandler::DDG4EventHandler ( )

Standard constructor.

Definition at line 47 of file DDG4EventHandler.cpp.

◆ ~DDG4EventHandler()

DDG4EventHandler::~DDG4EventHandler ( )
virtual

Default destructor.

Definition at line 61 of file DDG4EventHandler.cpp.

Member Function Documentation

◆ ClassDefOverride()

dd4hep::DDG4EventHandler::ClassDefOverride ( DDG4EventHandler  ,
 
)

◆ collectionLoop() [1/2]

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

Call functor on hit collection.

Implements dd4hep::EventHandler.

Definition at line 118 of file DDG4EventHandler.cpp.

◆ collectionLoop() [2/2]

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

Loop over collection and extract particle data.

Implements dd4hep::EventHandler.

Definition at line 138 of file DDG4EventHandler.cpp.

◆ collectionType()

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

Access to the collection type by name.

Implements dd4hep::EventHandler.

Definition at line 102 of file DDG4EventHandler.cpp.

◆ data()

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

Access the map of simulation data collections.

Implements dd4hep::EventHandler.

Definition at line 63 of file DDG4EventHandler.h.

◆ datasourceName()

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

Access the data source name.

Implements dd4hep::EventHandler.

Definition at line 94 of file DDG4EventHandler.cpp.

◆ GotoEvent()

bool DDG4EventHandler::GotoEvent ( long  event_number)
overridevirtual

Goto a specified event in the file.

Implements dd4hep::EventHandler.

Definition at line 81 of file DDG4EventHandler.cpp.

◆ NextEvent()

bool DDG4EventHandler::NextEvent ( )
overridevirtual

User overloadable function: Load the next event.

Load the next event.

Implements dd4hep::EventHandler.

Definition at line 71 of file DDG4EventHandler.cpp.

◆ numEvents()

long DDG4EventHandler::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 86 of file DDG4EventHandler.cpp.

◆ Open()

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

Open new data file.

Implements dd4hep::EventHandler.

Definition at line 189 of file DDG4EventHandler.cpp.

◆ PreviousEvent()

bool DDG4EventHandler::PreviousEvent ( )
overridevirtual

User overloadable function: Load the previous event.

Load the previous event.

Implements dd4hep::EventHandler.

Definition at line 76 of file DDG4EventHandler.cpp.

◆ ReadEvent()

Int_t DDG4EventHandler::ReadEvent ( Long64_t  n)

Load the specified event.

Definition at line 158 of file DDG4EventHandler.cpp.

Member Data Documentation

◆ m_branches

Branches dd4hep::DDG4EventHandler::m_branches
protected

Branch map.

Definition at line 47 of file DDG4EventHandler.h.

◆ m_data

TypedEventCollections dd4hep::DDG4EventHandler::m_data
protected

Data collection map.

Definition at line 55 of file DDG4EventHandler.h.

◆ m_entry

Long64_t dd4hep::DDG4EventHandler::m_entry
protected

File entry number.

Definition at line 49 of file DDG4EventHandler.h.

◆ m_file

std::pair<TFile*,TTree*> dd4hep::DDG4EventHandler::m_file
protected

Reference to data file.

Definition at line 45 of file DDG4EventHandler.h.

◆ m_particleConverter

ParticleAccessor_t dd4hep::DDG4EventHandler::m_particleConverter
protected

Function pointer to interprete particles.

Definition at line 53 of file DDG4EventHandler.h.

◆ m_simhitConverter

HitAccessor_t dd4hep::DDG4EventHandler::m_simhitConverter
protected

Function pointer to interprete hits.

Definition at line 51 of file DDG4EventHandler.h.


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