-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeImages.C
53 lines (44 loc) · 1.21 KB
/
makeImages.C
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
49
50
51
52
53
void makeImages(int n = 10000) {
auto h1 = new TH2D("h1","h1",8,0,10,8,0,10);
auto h2 = new TH2D("h2","h2",8,0,10,8,0,10);
auto f1 = new TF2("f1","xygaus");
auto f2 = new TF2("f2","xygaus");
double x1[64];
double x2[64];
TTree sgn("sgn","sgn");
TTree bkg("bkg","bkg");
TFile f("images.root","RECREATE");
for(auto i=0;i<64;i++)
{
bkg.Branch(Form("var%d",i),&x1[i]);
sgn.Branch(Form("var%d",i),&x2[i]);
}
sgn.SetDirectory(&f);
bkg.SetDirectory(&f);
f1->SetParameters(1,3,3,3,3);
f2->SetParameters(1,7,3,7,3 );
gRandom->SetSeed(0);
for (int i = 0; i < n; ++i) {
h1->Reset();
h2->Reset();
h1->FillRandom("f1",500);
h2->FillRandom("f2",500);
for (int k = 0; k < 8 ; ++k) {
for (int l = 0; l < 8 ; ++l) {
int m = k * 8 + l;
x1[m] = h1->GetBinContent(k+1,l+1);
x2[m] = h2->GetBinContent(k+1,l+1);
}
}
sgn.Fill();
bkg.Fill();
// if (n==1) {
// h1->Draw("COLZ");
// new TCanvas();
// h2->Draw("COLZ");
// }
}
sgn.Write();
bkg.Write();
f.Close();
}