From f367f15e376f34ffed427b22362681faf2cfef0f Mon Sep 17 00:00:00 2001
From: nnitika <nnitika@cern.ch>
Date: Tue, 12 Mar 2024 14:19:50 +0100
Subject: [PATCH] ATLFieldManager

---
 FullSimLight/include/ATLFieldManager.hh |  23 +-
 FullSimLight/src/ATLFieldManager.cc     | 365 +++++++++---------------
 2 files changed, 140 insertions(+), 248 deletions(-)

diff --git a/FullSimLight/include/ATLFieldManager.hh b/FullSimLight/include/ATLFieldManager.hh
index 4b500c348..81b0f9bcc 100644
--- a/FullSimLight/include/ATLFieldManager.hh
+++ b/FullSimLight/include/ATLFieldManager.hh
@@ -58,6 +58,10 @@ public:
     ParameterSet(const std::unordered_map<std::string, double>& params)
         : parameters(params) {}
 
+    void setDoubleParameter(const std::string& key, double value) {
+        parameters[key] = value;
+    }
+
     double getDoubleParameter(const std::string& key) const {
         auto it = parameters.find(key);
         return (it != parameters.end()) ? it->second : 0.0;
@@ -89,12 +93,12 @@ public:
     ATLFieldManager(const ATLFieldManager&) = delete;
     ATLFieldManager(ATLFieldManager&&) = delete;
     ATLFieldManager& operator=(const ATLFieldManager&) = delete;
-    ATLFieldManager &operator=(ATLFieldManager &&) =delete;
-    virtual ~ATLFieldManager();
-    
-    virtual void ConfigureForTrack(const G4Track*) override;
+    //ATLFieldManager &operator=(ATLFieldManager &&) =delete;
+    ~ATLFieldManager();
+
+    void ConfigureForTrack(const G4Track*) override;
         
-    void InitialiseForVolume(const ParameterSet& params,
+    void InitialiseForVolume( ParameterSet& params,
                              atl::G4Field* field,
                              G4ChordFinder* cfDefault,
                              G4ChordFinder *cfTracker,  
@@ -131,12 +135,11 @@ private:
     void setDefaultChordFinder();
     void setChordFinderForTracker();
     void setChordFinderForBeampipe();
-<<<<<<< HEAD
-=======
-    void ConfigureForTrack(const G4Track*) ;
 
-    void printParameters(const std::string& region);
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
+  //  void ConfigureForTrack(const G4Track*) ;
+
+   // void printParameters(const std::string& region);
+
 
     void printParameters(const std::string& regionName);
     void printParametersForBeampipe(const std::string& regionName);
diff --git a/FullSimLight/src/ATLFieldManager.cc b/FullSimLight/src/ATLFieldManager.cc
index 38e5ce5d4..d01c07822 100644
--- a/FullSimLight/src/ATLFieldManager.cc
+++ b/FullSimLight/src/ATLFieldManager.cc
@@ -2,20 +2,17 @@
 #include "ATLFieldManager.hh"
 #include "G4FieldManager.hh"
 #include "G4Types.hh"
-
 #include "FSLDetectorConstruction.hh"
 #include "FSLDetectorMessenger.hh"
 #include "RegionConfigurator.hh"
 #include "FullSimLight/MagFieldPlugin.h"
 #include "MassCalculator.hh"
 #include "ClashDetector.hh"
-
 // Geant4 includes
 #include "G4Version.hh"
 #include "globals.hh"
 #include "G4SystemOfUnits.hh"
 #include "G4VisAttributes.hh"
-
 #include "G4UniformMagField.hh"
 #include "G4QuadrupoleMagField.hh"
 #include "G4FieldManager.hh"
@@ -36,42 +33,12 @@
 #include "G4VIntegrationDriver.hh"
 #include "G4FSALIntegrationDriver.hh"
 #include "G4VFSALIntegrationStepper.hh"
-#include "G4RK547FEq1.hh"
-#include "G4NystromRK4.hh"
-
 // New FSAL type driver / steppers -----
 #include "G4IntegrationDriver.hh"
 #include "G4InterpolationDriver.hh"
 #include "G4HelixHeum.hh"
 #include "G4BFieldIntegrationDriver.hh"
-
 #include <cassert>
-// Geant4 steppers
-#if G4VERSION_NUMBER>=1040
-#include "G4BogackiShampine23.hh"
-#include "G4BogackiShampine45.hh"
-#include "G4DoLoMcPriRK34.hh"
-#include "G4DormandPrince745.hh"
-#include "G4DormandPrinceRK56.hh"
-#include "G4DormandPrinceRK78.hh"
-#include "G4RK547FEq1.hh"
-#include "G4RK547FEq2.hh"
-#include "G4RK547FEq3.hh"
-#include "G4TsitourasRK45.hh"
-#include "G4VIntegrationDriver.hh"
-#include "G4IntegrationDriver.hh"
-#endif
-#if G4VERSION_NUMBER>=1060
-#include "G4InterpolationDriver.hh"
-#endif
-#include "G4CashKarpRKF45.hh"
-#include "G4ClassicalRK4.hh"
-#include "G4FieldManager.hh"
-#include "G4HelixExplicitEuler.hh"
-#include "G4HelixImplicitEuler.hh"
-//#include "G4HelixBeampipeRunge.hh"
-#include "G4NystromRK4.hh"
-#include "G4RKG3_Stepper.hh"
 // **** INCLUDES for GeoModel
 #include "GeoModelRead/ReadGeoModel.h"
 #include "GeoModel2G4/ExtParameterisedVolumeBuilder.h"
@@ -91,17 +58,8 @@
 #include "G4SDManager.hh"
 #include "G4UIcommand.hh"
 #include <iomanip>
-//#include "G4ChordFinder.hh"
 #include "G4SystemOfUnits.hh"
 #include "G4MagneticField.hh"
-#include "G4Mag_UsualEqRhs.hh"
-#include "G4MagIntegratorDriver.hh"
-#include "G4DormandPrince745.hh"
-// New FSAL type driver / steppers -----
-#include "G4FSALIntegrationDriver.hh"
-#include "G4VFSALIntegrationStepper.hh"
-#include "G4RK547FEq1.hh"
-#include "G4NystromRK4.hh"
 // New FSAL type driver / steppers -----
 #include "G4IntegrationDriver.hh"
 #include "G4InterpolationDriver.hh"
@@ -112,11 +70,7 @@
 #include "G4StepLimiter.hh"
 //#include "StepMax.hh"
 #include <cassert>
-<<<<<<< HEAD
 #include "HistoManager.hh"
-=======
-
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
 #include "G4RegionStore.hh"
 #include "G4Region.hh"
 #include "G4Track.hh"
@@ -127,7 +81,6 @@
 #include "G4Step.hh"
 #include "G4ThreeVector.hh"
 ////////
-
 #include "G4ChordFinder.hh"
 #include "G4MagIntegratorStepper.hh"
 #include "G4PropagatorInField.hh"
@@ -140,51 +93,35 @@
 #include "G4FieldManagerStore.hh"
 
 ATLFieldManager::ATLFieldManager() 	
-    : G4FieldManager(),  // G4FieldManager is the base class 
-      m_currChordFinder(nullptr),
-      m_chordFinder(nullptr),
-      m_propagator(nullptr),
-      m_dChordDefault(0.25),	//Default
-      m_dIntersectionDefault(0.002),
-      m_dOneStepDefault(0.01),
-      m_stepMaxDefault(1000.), ////limit
-      m_dChordTracker(0.0001),	//Tracker					
-      m_dIntersectionTracker(0.0004),					
-      m_dOneStepTracker(0.001),
-      m_stepMaxTracker(100.),
-
-      m_Rmax2(1.e+6),	//10 meter	
-      m_Zmax(3.e+3),	//0.3 meter
-
-<<<<<<< HEAD
-      m_energyThTracker(0.0),	//0.2 GeV				
-      m_energyThreshold(0.0),	// EnergyThSimple = cms.double(0.015),    ## in GeV
-=======
-
-      m_energyThTracker(0.0),					
-      m_energyThreshold(0.0),
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
-
-      m_dChordBeampipe(0.002),	//Beampipe
-      m_dIntersectionBeampipe(0.003),
-      m_dOneStepBeampipe(0.02),
-      m_stepMaxBeampipe(1000.0),
-      
-      m_cfTracker(false),					
-<<<<<<< HEAD
-      m_cfBeampipe(false) {}						
-=======
-      m_cfBeampipe(false) {
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
-       
-ATLFieldManager::~ATLFieldManager() = default;
-//       ATLFieldManager::~ATLFieldManager() {	
- // if (m_chordFinder != m_currChordFinder) {
-  //  delete m_chordFinder;
-//  }
-//}
-
-void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
+   : G4FieldManager(),  // G4FieldManager base class 
+   m_currChordFinder(nullptr),
+   m_chordFinder(nullptr),
+   m_propagator(nullptr),
+   m_dChordDefault(0.25),	//Default
+   m_dIntersectionDefault(0.002),
+   m_dOneStepDefault(0.01),
+   m_stepMaxDefault(1000.), ////limit
+   m_dChordTracker(0.0001),	//Tracker					
+   m_dIntersectionTracker(0.0004),					
+   m_dOneStepTracker(0.001),
+   m_stepMaxTracker(100.),
+   m_Rmax2(1.e+6),	//10 meter	
+   m_Zmax(3.e+3),	//0.3 meter
+   m_energyThTracker(0.0),	//0.2 GeV				
+   m_energyThreshold(0.0),	// EnergyThSimple = cms.double(0.015),    ## in GeV
+   m_dChordBeampipe(0.002),	//Beampipe
+   m_dIntersectionBeampipe(0.003),
+   m_dOneStepBeampipe(0.02),
+   m_stepMaxBeampipe(1000.0),
+   m_cfTracker(false),					
+   m_cfBeampipe(false)		{}			
+
+ATLFieldManager::~ATLFieldManager(){	
+   if (m_chordFinder != m_currChordFinder) {
+   delete m_chordFinder;
+   }
+}
+void ATLFieldManager::InitialiseForVolume( ParameterSet &params,
                                           atl::G4Field* field,
                                           G4ChordFinder* cfDefault,
                                           G4ChordFinder *cfTracker,  
@@ -194,75 +131,56 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
                                          // const std::string& stepperName,
                                         //  double delta,
                                           G4PropagatorInField* pf) {
- 
-   double minstep = params.getDoubleParameter("Minstep") * CLHEP::mm;		//define or intilize in 1st section with other parameters
+   //define key values- string & double                                          
+ 	params.setDoubleParameter("Minstep", 0.1);
+   params.setDoubleParameter("MinimumEpsilonStep", 1e-05);
+   params.setDoubleParameter("MaximumEpsilonStep", 0.01);
+   params.setDoubleParameter("MaximumLoopCounts", 1000);
+   params.setDoubleParameter("DeltaChordTracker", 0.0001);   //Tracker
+   params.setDoubleParameter("DeltaIntersectionTracker",0.0004);
+   params.setDoubleParameter("DeltaOneStepTracker", 0.001);
+   params.setDoubleParameter("MaxStepTracker", 100.0);
+   params.setDoubleParameter("DeltaChordBeampipe", 0.002);  //Beampipe
+   params.setDoubleParameter("DeltaIntersectionBeampipe",0.003);
+   params.setDoubleParameter("DeltaOneStepBeampipe", 0.02);
+   params.setDoubleParameter("MaxStepBeampipe",1000.0);
+   params.setDoubleParameter("DeltaChordDefault", 0.25); //Default
+   params.setDoubleParameter("DeltaIntersectionDefault",0.002);
+   params.setDoubleParameter("DeltaOneStepDefault", 0.01);
+   params.setDoubleParameter("MaxStepDefault", 1000.0);
+   params.setDoubleParameter("EnergyThTracker", 0.2);
+   params.setDoubleParameter("EnergyThBeampipe", 0.5);
+   params.setDoubleParameter("EnergyThreshold", 0.015);
+   params.setDoubleParameter("Rmax2", 8000);   //others
+   params.setDoubleParameter("Zmax", 12000);   
+
+   double minstep = params.getDoubleParameter("Minstep") * CLHEP::mm;
    double minEpsStep = params.getDoubleParameter("MinimumEpsilonStep") * CLHEP::mm;
    double maxEpsStep = params.getDoubleParameter("MaximumEpsilonStep") * CLHEP::mm;
-   //int maxLC = static_cast<int>(params.getDoubleParameter("MaximumLoopCounts", 1000));
-   int maxLC = static_cast<int>(params.getDoubleParameter("MaximumLoopCounts"));  // Assuming "MaximumLoopCounts" is the parameter name
-//overwrite
-    minstep =  0.1 * CLHEP::mm;		//define or intilize in 1st section with other parameters
-    minEpsStep = 1e-05 * CLHEP::mm;
-    maxEpsStep =  0.01 * CLHEP::mm;
-    maxLC = 10 ;  // Assuming "MaximumLoopCounts" is the parameter name
-   // Tracker
-   m_dChordTracker = params.getDoubleParameter("DeltaChordTracker") * CLHEP::mm;					
+   int maxLC = static_cast<int>(params.getDoubleParameter("MaximumLoopCounts"));  
+   m_dChordTracker = params.getDoubleParameter("DeltaChordTracker") * CLHEP::mm;		 // Tracker			
    m_dIntersectionTracker = params.getDoubleParameter("DeltaIntersectionTracker") * CLHEP::mm;		
    m_dOneStepTracker = params.getDoubleParameter("DeltaOneStepTracker") * CLHEP::mm;					
    m_stepMaxTracker = params.getDoubleParameter("MaxStepTracker") * CLHEP::cm;
-//overwrite
-//m_dChordTracker = params.getDoubleParameter("DeltaChordTracker") * CLHEP::mm;
-   m_dChordTracker = 0.0001 * CLHEP::mm;  // This line sets a fixed value of 15.0 mm
-   m_dIntersectionTracker = 0.0004* CLHEP::mm;
-   m_dOneStepTracker = 0.001 * CLHEP::mm;					
-   m_stepMaxTracker = 100.0 * CLHEP::cm;
-
-   //Beampipe
-   m_dChordBeampipe = params.getDoubleParameter("DeltaChordBeampipe") * CLHEP::mm;
+   m_dChordBeampipe = params.getDoubleParameter("DeltaChordBeampipe") * CLHEP::mm;   //Beampipe
    m_dIntersectionBeampipe = params.getDoubleParameter("DeltaIntersectionBeampipe") * CLHEP::mm;
    m_dOneStepBeampipe = params.getDoubleParameter("DeltaOneStepBeampipe") * CLHEP::mm;
-   m_stepMaxBeampipe = params.getDoubleParameter("MaxStepBeampipe") * CLHEP::cm; 
-   //overwrite
-   m_dChordBeampipe = 0.002 * CLHEP::mm;
-   m_dIntersectionBeampipe = 0.003 * CLHEP::mm;
-   m_dOneStepBeampipe = 0.02 * CLHEP::mm;
-   m_stepMaxBeampipe = 1000.0 * CLHEP::cm;    
-   
-   //Default
-   m_dChordDefault = params.getDoubleParameter("DeltaChordDefault") * CLHEP::mm;	
+   m_stepMaxBeampipe = params.getDoubleParameter("MaxStepBeampipe") * CLHEP::cm;   
+   m_dChordDefault = params.getDoubleParameter("DeltaChordDefault") * CLHEP::mm;	  //Default
    m_dIntersectionDefault = params.getDoubleParameter("DeltaIntersectionDefault") * CLHEP::mm;
    m_dOneStepDefault = params.getDoubleParameter("DeltaOneStepDefault") * CLHEP::mm;
    m_stepMaxDefault = params.getDoubleParameter("MaxStepDefault") * CLHEP::cm;
-   //overwrite
-   m_dChordDefault = 0.25 * CLHEP::mm;	
-   m_dIntersectionDefault =  0.002 * CLHEP::mm;
-   m_dOneStepDefault = 0.01 * CLHEP::mm;
-   m_stepMaxDefault =  1000.0 * CLHEP::cm;
-    
    m_energyThreshold = params.getDoubleParameter("EnergyThBeampipe") * CLHEP::GeV;	//...check if ....
    m_energyThTracker = params.getDoubleParameter("EnergyThTracker") * CLHEP::GeV;
-   //overwrite   
-   m_energyThreshold = 0.015 * CLHEP::GeV;	//...check if ....
-   m_energyThTracker = 0.2 * CLHEP::GeV;					
- 
    double rmax = params.getDoubleParameter("Rmax") * CLHEP::mm;					
    m_Rmax2 = rmax * rmax;
-<<<<<<< HEAD
    m_Zmax = params.getDoubleParameter("Zmax") * CLHEP::mm;	
-  //overwrite      
-      m_Rmax2= 8000 * CLHEP::mm;	//10 meter	
-      m_Zmax = 12000 * CLHEP::mm;			
-=======
-   m_Zmax = params.getDoubleParameter("Zmax") * CLHEP::mm;
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
- 
+   			
    std::cout << "is it workinggggggggg!" ">\n"
-   //edm::LogVerbatim("")
-    //G4cout
-       << " New ATLFieldManager: LogicalVolume:      <" << vol << ">\n"
- //      << "               Stepper                   <" << stepperName << ">\n"	//define
-  //     << "               Field type                 <" << fieldType << ">\n"	//define
-  //     << "               Field const delta           " << delta << " mm\n"
+       << " New ATLFieldManager: LogicalVolume:      <" << vol << ">\n" //yet to include
+   //  << "               Stepper                   <" << stepperName << ">\n"	//define
+   //  << "               Field type                 <" << fieldType << ">\n"	//define
+   //  << "               Field const delta           " << delta << " mm\n"
        << "               MaximumLoopCounts           " << maxLC << "\n"
        << "               MinimumEpsilonStep          " << minEpsStep << "\n"
        << "               MaximumEpsilonStep          " << maxEpsStep << "\n"
@@ -290,35 +208,11 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
    m_chordFinderBeamPipe = cfBeamPipe;
    m_propagator = pf;
 
-
-std::cout << "ccccccc" << ">\n";
+   std::cout << "ccccccc" << ">\n";
 
     // initialisation of field manager
    theField.reset(field);
    SetDetectorField(field);  //here
-  
-   std::cout << "ddd" ">\n";
-
-  // SetMinimumEpsilonStep(minEpsStep);
-  // SetMaximumEpsilonStep(maxEpsStep);
-  std::cout << "eeee" ">\n";
-   // propagater in field
-
-//G4PropagatorInField* m_propagator = G4TransportationManager::GetTransportationManager()->GetPropagatorInField();
-//m_propagator = pf;
-
-/*void ATLFieldManager::SetMinimumEpsilonStep(G4double newEpsMin) {
-    m_minEpsStep = newEpsMin;
-
-    // Assuming m_propagator is your G4PropagatorInField member
-    if (m_propagator != nullptr) {
-        // Set the minimum epsilon step using the G4PropagatorInField member function
-        m_propagator->SetMinimumEpsilonStep(newEpsMin);
-    }
-    // Handle the case where m_propagator is nullptr if needed
-}	*/
-
-
    // ////add or eliminate
    if (pf != nullptr) {
     pf->SetMaxLoopCount(maxLC);
@@ -326,11 +220,11 @@ std::cout << "ccccccc" << ">\n";
     pf->SetMaximumEpsilonStep(maxEpsStep);
 } else {
     std::cout << "Error: propagator (pf) is a null pointer." << std::endl;
-    return; //  throw an exception
+    return; //  throw an exception..check that
 }
     std::cout << "pf" ">\n";
    // define regions
-   std::vector<std::string> rnames = params.getParameter<std::vector<std::string>>("WorldLog");	//VacRegions N.A.
+   std::vector<std::string> rnames = params.getParameter<std::vector<std::string>>("WorldLog");	//VacRegions N.A. volumes N.A.
    //std::vector<std::string> rnames = params.getStringParameter("VacRegions");
    if (!rnames.empty()) {
      std::stringstream ss;
@@ -343,45 +237,10 @@ std::cout << "ccccccc" << ">\n";
          }
        }
      }
-  //    std::cout << "Beampipe field integration in G4Regions....is it workinggggggggg!" << std::endl;
-      std::cout << "Beampipe field integration in G4Regions:\n" << ss.str() << "\n";
-//edm::LogVerbatim("SimG4CoreApplication") << "Beampipe field integration in G4Regions:\n" << ss.str() << "\n";// edm - CMS, modify
+     std::cout << "Beampipe field integration in G4Regions:\n" << ss.str() << "\n";
    }
    std::cout << "is it workinggggggggg!" << std::endl;
  }
-<<<<<<< HEAD
- 
-=======
-
- /*
->>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
- void ATLFieldManager::ConfigureForTrack(const G4Track *track) {
-   // run time parameters per track
-   if (track->GetKineticEnergy() > m_energyThTracker && isInsideTracker(track)) {					//tracker* !!?
-     if (!m_cfTracker) {					
-       setChordFinderForTracker();					
-     }
- 
-<<<<<<< HEAD
-   } else if (track->GetKineticEnergy() <= m_energyThreshold || isInsideVacuum(track)) {					//beampipe*
-=======
-   } else if (track->GetKineticEnergy() <= m_energyThreshold || isInsideBeampipe(track)) {					//beampipe*
->>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
-     if (!m_cfBeampipe) {					//beampipe*
-       setChordFinderForBeampipe();					//beampipe*
-     }
- 
-   } else if (m_cfTracker || m_cfBeampipe) {				//tracker* !!?		//beampipe*
-     // restore defaults
-     setDefaultChordFinder();
-   }
- }
-<<<<<<< HEAD
- 
- bool ATLFieldManager::isInsideVacuum(const G4Track *track) {					//beampipe*
-=======
-*/
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
   void ATLFieldManager::ConfigureForTrack(const G4Track *track) {
    // run time parameters per track
    if (track->GetKineticEnergy() > m_energyThTracker && isInsideTracker(track)) {
@@ -413,17 +272,9 @@ std::cout << "ccccccc" << ">\n";
      }
    }
    return false;
-<<<<<<< HEAD
+
  }	*/
