-
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 #44570 from mmusich/mm_dev_pedeConversionTest_14_1_X
add a unit test for conversion of `millepede.res` files into DB payloads
- Loading branch information
Showing
6 changed files
with
145 additions
and
13 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
12 changes: 12 additions & 0 deletions
12
Alignment/MillePedeAlignmentAlgorithm/test/align_params_cff.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,12 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
_alignParams = cms.PSet( | ||
alignParams = cms.vstring( | ||
"TrackerP1PXBHalfBarrel,111111", | ||
"TrackerP1PXECHalfCylinder,111111", | ||
"TrackerTIBHalfBarrel,111111", | ||
"TrackerTOBHalfBarrel,rrrrrr", | ||
"TrackerTIDEndcap,111111", | ||
"TrackerTECEndcap,111111", | ||
) | ||
) |
111 changes: 111 additions & 0 deletions
111
Alignment/MillePedeAlignmentAlgorithm/test/convertMPresToDB_cfg.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,111 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
from Configuration.Eras.Era_Run3_cff import Run3 | ||
process = cms.Process("Alignment", Run3) | ||
|
||
process.options = cms.untracked.PSet( | ||
Rethrow = cms.untracked.vstring("ProductNotFound") # do not accept this exception | ||
) | ||
|
||
###################################################### | ||
# initialize MessageLogger | ||
###################################################### | ||
process.load("FWCore.MessageService.MessageLogger_cfi") | ||
process.MessageLogger.files.alignment = cms.untracked.PSet( | ||
DEBUG = cms.untracked.PSet( | ||
limit = cms.untracked.int32(-1) | ||
), | ||
INFO = cms.untracked.PSet( | ||
limit = cms.untracked.int32(5), | ||
reportEvery = cms.untracked.int32(5) | ||
), | ||
WARNING = cms.untracked.PSet( | ||
limit = cms.untracked.int32(10) | ||
), | ||
ERROR = cms.untracked.PSet( | ||
limit = cms.untracked.int32(-1) | ||
), | ||
Alignment = cms.untracked.PSet( | ||
limit = cms.untracked.int32(-1), | ||
reportEvery = cms.untracked.int32(1) | ||
), | ||
enableStatistics = cms.untracked.bool(True) | ||
) | ||
|
||
###################################################### | ||
# Design GT (in order to fetch the design geometry) | ||
###################################################### | ||
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") | ||
from Configuration.AlCa.GlobalTag import GlobalTag | ||
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2024_design', '') # take your favourite | ||
|
||
###################################################### | ||
# Starting alignment of the campaign | ||
###################################################### | ||
from CondCore.CondDB.CondDB_cfi import * | ||
CondDBConnection = CondDB.clone( connect = cms.string( 'sqlite_file:alignment_input.db' ) ) | ||
process.trackerAlignment = cms.ESSource("PoolDBESSource", | ||
CondDBConnection, | ||
toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"), | ||
tag = cms.string("TrackerAlignment_PCL_byRun_v2_express_348155") | ||
) | ||
)) | ||
|
||
process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource", "trackerAlignment") | ||
|
||
###################################################### | ||
# Alignment producer | ||
###################################################### | ||
process.load("Configuration.Geometry.GeometryRecoDB_cff") | ||
process.load("Alignment.CommonAlignmentProducer.AlignmentProducer_cff") | ||
|
||
###################################################### | ||
# | ||
# !!! This has to match the alignable selection | ||
# of the pede configuration !!! | ||
# | ||
###################################################### | ||
from align_params_cff import _alignParams | ||
process.AlignmentProducer.ParameterBuilder.Selector = _alignParams | ||
|
||
###################################################### | ||
# Alignment Producer options | ||
###################################################### | ||
process.AlignmentProducer.doMisalignmentScenario = False #True | ||
process.AlignmentProducer.applyDbAlignment = True # either globalTag or trackerAlignment | ||
|
||
###################################################### | ||
# assign by reference (i.e. could change MillePedeAlignmentAlgorithm as well): | ||
###################################################### | ||
process.AlignmentProducer.algoConfig = process.MillePedeAlignmentAlgorithm | ||
process.AlignmentProducer.algoConfig.mode = 'pedeRead' # reads millepede.res | ||
process.AlignmentProducer.algoConfig.pedeReader.readFile = 'millepede.res' | ||
process.AlignmentProducer.algoConfig.treeFile = 'my_treeFile.root' | ||
|
||
###################################################### | ||
# Source | ||
###################################################### | ||
process.source = cms.Source("EmptySource", | ||
firstRun = cms.untracked.uint32(1) # choose your run! | ||
) | ||
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1) ) | ||
|
||
process.dump = cms.EDAnalyzer("EventContentAnalyzer") | ||
process.p = cms.Path(process.dump) | ||
|
||
# should not be needed, but is: | ||
# otherwise AlignmentProducer does not call relevant algorithm part | ||
process.AlignmentProducer.saveToDB = True | ||
|
||
###################################################### | ||
# Output alignment payload from reading file | ||
###################################################### | ||
CondDBConnectionOut = CondDB.clone( connect = cms.string( 'sqlite_file:convertedFromResFile.db' ) ) | ||
process.PoolDBOutputService = cms.Service("PoolDBOutputService", | ||
CondDBConnectionOut, | ||
timetype = cms.untracked.string('runnumber'), | ||
toPut = cms.VPSet(cms.PSet(record = cms.string('TrackerAlignmentRcd'), | ||
tag = cms.string('Alignments') | ||
) | ||
) | ||
) |
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
14 changes: 14 additions & 0 deletions
14
Alignment/MillePedeAlignmentAlgorithm/test/test_pedeConversion.sh
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,14 @@ | ||
#!/bin/bash | ||
function die { echo $1: status $2; exit $2; } | ||
|
||
LOCAL_TEST_DIR=${SCRAM_TEST_PATH} | ||
|
||
echo "============== testing conversion to DB file from millepede.res" | ||
(cmsRun ${LOCAL_TEST_DIR}/convertMPresToDB_cfg.py) || die 'failed running convertMPresToDB_cfg.py' $? | ||
|
||
echo -e "Content of the current directory is: "`ls .` | ||
|
||
INPUTFILE=convertedFromResFile.db | ||
|
||
echo -e "\n\n============== testing converted file corresponds to input" | ||
(cmsRun ${SCRAM_TEST_PATH}/AlignmentRcdChecker_cfg.py inputSqliteFile=${INPUTFILE}) || die 'failed running AlignmentRcdChecker' $? |