11 #include "cetlib_except/exception.h" 17 #include "Geant4/G4VPhysicalVolume.hh" 18 #include "Geant4/G4GDMLParser.hh" 19 #include "Geant4/G4LogicalVolumeStore.hh" 20 #include "Geant4/G4Material.hh" 21 #include "Geant4/G4UniformMagField.hh" 22 #include "Geant4/G4FieldManager.hh" 33 bool const& overlapCheck,
34 bool const& validateSchema)
36 if ( gdmlFile.empty() ) {
37 throw cet::exception(
"DetectorConstruction") <<
"Supplied GDML filename is empty\n" 38 << __FILE__ <<
":" << __LINE__ <<
"\n";
45 parser.SetOverlapCheck(overlapCheck);
46 parser.Read(GDMLfile,validateSchema);
51 fWorld = parser.GetWorldVolume();
66 auto const * pProvider = bField->
provider();
69 for(
auto fd : pProvider->Fields()){
76 G4LogicalVolume *bvol = G4LogicalVolumeStore::GetInstance()->GetVolume(fd.fVolume);
79 G4UniformMagField* magField =
new G4UniformMagField( fd.fField * CLHEP::tesla );
85 <<
"Setting uniform magnetic field to be " 86 << magField->GetConstantFieldValue().x() <<
" " 87 << magField->GetConstantFieldValue().y() <<
" " 88 << magField->GetConstantFieldValue().z() <<
" " 89 <<
" in " << bvol->GetName();
102 G4LogicalVolume *bvol = G4LogicalVolumeStore::GetInstance()->GetVolume(fd.fVolume);
110 <<
"Setting magnetic field in kFieldRZMapMode to be" 111 <<
" in " << bvol->GetName();
121 G4LogicalVolume *bvol = G4LogicalVolumeStore::GetInstance()->GetVolume(fd.fVolume);
129 <<
"Setting magnetic field in kFieldXYZMapMode to be" 130 <<
" in " << bvol->GetName();
139 <<
"Unknown or illegal Magneticfield " 140 <<
"mode specified: " 142 <<
". Note that AutomaticBFieldMode is reserved.";
Build Geant4 geometry from GDML.
#define MF_LOG_ERROR(category)
virtual ~DetectorConstruction()
DetectorConstruction(std::string const &gdmlFile, bool const &overlapCheck=false, bool const &validateSchema=true)
Standard constructor and destructor.
virtual const mag::MagneticField * provider() const =0
CommandLineParser * parser(0)
basic interface to Geant4 for ART-based software
#define MF_LOG_INFO(category)
static G4FieldManager * fFieldMgr
pointer to the field manager
static G4VPhysicalVolume * fWorld
pointer to the world volume
G4VPhysicalVolume * Construct()
cet::coded_exception< error, detail::translate > exception