PlotGen#
- book_histogram(df, HISTS_TO_BOOK, columns)[source]#
Book histograms for a given type (data, bkgnd, accMC, genMC)
- Parameters:
HISTS_TO_BOOK – dict of histograms to book, with associated function call, binning scheme, draw options
columns – list of column names in RDataFrame to check if we need to Redefine
- Returns:
list of booked Histos DRAW_OPTIONS: list of draw options
- Return type:
BOOKED_HISTOGRAMS
- define_if_not_observed(df, function, OBSERVED_FORMULAE, name, columns)[source]#
If requested function has not observed, define it and return new name If requested function has been observed, return the name associated with the observed function
- Parameters:
df – RDataFrame
function – function string
OBSERVED_FORMULAE – dict of observed {function: variable_name} pairs
name – new variable name to define if not observed
columns – list of column names in RDataFrame to check if we need to Redefine
- Returns:
RDataFrame name: string
- Return type:
df
- draw_histograms(results, hist_output_name, particles, HISTS_TO_BOOK, wavesets='all', stack_background=False, plot_acc_corrected=False, plot_chi2=False, output_format='pdf')[source]#
Draw histograms from a FitResults object. Histograms are booked using the book_histogram() function that uses macros to compute kinematic quantities to plot. Booked histograms are lazily evaluated / filled with RDataFrame.
- Parameters:
results (FitResults) – FitResults object
hist_output_name (str) – Output file name, do not include file type
particles (List[str]) – List of particles in reaction
HISTS_TO_BOOK (Dict[str, List]) – Dictionary of histograms to book. See book_histogram() for details
wavesets (str) – Space separated list of wavesets to turn on. Wavesets are semi-colon ; separated list of amplitudes. “all” turns on all waves.
stack_background (bool) – Stack backgrounds instead of subtracting them
plot_acc_corrected (bool) – Also plot acceptance corrected data, compare to weighted genmc
plot_chi2 (bool) – Plot chi2 values on the plot
output_format (str) – Output file format, “pdf” or “png”
- Returns:
None, dumps a pdf file based on hist_output_name
- turn_on_specifc_waveset(plotGen, results, waveset, verbose=True)[source]#
- Turn on a specific waveset which is an semicolon separated list of amplitude names.
If waveset = all, then turn on all amplitudes
Example
wavesets = ‘resAmp1;resAmp2’ # Will turn on only resAmp1 and resAmp2. AmpTools uses Reaction::Sum::Amp naming structure for amplitudes. The example will turn on all amplitudes with ‘resAmp1’ or ‘resAmp2’ anywhere in their name
- Parameters:
plotGen – PlotGenerator
results – FitResults
waveset – string
verbose – bool