7 #include <Math/GenVector/Cartesian3D.h> 8 #include <Math/GenVector/VectorUtil.h> 18 static inline T sqr(
const T &
val) {
return val *
val; }
20 template<
typename T1,
typename T2,
typename R>
21 struct JetDistance :
public std::binary_function<T1, T2, R> {
23 sigmaDeltaR2(
sqr(sigmaDeltaR)),
24 sigmaDeltaE2(
sqr(sigmaDeltaE)) {}
26 double operator () (
const T1 &v1,
const T2 &v2)
const 32 double x = VectorUtil::DeltaR2(v1, v2) / sigmaDeltaR2 +
33 sqr(2. * (v1.R() - v2.R()) /
34 (v1.R() + v2.R())) / sigmaDeltaE2;
39 double sigmaDeltaR2, sigmaDeltaE2;
44 maxChi2(pSet.getParameter<double>(
"maxChi2")),
45 sigmaDeltaR(pSet.getParameter<double>(
"sigmaDeltaR")),
46 sigmaDeltaE(pSet.getParameter<double>(
"sigmaDeltaE")),
60 typedef ROOT::Math::Cartesian3D<double>
Vector;
62 std::vector<Vector> corrRefJets;
65 iter != refJets_.
end(); ++iter) {
71 corrRefJets.push_back(
Vector(jet.
px(), jet.
py(), jet.
pz()));
75 std::vector<Vector> corrRecJets;
78 iter != recJets_.
end(); ++iter) {
84 corrRecJets.push_back(
Vector(jet.
px(), jet.
py(), jet.
pz()));
101 const std::vector<Match>&
matches =
102 matching.
match(std::less<double>(),
103 std::bind2nd(std::less<double>(),
maxChi2));
104 for(std::vector<Match>::const_iterator iter = matches.begin();
105 iter != matches.end(); ++iter) {
106 refToRec[iter->index1] = iter->index2;
107 recToRef[iter->index2] = iter->index1;
ROOT::Math::Plane3D::Vector Vector
Base class for all types of Jets.
double px() const final
x coordinate of momentum vector
edm::RefToBaseVector< reco::Jet > refJets
const_iterator end() const
std::vector< int > recToRef
edm::RefToBaseVector< reco::Jet > recJets
void matchCollections(const edm::RefToBaseVector< reco::Jet > &refJets, const edm::RefToBaseVector< reco::Jet > &recJets, const reco::JetCorrector *corrector)
match the collections
std::vector< int > refToRec
double pz() const final
z coordinate of momentum vector
double energy() const final
energy
edm::RefToBase< reco::Jet > operator()(const edm::RefToBase< reco::Jet > &recJet) const
Returns the matched "reference" jet.
CorrectJet refJetCorrector
CorrectJet recJetCorrector
void setCorrector(const reco::JetCorrector *corrector)
Returns the corrected jet.
double py() const final
y coordinate of momentum vector
const_iterator begin() const
std::vector< Match > match(SortComparator sortComparator=SortComparator(), CutCriterion cutCriterion=CutCriterion())
Square< F >::type sqr(const F &f)
void push_back(const RefToBase< T > &)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.