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