5 import FWCore.ParameterSet.Config
as cms
6 import FWCore.PythonUtilities.LumiList
as LumiList
7 from FWCore.ParameterSet.VarParsing
import VarParsing
8 from Alignment.OfflineValidation.TkAlAllInOneTool.utils
import _byteify
13 process = cms.Process(
"TkAlignmentDiMuonValidation")
19 options.register(
"config",
"", VarParsing.multiplicity.singleton, VarParsing.varType.string ,
"AllInOne config")
20 options.parseArguments()
23 valiMode =
"StandAlone" 28 with open(options.config,
"r") as configFile: config = _byteify(json.load(configFile, object_hook=_byteify),ignore_dicts=True)
35 with open(config[
"validation"][
"dataset"],
"r") as datafiles: 36 for fileName
in datafiles.readlines():
37 readFiles.append(fileName.replace(
"\n",
""))
42 if "goodlumi" in config[
"validation"]:
43 if os.path.isfile(config[
"validation"][
"goodlumi"]):
44 goodLumiSecs = cms.untracked.VLuminosityBlockRange(
LumiList.LumiList(filename = config[
"validation"][
"goodlumi"]).getCMSSWString().
split(
','))
47 print(
"Does not exist: {}. Continue without good lumi section file.")
48 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
51 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
56 process.source = cms.Source(
"PoolSource",
57 fileNames = cms.untracked.vstring(readFiles),
58 lumisToProcess = goodLumiSecs,
59 skipEvents = cms.untracked.uint32(0)
61 process.maxEvents = cms.untracked.PSet(
62 input = cms.untracked.int32(config[
"validation"].get(
"maxevents", 2000000))
68 process.options = cms.untracked.PSet(
69 wantSummary = cms.untracked.bool(
False),
70 Rethrow = cms.untracked.vstring(
"ProductNotFound"),
71 fileMode = cms.untracked.string(
'NOMERGE'),
77 process.load(
"FWCore.MessageService.MessageLogger_cfi")
78 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
79 process.load(
"Configuration.StandardSequences.Services_cff")
80 process.load(
"Configuration.StandardSequences.GeometryRecoDB_cff")
81 process.load(
"Configuration.StandardSequences.MagneticField_cff")
82 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
87 process.load(
"FWCore.MessageLogger.MessageLogger_cfi")
88 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
93 process.load(
"RecoTracker.TrackProducer.TrackRefitters_cff")
95 process.TrackRefitter = process.TrackRefitterP5.clone(
96 src =
'ALCARECOTkAlZMuMu',
97 TrajectoryInEvent =
True,
98 TTRHBuilder =
"WithAngleAndTemplate",
99 NavigationSchool =
"",
105 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
106 from Configuration.AlCa.GlobalTag
import GlobalTag
107 process.GlobalTag =
GlobalTag(process.GlobalTag, config[
"alignment"].get(
"globaltag",
"auto:run2_data"))
113 if "conditions" in config[
"alignment"]:
115 for condition
in config[
"alignment"][
"conditions"]:
116 setattr(process,
"conditionsIn{}".
format(condition), poolDBESSource.clone(
117 connect = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"connect"])),
118 toGet = cms.VPSet(cms.PSet(record = cms.string(
str(condition)),
119 tag = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"tag"]))
125 setattr(process,
"prefer_conditionsIn{}".
format(condition), cms.ESPrefer(
"PoolDBESSource",
"conditionsIn{}".
format(condition)))
130 from Alignment.OfflineValidation.diMuonValidation_cfi.py
import diMuonValidation
as _diMuonValidation
131 process.DiMuonMassValidation = _diMuonValidation.clone(
132 TkTag =
'TrackRefitter',
135 Pair_mass_max = 120.,
136 Pair_mass_nbins = 80,
142 Variable_CosThetaCS_xmin = -1.,
143 Variable_CosThetaCS_xmax = 1.,
144 Variable_CosThetaCS_nbins = 20,
146 Variable_DeltaEta_xmin = -4.8,
147 Variable_DeltaEta_xmax = 4.8,
148 Variable_DeltaEta_nbins = 20,
150 Variable_EtaMinus_xmin = -2.4,
151 Variable_EtaMinus_xmax = 2.4,
152 Variable_EtaMinus_nbins = 12,
154 Variable_EtaPlus_xmin = -2.4,
155 Variable_EtaPlus_xmax = 2.4,
156 Variable_EtaPlus_nbins = 12,
158 Variable_PhiCS_xmin = -math.pi/2.,
159 Variable_PhiCS_xmax = math.pi/2.,
160 Variable_PhiCS_nbins = 20,
162 Variable_PhiMinus_xmin = -math.pi,
163 Variable_PhiMinus_xmax = math.pi,
164 Variable_PhiMinus_nbins = 16,
166 Variable_PhiPlus_xmin = -math.pi,
167 Variable_PhiPlus_xmax = math.pi,
168 Variable_PhiPlus_nbins = 16,
170 Variable_PairPt_xmin = 0.,
171 Variable_PairPt_xmax = 100.,
172 Variable_PairPt_nbins = 100)
177 if valiMode ==
"StandAlone":
179 process.TFileService = cms.Service(
"TFileService",
180 fileName = cms.string(
"{}/Zmumu.root".
format(config[
"output"])),
181 closeFileFast = cms.untracked.bool(
True),
184 process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter*process.DiMuonMassValidation)
185
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)
def _byteify(data, ignore_dicts=False)