CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
scaleFunctionType51< T > Class Template Reference

#include <Functions.h>

Inheritance diagram for scaleFunctionType51< T >:
scaleFunctionBase< T >

Public Member Functions

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
 
 scaleFunctionType51 ()
 
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)
 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 &parScale, const std::vector< int > &parScaleOrder, const std::vector< double > &parStep, const std::vector< double > &parMin, const std::vector< double > &parMax, const int muonType)
 
- Public Member Functions inherited from scaleFunctionBase< T >
virtual int parNum () const
 
virtual ~scaleFunctionBase ()=0
 

Additional Inherited Members

- Protected Member Functions inherited from scaleFunctionBase< T >
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 inherited from scaleFunctionBase< T >
int parNum_
 

Detailed Description

template<class T>
class scaleFunctionType51< T >

Definition at line 2552 of file Functions.h.

Constructor & Destructor Documentation

template<class T >
scaleFunctionType51< T >::scaleFunctionType51 ( )
inline

Definition at line 2554 of file Functions.h.

References scaleFunctionBase< T >::parNum_.

2554 { this->parNum_ = 23; }

Member Function Documentation

template<class T >
virtual void scaleFunctionType51< 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 from scaleFunctionBase< T >.

Definition at line 2592 of file Functions.h.

References i, and scaleFunctionBase< T >::parNum_.

2592  {
2593  // scaleVec->push_back(1);
2594  for( int i=0; i<this->parNum_; ++i ) {
2595  scaleVec->push_back(0);
2596  }
2597  }
int i
Definition: DBlmapReader.cc:9
template<class T >
virtual double scaleFunctionType51< T >::scale ( const double &  pt,
const double &  eta,
const double &  phi,
const int  chg,
const T parScale 
) const
inlinevirtual

Implements scaleFunctionBase< T >.

Definition at line 2555 of file Functions.h.

References eta(), and funct::sin().

2555  {
2556  double ampl(0), phase(0), twist(0);
2557 
2558 // very bwd bin
2559  if ( eta < parScale[4] ) {
2560  ampl = parScale[1]; phase = parScale[2];
2561  twist = parScale[3]*(eta-parScale[4])+parScale[7]*(parScale[4]-parScale[8])+parScale[11]*parScale[8];
2562 // bwd bin
2563  } else if ( parScale[4] <= eta && eta < parScale[8] ) {
2564  ampl = parScale[5]; phase = parScale[6];
2565  twist = parScale[7]*(eta-parScale[8])+parScale[11]*parScale[8] ;
2566 // barrel bin 1
2567  } else if ( parScale[8] <= eta && eta < parScale[14] ) {
2568  if ( eta < 0 ) {
2569  ampl = parScale[9]; phase = parScale[10];
2570  } else if ( eta > 0 ) {
2571  ampl = parScale[11]; phase = parScale[12];
2572  }
2573  twist = parScale[13]*eta;
2574 // fwd bin
2575  } else if ( parScale[14] <= eta && eta < parScale[18] ) {
2576  ampl = parScale[15]; phase = parScale[16];
2577  twist = parScale[17]*(eta-parScale[14])+parScale[13]*parScale[14];
2578 // very fwd bin
2579  } else if ( parScale[18] < eta ) {
2580  ampl = parScale[19]; phase = parScale[20];
2581  twist = parScale[21]*(eta-parScale[18])+parScale[17]*(parScale[18]-parScale[14])+parScale[13]*parScale[14];
2582  }
2583 
2584 // apply the correction
2585  double curv = (1.+parScale[0])*((double)chg/pt
2586  -twist
2587  -ampl*sin(phi+phase)
2588  -0.5*parScale[22]);
2589  return 1./((double)chg*curv);
2590  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T eta() const
Definition: DDAxes.h:10
template<class T >
virtual void scaleFunctionType51< 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 
)
inlinevirtual

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

Implements scaleFunctionBase< T >.

Definition at line 2598 of file Functions.h.

