4 from sys
import version_info
6 import FWCore.ParameterSet.Config
as cms
7 import FWCore.PythonUtilities.LumiList
as LumiList
8 from FWCore.ParameterSet.VarParsing
import VarParsing
9 from Alignment.OfflineValidation.TkAlAllInOneTool.utils
import _byteify
14 process = cms.Process(
"TkAlignmentDiMuonValidation")
20 options.register(
"config",
"", VarParsing.multiplicity.singleton, VarParsing.varType.string ,
"AllInOne config")
21 options.parseArguments()
24 valiMode =
"StandAlone" 29 with open(options.config,
"r") as configFile: if version_info.major == 2:
30 config =
_byteify(json.load(configFile, object_hook=_byteify),ignore_dicts=
True)
32 config = json.load(configFile)
39 with open(config[
"validation"][
"dataset"],
"r") as datafiles: 40 for fileName
in datafiles.readlines():
41 readFiles.append(fileName.replace(
"\n",
""))
46 if "goodlumi" in config[
"validation"]:
47 if os.path.isfile(config[
"validation"][
"goodlumi"]):
48 goodLumiSecs = cms.untracked.VLuminosityBlockRange(
LumiList.LumiList(filename = config[
"validation"][
"goodlumi"]).getCMSSWString().
split(
','))
51 print(
"Does not exist: {}. Continue without good lumi section file.")
52 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
55 goodLumiSecs = cms.untracked.VLuminosityBlockRange()
60 process.source = cms.Source(
"PoolSource",
61 fileNames = cms.untracked.vstring(readFiles),
62 lumisToProcess = goodLumiSecs,
63 skipEvents = cms.untracked.uint32(0)
65 process.maxEvents = cms.untracked.PSet(
66 input = cms.untracked.int32(config[
"validation"].get(
"maxevents", 2000000))
72 process.options = cms.untracked.PSet(
73 wantSummary = cms.untracked.bool(
False),
74 Rethrow = cms.untracked.vstring(
"ProductNotFound"),
75 fileMode = cms.untracked.string(
'NOMERGE'),
81 process.load(
"FWCore.MessageService.MessageLogger_cfi")
82 process.load(
"RecoVertex.BeamSpotProducer.BeamSpot_cff")
83 process.load(
"Configuration.StandardSequences.Services_cff")
84 process.load(
"Configuration.StandardSequences.GeometryRecoDB_cff")
85 process.load(
"Configuration.StandardSequences.MagneticField_cff")
86 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
91 process.load(
"FWCore.MessageLogger.MessageLogger_cfi")
92 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
97 process.load(
"RecoTracker.TrackProducer.TrackRefitters_cff")
99 process.TrackRefitter = process.TrackRefitterP5.clone(
100 src =
'ALCARECOTkAlZMuMu',
101 TrajectoryInEvent =
True,
102 TTRHBuilder =
"WithAngleAndTemplate",
103 NavigationSchool =
"",
109 process.load(
"Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
110 from Configuration.AlCa.GlobalTag
import GlobalTag
111 process.GlobalTag =
GlobalTag(process.GlobalTag, config[
"alignment"].get(
"globaltag",
"auto:run2_data"))
117 if "conditions" in config[
"alignment"]:
119 for condition
in config[
"alignment"][
"conditions"]:
120 setattr(process,
"conditionsIn{}".
format(condition), poolDBESSource.clone(
121 connect = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"connect"])),
122 toGet = cms.VPSet(cms.PSet(record = cms.string(
str(condition)),
123 tag = cms.string(
str(config[
"alignment"][
"conditions"][condition][
"tag"]))
129 setattr(process,
"prefer_conditionsIn{}".
format(condition), cms.ESPrefer(
"PoolDBESSource",
"conditionsIn{}".
format(condition)))
134 from Alignment.OfflineValidation.diMuonValidation_cfi
import diMuonValidation
as _diMuonValidation
135 process.DiMuonMassValidation = _diMuonValidation.clone(
136 TkTag =
'TrackRefitter',
139 Pair_mass_max = 120.,
140 Pair_mass_nbins = 80,
141 Pair_etaminpos = -2.4,
142 Pair_etamaxpos = 2.4,
143 Pair_etaminneg = -2.4,
144 Pair_etamaxneg = 2.4,
146 Variable_CosThetaCS_xmin = -1.,
147 Variable_CosThetaCS_xmax = 1.,
148 Variable_CosThetaCS_nbins = 20,
150 Variable_DeltaEta_xmin = -4.8,
151 Variable_DeltaEta_xmax = 4.8,
152 Variable_DeltaEta_nbins = 20,
154 Variable_EtaMinus_xmin = -2.4,
155 Variable_EtaMinus_xmax = 2.4,
156 Variable_EtaMinus_nbins = 12,
158 Variable_EtaPlus_xmin = -2.4,
159 Variable_EtaPlus_xmax = 2.4,
160 Variable_EtaPlus_nbins = 12,
162 Variable_PhiCS_xmin = -math.pi/2.,
163 Variable_PhiCS_xmax = math.pi/2.,
164 Variable_PhiCS_nbins = 20,
166 Variable_PhiMinus_xmin = -math.pi,
167 Variable_PhiMinus_xmax = math.pi,
168 Variable_PhiMinus_nbins = 16,
170 Variable_PhiPlus_xmin = -math.pi,
171 Variable_PhiPlus_xmax = math.pi,
172 Variable_PhiPlus_nbins = 16,
174 Variable_PairPt_xmin = 0.,
175 Variable_PairPt_xmax = 100.,
176 Variable_PairPt_nbins = 100)
181 if valiMode ==
"StandAlone":
183 process.TFileService = cms.Service(
"TFileService",
184 fileName = cms.string(
"{}/Zmumu.root".
format(config[
"output"])),
185 closeFileFast = cms.untracked.bool(
True),
188 process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter*process.DiMuonMassValidation)
189
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)
def _byteify(data, ignore_dicts=False)