Beispiel #1
0
    def makePlots(n, r, s, t):
        hrList = []
        for sys in sysList:
            #All the rest will be within the json file
            print t
            if sys != 'nominal':
                file_ = '%s/Efficiency%s_%s_%s/%s_%sid%s_%s/%s' % (
                    path_in[1], n, r, sys, t.upper(), t, r, sys, s)
            else:
                file_ = '%s/Efficiency%s_%s/%s_%sid%s/%s' % (
                    path_in[0], n, r, t.upper(), t, r, s)
            print 'file_ is', file_
            hr = HistoReader('RUN%s_%s%s%s' % (r, n, t, sys))
            hr.readfile(file_)
            hr.SetNewRange(20, 120)
            hr.setInfo(sys)
            hr.CleanBigError(0.01)
            hr.setType(t)
            hrList.append(hr)

        hp = HistoPloter('.')
        ##Uncomment next line to have only min, max variations
        hp.MinMax = True
        hp.setRatioRange(0.98,
                         1.02)  #Set the ratio range. Default one is 0.85, 1.15
        hp.PlotEff1D(hrList)  #making the 1D plot
    def makePlots(n, r, s, t):
        hrList = []
        for sys in sysList:
            #All the rest will be within the json file
            print t
            file_ = '%s/Efficiency%s_%s_%s/%s_%sid%s_%s/%s' % (
                path_in, n, r, sys, t.upper(), t, r, sys, s)
            print 'file_ is', file_
            hr = HistoReader('%s%s%s' % (n, t, sys))
            hr.readfile(file_)
            hr.SetNewRange(20, 120)
            hr.setInfo(sys)
            hr.CleanBigError(0.01)
            hr.setType(t)
            hrList.append(hr)

        hp = HistoPloter('.')
        hp.setRatioRange(0.98,
                         1.02)  #Set the ratio range. Default one is 0.85, 1.15
        hp.PlotEff1D(hrList)  #making the 1D plot
                MapList = []
                ##All the rest will be within the json file
                #outputJSONname ='RunBCDEF_%s_%s'%(t,n)
                #j = JsonMaker(outputJSONname)
                #r_ = RootFileMaker(outputJSONname)
                MapList = []
                for s in NumDic[n]:
                    #Contains hr from Run BC, DE and F that will be summed up at the end
                    hrList = []
                    for r in Run:
                        file_ = '%s/Efficiency%s_%s_%s/%s_%sid%s_%s/%s' % (
                            path_in, n, r, sys, t.upper(), t, r, sys, s)
                        hr = HistoReader('hr')
                        hr.setInfo(sys + ' ' + t)
                        hr.readfile(file_)
                        hr.SetNewRange(20, 120)
                        hr.setLumi(LumiDic[r])
                        #hr.CleanBigError(0.05)
                        hr.setType(t)
                        hrList.append(hr)

                    #lumi sum of all the hr
                    hr0 = hrList[0]
                    for hr in hrList[1:]:
                        hr0.Sum(hr)

                    MapList.append(hr0.eff2D)

                    ##For SF
                    #if t == 'mc':
                    #    MC_MapList.append(hr0.eff2D)
Beispiel #4
0
    #Test 2D map
    ########
    fileBC = '/afs/cern.ch/user/f/fernanpe/public/for_Gael/Efficiencies_2017/EfficiencyID_BC/DATA_dataidBC/' + Id
    hr_dataBC = HistoReader('DataBC')
    hr_dataBC.readfile(fileBC)

    print 'Initial map'
    print '----------------'
    eff2D = hr_dataBC.eff2D
    eff2D.Print()
    eff2D.Print('up')
    eff2D.Print('down')

    print 'After Changing Range'
    print '----------------'
    hr_dataBC.SetNewRange(20, 90)
    eff2D = hr_dataBC.eff2D
    eff2D.Print()
    eff2D.Print('up')
    eff2D.Print('down')

    print 'After removing errors below 1%'
    print '----------------'
    hr_dataBC.CleanBigError(0.01)
    eff2D = hr_dataBC.eff2D
    eff2D.Print()
    eff2D.Print('up')
    eff2D.Print('down')

    print 'Other run'
    print '----------------'
            for s in NumDic[n]:
                #All the rest will be within the json file
                DATA_hr = None
                MC_hr = None
                for t in Type:
                    if n == 'ISO':
                        file_ = '/afs/cern.ch/work/g/gaperrin/private/TnP/TnP_Muon/CMSSW_9_4_0_pre3/src/MuonAnalysis/TagAndProbe/test/zmumu/Efficiency%s_%s/%s_%sid%s/%s'%(n,r,t.upper(),t,r,s)
                    elif n == 'DOUBLETRIGG':
                        file_ = '/afs/cern.ch/work/g/gaperrin/private/TnP/TnP_Muon/CMSSW_9_4_0/src/cmssw/PhysicsTools/TagAndProbe/test/zmumu/DoubleTriggerSF/EfficiencyEfficiencyTrigg_test/%s_%s_2017/%s'%(t.upper(),t,s)
                    elif n == 'TRIGG': 
                        file_ = '/afs/cern.ch/work/g/gaperrin/private/TnP/TnP_Muon/CMSSW_9_4_0/src/cmssw/PhysicsTools/TagAndProbe/test/zmumu/Iso0p06/%s'%file_dic[t]
                    print 'file is', file_
                    hr = HistoReader('%s%s'%(t,r))
                    hr.readfile(file_)     
                    #hr.SetNewRange(20, 120) 
                    hr.SetNewRange(20, 200) 
                    hr.setInfo(r)         
                    hr.CleanBigError(0.01)  
                    hr.setType(t)      
                    print hr.EffList
                    #For SF
                    if t == 'mc':
                        MC_hr = hr
                    elif t == 'data':
                        DATA_hr = hr
                        print 'yeah baby'
                print DATA_hr.EffList


                hp = HistoPloter('.')
                hp.setEffRange(0.5,1.2)