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