Projection Class Reference

Base class for all Rivet projections. More...

#include <Projection.hh>

Inheritance diagram for Projection:
Inheritance graph
[legend]
Collaboration diagram for Projection:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void project (const Event &e)=0
bool before (const Projection &p) const
virtual const std::set< PdgIdPairbeamPairs () const
virtual std::string name () const
 Get the name of the projection.
ProjectionaddPdgIdPair (PdgId beam1, PdgId beam2)
 Add a colliding beam pair.
LoggetLog () const
 Get a Log object based on the getName() property of the calling projection object.
void setName (const std::string &name)
 Used by derived classes to set their name.
Standard constructors and destructors.

 Projection ()
 The default constructor.
virtual const Projectionclone () const =0
 Clone on the heap.
virtual ~Projection ()
 The destructor.
Projection "getting" functions

std::set< ConstProjectionPtrgetProjections () const
 Get the contained projections, including recursion.
template<typename PROJ >
const PROJ & getProjection (const std::string &name) const
 Get the named projection, specifying return type via a template argument.
const ProjectiongetProjection (const std::string &name) const
Projection applying functions

template<typename PROJ >
const PROJ & applyProjection (const Event &evt, const PROJ &proj) const
 Apply the supplied projection on event.
template<typename PROJ >
const PROJ & applyProjection (const Event &evt, const Projection &proj) const
 Apply the supplied projection on event.
template<typename PROJ >
const PROJ & applyProjection (const Event &evt, const std::string &name) const
 Apply the named projection on event.

Protected Member Functions

virtual int compare (const Projection &p) const =0
Cmp< ProjectionmkNamedPCmp (const Projection &otherparent, const std::string &pname) const
Cmp< ProjectionmkPCmp (const Projection &otherparent, const std::string &pname) const
ProjectionHandlergetProjHandler () const
 Get a reference to the ProjectionHandler for this thread.
Projection registration functions

template<typename PROJ >
const PROJ & addProjection (const PROJ &proj, const std::string &name)
const Projection_addProjection (const Projection &proj, const std::string &name)
 Untemplated function to do the work...

Protected Attributes

bool _allowProjReg
 Flag to forbid projection registration in analyses until the init phase.

Private Attributes

string _name
set< PdgIdPair_beamPairs
 Beam-type constraint.

Friends

class Event
 Event is a friend.
class Cmp< Projection >
 The Cmp specialization for Projection is a friend.

Detailed Description

Base class for all Rivet projections.

Projection is the base class of all Projections to be used by Rivet. A Projection object can be assigned to an Event object and will then define a processed part of the information available in the Event, which then can be used by other Projection objects and/or Analysis objects.

The main virtual functions to be overridden by concrete sub-classes are project(const Event &) and compare(const Projection &).

Definition at line 28 of file Projection.hh.


Constructor & Destructor Documentation

Projection (  ) 

The default constructor.

Definition at line 10 of file Projection.cc.

References Projection::addPdgIdPair(), and Rivet::ANY.

00011     : _name("BaseProjection")
00012   {
00013     addPdgIdPair(ANY, ANY);
00014     //getLog() << Log::TRACE << "Creating " << name() << " at " << this << endl;
00015   }

~Projection (  )  [virtual]

The destructor.

Definition at line 18 of file Projection.cc.

00018                            {
00019     //getLog() << Log::TRACE << "Destroying " << name() << " at " << this << endl;
00020   }


Member Function Documentation

const Projection & _addProjection ( const Projection proj,
const std::string &  name 
) [protected, inherited]

Untemplated function to do the work...

Definition at line 33 of file ProjectionApplier.cc.

References ProjectionApplier::_allowProjReg, ProjectionApplier::getProjHandler(), ProjectionApplier::name(), Projection::name(), and ProjectionHandler::registerProjection().

Referenced by ProjectionApplier::addProjection().

00034                                                                              {
00035     if (!_allowProjReg) {
00036       cerr << "Trying to register projection '"
00037            << proj.name() << "' before init phase in '" << this->name() << "'." << endl;
00038       exit(2);
00039     }
00040     const Projection& reg = getProjHandler().registerProjection(*this, proj, name);
00041     return reg;
00042   }

Projection& addPdgIdPair ( PdgId  beam1,
PdgId  beam2 
) [inline]

Add a colliding beam pair.

Definition at line 107 of file Projection.hh.

References Projection::_beamPairs.

Referenced by Projection::Projection().

00107                                                        {
00108       _beamPairs.insert(PdgIdPair(beam1, beam2));
00109       return *this;
00110     }

