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("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.MagneticField_cff")
25 process.load("Configuration.StandardSequences.Reconstruction_cff")
26 process.load("Configuration.StandardSequences.Geometry_cff")
27 
28 ########### DATABASE conditions ############################
29 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
30 process.GlobalTag.globaltag = ".oO[GlobalTag]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 
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 
187  # The following parameters can be used to filter events
188  TriggerResultsLabel = cms.untracked.string("TriggerResults"),
189  TriggerResultsProcess = cms.untracked.string("HLT"),
190  TriggerPath = cms.untracked.vstring(""),
191  # Negate the result of the trigger
192  NegateTrigger = cms.untracked.bool(False),
193  debug = cms.untracked.int32(0),
194 )
195 
196 ###### FINAL SEQUENCE ##############################################
197 
198 process.p = cms.Path(
199  process.offlineBeamSpot*process.TrackRefitter
200  )
201 
202 """
203 
204 
205 ####################################################################
206 ####################################################################
207 zMuMuScriptTemplate="""
208 #!/bin/bash
209 source /afs/cern.ch/cms/caf/setup.sh
210 
211 echo -----------------------
212 echo Job started at `date`
213 echo -----------------------
214 
215 cwd=`pwd`
216 cd .oO[CMSSW_BASE]Oo./src
217 # export SCRAM_ARCH=slc5_amd64_gcc462
218 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
219 eval `scram runtime -sh`
220 cd $cwd
221 
222 rfmkdir -p .oO[datadir]Oo.
223 
224 rfmkdir -p .oO[logdir]Oo.
225 rm -f .oO[logdir]Oo./*.stdout
226 rm -f .oO[logdir]Oo./*.stderr
227 
228 if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]] # check for interactive mode
229 then
230  rfmkdir -p .oO[workdir]Oo.
231  rm -f .oO[workdir]Oo./*
232  cd .oO[workdir]Oo.
233 else
234  mkdir -p $cwd/TkAllInOneTool
235  cd $cwd/TkAllInOneTool
236 fi
237 
238 
239 .oO[CommandLine]Oo.
240 
241 ls -lh .
242 
243 source /afs/cern.ch/sw/lcg/external/gcc/4.6.2/x86_64-slc5/setup.sh
244 source /afs/cern.ch/sw/lcg/app/releases/ROOT/5.32.00/x86_64-slc5-gcc46-opt/root/bin/thisroot.sh
245 
246 # cd .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit
247 # ln -fs .oO[workdir]Oo./0_zmumuHisto.root .
248 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/CompareBiasZValidation.cc .
249 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/Legend.h .
250 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitMassSlices.cc .
251 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitSlices.cc .
252 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitXslices.cc .
253 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitWithRooFit.cc .
254 
255 root -q -b "CompareBiasZValidation.cc+(\\\"\\\")"
256 
257 
258 # mv BiasCheck.root .oO[workdir]Oo.
259 
260 # cd .oO[workdir]Oo.
261 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/tdrstyle.C .
262 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/MultiHistoOverlap_.oO[resonance]Oo..C .
263 # ln -fs /afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN2/TMP_EM/ZMuMu/data/MC/BiasCheck_DYToMuMu_Summer11_TkAlZMuMu_IDEAL.root ./BiasCheck_Reference.root
264 ln -fs .oO[zmumureference]Oo. ./BiasCheck_Reference.root
265 root -q -b MultiHistoOverlap_.oO[resonance]Oo..C
266 
267 cmsMkdir /store/caf/user/$USER/.oO[eosdir]Oo.
268 for RootOutputFile in $(ls *root )
269 do
270  cmsStage -f ${RootOutputFile} /store/caf/user/$USER/.oO[eosdir]Oo./
271 done
272 
273 for PngOutputFile in $(ls *png ); do
274  rfcp ${PngOutputFile} .oO[datadir]Oo.
275 done
276 
277 
278 echo -----------------------
279 echo Job ended at `date`
280 echo -----------------------
281 
282 """