#include "TFile.h" #include "TCanvas.h" #include "TStyle.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TGaxis.h" #include "TRandom.h" #include "TLegend.h" #include "TPaveStats.h" #include "TGraph.h" void profilospaziale() { TFile *f = TFile::Open("G:/cors/prot/prottot/cors_plot-prottot.root"); if (f == 0) { // if we cannot open the file, print an error message and return immediatly printf("Error: cannot open cors_plot.root!\n"); return; } f->ls(); TH3F *hgamrxryrz = (TH3F *)f->Get("hgamrxryrz"); if (hgamrxryrz == 0) { printf("Error getting an histogram from the file!\n"); return; } TH3F *helerxryrz = (TH3F *)f->Get("helerxryrz"); if (helerxryrz == 0) { printf("Error getting an histogram from the file!\n"); return; } TH3F *hmuorxryrz = (TH3F *)f->Get("hmuorxryrz"); if (hmuorxryrz == 0) { printf("Error getting an histogram from the file!\n"); return; } TH3F *hhadrxryrz = (TH3F *)f->Get("hhadrxryrz"); if (hhadrxryrz == 0) { printf("Error getting an histogram from the file!\n"); return; } TCanvas *c2 = new TCanvas("c2","hists with different scales",1280,1024); float marg=0.3; float offx=2.0; float offy=1.3; float offz=1.2; float n=3; TGaxis::SetMaxDigits(n); hgamrxryrz->SetTitle("#gamma secondari nell'EAS"); hgamrxryrz.GetXaxis()->SetTitle("x (m)"); hgamrxryrz.GetYaxis()->SetTitle("y (m)"); hgamrxryrz.GetZaxis()->SetTitle("z (m)"); hgamrxryrz->GetXaxis()->SetTitleOffset(offx); hgamrxryrz->GetYaxis()->SetTitleOffset(offy); hgamrxryrz->GetZaxis()->SetTitleOffset(offz); hgamrxryrz->SetMarkerColor(kBlue); gPad->SetBottomMargin(marg); hgamrxryrz->Draw(); { gPad->Modified(); gPad->Update(); TPaveStats *st = ((TPaveStats *)(gPad->GetPrimitive("stats"))); if (st) { st->SetTextColor(kBlack); st->SetX1NDC(st->GetX1NDC() - 0.1); st->SetX2NDC(st->GetX2NDC() - 0.1); st->SetY1NDC(st->GetY1NDC() - 0.02); st->SetY2NDC(st->GetY2NDC() - 0.02); gPad->Modified(); gPad->Update(); } } gROOT->ProcessLine("gROOT->SetBatch()"); c2.Print("G:/cors/prot/gammaprot_gammarxryrz.png"); delete c2; gROOT->ProcessLine("gROOT->SetBatch(kFALSE)"); }