Skip to content

Commit 0829a4b

Browse files
committed
introduce defaultPhase2ConditionsEra and use it in several phase-2 related unit tests configurations
1 parent 5da7be9 commit 0829a4b

File tree

13 files changed

+136
-29
lines changed

13 files changed

+136
-29
lines changed

Alignment/OfflineValidation/test/testPrimaryVertexRelatedValidations_cfg.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ class RefitType(Enum):
3333
_theRefitter = RefitType.COMMON # RefitType.STANDARD (other option not involving filtering)
3434
_theTrackCollection = 'generalTracks' # FIXME: 'ALCARECOTkAlMinBias' once a sample is available
3535

36+
###################################################################
37+
# Set default phase-2 settings
38+
###################################################################
39+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
40+
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
41+
3642
###################################################################
3743
# Set the era
3844
###################################################################
3945
if(options.isPhase2):
40-
from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
41-
process = cms.Process("Demo",Phase2C17I13M9)
46+
process = cms.Process("Demo", _PH2_ERA)
4247
else:
4348
from Configuration.Eras.Era_Run3_cff import Run3
4449
process = cms.Process("Demo", Run3)
@@ -118,7 +123,7 @@ class RefitType(Enum):
118123
####################################################################
119124
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
120125
from Configuration.AlCa.GlobalTag import GlobalTag
121-
process.GlobalTag = GlobalTag(process.GlobalTag, ('auto:phase2_realistic_T33' if options.isPhase2 else 'auto:phase1_2022_realistic'), '')
126+
process.GlobalTag = GlobalTag(process.GlobalTag, (_PH2_GLOBAL_TAG if options.isPhase2 else 'auto:phase1_2022_realistic'), '')
122127

123128
if _allFromGT:
124129
print("############ testPVValidation_cfg.py: msg%-i: All is taken from GT")

Alignment/TrackerAlignment/test/Misalignments/createRandomlyMisalignedGeometry_Phase2_cfg.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
import FWCore.ParameterSet.VarParsing as VarParsing
44
import copy, sys, os
55

6-
process = cms.Process("Misaligner")
6+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
7+
GLOBAL_TAG, ERA = _settings.get_era_and_conditions("2026D107") # this should really be _settings.DEFAULT_VERSION :(
8+
process = cms.Process("Misaligner", ERA)
79

810
###################################################################
911
# Setup 'standard' options
@@ -46,15 +48,16 @@
4648
###################################################################
4749
# Ideal geometry producer and standard includes
4850
###################################################################
49-
process.load('Configuration.Geometry.GeometryExtended2026DefaultReco_cff')
51+
process.load('Configuration.Geometry.GeometryExtended2026D107Reco_cff')
5052
process.trackerGeometry.applyAlignment = True
5153

5254
###################################################################
5355
# Just state the Global Tag (and pick some run)
5456
###################################################################
5557
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
5658
from Configuration.AlCa.GlobalTag import GlobalTag
57-
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T33', '') # using realistic Phase 2 geom
59+
#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T25', '') # using realistic Phase 2 geom
60+
process.GlobalTag = GlobalTag(process.GlobalTag, GLOBAL_TAG, '') # using realistic Phase 2 geom
5861
print("Using global tag:", process.GlobalTag.globaltag.value())
5962

6063
###################################################################

CondTools/SiPhase2Tracker/test/SiPhase2BadStripChannelBuilder_cfg.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import FWCore.ParameterSet.Config as cms
22

3-
process = cms.Process("ICALIB")
3+
###################################################################
4+
# Set default phase-2 settings
5+
###################################################################
6+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
7+
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
8+
9+
process = cms.Process("ICALIB", _PH2_ERA)
410
import FWCore.ParameterSet.VarParsing as VarParsing
511

612
options = VarParsing.VarParsing('analysis')
@@ -17,13 +23,13 @@
1723
engineName = cms.untracked.string('TRandom3')
1824
)
1925

20-
## specify detector D110, as the geometry is needed (will take tracker T35)
26+
## specify the default phase2 detector
2127
process.load("Configuration.Geometry.GeometryExtended2026Default_cff")
2228
process.load('Configuration.Geometry.GeometryExtended2026DefaultReco_cff')
2329

