Example to represent a drift tube efficiency with a function of the 
distance from the central wire:
- fit function parameters to a plot with measured efficiency
- simulate hits according to the fitted efficiency
- read simulated hits and produce an histogram to compare with original plot

HitEfficiency.h,cc  : class to represent a function with parameters
FitEfficiency.h,cc  : class to fit function over an histogram
fit.cc              : main program to fit histogram
sim.cc              : main program to simulated numbers with probability
                      density function described by the function
his.cc              : main program to read simulated numbers and 
                      histogram them
eff.root            : file containing the histogram to be fitted

to compile:

c++ -Wall `root-config --cflags` -o fit fit.cc \
HitEfficiency.cc FitEfficiency.cc `root-config --libs`
c++ -Wall -o sim sim.cc HitEfficiency.cc 
c++ -Wall `root-config --cflags` -o his his.cc \
HitEfficiency.cc FitEfficiency.cc `root-config --libs`

or

compile_fit
compile_sim
compile_his

to run:

# fit measured efficiency:
fit eff.root eff.txt
# eff.root :  input file containing plot of measured efficiency vs. distance
# eff.txt  : output file to write fitted parameter

# simulate hits with parametrized efficiency:
sim [seed] eff.txt hit.txt
# seed    : random number generation seed
# eff.txt :  input file with efficiency function parameters
# hit.txt : output file to write generated hits

# plot simulated hits
his hit.txt

