Go to the source code of this file.
int drawhistos |
( |
TString |
filename = "Data/HistoVertexing.root" | ) |
|
Definition at line 2 of file drawhistos.C.
References filename, LoadPandaStyle(), and plotandfithistosfromfile().
4 gROOT->LoadMacro(
"$VMCWORKDIR/macro/run/Tools.C");
7 gStyle->SetOptTitle(1);
12 gStyle->SetTextSize(0.10);
13 gStyle->SetLabelSize(0.07,
"x");
14 gStyle->SetTitleSize(0.07,
"x");
15 gStyle->SetLabelSize(0.07,
"y");
16 gStyle->SetTitleSize(0.07,
"y");
17 gStyle->SetLabelSize(0.07,
"z");
18 gStyle->SetTitleSize(0.07,
"z");
19 gStyle->SetPadBottomMargin(0.17);
plotandfithistosfromfile(TString filename="histos.root", TString ext=".pdf", Int_t divx=2, Int_t divy=2, Int_t pix=1200)
void GaussFitPlot |
( |
TH1 * |
his | ) |
|
Definition at line 93 of file drawhistos.C.
References ccc, Double_t, DrawText(), mean, par, sigma, and TString.
96 TF1* fitted =
new TF1(fitname.Data(),
"gaus",-5,5);
98 cout<<
" --- Fitting Gaussian to histogram "<<his->GetName()<<
" \""<<his->GetTitle()<<
"\" ---"<<endl;
99 fitted->SetLineColor(4);
100 fitted->SetLineWidth(2);
101 fitted->SetLineStyle(2);
103 fitted->GetParameters(par);
108 DrawText( 0.2, 0.75, str.Data(),0.07,1);
109 str=Form(
"#mu = %.3g",mean);
110 DrawText( 0.2, 0.65, str.Data(),0.07,1);
111 str=Form(
"#sigma = %.3g",sigma);
112 DrawText( 0.2, 0.55, str.Data(),0.07,1);
plotandfithistosfromfile |
( |
TString |
filename = "histos.root" , |
|
|
TString |
ext = ".pdf" , |
|
|
Int_t |
divx = 2 , |
|
|
Int_t |
divy = 2 , |
|
|
Int_t |
pix = 300 |
|
) |
| |
Definition at line 30 of file drawhistos.C.
References ext, file, filename, GaussFitPlot(), i, and TString.
34 if (!file) {cout<<
"File \""<<
filename.Data()<<
"\" is not there..."<<endl;
return;}
35 TCanvas* can =
new TCanvas();
36 Int_t pixx = ceil(1.4*pix*divx);
37 Int_t pixy = pix*divy;
38 can->SetCanvasSize(pixx,pixy);
39 can->Divide(divx, divy);
42 ext.ReplaceAll(
"..",
".");
43 picname.ReplaceAll(
".root",
ext);
45 cout <<
"opening: " << pic.Data()<<endl;
49 TList* list = file->GetListOfKeys();
50 if (!list) {cout<<
"List not there..."<<endl;
return;}
53 for(
int i=0;
i<list->GetEntries();
i++)
55 if(padcount > divx*divy)
57 can->Print(pic.Data());
59 can->SetCanvasSize(pixx,pixy);
60 can->Divide(divx, divy);
64 TKey*
key = (TKey*)list->At(
i);
65 keyclass = key->GetClassName();
67 if(keyclass.Contains(
"TH1"))
70 TH1* his = (TH1*)key->ReadObj();
71 his->GetXaxis()->SetNoExponent();
72 his->GetYaxis()->SetNoExponent();
79 can->Print(pic.Data());
81 can->Print(pic.Data());
82 cout <<
"closed: " << pic.Data()<<endl;
83 TString convertcmd =
"test -r ps2pdf && ps2pdf ";
84 convertcmd += pic.Data();
85 gSystem->Exec(convertcmd.Data());
void GaussFitPlot(TH1 *his)