StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bichselP.C
1 #include "Riostream.h"
2 class Bichsel;
3 Bichsel *m_Bichsel = 0;
4 class BetheBloch;
5 BetheBloch *m_BetheBloch = 0;
6 const Int_t NF = 5;
7 const Char_t *FNames[5] = {"BetheBloch","Girrf","Sirrf","B70M","B70"};
8 //________________________________________________________________________________
9 Double_t bfunc(Double_t *x,Double_t *par) {
10  if (! m_BetheBloch) m_BetheBloch = new BetheBloch();
11  return m_BetheBloch->operator()(x[0]);
12 }
13 //________________________________________________________________________________
14 Double_t gfunc(Double_t *x,Double_t *par) {
15  Int_t type = par[1];
16  Int_t k = 0;
17  if (type == 3) k = 1;
18  return 1e-6*BetheBloch::Girrf(x[0],par[4],k);
19 }
20 //________________________________________________________________________________
21 Double_t sifunc(Double_t *x,Double_t *par) {
22  Int_t type = par[1];
23  Int_t k = 0;
24  if (type == 3) k = 1;
25  return 1e-6*BetheBloch::Sirrf(x[0],par[2],k);
26 }
27 //________________________________________________________________________________
28 Double_t bichselZ(Double_t *x,Double_t *par) {
29  Int_t type = par[1];
30  Int_t k = 0;
31  if (type == 3) k = 1;
32  return 1e-6*TMath::Exp(m_Bichsel->GetMostProbableZ(TMath::Log10(x[0]),par[3]));
33 }
34 //________________________________________________________________________________
35 Double_t bichsel70(Double_t *x,Double_t *par) {
36  Double_t pove = x[0];
37  Double_t poverm = pove/par[0];
38  Int_t type = par[1];
39  Int_t k = 0;
40  if (type == 3) k = 1;
41  // Double_t Scale = BetheBloch::Sirrf(4.,par[2],k)/
42  // TMath::Exp(m_Bichsel->GetI70(TMath::Log10(4),par[3]));
43  return 1e-6*m_Bichsel->GetI70(TMath::Log10(poverm),par[3]);
44 }
45 //________________________________________________________________________________
46 Double_t bichsel70M(Double_t *x,Double_t *par) {
47  Double_t pove = x[0];
48  Double_t poverm = pove/par[0];
49  Int_t type = par[1];
50  Int_t k = 0;
51  if (type == 3) k = 1;
52  // Double_t Scale = BetheBloch::Sirrf(4.,par[2],k)/
53  // TMath::Exp(m_Bichsel->GetI70(TMath::Log10(4),par[3]));
54  return 1e-6*m_Bichsel->GetI70M(TMath::Log10(poverm),par[3]);
55 }
56 //________________________________________________________________________________
57 Double_t bichsel60(Double_t *x,Double_t *par) {
58  Int_t type = par[1];
59  Int_t k = 0;
60  if (type == 3) k = 1;
61  return m_Bichsel->GetI60(TMath::Log10(x[0]),par[3]);
62 }
63 void bichselP() {
64  if (gClassTable->GetID("StBichsel") < 0) {
65  gSystem->Load("libTable");
66  gSystem->Load("St_base");
67  gSystem->Load("StarClassLibrary");
68  gSystem->Load("StBichsel");
69  }
70  if (!m_Bichsel) m_Bichsel = new Bichsel();
71  TCanvas *c1 = new TCanvas("c1");
72  c1->SetLogx();
73  c1->SetLogy();
74  c1->SetGrid();
75  // TH1F *hr = c1->DrawFrame(2.e-2,1,1.e3,1.e2);
76  // TH1F *hr = c1->DrawFrame(1.e-2,1,1.e3,1.e2);
77  TH1F *hr = c1->DrawFrame(1.e-1,1e-6,1.e3,2.e-4);
78  // hr->SetXTitle("Momentum (GeV/c)");
79  hr->SetTitle("dE/dx predictions (GeV/cm) versus #beta#gamma = p/m");
80  hr->SetXTitle("#beta#gamma ");
81  hr->SetYTitle("dE/dx (GeV/cm)");
82  hr->Draw();
83  // Mass Type Length log2(dx)
84  Double_t params[5] = { 1.0, 0., 60., 1., 1e-3};
85  TLegend *leg = new TLegend(0.2,0.7,1,0.9,"");
86  for (Int_t f = 0; f < NF; f++) { // Functions
87  Int_t dx = 0;
88  Char_t *FunName = FNames[f];
89  TF1 *func = 0;
90  if (TString(FNames[f]) == "BetheBloch") {
91  func = new TF1(FunName,bfunc,1.e-2,1.e3,5);
92  func->SetLineColor(1);
93  }
94  if (TString(FNames[f]) == "Sirrf") {
95  func = new TF1(FunName,sifunc,1.e-2,1.e3,5);
96  func->SetLineColor(2);
97  }
98  if (TString(FNames[f]) == "Girrf") {
99  func = new TF1(FunName,gfunc,1.e-2,1.e3,5);
100  params[4] = 1.e-3;
101  if (dx == 1) params[4] = 1.e-2;
102  if (dx == 2) params[4] = 1.e-3;
103  if (dx == 3) params[4] = 1.e-4;
104  func->SetLineColor(3);
105  }
106  else {if (TString(FNames[f]) == "Bz") {
107  func = new TF1(FunName,bichselZ,1.e-2,1.e3,5);
108  func->SetLineColor(4);
109  }
110  else {if (TString(FNames[f]) == "B70") {
111  func = new TF1(FunName,bichsel70,1.e-2,1.e3,5);
112  func->SetLineColor(6);
113  }
114  else {if (TString(FNames[f]) == "B70M") {
115  func = new TF1(FunName,bichsel70M,1.e-2,1.e3,5);
116  func->SetLineColor(7);
117  }}}}
118  if (! func) continue;
119  func->SetParameters(params);
120  func->Draw("same");
121  TString name(FNames[f]);
122  if (name == "BetheBloch") name += ": Fitted from Year 0 data (P00hm production only)";
123  else if (name == "Sirrf") name += ": Fitted from Year 1 data (for production before P03h)";
124  else if (name == "Girrf") name += ": Geant3 prediction (for simulated data only)";
125  else if (name == "Bz") name += ": Bichsel most probable";
126  else if (name == "B70") name += ": Bichsel, 30 % truncation (for production P03h and after)";
127  else if (name == "B70M") name += ": Bichsel, 30 % truncation, with correction for saturation";
128  leg->AddEntry(func,name.Data(),"L");
129  }
130  leg->Draw();
131 }