CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SimpleZSPJPTJetCorrector Class Reference

classes declaration More...

#include <SimpleZSPJPTJetCorrector.h>

Public Member Functions

virtual double correctionEtEtaPhiP (double fEt, double fEta, double fPhi, double fP) const
 
virtual double correctionPtEtaPhiE (double fPt, double fEta, double fPhi, double fE) const
 
virtual double correctionPUEtEtaPhiP (double fEt, double fEta, double fPhi, double fP) const
 
void init (const std::string &fDataFile)
 
 SimpleZSPJPTJetCorrector ()
 
 SimpleZSPJPTJetCorrector (const std::string &fDataFile)
 
virtual ~SimpleZSPJPTJetCorrector ()
 

Private Member Functions

SimpleZSPJPTJetCorrectoroperator= (const SimpleZSPJPTJetCorrector &)
 
 SimpleZSPJPTJetCorrector (const SimpleZSPJPTJetCorrector &)
 

Private Attributes

bool debug_
 
TFormula * mFunc
 
JetCorrectorParametersmParameters
 

Detailed Description

classes declaration

Definition at line 15 of file SimpleZSPJPTJetCorrector.h.

Constructor & Destructor Documentation

◆ SimpleZSPJPTJetCorrector() [1/3]

SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( )

Definition at line 20 of file SimpleZSPJPTJetCorrector.cc.

◆ SimpleZSPJPTJetCorrector() [2/3]

SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( const std::string &  fDataFile)

Definition at line 22 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, pfMETCorrectionType0_cfi::formula, mps_fire::i, dqmiolumiharvest::j, and AlCaHLTBitMon_ParallelJobs::p.

22  {
23  debug_ = false;
24  mParameters = new JetCorrectorParameters(fDataFile, "");
25 
26  mFunc = new TFormula("function", ((mParameters->definitions()).formula()).c_str());
27 
28  // Read parameters
29  if (debug_) {
30  std::cout << " Size of parameters as read by SimpleJetCorrectorParameters " << mParameters->size() << std::endl;
31  for (unsigned int i = 0; i < mParameters->size(); i++) {
32  const std::vector<float> p = mParameters->record(i).parameters();
33  for (std::vector<float>::const_iterator j = p.begin(); j < p.end(); j++) {
34  std::cout << " Parameter number " << mParameters->record(i).xMin(0) << " " << mParameters->record(i).xMax(0)
35  << " " << (*j) << std::endl;
36  }
37  }
38  } // debug
39 }
std::vector< float > parameters() const
JetCorrectorParameters * mParameters
const Definitions & definitions() const
float xMin(unsigned fVar) const
float xMax(unsigned fVar) const
const Record & record(unsigned fBin) const

◆ ~SimpleZSPJPTJetCorrector()

SimpleZSPJPTJetCorrector::~SimpleZSPJPTJetCorrector ( )
virtual

Definition at line 41 of file SimpleZSPJPTJetCorrector.cc.

41 {}

◆ SimpleZSPJPTJetCorrector() [3/3]

SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( const SimpleZSPJPTJetCorrector )
private

Member Function Documentation

◆ correctionEtEtaPhiP()

double SimpleZSPJPTJetCorrector::correctionEtEtaPhiP ( double  fEt,
double  fEta,
double  fPhi,
double  fP 
) const
virtual

Definition at line 48 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, EgHLTOffHistBins_cfi::et, PVValHelper::eta, l1ScoutingRun3::demux::fEt(), l1ScoutingRun3::ugmt::fEta(), mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, and geometryCSVtoXML::xx.

