File indexing completed on 2024-04-06 12:23:32
0001 #include "PhysicsTools/JetCharge/interface/JetCharge.h"
0002
0003 double JetCharge::charge(const LorentzVector &lv, const reco::CandidateCollection &vec) const {
0004 return chargeFromVal<reco::Candidate, reco::CandidateCollection>(lv, vec);
0005 }
0006
0007 double JetCharge::charge(const LorentzVector &lv, const reco::TrackCollection &vec) const {
0008 return chargeFromVal<reco::Track, reco::TrackCollection>(lv, vec);
0009 }
0010
0011 double JetCharge::charge(const LorentzVector &lv, const reco::TrackRefVector &vec) const {
0012 return chargeFromRef<reco::TrackRef, reco::TrackRefVector>(lv, vec);
0013 }
0014
0015 double JetCharge::charge(const reco::Candidate &parent) const {
0016 return chargeFromValIterator<reco::Candidate, reco::Candidate::const_iterator>(
0017 parent.p4(), parent.begin(), parent.end());
0018 }
0019
0020 JetCharge::JetCharge(const edm::ParameterSet &iCfg) : var_(Pt), exp_(iCfg.getParameter<double>("exp")) {
0021 std::string var = iCfg.getParameter<std::string>("var");
0022 if (var == "Pt") {
0023 var_ = Pt;
0024 } else if (var == "RelPt") {
0025 var_ = RelPt;
0026 } else if (var == "RelEta") {
0027 var_ = RelEta;
0028 } else if (var == "DeltaR") {
0029 var_ = DeltaR;
0030 } else if (var == "Unit") {
0031 var_ = Unit;
0032 } else {
0033 throw cms::Exception("Configuration error") << "Unknown variable " << var.c_str() << " for computing jet charge";
0034 }
0035 }