SCT parametric simulation
From Charm-Tau Detector
(Difference between revisions)
(Blanked the page) |
|||
Line 1: | Line 1: | ||
+ | = Configure example = | ||
+ | There is an example of running the entire chain from generating particles to running an analysis tool. | ||
+ | |||
+ | <pre> | ||
+ | from Configurables import ApplicationMgr | ||
+ | |||
+ | from Gaudi.Configuration import * | ||
+ | from Configurables import GenAlg, EvtGenInterface | ||
+ | from Configurables import HepMCToEDMConverter | ||
+ | from Configurables import ScTauDataSvc | ||
+ | |||
+ | from Configurables import PodioOutput | ||
+ | |||
+ | from Configurables import SctParSimAlg | ||
+ | from Configurables import EventLoader | ||
+ | from Configurables import NtupleAlg, NTupleSvc | ||
+ | from Configurables import ParticleCombinerAlg | ||
+ | |||
+ | from Configurables import Gaudi__ParticlePropertySvc | ||
+ | from PathResolver import PathResolver | ||
+ | |||
+ | ofile = 'sctparsim_out.root' # name of output file | ||
+ | eventNumber = 50000 # number of events | ||
+ | |||
+ | ############################ | ||
+ | #### 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 | ||
+ | ############################ | ||
+ | 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 | ||
+ | ############################ | ||
+ | |||
+ | 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'"]) | ||
+ | |||
+ | options= { | ||
+ | 'TopAlg' : [gen, edm, sct_alg, evlo, cmbr, tupl, out], | ||
+ | 'EvtSel' : 'NONE', | ||
+ | 'ExtSvc' : [particlePropertySvc, podioevent], | ||
+ | 'EvtMax' : eventNumber, | ||
+ | 'StatusCodeCheck' : True, | ||
+ | 'AuditAlgorithms' : True, | ||
+ | 'AuditTools' : True, | ||
+ | 'AuditServices' : True, | ||
+ | 'OutputLevel' : INFO, | ||
+ | 'HistogramPersistency' : 'ROOT', | ||
+ | } | ||
+ | |||
+ | ApplicationMgr(**options) | ||
+ | </pre> | ||
+ | |||
+ | == Event generation == | ||
+ | === Podio input === | ||
+ | === Particle gun === | ||
+ | === EvtGen === | ||
+ | == SctParSim == | ||
+ | == Analysis == | ||
+ | == Podio output == |
Revision as of 12:29, 21 November 2021
Contents |
Configure example
There is an example of running the entire chain from generating particles to running an analysis tool.
from Configurables import ApplicationMgr from Gaudi.Configuration import * from Configurables import GenAlg, EvtGenInterface from Configurables import HepMCToEDMConverter from Configurables import ScTauDataSvc from Configurables import PodioOutput from Configurables import SctParSimAlg from Configurables import EventLoader from Configurables import NtupleAlg, NTupleSvc from Configurables import ParticleCombinerAlg from Configurables import Gaudi__ParticlePropertySvc from PathResolver import PathResolver ofile = 'sctparsim_out.root' # name of output file eventNumber = 50000 # number of events ############################ #### 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 ############################ 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 ############################ 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'"]) options= { 'TopAlg' : [gen, edm, sct_alg, evlo, cmbr, tupl, out], 'EvtSel' : 'NONE', 'ExtSvc' : [particlePropertySvc, podioevent], 'EvtMax' : eventNumber, 'StatusCodeCheck' : True, 'AuditAlgorithms' : True, 'AuditTools' : True, 'AuditServices' : True, 'OutputLevel' : INFO, 'HistogramPersistency' : 'ROOT', } ApplicationMgr(**options)