CMS 3D CMS Logo

List of all members | Static Public Member Functions
heppy::Apc Struct Reference

#include <Apc.h>

Static Public Member Functions

static double getApcJetMetMin (const std::vector< double > &et, const std::vector< double > &px, const std::vector< double > &py, const double metx, const double mety)
 

Detailed Description

Definition at line 16 of file Apc.h.

Member Function Documentation

◆ getApcJetMetMin()

double heppy::Apc::getApcJetMetMin ( const std::vector< double > &  et,
const std::vector< double > &  px,
const std::vector< double > &  py,
const double  metx,
const double  mety 
)
static

Definition at line 13 of file Apc.cc.

References Matriplex::atan2(), funct::cos(), srCondWrite_cfg::deltaPhi, l1tnanotables_cff::et, mps_fire::i, dqmiolumiharvest::j, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, and funct::sin().

17  {
18  if (et.empty())
19  return -1.;
20 
21  // Momentum sums in transverse plane
22  const double ht = accumulate(et.begin(), et.end(), 0.);
23 
24  // jets are pt-sorted
25  double apcjetmetmin(0.);
26 
27  std::vector<double> apcjetvector;
28  std::vector<double> apcjetmetvector;
29  for (size_t j = 0; j < et.size(); j++) {
30  apcjetvector.push_back(0.);
31  apcjetmetvector.push_back(0.);
32  double jet_phi_j = atan2(py[j], px[j]);
33  for (size_t i = 0; i < et.size(); i++) {
34  double jet_phi_i = atan2(py[i], px[i]);
35  double dphi_jet = fabs(deltaPhi(jet_phi_i, jet_phi_j));
36  double met_phi = atan2(mety, metx);
37  double dphimet = fabs(deltaPhi(jet_phi_i, met_phi));
38 
39  apcjetvector.back() += et[i] * cos(dphi_jet / 2.0);
40  apcjetmetvector.back() += et[i] * cos(dphi_jet / 2.0) * sin(dphimet / 2.0);
41  }
42  }
43  if (!apcjetvector.empty() && !apcjetmetvector.empty()) {
44  apcjetmetmin = *min_element(apcjetmetvector.begin(), apcjetmetvector.end());
45  }
46 
47  if (ht != 0)
48  return apcjetmetmin / ht;
49  else
50  return -1.;
51  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648