EtaPhiMoments

Jet

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
#ifndef JetReco_Jet_h
#define JetReco_Jet_h

/** \class reco::Jet
 *
 * \short Base class for all types of Jets
 *
 * Jet describes properties common for all kinds of jets, 
 * essentially kinematics. Base class for all types of Jets.
 *
 * \author Fedor Ratnikov, UMd
 *
 * \version   Original: April 22, 2005 by Fernando Varela Rodriguez.
 * \version   May 23, 2006 by F.R.
 ************************************************************/
#include <string>
#include "DataFormats/Candidate/interface/CompositePtrCandidate.h"

namespace reco {
  class Jet : public CompositePtrCandidate {
  public:
    typedef edm::Ptr<Candidate> Constituent;
    typedef std::vector<Constituent> Constituents;

    /// record to store eta-phi first and second moments
    class EtaPhiMoments {
    public:
      float etaMean;
      float phiMean;
      float etaEtaMoment;
      float phiPhiMoment;
      float etaPhiMoment;
    };

    /// Default constructor
    Jet() : mJetArea(0), mPileupEnergy(0), mPassNumber(0), mIsWeighted(false) {}
    /// Initiator
    Jet(const LorentzVector& fP4, const Point& fVertex);
    Jet(const LorentzVector& fP4, const Point& fVertex, const Constituents& fConstituents);
    /// Destructor
    ~Jet() override {}

    /// eta-phi statistics, ET weighted
    EtaPhiMoments etaPhiStatistics() const;

    /// eta-eta second moment, ET weighted
    float etaetaMoment() const;

    /// phi-phi second moment, ET weighted
    float phiphiMoment() const;

    /// eta-phi second moment, ET weighted
    float etaphiMoment() const;

    /// ET in annulus between rmin and rmax around jet direction
    float etInAnnulus(float fRmin, float fRmax) const;

    /// return # of constituent carrying fraction of energy
    int nCarrying(float fFraction) const;

    /// maximum distance from jet to constituent
    float maxDistance() const;

    /// # of constituents
    virtual int nConstituents() const { return numberOfDaughters(); }

    /// static function to convert detector eta to physics eta
    static float physicsEta(float fZVertex, float fDetectorEta);

    /// static function to convert physics eta to detector eta
    static float detectorEta(float fZVertex, float fPhysicsEta);

    static Candidate::LorentzVector physicsP4(const Candidate::Point& newVertex,
                                              const Candidate& inParticle,
                                              const Candidate::Point& oldVertex = Candidate::Point(0, 0, 0));

    static Candidate::LorentzVector detectorP4(const Candidate::Point& vertex, const Candidate& inParticle);

    /// list of constituents
    virtual Constituents getJetConstituents() const;

    /// quick list of constituents
    virtual std::vector<const reco::Candidate*> getJetConstituentsQuick() const;

    // jet structure variables:
    // constituentPtDistribution is the pT distribution among the jet constituents
    // (ptDistribution = 1 if jet made by one constituent carrying all its momentum,
    //  ptDistribution = 0 if jet made by infinite constituents carrying an infinitesimal fraction of pt):
    float constituentPtDistribution() const;

    // rmsCand is the rms of the eta-phi spread of the jet's constituents wrt the jet axis:
    float constituentEtaPhiSpread() const;

    /// Print object
    virtual std::string print() const;

    /// scale energy of the jet
    virtual void scaleEnergy(double fScale);

    /// set jet area
    virtual void setJetArea(float fArea) { mJetArea = fArea; }
    /// get jet area
    virtual float jetArea() const { return mJetArea; }

    ///  Set pileup energy contribution as calculated by algorithm
    virtual void setPileup(float fEnergy) { mPileupEnergy = fEnergy; }
    ///  pileup energy contribution as calculated by algorithm
    virtual float pileup() const { return mPileupEnergy; }

    ///  Set number of passes taken by algorithm
    virtual void setNPasses(int fPasses) { mPassNumber = fPasses; }
    ///  number of passes taken by algorithm
    virtual int nPasses() const { return mPassNumber; }

    ///  Set boolean if weights were applied by algorithm (e.g. PUPPI weights)
    virtual void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; }
    ///  boolean if weights were applied by algorithm (e.g. PUPPI weights)
    virtual int isWeighted() const { return mIsWeighted; }

    bool isJet() const override;

  private:
    float mJetArea;
    float mPileupEnergy;
    int mPassNumber;
    bool mIsWeighted;
  };
}  // namespace reco
#endif