예제 #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
예제 #2
0
    def makePlots(n, r, s, t):
        hrList = []
        for sys in sysList:
            #All the rest will be within the json file
            print t
            path = ''
            if sys == 'nominal':
                path = path_in[0]
            else:
                path = path_in[1]

            if not 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)
                file_ = '%s/%s/%s_%s_all/%s' % (path, sysDic[sys], t.upper(),
                                                t, s)
            else:
                #file_ = '%s/Efficiency%s_%s/%s_%sid%s/%s'%(path_in[0],n,r,t.upper(),t,r,s)
                file_ = '%s/EfficiencyRun2017B_F/%s_%s_all/%s' % (
                    path, t.upper(), t, s)
            print 'file_ is', file_
            #sys_.exit()
            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
        print 'hrList is', hrList
예제 #3
0
 def Gethr(lumi, run, file, name, info):
     ''' retrieve historeader for a single efficiency'''
     hr = HistoReader(name)
     hr.setInfo(info)
     hr.readfile(file)
     hr.setLumi(lumi)
     hr.setType(info)
     return hr
    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
예제 #5
0
            DATA_MapList = []
            SFoutputJSONname ='RunBCDEF_%s_%s_%s'%('SF',n, r)
            jSF = JsonMaker(SFoutputJSONname)
            rSF = RootFileMaker(SFoutputJSONname)
            for t in Type:
                #All the rest will be within the json file
                outputJSONname ='RunBCDEF_%s_%s_%s_%s'%('Eff',t,n,r)
                MapList = []
                j = JsonMaker(outputJSONname)
                r_ = RootFileMaker(outputJSONname)
                for s in NumDic[n]:
                    file_ = '/eos/cms/store/group/phys_muon/fernanpe/Efficiencies_LegacyReReco2016_final/Efficiency%s_BCDEF_%s/%s_%sid_BCDEF/%s'%(n,r,t.upper(),t,s)
                    hr = HistoReader('hr')
                    hr.readfile(file_)     
#                    hr.SetNewRange(20, 120) 
                    hr.setInfo('dummy')         
                    hr.CleanBigError(0.01)  
                    hr.setType(t)      
                    MapList.append(hr.eff2D)

                    #For SF
                    if t == 'mc':
                        MC_MapList.append(hr.eff2D)
                    elif t == 'data':
                        DATA_MapList.append(hr.eff2D)

                #For DATA, MC
                j.makeJSON(MapList)
                r_.makeROOT(MapList)

            #For SF
            sysSFMapList[sys] = {}
            for t in Type:
                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
예제 #7
0
    #########
    #Provide Plots separetly for run BCDEF
    #########
    for n in Num:
        for s in NumDic[n]:
            DATA_hrList = []
            MC_hrList = []
            for r in Run:
                #All the rest will be within the json file
                for t in Type:
                    file_ = '/afs/cern.ch/user/f/fernanpe/public/for_Gael/Efficiencies_2017/Efficiency%s_%s/%s_%sid%s/%s' % (
                        n, r, t.upper(), t, r, s)
                    hr = HistoReader('%s%s' % (t, r))
                    hr.readfile(file_)
                    hr.SetNewRange(20, 120)
                    hr.setInfo(r)
                    hr.CleanBigError(0.01)
                    hr.setLumi(LumiDic[r])
                    hr.setType(t)
                    #For SF
                    if t == 'mc':
                        MC_hrList.append(hr)
                    elif t == 'data':
                        DATA_hrList.append(hr)

            DATA_hr = DATA_hrList[0]
            MC_hr = MC_hrList[0]
            for d in DATA_hrList[1:]:
                DATA_hr.Sum(d)

            for d in MC_hrList[1:]:
예제 #8
0
    print '----------------'
    hr_dataBC.CleanBigError(0.01)
    eff2D = hr_dataBC.eff2D
    eff2D.Print()
    eff2D.Print('up')
    eff2D.Print('down')

    print 'Other run'
    print '----------------'
    fileDE = '/afs/cern.ch/user/f/fernanpe/public/for_Gael/Efficiencies_2017/EfficiencyID_DE/DATA_dataidDE/' + Id
    hr_dataDE = HistoReader('DataDE')
    hr_dataDE.readfile(fileDE)
    hr_dataDE.SetNewRange(20, 90)
    hr_dataDE.CleanBigError(0.01)
    hr_dataDE.setLumi(10)
    hr_dataDE.setInfo('DE')
    hr_dataDE.setType('data')
    eff2D = hr_dataDE.eff2D
    eff2D.Print()
    eff2D.Print('up')
    eff2D.Print('down')

    print 'Afer added other run (lumi-rew)'
    print '----------------'
    hr_dataBC.setLumi(10)
    hr_dataBC.setInfo('BC')
    hr_dataBC.setType('data')
    hr_dataBC.Sum(hr_dataDE)
    eff2D = hr_dataBC.eff2D
    eff2D.Print()
    eff2D.Print('up')