CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/SimG4Core/Geometry/src/DDDWorld.cc

Go to the documentation of this file.
00001 #include "SimG4Core/Geometry/interface/DDDWorld.h"
00002 #include "SimG4Core/Geometry/interface/DDG4Builder.h"
00003 
00004 #include "DetectorDescription/Core/interface/DDCompactView.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 
00007 #include "G4RunManagerKernel.hh"
00008 #include "G4PVPlacement.hh"
00009  
00010 using namespace edm;
00011 
00012 DDDWorld::DDDWorld(const DDCompactView* cpv, 
00013                    G4LogicalVolumeToDDLogicalPartMap & map,
00014                    SensitiveDetectorCatalog & catalog,
00015                    bool check) {
00016 
00017   std::auto_ptr<DDG4Builder> theBuilder(new DDG4Builder(cpv, check));
00018 
00019   DDGeometryReturnType ret = theBuilder->BuildGeometry();
00020   G4LogicalVolume *    world = ret.logicalVolume();
00021   G4VPhysicalVolume *  pv = 
00022     new G4PVPlacement(0,G4ThreeVector(),world,"DDDWorld",0,false,0);
00023   SetAsWorld(pv);
00024   map     = ret.lvToDDLPMap();
00025   catalog = ret.sdCatalog();
00026 }
00027 
00028 DDDWorld::~DDDWorld() {}
00029 
00030 void DDDWorld::SetAsWorld(G4VPhysicalVolume * pv) {
00031   G4RunManagerKernel * kernel = G4RunManagerKernel::GetRunManagerKernel();
00032   if (kernel != 0) kernel->DefineWorldVolume(pv);
00033   edm::LogInfo("SimG4CoreGeometry") << " World volume defined ";
00034 }
00035