rivet is hosted by Hepforge, IPPP Durham
JetAlg.hh
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_JetAlg_HH
00003 #define RIVET_JetAlg_HH
00004 
00005 #include "Rivet/Projection.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/VisibleFinalState.hh"
00008 #include "Rivet/Particle.hh"
00009 #include "Rivet/Jet.hh"
00010 
00011 namespace Rivet {
00012 
00013 
00014   /// Abstract base class for projections which can return a set of {@link Jet}s.
00015   class JetAlg : public Projection {
00016   public:
00017 
00018     /// Constructor
00019     JetAlg(const FinalState& fs);
00020 
00021     JetAlg() {};
00022 
00023     /// Clone on the heap.
00024     virtual const Projection* clone() const = 0;
00025 
00026     /// Destructor
00027     virtual ~JetAlg() { }
00028 
00029     /// @brief Include invisible particles in jet construction.
00030     /// The default behaviour is that jets are only constructed from visible
00031     /// (i.e. charged under an SM gauge group) particles. Some jet studies,
00032     /// including those from ATLAS, use a definition in which neutrinos from hadron
00033     /// decays are included (via MC correction) in the experimental jet definition.
00034     /// Setting this flag to true avoids the automatic restriction to a VisibleFinalState.
00035     void useInvisibles(bool useinvis=true) {
00036       _useInvisibles = useinvis;
00037     }
00038 
00039     /// Get jets in no guaranteed order, with optional cuts on \f$ p_\perp \f$ and rapidity.
00040     /// @note Returns a copy rather than a reference, due to cuts
00041     /// @todo Update to use Cuts
00042     virtual Jets jets(double ptmin=0.0, double ptmax=MAXDOUBLE,
00043                       double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
00044                       RapScheme rapscheme=PSEUDORAPIDITY) const {
00045       const Jets rawjets = _jets(ptmin);
00046       Jets rtn;
00047       MSG_DEBUG("Raw jet size (with pTmin cut = " << ptmin/GeV << " GeV) = " << rawjets.size());
00048       foreach (const Jet& j, rawjets) {
00049         const FourMomentum pj = j.momentum();
00050         if (!inRange(pj.pT(), ptmin, ptmax)) continue;
00051         if (rapscheme == PSEUDORAPIDITY && !inRange(pj.eta(), rapmin, rapmax)) continue;
00052         if (rapscheme == RAPIDITY && !inRange(pj.rapidity(), rapmin, rapmax)) continue;
00053         rtn += j;
00054       }
00055       return rtn;
00056     }
00057 
00058     /// Get the jets, ordered by supplied sorting function object, with optional cuts on \f$ p_\perp \f$ and rapidity.
00059     /// @note Returns a copy rather than a reference, due to cuts and sorting
00060     /// @todo Update to use Cuts
00061     template <typename F>
00062     Jets jets(F sorter,
00063               double ptmin=0.0, double ptmax=MAXDOUBLE,
00064               double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
00065               RapScheme rapscheme=PSEUDORAPIDITY) const {
00066       Jets js = jets(ptmin, ptmax, rapmin, rapmax, rapscheme);
00067       if (sorter != 0) {
00068         std::sort(js.begin(), js.end(), sorter);
00069       }
00070       return js;
00071     }
00072 
00073     /// Get the jets, ordered by \f$ p_T \f$, with optional cuts on \f$ p_\perp \f$ and rapidity.
00074     /// @note Returns a copy rather than a reference, due to cuts and sorting
00075     /// @todo Update to use Cuts
00076     Jets jetsByPt(double ptmin=0.0, double ptmax=MAXDOUBLE,
00077                   double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
00078                   RapScheme rapscheme=PSEUDORAPIDITY) const {
00079       return jets(cmpMomByPt, ptmin, ptmax, rapmin, rapmax, rapscheme);
00080     }
00081 
00082     /// Get the jets, ordered by \f$ |p| \f$, with optional cuts on \f$ p_\perp \f$ and rapidity.
00083     /// @note Returns a copy rather than a reference, due to cuts and sorting
00084     /// @todo Update to use Cuts
00085     Jets jetsByP(double ptmin=0.0, double ptmax=MAXDOUBLE,
00086                  double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
00087                  RapScheme rapscheme=PSEUDORAPIDITY) const {
00088       return jets(cmpMomByP, ptmin, ptmax, rapmin, rapmax, rapscheme);
00089     }
00090 
00091     /// Get the jets, ordered by \f$ E \f$, with optional cuts on \f$ p_\perp \f$ and rapidity.
00092     /// @note Returns a copy rather than a reference, due to cuts and sorting
00093     /// @todo Update to use Cuts
00094     Jets jetsByE(double ptmin=0.0, double ptmax=MAXDOUBLE,
00095                  double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
00096                  RapScheme rapscheme=PSEUDORAPIDITY) const {
00097       return jets(cmpMomByE, ptmin, ptmax, rapmin, rapmax, rapscheme);
00098     }
00099 
00100     /// Get the jets, ordered by \f$ E_T \f$, with optional cuts on \f$ p_\perp \f$ and rapidity.
00101     /// @note Returns a copy rather than a reference, due to cuts and sorting
00102     /// @todo Update to use Cuts
00103     Jets jetsByEt(double ptmin=0.0, double ptmax=MAXDOUBLE,
00104                   double rapmin=-MAXDOUBLE, double rapmax=MAXDOUBLE,
00105                   RapScheme rapscheme=PSEUDORAPIDITY) const {
00106       return jets(cmpMomByEt, ptmin, ptmax, rapmin, rapmax, rapscheme);
00107     }
00108 
00109 
00110   protected:
00111 
00112     /// @brief Internal pure virtual method for getting jets in no guaranteed order.
00113     /// An optional cut on min \f$ p_\perp \f$ is applied in this function, since that is
00114     /// directly supported by FastJet and it seems a shame to not make use of that. But
00115     /// all other jet cuts are applied at the @c ::jets() function level.
00116     /// @todo Update to use Cuts?
00117     virtual Jets _jets(double ptmin) const = 0;
00118 
00119 
00120   public:
00121 
00122     /// Number of jets.
00123     virtual size_t size() const = 0;
00124     /// Determine if the jet collection is empty.
00125     bool empty() const { return size() != 0; }
00126 
00127     /// Clear the projection.
00128     virtual void reset() = 0;
00129 
00130     typedef Jet entity_type;
00131     typedef Jets collection_type;
00132 
00133     /// Template-usable interface common to FinalState.
00134     collection_type entities() const { return jets(); }
00135 
00136     /// Do the calculation locally (no caching).
00137     virtual void calc(const Particles& constituents, const Particles& tagparticles=Particles()) = 0;
00138 
00139 
00140   protected:
00141 
00142     /// Perform the projection on the Event.
00143     virtual void project(const Event& e) = 0;
00144 
00145     /// Compare projections.
00146     virtual int compare(const Projection& p) const = 0;
00147 
00148 
00149   protected:
00150 
00151     /// Flag to determine whether or not the VFS wrapper is to be used.
00152     bool _useInvisibles;
00153 
00154   };
00155 
00156 
00157 }
00158 
00159 #endif