ProjectionApplier.hh
Go to the documentation of this file.00001
00002 #ifndef RIVET_ProjectionApplier_HH
00003 #define RIVET_ProjectionApplier_HH
00004
00005 #include "Rivet/Rivet.hh"
00006 #include "Rivet/Event.fhh"
00007 #include "Rivet/Projection.fhh"
00008 #include "Rivet/ProjectionHandler.hh"
00009 #include "Rivet/Tools/Logging.hh"
00010
00011 namespace Rivet {
00012
00013
00014
00015
00016
00017
00018 class ProjectionApplier {
00019 public:
00020
00021
00022
00023
00024
00025 ProjectionApplier();
00026
00027
00028 virtual ~ProjectionApplier();
00029
00030
00031 public:
00032
00033
00034
00035
00036 virtual std::string name() const = 0;
00037
00038
00039
00040
00041
00042 std::set<ConstProjectionPtr> getProjections() const {
00043 return getProjHandler().getChildProjections(*this, ProjectionHandler::DEEP);
00044 }
00045
00046
00047
00048 template <typename PROJ>
00049 const PROJ& getProjection(const std::string& name) const {
00050 const Projection& p = getProjHandler().getProjection(*this, name);
00051 return pcast<PROJ>(p);
00052 }
00053
00054
00055
00056
00057 const Projection& getProjection(const std::string& name) const {
00058 return getProjHandler().getProjection(*this, name);
00059 }
00060
00061
00062
00063
00064
00065
00066 template <typename PROJ>
00067 const PROJ& applyProjection(const Event& evt, const PROJ& proj) const {
00068 return pcast<PROJ>(_applyProjection(evt, proj));
00069 }
00070
00071
00072
00073 template <typename PROJ>
00074 const PROJ& applyProjection(const Event& evt, const Projection& proj) const {
00075 return pcast<PROJ>(_applyProjection(evt, proj));
00076 }
00077
00078
00079
00080 template <typename PROJ>
00081 const PROJ& applyProjection(const Event& evt, const std::string& name) const {
00082 return pcast<PROJ>(_applyProjection(evt, name));
00083 }
00084
00085
00086
00087 protected:
00088
00089 Log& getLog() const {
00090 return Log::getLog("Rivet.ProjectionHandler");
00091 }
00092
00093
00094 ProjectionHandler& getProjHandler() const {
00095 return _projhandler;
00096 }
00097
00098
00099 protected:
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 template <typename PROJ>
00113 const PROJ& addProjection(const PROJ& proj, const std::string& name) {
00114 const Projection& reg = _addProjection(proj, name);
00115 const PROJ& rtn = dynamic_cast<const PROJ&>(reg);
00116 return rtn;
00117 }
00118
00119
00120
00121 const Projection& _addProjection(const Projection& proj, const std::string& name);
00122
00123
00124
00125
00126 private:
00127
00128
00129
00130 const Projection& _applyProjection(const Event& evt, const std::string& name) const;
00131
00132
00133
00134 const Projection& _applyProjection(const Event& evt, const Projection& proj) const;
00135
00136
00137 protected:
00138
00139
00140 bool _allowProjReg;
00141
00142
00143 private:
00144
00145
00146 ProjectionHandler& _projhandler;
00147
00148 };
00149
00150 }
00151
00152 #endif