Rivet  1.8.0
VetoedFinalState.hh
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 
00016   class VetoedFinalState : public FinalState {
00017 
00018   public:
00019 
00021     typedef pair<double, double> BinaryCut;
00022 
00024     typedef map<long, BinaryCut> VetoDetails;
00025 
00027     typedef multimap<int, BinaryCut>  CompositeVeto;
00028 
00029 
00031 
00032 
00033     VetoedFinalState() {
00034       setName("VetoedFinalState");
00035       addProjection(FinalState(), "FS");
00036     }
00037 
00039     VetoedFinalState(const FinalState& fsp)
00040     {
00041       setName("VetoedFinalState");
00042       addProjection(fsp, "FS");
00043     }
00044 
00047     VetoedFinalState(const VetoDetails& vetocodes)
00048       : _vetoCodes(vetocodes)
00049     {
00050       setName("VetoedFinalState");
00051       addProjection(FinalState(), "FS");
00052     }
00053 
00057     VetoedFinalState(const FinalState& fsp, const VetoDetails& vetocodes)
00058       : _vetoCodes(vetocodes)
00059     {
00060       setName("VetoedFinalState");
00061       addProjection(fsp, "FS");
00062     }
00063 
00064 
00066     virtual const Projection* clone() const {
00067       return new VetoedFinalState(*this);
00068     }
00070 
00071 
00072   public:
00073 
00075     const VetoDetails& vetoDetails() const {
00076       return _vetoCodes;
00077     }
00078 
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 
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 
00097     VetoedFinalState& addVetoPairId(const long id) {
00098       addVetoId(id);
00099       addVetoId(-id);
00100       return *this;
00101     }
00102 
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 
00111     VetoedFinalState& vetoNeutrinos() {
00112       addVetoPairId(NU_E);
00113       addVetoPairId(NU_MU);
00114       addVetoPairId(NU_TAU);
00115       return *this;
00116     }
00117 
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 
00132     VetoedFinalState& addDecayProductsVeto(const long id){
00133       _parentVetoes.insert(id);
00134       return *this;
00135     }
00136 
00138     VetoedFinalState& setVetoDetails(const VetoDetails& ids) {
00139       _vetoCodes = ids;
00140       return *this;
00141     }
00142 
00144     VetoedFinalState& reset() {
00145       _vetoCodes.clear();
00146       return *this;
00147     }
00148 
00149 
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 
00164     void project(const Event& e);
00165 
00167     int compare(const Projection& p) const;
00168 
00169 
00170   private:
00171 
00173     VetoDetails _vetoCodes;
00174 
00176     CompositeVeto _compositeVetoes;
00177     set<int> _nCompositeDecays;
00178 
00179     typedef set<long> ParentVetos;
00180 
00182     ParentVetos _parentVetoes;
00183 
00185     set<string> _vetofsnames;
00186 
00187   };
00188 
00189 
00190 }
00191 
00192 
00193 #endif