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     DEFAULT_RIVET_PROJ_CLONE(VetoedFinalState);
00062 
00063     //@}
00064 
00065 
00066   public:
00067 
00068     /// Get the list of particle IDs and \f$ p_T \f$ ranges to veto.
00069     const VetoDetails& vetoDetails() const {
00070       return _vetoCodes;
00071     }
00072 
00073     /// Add a particle ID and \f$ p_T \f$ range to veto. Particles with \f$ p_T \f$
00074     /// IN the given range will be rejected.
00075     VetoedFinalState& addVetoDetail(const long id, const double ptmin, const double ptmax) {
00076       BinaryCut ptrange(ptmin, ptmax);
00077       _vetoCodes.insert(make_pair(id, ptrange));
00078       return *this;
00079     }
00080 
00081     /// Add a particle/antiparticle pair to veto in a given \f$ p_T \f$ range. Given a single ID, both
00082     /// the particle and its conjugate antiparticle will be rejected if their \f$ p_T \f$ is IN the given range.
00083     VetoedFinalState& addVetoPairDetail(const long id, const double ptmin, const double ptmax) {
00084       addVetoDetail(id,  ptmin, ptmax);
00085       addVetoDetail(-id, ptmin, ptmax);
00086       return *this;
00087     }
00088 
00089     /// Add a particle/antiparticle pair to veto. Given a single ID, both the particle and its corresponding
00090     /// antiparticle (for all \f$ p_T \f$ values) will be vetoed.
00091     VetoedFinalState& addVetoPairId(const long id) {
00092       addVetoId(id);
00093       addVetoId(-id);
00094       return *this;
00095     }
00096 
00097     /// Add a particle ID to veto (all \f$ p_T \f$ range will be vetoed).
00098     VetoedFinalState& addVetoId(const long id) {
00099       BinaryCut ptrange(0.0, numeric_limits<double>::max());
00100       _vetoCodes.insert(make_pair(id, ptrange));
00101       return *this;
00102     }
00103 
00104     /// Veto all neutrinos (convenience method)
00105     VetoedFinalState& vetoNeutrinos() {
00106       addVetoPairId(PID::NU_E);
00107       addVetoPairId(PID::NU_MU);
00108       addVetoPairId(PID::NU_TAU);
00109       return *this;
00110     }
00111 
00112     /// Add a veto on composite masses within a given width.
00113     /// The composite mass is composed of nProducts decay products
00114     /// @ todo might we want to specify a range of pdg ids for the decay products?
00115     VetoedFinalState& addCompositeMassVeto(const double &mass, const double &width, int nProducts=2){
00116       double halfWidth = 0.5*width;
00117       BinaryCut massRange(mass - halfWidth, mass + halfWidth);
00118       _compositeVetoes.insert(make_pair(nProducts, massRange));
00119       _nCompositeDecays.insert(nProducts);
00120       return *this;
00121     }
00122 
00123     /// Veto the decay products of particle with pdg id
00124     /// @todo Need HepMC to sort themselves out and keep vector bosons from
00125     /// the hard vtx in the event record before this will work reliably for all pdg ids
00126     VetoedFinalState& addDecayProductsVeto(const long id){
00127       _parentVetoes.insert(id);
00128       return *this;
00129     }
00130 
00131     /// Set the list of particle IDs and \f$ p_T \f$ ranges to veto.
00132     VetoedFinalState& setVetoDetails(const VetoDetails& ids) {
00133       _vetoCodes = ids;
00134       return *this;
00135     }
00136 
00137     /// Clear the list of particle IDs and ranges to veto.
00138     VetoedFinalState& reset() {
00139       _vetoCodes.clear();
00140       return *this;
00141     }
00142 
00143 
00144     /// Veto particles from a supplied final state.
00145     VetoedFinalState& addVetoOnThisFinalState(const FinalState& fs) {
00146       const string name = "FS_" + to_str(_vetofsnames.size());
00147       addProjection(fs, name);
00148       _vetofsnames.insert(name);
00149       return *this;
00150     }
00151 
00152 
00153   protected:
00154 
00155     /// Apply the projection on the supplied event.
00156     void project(const Event& e);
00157 
00158     /// Compare projections.
00159     int compare(const Projection& p) const;
00160 
00161 
00162   private:
00163 
00164     /// The final-state particles.
00165     VetoDetails _vetoCodes;
00166 
00167     /// Composite particle masses to veto
00168     CompositeVeto _compositeVetoes;
00169     set<int> _nCompositeDecays;
00170 
00171     typedef set<long> ParentVetos;
00172 
00173     /// Set of decaying particle IDs to veto
00174     ParentVetos _parentVetoes;
00175 
00176     /// Set of finalstate to be vetoed
00177     set<string> _vetofsnames;
00178 
00179   };
00180 
00181 
00182 }
00183 
00184 
00185 #endif