Exemple #1
0
from Gaudi.Configuration import *

from Configurables import ParticleGunAlg, MomentumRangeParticleGun, Gaudi__ParticlePropertySvc
pgun = MomentumRangeParticleGun(
    "PGun",
    PdgCodes=[11],  # electron
    MomentumMin=10,  # GeV
    MomentumMax=10,  # GeV
    ThetaMin=-0.45,  # rad
    ThetaMax=-0.45,  # rad
    PhiMin=1.6,  # rad
    PhiMax=1.6)  # rad
gen = ParticleGunAlg("ParticleGun", ParticleGunTool=pgun)
gen.DataOutputs.hepmc.Path = "hepmc"
ppservice = Gaudi__ParticlePropertySvc(
    "ParticlePropertySvc",
    ParticlePropertiesFile="../../../Generation/data/ParticleTable.txt")

from Configurables import HepMCConverter
hepmc_converter = HepMCConverter("Converter")
hepmc_converter.DataInputs.hepmc.Path = "hepmc"
hepmc_converter.DataOutputs.genparticles.Path = "allGenParticles"
hepmc_converter.DataOutputs.genvertices.Path = "allGenVertices"

from Configurables import HepMCDumper
hepmc_dump = HepMCDumper("hepmc")
hepmc_dump.DataInputs.hepmc.Path = "hepmc"

