CMS 3D CMS Logo

Apc.cc
Go to the documentation of this file.
4 
5 
6 #include <cmath>
7 #include <numeric>
8 #include <vector>
9 #include <algorithm>
10 #include <stdlib.h>
11 
12 namespace heppy {
13 
14  double Apc::getApcJetMetMin( const std::vector<double>& et,
15  const std::vector<double>& px,
16  const std::vector<double>& py,
17  const double metx, const double mety) {
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  }
68 }
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
TAKEN FROM http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/ElectroWeakAnalysis/Utilities/src/PdfWeig...
Definition: AlphaT.h:17
static double getApcJetMetMin(const std::vector< double > &et, const std::vector< double > &px, const std::vector< double > &py, const double metx, const double mety)
Definition: Apc.cc:14
et
define resolution functions of each parameter