StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bichdX.C
1 class Bichsel;
2 Bichsel *m_Bichsel = 0;
3 const Int_t NMasses = 5;
4 const Double_t Masses[NMasses] = {0.93827231,
5  0.493677,
6  0.13956995,
7  0.51099907e-3,
8  1.87561339};
9 const Char_t *Names[NMasses] = {"p", "K","pi","e","d"};
10 const Int_t NF = 6;
11 const Char_t *FNames[6] = {"Bz","Girrf","Sirrf","B70","B60","RB70"};
12 const Int_t Nlog2dx = 7;
13 const Double_t log2dx[Nlog2dx]; // = {0,1,1.6,2,2.58,2.8,3};
14 //________________________________________________________________________________
15 Double_t sifunc(Double_t *x,Double_t *par) {
16  Double_t pove = x[0];
17  Double_t poverm = pove/par[0];
18  Int_t type = par[1];
19  Int_t k = 0;
20  if (type == 3) k = 1;
21  return BetheBloch::Girrf(poverm,1.e-3,k);
22 }
23 //________________________________________________________________________________
24 Double_t gfunc(Double_t *x,Double_t *par) {
25  Double_t pove = x[0];
26  Double_t poverm = pove/par[0];
27  Int_t type = par[1];
28  Int_t k = 0;
29  if (type == 3) k = 1;
30  return BetheBloch::Sirrf(poverm,par[2],k);
31 }
32 // Double_t bbfunc(Double_t *x,Double_t *par) {
33 // Double_t pove = x[0];
34 // Double_t poverm = pove/par[0];
35 // BetheBloch BB;
36 // Double_t value = 1.e6*BB(poverm);
37 // // printf("x : %f p: %f val : %f \n",x[0],poverm,value);
38 // return value;
39 // }
40 Double_t bichselZ(Double_t *x,Double_t *par) {
41  Double_t pove = x[0];
42  Double_t poverm = pove/par[0];
43  return TMath::Exp(m_Bichsel->GetMostProbableZM(TMath::Log10(poverm),par[3]));
44 }
45 Double_t bichsel70(Double_t *x,Double_t *par) {
46  Double_t pove = x[0];
47  Double_t poverm = pove/par[0];
48  return m_Bichsel->GetI70M(TMath::Log10(poverm),par[3]);
49 }
50 Double_t Rbichsel70(Double_t *x,Double_t *par) {
51  Double_t pove = x[0];
52  Double_t poverm = pove/par[0];
53  return m_Bichsel->GetI70M(TMath::Log10(poverm),par[3])/m_Bichsel->GetI70M(TMath::Log10(poverm));
54 }
55 Double_t Rbichselz(Double_t *x,Double_t *par) {
56  Double_t pove = x[0];
57  Double_t poverm = pove/par[0];
58  return TMath::Exp(m_Bichsel->GetMostProbableZM(TMath::Log10(poverm),par[3]) -
59  m_Bichsel->GetMostProbableZM(TMath::Log10(poverm)));
60 }
61 Double_t bichsel60(Double_t *x,Double_t *par) {
62  Double_t pove = x[0];
63  Double_t poverm = pove/par[0];
64  return m_Bichsel->GetI60(TMath::Log10(poverm),par[3]);
65 }
66 void bichdX(TString Opt = "I70M") {
67  if (gClassTable->GetID("StBichsel") < 0) {
68 // gSystem->Load("libStar");
69 // gSystem->Load("St_base");
70 // gSystem->Load("StarClassLibrary");
71  gSystem->Load("StBichsel");
72  }
73  gStyle->SetOptDate(0);
74  if (!m_Bichsel) m_Bichsel = Bichsel::Instance();
75  TCanvas *c1 = new TCanvas("c1");
76  c1->SetLogx();
77  // c1->SetLogy();
78  // TH1F *hr = c1->DrawFrame(2.e-2,1,1.e3,1.e2);
79  // TH1F *hr = c1->DrawFrame(1.e-2,0,1.e3,10);
80  TH1F *hr = 0;
81  Int_t f = 0;
82  TString Fnames;
83  if (Opt.Contains("70",TString::kIgnoreCase)) {
84  Fnames = "I_{70}";
85  hr = c1->DrawFrame(1.e-1,0.7,1.e4,1.5);
86  // hr->SetXTitle("Momentum (GeV/c)");
87  f = 5;
88  } else if (Opt.Contains("z",TString::kIgnoreCase)) {
89  Fnames = "I_{fit}";
90  hr = c1->DrawFrame(1.e-1,0.7,1.e4,1.5);
91  f = 0;
92  }
93  hr->SetTitle(Form("Difference Bichsel %s predictions for different dx",Fnames.Data()));
94  hr->SetXTitle("#beta#gamma ");
95  // hr->SetYTitle("dE/dx (keV/cm)");
96  hr->SetYTitle(Form("%s(dx)/%s(2 cm)",Fnames.Data(),Fnames.Data()));
97  // Mass Type Length log2(dx)
98  Double_t params[4] = { 1.0, 0., 60., 1.};
99  TLegend *leg = new TLegend(0.62,0.7,0.9,0.9,"");//TLegend(0.79,0.91,0.89,0.89,"");
100  Int_t h = 0;
101  // for (Int_t f = 0; f< NF; f++) {
102  TF1 *func = 0;
103  for (Int_t f = 5; f <= 5; f++) {
104  Int_t icol = 2;
105  for (Int_t dx = 0; dx < Nlog2dx; dx++) {
106  params[3] = TMath::Log2(dx+1.);;
107  Char_t *FunName = Form("%s%s%i",FNames[f],Names[h],dx);
108  if (Opt.Contains("70",TString::kIgnoreCase)) func = new TF1(FunName,Rbichsel70,1.e-1,1.e4,4);
109  if (Opt.Contains("z",TString::kIgnoreCase)) func = new TF1(FunName,Rbichselz,1.e-1,1.e4,4);
110  if (! func) continue;
111  func->SetLineColor(icol);
112  // func->SetLineStyle(f+1);
113  icol++;
114  if (icol == 5) icol++;
115  func->SetParameters(params);
116  func->Draw("same");
117  leg->AddEntry(func,Form("%s dX = %4.1f (cm)",Fnames.Data(),TMath::Power(2.,params[3])),"L");
118  }
119  }
120  leg->Draw();
121 }