const PROJ& addProjection ( const PROJ &  proj,
const std::string &  name 
) [inline, protected, inherited]

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 ConcreteProjection via a pointer or reference to type Projection) since this will screw up the internal type management.

Definition at line 113 of file ProjectionApplier.hh.

References ProjectionApplier::_addProjection().

Referenced by ZFinder::_init(), WFinder::_init(), VetoedFinalState::addVetoOnThisFinalState(), BeamThrust::BeamThrust(), CDF_2009_S8057893::CDF_2009_S8057893::init(), CentralEtHCM::CentralEtHCM(), ChargedFinalState::ChargedFinalState(), ChargedLeptons::ChargedLeptons(), ClusteredPhotons::ClusteredPhotons(), DISFinalState::DISFinalState(), DISKinematics::DISKinematics(), DISLepton::DISLepton(), FinalState::FinalState(), FoxWolframMoments::FoxWolframMoments(), FParameter::FParameter(), HadronicFinalState::HadronicFinalState(), Hemispheres::Hemispheres(), IdentifiedFinalState::IdentifiedFinalState(), ZEUS_2001_S4815815::init(), UA5_1989_S1926373::init(), UA5_1988_S1867512::init(), UA5_1987_S1640666::init(), UA5_1986_S1583476::init(), UA5_1982_S875503::init(), UA1_1990_S2044935::init(), TASSO_1990_S2148048::init(), STAR_2009_UE_HELEN::init(), STAR_2008_S7993412::init(), STAR_2008_S7869363::init(), STAR_2006_S6870392::init(), STAR_2006_S6860818::init(), STAR_2006_S6500200::init(), SFM_1984_S1178091::init(), PDG_HADRON_MULTIPLICITIES_RATIOS::init(), PDG_HADRON_MULTIPLICITIES::init(), OPAL_2004_S6132243::init(), OPAL_2001_S4553896::init(), OPAL_1998_S3780481::init(), OPAL_1993_S2692198::init(), MC_ZZJETS::init(), MC_ZJETS::init(), MC_WWJETS::init(), MC_WPOL::init(), MC_WJETS::init(), MC_VH2BB::init(), MC_TTBAR::init(), MC_SUSY::init(), MC_PHOTONJETUE::init(), MC_PHOTONJETS::init(), MC_LEADINGJETS::init(), MC_JETS::init(), MC_HJETS::init(), MC_GENERIC::init(), MC_DIPHOTON::init(), MC_DIJET::init(), LHCB_2010_S8758301::init(), JADE_OPAL_2000_S4300807::init(), JADE_1998_S3612880::init(), H1_2000_S4129130::init(), H1_1995_S3167097::init(), H1_1994_S2919893::init(), ExampleAnalysis::init(), E735_1998_S3905616::init(), DELPHI_2003_WUD_03_11::init(), DELPHI_2002_069_CONF_603::init(), DELPHI_1996_S3430090::init(), DELPHI_1995_S3137023::init(), D0_2010_S8821313::init(), D0_2010_S8671338::init(), D0_2010_S8570965::init(), D0_2010_S8566488::init(), D0_2009_S8349509::init(), D0_2009_S8320160::init(), D0_2009_S8202443::init(), D0_2008_S7863608::init(), D0_2008_S7837160::init(), D0_2008_S7719523::init(), D0_2008_S7662670::init(), D0_2008_S7554427::init(), D0_2008_S6879055::init(), D0_2007_S7075677::init(), D0_2006_S6438750::init(), D0_2004_S5992206::init(), D0_2001_S4674421::init(), D0_2000_S4480767::init(), D0_1996_S3324664::init(), D0_1996_S3214044::init(), CMS_2011_S9120041::init(), CMS_2011_S9088458::init(), CMS_2011_S9086218::init(), CMS_2011_S8978280::init(), CMS_2011_S8968497::init(), CMS_2011_S8957746::init(), CMS_2011_S8950903::init(), CMS_2011_S8884919::init(), CMS_2010_S8656010::init(), CMS_2010_S8547297::init(), CDF_2010_S8591881_QCD::init(), CDF_2010_S8591881_DY::init(), CDF_2009_S8436959::init(), CDF_2009_S8383952::init(), CDF_2009_S8233977::init(), CDF_2009_NOTE_9936::init(), CDF_2008_S8095620::init(), CDF_2008_S8093652::init(), CDF_2008_S7828950::init(), CDF_2008_S7782535::init(), CDF_2008_S7541902::init(), CDF_2008_S7540469::init(), CDF_2008_NOTE_9351::init(), CDF_2008_LEADINGJETS::init(), CDF_2007_S7057202::init(), CDF_2006_S6653332::init(), CDF_2006_S6450792::init(), CDF_2005_S6217184::init(), CDF_2005_S6080774::init(), CDF_2004_S5839831::init(), CDF_2001_S4751469::init(), CDF_2001_S4563131::init(), CDF_2001_S4517016::init(), CDF_2000_S4266730::init(), CDF_2000_S4155203::init(), CDF_1998_S3618439::init(), CDF_1997_S3541940::init(), CDF_1996_S3418421::init(), CDF_1996_S3349578::init(), CDF_1996_S3108457::init(), CDF_1994_S2952106::init(), CDF_1993_S2742446::init(), CDF_1990_S2089246::init(), CDF_1988_S1865951::init(), BELLE_2006_S6265367::init(), ATLAS_2011_S9225137::init(), ATLAS_2011_S9212183::init(), ATLAS_2011_S9131140::init(), ATLAS_2011_S9128077::init(), ATLAS_2011_S9126244::init(), ATLAS_2011_S9120807::init(), ATLAS_2011_S9108483::init(), ATLAS_2011_S9041966::init(), ATLAS_2011_S9019561::init(), ATLAS_2011_S9002537::init(), ATLAS_2011_S8994773::init(), ATLAS_2011_S8983313::init(), ATLAS_2011_S8971293::init(), ATLAS_2011_S8924791::init(), ATLAS_2011_I925932::init(), ATLAS_2011_I919017::init(), ATLAS_2011_CONF_2011_098::init(), ATLAS_2011_CONF_2011_090::init(), ATLAS_2010_S8919674::init(), ATLAS_2010_S8918562::init(), ATLAS_2010_S8914702::init(), ATLAS_2010_S8894728::init(), ATLAS_2010_S8817804::init(), ATLAS_2010_S8591806::init(), ATLAS_2010_CONF_2010_049::init(), ALICE_2011_S8945144::init(), ALICE_2011_S8909580::init(), ALICE_2010_S8706239::init(), ALICE_2010_S8625980::init(), ALICE_2010_S8624100::init(), ALEPH_2004_S5765862::init(), ALEPH_1996_S3486095::init(), ALEPH_1996_S3196992::init(), ALEPH_1991_S2435284::init(), IsolationProjection< PROJ1, PROJ2, EST >::IsolationProjection(), JetAlg::JetAlg(), JetShape::JetShape(), LeadingParticlesFinalState::LeadingParticlesFinalState(), LeptonClusters::LeptonClusters(), LossyFinalState< ConstRandomFilter >::LossyFinalState(), MergedFinalState::MergedFinalState(), MissingMomentum::MissingMomentum(), Multiplicity::Multiplicity(), NeutralFinalState::NeutralFinalState(), NonHadronicFinalState::NonHadronicFinalState(), ParisiTensor::ParisiTensor(), Sphericity::Sphericity(), Spherocity::Spherocity(), SVertex::SVertex(), Thrust::Thrust(), TotalVisibleMomentum::TotalVisibleMomentum(), TriggerCDFRun0Run1::TriggerCDFRun0Run1(), TriggerCDFRun2::TriggerCDFRun2(), TriggerUA5::TriggerUA5(), VetoedFinalState::VetoedFinalState(), and VisibleFinalState::VisibleFinalState().

