ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameTools/include/MCDataScaleFactors.h
Revision: 1.5
Committed: Thu Jan 17 17:20:33 2013 UTC (12 years, 3 months ago) by bazterra
Content type: text/plain
Branch: MAIN
CVS Tags: Jan-17-2013-v2, Jan-17-2013-v1
Changes since 1.4: +5 -2 lines
Log Message:
Adding up and down individual systematic for b and l jets.

File Contents

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