- Main Page
- Classes
- Files

- File List
- File Members

# energyCalibration.h

Go to the documentation of this file.

    00001 //#include "NewMythenMacros.h"
    00002 #ifndef ENERGYCALIBRATION_H
    00003 #define ENERGYCALIBRATION_H
    00004
    00005 #include <TROOT.h>
    00006 #include <TF1.h>
    00007
    00008 using namespace std;
    00009
    00010 class TH1F;
    00011 class TGraphErrors;
    00012
    00013
    00014
    00015
    00016
    00017 const float conven=1000./3.6;
    00018 const float el=1.67E-4;
    00047 class energyCalibrationFunctions {
    00048
    00049  public:
    00050
    00051   energyCalibrationFunctions(int s=-1) {setScanSign(s);};
    00052
    00057   int setScanSign(int s=0) {if (s==1 || s==-1) sign=s; return sign;};;
    00058
    00059
    00068 Double_t gaussChargeSharing(Double_t *x, Double_t *par);
    00069
    00075 Double_t erfFunction(Double_t *x, Double_t *par) ;
    00076
    00085 Double_t erfFunctionChargeSharing(Double_t *x, Double_t *par);
    00086
    00100 Double_t erfFuncFluo(Double_t *x, Double_t *par);
    00101
    00102
    00104   static float median(float *x, int n);
    00106   static int quick_select(int arr[], int n);
    00108   static int kth_smallest(int *a, int n, int k);
    00109
    00110
    00119   Double_t spectrum(Double_t *x, Double_t *par);
    00120
    00121
    00130   Double_t scurve(Double_t *x, Double_t *par);
    00131
    00132
    00133
    00146   Double_t scurveFluo(Double_t *x, Double_t *par);
    00147
    00148
    00149  private:
    00150   int sign;
    00151
    00152
    00153 };
    00154
    00155
    00156
    00157 class energyCalibration  {
    00158
    00159
    00160  public:
    00164   energyCalibration();
    00165
    00169   ~energyCalibration();
    00170
    00175   int setPlotFlag(int p=-1) {if (p>=0) plot_flag=p; return plot_flag;};
    00176
    00181   int setScanSign(int s=0) {return funcs->setScanSign(s);};
    00182
    00183
    00188   void setFitRange(Double_t mi, Double_t ma){fit_min=mi; fit_max=ma;};
    00189
    00194   void getFitRange(Double_t &mi, Double_t &ma){mi=fit_min; ma=fit_max;};
    00195
    00196
    00206   void setStartParameters(Double_t *par);
    00207
    00217   void getStartParameters(Double_t *par);
    00218
    00226   TF1 *fitSCurve(TH1 *h1, Double_t *mypar, Double_t *emypar);
    00227
    00228
    00240   TGraphErrors* linearCalibration(int nscan, Double_t *en, Double_t *een, Double_t *fl, Double_t *efl, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff);
    00241
    00252   TGraphErrors* calibrate(int nscan, Double_t *en, Double_t *een, TH1F **h1, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff);
    00253
    00254
    00255
    00256  private:
    00257
    00258
    00259   int plot_flag;
    00261   Double_t fit_min;
    00262   Double_t fit_max;
    00264   Double_t bg_offset;
    00265   Double_t bg_slope;
    00266   Double_t flex;
    00267   Double_t noise;
    00268   Double_t ampl;
    00269   Double_t cs_slope;
    00271   energyCalibrationFunctions *funcs;
    00272
    00273   TF1 *fscurve;
    00276 };
    00277
    00278 #endif
    00279
    00280
    00281
    00282
    00283
    00284
    00285
    00286
    00287
    00288
    00289
    00290
    00291
    00292
    00293
    00294
    00295
    00296
    00297

All Classes Files Functions Variables