CMS 3D CMS Logo

PFMETAlgo.cc
Go to the documentation of this file.
2 
4 
8 
10 
11 using namespace std;
12 using namespace edm;
13 using namespace reco;
14 using namespace math;
15 using namespace pf2pat;
16 
17 PFMETAlgo::PFMETAlgo(const edm::ParameterSet& iConfig) {
18  verbose_ = iConfig.getUntrackedParameter<bool>("verbose", false);
19 
20  hfCalibFactor_ = iConfig.getParameter<double>("hfCalibFactor");
21 }
22 
23 PFMETAlgo::~PFMETAlgo() {}
24 
26  double sumEx = 0;
27  double sumEy = 0;
28  double sumEt = 0;
29 
30  for (unsigned i = 0; i < pfCandidates.size(); i++) {
32 
33  double E = cand.energy();
34 
36  if (cand.particleId() == PFCandidate::h_HF || cand.particleId() == PFCandidate::egamma_HF)
37  E *= hfCalibFactor_;
38 
39  double phi = cand.phi();
40  double cosphi = cos(phi);
41  double sinphi = sin(phi);
42 
43  double theta = cand.theta();
44  double sintheta = sin(theta);
45 
46  double et = E * sintheta;
47  double ex = et * cosphi;
48  double ey = et * sinphi;
49 
50  sumEx += ex;
51  sumEy += ey;
52  sumEt += et;
53  }
54 
55  double Et = sqrt(sumEx * sumEx + sumEy * sumEy);
56  XYZTLorentzVector missingEt(-sumEx, -sumEy, 0, Et);
57 
58  if (verbose_) {
59  cout << "PFMETAlgo: mEx, mEy, mEt = " << missingEt.X() << ", " << missingEt.Y() << ", " << missingEt.T() << endl;
60  }
61 
62  XYZPoint vertex; // dummy vertex
63  return MET(sumEt, missingEt, vertex);
64 }
zmumugammaAnalyzer_cfi.pfCandidates
pfCandidates
Definition: zmumugammaAnalyzer_cfi.py:11
mps_fire.i
i
Definition: mps_fire.py:355
PFCandidate.h
pf2pat
Definition: ElectronIDPFCandidateSelectorDefinition.h:22
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
objects.METAnalyzer.sumEt
sumEt
Definition: METAnalyzer.py:97
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::MET
Definition: MET.h:41
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
edm::ParameterSet
Definition: ParameterSet.h:36
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
cand
Definition: decayParser.h:34
LorentzVector.h
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
MET.h
std
Definition: JetResolutionObject.h:76
math
Definition: choleskyInversion.h:19
METFwd.h
reco::PFCandidateCollection
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Definition: PFCandidateFwd.h:12
PFMETAlgo.h
EventSetup.h
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
HLTTauDQMOffline_cfi.MET
MET
Definition: HLTTauDQMOffline_cfi.py:70