File indexing completed on 2025-01-18 09:55:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDEVE_DDG4EVENTHANDLER_H
0014 #define DDEVE_DDG4EVENTHANDLER_H
0015
0016
0017 #include "DDEve/EventHandler.h"
0018
0019
0020 #include <map>
0021 #include <string>
0022
0023
0024 class TTree;
0025 class TFile;
0026 class TBranch;
0027
0028
0029 namespace dd4hep {
0030
0031
0032
0033
0034
0035
0036
0037
0038 class DDG4EventHandler : public EventHandler {
0039 public:
0040 typedef std::map<std::string,std::pair<TBranch*,void*> > Branches;
0041 typedef void* (*ParticleAccessor_t)(void*, DDEveParticle*);
0042 typedef void* (*HitAccessor_t)(void*, DDEveHit*);
0043 protected:
0044
0045 std::pair<TFile*,TTree*> m_file;
0046
0047 Branches m_branches;
0048
0049 Long64_t m_entry;
0050
0051 HitAccessor_t m_simhitConverter;
0052
0053 ParticleAccessor_t m_particleConverter;
0054
0055 TypedEventCollections m_data;
0056 public:
0057
0058 DDG4EventHandler();
0059
0060 virtual ~DDG4EventHandler();
0061
0062
0063 virtual const TypedEventCollections& data() const override { return m_data; }
0064
0065 virtual long numEvents() const override;
0066
0067 std::string datasourceName() const override;
0068
0069 virtual CollectionType collectionType(const std::string& collection) const override;
0070
0071 virtual size_t collectionLoop(const std::string& collection, DDEveHitActor& actor) override;
0072
0073 virtual size_t collectionLoop(const std::string& collection, DDEveParticleActor& actor) override;
0074
0075 virtual bool Open(const std::string& type, const std::string& file_name) override;
0076
0077 virtual bool NextEvent() override;
0078
0079 virtual bool PreviousEvent() override;
0080
0081 virtual bool GotoEvent(long event_number) override;
0082
0083 Int_t ReadEvent(Long64_t n);
0084
0085 ClassDefOverride(DDG4EventHandler,0);
0086 };
0087
0088 }
0089 #endif
0090