VetoedFinalState.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_VetoedFinalState_HH
00003 #define RIVET_VetoedFinalState_HH
00004 
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "Rivet/Rivet.hh"
00007 #include "Rivet/Particle.hh"
00008 #include "Rivet/Event.hh"
00009 #include "Rivet/Projection.hh"
00010 #include "Rivet/Projections/FinalState.hh"
00011 
00012 
00013 namespace Rivet {
00014 
00015   /// Project all final state particles except for those listed by PDG code.
00016   class VetoedFinalState : public FinalState {
00017 
00018   public:
00019     
00020     /// Typedef for a vetoing entry.
00021     typedef map<long, pair<double, double> > VetoDetails;
00022 
00023     /// The default constructor. Must specify a FinalState projection 
00024     /// object which is assumed to live through the run.
00025     inline VetoedFinalState(FinalState& fsp)
00026       : _fsproj(fsp)
00027     {
00028       addProjection(_fsproj);
00029     }
00030 
00031     /// You can add a map of ID plus a pair containing \f$ p_{Tmin} \f$ and
00032     /// \f$ p_{Tmax} \f$ - these define the range of particles to be vetoed.
00033     inline VetoedFinalState(FinalState& fsp, const VetoDetails& vetocodes)
00034       : _fsproj(fsp), _vetoCodes(vetocodes)
00035     {
00036       addProjection(_fsproj);
00037     }
00038     
00039 
00040   public:
00041     /// Return the name of the projection
00042     inline string getName() const {
00043       return "VetoedFinalState";
00044     }
00045 
00046   protected:
00047     
00048     /// Apply the projection on the supplied event.
00049     void project(const Event& e);
00050     
00051     /// Compare projections.
00052     int compare(const Projection& p) const;
00053     
00054   public:
00055     
00056     /// Get the list of particle IDs and \f$ p_T \f$ ranges to veto.
00057     inline const VetoDetails& getVetoDetails() const {
00058       return _vetoCodes;
00059     }
00060   
00061     /// Add a particle ID and \f$ p_T \f$ range to veto. Particles with \f$ p_T \f$ 
00062     /// IN the given range will be rejected.
00063     inline VetoedFinalState& addVetoDetail(const long id, const double ptmin, const double ptmax) {
00064       pair<double, double> ptrange; 
00065       ptrange.first = ptmin;
00066       ptrange.second = ptmax;
00067       _vetoCodes.insert(make_pair(id, ptrange));
00068       return *this;
00069     }
00070 
00071     /// Add a particle/antiparticle pair to veto in a given \f$ p_T \f$ range. Given a single ID, both
00072     /// the particle and its conjugate antiparticle will be rejected if their \f$ p_T \f$ is IN the given range.
00073     inline VetoedFinalState& addVetoPairDetail(const long id, const double ptmin, const double ptmax) {
00074       addVetoPairDetail(id,  ptmin, ptmax);
00075       addVetoPairDetail(-id, ptmin, ptmax);
00076       return *this;
00077     }
00078 
00079     /// Add a particle/antiparticle pair to veto. Given a single ID, both the particle and its corresponding 
00080     /// antiparticle (for all \f$ p_T \f$ values) will be vetoed.
00081     inline VetoedFinalState& addVetoPairId(const long id) {
00082       addVetoId(id);
00083       addVetoId(-id);
00084       return *this;
00085     }
00086 
00087     /// Add a particle ID to veto (all \f$ p_T \f$ range will be vetoed).
00088     inline VetoedFinalState& addVetoId(const long id) {
00089       pair<double, double> ptrange;
00090       ptrange.first = 0.0;
00091       ptrange.second = numeric_limits<double>::max();
00092       _vetoCodes.insert(make_pair(id, ptrange));
00093       return *this;
00094     }
00095 
00096     /// Set the list of particle IDs and \f$ p_T \f$ ranges to veto.
00097     inline VetoedFinalState& setVetoDetails(const VetoDetails& ids) {
00098       _vetoCodes = ids;
00099       return *this;
00100     }
00101 
00102     /// Clear the list of particle IDs and ranges to veto.
00103     inline VetoedFinalState& clearVetoDetails() {
00104       _vetoCodes.clear();
00105       return *this;
00106     }
00107     
00108   private:
00109     
00110     /// The projector for the full final state.
00111     FinalState _fsproj;
00112     
00113     /// The final-state particles.
00114     VetoDetails _vetoCodes;
00115   
00116   };
00117 
00118   
00119 }
00120 
00121 
00122 #endif