Hello rooters!!!
I am trying to draw on the same sub_canvas two different histos, coming from two different rootfiles.
I am using
[code]TFile *f1 = TFile::Open(“run169_processed.root”);
TTree *MyTree1;
f1->GetObject(“clu_mm2X”, MyTree1);
if (!MyTree1) { std::cout << “Warning: clu_mm2X TTree NOT found!” << std::endl; return; }
TFile *f1_2 = TFile::Open("run197_processed.root");
TTree *MyTree1_2;
f1_2->GetObject("clu_mm2X", MyTree1_2);
if (!MyTree1_2) { std::cout << "Warning: clu_mm2X TTree NOT found!" << std::endl; return; }
TCanvas *c = new TCanvas(“c”, “cluster number”);
c->SetFillColor(kYellow-6);//change canvas’ color
c->Divide(2,3);//divide canvas in a 2-column and 3-row multipad
c_3->cd();//another way to move around pads
c_3->SetFillColor(kAzure+1);
c_3->SetFrameFillColor(10);
c_3->SetBorderMode(1);
c_3->SetBorderSize(2);
//fill histograms with color
gStyle->SetHistFillColor(8);
MyTree1->UseCurrentStyle();
//generate and fill cl_cluster TTree variable. The histo will be named h1
MyTree1->Draw("cl_first_timebin>>h1");
MyTree1_2->Draw("cl_first_timebin>>h1_2","same");
h1_2->SetFillColor(5);
h1->SetTitle("V_{mesh}=480V");
h1->SetAxisRange(-2,12,"X");
//h1->SetAxisRange(0,1800,"Y");
h1->Draw();
h1->Fit("gaus","W",NULL,2,10);
h1->GetFunction("gaus")->SetLineColor(kRed);
//h1->Fit("gaus","W",NULL,1,3000);
//h1->GetFunction("gaus")->SetLineColor(kRed);
c->Modified(); c->Update();
[/code]
but it’s not working.
Any ideas?
Thank you in advance!