Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CEPCSW
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Li Zhihao
CEPCSW
Commits
6eac7c25
Commit
6eac7c25
authored
1 year ago
by
Haoyu Shi
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
1938074c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Examples/options/test_detsimbg.py
+148
-0
148 additions, 0 deletions
Examples/options/test_detsimbg.py
with
148 additions
and
0 deletions
Examples/options/test_detsimbg.py
0 → 100644
+
148
−
0
View file @
6eac7c25
#!/usr/bin/env python
import
os
import
sys
# sys.exit(0)
from
Gaudi.Configuration
import
*
##############################################################################
# Random Number Svc
##############################################################################
from
Configurables
import
RndmGenSvc
,
HepRndm__Engine_CLHEP__RanluxEngine_
seed
=
[
42
]
# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi
rndmengine
=
HepRndm__Engine_CLHEP__HepJamesRandom_
(
"
RndmGenSvc.Engine
"
)
# The default engine in Geant4
rndmengine
.
SetSingleton
=
True
rndmengine
.
Seeds
=
seed
rndmgensvc
=
RndmGenSvc
(
"
RndmGenSvc
"
)
rndmgensvc
.
Engine
=
rndmengine
.
name
()
##############################################################################
# Event Data Svc
##############################################################################
from
Configurables
import
k4DataSvc
dsvc
=
k4DataSvc
(
"
EventDataSvc
"
)
##############################################################################
# Geometry Svc
##############################################################################
# geometry_option = "CepC_v4-onlyTracker.xml"
geometry_option
=
"
CepC_v4.xml
"
if
not
os
.
getenv
(
"
DETCEPCV4ROOT
"
):
print
(
"
Can
'
t find the geometry. Please setup envvar DETCEPCV4ROOT.
"
)
sys
.
exit
(
-
1
)
geometry_path
=
os
.
path
.
join
(
os
.
getenv
(
"
DETCEPCV4ROOT
"
),
"
compact
"
,
geometry_option
)
if
not
os
.
path
.
exists
(
geometry_path
):
print
(
"
Can
'
t find the compact geometry file: %s
"
%
geometry_path
)
sys
.
exit
(
-
1
)
from
Configurables
import
GeomSvc
geosvc
=
GeomSvc
(
"
GeomSvc
"
)
geosvc
.
compact
=
geometry_path
from
Configurables
import
TimeProjectionChamberSensDetTool
tpc_sensdettool
=
TimeProjectionChamberSensDetTool
(
"
TimeProjectionChamberSensDetTool
"
)
tpc_sensdettool
.
TypeOption
=
1
##############################################################################
# Physics Generator
##############################################################################
from
Configurables
import
GenAlgo
from
Configurables
import
GtGunTool
from
Configurables
import
StdHepRdr
from
Configurables
import
SLCIORdr
from
Configurables
import
HepMCRdr
from
Configurables
import
GenPrinter
from
Configurables
import
GtBeamBackgroundTool
bg
=
GtBeamBackgroundTool
(
"
GtBeamBackgroundTool
"
)
bg
.
InputFileMap
=
{
"
default
"
:
"
Test/0/ToCEPCSW.out
"
}
bg
.
InputBeamEnergyMap
=
{
"
default
"
:
120.
}
#GeV
bg
.
RotationAlongYMap
=
{
"
default
"
:
16.5e-3
}
# radian
#gun.Particles = ["pi+"]
#gun.EnergyMins = [100.] # GeV
#gun.EnergyMaxs = [100.] # GeV
#gun.ThetaMins = [0] # rad; 45deg
#gun.ThetaMaxs = [180.] # rad; 45deg
#gun.PhiMins = [0] # rad; 0deg
#gun.PhiMaxs = [360.] # rad; 360deg
# stdheprdr = StdHepRdr("StdHepRdr")
# stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep"
# lciordr = SLCIORdr("SLCIORdr")
# lciordr.Input = "/cefs/data/stdhep/lcio250/signal/Higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.slcio"
# hepmcrdr = HepMCRdr("HepMCRdr")
# hepmcrdr.Input = "example_UsingIterators.txt"
genprinter
=
GenPrinter
(
"
GenPrinter
"
)
genalg
=
GenAlgo
(
"
GenAlgo
"
)
genalg
.
GenTools
=
[
"
GtBeamBackgroundTool
"
]
# genalg.GenTools = ["StdHepRdr"]
# genalg.GenTools = ["StdHepRdr", "GenPrinter"]
# genalg.GenTools = ["SLCIORdr", "GenPrinter"]
# genalg.GenTools = ["HepMCRdr", "GenPrinter"]
##############################################################################
# Detector Simulation
##############################################################################
from
Configurables
import
DetSimSvc
detsimsvc
=
DetSimSvc
(
"
DetSimSvc
"
)
# from Configurables import ExampleAnaElemTool
# example_anatool = ExampleAnaElemTool("ExampleAnaElemTool")
from
Configurables
import
DetSimAlg
detsimalg
=
DetSimAlg
(
"
DetSimAlg
"
)
detsimalg
.
RandomSeeds
=
seed
# detsimalg.VisMacs = ["vis.mac"]
detsimalg
.
RunCmds
=
[
# "/tracking/verbose 1",
]
detsimalg
.
AnaElems
=
[
# example_anatool.name()
# "ExampleAnaElemTool"
"
Edm4hepWriterAnaElemTool
"
]
detsimalg
.
RootDetElem
=
"
WorldDetElemTool
"
from
Configurables
import
AnExampleDetElemTool
example_dettool
=
AnExampleDetElemTool
(
"
AnExampleDetElemTool
"
)
##############################################################################
# POD I/O
##############################################################################
from
Configurables
import
PodioOutput
out
=
PodioOutput
(
"
outputalg
"
)
out
.
filename
=
"
Test/0/test-detsim10.root
"
out
.
outputCommands
=
[
"
keep *
"
]
##############################################################################
# ApplicationMgr
##############################################################################
from
Configurables
import
ApplicationMgr
ApplicationMgr
(
TopAlg
=
[
genalg
,
detsimalg
,
out
],
EvtSel
=
'
NONE
'
,
EvtMax
=
3000
,
ExtSvc
=
[
rndmengine
,
rndmgensvc
,
dsvc
,
geosvc
],
)
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