Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
np
nptool
Commits
65504a6a
Commit
65504a6a
authored
4 years ago
by
flavigny
Browse files
Options
Downloads
Patches
Plain Diff
Clean old unused method and homogenize Nb of Slice definition in target
parent
19e668f7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#75222
passed
4 years ago
Stage: build-NPLib
Stage: build-NPSimulation
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NPSimulation/Core/Target.cc
+7
-81
7 additions, 81 deletions
NPSimulation/Core/Target.cc
NPSimulation/Core/Target.hh
+2
-5
2 additions, 5 deletions
NPSimulation/Core/Target.hh
with
9 additions
and
86 deletions
NPSimulation/Core/Target.cc
+
7
−
81
View file @
65504a6a
...
...
@@ -17,14 +17,7 @@
* *
*---------------------------------------------------------------------------*
* Comment: *
* Some improvment need to be done in material dealing *
* *
* + 16/09/2009: Add support for positioning the target with an angle with *
* respect to the beam (N. de Sereville) *
* + 16/09/2009: Add CH2 material for targets (N. de Sereville) *
* + 06/11/2009: Add new Token m_TargetNbLayers defining the number of *
* steps used to slow down the beam in the target *
* (N. de Sereville) *
* *
*****************************************************************************/
// C++ header
...
...
@@ -74,7 +67,7 @@ Target::Target(){
m_TargetAngle
=
0
;
m_TargetRadius
=
0
;
m_TargetDensity
=
0
;
m_TargetNb
Layer
s
=
5
;
// Number of steps by default
m_TargetNb
Slice
s
=
100.
;
// Number of
sslices/
steps by default
m_TargetBackingThickness
=
0
;
m_ReactionRegion
=
NULL
;
...
...
@@ -144,8 +137,8 @@ void Target::ReadConfiguration(NPL::InputParser parser){
exit
(
1
);
}
if
(
starget
[
0
]
->
HasToken
(
"N
BLAYERS
"
))
m_TargetNb
Layer
s
=
starget
[
0
]
->
GetInt
(
"N
BLAYERS
"
);
if
(
starget
[
0
]
->
HasToken
(
"N
bSlices
"
))
m_TargetNb
Slice
s
=
starget
[
0
]
->
GetInt
(
"N
bSlices
"
);
if
(
starget
[
0
]
->
HasToken
(
"BackingMaterial"
)
&&
starget
[
0
]
->
HasToken
(
"BackingThickness"
)){
m_TargetBackingMaterial
=
GetMaterialFromLibrary
(
starget
[
0
]
->
GetString
(
"BackingMaterial"
));
...
...
@@ -213,8 +206,8 @@ void Target::ReadConfiguration(NPL::InputParser parser){
exit
(
1
);
}
if
(
ctarget
[
0
]
->
HasToken
(
"N
BLAYERS
"
))
m_TargetNb
Layer
s
=
ctarget
[
0
]
->
GetInt
(
"N
BLAYERS
"
);
if
(
ctarget
[
0
]
->
HasToken
(
"N
bSlices
"
))
m_TargetNb
Slice
s
=
ctarget
[
0
]
->
GetInt
(
"N
bSlices
"
);
}
else
{
...
...
@@ -458,7 +451,7 @@ void Target::ConstructDetector(G4LogicalVolume* world){
void
Target
::
SetReactionRegion
(){
m_ReactionRegion
=
G4RegionStore
::
GetInstance
()
->
FindOrCreateRegion
(
"NPSimulationProcess"
);
m_ReactionRegion
->
AddRootLogicalVolume
(
m_TargetLogic
);
m_ReactionRegion
->
SetUserLimits
(
new
G4UserLimits
(
m_TargetThickness
/
10.
));
m_ReactionRegion
->
SetUserLimits
(
new
G4UserLimits
(
m_TargetThickness
/
m_TargetNbSlices
));
G4FastSimulationManager
*
mng
=
m_ReactionRegion
->
GetFastSimulationManager
();
unsigned
int
size
=
m_ReactionModel
.
size
();
...
...
@@ -468,7 +461,7 @@ void Target::SetReactionRegion(){
m_ReactionModel
.
clear
();
G4VFastSimulationModel
*
fsm
;
fsm
=
new
NPS
::
BeamReaction
(
"BeamReaction"
,
m_ReactionRegion
);
((
NPS
::
BeamReaction
*
)
fsm
)
->
SetStepSize
(
m_TargetThickness
/
10.
);
((
NPS
::
BeamReaction
*
)
fsm
)
->
SetStepSize
(
m_TargetThickness
/
m_TargetNbSlices
);
m_ReactionModel
.
push_back
(
fsm
);
fsm
=
new
NPS
::
Decay
(
"Decay"
,
m_ReactionRegion
);
m_ReactionModel
.
push_back
(
fsm
);
...
...
@@ -486,73 +479,6 @@ void Target::InitializeRootOutput()
void
Target
::
ReadSensitive
(
const
G4Event
*
)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Return the slow down beam energy after interaction at ZInteraction with initial beam energy before target IncidentEnergy
G4double
Target
::
SlowDownBeam
(
G4ParticleDefinition
*
Beam
,
G4double
IncidentEnergy
,
G4double
ZInteraction
,
G4double
IncidentTheta
){
if
(
Beam
->
GetParticleName
()
==
"neutron"
){
return
IncidentEnergy
;
}
if
((
0.5
*
m_TargetThickness
+
ZInteraction
)
<
0
){
cout
<<
"Something is wrong with the Z coordinate of the interaction position"
<<
endl
;
cout
<<
"Check the value of Z(interaction) "
<<
ZInteraction
<<
endl
;
}
G4double
ThicknessBeforeInteraction
=
(
0.5
*
m_TargetThickness
+
ZInteraction
)
/
cos
(
m_TargetAngle
);
G4double
dedx
,
de
;
static
G4EmCalculator
emCalculator
;
if
(
m_TargetType
){
if
(
m_TargetThickness
!=
0
){
for
(
G4int
i
=
0
;
i
<
m_TargetNbLayers
;
i
++
){
dedx
=
emCalculator
.
ComputeTotalDEDX
(
IncidentEnergy
,
Beam
,
m_TargetMaterial
);
de
=
dedx
*
ThicknessBeforeInteraction
/
m_TargetNbLayers
;
IncidentEnergy
-=
de
;
if
(
IncidentEnergy
<
0
){
IncidentEnergy
=
0
;
break
;
}
}
}
}
else
{
// Windows
if
(
m_FrontThickness
!=
0
)
for
(
G4int
i
=
0
;
i
<
m_TargetNbLayers
;
i
++
){
dedx
=
emCalculator
.
ComputeTotalDEDX
(
IncidentEnergy
,
Beam
,
m_FrontMaterial
);
de
=
dedx
*
m_FrontThickness
/
(
cos
(
IncidentTheta
)
*
m_TargetNbLayers
);
IncidentEnergy
-=
de
;
if
(
IncidentEnergy
<
0
){
IncidentEnergy
=
0
;
break
;
}
}
// Target
if
(
m_TargetThickness
!=
0
)
for
(
G4int
i
=
0
;
i
<
m_TargetNbLayers
;
i
++
){
dedx
=
emCalculator
.
ComputeTotalDEDX
(
IncidentEnergy
,
Beam
,
m_TargetMaterial
);
de
=
dedx
*
ThicknessBeforeInteraction
/
m_TargetNbLayers
;
IncidentEnergy
-=
de
;
if
(
IncidentEnergy
<
0
){
IncidentEnergy
=
0
;
break
;
}
}
}
if
(
IncidentEnergy
<
0
)
IncidentEnergy
=
0
;
return
IncidentEnergy
;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
Target
::
RandomGaussian2D
(
double
MeanX
,
double
MeanY
,
double
SigmaX
,
double
SigmaY
,
double
&
X
,
double
&
Y
,
double
NumberOfSigma
){
...
...
This diff is collapsed.
Click to expand it.
NPSimulation/Core/Target.hh
+
2
−
5
View file @
65504a6a
...
...
@@ -75,9 +75,6 @@ public:
// (interaction coordinates) are well located inside the target volume
bool
IsInsideTarget
()
{
return
false
;};
// Return the slow down beam energy after interaction at ZInteraction with initial beam energy before target IncidentEnergy
G4double
SlowDownBeam
(
G4ParticleDefinition
*
Beam
,
G4double
IncidentEnergy
,
G4double
ZInteraction
,
G4double
IncidentTheta
);
// Used to simulate beam emmitance effect
void
RandomGaussian2D
(
double
MeanX
,
double
MeanY
,
double
SigmaX
,
double
SigmaY
,
double
&
X
,
double
&
Y
,
double
NumberOfSigma
=
10000
);
...
...
@@ -94,7 +91,7 @@ public:
G4double
GetTargetY
()
{
return
m_TargetY
;}
G4double
GetTargetZ
()
{
return
m_TargetZ
;}
G4ThreeVector
GetTargetPosition
()
{
return
G4ThreeVector
(
m_TargetX
,
m_TargetY
,
m_TargetZ
);}
G4
int
GetTargetNb
Layer
s
()
{
return
m_TargetNb
Layer
s
;}
G4
double
GetTargetNb
Slice
s
()
{
return
m_TargetNb
Slice
s
;}
G4Tubs
*
GetTargetSolid
()
{
return
m_TargetSolid
;}
G4LogicalVolume
*
GetTargetLogic
()
{
return
m_TargetLogic
;}
...
...
@@ -113,7 +110,7 @@ private:
G4double
m_TargetRadius
;
G4double
m_TargetAngle
;
G4Material
*
m_TargetMaterial
;
G4
int
m_TargetNb
Layer
s
;
G4
double
m_TargetNb
Slice
s
;
G4Material
*
m_TargetBackingMaterial
;
G4double
m_TargetBackingThickness
;
...
...
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