2430
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
2531
from Configuration.AlCa.GlobalTag import GlobalTag
26-
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T33', '')
32+
process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '')
2733

2834
###################################################################
2935
# Messages

CondTools/SiPhase2Tracker/test/SiPhase2BadStripChannelReader_cfg.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
import FWCore.ParameterSet.Config as cms
44
import FWCore.ParameterSet.VarParsing as VarParsing
55

6-
process = cms.Process("TEST")
6+
###################################################################
7+
# Set default phase-2 settings
8+
###################################################################
9+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
10+
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
11+
12+
process = cms.Process("TEST", _PH2_ERA)
713
options = VarParsing.VarParsing('analysis')
814
options.register('fromESSource',
915
False, # default value
@@ -52,7 +58,7 @@
5258
process.load('Configuration.Geometry.GeometryExtended2026DefaultReco_cff')
5359
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
5460
from Configuration.AlCa.GlobalTag import GlobalTag
55-
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T33', '')
61+
process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '')
5662
#process.load("SLHCUpgradeSimulations.Geometry.fakePhase2OuterTrackerConditions_cff") # already included
5763
#process.SiPhase2OTFakeBadStripsESSource.printDebug = cms.untracked.bool(True) # this makes it verbose
5864
process.SiPhase2OTFakeBadStripsESSource.badComponentsFraction = cms.double(0.05) # bad components fraction is 5%

CondTools/SiPhase2Tracker/test/SiPhase2OuterTrackerLorentzAngleWriter_cfg.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
from __future__ import print_function
44
import os, shlex, shutil, getpass
55

6+
###################################################################
7+
# Set default phase-2 settings
8+
###################################################################
9+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
10+
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
11+
612
import FWCore.ParameterSet.Config as cms
7-
process = cms.Process("TEST")
13+
process = cms.Process("TEST", _PH2_ERA)
814

915
###################################################################
1016
# Messages
@@ -43,7 +49,7 @@
4349

4450
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
4551
from Configuration.AlCa.GlobalTag import GlobalTag
46-
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T33')
52+
process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG)
4753
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )
4854

4955
process.source = cms.Source("EmptyIOVSource",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from Configuration.PyReleaseValidation.upgradeWorkflowComponents import upgradeProperties as properties
2+
from Configuration.AlCa.autoCond import autoCond
3+
from Configuration.StandardSequences.Eras import eras
4+
5+
DEFAULT_VERSION = "2026D110"
6+
7+
def get_era_and_conditions(version_key):
8+
"""Retrieve the era and global tag for a given version key.
9+
10+
Args:
11+
version_key (str): The version key to look up.
12+
13+
Returns:
14+
tuple: A tuple containing the global tag and era object.
15+
16+
Raises:
17+
KeyError: If the version key or global tag is not found.
18+
"""
19+
# Ensure the version key exists in the properties for 2026
20+
if version_key not in properties[2026]:
21+
raise KeyError(f"Version key '{version_key}' not found in properties[2026].")
22+
23+
# Retrieve the global tag key
24+
global_tag_key = properties[2026][version_key]['GT']
25+
print(f"Global tag key from properties: {global_tag_key}")
26+
27+
# Validate the existence of the global tag in autoCond
28+
global_tag_name = global_tag_key.replace("auto:", "")
29+
if global_tag_name not in autoCond:
30+
raise KeyError(f"Global tag key '{global_tag_key}' not found in autoCond.")
31+
32+
# Retrieve the era key and get the corresponding era object
33+
era_key = properties[2026][version_key]['Era']
34+
print(f"Constructed era key from properties: {era_key}")
35+
era = getattr(eras, era_key)
36+
37+
return global_tag_key, era

Geometry/TrackerGeometryBuilder/test/python/testPixelTopologyMapTest_cfg.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import FWCore.ParameterSet.Config as cms
22
import FWCore.ParameterSet.VarParsing as VarParsing
33

4+
###################################################################
5+
# Set default phase-2 settings
6+
###################################################################
7+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
8+
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
9+
410
process = cms.Process("TopologyAnalysis")
511
options = VarParsing.VarParsing("analysis")
612

@@ -18,6 +24,12 @@
1824

1925
options.parseArguments()
2026

27+
if 'phase2' in options.globalTag:
28+
if options.globalTag != _PH2_GLOBAL_TAG:
29+
raise KeyError(
30+
f"Global tag key given in input ('{options.globalTag}') mismatches the default ('{_PH2_GLOBAL_TAG}')."
31+
)
32+
2133
###################################################################
2234
# Message logger service
2335
###################################################################

RecoTracker/MkFit/test/dumpMkFitGeometryPhase2.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import FWCore.ParameterSet.Config as cms
22

3-
from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
43
# from Configuration.ProcessModifiers.trackingMkFit_cff import trackingMkFit
54
from Configuration.ProcessModifiers.trackingMkFitCommon_cff import trackingMkFitCommon
65
trackingMkFit = cms.ModifierChain(trackingMkFitCommon)
76

8-
process = cms.Process('DUMP',Phase2C17I13M9,trackingMkFit)
7+
###################################################################
8+
# Set default phase-2 settings
9+
###################################################################
10+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
11+
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
12+
13+
process = cms.Process('DUMP', _PH2_ERA, trackingMkFit)
914

1015
# import of standard configurations
1116
process.load('Configuration.StandardSequences.Services_cff')
@@ -15,7 +20,7 @@
1520
process.load('Configuration.StandardSequences.Reconstruction_cff')
1621
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
1722
from Configuration.AlCa.GlobalTag import GlobalTag
18-
process.GlobalTag = GlobalTag(process.GlobalTag, "auto:phase2_realistic_T33", '')
23+
process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '')
1924

