ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FGolf/Tools/ScaleFactors.cc
(Generate patch)

Comparing UserCode/FGolf/Tools/ScaleFactors.cc (file contents):
Revision 1.4 by kelley, Tue May 29 18:42:48 2012 UTC vs.
Revision 1.5 by fgolf, Sat Jul 14 22:53:12 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines