Skip to content
Snippets Groups Projects
Commit e33ca193 authored by nnitika's avatar nnitika
Browse files

ATLFM

parent 3faefed9
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#define ATLFieldManager_h 1 #define ATLFieldManager_h 1
#include "G4FieldManager.hh" #include "G4FieldManager.hh"
#include "FSLDetectorConstruction.hh"
#include "FSLDetectorMessenger.hh"
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <memory> // Add this include for std::unique_ptr #include <memory> // Add this include for std::unique_ptr
...@@ -67,33 +68,26 @@ public: ...@@ -67,33 +68,26 @@ public:
: parameters(params) {} : parameters(params) {}
double getDoubleParameter(const std::string& key) const { double getDoubleParameter(const std::string& key) const {
auto it = parameters.find(key); auto it = parameters.find(key);
return (it != parameters.end()) ? it->second : 0.0; return (it != parameters.end()) ? it->second : 0.0;
} }
std::string getStringParameter(const std::string& key) const { std::string getStringParameter(const std::string& key) const {
return parameters.count(key) ? std::to_string(parameters.at(key)) : ""; return parameters.count(key) ? std::to_string(parameters.at(key)) : "";
} }
template <typename T> template <typename T>
T getParameter(const std::string& key) const; T getParameter(const std::string& key) const;
private: private:
std::unordered_map<std::string, double> parameters; std::unordered_map<std::string, double> parameters;
}; };
template <> template <typename T>
std::vector<std::string> ParameterSet::getParameter<std::vector<std::string>>(const std::string& key) const { T ParameterSet::getParameter(const std::string& key) const {
std::vector<std::string> result; auto it = parameters.find(key);
if (parameters.count(key)) { return (it != parameters.end()) ? static_cast<T>(it->second) : T{};
std::istringstream iss(getStringParameter(key)); }
std::copy(
std::istream_iterator<std::string>(iss),
std::istream_iterator<std::string>(),
std::back_inserter(result)
);
}
return result;
};
// Define ParameterSet class // Define ParameterSet class
/* /*
...@@ -131,28 +125,28 @@ public: ...@@ -131,28 +125,28 @@ public:
void InitialiseForVolume(const ParameterSet& params, void InitialiseForVolume(const ParameterSet& params,
atl::Field* field, atl::Field* field,
G4ChordFinder* cfDefault, G4ChordFinder* cfDefault,
// G4ChordFinder* cfMonopole, G4ChordFinder *cfTracker,
G4ChordFinder *cfBeamPipe,
const std::string& vol, const std::string& vol,
const std::string& fieldType, const std::string& fieldType,
const std::string& stepperName, const std::string& stepperName,
double delta, double delta,
G4PropagatorInField*); G4PropagatorInField*);
void setMonopoleTracking(G4bool);
private: private:
bool isInsideVacuum(const G4Track*); bool isInsideBeampipe(const G4Track*);
bool isInsideTracker(const G4Track*); bool isInsideTracker(const G4Track*);
void setDefaultChordFinder(); void setDefaultChordFinder();
void setChordFinderForTracker(); void setChordFinderForTracker();
void setChordFinderForBeampipe(); void setChordFinderForBeampipe();
void ConfigureForTrack(const G4Track*) ; void ConfigureForTrack(const G4Track*) ;
// void InitialiseForVolume(); void printParameters(const std::string& region);
std::unique_ptr<atl::Field> theField; std::unique_ptr<atl::Field> theField;
G4ChordFinder* m_currChordFinder; G4ChordFinder* m_currChordFinder;
G4ChordFinder* m_chordFinder; G4ChordFinder* m_chordFinder;
G4ChordFinder* m_chordFinderMonopole; G4ChordFinder* m_chordFinderTracker;
G4ChordFinder* m_chordFinderBeamPipe;
G4PropagatorInField* m_propagator; G4PropagatorInField* m_propagator;
std::vector<const G4Region*> m_regions; std::vector<const G4Region*> m_regions;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment