ST Analysis Macros 

Lars Eklund , John Hill, Gareth Moorhead and Peter Phillips

Contents

The standard distribution includes the following useful macros in the directory sctvar\analysis:
View Sources

stan_all_scurves.cpp
    Plot the scurves for the specified combination of run, scan, module and link, for a total of n_ch channels starting at channel start_ch. A postscript file is produced with 32 channels plotted on each page. If start_ch and n_ch are not specified, s curves are plotted for all 768 channels of the specified link. If called with only two arguments, module and link, the scurves are plotted for the scan in memory.

    Possible Uses of stan_all_scurves:
    .x stan_scurves.cpp(module,link)
    .x stan_scurves.cpp(run,scan,module,link)
    .x stan_scurves.cpp(run,scan,module,link,start_ch,n_ch)

stan_compare.cpp
    This macro is used to compare the scan histograms results from any two run/scan/module/link combinations. Each scan histogram is plotted in "colz" format and as a normalised projection. The optional argument log may be used to toggle between linear occupancy scale (0, default) and logarathmic occupancy scale (1). The projected range may be varied from the default setting (all channels) by use of the optional arguments lo_ch and hi_ch. Hint: to draw the first projection on top of the second one, simply type "h1p->Draw();" at the CINT prompt.

    Possible Uses of stan_compare:
    .x stan_compare.cpp(run1,scan1,moi1,loi1,run2,scan2,moi2,loi2)
    .x stan_compare.cpp(run1,scan1,moi1,loi1,run2,scan2,moi2,loi2,log)
    .x stan_compare.cpp(run1,scan1,moi1,loi1,run2,scan2,moi2,loi2,lo_ch,hi_ch,log)

stan_fitnoisescan.cpp
    This macro can be used to fit the error function to nosie occupancy scan data.

    Possible Uses of stan_fitnoisescan:
    .x stan_fitnoisescan.cpp(module,link)
    .x stan_fitnoisescan.cpp(run,scan,module,link)
    .x stan_fitnoisescan.cpp(run,scan,module,link,ascii,postscript)

stan_fitrc.cpp
    This macro will make a functional fit to the response curve determined by a series of threshold scans at different charges q given in the file sctdaq/analysis/st_rc.dat. The range to be fitted may be specified by the optional arguments range_lo and range_hi. The deafult range is 0fC to 8fC. Each of the component scans must already have been fitted by stan_fitscan.cpp.

    Possible Uses of stan_fitrc:
    .x stan_fitrc.cpp(run,start_scan,module,link)
    .x stan_fitrc.cpp(run,start_scan,module,link,chipset)
    .x stan_fitrc.cpp(run,start_scan,module,link,chipset,fit_type)
    .x stan_fitrc.cpp(run,start_scan,module,link,fit_type,range_lo,range_hi)
    .x stan_fitrc.cpp(run,start_scan,module,link,chipset,fit_type,range_lo,range_hi)
    .x stan_fitrc.cpp(run,start_scan,module,link,chipset,fit_type,range_lo,range_hi,ascii,postscript)
    Default chipset is 0 - ABCDT, use 1 - ABCDNT1 2 - ABC/CAFE
    Default fit type is 1 - polynomial, use 2 - Grillo 3 - Exponential 4 - Linear

stan_fitscan.cpp
    This macro may also be called directly from the main menu of ST.

    Possible Uses of stan_fitscan:
    .x stan_fitscan.cpp(module,link)
    .x stan_fitscan.cpp(run,scan,module,link)
    .x stan_fitscan.cpp(run,scan,module,link,ascii,postscript)

stan_fittw.cpp
    This macro will make a functional fit to the timewalk curve determined by a series of delay scans at different charges q given in the file sctdaq/analysis/st_tw.dat. Each of the component scans must already have been fitted by stan_fitscan.cpp.

    Possible Uses of stan_fittw:
    .x stan_fittw.cpp(run,start_scan,module,link)
    .x stan_fittw.cpp(run,start_scan,module,link,chipset)
    .x stan_fittw.cpp(run,start_scan,module,link,chipset,fit_type)
    .x stan_fittw.cpp(run,start_scan,module,link,chipset,fit_type,ascii)
    .x stan_fittw.cpp(run,start_scan,module,link,chipset,fit_type,ascii,postscript)
    Default chipset is 0 - ABCDT, use 1 - ABCDNT1 2 - ABC/CAFE
    Default fit type is 3 - Exponential, use 2 - Grillo 1 - polynomial

