Skip to content

Commit

Permalink
Format all files to conform to ruff config
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Dec 6, 2024
1 parent b719f61 commit 1f5130b
Show file tree
Hide file tree
Showing 15 changed files with 6,174 additions and 3,886 deletions.
3,208 changes: 1,941 additions & 1,267 deletions k4MarlinWrapper/examples/clicRec_e4h_input.py

Large diffs are not rendered by default.

599 changes: 460 additions & 139 deletions k4MarlinWrapper/examples/event_display.py

Large diffs are not rendered by default.

56 changes: 29 additions & 27 deletions k4MarlinWrapper/examples/runit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from Gaudi.Configuration import *

from Configurables import LcioEvent, EventDataSvc, MarlinProcessorWrapper

algList = []
evtsvc = EventDataSvc()

Expand All @@ -36,52 +37,53 @@
procA = MarlinProcessorWrapper("AidaProcessor")
procA.OutputLevel = DEBUG
procA.ProcessorType = "AIDAProcessor"
procA.Parameters = {"FileName": ["histograms"],
"FileType": ["root"],
"Compress": ["1"],
"Verbosity": ["DEBUG"],
}
procA.Parameters = {
"FileName": ["histograms"],
"FileType": ["root"],
"Compress": ["1"],
"Verbosity": ["DEBUG"],
}
algList.append(procA)


proc0 = MarlinProcessorWrapper("EventNumber")
proc0.OutputLevel = DEBUG
proc0.ProcessorType = "Statusmonitor"
proc0.Parameters = {"HowOften": ["1"],
"Verbosity": ["DEBUG"],
}
proc0.Parameters = {
"HowOften": ["1"],
"Verbosity": ["DEBUG"],
}
algList.append(proc0)


proc1 = MarlinProcessorWrapper("InitDD4hep")
proc1.OutputLevel = DEBUG
proc1.ProcessorType = "InitializeDD4hep"
proc1.Parameters = {#"EncodingStringParameter", "GlobalTrackerReadoutID"},
#"DD4hepXMLFile", "/cvmfs/clicdp.cern.ch/iLCSoft/builds/nightly/x86_64-slc6-gcc62-opt/lcgeo/HEAD/CLIC/compact/CLIC_o3_v13/CLIC_o3_v13.xml"},
"DD4hepXMLFile": [os.path.join(os.environ["K4GEO"], "CLIC/compact/CLIC_o2_v04/CLIC_o2_v04.xml")],
}
proc1.Parameters = { # "EncodingStringParameter", "GlobalTrackerReadoutID"},
# "DD4hepXMLFile", "/cvmfs/clicdp.cern.ch/iLCSoft/builds/nightly/x86_64-slc6-gcc62-opt/lcgeo/HEAD/CLIC/compact/CLIC_o3_v13/CLIC_o3_v13.xml"},
"DD4hepXMLFile": [
os.path.join(os.environ["K4GEO"], "CLIC/compact/CLIC_o2_v04/CLIC_o2_v04.xml")
],
}
algList.append(proc1)


digiVxd = MarlinProcessorWrapper("VXDBarrelDigitiser")
digiVxd.OutputLevel = DEBUG
digiVxd.ProcessorType = "DDPlanarDigiProcessor"
digiVxd.Parameters = {"SubDetectorName": ["Vertex"],
"IsStrip": ["false"],
"ResolutionU": ["0.003", "0.003", "0.003", "0.003", "0.003", "0.003"],
"ResolutionV": ["0.003", "0.003", "0.003", "0.003", "0.003", "0.003"],
"SimTrackHitCollectionName": ["VertexBarrelCollection"],
"SimTrkHitRelCollection": ["VXDTrackerHitRelations"],
"TrackerHitCollectionName": ["VXDTrackerHits"],
"Verbosity": ["DEBUG"],
}
digiVxd.Parameters = {
"SubDetectorName": ["Vertex"],
"IsStrip": ["false"],
"ResolutionU": ["0.003", "0.003", "0.003", "0.003", "0.003", "0.003"],
"ResolutionV": ["0.003", "0.003", "0.003", "0.003", "0.003", "0.003"],
"SimTrackHitCollectionName": ["VertexBarrelCollection"],
"SimTrkHitRelCollection": ["VXDTrackerHitRelations"],
"TrackerHitCollectionName": ["VXDTrackerHits"],
"Verbosity": ["DEBUG"],
}
algList.append(digiVxd)


from Configurables import ApplicationMgr
ApplicationMgr( TopAlg = algList,
EvtSel = 'NONE',
EvtMax = 10,
ExtSvc = [evtsvc],
OutputLevel=DEBUG
)

ApplicationMgr(TopAlg=algList, EvtSel="NONE", EvtMax=10, ExtSvc=[evtsvc], OutputLevel=DEBUG)
4 changes: 3 additions & 1 deletion k4MarlinWrapper/python/k4MarlinWrapper/inputReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import sys
from Configurables import LcioEvent, PodioInput, MarlinProcessorWrapper, EDM4hep2LcioTool


def create_reader(input_files, evtSvc):
"""Create the appropriate reader for the input files"""
if input_files[0].endswith(".slcio"):
Expand All @@ -38,13 +39,14 @@ def create_reader(input_files, evtSvc):

return read


def attach_edm4hep2lcio_conversion(algList, read):
"""Attach the edm4hep to lcio conversion if necessary e.g. when using create_reader. Should only be run after algList is complete."""
if not isinstance(read, PodioInput):
# nothing to convert :)
return

# find first wrapper
# find first wrapper
for alg in algList:
if isinstance(alg, MarlinProcessorWrapper):
break
Expand Down
33 changes: 17 additions & 16 deletions k4MarlinWrapper/python/k4MarlinWrapper/parseConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@
#
import re


def parseConstants(constants):
"""Keeps looping over constants dictionary,
replacing constants until no more are found
"""
again = True
while again:
again = False
for key, value in constants.items():
if isinstance(value, list):
for idx, val in enumerate(value):
value[idx] = val % constants
again = again or (value[idx] != val)
constants[key] = " ".join(value)
elif value:
if (value):
constants[key] = value % constants
again = again or (constants[key] != value)
"""Keeps looping over constants dictionary,
replacing constants until no more are found
"""
again = True
while again:
again = False
for key, value in constants.items():
if isinstance(value, list):
for idx, val in enumerate(value):
value[idx] = val % constants
again = again or (value[idx] != val)
constants[key] = " ".join(value)
elif value:
if value:
constants[key] = value % constants
again = again or (constants[key] != value)
Loading

0 comments on commit 1f5130b

Please sign in to comment.