rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.2
ProjectionHandler.hh
1// -*- C++ -*-
2#ifndef RIVET_ProjectionHandler_HH
3#define RIVET_ProjectionHandler_HH
4
5// @todo all thread/mutex code belongs to a temporary fix to allow for
6// basic threading
7#include <thread>
8#include <mutex>
9#include "Rivet/Config/RivetCommon.hh"
10#include "Rivet/Projection.fhh"
11
12namespace Rivet {
13
14
16 typedef std::shared_ptr<const Projection> ProjHandle;
17
18 // Forward declaration.
20
44 public:
45
47 friend class ProjectionApplier;
48
50 typedef set<ProjHandle> ProjHandles;
51
54 typedef map<string, ProjHandle> NamedProjs;
55
57 enum ProjDepth { SHALLOW, DEEP };
58
59
60 private:
61
64 typedef map<const ProjectionApplier*, NamedProjs> NamedProjsMap;
65
68 NamedProjsMap _namedprojs;
69
72 ProjHandles _projs;
73
74
75 public:
76
79
81 ~ProjectionHandler() = default;
82
85
88
90 ProjectionHandler() = default;
91
92 public:
93
97 const Projection& registerProjection(const ProjectionApplier& parent,
98 const Projection& proj,
99 const string& name);
101
102
103 private:
104
107
110 ProjHandle _getEquiv(const Projection& proj) const;
111
113 unique_ptr<Projection> _clone(const Projection& proj);
114
116 const Projection& _register(const ProjectionApplier& parent,
117 ProjHandle proj,
118 const string& name);
119
121 string _getStatus() const;
122
124 bool _checkDuplicate(const ProjectionApplier& parent,
125 const Projection& proj,
126 const string& name) const;
127
129
130
131 public:
132
135
137 bool hasProjection(const ProjectionApplier& parent, const string& name) const;
138
145 const string& name) const;
146
153 set<const Projection*> getChildProjections(const ProjectionApplier& parent,
154 ProjDepth depth=SHALLOW) const;
156
157
158 private:
159
161 void removeProjectionApplier(ProjectionApplier& parent);
162
163
164 private:
165
166 // /// Get map of named projections belonging to @a parent.
167 // /// Throws an exception if @a parent has not got any registered projections.
168 // const NamedProjs& namedProjs(const ProjectionApplier* parent) const {
169 // NamedProjsMap::const_iterator nps = _namedprojs.find(parent);
170 // if (nps == _namedprojs.end()) {
171 // stringstream ss;
172 // ss << "No NamedProjs registered for parent " << parent;
173 // throw Error(ss.str());
174 // }
175 // return *nps;
176 // }
177
178
179 };
180
181
182}
183
184#endif
Common base class for Projection and Analysis, used for internal polymorphism.
Definition ProjectionApplier.hh:22
The projection handler is a central repository for projections to be used in a Rivet analysis run.
Definition ProjectionHandler.hh:43
const Projection & getProjection(const ProjectionApplier &parent, const string &name) const
set< const Projection * > getChildProjections(const ProjectionApplier &parent, ProjDepth depth=SHALLOW) const
ProjectionHandler & operator=(const ProjectionHandler &)=delete
The assignment operator is hidden.
bool hasProjection(const ProjectionApplier &parent, const string &name) const
Check if there is a name projection registered by parent.
set< ProjHandle > ProjHandles
Typedef for a vector of Projection pointers.
Definition ProjectionHandler.hh:50
ProjectionHandler()=default
The standard constructor.
ProjDepth
Enum to specify depth of projection search.
Definition ProjectionHandler.hh:57
ProjectionHandler(const ProjectionHandler &)=delete
The copy constructor is hidden.
map< string, ProjHandle > NamedProjs
Typedef for the structure used to contain named projections for a particular containing Analysis or P...
Definition ProjectionHandler.hh:54
~ProjectionHandler()=default
Private destructor means no inheritance from this class.
Base class for all Rivet projections.
Definition Projection.hh:29
Definition MC_CENT_PPB_Projections.hh:10
std::shared_ptr< const Projection > ProjHandle
Typedef for Projection (smart) pointer.
Definition ProjectionHandler.hh:16