rivet is hosted by Hepforge, IPPP Durham
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 namespace Rivet {
00013 
00014 
00015   /// @brief FS modifier to exclude classes of particles from the final state.
00016   class VetoedFinalState : public FinalState {
00017 
00018   public:
00019 
00020     /// Typedef for a pair of back-to-back cuts.
00021     typedef pair<double, double> BinaryCut;
00022 
00023     /// Typedef for a vetoing entry.
00024     typedef map<long, BinaryCut> VetoDetails;
00025 
00026     /// Typedef for a veto on a composite particle mass.
00027     typedef multimap<int, BinaryCut>  CompositeVeto;
00028 
00029 
00030     /// @name Constructors
00031     //@{
00032     /// Default constructor.
00033     VetoedFinalState() {
00034       setName("VetoedFinalState");
00035       addProjection(FinalState(), "FS");
00036     }
00037 
00038     /// Constructor with specific FinalState.
00039     VetoedFinalState(const FinalState& fsp)
00040     {
00041       setName("VetoedFinalState");
00042       addProjection(fsp, "FS");
00043     }
00044 
00045     /// You can add a map of ID plus a pair containing \f$ p_{Tmin} \f$ and
00046     /// \f$ p_{Tmax} \f$ - these define the range of particles to be vetoed.
00047     VetoedFinalState(const VetoDetails& vetocodes)
00048       : _vetoCodes(vetocodes)
00049     {
00050       setName("VetoedFinalState");
00051       addProjection(FinalState(), "FS");
00052     }
00053 
00054     /// You can add a map of ID plus a pair containing \f$ p_{Tmin} \f$ and
00055     /// \f$ p_{Tmax} \f$ - these define the range of particles to be vetoed.
00056     /// This version also supplies a specifi FinalState to be used.
00057     VetoedFinalState(const FinalState& fsp, const VetoDetails& vetocodes)
00058       : _vetoCodes(vetocodes)
00059     {
00060       setName("VetoedFinalState");
00061       addProjection(fsp, "FS");
00062     }
00063 
00064 
00065     /// Clone on the heap.
00066     virtual const Projection* clone() const {
00067       return new VetoedFinalState(*this);
00068     }
00069     //@}
00070 
00071 
00072   public:
00073 
00074     /// Get the list of particle IDs and \f$ p_T \f$ ranges to veto.
00075     const VetoDetails& vetoDetails() const {
00076       return _vetoCodes;
00077     }
00078 
00079     /// Add a particle ID and \f$ p_T \f$ range to veto. Particles with \f$ p_T \f$
00080     /// IN the given range will be rejected.
00081     VetoedFinalState& addVetoDetail(const long id, const double ptmin, const double ptmax) {
00082       BinaryCut ptrange(ptmin, ptmax);
00083       _vetoCodes.insert(make_pair(id, ptrange));
00084       return *this;
00085     }
00086 
00087     /// Add a particle/antiparticle pair to veto in a given \f$ p_T \f$ range. Given a single ID, both
00088     /// the particle and its conjugate antiparticle will be rejected if their \f$ p_T \f$ is IN the given range.
00089     VetoedFinalState& addVetoPairDetail(const long id, const double ptmin, const double ptmax) {
00090       addVetoDetail(id,  ptmin, ptmax);
00091       addVetoDetail(-id, ptmin, ptmax);
00092       return *this;
00093     }
00094 
00095     /// Add a particle/antiparticle pair to veto. Given a single ID, both the particle and its corresponding
00096     /// antiparticle (for all \f$ p_T \f$ values) will be vetoed.
00097     VetoedFinalState& addVetoPairId(const long id) {
00098       addVetoId(id);
00099       addVetoId(-id);
00100       return *this;
00101     }
00102 
00103     /// Add a particle ID to veto (all \f$ p_T \f$ range will be vetoed).
00104     VetoedFinalState& addVetoId(const long id) {
00105       BinaryCut ptrange(0.0, numeric_limits<double>::max());
00106       _vetoCodes.insert(make_pair(id, ptrange));
00107       return *this;
00108     }
00109 
00110     /// Veto all neutrinos (convenience method)
00111     VetoedFinalState& vetoNeutrinos() {
00112       addVetoPairId(PID::NU_E);
00113       addVetoPairId(PID::NU_MU);
00114       addVetoPairId(PID::NU_TAU);
00115       return *this;
00116     }
00117 
00118     /// Add a veto on composite masses within a given width.
00119     /// The composite mass is composed of nProducts decay products
00120     /// @ todo might we want to specify a range of pdg ids for the decay products?
00121     VetoedFinalState& addCompositeMassVeto(const double &mass, const double &width, int nProducts=2){
00122       double halfWidth = 0.5*width;
00123       BinaryCut massRange(mass - halfWidth, mass + halfWidth);
00124       _compositeVetoes.insert(make_pair(nProducts, massRange));
00125       _nCompositeDecays.insert(nProducts);
00126       return *this;
00127     }
00128 
00129     /// Veto the decay products of particle with pdg id
00130     /// @todo Need HepMC to sort themselves out and keep vector bosons from
00131     /// the hard vtx in the event record before this will work reliably for all pdg ids
00132     VetoedFinalState& addDecayProductsVeto(const long id){
00133       _parentVetoes.insert(id);
00134       return *this;
00135     }
00136 
00137     /// Set the list of particle IDs and \f$ p_T \f$ ranges to veto.
00138     VetoedFinalState& setVetoDetails(const VetoDetails& ids) {
00139       _vetoCodes = ids;
00140       return *this;
00141     }
00142 
00143     /// Clear the list of particle IDs and ranges to veto.
00144     VetoedFinalState& reset() {
00145       _vetoCodes.clear();
00146       return *this;
00147     }
00148 
00149 
00150     /// Veto particles from a supplied final state.
00151     VetoedFinalState& addVetoOnThisFinalState(const FinalState& fs) {
00152       stringstream st_name;
00153       st_name << "FS_" << _vetofsnames.size();
00154       string name = st_name.str();
00155       addProjection(fs, name);
00156       _vetofsnames.insert(name);
00157       return *this;
00158     }
00159 
00160 
00161   protected:
00162 
00163     /// Apply the projection on the supplied event.
00164     void project(const Event& e);
00165 
00166     /// Compare projections.
00167     int compare(const Projection& p) const;
00168 
00169 
00170   private:
00171 
00172     /// The final-state particles.
00173     VetoDetails _vetoCodes;
00174 
00175     /// Composite particle masses to veto
00176     CompositeVeto _compositeVetoes;
00177     set<int> _nCompositeDecays;
00178 
00179     typedef set<long> ParentVetos;
00180 
00181     /// Set of decaying particle IDs to veto
00182     ParentVetos _parentVetoes;
00183 
00184     /// Set of finalstate to be vetoed
00185     set<string> _vetofsnames;
00186 
00187   };
00188 
00189 
00190 }
00191 
00192 
00193 #endif