00113                                                                        {
00114       const Projection& reg = _addProjection(proj, name);
00115       const PROJ& rtn = dynamic_cast<const PROJ&>(reg);
00116       return rtn;
00117     }

const PROJ& applyProjection ( const Event evt,
const std::string &  name 
) const [inline, inherited]

Apply the named projection on event.

Definition at line 81 of file ProjectionApplier.hh.

References ProjectionApplier::_applyProjection().

00081                                                                                {
00082       return pcast<PROJ>(_applyProjection(evt, name));
00083     }

const PROJ& applyProjection ( const Event evt,
const Projection proj 
) const [inline, inherited]

Apply the supplied projection on event.

Definition at line 74 of file ProjectionApplier.hh.

References ProjectionApplier::_applyProjection().

00074                                                                                 {
00075       return pcast<PROJ>(_applyProjection(evt, proj));
00076     }

const PROJ& applyProjection ( const Event evt,
const PROJ &  proj 
) const [inline, inherited]

Apply the supplied projection on event.

Definition at line 67 of file ProjectionApplier.hh.

References ProjectionApplier::_applyProjection().

Referenced by DISFinalState::project().

00067                                                                           {
00068       return pcast<PROJ>(_applyProjection(evt, proj));
00069     }

const set< PdgIdPair > beamPairs (  )  const [virtual]

