Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JZCaPA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Riccardo Longo
JZCaPA
Commits
a0ac4951
Commit
a0ac4951
authored
3 years ago
by
Chad Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Added absorption
parent
ec52a20a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MonteCarlo/src/FiberSD.cc
+32
-18
32 additions, 18 deletions
MonteCarlo/src/FiberSD.cc
with
32 additions
and
18 deletions
MonteCarlo/src/FiberSD.cc
+
32
−
18
View file @
a0ac4951
...
...
@@ -160,30 +160,44 @@ G4bool FiberSD::ProcessHits(G4Step* aStep,G4TouchableHistory*){
//instead of reflected back downward
// if( 3.1415/2.0 - atan( momentum.y() / ( 1-momentum.y() ) ) >= asin(1.0/Rindex) ){
if
(
momentum
.
y
()
>
0.0
){
//Now check for total internal reflection
//There are potentially multiple processes for our post step point, so we get the vector
//and step through it looking for TIR
G4ProcessVector
*
postStepDoItVector
=
opticalphoton
->
GetProcessManager
()
->
GetPostStepProcessVector
(
typeDoIt
);
G4int
n_proc
=
postStepDoItVector
->
entries
();
for
(
G4int
i
=
0
;
i
<
n_proc
;
++
i
){
G4OpBoundaryProcess
*
opProc
=
dynamic_cast
<
G4OpBoundaryProcess
*>
((
*
postStepDoItVector
)[
i
]);
if
(
opProc
&&
opProc
->
GetStatus
()
==
TotalInternalReflection
){
if
(
REDUCED_TREE
){
m_cherenkovVec
->
at
(
rodNum
)
++
;
FillTimeVector
(
rodNum
,
aStep
->
GetTrack
()
->
GetGlobalTime
()
);
m_nHits
++
;
return
true
;
}
//end if REDUCED_TREE
FiberHit
*
newHit
=
new
FiberHit
();
newHit
->
setPos
(
pos
);
newHit
->
setOrigin
(
aStep
->
GetTrack
()
->
GetVertexPosition
()
);
newHit
->
setMomentum
(
momentum
);
newHit
->
setEnergy
(
aStep
->
GetPreStepPoint
()
->
GetTotalEnergy
()
);
newHit
->
setTime
(
aStep
->
GetTrack
()
->
GetGlobalTime
()
);
newHit
->
setRodNb
(
rodNum
);
fiberCollection
->
insert
(
newHit
);
m_nHits
++
;
//Here we're simulating absorption. We determine the full path length of the photon within the fiber
//and roll a random number against it's chance of absorption. If it's not absorbed record it
G4MaterialPropertyVector
*
AbsMPV
=
MPT
->
GetProperty
(
kABSLENGTH
);
G4double
Absorption
=
AbsMPV
->
Value
(
aStep
->
GetTrack
()
->
GetDynamicParticle
()
->
GetTotalMomentum
(),
index
);
G4ThreeVector
momDir
=
aStep
->
GetPreStepPoint
()
->
GetMomentumDirection
();
//pathLength = (distance to top of fiber)/sin(polarAngle); polarAngle = atan(y/sqrt(x^2 + z^2));
G4double
pathLength
=
(
m_topOfVolume
-
pos
.
y
())
/
sin
(
atan
(
momDir
.
y
()
/
sqrt
(
pow
(
momDir
.
x
(),
2.0
)
+
pow
(
momDir
.
z
(),
2.0
)
)
)
);
G4double
absChance
=
exp
(
-
pathLength
/
Absorption
);
if
(
CLHEP
::
RandFlat
::
shoot
(
0.0
,
1.0
)
<
absChance
){
//This check amounts to if(!absorbed)
//Finally, record the ouput
if
(
REDUCED_TREE
){
m_cherenkovVec
->
at
(
rodNum
)
++
;
FillTimeVector
(
rodNum
,
aStep
->
GetTrack
()
->
GetGlobalTime
()
);
m_nHits
++
;
return
true
;
}
else
{
FiberHit
*
newHit
=
new
FiberHit
();
newHit
->
setPos
(
pos
);
newHit
->
setOrigin
(
aStep
->
GetTrack
()
->
GetVertexPosition
()
);
newHit
->
setMomentum
(
momentum
);
newHit
->
setEnergy
(
aStep
->
GetPreStepPoint
()
->
GetTotalEnergy
()
);
newHit
->
setTime
(
aStep
->
GetTrack
()
->
GetGlobalTime
()
);
newHit
->
setRodNb
(
rodNum
);
fiberCollection
->
insert
(
newHit
);
m_nHits
++
;
}
//end if REDUCED_TREE
}
//end if !absorbed
}
//end if opProc && TotalInternalReflection
}
//end for n_proc
}
...
...
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