From 912263b5532459f409b4b6fb29a8f211cf9ffe06 Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Fri, 20 Sep 2013 17:08:06 +0000 Subject: [PATCH] - updated exampleN04 to now use the standard Sds that come with it -> see SDWrapper.cc (exampleN04 now works) --- examples/noviceN04/Issues.txt | 8 ---- examples/noviceN04/compact/geant4.xml | 8 ++-- examples/noviceN04/run1.mac | 2 +- examples/noviceN04/src/SDWrapper.cc | 58 +++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 examples/noviceN04/src/SDWrapper.cc diff --git a/examples/noviceN04/Issues.txt b/examples/noviceN04/Issues.txt index 5e102245b..f3e97d482 100644 --- a/examples/noviceN04/Issues.txt +++ b/examples/noviceN04/Issues.txt @@ -21,12 +21,4 @@ - vis attribute drawingStyle="wireframe" does not seem to work (w/ geoDisplay ) - - definition of rotations not intuitive - need clear documentation: - Rotation rot( 0, 0 , phi ) - behaves differently from RotationZ(phi) !!?? - - - original G4VSensitiveDetector classes are not yet used in DD4hep port - => need to change DDG4/Geant4SensitiveDetector .... - - -> exampleN04 does not yet work (crashes due to missing SDs) diff --git a/examples/noviceN04/compact/geant4.xml b/examples/noviceN04/compact/geant4.xml index edffb935c..a4a9a5d68 100644 --- a/examples/noviceN04/compact/geant4.xml +++ b/examples/noviceN04/compact/geant4.xml @@ -3,19 +3,19 @@ <sensitive_detectors> <sd name="TrackerN04" - type="Geant4Tracker" + type="DD4hepExN04TrackerSD" ecut="1.0*keV" verbose="true" hit_aggregation="position"> </sd> <sd name="CalorimeterN04" - type="Geant4Calorimeter" + type="DD4hepExN04CalorimeterSD" ecut="0.5*keV" verbose="true" hit_aggregation="position"> </sd> - <sd name="MuonN04" - type="Geant4Calorimeter" + <sd name="MuonN04" + type="DD4hepExN04MuonSD" ecut="0.5*keV" verbose="true" hit_aggregation="position"> diff --git a/examples/noviceN04/run1.mac b/examples/noviceN04/run1.mac index 69ba6a2e1..3117e3b8c 100644 --- a/examples/noviceN04/run1.mac +++ b/examples/noviceN04/run1.mac @@ -10,7 +10,7 @@ # /run/verbose 0 /event/verbose 0 -/tracking/verbose 1 +/tracking/verbose 0 # # muon 300 MeV to the direction (1.,0.,0.) # 3 events diff --git a/examples/noviceN04/src/SDWrapper.cc b/examples/noviceN04/src/SDWrapper.cc new file mode 100644 index 000000000..8c713d274 --- /dev/null +++ b/examples/noviceN04/src/SDWrapper.cc @@ -0,0 +1,58 @@ +#include "DDG4/Factories.h" +#include "DDG4/G4SDFactory.h" +#include "DD4hep/LCDD.h" + +#include "ExN04CalorimeterSD.hh" +#include "ExN04CalorimeterROGeometry.hh" +#include "ExN04MuonSD.hh" +#include "ExN04TrackerSD.hh" + + +namespace DD4hep { namespace Simulation { + + + /** Factory class to create an instance of ExN04CalorimeterSD + */ + class DD4hepExN04CalorimeterSD : public DD4hep::Simulation::G4SDFactory { + public: + virtual G4VSensitiveDetector* createSD(const std::string& name, Geometry::LCDD& lcdd){ + + G4String calorimeterSDname = "/mydet/calorimeter"; + ExN04CalorimeterSD * calorimeterSD = new ExN04CalorimeterSD(calorimeterSDname); + G4String ROgeometryName = "CalorimeterROGeom"; + G4VReadOutGeometry* calRO = new ExN04CalorimeterROGeometry(ROgeometryName); + calRO->BuildROGeometry(); + calRO->SetName(ROgeometryName); + calorimeterSD->SetROgeometry(calRO); + return calorimeterSD ; + } + } ; + /** Factory class to create an instance of ExN04TrackerSD + */ + class DD4hepExN04TrackerSD : public DD4hep::Simulation::G4SDFactory{ + public: + virtual G4VSensitiveDetector* createSD(const std::string& name, Geometry::LCDD& lcdd){ + G4String trackerSDname = "/mydet/tracker"; + return new ExN04TrackerSD(trackerSDname); + } + } ; + + /** Factory class to create an instance of ExN04MuonSD + */ + class DD4hepExN04MuonSD : public DD4hep::Simulation::G4SDFactory{ + public: + virtual G4VSensitiveDetector* createSD(const std::string& name, Geometry::LCDD& lcdd){ + G4String muonSDname = "/mydet/muon"; + return new ExN04MuonSD(muonSDname); + } + } ; + + + } +} // End namespace DD4hep::Simulation + +DECLARE_G4SDFACTORY(DD4hepExN04CalorimeterSD) +DECLARE_G4SDFACTORY(DD4hepExN04MuonSD) +DECLARE_G4SDFACTORY(DD4hepExN04TrackerSD) + + -- GitLab