Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:01

0001 #ifndef CommonTools_PileupAlgos_PuppiAlgo_h
0002 #define CommonTools_PileupAlgos_PuppiAlgo_h
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0007 #include "CommonTools/PileupAlgos/interface/PuppiCandidate.h"
0008 #include <vector>
0009 
0010 class PuppiAlgo {
0011 public:
0012   PuppiAlgo(edm::ParameterSet &iConfig);
0013   ~PuppiAlgo();
0014   static void fillDescriptionsPuppiAlgo(edm::ParameterSetDescription &desc);
0015   //Computing Mean and RMS
0016   void reset();
0017   void fixAlgoEtaBin(int i_eta);
0018   void add(const PuppiCandidate &iParticle, const double &iVal, const unsigned int iAlgo);
0019   void computeMedRMS(const unsigned int &iAlgo);
0020   //Get the Weight
0021   double compute(std::vector<double> const &iVals, double iChi2) const;
0022   const std::vector<float> &alphas() { return fPups; }
0023   //Helpers
0024   inline int etaBins() const { return fEtaMin.size(); }
0025   inline double etaMin(int i) const { return fEtaMin[i]; }
0026   inline double etaMax(int i) const { return fEtaMax[i]; }
0027   inline double ptMin() const { return cur_PtMin; }
0028 
0029   inline int numAlgos() const { return fNAlgos; }
0030   inline int algoId(unsigned int iAlgo) const { return fAlgoId.at(iAlgo); }
0031   inline bool isCharged(unsigned int iAlgo) const { return fCharged.at(iAlgo); }
0032   inline double coneSize(unsigned int iAlgo) const { return fConeSize.at(iAlgo); }
0033   inline double neutralPt(double const iPUProxy) const { return cur_NeutralPtMin + iPUProxy * cur_NeutralPtSlope; }
0034 
0035   inline double rms() const { return cur_RMS; }
0036   inline double median() const { return cur_Med; }
0037 
0038   inline double etaMaxExtrap() const { return fEtaMaxExtrap; }
0039 
0040 private:
0041   unsigned int fNAlgos;
0042   std::vector<double> fEtaMax;
0043   std::vector<double> fEtaMin;
0044   std::vector<double> fPtMin;
0045   std::vector<double> fNeutralPtMin;
0046   std::vector<double> fNeutralPtSlope;
0047 
0048   std::vector<double> fRMSEtaSF;
0049   std::vector<double> fMedEtaSF;
0050   double fEtaMaxExtrap;
0051 
0052   double cur_PtMin;
0053   double cur_NeutralPtMin;
0054   double cur_NeutralPtSlope;
0055   double cur_RMS;
0056   double cur_Med;
0057 
0058   std::vector<double> fRMS;                          // this is the raw RMS per algo
0059   std::vector<double> fMedian;                       // this is the raw Median per algo
0060   std::vector<std::vector<double> > fRMS_perEta;     // this is the final RMS used after eta corrections
0061   std::vector<std::vector<double> > fMedian_perEta;  // this is the final Med used after eta corrections
0062 
0063   std::vector<float> fPups;
0064   std::vector<float> fPupsPV;
0065   std::vector<int> fAlgoId;
0066   std::vector<bool> fCharged;
0067   std::vector<bool> fAdjust;
0068   std::vector<int> fCombId;
0069   std::vector<double> fConeSize;
0070   std::vector<double> fRMSPtMin;
0071   std::vector<double> fRMSScaleFactor;
0072   std::vector<double> fMean;
0073   std::vector<int> fNCount;
0074 };
0075 
0076 #endif