OK now I understand your question. This is possible with some approximation as in principle to make a clean operation you would need to start from teh original unbinned x values. The approximation could be the following
TH1F *h; //your original histogram
int nbins = h->GetXaxis()->GetNbins();
TH1F *hnew = new TH1F("hnew","title",nbins,xminnew,xmaxnew);
for (int i=1;i<=nbins;i++0 {
double y = h->getBinContent(i);
double x = h->GetXaxis()->GetBinCenter(i);
double xnew = alpha*x + beta; //your transformation
hnew->Fill(xnew,y);
}
You may want to look also to TH1::Rebin (case xbins != 0) and see the procedure to recmpute errors in case the original hist has errors.
[quote=“brun”]OK now I understand your question. This is possible with some approximation as in principle to make a clean operation you would need to start from teh original unbinned x values. The approximation could be the following
TH1F *h; //your original histogram
int nbins = h->GetXaxis()->GetNbins();
TH1F *hnew = new TH1F("hnew","title",nbins,xminnew,xmaxnew);
for (int i=1;i<=nbins;i++0 {
double y = h->getBinContent(i);
double x = h->GetXaxis()->GetBinCenter(i);
double xnew = alpha*x + beta; //your transformation
hnew->Fill(xnew,y);
}
You may want to look also to TH1::Rebin (case xbins != 0) and see the procedure to recmpute errors in case the original hist has errors.
Rene[/quote]
it’s exactly the same procedure that I’m using. The problem is when alpha > 1 (a dilatation), for example with alpha=2 half bins are empty, so I must do a rebinning.
Yes this procedure is not going to create energy from vacuum.
It is up to you to figure out the right number of bins in the new histogram to avoid either empty bins or binning effects.