How to re-scale an histogram ?


The following routine (file rescale.f) can be used. It rescale the histogram Id1 into the histogram Id2 with the new axis coordinates X1 and X2. The number of bins of Id2 is computed in order to have the same bin width as Id1.

       Subroutine Rescale(Id1,Id2,X1,X2)
       Character*32 Chtitl
       Logical Hexist
       Call Hgive(Id1,Chtitl,Ncx,Xmin,Xmax,Ncy,Ymin,Ymax,Nwt,Loc)
       Bw   = (Xmax-Xmin)/Ncx
       Nbin = (X2-X1)/Bw
       Bw2  = Bw/2.
       If (Hexist(Id2)) Call Hdelet(Id2)
       Call Hbook1(Id2,Chtitl,NBin,X1,X2,0.)
       Do I=1,Ncx
          Call Hix(Id1,I,X)
          XI = X+Bw2
          W  = Hx(Id1,XI)
          Call Hfill(Id2,XI,0.,W)
       Enddo
       End
 
Example:
 PAW > Call rescale.f(10,11,-3.,10.)
 PAW > h/pl 11
 


Release NotesKnown bugsFAQsContributionsTutorialReference manualDown loadMiscellaneous

Paw.Support@cern.ch