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