def __init__(self): path = os.path.join(os.path.dirname(__file__), 'CombinedMethod_ScaleFactors_RecoIdIsoSip.root') self.e_rtfile = rt.TFile(path, 'READ') self.e_hist = self.e_rtfile.Get("h_electronScaleFactor_RecoIdIsoSip") path = os.path.join(os.path.dirname(__file__), 'MuonScaleFactors_2011_2012.root') self.m_rtfile = rt.TFile(path, 'READ') self.m_hist = self.m_rtfile.Get("TH2D_ALL_2012") self.muPOGId = MuonPOGCorrections.make_muon_pog_PFTight_2012() self.muPOGIso = MuonPOGCorrections.make_muon_pog_PFRelIsoDB012_2012() m_id_file = open(os.path.join(os.path.dirname(__file__),'MuonEfficiencies_Run2012ReReco_53X.pkl'),'r') self.m_id_dict = pickle.load(m_id_file) m_iso_file = open(os.path.join(os.path.dirname(__file__),'MuonEfficiencies_ISO_Run_2012ReReco_53X.pkl'),'r') self.m_iso_dict = pickle.load(m_iso_file)
#### MC-DATA and PU corrections ################################################ ################################################################################ # Determine MC-DATA corrections is7TeV = bool('7TeV' in os.environ['jobid']) print "Is 7TeV:", is7TeV # Make PU corrector from expected data PU distribution # PU corrections .root files from pileupCalc.py pu_distributions = glob.glob( os.path.join('inputs', os.environ['jobid'], 'data_DoubleMu*pu.root')) pu_corrector = PileupWeight.PileupWeight('S6' if is7TeV else 'S7', *pu_distributions) muon_pog_PFTight_2011 = MuonPOGCorrections.make_muon_pog_PFTight_2011() muon_pog_PFTight_2012 = MuonPOGCorrections.make_muon_pog_PFTight_2012() muon_pog_PFRelIsoDB02_2011 = MuonPOGCorrections.make_muon_pog_PFRelIsoDB02_2011( ) muon_pog_PFRelIsoDB02_2012 = MuonPOGCorrections.make_muon_pog_PFRelIsoDB02_2012( ) muon_pog_Mu17Mu8_Mu17_2012 = MuonPOGCorrections.make_muon_pog_Mu17Mu8_Mu17_2012( ) muon_pog_Mu17Mu8_Mu8_2012 = MuonPOGCorrections.make_muon_pog_Mu17Mu8_Mu8_2012() # takes etas of muons muon_pog_Mu17Mu8_2011 = MuonPOGCorrections.muon_pog_Mu17Mu8_eta_eta_2011 # Get object ID and trigger corrector functions
################################################################################ #### MC-DATA and PU corrections ################################################ ################################################################################ # Determine MC-DATA corrections is7TeV = bool("7TeV" in os.environ["jobid"]) print "Is 7TeV:", is7TeV # Make PU corrector from expected data PU distribution # PU corrections .root files from pileupCalc.py pu_distributions = glob.glob(os.path.join("inputs", os.environ["jobid"], "data_DoubleMu*pu.root")) pu_corrector = PileupWeight.PileupWeight("S6" if is7TeV else "S7", *pu_distributions) muon_pog_PFTight_2011 = MuonPOGCorrections.make_muon_pog_PFTight_2011() muon_pog_PFTight_2012 = MuonPOGCorrections.make_muon_pog_PFTight_2012() muon_pog_PFRelIsoDB02_2011 = MuonPOGCorrections.make_muon_pog_PFRelIsoDB02_2011() muon_pog_PFRelIsoDB02_2012 = MuonPOGCorrections.make_muon_pog_PFRelIsoDB02_2012() muon_pog_Mu17Mu8_Mu17_2012 = MuonPOGCorrections.make_muon_pog_Mu17Mu8_Mu17_2012() muon_pog_Mu17Mu8_Mu8_2012 = MuonPOGCorrections.make_muon_pog_Mu17Mu8_Mu8_2012() # takes etas of muons muon_pog_Mu17Mu8_2011 = MuonPOGCorrections.muon_pog_Mu17Mu8_eta_eta_2011 # Get object ID and trigger corrector functions def mc_corrector_2011(row): if row.run > 2: return 1 pu = pu_corrector(row.nTruePU)