2 #ifndef RIVET_ProjectionApplier_HH 3 #define RIVET_ProjectionApplier_HH 5 #include "Rivet/Config/RivetCommon.hh" 6 #include "Rivet/Projection.fhh" 7 #include "Rivet/ProjectionHandler.hh" 8 #include "Rivet/Tools/Logging.hh" 36 virtual std::string
name()
const = 0;
55 template <
typename PROJ>
58 return pcast<PROJ>(p);
62 template <
typename PROJ>
63 const PROJ&
get(
const std::string&
name)
const {
return getProjection<PROJ>(
name); }
80 template <
typename PROJ=Projection>
81 typename std::enable_if_t<std::is_base_of<Projection, PROJ>::value,
const PROJ&>
83 return pcast<PROJ>(_applyProjection(evt, proj));
87 template <
typename PROJ=Projection>
88 typename std::enable_if_t<std::is_base_of<Projection, PROJ>::value,
const PROJ&>
95 template <
typename PROJ=Projection>
96 typename std::enable_if_t<std::is_base_of<Projection, PROJ>::value,
const PROJ&>
98 return pcast<PROJ>(_applyProjection(evt, proj));
102 template <
typename PROJ=Projection>
103 typename std::enable_if_t<std::is_base_of<Projection, PROJ>::value,
const PROJ&>
104 apply(
const Event& evt,
const PROJ& proj)
const {
return applyProjection<PROJ>(evt, proj); }
110 template <
typename PROJ=Projection>
111 typename std::enable_if_t<std::is_base_of<Projection, PROJ>::value,
const PROJ&>
113 return pcast<PROJ>(_applyProjection(evt, name));
117 template <
typename PROJ=Projection>
118 typename std::enable_if_t<std::is_base_of<Projection, PROJ>::value,
const PROJ&>
122 template <
typename PROJ=Projection>
123 typename std::enable_if_t<std::is_base_of<Projection, PROJ>::value,
const PROJ&>
135 Log& getLog()
const {
160 template <
typename PROJ>
162 const Projection& reg = _declareProjection(proj, name);
163 const PROJ& rtn =
dynamic_cast<const PROJ&
>(reg);
169 template <
typename PROJ>
173 template <
typename PROJ>
185 const Projection& _applyProjection(
const Event& evt,
const std::string& name)
const;
Definition: MC_Cent_pPb.hh:10
bool hasProjection(const std::string &name) const
Does this applier have a projection registered under the name name?
Definition: ProjectionApplier.hh:49
void markAsOwned() const
Mark this object as owned by a proj-handler.
Definition: ProjectionApplier.hh:130
const Projection & getProjection(const ProjectionApplier &parent, const string &name) const
static Log & getLog(const std::string &name)
std::set< ConstProjectionPtr > getProjections() const
Get the contained projections, including recursion.
Definition: ProjectionApplier.hh:44
Logging system for controlled & formatted writing to stdout.
Definition: Logging.hh:10
virtual std::string name() const =0
Get the name of this Projection or Analysis class.
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > apply(const std::string &name, const Event &evt) const
Apply the supplied projection on event evt (convenience arg-reordering alias).
Definition: ProjectionApplier.hh:124
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > apply(const Event &evt, const PROJ &proj) const
Apply the supplied projection on event evt (user-facing alias).
Definition: ProjectionApplier.hh:104
The projection handler is a central repository for projections to be used in a Rivet analysis run...
Definition: ProjectionHandler.hh:43
const PROJ & declareProjection(const PROJ &proj, const std::string &name)
Register a contained projection.
Definition: ProjectionApplier.hh:161
Representation of a HepMC event, and enabler of Projection caching.
Definition: Event.hh:22
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > apply(const Event &evt, const std::string &name) const
Apply the supplied projection on event evt (user-facing alias).
Definition: ProjectionApplier.hh:119
ProjectionHandler & getProjHandler() const
Get a reference to the ProjectionHandler for this thread.
Definition: ProjectionApplier.hh:141
Common base class for Projection and Analysis, used for internal polymorphism.
Definition: ProjectionApplier.hh:21
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > applyProjection(const Event &evt, const std::string &name) const
Definition: ProjectionApplier.hh:112
const PROJ & getProjection(const std::string &name) const
Definition: ProjectionApplier.hh:56
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > apply(const Event &evt, const Projection &proj) const
Apply the supplied projection on event evt (user-facing alias).
Definition: ProjectionApplier.hh:89
const Projection & getProjection(const std::string &name) const
Definition: ProjectionApplier.hh:67
const PROJ & declare(const PROJ &proj, const std::string &name)
Register a contained projection (user-facing version)
Definition: ProjectionApplier.hh:170
bool hasProjection(const ProjectionApplier &parent, const string &name) const
Check if there is a name projection registered by parent.
ProjectionApplier()
Constructor.
const PROJ & declare(const std::string &name, const PROJ &proj)
Register a contained projection (user-facing, arg-reordered version)
Definition: ProjectionApplier.hh:174
Base class for all Rivet projections.
Definition: Projection.hh:29
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > applyProjection(const Event &evt, const Projection &proj) const
Definition: ProjectionApplier.hh:82
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > applyProjection(const Event &evt, const PROJ &proj) const
Definition: ProjectionApplier.hh:97
set< const Projection * > getChildProjections(const ProjectionApplier &parent, ProjDepth depth=SHALLOW) const