Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Feb 29, 2024
1 parent e5bdcca commit 3054187
Show file tree
Hide file tree
Showing 19 changed files with 522 additions and 353 deletions.
38 changes: 30 additions & 8 deletions test/k4FWCoreTest/options/CheckOutputFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,41 @@
import podio
except ImportError:
import os

print(f'PYTHONPATH={os.environ["PYTHONPATH"]}')
raise


def check_collections(filename, names):
podio_reader = podio.root_io.Reader(filename)
for frame in podio_reader.get('events'):
for frame in podio_reader.get("events"):
available = set(frame.getAvailableCollections())
if available != set(names):
print(f'These collections should be in the frame but are not: {set(names) - available}')
print(f'These collections are in the frame but should not be: {available - set(names)}')
raise RuntimeError('Collections in frame do not match expected collections')
print(
f"These collections should be in the frame but are not: {set(names) - available}"
)
print(
f"These collections are in the frame but should not be: {available - set(names)}"
)
raise RuntimeError("Collections in frame do not match expected collections")


check_collections('functional_transformer.root', ['MCParticles', 'NewMCParticles'])
check_collections('functional_transformer_multiple.root', ['VectorFloat', 'MCParticles1', 'MCParticles2', 'SimTrackerHits', 'TrackerHits', 'Tracks', 'Counter', 'NewMCParticles'])
check_collections('functional_transformer_multiple_output_commands.root', ['VectorFloat', 'MCParticles1', 'MCParticles2', 'SimTrackerHits', 'TrackerHits'])
check_collections('/tmp/a/b/c/output_k4test_exampledata_producer.root', ['MCParticles'])
check_collections("functional_transformer.root", ["MCParticles", "NewMCParticles"])
check_collections(
"functional_transformer_multiple.root",
[
"VectorFloat",
"MCParticles1",
"MCParticles2",
"SimTrackerHits",
"TrackerHits",
"Tracks",
"Counter",
"NewMCParticles",
],
)
check_collections(
"functional_transformer_multiple_output_commands.root",
["VectorFloat", "MCParticles1", "MCParticles2", "SimTrackerHits", "TrackerHits"],
)
check_collections("/tmp/a/b/c/output_k4test_exampledata_producer.root", ["MCParticles"])
27 changes: 15 additions & 12 deletions test/k4FWCoreTest/options/ExampleFunctionalConsumerMemory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@
from Configurables import EventDataSvc
from k4FWCore import ApplicationMgr

producer = ExampleFunctionalProducer("ExampleFunctionalProducer",
OutputCollection="MCParticles",
)
producer = ExampleFunctionalProducer(
"ExampleFunctionalProducer",
OutputCollection="MCParticles",
)

consumer = ExampleFunctionalConsumer("ExampleFunctionalConsumer",
InputCollection="MCParticles",
)
consumer = ExampleFunctionalConsumer(
"ExampleFunctionalConsumer",
InputCollection="MCParticles",
)

