Dear Helpers,
I am trying to plot a TH2F histogram which present the devision of the values from two other TH2F histogram with different ranges, please, could someone help ? I am using this part of the code but it doesn’t work.
{
// Style setting
gROOT->Reset();
TH2F *histAll = new TH2F(“histAll”,“hist All”,100,0.,456.,100,0,1); histAll->GetXaxis()->SetNdivisions(505);
TFile *f1 = new TFile(“myroot.root”);
TTree tree = (TTree)gDirectory->Get(“run_181951/Wave/Tree”);
Int_t nEntries = tree->GetEntries();
Int_t Sampling;
Int_t Region;
Int_t Eta;
Int_t Phi;
Double_t Fact;
tree->SetBranchAddress(“Sampling”, &Sampling);
tree->SetBranchAddress(“Region”, &Region);
tree->SetBranchAddress(“Eta”, &Eta);
tree->SetBranchAddress(“Phi”, &Phi);
tree->SetBranchAddress(“Fact”, &Fact);
TH1F* hist1 = new TH1F("hist1","hist1",100,0,3);
TH1F* hist2 = new TH1F("hist2","hist2",100,0,20);
for(i=0; i< tree->GetEntries(); ++i) {
tree->GetEntry(i);
if (Sampling==1 && Region == 0 ) hist1->Fill(Fact); // the range here on Eta is between 0 to 400
if (Sampling==2 && Region == 0 ) hist2->Fill(Fact); // the range here on Eta is between 0 to 50
TH2F* ratio = hist1->Divide(hist2);
TH2F* ratio = hist1->Divide(hist2);
histAll->Fill(Eta,ratio);
histAll->Draw();
Please, is there a way how can get this correct?
Thank you so much for your help
Gabino