FracVarAna.cxx File Reference

#include "StandardNtuple/NtpStRecord.h"
#include "CandNtupleSR/NtpSRRecord.h"
#include "CandNtupleSR/NtpSREvent.h"
#include "CandNtupleSR/NtpSRTrack.h"
#include "CandNtupleSR/NtpSRShower.h"
#include "CandNtupleSR/NtpSRStrip.h"
#include "NueAna/NueAnaTools/SntpHelpers.h"
#include "VertexFinder/NtpVtxFinder/NtpVtxFinder.h"
#include "FracVarAna.h"
#include "NueAna/mlpANN.h"
#include "MessageService/MsgService.h"
#include "TPad.h"
#include "TLatex.h"
#include "TNtuple.h"
#include "TFile.h"
#include "TMath.h"
#include <cassert>
#include <vector>
#include <algorithm>
#include <iostream>
#include <fstream>

Go to the source code of this file.

Functions

 CVSID ("$Id: FracVarAna.cxx,v 1.38 2009/08/05 01:50:59 jjling Exp $")
static Int_t WeightedFit (const Int_t n, const Double_t *x, const Double_t *y, const Double_t *w, Double_t *parm)

Variables

const Float_t STP_WIDTH = 0.0412

Function Documentation

CVSID ( "$Id: FracVarAna.  cxx,
v 1.38 2009/08/05 01:50:59 jjling Exp $"   
)
static Int_t WeightedFit ( const Int_t  n,
const Double_t *  x,
const Double_t *  y,
const Double_t *  w,
Double_t *  parm 
) [static]

Definition at line 30 of file FracVarAna.cxx.

Referenced by FracVarAna::Analyze().

00032 {
00033   Double_t sumx=0.;
00034   Double_t sumx2=0.;
00035   Double_t sumy=0.;
00036   Double_t sumy2=0.;
00037   Double_t sumxy=0.;
00038   Double_t sumw=0.;
00039   Double_t eparm[2];
00040 
00041   parm[0]  = 0.;
00042   parm[1]  = 0.;
00043   eparm[0] = 0.;
00044   eparm[1] = 0.;
00045 
00046   for (Int_t i=0; i<n; i++) {
00047     sumx += x[i]*w[i];
00048     sumx2 += x[i]*x[i]*w[i];
00049     sumy += y[i]*w[i]; 
00050     sumy2 += y[i]*y[i]*w[i];
00051     sumxy += x[i]*y[i]*w[i];
00052     sumw += w[i];
00053   }
00054   
00055   if (sumx2*sumw-sumx*sumx==0.) return 1;
00056   if (sumx2-sumx*sumx/sumw==0.) return 1;
00057   
00058   parm[0] = (sumy*sumx2-sumx*sumxy)/(sumx2*sumw-sumx*sumx);
00059   parm[1] = (sumxy-sumx*sumy/sumw)/(sumx2-sumx*sumx/sumw);
00060   
00061   eparm[0] = sumx2*(sumx2*sumw-sumx*sumx);
00062   eparm[1] = (sumx2-sumx*sumx/sumw);
00063   
00064   if (eparm[0]<0. || eparm[1]<0.) return 1;
00065   
00066   eparm[0] = sqrt(eparm[0])/(sumx2*sumw-sumx*sumx);
00067   eparm[1] = sqrt(eparm[1])/(sumx2-sumx*sumx/sumw);
00068   
00069   return 0;
00070 
00071 }


Variable Documentation

const Float_t STP_WIDTH = 0.0412

Definition at line 73 of file FracVarAna.cxx.


Generated on 3 Dec 2018 for loon by  doxygen 1.6.1