-  bool ATLFieldManager::isInsideBeampipe(const G4Track *track) {
-=======
- }
-<<<<<<< HEAD
- 
-=======
- */
  bool ATLFieldManager::isInsideBeampipe(const G4Track *track) {
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
    if (!m_regions.empty()) {
       const G4Region *reg = track->GetVolume()->GetLogicalVolume()->GetRegion();
 
@@ -439,7 +290,6 @@ std::cout << "ccccccc" << ">\n";
    }
    return false;
 }
-
 bool ATLFieldManager::isInsideTracker(const G4Track *track) {
    const G4ThreeVector &pos = track->GetPosition();
    const double x = pos.x();
@@ -457,27 +307,15 @@ bool ATLFieldManager::isInsideTracker(const G4Track *track) {
       }
    }
    return false;
-<<<<<<< HEAD
-}	/*
-=======
-}
-*/
+}	
  /*
->>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
  bool ATLFieldManager::isInsideTracker(const G4Track *track) {					//tracker* !!?
    const G4ThreeVector &pos = track->GetPosition();
    const double x = pos.x();
    const double y = pos.y();
    return (x * x + y * y < m_Rmax2 && std::abs(pos.z()) < m_Zmax);
-<<<<<<< HEAD
- }	 */
-=======
- }
-
- */
 
->>>>>>> 6b405a9246dbe177ebe3381b65003bcd666d7d18
+ }	 */
  void ATLFieldManager::setDefaultChordFinder() {
    if (m_currChordFinder != m_chordFinder) {
      m_currChordFinder = m_chordFinder;
@@ -489,8 +327,7 @@ bool ATLFieldManager::isInsideTracker(const G4Track *track) {
    m_propagator->SetLargestAcceptableStep(m_stepMaxDefault);
    m_cfBeampipe = m_cfTracker = false;					
  }
- 
- void ATLFieldManager::setChordFinderForTracker() {
+  void ATLFieldManager::setChordFinderForTracker() {
    if (m_currChordFinder != m_chordFinder) {
      m_currChordFinder = m_chordFinder;
      SetChordFinder(m_currChordFinder);
@@ -502,8 +339,7 @@ bool ATLFieldManager::isInsideTracker(const G4Track *track) {
    m_cfBeampipe = false;					
    m_cfTracker = true;					
  }
- 
- void ATLFieldManager::setChordFinderForBeampipe() {
+  void ATLFieldManager::setChordFinderForBeampipe() {
    if (m_currChordFinder != m_chordFinder) {
      m_currChordFinder = m_chordFinder;
      SetChordFinder(m_currChordFinder);
@@ -515,8 +351,6 @@ bool ATLFieldManager::isInsideTracker(const G4Track *track) {
    m_cfBeampipe = true;
    m_cfTracker = false;					
  }
-
-
 void ATLFieldManager::printParameters(const std::string& regionName) {
    std::cout << "DeltaChord: " << ((regionName == "Pixel" || regionName == "SCT" || regionName == "TRT") ? m_dChordTracker : m_dChordBeampipe) << " mm\n";
    std::cout << "DeltaOneStep: " << ((regionName == "Pixel" || regionName == "SCT" || regionName == "TRT") ? m_dOneStepTracker : m_dOneStepBeampipe) << " mm\n";
@@ -547,4 +381,59 @@ bool ATLFieldManager::isInsideTracker(const G4Track *track) {
 
    return false;
 }	*/
+   /*overwrite
+    minstep =  0.1 * CLHEP::mm;		//define or intilize in 1st section with other parameters
+    minEpsStep = 1e-05 * CLHEP::mm;
+    maxEpsStep =  0.01 * CLHEP::mm;
+    maxLC = 10 ;  // Assuming "MaximumLoopCounts" is the parameter name 
+   m_dChordTracker = 0.0001 * CLHEP::mm;  
+   m_dIntersectionTracker = 0.0004* CLHEP::mm;
+   m_dOneStepTracker = 0.001 * CLHEP::mm;					
+   m_stepMaxTracker = 100.0 * CLHEP::cm;
+      m_dChordBeampipe = 0.002 * CLHEP::mm;
+   m_dIntersectionBeampipe = 0.003 * CLHEP::mm;
+   m_dOneStepBeampipe = 0.02 * CLHEP::mm;
+   m_stepMaxBeampipe = 1000.0 * CLHEP::cm; 
+   m_stepMaxDefault =  1000.0 * CLHEP::cm;
+   m_energyThreshold = 0.015 * CLHEP::GeV;	//...check if ....
+   m_energyThTracker = 0.2 * CLHEP::GeV;	
+         m_Rmax2= 8000 * CLHEP::mm;	//10 meter	
+      m_Zmax = 12000 * CLHEP::mm;   */
+//G4PropagatorInField* m_propagator = G4TransportationManager::GetTransportationManager()->GetPropagatorInField();
+//m_propagator = pf;
+
+/*void ATLFieldManager::SetMinimumEpsilonStep(G4double newEpsMin) {
+    m_minEpsStep = newEpsMin;
 
+    // Assuming m_propagator is your G4PropagatorInField member
+    if (m_propagator != nullptr) {
+        // Set the minimum epsilon step using the G4PropagatorInField member function
+        m_propagator->SetMinimumEpsilonStep(newEpsMin);
+    }
+   
+}	*/
+ /*
+ void ATLFieldManager::ConfigureForTrack(const G4Track *track) {
+   // run time parameters per track
+   if (track->GetKineticEnergy() > m_energyThTracker && isInsideTracker(track)) {					//tracker* !!?
+     if (!m_cfTracker) {					
+       setChordFinderForTracker();					
+     }
+ 
+   } else if (track->GetKineticEnergy() <= m_energyThreshold || isInsideVacuum(track)) {					//beampipe*
+=======
+   } else if (track->GetKineticEnergy() <= m_energyThreshold || isInsideBeampipe(track)) {					//beampipe*
+>>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
+     if (!m_cfBeampipe) {					//beampipe*
+       setChordFinderForBeampipe();					//beampipe*
+     }
+ 
+   } else if (m_cfTracker || m_cfBeampipe) {				//tracker* !!?		//beampipe*
+     // restore defaults
+     setDefaultChordFinder();
+   }
+ }
+ 
+ bool ATLFieldManager::isInsideVacuum(const G4Track *track) {					//beampipe*
+=======
+*/
\ No newline at end of file
-- 
GitLab