Int_t Simple_hist_FCAL_test() { TCanvas *c1=new TCanvas(); c1->Divide(2,2); Float_t Amplitude[1600]= { 446.2, 530.4, 444.5, 529.9, 796.5, 553.1, 680.0, 595.3, 420.0, 325.3, 474.0, 511.3, 737.0, 398.0, 714.0, 512.0, 612.0, 538.0, 570.0, 275.0, 367.0, 524.0, 490.0, 353.5, 502.0, 492.0, 925.5, 510.5, 658.0, 374.5, 747.0, 590.0, 818.0, 324.0, 841.0, 437.5, 497.5, 520.0, 402.5, 453.5, 889.0, 382.5, 664.0, 361.5, 896.0, 488.0, 967.0, 380.0, 780.0, 548.5, 800.5, 593.5, 647.5, 571.5, 584.5, 555.5, 660.0, 345.5, 660.0, 653.5, 689.0, 383.0, 625.5, 451.5, 620.0, 497.5, 594.0, 396.5, 496.5, 422.5, 732.0, 503.0, 614.0, 419.0, 765.5, 629.0, 670.0, 486.5, 541.5, 435.0 }; TH1F *Amp=new TH1F("amp","Amplitudes both channels",50,-0.5,999.5); TH1F *Amp1=new TH1F("amp1","Amplitude channel 1",50.,-0.5,999.5); TH1F *Amp2=new TH1F("amp2","Amplitude channel 2",50.,-0.5,999.5); // Update the loop count for (int i=0;i<80;i++) { Amp->Fill(Amplitude[i]); if ( i % 2 == 0) { cout << i << "Channel 1 Amplitude = "<Fill(Amplitude[i]); } else { cout << i << "Channel 2 Amplitude = "<Fill(Amplitude[i]); } } TF1 *f1=new TF1("f1","gaus",0.,999.); c1->cd(3); Amp->Fit("f1"); Amp1->Fit("f1"); Amp2->Fit("f1"); Amp->Draw(); c1->cd(1); Amp1->SetLineColor(kGreen); Amp1->Draw(); c1->cd(2); Amp2->SetLineColor(kBlack); Amp2->Draw(); TFile *file1=new TFile("result.root","recreate"); Amp->Write(); Amp1->Write(); Amp2->Write(); file1->Close(); return 1; }