diff --git a/DDG4/plugins/Geant4FieldTrackingSetup.cpp b/DDG4/plugins/Geant4FieldTrackingSetup.cpp index b2ad82e30f47713ba927fc891b57586a268034b8..98ccab46023ab1af80108765fc234ab645e49fc9 100644 --- a/DDG4/plugins/Geant4FieldTrackingSetup.cpp +++ b/DDG4/plugins/Geant4FieldTrackingSetup.cpp @@ -57,6 +57,8 @@ namespace DD4hep { double eps_min; /// G4PropagatorInField parameter: eps_min double eps_max; + /// G4PropagatorInField parameter: LargestAcceptableStep + double largest_step; public: /// Default constructor @@ -187,6 +189,7 @@ Geant4FieldTrackingSetup::Geant4FieldTrackingSetup() : eq_typ(), stepper_typ() { delta_chord = -1.0; delta_one_step = -1.0; delta_intersection = -1.0; + largest_step = -1.0; } /// Default destructor @@ -218,6 +221,11 @@ int Geant4FieldTrackingSetup::execute(Geometry::LCDD& lcdd) { propagator->SetMinimumEpsilonStep(eps_min); if ( eps_max >= 0e0 ) propagator->SetMaximumEpsilonStep(eps_max); + if ( largest_step >= 0e0 ) { + propagator->SetLargestAcceptableStep(largest_step); + } else { + largest_step = propagator->GetLargestAcceptableStep(); + } return 1; } @@ -234,6 +242,7 @@ static long setup_fields(lcdd_t& lcdd, const DD4hep::Geometry::GeoHandler& /* cn if ( pm["delta_chord"] ) delta_chord = pm.toDouble("delta_chord"); if ( pm["delta_one_step"] ) delta_one_step = pm.toDouble("delta_one_step"); if ( pm["delta_intersection"] ) delta_intersection = pm.toDouble("delta_intersection"); + if ( pm["largest_step"] ) largest_step = pm.toDouble("largest_step"); } virtual ~XMLFieldTrackingSetup() {} } setup(vals); @@ -252,15 +261,18 @@ Geant4FieldTrackingSetupAction::Geant4FieldTrackingSetupAction(Geant4Context* ct declareProperty("delta_intersection", delta_intersection = -1.0); declareProperty("eps_min", eps_min = -1.0); declareProperty("eps_max", eps_max = -1.0); + declareProperty("largest_step", largest_step = -1.0); } /// Post-track action callback void Geant4FieldTrackingSetupAction::operator()() { execute(context()->lcdd()); - print("Geant4 magnetic field tracking configured. G4MagIntegratorStepper:%s G4Mag_EqRhs:%s " - "Epsilon:[min:%f mm max:%f mm] Delta:[chord:%f 1-step:%f intersect:%f]", - stepper_typ.c_str(),eq_typ.c_str(),eps_min, eps_max, - delta_chord,delta_one_step,delta_intersection); + printout( INFO, "FieldSetup", "Geant4 magnetic field tracking configured."); + printout( INFO, "FieldSetup", "G4MagIntegratorStepper:%s G4Mag_EqRhs:%s", + stepper_typ.c_str(), eq_typ.c_str()); + printout( INFO, "FieldSetup", "Epsilon:[min:%f mm max:%f mm]", eps_min, eps_max); + printout( INFO, "FieldSetup", "Delta:[chord:%f 1-step:%f intersect:%f] LargestStep %f mm", + delta_chord, delta_one_step, delta_intersection, largest_step); } @@ -276,15 +288,18 @@ Geant4FieldTrackingConstruction::Geant4FieldTrackingConstruction(Geant4Context* declareProperty("delta_intersection", delta_intersection = -1.0); declareProperty("eps_min", eps_min = -1.0); declareProperty("eps_max", eps_max = -1.0); + declareProperty("largest_step", largest_step = -1.0); } /// Post-track action callback void Geant4FieldTrackingConstruction::operator()() { execute(context()->lcdd()); - print("Geant4 magnetic field tracking configured. G4MagIntegratorStepper:%s G4Mag_EqRhs:%s " - "Epsilon:[min:%f mm max:%f mm] Delta:[chord:%f 1-step:%f intersect:%f]", - stepper_typ.c_str(),eq_typ.c_str(),eps_min, eps_max, - delta_chord,delta_one_step,delta_intersection); + printout( INFO, "FieldSetup", "Geant4 magnetic field tracking configured."); + printout( INFO, "FieldSetup", "G4MagIntegratorStepper:%s G4Mag_EqRhs:%s", + stepper_typ.c_str(), eq_typ.c_str()); + printout( INFO, "FieldSetup", "Epsilon:[min:%f mm max:%f mm]", eps_min, eps_max); + printout( INFO, "FieldSetup", "Delta:[chord:%f 1-step:%f intersect:%f] LargestStep %f mm", + delta_chord, delta_one_step, delta_intersection, largest_step); } DECLARE_GEANT4_SETUP(Geant4FieldSetup,setup_fields) diff --git a/DDG4/python/DDG4.py b/DDG4/python/DDG4.py index 94076704a60820a8014e31eb16a3284b07a0cf57..3e80c91f622383465d9e87b606bc78d19f78aa9f 100644 --- a/DDG4/python/DDG4.py +++ b/DDG4/python/DDG4.py @@ -508,6 +508,7 @@ class Geant4: field.delta_chord = 0.25*SystemOfUnits.mm field.delta_intersection = 1e-05*SystemOfUnits.mm field.delta_one_step = 0.001*SystemOfUnits.mm + field.largest_step = 10*SystemOfUnits.m if prt: print '+++++> ',field.name,'-> stepper = ',field.stepper print '+++++> ',field.name,'-> equation = ',field.equation @@ -517,6 +518,7 @@ class Geant4: print '+++++> ',field.name,'-> min_chord_step = ',field.min_chord_step,'[mm]' print '+++++> ',field.name,'-> delta_one_step = ',field.delta_one_step,'[mm]' print '+++++> ',field.name,'-> delta_intersection = ',field.delta_intersection,'[mm]' + print '+++++> ',field.name,'-> largest_step = ',field.largest_step,'[mm]' return field def setupPhysics(self,name): diff --git a/doc/LaTex/DDG4Manual-Setup.tex b/doc/LaTex/DDG4Manual-Setup.tex index 60dc4ce23db0ed3253ed07309a82595d8b2495b8..b4ec99e5af08f2c5c2dd4d309329a7c83055d20b 100644 --- a/doc/LaTex/DDG4Manual-Setup.tex +++ b/doc/LaTex/DDG4Manual-Setup.tex @@ -309,6 +309,7 @@ electromagnetic fields used in Geant4: delta_one_step="0.001*mm" eps_min="5e-05*mm" eps_max="0.001*mm" + largest_step = "10*m" stepper="HelixSimpleRunge" equation="Mag_UsualEqRhs"> </attributes>