ApplicationMgr(TopAlg=[producer, consumer],
EvtSel="NONE",
EvtMax=10,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
ApplicationMgr(
TopAlg=[producer, consumer],
EvtSel="NONE",
EvtMax=10,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,39 @@
# to check that the contents of the file are the expected ones

from Gaudi.Configuration import INFO
from Configurables import ExampleFunctionalProducerMultiple, ExampleFunctionalConsumerMultiple
from Configurables import (
ExampleFunctionalProducerMultiple,
ExampleFunctionalConsumerMultiple,
)
from Configurables import EventDataSvc
from k4FWCore import ApplicationMgr

producer = ExampleFunctionalProducerMultiple("Producer",
OutputCollectionFloat="VectorFloat",
OutputCollectionParticles1="MCParticles1",
OutputCollectionParticles2="MCParticles2",
OutputCollectionSimTrackerHits="SimTrackerHits",
OutputCollectionTrackerHits="TrackerHits",
OutputCollectionTracks="Tracks",
ExampleInt=5
)
producer = ExampleFunctionalProducerMultiple(
"Producer",
OutputCollectionFloat="VectorFloat",
OutputCollectionParticles1="MCParticles1",
OutputCollectionParticles2="MCParticles2",
OutputCollectionSimTrackerHits="SimTrackerHits",
OutputCollectionTrackerHits="TrackerHits",
OutputCollectionTracks="Tracks",
ExampleInt=5,
)

consumer = ExampleFunctionalConsumerMultiple("Consumer",
InputCollectionFloat="VectorFloat",
InputCollectionParticles1="MCParticles1",
InputCollectionParticles2="MCParticles2",
InputCollectionSimTrackerHits="SimTrackerHits",
InputCollectionTrackerHits="TrackerHits",
InputCollectionTracks="Tracks",
ExampleInt=5
)
consumer = ExampleFunctionalConsumerMultiple(
"Consumer",
InputCollectionFloat="VectorFloat",
InputCollectionParticles1="MCParticles1",
InputCollectionParticles2="MCParticles2",
InputCollectionSimTrackerHits="SimTrackerHits",
InputCollectionTrackerHits="TrackerHits",
InputCollectionTracks="Tracks",
ExampleInt=5,
)

ApplicationMgr(TopAlg=[producer, consumer],
EvtSel="NONE",
EvtMax=10,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
ApplicationMgr(
TopAlg=[producer, consumer],
EvtSel="NONE",
EvtMax=10,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,37 @@
# to check that the contents of the file are the expected ones

from Gaudi.Configuration import INFO
from Configurables import ExampleFunctionalProducer, ExampleFunctionalConsumerRuntimeCollections
from Configurables import (
ExampleFunctionalProducer,
ExampleFunctionalConsumerRuntimeCollections,
)
from k4FWCore import ApplicationMgr
from Configurables import EventDataSvc

producer0 = ExampleFunctionalProducer("Producer0",
OutputCollection="MCParticles0",
)
producer1 = ExampleFunctionalProducer("Producer1",
OutputCollection="MCParticles1",
)
producer2 = ExampleFunctionalProducer("Producer2",
OutputCollection="MCParticles2",
)
consumer = ExampleFunctionalConsumerRuntimeCollections("Consumer",
# InputCollection="MCParticles0 MCParticles1 MCParticles2",
InputCollection=["MCParticles0", "MCParticles1", "MCParticles2"],
Offset=0,
)
producer0 = ExampleFunctionalProducer(
"Producer0",
OutputCollection="MCParticles0",
)
producer1 = ExampleFunctionalProducer(
"Producer1",
OutputCollection="MCParticles1",
)
producer2 = ExampleFunctionalProducer(
"Producer2",
OutputCollection="MCParticles2",
)
consumer = ExampleFunctionalConsumerRuntimeCollections(
"Consumer",
# InputCollection="MCParticles0 MCParticles1 MCParticles2",
InputCollection=["MCParticles0", "MCParticles1", "MCParticles2"],
Offset=0,
)


ApplicationMgr(TopAlg=[producer0, producer1, producer2, consumer],
EvtSel="NONE",
EvtMax=10,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
ApplicationMgr(
TopAlg=[producer0, producer1, producer2, consumer],
EvtSel="NONE",
EvtMax=10,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,63 @@
# to check that the contents of the file are the expected ones

from Gaudi.Configuration import INFO
from Configurables import ExampleFunctionalProducerMultiple, ExampleFunctionalConsumerRuntimeCollectionsMultiple
from Configurables import (
ExampleFunctionalProducerMultiple,
ExampleFunctionalConsumerRuntimeCollectionsMultiple,
)
from k4FWCore import ApplicationMgr
from Configurables import EventDataSvc

producer0 = ExampleFunctionalProducerMultiple("Producer0",
OutputCollectionFloat="VectorFloat0",
OutputCollectionParticles1="MCParticles0",
OutputCollectionParticles2="MCParticles1",
OutputCollectionSimTrackerHits="SimTrackerHits0",
OutputCollectionTrackerHits="TrackerHits0",
OutputCollectionTracks="Tracks0",
ExampleInt=5
)
producer1 = ExampleFunctionalProducerMultiple("Producer1",
OutputCollectionFloat="VectorFloat1",
OutputCollectionParticles1="MCParticles2",
OutputCollectionParticles2="MCParticles3",
OutputCollectionSimTrackerHits="SimTrackerHits1",
OutputCollectionTrackerHits="TrackerHits1",
OutputCollectionTracks="Tracks1",
ExampleInt=5
)
producer2 = ExampleFunctionalProducerMultiple("Producer2",
OutputCollectionFloat="VectorFloat2",
OutputCollectionParticles1="MCParticles4",
OutputCollectionParticles2="MCParticles5",
OutputCollectionSimTrackerHits="SimTrackerHits2",
OutputCollectionTrackerHits="TrackerHits2",
OutputCollectionTracks="Tracks2",
ExampleInt=5
)
producer0 = ExampleFunctionalProducerMultiple(
"Producer0",
OutputCollectionFloat="VectorFloat0",
OutputCollectionParticles1="MCParticles0",
OutputCollectionParticles2="MCParticles1",
OutputCollectionSimTrackerHits="SimTrackerHits0",
OutputCollectionTrackerHits="TrackerHits0",
OutputCollectionTracks="Tracks0",
ExampleInt=5,
)
producer1 = ExampleFunctionalProducerMultiple(
"Producer1",
OutputCollectionFloat="VectorFloat1",
OutputCollectionParticles1="MCParticles2",
OutputCollectionParticles2="MCParticles3",
OutputCollectionSimTrackerHits="SimTrackerHits1",
OutputCollectionTrackerHits="TrackerHits1",
OutputCollectionTracks="Tracks1",
ExampleInt=5,
)
producer2 = ExampleFunctionalProducerMultiple(
"Producer2",
OutputCollectionFloat="VectorFloat2",
OutputCollectionParticles1="MCParticles4",
OutputCollectionParticles2="MCParticles5",
OutputCollectionSimTrackerHits="SimTrackerHits2",
OutputCollectionTrackerHits="TrackerHits2",
OutputCollectionTracks="Tracks2",
ExampleInt=5,
)

consumer = ExampleFunctionalConsumerRuntimeCollectionsMultiple("Consumer",
Particles=["MCParticles0", "MCParticles1", "MCParticles2", "MCParticles3", "MCParticles4"],
Tracks=["Tracks0", "Tracks1", "Tracks2"],
SimTrackerHits="SimTrackerHits0",
Offset=0,
)
consumer = ExampleFunctionalConsumerRuntimeCollectionsMultiple(
"Consumer",
Particles=[
"MCParticles0",
"MCParticles1",
"MCParticles2",
"MCParticles3",
"MCParticles4",
],
Tracks=["Tracks0", "Tracks1", "Tracks2"],
SimTrackerHits="SimTrackerHits0",
Offset=0,
)


ApplicationMgr(TopAlg=[producer0, producer1, producer2, consumer],
EvtSel="NONE",
EvtMax=10,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
ApplicationMgr(
TopAlg=[producer0, producer1, producer2, consumer],
EvtSel="NONE",
EvtMax=10,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
24 changes: 12 additions & 12 deletions test/k4FWCoreTest/options/ExampleFunctionalFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
from k4FWCore import ApplicationMgr, IOSvc

svc = IOSvc("IOSvc")
svc.input = 'output_k4test_exampledata_producer.root'
svc.output = 'functional_transformer.root'
svc.input = "output_k4test_exampledata_producer.root"
svc.output = "functional_transformer.root"

transformer = ExampleFunctionalTransformer("Transformer",
InputCollection="MCParticles",
OutputCollection="NewMCParticles")

mgr = ApplicationMgr(TopAlg=[transformer],
EvtSel="NONE",
EvtMax=-1,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
transformer = ExampleFunctionalTransformer(
"Transformer", InputCollection="MCParticles", OutputCollection="NewMCParticles"
)

mgr = ApplicationMgr(
TopAlg=[transformer],
EvtSel="NONE",
EvtMax=-1,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
26 changes: 14 additions & 12 deletions test/k4FWCoreTest/options/ExampleFunctionalFileMultiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@
from k4FWCore import ApplicationMgr, IOSvc

svc = IOSvc("IOSvc")
svc.input = ['output_k4test_exampledata_producer_multiple.root']
svc.output = 'functional_transformer_multiple.root'
svc.input = ["output_k4test_exampledata_producer_multiple.root"]
svc.output = "functional_transformer_multiple.root"

transformer = ExampleFunctionalTransformerMultiple("Transformer",
# InputCollection="MCParticles",
# OutputCollection="NewMCParticles")
)
transformer = ExampleFunctionalTransformerMultiple(
"Transformer",
# InputCollection="MCParticles",
# OutputCollection="NewMCParticles")
)

mgr = ApplicationMgr(TopAlg=[transformer],
EvtSel="NONE",
EvtMax=-1,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
mgr = ApplicationMgr(
TopAlg=[transformer],
EvtSel="NONE",
EvtMax=-1,
ExtSvc=[EventDataSvc("EventDataSvc")],
OutputLevel=INFO,
)
Loading

0 comments on commit 3054187

Please sign in to comment.