CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

TFormula * mFunc
 
JetCorrectorParametersmParameters
 

Detailed Description

classes declaration

Definition at line 17 of file SimpleZSPJPTJetCorrector.h.

Constructor & Destructor Documentation

SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( )

Definition at line 28 of file SimpleZSPJPTJetCorrector.cc.

29 {}
SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( const std::string &  fDataFile)

Definition at line 31 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, zspjpt::debug, EcalElecEmulExample_cfg::formula, i, j, and AlCaHLTBitMon_ParallelJobs::p.

32 {
33  mParameters = new JetCorrectorParameters (fDataFile,"");
34 
35  //std::cout<<" Formula "<<((mParameters->definitions()).formula()).c_str()<<std::endl;
36 
37  mFunc = new TFormula("function",((mParameters->definitions()).formula()).c_str());
38 
39 // Read parameters
40  if (zspjpt::debug) {
41  std::cout<<" Size of parameters as read by SimpleJetCorrectorParameters "<<mParameters->size()<<std::endl;
42  for(unsigned int i = 0; i<mParameters->size(); i++){
43  const std::vector<float> p = mParameters->record (i).parameters ();
44  for(std::vector<float>::const_iterator j=p.begin(); j<p.end(); j++) {
45  std::cout<<" Parameter number "<<mParameters->record (i).xMin(0)<<" "<<mParameters->record (i).xMax(0)<<" "<<(*j)<<std::endl;
46  }
47  }
48  } // debug
49 }
float xMin(unsigned fVar) const
int i
Definition: DBlmapReader.cc:9
std::vector< float > parameters() const
const Definitions & definitions() const
const Record & record(unsigned fBin) const
JetCorrectorParameters * mParameters
int j
Definition: DBlmapReader.cc:9
float xMax(unsigned fVar) const
tuple cout
Definition: gather_cfg.py:121
SimpleZSPJPTJetCorrector::~SimpleZSPJPTJetCorrector ( )
virtual

Definition at line 51 of file SimpleZSPJPTJetCorrector.cc.

51  {
52 }
SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( const SimpleZSPJPTJetCorrector )
private

Member Function Documentation

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

Definition at line 59 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, zspjpt::debug, eta(), i, and AlCaHLTBitMon_ParallelJobs::p.

59  {
60 
61  double et=fEt;
62  double eta=fabs (fEta);
63  double factor = 1.;
64 
65 // Define Eta bin for parametrization
66  std::vector<float> xx; xx.push_back(eta);
67  int band = mParameters->binIndex(xx);
68 
69  if(band < 0) return factor;
70 
71  const std::vector<float> p = mParameters->record (band).parameters ();
72 
73  // Set parameters
74  for(unsigned int i=0; i<p.size();i++) {
75  mFunc->SetParameter(i,p[i]);
76  }
77 
78  if (zspjpt::debug) {
79  cout<<" Et and eta of jet "<<et<<" "<<eta<<" bin "<<band<<" "<<p[1]<<" "<<p[2]<<" "<<p[3]<<
80  " "<<p[4]<<" "<<p[5]<<endl;
81  }
82 
83 // double koef = 1. - p[2]*exp(p[3]*et)-p[4]*exp(p[5]*et);
84 
85  double koef = 1. - mFunc->Eval(et);
86 
87 // If et calojet less then some value - use correction on the boundary
88 
89  if( et < p[0] ) koef = 1. - mFunc->Eval(p[0]);
90 
91 //
92  if(koef <= 0.000001)
93  {
94  if (zspjpt::debug) std::cout<<"SimpleZSPJPTJetCorrector::Problem with ZSP corrections "<<koef<<std::endl;
95  koef = 1.;
96  }
97 
98  double etnew = et/koef;
99 
100  if (zspjpt::debug) cout<<" The new energy found "<<etnew<<" "<<et<<" "<<koef<<endl;
101 
102  return etnew/et;
103 }
int i
Definition: DBlmapReader.cc:9
std::vector< float > parameters() const
const Record & record(unsigned fBin) const
T eta() const
JetCorrectorParameters * mParameters
int binIndex(const std::vector< float > &fX) const
tuple cout
Definition: gather_cfg.py:121
double SimpleZSPJPTJetCorrector::correctionPtEtaPhiE ( double  fPt,
double  fEta,
double  fPhi,
double  fE 
) const
virtual

Definition at line 54 of file SimpleZSPJPTJetCorrector.cc.

54  {
55  double costhetainv = cosh (fEta);
56  return correctionEtEtaPhiP (fE/costhetainv, fEta, fPhi, fPt*costhetainv);
57 }
virtual double correctionEtEtaPhiP(double fEt, double fEta, double fPhi, double fP) const
double SimpleZSPJPTJetCorrector::correctionPUEtEtaPhiP ( double  fEt,
double  fEta,
double  fPhi,
double  fP 
) const
virtual

Definition at line 105 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, zspjpt::debug, eta(), and AlCaHLTBitMon_ParallelJobs::p.

105  {
106 
107  double et=fEt;
108  double eta=fabs (fEta);
109  double factor = 1.;
110 
111 // Define Eta bin for parametrization
112  std::vector<float> xx; xx.push_back(eta);
113  int band = mParameters->binIndex(xx);
114 
115  if(band < 0) return factor;
116 
117  const std::vector<float> p = mParameters->record (band).parameters ();
118 
119  if (zspjpt::debug) {
120  cout<<" Et and eta of jet "<<et<<" "<<eta<<" bin "<<band<<std::endl;
121  }
122 
123  double koef = (et-p[2])/et;
124  double etnew = et/koef;
125 
126  if (zspjpt::debug) cout<<" The new energy found "<<etnew<<" "<<et<<endl;
127 
128  return etnew/et;
129 }
std::vector< float > parameters() const
const Record & record(unsigned fBin) const
T eta() const
JetCorrectorParameters * mParameters
int binIndex(const std::vector< float > &fX) const
tuple cout
Definition: gather_cfg.py:121
void SimpleZSPJPTJetCorrector::init ( const std::string &  fDataFile)
SimpleZSPJPTJetCorrector& SimpleZSPJPTJetCorrector::operator= ( const SimpleZSPJPTJetCorrector )
private

Member Data Documentation

TFormula* SimpleZSPJPTJetCorrector::mFunc
private

Definition at line 32 of file SimpleZSPJPTJetCorrector.h.

JetCorrectorParameters* SimpleZSPJPTJetCorrector::mParameters
private

Definition at line 31 of file SimpleZSPJPTJetCorrector.h.