CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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("RecoMuon.DetLayers.muonDetLayerGeometry_cfi")
18 process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")
19 process.load("RecoMuon.TrackingTools.MuonServiceProxy_cff")
20 
21 ########### standard includes ##############################
22 process.load("Configuration.StandardSequences..oO[magneticField]Oo._cff")
23 process.load("Configuration.StandardSequences.Reconstruction_cff")
24 process.load("Configuration.Geometry.GeometryRecoDB_cff")
25 
26 
27 ########### DATABASE conditions ############################
28 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff")
29 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
30 
31 .oO[condLoad]Oo.
32 
33 ########### TRACK REFITTER #################################
34 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
35 process.TrackRefitter.src = 'ALCARECOTkAlZMuMu'
36 process.TrackRefitter.TrajectoryInEvent = True
37 process.TrackRefitter.TTRHBuilder = "WithAngleAndTemplate"
38 process.TrackRefitter.NavigationSchool = ""
39 
40 ###### MuSclFit SETTINGS ##############################################
41 
42 
43 ### MuScleFit specific configuration
44 
45 process.looper = cms.Looper(
46  "MuScleFit",
47  # Only used when reading events from a root tree
48  MaxEventsFromRootTree = cms.int32(-1),
49 
50  # Specify a file if you want to read events from a root tree in a local file.
51  # In this case the input source should be an empty source with 0 events.
52 
53  InputRootTreeFileName = cms.string(""),
54 
55  # Specify the file name where you want to save a root tree with the muon pairs.
56  # Leave empty if no file should be written.
57 
58  OutputRootTreeFileName = cms.string(""),
59 
60 
61  # Choose the kind of muons you want to run on
62  # -------------------------------------------
63  MuonLabel = cms.InputTag("TrackRefitter"),
64 
65 
66  #MuonType = cms.int32(11),
67  MuonType = cms.int32(5),
68 
69  # This line allows to switch to PAT muons. Default is false.
70  # Note that the onia selection works only with onia patTuples.
71  PATmuons = cms.untracked.bool(False),
72 
73  # ---------------- #
74  # Select resonance #
75  # ---------------- #
76  # The resonances are to be specified in this order:
77  # Z0, Y(3S), Y(2S), Y(1S), Psi(2S), J/Psi
78  # -------------------------------------------------
79  resfind = cms.vint32(1, 0, 0, 0, 0, 0),
80 
81  # Likelihood settings
82  # -------------------
83  maxLoopNumber = cms.untracked.int32(1),
84  # Select which fits to do in which loop (0 = do not, 1 = do)
85  doResolFit = cms.vint32(0),
86  doScaleFit = cms.vint32(0),
87  doBackgroundFit = cms.vint32(0),
88  doCrossSectionFit = cms.vint32(0),
89 
90  # Use the probability file or not. If not it will perform a simpler selection taking the muon pair with
91  # invariant mass closer to the pdf value and will crash if some fit is attempted.
92  UseProbsFile = cms.untracked.bool(False),
93 
94  # False = use also MC information
95  speedup = cms.bool(True),
96  # Set this to false if you do not want to use simTracks.
97  # (Note that this is skipped anyway if speedup == True).
98  compareToSimTracks = cms.bool(False),
99 
100  # Output settings
101  # ---------------
102  OutputFileName = cms.untracked.string("zmumuHisto.root"),
103 
104  # BiasType=0 means no bias to muon momenta
105  # ----------------------------------------
106  BiasType = cms.int32(0),
107  parBias = cms.vdouble(),
108 
109  # SmearType=0 means no smearing applied to muon momenta
110  # -----------------------------------------------------
111  SmearType = cms.int32(0),
112  parSmear = cms.vdouble(),
113 
114  ### taken from J/Psi #########################
115  ResolFitType = cms.int32(14),
116  parResol = cms.vdouble(0.007,0.015, -0.00077, 0.0063, 0.0018, 0.0164),
117  parResolFix = cms.vint32(0, 0, 0,0, 0,0),
118  parResolOrder = cms.vint32(0, 0, 0, 0, 0, 0),
119 
120 
121  # -------------------- #
122  # Scale fit parameters #
123  # -------------------- #
124 
125  # -----------------------------------------------------------------------------------
126  ScaleFitType = cms.int32(18),
127  parScaleOrder = cms.vint32(0, 0, 0, 0),
128  parScaleFix = cms.vint32(0, 0, 0, 0),
129  parScale = cms.vdouble(1, 1, 1, 1),
130 
131 
132 
133  # ---------------------------- #
134  # Cross section fit parameters #
135  # ---------------------------- #
136  # Note that the cross section fit works differently than the others, it
137  # fits ratios of parameters. Fix and Order should not be used as is, they
138  # are there mainly for compatibility.
139  parCrossSectionOrder = cms.vint32(0, 0, 0, 0, 0, 0),
140  parCrossSectionFix = cms.vint32(0, 0, 0, 0, 0, 0),
141  parCrossSection = cms.vdouble(1.233, 2.07, 6.33, 13.9, 2.169, 127.2),
142 
143  # ------------------------- #
144  # Background fit parameters #
145  # ------------------------- #
146 
147  # Window factors for: Z, Upsilons and (J/Psi,Psi2S) regions
148  LeftWindowBorder = cms.vdouble(70., 8., 1.391495),
149  RightWindowBorder = cms.vdouble(110., 12., 5.391495),
150 
151  # The two parameters of BgrFitType=2 are respectively:
152  # bgr fraction, (negative of) bgr exp. slope, bgr constant
153  # --------------------------------------------------------
154  # The function types for resonances in a region must be the same
155  BgrFitType = cms.vint32(2, 2, 2), # regions
156  # These empty parameters should be used when there is no background
157  parBgr = cms.vdouble(0., 0., 0., 0., 0., 0.,
158  0., 0., 0., 0., 0., 0., 0.,0., 0.,0., 0.,0.),
159  parBgrFix = cms.vint32(0, 0, 0, 0, 0, 0,
160  # The rest of the parameters is used for the resonance regions. They are automatically fixed in the code
161  # because they are never used to fit the background, but only after the rescaling.
162  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
163  parBgrOrder = cms.vint32(0, 0, 0, 0, 0, 0,
164  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
165 
166 
167  # ----------------------- #
168 
169  # Set Minuit fit strategy
170  FitStrategy = cms.int32(1),
171 
172 
173  # Fit accuracy and debug parameters
174  StartWithSimplex = cms.bool(True),
175  ComputeMinosErrors = cms.bool(False),
176  MinimumShapePlots = cms.bool(True),
177 
178  ########## TO BE ENABLED ################################
179  # Set the cuts on muons to be used in the fit
180  MinMuonPt = cms.untracked.double(0.),
181  MaxMuonPt = cms.untracked.double(1000.),
182  MinMuonEtaFirstRange = cms.untracked.double(.oO[etaminneg]Oo.),
183  MaxMuonEtaFirstRange = cms.untracked.double(.oO[etamaxneg]Oo.),
184  MinMuonEtaSecondRange = cms.untracked.double(.oO[etaminpos]Oo.),
185  MaxMuonEtaSecondRange = cms.untracked.double(.oO[etamaxpos]Oo.),
186  PileUpSummaryInfo = cms.untracked.InputTag("addPileupInfo"),
187  PrimaryVertexCollection = cms.untracked.InputTag("offlinePrimaryVertices"),
188 
189  # The following parameters can be used to filter events
190  TriggerResultsLabel = cms.untracked.string("TriggerResults"),
191  TriggerResultsProcess = cms.untracked.string("HLT"),
192  TriggerPath = cms.untracked.vstring(""),
193  # Negate the result of the trigger
194  NegateTrigger = cms.untracked.bool(False),
195  debug = cms.untracked.int32(0),
196 )
197 
198 ###### FINAL SEQUENCE ##############################################
199 
200 process.p = cms.Path(
201  process.offlineBeamSpot*process.TrackRefitter
202  )
203 
204 """
205 
206 
207 ####################################################################
208 ####################################################################
209 zMuMuScriptTemplate="""
210 #!/bin/bash
211 source /afs/cern.ch/cms/caf/setup.sh
212 
213 echo -----------------------
214 echo Job started at `date`
215 echo -----------------------
216 
217 cwd=`pwd`
218 cd .oO[CMSSW_BASE]Oo./src
219 # export SCRAM_ARCH=slc5_amd64_gcc462
220 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
221 eval `scram runtime -sh`
222 cd $cwd
223 
224 rfmkdir -p .oO[datadir]Oo.
225 
226 rfmkdir -p .oO[logdir]Oo.
227 rm -f .oO[logdir]Oo./*.stdout
228 rm -f .oO[logdir]Oo./*.stderr
229 
230 if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]] # check for interactive mode
231 then
232  rfmkdir -p .oO[workdir]Oo.
233  rm -f .oO[workdir]Oo./*
234  cd .oO[workdir]Oo.
235 else
236  mkdir -p $cwd/TkAllInOneTool
237  cd $cwd/TkAllInOneTool
238 fi
239 
240 
241 .oO[CommandLine]Oo.
242 
243 ls -lh .
244 
245 #source /afs/cern.ch/sw/lcg/external/gcc/4.8.1/x86_64-slc6/setup.sh
246 #source /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.10/x86_64-slc6-gcc48-opt/root/bin/thisroot.sh
247 
248 # cd .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit
249 # ln -fs .oO[workdir]Oo./0_zmumuHisto.root .
250 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/CompareBiasZValidation.cc .
251 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/Legend.h .
252 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitMassSlices.cc .
253 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitSlices.cc .
254 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitXslices.cc .
255 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitWithRooFit.cc .
256 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitMass1D.cc .
257 
258 root -q -b "CompareBiasZValidation.cc+(\\\"\\\")"
259 
260 
261 # mv BiasCheck.root .oO[workdir]Oo.
262 
263 # cd .oO[workdir]Oo.
264 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/tdrstyle.C .
265 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/MultiHistoOverlap_.oO[resonance]Oo..C .
266 # ln -fs /afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN2/TMP_EM/ZMuMu/data/MC/BiasCheck_DYToMuMu_Summer11_TkAlZMuMu_IDEAL.root ./BiasCheck_Reference.root
267 if [[ .oO[zmumureference]Oo. == *store* ]]; then cmsStage -f .oO[zmumureference]Oo. BiasCheck_Reference.root; else ln -fs .oO[zmumureference]Oo. ./BiasCheck_Reference.root; fi
268 root -q -b MultiHistoOverlap_.oO[resonance]Oo..C
269 
270 cmsMkdir /store/caf/user/$USER/.oO[eosdir]Oo.
271 for RootOutputFile in $(ls *root )
272 do
273  cmsStage -f ${RootOutputFile} /store/caf/user/$USER/.oO[eosdir]Oo./
274 done
275 
276 for PngOutputFile in $(ls *png ); do
277  rfcp ${PngOutputFile} .oO[datadir]Oo.
278 done
279 
280 
281 echo -----------------------
282 echo Job ended at `date`
283 echo -----------------------
284 
285 """