10 #include "cetlib_except/exception.h" 12 #include "nutools/G4Base/DetectorConstruction.h" 13 #include "nutools/MagneticField/MagneticField.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";
39 const G4String GDMLfile =
static_cast<const G4String
>( gdmlFile );
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.";
G4VPhysicalVolume * Construct()
#define MF_LOG_ERROR(category)
DetectorConstruction(std::string const &gdmlFile, bool const &overlapCheck=false, bool const &validateSchema=true)
Standard constructor and destructor.
static G4VPhysicalVolume * fWorld
pointer to the world volume
std::vector< MagneticFieldDescription > const & Fields() const
virtual ~DetectorConstruction()
basic interface to Geant4 for ART-based software
#define MF_LOG_INFO(category)
cet::coded_exception< error, detail::translate > exception
static G4FieldManager * fFieldMgr
pointer to the field manager