StRoot
1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
StEEmcUtil
macros
pedMan.C
1
// manual pedestal fit to one channel
2
pedMan (
char
*name=
"out3-5b.hist.root"
){
3
4
name=
"mini1001.hist.root"
;
5
TFile *f=
new
TFile(name);
6
7
8
TCanvas *c=
new
TCanvas(
"bb"
,
"ccc"
,600,800);
9
c->Divide(1,2);
10
int
sec=6,isub=3,eta=4;
11
12
char
tt1[100];
13
14
sprintf(tt1,
"%2.2dT%c%2.2dc%d"
,sec,
'A'
+isub,eta,0);
15
TH1F*h= (TH1F*) f->Get(tt1);
// find histrogram in file with this name
16
17
h->Draw(); h->SetAxisRange(0,100); gPad->SetLogy();
18
char
text[100]; sprintf(text,
"eta%2.2d.gif"
,eta);
19
getPed(h);
20
// c->Print(text);
21
}
22
23
24
void
getPed(TH1F* h){
25
26
float
*x=h->GetArray();
27
28
// find max ADC in first 100 channels
29
30
float
ym=0;
31
int
nb=h->GetNbinsX();
32
int
i;
33
int
j=-1;
34
for
(i=1;i<=100;i++){
35
if
(ym>x[i])
continue
;
36
ym=x[i];
37
j=i;
38
}
39
40
float
x0=h->GetBinCenter(j);
41
h->Fit(
"gaus"
,
""
,
""
,x0-5,x0+4);
42
43
TF1 *f=h->GetFunction(
"gaus"
);
44
assert(f);
45
46
f->SetLineColor(kRed);
47
float
g=f->GetParameter(1);
48
float
eg=f->GetParError(1);
49
printf(
"#%s mean gain %f +/- %f \n"
,h->GetTitle(),g,eg);
50
}
51
52
53
54
55
56
57
Generated by
1.8.5