#include #include #include #include #include "TNtuple.h" #include "TFile.h" #include "TH1F.h" #include "TH2F.h" #include "TTree.h" #include "TChain.h" #include "TCanvas.h" #include "TGraph.h" #include "TGraphErrors.h" #include "TF1.h" #include "TStyle.h" #include "TRandom.h" void TH2Fproblem(){ float a1=0; float b1=0; TH2F *h2 = new TH2F("h2","h2",160,0,550,160,0,6.0); TH2F *h1 = new TH2F("h1","h1",160,0,550,160,0,6.0); for(int i=0;i<2000;i++){ a1=gRandom->Gaus(200.0,100.0); b1=gRandom->Gaus(3.0,2.0); h2->Fill(a1,b1); if( (gRandom->Gaus(0.0,1.0))>0.25 )h1->Fill(a1,b1); } TCanvas *c1 = new TCanvas("c1","c1", 700,700); h2->SetMarkerStyle(21); h2->SetMarkerSize(0.25); h2->Draw(); h1->SetMarkerStyle(21); h1->SetMarkerSize(0.25); h1->SetMarkerColor(kRed); h1->Draw("SAME"); cout << "FINITO" << endl; }