Go to the documentation of this file.00001 #include "PhysicsTools/JetCharge/interface/JetCharge.h"
00002
00003 double JetCharge::charge(const LorentzVector &lv, const reco::CandidateCollection &vec) const {
00004 return chargeFromVal<reco::Candidate,reco::CandidateCollection>(lv, vec);
00005 }
00006
00007 double JetCharge::charge(const LorentzVector &lv, const reco::TrackCollection &vec) const {
00008 return chargeFromVal<reco::Track,reco::TrackCollection>(lv, vec);
00009 }
00010
00011 double JetCharge::charge(const LorentzVector &lv, const reco::TrackRefVector &vec) const {
00012 return chargeFromRef<reco::TrackRef,reco::TrackRefVector>(lv, vec);
00013 }
00014
00015 double JetCharge::charge(const reco::Candidate &parent) const {
00016 return chargeFromValIterator<reco::Candidate,reco::Candidate::const_iterator>(parent.p4(),parent.begin(),parent.end());
00017 }
00018
00019 JetCharge::JetCharge(const edm::ParameterSet &iCfg) :
00020 var_(Pt),
00021 exp_(iCfg.getParameter<double>("exp")) {
00022 std::string var = iCfg.getParameter<std::string>("var");
00023 if (var == "Pt") {
00024 var_ = Pt;
00025 } else if (var == "RelPt") {
00026 var_ = RelPt;
00027 } else if (var == "RelEta") {
00028 var_ = RelEta;
00029 } else if (var == "DeltaR") {
00030 var_ = DeltaR;
00031 } else if (var == "Unit") {
00032 var_ = Unit;
00033 } else {
00034 throw cms::Exception("Configuration error") << "Unknown variable "
00035 << var.c_str() << " for computing jet charge";
00036 }
00037 }
00038