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 from Alignment.OfflineValidation.trackerOfflineValidation_cfi
import trackerOfflineValidation
as _trackerOfflineValidation
146 process.TrackerOfflineValidation = _trackerOfflineValidation.clone(
147 useInDqmMode =
False,
148 moduleDirectoryInOutput =
"",
149 Tracks =
"FinalTrackRefitter",
150 trajectoryInput =
"FinalTrackRefitter",
151 localCoorHistosOn =
False,
152 moduleLevelHistsTransient = config[
"validation"].get(
"moduleLevelHistsTransient",
False),
153 moduleLevelProfiles = config[
"validation"].get(
"moduleLevelProfiles",
True),
154 stripYResiduals = config[
"validation"].get(
"stripYResiduals",
False),
157 useOverflowForRMS =
False,
158 maxTracks = config[
"validation"].get(
"maxtracks", 1),
159 chargeCut = config[
"validation"].get(
"chargecut", 0),
162 TH1NormXResStripModules = dict(Nbinx = 100, xmin = -5.0, xmax = 5.0),
165 TH1XResStripModules = dict(Nbinx = 100, xmin = -0.5, xmax = 0.5),
168 TH1NormXprimeResStripModules = dict(Nbinx = 120, xmin = -3.0, xmax = 3.0),
171 TH1XprimeResStripModules = dict(Nbinx = 5000, xmin = -0.05, xmax = 0.05),
174 TH1NormYResStripModules = dict(Nbinx = 120, xmin = -3.0, xmax = 3.0),
177 TH1YResStripModules = dict(Nbinx = 5000, xmin = -11.0, xmax = 11.0),
180 TH1NormXResPixelModules = dict(Nbinx = 100, xmin = -5.0, xmax = 5.0),
183 TH1XResPixelModules = dict(Nbinx = 100, xmin = -0.5, xmax = 0.5),
186 TH1NormXprimeResPixelModules = dict(Nbinx = 120, xmin = -3.0, xmax = 3.0),
189 TH1XprimeResPixelModules = dict(Nbinx = 5000, xmin = -0.05, xmax = 0.05),
192 TH1NormYResPixelModules = dict(Nbinx = 120, xmin = -3.0, xmax = 3.0),
195 TH1YResPixelModules = dict(Nbinx = 5000, xmin = -0.05, xmax = 0.05),
198 TProfileXResStripModules = dict(Nbinx = 34, xmin = -1.02, xmax = 1.02),
201 TProfileYResStripModules = dict(Nbinx = 34, xmin = -1.02, xmax = 1.02),
204 TProfileXResPixelModules = dict(Nbinx = 17, xmin = -1.02, xmax = 1.02),
207 TProfileYResPixelModules = dict(Nbinx = 17, xmin = -1.02, xmax = 1.02)
211 process.TFileService = cms.Service(
"TFileService",
212 fileName = cms.string(
"{}/DMR.root".
format(config.get(
"output", os.getcwd()))),
213 closeFileFast = cms.untracked.bool(
True),
216 seqTrackerOfflineValidation = cms.Sequence(process.TrackerOfflineValidation)
219 process.p = cms.Path(process.seqTrackselRefit*seqTrackerOfflineValidation)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)