CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
SaturationFcn Class Reference

#include <SaturationFcn.h>

Inheritance diagram for SaturationFcn:

Public Member Functions

virtual double operator() (const std::vector< double > &x) const
 
 SaturationFcn ()
 
void set_data (int N, float *charge_ptr, float *adc_ptr)
 
virtual double Up () const
 
 ~SaturationFcn ()
 

Public Attributes

double x0start
 
double x1start
 
double x2start
 
double x3start
 

Private Attributes

double datx [20]
 
double daty [20]
 

Detailed Description

Definition at line 7 of file SaturationFcn.h.

Constructor & Destructor Documentation

SaturationFcn::SaturationFcn ( )
inline

Definition at line 11 of file SaturationFcn.h.

11 {}
SaturationFcn::~SaturationFcn ( )
inline

Definition at line 13 of file SaturationFcn.h.

13 {}

Member Function Documentation

virtual double SaturationFcn::operator() ( const std::vector< double > &  x) const
inlinevirtual

Definition at line 37 of file SaturationFcn.h.

References datx, daty, i, N, funct::pow(), and tmp.

37  {
38  double chisq = 0.0;
39  int N=20;
40  for(int i=0;i<N;i++){
41  double val=1.0+pow(x[1]*datx[i],x[2]);
42  double val2=1.0/x[2];
43  val=x[0]*x[1]*datx[i]/pow(val,val2);
44  double tmp=(daty[i]-x[3]-val);
45  //printf(" dat: %d %f %f %f %f \n",i,datx[i],daty[i]-x[3],val,tmp);
46  chisq=chisq+tmp*tmp;
47  }
48  //printf("x0-3 %f %f %f %f chisq %f \n",x[0],x[1],x[2],x[3],chisq);
49  return chisq;
50  }
int i
Definition: DBlmapReader.cc:9
double daty[20]
Definition: SaturationFcn.h:58
#define N
Definition: blowfish.cc:9
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double datx[20]
Definition: SaturationFcn.h:58
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void SaturationFcn::set_data ( int  N,
float *  charge_ptr,
float *  adc_ptr 
)
inline

Definition at line 16 of file SaturationFcn.h.

References datx, daty, i, N, x, x0start, x1start, x2start, x3start, and y.

Referenced by SaturationFit::SaturationFit().

16  {
17 
18  float x[20],y[20];
19 
20  for(int i=0;i<N;i++){
21  x[i]=charge_ptr[i];
22  y[i]=adc_ptr[i];
23  datx[i]=x[i];
24  daty[i]=y[i];
25  //printf("%d datx daty %f %f \n",i,datx[i],daty[i]);
26  }
27 
28  x3start=(y[4]*x[1]-y[1]*x[4])/(x[1]-x[4]);
29  x0start=daty[13]-x3start;
30  x1start=(y[4]-y[1])/(x[4]-x[1])/x0start;
31  x2start=20.;
32  //printf(" x0-2start %f %f %f %f\n",x0start,x1start,x2start,x3start);
33  }
int i
Definition: DBlmapReader.cc:9
double daty[20]
Definition: SaturationFcn.h:58
#define N
Definition: blowfish.cc:9
double datx[20]
Definition: SaturationFcn.h:58
virtual double SaturationFcn::Up ( ) const
inlinevirtual

Definition at line 35 of file SaturationFcn.h.

35 {return 1.;}

Member Data Documentation

double SaturationFcn::datx[20]
private

Definition at line 58 of file SaturationFcn.h.

Referenced by operator()(), and set_data().

double SaturationFcn::daty[20]
private

Definition at line 58 of file SaturationFcn.h.

Referenced by operator()(), and set_data().

double SaturationFcn::x0start

Definition at line 52 of file SaturationFcn.h.

Referenced by SaturationFit::SaturationFit(), and set_data().

double SaturationFcn::x1start

Definition at line 53 of file SaturationFcn.h.

Referenced by SaturationFit::SaturationFit(), and set_data().

double SaturationFcn::x2start

Definition at line 54 of file SaturationFcn.h.

Referenced by SaturationFit::SaturationFit(), and set_data().

double SaturationFcn::x3start

Definition at line 55 of file SaturationFcn.h.

Referenced by SaturationFit::SaturationFit(), and set_data().