stan_fittwbychan.cpp
    Possible Uses of stan_fittwbychan:
    .x stan_fittwbychan.cpp(run,start_scan,module,link)
    .x stan_fittwbychan.cpp(run,start_scan,module,link,chipset)
    .x stan_fittwbychan.cpp(run,start_scan,module,link,chipset,fit_type)
    .x stan_fittwbychan.cpp(run,start_scan,module,link,chipset,fit_type,ascii)
    .x stan_fittwbychan.cpp(run,start_scan,module,link,chipset,fit_type,ascii,postscript)
    Default chipset is 0 - ABCDT, use 1 - ABCDNT1 2 - ABC/CAFE
    Default fit type is 3 - Exponential, use 2 - Grillo 1 - polynomial

stan_kwikgain.cpp
    Given two (unfitted) threshold scans at differing charges charge1 and charge2, this macro will calculate gain, offset and noise by linear approximation. If called with only four arguments it is assumed that scan2 = scan1+1.

    Possible Uses of stan_kwikgain:
    .x stan_kwikgain.cpp(run,scan1,charge1,charge2)
    .x stan_kwikgain.cpp(run,scan1,charge1,scan2,charge2)
    .x stan_kwikgain.cpp(run,scan1,charge1,charge2,moi,loi)
    .x stan_kwikgain.cpp(run,scan1,charge1,scan2,charge2,moi,loi)
    .x stan_kwikgain.cpp(run1,scan1,charge1,run2,scan2,charge2,moi,loi,ascii,postscript)

stan_no.cpp
    This macro plots log(occupancy) vs threshold^2. It requires that the files "mymodule.fitrc" and "mymodule.mask" exist in the config directory. For the time being only linear response curve fits are supported. This macro should be considered to be under development (31.05.00).

    Possible Uses of stan_no:
    .x stan_no.cpp(run,scan,moi,loi)

stan_scurves.cpp
    Plot the scurves for the specified combination of run, scan, module and link. All scurves are plotted on a single page. If called with only two arguments, module and link, the scurves are plotted for the scan in memory. This macro may also be called directly from the main menu of ST.

    Possible Uses of stan_scurves:
    .x stan_scurves.cpp(module,link)
    .x stan_scurves.cpp(run,scan,module,link)

stan_trims.cpp
    From a series of fitted threshold scans, one taken at each possible setting of the ABCD2T trimdac, this macro will determine the best setting of the trimdac for each channel. The algorithm works by maximisation of the number of trimmed channels: target values from 0 to 300 mv in steps of 5mV are tried and the best value is automatically selected. Optionally the macro can be called with argument target, in which case the routine will trim to the specified value. The routine will give two output files for module n, "stmod_n.trim" comprising the list of trimdac settings and "stmod_n.mask", comprising the list of channels which could not be trimmed. These files are written in the current data directory, and must be moved to the config directory and renamed "mymodule.trim" and "mymodule.mask" to be picked up at the next restart of ST.

    Possible Uses of stan_trims:
    .x stan_trims.cpp(run,start_scan,module)
    .x stan_trims.cpp(run,start_scan,module,target)

stan_trim2.cpp
    This macro is based upon stan_trims.cpp, with the addition of graphical output. Although the macro trims both links of a module, plots are shown only for the requested link.

    Possible Uses of stan_trim2:
    .x stan_trim2.cpp(run,start_scan,module)
    .x stan_trim2.cpp(run,start_scan,module,link,target)
    .x stan_trim2.cpp(run,start_scan,module,link,target)

stan_util.cpp
    This macro comprises a number of utility routines used by the other macros, including the definitions of the fit finctions. It is not called directly by the user, but the user may wish to use some of these functions within his own analysis macros.
suggestions/corrections