#include <PFBenchmarkAlgo.h>
Static Public Member Functions | |
template<typename T , typename Collection > | |
static Collection | copyCollection (const Collection *) |
template<typename T , typename U > | |
static double | deltaEt (const T *, const U *) |
template<typename T , typename U > | |
static double | deltaEta (const T *, const U *) |
template<typename T , typename U > | |
static double | deltaPhi (const T *, const U *) |
template<typename T , typename U > | |
static double | deltaR (const T *, const U *) |
template<typename T , typename Collection > | |
static Collection | findAllInCone (const T *, const Collection *, double) |
template<typename T , typename Collection > | |
static Collection | findAllInEtWindow (const T *, const Collection *, double) |
template<typename T , typename Collection > | |
static const Collection::value_type * | matchByDeltaEt (const T *, const Collection *) |
template<typename T , typename Collection > | |
static const Collection::value_type * | matchByDeltaR (const T *, const Collection *) |
template<typename T , typename Collection > | |
static void | sortByDeltaEt (const T *, Collection &) |
template<typename T , typename Collection > | |
static void | sortByDeltaR (const T *, Collection &) |
Static Private Member Functions | |
template<typename T > | |
static void | vector_add (const T *c1, std::vector< T > &candidates) |
template<typename T > | |
static void | vector_add (const T *c1, edm::OwnVector< T > &candidates) |
template<typename T , typename U , template< typename, typename > class Sorter> | |
static void | vector_sort (edm::OwnVector< T > &candidates, Sorter< T, U > S) |
template<typename T , typename U , template< typename, typename > class Sorter> | |
static void | vector_sort (std::vector< T > &candidates, Sorter< T, U > S) |
Definition at line 16 of file PFBenchmarkAlgo.h.
Collection PFBenchmarkAlgo::copyCollection | ( | const Collection * | candidates | ) | [static] |
Definition at line 260 of file PFBenchmarkAlgo.h.
References filterCSVwithJSON::copy, Exception, i, and vector_add().
{ typedef typename Collection::value_type U; // Try to verify the validity of the Collection if (!candidates) throw cms::Exception("Invalid Arg") << "attempted to copy invalid Collection"; Collection copy; for (unsigned int i = 0; i < candidates->size(); i++) vector_add(&(*candidates)[i],copy); return copy; }
double PFBenchmarkAlgo::deltaEt | ( | const T * | c1, |
const U * | c2 | ||
) | [static] |
Definition at line 127 of file PFBenchmarkAlgo.h.
References Exception, and NULL.
Referenced by findAllInEtWindow(), matchByDeltaEt(), and deltaEtSorter< T, U >::operator()().
{ if (c1 == NULL || c2 == NULL) throw cms::Exception("Invalid Arg") << "attempted to calculate deltaEt for invalid Candidate(s)"; return c1->et() - c2->et(); }
double PFBenchmarkAlgo::deltaEta | ( | const T * | c1, |
const U * | c2 | ||
) | [static] |
Definition at line 138 of file PFBenchmarkAlgo.h.
References Exception, and NULL.
Referenced by deltaR().
{ if (c1 == NULL || c2 == NULL) throw cms::Exception("Invalid Arg") << "attempted to calculate deltaEta for invalid Candidate(s)"; return c1->eta() - c2->eta(); }
double PFBenchmarkAlgo::deltaPhi | ( | const T * | c1, |
const U * | c2 | ||
) | [static] |
Definition at line 149 of file PFBenchmarkAlgo.h.
References Exception, M_PI, and NULL.
Referenced by deltaR().
{ if (c1 == NULL || c2 == NULL) throw cms::Exception("Invalid Arg") << "attempted to calculate deltaPhi for invalid Candidate(s)"; double phi1 = c1->phi(); if (phi1 > M_PI) phi1 -= ceil((phi1 - M_PI) / (2 * M_PI)) * 2 * M_PI; if (phi1 <= - M_PI) phi1 += ceil((phi1 + M_PI) / (-2. * M_PI)) * 2. * M_PI; double phi2 = c2->phi(); if (phi2 > M_PI) phi2 -= ceil((phi2 - M_PI) / (2 * M_PI)) * 2 * M_PI; if (phi2 <= - M_PI) phi2 += ceil((phi2 + M_PI) / (-2. * M_PI)) * 2 * M_PI; // alternative method: // while (phi > M_PI) phi -= 2 * M_PI; // while (phi <= - M_PI) phi += 2 * M_PI; double deltaphi=-999.0; if (fabs(phi1 - phi2)<M_PI) { deltaphi=(phi1-phi2); } else { if ((phi1-phi2)>0.0) { deltaphi=(2*M_PI - fabs(phi1 - phi2)); } else { deltaphi=-(2*M_PI - fabs(phi1 - phi2)); } } return deltaphi; //return ( (fabs(phi1 - phi2)<M_PI)?(phi1-phi2):(2*M_PI - fabs(phi1 - phi2) ) ); // FL: wrong }
double PFBenchmarkAlgo::deltaR | ( | const T * | c1, |
const U * | c2 | ||
) | [static] |
Definition at line 189 of file PFBenchmarkAlgo.h.
References deltaEta(), deltaPhi(), Exception, NULL, funct::pow(), and mathSSE::sqrt().
Referenced by TauTagValidation::analyze(), GenericBenchmark::fill(), findAllInCone(), matchByDeltaR(), and PFJetBenchmark::process().
Collection PFBenchmarkAlgo::findAllInCone | ( | const T * | c1, |
const Collection * | candidates, | ||
double | ConeSize | ||
) | [static] |
Definition at line 309 of file PFBenchmarkAlgo.h.
References deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, Exception, i, sortByDeltaR(), and vector_add().
{ typedef typename Collection::value_type U; // Try to verify the validity of Candidate and the Collection if (!c1) throw cms::Exception("Invalid Arg") << "attempted to constrain to invalid Candidate"; if (!candidates) throw cms::Exception("Invalid Arg") << "attempted to constrain invalid Collection"; if (ConeSize <= 0) throw cms::Exception("Invalid Arg") << "zero or negative cone size specified"; Collection constrained; for (unsigned int i = 0; i < candidates->size(); i++) { const U *c2 = &(*candidates)[i]; // Add in-cone Candidates to the new Collection double dR = deltaR(c1,c2); if (dR < ConeSize) vector_add(c2,constrained); } // Sort and return Collection sortByDeltaR(c1,constrained); return constrained; }
Collection PFBenchmarkAlgo::findAllInEtWindow | ( | const T * | c1, |
const Collection * | candidates, | ||
double | EtWindow | ||
) | [static] |
Definition at line 338 of file PFBenchmarkAlgo.h.
References deltaEt(), Exception, i, sortByDeltaEt(), and vector_add().
{ typedef typename Collection::value_type U; // Try to verify the validity of Candidate and the Collection if (!c1) throw cms::Exception("Invalid Arg") << "attempted to constrain to invalid Candidate"; if (!candidates) throw cms::Exception("Invalid Arg") << "attempted to constrain invalid Collection"; if (EtWindow <= 0) throw cms::Exception("Invalid Arg") << "zero or negative cone size specified"; Collection constrained; //CandidateCollection::const_iterator candidate; //for (candidate = candidates->begin(); candidate != candidates->end(); candidate++) { for (unsigned int i = 0; i < candidates->size(); i++) { const U *c2 = &(*candidates)[i]; // Add in-cone Candidates to the new Collection double dEt = fabs(deltaEt(c1,c2)); if (dEt < EtWindow) vector_add(c2,constrained); } // Sort and return Collection sortByDeltaEt(c1,constrained); return constrained; }
const Collection::value_type * PFBenchmarkAlgo::matchByDeltaEt | ( | const T * | c1, |
const Collection * | candidates | ||
) | [static] |
Definition at line 230 of file PFBenchmarkAlgo.h.
References deltaEt(), Exception, i, match(), benchmark_cfg::minDeltaEt, and NULL.
{ typedef typename Collection::value_type U; // Try to verify the validity of the Candidate and Collection if (!c1) throw cms::Exception("Invalid Arg") << "attempted to match invalid Candidate"; if (!candidates) throw cms::Exception("Invalid Arg") << "attempted to match to invalid Collection"; double minDeltaEt = 9999.; const U *match = NULL; // Loop Over the Candidates... for (unsigned int i = 0; i < candidates->size(); i++) { const T *c2 = &(*candidates)[i]; if (!c2) throw cms::Exception("Invalid Arg") << "attempted to match to invalid Candidate"; // Find Minimal Delta-R double dEt = fabs(deltaEt(c1,c2)); if (dEt <= minDeltaEt) { match = c2; minDeltaEt = dEt; } } // Return the Candidate with the smallest dR return match; }
const Collection::value_type * PFBenchmarkAlgo::matchByDeltaR | ( | const T * | c1, |
const Collection * | candidates | ||
) | [static] |
Definition at line 200 of file PFBenchmarkAlgo.h.
References deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, Exception, i, match(), and NULL.
Referenced by GenericBenchmark::fill(), and PFJetBenchmark::process().
{ typedef typename Collection::value_type U; // Try to verify the validity of the Candidate and Collection if (!c1) throw cms::Exception("Invalid Arg") << "attempted to match invalid Candidate"; if (!candidates) throw cms::Exception("Invalid Arg") << "attempted to match to invalid Collection"; double minDeltaR = 9999.; const U *match = NULL; // Loop Over the Candidates... for (unsigned int i = 0; i < candidates->size(); i++) { const U *c2 = &(*candidates)[i]; if (!c2) throw cms::Exception("Invalid Arg") << "attempted to match to invalid Candidate"; // Find Minimal Delta-R double dR = deltaR(c1,c2); if (dR <= minDeltaR) { match = c2; minDeltaR = dR; } } // Return the Candidate with the smallest dR return match; }
void PFBenchmarkAlgo::sortByDeltaEt | ( | const T * | c1, |
Collection & | candidates | ||
) | [static] |
Definition at line 294 of file PFBenchmarkAlgo.h.
References Exception, and vector_sort().
Referenced by findAllInEtWindow().
{ typedef typename Collection::value_type U; // Try to verify the validity of Candidate and Collection if (!c1) throw cms::Exception("Invalid Arg") << "attempted to sort by invalid Candidate"; if (!candidates) throw cms::Exception("Invalid Arg") << "attempted to sort invalid Candidates"; // Sort the collection vector_sort(candidates,deltaEtSorter<T,U>(c1)); }
void PFBenchmarkAlgo::sortByDeltaR | ( | const T * | c1, |
Collection & | candidates | ||
) | [static] |
Definition at line 279 of file PFBenchmarkAlgo.h.
References Exception, and vector_sort().
Referenced by findAllInCone().
{ typedef typename Collection::value_type U; // Try to verify the validity of Candidate and Collection if (!c1) throw cms::Exception("Invalid Arg") << "attempted to sort by invalid Candidate"; if (!candidates) throw cms::Exception("Invalid Arg") << "attempted to sort invalid Candidates"; // Sort the collection vector_sort(candidates,deltaRSorter<T,U>(c1)); }
static void PFBenchmarkAlgo::vector_add | ( | const T * | c1, |
edm::OwnVector< T > & | candidates | ||
) | [inline, static, private] |
Definition at line 85 of file PFBenchmarkAlgo.h.
References edm::OwnVector< T, P >::push_back().
static void PFBenchmarkAlgo::vector_add | ( | const T * | c1, |
std::vector< T > & | candidates | ||
) | [inline, static, private] |
Definition at line 73 of file PFBenchmarkAlgo.h.
Referenced by copyCollection(), findAllInCone(), and findAllInEtWindow().
{ candidates.push_back(*c1); }
static void PFBenchmarkAlgo::vector_sort | ( | edm::OwnVector< T > & | candidates, |
Sorter< T, U > | S | ||
) | [inline, static, private] |
Definition at line 79 of file PFBenchmarkAlgo.h.
References edm::OwnVector< T, P >::sort().
{ candidates.sort(S); }
static void PFBenchmarkAlgo::vector_sort | ( | std::vector< T > & | candidates, |
Sorter< T, U > | S | ||
) | [inline, static, private] |
Definition at line 67 of file PFBenchmarkAlgo.h.
References python::multivaluedict::sort().
Referenced by sortByDeltaEt(), and sortByDeltaR().
{ sort(candidates.begin(),candidates.end(),S); }