Berkeley Nuclear Data Software
STOFAna.h
Go to the documentation of this file.
1 #ifndef _STOF_ANA_
2 #define _STOF_ANA_
3 //project
4 #include "PostProcBase.h"
5 #include "STOFEvent.h"
6 #include "STOFConfig.h"
7 #include "CutManager.h"
8 #include "CutBuilder.h"
9 //external inputs
10 #include "json.hpp"
11 //root
12 #include "TH1.h"
13 #include "TH2.h"
14 //c++
15 #include <string>
16 #include <map>
17 #include <random>
18 #include <fstream>
26 class STOFAna : public PostProcBase<STOFEvent>
27 {
28 public:
31  STOFAna();
34  STOFAna(std::string a_configFile);
36  void readConf(std::string a_configFile);
39  std::vector<TH2*> makeOutgoingTOFVAmpHists(bool a_applyCalib=false,
40  bool a_applyCuts = false
41  );
44  std::vector<TH2*> makeOutgoingTOFVTargetAmpHists(bool a_applyCalib=false,
45  bool a_applyCuts = false
46  );
49  std::vector<TH2*> makeIncomingTOFVTargetAmpHists(bool a_applyCalib=false,
50  bool a_applyCuts = false
51  );
54  std::vector<TH2*> makeEnETOFVTargetAmpHists(bool a_applyCalib=false,
55  bool a_applyCuts = false
56  );
59  std::vector<TH2*> makeEnITOFVTargetAmpHists(bool a_applyCalib=false,
60  bool a_applyCuts = false
61  );
64  std::vector<TH2*> makeEnITOFVTargetAmpHistsBG(bool a_applyCalib=false,
65  bool a_applyCuts = false
66  );
69  std::vector<TH2*> makeEnITOFVEnETOF(bool a_applyCalib=false,
70  bool a_applyCuts = false
71  );
73  std::vector<TH2*> makeEffEnVTargetAmpHists(bool a_applyCalib,
74  bool a_applyCuts,
75  bool a_exitTOFBinning = false
76  );
80  std::vector<TH2*> makeNeutronEneDist(bool a_applyCuts,
81  bool a_exitTOF = false
82  );
85  void makePlotFile(std::string a_outFileName="stofResults.root",
86  bool a_applyCalib=false,
87  bool a_applyCuts = false
88  );
92  void loadIncTOFGammaFlashHist(TH1* a_histogram);
93 
98  std::vector<TH1*> getScatterPulseHeight(double a_minET,
99  double a_maxET
100  );
106  std::vector<TH1*> getTargetPulseHeight(double a_minTOF,
107  double a_maxTOF,
108  bool a_incTOF
109  );
110 
111 
112 
113 
114  void setIsSim(bool a_isSim);
115  void setSmearExitTime(bool a_smearExitTime);
116  void setExitTres(double a_exitTres);
117  void setSmearIncTime(bool a_smearIncTime);
118  void setIncTres(double a_incTres);
119 
120  //used for setting up histograms
121  //number of amplitude bins to setup
122  void setnAmpBins(int a_nAmpBins);
123  //the maximum recoreded amplitude
124  void setmaxAmp(double a_maxAmp);
125  void seteTOFMax(double a_eTOFMax);
126  void seteTOFMin(double a_eTOFMin);
127  void setexitTBinWidth(double a_exitTBinWidth);
128 
129  void setSmearLight(bool a_smearLight);
130  void setMaxEn(double a_maxEn);
131  void setMinEn(double a_minEn);
132  void setConfig(STOFConfig a_config);
133 
134  //getters
135  bool getIsSim();
136  bool getSmearExitTime();
137  double getExitTres();
138  bool getSmearIncTime();
139  double getIncTres();
140  int getnAmpBins();
141  //the maximum recoreded amplitude
142  double getmaxAmp();
143  double geteTOFMax();
144  double geteTOFMin();
145  double getexitTBinWidth();
146  bool getSmearLight();
147  double getMaxEn();
148  double getMinEn();
149  TTree* getTree();
150  STOFEvent* getEvent();
152  void clearHists();
153 
165  std::map<string, bool> m_cutState;
166 
167  ~STOFAna();
168 private:
171  STOFConfig m_config;
173  CutManager m_cutManager;
176  bool passesCuts(STOFEvent* a_event);
177  //these are used to functionalize the templated base class
178  void setTreeName();
179  void setBranchName();
180  //used to store histograms from various routines
181  std::map<std::string , TH1*> m_hists;
182  //used to control simulation smearing and histogram generation
183  bool m_isSim;
184  bool m_smearExitTime;
185  double m_exitTres;
186  bool m_smearIncTime;
187  double m_incTres;
188  bool m_smearLight;
189 
190  //used for setting up histograms
191  //number of amplitude bins to setup
192  int m_nAmpBins;
193  //the maximum recoreded amplitude
194  double m_maxAmp;
195  double m_eTOFMax;
196  double m_eTOFMin;
197  double m_exitTBinWidth;
198  double m_iTOFMin;
199  double m_iTOFMax;
200  double m_iTOFBinWidth;
201  double m_minEn;
202  double m_maxEn;
203 
204  bool m_hasGammaFlashHist;
205  TH1* m_incGammaFlashHist;
206 
207  //used to make a simulated event offset by the current settings for the
208  //the experimental uncertainties
209  void createUncertainEv();
210  //used to store a simulation event modified by the experimental uncertainties
211  STOFEvent m_smrdEv;
217  std::vector<double> getEnBinsETOF();
220  std::vector<double> getEnBinsITOF();
221  //set up random generator
222  std::default_random_engine m_generator;
223 
224 };
225 
226 
227 #endif
Definition: CutManager.h:21
Definition: PostProcBase.h:21
Definition: STOFAna.h:27
std::vector< TH2 * > makeEnITOFVTargetAmpHistsBG(bool a_applyCalib=false, bool a_applyCuts=false)
amplitude hists !!!!!!this requires thoght
Definition: STOFAna.cpp:620
double geteTOFMax()
Definition: STOFAna.cpp:1351
bool getIsSim()
Definition: STOFAna.cpp:1322
void loadIncTOFGammaFlashHist(TH1 *a_histogram)
Definition: STOFAna.cpp:1100
void setExitTres(double a_exitTres)
Definition: STOFAna.cpp:1273
std::vector< TH2 * > makeEnETOFVTargetAmpHists(bool a_applyCalib=false, bool a_applyCuts=false)
Definition: STOFAna.cpp:433
int getnAmpBins()
Definition: STOFAna.cpp:1342
void setConfig(STOFConfig a_config)
Definition: STOFAna.cpp:1317
double getmaxAmp()
Definition: STOFAna.cpp:1347
void setMaxEn(double a_maxEn)
Definition: STOFAna.cpp:1309
void seteTOFMax(double a_eTOFMax)
Definition: STOFAna.cpp:1293
TTree * getTree()
Definition: STOFAna.cpp:1377
void setSmearExitTime(bool a_smearExitTime)
Definition: STOFAna.cpp:1269
double geteTOFMin()
Definition: STOFAna.cpp:1355
void setIsSim(bool a_isSim)
Definition: STOFAna.cpp:1264
void setSmearLight(bool a_smearLight)
Definition: STOFAna.cpp:1305
bool getSmearExitTime()
Definition: STOFAna.cpp:1326
double getExitTres()
Definition: STOFAna.cpp:1330
std::map< string, bool > m_cutState
Definition: STOFAna.h:165
void setexitTBinWidth(double a_exitTBinWidth)
Definition: STOFAna.cpp:1301
std::vector< TH2 * > makeEffEnVTargetAmpHists(bool a_applyCalib, bool a_applyCuts, bool a_exitTOFBinning=false)
this function creates a histogram for calculating the efficiency
Definition: STOFAna.cpp:823
double getexitTBinWidth()
Definition: STOFAna.cpp:1359
STOFEvent * getEvent()
Definition: STOFAna.cpp:1381
std::vector< TH2 * > makeIncomingTOFVTargetAmpHists(bool a_applyCalib=false, bool a_applyCuts=false)
Definition: STOFAna.cpp:332
void setMinEn(double a_minEn)
Definition: STOFAna.cpp:1313
CutManager & getCutManager()
Definition: STOFAna.cpp:1385
std::vector< TH2 * > makeNeutronEneDist(bool a_applyCuts, bool a_exitTOF=false)
Definition: STOFAna.cpp:925
void clearHists()
Definition: STOFAna.cpp:1389
void seteTOFMin(double a_eTOFMin)
Definition: STOFAna.cpp:1297
void setSmearIncTime(bool a_smearIncTime)
Definition: STOFAna.cpp:1277
double getMinEn()
Definition: STOFAna.cpp:1371
double getIncTres()
Definition: STOFAna.cpp:1338
void setnAmpBins(int a_nAmpBins)
Definition: STOFAna.cpp:1285
void setIncTres(double a_incTres)
Definition: STOFAna.cpp:1281
std::vector< TH2 * > makeOutgoingTOFVTargetAmpHists(bool a_applyCalib=false, bool a_applyCuts=false)
Definition: STOFAna.cpp:236
STOFAna()
Definition: STOFAna.cpp:10
std::vector< TH2 * > makeEnITOFVTargetAmpHists(bool a_applyCalib=false, bool a_applyCuts=false)
Definition: STOFAna.cpp:525
std::vector< TH2 * > makeOutgoingTOFVAmpHists(bool a_applyCalib=false, bool a_applyCuts=false)
Definition: STOFAna.cpp:151
std::vector< TH1 * > getTargetPulseHeight(double a_minTOF, double a_maxTOF, bool a_incTOF)
Definition: STOFAna.cpp:1166
std::vector< TH2 * > makeEnITOFVEnETOF(bool a_applyCalib=false, bool a_applyCuts=false)
Definition: STOFAna.cpp:721
void readConf(std::string a_configFile)
this function reads the config file
Definition: STOFAna.cpp:60
void setmaxAmp(double a_maxAmp)
Definition: STOFAna.cpp:1289
std::vector< TH1 * > getScatterPulseHeight(double a_minET, double a_maxET)
Definition: STOFAna.cpp:1110
~STOFAna()
Definition: STOFAna.cpp:1616
bool getSmearIncTime()
Definition: STOFAna.cpp:1334
double getMaxEn()
Definition: STOFAna.cpp:1367
bool getSmearLight()
Definition: STOFAna.cpp:1363
void makePlotFile(std::string a_outFileName="stofResults.root", bool a_applyCalib=false, bool a_applyCuts=false)
Definition: STOFAna.cpp:1045
Definition: STOFConfig.h:16
Definition: STOFEvent.h:9