Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-15 22:40:11

0001 ZMuMuValidationTemplate="""
0002 compressionSettings = 207
0003 ###### MuSclFit SETTINGS  ##############################################
0004 
0005 ### MuScleFit specific configuration
0006 
0007 process.looper = cms.Looper(
0008     "MuScleFit",
0009     # Only used when reading events from a root tree
0010     MaxEventsFromRootTree = cms.int32(-1),
0011 
0012     # Specify a file if you want to read events from a root tree in a local file.
0013     # In this case the input source should be an empty source with 0 events.
0014 
0015     InputRootTreeFileName = cms.string(""),
0016 
0017     # Specify the file name where you want to save a root tree with the muon pairs.
0018     # Leave empty if no file should be written.
0019 
0020     OutputRootTreeFileName = cms.string(""),
0021 
0022 
0023     # Choose the kind of muons you want to run on
0024     # -------------------------------------------
0025     MuonLabel = cms.InputTag("TrackRefitter"),
0026 
0027 
0028     #MuonType = cms.int32(11),
0029     MuonType = cms.int32(5),
0030 
0031     # This line allows to switch to PAT muons. Default is false.
0032     # Note that the onia selection works only with onia patTuples.
0033     PATmuons = cms.untracked.bool(False),
0034 
0035     # ---------------- #
0036     # Select resonance #
0037     # ---------------- #
0038     # The resonances are to be specified in this order:
0039     # Z0, Y(3S), Y(2S), Y(1S), Psi(2S), J/Psi
0040     # -------------------------------------------------
0041     resfind = cms.vint32(
0042       int(".oO[resonance]Oo." == "Z"),
0043       int(".oO[resonance]Oo." == "Y3S"),
0044       int(".oO[resonance]Oo." == "Y2S"),
0045       int(".oO[resonance]Oo." == "Y1S"),
0046       int(".oO[resonance]Oo." == "Psi2S"),
0047       int(".oO[resonance]Oo." == "JPsi")
0048     ),
0049 
0050     # Likelihood settings
0051     # -------------------
0052     maxLoopNumber = cms.untracked.int32(1),
0053     # Select which fits to do in which loop (0 = do not, 1 = do)
0054     doResolFit =        cms.vint32(0),
0055     doScaleFit =        cms.vint32(0),
0056     doBackgroundFit =   cms.vint32(0),
0057     doCrossSectionFit = cms.vint32(0),
0058 
0059     # Use the probability file or not. If not it will perform a simpler selection taking the muon pair with
0060     # invariant mass closer to the pdf value and will crash if some fit is attempted.
0061     UseProbsFile = cms.untracked.bool(False),
0062 
0063     # False = use also MC information
0064     speedup = cms.bool(True),
0065     # Set this to false if you do not want to use simTracks.
0066     # (Note that this is skipped anyway if speedup == True).
0067     compareToSimTracks = cms.bool(False),
0068 
0069     # Output settings
0070     # ---------------
0071     # Use compressions settings of TFile
0072     # see https://root.cern.ch/root/html534/TFile.html#TFile:SetCompressionSettings
0073     # settings = 100 * algorithm + level
0074     # level is from 1 (small) to 9 (large compression)
0075     # algo: 1 (ZLIB), 2 (LMZA)
0076     # see more about compression & performance: https://root.cern.ch/root/html534/guides/users-guide/InputOutput.html#compression-and-performance
0077 
0078     OutputFileName = cms.untracked.string("zmumuHisto.root"),
0079     compressionSettings = cms.untracked.int32(compressionSettings), 
0080 
0081     # BiasType=0 means no bias to muon momenta
0082     # ----------------------------------------
0083     BiasType = cms.int32(0),
0084     parBias = cms.vdouble(),
0085 
0086     # SmearType=0 means no smearing applied to muon momenta
0087     # -----------------------------------------------------
0088     SmearType = cms.int32(0),
0089     parSmear = cms.vdouble(),
0090 
0091     ### taken from J/Psi #########################
0092 #    ResolFitType = cms.int32(14),
0093 #    parResol = cms.vdouble(0.007,0.015, -0.00077, 0.0063, 0.0018, 0.0164),
0094 #    parResolFix = cms.vint32(0, 0, 0,0, 0,0),
0095 #    parResolOrder = cms.vint32(0, 0, 0, 0, 0, 0),
0096     ResolFitType = cms.int32(0),
0097     parResol = cms.vdouble(0),
0098     parResolFix = cms.vint32(0),
0099     parResolOrder = cms.vint32(0),
0100 
0101 
0102     # -------------------- #
0103     # Scale fit parameters #
0104     # -------------------- #
0105 
0106     # -----------------------------------------------------------------------------------
0107 #    ScaleFitType = cms.int32(18),
0108 #    parScaleOrder = cms.vint32(0, 0, 0, 0),
0109 #    parScaleFix =   cms.vint32(0, 0, 0, 0),
0110 #    parScale = cms.vdouble(1, 1, 1, 1),
0111     ScaleFitType = cms.int32(0),
0112     parScaleOrder = cms.vint32(0),
0113     parScaleFix =   cms.vint32(0),
0114     parScale = cms.vdouble(0),
0115 
0116 
0117 
0118     # ---------------------------- #
0119     # Cross section fit parameters #
0120     # ---------------------------- #
0121     # Note that the cross section fit works differently than the others, it
0122     # fits ratios of parameters. Fix and Order should not be used as is, they
0123     # are there mainly for compatibility.
0124     parCrossSectionOrder = cms.vint32(0, 0, 0, 0, 0, 0),
0125     parCrossSectionFix =   cms.vint32(0, 0, 0, 0, 0, 0),
0126     parCrossSection = cms.vdouble(1.233, 2.07, 6.33, 13.9, 2.169, 127.2),
0127 
0128     # ------------------------- #
0129     # Background fit parameters #
0130     # ------------------------- #
0131 
0132     # Window factors for: Z, Upsilons and (J/Psi,Psi2S) regions
0133     LeftWindowBorder  = cms.vdouble(70., 8., 1.391495),
0134     RightWindowBorder = cms.vdouble(110., 12., 5.391495),
0135 
0136     # The two parameters of BgrFitType=2 are respectively:
0137     # bgr fraction, (negative of) bgr exp. slope, bgr constant
0138     # --------------------------------------------------------
0139     # The function types for resonances in a region must be the same
0140     BgrFitType = cms.vint32(2, 2, 2), # regions
0141     # These empty parameters should be used when there is no background
0142     parBgr = cms.vdouble(0., 0.,   0., 0.,   0., 0.,
0143                          0., 0.,   0., 0.,   0., 0.,   0.,0.,   0.,0.,   0.,0.),
0144     parBgrFix = cms.vint32(0, 0,   0, 0,   0, 0,
0145                            # The rest of the parameters is used for the resonance regions. They are automatically fixed in the code
0146                            # because they are never used to fit the background, but only after the rescaling.
0147                            1, 1,   1, 1,   1, 1,   1, 1,   1, 1,   1, 1),
0148     parBgrOrder = cms.vint32(0, 0,   0, 0,   0, 0,
0149                              0, 0,   0, 0,   0, 0,   0, 0,   0, 0,   0, 0),
0150 
0151 
0152     # ----------------------- #
0153 
0154     # Set Minuit fit strategy
0155     FitStrategy = cms.int32(1),
0156 
0157 
0158     # Fit accuracy and debug parameters
0159     StartWithSimplex = cms.bool(True),
0160     ComputeMinosErrors = cms.bool(False),
0161     MinimumShapePlots = cms.bool(True),
0162 
0163     ########## TO BE ENABLED ################################
0164     # Set the cuts on muons to be used in the fit
0165     MinMuonPt = cms.untracked.double(.oO[minpt]Oo.),
0166     MaxMuonPt = cms.untracked.double(.oO[maxpt]Oo.),
0167     MinMuonEtaFirstRange = cms.untracked.double(.oO[etaminneg]Oo.),
0168     MaxMuonEtaFirstRange = cms.untracked.double(.oO[etamaxneg]Oo.),
0169     MinMuonEtaSecondRange = cms.untracked.double(.oO[etaminpos]Oo.),
0170     MaxMuonEtaSecondRange = cms.untracked.double(.oO[etamaxpos]Oo.),
0171     PileUpSummaryInfo = cms.untracked.InputTag("addPileupInfo"),
0172     PrimaryVertexCollection = cms.untracked.InputTag("offlinePrimaryVertices"),
0173 
0174     # The following parameters can be used to filter events
0175     TriggerResultsLabel = cms.untracked.string("TriggerResults"),
0176     TriggerResultsProcess = cms.untracked.string("HLT"),
0177     TriggerPath = cms.untracked.vstring(""),
0178     # Negate the result of the trigger
0179     NegateTrigger = cms.untracked.bool(False),
0180     debug = cms.untracked.int32(0),
0181 )
0182 
0183 """
0184 
0185 
0186 ####################################################################
0187 ####################################################################
0188 LoadMuonModules = """
0189 process.load("RecoMuon.DetLayers.muonDetLayerGeometry_cfi")
0190 process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")
0191 process.load("RecoMuon.TrackingTools.MuonServiceProxy_cff")
0192 process.load("Configuration.StandardSequences.Reconstruction_cff")
0193 """
0194 
0195 
0196 ####################################################################
0197 ####################################################################
0198 ZMuMuPath = """
0199 process.p = cms.Path(
0200     process.offlineBeamSpot*process.TrackRefitter
0201     )
0202 """
0203 
0204 
0205 ####################################################################
0206 ####################################################################
0207 zMuMuScriptTemplate="""#!/bin/bash
0208 source /afs/cern.ch/cms/caf/setup.sh
0209 export X509_USER_PROXY=.oO[scriptsdir]Oo./.user_proxy
0210 
0211 echo  -----------------------
0212 echo  Job started at `date`
0213 echo  -----------------------
0214 
0215 cwd=`pwd`
0216 cd .oO[CMSSW_BASE]Oo./src
0217 export SCRAM_ARCH=.oO[SCRAM_ARCH]Oo.
0218 eval `scram runtime -sh`
0219 cd $cwd
0220 
0221 mkdir -p .oO[datadir]Oo.
0222 mkdir -p .oO[workingdir]Oo.
0223 mkdir -p .oO[logdir]Oo.
0224 rm -f .oO[logdir]Oo./*.stdout
0225 rm -f .oO[logdir]Oo./*.stderr
0226 
0227 if [[ $HOSTNAME = lxplus[0-9]*[.a-z0-9]* ]] # check for interactive mode
0228 then
0229     mkdir -p .oO[workdir]Oo.
0230     rm -f .oO[workdir]Oo./*
0231     cd .oO[workdir]Oo.
0232 else
0233     mkdir -p $cwd/TkAllInOneTool
0234     cd $cwd/TkAllInOneTool
0235 fi
0236 
0237 
0238 .oO[CommandLine]Oo.
0239 
0240 ls -lh .
0241 
0242 cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/CompareBias.oO[resonance]Oo.Validation.cc .
0243 cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/Legend.h .
0244 cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitMassSlices.cc .
0245 cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitSlices.cc .
0246 cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitXslices.cc .
0247 cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitWithRooFit.cc .
0248 cp .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/FitMass1D.cc .
0249 
0250 root -q -b -l "CompareBias.oO[resonance]Oo.Validation.cc+(.oO[rebinphi]Oo., .oO[rebinetadiff]Oo., .oO[rebineta]Oo., .oO[rebinpt]Oo.)"
0251 
0252 cp  .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/tdrstyle.C .
0253 cp  .oO[MuonAnalysis/MomentumScaleCalibration]Oo./test/Macros/RooFit/MultiHistoOverlap_.oO[resonance]Oo..C .
0254 
0255 if [[ .oO[zmumureference]Oo. == *store* ]]; then xrdcp -f .oO[zmumureference]Oo. BiasCheck_Reference.root; else ln -fs .oO[zmumureference]Oo. ./BiasCheck_Reference.root; fi
0256 root -q -b -l MultiHistoOverlap_.oO[resonance]Oo..C
0257 
0258 eos mkdir -p /store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/
0259 for RootOutputFile in $(ls *root )
0260 do
0261     xrdcp -f ${RootOutputFile}  root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./
0262     cp ${RootOutputFile}  .oO[workingdir]Oo.
0263 done
0264 
0265 mkdir -p .oO[plotsdir]Oo.
0266 for PngOutputFile in $(ls *png ); do
0267     xrdcp -f ${PngOutputFile}  root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./plots/
0268     cp ${PngOutputFile}  .oO[plotsdir]Oo.
0269 done
0270 
0271 
0272 echo  -----------------------
0273 echo  Job ended at `date`
0274 echo  -----------------------
0275 
0276 """
0277 
0278 ######################################################################
0279 ######################################################################
0280 
0281 mergeZmumuPlotsExecution="""
0282 #merge Z->mumu histograms
0283 
0284 cp .oO[mergeZmumuPlotsScriptPath]Oo. .
0285 root -l -x -b -q TkAlMergeZmumuPlots.C++
0286 
0287 """
0288 
0289 ######################################################################
0290 ######################################################################
0291 
0292 mergeZmumuPlotsTemplate="""
0293 #include "MuonAnalysis/MomentumScaleCalibration/test/Macros/RooFit/MultiHistoOverlapAll_.oO[resonance]Oo..C"
0294 #include <sstream>
0295 #include <vector>
0296 
0297 template <typename T> string separatebycommas(vector<T> v){
0298   if (v.size()==0) return "";
0299   stringstream s;
0300   s << v[0];
0301   for (unsigned int i = 1; i < v.size(); i++) s << "," << v[i];
0302   return s.str();
0303 }
0304 
0305 void TkAlMergeZmumuPlots(){
0306   vector<string> filenames; vector<string> titles; vector<int> colors; vector<int> linestyles;
0307 
0308 .oO[PlottingInstantiation]Oo.
0309 
0310   vector<int> linestyles_new, markerstyles_new;
0311   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); }
0312 
0313   TkAlStyle::legendheader = ".oO[legendheader]Oo.";
0314   TkAlStyle::set(.oO[publicationstatus]Oo., .oO[era]Oo., ".oO[customtitle]Oo.", ".oO[customrighttitle]Oo.");
0315 
0316   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.);
0317 }
0318 """