4 import FWCore.ParameterSet.Config
as cms
5 import FWCore.PythonUtilities.LumiList
as LumiList
6 from Alignment.OfflineValidation.TkAlAllInOneTool.defaultInputFiles_cff
import filesDefaultData_Cosmics_string
7 from FWCore.ParameterSet.VarParsing
import VarParsing
8 from Alignment.OfflineValidation.TkAlAllInOneTool.utils
import _byteify
14 process = cms.Process(
"splitter")
20 options.register(
"config",
"", VarParsing.multiplicity.singleton, VarParsing.varType.string ,
"AllInOne config")
21 options.parseArguments()
26 if options.config ==
"":
27 config = {
"validation": {},
30 with open(options.config,
"r") as configFile: 31 if options.config.endswith(
".json"):
32 config = json.load(configFile)
33 elif options.config.endswith(
".yaml"):
34 config = yaml.safe_load(configFile)
41 if "dataset" in config[
"validation"]:
42 with open(config[
"validation"][
"dataset"],
"r") as datafiles: 43 for fileName
in datafiles.readlines():
44 readFiles.append(fileName.replace(
"\n",
""))
46 process.source = cms.Source(
"PoolSource",
47 fileNames = cms.untracked.vstring(readFiles),
48 skipEvents = cms.untracked.uint32(0)
51 print(
">>>>>>>>>> MTS_cfg.py: msg%-i: dataset not specified! Loading default file -> filesDefaultData_Cosmics_string!")
52 process.source = cms.Source(
"PoolSource",
53 fileNames = cms.untracked.vstring(filesDefaultData_Cosmics_string),
54 skipEvents = cms.untracked.uint32(0)
60 if "goodlumi" in config[
"validation"]:
61 if os.path.isfile(config[
"validation"][
"goodlumi"]):
62 goodLumiSecs = cms.untracked.VLuminosityBlockRange(
LumiList.LumiList(filename = config[
"validation"][
"goodlumi"]).getCMSSWString().
split(
','))
64 print(
"Does not exist: {}. Continue without good lumi section file.")
65 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
68 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
73 runboundary = config[
"validation"].get(
"runboundary", 1)
75 if(isinstance(runboundary, (list, tuple))):
77 print(
"Multiple Runs are selected")
79 process.source.firstRun = cms.untracked.uint32(runboundary[0])
81 process.source.firstRun = cms.untracked.uint32(runboundary)
86 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(config[
"validation"].get(
"maxevents", 1)))
91 process.options = cms.untracked.PSet(
92 wantSummary = cms.untracked.bool(
False),
93 Rethrow = cms.untracked.vstring(
"ProductNotFound"),
94 fileMode = cms.untracked.string(
'NOMERGE'),
100 process.load(
"FWCore.MessageLogger.MessageLogger_cfi")
101 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
102 process.MessageLogger.cout.enableStatistics = cms.untracked.bool(
True)
107 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
108 process.load(
"Configuration.Geometry.GeometryDB_cff")
109 process.load(
'Configuration.StandardSequences.Services_cff')
110 process.load(
"Configuration.StandardSequences.MagneticField_cff")
115 import Alignment.CommonAlignment.tools.trackselectionRefitting
as trackselRefit
116 process.seqTrackselRefit = trackselRefit.getSequence(
118 config[
"validation"].get(
"trackcollection",
"ALCARECOTkAlCosmicsCTF0T"),
119 isPVValidation =
False,
120 TTRHBuilder = config[
"validation"].get(
"tthrbuilder",
"WithAngleAndTemplate"),
121 usePixelQualityFlag=config[
"validation"].get(
"usePixelQualityFlag",
True),
122 openMassWindow =
False,
123 cosmicsDecoMode =
True,
124 cosmicsZeroTesla=config[
"validation"].get(
"cosmicsZeroTesla",
False),
125 momentumConstraint =
None,
126 cosmicTrackSplitting =
True,
133 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
134 from Configuration.AlCa.GlobalTag
import GlobalTag
135 process.GlobalTag =
GlobalTag(process.GlobalTag, config[
"alignment"].get(
"globaltag",
"124X_dataRun3_Prompt_v10"))
140 if "conditions" in config[
"alignment"]:
143 for condition
in config[
"alignment"][
"conditions"]:
146 "conditionsIn{}".
format(condition),
147 poolDBESSource.clone(
149 connect = cms.string(
"sqlite_file:" +
str(config[
"alignment"][
"conditions"][condition][
"connect"])
if "alignments_MP.db" in str(config[
"alignment"][
"conditions"][condition][
"connect"])
else str(config[
"alignment"][
"conditions"][condition][
"connect"])),
153 record = cms.string(
str(condition)),
154 tag = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"tag"]))
162 "prefer_conditionsIn{}".
format(condition),
163 cms.ESPrefer(
"PoolDBESSource",
"conditionsIn{}".
format(condition))
170 process.FittingSmootherRKP5.EstimateCut = -1
171 process.AlignmentTrackSelector.minHitsPerSubDet.inPIXEL = 2
178 compressionSettings = 207
179 process.cosmicValidation = cms.EDAnalyzer(
180 "CosmicSplitterValidation",
181 compressionSettings = cms.untracked.int32(compressionSettings),
182 ifSplitMuons = cms.bool(
False),
183 checkIfGolden = cms.bool(
False),
184 splitTracks = cms.InputTag(
"FinalTrackRefitter",
"",
"splitter"),
185 splitGlobalMuons = cms.InputTag(
"muons",
"",
"splitter"),
186 originalTracks = cms.InputTag(
"FirstTrackRefitter",
"",
"splitter"),
187 originalGlobalMuons = cms.InputTag(
"muons",
"",
"Rec")
193 process.TFileService = cms.Service(
"TFileService",
194 fileName = cms.string(
"{}/MTSValidation_{}_{}.root".
format(config.get(
"output", os.getcwd()), config[
"alignment"].get(
"name",
""), config[
"validation"].get(
"IOV", 1.))),
195 closeFileFast = cms.untracked.bool(
True),
201 process.p = cms.Path(process.seqTrackselRefit*process.cosmicValidation)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)