Berkeley Nuclear Data Software
FluxMatrixAna.h
Go to the documentation of this file.
1 #ifndef _FLUX_MATRIX_ANA_H_
2 #define _FLUX_MATRIX_ANA_H_
3 
4 //ROOT includes
5 #include "TH1.h"
6 #include "SpectrumAnalysis.h"
7 #include "TH2.h"
8 #include "TMatrixD.h"
9 #include "TFitResult.h"
10 #include "TRandom3.h"
11 #include "TALYSUtils.h"
12 //c++includes
13 #include <cstdint>
14 #include <vector>
15 #include <utility>
16 #include <deque>
17 #include <random>
18 using std::vector;
19 #include <map>
20 using std::map;
21 using std::pair;
22 
23 // #include "../../BasicSupport/external/eigen/Eigen/Dense"
24 #include <Eigen/Dense>
25 
26 
34 class FluxAna
35 {
36 public:
38  FluxAna();
39 
40 
41  //setters
42  //all times are ns, distances are cm, energies are MeV
43  void setRFPeriod(double a_RFPeriod);
44  void setTimeResolution(double a_timeResolution);
45  void setReqTimeBinWidth(double a_reqTimeBinWidth);
46  void setFlightPath(double a_flightPath);
47  void setEMin(double a_eMin);
48  void setEMax(double a_eMax);
49  double getRFPeriod();
50  double getTimeResolution();
51  double getReqTimeBinWidth();
52  double getFlightPath();
53  double getEMin();
54  double getEMax();
55  //OriginalFlux readFlux(double a_minEnergy);
59  void readBinWiseFluxCSV(std::string a_fileName);
62  void loadFluxHist(std::string a_fileName,std::string a_histName);
63  void loadFluxHistCovMat(std::string a_fileName,std::string a_histName);
66  void setFlxHist(TH1* a_fluxHist);
68  TH1* getFluxHist();
69 
75  vector<double> readDeutronTimeProfile(TH1* a_rfHist,
76  double a_distToBreakup,
77  double a_distToDet,
78  double a_timeResolution=-1);
79 
80  vector<double> getEnergySpecLowerBinEdges();
81 
83  std::vector<double> buildTimeSinceRFAxis();
86  void setTimeSinceRFAxis(std::vector<double> a_binEdges);
89  std::vector<double> buildEnergyAxis();
92  std::pair<int,int> findRFPeriodPlusBinIndex(double a_En);
94  TH1* generateNew1DFlux();
99  TH1* rebinFluxHist();
106  TH2* buildFluxMatrix();
107 
108 
112  TH2F* smearFluxMatrix();
113  TH2* getSmearFluxMatrix();
115  vector<Eigen::MatrixXf> getFluxMatrix();
117  vector<Eigen::MatrixXf> getSmearedFluxMatrix();
118  //requires that the rebinned energy histogram has been generated
119  std::vector<double> getEnBinCenters();
120 
124  std::pair<double, double> getFluxAndError(double a_en);
125 
128  std::pair<double, double> getFluxAndError(double a_lowEn,double a_highEn);
132  vector<vector<double>> getFluxAtTimeSinceRFBin(int a_tofBin);
133  ~FluxAna();
134 
135 private:
137  TH1* m_fluxHisto;
138  TH1* m_fluxHistoOriginal;
139  Eigen::MatrixXf m_fluxCovarianceMatrix;
140  Eigen::MatrixXf m_cholDecompFluxCov;
142  TH1* m_fluxHistoRebin;
144  TH2* m_rootFluxMatrix;
145  TH2* m_rootFluxMatrixConv;
147  Eigen::MatrixXf m_fullFluxMat;
148  Eigen::MatrixXf m_fullFluxMatErr;
149  Eigen::MatrixXf m_fullFluxMatConv;
150  Eigen::MatrixXf m_fullFluxMatErrConv;
152  vector<double> m_orgBinEdges;
154  vector<double> m_orgBinFlux;
156  vector<double> m_orgBinDFlux;
157 
162  std::vector<double> m_timeSinceRFAxis;
169  std::vector<double> m_energyAxis;
170 
172  vector<double> m_timeSmearing;
174  double m_RFPeriod;
175  double m_timeResolution;
176  double m_reqTimeBinWidth;
177  double m_timeBinWidth;
178  double m_flightPath;
179  double m_eMin;
180  double m_eMax;
181  bool m_hasFluxUncMat;
183  TALYSUtils m_talysUtil;
184  std::mt19937_64 m_randGen;
185 };
186 
187 #endif
Definition: FluxMatrixAna.h:35
void setTimeResolution(double a_timeResolution)
Definition: FluxMatrixAna.cpp:65
TH2 * getSmearFluxMatrix()
Definition: FluxMatrixAna.cpp:807
vector< Eigen::MatrixXf > getFluxMatrix()
returns the eigen interpretation of the flux and error matrix
Definition: FluxMatrixAna.cpp:811
FluxAna()
Default constructor puts the class into working state.
Definition: FluxMatrixAna.cpp:44
vector< double > getEnergySpecLowerBinEdges()
Definition: FluxMatrixAna.cpp:417
void setTimeSinceRFAxis(std::vector< double > a_binEdges)
Definition: FluxMatrixAna.cpp:435
TH2 * buildFluxMatrix()
Definition: FluxMatrixAna.cpp:548
vector< double > readDeutronTimeProfile(TH1 *a_rfHist, double a_distToBreakup, double a_distToDet, double a_timeResolution=-1)
Definition: FluxMatrixAna.cpp:272
void setEMin(double a_eMin)
Definition: FluxMatrixAna.cpp:77
void setFlightPath(double a_flightPath)
Definition: FluxMatrixAna.cpp:73
std::vector< double > getEnBinCenters()
Definition: FluxMatrixAna.cpp:819
void readBinWiseFluxCSV(std::string a_fileName)
Definition: FluxMatrixAna.cpp:114
std::vector< double > buildEnergyAxis()
Definition: FluxMatrixAna.cpp:440
double getEMax()
Definition: FluxMatrixAna.cpp:106
vector< Eigen::MatrixXf > getSmearedFluxMatrix()
returns smeared eigen interpretation of the flux and error matrix
Definition: FluxMatrixAna.cpp:815
std::pair< double, double > getFluxAndError(double a_en)
Definition: FluxMatrixAna.cpp:833
void loadFluxHist(std::string a_fileName, std::string a_histName)
Definition: FluxMatrixAna.cpp:210
vector< vector< double > > getFluxAtTimeSinceRFBin(int a_tofBin)
Definition: FluxMatrixAna.cpp:853
TH2F * smearFluxMatrix()
Definition: FluxMatrixAna.cpp:600
void loadFluxHistCovMat(std::string a_fileName, std::string a_histName)
Definition: FluxMatrixAna.cpp:235
TH1 * generateNew1DFlux()
creates new 1D flux from covariance matrix
Definition: FluxMatrixAna.cpp:472
double getRFPeriod()
Definition: FluxMatrixAna.cpp:86
double getEMin()
Definition: FluxMatrixAna.cpp:102
double getTimeResolution()
Definition: FluxMatrixAna.cpp:90
void setFlxHist(TH1 *a_fluxHist)
Definition: FluxMatrixAna.cpp:258
void setReqTimeBinWidth(double a_reqTimeBinWidth)
Definition: FluxMatrixAna.cpp:69
double getFlightPath()
Definition: FluxMatrixAna.cpp:98
~FluxAna()
Definition: FluxMatrixAna.cpp:930
void setRFPeriod(double a_RFPeriod)
Definition: FluxMatrixAna.cpp:61
std::pair< int, int > findRFPeriodPlusBinIndex(double a_En)
Definition: FluxMatrixAna.cpp:457
double getReqTimeBinWidth()
Definition: FluxMatrixAna.cpp:94
TH1 * getFluxHist()
this returns a clone of the internal flux hist as originally loaded or read
Definition: FluxMatrixAna.cpp:263
void setEMax(double a_eMax)
Definition: FluxMatrixAna.cpp:81
TH1 * getRebinnedFluxHistPerMeV()
Definition: FluxMatrixAna.cpp:534
std::vector< double > buildTimeSinceRFAxis()
builds the time since RF axis
Definition: FluxMatrixAna.cpp:423
TH1 * rebinFluxHist()
Definition: FluxMatrixAna.cpp:493
Definition: TALYSUtils.h:62