rivet is hosted by Hepforge, IPPP Durham
IdentifiedFinalState.hh
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_IdentifiedFinalState_HH
00003 #define RIVET_IdentifiedFinalState_HH
00004 
00005 #include "Rivet/Projections/FinalState.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// @brief Produce a final state which only contains specified particle IDs.
00011   class IdentifiedFinalState : public FinalState {
00012   public:
00013 
00014     /// @name Constructors
00015     //@{
00016 
00017     /// Constructor with a FinalState and optional list of PDG ID codes.
00018     IdentifiedFinalState(const FinalState& fsp, const vector<PdgId>& pids=vector<PdgId>());
00019 
00020     /// Constructor with a list of PDG ID codes and a FinalState.
00021     IdentifiedFinalState(const vector<PdgId>& pids, const FinalState& fsp);
00022 
00023     /// Constructor with a FinalState and a single of PDG ID code.
00024     IdentifiedFinalState(const FinalState& fsp, PdgId pid);
00025 
00026     /// Constructor with a single PDG ID code and a FinalState.
00027     IdentifiedFinalState(PdgId pid, const FinalState& fsp);
00028 
00029 
00030     /// Construction using optional Cuts object and optional list of PDG ID codes
00031     IdentifiedFinalState(const Cut& c=Cuts::open(), const vector<PdgId>& pids=vector<PdgId>());
00032 
00033     /// Construction using list of PDG ID codes and an optional Cuts object
00034     IdentifiedFinalState(const vector<PdgId>& pids, const Cut& c=Cuts::open());
00035 
00036     /// Construction using Cuts object and a single PDG ID code
00037     IdentifiedFinalState(const Cut& c, PdgId pid);
00038 
00039     /// Construction using a single PDG ID code and an optional Cuts object
00040     IdentifiedFinalState(PdgId pid, const Cut& c=Cuts::open());
00041 
00042 
00043     /// Constructor with eta range and pT_min arguments and optional list of PDG ID codes.
00044     /// @deprecated Use the versions with Cut or FinalState arguments
00045     DEPRECATED("Use the versions with Cut or FinalState arguments.")
00046     IdentifiedFinalState(double etamin, double etamax, double ptMin=0.0*GeV);
00047 
00048 
00049     /// Clone on the heap.
00050     virtual const Projection* clone() const {
00051       return new IdentifiedFinalState(*this);
00052     }
00053 
00054     //@}
00055 
00056 
00057   public:
00058 
00059     /// Get the list of particle IDs to accept.
00060     const set<PdgId>& acceptedIds() const {
00061       return _pids;
00062     }
00063 
00064     /// Add an accepted particle ID.
00065     IdentifiedFinalState& acceptId(PdgId pid) {
00066       _pids.insert(pid);
00067       return *this;
00068     }
00069 
00070     /// Add a set of accepted particle IDs.
00071     IdentifiedFinalState& acceptIds(const vector<PdgId>& pids) {
00072       foreach (const PdgId pid, pids) {
00073         _pids.insert(pid);
00074       }
00075       return *this;
00076     }
00077 
00078     /// Add an accepted particle ID and its antiparticle.
00079     IdentifiedFinalState& acceptIdPair(PdgId pid) {
00080       _pids.insert(pid);
00081       _pids.insert(-pid);
00082       return *this;
00083     }
00084 
00085     /// Add a set of accepted particle IDs and their antiparticles.
00086     IdentifiedFinalState& acceptIdPairs(const vector<PdgId>& pids) {
00087       foreach (const PdgId pid, pids) {
00088         _pids.insert(pid);
00089         _pids.insert(-pid);
00090       }
00091       return *this;
00092     }
00093 
00094     /// Accept all neutrinos (convenience method).
00095     IdentifiedFinalState& acceptNeutrinos() {
00096       acceptIdPair(PID::NU_E);
00097       acceptIdPair(PID::NU_MU);
00098       acceptIdPair(PID::NU_TAU);
00099       return *this;
00100     }
00101 
00102     /// Accept all charged leptons (convenience method).
00103     IdentifiedFinalState& acceptChLeptons() {
00104       acceptIdPair(PID::ELECTRON);
00105       acceptIdPair(PID::MUON);
00106       acceptIdPair(PID::TAU);
00107       return *this;
00108     }
00109 
00110     /// Reset the list of particle IDs to accept.
00111     void reset() {
00112       _pids.clear();
00113     }
00114 
00115     // The remaining particles
00116     virtual const Particles& remainingParticles() const {
00117       return _remainingParticles;
00118     }
00119 
00120 
00121   protected:
00122 
00123     /// Apply the projection on the supplied event.
00124     void project(const Event& e);
00125 
00126     /// Compare projections.
00127     int compare(const Projection& p) const;
00128 
00129 
00130   private:
00131 
00132     /// The final-state particles.
00133     set<PdgId> _pids;
00134 
00135     // A vector of all other particles in the final state
00136     Particles _remainingParticles;
00137 
00138   };
00139 
00140 
00141 }
00142 
00143 
00144 #endif