Berkeley Nuclear Data Software
GenesisNeutronSinglesAna.h
Go to the documentation of this file.
1 #ifndef _GEN_NEUTRON_SINGLES_ANA_H_
2 #define _GEN_NEUTRON_SINGLES_ANA_H_
3 //ROOT includes
4 #include "TH1.h"
5 #include "GammaProductionAna.h"
6 #include "FluxMatrixAna.h"
7 #include "TALYSUtils.h"
8 #include "TH2.h"
9 #include "TMatrixD.h"
10 #include "TFitResult.h"
11 #include "TRandom3.h"
12 #include "TALYSUtils.h"
13 #include "TTree.h"
14 //c++includes
15 #include <cstdint>
16 #include <vector>
17 #include <utility>
18 #include <deque>
19 using std::vector;
20 #include <map>
21 using std::map;
22 using std::pair;
23 
24 // #include "../../BasicSupport/external/eigen/Eigen/Dense"
25 #include <Eigen/Dense>
28 
30 {
31 public:
36  TALYSUtils a_talysUtils);
37  void addFluxMatrix(FluxAna a_fluxMat);
38  void addTALYSUtils(TALYSUtils a_talysUtils);
41  void readTotalNeutronTOFHists(string a_fileName,
42  string a_fileNameBKG,
43  double a_backgroundScaler);
44  void readTotalNeutronTOFTree(string a_fileName);
45  void readTotalNeutronTOFTreeBKG(string a_fileNameBKG);
46  void subtractBackground(double a_bkgScalar);
49  void readNeutronResponseFunctions(string a_fileNameTarget,
50  double a_numSim = 2.e9);
52  void readAngularNeutronResponseFunctions(string a_fileNameTarget,
53  double a_numSim = 2.e9);
54  void useAngularResponseFunctions(bool a_useAngularRespFuncs);
55  void setRespFuncNumEnerBins(int a_numEnerBins);
56  void setRespFuncNumAngleBins(int a_numAngleBins);
57  void setRespFuncNumLYBins(int a_numLYBins);
58  void setRespFuncMaxEner(double a_maxEnergy);
59  void setTotCharge(double a_totCharge);
60  void setTargetRhoR(double a_rhoR);
61  void setTargetSolidAngle(double a_solidAngle);
63  void readDetDistAng(string a_configFileName);
64  double getDetectorDistance(int a_detID);
65  double getDetectorAngle(int a_detID);
66 
67  void readENDFEventTree(string a_fileName);
68 
69  void readYAHFCEventTree(string a_fileName);
73  // should return vector (with STOF errors)
74  vector<Eigen::MatrixXf> plotTALYSTotalTOFvsEnOut(int a_detID, bool a_draw=1);
75  vector<Eigen::MatrixXf> plotENDFTotalTOFvsEnOut(int a_detID, bool a_draw=1);
76  // vector<Eigen::MatrixXf> plotYAHFCTotalTOFvsEnOut(int a_detID, bool a_draw=1);
79  vector<Eigen::MatrixXf> convolveTotalTOFResponse(int a_detID);
80  vector<Eigen::MatrixXf> convolveTotalTOFResponse(double a_angle,
81  double a_width);
82  TH2F* getModelResponseHist(int a_detID);
83  TH2F* getModelResponseHist(double a_angle, double a_width);
85  double calcSliceChi2(int a_detID, double a_tof);
86  double calcSliceChi2(double a_angle, double a_width, double a_tof);
88  double getFullChi2(int a_detID);
89  double getFullChi2(double a_angle, double a_width);
91  void setForwardModelDetectors(vector<int> a_dets);
94  void setForwardModelAngles(vector<std::pair<double,double>> a_angles);
96  void forwardModel();
98  double talysModelFit(const double* a_params);
99 
100  int readTALYSOutput();
103  void plotTotalComp(int a_detID);
104  void plotTotalComp(double a_angle, double a_width);
106  TH2F* getExpHists(int a_detID);
107  TH2F* getExpHists(double a_angle, double a_width);
109  void plot1DComp(int a_detID, double a_minLight);
111  void plotSliceComp(int a_detID, double a_tof);
112  void plotSliceComp(double a_angle,
113  double a_width,
114  double a_tof);
115  TH2F* getResponseHist(int a_detID);
116  TH2F* getResponseHist(double a_angle,
117  double a_width);
119  vector<double> getCovarianceMatrix(std::ostream& stream);
120 private:
122  map<int, TH2F*> m_hists_bkg;
124  map<int, TH2F*> m_hists_orig;
126  map<int, TH2F*> m_hists_blank;
128  map<int, TH2F*> m_respFuncs;
129  map<int, Eigen::MatrixXf> m_respFuncsMat;
130  map<int, Eigen::MatrixXf> m_respFuncsMat2;
131  map<int, Eigen::MatrixXf> m_respFuncsMatUnc;
133  map<int, vector<double>> m_detDistAng;
134  double m_bkgScalar;
135  double m_totalCharge;
136  double m_targetRhoR;
137  double m_targetSolidAngle;
138  // vector<Eigen::MatrixXf> m_currModelMats;
139 
140  FluxAna m_fluxMat;
141  TALYSUtils m_talysUtils;
142 
143  vector<double> m_flux1D;
144  vector<double> m_flux1D_unc;
145  vector<double> m_flux1D_binEdges;
146 
147  TTree* m_endfEvents;
148  TTree* m_yahfcEvents;
149  bool m_useAngularRespFuncs;
150 
151  TH2F* m_totalExpHists;
152 
153  int m_numLYBins;
154  int m_numTTOFBins;
155  int m_numEnerBins;
156  int m_numAngleBins;
157  double m_maxEnergy;
158 
159  vector<int> m_forwardModelDetIDs;
160  vector<std::pair<double,double>> m_forwardModelDetAngles;
161 public:
162  ROOT::Math::Minimizer* m_minimum;
163  vector<Eigen::MatrixXf> m_currModelMats;
164  std::map<string, int> m_talysParams;
165 
166  int m_tofWidth = 0;
167 };
168 
169 #endif
Definition: FluxMatrixAna.h:35
Definition: GenesisNeutronSinglesAna.h:30
void setTargetSolidAngle(double a_solidAngle)
Definition: GenesisNeutronSinglesAna.cpp:326
vector< Eigen::MatrixXf > plotTALYSTotalTOFvsEnOut(int a_detID, bool a_draw=1)
Definition: GenesisNeutronSinglesAna.cpp:370
void setTargetRhoR(double a_rhoR)
Definition: GenesisNeutronSinglesAna.cpp:322
double talysModelFit(const double *a_params)
chi2 for forward model
Definition: GenesisNeutronSinglesAna.cpp:1225
void setRespFuncNumLYBins(int a_numLYBins)
Definition: GenesisNeutronSinglesAna.cpp:310
void setForwardModelDetectors(vector< int > a_dets)
set the detectors IDs for Chi2 experiment/model comparisons
Definition: GenesisNeutronSinglesAna.cpp:1181
void readYAHFCEventTree(string a_fileName)
Definition: GenesisNeutronSinglesAna.cpp:692
double calcSliceChi2(int a_detID, double a_tof)
calculate chi2 between model and experiment for a tof slice
Definition: GenesisNeutronSinglesAna.cpp:814
vector< Eigen::MatrixXf > convolveTotalTOFResponse(int a_detID)
Definition: GenesisNeutronSinglesAna.cpp:721
void readNeutronResponseFunctions(string a_fileNameTarget, double a_numSim=2.e9)
Definition: GenesisNeutronSinglesAna.cpp:226
void readTotalNeutronTOFHists(string a_fileName, string a_fileNameBKG, double a_backgroundScaler)
load the data - from buildTOFHists
Definition: GenesisNeutronSinglesAna.cpp:103
void setRespFuncMaxEner(double a_maxEnergy)
Definition: GenesisNeutronSinglesAna.cpp:314
int readTALYSOutput()
Definition: GenesisNeutronSinglesAna.cpp:1254
void useAngularResponseFunctions(bool a_useAngularRespFuncs)
Definition: GenesisNeutronSinglesAna.cpp:297
void setRespFuncNumEnerBins(int a_numEnerBins)
Definition: GenesisNeutronSinglesAna.cpp:302
void plot1DComp(int a_detID, double a_minLight)
plot TOF for experiment and model starting at a minimum light
Definition: GenesisNeutronSinglesAna.cpp:984
void plotTotalComp(int a_detID)
plot TOF vs light for experiment and model
Definition: GenesisNeutronSinglesAna.cpp:953
void readDetDistAng(string a_configFileName)
builds a map of detector ID, distance and angle
Definition: GenesisNeutronSinglesAna.cpp:330
double getDetectorDistance(int a_detID)
Definition: GenesisNeutronSinglesAna.cpp:341
vector< Eigen::MatrixXf > m_currModelMats
Definition: GenesisNeutronSinglesAna.h:163
void readAngularNeutronResponseFunctions(string a_fileNameTarget, double a_numSim=2.e9)
sets m_useAngularRespFuncs to true
Definition: GenesisNeutronSinglesAna.cpp:259
void readENDFEventTree(string a_fileName)
Definition: GenesisNeutronSinglesAna.cpp:548
void plotSliceComp(int a_detID, double a_tof)
plot light for a given TOF bin for experiment and model
Definition: GenesisNeutronSinglesAna.cpp:1027
void forwardModel()
run the forward model minimization
Definition: GenesisNeutronSinglesAna.cpp:1189
void setForwardModelAngles(vector< std::pair< double, double >> a_angles)
Definition: GenesisNeutronSinglesAna.cpp:1185
std::map< string, int > m_talysParams
Definition: GenesisNeutronSinglesAna.h:164
int m_tofWidth
Definition: GenesisNeutronSinglesAna.h:166
void readTotalNeutronTOFTreeBKG(string a_fileNameBKG)
Definition: GenesisNeutronSinglesAna.cpp:179
TH2F * getModelResponseHist(int a_detID)
Definition: GenesisNeutronSinglesAna.cpp:775
ROOT::Math::Minimizer * m_minimum
Definition: GenesisNeutronSinglesAna.h:162
TH2F * getResponseHist(int a_detID)
Definition: GenesisNeutronSinglesAna.cpp:1260
void addFluxMatrix(FluxAna a_fluxMat)
Definition: GenesisNeutronSinglesAna.cpp:71
TH2F * getExpHists(int a_detID)
returns experimental total TOF vs light histogram
Definition: GenesisNeutronSinglesAna.cpp:915
vector< Eigen::MatrixXf > plotENDFTotalTOFvsEnOut(int a_detID, bool a_draw=1)
Definition: GenesisNeutronSinglesAna.cpp:553
void readTotalNeutronTOFTree(string a_fileName)
Definition: GenesisNeutronSinglesAna.cpp:151
void subtractBackground(double a_bkgScalar)
Definition: GenesisNeutronSinglesAna.cpp:207
double getDetectorAngle(int a_detID)
Definition: GenesisNeutronSinglesAna.cpp:355
vector< double > getCovarianceMatrix(std::ostream &stream)
plots the covariance matrix and returns the values
Definition: GenesisNeutronSinglesAna.cpp:1311
GenesisNeutronSinglesAna()
default constructor
Definition: GenesisNeutronSinglesAna.cpp:37
double getFullChi2(int a_detID)
chi2 for all tofs (draws too)
Definition: GenesisNeutronSinglesAna.cpp:877
void setTotCharge(double a_totCharge)
Definition: GenesisNeutronSinglesAna.cpp:318
TALYSUtils * getTALYSUtils()
Definition: GenesisNeutronSinglesAna.cpp:99
void setRespFuncNumAngleBins(int a_numAngleBins)
Definition: GenesisNeutronSinglesAna.cpp:306
void addTALYSUtils(TALYSUtils a_talysUtils)
Definition: GenesisNeutronSinglesAna.cpp:95
Definition: TALYSUtils.h:62