#include "TProfile.h" #include "TH2.h" #include "TStyle.h" void profile_rms() { TH2F* h2=new TH2F("h2","h2", 10,-5.,5., 1, 0.,1.); h2->FillRandom("gaus",500000); TH1D* hproj=h2->ProjectionX("projection_x", 1, 1); TProfile* prof=h2->ProfileY(); TCanvas* c=new TCanvas("profileRMS", "profile and RMS"); c->Divide(1,2); c->cd(1); gStyle->SetOptStat(111111); hproj->Draw(); c->cd(2); prof->Draw(); }