k4SimGeant4
Loading...
Searching...
No Matches
GeoSvc.h
Go to the documentation of this file.
1#ifndef GEOSVC_H
2#define GEOSVC_H
3
4// Interface
5#include "k4Interface/IGeoSvc.h"
6
7// Gaudi
8#include "GaudiKernel/IIncidentListener.h"
9#include "GaudiKernel/IIncidentSvc.h"
10#include "GaudiKernel/Incident.h"
11#include "GaudiKernel/MsgStream.h"
12#include "GaudiKernel/Service.h"
13#include "GaudiKernel/ServiceHandle.h"
14
15// DD4Hep
16#include "DD4hep/Detector.h"
17
18// Geant4
19#include "G4RunManager.hh"
20#include "G4VUserDetectorConstruction.hh"
21
22class GeoSvc : public extends<Service, IGeoSvc> {
23
24public:
26 GeoSvc(const std::string& name, ISvcLocator* svc);
27
29 virtual ~GeoSvc();
31 virtual StatusCode initialize() final;
33 virtual StatusCode finalize() final;
35 StatusCode buildDD4HepGeo();
37 StatusCode buildGeant4Geo();
38 // receive DD4hep Geometry
39 virtual dd4hep::DetElement getDD4HepGeo() override;
40 virtual dd4hep::Detector* getDetector() override;
41 virtual std::string constantAsString(std::string const& name) override;
42 // receive Geant4 Geometry
43 virtual G4VUserDetectorConstruction* getGeant4Geo() override;
44
45private:
47 dd4hep::Detector* m_dd4hepgeo;
49 std::shared_ptr<G4VUserDetectorConstruction> m_geant4geo;
51 Gaudi::Property<std::vector<std::string>> m_xmlFileNames{this, "detectors", {}, "Detector descriptions XML-files"};
53 Gaudi::Property<std::map<std::string, std::string>> m_sensitive_types{this, "sensitiveTypes", {{"tracker", "SimpleTrackerSD"}, {"calorimeter", "SimpleCalorimeterSD"}}};
55 Gaudi::Property<bool> m_buildGeant4Geo{this, "EnableGeant4Geo", true, "If True the DD4hep geometry is converted for Geant4 Simulations"};
56
57};
58
59#endif // GEOSVC_H
Definition GeoSvc.h:22
Gaudi::Property< std::map< std::string, std::string > > m_sensitive_types
mapping of sensitive detector names
Definition GeoSvc.h:53
GeoSvc(const std::string &name, ISvcLocator *svc)
Default constructor.
Definition GeoSvc.cpp:13
StatusCode buildGeant4Geo()
This function generates the Geant4 geometry.
Definition GeoSvc.cpp:91
virtual std::string constantAsString(std::string const &name) override
Definition GeoSvc.cpp:105
virtual StatusCode finalize() final
Finalize function.
Definition GeoSvc.cpp:63
virtual dd4hep::DetElement getDD4HepGeo() override
Definition GeoSvc.cpp:89
Gaudi::Property< std::vector< std::string > > m_xmlFileNames
XML-files with the detector description.
Definition GeoSvc.h:51
StatusCode buildDD4HepGeo()
This function generates the DD4hep geometry.
Definition GeoSvc.cpp:65
virtual dd4hep::Detector * getDetector() override
Definition GeoSvc.cpp:87
dd4hep::Detector * m_dd4hepgeo
Pointer to the interface to the DD4hep geometry.
Definition GeoSvc.h:47
virtual StatusCode initialize() final
Initialize function.
Definition GeoSvc.cpp:22
Gaudi::Property< bool > m_buildGeant4Geo
Whether to create the geant4 geometry or not.
Definition GeoSvc.h:55
virtual G4VUserDetectorConstruction * getGeant4Geo() override
Definition GeoSvc.cpp:103
std::shared_ptr< G4VUserDetectorConstruction > m_geant4geo
Pointer to the detector construction of DDG4.
Definition GeoSvc.h:49
virtual ~GeoSvc()
Destructor.
Definition GeoSvc.cpp:16