rivet is hosted by Hepforge, IPPP Durham
InvMassFinalState.hh
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_InvMassFinalState_HH
00003 #define RIVET_InvMassFinalState_HH
00004 
00005 #include "Rivet/Projections/FinalState.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// @brief Identify particles which can be paired to fit within a given invariant mass window
00011   class InvMassFinalState : public FinalState {
00012   public:
00013 
00014     /// Constructor for a single inv-mass pair.
00015     InvMassFinalState(const FinalState& fsp,
00016                       const std::pair<PdgId, PdgId>& idpair, // pair of decay products
00017                       double minmass, // min inv mass
00018                       double maxmass, // max inv mass
00019                       double masstarget=-1.0);
00020 
00021 
00022     /// Constructor for multiple inv-mass pairs.
00023     InvMassFinalState(const FinalState& fsp,
00024                       const std::vector<std::pair<PdgId, PdgId> >& idpairs,  // vector of pairs of decay products
00025                       double minmass, // min inv mass
00026                       double maxmass, // max inv mass
00027                       double masstarget=-1.0);
00028 
00029 
00030     /// Same thing as above, but we want to pass the particles directly to the calc method
00031     InvMassFinalState(const std::pair<PdgId, PdgId>& idpair, // pair of decay products
00032                       double minmass, // min inv mass
00033                       double maxmass, // max inv mass
00034                       double masstarget=-1.0);
00035     InvMassFinalState(const std::vector<std::pair<PdgId, PdgId> >& idpairs,  // vector of pairs of decay products
00036                       double minmass, // min inv mass
00037                       double maxmass, // max inv mass
00038                       double masstarget=-1.0);
00039 
00040 
00041     /// Clone on the heap.
00042     virtual const Projection* clone() const {
00043         return new InvMassFinalState(*this);
00044     }
00045 
00046 
00047   public:
00048 
00049     /// Constituent pairs.
00050     const std::vector<std::pair<Particle, Particle> >& particlePairs() const;
00051 
00052 
00053     /// Choose whether to use the full inv mass or just the transverse mass.
00054     void useTransverseMass(bool usetrans=true) {
00055       _useTransverseMass = usetrans;
00056     }
00057 
00058     /// Operate on a given particle vector directly instead of through project (no caching)
00059     void calc(const Particles& inparticles);
00060 
00061   private:
00062 
00063     /// Transverse Mass
00064     inline double massT( FourMomentum v1, FourMomentum v2) {
00065       return sqrt( (v1.Et() + v2.Et())*(v1.Et() + v2.Et()) -
00066                    (v1+v2).perp()*(v1+v2).perp() );
00067     }
00068 
00069   protected:
00070 
00071     /// Apply the projection on the supplied event.
00072     void project(const Event& e);
00073 
00074     /// Compare projections.
00075     int compare(const Projection& p) const;
00076 
00077 
00078   private:
00079 
00080     /// IDs of the decay products.
00081     std::vector<PdgIdPair> _decayids;
00082 
00083     /// Constituent pairs.
00084     std::vector<std::pair<Particle, Particle> > _particlePairs;
00085 
00086     /// Min inv mass.
00087     double _minmass;
00088 
00089     /// Max inv mass.
00090     double _maxmass;
00091 
00092     /// Target mass if only one pair should be returned.
00093     double _masstarget;
00094 
00095     /// Flag to decide whether to use the full inv mass or just the transverse mass.
00096     bool _useTransverseMass;
00097   };
00098 
00099 
00100 }
00101 
00102 
00103 #endif