Main Page | Class List | File List | Class Members | File Members | Related Pages

align.cpp File Reference

Align 4 chambers with minuit. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "TROOT.h"
#include "TFile.h"
#include "TTree.h"
#include "TLeaf.h"
#include "TMinuit.h"
#include "GeoServer.h"

Defines

#define TMAX   25000
 max.

Functions

void linfit (double x[], double y[], int ndata, double sig[], int mwt, double *a, double *b, double *siga, double *sigb, double *chi2)
 Straight line fit from Numerical Recipes.
void FCN (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 Minuit minimization fuction.
int main (int argc, char *argv[])
 main program


Detailed Description

Align 4 chambers with minuit.

reads output tree of long.cpp


Define Documentation

#define TMAX   25000
 

max.

number of tracks


Function Documentation

void FCN Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag
 

Minuit minimization fuction.

Input parameters

Parameters:
npar number of currently variable parameters.
par vector of (constant and variable) parameters.
iflag Indicates what is to be calculated (see example below).
Output parameters
Parameters:
f The calculated function value: chi-squared.
gin The (optional) vector of first derivatives).

void linfit double  x[],
double  y[],
int  ndata,
double  sig[],
int  mwt,
double *  a,
double *  b,
double *  siga,
double *  sigb,
double *  chi2
 

Straight line fit from Numerical Recipes.

Given a set of points x[0..ndata-1], y[0..ndata-1] with standard deviations sig[0..ndata-1], fit them to a straight line y = a+bx by minimizing chi-squared. Returned are a,b and their respective probable uncertainties siga and sigb, the chi-square chi2. If mwt = 0 on input, then the standard deviations are assumed to be unavailable: the normalization of chi2 is to unit standard deviation on all points.

Note:
This was copied from Numerical Recipes and modified: The arrays are 0-based and the goodness-of-fit is not computed. All float variables are now double.
Parameters:
x the 0-based array of x values.
y the 0-based array of y values.
ndata the number of elements in x, y, and sig.
sig the 0-based array of y errors
mwt if set to 0, then the errors in sig are ignored.
a the intercept of the line.
b the slope of the line.
siga the error on the intercept.
sigb the error on the slope
chi2 the chi-squared of the fit.


Generated on Wed Oct 29 10:35:18 2008 for CSCRead by  doxygen 1.3.9.1