FastJets.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_FastJets_HH
00003 #define RIVET_FastJets_HH
00004 
00005 #include "Rivet/Projection.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Particle.hh"
00008 #include "fastjet/ClusterSequence.hh"
00009 
00010 namespace Rivet {
00011   
00012   /// Project out kT jets found using fastJet package.
00013   class FastJets : public Projection {
00014     
00015   public:
00016     
00017     /// @name Standard constructors and destructors.
00018     //@{
00019     /// Default constructor. Must specify a FinalState projection which is
00020     //  assumed to live throughout the run.
00021     inline FastJets(FinalState& fsp)
00022       : _cseq(0), _type(fastjet::kt_algorithm), _recom(fastjet::E_scheme), 
00023         _rparameter(1.0), _fsproj(&fsp) 
00024     { 
00025       addProjection(fsp);
00026       _jdef = fastjet::JetDefinition(_type,_rparameter,_recom); 
00027     }
00028 
00029     // @todo implement configurable constructor for fastJet
00030     /// Argument constructor. Allows the to be run with different parameters.
00031     /// Must specify a FinalState projection which is assumed to live throughout the run. 
00032     //inline FastJets(FinalState& fsp, int type, int angle, int recom, double rparameter)
00033     //  : _pktev(0), _type(type), _angle(angle), _recom(recom),
00034     //    _rparameter(rparameter), _fsproj(&fsp)
00035     //{ 
00036     //  addProjection(fsp);
00037     //}
00038     
00039     /// Destructor.
00040     inline virtual ~FastJets() { 
00041       if (_cseq) delete _cseq; 
00042     }
00043     //@}
00044 
00045   public:
00046     /// Return the name of the projection
00047     inline string getName() const {
00048       return "FastJets";
00049     }
00050     
00051   protected:   
00052 
00053     /// Perform the projection on the Event.
00054     void project(const Event& e);
00055 
00056     /// Compare projections.
00057     int compare(const Projection& p) const;  
00058 
00059   public:
00060     
00061     // @todo for more efficiency, pass the pt cut.
00062     inline int getNJets() const {
00063       return _cseq->inclusive_jets().size();
00064     }
00065     inline vector<fastjet::PseudoJet> getJetsPt() const {
00066       return sorted_by_pt(_cseq->inclusive_jets());
00067     }
00068 
00069     /// return the cluster sequence.
00070     inline fastjet::ClusterSequence getCSeq() const {
00071       return *_cseq;
00072     }
00073 
00074     /// return the jet definitions
00075     inline fastjet::JetDefinition getJetDef() const {
00076       return _jdef;
00077     }
00078 
00079     /// Get the subjet splitting variables for the given jet.
00080     vector<double> getYSubJet(const fastjet::PseudoJet& jet) const; 
00081 
00082   private:
00083     
00084 
00085     /// Internal KtEvent, rebuilt every time an event is projected, but not otherwise.
00086     fastjet::ClusterSequence* _cseq;
00087 
00088     fastjet::JetFinder _type;
00089     fastjet::RecombinationScheme _recom;
00090     double _rparameter;  
00091 
00092     /// The FinalState projection used by this projection.
00093     FinalState* _fsproj;
00094 
00095     /// Jet definition
00096     fastjet::JetDefinition  _jdef;
00097 
00098     fastjet::Strategy _strat;
00099 
00100     /// Map of vectors of y scales. This is mutable so we can use caching/lazy evaluation.
00101     mutable map<int, vector<double> > _yscales;
00102   
00103   };
00104 
00105 }
00106 
00107 #endif