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

bool debug_
 
TFormula * mFunc
 
JetCorrectorParametersmParameters
 

Detailed Description

classes declaration

Definition at line 16 of file SimpleZSPJPTJetCorrector.h.

Constructor & Destructor Documentation

SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( )

Definition at line 21 of file SimpleZSPJPTJetCorrector.cc.

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

Definition at line 24 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, EcalElecEmulTccOnlyExample_cfg::formula, i, j, and AlCaHLTBitMon_ParallelJobs::p.

25 {
26  debug_=false;
27  mParameters = new JetCorrectorParameters (fDataFile,"");
28 
29  //std::cout<<" Formula "<<((mParameters->definitions()).formula()).c_str()<<std::endl;
30 
31  mFunc = new TFormula("function",((mParameters->definitions()).formula()).c_str());
32 
33 // Read parameters
34  if (debug_) {
35  std::cout<<" Size of parameters as read by SimpleJetCorrectorParameters "<<mParameters->size()<<std::endl;
36  for(unsigned int i = 0; i<mParameters->size(); i++){
37  const std::vector<float> p = mParameters->record (i).parameters ();
38  for(std::vector<float>::const_iterator j=p.begin(); j<p.end(); j++) {
39  std::cout<<" Parameter number "<<mParameters->record (i).xMin(0)<<" "<<mParameters->record (i).xMax(0)<<" "<<(*j)<<std::endl;
40  }
41  }
42  } // debug
43 }
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:145
SimpleZSPJPTJetCorrector::~SimpleZSPJPTJetCorrector ( )
virtual

Definition at line 45 of file SimpleZSPJPTJetCorrector.cc.

45  {
46 }
SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( const SimpleZSPJPTJetCorrector )
private

Member Function Documentation

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

Definition at line 53 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, eta, i, and AlCaHLTBitMon_ParallelJobs::p.

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

Definition at line 48 of file SimpleZSPJPTJetCorrector.cc.

48  {
49  double costhetainv = cosh (fEta);
50  return correctionEtEtaPhiP (fE/costhetainv, fEta, fPhi, fPt*costhetainv);
51 }
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 99 of file SimpleZSPJPTJetCorrector.cc.

References gather_cfg::cout, eta, and AlCaHLTBitMon_ParallelJobs::p.

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

Member Data Documentation

bool SimpleZSPJPTJetCorrector::debug_
private

Definition at line 32 of file SimpleZSPJPTJetCorrector.h.

TFormula* SimpleZSPJPTJetCorrector::mFunc
private

Definition at line 31 of file SimpleZSPJPTJetCorrector.h.

JetCorrectorParameters* SimpleZSPJPTJetCorrector::mParameters
private

Definition at line 30 of file SimpleZSPJPTJetCorrector.h.