![]() |
![]() |
Public Member Functions | |
def | __init__ (self, fn_hf, fn_lf) |
def | calcEventWeight (self, jets, kind, systematic) |
def | calcJetWeight (self, jet, kind, systematic) |
def | calcJetWeightImpl (self, pt, aeta, fl, csv, kind, systematic) |
def | getBin (self, bvec, val) |
def | getHistosFromFile (self, fn) |
def | init (self, fn_hf, fn_lf) |
Public Attributes | |
btag | |
eta_bins_hf | |
eta_bins_lf | |
pdfs | |
pt_bins_hf | |
pt_bins_lf | |
systematics_for_b | |
systematics_for_c | |
systematics_for_l | |
Calculates the jet and event correction factor as a weight based on the b-tagger shape-dependent data/mc corrections. Currently, the recipe is only described in https://twiki.cern.ch/twiki/bin/viewauth/CMS/TTbarHbbRun2ReferenceAnalysis#Applying_CSV_weights In short, jet-by-jet correction factors as a function of pt, eta and CSV have been derived. This code accesses the flavour of MC jets and gets the correct weight histogram corresponding to the pt, eta and flavour of the jet. From there, the per-jet weight is just accessed according to the value of the discriminator.
Definition at line 5 of file BTagWeightCalculator.py.
def BTagWeightCalculator.BTagWeightCalculator.__init__ | ( | self, | |
fn_hf, | |||
fn_lf | |||
) |
Definition at line 17 of file BTagWeightCalculator.py.
def BTagWeightCalculator.BTagWeightCalculator.calcEventWeight | ( | self, | |
jets, | |||
kind, | |||
systematic | |||
) |
The per-event weight is just a product of per-jet weights.
Definition at line 180 of file BTagWeightCalculator.py.
References BTagWeightCalculator.BTagWeightCalculator.calcJetWeight().
def BTagWeightCalculator.BTagWeightCalculator.calcJetWeight | ( | self, | |
jet, | |||
kind, | |||
systematic | |||
) |
Calculates the per-jet correction factor. jet: either an object with the attributes pt, eta, mcFlavour, self.btag or a Heppy Jet kind: string specifying the name of the corrections. Usually "final". systematic: the correction systematic, e.g. "nominal", "JESUp", etc
Definition at line 108 of file BTagWeightCalculator.py.
References funct.abs(), BTagWeightCalculator.BTagWeightCalculator.btag, and BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcEventWeight().
def BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl | ( | self, | |
pt, | |||
aeta, | |||
fl, | |||
csv, | |||
kind, | |||
systematic | |||
) |
Definition at line 131 of file BTagWeightCalculator.py.
References BTagWeightCalculator.BTagWeightCalculator.eta_bins_hf, BTagWeightCalculator.BTagWeightCalculator.eta_bins_lf, DQMChannel.getBin(), hcaldqm::quantity::Quantity.getBin(), BTagWeightCalculator.BTagWeightCalculator.getBin(), CentralityBins.getBin(), hcaldqm::quantity::DetectorQuantity.getBin(), hcaldqm::quantity::TrigTowerQuantity.getBin(), hcaldqm::quantity::ElectronicsQuantity.getBin(), Rivet::HiggsTemplateCrossSections.getBin(), hcaldqm::quantity::FEDQuantity.getBin(), hcaldqm::quantity::FlagQuantity.getBin(), hcaldqm::quantity::LumiSection.getBin(), hcaldqm::quantity::CrateQuantity.getBin(), hcaldqm::quantity::LumiSectionCoarse.getBin(), hcaldqm::quantity::RunNumber.getBin(), hcaldqm::quantity::EventType.getBin(), BTagWeightCalculator.BTagWeightCalculator.pdfs, PhysicsTools::Calibration::ProcLikelihood.pdfs, BTagWeightCalculator.BTagWeightCalculator.pt_bins_hf, BTagWeightCalculator.BTagWeightCalculator.pt_bins_lf, BTagWeightCalculator.BTagWeightCalculator.systematics_for_b, BTagWeightCalculator.BTagWeightCalculator.systematics_for_c, and BTagWeightCalculator.BTagWeightCalculator.systematics_for_l.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeight().
def BTagWeightCalculator.BTagWeightCalculator.getBin | ( | self, | |
bvec, | |||
val | |||
) |
Definition at line 42 of file BTagWeightCalculator.py.
References createfilelist.int.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().
def BTagWeightCalculator.BTagWeightCalculator.getHistosFromFile | ( | self, | |
fn | |||
) |
Initialized the lookup table for b-tag weight histograms based on jet pt, eta and flavour. The format of the weight file is similar to: KEY: TH1D csv_ratio_Pt0_Eta0_final;1 KEY: TH1D csv_ratio_Pt0_Eta0_final_JESUp;1 KEY: TH1D csv_ratio_Pt0_Eta0_final_JESDown;1 KEY: TH1D csv_ratio_Pt0_Eta0_final_LFUp;1 KEY: TH1D csv_ratio_Pt0_Eta0_final_LFDown;1 KEY: TH1D csv_ratio_Pt0_Eta0_final_Stats1Up;1 KEY: TH1D csv_ratio_Pt0_Eta0_final_Stats1Down;1 KEY: TH1D csv_ratio_Pt0_Eta0_final_Stats2Up;1 KEY: TH1D csv_ratio_Pt0_Eta0_final_Stats2Down;1 KEY: TH1D c_csv_ratio_Pt0_Eta0_final;2 KEY: TH1D c_csv_ratio_Pt0_Eta0_final;1 KEY: TH1D c_csv_ratio_Pt0_Eta0_final_cErr1Up;1 KEY: TH1D c_csv_ratio_Pt0_Eta0_final_cErr1Down;1 KEY: TH1D c_csv_ratio_Pt0_Eta0_final_cErr2Up;1 KEY: TH1D c_csv_ratio_Pt0_Eta0_final_cErr2Down;1
Definition at line 59 of file BTagWeightCalculator.py.
References createfilelist.int.
Referenced by BTagWeightCalculator.BTagWeightCalculator.init().
def BTagWeightCalculator.BTagWeightCalculator.init | ( | self, | |
fn_hf, | |||
fn_lf | |||
) |
fn_hf (string) - path to the heavy flavour weight file fn_lf (string) - path to the light flavour weight file
Definition at line 45 of file BTagWeightCalculator.py.
References BTagWeightCalculator.BTagWeightCalculator.getHistosFromFile(), BTagWeightCalculator.BTagWeightCalculator.pdfs, PhysicsTools::Calibration::ProcLikelihood.pdfs, and edm.print().
BTagWeightCalculator.BTagWeightCalculator.btag |
Definition at line 32 of file BTagWeightCalculator.py.
Referenced by Jet.Jet.btagWP(), and BTagWeightCalculator.BTagWeightCalculator.calcJetWeight().
BTagWeightCalculator.BTagWeightCalculator.eta_bins_hf |
Definition at line 25 of file BTagWeightCalculator.py.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().
BTagWeightCalculator.BTagWeightCalculator.eta_bins_lf |
Definition at line 29 of file BTagWeightCalculator.py.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().
BTagWeightCalculator.BTagWeightCalculator.pdfs |
BTagWeightCalculator.BTagWeightCalculator.pt_bins_hf |
Definition at line 24 of file BTagWeightCalculator.py.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().
BTagWeightCalculator.BTagWeightCalculator.pt_bins_lf |
Definition at line 28 of file BTagWeightCalculator.py.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().
BTagWeightCalculator.BTagWeightCalculator.systematics_for_b |
Definition at line 36 of file BTagWeightCalculator.py.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().
BTagWeightCalculator.BTagWeightCalculator.systematics_for_c |
Definition at line 38 of file BTagWeightCalculator.py.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().
BTagWeightCalculator.BTagWeightCalculator.systematics_for_l |
Definition at line 39 of file BTagWeightCalculator.py.
Referenced by BTagWeightCalculator.BTagWeightCalculator.calcJetWeightImpl().