Ejemplo n.º 1
0
# Geant4 algorithm
# Translates EDM to G4Event, passes the event to G4, writes out outputs via tools
# and a tool that saves the calorimeter hits
from Configurables import SimG4Alg, SimG4SaveCalHits, InspectHitsCollectionsTool
savehcaltool = SimG4SaveCalHits("saveHCalHits",
                                readoutNames=["BarHCal_Readout"])
savehcaltool.positionedCaloHits.Path = "HCalPositionedHits"
savehcaltool.caloHits.Path = "HCalHits"
# Change INFO to DEBUG for printout of each deposit

# next, create the G4 algorithm, giving the list of names of tools ("XX/YY")
from Configurables import SimG4SingleParticleGeneratorTool
pgun = SimG4SingleParticleGeneratorTool("SimG4SingleParticleGeneratorTool",
                                        saveEdm=True,
                                        particleName="e-",
                                        energyMin=energy,
                                        energyMax=energy,
                                        etaMin=-0.36,
                                        etaMax=0.36,
                                        OutputLevel=DEBUG)

geantsim = SimG4Alg("SimG4Alg",
                    outputs=["SimG4SaveCalHits/saveHCalHits"],
                    eventProvider=pgun,
                    OutputLevel=DEBUG)

# PODIO algorithm
from Configurables import PodioOutput
out = PodioOutput("out", OutputLevel=DEBUG)
out.outputCommands = ["keep *"]
out.filename = "output_hcalSim_e" + str(int(
    energy / 1000)) + "GeV_eta036_1events.root"
Ejemplo n.º 2
0
                        actions="SimG4FullSimActions")
geantservice.g4PostInitCommands += ["/run/setCut 0.1 mm"]
from Configurables import SimG4Alg, SimG4SaveCalHits, SimG4SingleParticleGeneratorTool
saveecaltool = SimG4SaveCalHits("saveECalBarrelHits",
                                readoutNames=["ECalBarrelEta"])
saveecaltool.positionedCaloHits.Path = "ECalBarrelPositionedHits"
saveecaltool.caloHits.Path = "ECalBarrelHits"
savecalendcaptool = SimG4SaveCalHits("saveECalEndcapHits",
                                     readoutNames=["EMECPhiEta"])
savecalendcaptool.positionedCaloHits.Path = "ECalEndcapPositionedHits"
savecalendcaptool.caloHits.Path = "ECalEndcapHits"
from Configurables import SimG4SingleParticleGeneratorTool
pgun = SimG4SingleParticleGeneratorTool("SimG4SingleParticleGeneratorTool",
                                        saveEdm=True,
                                        particleName="e-",
                                        energyMin=50000,
                                        energyMax=50000,
                                        etaMin=2.,
                                        etaMax=2.)
geantsim = SimG4Alg("SimG4Alg",
                    outputs=[
                        "SimG4SaveCalHits/saveECalBarrelHits",
                        "SimG4SaveCalHits/saveECalEndcapHits"
                    ],
                    eventProvider=pgun)

#Configure tools for calo reconstruction
from Configurables import CalibrateInLayersTool
calibcellsBarrel = CalibrateInLayersTool(
    "CalibrateBarrel",
    # sampling fraction obtained using SamplingFractionInLayers from DetStudies package
# giving the names of tools will initialize the tools of that type
geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist="SimG4FtfpBert", actions="SimG4FullSimActions")

#geantservice.g4PostInitCommands  += ["/tracking/verbose 1"]

# Geant4 algorithm
# Translates EDM to G4Event, passes the event to G4, writes out outputs via tools
from Configurables import SimG4Alg, SimG4SaveTrackerHits
# first, create a tool that saves the tracker hits
# Name of that tool in GAUDI is "XX/YY" where XX is the tool class name ("SimG4SaveTrackerHits")
# and YY is the given name ("saveTrackerHits")
savetrackertool = SimG4SaveTrackerHits("saveTrackerHits", readoutNames = ["TrackerBarrelReadout", "TrackerEndcapReadout"])
savetrackertool.positionedTrackHits.Path = "positionedHits"
savetrackertool.trackHits.Path = "hits"
# next, create the G4 algorithm, giving the list of names of tools ("XX/YY")
pgun = SimG4SingleParticleGeneratorTool("GeantinoGun", etaMin=-5, etaMax=5, particleName="geantino")
geantsim = SimG4Alg("SimG4Alg",
                    outputs= ["SimG4SaveTrackerHits/saveTrackerHits" ],
                    eventProvider=pgun)

# PODIO algorithm
from Configurables import PodioOutput
out = PodioOutput("out",
                   OutputLevel=DEBUG)
out.outputCommands = ["keep *"]

