StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bichseldNdbg.C
1 #include "Riostream.h"
2 class Bichsel;
3 Bichsel *m_Bichsel = 0;
4 const Int_t NMasses = 5;
5 const Double_t Masses[NMasses] = {0.93827231,
6  0.493677,
7  0.13956995,
8  0.51099907e-3,
9  1.87561339};
10 const Char_t *Names[NMasses] = {"p", "K","pi","e","d"};
11 const Int_t NF = 3;
12 const Char_t *FNames[3] = {"Bz","B70","B60"};
13 const Int_t Nlog2dx = 3;
14 const Double_t log2dx[3] = {0,1,2};
15 //________________________________________________________________________________
16 Double_t bichselZ(Double_t *x,Double_t *par) {
17  Double_t pove = x[0];
18  Double_t poverm = pove/par[0];
19  return par[1]*TMath::Exp(m_Bichsel->GetMostProbableZ(TMath::Log10(poverm),par[3]));
20 }
21 //________________________________________________________________________________
22 Double_t bichsel70(Double_t *x,Double_t *par) {
23  Double_t pove = x[0];
24  Double_t poverm = pove/par[0];
25  return par[1]*m_Bichsel->GetI70M(TMath::Log10(poverm),par[3]);
26 }
27 //________________________________________________________________________________
28 Double_t bichsel60(Double_t *x,Double_t *par) {
29  Double_t pove = x[0];
30  Double_t poverm = pove/par[0];
31  return par[1]*m_Bichsel->GetI60(TMath::Log10(poverm),par[3]);
32 }
33 void bichseldNdbg() {
34  if (gClassTable->GetID("StBichsel") < 0) {
35  gSystem->Load("libTable");
36  gSystem->Load("St_base");
37  gSystem->Load("StarClassLibrary");
38  gSystem->Load("StBichsel");
39  }
40  if (!m_Bichsel) m_Bichsel = Bichsel::Instance();
41  TCanvas *c1 = new TCanvas("c1");
42  c1->SetLogx();
43  c1->SetLogy();
44  c1->SetGrid();
45  // TH1F *hr = c1->DrawFrame(2.e-2,1,1.e3,1.e2);
46  // TH1F *hr = c1->DrawFrame(1.e-2,1,1.e3,1.e2);
47  TH1F *hr = c1->DrawFrame(1.e-2,1,1.e4,1.e3);
48  // hr->SetXTitle("Momentum (GeV/c)");
49  hr->SetTitle("dE/dx predictions");
50  hr->SetXTitle("#beta #gamma");
51  hr->SetYTitle("dE/dx (keV/cm)");
52  hr->Draw();
53  // Mass Scale Length log2(dx)
54  Double_t params[5] = { 1.0, 1.21773e+01, 60., 1., 1e-3};
55  TLegend *leg = new TLegend(0.4,0.7,0.9,0.9,"");//TLegend(0.79,0.91,0.89,0.89,"");
56  // for (Int_t h = 0; h < 4; h++) { // Masses
57  Int_t h = 2;
58  // for (Int_t f = 0; f < NF; f++) { // Functions
59  for (Int_t f = 1; f < 2; f++) { // Functions
60  for (Int_t dx = 1; dx < 2; dx++) {
61  params[3] = log2dx[dx];
62  Char_t *FunName = Form("%s%s%i",FNames[f],Names[h],(int)log2dx[dx]);
63  cout << "Make " << FunName << endl;
64  if (TString(FNames[f]) == "Bz") {
65  func = new TF1(FunName,bichselZ,1.e-2,1.e4,5);
66  func->SetLineColor(4);
67  } else {if (TString(FNames[f]) == "B70") {
68  func = new TF1(FunName,bichsel70,1.e-2,1.e4,5);
69  func->SetLineColor(6);
70  } else {if (TString(FNames[f]) == "B60") {
71  func = new TF1(FunName,bichsel60,1.e-2,1.e4,5);
72  func->SetLineColor(7);
73  }}}
74  if (! func) continue;
75  // func->SetParameters(params);
76  for (Int_t j = 0; j < 5; j++) {
77  if (j == 1) func->SetParameter(j,params[j]);
78  else func->FixParameter(j,params[j]);
79  }
80  func->Draw("same");
81  TString name(FNames[f]);
82  if (name == "Bz") name += ": Bichsel most probable";
83  else if (name == "B70") name += ": Bichsel, 30 % truncation";
84  else if (name == "B60") name += ": Bichsel, 40 % truncation";
85  leg->AddEntry(func,name.Data(),"L");
86  }
87  }
88  leg->Draw();
89 }