Skip to content

Commit

Permalink
Merge tag 'CMSSW_14_2_X_2024-11-11-2300' into CMSSW_14_1_0_pre3_LST_X…
Browse files Browse the repository at this point in the history
…_LSTCore_realfiles
  • Loading branch information
ariostas committed Nov 12, 2024
2 parents 8928adf + 036340d commit 1a0ab7e
Show file tree
Hide file tree
Showing 110 changed files with 13,258 additions and 2,486 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,54 @@
from __future__ import print_function
def setup(process, global_tag, zero_tesla = False):
import re

def setup(process, global_tag, zero_tesla=False, geometry=""):
"""General setup of an alignment process.
Arguments:
- `process`: cms.Process object
- `global_tag`: global tag to be used
- `zero_tesla`: if 'True' the B-field map for 0T is enforced
- `geometry`: geometry to be used (default is an empty string for the standard geometry)
"""

# MessageLogger for convenient output
# --------------------------------------------------------------------------
process.load('Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.myMessageLogger_cff')

# Load the conditions
# Load the magnetic field configuration
# --------------------------------------------------------------------------
if zero_tesla:
# actually only needed for 0T MC samples, but does not harm for 0T data:
# For 0T MC samples or data
process.load("Configuration.StandardSequences.MagneticField_0T_cff")
else:
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.Geometry.GeometryRecoDB_cff')

# Load the geometry
# --------------------------------------------------------------------------
if geometry == "":
# Default geometry
print(f"Using Geometry from DB")
process.load('Configuration.Geometry.GeometryRecoDB_cff')
else:
# Check if the geometry string matches the format "Extended<X>", e.g. Extended2026D110
if re.match(r"^Extended\w+$", geometry):
# Dynamically load the specified geometry
geometry_module = f"Configuration.Geometry.Geometry{geometry}Reco_cff"
try:
process.load(geometry_module)
print(f"Using Geometry: {geometry_module}")
except Exception as e:
print(f"Error: Unable to load the geometry module '{geometry_module}'.\n{e}")
raise
else:
raise ValueError(f"Invalid geometry format: '{geometry}'. Expected format is 'Extended<X>'.")

# Load the conditions (GlobalTag)
# --------------------------------------------------------------------------
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")

from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, global_tag)
print("Using Global Tag:", process.GlobalTag.globaltag._value)

return process # not required because the cms.Process is modified in place
return process # Not required since the cms.Process object is modified in place
32 changes: 29 additions & 3 deletions Alignment/MillePedeAlignmentAlgorithm/scripts/mps_alisetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def _create_mille_jobs(self):
gt_regex = re.compile('setupGlobaltag\s*\=\s*[\"\'](.*?)[\"\']')
sg_regex = re.compile("setupRunStartGeometry\s*\=\s*.*$", re.M)
collection_regex = re.compile('setupCollection\s*\=\s*[\"\'](.*?)[\"\']')
recogeom_regex = re.compile('setupRecoGeometry\s*\=\s*[\"\'](.*?)[\"\']')
czt_regex = re.compile('setupCosmicsZeroTesla\s*\=\s*.*$', re.M)
cdm_regex = re.compile('setupCosmicsDecoMode\s*\=\s*.*$', re.M)
pw_regex = re.compile('setupPrimaryWidth\s*\=\s*.*$', re.M)
Expand All @@ -275,6 +276,9 @@ def _create_mille_jobs(self):
tmpFile = re.sub(gt_regex,
'setupGlobaltag = \"'+dataset["globaltag"]+'\"',
tmpFile)
tmpFile = re.sub(recogeom_regex,
'setupRecoGeometry = \"'+dataset["recogeometry"]+'\"',
tmpFile)
tmpFile = re.sub(sg_regex,
"setupRunStartGeometry = "+
self._general_options["FirstRunForStartGeometry"], tmpFile)
Expand Down Expand Up @@ -353,6 +357,7 @@ def _create_mille_jobs(self):
print("cosmicsDecoMode: ", dataset["cosmicsDecoMode"])
print("cosmicsZeroTesla: ", dataset["cosmicsZeroTesla"])
print("Globaltag: ", dataset["globaltag"])
print("RecoGeometry: ", dataset["recogeometry"])
print("Number of jobs: ", dataset["njobs"])
print("Inputfilelist: ", dataset["inputFileList"])
if dataset["json"] != "":
Expand Down Expand Up @@ -466,6 +471,9 @@ def _create_additional_pede_jobs(self):
tmpFile = re.sub('setupGlobaltag\s*\=\s*[\"\'](.*?)[\"\']',
'setupGlobaltag = \"'+self._global_tag+'\"',
tmpFile)
tmpFile = re.sub('setupRecoGeometry\s*\=\s*[\"\'](.*?)[\"\']',
'setupRecoGeometry = \"'+self._reco_geometry+'\"',
tmpFile)
tmpFile = re.sub('setupCollection\s*\=\s*[\"\'](.*?)[\"\']',
'setupCollection = \"'+collection+'\"',
tmpFile)
Expand Down Expand Up @@ -651,6 +659,7 @@ def _create_tracker_tree(self):
config = mpsv_iniparser.ConfigData()
config.jobDataPath = "." # current directory
config.globalTag = self._global_tag
#config.recoGeometry = self._reco_geometry
config.firstRun = self._first_run
self._tracker_tree_path = mpsv_trackerTree.check(config)

