1 |
khahn |
1.1 |
#include <math.h>
|
2 |
|
|
|
3 |
|
|
#include "IsolationSelection.h"
|
4 |
|
|
#include "IsolationSelectionDefs.h"
|
5 |
|
|
|
6 |
khahn |
1.2 |
bool pairwiseIsoSelection( ControlFlags &ctrl, vector<SimpleLepton> &lepvec, float rho ) {
|
7 |
|
|
|
8 |
|
|
bool passiso=true;
|
9 |
|
|
|
10 |
|
|
for( int i=0; i<lepvec.size(); i++ )
|
11 |
|
|
{
|
12 |
|
|
|
13 |
|
|
if( !(lepvec[i].is4l) ) continue;
|
14 |
|
|
|
15 |
|
|
float effArea_ecal_i, effArea_hcal_i;
|
16 |
|
|
if( lepvec[i].isEB ) {
|
17 |
|
|
if( lepvec[i].type == 11 ) {
|
18 |
|
|
effArea_ecal_i = 0.101;
|
19 |
|
|
effArea_hcal_i = 0.021;
|
20 |
|
|
} else {
|
21 |
|
|
effArea_ecal_i = 0.074;
|
22 |
|
|
effArea_hcal_i = 0.022;
|
23 |
|
|
}
|
24 |
|
|
} else {
|
25 |
|
|
if( lepvec[i].type == 11 ) {
|
26 |
|
|
effArea_ecal_i = 0.046;
|
27 |
|
|
effArea_hcal_i = 0.040;
|
28 |
|
|
} else {
|
29 |
|
|
effArea_ecal_i = 0.045;
|
30 |
|
|
effArea_hcal_i = 0.030;
|
31 |
|
|
}
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
float isoEcal_corr_i = lepvec[i].isoEcal - (effArea_ecal_i*rho);
|
35 |
|
|
float isoHcal_corr_i = lepvec[i].isoHcal - (effArea_hcal_i*rho);
|
36 |
|
|
|
37 |
|
|
for( int j=i+1; j<lepvec.size(); j++ )
|
38 |
|
|
{
|
39 |
|
|
|
40 |
|
|
if( !(lepvec[j].is4l) ) continue;
|
41 |
|
|
|
42 |
|
|
float effArea_ecal_j, effArea_hcal_j;
|
43 |
|
|
if( lepvec[j].isEB ) {
|
44 |
|
|
if( lepvec[j].type == 11 ) {
|
45 |
|
|
effArea_ecal_j = 0.101;
|
46 |
|
|
effArea_hcal_j = 0.021;
|
47 |
|
|
} else {
|
48 |
|
|
effArea_ecal_j = 0.074;
|
49 |
|
|
effArea_hcal_j = 0.022;
|
50 |
|
|
}
|
51 |
|
|
} else {
|
52 |
|
|
if( lepvec[j].type == 11 ) {
|
53 |
|
|
effArea_ecal_j = 0.046;
|
54 |
|
|
effArea_hcal_j = 0.040;
|
55 |
|
|
} else {
|
56 |
|
|
effArea_ecal_j = 0.045;
|
57 |
|
|
effArea_hcal_j = 0.030;
|
58 |
|
|
}
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
float isoEcal_corr_j = lepvec[j].isoEcal - (effArea_ecal_j*rho);
|
62 |
|
|
float isoHcal_corr_j = lepvec[j].isoHcal - (effArea_hcal_j*rho);
|
63 |
|
|
float RIso_i = (lepvec[i].isoTrk+isoEcal_corr_i+isoHcal_corr_i)/lepvec[i].vec->Pt();
|
64 |
|
|
float RIso_j = (lepvec[j].isoTrk+isoEcal_corr_j+isoHcal_corr_j)/lepvec[j].vec->Pt();
|
65 |
|
|
float comboIso = RIso_i + RIso_j;
|
66 |
|
|
|
67 |
|
|
if( comboIso > 0.35 ) {
|
68 |
|
|
if( ctrl.debug ) cout << "combo failing for indices: " << i << "," << j << endl;
|
69 |
|
|
passiso = false;
|
70 |
|
|
return passiso;
|
71 |
|
|
}
|
72 |
|
|
}
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
return passiso;
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
|
79 |
khahn |
1.1 |
SelectionStatus passMuonIsoSelection( ControlFlags &ctrl, const mithep::TMuon * mu ) {
|
80 |
|
|
|
81 |
|
|
float reliso = mu->pfIso03/mu->pt;
|
82 |
|
|
bool isEB = (fabs(mu->eta) < 1.479 ? 1 : 0 );
|
83 |
|
|
bool failiso = false;
|
84 |
|
|
if( isEB && mu->pt > 20 && reliso > PFISO_MU_LOOSE_EB_HIGHPT ) {
|
85 |
|
|
failiso = true;
|
86 |
|
|
}
|
87 |
|
|
if( isEB && mu->pt < 20 && reliso > PFISO_MU_LOOSE_EB_LOWPT ) {
|
88 |
|
|
failiso = true;
|
89 |
|
|
}
|
90 |
|
|
if( !(isEB) && mu->pt > 20 && reliso > PFISO_MU_LOOSE_EE_HIGHPT ) {
|
91 |
|
|
failiso = true;
|
92 |
|
|
}
|
93 |
|
|
if( !(isEB) && mu->pt < 20 && reliso > PFISO_MU_LOOSE_EE_LOWPT ) {
|
94 |
|
|
failiso = true;
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
SelectionStatus status;
|
98 |
|
|
if( !failiso ) status.setStatus(SelectionStatus::LOOSEISO);
|
99 |
|
|
if( !failiso ) status.setStatus(SelectionStatus::TIGHTISO);
|
100 |
|
|
return status;
|
101 |
|
|
|
102 |
|
|
};
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
SelectionStatus failEleIso(ControlFlags &ctrl, const mithep::TElectron * ele) {
|
106 |
|
|
|
107 |
|
|
bool failiso=false;
|
108 |
|
|
|
109 |
|
|
float reliso = ele->pfIso04/ele->pt;
|
110 |
|
|
bool isEB = (fabs(ele->eta) < 1.479 ? 1 : 0 );
|
111 |
|
|
if( isEB && ele->pt > 20 && reliso > PFISO_ELE_LOOSE_EB_HIGHPT ) {
|
112 |
|
|
failiso = true;
|
113 |
|
|
}
|
114 |
|
|
if( isEB && ele->pt < 20 && reliso > PFISO_ELE_LOOSE_EB_LOWPT ) {
|
115 |
|
|
failiso = true;
|
116 |
|
|
}
|
117 |
|
|
if(ctrl.debug) cout << "before iso check ..." << endl;
|
118 |
|
|
if( !(isEB) && ele->pt > 20 && reliso > PFISO_ELE_LOOSE_EE_HIGHPT ) {
|
119 |
|
|
if(ctrl.debug) cout << "\tit fails ..." << endl;
|
120 |
|
|
failiso = true;
|
121 |
|
|
}
|
122 |
|
|
if( !(isEB) && ele->pt < 20 && reliso > PFISO_ELE_LOOSE_EE_LOWPT ) {
|
123 |
|
|
failiso = true;
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
SelectionStatus status;
|
127 |
|
|
if( !failiso ) {
|
128 |
|
|
status.setStatus(SelectionStatus::LOOSEISO);
|
129 |
|
|
status.setStatus(SelectionStatus::TIGHTISO);
|
130 |
|
|
}
|
131 |
|
|
if(ctrl.debug) cout << "returning status : " << hex << status.getStatus() << dec << endl;
|
132 |
|
|
return status;
|
133 |
|
|
|
134 |
|
|
}
|
135 |
anlevin |
1.3 |
|
136 |
|
|
bool noIso(ControlFlags &, vector<SimpleLepton> &, float rho) {
|
137 |
|
|
|
138 |
|
|
return true;
|
139 |
|
|
}
|