# ApplicationMgr
from Configurables import ApplicationMgr
ApplicationMgr( TopAlg = [geantsim, out],
                EvtSel = 'NONE',
                EvtMax   = 10000,
Ejemplo n.º 4
0
    "SimG4SaveCalHits/saveECalEndcapHits", "SimG4SaveCalHits/saveECalFwdHits",
    "SimG4SaveCalHits/saveHCalExtBarrelHits",
    "SimG4SaveCalHits/saveHCalEndcapHits", "SimG4SaveCalHits/saveHCalFwdHits",
    "SimG4SaveCalHits/saveTailCatcherHits",
    "SimG4SaveTrackerHits/saveTrackerHits"
]

geantsim = SimG4Alg("SimG4Alg", outputs=outputHitsTools)

if simargs.singlePart:
    from Configurables import SimG4SingleParticleGeneratorTool
    pgun = SimG4SingleParticleGeneratorTool(
        "SimG4SingleParticleGeneratorTool",
        saveEdm=True,
        particleName=particle_geant_names[pdg],
        energyMin=energy * 1000,
        energyMax=energy * 1000,
        etaMin=etaMin,
        etaMax=etaMax,
        phiMin=phiMin,
        phiMax=phiMax)
    geantsim.eventProvider = pgun
else:
    from Configurables import PythiaInterface, GenAlg, GaussSmearVertex
    smeartool = GaussSmearVertex("GaussSmearVertex")
    if simargs.useVertexSmearTool:
        smeartool.xVertexSigma = 0.5 * units.mm
        smeartool.yVertexSigma = 0.5 * units.mm
        smeartool.zVertexSigma = 40 * units.mm
        smeartool.tVertexSigma = 180 * units.picosecond

    pythia8gentool = PythiaInterface("Pythia8", Filename=card)
Ejemplo n.º 5
0
                                caloHits="ECalBarrelHits")
savehcaltool = SimG4SaveCalHits("saveHCalHits",
                                readoutNames=[hcalReadoutName],
                                positionedCaloHits="HCalPositionedHits",
                                caloHits="HCalHits")
saveexthcaltool = SimG4SaveCalHits("saveExtHCalHits",
                                   readoutNames=[extHcalReadoutName],
                                   positionedCaloHits="ExtHCalPositionedHits",
                                   caloHits="ExtHCalHits")

# next, create the G4 algorithm, giving the list of names of tools ("XX/YY")
from Configurables import SimG4SingleParticleGeneratorTool
pgun = SimG4SingleParticleGeneratorTool("SimG4SingleParticleGeneratorTool",
                                        saveEdm=True,
                                        particleName=particleType,
                                        energyMin=energy,
                                        energyMax=energy,
                                        etaMin=1.0,
                                        etaMax=1.0,
                                        OutputLevel=DEBUG)

geantsim = SimG4Alg("SimG4Alg",
                    outputs=[
                        "SimG4SaveCalHits/saveECalBarrelHits",
                        "SimG4SaveCalHits/saveHCalHits",
                        "SimG4SaveCalHits/saveExtHCalHits"
                    ],
                    eventProvider=pgun,
                    OutputLevel=DEBUG)

# Configure tools for calo reconstruction
from Configurables import CalibrateInLayersTool
Ejemplo n.º 6
0
savehcalendcaptool = SimG4SaveCalHits("saveHCalEndcapHits",
                                      readoutNames=[hcalEndcapReadoutName])
savehcalendcaptool.positionedCaloHits.Path = "HCalEndcapPositionedHits"
savehcalendcaptool.caloHits.Path = "HCalEndcapHits"
savehcalfwdtool = SimG4SaveCalHits("saveHCalFwdHits",
                                   readoutNames=[hcalFwdReadoutName])
savehcalfwdtool.positionedCaloHits.Path = "HCalFwdPositionedHits"
savehcalfwdtool.caloHits.Path = "HCalFwdHits"

# next, create the G4 algorithm, giving the list of names of tools ("XX/YY")
from Configurables import SimG4SingleParticleGeneratorTool
pgun = SimG4SingleParticleGeneratorTool("SimG4SingleParticleGeneratorTool",
                                        saveEdm=True,
                                        particleName=particleType,
                                        energyMin=energy,
                                        energyMax=energy,
                                        etaMin=-0.3,
                                        etaMax=0.3,
                                        phiMin=0,
                                        phiMax=6.28,
                                        OutputLevel=DEBUG)

