Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:45

0001 import os
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 alignmenttmp = os.environ["ALIGNMENT_ALIGNMENTTMP"].split("\n")
0005 iteration = int(os.environ["ALIGNMENT_ITERATION"])
0006 
0007 globaltag = os.environ["ALIGNMENT_GLOBALTAG"]
0008 inputdb = os.environ["ALIGNMENT_INPUTDB"]
0009 trackerconnect = os.environ["ALIGNMENT_TRACKERCONNECT"]
0010 trackeralignment = os.environ["ALIGNMENT_TRACKERALIGNMENT"]
0011 trackerAPEconnect = os.environ["ALIGNMENT_TRACKERAPECONNECT"]
0012 trackerAPE = os.environ["ALIGNMENT_TRACKERAPE"]
0013 trackerBowsconnect = os.environ["ALIGNMENT_TRACKERBOWSCONNECT"]
0014 trackerBows = os.environ["ALIGNMENT_TRACKERBOWS"]
0015 gprcdconnect = os.environ["ALIGNMENT_GPRCDCONNECT"]
0016 gprcd = os.environ["ALIGNMENT_GPRCD"]
0017 
0018 iscosmics = (os.environ["ALIGNMENT_ISCOSMICS"] == "True")
0019 station123params = os.environ["ALIGNMENT_STATION123PARAMS"]
0020 station4params = os.environ["ALIGNMENT_STATION4PARAMS"]
0021 cscparams = os.environ["ALIGNMENT_CSCPARAMS"]
0022 minTrackPt = float(os.environ["ALIGNMENT_MINTRACKPT"])
0023 maxTrackPt = float(os.environ["ALIGNMENT_MAXTRACKPT"])
0024 minTrackP = float(os.environ["ALIGNMENT_MINTRACKP"])
0025 maxTrackP = float(os.environ["ALIGNMENT_MAXTRACKP"])
0026 minTrackerHits = int(os.environ["ALIGNMENT_MINTRACKERHITS"])
0027 maxTrackerRedChi2 = float(os.environ["ALIGNMENT_MAXTRACKERREDCHI2"])
0028 allowTIDTEC = (os.environ["ALIGNMENT_ALLOWTIDTEC"] == "True")
0029 twoBin = (os.environ["ALIGNMENT_TWOBIN"] == "True")
0030 weightAlignment = (os.environ["ALIGNMENT_WEIGHTALIGNMENT"] == "True")
0031 minAlignmentHits = int(os.environ["ALIGNMENT_MINALIGNMENTHITS"])
0032 combineME11 = (os.environ["ALIGNMENT_COMBINEME11"] == "True")
0033 maxResSlopeY = float(os.environ["ALIGNMENT_MAXRESSLOPEY"])
0034 residualsModel = os.environ["ALIGNMENT_RESIDUALSMODEL"]
0035 peakNSigma = float(os.environ["ALIGNMENT_PEAKNSIGMA"])
0036 useResiduals = os.environ["ALIGNMENT_USERESIDUALS"]
0037 
0038 # optionally do selective DT or CSC alignment
0039 doDT = True
0040 doCSC = True
0041 envDT = os.getenv("ALIGNMENT_DO_DT")
0042 envCSC = os.getenv("ALIGNMENT_DO_CSC")
0043 if envDT is not None and envCSC is not None:
0044   if envDT=='True' and envCSC=='False':
0045     doDT = True
0046     doCSC = False
0047   if envDT=='False' and envCSC=='True':
0048     doDT = False
0049     doCSC = True
0050 
0051 # optionally: create ntuples along with tmp files
0052 createAlignNtuple = False
0053 envNtuple = os.getenv("ALIGNMENT_CREATEALIGNNTUPLE")
0054 if envNtuple is not None:
0055   if envNtuple=='True': createAlignNtuple = True
0056 
0057 
0058 process = cms.Process("ALIGN")
0059 process.source = cms.Source("EmptySource")
0060 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
0061 
0062 process.load("Configuration.StandardSequences.Reconstruction_cff")
0063 
0064 process.MuonNumberingInitialization = cms.ESProducer("MuonNumberingInitialization")
0065 process.MuonNumberingRecord = cms.ESSource( "EmptyESSource",
0066     recordName = cms.string( "MuonNumberingRecord" ),
0067     iovIsRunNotTime = cms.bool( True ),
0068     firstValid = cms.vuint32( 1 )
0069 )
0070 
0071 process.load("Configuration.Geometry.GeometryIdeal_cff")
0072 process.load("Configuration.StandardSequences.MagneticField_cff")
0073 
0074 process.load("Alignment.MuonAlignmentAlgorithms.MuonAlignmentFromReference_cff")
0075 process.looper.algoConfig.readTemporaryFiles = cms.vstring(*alignmenttmp)
0076 process.looper.algoConfig.reportFileName = cms.string("MuonAlignmentFromReference_report.py")
0077 
0078 process.looper.ParameterBuilder.Selector.alignParams = cms.vstring("MuonDTChambers,%s,stations123" % station123params, "MuonDTChambers,%s,station4" % station4params, "MuonCSCChambers,%s" % cscparams)
0079 process.looper.algoConfig.minTrackPt = minTrackPt
0080 process.looper.algoConfig.maxTrackPt = maxTrackPt
0081 process.looper.algoConfig.minTrackP = minTrackP
0082 process.looper.algoConfig.maxTrackP = maxTrackP
0083 process.looper.algoConfig.minTrackerHits = minTrackerHits
0084 process.looper.algoConfig.maxTrackerRedChi2 = maxTrackerRedChi2
0085 process.looper.algoConfig.allowTIDTEC = allowTIDTEC
0086 process.looper.algoConfig.twoBin = twoBin
0087 process.looper.algoConfig.weightAlignment = weightAlignment
0088 process.looper.algoConfig.minAlignmentHits = minAlignmentHits
0089 process.looper.algoConfig.combineME11 = combineME11
0090 process.looper.algoConfig.maxResSlopeY = maxResSlopeY
0091 process.looper.algoConfig.residualsModel = cms.string(residualsModel)
0092 process.looper.algoConfig.peakNSigma = peakNSigma
0093 process.looper.algoConfig.createNtuple = createAlignNtuple
0094 process.looper.algoConfig.doDT = doDT
0095 process.looper.algoConfig.doCSC = doCSC
0096 process.looper.algoConfig.useResiduals = cms.string(useResiduals)
0097 
0098 
0099 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0100 process.GlobalTag.globaltag = cms.string(globaltag)
0101 process.looper.applyDbAlignment = True
0102 
0103 process.MuonAlignmentFromReferenceInputDB.connect = cms.string("sqlite_file:%s" % inputdb)
0104 process.MuonAlignmentFromReferenceInputDB.toGet = cms.VPSet(cms.PSet(record = cms.string("DTAlignmentRcd"), tag = cms.string("DTAlignmentRcd")),
0105                                                             cms.PSet(record = cms.string("CSCAlignmentRcd"), tag = cms.string("CSCAlignmentRcd")))
0106 
0107 if trackerconnect != "":
0108     from CondCore.DBCommon.CondDBSetup_cfi import *
0109     process.TrackerAlignmentInputDB = cms.ESSource("PoolDBESSource",
0110                                                    CondDBSetup,
0111                                                    connect = cms.string(trackerconnect),
0112                                                    toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"), tag = cms.string(trackeralignment))))
0113     process.es_prefer_TrackerAlignmentInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentInputDB")
0114 
0115 if trackerAPEconnect != "":
0116     from CondCore.DBCommon.CondDBSetup_cfi import *
0117     process.TrackerAlignmentErrorInputDB = cms.ESSource("PoolDBESSource",
0118                                                    CondDBSetup,
0119                                                    connect = cms.string(trackerAPEconnect),
0120                                                    toGet = cms.VPSet(cms.PSet(cms.PSet(record = cms.string("TrackerAlignmentErrorExtendedRcd"), tag = cms.string(trackerAPE)))))
0121     process.es_prefer_TrackerAlignmentErrorInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentErrorInputDB")
0122 
0123 if trackerBowsconnect != "":
0124     from CondCore.DBCommon.CondDBSetup_cfi import *
0125     process.TrackerSurfaceDeformationInputDB = cms.ESSource("PoolDBESSource",
0126                                                    CondDBSetup,
0127                                                    connect = cms.string(trackerBowsconnect),
0128                                                    toGet = cms.VPSet(cms.PSet(cms.PSet(record = cms.string("TrackerSurfaceDeformationRcd"), tag = cms.string(trackerBows)))))
0129     process.es_prefer_TrackerSurfaceDeformationInputDB = cms.ESPrefer("PoolDBESSource", "TrackerSurfaceDeformationInputDB")
0130 
0131 if gprcdconnect != "":
0132     from CondCore.DBCommon.CondDBSetup_cfi import *
0133     process.GlobalPositionInputDB = cms.ESSource("PoolDBESSource",
0134                                                    CondDBSetup,
0135                                                    connect = cms.string(gprcdconnect),
0136                                                    toGet = cms.VPSet(cms.PSet(record = cms.string("GlobalPositionRcd"), tag = cms.string(gprcd))))
0137     process.es_prefer_GlobalPositionInputDB = cms.ESPrefer("PoolDBESSource", "GlobalPositionInputDB")
0138 
0139 process.looper.saveToDB = True
0140 process.looper.saveApeToDB = True
0141 process.PoolDBOutputService.connect = cms.string("sqlite_file:MuonAlignmentFromReference_outputdb.db")
0142 
0143 process.TFileService = cms.Service("TFileService", fileName = cms.string("MuonAlignmentFromReference_plotting.root"))