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 >:
scaleFunction50< T > scaleFunctionType0< T > scaleFunctionType50< T > scaleFunctionType64< T >

Public Member Functions

virtual int parNum () const
 
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 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
 
virtual ~scaleFunctionBase ()=0
 

Protected Member Functions

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< ParSet > &parSet)
 
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 44 of file Functions.h.

Constructor & Destructor Documentation

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

Definition at line 103 of file Functions.h.

Referenced by scaleFunctionBase< std::vector< double > >::setPar().

103 { } // defined even though it's pure virtual; should be faster this way.
template<class T>
virtual scaleFunctionBase< T >::~scaleFunctionBase ( )
pure virtual

Member Function Documentation

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

Definition at line 48 of file MuScleFitCorrector_Functions.h.

48 { return parNum_; }
template<class T>
virtual int scaleFunctionBase< T >::parNum ( ) const
inlinevirtual
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 49 of file Functions.h.

Referenced by MuScleFitUtils::minimizeLikelihood().

49  {
50  std::cout << "ERROR: the resetParameters method must be defined in each scale function" << std::endl;
51  std::cout << "Please add it to the scaleFunction you are using" << std::endl;
52  exit(1);
53  }
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
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
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< ParSet > &  parSet 
)
inlineprotectedvirtual

Definition at line 51 of file MuScleFitCorrector_Functions.h.

52  {
53  if( int(parSet.size()) != this->parNum_ ) {
54  std::cout << "Error: wrong number of parameter initializations = " << parSet.size() << ". Number of parameters is " << this->parNum_ << std::endl;
55  exit(1);
56  }
57  for( int iPar=0; iPar<this->parNum_; ++iPar ) {
58  Start[iPar] = parResol[iPar];
59  Step[iPar] = parSet[iPar].step;
60  Mini[iPar] = parSet[iPar].mini;
61  Maxi[iPar] = parSet[iPar].maxi;
62  ind[iPar] = parResolOrder[iPar];
63  parname[iPar] = parSet[iPar].name;
64  }
65  }
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 70 of file Functions.h.

72  {
73  for( int iPar=0; iPar<this->parNum_; ++iPar ) {
74  Start[iPar] = parScale[iPar];
75  Step[iPar] = thisStep[iPar];
76  Mini[iPar] = thisMini[iPar];
77  Maxi[iPar] = thisMaxi[iPar];
78  ind[iPar] = parScaleOrder[iPar];
79  parname[iPar] = thisParName[iPar];
80  }
81  }
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 82 of file Functions.h.

83  {
84  if( int(parSet.size()) != this->parNum_ ) {
85  std::cout << "Error: wrong number of parameter initializations = " << parSet.size() << ". Number of parameters is " << this->parNum_ << std::endl;
86  exit(1);
87  }
88  for( int iPar=0; iPar<this->parNum_; ++iPar ) {
89  Start[iPar] = parResol[iPar];
90  Step[iPar] = parSet[iPar].step;
91  Mini[iPar] = parSet[iPar].mini;
92  Maxi[iPar] = parSet[iPar].maxi;
93  ind[iPar] = parResolOrder[iPar];
94  parname[iPar] = parSet[iPar].name;
95  }
96  }
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().

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 56 of file Functions.h.

62  {
63  std::cout << "The method setParameters must be implemented for this scale function" << std::endl;
64  exit(1);
65  }

Member Data Documentation

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

Definition at line 68 of file Functions.h.