from Configurables import GeoSvc
geoservice = GeoSvc("GeoSvc",
                    detectors=['file:compact/Box_dd4hepCaloSD.xml'],
Exemple #2
0
from Gaudi.Configuration import *

# Data service
from Configurables import FCCDataSvc
podioevent = FCCDataSvc("EventDataSvc")

from Configurables import MomentumRangeParticleGun
from GaudiKernel import PhysicalConstants as constants
guntool = MomentumRangeParticleGun()
guntool.ThetaMin = 0
guntool.ThetaMax = 2 * constants.pi
guntool.PdgCodes = [11]
from Configurables import GenAlg
gen = GenAlg()
gen.SignalProvider = guntool
gen.hepmc.Path = "hepmc"

# reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles
from Configurables import HepMCToEDMConverter
hepmc_converter = HepMCToEDMConverter("Converter")
hepmc_converter.hepmc.Path = "hepmc"
hepmc_converter.genparticles.Path = "allGenParticles"
hepmc_converter.genvertices.Path = "allGenVertices"

# DD4hep geometry service
# Parses the given xml file
from Configurables import GeoSvc
geoservice = GeoSvc(
    "GeoSvc",
    detectors=[
        'file:Detector/DetFCChhBaseline1/compact/FCChh_DectEmptyMaster.xml',
Exemple #3
0
from Gaudi.Configuration import *
from Configurables import ApplicationMgr, HepMCReader, HepMCDumper

from Configurables import ParticleGunAlg, MomentumRangeParticleGun

pgun = MomentumRangeParticleGun(
    "PGun",
    PdgCodes=[11],  # electron
    MomentumMin=20,  # GeV
    MomentumMax=20,  # GeV
    ThetaMin=1.58,  # rad
    ThetaMax=1.58,  # rad
    PhiMin=0,  # rad
    PhiMax=0)  # rad
gen = ParticleGunAlg("ParticleGun",
                     ParticleGunTool=pgun,
                     VertexSmearingToolPGun="FlatSmearVertex")
gen.DataOutputs.hepmc.Path = "hepmc"

from Configurables import Gaudi__ParticlePropertySvc
## Particle service
# list of possible particles is defined in ParticlePropertiesFile
ppservice = Gaudi__ParticlePropertySvc(
    "ParticlePropertySvc",
    ParticlePropertiesFile="Generation/data/ParticleTable.txt")

from Configurables import HepMCConverter

hepmc_converter = HepMCConverter("Converter")
hepmc_converter.DataInputs.hepmc.Path = "hepmc"
hepmc_converter.DataOutputs.genparticles.Path = "allGenParticles"
Exemple #4
0
### \ingroup SimulationExamples
### | **input (alg)**               | other algorithms                 |                                                         |                        |                                  | **output (alg)**                              |
### |-------------------------------|----------------------------------|---------------------------------------------------------|------------------------|----------------------------------|-----------------------------------------------|
### | generating single particle events from a given list of types, with momentum, phi and theta from a given range, saving to HepMC | convert `HepMC::GenEvent` to EDM | geometry parsed from XML (TestHCal.xml) by DD4hep using GeoSvc | FTFP_BERT physics list | saving HCal hits | write the EDM output to ROOT file using PODIO |

from Gaudi.Configuration import *

from Configurables import FCCDataSvc
## Data service
podioevent = FCCDataSvc("EventDataSvc")

from Configurables import GenAlg, MomentumRangeParticleGun
## Particle Gun using MomentumRangeParticleGun tool and FlatSmearVertex
# MomentumRangeParticleGun generates particles of given type(s) within given momentum, phi and theta range
# FlatSmearVertex smears the vertex with uniform distribution
guntool = MomentumRangeParticleGun()
gen = GenAlg("ParticleGun",
             SignalProvider=guntool,
             VertexSmearingTool="FlatSmearVertex")
gen.hepmc.Path = "hepmc"

from Configurables import Gaudi__ParticlePropertySvc
## Particle service
# list of possible particles is defined in ParticlePropertiesFile
ppservice = Gaudi__ParticlePropertySvc(
    "ParticlePropertySvc",
    ParticlePropertiesFile="Generation/data/ParticleTable.txt")

from Configurables import HepMCToEDMConverter
## Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles
hepmc_converter = HepMCToEDMConverter("Converter")
Exemple #5
0
from Gaudi.Configuration import *

# Data service
from Configurables import FCCDataSvc
podioevent = FCCDataSvc("EventDataSvc")


from Configurables import GenAlg, MomentumRangeParticleGun
## Particle Gun using MomentumRangeParticleGun tool and FlatSmearVertex
# MomentumRangeParticleGun generates particles of given type(s) within given momentum, phi and theta range
# FlatSmearVertex smears the vertex with uniform distribution

pgun_tool = MomentumRangeParticleGun(PdgCodes=[13, -13])
gen = GenAlg("ParticleGun", SignalProvider=pgun_tool, VertexSmearingTool="FlatSmearVertex")
gen.hepmc.Path = "hepmc"

from Configurables import Gaudi__ParticlePropertySvc
## Particle service
# list of possible particles is defined in ParticlePropertiesFile
ppservice = Gaudi__ParticlePropertySvc("ParticlePropertySvc", ParticlePropertiesFile="Generation/data/ParticleTable.txt")

# DD4hep geometry service
# Parses the given xml file
from Configurables import GeoSvc
geoservice = GeoSvc("GeoSvc", detectors=['file:Detector/DetFCChhBaseline1/compact/FCChh_DectEmptyMaster.xml',
  'file:Detector/DetFCChhTrackerTkLayout/compact/Tracker.xml'],
                    OutputLevel = DEBUG)

from Configurables import HepMCToEDMConverter
## Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles
hepmc_converter = HepMCToEDMConverter("Converter")
                    default=None,
                    help='specify compact file for the geometry')
args, _ = parser.parse_known_args()

from Gaudi.Configuration import *

# Data service
from Configurables import FCCDataSvc
podioevent = FCCDataSvc("EventDataSvc")

from Configurables import GenAlg, MomentumRangeParticleGun
## Particle Gun using MomentumRangeParticleGun tool and FlatSmearVertex
# MomentumRangeParticleGun generates particles of given type(s) within given momentum, phi and theta range
# FlatSmearVertex smears the vertex with uniform distribution

pgun_tool = MomentumRangeParticleGun(PdgCodes=[13, -13])
pgun_tool.ThetaMin = 0.0
pgun_tool.ThetaMax = 2 * 3.14
gen = GenAlg("ParticleGun",
             SignalProvider=pgun_tool,
             VertexSmearingTool="FlatSmearVertex")
gen.hepmc.Path = "hepmc"

from Configurables import Gaudi__ParticlePropertySvc
## Particle service
# list of possible particles is defined in ParticlePropertiesFile
ppservice = Gaudi__ParticlePropertySvc(
    "ParticlePropertySvc",
    ParticlePropertiesFile="Generation/data/ParticleTable.txt")

# DD4hep geometry service
Exemple #7
0
from Gaudi.Configuration import *
from Configurables import ApplicationMgr
from GaudiKernel import SystemOfUnits as units

from Configurables import k4DataSvc
dataservice = k4DataSvc("EventDataSvc")

from Configurables import GenAlg, MomentumRangeParticleGun
pgun = MomentumRangeParticleGun(
    "PGun",
    PdgCodes=[11],  # electron
    MomentumMin=20. * units.GeV,  # GeV
    MomentumMax=20. * units.GeV,  # GeV
    ThetaMin=1.5335,  # rad
    ThetaMax=1.5335,  # rad
    PhiMin=0.01745,  # rad
    PhiMax=0.01745  # rad
)

from Configurables import FlatSmearVertex
smearTool = FlatSmearVertex(
    "VertexSmearingTool",
    yVertexMin=-36.42,  # mm
    yVertexMax=-26.42,  # mm
    zVertexMin=-52.135,  # mm
    zVertexMax=-42.135,  # mm
    beamDirection=0  # 1, 0, -1
)

from Configurables import HepMCToEDMConverter
hepmc2edm = HepMCToEDMConverter("Converter")
Exemple #8
0
magnetic_field = 1
particleType = "e-"

from Gaudi.Configuration import *

from Configurables import FCCDataSvc
podioevent = FCCDataSvc("EventDataSvc")

############################################### Particle Gun setup
### To consistently get particles in both the barrel and the endcap,
### use a double particle gun - one electron in the forward region, one pion in the barrel region

_pi = 3.14159

from Configurables import MomentumRangeParticleGun
pgun1_electron = MomentumRangeParticleGun("ParticleGun1_Electron")
pgun1_electron.PdgCodes = [11]
pgun1_electron.MomentumMin = 50 * GeV
pgun1_electron.MomentumMax = 50 * GeV
pgun1_electron.PhiMin = 0
pgun1_electron.PhiMax = 2 * _pi
# corresponds to 4.7 < eta < 5.4
pgun1_electron.ThetaMin = 0.5 * _pi / 180.
pgun1_electron.ThetaMax = 1.5 * _pi / 180.

from Configurables import MomentumRangeParticleGun
pgun2_pion = MomentumRangeParticleGun("ParticleGun2_Pion")
pgun2_pion.PdgCodes = [211]
pgun2_pion.MomentumMin = 20 * GeV
pgun2_pion.MomentumMax = 20 * GeV
pgun2_pion.PhiMin = 0
Exemple #9
0
from Gaudi.Configuration import *
from Configurables import ApplicationMgr, THistSvc, Gaudi__ParticlePropertySvc
from Configurables import HepMCDumper, ParticleGunAlg, MomentumRangeParticleGun, HepMCHistograms, FlatSmearVertex

dumper = HepMCDumper("Dumper")
dumper.DataInputs.hepmc.Path = "hepmc"

particlePropertySvc = Gaudi__ParticlePropertySvc(
    "ParticlePropertySvc",
    ParticlePropertiesFile='Generation/data/ParticleTable.txt')
guntool = MomentumRangeParticleGun(PdgCodes=[-211, 211, -11, -13, 13, 11])

smeartool = FlatSmearVertex("smeartoolname")
# FCCSW standard unit of length: [mm]
smeartool.xVertexMin = -10
smeartool.xVertexMax = 10
smeartool.yVertexMin = -10
smeartool.yVertexMax = 10
smeartool.zVertexMin = -30
smeartool.zVertexMax = 30

gun = ParticleGunAlg("gun",
                     ParticleGunTool=guntool,
                     VertexSmearingToolPGun=smeartool)
gun.DataOutputs.hepmc.Path = "hepmc"

from Configurables import HepMCConverter
hepmc_converter = HepMCConverter("Converter")
hepmc_converter.DataInputs.hepmc.Path = "hepmc"
hepmc_converter.DataOutputs.genparticles.Path = "allGenParticles"
hepmc_converter.DataOutputs.genvertices.Path = "allGenVertices"
Exemple #10
0
from Gaudi.Configuration import *
from Configurables import ApplicationMgr, HepMCDumper

from Configurables import MomentumRangeParticleGun
from GaudiKernel import PhysicalConstants as constants
guntool = MomentumRangeParticleGun("Gun2")
guntool.ThetaMin = 0
guntool.ThetaMax = 2 * constants.pi
guntool.PdgCodes = [11]
guntool2 = MomentumRangeParticleGun("Gun1")
guntool2.ThetaMin = 0
guntool2.ThetaMax = 2 * constants.pi
guntool2.PdgCodes = [11]
from Configurables import ConstPileUp
pileuptool = ConstPileUp()
pileuptool.numPileUpEvents = 10
from Configurables import GenAlg
gen = GenAlg()
gen.SignalProvider = guntool
gen.PileUpProvider = guntool2
gen.PileUpTool = pileuptool
gen.hepmc.Path = "hepmc"

from Configurables import HepMCToEDMConverter
hepmc_converter = HepMCToEDMConverter("Converter")
hepmc_converter.hepmc.Path = "hepmc"
hepmc_converter.genparticles.Path = "allGenParticles"
hepmc_converter.genvertices.Path = "allGenVertices"

dumper = HepMCDumper("Dumper")
dumper.hepmc.Path = "hepmc"
Exemple #11
0
from Gaudi.Configuration import *
from GaudiKernel import SystemOfUnits as units

from Configurables import FCCDataSvc
## Data service

podioevent = FCCDataSvc("EventDataSvc")
from Configurables import HepMCDumper, MomentumRangeParticleGun, HepMCHistograms, FlatSmearVertex, ConstPileUp

guntool = MomentumRangeParticleGun("SignalProvider", PdgCodes=[11])

from Configurables import GenAlg
gun = GenAlg(SignalProvider=guntool)
gun.hepmc.Path = "hepmc"

from Configurables import HepMCToEDMConverter
hepmc_converter = HepMCToEDMConverter("Converter")
hepmc_converter.hepmc.Path = "hepmc"
hepmc_converter.genparticles.Path = "allGenParticles"
hepmc_converter.genvertices.Path = "allGenVertices"

# convert (final state) EDM back to HepMC
from Configurables import EDMToHepMCConverter
edm_converter = EDMToHepMCConverter("BackConverter")
edm_converter.hepmc.Path = "hepmcconverted"
edm_converter.genparticles.Path = "allGenParticles"
edm_converter.genvertices.Path = "allGenVertices"
from Configurables import HepMCDumper
dumper = HepMCDumper("Dumper")
dumper.hepmc.Path = "hepmc"
Exemple #12
0
### \ingroup SimulationExamples
### | **input (alg)**               | other algorithms                 |                                                         |                        |                                  | **output (alg)**                              |
### |-------------------------------|----------------------------------|---------------------------------------------------------|------------------------|----------------------------------|-----------------------------------------------|
### | generating single particle events from a given list of types, with momentum, phi and theta from a given range, saving to HepMC | convert `HepMC::GenEvent` to EDM | geometry parsed from XML (TestHCal.xml) by DD4hep using GeoSvc | FTFP_BERT physics list | saving HCal hits | write the EDM output to ROOT file using PODIO |

from Gaudi.Configuration import *

from Configurables import FCCDataSvc
## Data service
podioevent = FCCDataSvc("EventDataSvc")

from Configurables import GenAlg, MomentumRangeParticleGun
## Particle Gun using MomentumRangeParticleGun tool and FlatSmearVertex
# MomentumRangeParticleGun generates particles of given type(s) within given momentum, phi and theta range
# FlatSmearVertex smears the vertex with uniform distribution
guntool = MomentumRangeParticleGun()
guntool.PdgCodes = [11]
gen = GenAlg("ParticleGun",
             SignalProvider=guntool,
             VertexSmearingTool="FlatSmearVertex")
gen.hepmc.Path = "hepmc"

from Configurables import HepMCToEDMConverter
## Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles
hepmc_converter = HepMCToEDMConverter("Converter")
hepmc_converter.hepmc.Path = "hepmc"
hepmc_converter.genparticles.Path = "allGenParticles"
hepmc_converter.genvertices.Path = "allGenVertices"

from Configurables import GeoSvc
## DD4hep geometry service
from Gaudi.Configuration import *
from GaudiKernel import SystemOfUnits as units
from GaudiKernel import PhysicalConstants as constants



from Configurables import MomentumRangeParticleGun
guntool = MomentumRangeParticleGun()
guntool.ThetaMin = 0 
guntool.ThetaMax = 2 * constants.pi 
guntool.MomentumMin = 100*units.GeV
guntool.MomentumMax = 100*units.GeV
guntool.PdgCodes = [11]

from Configurables import GenAlg
gen = GenAlg()
gen.SignalProvider=guntool
gen.hepmc.Path = "hepmc"
ApplicationMgr().TopAlg += [gen]

from Configurables import HepMCToEDMConverter
## reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles
hepmc_converter = HepMCToEDMConverter("Converter")
hepmc_converter.hepmc.Path="hepmc"
hepmc_converter.GenParticles.Path="GenParticles"
ApplicationMgr().TopAlg += [hepmc_converter]
momentum = 100
# theta from 80 to 100 degrees corresponds to -0.17 < eta < 0.17 
thetaMin = 80.
thetaMax = 100.
magneticField = False

from Gaudi.Configuration import *

from Configurables import FCCDataSvc
podioevent  = FCCDataSvc("EventDataSvc")

################## Particle gun setup
_pi = 3.14159

from Configurables import  MomentumRangeParticleGun
pgun = MomentumRangeParticleGun("ParticleGun_Electron")
pgun.PdgCodes = [11]
pgun.MomentumMin = momentum * GeV
pgun.MomentumMax = momentum * GeV
pgun.PhiMin = 0
pgun.PhiMax = 2 * _pi
pgun.ThetaMin = thetaMin * _pi / 180.
pgun.ThetaMax = thetaMax * _pi / 180.

from Configurables import GenAlg
genalg_pgun = GenAlg()
genalg_pgun.SignalProvider = pgun 
genalg_pgun.hepmc.Path = "hepmc"

from Configurables import HepMCToEDMConverter
hepmc_converter = HepMCToEDMConverter()
Exemple #15
0
import os
from GaudiKernel import SystemOfUnits as units
from GaudiKernel import PhysicalConstants as constants
from Gaudi.Configuration import *

from Configurables import FCCDataSvc
podioevent = FCCDataSvc("EventDataSvc")
from Configurables import PodioInput

from Configurables import GenAlg, MomentumRangeParticleGun
pgun_tool = MomentumRangeParticleGun(PdgCodes=[13],
                                     PhiMin=0.,
                                     PhiMax=constants.pi * 0.5,
                                     ThetaMin=constants.pi / 2.,
                                     ThetaMax=constants.pi * 0.9,
                                     MomentumMin=10000,
                                     MomentumMax=100000)
gen = GenAlg("ParticleGun", SignalProvider=pgun_tool)
gen.hepmc.Path = "hepmc"

from Configurables import GeoSvc
geoservice = GeoSvc(
    "GeoSvc",
    detectors=[
        'file:Detector/DetFCChhBaseline1/compact/FCChh_DectEmptyMaster.xml',
        'file:Detector/DetFCChhTrackerTkLayout/compact/Tracker.xml',
    ],
)

from Configurables import HepMCToEDMConverter
hepmc_converter = HepMCToEDMConverter("Converter")
Exemple #16
0
podioevent = FCCDataSvc("EventDataSvc")
from Configurables import ApplicationMgr, THistSvc, Gaudi__ParticlePropertySvc
from Configurables import HepMCDumper, MomentumRangeParticleGun, HepMCHistograms, FlatSmearVertex, ConstPileUp

dumper = HepMCDumper("Dumper")
dumper.hepmc.Path = "hepmc"

from Configurables import HepMCFileWriter
writer = HepMCFileWriter("MyHepMCFileWriter")
writer.hepmc.Path = "hepmc"

particlePropertySvc = Gaudi__ParticlePropertySvc(
    "ParticlePropertySvc",
    ParticlePropertiesFile='Generation/data/ParticleTable.txt')
guntool = MomentumRangeParticleGun("SignalProvider", PdgCodes=[-211])
guntool2 = MomentumRangeParticleGun("PileUpProvider", PdgCodes=[11])

smeartool = FlatSmearVertex("smeartoolname")
smeartool.xVertexMin = -10 * units.mm
smeartool.xVertexMax = 10 * units.mm
smeartool.yVertexMin = -10 * units.mm
smeartool.yVertexMax = 10 * units.mm
smeartool.zVertexMin = -30 * units.mm
smeartool.zVertexMax = 30 * units.mm

pileuptool = ConstPileUp("MyPileUpConfig", numPileUpEvents=1)

from Configurables import GenAlg
gun = GenAlg()
gun.hepmc.Path = "hepmc"
from GaudiKernel.SystemOfUnits import MeV, GeV, tesla

from Configurables import ApplicationMgr
ApplicationMgr().EvtSel = 'NONE' 
ApplicationMgr().EvtMax = 2
ApplicationMgr().OutputLevel = INFO
ApplicationMgr().StopOnSignal = True
ApplicationMgr().ExtSvc += ['RndmGenSvc']

from Configurables import FCCDataSvc
## Data service
podioevent = FCCDataSvc("EventDataSvc")
ApplicationMgr().ExtSvc += [podioevent]

from Configurables import MomentumRangeParticleGun
guntool = MomentumRangeParticleGun()
guntool.ThetaMin = 45 * constants.pi / 180.
guntool.ThetaMax = 135 * constants.pi / 180.
guntool.PhiMin = 0.
guntool.PhiMax = 2. * constants.pi
guntool.MomentumMin = 1. *units.GeV
guntool.MomentumMax = 1. *units.GeV
guntool.PdgCodes = [11] # 11 electron, 13 muon, 22 photon, 111 pi0, 211 pi+

from Configurables import GenAlg
gen = GenAlg()
gen.SignalProvider=guntool
gen.hepmc.Path = "hepmc"
ApplicationMgr().TopAlg += [gen]

from Configurables import HepMCToEDMConverter