Go to the documentation of this file.00001 import os
00002 import FWCore.ParameterSet.Config as cms
00003
00004 inputfiles = os.environ["ALIGNMENT_INPUTFILES"].split(" ")
00005 iteration = int(os.environ["ALIGNMENT_ITERATION"])
00006 jobnumber = int(os.environ["ALIGNMENT_JOBNUMBER"])
00007 mapplots = (os.environ["ALIGNMENT_MAPPLOTS"] == "True")
00008 segdiffplots = (os.environ["ALIGNMENT_SEGDIFFPLOTS"] == "True")
00009 curvatureplots = (os.environ["ALIGNMENT_CURVATUREPLOTS"] == "True")
00010 globaltag = os.environ["ALIGNMENT_GLOBALTAG"]
00011 inputdb = os.environ["ALIGNMENT_INPUTDB"]
00012 trackerconnect = os.environ["ALIGNMENT_TRACKERCONNECT"]
00013 trackeralignment = os.environ["ALIGNMENT_TRACKERALIGNMENT"]
00014 trackerAPEconnect = os.environ["ALIGNMENT_TRACKERAPECONNECT"]
00015 trackerAPE = os.environ["ALIGNMENT_TRACKERAPE"]
00016 gprcdconnect = os.environ["ALIGNMENT_GPRCDCONNECT"]
00017 gprcd = os.environ["ALIGNMENT_GPRCD"]
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 minTrackerHits = int(os.environ["ALIGNMENT_MINTRACKERHITS"])
00025 maxTrackerRedChi2 = float(os.environ["ALIGNMENT_MAXTRACKERREDCHI2"])
00026 allowTIDTEC = (os.environ["ALIGNMENT_ALLOWTIDTEC"] == "True")
00027 twoBin = (os.environ["ALIGNMENT_TWOBIN"] == "True")
00028 weightAlignment = (os.environ["ALIGNMENT_WEIGHTALIGNMENT"] == "True")
00029 minAlignmentHits = int(os.environ["ALIGNMENT_MINALIGNMENTHITS"])
00030 combineME11 = (os.environ["ALIGNMENT_COMBINEME11"] == "True")
00031 maxEvents = int(os.environ["ALIGNMENT_MAXEVENTS"])
00032 skipEvents = int(os.environ["ALIGNMENT_SKIPEVENTS"])
00033 maxResSlopeY = float(os.environ["ALIGNMENT_MAXRESSLOPEY"])
00034
00035 process = cms.Process("GATHER")
00036 process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(*inputfiles), skipEvents = cms.untracked.uint32(skipEvents))
00037 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(maxEvents))
00038
00039 process.MessageLogger = cms.Service("MessageLogger",
00040 destinations = cms.untracked.vstring("cout"),
00041 cout = cms.untracked.PSet(threshold = cms.untracked.string("ERROR")))
00042
00043 process.load("Alignment.MuonAlignmentAlgorithms.MuonAlignmentFromReference_cff")
00044 process.looper.algoConfig.writeTemporaryFile = "Alignment%03d.tmp" % jobnumber
00045 process.looper.algoConfig.doAlignment = False
00046
00047 process.looper.ParameterBuilder.Selector.alignParams = cms.vstring("MuonDTChambers,%s,stations123" % station123params, "MuonDTChambers,%s,station4" % station4params, "MuonCSCChambers,%s" % cscparams)
00048 process.looper.algoConfig.minTrackPt = minTrackPt
00049 process.looper.algoConfig.maxTrackPt = maxTrackPt
00050 process.looper.algoConfig.minTrackerHits = minTrackerHits
00051 process.looper.algoConfig.maxTrackerRedChi2 = maxTrackerRedChi2
00052 process.looper.algoConfig.allowTIDTEC = allowTIDTEC
00053 process.looper.algoConfig.twoBin = twoBin
00054 process.looper.algoConfig.weightAlignment = weightAlignment
00055 process.looper.algoConfig.minAlignmentHits = minAlignmentHits
00056 process.looper.algoConfig.combineME11 = combineME11
00057 process.looper.algoConfig.maxResSlopeY = maxResSlopeY
00058
00059 process.looper.monitorConfig = cms.PSet(monitors = cms.untracked.vstring())
00060
00061 if mapplots:
00062 process.load("Alignment.CommonAlignmentMonitor.AlignmentMonitorMuonSystemMap1D_cfi")
00063 process.looper.monitorConfig.monitors.append("AlignmentMonitorMuonSystemMap1D")
00064 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D = process.AlignmentMonitorMuonSystemMap1D
00065 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minTrackPt = cms.double(minTrackPt)
00066 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.maxTrackPt = cms.double(maxTrackPt)
00067 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minTrackerHits = cms.int32(minTrackerHits)
00068 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.maxTrackerRedChi2 = cms.double(maxTrackerRedChi2)
00069 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.allowTIDTEC = cms.bool(allowTIDTEC)
00070 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minDT13Hits = process.looper.algoConfig.minDT13Hits
00071 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minDT2Hits = process.looper.algoConfig.minDT2Hits
00072 process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minCSCHits = process.looper.algoConfig.minCSCHits
00073
00074 if segdiffplots:
00075 process.load("Alignment.CommonAlignmentMonitor.AlignmentMonitorSegmentDifferences_cfi")
00076 process.looper.monitorConfig.monitors.append("AlignmentMonitorSegmentDifferences")
00077 process.looper.monitorConfig.AlignmentMonitorSegmentDifferences = process.AlignmentMonitorSegmentDifferences
00078
00079
00080 process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minTrackerHits = cms.int32(minTrackerHits)
00081 process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.maxTrackerRedChi2 = cms.double(maxTrackerRedChi2)
00082 process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.allowTIDTEC = cms.bool(allowTIDTEC)
00083 process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minDT13Hits = process.looper.algoConfig.minDT13Hits
00084 process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minDT2Hits = process.looper.algoConfig.minDT2Hits
00085 process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minCSCHits = process.looper.algoConfig.minCSCHits
00086
00087 if curvatureplots:
00088 process.load("Alignment.CommonAlignmentMonitor.AlignmentMonitorMuonVsCurvature_cfi")
00089 process.looper.monitorConfig.monitors.append("AlignmentMonitorMuonVsCurvature")
00090 process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature = process.AlignmentMonitorMuonVsCurvature
00091 process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.minTrackerHits = cms.int32(minTrackerHits)
00092 process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.maxTrackerRedChi2 = cms.double(maxTrackerRedChi2)
00093 process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.allowTIDTEC = cms.bool(allowTIDTEC)
00094 process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.minDT13Hits = process.looper.algoConfig.minDT13Hits
00095 process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.minDT2Hits = process.looper.algoConfig.minDT2Hits
00096 process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.minCSCHits = process.looper.algoConfig.minCSCHits
00097
00098 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00099 process.GlobalTag.globaltag = cms.string(globaltag)
00100 process.looper.applyDbAlignment = True
00101 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")
00102
00103 if iscosmics:
00104 process.Path = cms.Path(process.offlineBeamSpot * process.MuonAlignmentFromReferenceGlobalCosmicRefit)
00105 process.looper.tjTkAssociationMapTag = cms.InputTag("MuonAlignmentFromReferenceGlobalCosmicRefit:Refitted")
00106 else:
00107 process.Path = cms.Path(process.offlineBeamSpot * process.MuonAlignmentFromReferenceGlobalMuonRefit)
00108 process.looper.tjTkAssociationMapTag = cms.InputTag("MuonAlignmentFromReferenceGlobalMuonRefit:Refitted")
00109
00110 process.MuonAlignmentFromReferenceInputDB.connect = cms.string("sqlite_file:%s" % inputdb)
00111 process.MuonAlignmentFromReferenceInputDB.toGet = cms.VPSet(cms.PSet(record = cms.string("DTAlignmentRcd"), tag = cms.string("DTAlignmentRcd")),
00112 cms.PSet(record = cms.string("CSCAlignmentRcd"), tag = cms.string("CSCAlignmentRcd")))
00113
00114 if trackerconnect != "":
00115 from CondCore.DBCommon.CondDBSetup_cfi import *
00116 process.TrackerAlignmentInputDB = cms.ESSource("PoolDBESSource",
00117 CondDBSetup,
00118 connect = cms.string(trackerconnect),
00119 toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"), tag = cms.string(trackeralignment))))
00120 process.es_prefer_TrackerAlignmentInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentInputDB")
00121
00122 if trackerAPEconnect != "":
00123 from CondCore.DBCommon.CondDBSetup_cfi import *
00124 process.TrackerAlignmentErrorInputDB = cms.ESSource("PoolDBESSource",
00125 CondDBSetup,
00126 connect = cms.string(trackerAPEconnect),
00127 toGet = cms.VPSet(cms.PSet(cms.PSet(record = cms.string("TrackerAlignmentErrorRcd"), tag = cms.string(trackerAPE)))))
00128 process.es_prefer_TrackerAlignmentErrorInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentErrorInputDB")
00129
00130 if gprcdconnect != "":
00131 from CondCore.DBCommon.CondDBSetup_cfi import *
00132 process.GlobalPositionInputDB = cms.ESSource("PoolDBESSource",
00133 CondDBSetup,
00134 connect = cms.string(gprcdconnect),
00135 toGet = cms.VPSet(cms.PSet(record = cms.string("GlobalPositionRcd"), tag = cms.string(gprcd))))
00136 process.es_prefer_GlobalPositionInputDB = cms.ESPrefer("PoolDBESSource", "GlobalPositionInputDB")
00137
00138 process.looper.saveToDB = False
00139 process.looper.saveApeToDB = False
00140 del process.PoolDBOutputService
00141
00142 process.TFileService = cms.Service("TFileService", fileName = cms.string("plotting%03d.root" % jobnumber))