geantsim = SimG4Alg(
    "SimG4Alg",
    outputs=[
        "SimG4SaveCalHits/saveECalBarrelHits",
        # "SimG4SaveCalHits/saveECalEndcapHits",
        # "SimG4SaveCalHits/saveECalFwdHits", "SimG4SaveCalHits/saveHCalHits",
        # "SimG4SaveCalHits/saveExtHCalHits", "SimG4SaveCalHits/saveHCalEndcapHits",
        # "SimG4SaveCalHits/saveHCalFwdHits"
    ],
    eventProvider=pgun,
Ejemplo n.º 7
0
from Configurables import SimG4Svc
geantservice = SimG4Svc("SimG4Svc",
                        detector='SimG4DD4hepDetector',
                        physicslist="SimG4FtfpBert",
                        actions="SimG4FullSimActions")

from Configurables import SimG4Alg, SimG4SaveTrackerHits
savetool = SimG4SaveTrackerHits("saveHits",
                                readoutNames=["TrackerBarrelReadout"])
savetool.positionedTrackHits.Path = "PositionedHits"
savetool.trackHits.Path = "Hits"
from Configurables import SimG4SingleParticleGeneratorTool
pgun = SimG4SingleParticleGeneratorTool("SimG4SingleParticleGeneratorTool",
                                        saveEdm=True,
                                        particleName="mu-",
                                        energyMin=1000,
                                        energyMax=1000,
                                        etaMin=0,
                                        etaMax=0,
                                        OutputLevel=DEBUG)
geantsim = SimG4Alg("SimG4Alg",
                    outputs=["SimG4SaveTrackerHits/saveHits"],
                    eventProvider=pgun,
                    OutputLevel=DEBUG)

from Configurables import CreateVolumeTrackPositions
positions = CreateVolumeTrackPositions("positions", OutputLevel=VERBOSE)
positions.hits.Path = "Hits"
positions.positionedHits.Path = "Positions"

# PODIO algorithm
from Configurables import PodioOutput
Ejemplo n.º 8
0
geantservice.regions = [regiontool]
geantservice.magneticField = field
geantservice.g4PostInitCommands += ["/process/eLoss/minKinEnergy 1 MeV"]
geantservice.g4PostInitCommands += ["/tracking/storeTrajectory 1"]
ApplicationMgr().ExtSvc += [geantservice]

from Configurables import SimG4SaveTrajectory
savetrajectorytool = SimG4SaveTrajectory("saveTrajectory")
savetrajectorytool.TrajectoryPoints.Path = "trajectoryPoints"

from Configurables import SimG4SaveParticleHistory
savehisttool = SimG4SaveParticleHistory("saveHistory")
savehisttool.GenParticles.Path = "SimParticles"

from Configurables import SimG4SingleParticleGeneratorTool
pgun = SimG4SingleParticleGeneratorTool("ParticleGun")
pgun.etaMin = 0
pgun.etaMax = 0
pgun.phiMin = 0
pgun.phiMax = 360
pgun.energyMin = 2400
pgun.energyMax = 2400
pgun.particleName = "mu-"

from Configurables import SimG4Alg
geantsim = SimG4Alg("SimG4Alg")
geantsim.outputs += [
    savehisttool,
    #todo: investigate error
    #savetrajectorytool,
]
# Geant4 service
# Configures the Geant simulation: geometry, physics list and user actions
from Configurables import SimG4Svc
geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist="SimG4FtfpBert", actions="SimG4FullSimActions")
geantservice.g4PostInitCommands += ["/run/setCut 0.1 mm"]

# Geant4 algorithm
# Translates EDM to G4Event, passes the event to G4, writes out outputs via tools
# and a tool that saves the calorimeter hits
from Configurables import SimG4Alg, SimG4SaveCalHits, SimG4SingleParticleGeneratorTool
saveecaltool = SimG4SaveCalHits("saveECalBarrelHits",readoutNames = ["ECalBarrelEta"])
saveecaltool.positionedCaloHits.Path = "ECalBarrelPositionedHits"
saveecaltool.caloHits.Path = "ECalBarrelHits"
from Configurables import SimG4SingleParticleGeneratorTool
pgun=SimG4SingleParticleGeneratorTool("SimG4SingleParticleGeneratorTool",saveEdm=True,
                                      particleName = "e-", energyMin = 50000, energyMax = 50000, etaMin = 0, etaMax = 0, phiMin = -0.1, phiMax = 0.1,
                                      OutputLevel = DEBUG)
# next, create the G4 algorithm, giving the list of names of tools ("XX/YY")
geantsim = SimG4Alg("SimG4Alg",
                    outputs= ["SimG4SaveCalHits/saveECalBarrelHits"],
                    eventProvider = pgun,
                    OutputLevel = DEBUG)


from Configurables import CreateCaloCells
createcellsBarrel = CreateCaloCells("CreateCaloCellsBarrel",
                                    doCellCalibration=False,
                                    addCellNoise=False, filterCellNoise=False)
createcellsBarrel.hits.Path="ECalBarrelHits"
createcellsBarrel.cells.Path="ECalBarrelCells"
Ejemplo n.º 10
0
savetrackertool.trackHits.Path = "hits_barrel"
savetrackertool.digiTrackHits.Path = "digiHits_barrel"

savetrackertool_endcap = SimG4SaveTrackerHits("saveTrackerHits_Endcap", readoutNames = ["VertexEndcapCollection"])
savetrackertool_endcap.positionedTrackHits.Path = "positionedHits_endcap"
savetrackertool_endcap.trackHits.Path = "hits_endcap"
savetrackertool_endcap.digiTrackHits.Path = "digiHits_endcap"


savetrackertool_DCH = SimG4SaveTrackerHits("saveTrackerHits_DCH", readoutNames = ["DriftChamberCollection"])
savetrackertool_DCH.positionedTrackHits.Path = "positionedHits_DCH"
savetrackertool_DCH.trackHits.Path = "hits_DCH"
savetrackertool_DCH.digiTrackHits.Path = "digiHits_DCH"


pgun = SimG4SingleParticleGeneratorTool("GeantinoGun", etaMin=-0.1, etaMax=0.1, phiMin=0, phiMax=6.2831853, 
                                        particleName="mu-", energyMin=100000, energyMax=100000)


geantsim = SimG4Alg("SimG4Alg",
                    outputs= [
        "SimG4SaveParticleHistory/saveHistory",
        "SimG4SaveTrackerHits/saveTrackerHits_Barrel", 
        "SimG4SaveTrackerHits/saveTrackerHits_Endcap",
        "SimG4SaveTrackerHits/saveTrackerHits_DCH"
        ],
                    eventProvider=pgun)

# PODIO algorithm
from Configurables import PodioOutput
out = PodioOutput("out",
                  filename = "fccee_fullsim_pgun.root",
Ejemplo n.º 11
0
savetrackertool_endcap = SimG4SaveTrackerHits("saveTrackerHits_Endcap")
savetrackertool_endcap.readoutNames = ["VertexEndcapCollection"]
savetrackertool_endcap.positionedTrackHits.Path = "positionedHits_endcap"
savetrackertool_endcap.trackHits.Path = "hits_endcap"
savetrackertool_endcap.digiTrackHits.Path = "digiHits_endcap"

from Configurables import SimG4SaveTrackerHits
savetrackertool_DCH = SimG4SaveTrackerHits("saveTrackerHits_DCH")
savetrackertool_DCH.readoutNames = ["DriftChamberCollection"]
savetrackertool_DCH.positionedTrackHits.Path = "positionedHits_DCH"
savetrackertool_DCH.trackHits.Path = "hits_DCH"
savetrackertool_DCH.digiTrackHits.Path = "digiHits_DCH"

set_energy = 2400 
from Configurables import SimG4SingleParticleGeneratorTool
pgun = SimG4SingleParticleGeneratorTool("GeantinoGun")
pgun.etaMin=0
pgun.etaMax=0
pgun.phiMin=0
pgun.phiMax=360
pgun.energyMin=set_energy
pgun.energyMax=set_energy
pgun.particleName="mu-"

from Configurables import SimG4Alg
geantsim = SimG4Alg("SimG4Alg")
geantsim.outputs= [
        "SimG4SaveParticleHistory/saveHistory",
        "SimG4SaveTrackerHits/saveTrackerHits_Barrel", 
        "SimG4SaveTrackerHits/saveTrackerHits_Endcap",
        "SimG4SaveTrackerHits/saveTrackerHits_DCH",
Ejemplo n.º 12
0
savetrackertool_endcap = SimG4SaveTrackerHits(
    "saveTrackerHits_Endcap", readoutNames=["VertexEndcapCollection"])
savetrackertool_endcap.positionedTrackHits.Path = "positionedHits_endcap"
savetrackertool_endcap.trackHits.Path = "hits_endcap"
savetrackertool_endcap.digiTrackHits.Path = "digiHits_endcap"

savetrackertool_DCH = SimG4SaveTrackerHits(
    "saveTrackerHits_DCH", readoutNames=["DriftChamberCollection"])
savetrackertool_DCH.positionedTrackHits.Path = "positionedHits_DCH"
savetrackertool_DCH.trackHits.Path = "hits_DCH"
savetrackertool_DCH.digiTrackHits.Path = "digiHits_DCH"

pgun = SimG4SingleParticleGeneratorTool("GeantinoGun",
                                        etaMin=0,
                                        etaMax=0,
                                        phiMin=0,
                                        phiMax=360,
                                        particleName="mu-",
                                        energyMin=set_energy,
                                        energyMax=set_energy)

geantsim = SimG4Alg("SimG4Alg",
                    outputs=[
                        "SimG4SaveParticleHistory/saveHistory",
                        "SimG4SaveTrackerHits/saveTrackerHits_Barrel",
                        "SimG4SaveTrackerHits/saveTrackerHits_Endcap",
                        "SimG4SaveTrackerHits/saveTrackerHits_DCH"
                    ],
                    eventProvider=pgun)

# PODIO algorithm
from Configurables import PodioOutput