ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/include/MCDataScaleFactors.h
Revision: 1.2
Committed: Fri Dec 7 10:56:32 2012 UTC (12 years, 4 months ago) by peiffer
Content type: text/plain
Branch: MAIN
Changes since 1.1: +161 -0 lines
Log Message:
b tagging scale factors

File Contents

# User Rev Content
1 peiffer 1.1 #ifndef MCDataScaleFactors_H
2     #define MCDataScaleFactors_H
3    
4     #include "include/Utils.h"
5     #include "include/EventCalc.h"
6    
7     /**
8     * @short module to apply data-MC lepton scale factors for trigger and ID
9     *
10     *
11     */
12     class LeptonScaleFactors{
13     public:
14     /**
15     * constructor
16     *
17     * first argument: list of corrections to be applied together with weight factors for luminosity, example: "MuonRunA 1.5 MuonRunB 2.6 MuonRunC 7.8"
18     *
19     * second argument: systematic shift
20     * @see E_SystShift
21     */
22     LeptonScaleFactors(std::vector<std::string> correctionlist, E_SystShift syst_shift=e_Default);
23     ///Default destructor
24     ~LeptonScaleFactors(){};
25    
26     ///return the weighted correction factor
27     double GetWeight();
28    
29     private:
30     E_SystShift m_syst_shift;
31     std::vector<std::pair<std::string, double> > m_correctionlist;
32    
33     };
34    
35    
36 peiffer 1.2 class BtagFunction
37     {
38     public:
39     BtagFunction();
40    
41     virtual ~BtagFunction()
42     {
43     };
44    
45     virtual float value(const float &x) const = 0;
46     virtual float value_plus(const float &x) const = 0;
47     virtual float value_minus(const float &x) const = 0;
48    
49     protected:
50     const uint32_t find_bin(const float &jet_pt) const;
51    
52     private:
53     std::vector<float> _bins;
54     };
55    
56     class BtagScale: public BtagFunction
57     {
58     // CSVT operating point
59     public:
60     BtagScale();
61    
62     virtual float value(const float &jet_pt) const;
63     virtual float value_plus(const float &jet_pt) const
64     {
65     return value(jet_pt) + error(jet_pt);
66     }
67    
68     virtual float value_minus(const float &jet_pt) const
69     {
70     const float value_ = value(jet_pt) - error(jet_pt);
71    
72     return value_ > 0 ? value_ : 0;
73     }
74    
75     protected:
76     virtual float error(const float &jet_pt) const;
77    
78     private:
79     std::vector<float> _errors;
80     };
81    
82     class CtagScale: public BtagScale
83     {
84     protected:
85     virtual float error(const float &jet_pt) const;
86     };
87    
88     class LightScale: public BtagFunction
89     {
90     public:
91     virtual float value(const float &jet_pt) const;
92     virtual float value_plus(const float &jet_pt) const;
93     virtual float value_minus(const float &jet_pt) const;
94    
95     private:
96     float value_max(const float &jet_pt) const;
97     float value_min(const float &jet_pt) const;
98     };
99    
100     class BtagEfficiency: public BtagFunction
101     {
102     // Errors are not provided ... yet
103     public:
104     BtagEfficiency();
105    
106     virtual float value(const float &jet_pt) const;
107     virtual float value_plus(const float &jet_pt) const
108     {
109     return value(jet_pt);
110     }
111    
112     virtual float value_minus(const float &jet_pt) const
113     {
114     return value(jet_pt);
115     }
116    
117     private:
118     std::vector<float> _values;
119     };
120    
121     class CtagEfficiency: public BtagEfficiency
122     {
123     };
124    
125     class LightEfficiency: public BtagEfficiency
126     {
127     // Errors are not provided ... yet
128     public:
129     LightEfficiency();
130    
131     virtual float value(const float &jet_pt) const;
132    
133     private:
134     std::vector<float> _values;
135     };
136    
137     class LightEfficiencyData: public BtagEfficiency
138     {
139     // Errors are not provided ... yet
140     public:
141     virtual float value(const float &jet_pt) const;
142     };
143    
144    
145    
146    
147     /**
148     * @short module to apply data-MC scale factors for b tagging
149     *
150     *
151     */
152     class BTaggingScaleFactors{
153     public:
154     /**
155     * constructor
156     *
157     * second argument: systematic shift
158     * @see E_SystShift
159     */
160     BTaggingScaleFactors(E_SystShift syst_shift=e_Default);
161     ///Default destructor
162     ~BTaggingScaleFactors(){};
163    
164     ///return the weighted correction factor
165     double GetWeight();
166    
167     private:
168    
169     E_SystShift m_syst_shift;
170    
171     float scale(const bool &is_tagged,
172     const float &jet_pt,
173     const BtagFunction* sf,
174     const BtagFunction* eff,
175     const E_SystShift &sytematic);
176    
177     float scale_data(const bool &is_tagged,
178     const float &jet_pt,
179     const BtagFunction* sf,
180     const BtagFunction* eff,
181     const E_SystShift &sytematic);
182    
183    
184     BtagFunction* _scale_btag;
185     BtagFunction* _eff_btag;
186    
187     BtagFunction* _scale_ctag;
188     BtagFunction* _eff_ctag;
189    
190     BtagFunction* _scale_light;
191     BtagFunction* _eff_light;
192     };
193    
194    
195    
196    
197 peiffer 1.1 #endif