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 16 of file SimpleZSPJPTJetCorrector.h.

Constructor & Destructor Documentation

SimpleZSPJPTJetCorrector::SimpleZSPJPTJetCorrector ( )

Definition at line 27 of file SimpleZSPJPTJetCorrector.cc.

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

Definition at line 30 of file SimpleZSPJPTJetCorrector.cc.

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

31 {
32  mParameters = new JetCorrectorParameters (fDataFile,"");
33 
34  //std::cout<<" Formula "<<((mParameters->definitions()).formula()).c_str()<<std::endl;
35 
36  mFunc = new TFormula("function",((mParameters->definitions()).formula()).c_str());
37 
38 // Read parameters
39  if (zspjpt::debug) {
40  std::cout<<" Size of parameters as read by SimpleJetCorrectorParameters "<<mParameters->size()<<std::endl;
41  for(unsigned int i = 0; i<mParameters->size(); i++){
42  const std::vector<float> p = mParameters->record (i).parameters ();
43  for(std::vector<float>::const_iterator j=p.begin(); j<p.end(); j++) {
44  std::cout<<" Parameter number "<<mParameters->record (i).xMin(0)<<" "<<mParameters->record (i).xMax(0)<<" "<<(*j)<<std::endl;
45  }
46  }
47  } // debug
48 }
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 50 of file SimpleZSPJPTJetCorrector.cc.

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

Member Function Documentation

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

Definition at line 58 of file SimpleZSPJPTJetCorrector.cc.

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

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

53  {
54  double costhetainv = cosh (fEta);
55  return correctionEtEtaPhiP (fE/costhetainv, fEta, fPhi, fPt*costhetainv);
56 }
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 104 of file SimpleZSPJPTJetCorrector.cc.

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

104  {
105 
106  double et=fEt;
107  double eta=fabs (fEta);
108  double factor = 1.;
109 
110 // Define Eta bin for parametrization
111  std::vector<float> xx; xx.push_back(eta);
112  int band = mParameters->binIndex(xx);
113 
114  if(band < 0) return factor;
115 
116  const std::vector<float> p = mParameters->record (band).parameters ();
117 
118  if (zspjpt::debug) {
119  cout<<" Et and eta of jet "<<et<<" "<<eta<<" bin "<<band<<std::endl;
120  }
121 
122  double koef = (et-p[2])/et;
123  double etnew = et/koef;
124 
125  if (zspjpt::debug) cout<<" The new energy found "<<etnew<<" "<<et<<endl;
126 
127  return etnew/et;
128 }
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 31 of file SimpleZSPJPTJetCorrector.h.

JetCorrectorParameters* SimpleZSPJPTJetCorrector::mParameters
private

Definition at line 30 of file SimpleZSPJPTJetCorrector.h.