CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcLine Class Reference

#include <MdcLine.h>

Public Member Functions

 MdcLine (int n)
 
 ~MdcLine ()
 
int fit (int nUse)
 

Public Attributes

double * x
 
double * y
 
double * sigma
 
double * resid
 
int nPoint
 
double slope
 
double intercept
 
double chisq
 
double errmat [3]
 

Detailed Description

Definition at line 13 of file MdcLine.h.

Constructor & Destructor Documentation

◆ MdcLine()

MdcLine::MdcLine ( int  n)
inline

Definition at line 25 of file MdcLine.h.

25 {
26 nPoint = n;
27 x = new double[n];
28 y = new double[n];
29 sigma = new double[n];
30 resid = new double[n];
31 };
const Int_t n
double * x
Definition: MdcLine.h:15
double * y
Definition: MdcLine.h:16
int nPoint
Definition: MdcLine.h:19
double * resid
Definition: MdcLine.h:18
double * sigma
Definition: MdcLine.h:17

◆ ~MdcLine()

MdcLine::~MdcLine ( )
inline

Definition at line 32 of file MdcLine.h.

32 {
33 delete [] x;
34 delete [] y;
35 delete [] sigma;
36 delete [] resid;
37 };

Member Function Documentation

◆ fit()

int MdcLine::fit ( int  nUse)

Definition at line 10 of file MdcLine.cxx.

10 {
11
12 double s1, sx, sy, sxx, sxy; // The various sums.
13 double delinv, denom;
14 double weight = 0.013; // weight for hits, calculated from sigmas.
15 int ihit;
16 if (nUse > nPoint) nUse = nPoint;
17 s1 = sx = sy = sxx = sxy = 0.0;
18 chisq = 0.0;
19 for (ihit = 0; ihit < nUse; ihit++) {
20
21 if (sigma[ihit] < 0.0) continue;
22 weight = 1. / (sigma[ihit] * sigma[ihit]);//NEED sigma of MdcHits
23 s1 += weight;
24 sx += x[ihit] * weight;
25 sy += y[ihit] * weight;
26 sxx += x[ihit] * (x[ihit] * weight);
27 sxy += y[ihit] * (x[ihit] * weight);
28
29 //std::cout<<__FILE__<<" "<<__LINE__<< " "<<ihit<<" sigma "<<
30 //sigma[ihit] <<" weight "
31 //<< weight<<" x "
32 //<< x[ihit]<<" y "
33 //<< y[ihit]<< std::endl;
34 }
35
36 /* Calculate parameters. */
37 denom = s1 * sxx - sx * sx;
38 delinv = (denom == 0.0) ? 1.e20 : 1. / denom;
39 intercept = (sy * sxx - sx * sxy) * delinv;
40 slope = (s1 * sxy - sx * sy) * delinv;
41 errmat[0] = sxx * delinv;
42 errmat[1] = -sx * delinv;
43 errmat[2] = s1 * delinv;
44 //std::cout << " After Fit:" << std::endl;//yzhang debug
45 /* Calculate residuals. */
46 for (ihit = 0; ihit < nUse; ihit++) {
47 if (sigma[ihit] < 0.0) continue;
48 resid[ihit] = ( y[ihit] - intercept - slope * x[ihit] );
49 chisq += resid[ihit] * resid[ihit] / (sigma[ihit] * sigma[ihit]);
50 //std::cout << "resid "<<ihit<<" "<<resid[ihit]<<" sigma "<<sigma[ihit]<<" chisq add "<<resid[ihit] * resid[ihit] / (sigma[ihit] * sigma[ihit]) << std::endl;//yzhang debug
51 }
52
53 //std::cout<<__FILE__<<" "<<__LINE__
54 //<< " intercept "<<intercept<<" slope "<<slope
55 //<< " chisq "<<chisq<<std::endl;//yzhang debug
56 return 0;
57}
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
Definition: KarFin.h:34
double intercept
Definition: MdcLine.h:21
double slope
Definition: MdcLine.h:20
double chisq
Definition: MdcLine.h:22
double errmat[3]
Definition: MdcLine.h:23

Referenced by MdcSeg::addHits(), MdcSegGrouper::calcParByHits(), and MdcSegInfoSterO::calcStereo().

Member Data Documentation

◆ chisq

double MdcLine::chisq

Definition at line 22 of file MdcLine.h.

Referenced by MdcSeg::addHits(), MdcSegGrouper::calcParByHits(), fit(), and MdcSeg::setValues().

◆ errmat

double MdcLine::errmat[3]

Definition at line 23 of file MdcLine.h.

Referenced by MdcSeg::addHits(), fit(), and MdcSeg::setValues().

◆ intercept

double MdcLine::intercept

◆ nPoint

int MdcLine::nPoint

Definition at line 19 of file MdcLine.h.

Referenced by MdcSegGrouper::calcParByHits(), fit(), and MdcLine().

◆ resid

double* MdcLine::resid

Definition at line 18 of file MdcLine.h.

Referenced by fit(), MdcLine(), and ~MdcLine().

◆ sigma

◆ slope

double MdcLine::slope

◆ x

◆ y

double* MdcLine::y

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