diff --git a/README.md b/README.md index 6c70d33bb..6cb0bbc2a 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,14 @@ with tools that consume JSON. Use `edm4hep2json --help` to see the available options for selecting which parts of the input file should be part of the output. +## Example files + +Example EDM4hep files can be obtained from the Continuous Integration (CI) +workflows. From the EDM4hep github page, go to Actions -> Key4hep build, click +one of the runs (the latest scheduled is preferred) and they will appear at the +bottom, under Artifacts. + + ## Contributing Contributions and bug reports are welcome! See our [contributing guidelines](doc/contributing.md) if you want to contribute code to EDM4hep. diff --git a/scripts/createEDM4hepFile.py b/scripts/createEDM4hepFile.py index 9ade63cf0..e9e902cc2 100644 --- a/scripts/createEDM4hepFile.py +++ b/scripts/createEDM4hepFile.py @@ -10,14 +10,16 @@ frames = 3 # How many frames or events will be written vectorsize = 5 # For vector members, each vector member will have this size counter = count() # next(counter) will return 0, 1, 2, ... -# used to generate the dummy data -output_file = "output.root" parser = argparse.ArgumentParser(description="Create a file with EDM4hep data") parser.add_argument( "--rntuple", action="store_true", help="Use a ROOT ntuple instead of EDM4hep" ) +parser.add_argument( + "--output-file", type=str, help="Output file name", default="edm4hep.root" +) args = parser.parse_args() +output_file = args.output_file if args.rntuple: try: @@ -78,9 +80,7 @@ particle.setMomentumAtEndpoint( edm4hep.Vector3d(next(counter), next(counter), next(counter)) ) - particle.setSpin( - edm4hep.Vector3f(next(counter), next(counter), next(counter)) - ) + particle.setSpin(edm4hep.Vector3f(next(counter), next(counter), next(counter))) particle.setColorFlow(edm4hep.Vector2i(next(counter), next(counter))) particles[0].addToDaughters(particles[1]) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ee6306bdb..83cf21ca1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,9 +13,12 @@ function(set_test_env _testname) ) endfunction() -add_test(NAME "Create an EDM4hep data file" COMMAND python ${PROJECT_SOURCE_DIR}/scripts/createEDM4hepFile.py) +add_test(NAME "Create an EDM4hep data file" COMMAND python ${PROJECT_SOURCE_DIR}/scripts/createEDM4hepFile.py --output-file edm4hep_example.root) set_test_env("Create an EDM4hep data file") +add_test(NAME "Create an EDM4hep data file (RNTuple)" COMMAND python ${PROJECT_SOURCE_DIR}/scripts/createEDM4hepFile.py --rntuple --output-file edm4hep_example_rntuple.root) +set_test_env("Create an EDM4hep data file (RNTuple)") + add_executable(write_events write_events.cc) target_include_directories(write_events PUBLIC ${PROJECT_SOURCE_DIR}/edm4hep ) target_link_libraries(write_events edm4hep podio::podioRootIO)