CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
gather_cfg.py
Go to the documentation of this file.
1 import os
2 import FWCore.ParameterSet.Config as cms
3 
4 inputfiles = os.environ["ALIGNMENT_INPUTFILES"].split(" ")
5 iteration = int(os.environ["ALIGNMENT_ITERATION"])
6 jobnumber = int(os.environ["ALIGNMENT_JOBNUMBER"])
7 mapplots = (os.environ["ALIGNMENT_MAPPLOTS"] == "True")
8 segdiffplots = (os.environ["ALIGNMENT_SEGDIFFPLOTS"] == "True")
9 curvatureplots = (os.environ["ALIGNMENT_CURVATUREPLOTS"] == "True")
10 globaltag = os.environ["ALIGNMENT_GLOBALTAG"]
11 inputdb = os.environ["ALIGNMENT_INPUTDB"]
12 trackerconnect = os.environ["ALIGNMENT_TRACKERCONNECT"]
13 trackeralignment = os.environ["ALIGNMENT_TRACKERALIGNMENT"]
14 trackerAPEconnect = os.environ["ALIGNMENT_TRACKERAPECONNECT"]
15 trackerAPE = os.environ["ALIGNMENT_TRACKERAPE"]
16 gprcdconnect = os.environ["ALIGNMENT_GPRCDCONNECT"]
17 gprcd = os.environ["ALIGNMENT_GPRCD"]
18 iscosmics = (os.environ["ALIGNMENT_ISCOSMICS"] == "True")
19 station123params = os.environ["ALIGNMENT_STATION123PARAMS"]
20 station4params = os.environ["ALIGNMENT_STATION4PARAMS"]
21 cscparams = os.environ["ALIGNMENT_CSCPARAMS"]
22 minTrackPt = float(os.environ["ALIGNMENT_MINTRACKPT"])
23 maxTrackPt = float(os.environ["ALIGNMENT_MAXTRACKPT"])
24 minTrackerHits = int(os.environ["ALIGNMENT_MINTRACKERHITS"])
25 maxTrackerRedChi2 = float(os.environ["ALIGNMENT_MAXTRACKERREDCHI2"])
26 allowTIDTEC = (os.environ["ALIGNMENT_ALLOWTIDTEC"] == "True")
27 twoBin = (os.environ["ALIGNMENT_TWOBIN"] == "True")
28 weightAlignment = (os.environ["ALIGNMENT_WEIGHTALIGNMENT"] == "True")
29 minAlignmentHits = int(os.environ["ALIGNMENT_MINALIGNMENTHITS"])
30 combineME11 = (os.environ["ALIGNMENT_COMBINEME11"] == "True")
31 maxEvents = int(os.environ["ALIGNMENT_MAXEVENTS"])
32 skipEvents = int(os.environ["ALIGNMENT_SKIPEVENTS"])
33 maxResSlopeY = float(os.environ["ALIGNMENT_MAXRESSLOPEY"])
34 
35 process = cms.Process("GATHER")
36 process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(*inputfiles), skipEvents = cms.untracked.uint32(skipEvents))
37 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(maxEvents))
38 
39 process.MessageLogger = cms.Service("MessageLogger",
40  destinations = cms.untracked.vstring("cout"),
41  cout = cms.untracked.PSet(threshold = cms.untracked.string("ERROR")))
42 
43 process.load("Alignment.MuonAlignmentAlgorithms.MuonAlignmentFromReference_cff")
44 process.looper.algoConfig.writeTemporaryFile = "alignment%03d.tmp" % jobnumber
45 process.looper.algoConfig.doAlignment = False
46 
47 process.looper.ParameterBuilder.Selector.alignParams = cms.vstring("MuonDTChambers,%s,stations123" % station123params, "MuonDTChambers,%s,station4" % station4params, "MuonCSCChambers,%s" % cscparams)
48 process.looper.algoConfig.minTrackPt = minTrackPt
49 process.looper.algoConfig.maxTrackPt = maxTrackPt
50 process.looper.algoConfig.minTrackerHits = minTrackerHits
51 process.looper.algoConfig.maxTrackerRedChi2 = maxTrackerRedChi2
52 process.looper.algoConfig.allowTIDTEC = allowTIDTEC
53 process.looper.algoConfig.twoBin = twoBin
54 process.looper.algoConfig.weightAlignment = weightAlignment
55 process.looper.algoConfig.minAlignmentHits = minAlignmentHits
56 process.looper.algoConfig.combineME11 = combineME11
57 process.looper.algoConfig.maxResSlopeY = maxResSlopeY
58 
59 process.looper.monitorConfig = cms.PSet(monitors = cms.untracked.vstring())
60 
61 if mapplots:
62  process.load("Alignment.CommonAlignmentMonitor.AlignmentMonitorMuonSystemMap1D_cfi")
63  process.looper.monitorConfig.monitors.append("AlignmentMonitorMuonSystemMap1D")
64  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D = process.AlignmentMonitorMuonSystemMap1D
65  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minTrackPt = cms.double(minTrackPt)
66  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.maxTrackPt = cms.double(maxTrackPt)
67  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minTrackerHits = cms.int32(minTrackerHits)
68  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.maxTrackerRedChi2 = cms.double(maxTrackerRedChi2)
69  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.allowTIDTEC = cms.bool(allowTIDTEC)
70  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minDT13Hits = process.looper.algoConfig.minDT13Hits
71  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minDT2Hits = process.looper.algoConfig.minDT2Hits
72  process.looper.monitorConfig.AlignmentMonitorMuonSystemMap1D.minCSCHits = process.looper.algoConfig.minCSCHits
73 
74 if segdiffplots:
75  process.load("Alignment.CommonAlignmentMonitor.AlignmentMonitorSegmentDifferences_cfi")
76  process.looper.monitorConfig.monitors.append("AlignmentMonitorSegmentDifferences")
77  process.looper.monitorConfig.AlignmentMonitorSegmentDifferences = process.AlignmentMonitorSegmentDifferences
78  # this should be set separately (50 GeV nominal)
79  # process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minTrackPt = cms.double(minTrackPt)
80  process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minTrackerHits = cms.int32(minTrackerHits)
81  process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.maxTrackerRedChi2 = cms.double(maxTrackerRedChi2)
82  process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.allowTIDTEC = cms.bool(allowTIDTEC)
83  process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minDT13Hits = process.looper.algoConfig.minDT13Hits
84  process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minDT2Hits = process.looper.algoConfig.minDT2Hits
85  process.looper.monitorConfig.AlignmentMonitorSegmentDifferences.minCSCHits = process.looper.algoConfig.minCSCHits
86 
87 if curvatureplots:
88  process.load("Alignment.CommonAlignmentMonitor.AlignmentMonitorMuonVsCurvature_cfi")
89  process.looper.monitorConfig.monitors.append("AlignmentMonitorMuonVsCurvature")
90  process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature = process.AlignmentMonitorMuonVsCurvature
91  process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.minTrackerHits = cms.int32(minTrackerHits)
92  process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.maxTrackerRedChi2 = cms.double(maxTrackerRedChi2)
93  process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.allowTIDTEC = cms.bool(allowTIDTEC)
94  process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.minDT13Hits = process.looper.algoConfig.minDT13Hits
95  process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.minDT2Hits = process.looper.algoConfig.minDT2Hits
96  process.looper.monitorConfig.AlignmentMonitorMuonVsCurvature.minCSCHits = process.looper.algoConfig.minCSCHits
97 
98 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
99 process.GlobalTag.globaltag = cms.string(globaltag)
100 process.looper.applyDbAlignment = True
101 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")
102 
103 if iscosmics:
104  process.Path = cms.Path(process.offlineBeamSpot * process.MuonAlignmentFromReferenceGlobalCosmicRefit)
105  process.looper.tjTkAssociationMapTag = cms.InputTag("MuonAlignmentFromReferenceGlobalCosmicRefit:Refitted")
106 else:
107  process.Path = cms.Path(process.offlineBeamSpot * process.MuonAlignmentFromReferenceGlobalMuonRefit)
108  process.looper.tjTkAssociationMapTag = cms.InputTag("MuonAlignmentFromReferenceGlobalMuonRefit:Refitted")
109 
110 process.MuonAlignmentFromReferenceInputDB.connect = cms.string("sqlite_file:%s" % inputdb)
111 process.MuonAlignmentFromReferenceInputDB.toGet = cms.VPSet(cms.PSet(record = cms.string("DTAlignmentRcd"), tag = cms.string("DTAlignmentRcd")),
112  cms.PSet(record = cms.string("CSCAlignmentRcd"), tag = cms.string("CSCAlignmentRcd")))
113 
114 if trackerconnect != "":
116  process.TrackerAlignmentInputDB = cms.ESSource("PoolDBESSource",
117  CondDBSetup,
118  connect = cms.string(trackerconnect),
119  toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"), tag = cms.string(trackeralignment))))
120  process.es_prefer_TrackerAlignmentInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentInputDB")
121 
122 if trackerAPEconnect != "":
124  process.TrackerAlignmentErrorInputDB = cms.ESSource("PoolDBESSource",
125  CondDBSetup,
126  connect = cms.string(trackerAPEconnect),
127  toGet = cms.VPSet(cms.PSet(cms.PSet(record = cms.string("TrackerAlignmentErrorRcd"), tag = cms.string(trackerAPE)))))
128  process.es_prefer_TrackerAlignmentErrorInputDB = cms.ESPrefer("PoolDBESSource", "TrackerAlignmentErrorInputDB")
129 
130 if gprcdconnect != "":
132  process.GlobalPositionInputDB = cms.ESSource("PoolDBESSource",
133  CondDBSetup,
134  connect = cms.string(gprcdconnect),
135  toGet = cms.VPSet(cms.PSet(record = cms.string("GlobalPositionRcd"), tag = cms.string(gprcd))))
136  process.es_prefer_GlobalPositionInputDB = cms.ESPrefer("PoolDBESSource", "GlobalPositionInputDB")
137 
138 process.looper.saveToDB = False
139 process.looper.saveApeToDB = False
140 del process.PoolDBOutputService
141 
142 process.TFileService = cms.Service("TFileService", fileName = cms.string("plotting%03d.root" % jobnumber))
double split
Definition: MVATrainer.cc:139