20    TH1F *h = 
new TH1F(
"h",
"test rebin",100,-3,3);
 
   21    Int_t nentries = 1000;
 
   22    h->FillRandom(
"gaus",nentries);
 
   25    TAxis *axis = h->GetXaxis();
 
   26    for (Int_t i=1;i<=100;i++) {
 
   27       Int_t y = (Int_t)h->GetBinContent(i);
 
   29       Double_t dx = axis->GetBinWidth(i)/y;
 
   30       Double_t xmin = axis->GetBinLowEdge(i);
 
   31       for (Int_t j=0;j<y;j++) {
 
   32          xbins[k] = xmin +j*dx;
 
   36    xbins[k] = axis->GetXmax();
 
   39    TH1F *hnew = 
new TH1F(
"hnew",
"rebinned",k,xbins);
 
   40    hnew->FillRandom(
"gaus",10*nentries);
 
   45    for (Int_t j=0;j<k;j+=2) {
 
   46       xbins2[kk] = xbins[j];
 
   49    xbins2[kk] = xbins[k];
 
   50    TH1F *hnew2 = (TH1F*)hnew->Rebin(kk,
"hnew2",xbins2);
 
   53    TCanvas *c1 = 
new TCanvas(
"c1",
"c1",800,1000);