Return the BeamConstraints for this projection, not including recursion. Derived classes should ensure that all contained projections are registered in the _projections set for the beam constraint chaining to work.

Definition at line 39 of file Projection.cc.

References Projection::_beamPairs, Projection::beamPairs(), Projection::getLog(), ProjectionApplier::getProjections(), Rivet::intersection(), and Log::TRACE.

Referenced by Projection::beamPairs().

00039                                                    {
00040     set<PdgIdPair> ret = _beamPairs;
00041     set<ConstProjectionPtr> projs = getProjections();
00042     for (set<ConstProjectionPtr>::const_iterator ip = projs.begin(); ip != projs.end(); ++ip) {
00043       ConstProjectionPtr p = *ip;
00044       getLog() << Log::TRACE << "Proj addr = " << p << endl;
00045       if (p) ret = intersection(ret, p->beamPairs());
00046     }
00047     return ret;
00048   }

bool before ( const Projection p  )  const

Determine whether this object should be ordered before the object p given as argument. If p is of a different class than this, the before() function of the corresponding type_info objects is used. Otherwise, if the objects are of the same class, the virtual compare(const Projection &) will be returned.

Definition at line 28 of file Projection.cc.

References Projection::compare().

Referenced by less< const Rivet::Projection * >::operator()().

00028                                                    {
00029     const std::type_info& thisid = typeid(*this);
00030     const std::type_info& otherid = typeid(p);
00031     if (thisid == otherid) {
00032       return compare(p) < 0;
00033     } else {
00034       return thisid.before(otherid);
00035     }
00036   }

virtual const Projection* clone (  )  const [pure virtual]
virtual int compare ( const Projection p  )  const [protected, pure virtual]

This function is used to define a unique ordering between different Projection objects of the same class. If this is considered to be equivalent to the Projector object, p, in the argument the function should return 0. If this object should be ordered before p a negative value should be returned, otherwise a positive value should be returned. This function must never be called explicitly, but should only be called from the operator<(const Projection &). When implementing the function in concrete sub-classes, it is then guaranteed that the Projection object p in the argument is of the same class as the sub-class and can be safely dynamically casted to that class.

When implementing this function in a sub-class, the immediate base class version of the function should be called first. If the base class function returns a non-zero value, that value should be returned immediately. Only if zero is returned should this function check the member variables of the sub-class to determine whether this should be ordered before or after p, or if it is equivalent with p.

Implemented in BeamThrust, CentralEtHCM, ChargedFinalState, ChargedLeptons, ClusteredPhotons, DISFinalState, DISKinematics, DISLepton, FastJets, FinalState, FoxWolframMoments, FParameter, HadronicFinalState, Hemispheres, IdentifiedFinalState, InitialQuarks, InvMassFinalState, IsolationProjection< PROJ1, PROJ2, EST >, JetAlg, JetShape, LeadingParticlesFinalState, LeptonClusters, LossyFinalState< FILTER >, MergedFinalState, MissingMomentum, Multiplicity, NeutralFinalState, NonHadronicFinalState, ParisiTensor, Sphericity, Spherocity, SVertex, Thrust, TotalVisibleMomentum, UnstableFinalState, VetoedFinalState, VisibleFinalState, WFinder, ZFinder, and LossyFinalState< ConstRandomFilter >.

Referenced by Projection::before().

Log& getLog (  )  const [inline]

Get a Log object based on the getName() property of the calling projection object.

Reimplemented from ProjectionApplier.

Definition at line 114 of file Projection.hh.

References Projection::name().

Referenced by Projection::beamPairs(), InvMassFinalState::calc(), VetoedFinalState::project(), UnstableFinalState::project(), LossyFinalState< ConstRandomFilter >::project(), IsolationProjection< PROJ1, PROJ2, EST >::project(), InitialQuarks::project(), ChargedFinalState::project(), and TotalVisibleMomentum::TotalVisibleMomentum().

00114                         {
00115       string logname = "Rivet.Projection." + name();
00116       return Log::getLog(logname);
00117     }

const Projection& getProjection ( const std::string &  name  )  const [inline, inherited]

Get the named projection (non-templated, so returns as a reference to a Projection base class).

Definition at line 57 of file ProjectionApplier.hh.

References ProjectionHandler::getProjection(), and ProjectionApplier::getProjHandler().

00057                                                                  {
00058       return getProjHandler().getProjection(*this, name);
00059     }

const PROJ& getProjection ( const std::string &  name  )  const [inline, inherited]

Get the named projection, specifying return type via a template argument.

Definition at line 49 of file ProjectionApplier.hh.

