CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Alignment/MuonAlignmentAlgorithms/python/align_cfg.py

Go to the documentation of this file.
00001 import os
00002 import FWCore.ParameterSet.Config as cms
00003 
00004 alignmenttmp = os.environ["ALIGNMENT_ALIGNMENTTMP"].split("\n")
00005 iteration = int(os.environ["ALIGNMENT_ITERATION"])
00006 
00007 globaltag = os.environ["ALIGNMENT_GLOBALTAG"]
00008 inputdb = os.environ["ALIGNMENT_INPUTDB"]
00009 trackerconnect = os.environ["ALIGNMENT_TRACKERCONNECT"]
00010 trackeralignment = os.environ["ALIGNMENT_TRACKERALIGNMENT"]
00011 trackerAPEconnect = os.environ["ALIGNMENT_TRACKERAPECONNECT"]
00012 trackerAPE = os.environ["ALIGNMENT_TRACKERAPE"]
00013 trackerBowsconnect = os.environ["ALIGNMENT_TRACKERBOWSCONNECT"]
00014 trackerBows = os.environ["ALIGNMENT_TRACKERBOWS"]
00015 gprcdconnect = os.environ["ALIGNMENT_GPRCDCONNECT"]
00016 gprcd = os.environ["ALIGNMENT_GPRCD"]
00017 
00018 iscosmics = (os.environ["ALIGNMENT_ISCOSMICS"] == "True")
00019 station123params = os.environ["ALIGNMENT_STATION123PARAMS"]
00020 station4params = os.environ["ALIGNMENT_STATION4PARAMS"]
00021 cscparams = os.environ["ALIGNMENT_CSCPARAMS"]
00022 minTrackPt = float(os.environ["ALIGNMENT_MINTRACKPT"])
00023 maxTrackPt = float(os.environ["ALIGNMENT_MAXTRACKPT"])
00024 minTrackP = float(os.environ["ALIGNMENT_MINTRACKP"])
00025 maxTrackP = float(os.environ["ALIGNMENT_MAXTRACKP"])
00026 minTrackerHits = int(os.environ["ALIGNMENT_MINTRACKERHITS"])
00027 maxTrackerRedChi2 = float(os.environ["ALIGNMENT_MAXTRACKERREDCHI2"])
00028 allowTIDTEC = (os.environ["ALIGNMENT_ALLOWTIDTEC"] == "True")
00029 twoBin = (os.environ["ALIGNMENT_TWOBIN"] == "True")
00030 weightAlignment = (os.environ["ALIGNMENT_WEIGHTALIGNMENT"] == "True")
00031 minAlignmentHits = int(os.environ["ALIGNMENT_MINALIGNMENTHITS"])
00032 combineME11 = (os.environ["ALIGNMENT_COMBINEME11"] == "True")
00033 maxResSlopeY = float(os.environ["ALIGNMENT_MAXRESSLOPEY"])
00034 residualsModel = os.environ["ALIGNMENT_RESIDUALSMODEL"]
00035 peakNSigma = float(os.environ["ALIGNMENT_PEAKNSIGMA"])
00036 useResiduals = os.environ["ALIGNMENT_USERESIDUALS"]
00037 
00038 # optionally do selective DT or CSC Alignment
00039 doDT = True
00040 doCSC = True
00041 envDT = os.getenv("ALIGNMENT_DO_DT")
00042 envCSC = os.getenv("ALIGNMENT_DO_CSC")
00043 if envDT is not None and envCSC is not None:
00044   if envDT=='True' and envCSC=='False':
00045     doDT = True
00046     doCSC = False
00047   if envDT=='False' and envCSC=='True':
00048     doDT = False
00049     doCSC = True
00050 
00051 # optionally: create ntuples along with tmp files
00052 createAlignNtuple = False
00053 envNtuple = os.getenv("ALIGNMENT_CREATEALIGNNTUPLE")
00054 if envNtuple is not None:
00055   if envNtuple=='True': createAlignNtuple = True
00056 
00057 
00058 process = cms.Process("ALIGN")
00059 process.source = cms.Source("EmptySource")
00060 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
00061 
00062 process.load("Alignment.MuonAlignmentAlgorithms.MuonAlignmentFromReference_cff")
00063 process.looper.algoConfig.readTemporaryFiles = cms.vstring(*alignmenttmp)
00064 process.looper.algoConfig.reportFileName = cms.string("MuonAlignmentFromReference_report.py")
00065 
00066 process.looper.ParameterBuilder.Selector.alignParams = cms.vstring("MuonDTChambers,%s,stations123" % station123params, "MuonDTChambers,%s,station4" % station4params, "MuonCSCChambers,%s" % cscparams)
00067 process.looper.algoConfig.minTrackPt = minTrackPt
00068 process.looper.algoConfig.maxTrackPt = maxTrackPt
00069 process.looper.algoConfig.minTrackP = minTrackP
00070 process.looper.algoConfig.maxTrackP = maxTrackP
00071 process.looper.algoConfig.minTrackerHits = minTrackerHits
00072 process.looper.algoConfig.maxTrackerRedChi2 = maxTrackerRedChi2
00073 process.looper.algoConfig.allowTIDTEC = allowTIDTEC
00074 process.looper.algoConfig.twoBin = twoBin
00075 process.looper.algoConfig.weightAlignment = weightAlignment
00076 process.looper.algoConfig.minAlignmentHits = minAlignmentHits
00077 process.looper.algoConfig.combineME11 = combineME11
00078 process.looper.algoConfig.maxResSlopeY = maxResSlopeY
00079 process.looper.algoConfig.residualsModel = cms.string(residualsModel)
00080 process.looper.algoConfig.peakNSigma = peakNSigma
00081 process.looper.algoConfig.createNtuple = createAlignNtuple
00082 process.looper.algoConfig.doDT = doDT
00083 process.looper.algoConfig.doCSC = doCSC
00084 process.looper.algoConfig.useResiduals = cms.string(useResiduals)
00085 
00086 
00087 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00088 process.GlobalTag.globaltag = cms.string(globaltag)
00089 process.looper.applyDbAlignment = True
00090 
00091 process.MuonAlignmentFromReferenceInputDB.connect = cms.string("sqlite_file:%s" % inputdb)
00092 process.MuonAlignmentFromReferenceInputDB.toGet = cms.VPSet(cms.PSet(record = cms.string("DTAlignmentRcd"), tag = cms.string("DTAlignmentRcd")),
00093                                                             cms.PSet(record = cms.string("CSCAlignmentRcd"), tag = cms.string("CSCAlignmentRcd")))
00094 
00095 if trackerconnect != "":
00096     from CondCore.DBCommon.CondDBSetup_cfi import *
00097     process.TrackerAlignmentInputDB = cms.ESSource("PoolDBESSource",
00098                                                    CondDBSetup,
00099                                                    connect = cms.string(trackerconnect),
00100                                                    toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"), tag = cms.string(trackeralignment))))
00101     process.es_prefer_TrackerAlignmentInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentInputDB")
00102 
00103 if trackerAPEconnect != "":
00104     from CondCore.DBCommon.CondDBSetup_cfi import *
00105     process.TrackerAlignmentErrorInputDB = cms.ESSource("PoolDBESSource",
00106                                                    CondDBSetup,
00107                                                    connect = cms.string(trackerAPEconnect),
00108                                                    toGet = cms.VPSet(cms.PSet(cms.PSet(record = cms.string("TrackerAlignmentErrorRcd"), tag = cms.string(trackerAPE)))))
00109     process.es_prefer_TrackerAlignmentErrorInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentErrorInputDB")
00110 
00111 if trackerBowsconnect != "":
00112     from CondCore.DBCommon.CondDBSetup_cfi import *
00113     process.TrackerSurfaceDeformationInputDB = cms.ESSource("PoolDBESSource",
00114                                                    CondDBSetup,
00115                                                    connect = cms.string(trackerBowsconnect),
00116                                                    toGet = cms.VPSet(cms.PSet(cms.PSet(record = cms.string("TrackerSurfaceDeformationRcd"), tag = cms.string(trackerBows)))))
00117     process.es_prefer_TrackerSurfaceDeformationInputDB = cms.ESPrefer("PoolDBESSource", "TrackerSurfaceDeformationInputDB")
00118 
00119 if gprcdconnect != "":
00120     from CondCore.DBCommon.CondDBSetup_cfi import *
00121     process.GlobalPositionInputDB = cms.ESSource("PoolDBESSource",
00122                                                    CondDBSetup,
00123                                                    connect = cms.string(gprcdconnect),
00124                                                    toGet = cms.VPSet(cms.PSet(record = cms.string("GlobalPositionRcd"), tag = cms.string(gprcd))))
00125     process.es_prefer_GlobalPositionInputDB = cms.ESPrefer("PoolDBESSource", "GlobalPositionInputDB")
00126 
00127 process.looper.saveToDB = True
00128 process.looper.saveApeToDB = True
00129 process.PoolDBOutputService.connect = cms.string("sqlite_file:MuonAlignmentFromReference_outputdb.db")
00130 
00131 process.TFileService = cms.Service("TFileService", fileName = cms.string("MuonAlignmentFromReference_plotting.root"))