15 const std::vector<double>& px,
16 const std::vector<double>& py,
17 const double metx,
const double mety) {
19 if(et.size()==0)
return -1.;
22 const double ht = accumulate( et.begin(), et.end(), 0. );
25 double firstjet_phi = atan2(py[0], px[0]);
27 double apcjet(0.), apcmet(0.), apcjetmet(0.);
28 double apcjetmetmin(0.);
30 for (
size_t i = 0;
i < et.size();
i++) {
31 double jet_phi = atan2(py[
i], px[i]);
32 double met_phi = atan2(mety, metx);
34 double dphisignaljet = fabs(
deltaPhi(jet_phi,firstjet_phi));
35 double dphimet = fabs(
deltaPhi(jet_phi, met_phi));
37 apcjet += et[
i] *
cos(dphisignaljet/2.0);
38 apcmet += et[
i] *
sin(dphimet/2.0);
39 apcjetmet += et[
i] *
cos(dphisignaljet/2.0) *
sin(dphimet/2.0);
43 std::vector<double> apcjetvector;
44 std::vector<double> apcjetmetvector;
45 for (
size_t j = 0;
j < et.size();
j++) {
46 apcjetvector.push_back(0.);
47 apcjetmetvector.push_back(0.);
48 double jet_phi_j = atan2(py[
j], px[j]);
49 for (
size_t i = 0;
i < et.size();
i++) {
50 double jet_phi_i = atan2(py[
i], px[i]);
51 double dphi_jet = fabs(
deltaPhi(jet_phi_i, jet_phi_j));
52 double met_phi = atan2(mety, metx);
53 double dphimet = fabs(
deltaPhi(jet_phi_i, met_phi));
55 apcjetvector.back() += et[
i] *
cos(dphi_jet/2.0);
56 apcjetmetvector.back() += et[
i] *
cos(dphi_jet/2.0) *
sin(dphimet/2.0);
59 if (apcjetvector.size() > 0 && apcjetmetvector.size() > 0) {
60 apcjetmetmin = *min_element(apcjetmetvector.begin(), apcjetmetvector.end());
64 if (ht != 0)
return apcjetmetmin / ht;
Sin< T >::type sin(const T &t)
Cos< T >::type cos(const T &t)
static double getApcJetMetMin(const std::vector< double > &et, const std::vector< double > &px, const std::vector< double > &py, const double metx, const double mety)