48  {
49  double et = fEt;
50  double eta = fabs(fEta);
51  double factor = 1.;
52 
53  // Define Eta bin for parametrization
54  std::vector<float> xx;
55  xx.push_back(eta);
56  int band = mParameters->binIndex(xx);
57 
58  if (band < 0)
59  return factor;
60 
61  const std::vector<float> p = mParameters->record(band).parameters();
62 
63  // Set parameters
64  for (unsigned int i = 0; i < p.size(); i++) {
65  mFunc->SetParameter(i, p[i]);
66  }
67 
68  if (debug_) {
69  cout << " Et and eta of jet " << et << " " << eta << " bin " << band << " " << p[1] << " " << p[2] << " " << p[3]
70  << " " << p[4] << " " << p[5] << endl;
71  }
72 
73  // double koef = 1. - p[2]*exp(p[3]*et)-p[4]*exp(p[5]*et);
74 
75  double koef = 1. - mFunc->Eval(et);
76 
77  // If et calojet less then some value - use correction on the boundary
78 
79  if (et < p[0])
80  koef = 1. - mFunc->Eval(p[0]);
81 
82  //
83  if (koef <= 0.000001) {
84  if (debug_)
85  std::cout << "SimpleZSPJPTJetCorrector::Problem with ZSP corrections " << koef << std::endl;
86  koef = 1.;
87  }
88 
89  double etnew = et / koef;
90 
91  if (debug_)
92  cout << " The new energy found " << etnew << " " << et << " " << koef << endl;
93 
94  return etnew / et;
95 }
std::vector< float > parameters() const
int binIndex(const std::vector< float > &fX) const
float fEt(int hwEt)
Definition: conversion.h:29
JetCorrectorParameters * mParameters
float fEta(int hwEta)
Definition: conversion.h:17
const Record & record(unsigned fBin) const

◆ correctionPtEtaPhiE()

double SimpleZSPJPTJetCorrector::correctionPtEtaPhiE ( double  fPt,
double  fEta,
double  fPhi,
double  fE 
) const
virtual

Definition at line 43 of file SimpleZSPJPTJetCorrector.cc.

References l1ScoutingRun3::ugmt::fEta(), l1ScoutingRun3::ugmt::fPhi(), and l1ScoutingRun3::ugmt::fPt().

43  {
44  double costhetainv = cosh(fEta);
45  return correctionEtEtaPhiP(fE / costhetainv, fEta, fPhi, fPt * costhetainv);
46 }
float fPhi(int hwPhi)
Definition: conversion.h:18
float fPt(int hwPt)
Definition: conversion.h:16
virtual double correctionEtEtaPhiP(double fEt, double fEta, double fPhi, double fP) const
float fEta(int hwEta)
Definition: conversion.h:17

◆ correctionPUEtEtaPhiP()

double SimpleZSPJPTJetCorrector::correctionPUEtEtaPhiP ( double  fEt,
double  fEta,
double  fPhi,
double  fP 
) const
virtual

Definition at line 97 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, EgHLTOffHistBins_cfi::et, PVValHelper::eta, l1ScoutingRun3::demux::fEt(), l1ScoutingRun3::ugmt::fEta(), AlCaHLTBitMon_ParallelJobs::p, and geometryCSVtoXML::xx.

97  {
98  double et = fEt;
99  double eta = fabs(fEta);
100  double factor = 1.;
101 
102  // Define Eta bin for parametrization
103  std::vector<float> xx;
104  xx.push_back(eta);
105  int band = mParameters->binIndex(xx);
106 
107  if (band < 0)
108  return factor;
109 
110  const std::vector<float> p = mParameters->record(band).parameters();
111 
112  if (debug_) {
113  cout << " Et and eta of jet " << et << " " << eta << " bin " << band << std::endl;
114  }
115 
116  double koef = (et - p[2]) / et;
117  double etnew = et / koef;
118 
119  if (debug_)
120  cout << " The new energy found " << etnew << " " << et << endl;
121 
122  return etnew / et;
123 }
std::vector< float > parameters() const
int binIndex(const std::vector< float > &fX) const
float fEt(int hwEt)
Definition: conversion.h:29
JetCorrectorParameters * mParameters
float fEta(int hwEta)
Definition: conversion.h:17
const Record & record(unsigned fBin) const

◆ init()

void SimpleZSPJPTJetCorrector::init ( const std::string &  fDataFile)

◆ operator=()

SimpleZSPJPTJetCorrector& SimpleZSPJPTJetCorrector::operator= ( const SimpleZSPJPTJetCorrector )
private

Member Data Documentation

◆ debug_

bool SimpleZSPJPTJetCorrector::debug_
private

Definition at line 31 of file SimpleZSPJPTJetCorrector.h.

◆ mFunc

TFormula* SimpleZSPJPTJetCorrector::mFunc
private

Definition at line 30 of file SimpleZSPJPTJetCorrector.h.

◆ mParameters

JetCorrectorParameters* SimpleZSPJPTJetCorrector::mParameters
private

Definition at line 29 of file SimpleZSPJPTJetCorrector.h.