/usr/include/Rivet/ProjectionApplier.hh is in librivet-dev 1.8.3-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | // -*- C++ -*-
#ifndef RIVET_ProjectionApplier_HH
#define RIVET_ProjectionApplier_HH
#include "Rivet/Rivet.hh"
#include "Rivet/Event.fhh"
#include "Rivet/Projection.fhh"
#include "Rivet/ProjectionHandler.hh"
#include "Rivet/Tools/Logging.hh"
namespace Rivet {
/// @brief Common base class for Projection and Analysis, used for internal polymorphism
///
/// Empty interface used for storing Projection and Analysis pointers in the
/// same container (used by the ProjectionHandler)
class ProjectionApplier {
public:
// The proj handler needs access to reset the _allowProjReg flag before calling a.init()
// friend class ProjectionHandler;
/// Constructor
ProjectionApplier();
// Virtual destructor: ensure that inheritance is possible.
virtual ~ProjectionApplier();
public:
/// @name Metadata functions
//@{
/// Get the name of this Projection or Analysis class
virtual std::string name() const = 0;
//@}
/// @name Projection "getting" functions
//@{
/// Get the contained projections, including recursion.
std::set<ConstProjectionPtr> getProjections() const {
return getProjHandler().getChildProjections(*this, ProjectionHandler::DEEP);
}
/// Get the named projection, specifying return type via a template argument.
template <typename PROJ>
const PROJ& getProjection(const std::string& name) const {
const Projection& p = getProjHandler().getProjection(*this, name);
return pcast<PROJ>(p);
}
/// Get the named projection (non-templated, so returns as a reference to a
/// Projection base class).
const Projection& getProjection(const std::string& name) const {
return getProjHandler().getProjection(*this, name);
}
//@}
/// @name Projection applying functions
//@{
/// Apply the supplied projection on @a event.
template <typename PROJ>
const PROJ& applyProjection(const Event& evt, const PROJ& proj) const {
return pcast<PROJ>(_applyProjection(evt, proj));
}
/// Apply the supplied projection on @a event.
template <typename PROJ>
const PROJ& applyProjection(const Event& evt, const Projection& proj) const {
return pcast<PROJ>(_applyProjection(evt, proj));
}
/// Apply the named projection on @a event.
template <typename PROJ>
const PROJ& applyProjection(const Event& evt, const std::string& name) const {
return pcast<PROJ>(_applyProjection(evt, name));
}
//@}
protected:
Log& getLog() const {
return Log::getLog("Rivet.ProjectionHandler");
}
/// Get a reference to the ProjectionHandler for this thread.
ProjectionHandler& getProjHandler() const {
return _projhandler;
}
protected:
/// @name Projection registration functions
//@{
/// Register a contained projection. The type of the argument is used to
/// instantiate a new projection internally: this new object is applied to
/// events rather than the argument object. Hence you are advised to only use
/// locally-scoped Projection objects in your Projection and Analysis
/// constructors, and to avoid polymorphism (e.g. handling @c ConcreteProjection
/// via a pointer or reference to type @c Projection) since this will screw
/// up the internal type management.
template <typename PROJ>
const PROJ& addProjection(const PROJ& proj, const std::string& name) {
const Projection& reg = _addProjection(proj, name);
const PROJ& rtn = dynamic_cast<const PROJ&>(reg);
return rtn;
}
/// Untemplated function to do the work...
const Projection& _addProjection(const Projection& proj, const std::string& name);
//@}
private:
/// Non-templated version of string-based applyProjection, to work around
/// header dependency issue.
const Projection& _applyProjection(const Event& evt, const std::string& name) const;
/// Non-templated version of proj-based applyProjection, to work around
/// header dependency issue.
const Projection& _applyProjection(const Event& evt, const Projection& proj) const;
protected:
/// Flag to forbid projection registration in analyses until the init phase
bool _allowProjReg;
private:
/// Pointer to projection handler.
ProjectionHandler& _projhandler;
};
}
#endif
|