CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SimpleZSPJPTJetCorrector Class Reference

classes declaration More...

#include <SimpleZSPJPTJetCorrector.h>

List of all members.

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 (const std::string &fDataFile)
 SimpleZSPJPTJetCorrector ()
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.

{}
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.

{
  mParameters = new JetCorrectorParameters (fDataFile,"");

  //std::cout<<" Formula "<<((mParameters->definitions()).formula()).c_str()<<std::endl;

  mFunc            = new TFormula("function",((mParameters->definitions()).formula()).c_str());

// Read parameters
 if (zspjpt::debug) {
  std::cout<<" Size of parameters as read by SimpleJetCorrectorParameters "<<mParameters->size()<<std::endl;
  for(unsigned int i = 0; i<mParameters->size(); i++){
   const std::vector<float> p = mParameters->record (i).parameters ();
    for(std::vector<float>::const_iterator j=p.begin(); j<p.end(); j++) {
         std::cout<<" Parameter number "<<mParameters->record (i).xMin(0)<<" "<<mParameters->record (i).xMax(0)<<" "<<(*j)<<std::endl;
     }
  }
 } // debug
}
SimpleZSPJPTJetCorrector::~SimpleZSPJPTJetCorrector ( ) [virtual]

Definition at line 51 of file SimpleZSPJPTJetCorrector.cc.

                                                     {
} 
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.

                                                                                                           {
  
  double et=fEt;
  double eta=fabs (fEta);
  double factor = 1.;

// Define Eta bin for parametrization 
  std::vector<float> xx; xx.push_back(eta);
  int band = mParameters->binIndex(xx);

  if(band < 0) return factor;

  const std::vector<float> p = mParameters->record (band).parameters ();

 // Set parameters 
  for(unsigned int i=0; i<p.size();i++) {
     mFunc->SetParameter(i,p[i]);
  }

  if (zspjpt::debug) {
     cout<<" Et and eta of jet "<<et<<" "<<eta<<" bin "<<band<<" "<<p[1]<<" "<<p[2]<<" "<<p[3]<<
     " "<<p[4]<<" "<<p[5]<<endl;
  } 

//  double koef = 1. - p[2]*exp(p[3]*et)-p[4]*exp(p[5]*et);
  
  double koef = 1. - mFunc->Eval(et);

// If et calojet less then some value - use correction on the boundary
 
  if( et < p[0] ) koef = 1. - mFunc->Eval(p[0]);

//
  if(koef <= 0.000001) 
  {
   if (zspjpt::debug)  std::cout<<"SimpleZSPJPTJetCorrector::Problem with ZSP corrections "<<koef<<std::endl; 
  koef = 1.;
  }

  double etnew = et/koef;

  if (zspjpt::debug) cout<<" The new energy found "<<etnew<<" "<<et<<" "<<koef<<endl;
  
  return etnew/et;
}
double SimpleZSPJPTJetCorrector::correctionPtEtaPhiE ( double  fPt,
double  fEta,
double  fPhi,
double  fE 
) const [virtual]

Definition at line 54 of file SimpleZSPJPTJetCorrector.cc.

                                                                                                           {
  double costhetainv = cosh (fEta);
  return correctionEtEtaPhiP (fE/costhetainv, fEta, fPhi, fPt*costhetainv);
}
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.

                                                                                                             {

  double et=fEt;
  double eta=fabs (fEta);
  double factor = 1.;

// Define Eta bin for parametrization 
  std::vector<float> xx; xx.push_back(eta);
  int band = mParameters->binIndex(xx);

  if(band < 0) return factor;

  const std::vector<float> p = mParameters->record (band).parameters ();

  if (zspjpt::debug) {
     cout<<" Et and eta of jet "<<et<<" "<<eta<<" bin "<<band<<std::endl;
  }

  double koef = (et-p[2])/et;
  double etnew = et/koef;

  if (zspjpt::debug) cout<<" The new energy found "<<etnew<<" "<<et<<endl;

  return etnew/et;
}
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.

Definition at line 31 of file SimpleZSPJPTJetCorrector.h.