-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 #37226 from mmusich/addMillePedeTestingSetup_12_3_X
[12.3.X] Introduce alignment campaign-like unit test for `pede`
- Loading branch information
Showing
4 changed files
with
139 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
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,2 @@ | ||
#include "FWCore/Utilities/interface/TestHelper.h" | ||
RUNTEST() |
100 changes: 100 additions & 0 deletions
100
Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py
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,100 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
process = cms.Process("Alignment") | ||
|
||
process.Tracer = cms.Service("Tracer") | ||
|
||
setupGlobaltag = "121X_mcRun3_2021_realistic_forpp900GeV_v6" | ||
setupCollection = "ALCARECOTkAlCosmicsCosmicTF0T" | ||
setupCosmicsDecoMode = True | ||
setupCosmicsZeroTesla = False | ||
setupPrimaryWidth = -1.0 | ||
setupJson = "placeholder_json" | ||
setupRunStartGeometry = 1 | ||
setupAlgoMode = "pede" | ||
setupMonitorFile = "millePedeMonitorISN.root" | ||
setupBinaryFile = "milleBinaryISN.dat" | ||
readFiles = cms.untracked.vstring() | ||
|
||
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup | ||
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla) | ||
|
||
|
||
################################################################################ | ||
# setup alignment producer | ||
################################################################################ | ||
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.ConfigureAlignmentProducer as confAliProducer | ||
|
||
confAliProducer.setConfiguration(process, | ||
collection = setupCollection, | ||
mode = setupAlgoMode, | ||
monitorFile = setupMonitorFile, | ||
binaryFile = setupBinaryFile, | ||
primaryWidth = setupPrimaryWidth, | ||
cosmicsZeroTesla = setupCosmicsZeroTesla) | ||
|
||
|
||
################################################################################ | ||
# Overwrite some conditions in global tag | ||
################################################################################ | ||
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.SetCondition as tagwriter | ||
|
||
################################################################################ | ||
# insert Startgeometry | ||
################################################################################ | ||
# You can use tagwriter.setCondition() to overwrite conditions in globaltag | ||
|
||
################################################################################ | ||
# insert Alignables | ||
################################################################################ | ||
process.AlignmentProducer.ParameterBuilder.parameterTypes = ["SelectorRigid,RigidBody"] | ||
|
||
################################################################################ | ||
# Define the high-level structure alignables | ||
################################################################################ | ||
process.AlignmentProducer.ParameterBuilder.SelectorRigid = cms.PSet( | ||
alignParams = cms.vstring( | ||
"TrackerP1PXBHalfBarrel,111111", | ||
"TrackerP1PXECHalfCylinder,111111", | ||
"TrackerTIBHalfBarrel,111111", | ||
"TrackerTOBHalfBarrel,rrrrrr", | ||
"TrackerTIDEndcap,111111", | ||
"TrackerTECEndcap,111111", | ||
) | ||
) | ||
|
||
################################################################################ | ||
# insert Pedesettings | ||
################################################################################ | ||
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.helper as helper | ||
helper.set_pede_option(process, "skipemptycons") | ||
|
||
################################################################################ | ||
# Mille-procedure | ||
################################################################################ | ||
if setupAlgoMode == "mille": | ||
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.MilleSetup as mille | ||
mille.setup(process, | ||
input_files = readFiles, | ||
collection = setupCollection, | ||
json_file = setupJson, | ||
cosmics_zero_tesla = setupCosmicsZeroTesla, | ||
cosmics_deco_mode = setupCosmicsDecoMode) | ||
|
||
################################################################################ | ||
# Pede-procedure | ||
################################################################################ | ||
else: | ||
merge_binary_files = [ | ||
'milleBinary001.dat', | ||
'milleBinary002.dat', | ||
'milleBinary003.dat'] | ||
merge_tree_files = [ | ||
'treeFile001.root', | ||
'treeFile002.root', | ||
'treeFile003.root'] | ||
|
||
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.PedeSetup as pede | ||
pede.setup(process, | ||
binary_files = merge_binary_files, | ||
tree_files = merge_tree_files, | ||
run_start_geometry = setupRunStartGeometry) |
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,32 @@ | ||
#!/bin/bash | ||
function die { echo $1: status $2; exit $2; } | ||
|
||
if [ "${SCRAM_TEST_NAME}" != "" ] ; then | ||
mkdir ${SCRAM_TEST_NAME} | ||
cd ${SCRAM_TEST_NAME} | ||
fi | ||
|
||
if test -f "milleBinary00*"; then | ||
echo "cleaning the local test area" | ||
rm -fr milleBinary00* | ||
rm -fr pedeSteer* | ||
fi | ||
|
||
pwd | ||
echo " testing Aligment/MillePedeAlignmentAlgorithm" | ||
|
||
REMOTE="/store/group/alca_global/tkal_millepede_tests/" | ||
TESTPACKAGE="test_pede_package.tar" | ||
COMMMAND=`xrdfs cms-xrd-global.cern.ch locate ${REMOTE}${TESTPACKAGE}` | ||
STATUS=$? | ||
echo "xrdfs command status = "$STATUS | ||
if [ $STATUS -eq 0 ]; then | ||
echo "Using file ${TESTPACKAGE}. Running in ${LOCAL_TEST_DIR}." | ||
xrdcp root://cms-xrd-global.cern.ch/${REMOTE}${TESTPACKAGE} ${LOCAL_TEST_DIR} | ||
tar -xvf ${LOCAL_TEST_DIR}/${TESTPACKAGE} | ||
gunzip milleBinary00* | ||
(cmsRun ${LOCAL_TEST_DIR}/test_pede.py) || die 'failed running test_pede.py' $? | ||
echo -e "\n MillePede Exit Status: "`cat millepede.end` | ||
else | ||
die "SKIPPING test, file ${TESTPACKAGE} not found" 0 | ||
fi |