00001 #include "Riostream.h"
00002 class Bichsel;
00003 Bichsel *m_Bichsel = 0;
00004 class BetheBloch;
00005 BetheBloch *m_BetheBloch = 0;
00006 const Int_t NF = 5;
00007 const Char_t *FNames[5] = {"BetheBloch","Girrf","Sirrf","B70M","B70"};
00008
00009 Double_t bfunc(Double_t *x,Double_t *par) {
00010 if (! m_BetheBloch) m_BetheBloch = new BetheBloch();
00011 return m_BetheBloch->operator()(x[0]);
00012 }
00013
00014 Double_t gfunc(Double_t *x,Double_t *par) {
00015 Int_t type = par[1];
00016 Int_t k = 0;
00017 if (type == 3) k = 1;
00018 return 1e-6*BetheBloch::Girrf(x[0],par[4],k);
00019 }
00020
00021 Double_t sifunc(Double_t *x,Double_t *par) {
00022 Int_t type = par[1];
00023 Int_t k = 0;
00024 if (type == 3) k = 1;
00025 return 1e-6*BetheBloch::Sirrf(x[0],par[2],k);
00026 }
00027
00028 Double_t bichselZ(Double_t *x,Double_t *par) {
00029 Int_t type = par[1];
00030 Int_t k = 0;
00031 if (type == 3) k = 1;
00032 return 1e-6*TMath::Exp(m_Bichsel->GetMostProbableZ(TMath::Log10(x[0]),par[3]));
00033 }
00034
00035 Double_t bichsel70(Double_t *x,Double_t *par) {
00036 Double_t pove = x[0];
00037 Double_t poverm = pove/par[0];
00038 Int_t type = par[1];
00039 Int_t k = 0;
00040 if (type == 3) k = 1;
00041
00042
00043 return 1e-6*m_Bichsel->GetI70(TMath::Log10(poverm),par[3]);
00044 }
00045
00046 Double_t bichsel70M(Double_t *x,Double_t *par) {
00047 Double_t pove = x[0];
00048 Double_t poverm = pove/par[0];
00049 Int_t type = par[1];
00050 Int_t k = 0;
00051 if (type == 3) k = 1;
00052
00053
00054 return 1e-6*m_Bichsel->GetI70M(TMath::Log10(poverm),par[3]);
00055 }
00056
00057 Double_t bichsel60(Double_t *x,Double_t *par) {
00058 Int_t type = par[1];
00059 Int_t k = 0;
00060 if (type == 3) k = 1;
00061 return m_Bichsel->GetI60(TMath::Log10(x[0]),par[3]);
00062 }
00063 void bichselP() {
00064 if (gClassTable->GetID("StBichsel") < 0) {
00065 gSystem->Load("libTable");
00066 gSystem->Load("St_base");
00067 gSystem->Load("StarClassLibrary");
00068 gSystem->Load("StBichsel");
00069 }
00070 if (!m_Bichsel) m_Bichsel = new Bichsel();
00071 TCanvas *c1 = new TCanvas("c1");
00072 c1->SetLogx();
00073 c1->SetLogy();
00074 c1->SetGrid();
00075
00076
00077 TH1F *hr = c1->DrawFrame(1.e-1,1e-6,1.e3,2.e-4);
00078
00079 hr->SetTitle("dE/dx predictions (GeV/cm) versus #beta#gamma = p/m");
00080 hr->SetXTitle("#beta#gamma ");
00081 hr->SetYTitle("dE/dx (GeV/cm)");
00082 hr->Draw();
00083
00084 Double_t params[5] = { 1.0, 0., 60., 1., 1e-3};
00085 TLegend *leg = new TLegend(0.2,0.7,1,0.9,"");
00086 for (Int_t f = 0; f < NF; f++) {
00087 Int_t dx = 0;
00088 Char_t *FunName = FNames[f];
00089 TF1 *func = 0;
00090 if (TString(FNames[f]) == "BetheBloch") {
00091 func = new TF1(FunName,bfunc,1.e-2,1.e3,5);
00092 func->SetLineColor(1);
00093 }
00094 if (TString(FNames[f]) == "Sirrf") {
00095 func = new TF1(FunName,sifunc,1.e-2,1.e3,5);
00096 func->SetLineColor(2);
00097 }
00098 if (TString(FNames[f]) == "Girrf") {
00099 func = new TF1(FunName,gfunc,1.e-2,1.e3,5);
00100 params[4] = 1.e-3;
00101 if (dx == 1) params[4] = 1.e-2;
00102 if (dx == 2) params[4] = 1.e-3;
00103 if (dx == 3) params[4] = 1.e-4;
00104 func->SetLineColor(3);
00105 }
00106 else {if (TString(FNames[f]) == "Bz") {
00107 func = new TF1(FunName,bichselZ,1.e-2,1.e3,5);
00108 func->SetLineColor(4);
00109 }
00110 else {if (TString(FNames[f]) == "B70") {
00111 func = new TF1(FunName,bichsel70,1.e-2,1.e3,5);
00112 func->SetLineColor(6);
00113 }
00114 else {if (TString(FNames[f]) == "B70M") {
00115 func = new TF1(FunName,bichsel70M,1.e-2,1.e3,5);
00116 func->SetLineColor(7);
00117 }}}}
00118 if (! func) continue;
00119 func->SetParameters(params);
00120 func->Draw("same");
00121 TString name(FNames[f]);
00122 if (name == "BetheBloch") name += ": Fitted from Year 0 data (P00hm production only)";
00123 else if (name == "Sirrf") name += ": Fitted from Year 1 data (for production before P03h)";
00124 else if (name == "Girrf") name += ": Geant3 prediction (for simulated data only)";
00125 else if (name == "Bz") name += ": Bichsel most probable";
00126 else if (name == "B70") name += ": Bichsel, 30 % truncation (for production P03h and after)";
00127 else if (name == "B70M") name += ": Bichsel, 30 % truncation, with correction for saturation";
00128 leg->AddEntry(func,name.Data(),"L");
00129 }
00130 leg->Draw();
00131 }