17 double phi1, eta1, phi2, eta2;
19 double dphi1 = fabs(TVector2::Phi_mpi_pi(phi1-b.
met_phi()));
20 double dphi2 = fabs(TVector2::Phi_mpi_pi(phi2-b.
met_phi()));
21 if(phi1 != -999 && phi2 != -999){
22 return std::min(dphi1,dphi2);
23 }
else if(phi1 != -999 && phi2 == -999){
25 }
else if(phi1 == -999 && phi2 != -999){
32 double phi1, eta1, phi2, eta2;
34 double dphi1 = fabs(TVector2::Phi_mpi_pi(phi1-b.
met_phi()));
35 double dphi2 = fabs(TVector2::Phi_mpi_pi(phi2-b.
met_phi()));
36 if(phi1 != -999 && phi2 != -999){
37 return std::max(dphi1,dphi2);
38 }
else if(phi1 != -999 && phi2 == -999){
40 }
else if(phi1 == -999 && phi2 != -999){
47 double phi1, eta1, phi2, eta2;
50 for(
size_t ijet = 0; ijet < b.
jets_pt()->size(); ++ijet){
52 double dphi1 = fabs(TVector2::Phi_mpi_pi(phi1-b.
jets_phi()->at(ijet)));
53 double dphi2 = fabs(TVector2::Phi_mpi_pi(phi2-b.
jets_phi()->at(ijet)));
55 if(phi1 != -999 && phi2 != -999){
56 thisdphi = std::min(dphi1, dphi2);
57 }
else if(phi1 != -999 && phi2 == -999){
59 }
else if(phi1 == -999 && phi2 != -999){
62 if(minphi < 0. || thisdphi < minphi){
70 double phi1, eta1, phi2, eta2;
73 for(
size_t ijet = 0; ijet < b.
jets_pt()->size(); ++ijet){
75 double dphi1 = fabs(TVector2::Phi_mpi_pi(phi1-b.
jets_phi()->at(ijet)));
76 double dphi2 = fabs(TVector2::Phi_mpi_pi(phi2-b.
jets_phi()->at(ijet)));
78 if(phi1 != -999 && phi2 != -999){
79 thisdphi = std::max(dphi1, dphi2);
80 }
else if(phi1 != -999 && phi2 == -999){
82 }
else if(phi1 == -999 && phi2 != -999){
85 if(maxphi < 0. || thisdphi > maxphi){
94 for(
size_t ijet = 0; ijet < b.
jets_pt()->size(); ++ijet){
96 double thisdphi = fabs(TVector2::Phi_mpi_pi(b.
met_phi()-b.
jets_phi()->at(ijet)));
97 if(minphi < 0. || thisdphi < minphi){
106 for(
size_t ijet = 0; ijet < b.
jets_pt()->size(); ++ijet){
108 double thisdphi = fabs(TVector2::Phi_mpi_pi(b.
met_phi()-b.
jets_phi()->at(ijet)));
109 if(maxphi < 0. || thisdphi > maxphi){
117 double phi1, eta1, phi2, eta2;
120 for(
size_t ijet = 0; ijet < b.
jets_pt()->size(); ++ijet){
122 double dr1 = hypot(TVector2::Phi_mpi_pi(phi1-b.
jets_phi()->at(ijet)), eta2-eta1);
123 double dr2 = hypot(TVector2::Phi_mpi_pi(phi2-b.
jets_phi()->at(ijet)), eta2-eta1);
125 if(phi1 != -999 && phi2 != -999){
126 thisdr = std::min(dr1, dr2);
127 }
else if(phi1 != -999 && phi2 == -999){
129 }
else if(phi1 == -999 && phi2 != -999){
132 if(minr < 0. || thisdr < minr){
140 double phi1, eta1, phi2, eta2;
143 for(
size_t ijet = 0; ijet < b.
jets_pt()->size(); ++ijet){
145 double dr1 = hypot(TVector2::Phi_mpi_pi(phi1-b.
jets_phi()->at(ijet)), eta2-eta1);
146 double dr2 = hypot(TVector2::Phi_mpi_pi(phi2-b.
jets_phi()->at(ijet)), eta2-eta1);
148 if(phi1 != -999 && phi2 != -999){
149 thisdr = std::max(dr1, dr2);
150 }
else if(phi1 != -999 && phi2 == -999){
152 }
else if(phi1 == -999 && phi2 != -999){
155 if(maxr < 0. || thisdr > maxr){
163 return ijet<b.
jets_pt()->size()
170 return iel<b.
els_pt()->size()
171 && b.
els_pt()->at(iel)>20.
179 return imu<b.
mus_pt()->size()
180 && b.
mus_pt()->at(imu)>20.
181 && fabs(b.
mus_eta()->at(imu))<2.4
188 if(itk >= b.
tks_pt()->size())
return false;
202 if (b.
ntrupv()<0)
return 1.;
209 if (nisrjets==0)
return 1.099*wgt;
210 else if (nisrjets==1)
return 0.969*wgt;
211 else if (nisrjets==2)
return 0.870*wgt;
212 else if (nisrjets==3)
return 0.772*wgt;
213 else if (nisrjets==4)
return 0.712*wgt;
214 else if (nisrjets==5)
return 0.661*wgt;
215 else if (nisrjets>=6)
return 0.566*wgt;
220 if (b.
ntrupv()<0)
return 1.;
225 int nisrjets(b.
njets());
227 if (nisrjets==0)
return 0.981*wgt;
228 else if (nisrjets==1)
return 1.071*wgt;
229 else if (nisrjets==2)
return 1.169*wgt;
230 else if (nisrjets==3)
return 1.157*wgt;
231 else if (nisrjets==4)
return 1.014*wgt;
232 else if (nisrjets==5)
return 0.920*wgt;
233 else if (nisrjets==6)
return 0.867*wgt;
234 else if (nisrjets>=7)
return 0.935*wgt;
240 for (
size_t ijet(0); ijet<b.
jets_pt()->size(); ++ijet){
243 for (
size_t imc(0); imc<b.
mc_pt()->size(); ++imc){
244 if(b.
mc_status()->at(imc)!=23 || abs(b.
mc_id()->at(imc))>5)
continue;
245 if(!(abs(b.
mc_mom()->at(imc))==6 || abs(b.
mc_mom()->at(imc))==23 ||
246 abs(b.
mc_mom()->at(imc))==24 || abs(b.
mc_mom()->at(imc))==15))
continue;
262 phi1 = -999.; eta1 = -999.;
263 phi2 = -999.; eta2 = -999.;
264 bool h1=
false, h2=
false;
266 for(
size_t iel = 0; iel < b.
els_pt()->size() && !(h1&&h2); ++iel){
279 }
else if(b.
nels()==1 && b.
nmus()==1){
280 for(
size_t iel = 0; iel < b.
els_pt()->size() && !h1; ++iel){
293 for(
size_t imu = 0; imu < b.
mus_pt()->size() && h1 && !h2; ++imu){
306 }
else if(b.
nels()==0 && b.
nmus()==2){
307 for(
size_t imu = 0; imu < b.
mus_pt()->size() && !(h1&&h2); ++imu){
321 for(
size_t iel = 0; iel < b.
els_pt()->size() && !h1; ++iel){
334 for(
size_t itk = 0; itk < b.
tks_pt()->size() && h1 && !h2; ++itk){
348 for(
size_t imu = 0; imu < b.
mus_pt()->size() && !h1; ++imu){
361 for(
size_t itk = 0; itk < b.
tks_pt()->size() && h1 && !h2; ++itk){
std::vector< int > *const & mc_status() const
Get mc_status for current event and cache it.
std::vector< float > *const & mus_eta() const
Get mus_eta for current event and cache it.
const NamedFunc min_dphi_lep_met
const NamedFunc njets_weights_ttisr
const NamedFunc min_dr_lep_jet
float const & eff_trig() const
Get eff_trig for current event and cache it.
int const & njets() const
Get njets for current event and cache it.
std::vector< float > *const & els_pt() const
Get els_pt for current event and cache it.
int NISRMatch(const Baby &b)
std::vector< float > *const & mus_phi() const
Get mus_phi for current event and cache it.
std::vector< float > *const & jets_phi() const
Get jets_phi for current event and cache it.
const NamedFunc max_dphi_lep_jet
Abstract base class for access to ntuple variables.
std::vector< float > *const & tks_mt2() const
Get tks_mt2 for current event and cache it.
const NamedFunc njets_weights_visr
std::vector< float > *const & mus_pt() const
Get mus_pt for current event and cache it.
Combines a callable function taking a Baby and returning a scalar or vector with its string represent...
float const & met_phi() const
Get met_phi for current event and cache it.
std::vector< float > *const & tks_eta() const
Get tks_eta for current event and cache it.
float const & w_toppt() const
Get w_toppt for current event and cache it.
std::vector< float > *const & els_miniso() const
Get els_miniso for current event and cache it.
bool IsGoodMuon(const Baby &b, std::size_t imu)
int const & nmus() const
Get nmus for current event and cache it.
std::vector< float > *const & tks_d0() const
Get tks_d0 for current event and cache it.
const NamedFunc max_dr_lep_jet
NamedFunc::ScalarType NJetsWeights_ttISR(const Baby &b, bool use_baby_nisr)
std::vector< int > *const & mc_mom() const
Get mc_mom for current event and cache it.
std::vector< float > *const & mc_pt() const
Get mc_pt for current event and cache it.
std::vector< float > *const & els_phi() const
Get els_phi for current event and cache it.
std::vector< float > *const & jets_eta() const
Get jets_eta for current event and cache it.
std::vector< bool > *const & mus_sigid() const
Get mus_sigid for current event and cache it.
std::vector< bool > *const & els_sigid() const
Get els_sigid for current event and cache it.
const NamedFunc min_dphi_lep_jet
float deltaR(float eta1, float phi1, float eta2, float phi2)
const NamedFunc n_isr_match
std::vector< float > *const & tks_miniso() const
Get tks_miniso for current event and cache it.
std::vector< float > *const & tks_pt() const
Get tks_pt for current event and cache it.
const NamedFunc min_dphi_met_jet
float const & weight() const
Get weight for current event and cache it.
std::vector< float > *const & els_sceta() const
Get els_sceta for current event and cache it.
std::vector< float > *const & tks_phi() const
Get tks_phi for current event and cache it.
std::vector< int > *const & mc_id() const
Get mc_id for current event and cache it.
float const & nisr() const
Get nisr for current event and cache it.
int const & nels() const
Get nels for current event and cache it.
int const & nveto() const
Get nveto for current event and cache it.
std::vector< int > *const & tks_pdg() const
Get tks_pdg for current event and cache it.
const NamedFunc max_dphi_met_jet
std::vector< float > *const & jets_pt() const
Get jets_pt for current event and cache it.
bool IsGoodJet(const Baby &b, std::size_t ijet)
bool IsGoodElectron(const Baby &b, std::size_t iel)
std::vector< float > *const & mus_miniso() const
Get mus_miniso for current event and cache it.
std::vector< float > *const & tks_dz() const
Get tks_dz for current event and cache it.
int const & ntrupv() const
Get ntrupv for current event and cache it.
bool IsGoodTrack(const Baby &b, std::size_t itk)
std::vector< float > *const & mc_eta() const
Get mc_eta for current event and cache it.
void DileptonAngles(const Baby &b, NamedFunc::ScalarType &eta1, NamedFunc::ScalarType &phi1, NamedFunc::ScalarType &eta2, NamedFunc::ScalarType &phi2)
const NamedFunc max_dphi_lep_met
std::vector< bool > *const & jets_islep() const
Get jets_islep for current event and cache it.
NamedFunc::ScalarType NJetsWeights_vISR(const Baby &b)
std::vector< float > *const & mc_phi() const
Get mc_phi for current event and cache it.