10 #include "cetlib_except/exception.h" 15 #include "Geant4/G4VPhysicalVolume.hh" 16 #include "Geant4/G4GDMLParser.hh" 17 #include "Geant4/G4LogicalVolumeStore.hh" 18 #include "Geant4/G4Material.hh" 19 #include "Geant4/G4UniformMagField.hh" 20 #include "Geant4/G4FieldManager.hh" 31 bool const& overlapCheck,
32 bool const& validateSchema)
34 if ( gdmlFile.empty() ) {
35 throw cet::exception(
"DetectorConstruction") <<
"Supplied GDML filename is empty\n" 36 << __FILE__ <<
":" << __LINE__ <<
"\n";
43 parser.SetOverlapCheck(overlapCheck);
44 parser.Read(GDMLfile,validateSchema);
49 fWorld = parser.GetWorldVolume();
66 for(
auto fd : bField->
Fields()){
73 G4LogicalVolume *bvol = G4LogicalVolumeStore::GetInstance()->GetVolume(fd.fVolume);
76 G4UniformMagField* magField =
new G4UniformMagField( fd.fField * CLHEP::tesla );
82 <<
"Setting uniform magnetic field to be " 83 << magField->GetConstantFieldValue().x() <<
" " 84 << magField->GetConstantFieldValue().y() <<
" " 85 << magField->GetConstantFieldValue().z() <<
" " 86 <<
" in " << bvol->GetName();
98 <<
"Unknown or illegal Magneticfield " 101 <<
". Note that AutomaticBFieldMode is reserved.";
Build Geant4 geometry from GDML.
#define LOG_INFO(category)
virtual ~DetectorConstruction()
std::vector< MagneticFieldDescription > const & Fields() const
Describe the magnetic field structure of a detector.
#define LOG_ERROR(category)
DetectorConstruction(std::string const &gdmlFile, bool const &overlapCheck=false, bool const &validateSchema=true)
Standard constructor and destructor.
CommandLineParser * parser(0)
basic interface to Geant4 for ART-based software
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