Berkeley Nuclear Data Software
|
#include <SpectrumAnalysis.h>
Public Types | |
using | EffPeakSet = std::map< double, std::pair< double, double > > |
Container type for efficiency outputs. More... | |
Public Member Functions | |
SpectrumAnalysis () | |
default constructor More... | |
void | loadHists (string a_fname, int a_modID, double a_countTime=0) |
void | loadBackgroundHists (string a_fname, int a_modID, double a_countTime) |
loads GEANT4 output processed with GenAnalysis.generateSpectrumVeto() More... | |
void | addHists (string a_fname, int a_modID, double a_countTime=0) |
adds spectra to previously loaded spectra More... | |
void | addBackgroundHists (string a_fname, int a_modID, double a_countTime) |
void | subtractBackgroundSpectra () |
subtract background spectra from loaded spectra More... | |
void | setResolutionParameters (vector< double > a_params) |
void | fixResolution (bool a_fixRes) |
void | fixMean (bool a_fixMean) |
void | setVerbosity (int a_verbosity) |
void | rebinSpectrum (DetType a_detType, int a_detID, int a_elemID, int a_rebinFactor=2) |
rebins spectra More... | |
vector< PeakInfo > | FitPeaksMan (DetType a_detType, int a_detID, int a_elemID, double a_lower, double a_higher, vector< double > a_peakMeans, bool a_addBack=false, bool a_bgoVeto=false, bool a_checkPeakRes=true) |
vector< PeakInfo > | FitPeaksMan (TH1F *a_hist, double a_lower, double a_higher, vector< double > a_peakMeans, int a_polyDegree=0) |
vector< PeakInfo > | FitPeaksManPol1 (DetType a_detType, int a_detID, int a_elemID, double a_lower, double a_higher, vector< double > a_peakMeans, bool a_addBack=false, bool a_bgoVeto=false, bool a_checkPeakRes=true) |
same as FitPeaksMan but fit peaks with 1st degree polynomial background More... | |
void | printPeakFits () |
prints information about fitted peaks (mean, area, resolution, chi2/ndf) More... | |
vector< PeakInfo > | FitPeaksErf (DetType a_detType, int a_detID, int a_elemID, double a_lower, double a_higher, double a_peakMean, bool a_addBack=false, bool a_bgoVeto=false) |
vector< PeakInfo > | FitPeaksErf (TH1F *a_hist, double a_lower, double a_higher, double a_peakMean) |
vector< PeakInfo > | FitPeaks6111Double (TH1F *a_hist) |
EffPeakSet | Eu152Efficiency (DetType a_detType, int a_detID, int a_elemID, double a_activity, double a_countTime, double a_simBrTot=.2101, bool a_res=false, bool a_bgoVeto=false, bool a_addBack=false, bool a_draw=false) |
EffPeakSet | Eu152Efficiency (TH1F *a_hist, double a_activity, double a_countTime, double a_simBrTot=.2101, bool a_res=false, bool a_draw=false) |
EffPeakSet | Co56Efficiency (TH1F *a_hist, double a_activity, double a_countTime, double a_simBrTot=.9993999, bool a_res=false, bool a_draw=false) |
EffPeakSet | Ga66Efficiency (TH1F *a_hist, double a_activity, double a_countTime, int multi_peaking=0, double a_simBrTot=.37, bool a_res=false, bool a_draw=false) |
EffPeakSet | Cl35Efficiency (TH1F *a_hist, double a_activity, double a_countTime, bool double_peak=false, double a_simBrTot=1.0, bool a_res=false, bool a_draw=false) |
EffPeakSet | createEffPeakSet (string infilename) |
vector< double > | calcEffCurve (EffPeakSet const &a_ps, string a_fitType) const |
void | calcAddBackFactor () |
map< int, TH1 * > | getHists () |
returns m_hists, useful for drawing More... | |
map< int, vector< TH1 * > > | getCloverHists () |
TH1 * | getHist (DetType a_detType, int a_detID, int a_elemID=0, bool a_addBack=false, bool a_bgoVeto=false) |
map< int, map< double, PeakInfo > > | getPeakFits () |
vector< double > | ChannelResolution (DetType a_detType, int a_detID, int a_elemID=0) |
creates plot of resolution vs energy More... | |
int | autoEu152EnergyCalibration (int a_channel, int a_guess=5000) |
int | autoEu152EnergyCalibration (TH1 *a_hist, int a_guess=5000) |
int | autoEu152EnergyCalibration1408Guess (int a_channel, int a_guess) |
int | autoEu152EnergyCalibration1408Guess (TH1 *a_hist, int a_guess) |
void | removePeakFit (DetType a_detType, int a_detID, int a_elemID, double a_energy) |
removes last peak in m_peakFits More... | |
void | setUpMinimizer () |
double | fitPeakConstrained (const double *a_params) |
std::vector< double > | fitSTOFBandProjection (TH1F *a_histogram, double a_minLight, double a_maxLight, vector< double > a_peakCentroid, int a_polOrder) |
SpectrumAnalysis () | |
default constructor More... | |
void | loadHists (string a_fname, int a_modID, double a_countTime=0) |
void | loadSimHists (string a_fname) |
loads GEANT4 output processed with GenAnalysis.generateSpectrumVeto() More... | |
void | loadBackgroundHists (string a_fname, int a_modID, double a_countTime) |
loads a spectrum for background subtraction More... | |
void | addHists (string a_fname, int a_modID, double a_countTime=0) |
adds spectra to previously loaded spectra More... | |
void | addBackgroundHists (string a_fname, int a_modID, double a_countTime) |
void | subtractBackgroundSpectra () |
subtract background spectra from loaded spectra More... | |
void | rebinSpectrum (int a_channel, int a_rebinFactor=2, bool a_fullClover=false) |
rebins spectra More... | |
vector< Peak > | FitPeaksMan (int a_channel, double a_lower, double a_higher, vector< double > a_peakMeans, bool a_fullClover=false, bool a_addBack=false, bool a_checkPeakRes=true) |
vector< Peak > | FitPeaksManPol1 (int a_channel, int a_lower, int a_higher, vector< double > a_peakMeans, bool a_checkPeakRes=true, bool a_fullClover=false, bool a_addBack=false) |
same as aboe but fit peaks with 1st degree polynomial background More... | |
void | printPeakFits () |
prints information about fitted peaks (mean, area, resolution, chi2/ndf) More... | |
vector< Peak > | FitPeaksErf (int a_channel, double a_lower, double a_higher, int a_numPeaks=1, bool a_fullClover=false, bool a_addBack=false) |
map< double, std::pair< double, double > > | Eu152Efficiency (int a_channel, double a_activity, double a_countTime, double a_simBrTot=.2101, bool a_res=false, bool a_fullClover=false, bool a_addBack=false, bool a_draw=false) |
void | calcAddBackFactor () |
map< double, std::pair< double, double > > | U235Efficiency (int a_channel, double a_activity, double a_activityErr, double a_countTime) |
map< int, TH1 * > | getHists () |
returns m_hists, useful for drawing More... | |
map< int, vector< TH1 * > > | getCloverHists () |
map< int, vector< Peak > > | getPeakFits () |
void | ChannelResolution (int a_channel) |
creates plot of resolution vs energy More... | |
int | autoEu152EnergyCalibration (int a_channel) |
void | removeLastPeak (int a_channel) |
removes last peak in m_peakFits More... | |
double | fitPeakConstrained (const double *a_params) |
Static Public Member Functions | |
static Double_t | totalFit (Double_t *x, Double_t *par) |
https://doi.org/10.1016/S0168-9002(98)00778-5 More... | |
static Double_t | fullGeFit (Double_t *x, Double_t *par) |
Public Attributes | |
map< DetType, map< int, map< int, TH1 * > > > | m_histsD |
using SpectrumAnalysis::EffPeakSet = std::map<double, std::pair<double, double> > |
Container type for efficiency outputs.
SpectrumAnalysis::SpectrumAnalysis | ( | ) |
default constructor
SpectrumAnalysis::SpectrumAnalysis | ( | ) |
default constructor
void SpectrumAnalysis::addBackgroundHists | ( | string | a_fname, |
int | a_modID, | ||
double | a_countTime | ||
) |
void SpectrumAnalysis::addBackgroundHists | ( | string | a_fname, |
int | a_modID, | ||
double | a_countTime | ||
) |
void SpectrumAnalysis::addHists | ( | string | a_fname, |
int | a_modID, | ||
double | a_countTime = 0 |
||
) |
adds spectra to previously loaded spectra
void SpectrumAnalysis::addHists | ( | string | a_fname, |
int | a_modID, | ||
double | a_countTime = 0 |
||
) |
adds spectra to previously loaded spectra
int SpectrumAnalysis::autoEu152EnergyCalibration | ( | int | a_channel | ) |
attempts to generate an energy calibration from Eu152 data when rootFileBasicHistogrammer file is loaded assumes biggest peak is either 121.8, 344.3, or 1408 keV very much a W.I.P. use with caution
int SpectrumAnalysis::autoEu152EnergyCalibration | ( | int | a_channel, |
int | a_guess = 5000 |
||
) |
attempts to generate an energy calibration from Eu152 data when rootFileBasicHistogrammer file is loaded assumes biggest peak is either 121.8, 344.3, or 1408 keV very much a W.I.P. use with caution
int SpectrumAnalysis::autoEu152EnergyCalibration | ( | TH1 * | a_hist, |
int | a_guess = 5000 |
||
) |
int SpectrumAnalysis::autoEu152EnergyCalibration1408Guess | ( | int | a_channel, |
int | a_guess | ||
) |
int SpectrumAnalysis::autoEu152EnergyCalibration1408Guess | ( | TH1 * | a_hist, |
int | a_guess | ||
) |
void SpectrumAnalysis::calcAddBackFactor | ( | ) |
produces a plot of Add-back factor vs. gamma energy for Eu-152 spectra currently hard-coded to do Clover 0 and Clover 1
since the add back factor is a ratio, don't need accurate source activity, count time, etc. clover 0
void SpectrumAnalysis::calcAddBackFactor | ( | ) |
produces a plot of Add-back factor vs. gamma energy for Eu-152 spectra currently hard-coded to do Clover 0 and Clover 1
vector< double > SpectrumAnalysis::calcEffCurve | ( | EffPeakSet const & | a_ps, |
string | a_fitType | ||
) | const |
Calculates efficiency curve on a given peak set from SpectrumAnalysis::Eu152Efficiency returns efficiency parameteres fitType: Which fit function to use, debertin or lin (see Kis paper cited in the totalFit and fullGeFit functions)
vector< double > SpectrumAnalysis::ChannelResolution | ( | DetType | a_detType, |
int | a_detID, | ||
int | a_elemID = 0 |
||
) |
creates plot of resolution vs energy
void SpectrumAnalysis::ChannelResolution | ( | int | a_channel | ) |
creates plot of resolution vs energy
SpectrumAnalysis::EffPeakSet SpectrumAnalysis::Cl35Efficiency | ( | TH1F * | a_hist, |
double | a_activity, | ||
double | a_countTime, | ||
bool | double_peak = false , |
||
double | a_simBrTot = 1.0 , |
||
bool | a_res = false , |
||
bool | a_draw = false |
||
) |
calculates efficiency from an Cl-35(n,gamma) calibrated spectrum produces a graph of efficiency activity in mciroCurie, countTime in seconds Intensities (in the form of cross section, aka absolute intensity per 100 neutron captures) from A=36 Nuclear Data Sheets returns map of energy: area, area uncertainty If using this for relative efficiency to scale to an absolute source, just use an arbitrary value for the activity
gamma energies, branching ratios, BR uncertainties
SpectrumAnalysis::EffPeakSet SpectrumAnalysis::Co56Efficiency | ( | TH1F * | a_hist, |
double | a_activity, | ||
double | a_countTime, | ||
double | a_simBrTot = .9993999 , |
||
bool | a_res = false , |
||
bool | a_draw = false |
||
) |
calculates efficiency from an Co-56 calibrated spectrum produces a graph of efficiency activity in mciroCurie, countTime in seconds branching ratios (intensities) from A=56 Nuclear Data Sheets returns map of energy: area, area uncertainty doesn't fit all Co-56 peaks (but could) If using this for relative efficiency to scale to an absolute source, just use an arbitrary value for the activity
gamma energies, branching ratios, BR uncertainties
SpectrumAnalysis::EffPeakSet SpectrumAnalysis::createEffPeakSet | ( | string | infilename | ) |
SpectrumAnalysis::EffPeakSet SpectrumAnalysis::Eu152Efficiency | ( | DetType | a_detType, |
int | a_detID, | ||
int | a_elemID, | ||
double | a_activity, | ||
double | a_countTime, | ||
double | a_simBrTot = .2101 , |
||
bool | a_res = false , |
||
bool | a_bgoVeto = false , |
||
bool | a_addBack = false , |
||
bool | a_draw = false |
||
) |
calculates efficiency from an Eu-152 calibrated spectrum produces a graph of efficiency activity in mciroCurie, countTime in seconds branching ratios from Knoll 3rd edition page 447 returns map of energy: area, area uncertainty doesn't fit all Eu-152 peaks (but could)
map< double, std::pair< double, double > > SpectrumAnalysis::Eu152Efficiency | ( | int | a_channel, |
double | a_activity, | ||
double | a_countTime, | ||
double | a_simBrTot = .2101 , |
||
bool | a_res = false , |
||
bool | a_fullClover = false , |
||
bool | a_addBack = false , |
||
bool | a_draw = false |
||
) |
calculates efficiency from an Eu-152 calibrated spectrum produces a graph of efficiency activity in mciroCurie, countTime in seconds branching ratios from Knoll 3rd edition page 447 returns map of energy: area, area uncertainty doesn't fit all Eu-152 peaks (but could)
gamma energies, branching ratios, BR uncertainties
SpectrumAnalysis::EffPeakSet SpectrumAnalysis::Eu152Efficiency | ( | TH1F * | a_hist, |
double | a_activity, | ||
double | a_countTime, | ||
double | a_simBrTot = .2101 , |
||
bool | a_res = false , |
||
bool | a_draw = false |
||
) |
gamma energies, branching ratios, BR uncertainties
double SpectrumAnalysis::fitPeakConstrained | ( | const double * | a_params | ) |
set-up the fit function
calculate chi2 between fit and histogram
penalize for distance to expected width(s)
double SpectrumAnalysis::fitPeakConstrained | ( | const double * | a_params | ) |
vector< PeakInfo > SpectrumAnalysis::FitPeaks6111Double | ( | TH1F * | a_hist | ) |
estimate amplitude and background
estimate amplitude and background
containers for fit results
set up the minimizer with initial conditions
do the minimization
get the results – need to check if minimizer actually succeeds?
save fit results
vector< PeakInfo > SpectrumAnalysis::FitPeaksErf | ( | DetType | a_detType, |
int | a_detID, | ||
int | a_elemID, | ||
double | a_lower, | ||
double | a_higher, | ||
double | a_peakMean, | ||
bool | a_addBack = false , |
||
bool | a_bgoVeto = false |
||
) |
fits peaks using the full RadWare fit function currently only works for single peaks (a_numPeaks is meaningless)
vector< Peak > SpectrumAnalysis::FitPeaksErf | ( | int | a_channel, |
double | a_lower, | ||
double | a_higher, | ||
int | a_numPeaks = 1 , |
||
bool | a_fullClover = false , |
||
bool | a_addBack = false |
||
) |
fits peaks using the full RadWare fit function currently only works for single peaks (a_numPeaks is meaningless)
vector< PeakInfo > SpectrumAnalysis::FitPeaksErf | ( | TH1F * | a_hist, |
double | a_lower, | ||
double | a_higher, | ||
double | a_peakMean | ||
) |
vector< PeakInfo > SpectrumAnalysis::FitPeaksMan | ( | DetType | a_detType, |
int | a_detID, | ||
int | a_elemID, | ||
double | a_lower, | ||
double | a_higher, | ||
vector< double > | a_peakMeans, | ||
bool | a_addBack = false , |
||
bool | a_bgoVeto = false , |
||
bool | a_checkPeakRes = true |
||
) |
takes in channel, upper and lower bounds over which to fit a peak fits with linear (0 degree polynomial) background stores fit in m_peakFits a_peakMeans -> used to seed peak means for fitting doublets put larger peak first in list a_fullClover -> will fit clover spectra (a_channel then is Clover ID) a_addBack -> will fit either added-back or non clover spectra a_checkPeakRes -> only stores fit is resolution is reasonable passes relevant hists to FitPeaksMan and saves fits to m_peakFits
vector< Peak > SpectrumAnalysis::FitPeaksMan | ( | int | a_channel, |
double | a_lower, | ||
double | a_higher, | ||
vector< double > | a_peakMeans, | ||
bool | a_fullClover = false , |
||
bool | a_addBack = false , |
||
bool | a_checkPeakRes = true |
||
) |
takes in channel, upper and lower bounds over which to fit a peak fits with linear (0 degree polynomial) background stores fit in m_peakFits a_peakMeans -> used to seed peak means for fitting doublets a_fullClover -> will fit clover spectra (a_channel then is Clover ID) a_addBack -> will fit either added-back or non clover spectra a_checkPeakRes -> only stores fit is resolution is reasonable
get parameters for seeding the fit
seed fit
save the fitted peak info
save the fitted peak info
r1->Ndf();
vector< PeakInfo > SpectrumAnalysis::FitPeaksMan | ( | TH1F * | a_hist, |
double | a_lower, | ||
double | a_higher, | ||
vector< double > | a_peakMeans, | ||
int | a_polyDegree = 0 |
||
) |
performs fit on a_hist a_polyDegree is degree of polynomial for background (=0, 1) can fit singlets, doublets, triplets
estimate amplitude and background
containers for fit results
expected width
gauss + constant background
seed fit with educated guesses
number of parameters to fit
location of sigma in parameter list (for penalty)
set up the minimizer with initial conditions
do the minimization
get the results – need to check if minimizer actually succeeds?
save fit results
vector< PeakInfo > SpectrumAnalysis::FitPeaksManPol1 | ( | DetType | a_detType, |
int | a_detID, | ||
int | a_elemID, | ||
double | a_lower, | ||
double | a_higher, | ||
vector< double > | a_peakMeans, | ||
bool | a_addBack = false , |
||
bool | a_bgoVeto = false , |
||
bool | a_checkPeakRes = true |
||
) |
same as FitPeaksMan but fit peaks with 1st degree polynomial background
vector< Peak > SpectrumAnalysis::FitPeaksManPol1 | ( | int | a_channel, |
int | a_lower, | ||
int | a_higher, | ||
vector< double > | a_peakMeans, | ||
bool | a_checkPeakRes = true , |
||
bool | a_fullClover = false , |
||
bool | a_addBack = false |
||
) |
same as aboe but fit peaks with 1st degree polynomial background
std::vector< double > SpectrumAnalysis::fitSTOFBandProjection | ( | TH1F * | a_histogram, |
double | a_minLight, | ||
double | a_maxLight, | ||
vector< double > | a_peakCentroid, | ||
int | a_polOrder | ||
) |
void SpectrumAnalysis::fixMean | ( | bool | a_fixMean | ) |
void SpectrumAnalysis::fixResolution | ( | bool | a_fixRes | ) |
fixes the resolution based on resolution params for peak fits sets m_fixRes, default is false
|
static |
Fitting function for efficiency curve Lin fit function [see z. kis NIMA (1998)] Good for 300 - 9700 keV https://doi.org/10.1016/S0168-9002(98)00778-5
SpectrumAnalysis::EffPeakSet SpectrumAnalysis::Ga66Efficiency | ( | TH1F * | a_hist, |
double | a_activity, | ||
double | a_countTime, | ||
int | multi_peaking = 0 , |
||
double | a_simBrTot = .37 , |
||
bool | a_res = false , |
||
bool | a_draw = false |
||
) |
calculates efficiency from an Ga-66 (from 66Zn(d,2n)) calibrated spectrum produces a graph of efficiency activity in mciroCurie, countTime in seconds branching ratios (intensities) from A=66 Nuclear Data Sheets returns map of energy: area, area uncertainty If using this for relative efficiency to scale to an absolute source, just use an arbitrary value for the activity
gamma energies, branching ratios, BR uncertainties
map< int, vector< TH1 * > > SpectrumAnalysis::getCloverHists | ( | ) |
map<int,vector<TH1*> > SpectrumAnalysis::getCloverHists | ( | ) |
TH1 * SpectrumAnalysis::getHist | ( | DetType | a_detType, |
int | a_detID, | ||
int | a_elemID = 0 , |
||
bool | a_addBack = false , |
||
bool | a_bgoVeto = false |
||
) |
map< int, TH1 * > SpectrumAnalysis::getHists | ( | ) |
returns m_hists, useful for drawing
low energy efficiency from U235 decays activity in Bq
map<int, TH1*> SpectrumAnalysis::getHists | ( | ) |
returns m_hists, useful for drawing
map< int, vector< Peak > > SpectrumAnalysis::getPeakFits | ( | ) |
map<int, vector<Peak> > SpectrumAnalysis::getPeakFits | ( | ) |
void SpectrumAnalysis::loadBackgroundHists | ( | string | a_fname, |
int | a_modID, | ||
double | a_countTime | ||
) |
loads GEANT4 output processed with GenAnalysis.generateSpectrumVeto()
loads a spectrum for background subtraction
void SpectrumAnalysis::loadBackgroundHists | ( | string | a_fname, |
int | a_modID, | ||
double | a_countTime | ||
) |
loads a spectrum for background subtraction
void SpectrumAnalysis::loadHists | ( | string | a_fname, |
int | a_modID, | ||
double | a_countTime = 0 |
||
) |
loads histograms (with >10 counts) from file containing histograms currently only loads histograms generated from rootFileBasicHistogrammer or "calibrated hists" (GenesisAnalysis.buildGammaSpectra()) stores hists in m_hists --> this map is cleared at the top of the function m_hists is indexed by channel - hist name and channel are printed if the file if CalibratedSpectra with full clover / add-back/BGO etc. those hists are stored in m_cloverHists
void SpectrumAnalysis::loadHists | ( | string | a_fname, |
int | a_modID, | ||
double | a_countTime = 0 |
||
) |
loads histograms (with >10 counts) from file containing histograms currently only loads histograms generated from "basic histogrammer" or "calibrated hists" (GenCoinAnalysis.buildGammaSpectra())
void SpectrumAnalysis::loadSimHists | ( | string | a_fname | ) |
loads GEANT4 output processed with GenAnalysis.generateSpectrumVeto()
void SpectrumAnalysis::printPeakFits | ( | ) |
prints information about fitted peaks (mean, area, resolution, chi2/ndf)
void SpectrumAnalysis::printPeakFits | ( | ) |
prints information about fitted peaks (mean, area, resolution, chi2/ndf)
void SpectrumAnalysis::rebinSpectrum | ( | DetType | a_detType, |
int | a_detID, | ||
int | a_elemID, | ||
int | a_rebinFactor = 2 |
||
) |
rebins spectra
void SpectrumAnalysis::rebinSpectrum | ( | int | a_channel, |
int | a_rebinFactor = 2 , |
||
bool | a_fullClover = false |
||
) |
rebins spectra
void SpectrumAnalysis::removeLastPeak | ( | int | a_channel | ) |
removes last peak in m_peakFits
void SpectrumAnalysis::removePeakFit | ( | DetType | a_detType, |
int | a_detID, | ||
int | a_elemID, | ||
double | a_energy | ||
) |
removes last peak in m_peakFits
void SpectrumAnalysis::setResolutionParameters | ( | vector< double > | a_params | ) |
set the expected peak resolution for constraining peak fits parameterizing resolution as FWHM = sqrt([0]*E_gamma + [1])
void SpectrumAnalysis::setUpMinimizer | ( | ) |
need to add check for Minuit2
void SpectrumAnalysis::setVerbosity | ( | int | a_verbosity | ) |
void SpectrumAnalysis::subtractBackgroundSpectra | ( | ) |
subtract background spectra from loaded spectra
void SpectrumAnalysis::subtractBackgroundSpectra | ( | ) |
subtract background spectra from loaded spectra
|
static |
https://doi.org/10.1016/S0168-9002(98)00778-5
Fitting function for efficiency curve debertin fit function [see z. kis NIMA (1998)] Good for 120-1400 keV
map< double, std::pair< double, double > > SpectrumAnalysis::U235Efficiency | ( | int | a_channel, |
double | a_activity, | ||
double | a_activityErr, | ||
double | a_countTime | ||
) |
low energy efficiency from U235 decays activity in Bq
map<DetType, map<int, map<int,TH1*> > > SpectrumAnalysis::m_histsD |