1 import FWCore.ParameterSet.Config
as cms
2 import FWCore.PythonUtilities.LumiList
as LumiList
3 from Alignment.OfflineValidation.TkAlAllInOneTool.defaultInputFiles_cff
import filesDefaultMC_NoPU
5 from FWCore.ParameterSet.VarParsing
import VarParsing
11 process = cms.Process(
"OfflineValidator")
15 options.register(
"config",
"", VarParsing.multiplicity.singleton, VarParsing.varType.string ,
"AllInOne config")
17 options.parseArguments()
20 if options.config ==
"":
21 config = {
"validation": {},
24 with open(options.config,
"r") as configFile: 25 config = json.load(configFile) 32 if "dataset" in config[
"validation"]:
33 with open(config[
"validation"][
"dataset"],
"r") as datafiles: 34 for fileName
in datafiles.readlines():
35 readFiles.append(fileName.replace(
"\n",
""))
38 process.source = cms.Source(
"PoolSource",
39 fileNames = cms.untracked.vstring(readFiles),
40 skipEvents = cms.untracked.uint32(0)
43 print(
">>>>>>>>>> DMR_cfg.py: msg%-i: config not specified! Loading default MC simulation -> filesDefaultMC_NoPU!")
44 process.source = cms.Source(
"PoolSource",
45 fileNames = filesDefaultMC_NoPU,
46 skipEvents = cms.untracked.uint32(0)
50 if "goodlumi" in config[
"validation"]:
51 if os.path.isfile(config[
"validation"][
"goodlumi"]):
52 goodLumiSecs = cms.untracked.VLuminosityBlockRange(
LumiList.LumiList(filename = config[
"validation"][
"goodlumi"]).getCMSSWString().
split(
','))
55 print(
"Does not exist: {}. Continue without good lumi section file.")
56 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
59 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
61 process.source.lumisToProcess = goodLumiSecs
64 process.maxEvents = cms.untracked.PSet(
65 input = cms.untracked.int32(config[
"validation"].get(
"maxevents", 1))
69 process.options = cms.untracked.PSet(
70 wantSummary = cms.untracked.bool(
False),
71 Rethrow = cms.untracked.vstring(
"ProductNotFound"),
72 fileMode = cms.untracked.string(
'NOMERGE'),
75 process.load(
"FWCore.MessageLogger.MessageLogger_cfi")
76 process.MessageLogger = cms.Service(
"MessageLogger",
77 destinations = cms.untracked.vstring(
'cerr'),
78 cerr = cms.untracked.PSet(
79 threshold = cms.untracked.string(
'ERROR')
85 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
86 process.load(
"Configuration.Geometry.GeometryDB_cff")
87 process.load(
'Configuration.StandardSequences.Services_cff')
88 process.load(
"Configuration.StandardSequences.MagneticField_cff")
91 import Alignment.CommonAlignment.tools.trackselectionRefitting
as trackselRefit
92 process.seqTrackselRefit = trackselRefit.getSequence(process,
93 config[
"validation"].get(
"trackcollection",
"generalTracks"),
94 isPVValidation =
False,
95 TTRHBuilder = config[
"validation"].get(
"tthrbuilder",
"WithAngleAndTemplate"),
96 usePixelQualityFlag=config[
"validation"].get(
"usePixelQualityFlag",
True),
97 openMassWindow =
False,
98 cosmicsDecoMode =
True,
99 cosmicsZeroTesla=config[
"validation"].get(
"cosmicsZeroTesla",
False),
100 momentumConstraint =
None,
101 cosmicTrackSplitting =
False,
106 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
107 from Configuration.AlCa.GlobalTag
import GlobalTag
108 process.GlobalTag =
GlobalTag(process.GlobalTag, config[
"alignment"].get(
"globaltag",
"auto:phase1_2017_realistic"))
111 if "conditions" in config[
"alignment"]:
114 for condition
in config[
"alignment"][
"conditions"]:
115 setattr(process,
"conditionsIn{}".
format(condition), poolDBESSource.clone(
116 connect = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"connect"])),
119 record = cms.string(
str(condition)),
120 tag = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"tag"]))
126 setattr(process,
"prefer_conditionsIn{}".
format(condition), cms.ESPrefer(
"PoolDBESSource",
"conditionsIn{}".
format(condition)))
129 process.oneGoodVertexFilter = cms.EDFilter(
"VertexSelector",
130 src = cms.InputTag(config[
"validation"].get(
"vertexcollection",
"offlinePrimaryVertices")),
131 cut = cms.string(
"!isFake && ndof > 4 && abs(z) <= 15 && position.Rho <= 2"),
132 filter = cms.bool(
True),
134 process.FilterGoodEvents=cms.Sequence(process.oneGoodVertexFilter)
136 process.noScraping= cms.EDFilter(
"FilterOutScraping",
137 src=cms.untracked.InputTag(config[
"validation"].get(
"trackcollection",
"generalTracks")),
138 applyfilter = cms.untracked.bool(
True),
139 debugOn = cms.untracked.bool(
False),
140 numtrack = cms.untracked.uint32(10),
141 thresh = cms.untracked.double(0.25),
145 process.TrackerOfflineValidation = cms.EDAnalyzer(
"TrackerOfflineValidation",
146 useInDqmMode = cms.bool(
False),
147 moduleDirectoryInOutput = cms.string(
""),
148 Tracks = cms.InputTag(
"FinalTrackRefitter"),
149 trajectoryInput = cms.string(
'FinalTrackRefitter'),
150 localCoorHistosOn = cms.bool(
False),
151 moduleLevelHistsTransient = config[
"validation"].get(
"moduleLevelHistsTransient", cms.bool(
False)),
152 moduleLevelProfiles = config[
"validation"].get(
"moduleLevelProfiles", cms.bool(
True)),
153 localCoorProfilesOn = cms.bool(
False),
154 stripYResiduals = cms.bool(config[
"validation"].get(
"stripYResiduals",
False)),
155 useFwhm = cms.bool(
True),
156 useFit = cms.bool(
False),
157 useCombinedTrajectory = cms.bool(
False),
158 useOverflowForRMS = cms.bool(
False),
159 maxTracks = cms.uint64(config[
"validation"].get(
"maxtracks", 1)),
160 chargeCut = cms.int32(config[
"validation"].get(
"chargecut", 0)),
162 TH1NormXResStripModules = cms.PSet(
163 Nbinx = cms.int32(100), xmin = cms.double(-5.0), xmax = cms.double(5.0)
167 TH1XResStripModules = cms.PSet(
168 Nbinx = cms.int32(100), xmin = cms.double(-0.5), xmax = cms.double(0.5)
172 TH1NormXprimeResStripModules = cms.PSet(
173 Nbinx = cms.int32(120), xmin = cms.double(-3.0), xmax = cms.double(3.0)
177 TH1XprimeResStripModules = cms.PSet(
178 Nbinx = cms.int32(5000), xmin = cms.double(-0.05), xmax = cms.double(0.05)
182 TH1NormYResStripModules = cms.PSet(
183 Nbinx = cms.int32(120), xmin = cms.double(-3.0), xmax = cms.double(3.0)
186 TH1YResStripModules = cms.PSet(
187 Nbinx = cms.int32(5000), xmin = cms.double(-11.0), xmax = cms.double(11.0)
191 TH1NormXResPixelModules = cms.PSet(
192 Nbinx = cms.int32(100), xmin = cms.double(-5.0), xmax = cms.double(5.0)
195 TH1XResPixelModules = cms.PSet(
196 Nbinx = cms.int32(100), xmin = cms.double(-0.5), xmax = cms.double(0.5)
199 TH1NormXprimeResPixelModules = cms.PSet(
200 Nbinx = cms.int32(120), xmin = cms.double(-3.0), xmax = cms.double(3.0)
203 TH1XprimeResPixelModules = cms.PSet(
204 Nbinx = cms.int32(5000), xmin = cms.double(-0.05), xmax = cms.double(0.05)
207 TH1NormYResPixelModules = cms.PSet(
208 Nbinx = cms.int32(120), xmin = cms.double(-3.0), xmax = cms.double(3.0)
211 TH1YResPixelModules = cms.PSet(
212 Nbinx = cms.int32(5000), xmin = cms.double(-0.05), xmax = cms.double(0.05)
215 TProfileXResStripModules = cms.PSet(
216 Nbinx = cms.int32(34), xmin = cms.double(-1.02), xmax = cms.double(1.02)
219 TProfileYResStripModules = cms.PSet(
220 Nbinx = cms.int32(34), xmin = cms.double(-1.02), xmax = cms.double(1.02)
223 TProfileXResPixelModules = cms.PSet(
224 Nbinx = cms.int32(17), xmin = cms.double(-1.02), xmax = cms.double(1.02)
227 TProfileYResPixelModules = cms.PSet(
228 Nbinx = cms.int32(17), xmin = cms.double(-1.02), xmax = cms.double(1.02)
233 process.TFileService = cms.Service(
"TFileService",
234 fileName = cms.string(
"{}/DMR.root".
format(config.get(
"output", os.getcwd()))),
235 closeFileFast = cms.untracked.bool(
True),
238 seqTrackerOfflineValidation = cms.Sequence(process.TrackerOfflineValidation)
241 process.p = cms.Path(process.seqTrackselRefit*seqTrackerOfflineValidation)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)