GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DemoCalibrators.C
Go to the documentation of this file.
1 
6 using namespace std;
7 
8 using namespace Gw;
9 
10 #define MAX_STRING_LENGTH 50
11 
12 
25 void DemoCo60(Double_t xmin=0, Double_t xmax=4096)
26 {
27  // construct a function with 2 peaks to simulate the 2 Co60 peaks
28  TString str;
29  str = "gaus(0) + gaus(3) + [6]*x + [7]";
30  TF1 f("Co60raw",str.Data(),0,10000);
31  f.SetParameters(1000,2256.23,1.,800,2596.17,1.5,0.01,10);
32  TH1D *hraw = new TH1D("RAWhisto","Raw Data",4096,0,4096);
33  hraw->FillRandom("Co60raw",100000);
34 
35  // Calibrator Co60
36  CalibCo60 *calibrator = new CalibCo60();
37  hraw->GetXaxis()->SetRange(xmin,xmax);
38  TF1 *calfunction = new TF1 ("CalibrationFunction","pol1(0)");
39 
40  calibrator->Calibrate(hraw,calfunction);
41 
42  H1Calibrator *cal = new H1Calibrator();
43  cal->Calibrate(hraw,calfunction);
44 
45 }
46 
57 void DemoCo60ByHand(Double_t channel1=2256, Double_t channel2=2596)
58 {
59  // construct a function with 2 peaks to simulate the 2 Co60 peaks
60  TString str;
61  str = "gaus(0) + gaus(3) + [6]*x + [7]";
62  TF1 f("Co60raw",str.Data(),0,10000);
63  f.SetParameters(1000,2256.23,1.,800,2596.17,1.5,0.01,10);
64  TH1D *hraw = new TH1D("RAWhisto","Raw Data",4096,0,4096);
65  hraw->FillRandom("Co60raw",100000);
66 
67  // Calibrator Co60
68  CalibCo60 *calibrator = new CalibCo60();
69 
70  TF1 *calfunction = new TF1 ("CalibrationFunction","pol1(0)");
71 
72  calibrator->Calibrate(hraw,calfunction,channel1,channel2);
73 
74  H1Calibrator *cal = new H1Calibrator();
75  cal->Calibrate(hraw,calfunction);
76 }
77 
void DemoCo60(Double_t xmin=0, Double_t xmax=4096)
Function to calibrate a Co60 spectrum with the CalibCo60 service class.
void Calibrate(const TH1 *, const TF1 *, const Option_t *AxisOption="x")
void Calibrate(const TH1 *histo, TF1 *function, Double_t channel1, Double_t channel2, Option_t *AxisOption="x")
Perform the calibration "by hand".
Definition: CalibCo60.cpp:69
H1Calibrator is a service class in order to calibrate a TH1 The raw histogram must never be changed T...
Definition: H1Calibrator.h:58
void DemoCo60ByHand(Double_t channel1=2256, Double_t channel2=2596)
Function to calibrate a Co60 spectrum with the CalibCo60 service class.
CalibCo60 is a service class in order to find calibration coefficients for a TH1 espacially with Co60...
Definition: CalibCo60.h:53