rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
Rivet::ProjectionHandler Class Reference

The projection handler is a central repository for projections to be used in a Rivet analysis run. More...

#include <ProjectionHandler.hh>

Public Types

enum  ProjDepth { SHALLOW , DEEP }
 Enum to specify depth of projection search.
 
typedef set< ProjHandleProjHandles
 Typedef for a vector of Projection pointers.
 
typedef map< string, ProjHandleNamedProjs
 Typedef for the structure used to contain named projections for a particular containing Analysis or Projection.
 

Public Member Functions

Construction. *‍/
 ~ProjectionHandler ()=default
 Private destructor means no inheritance from this class.
 
ProjectionHandleroperator= (const ProjectionHandler &)=delete
 The assignment operator is hidden.
 
 ProjectionHandler (const ProjectionHandler &)=delete
 The copy constructor is hidden.
 
 ProjectionHandler ()=default
 The standard constructor.
 
Projection registration

Attach and retrieve a projection as a reference.

const ProjectionregisterProjection (const ProjectionApplier &parent, const Projection &proj, const string &name)
 
Projection retrieval. *‍/
bool hasProjection (const ProjectionApplier &parent, const string &name) const
 Check if there is a name projection registered by parent.
 
const ProjectiongetProjection (const ProjectionApplier &parent, const string &name) const
 
set< const Projection * > getChildProjections (const ProjectionApplier &parent, ProjDepth depth=SHALLOW) const
 

Friends

class ProjectionApplier
 ProjectionApplier's destructor needs to trigger cleaning up the proj handler repo.
 

Detailed Description

The projection handler is a central repository for projections to be used in a Rivet analysis run.

Without centralised projections, it can be hard to know which of an equivalent set of projections will be run on a particular event. In turn, this may mean that certain projections in the chain can go out of scope unexpectedly. There were originally also the issues that projections may need to be held as member pointers to an abstract base class, since post-construction setup is needed; that projections contained pointers to their own dependency chain, which could go out of scope; and that projection members could be modified after being applied to an event which, due to the caching model, would have unpredictable consequences.

By centralising all the projections, these issues are eliminated, as well as allowing analysis classes to contain fewer data members (since projections are now better accessed by name than by storing a data member reference or pointer).

The core of the ProjectionHandler design is that it is a singleton class, essentially a wrapper around a map of Projection*, indexed by a hash of the registering object and its local name for the registered projection.

Member Function Documentation

◆ getChildProjections()

set< const Projection * > Rivet::ProjectionHandler::getChildProjections ( const ProjectionApplier parent,
ProjDepth  depth = SHALLOW 
) const

Get child projections for the given parent. By default this will just return the projections directly contained by the parent, but the depth argument can be changed to do a deep retrieval, which will recurse through the whole projection chain. In this case, there is no protection against getting stuck in a circular projection dependency loop. Does NOT look in declQueue

Referenced by Rivet::ProjectionApplier::getImmediateChildProjections(), and Rivet::ProjectionApplier::getProjections().

◆ getProjection()

const Projection & Rivet::ProjectionHandler::getProjection ( const ProjectionApplier parent,
const string &  name 
) const

Retrieve a named projection for the given parent. Returning as a reference is partly to discourage ProjectionApplier classes from storing pointer members to the registered projections, since that can lead to problems and there is no need to do so. Does look in the declQueue, but NOT recursively (yet?).

Referenced by Rivet::ProjectionApplier::getProjection().


The documentation for this class was generated from the following file: