Rev 258 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 258 | Rev 322 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | #include "mH1D.h" |
4 | #include "mH1D.h" |
- | 5 | #include <TSystem.h> |
|
5 | 6 | ||
6 | double H1DGetBinContent(H1D *h1d,int atx){ |
7 | double H1DGetBinContent(H1D *h1d,int atx){ |
7 | 8 | ||
8 | if (!h1d) return 0; |
9 | if (!h1d) return 0; |
9 | if (h1d->nx <= atx) return 0; |
10 | if (h1d->nx <= atx) return 0; |
Line 14... | Line 15... | ||
14 | } |
15 | } |
15 | 16 | ||
16 | 17 | ||
17 | int H1Dload(char *fname){ |
18 | int H1Dload(char *fname){ |
18 | 19 | ||
- | 20 | TString dfile( gSystem->Getenv("USERPROFILE") ); |
|
- | 21 | dfile.ReplaceAll("\\","/"); |
|
- | 22 | dfile += TString("/Desktop/data/") + fname; |
|
- | 23 | fprintf(stderr, "Filename %s\n",dfile.Data()); |
|
19 | FILE *fp= fopen( |
24 | FILE *fp= fopen(dfile.Data() ,"rb"); |
- | 25 | ||
20 | if (!fp) return -1; |
26 | if (!fp) return -1; |
21 | H1D *h = new H1D; |
27 | H1D *h = new H1D; |
22 | int size=sizeof(H1D); |
28 | int size=sizeof(H1D); |
23 | int nb1 = fread(h,1, size,fp); |
29 | int nb1 = fread(h,1, size,fp); |
24 | if (size + h->size !=h->len ) printf("WRONG HEADER ! Check sizeof H2D on CVI\n"); |
30 | if (size + h->size !=h->len ) printf("WRONG HEADER ! Check sizeof H2D on CVI\n"); |
Line 45... | Line 51... | ||
45 | for (int ix=0;ix<h->nx;ix++){ |
51 | for (int ix=0;ix<h->nx;ix++){ |
46 | 52 | ||
47 | double g=H1DGetBinContent(h,ix); |
53 | double g=H1DGetBinContent(h,ix); |
48 | h1d->SetBinContent(ix+1, g); |
54 | h1d->SetBinContent(ix+1, g); |
49 | // if (g>0) printf("i %d j %d v %g\n",ix+1,iy+1,g); |
55 | // if (g>0) printf("i %d j %d v %g\n",ix+1,iy+1,g); |
50 | 56 | ||
51 | } |
57 | } |
52 | - | ||
- | 58 | h1d->SetEntries(h->nentries); |
|
53 | gStyle->SetOptStat( |
59 | gStyle->SetOptStat(1); |
54 | gStyle->SetOptFit(1); |
60 | gStyle->SetOptFit(1); |
55 | h1d->Draw("colz"); |
61 | h1d->Draw("colz"); |
56 | 62 | ||
57 |
|
63 | TString hname; |
58 |
|
64 | //sprintf(hname,"%s.pdf",dfile.Data()); |
- | 65 | hname = dfile + ".pdf"; |
|
- | 66 | gPad->SaveAs(hname); |
|
- | 67 | ||
- | 68 | //sprintf(hname,"%s.root",dfile.Data()); |
|
- | 69 | hname = dfile + ".root"; |
|
- | 70 | //printf("%s\n",hname); |
|
- | 71 | printf("%s\n",hname.Data()); |
|
59 | gPad->SaveAs(hname); |
72 | gPad->SaveAs(hname); |
60 | h1d->FitPanel(); |
73 | h1d->FitPanel(); |
61 | gPad->SaveAs(fname); |
- | |
62 | return 0; |
74 | return 0; |
63 | } |
75 | } |