#include <JetCharge.h>
Public Types | |
typedef reco::Particle::LorentzVector | LorentzVector |
enum | Variable { Pt, RelPt, RelEta, DeltaR, Unit } |
typedef reco::Particle::Vector | Vector |
Public Member Functions | |
double | charge (const LorentzVector &lv, const reco::TrackCollection &vec) const |
double | charge (const LorentzVector &lv, const reco::TrackRefVector &vec) const |
double | charge (const LorentzVector &lv, const reco::CandidateCollection &vec) const |
double | charge (const reco::Candidate &parent) const |
JetCharge (const edm::ParameterSet &iCfg) | |
JetCharge (Variable var, double exponent=1.0) | |
Private Member Functions | |
template<typename T , typename C > | |
double | chargeFromRef (const LorentzVector &lv, const C &vec) const |
template<typename T , typename C > | |
double | chargeFromVal (const LorentzVector &lv, const C &vec) const |
template<typename T , typename IT > | |
double | chargeFromValIterator (const LorentzVector &lv, const IT &begin, const IT &end) const |
template<class T > | |
double | getWeight (const LorentzVector &lv, const T &obj) const |
Private Attributes | |
double | exp_ |
Variable | var_ |
Definition at line 18 of file JetCharge.h.
Definition at line 21 of file JetCharge.h.
Definition at line 22 of file JetCharge.h.
enum JetCharge::Variable |
JetCharge::JetCharge | ( | Variable | var, |
double | exponent = 1.0 |
||
) | [inline] |
Definition at line 24 of file JetCharge.h.
JetCharge::JetCharge | ( | const edm::ParameterSet & | iCfg | ) |
Definition at line 19 of file JetCharge.cc.
References DeltaR, Exception, edm::ParameterSet::getParameter(), Pt, RelEta, RelPt, AlCaHLTBitMon_QueryRunRegistry::string, Unit, and var_.
: var_(Pt), exp_(iCfg.getParameter<double>("exp")) { std::string var = iCfg.getParameter<std::string>("var"); if (var == "Pt") { var_ = Pt; } else if (var == "RelPt") { var_ = RelPt; } else if (var == "RelEta") { var_ = RelEta; } else if (var == "DeltaR") { var_ = DeltaR; } else if (var == "Unit") { var_ = Unit; } else { throw cms::Exception("Configuration error") << "Unknown variable " << var.c_str() << " for computing jet charge"; } }
double JetCharge::charge | ( | const LorentzVector & | lv, |
const reco::TrackCollection & | vec | ||
) | const |
Definition at line 7 of file JetCharge.cc.
Referenced by JetChargeProducer::produce().
{
return chargeFromVal<reco::Track,reco::TrackCollection>(lv, vec);
}
double JetCharge::charge | ( | const LorentzVector & | lv, |
const reco::TrackRefVector & | vec | ||
) | const |
Definition at line 11 of file JetCharge.cc.
{
return chargeFromRef<reco::TrackRef,reco::TrackRefVector>(lv, vec);
}
double JetCharge::charge | ( | const reco::Candidate & | parent | ) | const |
Definition at line 15 of file JetCharge.cc.
References reco::Candidate::begin(), reco::Candidate::end(), and reco::Candidate::p4().
double JetCharge::charge | ( | const LorentzVector & | lv, |
const reco::CandidateCollection & | vec | ||
) | const |
Definition at line 3 of file JetCharge.cc.
{
return chargeFromVal<reco::Candidate,reco::CandidateCollection>(lv, vec);
}
double JetCharge::chargeFromRef | ( | const LorentzVector & | lv, |
const C & | vec | ||
) | const [private] |
Definition at line 69 of file JetCharge.h.
References end, getWeight(), getGTfromDQMFile::obj, and w().
double JetCharge::chargeFromVal | ( | const LorentzVector & | lv, |
const C & | vec | ||
) | const [private] |
Definition at line 63 of file JetCharge.h.
{ typedef typename C::const_iterator IT; return JetCharge::chargeFromValIterator<T,IT>(lv, vec.begin(), vec.end()); }
double JetCharge::chargeFromValIterator | ( | const LorentzVector & | lv, |
const IT & | begin, | ||
const IT & | end | ||
) | const [private] |
Definition at line 51 of file JetCharge.h.
References end, getWeight(), getGTfromDQMFile::obj, and w().
double JetCharge::getWeight | ( | const LorentzVector & | lv, |
const T & | obj | ||
) | const [private] |
Definition at line 82 of file JetCharge.h.
References abs, DeltaR, exp_, funct::log(), funct::pow(), Pt, RelEta, RelPt, run_regression::ret, mathSSE::sqrt(), Unit, and var_.
Referenced by chargeFromRef(), and chargeFromValIterator().
{ double ret; switch (var_) { case Pt: ret = obj.pt(); break; case DeltaR: ret = ROOT::Math::VectorUtil::DeltaR(lv.Vect(), obj.momentum()); break; case RelPt: case RelEta: ret = lv.Vect().Dot(obj.momentum())/(lv.P() * obj.p()); // cos(theta) ret = (var_ == RelPt ? std::sqrt(1 - ret*ret) * obj.p() : // p * sin(theta) = pt - 0.5 * std::log((1-ret)/(1+ret))); // = - log tan theta/2 = eta break; case Unit: default: ret = 1.0; } return (exp_ == 1.0 ? ret : (ret > 0 ? std::pow(ret,exp_) : - std::pow(std::abs(ret), exp_))); }
double JetCharge::exp_ [private] |
Definition at line 46 of file JetCharge.h.
Referenced by getWeight().
Variable JetCharge::var_ [private] |
Definition at line 46 of file JetCharge.h.
Referenced by getWeight(), and JetCharge().