GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DoGammaFilter.C
Go to the documentation of this file.
1 
13 TH1F *DoDoppler(Axis_t min_e = 0, Axis_t max_e = 4096)
14 {
15  // Doppler shift
16  Float_t beta = 0.02;
17  // Float_t beta = 0;
18 
19  // opening angle
20  Float_t dtheta = 10.0 * TMath::Pi() / 180; // euroball
21  // Float_t dtheta = 1 * TMath::Pi() / 180; // AGATA
22 
23  // intrinseque resolution
24  // linear curve so two points are needed
25  // e1, e2 - energies in keV
26  // r1, r2 - half-max width intrinseque
27  Float_t e1 = 100.0, r1 = 1.0, e2 = 1300.0, r2 = 2.5;
28 
29  //now determine the linear function
30  TF1 *f_de_int = new TF1("resolution_int","pol1",min_e,max_e);
31 
32  f_de_int->SetParameters(r1-e1*(r2-r1)/(e2-e1),(r2-r1)/(e2-e1));
33  //f_de_int->Draw();
34 
35  Int_t bin = Int_t ( max_e - min_e );
36  TH1F *h = new TH1F("GammaFilter_Doppler","Doppler",bin,min_e,max_e);
37 
38  Float_t de_int, de_theta;
39  for (int i = 0; i < bin; i++ ) {
40  de_int = f_de_int->Eval(min_e+i);
41  de_theta = i * beta * dtheta ;
42 
43  // printf("%d %f %f \n",i,de_int,de_theta);
44  h->SetBinContent(i+1,TMath::Sqrt( de_int*de_int + de_theta*de_theta ) / 2.3548 ); // 2.3548 for sigma
45  }
46 
47  h->SetLineColor(2);
48  h->SetBinContent(0,0); h->SetBinContent(bin+1,0);
49 
50  h->Draw();
51 
52  return h;
53 }
54 
55 /*
56 TH1F *DoDoppler(Axis_t min_e = 0, Axis_t max_e = 4096)
57 {
58  // linear curve so two points are needed
59  // e1, e2 - energies in keV
60  // r1, r2 - half-max width ..
61  Float_t e1 = 100.0, r1 = 1.0, e2 = 1300.0, r2 = 2.5;
62 
63  // change r1 and r2 into sigma1, sigma2 ..
64  r1 = r1 / 2.3548; r2 = r2 / 2.3548;
65 
66  //now determine the linear function
67  TF1 *f = new TF1("resolution","pol1",min_e,max_e);
68 
69  f->SetParameters(r1-e1*(r2-r1)/(e2-e1),(r2-r1)/(e2-e1));
70  //f->Draw();
71 
72  Int_t bin = Int_t ( max_e - min_e );
73  TH1F *h = new TH1F("GammaFilter_Doppler","Doppler",bin,min_e,max_e);
74 
75  for (int i = 0; i < bin; i++ ) {
76  h->SetBinContent(i+1,f->Eval(min_e+i));
77  }
78 
79  h->SetLineColor(2);
80  h->SetBinContent(0,0); h->SetBinContent(bin+1,0);
81 
82  h->Draw();
83 
84  return h;
85 }
86 */
87 
94 TH1F *DoCompton(Float_t pt = 0.5, Axis_t min_e = 0, Axis_t max_e = 4096)
95 {
96  Int_t cut1 = 100, cut2 = 300; Float_t a, b;
97 
98  a = (1.0-pt)/(cut1-cut2); b = 1.0 - cut1 * a;
99 
100  Int_t bin = Int_t ( max_e - min_e );
101  TH1F *h = new TH1F("GammaFilter_Compton","Compton",bin,min_e,max_e);
102 
103  for (int i = 0; i < bin; i++ ) {
104  if ( i < cut1 ) {
105  h->SetBinContent(i+1,1);
106  }
107  if ( i >= cut1 && i <= cut2 ) {
108  h->SetBinContent(i+1,a*i+b);
109  }
110  if ( i > cut2 ) {
111  h->SetBinContent(i+1,pt);
112  }
113  }
114 
115  h->SetLineColor(2);
116  h->SetBinContent(0,0); h->SetBinContent(bin+1,0);
117 
118  h->Draw();
119 
120  return h;
121 }
TBrowser * b
TH1F * DoCompton(Float_t pt=0.5, Axis_t min_e=0, Axis_t max_e=4096)
Function to build an histogram given the Compton probability.
Definition: DoGammaFilter.C:94
TH1F * DoDoppler(Axis_t min_e=0, Axis_t max_e=4096)
Function to build an histogram given the resolution.
Definition: DoGammaFilter.C:13