Dear Root experts,
Hi !
I have two 2D histograms of identical dimensions (0, 4096) & total bins (4096). I want to subtract ‘hist 2’ from ‘hist 1’ , but only after multiplyig the bin contents of X & Y axis of ‘hist 2’ by factors 0.3 & 0. 2 respectively. Also I want to do this only selectively, i.e. only for those bins of ‘hist 1’, which have non zero entries. I know that In case of a simple subtraction (without any selection) with common multiplying factor (say 0.2) , it can be done in the following way -
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
TFile *f1 = new TFile(“f1.root”, “read”);
TH2F h1 = (TH2F)f1->Get(“hist1”);
//
TFile *f2 = new TFile(“f2.root”, “read”);
TH2F h2 = (TH2F)f2->Get(“hist2”);
TH2F h_out = (TH2F)h1->Clone(“difference”);
h_out->Add(h2, -0.2);
h_out->Draw();
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
But this selectively subtraction with different factors for X & Y axis is a new problem to me and therefore don’t know how to do it.
So if possible, please suggest me the way to do it with an example.
cylab123