A more complex example


Fit a background with a P3

Macro PAWEX15A ID=30001 IP1=40 IP2=111 IZ1=33 IZ2=150 LOOP=20 * Set 2BUF 1 Hi/file 1 pawtut.hbook ; Hrin [ID] Set FWID 6 ; Set DMOD 1 1 NBIN = $HINFO([ID],'XBINS') Vector/Create FUNC([NBIN]) Vector/Create Y([NBIN]) Vector/Create S([NBIN]) Vector/Create X([NBIN],[LOOP]) Histogram/Copy [ID] 1 Histogram/Copy [ID] 2 * 2 Do i=1,[LOOP] Histogram/Plot 1 3 Histogram/Fit 1([IZ1]:[IZ2]) P3 0q 3 Get/Func 1 FUNC ; Put/Cont 2 FUNC 3 Sub 1 2 3 4 Histogram/Fit 3([IP1]:[IP2]) G 0q Histogram/Plot 3([IP1]:[IP2]) FUNCS 4 Get/Func 3 FUNC ; Put/Cont 2 FUNC 4 Sub 1 2 1 Get/Func 3 X(1:[NBIN],[i]) Call igterm Enddo * Get/Func 1 FUNC ; Put/Cont 2 FUNC Sub [id] 2 3 Zone 1 2 Histogram/Plot [ID] Histogram/Plot 1 FUNCS 5 Do i=1,[LOOP] Vector/Copy X(1:[NBIN],[i]) Y SIGMA S = S + Y SIGMA Y = Y+FUNC Put/Cont 2 Y Histogram/Plot 2([IP1]:[IP2]) SL Enddo Histogram/Plot 3([IP1]:[IP2]) HIST Put/Cont 2 S Histogram/plot 2([IP1]:[IP2]) Sl * Close 1 V/Del FUNC,X,Y,S ; H/Del 1,2,3


  1. This system function allows to retrieve informations on an histogram. Note that in a COMIS program information about histograms can be retrieve with the routine HGIVE (see example below).
  2. This loop try to find a P3 background.
  3. After a P3 fit, a new histogram is booked with the fit value at each channel. This new histogram is consider as an approximation of the background and is removed from the original histogram.
  4. A gaussian fit allows to remove the pick.
  5. This loop produce the two final plots.

How to retrieve histogram informations in a COMIS program

subroutine hinfo(id) character*32 chtitl vector hid(6) call hgive(id,chtitl,ncx,xmin,xmax,ncy,ymin,ymax,nwt,loc) hid(1) = ncx hid(2) = xmin hid(3) = xmax hid(4) = ncy hid(5) = ymin hid(6) = ymax end


PAW TutorialLast update: 1999/04/01 14.58
Olivier.Couet@Cern.Ch