2 #ifndef RIVET_IsolationProjection_HH
3 #define RIVET_IsolationProjection_HH
5 #include "Rivet/Event.hh"
6 #include "Rivet/Projection.hh"
7 #include "Rivet/Math/Units.hh"
8 #include "Rivet/Projections/IsolationEstimators.hh"
9 #include <boost/shared_ptr.hpp>
16 template <
typename PROJ1,
typename PROJ2,
17 typename EST =
typename isohelper<typename PROJ1::entity_type, typename PROJ2::collection_type>::estimatorhelper>
24 double ptmin = 0*GeV) :
25 _estimator(estimator),
34 const vector<pair<const typename PROJ1::entity_type*, double> >
53 boost::shared_ptr<EST> _estimator;
63 vector<pair<const typename PROJ1::entity_type*, double> > _isovalues;
67 template<
typename PROJ1,
typename PROJ2,
typename EST>
70 vector<pair<const typename PROJ1::entity_type*, double> > out;
71 for (
typename vector<pair<const typename PROJ1::entity_type*, double> >::const_iterator i = _isovalues.begin(); i != _isovalues.end(); ++i){
72 if (i->second < maxiso) out.push_back(*i);
78 template<
typename PROJ1,
typename PROJ2,
typename EST>
83 const PROJ1& isofs = applyProjection<PROJ1>(e,
"ToBeIsolated");
86 const typename PROJ1::collection_type isopart = isofs.entities();
87 const PROJ2& ctrlfs = applyProjection<PROJ2>(e,
"Control");
88 const typename PROJ2::collection_type ctrlpart = ctrlfs.entities();
89 for (
typename PROJ1::collection_type::const_iterator iiso = isopart.begin(); iiso != isopart.end(); ++iiso){
90 if (iiso->getMomentum().pT() < _ptmin)
continue;
91 double isolation = _estimator->estimate(*iiso, ctrlpart);
92 log << Log::DEBUG <<
"Isolation for particle with momentum " << iiso->getMomentum()
93 <<
" is " << isolation << endl;
94 _isovalues.push_back(make_pair(&(*iiso), isolation));
98 template<
typename PROJ1,
typename PROJ2,
typename EST>
102 int isofscmp = mkNamedPCmp(other,
"ToBeIsolated");
103 if (isofscmp != EQUIVALENT)
return isofscmp;
104 int isoctrlcmp = mkNamedPCmp(other,
"Control");
105 if (isoctrlcmp != EQUIVALENT)
return isoctrlcmp;
107 int ptmincmp =
cmp(_ptmin, other._ptmin);
108 if (ptmincmp != EQUIVALENT)
return ptmincmp;
111 return cmp(*(_estimator.get()),*(other._estimator.get()));