Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:24

0001 #ifndef JetReco_Jet_h
0002 #define JetReco_Jet_h
0003 
0004 /** \class reco::Jet
0005  *
0006  * \short Base class for all types of Jets
0007  *
0008  * Jet describes properties common for all kinds of jets, 
0009  * essentially kinematics. Base class for all types of Jets.
0010  *
0011  * \author Fedor Ratnikov, UMd
0012  *
0013  * \version   Original: April 22, 2005 by Fernando Varela Rodriguez.
0014  * \version   May 23, 2006 by F.R.
0015  ************************************************************/
0016 #include <string>
0017 #include "DataFormats/Candidate/interface/CompositePtrCandidate.h"
0018 
0019 namespace reco {
0020   class Jet : public CompositePtrCandidate {
0021   public:
0022     typedef edm::Ptr<Candidate> Constituent;
0023     typedef std::vector<Constituent> Constituents;
0024 
0025     /// record to store eta-phi first and second moments
0026     class EtaPhiMoments {
0027     public:
0028       float etaMean;
0029       float phiMean;
0030       float etaEtaMoment;
0031       float phiPhiMoment;
0032       float etaPhiMoment;
0033     };
0034 
0035     /// Default constructor
0036     Jet() : mJetArea(0), mPileupEnergy(0), mPassNumber(0), mIsWeighted(false) {}
0037     /// Initiator
0038     Jet(const LorentzVector& fP4, const Point& fVertex);
0039     Jet(const LorentzVector& fP4, const Point& fVertex, const Constituents& fConstituents);
0040     /// Destructor
0041     ~Jet() override {}
0042 
0043     /// eta-phi statistics, ET weighted
0044     EtaPhiMoments etaPhiStatistics() const;
0045 
0046     /// eta-eta second moment, ET weighted
0047     float etaetaMoment() const;
0048 
0049     /// phi-phi second moment, ET weighted
0050     float phiphiMoment() const;
0051 
0052     /// eta-phi second moment, ET weighted
0053     float etaphiMoment() const;
0054 
0055     /// ET in annulus between rmin and rmax around jet direction
0056     float etInAnnulus(float fRmin, float fRmax) const;
0057 
0058     /// return # of constituent carrying fraction of energy
0059     int nCarrying(float fFraction) const;
0060 
0061     /// maximum distance from jet to constituent
0062     float maxDistance() const;
0063 
0064     /// # of constituents
0065     virtual int nConstituents() const { return numberOfDaughters(); }
0066 
0067     /// static function to convert detector eta to physics eta
0068     static float physicsEta(float fZVertex, float fDetectorEta);
0069 
0070     /// static function to convert physics eta to detector eta
0071     static float detectorEta(float fZVertex, float fPhysicsEta);
0072 
0073     static Candidate::LorentzVector physicsP4(const Candidate::Point& newVertex,
0074                                               const Candidate& inParticle,
0075                                               const Candidate::Point& oldVertex = Candidate::Point(0, 0, 0));
0076 
0077     static Candidate::LorentzVector detectorP4(const Candidate::Point& vertex, const Candidate& inParticle);
0078 
0079     /// list of constituents
0080     virtual Constituents getJetConstituents() const;
0081 
0082     /// quick list of constituents
0083     virtual std::vector<const reco::Candidate*> getJetConstituentsQuick() const;
0084 
0085     // jet structure variables:
0086     // constituentPtDistribution is the pT distribution among the jet constituents
0087     // (ptDistribution = 1 if jet made by one constituent carrying all its momentum,
0088     //  ptDistribution = 0 if jet made by infinite constituents carrying an infinitesimal fraction of pt):
0089     float constituentPtDistribution() const;
0090 
0091     // rmsCand is the rms of the eta-phi spread of the jet's constituents wrt the jet axis:
0092     float constituentEtaPhiSpread() const;
0093 
0094     /// Print object
0095     virtual std::string print() const;
0096 
0097     /// scale energy of the jet
0098     virtual void scaleEnergy(double fScale);
0099 
0100     /// set jet area
0101     virtual void setJetArea(float fArea) { mJetArea = fArea; }
0102     /// get jet area
0103     virtual float jetArea() const { return mJetArea; }
0104 
0105     ///  Set pileup energy contribution as calculated by algorithm
0106     virtual void setPileup(float fEnergy) { mPileupEnergy = fEnergy; }
0107     ///  pileup energy contribution as calculated by algorithm
0108     virtual float pileup() const { return mPileupEnergy; }
0109 
0110     ///  Set number of passes taken by algorithm
0111     virtual void setNPasses(int fPasses) { mPassNumber = fPasses; }
0112     ///  number of passes taken by algorithm
0113     virtual int nPasses() const { return mPassNumber; }
0114 
0115     ///  Set boolean if weights were applied by algorithm (e.g. PUPPI weights)
0116     virtual void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; }
0117     ///  boolean if weights were applied by algorithm (e.g. PUPPI weights)
0118     virtual int isWeighted() const { return mIsWeighted; }
0119 
0120     bool isJet() const override;
0121 
0122   private:
0123     float mJetArea;
0124     float mPileupEnergy;
0125     int mPassNumber;
0126     bool mIsWeighted;
0127   };
0128 }  // namespace reco
0129 #endif