SCT parametric simulation
(→Podio input) |
(→SctParSim) |
||
(17 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
+ | = How to run = | ||
+ | |||
+ | Login to stark or proxima machine. | ||
+ | <pre> | ||
+ | ssh stark -X | ||
+ | setupSCTAU; asetup SCTauSim,master,latest | ||
+ | mkdir workarea | ||
+ | cd workarea | ||
+ | mkdir run | ||
+ | cd run | ||
+ | cp /home/razuvaev/public/misc/pi_ms_f1_mppc2_px3_d200_mla4_graph2d.root . | ||
+ | cp /home/razuvaev/public/misc/g4beamline_pi_plus_100k_parse.root . | ||
+ | cp /home/razuvaev/public/misc/g4beamline_mu_plus_100k_parse.root . | ||
+ | ctaurun SctParSimAlg/sctparsim_test_particle_gun.py | ||
+ | </pre> | ||
+ | |||
= Configure example = | = Configure example = | ||
− | There | + | There are some examples to run the parametric simulation |
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Using tools | ||
+ | ! Link | ||
+ | |- | ||
+ | | Read from a ROOT-file, write to a ROOT-file | ||
+ | | [https://git.inp.nsk.su/sctau/aurora/-/blob/master/Simulation/SctParSimAlg/jobOptions/sctparsim_test_read.py sctparsim_test_read.py] | ||
+ | |- | ||
+ | | Generate using the particle gun, write to a ROOT-file | ||
+ | | [https://git.inp.nsk.su/sctau/aurora/-/blob/master/Simulation/SctParSimAlg/jobOptions/sctparsim_test_particle_gun.py sctparsim_test_particle_gun.py] | ||
+ | |- | ||
+ | | Generate using <code>EvtGen</code>, write to a ROOT-file | ||
+ | | [https://git.inp.nsk.su/sctau/aurora/-/blob/master/Simulation/SctParSimAlg/jobOptions/sctparsim_test_evtgen.py sctparsim_test_evtgen.py] | ||
+ | |- | ||
+ | | Generate using <code>EvtGen</code>, use the analysis tool | ||
+ | | [https://git.inp.nsk.su/sctau/aurora/-/blob/master/Simulation/SctParSimAlg/jobOptions/sct_run_test_analisis.py sct_run_test_analisis.py] | ||
+ | |} | ||
+ | == Event generation == | ||
+ | |||
+ | The "Event generation" block may contain other options: to read a ROOT file, to generate using the particle gun tool and to generate using EvtGen. | ||
+ | |||
+ | === Podio input === | ||
+ | |||
+ | It is possible to read the particle parameters from a ROOT file. | ||
+ | |||
+ | You have to import the library | ||
<pre> | <pre> | ||
− | from Configurables import | + | from Configurables import PodioInput |
+ | </pre> | ||
− | + | and to create the algorithm instance | |
− | + | <pre> | |
− | + | podioevent = ScTauDataSvc("EventDataSvc", input="fileName.root") | |
− | + | podioinput = PodioInput("PodioReader", OutputLevel=INFO, collections=['allGenParticles']) | |
+ | </pre> | ||
− | + | The reading algorithm has the following parameters: | |
+ | * input - an input file name | ||
+ | * collections - a name of a branch with MC particles | ||
− | from Configurables import | + | === Particle gun === |
− | from Configurables import | + | |
− | from Configurables import | + | To use the particle gun algorithm, it is necessary to import the following libraries |
− | from Configurables import | + | <pre> |
+ | from Configurables import ParticleGun | ||
+ | from Configurables import GenAlg | ||
+ | from Configurables import HepMCToEDMConverter | ||
+ | from Configurables import HepMCFileWriter | ||
from Configurables import Gaudi__ParticlePropertySvc | from Configurables import Gaudi__ParticlePropertySvc | ||
from PathResolver import PathResolver | from PathResolver import PathResolver | ||
+ | </pre> | ||
− | + | and to write the following strings | |
− | + | <pre> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
particlePropertySvc = Gaudi__ParticlePropertySvc( | particlePropertySvc = Gaudi__ParticlePropertySvc( | ||
"ParticlePropertySvc", | "ParticlePropertySvc", | ||
Line 35: | Line 79: | ||
) | ) | ||
− | + | from math import pi | |
− | + | guntool = ParticleGun("PdgCodes", PdgCodes=[211]) | |
− | + | guntool.OutputLevel=DEBUG | |
− | + | ||
− | + | guntool.MomentumMin = 0 * units.MeV | |
− | + | guntool.MomentumMax = 4 * units.GeV | |
− | + | guntool.ThetaMin = 0 * units.rad | |
− | + | guntool.ThetaMax = pi * units.rad | |
− | + | ||
− | + | ||
− | + | ||
− | + | guntool.PhiMin = 0 * units.rad | |
− | + | guntool.PhiMax = 2 * pi * units.rad | |
− | + | ||
− | + | ||
− | + | ||
− | + | gun = GenAlg("ParticleGun", SignalProvider=guntool) | |
− | + | gun.hepmc.Path = "hepmc" | |
− | + | ||
− | + | ||
− | + | ||
− | + | writer = HepMCFileWriter("HepMCFileWriter") | |
− | + | writer.hepmc.Path="hepmc" | |
− | + | ||
− | + | hepmc_converter = HepMCToEDMConverter("Converter") | |
− | + | hepmc_converter.hepmc.Path="hepmc" | |
− | + | hepmc_converter.genparticles.Path="allGenParticles" | |
− | + | hepmc_converter.genvertices.Path="allGenVertices" | |
+ | </pre> | ||
− | + | Some parameters can be changed: | |
− | + | * PdgCodes - a list containing particles PDG codes to generate | |
− | + | * MomentumMin - a minimum particle momentum | |
− | + | * MomentumMax - a maximum particle momentum | |
− | + | * ThetaMin - a minimum theta angle | |
− | + | * ThetaMax - a maximum theta angle | |
+ | * PhiMin - a minimum phi angle | ||
+ | * PhiMax - a maximum phi angle | ||
− | + | === EvtGen === | |
− | + | ||
− | + | More information about EvtGen is [https://ctd.inp.nsk.su/wiki/index.php/Event_generators here]. | |
− | + | ||
− | + | ||
− | + | ||
− | + | <code>EvtGen</code> interface has the following parameters: | |
− | + | * <code>dec</code> - EvtGen users decay file. It can be one of the included in Aurora files or absolute path to your own decay file. Inclusive MC generation does not require user decay file | |
− | + | * <code>root</code> - root particle for EvtGen. <code>vpho</code> (virtual photon) should be used for non-resonant processes | |
− | + | ** Acceptable root particles: <code>vpho</code>, <code>J/psi</code>, <code>psi(2S)</code>, <code>psi(3770)</code>, <code>psi(4040)</code>, <code>psi(4160)</code>, <code>psi(4415)</code>. For more details see Generation/GenTools/GenWrappers/python/EvtGenTools.py in Aurora. | |
+ | * <code>ecms</code> - center-of-mass energy (mass of the root particle). The parameter <code>ecms</code> must be set for virtual photon while for other root particles (<math>J/\psi</math>, <math>\psi(2S)</math>, ...) this parameter is optional. Mean mass of the root particle is adopted if <code>ecms</code> is omitted. | ||
+ | * <code>nevt</code> - number if events to be gnerated | ||
+ | * <code>ip</code> - uniform 3D smearing (in mm) for the primary vertex | ||
+ | * <code>ofile</code> - output file name | ||
+ | One can change these parameters to change behaviour of EvtGen and to produce arbitrary MC sample. | ||
− | + | == SctParSim == | |
− | + | ||
− | + | To run the parametric simulation, the script has to have two lines: | |
− | + | <pre> | |
− | + | from Configurables import SctParSimAlg | |
− | + | sct_alg = SctParSimAlg('SctAlg') | |
− | + | </pre> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | To change some detector parameters, write strings of the following structure | |
+ | <pre> | ||
+ | sct_alg.detectorSubsystemName.parameter = mean | ||
</pre> | </pre> | ||
− | + | The full parameters list is [https://ctd.inp.nsk.su/wiki/index.php/SctParSim_(Aurora) here]. | |
− | + | ||
− | It is possible to | + | == Analysis == |
+ | |||
+ | The analysis tool has the following parameters: | ||
+ | * EventLoader | ||
+ | ** pcl.Path - a branch (in the input ROOT-file) for reading | ||
+ | ** plists - a partilce list for further analisis. if it is necessary to consider not only positive, but also negative particles, the label "сс" is used. For example <code>[['K+ cc'], ['pi+ cc']]</code>. Also it is possible to write a kinematic constraint; for example <code>[['K+ cc', 'p > 0.5'], ['pi+ cc']]</code> (kaons don't have the momentum less then 0.5 GeV) | ||
+ | |||
+ | * ParticleCombinerAlg | ||
+ | ** decStr - an investigated decay | ||
+ | ** cutStr - a selection criteria | ||
+ | ** selfConj - if neutral particle <code>True</code>, else <code>False</code> | ||
+ | |||
+ | * NtupleAlg | ||
+ | ** vars - a list contains the particle parameters to write an output file. A particle in the decay string can be selected using the "^" symbol. If a decay isn't written (<code>''</code>), the information about parameters will be about a parent particle. | ||
+ | |||
+ | More information about the analysis tool is [https://ctd.inp.nsk.su/wiki/index.php/Use_Analysis_package here]. | ||
+ | |||
+ | == Podio output == | ||
+ | |||
+ | It is possible to write the particle parameters to a ROOT file. | ||
You have to import the library | You have to import the library | ||
<pre> | <pre> | ||
− | from Configurables import | + | from Configurables import PodioOutput |
</pre> | </pre> | ||
and to create the algorithm instance | and to create the algorithm instance | ||
<pre> | <pre> | ||
− | + | out = PodioOutput('out', filename=ofile) | |
− | + | out.outputCommands = ["keep *"] | |
</pre> | </pre> | ||
− | The | + | The reading algorithm has the parameter: filename - an output file name. |
− | + | ||
− | + | ||
− | == | + | == Running algorithm == |
− | + | ||
− | + | Some necessary parametrs to run the algorithms: | |
− | + | * TopAlg - a list of the using algorithms | |
− | + | * EvtMax - a number of events |
Latest revision as of 13:34, 24 November 2021
Contents |
[edit] How to run
Login to stark or proxima machine.
ssh stark -X setupSCTAU; asetup SCTauSim,master,latest mkdir workarea cd workarea mkdir run cd run cp /home/razuvaev/public/misc/pi_ms_f1_mppc2_px3_d200_mla4_graph2d.root . cp /home/razuvaev/public/misc/g4beamline_pi_plus_100k_parse.root . cp /home/razuvaev/public/misc/g4beamline_mu_plus_100k_parse.root . ctaurun SctParSimAlg/sctparsim_test_particle_gun.py
[edit] Configure example
There are some examples to run the parametric simulation
Using tools | Link |
---|---|
Read from a ROOT-file, write to a ROOT-file | sctparsim_test_read.py |
Generate using the particle gun, write to a ROOT-file | sctparsim_test_particle_gun.py |
Generate using EvtGen , write to a ROOT-file
|
sctparsim_test_evtgen.py |
Generate using EvtGen , use the analysis tool
|
sct_run_test_analisis.py |
[edit] Event generation
The "Event generation" block may contain other options: to read a ROOT file, to generate using the particle gun tool and to generate using EvtGen.
[edit] Podio input
It is possible to read the particle parameters from a ROOT file.
You have to import the library
from Configurables import PodioInput
and to create the algorithm instance
podioevent = ScTauDataSvc("EventDataSvc", input="fileName.root") podioinput = PodioInput("PodioReader", OutputLevel=INFO, collections=['allGenParticles'])
The reading algorithm has the following parameters:
- input - an input file name
- collections - a name of a branch with MC particles
[edit] Particle gun
To use the particle gun algorithm, it is necessary to import the following libraries
from Configurables import ParticleGun from Configurables import GenAlg from Configurables import HepMCToEDMConverter from Configurables import HepMCFileWriter from Configurables import Gaudi__ParticlePropertySvc from PathResolver import PathResolver
and to write the following strings
particlePropertySvc = Gaudi__ParticlePropertySvc( "ParticlePropertySvc", ParticlePropertiesFile=PathResolver.FindDataFile('GenParticleData/ParticleTable.txt') ) from math import pi guntool = ParticleGun("PdgCodes", PdgCodes=[211]) guntool.OutputLevel=DEBUG guntool.MomentumMin = 0 * units.MeV guntool.MomentumMax = 4 * units.GeV guntool.ThetaMin = 0 * units.rad guntool.ThetaMax = pi * units.rad guntool.PhiMin = 0 * units.rad guntool.PhiMax = 2 * pi * units.rad gun = GenAlg("ParticleGun", SignalProvider=guntool) gun.hepmc.Path = "hepmc" writer = HepMCFileWriter("HepMCFileWriter") writer.hepmc.Path="hepmc" hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path="hepmc" hepmc_converter.genparticles.Path="allGenParticles" hepmc_converter.genvertices.Path="allGenVertices"
Some parameters can be changed:
- PdgCodes - a list containing particles PDG codes to generate
- MomentumMin - a minimum particle momentum
- MomentumMax - a maximum particle momentum
- ThetaMin - a minimum theta angle
- ThetaMax - a maximum theta angle
- PhiMin - a minimum phi angle
- PhiMax - a maximum phi angle
[edit] EvtGen
More information about EvtGen is here.
EvtGen
interface has the following parameters:
-
dec
- EvtGen users decay file. It can be one of the included in Aurora files or absolute path to your own decay file. Inclusive MC generation does not require user decay file -
root
- root particle for EvtGen.vpho
(virtual photon) should be used for non-resonant processes- Acceptable root particles:
vpho
,J/psi
,psi(2S)
,psi(3770)
,psi(4040)
,psi(4160)
,psi(4415)
. For more details see Generation/GenTools/GenWrappers/python/EvtGenTools.py in Aurora.
- Acceptable root particles:
-
ecms
- center-of-mass energy (mass of the root particle). The parameterecms
must be set for virtual photon while for other root particles (, , ...) this parameter is optional. Mean mass of the root particle is adopted ifecms
is omitted. -
nevt
- number if events to be gnerated -
ip
- uniform 3D smearing (in mm) for the primary vertex -
ofile
- output file name
One can change these parameters to change behaviour of EvtGen and to produce arbitrary MC sample.
[edit] SctParSim
To run the parametric simulation, the script has to have two lines:
from Configurables import SctParSimAlg sct_alg = SctParSimAlg('SctAlg')
To change some detector parameters, write strings of the following structure
sct_alg.detectorSubsystemName.parameter = mean
The full parameters list is here.
[edit] Analysis
The analysis tool has the following parameters:
- EventLoader
- pcl.Path - a branch (in the input ROOT-file) for reading
- plists - a partilce list for further analisis. if it is necessary to consider not only positive, but also negative particles, the label "сс" is used. For example
[['K+ cc'], ['pi+ cc']]
. Also it is possible to write a kinematic constraint; for example[['K+ cc', 'p > 0.5'], ['pi+ cc']]
(kaons don't have the momentum less then 0.5 GeV)
- ParticleCombinerAlg
- decStr - an investigated decay
- cutStr - a selection criteria
- selfConj - if neutral particle
True
, elseFalse
- NtupleAlg
- vars - a list contains the particle parameters to write an output file. A particle in the decay string can be selected using the "^" symbol. If a decay isn't written (
), the information about parameters will be about a parent particle.
- vars - a list contains the particle parameters to write an output file. A particle in the decay string can be selected using the "^" symbol. If a decay isn't written (
More information about the analysis tool is here.
[edit] Podio output
It is possible to write the particle parameters to a ROOT file.
You have to import the library
from Configurables import PodioOutput
and to create the algorithm instance
out = PodioOutput('out', filename=ofile) out.outputCommands = ["keep *"]
The reading algorithm has the parameter: filename - an output file name.
[edit] Running algorithm
Some necessary parametrs to run the algorithms:
- TopAlg - a list of the using algorithms
- EvtMax - a number of events