Skip to content

Commit

Permalink
Run 3 Scouting format tests, read old versions in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
wddgit committed May 31, 2023
1 parent 21991a1 commit 084a0b8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions DataFormats/Scouting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# DataFormats/Scouting

## Scouting Data Formats

Any changes to the Scouting data formats must be backwards compatible. In order to ensure the Scouting formats can be read by all future CMSSW releases, there is a `TestRun3ScoutingDataFormats` unit test, which makes use of the `TestReadRun3Scouting` analyzer and the `TestWriteRun3Scouting` producer. The unit test checks that the objects can be read properly from

* a file written by the same release
* files written by (some) earlier releases

If the persistent format of any Scouting data format gets changed in the future, please adjust the `TestReadRun3Scouting` and `TestWriteRun3Scouting` modules accordingly. It is important that every member container has some content in this test. Please also add a new file to the [https://github.com/cms-data/DataFormats-Scouting/](https://github.com/cms-data/DataFormats-Scouting/) repository, and update the `TestRun3ScoutingDataFormats` unit test to read the newly created file. The file name should contain the release or pre-release with which it was written. There will probably be analogous tests added in the future for run 2 and future runs which will need similar maintenance, although it is unlikely the run 2 formats will change anymore.
30 changes: 30 additions & 0 deletions DataFormats/Scouting/test/TestRun3ScoutingFormats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,34 @@ file=testRun3Scouting.root

cmsRun ${LOCAL_TEST_DIR}/test_readRun3Scouting_cfg.py "$file" || die "Failure using test_readRun3Scouting_cfg.py $file" $?

# The old files read below were generated as follows.
# testRun3Scouting_CMSSW_12_4_0.root: Check out the 12_4_0
# release and cherry pick the commit that adds the original
# version of the file DataFormats/Scouting/test/TestWriteRun3Scouting.cc
# (6 files added by that commit). There will be a conflict
# with BuildFile.xml and you will need to delete the two
# unrelated lines).
#
# testRun3Scouting_CMSSW_13_0_3.root: Check out the 13_0_3
# release and cherry pick the commit that adds the original
# version of the file DataFormats/Scouting/test/TestWriteRun3Scouting.cc
# (6 files added by that commit). There will be the same
# conflict with BuildFile.xml and you will need to delete the two
# unrelated lines). Also add the second commit modifying that
# file.
#
# Run the create_Run3Scouting_test_file.py configuration and
# rename the file it creates.
#
# 12_4_0 was chosen because that release was used for 2022 data.
# 13_0_3 is being used for 2023 data.

file=testRun3Scouting_CMSSW_12_4_0.root
inputfile=$(edmFileInPath DataFormats/Scouting/data/$file) || die "Failure edmFileInPath DataFormats/Scouting/data/$file" $?
cmsRun ${LOCAL_TEST_DIR}/test_readRun3Scouting_CMSSW_12_4_0_cfg.py "$inputfile" || die "Failed to read old file $file" $?

file=testRun3Scouting_CMSSW_13_0_3.root
inputfile=$(edmFileInPath DataFormats/Scouting/data/$file) || die "Failure edmFileInPath DataFormats/Scouting/data/$file" $?
cmsRun ${LOCAL_TEST_DIR}/test_readRun3Scouting_cfg.py "$inputfile" || die "Failed to read old file $file" $?

exit 0

0 comments on commit 084a0b8

Please sign in to comment.