CMS 3D CMS Logo

PuppiAlgo.h
Go to the documentation of this file.
1 #ifndef CommonTools_PileupAlgos_PuppiAlgo_h
2 #define CommonTools_PileupAlgos_PuppiAlgo_h
3 
8 #include <vector>
9 
10 class PuppiAlgo {
11 public:
12  PuppiAlgo(edm::ParameterSet &iConfig);
13  ~PuppiAlgo();
15  //Computing Mean and RMS
16  void reset();
17  void fixAlgoEtaBin(int i_eta);
18  void add(const PuppiCandidate &iParticle, const double &iVal, const unsigned int iAlgo);
19  void computeMedRMS(const unsigned int &iAlgo);
20  //Get the Weight
21  double compute(std::vector<double> const &iVals, double iChi2) const;
22  const std::vector<float> &alphas() { return fPups; }
23  //Helpers
24  inline int etaBins() const { return fEtaMin.size(); }
25  inline double etaMin(int i) const { return fEtaMin[i]; }
26  inline double etaMax(int i) const { return fEtaMax[i]; }
27  inline double ptMin() const { return cur_PtMin; }
28 
29  inline int numAlgos() const { return fNAlgos; }
30  inline int algoId(unsigned int iAlgo) const { return fAlgoId.at(iAlgo); }
31  inline bool isCharged(unsigned int iAlgo) const { return fCharged.at(iAlgo); }
32  inline double coneSize(unsigned int iAlgo) const { return fConeSize.at(iAlgo); }
33  inline double neutralPt(double const iPUProxy) const { return cur_NeutralPtMin + iPUProxy * cur_NeutralPtSlope; }
34 
35  inline double rms() const { return cur_RMS; }
36  inline double median() const { return cur_Med; }
37 
38  inline double etaMaxExtrap() const { return fEtaMaxExtrap; }
39 
40 private:
41  unsigned int fNAlgos;
42  std::vector<double> fEtaMax;
43  std::vector<double> fEtaMin;
44  std::vector<double> fPtMin;
45  std::vector<double> fNeutralPtMin;
46  std::vector<double> fNeutralPtSlope;
47 
48  std::vector<double> fRMSEtaSF;
49  std::vector<double> fMedEtaSF;
50  double fEtaMaxExtrap;
51 
52  double cur_PtMin;
55  double cur_RMS;
56  double cur_Med;
57 
58  std::vector<double> fRMS; // this is the raw RMS per algo
59  std::vector<double> fMedian; // this is the raw Median per algo
60  std::vector<std::vector<double> > fRMS_perEta; // this is the final RMS used after eta corrections
61  std::vector<std::vector<double> > fMedian_perEta; // this is the final Med used after eta corrections
62 
63  std::vector<float> fPups;
64  std::vector<float> fPupsPV;
65  std::vector<int> fAlgoId;
66  std::vector<bool> fCharged;
67  std::vector<bool> fAdjust;
68  std::vector<int> fCombId;
69  std::vector<double> fConeSize;
70  std::vector<double> fRMSPtMin;
71  std::vector<double> fRMSScaleFactor;
72  std::vector<double> fMean;
73  std::vector<int> fNCount;
74 };
75 
76 #endif
double coneSize(unsigned int iAlgo) const
Definition: PuppiAlgo.h:32
void add(const PuppiCandidate &iParticle, const double &iVal, const unsigned int iAlgo)
Definition: PuppiAlgo.cc:87
void computeMedRMS(const unsigned int &iAlgo)
Definition: PuppiAlgo.cc:112
double etaMin(int i) const
Definition: PuppiAlgo.h:25
int numAlgos() const
Definition: PuppiAlgo.h:29
double cur_PtMin
Definition: PuppiAlgo.h:52
std::vector< double > fEtaMin
Definition: PuppiAlgo.h:43
static void fillDescriptionsPuppiAlgo(edm::ParameterSetDescription &desc)
Definition: PuppiAlgo.cc:218
const std::vector< float > & alphas()
Definition: PuppiAlgo.h:22
std::vector< bool > fAdjust
Definition: PuppiAlgo.h:67
double neutralPt(double const iPUProxy) const
Definition: PuppiAlgo.h:33
PuppiAlgo(edm::ParameterSet &iConfig)
Definition: PuppiAlgo.cc:8
double cur_NeutralPtSlope
Definition: PuppiAlgo.h:54
std::vector< double > fConeSize
Definition: PuppiAlgo.h:69
void reset()
Definition: PuppiAlgo.cc:68
int algoId(unsigned int iAlgo) const
Definition: PuppiAlgo.h:30
double cur_Med
Definition: PuppiAlgo.h:56
std::vector< std::vector< double > > fMedian_perEta
Definition: PuppiAlgo.h:61
double compute(std::vector< double > const &iVals, double iChi2) const
Definition: PuppiAlgo.cc:183
~PuppiAlgo()
Definition: PuppiAlgo.cc:64
std::vector< double > fRMS
Definition: PuppiAlgo.h:58
std::vector< double > fNeutralPtMin
Definition: PuppiAlgo.h:45
double ptMin() const
Definition: PuppiAlgo.h:27
std::vector< float > fPupsPV
Definition: PuppiAlgo.h:64
double etaMax(int i) const
Definition: PuppiAlgo.h:26
double cur_NeutralPtMin
Definition: PuppiAlgo.h:53
std::vector< float > fPups
Definition: PuppiAlgo.h:63
std::vector< double > fMean
Definition: PuppiAlgo.h:72
std::vector< int > fAlgoId
Definition: PuppiAlgo.h:65
double etaMaxExtrap() const
Definition: PuppiAlgo.h:38
std::vector< double > fRMSPtMin
Definition: PuppiAlgo.h:70
std::vector< int > fCombId
Definition: PuppiAlgo.h:68
std::vector< double > fRMSScaleFactor
Definition: PuppiAlgo.h:71
std::vector< double > fPtMin
Definition: PuppiAlgo.h:44
std::vector< double > fRMSEtaSF
Definition: PuppiAlgo.h:48
std::vector< double > fNeutralPtSlope
Definition: PuppiAlgo.h:46
bool isCharged(unsigned int iAlgo) const
Definition: PuppiAlgo.h:31
std::vector< double > fMedEtaSF
Definition: PuppiAlgo.h:49
std::vector< double > fEtaMax
Definition: PuppiAlgo.h:42
double fEtaMaxExtrap
Definition: PuppiAlgo.h:50
int etaBins() const
Definition: PuppiAlgo.h:24
double cur_RMS
Definition: PuppiAlgo.h:55
void fixAlgoEtaBin(int i_eta)
Definition: PuppiAlgo.cc:79
double rms() const
Definition: PuppiAlgo.h:35
double median() const
Definition: PuppiAlgo.h:36
std::vector< bool > fCharged
Definition: PuppiAlgo.h:66
std::vector< std::vector< double > > fRMS_perEta
Definition: PuppiAlgo.h:60
unsigned int fNAlgos
Definition: PuppiAlgo.h:41
std::vector< int > fNCount
Definition: PuppiAlgo.h:73
std::vector< double > fMedian
Definition: PuppiAlgo.h:59