-
Notifications
You must be signed in to change notification settings - Fork 0
/
hist.cpp
48 lines (38 loc) · 1.11 KB
/
hist.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
void hist() {
TFile *file2 = new TFile("flat_scint3_box15_gap01_xz2mm_e200.root");
TFile *file4 = new TFile("flat_scint3_box15_gap01_xz4mm_e200.root");
TFile *file6 = new TFile("flat_scint3_box15_gap01_xz6mm_e200.root");
TH1F *hist2;
TH1F *hist4;
TH1F *hist6;
TF1 *fitFunc;
gStyle->SetOptStat(0);
/* printf("File open... ");
if (!file) {
printf("[FAIL]\n");
return 0;
} else printf("[OK]\n");
*/
printf("Loading histogram... ");
hist2 = file2->GetObject("fCounterSipm", hist2);
hist4 = file4->GetObject("fCounterSipm", hist4);
hist6 = file6->GetObject("fCounterSipm", hist6);
/* if (!hist1) {
printf("[FAIL]\n");
return 0;
} else printf("[OK]\n");
if (!hist2) {
printf("[FAIL]\n");
return 0;
} else printf("[OK]\n");
*/
fitFunc = new TF1("fitFunc", "landau");
hist2->Fit(fitFunc);
hist4->Fit(fitFunc);
hist6->Fit(fitFunc);
hist4->SetLineColor(kRed);
hist6->SetLineColor(kBlue);
hist2->Draw("SAME");
hist4->Draw("SAME");
hist6->Draw("SAME");
}