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()
69 process.source.lumisToProcess = goodLumiSecs
74 runboundary = config[
"validation"].get(
"runboundary", 1)
76 if(isinstance(runboundary, (list, tuple))):
78 print(
"Multiple Runs are selected")
80 process.source.firstRun = cms.untracked.uint32(runboundary[0])
82 process.source.firstRun = cms.untracked.uint32(runboundary)
87 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(config[
"validation"].get(
"maxevents", 1)))
92 process.options = cms.untracked.PSet(
93 wantSummary = cms.untracked.bool(
False),
94 Rethrow = cms.untracked.vstring(
"ProductNotFound"),
95 fileMode = cms.untracked.string(
'NOMERGE'),
101 process.load(
"FWCore.MessageLogger.MessageLogger_cfi")
102 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
103 process.MessageLogger.cout.enableStatistics = cms.untracked.bool(
True)
108 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
109 process.load(
"Configuration.Geometry.GeometryDB_cff")
110 process.load(
'Configuration.StandardSequences.Services_cff')
111 process.load(
"Configuration.StandardSequences.MagneticField_cff")
116 import Alignment.CommonAlignment.tools.trackselectionRefitting
as trackselRefit
117 process.seqTrackselRefit = trackselRefit.getSequence(
119 config[
"validation"].get(
"trackcollection",
"ALCARECOTkAlCosmicsCTF0T"),
120 isPVValidation =
False,
121 TTRHBuilder = config[
"validation"].get(
"tthrbuilder",
"WithAngleAndTemplate"),
122 usePixelQualityFlag=config[
"validation"].get(
"usePixelQualityFlag",
True),
123 openMassWindow =
False,
124 cosmicsDecoMode =
True,
125 cosmicsZeroTesla=config[
"validation"].get(
"cosmicsZeroTesla",
False),
126 momentumConstraint =
None,
127 cosmicTrackSplitting =
True,
134 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
135 from Configuration.AlCa.GlobalTag
import GlobalTag
136 process.GlobalTag =
GlobalTag(process.GlobalTag, config[
"alignment"].get(
"globaltag",
"124X_dataRun3_Prompt_v10"))
141 if "conditions" in config[
"alignment"]:
144 for condition
in config[
"alignment"][
"conditions"]:
147 "conditionsIn{}".
format(condition),
148 poolDBESSource.clone(
149 connect = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"connect"])),
152 record = cms.string(
str(condition)),
153 tag = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"tag"]))
161 "prefer_conditionsIn{}".
format(condition),
162 cms.ESPrefer(
"PoolDBESSource",
"conditionsIn{}".
format(condition))
169 process.FittingSmootherRKP5.EstimateCut = -1
170 process.AlignmentTrackSelector.minHitsPerSubDet.inPIXEL = 2
177 compressionSettings = 207
178 process.cosmicValidation = cms.EDAnalyzer(
179 "CosmicSplitterValidation",
180 compressionSettings = cms.untracked.int32(compressionSettings),
181 ifSplitMuons = cms.bool(
False),
182 checkIfGolden = cms.bool(
False),
183 splitTracks = cms.InputTag(
"FinalTrackRefitter",
"",
"splitter"),
184 splitGlobalMuons = cms.InputTag(
"muons",
"",
"splitter"),
185 originalTracks = cms.InputTag(
"FirstTrackRefitter",
"",
"splitter"),
186 originalGlobalMuons = cms.InputTag(
"muons",
"",
"Rec")
192 process.TFileService = cms.Service(
"TFileService",
193 fileName = cms.string(
"{}/MTSValidation_{}_{}.root".
format(config.get(
"output", os.getcwd()), config[
"alignment"].get(
"name",
""), config[
"validation"].get(
"IOV", 1.))),
194 closeFileFast = cms.untracked.bool(
True),
200 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)