00001 {gROOT->Reset();
00002
00003
00004 bool distrib = 1;
00005 bool mean_value = 0;
00006
00007
00008 TString file2 = "histo_hadron_2gev_2absorber.root";
00009 TString file4 = "histo_hadron_2gev_4absorber.root";
00010 TString file6 = "histo_hadron_2gev_6absorber.root";
00011 TString file8 = "histo_hadron_2gev_8absorber.root";
00012 TString file10 = "histo_hadron_2gev_10absorber.root";
00013 TString file12 = "histo_hadron_2gev_12absorber.root";
00014
00015 TFile * tf2 = new TFile(file2.Data());
00016 TFile * tf4 = new TFile(file4.Data());
00017 TFile * tf6 = new TFile(file6.Data());
00018 TFile * tf8 = new TFile(file8.Data());
00019 TFile * tf10 = new TFile(file10.Data());
00020 TFile * tf12 = new TFile(file12.Data());
00021
00022 TH1F * hnhit2 = (TH1F*)tf2.Get("hnhit4_clean");
00023 TH1F * hnhit4 = (TH1F*)tf4.Get("hnhit4_clean");
00024 TH1F * hnhit6 = (TH1F*)tf6.Get("hnhit4_clean");
00025 TH1F * hnhit8 = (TH1F*)tf8.Get("hnhit4_clean");
00026 TH1F * hnhit10 = (TH1F*)tf10.Get("hnhit4_clean");
00027 TH1F * hnhit12 = (TH1F*)tf12.Get("hnhit4_clean");
00028
00029 hnhit2->SetLineStyle(1);
00030 hnhit4->SetLineStyle(1);
00031 hnhit6->SetLineStyle(1);
00032 hnhit8->SetLineStyle(1);
00033 hnhit10->SetLineStyle(1);
00034 hnhit12->SetLineStyle(1);
00035
00036 hnhit2->SetLineColor(1);
00037 hnhit4->SetLineColor(2);
00038 hnhit6->SetLineColor(4);
00039 hnhit8->SetLineColor(7);
00040 hnhit10->SetLineColor(8);
00041 hnhit12->SetLineColor(6);
00042
00043
00044
00045 if (distrib){
00046
00047 TH2F * frame = new TH2F("frame","",100,0,25,100,0,1.1);
00048 frame->SetTitle("Hit distribution from 2 GeV hadrons for various number of absorbers");
00049 frame->SetXTitle("number of hits");
00050
00051 TLegend * tleg = new TLegend(0.18,0.73,0.52,0.93);
00052 tleg->AddEntry(hnhit2,"2 absorbers","l");
00053 tleg->AddEntry(hnhit4,"4 absorbers","l");
00054 tleg->AddEntry(hnhit6,"6 absorbers","l");
00055 tleg->AddEntry(hnhit8,"8 absorbers","l");
00056 tleg->AddEntry(hnhit10,"10 absorbers","l");
00057 tleg->AddEntry(hnhit12,"12 absorbers","l");
00058
00059 frame->Draw();
00060 hnhit2->DrawNormalized("same");
00061 hnhit4->DrawNormalized("same");
00062 hnhit6->DrawNormalized("same");
00063 hnhit8->DrawNormalized("same");
00064 hnhit10->DrawNormalized("same");
00065 hnhit12->DrawNormalized("same");
00066 tleg->Draw("same");}
00067
00068
00069
00070
00071 if (mean_value){
00072
00073 int N = 6;
00074
00075 float nabs[N] = {2,4,6,8,10,12};
00076 float mean[N];
00077 float max[N];
00078 float rms[N];
00079
00080 mean[0] = hnhit2->GetMean();
00081 mean[1] = hnhit4->GetMean();
00082 mean[2] = hnhit6->GetMean();
00083 mean[3] = hnhit8->GetMean();
00084 mean[4] = hnhit10->GetMean();
00085 mean[5] = hnhit12->GetMean();
00086
00087 max[0] = hnhit2->GetMaximumBin();
00088 max[1] = hnhit4->GetMaximumBin();
00089 max[2] = hnhit6->GetMaximumBin();
00090 max[3] = hnhit8->GetMaximumBin();
00091 max[4] = hnhit10->GetMaximumBin();
00092 max[5] = hnhit12->GetMaximumBin();
00093
00094 rms[0] = hnhit2->GetRMS();
00095 rms[1] = hnhit4->GetRMS();
00096 rms[2] = hnhit6->GetRMS();
00097 rms[3] = hnhit8->GetRMS();
00098 rms[4] = hnhit10->GetRMS();
00099 rms[5] = hnhit12->GetRMS();
00100
00101 TGraph * tg_mean = new TGraph(N,nabs,mean);
00102 TGraph * tg_max = new TGraph(N,nabs,max);
00103 TGraph * tg_rms = new TGraph(N,nabs,rms);
00104
00105 tg_mean->SetTitle("Mean number of hits from 2 GeV hadrons for various number of absorbers");
00106 tg_mean->GetXaxis()->SetTitle("number of absorbers");
00107 tg_mean->GetYaxis()->SetTitle("mean number of hits");
00108
00109 tg_max->SetTitle("Hit distribution MPV from 2 GeV hadrons for various number of absorbers");
00110 tg_max->GetXaxis()->SetTitle("number of absorbers");
00111 tg_max->GetYaxis()->SetTitle("most probable number of hits");
00112
00113 tg_rms->SetTitle("RMS of the number of hits from 2 GeV hadrons for various number of absorbers");
00114 tg_rms->GetXaxis()->SetTitle("number of absorbers");
00115 tg_rms->GetYaxis()->SetTitle("rms of the number of hits");
00116
00117 tg_mean->SetMarkerStyle(20);
00118 tg_max->SetMarkerStyle(20);
00119 tg_rms->SetMarkerStyle(20);
00120
00121 tg_mean->SetMarkerSize(1.3);
00122 tg_max->SetMarkerSize(1.3);
00123 tg_rms->SetMarkerSize(1.3);
00124
00125 tg_mean->SetMarkerColor(2);
00126 tg_max->SetMarkerColor(2);
00127 tg_rms->SetMarkerColor(2);
00128
00129 tg_mean->Draw("ap");
00130
00131
00132
00133 }
00134
00135
00136 }