References scaleFunctionBase< T >::setPar().

2599  {
2600 
2601  double thisStep[] = {0.000001,
2602  0.000001, 0.01, 0.000001, 0.01,
2603  0.000001, 0.01, 0.000001, 0.01,
2604  0.000001, 0.01, 0.000001, 0.01,
2605  0.000001, 0.01, 0.000001, 0.01,
2606  0.000001, 0.01, 0.000001, 0.01,
2607  0.000001, 0.01, 0.000001,
2608  0.000001};
2609 
2610  TString thisParName[] = { "Curv global scale"
2611  , "Phi ampl eta vbwd" , "Phi phase eta vbwd" , "Twist eta vbwd", "vbwd/bwd bndry"
2612  , "Phi ampl eta bwd" , "Phi phase eta bwd" , "Twist eta bwd", "bwd/bar bndry"
2613  , "Phi ampl eta bar-" ,"Phi phase eta bar-", "Phi ampl eta bar+","Phi phase eta bar+" , "Twist eta bar", "bar/fwd bndry"
2614  , "Phi ampl eta fwd" , "Phi phase eta fwd" , "Twist eta fwd", "fwd/vfwd bndry"
2615  , "Phi ampl eta vfwd" , "Phi phase eta vfwd" , "Twist eta vfwd"
2616  , "Charge depend bias"};
2617 
2618  if( muonType == 1 ) {
2619  double thisMini[] = {-0.1, -0.3, -3.1416, -0.3, -2.6, -0.3, -3.1416, -0.3, -2.6, -0.3, -3.1416, -0.3, -3.1416, -0.3, 0., -0.3, -3.1416, -0.3, 0. , -0.3, -3.1416, -0.3, -0.1};
2620  double thisMaxi[] = { 0.1, 0.3, 3.1416, 0.3, 0. , 0.3, 3.1416, 0.3, 0. , 0.3, 3.1416, 0.3, 3.1416, 0.3, 2.6 , 0.3, 3.1416, 0.3, 2.6 , 0.3, 3.1416, 0.3, 0.1};
2621  this->setPar( Start, Step, Mini, Maxi, ind, parname, parScale, parScaleOrder, thisStep, thisMini, thisMaxi, thisParName );
2622  } else {
2623  double thisMini[] = {-0.1, -0.3, -3.1416, -0.3, -2.6, -0.3, -3.1416, -0.3, -2.6, -0.3, -3.1416, -0.3, -3.1416, -0.3, 0., -0.3, -3.1416, -0.3, 0. , -0.3, -3.1416, -0.3, -0.1};
2624  double thisMaxi[] = { 0.1, 0.3, 3.1416, 0.3, 0. , 0.3, 3.1416, 0.3, 0. , 0.3, 3.1416, 0.3, 3.1416, 0.3, 2.6 , 0.3, 3.1416, 0.3, 2.6 , 0.3, 3.1416, 0.3, 0.1};
2625  this->setPar( Start, Step, Mini, Maxi, ind, parname, parScale, parScaleOrder, thisStep, thisMini, thisMaxi, thisParName );
2626  }
2627  }
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.
Definition: Functions.h:70
template<class T >
virtual void scaleFunctionType51< T >::setParameters ( double *  Start,
double *  Step,
double *  Mini,
double *  Maxi,
int *  ind,
TString *  parname,
const T parScale,
const std::vector< int > &  parScaleOrder,
const std::vector< double > &  parStep,
const std::vector< double > &  parMin,
const std::vector< double > &  parMax,
const int  muonType 
)
inlinevirtual

Reimplemented from scaleFunctionBase< T >.

Definition at line 2628 of file Functions.h.

References gather_cfg::cout, cmsRelvalreport::exit, i, scaleFunctionBase< T >::parNum_, and scaleFunctionBase< T >::setPar().

