Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GeoModelDev
GeoModel
Commits
c41f2f30
Commit
c41f2f30
authored
1 year ago
by
nnitika
Committed by
Marilena Bandieramonte
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
modified for parameter opt.
parent
6ecc4cec
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
FullSimLight/src/FSLDetectorMessenger.cc
+118
-37
118 additions, 37 deletions
FullSimLight/src/FSLDetectorMessenger.cc
with
118 additions
and
37 deletions
FullSimLight/src/FSLDetectorMessenger.cc
+
118
−
37
View file @
c41f2f30
#include
"FSLDetectorMessenger.hh"
#include
"FSLDetectorConstruction.hh"
#include
"G4UIdirectory.hh"
#include
"G4UIcmdWithADoubleAndUnit.hh"
#include
"G4UIcmdWithAString.hh"
#include
"G4UIcmdWithoutParameter.hh"
#include
"globals.hh"
#include
"G4ChordFinder.hh"
#include
"G4FieldManager.hh"
#include
"G4TransportationManager.hh"
#include
"G4MagneticField.hh"
#include
"G4IntegrationDriver.hh"
#include
"G4VIntegrationDriver.hh"
#include
"G4Field.hh"
#include
"G4UImanager.hh"
#include
"G4UIcommand.hh"
#include
"G4UIcontrolMessenger.hh"
#include
"G4UIbatch.hh"
FSLDetectorMessenger
::
FSLDetectorMessenger
(
FSLDetectorConstruction
*
FSLDet
)
:
theDetector
(
FSLDet
)
{
#include
"G4RunManager.hh"
theDetectorDir
=
new
G4UIdirectory
(
"/FSLdet/"
);
theDetectorDir
->
SetGuidance
(
"Detector control."
);
FSLDetectorMessenger
::
FSLDetectorMessenger
(
FSLDetectorConstruction
*
FSLDet
)
:
theDetector
(
FSLDet
)
{
theDetectorDir
=
new
G4UIdirectory
(
"/FSLdet/"
);
theDetectorDir
->
SetGuidance
(
"Detector control."
);
theFieldCommand
=
new
G4UIcmdWithADoubleAndUnit
(
"/FSLdet/setField"
,
this
);
theFieldCommand
->
SetGuidance
(
"Define uniform magnetic field along Z."
);
theFieldCommand
->
SetGuidance
(
" -> in unit of [Tesla]"
);
theFieldCommand
->
SetParameterName
(
"By"
,
false
);
theFieldCommand
->
SetDefaultValue
(
0.0
);
theFieldCommand
->
SetUnitCategory
(
"Magnetic flux density"
);
theFieldCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
theFieldCommand
=
new
G4UIcmdWithADoubleAndUnit
(
"/FSLdet/setField"
,
this
);
theFieldCommand
->
SetGuidance
(
"Define uniform magnetic field along Z."
);
theFieldCommand
->
SetGuidance
(
" -> in unit of [Tesla]"
);
theFieldCommand
->
SetParameterName
(
"By"
,
false
);
theFieldCommand
->
SetDefaultValue
(
0.0
);
theFieldCommand
->
SetUnitCategory
(
"Magnetic flux density"
);
theFieldCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
theGDMLCommand
=
new
G4UIcmdWithAString
(
"/FSLdet/setGdmlFile"
,
this
);
theGDMLCommand
->
SetGuidance
(
"Set the GDML file."
);
theGDMLCommand
->
SetDefaultValue
(
"atlas2018.gdml"
);
theGDMLCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
theGDMLCommand
=
new
G4UIcmdWithAString
(
"/FSLdet/setGdmlFile"
,
this
);
theGDMLCommand
->
SetGuidance
(
"Set the GDML file."
);
//
theGDMLCommand->SetDefaultValue("atlas2018.gdml");
theGDMLCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
theRegionCommand
=
new
G4UIcmdWithoutParameter
(
"/FSLdet/addRegions"
,
this
);
theRegionCommand
->
SetGuidance
(
"Try to add detector regions."
);
theRegionCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
theRegionCommand
=
new
G4UIcmdWithoutParameter
(
"/FSLdet/addRegions"
,
this
);
theRegionCommand
->
SetGuidance
(
"Try to add detector regions."
);
theRegionCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
}
// Add commands for deltaIntersection and deltaOneStep
theDeltaIntersectionCommand
=
new
G4UIcmdWithADoubleAndUnit
(
"/FSLdet/setDeltaIntersection"
,
this
);
theDeltaIntersectionCommand
->
SetGuidance
(
"Set deltaIntersection value for tracking."
);
theDeltaIntersectionCommand
->
SetParameterName
(
"deltaIntersection"
,
false
);
theDeltaIntersectionCommand
->
SetUnitCategory
(
"Length"
);
theDeltaIntersectionCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
theDeltaOneStepCommand
=
new
G4UIcmdWithADoubleAndUnit
(
"/FSLdet/setDeltaOneStep"
,
this
);
theDeltaOneStepCommand
->
SetGuidance
(
"Set deltaOneStep value for tracking."
);
theDeltaOneStepCommand
->
SetParameterName
(
"deltaOneStep"
,
false
);
theDeltaOneStepCommand
->
SetUnitCategory
(
"Length"
);
theDeltaOneStepCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
theEpsilonMinCommand
=
new
G4UIcmdWithADoubleAndUnit
(
"/FSLdet/setEpsilonMin"
,
this
);
theEpsilonMinCommand
->
SetGuidance
(
"Set EpsilonMin value for tracking."
);
theEpsilonMinCommand
->
SetParameterName
(
"EpsilonMin"
,
false
);
theEpsilonMinCommand
->
SetUnitCategory
(
"Length"
);
theEpsilonMinCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
theEpsilonMaxCommand
=
new
G4UIcmdWithADoubleAndUnit
(
"/FSLdet/setEpsilonMax"
,
this
);
theEpsilonMaxCommand
->
SetGuidance
(
"Set EpsilonMax value for tracking."
);
theEpsilonMaxCommand
->
SetParameterName
(
"EpsilonMax"
,
false
);
theEpsilonMaxCommand
->
SetUnitCategory
(
"Length"
);
theEpsilonMaxCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
FSLDetectorMessenger
::~
FSLDetectorMessenger
()
{
delete
theFieldCommand
;
delete
theDetectorDir
;
delete
theRegionCommand
;
// Add command for chord length
theDeltaChordCommand
=
new
G4UIcmdWithADoubleAndUnit
(
"/FSLdet/setDeltaChord"
,
this
);
theDeltaChordCommand
->
SetGuidance
(
"Set the DeltaChord length for tracking."
);
theDeltaChordCommand
->
SetParameterName
(
"DeltaChord"
,
false
);
theDeltaChordCommand
->
SetGuidance
(
" -> in unit of [millimeter]"
);
theDeltaChordCommand
->
SetUnitCategory
(
"Length"
);
theDeltaChordCommand
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
}
FSLDetectorMessenger
::~
FSLDetectorMessenger
()
{
delete
theFieldCommand
;
delete
theDetectorDir
;
delete
theRegionCommand
;
delete
theDeltaIntersectionCommand
;
delete
theDeltaOneStepCommand
;
delete
theEpsilonMinCommand
;
delete
theEpsilonMaxCommand
;
delete
theDeltaChordCommand
;
}
////////////////////////////////////////////////////////////////
//
void
FSLDetectorMessenger
::
SetNewValue
(
G4UIcommand
*
command
,
G4String
newValue
)
{
if
(
command
==
theFieldCommand
)
{
theDetector
->
SetMagFieldValue
(
theFieldCommand
->
GetNewDoubleValue
(
newValue
));
}
if
(
command
==
theGDMLCommand
)
{
theDetector
->
SetGDMLFileName
(
newValue
);
}
if
(
command
==
theRegionCommand
)
{
theDetector
->
SetAddRegions
(
true
);
}
void
FSLDetectorMessenger
::
SetNewValue
(
G4UIcommand
*
command
,
G4String
newValue
)
{
if
(
command
==
theFieldCommand
)
{
theDetector
->
SetMagFieldValue
(
theFieldCommand
->
GetNewDoubleValue
(
newValue
)
);
}
if
(
command
==
theGDMLCommand
)
{
theDetector
->
SetGDMLFileName
(
newValue
);
}
if
(
command
==
theRegionCommand
)
{
theDetector
->
SetAddRegions
(
true
);
}
//////////Adding cmd//////
}
G4FieldManager
*
fieldMgr
=
G4TransportationManager
::
GetTransportationManager
()
->
GetFieldManager
();
if
(
fieldMgr
!=
nullptr
)
{
if
(
command
==
theDeltaIntersectionCommand
)
{
fieldMgr
->
SetDeltaIntersection
(
theDeltaIntersectionCommand
->
GetNewDoubleValue
(
newValue
));
}
if
(
command
==
theDeltaOneStepCommand
)
{
fieldMgr
->
SetDeltaOneStep
(
theDeltaOneStepCommand
->
GetNewDoubleValue
(
newValue
));
}
if
(
command
==
theEpsilonMinCommand
)
{
fieldMgr
->
SetMinimumEpsilonStep
(
theEpsilonMinCommand
->
GetNewDoubleValue
(
newValue
));
}
if
(
command
==
theEpsilonMaxCommand
)
{
fieldMgr
->
SetMaximumEpsilonStep
(
theEpsilonMaxCommand
->
GetNewDoubleValue
(
newValue
));
}
G4ChordFinder
*
fChordFinder
=
fieldMgr
->
GetChordFinder
();
if
(
fChordFinder
!=
nullptr
)
{
if
(
command
==
theDeltaChordCommand
)
fieldMgr
->
GetChordFinder
()
->
SetDeltaChord
(
theDeltaChordCommand
->
GetNewDoubleValue
(
newValue
));
//fieldMgr->GetChordFinder()->SetDeltaChord( fDeltaChord);
//fieldMgr->fDeltaChord = theDeltaChordCommand->GetNewDoubleValue(newValue);
//fChordFinder->SetDeltaChord(fDeltaChord);
//G4ChordFinder* fChordFinder = fieldMgr->GetChordFinder();
// if (fChordFinder != nullptr) {
// if (command == theDeltaChordCommand)
// fChordFinder->SetDeltaChord(theDeltaChordCommand->GetNewDoubleValue(newValue));
// fChordFinder->SetDeltaChord(theDeltaChordCommand->GetNewDoubleValue(newValue));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment