From e33ca193162dc6dae9a5a0198e9f99f44f243579 Mon Sep 17 00:00:00 2001
From: nnitika <nnitika@cern.ch>
Date: Fri, 26 Jan 2024 09:37:51 +0100
Subject: [PATCH] ATLFM

---
 FullSimLight/include/ATLFieldManager.hh | 44 +++++++++++--------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/FullSimLight/include/ATLFieldManager.hh b/FullSimLight/include/ATLFieldManager.hh
index 638fc2099..cbfc846f5 100644
--- a/FullSimLight/include/ATLFieldManager.hh
+++ b/FullSimLight/include/ATLFieldManager.hh
@@ -4,7 +4,8 @@
 #define ATLFieldManager_h 1
 
 #include "G4FieldManager.hh"
-
+#include "FSLDetectorConstruction.hh"
+#include "FSLDetectorMessenger.hh"
 #include <string>
 #include <unordered_map>
 #include <memory>  // Add this include for std::unique_ptr
@@ -67,33 +68,26 @@ public:
         : parameters(params) {}
 
     double getDoubleParameter(const std::string& key) const {
-    auto it = parameters.find(key);
-    return (it != parameters.end()) ? it->second : 0.0;
-}
+        auto it = parameters.find(key);
+        return (it != parameters.end()) ? it->second : 0.0;
+    }
+
     std::string getStringParameter(const std::string& key) const {
         return parameters.count(key) ? std::to_string(parameters.at(key)) : "";
     }
 
     template <typename T>
-    T getParameter(const std::string& key) const;
-    
+    T getParameter(const std::string& key) const;  
+
 private:
     std::unordered_map<std::string, double> parameters;
 };
 
-template <>
-std::vector<std::string> ParameterSet::getParameter<std::vector<std::string>>(const std::string& key) const {
-    std::vector<std::string> result;
-    if (parameters.count(key)) {
-        std::istringstream iss(getStringParameter(key));
-        std::copy(
-            std::istream_iterator<std::string>(iss),
-            std::istream_iterator<std::string>(),
-            std::back_inserter(result)
-        );
-    }
-    return result;
-};
+template <typename T>
+T ParameterSet::getParameter(const std::string& key) const {
+    auto it = parameters.find(key);
+    return (it != parameters.end()) ? static_cast<T>(it->second) : T{};
+}
 
 // Define ParameterSet class
 /*
@@ -131,28 +125,28 @@ public:
     void InitialiseForVolume(const ParameterSet& params,
                              atl::Field* field,
                              G4ChordFinder* cfDefault,
-                            // G4ChordFinder* cfMonopole,
+                             G4ChordFinder *cfTracker,  
+                             G4ChordFinder *cfBeamPipe,
                              const std::string& vol,
                              const std::string& fieldType,
                              const std::string& stepperName,
                              double delta,
                              G4PropagatorInField*);
 
-    void setMonopoleTracking(G4bool);
-
 private:
-    bool isInsideVacuum(const G4Track*);
+    bool isInsideBeampipe(const G4Track*);
     bool isInsideTracker(const G4Track*);
     void setDefaultChordFinder();
     void setChordFinderForTracker();
     void setChordFinderForBeampipe();
     void ConfigureForTrack(const G4Track*) ;
-  //  void InitialiseForVolume();
+    void printParameters(const std::string& region);
 
     std::unique_ptr<atl::Field> theField;
     G4ChordFinder* m_currChordFinder;
     G4ChordFinder* m_chordFinder;
-    G4ChordFinder* m_chordFinderMonopole;
+    G4ChordFinder* m_chordFinderTracker;
+    G4ChordFinder* m_chordFinderBeamPipe;
     G4PropagatorInField* m_propagator;
     std::vector<const G4Region*> m_regions;
 
-- 
GitLab