1
|
{
|
2
|
TFile *f = new TFile("/home/muzalevsky/AculUti/exp1803/cali1mm/calDL/SQX_L_full_calibrated_spectra.root");
|
3
|
const Int_t nhists = 32;
|
4
|
TH1F *h[nhists];
|
5
|
|
6
|
TString hname,cName;
|
7
|
TTree *t = (TTree*)f->Get("AnalysisxTree");
|
8
|
for(Int_t i=0;i<nhists;i++) {
|
9
|
hname.Form("HistSQX_L[%d]Efull",i);
|
10
|
h[i] = (TH1F*)f->Get(hname.Data());
|
11
|
}
|
12
|
|
13
|
TF1* g1 = new TF1("g1", "gaus", 4.4, 4.6);
|
14
|
g1->SetParLimits(0,1.,150.);
|
15
|
g1->SetParLimits(1,4.,5.);
|
16
|
g1->SetParLimits(2,0.1,3.);
|
17
|
|
18
|
TF1* g2 = new TF1("g2", "gaus", 5.12, 5.35);
|
19
|
g2->SetParLimits(0,1.,150.);
|
20
|
g2->SetParLimits(1,5.12,5.35);
|
21
|
g2->SetParLimits(2,0.1,3.);
|
22
|
|
23
|
TF1* g3 = new TF1("g3", "gaus", 5.65, 5.95);
|
24
|
g3->SetParLimits(0,1.,150.);
|
25
|
g3->SetParLimits(1,5.65,5.95);
|
26
|
g3->SetParLimits(2,0.1,3.);
|
27
|
|
28
|
TF1* g4 = new TF1("g4", "gaus", 7.25, 7.65);
|
29
|
g4->SetParLimits(0,1.,150.);
|
30
|
g4->SetParLimits(1,7.25,7.65);
|
31
|
g4->SetParLimits(2,0.1,3.);
|
32
|
|
33
|
TCanvas *c[8];
|
34
|
for(Int_t i=0;i<8;i++){
|
35
|
cName.Form("c%d",i+1);
|
36
|
TCanvas *c[i] = new TCanvas(cName.Data(),"calibrated spectra",1000,1000);
|
37
|
c[i]->Divide(2,2);
|
38
|
}
|
39
|
|
40
|
|
41
|
|
42
|
|
43
|
|
44
|
|
45
|
|
46
|
|
47
|
|
48
|
|
49
|
ofstream outcalfile;
|
50
|
outcalfile.open("/home/muzalevsky/AculUti/exp1803/cali1mm/calDL/check_cali.txt");
|
51
|
if (!outcalfile.is_open()) {
|
52
|
cout <<"Output file was not opened" << endl;
|
53
|
return;
|
54
|
}
|
55
|
|
56
|
Int_t count=-1;
|
57
|
Int_t nPad;
|
58
|
for(Int_t i=0;i<32;i++) {
|
59
|
count = i/4;
|
60
|
nPad = (i%4)+1;
|
61
|
c[count]->cd(nPad);
|
62
|
|
63
|
h[i]->Draw();
|
64
|
h[i]->Rebin(8);
|
65
|
h[i]->Fit("g1","R+");
|
66
|
h[i]->Fit("g2","R+");
|
67
|
h[i]->Fit("g3","R+");
|
68
|
h[i]->Fit("g4","R+");
|
69
|
h[i]->GetXaxis()->SetRangeUser(4.,8.);
|
70
|
c[count]->Update();
|
71
|
outcalfile << g1->GetParameter(1) << "\t" << g2->GetParameter(1) << "\t" << g3->GetParameter(1) << "\t" << g4->GetParameter(1) << endl;
|
72
|
}
|
73
|
|
74
|
return;
|
75
|
}
|