-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBTagSFUtil.h
88 lines (55 loc) · 3.02 KB
/
BTagSFUtil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*************************************************************
Class Usage:
This class should only be used for upgrading and downgrading
if a single operating point is used in an analysis.
Based on the BTagSFUtil from Michael Segala
- BTagSFUtil *BTagSF = new BTagSFUtil(BTagAlgorithm, DataPeriod)
where: BTagAlgorithm is the btag algorithm you want to use, ex: "CSVM"
DataPeriod can be "AB", "C", "D" or "ABCD" (default) for PromptReco data, "ABCD" for Winter13 rereco
- When running over FastSim MC, the dataset has to be specified to retrive special correction factors:
BTagSFUtil *BTagSF = new BTagSFUtil(BTagAlgorithm, DataPeriod, FastSimDataset)
where the supported FastSim datasets are T1bbbb, T1tttt, T2, T2bb, T2bwm T2tt and T3w
Note that according to POG prescriptions we are still using 2011 CFs with double uncertainties. 2012 CFs are
waiting for additional cross checks
- For applying the SF to a jet:
BTagSF->IsTagged(DiscriminatorValue, JetFlavor, JetPt, JetEta, SystematicFlag, FastSimSystematic)
where: DiscriminatorValue is the value for the discrimnant of your choise for the jet to which the SF is applied
SystematicFlag = 0, +1, -1 if you want to apply the central values of the SF, or the SF +/- 1 sigma respectively
FastSimSystematic = same as for SystematicFlag, but for the CFs for the FastSim MC
*************************************************************/
#include <Riostream.h>
#include "TRandom3.h"
#include "TMath.h"
#include "TF1.h"
class BTagSFUtil{
public:
BTagSFUtil(TString BTagAlgorithm, TString DataPeriod = "ABCD", TString FastSimDataset = "", int Seed = 0);
~BTagSFUtil();
float GetJetSF(int JetFlavor, float JetPt, float JetEta, int SystematicFlag, int FastSimSystematic = 0);
bool IsTagged(float JetDiscriminant, int JetFlavor, float JetPt, float JetEta, int SystematicFlag, int FastSimSystematic = 0);
private:
void GetBTagPayload(TString BTagAlgorithm, TString DataPeriod);
void GetFastSimPayload(TString BTagAlgorithm, TString FastSimDataset);
float ScaleFactorB(float JetPt, int SystematicFlag);
float ScaleFactorLight(float JetPt, float JetEta, int SystematicFlag);
float ScaleFactorJet(int JetFlavor, float JetPt, float JetEta, int SystematicFlag);
float JetTagEfficiency(int JetFlavor, float JetPt, float JetEta);
float TagEfficiencyB(float JetPt, float JetEta);
float TagEfficiencyC(float JetPt, float JetEta);
float TagEfficiencyLight(float JetPt, float JetEta);
float FastSimCorrectionFactor(int JetFlavor, float JetPt, float JetEta, int FastSimSystematic);
TRandom3* rand_;
TString TaggerName;
float TaggerCut;
TF1 *funSFb, *funSFlight[4][3];
int nBTagPtBins;
float BTagPtBinEdge[50];
float SFb_error[50];
int nBTagEtaBins;
float BTagEtaBinEdge[50];
bool IsFastSimDataset;
int nFastSimPtBins, nFastSimEtaBins[3];
float FastSimPtBinEdge[50], FastSimEtaBinEdge[50][3];
float FastSimCF[50][2][3];
float FastSimCF_error[50][2][3];
};