// AK20110616 Class to implement a 3D field map // Modified from BLCMDfieldmap.cc from G4beamline v2.03 // // #include #include "IFieldMap.hxx" #include "IFieldMapDescription.hxx" #include namespace COMET { IFieldMap::IFieldMap(std::string mapFileName, Double_t scaling, Double_t gradient, Double_t timeOffset, TVector3 translation, TRotation rotation) : IElementField(translation,rotation),fFilename(mapFileName) ,fScaling(scaling), fGradient(gradient), fTimeOffset(timeOffset){ fMap = new IBLFieldMap(); fIsGood = fMap->readFile(mapFileName); if(fIsGood){ //Set fBoundingBox to be the extent of the field map fMap->getBoundingBox(fBoundingBox); } } IFieldMap::~IFieldMap() { delete fMap; } void IFieldMap::getFieldValue(const Double_t LocalPoint[4], Double_t LocalField[6]) const { fMap->getFieldValue(LocalPoint,LocalField,fScaling,fGradient); } IHandle IFieldMap::MakeDescription(){ return IHandle( new IFieldMapDescription( fFilename,fScaling,fGradient,fTimeOffset, GetTranslation(),GetRotation() )); } }