14 #include "TGeoManager.h" 34 auto fieldDescriptions = pset.
get<std::vector<fhicl::ParameterSet> >(
"FieldDescriptions");
37 for(
auto itr : fieldDescriptions){
45 fieldDescription.fVolume = itr.get<std::string>(
"MagnetizedVolume");
46 fieldDescription.fGeoVol = gGeoManager->FindVolumeFast(fieldDescription.fVolume.c_str());
48 if( fieldDescription.fGeoVol ==
nullptr )
50 <<
"cannot locat volume " 51 << fieldDescription.fVolume
52 <<
" in gGeoManager, bail";
55 std::vector<double> field = itr.get<std::vector<double> >(
"ConstantField");
59 for(
size_t i = 0; i < 3; ++i) fieldDescription.fField[i] = field[i];
73 double point[3] = { p.x(), p.y(), p.z() };
78 if(fd.fGeoVol->Contains(point))
return fd.fField;
81 return G4ThreeVector(0);
91 if (fd.fVolume.compare(volName) == 0)
return fd.fField;
95 return G4ThreeVector(0);
MagneticFieldStandard(fhicl::ParameterSet const &pset)
void reconfigure(fhicl::ParameterSet const &pset)
T get(std::string const &key) const
std::vector< MagneticFieldDescription > fFieldDescriptions
Descriptions of the fields.
G4ThreeVector const FieldAtPoint(G4ThreeVector const &p=G4ThreeVector(0)) const override
enum mag::MagneticFieldMode MagFieldMode_t
G4ThreeVector const UniformFieldInVolume(std::string const &volName) const override
cet::coded_exception< error, detail::translate > exception