1 #ifndef _GAMMA_PRODUCTION_ANALYSIS_H_
2 #define _GAMMA_PRODUCTION_ANALYSIS_H_
8 #include "TFitResult.h"
25 #include <Eigen/Dense>
69 double a_timeResolution,
71 double a_timeBinWidth=-1);
81 std::string a_fitType=
"Debertin",
82 bool a_readEffCovMat =
false);
95 void addTree(std::string a_expTree);
100 string a_outFileName);
103 string a_outFileName);
116 double a_gammaEnergy,
118 std::string a_dataSetName =
"");
142 vector<double>
calcGammaEff(
int a_detID,
int a_elementID,
double a_energy);
150 double a_thresholdAdder);
162 int a_detID,
int a_elementID,
187 map<double, std::pair<double,double>>
getTotExpYield(
double a_gammaEnergy,
188 int a_detID,
int a_elementID,
189 double a_tofWidth=-1,
196 Eigen::VectorXf a_crossSection);
198 Eigen::VectorXf a_crossSectionUnc,
199 Eigen::VectorXf a_crossSection);
208 bool a_calcUnc=
false,
209 bool a_useEXFOR=
false,
210 double a_thresholdAdder=0.);
215 double plotComp(
double a_gammaEnergy,
218 bool a_useEXFOR=
false,
219 double a_normalize=1,
220 bool a_drawEnAxis=
true,
227 bool a_useEXFOR=
false,
228 bool a_drawEnAxis=
true,
249 double a_thresholdAdder=0.,
250 double a_normalize=0,
258 double a_gammaEnergy,
264 double a_gammaEnergy,
290 double a_smoothness=1.e-2,
292 bool a_useEXFOR=
false);
303 bool a_runECIS=
true);
308 vector<double> a_gammaEnergy,
313 vector<double> a_gammaEnergy,
322 bool a_calcUnc=
false,
323 double a_thresholdAdder=0);
332 map<int, PeakInfo>
getPeakFits(
double a_gammaE,
int a_detID,
int a_elemID);
336 Eigen::MatrixXf m_fullFluxMat;
337 Eigen::MatrixXf m_fullFluxMatErr;
341 vector<double> m_ener0BinEdges;
343 vector<double> m_enerBinWidths;
345 vector<double> m_enerBinCenters;
348 map<int,map<int,TH2F*>> m_tofEgamma0;
349 map<int,map<int,TH2F*>> m_tofEgammaBKG;
351 map<int,map<int,vector<double>>> m_effParams;
353 map<double,vector<std::pair<std::string,std::string>>> m_eGammaLevels;
354 map<double, vector<double>> m_eGammaThreshold;
356 std::string m_talysPath;
358 double m_rhoR = 5.283e21;
359 double m_solidAngle = 3.67e-5;
360 double m_solidAngleDet = 1;
362 double m_totalCharge;
365 double m_timeResolution;
368 map<double, map<int, map<int, map<int, PeakInfo>>>> m_peakFits;
370 map<int, map<int, Eigen::MatrixXf>> m_gammaEffCovMats;
372 map<double, std::pair<vector<double>, vector<double>>> m_exforData;
373 map<double, std::string> m_exforDataSetNames;
374 map<string, map<double, vector<DataValuePair>>> m_exforDataAll;
375 bool m_hasGammaEffUnc;
376 bool m_hasFluxUncMat;
377 bool m_useTALYSscaler;
385 map<int, map<int,map<double, vector<DataValuePair>>>> m_unwrappedXSecs;
386 map<double, vector<DataValuePair>> m_currUnwrappedData;
387 map<double, vector<int>> m_currUnwrappedDataIndex;
389 TRandom3* m_rand_gen;
393 vector<double>
calcNonWrappedEners(vector<double> a_cumulativeCounts, vector<double> a_eners);
397 vector<double>
getEnergyPoints(
double a_gammaEnergy,
int a_coinGammaID=0);
Definition: GammaProductionAna.h:30
double m_xVal
Definition: GammaProductionAna.h:33
double m_yVal
Definition: GammaProductionAna.h:36
double m_xUnc
Definition: GammaProductionAna.h:34
DataValuePair()
Definition: GammaProductionAna.cpp:40
double m_xUncUp
Definition: GammaProductionAna.h:35
friend std::ostream & operator<<(std::ostream &os, const DataValuePair &a_dataPair)
Definition: GammaProductionAna.cpp:48
friend std::istream & operator>>(std::istream &a_istream, DataValuePair &a_dataPair)
Definition: GammaProductionAna.cpp:62
double m_yUnc
Definition: GammaProductionAna.h:37
Definition: FluxMatrixAna.h:35
Definition: GammaProductionAna.h:43
void setTargetSolidAngle(double a_solidAngle)
sr
Definition: GammaProductionAna.cpp:480
void addTree(std::string a_expTree)
Definition: GammaProductionAna.cpp:792
Eigen::VectorXf getEXFORCrossSection(double a_gammaEnergy, bool a_calcUnc=false, double a_thresholdAdder=0)
Definition: GammaProductionAna.cpp:1656
void readGammaEffParams(std::string a_effParamFile, std::string a_fitType="Debertin", bool a_readEffCovMat=false)
Definition: GammaProductionAna.cpp:1218
vector< Eigen::VectorXf > m_currDataUnc
Definition: GammaProductionAna.h:406
vector< std::pair< double, double > > scanTALYSParameter(int a_parameterNum, vector< double > a_gammaEnergy, bool a_runECIS=true, int a_detID=1, int a_elementID=2)
Definition: GammaProductionAna.cpp:3842
ROOT::Math::Minimizer * m_minimum
Definition: GammaProductionAna.h:410
void readPeakFits(double a_gammaEnergy, int a_detID, int a_elementID)
Definition: GammaProductionAna.cpp:2278
double m_smoothness
Definition: GammaProductionAna.h:412
TChain * m_trees
Definition: GammaProductionAna.h:416
void setTargetRhoR(double a_rhoR)
Definition: GammaProductionAna.cpp:476
double forwardModelFit(const double *a_params)
fit function for above
Definition: GammaProductionAna.cpp:3599
void addFluxMatrix(FluxAna a_fluxAna)
Definition: GammaProductionAna.cpp:415
void buildHistsBKG(vector< int > a_cloverList, bool a_saveFile, string a_outFileName)
Definition: GammaProductionAna.cpp:973
bool m_hasFileBKG
Definition: GammaProductionAna.h:423
bool m_saveFits
Definition: GammaProductionAna.h:398
vector< Eigen::MatrixXf > m_currFluxMat
Definition: GammaProductionAna.h:403
vector< Eigen::VectorXf > m_currData
Definition: GammaProductionAna.h:405
void setNewPeakFit(double a_gammaEnergy, int a_detID, int a_elementID, int a_tof, PeakInfo a_peakInfo)
replace a peak fit with a new one
Definition: GammaProductionAna.cpp:2236
void plotSVD()
plot the flux matrix reconstructed from its SVD
Definition: GammaProductionAna.cpp:3222
void writePeakFits(double a_gammaEnergy, int a_detID, int a_elementID)
Definition: GammaProductionAna.cpp:2245
void addEXFORCrossSection(std::string a_fileName, double a_gammaEnergy, bool a_draw=false, std::string a_dataSetName="")
Definition: GammaProductionAna.cpp:1032
vector< double > calcNonWrappedEners(vector< double > a_cumulativeCounts, vector< double > a_eners)
Definition: GammaProductionAna.cpp:4130
void loadExpTOFvsEGamma(std::string a_expFile)
Eigen::VectorXf calculateYieldUnc(Eigen::MatrixXf a_fluxUncMat, Eigen::VectorXf a_crossSection)
Definition: GammaProductionAna.cpp:1621
bool m_hasFile
Definition: GammaProductionAna.h:418
void setupTALYSParams(std::string a_paramFile)
Definition: GammaProductionAna.cpp:3636
void addTreeBKG(std::string a_expTree)
Definition: GammaProductionAna.cpp:853
void setVerbosity(int a_verbosity)
Definition: GammaProductionAna.cpp:467
vector< double > calcGammaEff(int a_detID, int a_elementID, double a_energy)
Definition: GammaProductionAna.cpp:1294
TALYSUtils * getTALYSUtils()
Definition: GammaProductionAna.cpp:1369
map< double, std::pair< double, double > > getTotExpYield(double a_gammaEnergy, int a_detID, int a_elementID, double a_tofWidth=-1, bool a_draw=true, int a_plotType=0)
Definition: GammaProductionAna.cpp:1465
vector< Eigen::MatrixXf > m_currFluxUncMat
Definition: GammaProductionAna.h:404
NSDPhysicsEvents::CloverEvent * m_currentEventBKG
Definition: GammaProductionAna.h:424
int setupTALYSMinimizer(vector< double > a_gammaEnergy, int a_detID, int a_elementID)
Definition: GammaProductionAna.cpp:3769
void loadExpTOFvsEGamma(vector< std::string > a_expFiles)
void compDetectorElements(double a_gammaEnergy, int a_detID1, int a_elementID1, int a_detID2, int a_elementID2)
Definition: GammaProductionAna.cpp:2135
std::pair< int,int > m_currDetElemID
Definition: GammaProductionAna.h:407
void setRFPeriod(double a_RFPeriod)
[ns]
Definition: GammaProductionAna.cpp:490
void setSaveTALYSFits(bool a_saveFits)
save plots of GENESIS data vs TALYS generated by minimizer
Definition: GammaProductionAna.cpp:3640
PeakInfo getPeakArea(double a_tof, double a_tofWidth, int a_detID, int a_elementID, double a_energy, bool a_draw=0, bool a_fitBkg=1, bool a_drawBkg=0, bool a_saveFit=1)
Definition: GammaProductionAna.cpp:1378
void setupTALYSUtils(int a_ZID, int a_AID, string a_talysPath)
if default constuctor was used, this sets up the TALYS interface
Definition: GammaProductionAna.cpp:107
void noExpUnwrapTest(double a_gammaEnergy, int a_detID=0, int a_elementID=2, double a_alpha=1.)
Definition: GammaProductionAna.cpp:3106
SpectrumAnalysis m_specAna
refit peaks from getPeakArea
Definition: GammaProductionAna.h:325
vector< double > m_tempGammaEnergy
Definition: GammaProductionAna.h:409
bool m_ratio
Definition: GammaProductionAna.h:399
NSDPhysicsEvents::CloverEvent * m_currentEvent
Definition: GammaProductionAna.h:419
void setBackgroundScalar(double a_scalar)
normalization for background subtraction
Definition: GammaProductionAna.cpp:1190
GammaProductionAna()
default constructor
Definition: GammaProductionAna.cpp:68
vector< Eigen::MatrixXf > getFluxMatrix(double a_minEnergy)
calculates gamma ray uncertainties
Definition: GammaProductionAna.cpp:434
vector< double > getEnergyPoints(double a_gammaEnergy, int a_coinGammaID=0)
Definition: GammaProductionAna.cpp:2947
TH2F * buildFluxMatrix(std::string a_stofFluxFileName, double a_minEnergy, double a_maxEnergy, double a_flightPath, double a_timeResolution, double a_RFPeriod, double a_timeBinWidth=-1)
Definition: GammaProductionAna.cpp:114
double plotComp(double a_gammaEnergy, int a_detID, int a_elementID, bool a_useEXFOR=false, double a_normalize=1, bool a_drawEnAxis=true, bool a_draw=true)
Definition: GammaProductionAna.cpp:1773
double testForwardModel(double a_gammaEnergy, int a_detID, int a_elementID, double a_smoothness=1.e-2, bool a_draw=true, bool a_useEXFOR=false)
Definition: GammaProductionAna.cpp:3272
vector< DataValuePair > calcUnwrappedXSec(double a_gammaEnergy, int a_detID, int a_elementID, double a_thresholdAdder=0., double a_normalize=0, bool a_draw=true)
Definition: GammaProductionAna.cpp:2298
void talysForwardModel(vector< double > a_gammaEnergy, int a_detID, int a_elementID, bool a_scale=false, bool a_runECIS=true)
Chi-2 minimization on a set of TALYS parameters.
Definition: GammaProductionAna.cpp:3644
void setTotalCharge(double a_charge)
total charge from BCM [uC]
Definition: GammaProductionAna.cpp:472
map< int, PeakInfo > getPeakFits(double a_gammaE, int a_detID, int a_elemID)
Definition: GammaProductionAna.cpp:4111
void setTalysPath(std::string a_path)
path to directory where talys will be run
Definition: GammaProductionAna.cpp:1213
map< int, map< int, TH2F * > > m_tofEgamma
Definition: GammaProductionAna.h:329
vector< DataValuePair > calcUnwrappedXSec(map< double, std::pair< double, double >> a_expYields, double a_gammaEnergy, double a_threshold, bool a_normalize=0, bool a_draw=true)
void loadExpBKGData(vector< std::string > a_expFile)
stored in m_tofEgammaBKG
Definition: GammaProductionAna.cpp:502
void setDetSolidAngle(double a_solidAngle)
Definition: GammaProductionAna.cpp:485
std::vector< string > m_loadedTreesBKG
Definition: GammaProductionAna.h:422
TChain * m_treesBKG
Definition: GammaProductionAna.h:421
void setTimeResolution(double a_timeResolution)
sigma [ns]
Definition: GammaProductionAna.cpp:494
double talysModelFit(const double *a_params)
Definition: GammaProductionAna.cpp:3957
double plotRatio(double a_energy1, double a_energy2, int a_detID, int a_elementID, bool a_useEXFOR=false, bool a_drawEnAxis=true, bool a_draw=true)
ratio of gamma 1 over gamma 2
Definition: GammaProductionAna.cpp:1978
std::vector< string > m_loadedTrees
Definition: GammaProductionAna.h:417
Eigen::VectorXf convolveXSec(double a_gammaEnergy, int a_detID, int a_elementID, bool a_calcUnc=false, bool a_useEXFOR=false, double a_thresholdAdder=0.)
Definition: GammaProductionAna.cpp:1684
TH2F * getFluxHist()
Definition: GammaProductionAna.cpp:1373
vector< double > getEnergySpecLowerBinEdges()
returns m_energ0BinEdges
Definition: GammaProductionAna.cpp:4062
void readEGammaLevels(std::string a_lvlFile)
Definition: GammaProductionAna.cpp:1195
void testUnwrapping(double a_gammaEnergy, int a_detID, int a_elementID)
Definition: GammaProductionAna.cpp:2962
void writeNonWrappedXSec(double a_gammaE, int a_detID, int a_elemID)
Definition: GammaProductionAna.cpp:4066
std::map< string, int > m_talysParams
Definition: GammaProductionAna.h:328
TH1F * m_lastHist
Definition: GammaProductionAna.h:326
void setFlightPath(double a_flightPath)
neutron beam flight path [m]
Definition: GammaProductionAna.cpp:498
void buildHists(vector< int > a_cloverList, bool a_saveFile, string a_outFileName)
Definition: GammaProductionAna.cpp:914
Definition: NSDPhysicsEvents.h:110
Definition: SpectrumAnalysis.h:21
Definition: SpectrumAnalysis.h:40
Definition: TALYSUtils.h:62