// Test to load field map and dump out field at a point #include #include //#include //#include #include "ICOMETLog.hxx" #include "IFieldManager.hxx" #include "IFieldMap.hxx" #include "Rtypes.h" #include"TVector3.h" #include "TRotation.h" /* #include "G4Material.hh" #include "G4Box.hh" #include "G4LogicalVolume.hh" #include "G4PhysicalConstants.hh" #include "G4SystemOfUnits.hh" */ int main(int argc,char** argv) { COMET::ICOMETLog::Configure(); COMETLog("Field Map Test"); COMET::IFieldManager* theGlobalField = COMET::IFieldManager::getObject(); // Add a field map std::string filename="defaultFieldMap.dat"; // G4Box* fieldSolid = new G4Box("fieldSolid", 1.0*m,1.0*m,1.0*m); // G4Material* Vacuum = new G4Material("Vacuum",1.,1.0,1.0); // G4LogicalVolume* container = new G4LogicalVolume(fieldSolid,Vacuum,"container"); //G4RotationMatrix rotMat = G4RotationMatrix(G4ThreeVector(1,0,0),G4ThreeVector(0,1,0),G4ThreeVector(0,0,1)); COMET::IFieldMap* aFieldMap = new COMET::IFieldMap(filename,1.0,1.0,0.0,TVector3(0,0,0),TRotation()); // Get field at a point Double_t point[3]; Double_t field[6]; point[0]=point[1]=point[2]=0.; theGlobalField->GetFieldValue(point,field); COMETLog("field is " << field[0]/unit::tesla << ", "<< field[1]/unit::tesla << ", "<< field[2]/unit::tesla ); return 0; }