-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit test for Run 3 Scouting formats #41834
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wouldn't be bad to also rearrange classes_def.xml in order to have the classes listed there in alphabetical order, in order to avoid some head hache to who's trying to associate the versions in the name of the data file to the classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @perrotta for the suggestion, I agree a matching order in the
classes_def.xml
would help. @wddgit Could you take care of it (either as part of the Run2 scouting PR, or in a separate PR)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll include it in the Run 2 Scouting PR which I am currently implementing. A good idea.