Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
athena
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Ran Bi
athena
Commits
44f16b02
Commit
44f16b02
authored
4 years ago
by
Benedict Tobias Winter
Browse files
Options
Downloads
Patches
Plain Diff
Add PG JOs for FCS with energy range instead of fixed energy
parent
7126e82e
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
Generators/ParticleGun/share/common/ParticleGun_FastCalo_Config_Erange.py
+103
-0
103 additions, 0 deletions
...cleGun/share/common/ParticleGun_FastCalo_Config_Erange.py
with
103 additions
and
0 deletions
Generators/ParticleGun/share/common/ParticleGun_FastCalo_Config_Erange.py
0 → 100644
+
103
−
0
View file @
44f16b02
#! -*- python -*-
evgenConfig
.
description
=
"
Single particle gun for FastCaloSim event generation
"
evgenConfig
.
keywords
=
[
"
singleParticle
"
,]
evgenConfig
.
generators
=
[
"
ParticleGun
"
]
evgenConfig
.
contact
=
[
"
david.sosa@cern.ch
"
]
import
ParticleGun
as
PG
import
ROOT
class
MyParticleSampler
(
PG
.
ParticleSampler
):
def
__init__
(
self
,
energy
,
eta
,
pid
,
shift_z
=
0
):
self
.
pid
=
pid
self
.
shift_z
=
shift_z
pdg_table
=
ROOT
.
TDatabasePDG
.
Instance
()
mass
=
pdg_table
.
GetParticle
(
self
.
pid
()).
Mass
()
self
.
mom1
=
PG
.
EEtaMPhiSampler
(
energy
=
energy
,
eta
=
eta
,
mass
=
mass
)
def
shoot
(
self
):
pid
=
self
.
pid
()
shift_z
=
self
.
shift_z
mom
=
self
.
mom1
.
shoot
()
pos_temp
=
mom
.
Vect
().
Unit
()
# Define geometry
barrelR1
=
1148.0
barrelR2
=
120.0
barrelR3
=
41.0
endcapZ1
=
3550.0
endcapZ2
=
4587.0
# Would it hit the barrel, or the endcap?
tanTheta
=
pos_temp
.
Perp
()
/
abs
(
pos_temp
.
Z
()
);
if
tanTheta
>
barrelR1
/
endcapZ1
:
pos_temp
*=
barrelR1
/
pos_temp
.
Perp
()
elif
tanTheta
>
barrelR2
/
endcapZ1
:
pos_temp
*=
endcapZ1
/
abs
(
pos_temp
.
Z
()
)
elif
tanTheta
>
barrelR2
/
endcapZ2
:
pos_temp
*=
barrelR2
/
pos_temp
.
Perp
()
elif
tanTheta
>
barrelR3
/
endcapZ2
:
pos_temp
*=
endcapZ2
/
abs
(
pos_temp
.
Z
()
)
else
:
pos_temp
*=
barrelR3
/
pos_temp
.
Perp
()
# Shift position of vector in the Z direction
pos_temp_2
=
ROOT
.
TVector3
()
pos_temp_2
.
SetXYZ
(
pos_temp
.
X
(),
pos_temp
.
Y
(),
pos_temp
.
Z
()
+
shift_z
)
pos_temp_2
*=
1.
/
pos_temp_2
.
Mag
();
# reduce magnitude of vector
# recalculate; Would it hit the barrel, or the endcap?
tanTheta_2
=
pos_temp_2
.
Perp
()
/
abs
(
pos_temp_2
.
Z
()
);
if
tanTheta_2
>
barrelR1
/
endcapZ1
:
pos_temp_2
*=
barrelR1
/
pos_temp_2
.
Perp
()
elif
tanTheta_2
>
barrelR2
/
endcapZ1
:
pos_temp_2
*=
endcapZ1
/
abs
(
pos_temp_2
.
Z
()
)
elif
tanTheta_2
>
barrelR2
/
endcapZ2
:
pos_temp_2
*=
barrelR2
/
pos_temp_2
.
Perp
()
elif
tanTheta_2
>
barrelR3
/
endcapZ2
:
pos_temp_2
*=
endcapZ2
/
abs
(
pos_temp_2
.
Z
()
)
else
:
pos_temp_2
*=
barrelR3
/
pos_temp_2
.
Perp
()
pos
=
ROOT
.
TLorentzVector
(
pos_temp_2
.
X
(),
pos_temp_2
.
Y
(),
pos_temp_2
.
Z
(),
pos_temp_2
.
Mag
())
#print "pid ",pid
return
[
PG
.
SampledParticle
(
pid
,
mom
,
pos
)
]
E_li
=
[]
myLowE
=
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
_E
'
)[
1
].
split
(
'
_
'
)[
0
])
myHighE
=
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
_E
'
)[
1
].
split
(
'
_
'
)[
1
])
E_li
.
extend
([
myLowE
,
myHighE
])
myZV
=
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
_
'
)[
-
1
].
split
(
'
.py
'
)[
0
].
replace
(
"
m
"
,
"
-
"
))
myPDGID
=
int
(
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
_pid
'
)[
1
].
split
(
'
_
'
)[
0
].
replace
(
'
m
'
,
'
-
'
)))
eta_li
=
[]
if
"
disj
"
in
runArgs
.
jobConfig
[
0
]:
myLowEta1
=
0.01
*
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
eta_
'
)[
1
].
split
(
'
_
'
)[
0
].
replace
(
'
m
'
,
'
-
'
))
myLowEta2
=
0.01
*
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
eta_
'
)[
1
].
split
(
'
_
'
)[
1
].
replace
(
'
m
'
,
'
-
'
))
myHighEta1
=
0.01
*
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
eta_
'
)[
1
].
split
(
'
_
'
)[
2
].
replace
(
'
m
'
,
'
-
'
))
myHighEta2
=
0.01
*
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
eta_
'
)[
1
].
split
(
'
_
'
)[
3
].
replace
(
'
m
'
,
'
-
'
))
eta_li
.
extend
([
myLowEta1
,
myLowEta2
,
myHighEta1
,
myHighEta2
])
else
:
myLowEta
=
0.01
*
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
eta
'
)[
1
].
split
(
'
_
'
)[
0
].
replace
(
'
m
'
,
'
-
'
))
myHighEta
=
0.01
*
float
(
runArgs
.
jobConfig
[
0
].
split
(
'
eta
'
)[
1
].
split
(
'
_
'
)[
1
].
replace
(
'
m
'
,
'
-
'
))
eta_li
.
extend
([
myLowEta
,
myHighEta
])
print
"
================ SETTTINGS =================
"
print
(
"
energy =
"
,
E_li
)
print
(
"
eta =
"
,
eta_li
)
print
(
"
pid =
"
,
myPDGID
)
print
(
"
shift_z =
"
,
myZV
)
print
"
============================================
"
genSeq
+=
PG
.
ParticleGun
()
print
"
E_li =
"
,
E_li
,
"
, eta_li =
"
,
eta_li
,
"
, pid =
"
,
myPDGID
,
"
, myZV =
"
,
myZV
genSeq
.
ParticleGun
.
sampler
=
MyParticleSampler
(
energy
=
E_li
,
eta
=
eta_li
,
pid
=
myPDGID
,
shift_z
=
myZV
)
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