BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MucRecQuadFit Class Reference

#include <MucRecQuadFit.h>

Public Member Functions

 MucRecQuadFit ()
 Constructor.
 ~MucRecQuadFit ()
 Destructor.
int QuadFit (float x[], float y[], float w[], int n, float *a, float *b, float *c, int *half, float *chisq, float *siga, float *sigb, float *sigc)
 MucRecQuadFit ()
 Constructor.
 ~MucRecQuadFit ()
 Destructor.
int QuadFit (float x[], float y[], float w[], int n, float *a, float *b, float *c, int *half, float *chisq, float *siga, float *sigb, float *sigc)
 MucRecQuadFit ()
 Constructor.
 ~MucRecQuadFit ()
 Destructor.
int QuadFit (float x[], float y[], float w[], int n, float *a, float *b, float *c, int *half, float *chisq, float *siga, float *sigb, float *sigc)

Detailed Description

Constructor & Destructor Documentation

◆ MucRecQuadFit() [1/3]

MucRecQuadFit::MucRecQuadFit ( )

Constructor.

Definition at line 20 of file MucRecQuadFit.cxx.

20 {
21 // Constructor.
22}

◆ ~MucRecQuadFit() [1/3]

MucRecQuadFit::~MucRecQuadFit ( )

Destructor.

Definition at line 24 of file MucRecQuadFit.cxx.

24 {
25 // Destructor.
26}

◆ MucRecQuadFit() [2/3]

MucRecQuadFit::MucRecQuadFit ( )

Constructor.

◆ ~MucRecQuadFit() [2/3]

MucRecQuadFit::~MucRecQuadFit ( )

Destructor.

◆ MucRecQuadFit() [3/3]

MucRecQuadFit::MucRecQuadFit ( )

Constructor.

◆ ~MucRecQuadFit() [3/3]

MucRecQuadFit::~MucRecQuadFit ( )

Destructor.

Member Function Documentation

◆ QuadFit() [1/3]

int MucRecQuadFit::QuadFit ( float x[],
float y[],
float w[],
int n,
float * a,
float * b,
float * c,
int * half,
float * chisq,
float * siga,
float * sigb,
float * sigc )

Definition at line 62 of file MucRecQuadFit.cxx.

67{
68 double sumx, sumx2, sumx3, sumx4, sumy, sumyx, sumyx2, det;
69 float chi;
70
71 /* The variable "i" is declared 8 bytes long to avoid triggering an
72 apparent alignment bug in optimized code produced by gcc-2.95.3.
73 The bug doesn't seem to be present in gcc-3.2. */
74 long i;
75
76 chi = 99999999.0;
77 *a = 0;
78 *b = 0;
79 *c = 0;
80 *half = 0;
81
82 /* N must be >= 2 for this guy to work */
83 if ( n < 3 )
84 {
85 // cout << "utiQuadFit-W: Too few points for quad fit \n" << endl;
86 return -1;
87 }
88
89 /* Initialization */
90 sumx = 0.0;
91 sumx2 = 0.0;
92 sumx3 = 0.0;
93 sumx4 = 0.0;
94 sumy = 0.0;
95 sumyx = 0.0;
96 sumyx2 = 0.0;
97
98 /* Find sum , sumx ,sumy, sumxx, sumxy */
99 for ( i = 0; i < n; i++ )
100 {
101 sumx = sumx + w[i] * x[i];
102 sumx2 = sumx2 + w[i] * x[i] * x[i];
103 sumx3 = sumx3 + w[i] * x[i] * x[i] * x[i];
104 sumx4 = sumx4 + w[i] * x[i] * x[i] * x[i] * x[i];
105 sumy = sumy + w[i] * y[i];
106 sumyx = sumyx + w[i] * y[i] * x[i];
107 sumyx2 = sumyx2 + w[i] * y[i] * x[i] * x[i];
108 // cout<<"x : y "<<x[i]<<" "<<y[i]<<endl;
109 }
110
111 /* compute the best fitted parameters A,B,C */
112
113 HepMatrix D( 3, 3, 1 );
114 HepMatrix C( 3, 1 ), ABC( 3, 1 );
115 D( 1, 1 ) = sumx4;
116 D( 1, 2 ) = D( 2, 1 ) = sumx3;
117 D( 1, 3 ) = D( 3, 1 ) = D( 2, 2 ) = sumx2;
118 D( 3, 2 ) = D( 2, 3 ) = sumx;
119 D( 3, 3 ) = n;
120 C( 1, 1 ) = sumyx2;
121 C( 2, 1 ) = sumyx;
122 C( 3, 1 ) = sumy;
123
124 int ierr;
125 ABC = ( D.inverse( ierr ) ) * C;
126
127 *a = ABC( 1, 1 );
128 *b = ABC( 2, 1 );
129 *c = ABC( 3, 1 );
130
131 // judge which half parabola these points belone to
132 float center = *b / ( -2 * ( *a ) );
133 float mean_x = 0.0;
134 for ( i = 0; i < n; i++ ) { mean_x += x[i] / n; }
135
136 if ( mean_x > center ) *half = 2; // right half
137 else *half = 1; // left half
138
139 // cout<<"in MucRecQuadFit:: which half= "<<*half<<endl;
140
141 /* calculate chi-square */
142 chi = 0.0;
143 for ( i = 0; i < n; i++ )
144 {
145 chi =
146 chi + ( w[i] ) * ( ( y[i] ) - *a * ( x[i] ) - *b ) * ( ( y[i] ) - *a * ( x[i] ) - *b );
147 }
148
149 //*siga = sum/det;
150 //*sigb = sxx/det;
151
152 *chisq = chi;
153 return 1;
154}
const Int_t n
Double_t x[10]
double w
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations C
Definition RRes.h:29

Referenced by MucRec2DRoad::SimpleFit(), and MucRec2DRoad::SimpleFitNoCurrentGap().

◆ QuadFit() [2/3]

int MucRecQuadFit::QuadFit ( float x[],
float y[],
float w[],
int n,
float * a,
float * b,
float * c,
int * half,
float * chisq,
float * siga,
float * sigb,
float * sigc )

◆ QuadFit() [3/3]

int MucRecQuadFit::QuadFit ( float x[],
float y[],
float w[],
int n,
float * a,
float * b,
float * c,
int * half,
float * chisq,
float * siga,
float * sigb,
float * sigc )

The documentation for this class was generated from the following files: