#include "TFile.h" #include "TTree.h" #include "TCanvas.h" #include "TF1.h" #include "TH1F.h" void opentrees() { TString fName = "simevents.root"; TString fName1 = "simevents-1.root"; TString fName2 = "simevents-2.root"; //open files TFile *fr1 = new TFile(fName1.Data()); if (fr1->IsZombie()) { Error("opentrees", "File %s not found.", fName1.Data()); return; } TFile *fr2 = new TFile(fName2.Data()); TFile *fr = new TFile(fName.Data()); //get trees TTree *tr1 = (TTree*)fr1->Get("simevents"); TTree *tr2 = (TTree*)fr2->Get("simevents"); TTree *tr = (TTree*)fr->Get("simevents"); //first Canvas TCanvas *c1 = new TCanvas(); // TCanvas *c1 = new TCanvas("name1", "title of canvas"); // TCanvas *c1 = new TCanvas("name1", "title of canvas", 0, 0, 950, 700); c1->Divide(2,2); c1->cd(1); tr->Draw("E", "E>0"); c1->cd(2); tr1->Draw("E", "E>0"); c1->cd(3); tr2->Draw("E", "E>0"); c1->cd(4); tr->Draw("E", "E>0.95"); tr1->SetLineColor(kRed); tr1->Draw("E", "E>0", "same"); tr2->SetLineColor(kBlue); tr2->Draw("E", "E>0", "same"); }