2 #ifndef RIVET_IsolationEstimators_HH
3 #define RIVET_IsolationEstimators_HH
5 #include "Rivet/Math/MathUtils.hh"
6 #include "Rivet/Particle.hh"
7 #include "Rivet/Jet.hh"
16 template <
typename T,
typename C >
17 class IsolationEstimator {
21 virtual ~IsolationEstimator(){};
23 virtual double estimate(
const T & t,
const C & c)
const = 0;
25 virtual int compare(
const IsolationEstimator < T, C > *other)
const = 0;
27 virtual bool before(
const IsolationEstimator * other)
const {
28 const std::type_info & thisid =
typeid(*this);
29 const std::type_info & otherid =
typeid(*other);
30 if (thisid == otherid) {
31 return compare(other) < 0;
33 return thisid.before(otherid);
37 bool operator < (
const IsolationEstimator& other)
const{
38 return this->before(&other);
45 template <
class T,
class C >
46 class PtInConeEstimator :
public IsolationEstimator < T, C > {
48 PtInConeEstimator(
double radius,
double ptmin = 0.0)
49 : _radius(radius), _ptmin(ptmin) { }
51 virtual double estimate(
const T & t,
const C & c)
const {
53 for (
typename C::const_iterator ic = c.begin(); ic != c.end(); ++ic) {
54 if (ic->momentum().pT() < _ptmin)
56 if (deltaR(t.momentum(), ic->momentum()) < _radius) {
57 ptsum += ic->momentum().pT();
60 return ptsum / t.momentum().pT();
63 virtual int compare(
const IsolationEstimator < T, C > *other)
const {
64 const PtInConeEstimator *concreteother =
dynamic_cast<const PtInConeEstimator*
>(other);
65 int ptmincmp =
cmp(_ptmin, concreteother->getPtMin());
68 int radcmp =
cmp(_radius, concreteother->getRadius());
74 double radius()
const {
78 double ptMin()
const {
89 template <
class T,
class C >
90 class MultiplicityInConeEstimator :
public IsolationEstimator < T, C > {
92 MultiplicityInConeEstimator(
double radius,
double ptmin = 0.0)
93 : _radius(radius), _ptmin(ptmin) { }
95 virtual double estimate(
const T & t,
const C & c)
const {
97 for (
typename C::const_iterator ic = c.begin(); ic != c.end(); ++ic) {
98 if (ic->momentum().pT() < _ptmin)
100 if (deltaR(t.momentum(), ic->momentum()) < _radius) {
107 virtual int compare(
const IsolationEstimator < T, C > *other)
const {
108 const MultiplicityInConeEstimator *concreteother = dynamic_cast <
const MultiplicityInConeEstimator * >(other);
109 int ptmincmp =
cmp(_ptmin, concreteother->getPtMin());
112 int radcmp =
cmp(_radius, concreteother->getRadius());
118 double radius()
const {
122 double ptMin()
const {
133 typedef MultiplicityInConeEstimator < Jet, std::vector < Jet > >JetIsoEstimatorByMultiplicity;
134 typedef MultiplicityInConeEstimator < Particle, std::vector < Jet > >ParticleFromJetIsoEstimatorByMultiplicity;
135 typedef MultiplicityInConeEstimator < Particle, std::vector < Particle > >ParticleIsoEstimatorByMultiplicity;
137 typedef PtInConeEstimator < Jet, std::vector < Jet > >JetIsoEstimatorByPt;
138 typedef PtInConeEstimator < Particle, std::vector < Jet > >ParticleFromJetIsoEstimatorByPt;
139 typedef PtInConeEstimator < Particle, std::vector < Particle > >ParticleIsoEstimatorByPt;
140 template <
typename TYPE1,
typename TYPE2>
struct isohelper {
141 typedef IsolationEstimator<TYPE1, TYPE2> estimatorhelper;
Definition: MC_JetAnalysis.hh:9
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition: Cmp.hh:285