CMS 3D CMS Logo

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 11 of file SaturationFcn.h.

Constructor & Destructor Documentation

◆ SaturationFcn()

SaturationFcn::SaturationFcn ( )
inline

Definition at line 15 of file SaturationFcn.h.

15 {}

◆ ~SaturationFcn()

SaturationFcn::~SaturationFcn ( )
inline

Definition at line 17 of file SaturationFcn.h.

17 {}

Member Function Documentation

◆ operator()()

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

Definition at line 41 of file SaturationFcn.h.

41  {
42  double chisq = 0.0;
43  int N=20;
44  for(int i=0;i<N;i++){
45  double val=1.0+pow(x[1]*datx[i],x[2]);
46  double val2=1.0/x[2];
47  val=x[0]*x[1]*datx[i]/pow(val,val2);
48  double tmp=(daty[i]-x[3]-val);
49  //printf(" dat: %d %f %f %f %f \n",i,datx[i],daty[i]-x[3],val,tmp);
50  chisq=chisq+tmp*tmp;
51  }
52  //printf("x0-3 %f %f %f %f chisq %f \n",x[0],x[1],x[2],x[3],chisq);
53  return chisq;
54  }

References mps_fire::i, N, funct::pow(), createJobs::tmp, and heppy_batch::val.

◆ set_data()

void SaturationFcn::set_data ( int  N,
float *  charge_ptr,
float *  adc_ptr 
)
inline

Definition at line 20 of file SaturationFcn.h.

20  {
21 
22  float x[20],y[20];
23 
24  for(int i=0;i<N;i++){
25  x[i]=charge_ptr[i];
26  y[i]=adc_ptr[i];
27  datx[i]=x[i];
28  daty[i]=y[i];
29  //printf("%d datx daty %f %f \n",i,datx[i],daty[i]);
30  }
31 
32  x3start=(y[4]*x[1]-y[1]*x[4])/(x[1]-x[4]);
33  x0start=daty[13]-x3start;
34  x1start=(y[4]-y[1])/(x[4]-x[1])/x0start;
35  x2start=20.;
36  //printf(" x0-2start %f %f %f %f\n",x0start,x1start,x2start,x3start);
37  }

References mps_fire::i, and N.

Referenced by SaturationFit::SaturationFit().

◆ Up()

virtual double SaturationFcn::Up ( ) const
inlinevirtual

Definition at line 39 of file SaturationFcn.h.

39 {return 1.;}

Member Data Documentation

◆ datx

double SaturationFcn::datx[20]
private

Definition at line 62 of file SaturationFcn.h.

◆ daty

double SaturationFcn::daty[20]
private

Definition at line 62 of file SaturationFcn.h.

◆ x0start

double SaturationFcn::x0start

Definition at line 56 of file SaturationFcn.h.

Referenced by SaturationFit::SaturationFit().

◆ x1start

double SaturationFcn::x1start

Definition at line 57 of file SaturationFcn.h.

Referenced by SaturationFit::SaturationFit().

◆ x2start

double SaturationFcn::x2start

Definition at line 58 of file SaturationFcn.h.

Referenced by SaturationFit::SaturationFit().

◆ x3start

double SaturationFcn::x3start

Definition at line 59 of file SaturationFcn.h.

Referenced by SaturationFit::SaturationFit().

DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
SaturationFcn::x2start
double x2start
Definition: SaturationFcn.h:58
DDAxes::x
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
SaturationFcn::x1start
double x1start
Definition: SaturationFcn.h:57
N
#define N
Definition: blowfish.cc:9
SaturationFcn::daty
double daty[20]
Definition: SaturationFcn.h:62
heppy_batch.val
val
Definition: heppy_batch.py:351
SaturationFcn::datx
double datx[20]
Definition: SaturationFcn.h:62
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
SaturationFcn::x3start
double x3start
Definition: SaturationFcn.h:59
SaturationFcn::x0start
double x0start
Definition: SaturationFcn.h:56