Geant4Output2Podio.h
Go to the documentation of this file.
1 #ifndef DD4HEP_DDG4_GEANT4Output2Podio_H
2 #define DD4HEP_DDG4_GEANT4Output2Podio_H
3 
4 #include "DDG4/Geant4OutputAction.h"
5 //#include "podio/GenericParameters.h"
6 #include "podio/CollectionBase.h"
7 #include "podio/CollectionIDTable.h"
8 
9 #include "podio/EventStore.h"
10 #include "podio/ROOTWriter.h"
11 
12 namespace dd4pod {
13 class Geant4Particle;
15 }
16 
17 namespace dd4hep {
18 
19 
20  class ComponentCast;
21 
22  namespace sim {
23 
24  class Geant4Particle;
25 
31  protected:
32  void
34  dd4hep::sim::Geant4Particle* part);
35 
38 
40  std::vector<std::string> m_disabledCollections;
41 
43  std::vector<std::string> m_enabledCollections;
44 
46  bool m_disableParticles = false;
47 
48  podio::EventStore store;
49  podio::ROOTWriter* writer = nullptr;
50 
51  std::map<std::string, podio::CollectionBase*> m_col_map;
52  std::vector<std::pair<std::string, podio::CollectionBase*>> m_collections;
53  std::vector<std::pair<std::string, podio::CollectionBase*>>
55  podio::CollectionIDTable* m_collectionIDs;
56 
57  public:
58  Geant4Output2Podio(Geant4Context* context, const std::string& nam);
59  virtual ~Geant4Output2Podio();
60 
62  //int fill(const std::string& nam, const ComponentCast& type, void* ptr);
63 
65  virtual void beginRun(const G4Run* run);
66 
68  virtual void endRun(const G4Run* run);
69 
71  virtual void saveRun(const G4Run* run );
72 
74  virtual void saveCollection(OutputContext<G4Event>& ctxt, G4VHitsCollection* collection);
75 
77  virtual void saveEvent(OutputContext<G4Event>& ctxt);
78 
80  virtual void commit(OutputContext<G4Event>& ctxt);
81  };
82 
83  } // End namespace sim
84 } // End namespace dd4hep
85 #endif // DD4HEP_DDG4_GEANT4Output2Podio_H
void ConstructParticle(dd4pod::Geant4ParticleCollection *col, dd4hep::sim::Geant4Particle *part)
Saves output to podio data model.
virtual void beginRun(const G4Run *run)
Callback to store the Geant4 run information.
virtual void saveEvent(OutputContext< G4Event > &ctxt)
Callback to store the Geant4 event.
virtual ~Geant4Output2Podio()
Default destructor.
std::vector< std::pair< std::string, podio::CollectionBase * > > m_collections
podio::CollectionIDTable * m_collectionIDs
bool m_handleMCTruth
Flag if Monte-Carlo truth should be followed and checked.
virtual void endRun(const G4Run *run)
Callback to store the Geant4 run information.
virtual void saveRun(const G4Run *run)
Callback to store the Geant4 run information.
virtual void saveCollection(OutputContext< G4Event > &ctxt, G4VHitsCollection *collection)
Callback to store each Geant4 hit collection.
Geant4Output2Podio(Geant4Context *context, const std::string &nam)
Standard constructor.
bool m_disableParticles
Property: vector with disabled collections.
std::vector< std::string > m_disabledCollections
Property: vector with disabled collections.
Namespace for the AIDA detector description toolkit.
std::vector< std::pair< std::string, podio::CollectionBase * > > m_readCollections
std::map< std::string, podio::CollectionBase * > m_col_map
A Collection is identified by an ID.
std::vector< std::string > m_enabledCollections
Property: vector with disabled collections.
virtual void commit(OutputContext< G4Event > &ctxt)
Commit data at end of filling procedure.