Skip to content
Snippets Groups Projects
Commit 6b405a92 authored by Marilena Bandieramonte's avatar Marilena Bandieramonte
Browse files

Fix conficts pull

parents f029d3e2 dedbbe92
No related branches found
No related tags found
No related merge requests found
Pipeline #6790182 passed
......@@ -35,7 +35,6 @@
#include <nlohmann/json.hpp>
#include <fstream>
#include "G4StepLimiterPhysics.hh"
static const std::string fullSimLightShareDir=FULLSIMLIGHTSHAREDIR;
......
......@@ -67,33 +67,27 @@ 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,29 @@ 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;
......
......@@ -162,27 +162,28 @@ ATLFieldManager::ATLFieldManager()
m_chordFinder(nullptr),
m_propagator(nullptr),
m_dChordDefault(0.25), //Default
m_dIntersectionDefault(0.001),
m_dIntersectionDefault(0.002),
m_dOneStepDefault(0.01),
m_stepMaxDefault(1000.), ////limit
m_dChordTracker(0.0001), //Tracker //tracker* !!?
m_dIntersectionTracker(0.001), //tracker* !!?
m_dOneStepTracker(0.001), //tracker* !!?
m_dChordTracker(0.0001), //Tracker
m_dIntersectionTracker(0.0004),
m_dOneStepTracker(0.001),
m_stepMaxTracker(100.),
m_Rmax2(1.e+4),
m_Zmax(3.e+2),
m_energyThTracker(0.0), //tracker* !!?
m_energyThTracker(0.0),
m_energyThreshold(0.0),
m_dChordBeampipe(0.002), //Beampipe
m_dIntersectionBeampipe(0.0001),
m_dIntersectionBeampipe(0.003),
m_dOneStepBeampipe(0.02),
m_stepMaxBeampipe(1000.0),
m_cfTracker(false), //tracker* !!?
m_cfBeampipe(false) { //beampipe*
m_cfTracker(false),
m_cfBeampipe(false) {
if (m_chordFinder != m_currChordFinder) {
delete m_chordFinder;
......@@ -192,7 +193,8 @@ ATLFieldManager::ATLFieldManager()
void ATLFieldManager::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,
......@@ -206,28 +208,28 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
int maxLC = static_cast<int>(params.getDoubleParameter("MaximumLoopCounts")); // Assuming "MaximumLoopCounts" is the parameter name
// Tracker
m_dChordTracker = params.getDoubleParameter("DeltaChord") * CLHEP::mm; //tracker* !!?
m_dIntersectionTracker = params.getDoubleParameter("DeltaIntersection") * CLHEP::mm;
m_dOneStepTracker = params.getDoubleParameter("DeltaOneStep") * CLHEP::mm; //tracker* !!?
m_stepMaxTracker = params.getDoubleParameter("MaxStep") * CLHEP::cm;
m_dChordTracker = params.getDoubleParameter("DeltaChordTracker") * CLHEP::mm;
m_dIntersectionTracker = params.getDoubleParameter("DeltaIntersectionTracker") * CLHEP::mm;
m_dOneStepTracker = params.getDoubleParameter("DeltaOneStepTracker") * CLHEP::mm;
m_stepMaxTracker = params.getDoubleParameter("MaxStepTracker") * CLHEP::cm;
//Beampipe
m_dChordBeampipe = params.getDoubleParameter("DeltaChord") * CLHEP::mm;
m_dIntersectionBeampipe = params.getDoubleParameter("DeltaIntersection") * CLHEP::mm;
m_dOneStepBeampipe = params.getDoubleParameter("DeltaOneStep") * CLHEP::mm;
m_stepMaxBeampipe = params.getDoubleParameter("MaxStep") * CLHEP::cm;
m_dChordBeampipe = params.getDoubleParameter("DeltaChordBeampipe") * CLHEP::mm;
m_dIntersectionBeampipe = params.getDoubleParameter("DeltaIntersectionBeampipe") * CLHEP::mm;
m_dOneStepBeampipe = params.getDoubleParameter("DeltaOneStepBeampipe") * CLHEP::mm;
m_stepMaxBeampipe = params.getDoubleParameter("MaxStepBeampipe") * CLHEP::cm;
//Default
m_dChordDefault = params.getDoubleParameter("DeltaChord") * CLHEP::mm;
m_dIntersectionDefault = params.getDoubleParameter("DeltaIntersection") * CLHEP::mm;
m_dOneStepDefault = params.getDoubleParameter("DeltaOneStep") * CLHEP::mm;
m_stepMaxDefault = params.getDoubleParameter("MaxStep") * CLHEP::cm;
m_dChordDefault = params.getDoubleParameter("DeltaChordDefault") * CLHEP::mm;
m_dIntersectionDefault = params.getDoubleParameter("DeltaIntersectionDefault") * CLHEP::mm;
m_dOneStepDefault = params.getDoubleParameter("DeltaOneStepDefault") * CLHEP::mm;
m_stepMaxDefault = params.getDoubleParameter("MaxStepDefault") * CLHEP::cm;
m_energyThreshold = params.getDoubleParameter("EnergyThBeampipe") * CLHEP::GeV; //...check if ....
m_energyThTracker = params.getDoubleParameter("EnergyThTracker") * CLHEP::GeV; //tracker* !!?
m_energyThTracker = params.getDoubleParameter("EnergyThTracker") * CLHEP::GeV;
double rmax = params.getDoubleParameter("RmaxTracker") * CLHEP::mm; //tracker* !!?
double rmax = params.getDoubleParameter("Rmax") * CLHEP::mm;
m_Rmax2 = rmax * rmax;
m_Zmax = params.getDoubleParameter("ZmaxTracker") * CLHEP::mm; //tracker* !!?
m_Zmax = params.getDoubleParameter("Zmax") * CLHEP::mm;
std::cout << "is it workinggggggggg!" ">\n"
//edm::LogVerbatim("")
......@@ -240,26 +242,26 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
<< " MinimumEpsilonStep " << minEpsStep << "\n"
<< " MaximumEpsilonStep " << maxEpsStep << "\n"
<< " MinStep " << minstep << " mm\n"
<< " MaxStep Default " << m_stepMaxDefault / CLHEP::cm << " cm\n"
<< " MaxStep Tracker " << m_stepMaxTracker / CLHEP::cm << " cm\n"
<< " DeltaChord Default " << m_dChordDefault << " mm\n"
<< " DeltaOneStep Default " << m_dOneStepDefault << " mm\n"
<< " DeltaIntersection Default " << m_dIntersectionDefault << " mm\n"
<< " DeltaInterTracker " << m_dIntersectionTracker << " mm\n" //tracker* !!?
<< " MaxStepDefault " << m_stepMaxDefault / CLHEP::cm << " cm\n"
<< " MaxStepTracker " << m_stepMaxTracker / CLHEP::cm << " cm\n"
<< " DeltaChordDefault " << m_dChordDefault << " mm\n"
<< " DeltaOneStepDefault " << m_dOneStepDefault << " mm\n"
<< " DeltaIntersectionDefault " << m_dIntersectionDefault << " mm\n"
<< " DeltaInterTracker " << m_dIntersectionTracker << " mm\n"
<< " EnergyThresholdBeampipe " << m_energyThreshold / CLHEP::MeV << " MeV\n"
<< " EnergyThresholdTracker " << m_energyThTracker / CLHEP::MeV << " MeV\n" //tracker* !!?
<< " EnergyThresholdTracker " << m_energyThTracker / CLHEP::MeV << " MeV\n"
<< " DeltaChordBeampipe " << m_dChordBeampipe << " mm\n"
<< " DeltaOneStepBeampipe " << m_dOneStepBeampipe << " mm\n"
<< " DeltaIntersectionBeampipe " << m_dIntersectionBeampipe << " mm\n"
<< " MaxStepInVacuum " << m_stepMaxBeampipe / CLHEP::cm << " cm"; //beampipe*
<< " MaxStepInVacuum " << m_stepMaxBeampipe / CLHEP::cm << " cm";
// initialisation of chord finders
m_chordFinder = cfDefault; //here
m_chordFinder = cfDefault;
m_chordFinderTracker = cfTracker;
m_chordFinderBeamPipe = cfBeamPipe;
m_chordFinder->SetDeltaChord(m_dChordDefault); //check replacement of m_dChord
// m_chordFinderMonopole = cfmon; //here
// m_chordFinderMonopole->SetDeltaChord(m_dChord); //check
// initialisation of field manager
// initialisation of field manager
theField.reset(field);
SetDetectorField(field); //here
......@@ -292,7 +294,9 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
//edm::LogVerbatim("SimG4CoreApplication") << "Beampipe field integration in G4Regions:\n" << ss.str() << "\n";// edm is for CMS, modify it
}
}
/*
>>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
void ATLFieldManager::ConfigureForTrack(const G4Track *track) {
// run time parameters per track
if (track->GetKineticEnergy() > m_energyThTracker && isInsideTracker(track)) { //tracker* !!?
......@@ -300,7 +304,11 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
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*
}
......@@ -310,8 +318,33 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
setDefaultChordFinder();
}
}
<<<<<<< HEAD
bool ATLFieldManager::isInsideVacuum(const G4Track *track) { //beampipe*
=======
*/
void ATLFieldManager::ConfigureForTrack(const G4Track *track) {
// run time parameters per track
if (track->GetKineticEnergy() > m_energyThTracker && isInsideTracker(track)) {
if (!m_cfTracker) {
setChordFinderForTracker();
std::cout << "Track is in the Tracker region with the following parameters:\n";
printParameters("Tracker");
}
} else if (track->GetKineticEnergy() <= m_energyThreshold || isInsideBeampipe(track)) {
if (!m_cfBeampipe) {
setChordFinderForBeampipe();
std::cout << "Track is in the Beampipe region with the following parameters:\n";
printParameters("Beampipe");
}
} else if (m_cfTracker || m_cfBeampipe) {
// restore defaults
setDefaultChordFinder();
}
}
/*
bool ATLFieldManager::isInsideBeampipe(const G4Track *track) { //beampipe*
>>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
if (!m_regions.empty()) {
const G4Region *reg = track->GetVolume()->GetLogicalVolume()->GetRegion();
for (auto &areg : m_regions) {
......@@ -322,40 +355,103 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
}
return false;
}
<<<<<<< HEAD
=======
*/
bool ATLFieldManager::isInsideBeampipe(const G4Track *track) {
if (!m_regions.empty()) {
const G4Region *reg = track->GetVolume()->GetLogicalVolume()->GetRegion();
// Check if the track is in any of the specified beam pipe regions
for (auto &areg : m_regions) {
if (reg == areg) {
std::string regionName = areg->GetName();
if (regionName == "BeamPipeCentral" || regionName == "BeamPipeFwd" || regionName == "BeamPipe") {
return true;
}
}
}
}
return false;
}
bool ATLFieldManager::isInsideTracker(const G4Track *track) {
const G4Region *reg = track->GetVolume()->GetLogicalVolume()->GetRegion();
std::string regionName = reg->GetName();
// if the track is inside any of the specified tracker regions
if (regionName == "TrackerSupportRailBarrelPart1" ||
regionName == "TrackerSupportRailBarrelPart2" ||
regionName == "TrackerSupportRailBarrelPart3" ||
regionName == "TrackerSupportRailEndPart1" ||
regionName == "TrackerSupportRailEndPart2" ||
regionName == "TrackerSupportRailEndPart3") {
return true;
}
return false;
}
/*
bool ATLFieldManager::isInsideTracker(const G4Track *track) {
const G4ThreeVector &pos = track->GetPosition();
const double x = pos.x();
const double y = pos.y();
// Check if the track is within the specified tracker regions
if ((x * x + y * y < m_Rmax2) && (std::abs(pos.z()) < m_Zmax)) {
const G4Region *reg = track->GetVolume()->GetLogicalVolume()->GetRegion();
std::string regionName = reg->GetName();
if (regionName == "TrackerSupportRailBarrelPart1" ||
regionName == "TrackerSupportRailBarrelPart2" ||
regionName == "TrackerSupportRailBarrelPart3" ||
regionName == "TrackerSupportRailEndPart1" ||
regionName == "TrackerSupportRailEndPart2" ||
regionName == "TrackerSupportRailEndPart3") {
return true;
}
}
return false;
}
*/
/*
>>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
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);
}
*/
void ATLFieldManager::setDefaultChordFinder() {
if (m_currChordFinder != m_chordFinder) {
m_currChordFinder = m_chordFinder;
SetChordFinder(m_currChordFinder);
}
m_currChordFinder->SetDeltaChord(m_dChordDefault);//monopole
m_currChordFinder->SetDeltaChord(m_dChordDefault);
SetDeltaOneStep(m_dOneStepDefault);
SetDeltaIntersection(m_dIntersectionDefault);
m_propagator->SetLargestAcceptableStep(m_stepMaxDefault);
m_cfBeampipe = m_cfTracker = false; //tracker* !!? //beampipe*
m_cfBeampipe = m_cfTracker = false;
}
void ATLFieldManager::setChordFinderForTracker() { //tracker* !!?
void ATLFieldManager::setChordFinderForTracker() {
if (m_currChordFinder != m_chordFinder) {
m_currChordFinder = m_chordFinder;
SetChordFinder(m_currChordFinder);
}
m_currChordFinder->SetDeltaChord(m_dChordTracker); //tracker* !!?
SetDeltaOneStep(m_dOneStepTracker); //tracker* !!?
SetDeltaIntersection(m_dIntersectionTracker); //tracker* !!?
m_currChordFinder->SetDeltaChord(m_dChordTracker);
SetDeltaOneStep(m_dOneStepTracker);
SetDeltaIntersection(m_dIntersectionTracker);
m_propagator->SetLargestAcceptableStep(m_stepMaxTracker);
m_cfBeampipe = false; //beampipe*
m_cfTracker = true; //tracker* !!?
m_cfBeampipe = false;
m_cfTracker = true;
}
void ATLFieldManager::setChordFinderForBeampipe() { //beampipe*
void ATLFieldManager::setChordFinderForBeampipe() {
if (m_currChordFinder != m_chordFinder) {
m_currChordFinder = m_chordFinder;
SetChordFinder(m_currChordFinder);
......@@ -365,5 +461,14 @@ void ATLFieldManager::InitialiseForVolume(const ParameterSet &params,
SetDeltaIntersection(m_dIntersectionBeampipe);
m_propagator->SetLargestAcceptableStep(m_stepMaxBeampipe);
m_cfBeampipe = true;
m_cfTracker = false; //tracker* !!?
m_cfTracker = false;
}
void ATLFieldManager::printParameters(const std::string& region) {
std::cout << "DeltaChord: " << (region == "Tracker" ? m_dChordTracker : m_dChordBeampipe) << " mm\n";
std::cout << "DeltaOneStep: " << (region == "Tracker" ? m_dOneStepTracker : m_dOneStepBeampipe) << " mm\n";
std::cout << "DeltaIntersection: " << (region == "Tracker" ? m_dIntersectionTracker : m_dIntersectionBeampipe) << " mm\n";
std::cout << "MaxStep: " << (region == "Tracker" ? m_stepMaxTracker : m_stepMaxBeampipe) / CLHEP::cm << " cm\n";
}
......@@ -31,6 +31,30 @@
#include "G4GDMLParser.hh"
//#include "G4LogicalVolumeStore.hh"
//chord
//#include "G4MagneticField.hh"
//#include "G4IntegrationDriver.hh"
//#include "G4VIntegrationDriver.hh"
//#include "G4MagIntegratorStepper.hh"
#include "G4Field.hh"
#include "G4VIntegrationDriver.hh"
#include "G4VIntegrationDriver.hh"
#include "G4FSALIntegrationDriver.hh"
#include "G4VFSALIntegrationStepper.hh"
#include "G4RK547FEq1.hh"
// #include "G4RK547FEq2.hh"
// #include "G4RK547FEq3.hh"
#include "G4NystromRK4.hh"
// New FSAL type driver / steppers -----
#include "G4IntegrationDriver.hh"
#include "G4InterpolationDriver.hh"
// #include "G4FSALBogackiShampine45.hh"
// #include "G4FSALDormandPrince745.hh"
#include "G4HelixHeum.hh"
#include "G4BFieldIntegrationDriver.hh"
#include <cassert>
#include <algorithm>
......@@ -152,6 +176,7 @@
//#include "StepMax.hh"
#include <cassert>
#include "G4RegionStore.hh"
#include "G4Region.hh"
#include "G4Track.hh"
......@@ -322,11 +347,19 @@ G4VPhysicalVolume *FSLDetectorConstruction::Construct()
G4UserLimits* userLimits = new G4UserLimits(theStepMax);
lv->SetUserLimits(userLimits);
}
<<<<<<< HEAD
// Print the value of maxStepLength (fStepMax)
G4cout << "StepMax (fStepMax) set to: " << theStepMax << std::endl;
=======
// Print the value of maxStepLength (fStepMax)
G4cout << "StepMax (fStepMax) set to: " << theStepMax << std::endl;
>>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
*/
}
else if (fGeometryFileName.contains(".gdml")){
......@@ -519,6 +552,155 @@ fDeltaChord->SetDeltaChord();
fDeltaChord->SetDeltaOneStep();
fDeltaChord->SetDeltaIntersection();
<<<<<<< HEAD
////Tracker from CMS////////
void G4FieldManager::ConfigureForTrack(const G4Track *ptrack) {
if (ptrack->GetKineticEnergy() // G4doc. < 2.5 * MeV )// {
TrackAndPrintParticleDetails(ptrack);
if (!Tracker) {
setChordFinderForTracker();
}
} else {
// restore defaults
setDefaultChordFinder();
}
}
*/
/*void G4UserSteppingAction::UserSteppingAction(const G4Step* step) {
G4Track* track = step->GetTrack();
G4ParticleDefinition* particle = track->GetDefinition();
G4ThreeVector position = track->GetPosition();
G4ThreeVector momentum = track->GetMomentum();
G4cout << "Particle: " << particle->GetParticleName() << G4endl;
G4cout << "Position: " << position << G4endl;
G4cout << "Momentum: " << momentum << G4endl;
// Add more information as needed
// Call base class method for processing further
G4UserSteppingAction::UserSteppingAction(step);
*/
/*void G4FieldManager::TrackAndPrintParticleDetails(const G4Track* track) {
const G4ParticleDefinition* particleDefinition = track->GetParticleDefinition();
const G4DynamicParticle* dynamicParticle = track->GetDynamicParticle();
G4cout << "Particle Details:" << G4endl;
G4cout << " Track ID: " << track->GetTrackID() << G4endl;
G4cout << " Particle Name: " << particleDefinition->GetParticleName() << G4endl;
G4cout << " Particle Mass: " << particleDefinition->GetPDGMass() / GeV << " GeV/c^2" << G4endl;
G4cout << " Kinetic Energy: " << track->GetKineticEnergy() / GeV << " GeV" << G4endl;
G4cout << " Momentum: " << track->GetMomentum() / GeV << " GeV/c" << G4endl;
G4cout << " Position: " << track->GetPosition() / mm << " mm" << G4endl;
G4cout << " Direction: " << track->GetMomentumDirection() << G4endl;
G4cout << G4endl;
}*/
/////////////////////////////////////////////////////////////
///////////// MuonSys /////////////
/*G4LogicalVolume* muonSysLogicalVolume = nullptr;
// Loop through the logical volumes to find "MuonSys" by name
for (auto lv : *logVolStore) {
if (lv->GetName() == "MuonSys") {
muonSysLogicalVolume = lv;
break;
}
}
////////////////////DeltaIntersection-MuonSys/////////////
// Check for "MuonSys"
if (muonSysLogicalVolume) {
// Create a G4Region and associate it with "MuonSys" logical volume
G4Region* muonSysRegion = new G4Region("MuonSysRegion");
muonSysRegion->AddRootLogicalVolume(muonSysLogicalVolume);
// Set the step size limit for "MuonSys" logical volume
G4double theStepMaxMuonSys = 1.0 * mm; // StepMax value for MuonSys
G4UserLimits* muonSysUserLimits = muonSysLogicalVolume->GetUserLimits();
if (!muonSysUserLimits) {
muonSysUserLimits = new G4UserLimits(theStepMaxMuonSys);
muonSysLogicalVolume->SetUserLimits(muonSysUserLimits);
} else {
// If user limits already exist, update the maximum step length
muonSysUserLimits->SetMaxAllowedStep(theStepMaxMuonSys);
}
// Get the field manager for the "MuonSysRegion"
G4FieldManager* muonSysFieldMgr = muonSysRegion->GetFieldManager();
// Set the deltaIntersection for the "MuonSysRegion"
G4double theDeltaIntersectionMuonSys = 0.1 * mm; // DeltaIntersection value for MuonSys
muonSysFieldMgr->SetDeltaIntersection(theDeltaIntersectionMuonSys);
// Print the step size limit for "MuonSys" logical volume
G4cout << "Step size limit on MuonSys: " << theStepMaxMuonSys / mm << " mm" << G4endl;
// Print the deltaIntersection for "MuonSys" region
G4cout << "DeltaIntersection for MuonSysRegion: " << theDeltaIntersectionMuonSys / mm << " mm" << G4endl;
} else {
G4cerr << "Error: Logical volume 'MuonSys' not found in the geometry description!" << G4endl;
}*/
//}
/////////////////////////////////////////////////////////
///////////// SCT /////////////
/*
// Create a list of SCT logical volume names
std::vector<std::string> sctLogicalVolumeNames = {"SCT_Barrel", "SCT_ForwardA", "SCT_ForwardC"};
for (const std::string& sctName : sctLogicalVolumeNames) {
G4LogicalVolume* sctLogicalVolume = nullptr;
// Loop through the logical volumes to find the SCT logical volume by name
for (auto lv : *logVolStore) {
if (lv->GetName() == G4String(sctName.c_str())) { // Convert std::string to G4String
sctLogicalVolume = lv;
break;
}
}
// Check if the SCT logical volume was found
if (sctLogicalVolume) {
// Create a G4Region and associate it with the SCT logical volume
G4Region* sctRegion = new G4Region((sctName + "Region").c_str());
sctRegion->AddRootLogicalVolume(sctLogicalVolume);
// Set the step size limit for the SCT logical volume
G4double theStepMaxSCT = 2.0 * mm; // StepMax value for SCT
G4UserLimits* sctUserLimits = sctLogicalVolume->GetUserLimits();
if (!sctUserLimits) {
sctUserLimits = new G4UserLimits(theStepMaxSCT);
sctLogicalVolume->SetUserLimits(sctUserLimits);
} else {
// If user limits already exist, update the maximum step length
sctUserLimits->SetMaxAllowedStep(theStepMaxSCT);
}
// Print the step size limit for the SCT logical volume
G4cout << "Step size limit on " << sctName << ": " << theStepMaxSCT / mm << " mm" << G4endl;
} else {
G4cerr << "Error: Logical volume '" << sctName << "' not found in the geometry description!" << G4endl;
}
}
*/
/////////////////////
/*
//G4double theStepMax = 1.0 * mm;
// Loop through logical volumes and set the step limits
for (auto lv : *logVolStore) {
G4UserLimits* userLimits = lv->GetUserLimits();
if (!userLimits) {
userLimits = new G4UserLimits(theStepMax);
lv->SetUserLimits(userLimits);
} else {
// If user limits already exist, update the maximum step length
userLimits->SetMaxAllowedStep(theStepMax);
}
}
=======
////Tracker from CMS////////
void G4FieldManager::ConfigureForTrack(const G4Track *ptrack) {
......@@ -666,6 +848,7 @@ for (auto lv : *logVolStore) {
userLimits->SetMaxAllowedStep(theStepMax);
}
}
>>>>>>> dedbbe927cafde8861ebe5968921156c3093037c
// Print the value of maxStepLength (theStepMax)
G4cout << "StepMax (theStepMax) set to: " << theStepMax << std::endl; */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment