Skip to content

Commit

Permalink
Migrate to IOSvc
Browse files Browse the repository at this point in the history
  • Loading branch information
BrieucF committed Aug 6, 2024
1 parent c3a17f5 commit a9f592f
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions Tracking/test/runTracksFromGenParticles.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
from Configurables import ApplicationMgr
from Configurables import EventCounter
from k4FWCore import ApplicationMgr
from Gaudi.Configuration import INFO, WARNING, DEBUG
import os

if not os.path.isfile("ddsim_output_edm4hep.root"):
os.system("ddsim --enableGun --gun.distribution uniform --gun.energy '10*GeV' --gun.particle e- --numberOfEvents 100 --outputFile ddsim_output_edm4hep.root --random.enableEventSeed --random.seed 42 --compactFile $K4GEO/FCCee/IDEA/compact/IDEA_o1_v02/IDEA_o1_v02.xml")

# Loading the output of the SIM step
from Configurables import k4DataSvc, PodioInput, PodioOutput
evtsvc = k4DataSvc('EventDataSvc')
evtsvc.input = "ddsim_output_edm4hep.root"
#evtsvc.input = "/afs/cern.ch/user/b/brfranco/work/public/MIT_tutorial/CLDConfig/CLDConfig/wzp6_ee_mumuH_ecm240_CLD_RECO_edm4hep.root"
Nevts = -1
input_reader = PodioInput('InputReader')
from k4FWCore import IOSvc
io_svc = IOSvc("IOSvc")
io_svc.input = "ddsim_output_edm4hep.root"
io_svc.output = "tracks_from_genParticle_output.root"

# Calling TracksFromGenParticles
from Configurables import TracksFromGenParticles
Expand All @@ -30,23 +27,24 @@
InputTracksFromGenParticlesAssociation = tracksFromGenParticles.OutputMCRecoTrackParticleAssociation,
Bz = 2.0)

# Output
from Configurables import PodioOutput
out = PodioOutput("out",
OutputLevel=INFO)
out.outputCommands = ["keep *"]
out.filename = "tracks_from_genParticle_output.root"

# Set auditor service
from Configurables import AuditorSvc, ChronoAuditor
chra = ChronoAuditor()
audsvc = AuditorSvc()
audsvc.Auditors = [chra]
tracksFromGenParticles.AuditExecute = True
plotTrackHitDistances.AuditExecute = True

# event counter
from Configurables import EventCounter
event_counter = EventCounter('event_counter')
event_counter.Frequency = 10

from Configurables import EventDataSvc
ApplicationMgr(
TopAlg= [input_reader, tracksFromGenParticles, plotTrackHitDistances, out],
TopAlg= [event_counter, tracksFromGenParticles, plotTrackHitDistances],
EvtSel='NONE',
EvtMax=Nevts,
ExtSvc=[evtsvc, audsvc],
EvtMax=-1,
ExtSvc=[EventDataSvc("EventDataSvc"), audsvc],
StopOnSignal=True,
)

0 comments on commit a9f592f

Please sign in to comment.