CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JetCharge.cc
Go to the documentation of this file.
2 
3 double JetCharge::charge(const LorentzVector &lv, const reco::CandidateCollection &vec) const {
4  return chargeFromVal<reco::Candidate,reco::CandidateCollection>(lv, vec);
5 }
6 
7 double JetCharge::charge(const LorentzVector &lv, const reco::TrackCollection &vec) const {
8  return chargeFromVal<reco::Track,reco::TrackCollection>(lv, vec);
9 }
10 
11 double JetCharge::charge(const LorentzVector &lv, const reco::TrackRefVector &vec) const {
12  return chargeFromRef<reco::TrackRef,reco::TrackRefVector>(lv, vec);
13 }
14 
15 double JetCharge::charge(const reco::Candidate &parent) const {
16  return chargeFromValIterator<reco::Candidate,reco::Candidate::const_iterator>(parent.p4(),parent.begin(),parent.end());
17 }
18 
20 var_(Pt),
21 exp_(iCfg.getParameter<double>("exp")) {
22  std::string var = iCfg.getParameter<std::string>("var");
23  if (var == "Pt") {
24  var_ = Pt;
25  } else if (var == "RelPt") {
26  var_ = RelPt;
27  } else if (var == "RelEta") {
28  var_ = RelEta;
29  } else if (var == "DeltaR") {
30  var_ = DeltaR;
31  } else if (var == "Unit") {
32  var_ = Unit;
33  } else {
34  throw cms::Exception("Configuration error") << "Unknown variable "
35  << var.c_str() << " for computing jet charge";
36  }
37 }
38 
T getParameter(std::string const &) const
double charge(const LorentzVector &lv, const reco::TrackCollection &vec) const
Definition: JetCharge.cc:7
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
JetCharge(Variable var, double exponent=1.0)
Definition: JetCharge.h:24
Variable var_
Definition: JetCharge.h:46
const_iterator end() const
last daughter const_iterator
Definition: Candidate.h:146
reco::Particle::LorentzVector LorentzVector
Definition: JetCharge.h:21
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:144
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector