CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
scaleFunctionBase< T > Class Template Referenceabstract

#include <Functions.h>

Inheritance diagram for scaleFunctionBase< T >:
scaleFunctionType0< T > scaleFunctionType50< T > scaleFunctionType64< T >

Public Member Functions

virtual int parNum () const
 
virtual void resetParameters (std::vector< double > *scaleVec) const
 This method is used to reset the scale parameters to neutral values (useful for iterations > 0) More...
 
virtual double scale (const double &pt, const double &eta, const double &phi, const int chg, const T &parScale) const =0
 
virtual void setParameters (double *Start, double *Step, double *Mini, double *Maxi, int *ind, TString *parname, const T &parScale, const std::vector< int > &parScaleOrder, const int muonType)=0
 This method is used to differentiate parameters among the different functions. More...
 
virtual void setParameters (double *Start, double *Step, double *Mini, double *Maxi, int *ind, TString *parname, const T &parResol, const std::vector< int > &parResolOrder, const std::vector< double > &parStep, const std::vector< double > &parMin, const std::vector< double > &parMax, const int muonType)
 
virtual ~scaleFunctionBase ()=0
 

Protected Member Functions

virtual void setPar (double *Start, double *Step, double *Mini, double *Maxi, int *ind, TString *parname, const T &parScale, const std::vector< int > &parScaleOrder, double *thisStep, double *thisMini, double *thisMaxi, TString *thisParName)
 This method sets the parameters. More...
 
virtual void setPar (double *Start, double *Step, double *Mini, double *Maxi, int *ind, TString *parname, const T &parResol, const std::vector< int > &parResolOrder, const std::vector< ParameterSet > &parSet)
 

Protected Attributes

int parNum_
 

Detailed Description

template<class T>
class scaleFunctionBase< T >

The correct functor is selected at job start in the constructor. The pt value is taken by reference and modified internally. eta, phi and chg are taken by const reference.
Made into a template so that it can be used with arrays too (parval for the scale fit is an array, because Lykelihood is an extern C function, because TMinuit asks it).
Note that in the array case it takes the pointer by const reference, thus the elements of the array are modifiable.

Definition at line 40 of file Functions.h.

Constructor & Destructor Documentation

◆ ~scaleFunctionBase()

template<class T >
scaleFunctionBase< T >::~scaleFunctionBase ( )
inlinepure virtual

Definition at line 132 of file Functions.h.

132  {
133 } // defined even though it's pure virtual; should be faster this way.

Member Function Documentation

◆ parNum()

template<class T>
virtual int scaleFunctionBase< T >::parNum ( ) const
inlinevirtual

Definition at line 76 of file Functions.h.

Referenced by MuScleFitUtils::minimizeLikelihood().

76 { return parNum_; }

◆ resetParameters()

template<class T>
virtual void scaleFunctionBase< T >::resetParameters ( std::vector< double > *  scaleVec) const
inlinevirtual

This method is used to reset the scale parameters to neutral values (useful for iterations > 0)

Reimplemented in scaleFunctionType64< T >, scaleFunctionType50< T >, and scaleFunctionType0< T >.

Definition at line 46 of file Functions.h.

Referenced by MuScleFitUtils::minimizeLikelihood().

46  {
47  std::cout << "ERROR: the resetParameters method must be defined in each scale function" << std::endl;
48  std::cout << "Please add it to the scaleFunction you are using" << std::endl;
49  exit(1);
50  }
def exit(msg="")

◆ scale()

template<class T>
virtual double scaleFunctionBase< T >::scale ( const double &  pt,
const double &  eta,
const double &  phi,
const int  chg,
const T parScale 
) const
pure virtual

◆ setPar() [1/2]

template<class T>
virtual void scaleFunctionBase< T >::setPar ( double *  Start,
double *  Step,
double *  Mini,
double *  Maxi,
int *  ind,
TString *  parname,
const T parScale,
const std::vector< int > &  parScaleOrder,
double *  thisStep,
double *  thisMini,
double *  thisMaxi,
TString *  thisParName 
)
inlineprotectedvirtual

This method sets the parameters.

Definition at line 81 of file Functions.h.

Referenced by scaleFunctionType50< T >::setParameters(), and scaleFunctionType64< T >::setParameters().

92  {
93  for (int iPar = 0; iPar < this->parNum_; ++iPar) {
94  Start[iPar] = parScale[iPar];
95  Step[iPar] = thisStep[iPar];
96  Mini[iPar] = thisMini[iPar];
97  Maxi[iPar] = thisMaxi[iPar];
98  ind[iPar] = parScaleOrder[iPar];
99  parname[iPar] = thisParName[iPar];
100  }
101  }

◆ setPar() [2/2]

template<class T>
virtual void scaleFunctionBase< T >::setPar ( double *  Start,
double *  Step,
double *  Mini,
double *  Maxi,
int *  ind,
TString *  parname,
const T parResol,
const std::vector< int > &  parResolOrder,
const std::vector< ParameterSet > &  parSet 
)
inlineprotectedvirtual

Definition at line 102 of file Functions.h.

110  {
111  if (int(parSet.size()) != this->parNum_) {
112  std::cout << "Error: wrong number of parameter initializations = " << parSet.size()
113  << ". Number of parameters is " << this->parNum_ << std::endl;
114  exit(1);
115  }
116  for (int iPar = 0; iPar < this->parNum_; ++iPar) {
117  Start[iPar] = parResol[iPar];
118  Step[iPar] = parSet[iPar].step;
119  Mini[iPar] = parSet[iPar].mini;
120  Maxi[iPar] = parSet[iPar].maxi;
121  ind[iPar] = parResolOrder[iPar];
122  parname[iPar] = parSet[iPar].name;
123  }
124  }
def exit(msg="")

◆ setParameters() [1/2]

template<class T>
virtual void scaleFunctionBase< T >::setParameters ( double *  Start,
double *  Step,
double *  Mini,
double *  Maxi,
int *  ind,
TString *  parname,
const T parScale,
const std::vector< int > &  parScaleOrder,
const int  muonType 
)
pure virtual

This method is used to differentiate parameters among the different functions.

Implemented in scaleFunctionType64< T >, scaleFunctionType50< T >, and scaleFunctionType0< T >.

Referenced by MuScleFitUtils::minimizeLikelihood().

◆ setParameters() [2/2]

template<class T>
virtual void scaleFunctionBase< T >::setParameters ( double *  Start,
double *  Step,
double *  Mini,
double *  Maxi,
int *  ind,
TString *  parname,
const T parResol,
const std::vector< int > &  parResolOrder,
const std::vector< double > &  parStep,
const std::vector< double > &  parMin,
const std::vector< double > &  parMax,
const int  muonType 
)
inlinevirtual

Reimplemented in scaleFunctionType64< T >, and scaleFunctionType50< T >.

Definition at line 61 of file Functions.h.

72  {
73  std::cout << "The method setParameters must be implemented for this scale function" << std::endl;
74  exit(1);
75  }
def exit(msg="")

Member Data Documentation

◆ parNum_

template<class T>
int scaleFunctionBase< T >::parNum_
protected