1 |
|
#include "ScaleFactors.h" |
2 |
|
#include "CORE/CMS2.h" |
3 |
< |
//#include "bTagEff_BTV.h" |
3 |
> |
#include "DileptonHypType.h" |
4 |
|
|
5 |
|
float dileptonTagAndProbeScaleFactor(int hyp_idx) |
6 |
|
{ |
57 |
|
return 0.; |
58 |
|
} |
59 |
|
|
60 |
< |
float dilepTriggerScaleFactor(enum TrigEffType trig_eff_type, int hyp_idx) |
60 |
> |
float dilepTriggerScaleFactor(int hyp_idx) |
61 |
|
{ |
62 |
< |
float sf1 = triggerScaleFactor(trig_eff_type, cms2.hyp_lt_id().at(hyp_idx), cms2.hyp_lt_p4().at(hyp_idx).pt(), cms2.hyp_lt_p4().at(hyp_idx).eta()); |
63 |
< |
float sf2 = triggerScaleFactor(trig_eff_type, cms2.hyp_ll_id().at(hyp_idx), cms2.hyp_ll_p4().at(hyp_idx).pt(), cms2.hyp_ll_p4().at(hyp_idx).eta()); |
64 |
< |
return (sf1 * sf2); |
62 |
> |
double eff_1l = 0.; |
63 |
> |
double eff_1t = 0.; |
64 |
> |
double eff_2l = 0.; |
65 |
> |
double eff_2t = 0.; |
66 |
> |
double eff_z = 0.; |
67 |
> |
|
68 |
> |
DileptonHypType hyp_type = hyp_typeToHypType(cms2.hyp_type().at(hyp_idx)); |
69 |
> |
|
70 |
> |
if (hyp_type == DILEPTON_EE || hyp_type == DILEPTON_MUMU) { |
71 |
> |
eff_1l = triggerScaleFactor(LeadDbl, cms2.hyp_lt_id().at(hyp_idx), cms2.hyp_lt_p4().at(hyp_idx)); |
72 |
> |
eff_1t = triggerScaleFactor(TrailDbl, cms2.hyp_lt_id().at(hyp_idx), cms2.hyp_lt_p4().at(hyp_idx)); |
73 |
> |
eff_2l = triggerScaleFactor(LeadDbl, cms2.hyp_ll_id().at(hyp_idx), cms2.hyp_ll_p4().at(hyp_idx)); |
74 |
> |
eff_2t = triggerScaleFactor(TrailDbl, cms2.hyp_ll_id().at(hyp_idx), cms2.hyp_ll_p4().at(hyp_idx)); |
75 |
> |
if (cms2.hyp_lt_p4().at(hyp_idx).pt() > cms2.hyp_ll_p4().at(hyp_idx).pt()) |
76 |
> |
eff_z = triggerScaleFactor(DzDbl, cms2.hyp_ll_id().at(hyp_idx), cms2.hyp_ll_p4().at(hyp_idx)); |
77 |
> |
else |
78 |
> |
eff_z = triggerScaleFactor(DzDbl, cms2.hyp_lt_id().at(hyp_idx), cms2.hyp_lt_p4().at(hyp_idx)); |
79 |
> |
|
80 |
> |
return (eff_1l * eff_2t + eff_1t * eff_2l - eff_1l * eff_2l) * eff_z; |
81 |
> |
} |
82 |
> |
else if (hyp_type == DILEPTON_EMU) { |
83 |
> |
eff_1l = triggerScaleFactor(LeadDbl, cms2.hyp_lt_id().at(hyp_idx), cms2.hyp_lt_p4().at(hyp_idx)); |
84 |
> |
eff_1t = triggerScaleFactor(TrailDbl, cms2.hyp_lt_id().at(hyp_idx), cms2.hyp_lt_p4().at(hyp_idx)); |
85 |
> |
eff_2l = triggerScaleFactor(LeadDbl, cms2.hyp_ll_id().at(hyp_idx), cms2.hyp_ll_p4().at(hyp_idx)); |
86 |
> |
eff_2t = triggerScaleFactor(TrailDbl, cms2.hyp_ll_id().at(hyp_idx), cms2.hyp_ll_p4().at(hyp_idx)); |
87 |
> |
if (abs(cms2.hyp_ll_id().at(hyp_idx)) == 13) |
88 |
> |
eff_z = triggerScaleFactor(DzDbl, cms2.hyp_ll_id().at(hyp_idx), cms2.hyp_ll_p4().at(hyp_idx)); |
89 |
> |
else |
90 |
> |
eff_z = triggerScaleFactor(DzDbl, cms2.hyp_lt_id().at(hyp_idx), cms2.hyp_lt_p4().at(hyp_idx)); |
91 |
> |
|
92 |
> |
return (eff_1l * eff_2t + eff_1t * eff_2l - eff_1l * eff_2l) * sqrt(eff_z); |
93 |
> |
} |
94 |
|
} |
95 |
|
|
96 |
< |
float triggerScaleFactor(enum TrigEffType trig_eff_type, int id, float pt, float eta) |
96 |
> |
float triggerScaleFactor(enum TrigEffType trig_eff_type, int id, LorentzVector &p4) |
97 |
|
{ |
98 |
|
unsigned int aid = abs(id); |
99 |
< |
float feta = fabs(eta); |
99 |
> |
float eta = fabs(p4.eta()); |
100 |
> |
float pt = p4.pt(); |
101 |
|
|
102 |
|
if (aid == 11) |
103 |
|
{ |