SCT parametric simulation
Contents |
Configure example
There is an example of running the entire chain from generating particles to running an analysis tool. A more detailed description of the algorithms and their parameters is presented below.
from Configurables import ApplicationMgr from Gaudi.Configuration import * from Configurables import GenAlg, EvtGenInterface from Configurables import HepMCToEDMConverter from Configurables import ScTauDataSvc from Configurables import Gaudi__ParticlePropertySvc from PathResolver import PathResolver ############################ #### Event generation #### ############################ podioevent = ScTauDataSvc("EventDataSvc") # Particle service particlePropertySvc = Gaudi__ParticlePropertySvc( "ParticlePropertySvc", ParticlePropertiesFile=PathResolver.FindDataFile('GenParticleData/ParticleTable.txt') ) # EvtGen evtgen = EvtGenInterface('SignalProvider') #evtgen.userdec = "./mydec.dec" #evtgen.rootParticle = "J/psi" gen = GenAlg('EvtGenAlg', SignalProvider=evtgen) gen.hepmc.Path = 'hepmc' # HepMC3 to PODIO edm = HepMCToEDMConverter("Converter") edm.hepmc.Path=gen.hepmc.Path edm.genparticles.Path="allGenParticles" edm.genvertices.Path="allGenVertices" ############################ # SctParSim ############################ from Configurables import SctParSimAlg sct_alg = SctParSimAlg('SctAlg') #sct_alg.CaloSystemTool.caloClSizeEGamma = 0.2 # Example how to change a subsystem parameter ############################ # Podio output ############################ out = PodioOutput('out', filename=ofile) out.outputCommands = ["keep *"] ############################ # Analisis ############################ from Configurables import EventLoader from Configurables import NtupleAlg, NTupleSvc from Configurables import ParticleCombinerAlg evlo = EventLoader('EvtLoader') evlo.pcl.Path = 'Particles' # Branch (in the input ROOT-file) for reading evlo.pListMap.Path = 'Lists1' evlo.plists = [['gamma']] # Partilce list for further analisis # Select particle combinations cmbr = ParticleCombinerAlg('Cmbr', decStr = 'pi0 -> gamma gamma', # Investigated decay cutStr = 'E > 0.5', # Selection criteria selfConj = True # if neutral particle True, else False ) cmbr.pListMapI = evlo.pListMap.Path cmbr.pListMapO.Path = 'Lists2' # Select variables to save to n-tuple tupl = NtupleAlg('piTuple') tupl.listName = 'pi0' tupl.fileName = 'scttuple/tup' # List contains the particle parametes to write an output file tupl.vars = [['px_mc', 'py_mc', 'pz_mc', 'E', 'pi0 -> ^gamma ^gamma'], ['M', ''], ] tupl.pListMapI.Path = cmbr.pListMapO.Path NTupleSvc(Output = ["scttuple DATAFILE='tup.root' OPT='NEW' TYP='ROOT'"]) ############################ # Running algorithms ############################ options= { 'TopAlg' : [gen, edm, sct_alg, evlo, cmbr, tupl, out], 'EvtSel' : 'NONE', 'ExtSvc' : [particlePropertySvc, podioevent], 'EvtMax' : 10000, 'StatusCodeCheck' : True, 'AuditAlgorithms' : True, 'AuditTools' : True, 'AuditServices' : True, 'OutputLevel' : INFO, 'HistogramPersistency' : 'ROOT', } ApplicationMgr(**options)
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
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 parametres:
- input - an input file name
- collections - a name of a branch with MC particles
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
EvtGen
More information about EvtGen is here.
EvtGen
function 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.