2025
process.MessageLogger.cerr.threshold = "INFO"
2126
process.MessageLogger.cerr.MkFitGeometryESProducer = dict(limit=-1)

SLHCUpgradeSimulations/Geometry/test/phase2_digi_reco_pixelntuple_cfg.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import FWCore.ParameterSet.Config as cms
22

3+
###################################################################
4+
# Set default phase-2 settings
5+
###################################################################
6+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
7+
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
38

4-
from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
5-
process = cms.Process('USER',Phase2C17I13M9)
9+
process = cms.Process('USER', _PH2_ERA)
610

711
# import of standard configurations
812
process.load('Configuration.StandardSequences.Services_cff')
@@ -95,7 +99,7 @@
9599
# They need pixel RecHits where the charge is stored with high-granularity and large dinamic range
96100

97101
from Configuration.AlCa.GlobalTag import GlobalTag
98-
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T33', '')
102+
process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '')
99103

100104
# Path and EndPath definitions
101105
process.digitisation_step = cms.Path(process.pdigi_valid)

SLHCUpgradeSimulations/Geometry/test/writeFile_phase2_cfg.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import FWCore.ParameterSet.Config as cms
22

3-
process = cms.Process("ICALIB")
3+
###################################################################
4+
# Set default phase-2 settings
5+
###################################################################
6+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
7+
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
8+
9+
process = cms.Process("ICALIB",_PH2_ERA)
410
process.load("Configuration.StandardSequences.Services_cff")
511
process.load('Configuration.Geometry.GeometryExtended2026DefaultReco_cff')
612

713
process.trackerGeometry.applyAlignment = cms.bool(False)
814

915
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
1016
from Configuration.AlCa.GlobalTag import GlobalTag
11-
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T33', '')
17+
process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '')
1218

1319
process.source = cms.Source("EmptyIOVSource",
1420
firstValue = cms.uint64(1),
@@ -28,7 +34,7 @@
2834
)
2935

3036
process.prodpixel = cms.EDAnalyzer("SiPixelDetInfoFileWriter",
31-
FilePath = cms.untracked.string('PixelSkimmedGeometry_GeometryExtended2026Tilted_D110.txt'),
37+
FilePath = cms.untracked.string('PixelSkimmedGeometry_GeometryExtended2026Tilted_Default.txt'),
3238
WriteROCInfo = cms.untracked.bool(True)
3339
)
3440

0 commit comments

Comments
 (0)