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
##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) #elif t == 'data':
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 '----------------' 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()