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 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 
121 
122  # -------------------- #
123  # Scale fit parameters #
124  # -------------------- #
125 
126  # -----------------------------------------------------------------------------------
127  ScaleFitType = cms.int32(18),
128  parScaleOrder = cms.vint32(0, 0, 0, 0),
129  parScaleFix = cms.vint32(0, 0, 0, 0),
130  parScale = cms.vdouble(1, 1, 1, 1),
131 
132 
133 
134  # ---------------------------- #
135  # Cross section fit parameters #
136  # ---------------------------- #
137  # Note that the cross section fit works differently than the others, it
138  # fits ratios of parameters. Fix and Order should not be used as is, they
139  # are there mainly for compatibility.
140  parCrossSectionOrder = cms.vint32(0, 0, 0, 0, 0, 0),
141  parCrossSectionFix = cms.vint32(0, 0, 0, 0, 0, 0),
142  parCrossSection = cms.vdouble(1.233, 2.07, 6.33, 13.9, 2.169, 127.2),
143 
144  # ------------------------- #
145  # Background fit parameters #
146  # ------------------------- #
147 
148  # Window factors for: Z, Upsilons and (J/Psi,Psi2S) regions
149  LeftWindowBorder = cms.vdouble(70., 8., 1.391495),
150  RightWindowBorder = cms.vdouble(110., 12., 5.391495),
151 
152  # The two parameters of BgrFitType=2 are respectively:
153  # bgr fraction, (negative of) bgr exp. slope, bgr constant
154  # --------------------------------------------------------
155  # The function types for resonances in a region must be the same
156  BgrFitType = cms.vint32(2, 2, 2), # regions
157  # These empty parameters should be used when there is no background
158  parBgr = cms.vdouble(0., 0., 0., 0., 0., 0.,
159  0., 0., 0., 0., 0., 0., 0.,0., 0.,0., 0.,0.),
160  parBgrFix = cms.vint32(0, 0, 0, 0, 0, 0,
161  # The rest of the parameters is used for the resonance regions. They are automatically fixed in the code
162  # because they are never used to fit the background, but only after the rescaling.
163  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
164  parBgrOrder = cms.vint32(0, 0, 0, 0, 0, 0,
165  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
166 
167 
168  # ----------------------- #
169 
170  # Set Minuit fit strategy
171  FitStrategy = cms.int32(1),
172 
173 
174  # Fit accuracy and debug parameters
175  StartWithSimplex = cms.bool(True),
176  ComputeMinosErrors = cms.bool(False),
177  MinimumShapePlots = cms.bool(True),
178 
179  ########## TO BE ENABLED ################################
180  # Set the cuts on muons to be used in the fit
181  MinMuonPt = cms.untracked.double(0.),
182  MaxMuonPt = cms.untracked.double(1000.),
183  MinMuonEtaFirstRange = cms.untracked.double(.oO[etaminneg]Oo.),
184  MaxMuonEtaFirstRange = cms.untracked.double(.oO[etamaxneg]Oo.),
185  MinMuonEtaSecondRange = cms.untracked.double(.oO[etaminpos]Oo.),
186  MaxMuonEtaSecondRange = cms.untracked.double(.oO[etamaxpos]Oo.),
187  PileUpSummaryInfo = cms.untracked.InputTag("addPileupInfo"),
188  PrimaryVertexCollection = cms.untracked.InputTag("offlinePrimaryVertices"),
189 
190  # The following parameters can be used to filter events
191  TriggerResultsLabel = cms.untracked.string("TriggerResults"),
192  TriggerResultsProcess = cms.untracked.string("HLT"),
193  TriggerPath = cms.untracked.vstring(""),
194  # Negate the result of the trigger
195  NegateTrigger = cms.untracked.bool(False),
196  debug = cms.untracked.int32(0),
197 )
198 
199 ###### FINAL SEQUENCE ##############################################
200 
201 process.p = cms.Path(
202  process.offlineBeamSpot*process.TrackRefitter
203  )
204 
205 """
206 
207 
208 ####################################################################
209 ####################################################################
210 zMuMuScriptTemplate="""
211 #!/bin/bash
212 source /afs/cern.ch/cms/caf/setup.sh
213 
214 echo -----------------------
215 echo Job started at `date`
216 echo -----------------------
217 
218 cwd=`pwd`
219 cd .oO[CMSSW_BASE]Oo./src
220 # export SCRAM_ARCH=slc5_amd64_gcc462
221 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
222 eval `scram runtime -sh`
223 cd $cwd
224 
225 rfmkdir -p .oO[datadir]Oo.
226 
227 rfmkdir -p .oO[logdir]Oo.
228 rm -f .oO[logdir]Oo./*.stdout
229 rm -f .oO[logdir]Oo./*.stderr
230 
231 if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]] # check for interactive mode
232 then
233  rfmkdir -p .oO[workdir]Oo.
234  rm -f .oO[workdir]Oo./*
235  cd .oO[workdir]Oo.
236 else
237  mkdir -p $cwd/TkAllInOneTool
238  cd $cwd/TkAllInOneTool
239 fi
240 
241 
242 .oO[CommandLine]Oo.
243 
244 ls -lh .
245 
246 source /afs/cern.ch/sw/lcg/external/gcc/4.8.1/x86_64-slc6/setup.sh
247 source /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.10/x86_64-slc6-gcc48-opt/root/bin/thisroot.sh
248 
249 # cd .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit
250 # ln -fs .oO[workdir]Oo./0_zmumuHisto.root .
251 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/CompareBiasZValidation.cc .
252 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/Legend.h .
253 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitMassSlices.cc .
254 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitSlices.cc .
255 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitXslices.cc .
256 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitWithRooFit.cc .
257 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/FitMass1D.cc .
258 
259 root -q -b "CompareBiasZValidation.cc+(\\\"\\\")"
260 
261 
262 # mv BiasCheck.root .oO[workdir]Oo.
263 
264 # cd .oO[workdir]Oo.
265 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/tdrstyle.C .
266 cp .oO[CMSSW_BASE]Oo./src/MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/MultiHistoOverlap_.oO[resonance]Oo..C .
267 # ln -fs /afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN2/TMP_EM/ZMuMu/data/MC/BiasCheck_DYToMuMu_Summer11_TkAlZMuMu_IDEAL.root ./BiasCheck_Reference.root
268 if [[ .oO[zmumureference]Oo. == *store* ]]; then cmsStage -f .oO[zmumureference]Oo. BiasCheck_Reference.root; else ln -fs .oO[zmumureference]Oo. ./BiasCheck_Reference.root; fi
269 root -q -b MultiHistoOverlap_.oO[resonance]Oo..C
270 
271 cmsMkdir /store/caf/user/$USER/.oO[eosdir]Oo.
272 for RootOutputFile in $(ls *root )
273 do
274  cmsStage -f ${RootOutputFile} /store/caf/user/$USER/.oO[eosdir]Oo./
275 done
276 
277 for PngOutputFile in $(ls *png ); do
278  rfcp ${PngOutputFile} .oO[datadir]Oo.
279 done
280 
281 
282 echo -----------------------
283 echo Job ended at `date`
284 echo -----------------------
285 
286 """