Skip to content

Commit

Permalink
add a unit test for createTrackerAlignmentRcds
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed Aug 28, 2024
1 parent 3914bc8 commit 0ce8a62
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions Alignment/TrackerAlignment/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
<test name="test_PixelBaryCentreTool" command="pixelPositions.sh"/>
<test name="test_ProduceSystematicMisalignment" command="testProduceAllMisalignments.sh"/>
<test name="test_CreateRandomMisalignment" command="testCreateRandomMisalignment.sh"/>
<test name="test_CreateReferenceRecords" command="testCreateReferenceRecords.sh"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
from __future__ import print_function
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing

import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
###################################################################
# Setup 'standard' options
###################################################################
options = VarParsing.VarParsing()
options.register('Scenario',
_settings.DEFAULT_VERSION, # default value
VarParsing.VarParsing.multiplicity.singleton, # singleton or list
VarParsing.VarParsing.varType.string, # string, int, or float
"geometry version to use")
options.parseArguments()

###################################################################
# get Global Tag and ERA
###################################################################
GLOBAL_TAG, ERA = _settings.get_era_and_conditions(options.Scenario)
process = cms.Process("Alignment", ERA)

process.load("Configuration.StandardSequences.MagneticField_cff") # B-field map
if(options.Scenario == _settings.DEFAULT_VERSION):
print("Loading default scenario: ", _settings.DEFAULT_VERSION)
process.load('Configuration.Geometry.GeometryExtended2026DefaultReco_cff')
else:
process.load('Configuration.Geometry.GeometryExtended'+options.Scenario+'Reco_cff')
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") # Global tag


################################################################################
# parameters to configure:
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag,GLOBAL_TAG)

process.load("Alignment.TrackerAlignment.createIdealTkAlRecords_cfi")
process.createIdealTkAlRecords.alignToGlobalTag = False
################################################################################

usedGlobalTag = process.GlobalTag.globaltag.value()
print("Using Global Tag:", usedGlobalTag)

from CondCore.CondDB.CondDB_cfi import *
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
CondDB,
timetype = cms.untracked.string("runnumber"),
toPut = cms.VPSet(
cms.PSet(
record = cms.string("TrackerAlignmentRcd"),
tag = cms.string("Alignments")
),
cms.PSet(
record = cms.string("TrackerAlignmentErrorExtendedRcd"),
tag = cms.string("AlignmentErrorsExtended")
),
cms.PSet(
record = cms.string("TrackerSurfaceDeformationRcd"),
tag = cms.string("AlignmentSurfaceDeformations")
),
)
)
process.PoolDBOutputService.connect = \
("sqlite_file:tracker_alignment_payloads_"+
options.Scenario+("_reference.db"
if process.createIdealTkAlRecords.createReferenceRcd
else "_fromIdealGeometry.db"))

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
process.source = cms.Source("EmptySource")

process.p = cms.Path(process.createIdealTkAlRecords)
7 changes: 7 additions & 0 deletions Alignment/TrackerAlignment/test/testCreateReferenceRecords.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

function die { echo $1: status $2 ; exit $2; }
for test in $(ls $SCRAM_TEST_PATH | grep createTrackerAlignmentRcds); do
echo -e "\n\nrunning unit test: " ${test}
cmsRun $SCRAM_TEST_PATH/${test} || die "Failure running ${test}" $?
done

0 comments on commit 0ce8a62

Please sign in to comment.