Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:45

0001 #!/usr/bin/env python
0002 
0003 """ This is script runs all the macros in the local Macros dir
0004 """
0005 
0006 def arguments(comp, resType = "Z", firstFile = "0", secondFile = "1") :
0007     if( comp == "Pt" ) :
0008         name = "pt"
0009     elif( comp == "Eta" ) :
0010         name = "eta"
0011     elif( comp == "PhiPlus" ) :
0012         name = "phiPlus"
0013     elif( comp == "PhiMinus" ) :
0014         name = "phiMinus"
0015     else :
0016         print "Error"
0017         return ""
0018     if( resType == "Z" ) :
0019         fitType = "2"
0020     else :
0021         fitType = "1"
0022     return "\"hRecBestResVSMu_MassVS"+comp+"\", \"hGenResVSMu_MassVS"+comp+"\", \""+firstFile+"_MuScleFit.root\", \""+secondFile+"_MuScleFit.root\", \"Resonance mass vs "+name+"\", \""+resType+"\", 4, 4, "+fitType+", \"filegraph_"+name+".root\""
0023 
0024 import os
0025 
0026 from ROOT import gROOT
0027 
0028 firstFile = "\"0\""
0029 secondFile = "\"3\""
0030 resonanceType = "Z"
0031 massProbablityName = "Z"
0032 
0033 macrosDir = os.popen("echo $CMSSW_BASE", "r").read().strip()
0034 macrosDir += "/src/MuonAnalysis/MomentumScaleCalibration/test/Macros/"
0035 
0036 print macrosDir+"Run.C"
0037 
0038 # Mass vs pt, eta, phi
0039 # --------------------
0040 gROOT.ProcessLine(".L "+macrosDir+"fit2DProj.C+");
0041 fileNum1 = firstFile.strip("\"")
0042 fileNum2 = secondFile.strip("\"")
0043 gROOT.ProcessLine( "macroPlot("+arguments("Pt", resonanceType, fileNum1, fileNum2)+", false)" )
0044 gROOT.ProcessLine( "macroPlot("+arguments("Eta", resonanceType, fileNum1, fileNum2)+", false)" )
0045 gROOT.ProcessLine( "macroPlot("+arguments("PhiPlus", resonanceType, fileNum1, fileNum2)+", false)" )
0046 gROOT.ProcessLine( "macroPlot("+arguments("PhiMinus", resonanceType, fileNum1, fileNum2)+", false)" )
0047 
0048 # Resolution
0049 # ----------
0050 # The second parameter is a bool defining whether it should do half eta
0051 # The third parameter is an integer defining the minimum number of entries required to perform a fit
0052 gROOT.ProcessLine(".x "+macrosDir+"ResolDraw.cc+("+firstFile+", false, 100)")
0053 gROOT.ProcessLine(".x "+macrosDir+"ResolDraw.cc+("+secondFile+", false, 100)")
0054 gROOT.ProcessLine(".x "+macrosDir+"ResolCompare.cc("+firstFile+", "+secondFile+", true)")
0055 # os.system("root -l "+macrosDir+"ResolCompare.cc")
0056 
0057 # Pt reco vs Pt gen
0058 gROOT.ProcessLine(".x "+macrosDir+"CompareRecoGenPt.C+("+firstFile+", "+secondFile+")")
0059 
0060 # Mass vs mass probability. The last value is the rebin of the mass histogram
0061 gROOT.ProcessLine(".x "+macrosDir+"Plot_mass.C+("+firstFile+", "+secondFile+", 1)")
0062 gROOT.ProcessLine(".x "+macrosDir+"ShowMassComparison.C+(\""+massProbablityName+"\")")
0063 # os.system("root -l "+macrosDir+"ShowMassComparison.C")