-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41834 from wddgit/run3ScoutingUnitTest
Add unit test for Run 3 Scouting formats
- Loading branch information
Showing
8 changed files
with
2,055 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 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 version numbers of the data format classes (from classes_def.xml) in alphabetical order and the release or pre-release with which it was written. If the latest file of Run 3 scouting before the update has not been used in data taking, the file can be deleted. | ||
|
||
There will probably be analogous tests added in the future for Run 2 and for runs after Run 3 which will need similar maintenance, although it is unlikely the Run 2 formats will change anymore. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
<use name="DataFormats/Scouting"/> | ||
|
||
<library name="testRun3ScoutingDataFormats" file="TestReadRun3Scouting.cc,TestWriteRun3Scouting.cc"> | ||
<flags EDM_PLUGIN="1"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="FWCore/Utilities"/> | ||
</library> | ||
|
||
<test name="TestRun3ScoutingDataFormats" command="TestRun3ScoutingFormats.sh"/> | ||
|
||
<test name="testDataFormatsScoutingRun2" command="testDataFormatsScoutingRun2.sh"/> | ||
<test name="testDataFormatsScoutingRun3" command="testDataFormatsScoutingRun3.sh"/> |
1,097 changes: 1,097 additions & 0 deletions
1,097
DataFormats/Scouting/test/TestReadRun3Scouting.cc
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/sh -ex | ||
|
||
function die { echo $1: status $2 ; exit $2; } | ||
|
||
LOCAL_TEST_DIR=${SCRAM_TEST_PATH} | ||
|
||
cmsRun ${LOCAL_TEST_DIR}/create_Run3Scouting_test_file_cfg.py || die 'Failure using create_Run3Scouting_test_file_cfg.py' $? | ||
|
||
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_v3_v5_v3_v4_v5_v3_v5_v3_v3_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_v3_v6_v3_v4_v5_v3_v5_v3_v3_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_cfg.py configuration and | ||
# rename the file it creates. | ||
# | ||
# The versions of the classes are encoded in the filenames in | ||
# alphabetical order. The only version that changed from 12_4_0 | ||
# to 13_0_3 was the Run3ScoutingElectron class. | ||
# | ||
# 12_4_0 was chosen because the 12_4_X release cycle was used | ||
# for 2022 data, and the scouting data formats were not updated | ||
# after 12_4_0. | ||
# | ||
# 13_0_3 was chosen because the 13_0_X release cycle was used | ||
# for 2023 data, and the scouting data formats and ROOT were | ||
# not updated after 13_0_3. | ||
|
||
file=testRun3Scouting_v3_v5_v3_v4_v5_v3_v5_v3_v3_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_v3_v6_v3_v4_v5_v3_v5_v3_v3_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 |
Oops, something went wrong.