References ProjectionHandler::getProjection(), and ProjectionApplier::getProjHandler().

Referenced by ProjectionApplier::_applyProjection(), Rivet::pcmp(), and Hemispheres::project().

00049                                                            {
00050       const Projection& p = getProjHandler().getProjection(*this, name);
00051       return pcast<PROJ>(p);
00052     }

std::set<ConstProjectionPtr> getProjections (  )  const [inline, inherited]

Get the contained projections, including recursion.

Definition at line 42 of file ProjectionApplier.hh.

References ProjectionHandler::DEEP, ProjectionHandler::getChildProjections(), and ProjectionApplier::getProjHandler().

Referenced by Projection::beamPairs().

00042                                                       {
00043       return getProjHandler().getChildProjections(*this, ProjectionHandler::DEEP);
00044     }

ProjectionHandler& getProjHandler (  )  const [inline, protected, inherited]
Cmp< Projection > mkNamedPCmp ( const Projection otherparent,
const std::string &  pname 
) const [protected]
Cmp< Projection > mkPCmp ( const Projection otherparent,
const std::string &  pname 
) const [protected]

Shortcut to make a named Cmp<Projection> comparison with the *this object automatically passed as one of the parent projections.

Definition at line 57 of file Projection.cc.

References Rivet::pcmp().

00058                                                                 {
00059     return pcmp(*this, otherparent, pname);
00060   }

virtual std::string name (  )  const [inline, virtual]
virtual void project ( const Event e  )  [pure virtual]
void setName ( const std::string &  name  )  [inline]

Used by derived classes to set their name.

Definition at line 120 of file Projection.hh.

References Projection::_name.

Referenced by ZFinder::_init(), WFinder::_init(), FastJets::_init1(), FastJets::_init2(), FastJets::_init3(), Beam::Beam(), BeamThrust::BeamThrust(), CentralEtHCM::CentralEtHCM(), ChargedFinalState::ChargedFinalState(), ChargedLeptons::ChargedLeptons(), ClusteredPhotons::ClusteredPhotons(), ConstLossyFinalState::ConstLossyFinalState(), DISFinalState::DISFinalState(), DISKinematics::DISKinematics(), DISLepton::DISLepton(), FinalState::FinalState(), FoxWolframMoments::FoxWolframMoments(), FParameter::FParameter(), HadronicFinalState::HadronicFinalState(), Hemispheres::Hemispheres(), IdentifiedFinalState::IdentifiedFinalState(), InitialQuarks::InitialQuarks(), IsolationProjection< PROJ1, PROJ2, EST >::IsolationProjection(), JetAlg::JetAlg(), JetShape::JetShape(), LeadingParticlesFinalState::LeadingParticlesFinalState(), LeptonClusters::LeptonClusters(), LossyFinalState< ConstRandomFilter >::LossyFinalState(), MergedFinalState::MergedFinalState(), MissingMomentum::MissingMomentum(), Multiplicity::Multiplicity(), NeutralFinalState::NeutralFinalState(), NonHadronicFinalState::NonHadronicFinalState(), ParisiTensor::ParisiTensor(), PVertex::PVertex(), Sphericity::Sphericity(), Spherocity::Spherocity(), SVertex::SVertex(), Thrust::Thrust(), TotalVisibleMomentum::TotalVisibleMomentum(), TriggerCDFRun0Run1::TriggerCDFRun0Run1(), TriggerCDFRun2::TriggerCDFRun2(), TriggerUA5::TriggerUA5(), UnstableFinalState::UnstableFinalState(), VetoedFinalState::VetoedFinalState(), and VisibleFinalState::VisibleFinalState().

00120                                         {
00121       _name = name;
00122     }


Friends And Related Function Documentation

friend class Cmp< Projection > [friend]

The Cmp specialization for Projection is a friend.

Definition at line 36 of file Projection.hh.

friend class Event [friend]

Event is a friend.

Definition at line 33 of file Projection.hh.


Member Data Documentation

bool _allowProjReg [protected, inherited]

Flag to forbid projection registration in analyses until the init phase.

Definition at line 140 of file ProjectionApplier.hh.

Referenced by ProjectionApplier::_addProjection(), and Analysis::Analysis().

set<PdgIdPair> _beamPairs [private]

Beam-type constraint.

Definition at line 143 of file Projection.hh.

Referenced by Projection::addPdgIdPair(), and Projection::beamPairs().

string _name [private]

Name variable is used by the base class messages to identify which derived class is being handled.

Definition at line 140 of file Projection.hh.

Referenced by Projection::name(), and Projection::setName().


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