test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 17 of file Apc.h.

Member Function Documentation

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 14 of file Apc.cc.

References funct::cos(), SiPixelRawToDigiRegional_cfi::deltaPhi, i, j, and funct::sin().

17  {
18 
19  if(et.size()==0) 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 firstjet_phi = atan2(py[0], px[0]);
26 
27  double apcjet(0.), apcmet(0.), apcjetmet(0.);
28  double apcjetmetmin(0.);
29 
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);
33 
34  double dphisignaljet = fabs(deltaPhi(jet_phi,firstjet_phi));
35  double dphimet = fabs(deltaPhi(jet_phi, met_phi));
36 
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);
40  }
41 
42 
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));
54 
55  apcjetvector.back() += et[i] * cos(dphi_jet/2.0);
56  apcjetmetvector.back() += et[i] * cos(dphi_jet/2.0) * sin(dphimet/2.0);
57  }
58  }
59  if (apcjetvector.size() > 0 && apcjetmetvector.size() > 0) {
60  apcjetmetmin = *min_element(apcjetmetvector.begin(), apcjetmetvector.end());
61  }
62 
63 
64  if (ht != 0) return apcjetmetmin / ht;
65  else return -1.;
66 
67  }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int j
Definition: DBlmapReader.cc:9