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

WIP: integrate DDG4's magnetic field.

parent 8aa102d8
No related branches found
No related tags found
No related merge requests found
...@@ -74,4 +74,13 @@ ...@@ -74,4 +74,13 @@
<!--include ref="Field_Solenoid_Map_s_4.0T.xml"/> <!--include ref="Field_Solenoid_Map_s_4.0T.xml"/>
<include ref="Field_AntiDID_Map_s.xml"/> <include ref="Field_AntiDID_Map_s.xml"/>
<include ref="Field_FwdMagnets_Ideal_1000GeV.xml"/--> <include ref="Field_FwdMagnets_Ideal_1000GeV.xml"/-->
<fields>
<field name="MagnetFields_Constant" type="ConstantField" field="magnetic">
<strength x="0" y="0" z="3.0*tesla"/>
</field>
</fields>
</lccdd> </lccdd>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "DD4hep/Plugins.h" #include "DD4hep/Plugins.h"
#include "DDG4/Geant4Converter.h" #include "DDG4/Geant4Converter.h"
#include "DDG4/Geant4Mapping.h" #include "DDG4/Geant4Mapping.h"
#include "DDG4/Geant4Field.h"
DECLARE_COMPONENT(AnExampleDetElemTool) DECLARE_COMPONENT(AnExampleDetElemTool)
...@@ -162,11 +162,16 @@ AnExampleDetElemTool::ConstructSDandField() { ...@@ -162,11 +162,16 @@ AnExampleDetElemTool::ConstructSDandField() {
G4FieldManager* fieldManager G4FieldManager* fieldManager
= G4TransportationManager::GetTransportationManager()->GetFieldManager(); = G4TransportationManager::GetTransportationManager()->GetFieldManager();
G4ThreeVector value(0,0,3.*tesla); // // Below is a uniform B-field
G4UniformMagField* aMagField = new G4UniformMagField(value); // G4ThreeVector value(0,0,3.*tesla);
// G4UniformMagField* mag_field = new G4UniformMagField(value);
// DDG4 based B-field
dd4hep::OverlayedField fld = lcdd->field();
G4MagneticField* mag_field = new dd4hep::sim::Geant4Field(fld);
fieldManager->SetDetectorField(aMagField); fieldManager->SetDetectorField(mag_field);
fieldManager->CreateChordFinder(aMagField); fieldManager->CreateChordFinder(mag_field);
} }
......
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