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()));
void setName(const std::string &name)
Used by derived classes to set their name.
Definition: Projection.hh:120
Definition: MC_JetAnalysis.hh:9
IsolationProjection(PROJ1 &iso, PROJ2 &ctrl, EST *estimator, double ptmin=0 *GeV)
Constructor.
Definition: IsolationProjection.hh:21
const vector< pair< const typename PROJ1::entity_type *, double > > isolatedParticles(double maxiso=numeric_limits< double >::max()) const
Get the isolation values for the isofinalstate.
Definition: IsolationProjection.hh:69
Definition: IsolationProjection.hh:18
virtual const Projection * clone() const
Clone on the heap.
Definition: IsolationProjection.hh:37
virtual int compare(const Projection &p) const
Compare projections.
Definition: IsolationProjection.hh:99
virtual void project(const Event &e)
Apply the projection to the event.
Definition: IsolationProjection.hh:79
const PROJ & addProjection(const PROJ &proj, const std::string &name)
Definition: ProjectionApplier.hh:113
Base class for all Rivet projections.
Definition: Projection.hh:28
Cmp< T > cmp(const T &t1, const T &t2)
Global helper function for easy creation of Cmp objects.
Definition: Cmp.hh:285