2634  {
2635  if( (int(parStep.size()) != this->parNum_) || (int(parMin.size()) != this->parNum_) || (int(parMax.size()) != this->parNum_) ) {
2636  std::cout << "Error: par step or min or max do not match with number of parameters" << std::endl;
2637  std::cout << "parNum = " << this->parNum_ << std::endl;
2638  std::cout << "parStep.size() = " << parStep.size() << std::endl;
2639  std::cout << "parMin.size() = " << parMin.size() << std::endl;
2640  std::cout << "parMax.size() = " << parMax.size() << std::endl;
2641  exit(1);
2642  }
2643  std::vector<ParameterSet> parSet(this->parNum_);
2644  // name, step, mini, maxi
2645  parSet[0] = ParameterSet( "Curv global scale", parStep[0], parMin[0], parMax[0] );
2646  parSet[1] = ParameterSet( "Phi ampl vbwd", parStep[1], parMin[1], parMax[1] );
2647  parSet[2] = ParameterSet( "Phi phase vbwd", parStep[2], parMin[2], parMax[2] );
2648  parSet[3] = ParameterSet( "Twist vbwd", parStep[3], parMin[3], parMax[3] );
2649  parSet[4] = ParameterSet( "vbwd/bwd bndry", parStep[4], parMin[4], parMax[4] );
2650  parSet[5] = ParameterSet( "Phi ampl bwd", parStep[5], parMin[5], parMax[5] );
2651  parSet[6] = ParameterSet( "Phi phase bwd", parStep[6], parMin[6], parMax[6] );
2652  parSet[7] = ParameterSet( "Twist bwd", parStep[7], parMin[7], parMax[7] );
2653  parSet[8] = ParameterSet( "bwd/bar bndry", parStep[8], parMin[8], parMax[8] );
2654  parSet[9] = ParameterSet( "Phi ampl bar-", parStep[9], parMin[9], parMax[9] );
2655  parSet[10] = ParameterSet( "Phi phase bar-", parStep[10],parMin[10],parMax[10] );
2656  parSet[11] = ParameterSet( "Phi ampl bar+", parStep[11],parMin[11],parMax[11] );
2657  parSet[12] = ParameterSet( "Phi phase bar+", parStep[12],parMin[12],parMax[12] );
2658  parSet[13] = ParameterSet( "Twist bar", parStep[13],parMin[13],parMax[13] );
2659  parSet[14] = ParameterSet( "bar/fwd bndry", parStep[14],parMin[14],parMax[14] );
2660  parSet[15] = ParameterSet( "Phi ampl fwd", parStep[15],parMin[15],parMax[15] );
2661  parSet[16] = ParameterSet( "Phi phase fwd", parStep[16],parMin[16],parMax[16] );
2662  parSet[17] = ParameterSet( "Twist fwd", parStep[17],parMin[17],parMax[17] );
2663  parSet[18] = ParameterSet( "fwd/vfwd bndry", parStep[18],parMin[18],parMax[18] );
2664  parSet[19] = ParameterSet( "Phi ampl vfwd", parStep[19],parMin[19],parMax[19] );
2665  parSet[20] = ParameterSet( "Phi phase vfwd", parStep[20],parMin[20],parMax[20] );
2666  parSet[21] = ParameterSet( "Twist vfwd", parStep[21],parMin[21],parMax[21] );
2667  parSet[22] = ParameterSet( "Charge depend bias", parStep[22],parMin[22],parMax[22] );
2668 
2669  std::cout << "setting parameters" << std::endl;
2670  for( int i=0; i<this->parNum_; ++i ) {
2671  std::cout << "parStep["<<i<<"] = " << parStep[i]
2672  << ", parMin["<<i<<"] = " << parMin[i]
2673  << ", parMax["<<i<<"] = " << parMin[i] << std::endl;
2674  }
2675  this->setPar( Start, Step, Mini, Maxi, ind, parname, parScale, parScaleOrder, parSet );
2676  }
int i
Definition: DBlmapReader.cc:9
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.
Definition: Functions.h:70
tuple cout
Definition: gather_cfg.py:121