6void help(std::string topic) {
7 if (topic.size() == 0) {
8 std::cout <<
"GamR help: " << std::endl;
9 std::cout <<
"help(<topic>) - help on specific topic" << std::endl;
10 std::cout <<
"topics include: " << std::endl;
11 std::cout <<
" abbrevs - quick abbreviations for common functions" << std::endl;
12 std::cout <<
" spect - spectroscopy tools" << std::endl;
13 std::cout <<
" angdist - gamma-ray angular distribution and correlations" << std::endl;
14 std::cout <<
" bateman - Bateman equation fitting" << std::endl;
15 std::cout <<
" efficiency - fit efficienties for HPGe detectors and arrays" << std::endl;
16 std::cout <<
" nucleus - fit and draw level schemes" << std::endl;
18 else if (topic ==
"abbrevs") {
19 std::cout <<
"GamR Abbreviations help: " << std::endl;
20 std::cout <<
"Abbreviations are commonly used functions designed to be used from the ROOT command line. They " << std::endl;
21 std::cout <<
"will typically call a more verbosely named GamR function in the appropriate namespace. Look at " << std::endl;
22 std::cout <<
"src/abbrevs/Abbreviations.hh and src/abbrevs/Abbreviations.cc to see the specific functions " << std::endl;
23 std::cout <<
"they are calling." << std::endl << std::endl;
24 std::cout <<
" px(), py() - projections into X- or Y- axes, operates on current Canvas" << std::endl;
25 std::cout <<
" gx(), gy() - interactive gating on X- or Y-axes" << std::endl;
26 std::cout <<
" bsx(), bsy() - interactive background subtraction" << std::endl;
27 std::cout <<
" cs() - prints cursor click coordinates to screen" << std::endl;
28 std::cout << std::endl;
29 std::cout <<
" pf() - fit (Gaussian) peaks" << std::endl;
30 std::cout <<
" pfconf() - configure fit parameters" << std::endl;
31 std::cout <<
" pfprint() - print parameters" << std::endl;
32 std::cout <<
" pfsave() - save parameters" << std::endl;
33 std::cout << std::endl;
34 std::cout <<
" bp() - \"basic peak\". This sums the counts over a background, " << std::endl;
35 std::cout <<
" which is usually fitted" << std::endl;
36 std::cout <<
" cbp() - \"click basic peak\". As above, but background is a straight" << std::endl;
37 std::cout <<
" line between two clicks on the canvas" << std::endl;
38 std::cout <<
" ig() - integrate between two bounds" << std::endl;
39 std::cout <<
" igbs() - integrate with background subtraction" << std::endl;
40 std::cout <<
" ct() - counts between two bounds" << std::endl;
41 std::cout <<
" ctbs() - counts with background subtraction" << std::endl;
42 std::cout <<
" fp() - \"find peaks\", implementation of ROOTs TSpectrum search" << std::endl;
43 std::cout << std::endl;
44 std::cout <<
" ls() - list 1D histograms in current directory" << std::endl;
45 std::cout <<
" sp(i) - draw histogram i" << std::endl;
46 std::cout <<
" os() - overlay 1D histograms. This takes a {list} of indices, histogram" << std::endl;
47 std::cout <<
" pointers, or start and stop indices for sequential lists. Also can" << std::endl;
48 std::cout <<
" do x-slices of a 2D histogram, or a {list} of file names followed by" << std::endl;
49 std::cout <<
" a histogram name (the same in each file)" << std::endl;
50 std::cout <<
" ss() - stack spectra, same arguments as above" << std::endl;
51 std::cout << std::endl;
52 std::cout <<
" lin() - linear (y) scale" << std::endl;
53 std::cout <<
" log() - log (y) scale" << std::endl;
54 std::cout <<
" zx(), zy() - zoom to limits on x/y" << std::endl;
55 std::cout <<
" uzx(), uzy(), uz() - unzoom" << std::endl;
56 std::cout << std::endl;
57 std::cout <<
" ca() - calibrate, returns pair of gain/offset for linear calibration" << std::endl;
58 std::cout << std::endl;
59 std::cout <<
" add() - sum lists of spectra together" << std::endl;
60 std::cout <<
" rb() - rebin" << std::endl;
61 std::cout <<
" ns() - \"norm spectra\", normalize to region indicated by clicks" << std::endl;
62 std::cout <<
" nsbs() - as above but with background subtraction" << std::endl;
63 std::cout <<
" rn() - rename currently plotted histogram" << std::endl;
64 std::cout << std::endl;
65 std::cout <<
" ls2() - list 2D spectra" << std::endl;
66 std::cout <<
" sp2(i) - plot 2D spectrum by index" << std::endl;
67 std::cout <<
" add2() - add 2D spectra" << std::endl;
68 std::cout << std::endl;
70 else if ( topic ==
"spect" ) {
71 std::cout <<
"GamR Spectroscopy help: " << std::endl;
72 std::cout <<
"Spectroscopy tools - calibrations, cuts, display utilities, peak fitting, and I/O to ASCII text formats." << std::endl;
73 std::cout <<
"See also help(\"spect/fitting\")" << std::endl;
74 std::cout <<
"Look in src/lib/spect/ for more details" << std::endl;
76 else if ( topic ==
"spect/fitting" ) {
77 std::cout <<
"Peak fitting is done through the 'pf()' [GamR::Spect::FitPeaks()] or 'bp()' [GamR::TK::FitBPeak()] functions" << std::endl;
78 std::cout << std::endl;
79 std::cout <<
"GamR::TK::FitBPeak()" << std::endl << std::endl;
81 std::cout <<
"BPeak stands for \'Basic' Peak -- the idea being to extract information about a peak while making no assumption" << std::endl;
82 std::cout <<
"about its shape. This proceeds by defining a peak region and then several background regions: usually at least " << std::endl;
83 std::cout <<
"one on either side of the peak. The background regions are then fit with some function(s), and the extrapolation/" << std::endl;
84 std::cout <<
"interpolation of these into the peak area is used to get the peak area and centroid after subtracting the background" << std::endl << std::endl;
86 std::cout <<
"The call signature is" << std::endl << std::endl;
88 std::cout <<
" bp(canvas, ROOT fitting options, BPeak options)," << std::endl << std::endl;
90 std::cout <<
"where the canvas is a ROOT canvas on which the histogram is plotted, and the second two arguments are optional" << std::endl;
91 std::cout <<
"strings. The first is passed to the ROOT TF1::Fit() function (see appropriate ROOT documentation). The second defines" << std::endl;
92 std::cout <<
"what kind of background to fit, and usually contains two characters. The first represents the functional form of the" << std::endl;
93 std::cout <<
"background: " << std::endl;
94 std::cout <<
" \"c\" : constant" << std::endl;
95 std::cout <<
" \"l\" : linear" << std::endl;
96 std::cout <<
" \"q\" : quadratic" << std::endl;
97 std::cout <<
"The second letter represents how the interpolation is conducted:" << std::endl;
98 std::cout <<
" \"s\" : smooth -- a single function is fitted to the union of all background regions." << std::endl;
99 std::cout <<
" \"p\" : point -- two background functions are fitted, one above and one below the peak region. These are extrapolated" << std::endl;
100 std::cout <<
" to the edges of the peak region, and then a straight line between the two intersections is used beneath the peak" << std::endl;
101 std::cout <<
" \"x\" : step -- two background functions are fitted, and then a smooth interpolation between them using the error " << std::endl;
102 std::cout <<
" function (erf) connects the two regions" << std::endl <<std::endl;
103 std::cout <<
"The default BPeak option is \"ls\" -- a linear smooth background" << std::endl;
104 std::cout << std::endl;
105 std::cout <<
"GamR::Spect::FitPeaks()" << std::endl << std::endl;
107 std::cout <<
"This actually fits a functional form to the peak(s). The most basic peak shape is a Gaussian, but this can be modified" << std::endl;
108 std::cout <<
"in several ways -- by adding one or two skewed components, and/or a step underneath the peak. The call signature is:" << std::endl << std::endl;
110 std::cout <<
" pf(canvas, ROOT fitting options, FitPeaks options)," << std::endl << std::endl;
112 std::cout <<
"in a similar fashion to bp(). The FitPeak options are:" << std::endl;
113 std::cout <<
" \"z\" : quiet mode" << std::endl;
114 std::cout <<
" \"f\" : fix widths -- all peaks are fitted with common width/skew/step parameters" << std::endl;
115 std::cout <<
" \"ff\" : fix widths from file --- the width/skew/step parameters are not fitted but read from a file (see below)" << std::endl;
116 std::cout <<
" \"q\" : quadratic background" << std::endl;
117 std::cout <<
" \"c\" : constant background" << std::endl;
118 std::cout <<
" \"q\" : quadratic background" << std::endl;
119 std::cout <<
" \"t\" : one tail (skewed component)" << std::endl;
120 std::cout <<
" \"g\" : two tails (two skewed components)" << std::endl;
121 std::cout <<
" \"s\" : step" << std::endl;
122 std::cout <<
" \"e\" : fix energy of one or more peaks" << std::endl;
123 std::cout <<
" \"n\" : no fit --- just create the template function with starting guesses but do not fit" << std::endl << std::endl;
125 std::cout <<
"The option \"ff\" requires an additional file named \"FitWidths.dat\" in the current directory. It should contain several" << std::endl;
126 std::cout <<
"rows, each with 7 numbers corresponding to:" << std::endl;
127 std::cout << std::endl;
128 std::cout <<
"Energy Width Step Skew SkewAmp Skew2 SkewAmp2" << std::endl << std::endl;
129 std::cout <<
"With several rows at different energies, the shapes of the detector response across the whole energy range can be specified." << std::endl;
130 std::cout <<
"The fitting function will read this file and interpolate (linearly) between the energies defining the appropriate shape" << std::endl;
131 std::cout <<
"for the correct region of the spectrum. Thus, the only fitted parameters for each peak are its location (centroid) and " << std::endl;
132 std::cout <<
"its amplitude. An example \"FitWidths.dat\" file can be found in the share folder inside the install directory." << std::endl;
134 else if (topic ==
"angdist" ) {
135 std::cout <<
"GamR Angdist help: " << std::endl;
136 std::cout <<
"Angular distribution/correlation tools. Formalism for statistical tensors, population parameters, Fk and" << std::endl;
137 std::cout <<
"Ak coefficients, gamma-ray angular distributions and correlations. Fitting angular correlations is here," << std::endl;
138 std::cout <<
"as well as Time-Dependent Perturbed Angular Distributions." << std::endl;
140 else if (topic ==
"bateman" ) {
141 std::cout <<
"GamR Bateman help: " << std::endl;
142 std::cout <<
"For fitting the Bateman equations numerically for an arbitrary feeding/decay scheme" << std::endl;
144 else if (topic ==
"efficiency" ) {
145 std::cout <<
"GamR Efficiency help: " << std::endl;
146 std::cout <<
"Classes for fitting HPGe efficiency curves. Uses the Radware 7-parameter function, can stitch together " << std::endl;
147 std::cout <<
"multiple data sets, do several detectors simultaneously, and optionally anchor to absolute efficiency points" << std::endl;
149 else if (topic ==
"nucleus") {
150 std::cout <<
"GamR Nucleus help: " << std::endl;
151 std::cout <<
"Classes for fitting and drawing level schemes" << std::endl;
154 std::cout <<
"Unknown topic" << std::endl;
185TSpectrum*
fp(TCanvas *canvas ,
double sigma, Option_t *option,
double threshold) {
return GamR::Spect::FindPeaks(canvas, sigma, option, threshold); }
203void os(std::vector<std::string> files, std::string name,
int iXstart,
int iXstop, Option_t *option) {
GamR::Spect::OverlaySpectra(files, name, iXstart, iXstop, option); }
221std::pair<double, double>
ca(TH1 *hist,
double lowEst,
double highEst,
double lowEn,
double highEn,
double sigma) {
return GamR::Spect::TwoPointCalibrate(hist, lowEst, highEst, lowEn, highEn, sigma); }
TH2 * rby(TH2 *hist, int rebin)
TH2 * rbx(TH2 *hist, int rebin)
void zx(double low, double high, TVirtualPad *canvas)
std::pair< double, double > ctbs(TCanvas *canvas)
TH1D * gy(TCanvas *canvas)
void sp(int i, Option_t *option)
TH1 * rb(TH1 *hist, int rebin)
std::pair< double, double > igbs(TCanvas *canvas)
TSpectrum * fp(TCanvas *canvas, double sigma, Option_t *option, double threshold)
void uzy(TVirtualPad *canvas)
void cs(TVirtualPad *canvas)
TH1D * bsy(TCanvas *canvas)
GamR::TK::BPeak * bp(TCanvas *canvas, Option_t *foption, Option_t *option)
GamR::TK::BPeak * cbp(TCanvas *canvas)
void ss(std::vector< int > indexes, TCanvas *canvas, Option_t *option)
void cc(TH2 *hist, int ncontours, double bias)
std::pair< double, double > ct(TCanvas *canvas)
void sp2(int i, Option_t *option)
GamR::Spect::PeakFit * pf(TCanvas *canvas, Option_t *foption, Option_t *option)
void ns(TVirtualPad *canvas, Option_t *option)
void os(std::vector< int > indexes, TCanvas *canvas, Option_t *option)
void help(std::string topic)
std::pair< double, double > ca2(TVirtualPad *canvas)
void log(TVirtualPad *canvas)
void rn(TVirtualPad *canvas)
std::pair< double, double > ig(TCanvas *canvas)
void uzx(TVirtualPad *canvas)
TH1 * add(std::vector< TH1 * > hists, const char *name)
void lin(TVirtualPad *canvas)
TH2 * add2(std::vector< TH2 * > hists, const char *name)
void uz(TVirtualPad *canvas)
void py(TVirtualPad *canvas)
void px(TVirtualPad *canvas)
void zy(double low, double high, TVirtualPad *canvas)
void nsbs(TVirtualPad *canvas)
TH1D * bsx(TCanvas *canvas)
TH1D * gx(TCanvas *canvas)
std::pair< double, double > ca(TVirtualPad *canvas, double sigma)
BPeak * ClickBPeak(TCanvas *canvas)
BPeak * FitBPeak(TCanvas *canvas, Option_t *foption, Option_t *option)
std::vector< TH2 * > List2DSpectra(bool quiet)
TH1D * ProjY(TH2 *hist, const char *name)
TH2 * RebinY(TH2 *hist, int rebin)
std::pair< double, double > TwoPointCalibrate(TVirtualPad *canvas, double sigma)
void Draw2D(int i, Option_t *option)
TH1D * BackgroundSubtractY(TH2 *hist, GamR::TK::Gate peak, std::vector< GamR::TK::Gate > background, const char *name)
TH1 * Rebin(TH1 *hist, int rebin)
TH2D * Add2(std::vector< int > hists, const char *name)
void Draw(int i, Option_t *option)
std::vector< TH1 * > List1DSpectra(bool quiet)
TSpectrum * FindPeaks(TCanvas *canvas, double sigma, Option_t *option, double threshold)
void Rename(TVirtualPad *canvas)
PeakFitGuesses * gFitGuesses
void NormSpectra(TVirtualPad *canvas, Option_t *option)
void ContourCalc(TH2 *hist, int ncontours, double bias)
void Cursor(TVirtualPad *canvas)
TH1D * BackgroundSubtractX(TH2 *hist, GamR::TK::Gate peak, std::vector< GamR::TK::Gate > background, const char *name)
void LinAll(TVirtualPad *canvas)
void UnZoomAllY(TVirtualPad *canvas)
std::pair< double, double > IntegralBS(TH1 *hist, GamR::Nucleus::Transition transition)
void OverlaySpectra(std::vector< int > display_indexes, TCanvas *canvas, Option_t *option)
std::pair< double, double > CountsBS(TH1 *hist, GamR::Nucleus::Transition transition, std::string opt)
TH1D * GateY(TH2 *hist, GamR::TK::Gate peak, const char *name)
void LogAll(TVirtualPad *canvas)
void NormSpectraBackSub(TVirtualPad *canvas)
TH1D * ProjX(TH2 *hist, const char *name)
GamR::Spect::PeakFit * FitPeaks(TH1 *hist, double Low, double High, std::vector< double > Peaks, Option_t *foption, Option_t *option, std::vector< std::string > FixPeaks)
void StackSpectra(std::vector< int > display_indexes, TCanvas *canvas, Option_t *option)
void ZoomAllX(double low, double high, TVirtualPad *canvas)
void ZoomAllY(double low, double high, TVirtualPad *canvas)
void UnZoomAllX(TVirtualPad *canvas)
TH2 * RebinX(TH2 *hist, int rebin)
TH1D * Add(TH1 *hist1, TH1 *hist2, const char *name, double c1, double c2)
std::pair< double, double > TwoClickCalibrate(TVirtualPad *canvas)
std::pair< double, double > Counts(TH1 *hist, GamR::TK::Gate peak, std::string opt)
std::pair< double, double > Integral(TH1 *hist, GamR::TK::Gate peak)
TH1D * GateX(TH2 *hist, GamR::TK::Gate peak, const char *name)