Expand All @@ -671,7 +680,7 @@ def _fetch_essentials(self):
def _fetch_defaults(self):
"""Fetch default general options from config file."""

for var in ("globaltag", "configTemplate", "json", "massStorageDir",
for var in ("globaltag", "recogeometry", "configTemplate", "json", "massStorageDir",
"testMode"):
try:
self._general_options[var] = self._config.get("general", var)
Expand All @@ -681,7 +690,7 @@ def _fetch_defaults(self):

for dataset in self._external_datasets.values():
dataset["general"] = {}
for var in ("globaltag", "configTemplate", "json"):
for var in ("globaltag", "recogeometry", "configTemplate", "json"):
try:
dataset["general"][var] = dataset["config"].get("general", var)
except (ConfigParser.NoSectionError,ConfigParser.NoOptionError):
Expand Down Expand Up @@ -785,6 +794,23 @@ def _fetch_datasets(self):
print("and no default in [general] section.")
sys.exit(1)

# get recogeometry and configTemplate. If none in section, try to get
# default from [general] section.
for var in ("configTemplate", "recogeometry"):
try:
self._datasets[name][var] = config["config"].get(section, var)
except (ConfigParser.NoSectionError,ConfigParser.NoOptionError):
try:
self._datasets[name][var] = config["general"][var]
except KeyError:
try:
self._datasets[name][var] \
= all_configs["main"]["general"][var]
except KeyError:
print("No",var,"found in ["+section+"]", end=' ')
print("and no default in [general] section.")
sys.exit(1)

# extract non-essential options
if "ALCARECOTkAlCosmics" in self._datasets[name]["collection"]:
try:
Expand Down Expand Up @@ -885,7 +911,7 @@ def _fetch_datasets(self):
sys.exit(1)

self._global_tag = self._datasets[name]["globaltag"]

self._reco_geometry = self._datasets[name]["recogeometry"]

################################################################################
if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pedeMem = 32000
datasetdir = /afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/MP/MPproduction/datasetfiles
configTemplate = universalConfigTemplate.py
globaltag = auto:run2_data
;# empty string defaults to geometry from DB
recogeometry =
;# set this to the run from where you want to start
FirstRunForStartGeometry = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
# process.AlignmentProducer.algoConfig.TrajectoryFactory.ParticleProperties.PrimaryWidth = ...
# if primaryWidth<=0.0 it has no effect at all.


import FWCore.ParameterSet.Config as cms
process = cms.Process("Alignment")

################################################################################
# Variables edited by mps_alisetup.py. Used in functions below.
# You can change them manually as well.
Expand All @@ -46,10 +42,21 @@
setupCollection = "placeholder_collection"
setupCosmicsDecoMode = False
setupCosmicsZeroTesla = False
setupRecoGeometry = "placeholder_recogeometry"
setupPrimaryWidth = -1.0
setupJson = "placeholder_json"
setupRunStartGeometry = -1

import FWCore.ParameterSet.Config as cms
if not setupRecoGeometry: # empty string defaults to DB
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process("Alignment", Run3)
else:
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
# need to remove "Extended from the setupRecoGeometry because of defaultPhase2ConditionsEra interface"
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(setupRecoGeometry.replace("Extended", ""))
process = cms.Process("Alignment",_PH2_ERA)

################################################################################
# Variables edited by MPS (mps_setup and mps_merge). Be careful.
# ------------------------------------------------------------------------------
Expand All @@ -69,7 +76,7 @@
# General setup
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla)
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla, setupRecoGeometry)


################################################################################
Expand Down
3 changes: 2 additions & 1 deletion Alignment/MillePedeAlignmentAlgorithm/test/test_mille.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
setupCosmicsDecoMode = False
setupCosmicsZeroTesla = False
setupPrimaryWidth = -1.0
setupRecoGeometry = "" # empty string defaults to DB
setupJson = ""
setupRunStartGeometry = 362350

Expand Down Expand Up @@ -53,7 +54,7 @@
# General setup
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla)
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla, setupRecoGeometry)

################################################################################
# setup alignment producer
Expand Down
3 changes: 2 additions & 1 deletion Alignment/MillePedeAlignmentAlgorithm/test/test_pede.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
setupCosmicsDecoMode = True
setupCosmicsZeroTesla = False
setupPrimaryWidth = -1.0
setupRecoGeometry = "" # empty string defaults to DB
setupJson = "placeholder_json"
setupRunStartGeometry = 348908

Expand All @@ -35,7 +36,7 @@
# General setup
# ------------------------------------------------------------------------------
import Alignment.MillePedeAlignmentAlgorithm.alignmentsetup.GeneralSetup as generalSetup
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla)
generalSetup.setup(process, setupGlobaltag, setupCosmicsZeroTesla, setupRecoGeometry)

################################################################################
# setup alignment producer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ echo " testing CalibTracker/StandalonTrackerTopology"

cmsRun ${SCRAM_TEST_PATH}/testStandaloneTrackerTopology_cfg.py || die "Failure using cmsRun testPixelTopologyMapTest_cfg.py (Phase-0 test)" $?
cmsRun ${SCRAM_TEST_PATH}/testStandaloneTrackerTopology_cfg.py runNumber=300000 || die "Failure using cmsRun testPixelTopologyMapTest_cfg.py (Phase-1 test)" $?
cmsRun ${SCRAM_TEST_PATH}/testStandaloneTrackerTopology_cfg.py globalTag=auto:phase2_realistic_T21 || die "Failure using cmsRun testPixelTopologyMapTest_cfg.py (Phase-2 test)" $?
cmsRun ${SCRAM_TEST_PATH}/testStandaloneTrackerTopology_cfg.py isPhase2=True || die "Failure using cmsRun testPixelTopologyMapTest_cfg.py (Phase-2 test)" $?
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing

process = cms.Process("TopologyAnalysis")
options = VarParsing.VarParsing("analysis")

options.register ('globalTag',
Expand All @@ -16,8 +15,25 @@
VarParsing.VarParsing.varType.int, # string, int, or float
"run number")

options.register ('isPhase2',
False,
VarParsing.VarParsing.multiplicity.singleton, # singleton or list
VarParsing.VarParsing.varType.bool, # string, int, or float
"is phase2?")

options.parseArguments()

###################################################################
# Set default phase-2 settings
###################################################################
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
_PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)

if(options.isPhase2):
process = cms.Process("TopologyAnalysis",_PH2_ERA)
else:
process = cms.Process("TopologyAnalysis")

###################################################################
# Message logger service
###################################################################
Expand All @@ -29,9 +45,9 @@
###################################################################
process.load("Configuration.StandardSequences.Services_cff")

if 'phase2' in options.globalTag:
process.load("Configuration.Geometry.GeometryExtended2026D98_cff")
process.load("Configuration.Geometry.GeometryExtended2026D98Reco_cff")
if(options.isPhase2):
process.load("Configuration.Geometry.GeometryExtendedRun4Default_cff")
process.load("Configuration.Geometry.GeometryExtendedRun4DefaultReco_cff")
else:
process.load("Configuration.StandardSequences.GeometryRecoDB_cff")

Expand All @@ -40,7 +56,10 @@
####################################################################
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, '')
if(options.isPhase2):
process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '')
else:
process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, '')

###################################################################
# Empty Source
Expand Down
1 change: 0 additions & 1 deletion Calibration/HcalAlCaRecoProducers/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<use name="TrackPropagation/SteppingHelixPropagator"/>
<use name="rootphysics"/>
<use name="boost"/>
<use name="hls"/>
<use name="clhep"/>
<use name="root"/>
<library file="*.cc" name="CalibrationHcalAlCaRecoProducersPlugins">
Expand Down
Loading

0 comments on commit 1a0ab7e

Please sign in to comment.