TABLE OF CONTENTS
- 1. /histMC
- 1.1. histMC/histogramMC
- 1.2. histMC/ClearHistMC
- 1.3. histMC/CreateHistMC
- 1.4. histMC/RemoveHistMC
- 1.5. histMC/AddHistMC
- 1.6. histMC/RebinHistMC
- 1.7. histMC/CopyDesc
- 1.8. histMC/WriteHeaderMC
- 1.9. histMC/WriteHistMC
- 1.10. histMC/WriteHistMC_Integrated
- 1.11. histMC/WriteHistMC_Spline
- 1.12. histMC/WriteHistMC_Gauss
- 1.13. histMC/ReadHistMC
- 1.14. histMC/sumHistMC
- 1.15. histMC/DumpHistMC
- 1.16. histMC/FetchHistMC
/histMC [ Modules ]
NAME
module histMC
PURPOSE
Encapsulate all routines and data for 1D Histograms with multiple channels.
Features of Histograms provided by this module:
- store parameters of the x-binning
- enable multiple y-values
- track keeping of under-/over-score the given extreme values of x.
- provide simple-to-understand output routines (cf. WriteHist)
- provide simple histogram arithmetic (not yet implemented)
- many others...
Every Histogram prints its own multicolumn output. A multicolumn output of many different histograms for the same x-value is not implemented. This is done by the module "histMPf90".
INPUTS
...(This module needs no input)
histMC/histogramMC [ Types ]
NAME
type histogramMC
PURPOSE
Type definition to store all information for a multi-channel 1D Histogram.
SOURCE
type, public :: histogramMC real :: xMin ! smallest x-value real :: xMax ! largest x-value real :: xBin ! width of x-Bin real :: xExtreme(2) ! extremes of used x-values ! (min,max) character*(NameLength) :: Name ! name to be written character*(NameLength) :: xDesc ! description of x-value character*(NameLength),allocatable :: yDesc(:) ! description of y-channels real,allocatable :: yVal(:,:) ! histogramm values: ! (x), (yy1,yy2,yy3...) ! bin 0,-1 : underflow/overflow !!! logical :: initialized = .false.! flag to indicate whether the histogram has been initialized end type histogramMC
histMC/ClearHistMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine ClearHistMC (H)
PURPOSE
Sets the histogram to zero again
INPUTS
- type(histogramMC) :: H -- Histogramm to be cleared
OUTPUT
H is changed
histMC/CreateHistMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine CreateHistMC (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):: 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/RemoveHistMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine RemoveHistMC(H)
PURPOSE
Free the allocated memory
INPUTS
- type(histogramMC) :: H -- Histogramm to be used
OUTPUT
H is changed
histMC/AddHistMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine AddHistMC (H, x, nCh, y)
PURPOSE
Add to the given histogram at the given x-value the weight y (y2). If y2 is given, also the second column is filled.
INPUTS
- type(histogram) :: 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/RebinHistMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine RebinHistMC (H, N)
PURPOSE
Perform a rebinning of a present histogram, i.e. increase the bin size by an integer factor.
INPUTS
- type(histogramMC),intent(inout) :: H -- histogram to be rebinned
- integer, intent(in) :: N -- rebinning factor
OUTPUT
H is changed
histMC/CopyDesc [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine CopyDesc(H_dest,H_src)
PURPOSE
Copy the channel descriptions from one histogram to another.
INPUTS
OUTPUT
H_dest is changed
histMC/WriteHeaderMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
logical function WriteHeaderMC (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) :: H -- Histogramm
- integer :: iFile -- file number to write to
- real, optional :: mul
- logical,optional :: FinalLineBreak -- .false.= No line break after the header
OUTPUT
histMC/WriteHistMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine WriteHistMC(H,file,div,add,mul,dump)
PURPOSE
Write out the histogram.
The entries are multiplied by 'mul'.
INPUTS
- type(histogram) :: H -- Histogramm to be used
- character*(*) :: file -- name of file to open and close
- real :: div -- if true, divide data by the bin width [OPTIONAL]
- real :: add -- factor to add [OPTIONAL]
- 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
Columns are divided by the bin-width, if "div" is true (or omitted). (Default: div = .true.)
In addition a header with additional info is written to the file (see "WriteHeaderMC")
NOTES
The Histogram Data is not affected!!!
histMC/WriteHistMC_Integrated [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine WriteHistMC_Integrated(H,file,div)
PURPOSE
Write out the histogram, integrating the data over x.
INPUTS
- type(histogram) :: H -- Histogramm to be used
- character*(*) :: file -- name of file to open and close
- logical :: div -- if true, divide data by the bin width [OPTIONAL]
OUTPUT
write to file
histMC/WriteHistMC_Spline [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine WriteHistMC_Spline(H,file,nPoints)
PURPOSE
Write out the histogram.
The binning is subdivided into "nPoints" points per bin, where every point is calculated via cubic spline interpolation. (Default: nPoints=5)
INPUTS
- type(histogram) :: H -- Histogramm to be used
- integer :: iFile -- File number output to redirect
- integer :: nPoints -- number of sub-points [OPTIONAL]
OUTPUT
write to file number
cf. WriteHist
NOTES
The Histogram Data is not affected!!!
histMC/WriteHistMC_Gauss [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine WriteHistMC_Gauss (H, file, width_in)
PURPOSE
Write out the histogram, convoluted with a gaussian distribution.
INPUTS
- type(histogram) :: H -- Histogramm to be used
- character*(*) :: file -- name of file to open and close
- real, OPTIONAL :: width_in -- width of gaussian
OUTPUT
write to file
NOTES
The Histogram Data is not affected!!!
histMC/ReadHistMC [ Functions ]
[ Top ] [ histMC ] [ Functions ]
NAME
function ReadHistMC (H, file, w) result (success)
PURPOSE
Read in a histogram from a file.
INPUTS
- type(histogramMC) :: 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/sumHistMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine sumHistMC (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) :: A, B -- Histograms to be used
- real, optional, intent(in) :: w -- optional weighting factor
OUTPUT
A is changed.
histMC/DumpHistMC [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine DumpHistMC(H,file,iFile, add,mul)
PURPOSE
Write all the histogram information unformatted (i.e. binary) to a file
INPUTS
- type(histogramMC) :: 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 [ Subroutines ]
[ Top ] [ histMC ] [ Subroutines ]
NAME
subroutine FetchHistMC(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) :: 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