3 import FWCore.ParameterSet.Config
as cms
4 import FWCore.PythonUtilities.LumiList
as LumiList
5 from Alignment.OfflineValidation.TkAlAllInOneTool.defaultInputFiles_cff
import filesDefaultMC_NoPU
6 from FWCore.ParameterSet.VarParsing
import VarParsing
7 from Alignment.OfflineValidation.TkAlAllInOneTool.utils
import _byteify
12 process = cms.Process(
"PrimaryVertexResolution")
18 options.register(
"config",
"", VarParsing.multiplicity.singleton, VarParsing.varType.string ,
"AllInOne config")
19 options.parseArguments()
24 if options.config ==
"":
25 config = {
"validation": {},
28 with open(options.config,
"r") as configFile: 29 config = json.load(configFile) 36 if "dataset" in config[
"validation"]:
37 with open(config[
"validation"][
"dataset"],
"r") as datafiles: 38 for fileName
in datafiles.readlines():
39 readFiles.append(fileName.replace(
"\n",
""))
41 process.source = cms.Source(
"PoolSource",
42 fileNames = cms.untracked.vstring(readFiles),
43 skipEvents = cms.untracked.uint32(0)
46 print(
">>>>>>>>>> SplitV_cfg.py: msg%-i: config not specified! Loading default MC simulation -> filesDefaultMC_NoPU!")
47 process.source = cms.Source(
"PoolSource",
48 fileNames = filesDefaultMC_NoPU,
49 skipEvents = cms.untracked.uint32(0)
55 if "goodlumi" in config[
"validation"]:
56 if os.path.isfile(config[
"validation"][
"goodlumi"]):
57 goodLumiSecs = cms.untracked.VLuminosityBlockRange(
LumiList.LumiList(filename = config[
"validation"][
"goodlumi"]).getCMSSWString().
split(
','))
59 print(
"Does not exist: {}. Continue without good lumi section file.")
60 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
63 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
68 runboundary = config[
"validation"].get(
"runboundary", 1)
70 if(isinstance(runboundary, (list, tuple))):
72 print(
"Multiple Runs are selected")
74 process.source.firstRun = cms.untracked.uint32(runboundary[0])
76 process.source.firstRun = cms.untracked.uint32(runboundary)
81 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(config[
"validation"].get(
"maxevents", 1)))
86 process.options = cms.untracked.PSet(
87 wantSummary = cms.untracked.bool(
False),
88 Rethrow = cms.untracked.vstring(
"ProductNotFound"),
89 fileMode = cms.untracked.string(
'NOMERGE'),
95 process.load(
"FWCore.MessageLogger.MessageLogger_cfi")
96 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
97 process.MessageLogger.cout.enableStatistics = cms.untracked.bool(
True)
102 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
103 process.load(
"Configuration.Geometry.GeometryDB_cff")
104 process.load(
'Configuration.StandardSequences.Services_cff')
105 process.load(
"Configuration.StandardSequences.MagneticField_cff")
110 process.load(
"RecoTracker.TrackProducer.TrackRefitters_cff")
111 process.TrackRefitter.src = config[
"validation"].get(
"trackcollection",
"generalTracks")
112 process.TrackRefitter.TTRHBuilder = config[
"validation"].get(
"tthrbuilder",
"WithAngleAndTemplate")
113 process.TrackRefitter.NavigationSchool =
"" 118 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
119 from Configuration.AlCa.GlobalTag
import GlobalTag
120 process.GlobalTag =
GlobalTag(process.GlobalTag, config[
"alignment"].get(
"globaltag",
"auto:phase1_2017_realistic"))
125 if "conditions" in config[
"alignment"]:
128 for condition
in config[
"alignment"][
"conditions"]:
129 setattr(process,
"conditionsIn{}".
format(condition), poolDBESSource.clone(
130 connect = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"connect"])),
133 record = cms.string(
str(condition)),
134 tag = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"tag"]))
140 setattr(process,
"prefer_conditionsIn{}".
format(condition), cms.ESPrefer(
"PoolDBESSource",
"conditionsIn{}".
format(condition)))
146 process.theHLTFilter = triggerResultsFilter.clone(
147 triggerConditions = cms.vstring(config[
"validation"].get(
"triggerBits",
"*")),
148 hltResults = cms.InputTag(
"TriggerResults",
"",
"HLT" ),
149 l1tResults = cms.InputTag(
"" ),
150 throw = cms.bool(
False)
156 process.load(
"TrackingTools.TransientTrack.TransientTrackBuilder_cfi")
159 process.offlinePrimaryVerticesFromRefittedTrks = offlinePrimaryVertices.clone()
160 process.offlinePrimaryVerticesFromRefittedTrks.TrackLabel = cms.InputTag(
"TrackRefitter")
161 process.offlinePrimaryVerticesFromRefittedTrks.vertexCollections.maxDistanceToBeam = 1
162 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxNormalizedChi2 = 20
163 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.minSiliconLayersWithHits = 5
164 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxD0Significance = 5.0
166 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxD0Error = 1.0
167 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.maxDzError = 1.0
168 process.offlinePrimaryVerticesFromRefittedTrks.TkFilterParameters.minPixelLayersWithHits = 2
176 compressionSettings = 207
181 from Alignment.OfflineValidation.splitVertexResolution_cfi
import splitVertexResolution
as _splitVertexResolution
182 process.PrimaryVertexResolution = _splitVertexResolution.clone(
183 compressionSettings = compressionSettings,
185 vtxCollection =
"offlinePrimaryVerticesFromRefittedTrks",
186 trackCollection =
"TrackRefitter",
188 minVertexMeanWeight = 0.5,
189 runControl = config[
"validation"].get(
"runControl",
False),
190 runControlNumber = [runboundary]
193 process.TFileService = cms.Service(
"TFileService",
194 fileName = cms.string(
"{}/SplitV.root".
format(config.get(
"output", os.getcwd()))),
195 closeFileFast = cms.untracked.bool(
True)
197 print(
"Saving the output at %s" % process.TFileService.fileName.value())
199 process.theValidSequence = cms.Sequence(process.offlineBeamSpot +
200 process.TrackRefitter +
201 process.offlinePrimaryVerticesFromRefittedTrks +
202 process.PrimaryVertexResolution)
204 HLTSel = config[
"validation"].get(
"HLTselection",
False)
207 process.p = cms.Path(process.theHLTFilter + process.theValidSequence)
209 process.p = cms.Path(process.theValidSequence)
The trigger filter module.
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)