gibuu is hosted by Hepforge, IPPP Durham
GiBUU

TABLE OF CONTENTS


/histMC_avg [ Modules ]

[ Top ] [ Modules ]

NAME

module histMC_avg

PURPOSE

This module implements a type 'histogramMC_avg' for 1D Histograms with multiple channels. It is similar to the type 'histogramMC' but in addition stores event counts for each bin and channel. In the end it outputs the average of the stored quantity over all entries in a particular bin. This is useful e.g. for the flow analysis in the module 'HeavyIonAnalysis'.


histMC_avg/histogramMC_avg [ Types ]

[ Top ] [ histMC_avg ] [ Types ]

NAME

type histogramMC_avg

PURPOSE

Type definition to store all information for a multi-channel 1D Histogram with averaging capabilities.

SOURCE

  type, public :: histogramMC_avg
    real :: xMin, xMax, xBin                         ! smallest/largest x-value & bin width
    real :: xExtreme(2)                              ! extremes of used x-values (min,max)
    character*(NameLength) :: Name, xDesc            ! histogram name and description of x-value
    character*(NameLength), allocatable :: yDesc(:)  ! description of y-channels
    real, allocatable :: yVal(:,:)      ! histogramm values: (x), (y1,y2,y3,...)
                                        ! bin 0,-1 : underflow/overflow !!!
    integer, allocatable :: counts(:,:) ! counts: (x), (count1,count2,count3,...)
                                        ! bin 0,-1 : underflow/overflow counts !!!
    logical :: initialized = .false.    ! flag to indicate whether the histogram has been initialized
  end type histogramMC_avg

histMC_avg/CreateHistMC_avg [ Subroutines ]

[ Top ] [ histMC_avg ] [ Subroutines ]

NAME

subroutine CreateHistMC_avg (H, HName, x1, x2, bin, nCh)

PURPOSE

This is the constructor of a multi-channel 1D-Histogram. Allocate memory for the entries and put additional variables to their default.

INPUTS

  • type(histogramMC_avg):: H -- Histogramm to be created
  • character*(*) :: HName -- Name of histogram
  • real :: x1,x2,bin -- Minimal/maximal value for x-coordinate to be considered, bin-width
  • integer :: nCh -- Number of channels

OUTPUT

H is changed.


histMC_avg/histMC_avg [ Subroutines ]

[ Top ] [ histMC_avg ] [ Subroutines ]

NAME

subroutine RemoveHistMC_avg(H)

PURPOSE

Free the allocated memory.

INPUTS

OUTPUT

H is changed.


histMC_avg/AddHistMC_avg [ Subroutines ]

[ Top ] [ histMC_avg ] [ Subroutines ]

NAME

subroutine AddHistMC_avg (H, x, nCh, y)

PURPOSE

Add the weight y to the given histogram at the given x-value and channel number, and increment the count for that bin.

INPUTS

  • type(histogramMC_avg) :: H -- Histogramm to be used
  • real :: x -- x-value
  • integer :: nCh -- number of Channel
  • real :: y -- weight to be added

OUTPUT

H is changed.


histMC_avg/CopyDesc_avg [ Subroutines ]

[ Top ] [ histMC_avg ] [ Subroutines ]

NAME

subroutine CopyDesc_avg (H_dest, H_src)

PURPOSE

Copy the channel descriptions from one histogram to another.

INPUTS

OUTPUT

H_dest is changed


histMC_avg/WriteHeader [ Subroutines ]

[ Top ] [ histMC_avg ] [ Subroutines ]

NAME

logical function WriteHeader (H, iFile, mul, FinalLineBreak)

PURPOSE

A header is written to the file:

  • Underflow: sum of all calls with a x-value less than x-min
  • Entries: sum of all entries listed in section "Data" below
  • Overflow: sum of all calls with a x-value above x-max
  • Extrema: the smallest/biggest x-values which had been added
  • counted: the range of x-values, which is considered in "Entries"
  • descriptions of x-value and all y-channels

Summing "Underflow"+"Entries"+"Overflow" gives the number of ALL calls, i.e. the integral from -infty upto +infty.

Output of "Underflow","Entries","Overflow" shows only the sum of all channels.

INPUTS

  • type(histogramMC_avg) :: H -- Histogramm
  • integer :: iFile -- file number to write to
  • real, optional :: mul
  • logical,optional :: FinalLineBreak -- .false.= No line break after the header

OUTPUT


histMC_avg/WriteHistMC_avg [ Subroutines ]

[ Top ] [ histMC_avg ] [ Subroutines ]

NAME

subroutine WriteHistMC_avg(H,file,mul,dump)

PURPOSE

Write out the histogram. The entries are multiplied by 'mul'.

INPUTS

  • type(histogramMC_avg) :: H -- Histogramm to be used
  • character*(*) :: file -- name of file to open and close
  • real :: mul -- factor to multiply [OPTIONAL]
  • logical :: dump -- if true, also dump it binary to file [OPTIONAL]

OUTPUT

write to file

Several columns are written in the data section:

  • 1) x-value (i.e. middle of bin)
  • 2) total sum of all y-values
  • 3...) all single y-values (followed by their counts)

In addition a header with additional info is written to the file (see "WriteHeader").

NOTES

The Histogram data is not affected.


histMC_avg/ReadHistMC_avg [ Functions ]

[ Top ] [ histMC_avg ] [ Functions ]

NAME

function ReadHistMC_avg (H, file, w) result (success)

PURPOSE

Read in a histogram from a file.

INPUTS

  • type(histogramMC_avg) :: H -- Histogram to be used
  • character*(*) :: file -- name of file to read
  • real, optional, intent(in) :: w -- optional weigting factor

OUTPUT

  • H is changed
  • return value indicates success or failure

NOTES

Only data points are read (no under-/overflow etc).


histMC_avg/sumHistMC_avg [ Subroutines ]

[ Top ] [ histMC_avg ] [ Subroutines ]

NAME

subroutine sumHistMC_avg (A, B, w)

PURPOSE

Perform a summation of two histograms: A = A + B. If a weight 'w' is given, do a weighted summation: A = A + w*B

INPUTS

  • type(histogramMC_avg) :: A, B -- Histograms to be used
  • real, optional, intent(in) :: w -- optional weighting factor

OUTPUT

A is changed.


histMC/DumpHistMC_avg [ Subroutines ]

[ Top ] [ histMC ] [ Subroutines ]

NAME

subroutine DumpHistMC_avg(H,file,iFile, add,mul)

PURPOSE

Write all the histogram information unformatted (i.e. binary) to a file

INPUTS

  • type(histogramMC_avg) :: H -- Histogramm to be used
  • character*(*) :: file -- name of file to open and close
  • integer,OPTIONAL :: iFile -- File number output to redirect [OPTIONAL]
  • real :: add -- factor to add [OPTIONAL]
  • real :: mul -- factor to multiply [OPTIONAL]

OUTPUT

H is written UNFORMATTED to the given file


histMC/FetchHistMC_avg [ Subroutines ]

[ Top ] [ histMC ] [ Subroutines ]

NAME

subroutine FetchHistMC_avg(H,file,iFile, add,mul,flagOK)

PURPOSE

Read in all the histogram information previously dumped unformatted (i.e. binary) to a file

INPUTS

  • character*(*) :: file -- name of file to open and close
  • integer,OPTIONAL:: iFile -- File number input to redirect [OPTIONAL]

OUTPUT

  • type(histogramMC_avg) :: H -- Histogramm to be used
  • real :: add -- factor to add [OPTIONAL]
  • real :: mul -- factor to multiply [OPTIONAL]
  • logical :: flagOK -- flag, if reading was okay [OPTIONAL]

H is read UNFORMATTED from the given file. Sizes are calculated as in CreateHist, also memory is allocated.

NOTES

No checks about input are performed!