Skip to content
Snippets Groups Projects
Commit 8aa102d8 authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: hardcode a uniform magnetic field.

parent 82fa4a08
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,11 @@
#include "G4PhysicalVolumeStore.hh"
#include "G4OpticalSurface.hh"
// Field
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "DD4hep/Detector.h"
#include "DD4hep/Plugins.h"
#include "DDG4/Geant4Converter.h"
......@@ -143,6 +148,26 @@ AnExampleDetElemTool::ConstructSDandField() {
}
}
// =======================================================================
// Construct Field
// =======================================================================
// TODO: integrate the field between DD4hep and Geant4
// Note:
// DD4hep provides the parameters of fields
// Geant4 will setup the field based on the DD4hep fields
// Related Examples:
// - G4: G4GlobalMagFieldMessenger.cc
G4FieldManager* fieldManager
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
G4ThreeVector value(0,0,3.*tesla);
G4UniformMagField* aMagField = new G4UniformMagField(value);
fieldManager->SetDetectorField(aMagField);
fieldManager->CreateChordFinder(aMagField);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment