Newer
Older
// $Id$
//====================================================================
// AIDA Detector description implementation
//--------------------------------------------------------------------
//
// Author : M.Frank
//
//====================================================================
Pere Mato
committed
#include "DDG4/Geant4DetectorConstruction.h"
#include "DDG4/Geant4HierarchyDump.h"
Pere Mato
committed
#include "DDG4/Geant4Converter.h"
Pere Mato
committed
#include "DD4hep/LCDD.h"
#include "TGeoManager.h"
#include "G4PVPlacement.hh"
Pere Mato
committed
#ifdef GEANT4_HAS_GDML
#include "G4GDMLParser.hh"
#endif
using namespace std;
using namespace DD4hep;
using namespace DD4hep::Geometry;
DD4hep::Simulation::Geant4DetectorConstruction::Geant4DetectorConstruction(Geometry::LCDD& lcdd)
: m_outputLevel(PrintLevel(printLevel()-1)), m_lcdd(lcdd), m_world(0) {
}
DD4hep::Simulation::Geant4DetectorConstruction::Geant4DetectorConstruction(DD4hep::Simulation::Geant4Kernel& kernel)
: m_lcdd(kernel.lcdd()), m_world(0) {
m_outputLevel = kernel.getOutputLevel("Geant4Converter");
}
/// Default destructor
DD4hep::Simulation::Geant4DetectorConstruction::~Geant4DetectorConstruction() {
Pere Mato
committed
}
G4VPhysicalVolume* DD4hep::Simulation::Geant4DetectorConstruction::Construct() {
typedef Simulation::Geant4Converter Geant4Converter;
Geant4Mapping& g4map = Geant4Mapping::instance();
DetElement world = m_lcdd.world();
Geant4GeometryInfo* info = conv.create(world).detach();
Markus Frank
committed
g4map.attach(info);
m_world = info->world();
m_lcdd.apply("DD4hepVolumeManager", 0, 0);
// Create Geant4 volume manager
g4map.volumeManager();
//Geant4HierarchyDump dmp(m_lcdd);
//dmp.dump("",m_world);