26 #include "nutools/MagneticField/MagneticField.h" 28 #include "TGeoManager.h" 43 auto fieldDescriptions = pset.
get<std::vector<fhicl::ParameterSet> >(
"FieldDescriptions");
46 for(
auto itr : fieldDescriptions){
56 fieldDescription.fVolume = itr.get<
std::string>(
"MagnetizedVolume");
57 fieldDescription.fGeoVol = gGeoManager->FindVolumeFast(fieldDescription.fVolume.c_str());
60 if( fieldDescription.fGeoVol ==
nullptr )
62 <<
"cannot locat volume " 63 << fieldDescription.fVolume
64 <<
" in gGeoManager, bail";
68 std::vector<double> field = itr.get<std::vector<double> >(
"ConstantField");
72 for(
size_t i = 0; i < 3; ++i) fieldDescription.fField[i] = field[i];
86 double point[3] = { p.x(), p.y(), p.z() };
92 if(fd.fGeoVol->Contains(point))
return fd.fField;
96 return G4ThreeVector(0);
106 if (fd.fVolume.compare(volName) == 0)
return fd.fField;
110 return G4ThreeVector(0);
G4ThreeVector const FieldAtPoint(G4ThreeVector const &p=G4ThreeVector(0)) const
#define DEFINE_ART_SERVICE(svc)
std::vector< MagneticFieldDescription > fFieldDescriptions
Descriptions of the fields.
T get(std::string const &key) const
MagneticField(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
enum mag::MagneticFieldMode MagFieldMode_t
G4ThreeVector const UniformFieldInVolume(std::string const &volName) const
void reconfigure(fhicl::ParameterSet const &pset)
cet::coded_exception< error, detail::translate > exception