CMS 3D CMS Logo

Public Member Functions | Private Attributes

JetResolution Class Reference

#include <JetResolution.h>

List of all members.

Public Member Functions

void initialize (const std::string &fileName, bool doGaussian=false)
 JetResolution ()
 JetResolution (const std::string &fileName, bool doGaussian=false)
const std::string & name () const
TF1 * parameter (const std::string &parameterName, const std::vector< float > &x)
TF1 * parameterEta (const std::string &parameterName, float eta)
double parameterEtaEval (const std::string &parameterName, float eta, float pt)
const JetCorrectorParametersparameters (int i) const
TF1 * resolution (const std::vector< float > &x, const std::vector< float > &y) const
TF1 * resolutionEtaPt (float eta, float pt) const
virtual ~JetResolution ()

Private Attributes

std::string name_
std::vector< TF1 * > parameterFncs_
std::vector
< JetCorrectorParameters * > 
parameters_
TF1 * resolutionFnc_

Detailed Description

Definition at line 13 of file JetResolution.h.


Constructor & Destructor Documentation

JetResolution::JetResolution ( )

Definition at line 41 of file JetResolution.cc.

References resolutionFnc_.

  : resolutionFnc_(0)
{
  resolutionFnc_ = new TF1();
}
JetResolution::JetResolution ( const std::string &  fileName,
bool  doGaussian = false 
)
JetResolution::~JetResolution ( ) [virtual]

Definition at line 57 of file JetResolution.cc.

References i, parameterFncs_, parameters_, and resolutionFnc_.

{
  delete resolutionFnc_;
  for (unsigned i=0;i<parameterFncs_.size();i++) delete parameterFncs_[i];
  for (unsigned i=0;i<parameters_.size();i++)    delete parameters_[i];
}

Member Function Documentation

void JetResolution::initialize ( const std::string &  fileName,
bool  doGaussian = false 
)
const std::string& JetResolution::name ( ) const [inline]

Definition at line 32 of file JetResolution.h.

References name_.

{ return name_; }
TF1* JetResolution::parameter ( const std::string &  parameterName,
const std::vector< float > &  x 
)

Referenced by parameterEta().

TF1 * JetResolution::parameterEta ( const std::string &  parameterName,
float  eta 
)

Definition at line 146 of file JetResolution.cc.

References parameter(), and x.

Referenced by main().

{
  vector<float> x; x.push_back(eta);
  return parameter(parameterName,x);
}
double JetResolution::parameterEtaEval ( const std::string &  parameterName,
float  eta,
float  pt 
)

Definition at line 182 of file JetResolution.cc.

References newFWLiteAna::bin, JetCorrectorParameters::binIndex(), JetCorrectorParameters::definitions(), cuy::ii, N, parameterFncs_, parameters_, JetCorrectorParameters::record(), JetCorrectorParameters::size(), and AlCaHLTBitMon_QueryRunRegistry::string.

{
  TF1* func(0);
  JetCorrectorParameters* params(0);
  for (std::vector<TF1*>::size_type ifunc = 0; ifunc < parameterFncs_.size(); ++ifunc)
    {
      std::string fncname = parameterFncs_[ifunc]->GetName();
      if ( !(fncname.find("f"+parameterName) == 0) ) continue;
      params = parameters_[ifunc];
      func = (TF1*)parameterFncs_[ifunc];
      break;
    }

  if (!func)
    edm::LogError("ParameterNotFound") << "JetResolution::parameterEtaEval(): no parameter \""
                                  << parameterName << "\" found" << std::endl;

  std::vector<float> etas; etas.push_back(eta);
  int bin = params->binIndex(etas);

  if ( !(0 <= bin && bin < (int)params->size() ) )
    edm::LogError("ParameterNotFound") << "JetResolution::parameterEtaEval(): bin out of range: "
                                       << bin << std::endl;

  const std::vector<float>& pars = params->record(bin).parameters();

  int N = params->definitions().nParVar();
  for (unsigned ii = 2*N; ii < pars.size(); ++ii)
    {
      func->SetParameter(ii-2*N, pars[ii]); 
    }
  
  return func->Eval(pt);
}
const JetCorrectorParameters& JetResolution::parameters ( int  i) const [inline]

Definition at line 40 of file JetResolution.h.

References i, and parameters_.

{ return *(parameters_[i]); }
TF1* JetResolution::resolution ( const std::vector< float > &  x,
const std::vector< float > &  y 
) const

Referenced by resolutionEtaPt().

TF1 * JetResolution::resolutionEtaPt ( float  eta,
float  pt 
) const

Definition at line 115 of file JetResolution.cc.

References resolution(), x, and detailsBasic3DVector::y.

Referenced by main().

{
  vector<float> x; x.push_back(eta);
  vector<float> y; y.push_back(pt);
  return resolution(x,y);
}

Member Data Documentation

std::string JetResolution::name_ [private]

Definition at line 47 of file JetResolution.h.

Referenced by name().

std::vector<TF1*> JetResolution::parameterFncs_ [private]
TF1* JetResolution::resolutionFnc_ [mutable, private]