diff --git a/DDG4/include/Geant4Converter.h b/DDG4/include/DDG4/Geant4Converter.h similarity index 97% rename from DDG4/include/Geant4Converter.h rename to DDG4/include/DDG4/Geant4Converter.h index 4279a51e9e05c1619d64527a608154bebf915a8a..8f0cfadbadaea94c9c28cd0885ef1d3525e01cf5 100644 --- a/DDG4/include/Geant4Converter.h +++ b/DDG4/include/DDG4/Geant4Converter.h @@ -48,6 +48,7 @@ typedef G4AnyThing<G4VSolid> G4Tubs; typedef G4AnyThing<G4VSolid> G4Trd; typedef G4AnyThing<G4VSolid> G4Paraboloid; typedef G4AnyThing<G4VSolid> G4Polycone; +typedef G4AnyThing<G4VSolid> G4Polyhedra; typedef G4AnyThing<G4VSolid> G4Sphere; typedef G4AnyThing<G4VSolid> G4Torus; typedef G4AnyThing<G4VSolid> G4UnionSolid; @@ -70,6 +71,7 @@ typedef G4AnyThing<G4VAny> G4PVPlacement; #include "G4Trd.hh" #include "G4Paraboloid.hh" #include "G4Polycone.hh" +#include "G4Polyhedra.hh" #include "G4Sphere.hh" #include "G4Torus.hh" #include "G4UnionSolid.hh" @@ -97,7 +99,7 @@ namespace DD4hep { std::map<const TGeoVolume*, G4LogicalVolume*> g4Volumes; std::map<const TGeoNode*, G4PVPlacement*> g4Placements; }; - G4GeometryInfo* m_dataPtr; + G4GeometryInfo* m_dataPtr; G4GeometryInfo& data() const { return *m_dataPtr; } /// Constructor @@ -122,4 +124,3 @@ namespace DD4hep { } // End namespace DD4hep #endif // DD4HEP_GEANT4CONVERTER_H - diff --git a/DDG4/include/DDG4/Geant4SensitiveDetector.h b/DDG4/include/DDG4/Geant4SensitiveDetector.h new file mode 100644 index 0000000000000000000000000000000000000000..81eb77be543930a6eee92a29cd61e87d3f05561c --- /dev/null +++ b/DDG4/include/DDG4/Geant4SensitiveDetector.h @@ -0,0 +1,73 @@ +// $Id:$ +//==================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------- +// +// Author : M.Frank +// +//==================================================================== +#ifndef DD4HEP_GEANT4SENSITIVEDETECTOR_H +#define DD4HEP_GEANT4SENSITIVEDETECTOR_H + +// Framework include files +#include "DD4hep/Readout.h" +#include "DD4hep/Detector.h" + +// Geant 4 include files +#include "G4Step.hh" +#include "G4HCofThisEvent.hh" +#include "G4TouchableHistory.hh" +#include "G4VSensitiveDetector.hh" + +/* + * DD4hep namespace declaration + */ +namespace DD4hep { + + namespace Geometry { + struct LCDD; + }; + + /* + * Simulation namespace declaration + */ + namespace Simulation { + + struct Geant4SensitiveDetector : public G4VSensitiveDetector { + + typedef Geometry::LCDD LCDD; + typedef Geometry::Readout Readout; + typedef Geometry::DetElement DetElement; + + /// Reference to the detector description object + LCDD& m_lcdd; + /// Reference to the detector element describing this sensitive element + DetElement m_detector; + /// Reference to the readout structure + Readout m_readout; + + public: + /// Constructor + Geant4SensitiveDetector(const std::string& name, DetElement detector, LCDD& lcdd); + + /// Standard destructor + virtual ~Geant4SensitiveDetector(); + + /** Method invoked at the begining of each event. + * The hits collection(s) created by this sensitive detector must + * be set to the G4HCofThisEvent object at one of these two methods. + */ + virtual void Initialize(G4HCofThisEvent* HCE); + /// Method invoked at the end of each event. + virtual void EndOfEvent(G4HCofThisEvent* HCE); + + /// Method for generating hit(s) using the information of G4Step object. + virtual G4bool ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist) = 0; + + /// Method is invoked if the event abortion is occured. + virtual void clear(); + }; + } // End namespace Simulation +} // End namespace DD4hep + +#endif // DD4HEP_GEANT4SENSITIVEDETECTOR_H diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index ada85eb5d99b384c70ca0884d2dabf36b6a1e487..5b8ab0482f3b224f91bf35ab317aaab8b8c670a4 100644 Binary files a/DDG4/src/Geant4Converter.cpp and b/DDG4/src/Geant4Converter.cpp differ diff --git a/DDG4/src/Geant4SensitiveDetector.cpp b/DDG4/src/Geant4SensitiveDetector.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3791bb97823ffb57cdfca942aa7f1add17a53ccd --- /dev/null +++ b/DDG4/src/Geant4SensitiveDetector.cpp @@ -0,0 +1,43 @@ +// $Id:$ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Author : M.Frank +// +//==================================================================== + +#include "DDG4/Geant4SensitiveDetector.h" + +using namespace DD4hep; +using namespace DD4hep::Simulation; + +/// Constructor +Geant4SensitiveDetector::Geant4SensitiveDetector(const std::string& name, DetElement detector, LCDD& lcdd) + : G4VSensitiveDetector(name), m_detector(detector), m_lcdd(lcdd) +{ + m_readout = detector.readout(); + collectionName.insert("trackerCollection"); +} + +/// Standard destructor +Geant4SensitiveDetector::~Geant4SensitiveDetector() { +} + +/// Method invoked at the begining of each event. +void Geant4SensitiveDetector::Initialize(G4HCofThisEvent* HCE) { +} + +/// Method invoked at the end of each event. +void Geant4SensitiveDetector::EndOfEvent(G4HCofThisEvent* HCE) { +} + +/// Method for generating hit(s) using the information of G4Step object. +G4bool Geant4SensitiveDetector::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist) { +} + +/// Method is invoked if the event abortion is occured. +void Geant4SensitiveDetector::clear() { +} + +//DECLARE_TRANSLATION(LCDD2Geant4,create_g4);