test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
Alignment
OfflineValidation
python
TkAlAllInOneTool
zMuMuValidationTemplates.py
Go to the documentation of this file.
1
ZMuMuValidationTemplate=
"""
2
import FWCore.ParameterSet.Config as cms
3
4
process = cms.Process("ONLYHISTOS")
5
6
7
# Messages
8
process.load("FWCore.MessageService.MessageLogger_cfi")
9
process.MessageLogger.destinations = ['cout', 'cerr']
10
process.MessageLogger.cerr.FwkReport.reportEvery = 5000
11
12
13
########### DATA FILES ####################################
14
.oO[datasetDefinition]Oo.
15
# process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
16
17
#process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
18
#process.load("Geometry.CommonDetUnit.globalTrackingGeometry_cfi")
19
process.load("RecoMuon.DetLayers.muonDetLayerGeometry_cfi")
20
process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")
21
process.load("RecoMuon.TrackingTools.MuonServiceProxy_cff")
22
23
########### standard includes ##############################
24
process.load("Configuration.StandardSequences..oO[magneticField]Oo._cff")
25
process.load("Configuration.StandardSequences.Reconstruction_cff")
26
process.load("Configuration.Geometry.GeometryRecoDB_cff")
27
28
29
########### DATABASE conditions ############################
30
.oO[LoadGlobalTagTemplate]Oo.
31
32
.oO[condLoad]Oo.
33
34
########### TRACK REFITTER #################################
35
process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
36
process.TrackRefitter.src = 'ALCARECOTkAlZMuMu'
37
process.TrackRefitter.TrajectoryInEvent = True
38
process.TrackRefitter.TTRHBuilder = "WithAngleAndTemplate"
39
process.TrackRefitter.NavigationSchool = ""
40
41
###### MuSclFit SETTINGS ##############################################
42
43
44
### MuScleFit specific configuration
45
46
process.looper = cms.Looper(
47
"MuScleFit",
48
# Only used when reading events from a root tree
49
MaxEventsFromRootTree = cms.int32(-1),
50
51
# Specify a file if you want to read events from a root tree in a local file.
52
# In this case the input source should be an empty source with 0 events.
53
54
InputRootTreeFileName = cms.string(""),
55
56
# Specify the file name where you want to save a root tree with the muon pairs.
57
# Leave empty if no file should be written.
58
59
OutputRootTreeFileName = cms.string(""),
60
61
62
# Choose the kind of muons you want to run on
63
# -------------------------------------------
64
MuonLabel = cms.InputTag("TrackRefitter"),
65
66
67
#MuonType = cms.int32(11),
68
MuonType = cms.int32(5),
69
70
# This line allows to switch to PAT muons. Default is false.
71
# Note that the onia selection works only with onia patTuples.
72
PATmuons = cms.untracked.bool(False),
73
74
# ---------------- #
75
# Select resonance #
76
# ---------------- #
77
# The resonances are to be specified in this order:
78
# Z0, Y(3S), Y(2S), Y(1S), Psi(2S), J/Psi
79
# -------------------------------------------------
80
resfind = cms.vint32(1, 0, 0, 0, 0, 0),
81
82
# Likelihood settings
83
# -------------------
84
maxLoopNumber = cms.untracked.int32(1),
85
# Select which fits to do in which loop (0 = do not, 1 = do)
86
doResolFit = cms.vint32(0),
87
doScaleFit = cms.vint32(0),
88
doBackgroundFit = cms.vint32(0),
89
doCrossSectionFit = cms.vint32(0),
90
91
# Use the probability file or not. If not it will perform a simpler selection taking the muon pair with
92
# invariant mass closer to the pdf value and will crash if some fit is attempted.
93
UseProbsFile = cms.untracked.bool(False),
94
95
# False = use also MC information
96
speedup = cms.bool(True),
97
# Set this to false if you do not want to use simTracks.
98
# (Note that this is skipped anyway if speedup == True).
99
compareToSimTracks = cms.bool(False),
100
101
# Output settings
102
# ---------------
103
OutputFileName = cms.untracked.string("zmumuHisto.root"),
104
105
# BiasType=0 means no bias to muon momenta
106
# ----------------------------------------
107
BiasType = cms.int32(0),
108
parBias = cms.vdouble(),
109
110
# SmearType=0 means no smearing applied to muon momenta
111
# -----------------------------------------------------
112
SmearType = cms.int32(0),
113
parSmear = cms.vdouble(),
114
115
### taken from J/Psi #########################
116
# ResolFitType = cms.int32(14),
117
# parResol = cms.vdouble(0.007,0.015, -0.00077, 0.0063, 0.0018, 0.0164),
118
# parResolFix = cms.vint32(0, 0, 0,0, 0,0),
119
# parResolOrder = cms.vint32(0, 0, 0, 0, 0, 0),
120
ResolFitType = cms.int32(0),
121
parResol = cms.vdouble(0),
122
parResolFix = cms.vint32(0),
123
parResolOrder = cms.vint32(0),
124
125
126
# -------------------- #
127
# Scale fit parameters #
128
# -------------------- #
129
130
# -----------------------------------------------------------------------------------
131
# ScaleFitType = cms.int32(18),
132
# parScaleOrder = cms.vint32(0, 0, 0, 0),
133
# parScaleFix = cms.vint32(0, 0, 0, 0),
134
# parScale = cms.vdouble(1, 1, 1, 1),
135
ScaleFitType = cms.int32(0),
136
parScaleOrder = cms.vint32(0),
137
parScaleFix = cms.vint32(0),
138
parScale = cms.vdouble(0),
139
140
141
142
# ---------------------------- #
143
# Cross section fit parameters #
144
# ---------------------------- #
145
# Note that the cross section fit works differently than the others, it
146
# fits ratios of parameters. Fix and Order should not be used as is, they
147
# are there mainly for compatibility.
148
parCrossSectionOrder = cms.vint32(0, 0, 0, 0, 0, 0),
149
parCrossSectionFix = cms.vint32(0, 0, 0, 0, 0, 0),
150
parCrossSection = cms.vdouble(1.233, 2.07, 6.33, 13.9, 2.169, 127.2),
151
152
# ------------------------- #
153
# Background fit parameters #
154
# ------------------------- #
155
156
# Window factors for: Z, Upsilons and (J/Psi,Psi2S) regions
157
LeftWindowBorder = cms.vdouble(70., 8., 1.391495),
158
RightWindowBorder = cms.vdouble(110., 12., 5.391495),
159
160
# The two parameters of BgrFitType=2 are respectively:
161
# bgr fraction, (negative of) bgr exp. slope, bgr constant
162
# --------------------------------------------------------
163
# The function types for resonances in a region must be the same
164
BgrFitType = cms.vint32(2, 2, 2), # regions
165
# These empty parameters should be used when there is no background
166
parBgr = cms.vdouble(0., 0., 0., 0., 0., 0.,
167
0., 0., 0., 0., 0., 0., 0.,0., 0.,0., 0.,0.),
168
parBgrFix = cms.vint32(0, 0, 0, 0, 0, 0,
169
# The rest of the parameters is used for the resonance regions. They are automatically fixed in the code
170
# because they are never used to fit the background, but only after the rescaling.
171
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
172
parBgrOrder = cms.vint32(0, 0, 0, 0, 0, 0,
173
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
174
175
176
# ----------------------- #
177
178
# Set Minuit fit strategy
179
FitStrategy = cms.int32(1),
180
181
182
# Fit accuracy and debug parameters
183
StartWithSimplex = cms.bool(True),
184
ComputeMinosErrors = cms.bool(False),
185
MinimumShapePlots = cms.bool(True),
186
187
########## TO BE ENABLED ################################
188
# Set the cuts on muons to be used in the fit
189
MinMuonPt = cms.untracked.double(0.),
190
MaxMuonPt = cms.untracked.double(1000.),
191
MinMuonEtaFirstRange = cms.untracked.double(.oO[etaminneg]Oo.),
192
MaxMuonEtaFirstRange = cms.untracked.double(.oO[etamaxneg]Oo.),
193
MinMuonEtaSecondRange = cms.untracked.double(.oO[etaminpos]Oo.),
194
MaxMuonEtaSecondRange = cms.untracked.double(.oO[etamaxpos]Oo.),
195
PileUpSummaryInfo = cms.untracked.InputTag("addPileupInfo"),
196
PrimaryVertexCollection = cms.untracked.InputTag("offlinePrimaryVertices"),
197
198
# The following parameters can be used to filter events
199
TriggerResultsLabel = cms.untracked.string("TriggerResults"),
200
TriggerResultsProcess = cms.untracked.string("HLT"),
201
TriggerPath = cms.untracked.vstring(""),
202
# Negate the result of the trigger
203
NegateTrigger = cms.untracked.bool(False),
204
debug = cms.untracked.int32(0),
205
)
206
207
###### FINAL SEQUENCE ##############################################
208
209
process.p = cms.Path(
210
process.offlineBeamSpot*process.TrackRefitter
211
)
212
213
"""
214
215
216
####################################################################
217
####################################################################
218
zMuMuScriptTemplate=
"""
219
#!/bin/bash
220
source /afs/cern.ch/cms/caf/setup.sh
221
eos='/afs/cern.ch/project/eos/installation/cms/bin/eos.select'
222
223
echo -----------------------
224
echo Job started at `date`
225
echo -----------------------
226
227
cwd=`pwd`
228
cd .oO[CMSSW_BASE]Oo./src
229
export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
230
eval `scram runtime -sh`
231
cd $cwd
232
233
rfmkdir -p .oO[datadir]Oo.
234
rfmkdir -p .oO[workingdir]Oo.
235
rfmkdir -p .oO[logdir]Oo.
236
rm -f .oO[logdir]Oo./*.stdout
237
rm -f .oO[logdir]Oo./*.stderr
238
239
if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]] # check for interactive mode
240
then
241
rfmkdir -p .oO[workdir]Oo.
242
rm -f .oO[workdir]Oo./*
243
cd .oO[workdir]Oo.
244
else
245
mkdir -p $cwd/TkAllInOneTool
246
cd $cwd/TkAllInOneTool
247
fi
248
249
250
.oO[CommandLine]Oo.
251
252
ls -lh .
253
254
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/CompareBiasZValidation.cc .
255
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/Legend.h .
256
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitMassSlices.cc .
257
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitSlices.cc .
258
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitXslices.cc .
259
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitWithRooFit.cc .
260
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitMass1D.cc .
261
262
root -q -b -l "CompareBiasZValidation.cc+(.oO[rebinphi]Oo., .oO[rebinetadiff]Oo., .oO[rebineta]Oo., .oO[rebinpt]Oo.)"
263
264
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/tdrstyle.C .
265
cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/MultiHistoOverlap_.oO[resonance]Oo..C .
266
267
if [[ .oO[zmumureference]Oo. == *store* ]]; then xrdcp -f .oO[zmumureference]Oo. BiasCheck_Reference.root; else ln -fs .oO[zmumureference]Oo. ./BiasCheck_Reference.root; fi
268
root -q -b -l MultiHistoOverlap_.oO[resonance]Oo..C
269
270
$eos mkdir -p /store/caf/user/$USER/.oO[eosdir]Oo./plots/
271
for RootOutputFile in $(ls *root )
272
do
273
xrdcp -f ${RootOutputFile} root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./
274
rfcp ${RootOutputFile} .oO[workingdir]Oo.
275
done
276
277
mkdir -p .oO[plotsdir]Oo.
278
for PngOutputFile in $(ls *png ); do
279
xrdcp -f ${PngOutputFile} root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./plots/
280
rfcp ${PngOutputFile} .oO[plotsdir]Oo.
281
done
282
283
284
echo -----------------------
285
echo Job ended at `date`
286
echo -----------------------
287
288
"""
289
290
######################################################################
291
######################################################################
292
293
mergeZmumuPlotsExecution=
"""
294
#merge Z->mumu histograms
295
296
rfcp .oO[mergeZmumuPlotsScriptPath]Oo. .
297
root -l -x -b -q TkAlMergeZmumuPlots.C++
298
299
"""
300
301
######################################################################
302
######################################################################
303
304
mergeZmumuPlotsTemplate=
"""
305
#include "MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/MultiHistoOverlapAll_Z.C"
306
#include <sstream>
307
#include <vector>
308
309
template <typename T> string separatebycommas(vector<T> v)
310
{
311
if (v.size()==0) return "";
312
stringstream s;
313
s << v[0];
314
for (unsigned int i = 1; i < v.size(); i++)
315
s << "," << v[i];
316
return s.str();
317
}
318
319
void TkAlMergeZmumuPlots()
320
{
321
vector<string> filenames; vector<string> titles; vector<int> colors; vector<int> linestyles;
322
323
.oO[mergeZmumuPlotsInstantiation]Oo.
324
325
TkAlStyle::legendheader = ".oO[legendheader]Oo.";
326
TkAlStyle::set(.oO[publicationstatus]Oo., .oO[era]Oo., ".oO[customtitle]Oo.", ".oO[customrighttitle]Oo.");
327
328
MultiHistoOverlapAll_Z(separatebycommas(filenames), separatebycommas(titles), separatebycommas(colors), separatebycommas(linestyles), ".oO[datadir]Oo./ZMuMuPlots", .oO[switchONfit]Oo.);
329
}
330
"""
Generated for CMSSW Reference Manual by
1.8.5