Berkeley Nuclear Data Software
GenesisAnalysis.h
Go to the documentation of this file.
2 #include "GENESISConfig.h"
3 //project includes
4 #include "MDPP16DataStructures.h"
6 #include "MesyDAQEvent.h"
7 #include "ConfigClasses.h"
8 #include "ConfigBuilder.h"
9 #include "PostProcBase.h"
10 #include "NSDPhysicsCalcs.h"
11 //root includes
12 #include "TChain.h"
13 #include "TFile.h"
14 #include "TH1.h"
15 //c++ includes
16 #include <vector>
17 #include <string>
18 #include <deque>
19 #include <utility>
20 #include <algorithm>
21 using std::vector;
22 using std::string;
23 using std::deque;
24 using std::sort;
25 using std::pair;
26 
29 class GenesisAnalysis : public PostProcBase<GenesisEvent>
30 {
31 public:
33  GenesisAnalysis(string a_configFileName);
34  void readConfigFile(string a_configFileName);
40  void accumulateBasicQuantities(string a_outFileName
41  = "genEventBasicQuantities.root");
42 
43  //this function builds a tree of information for the scintillator detectors
44  //that applies the timing calibrations before producing time differences
45  //with the rf. It should be used in conjunction with an expectation of the
46  //arrival times of the beam produced gammas to develop a RF time offset.
47  //this requires that your config file is complete with timing and gain
48  //calibrations for the scintillators.
49  //the resultant tree contains the following variables
50  // int detID
51  // uint32_t wallTime
52  // int isNeutron
53  // double amp
54  // double shape
55  // std::vector<double> rfDiffs
56  void buildRFCalibrationTree(string a_outFileName
57  = "rfCalibrationResults.root",
58  double a_dsFraction = 0.1
59  );
72  void buildGammaSpectra(string a_outFileName = "spec1.root",
73  bool a_requireScint=false,
76  bool a_integralCal = false,
77  int a_maxE = 8192
78  );
87  void buildTOFHists(string a_outFileName = "tofHists.root");
89  void buildPSDFHists(string a_outFileName = "psdHists.root");
99  string a_outFileNameRoot = "gammaTimeOffset.root",
100  string a_outFileNameTxt = "gammaTimeOffset.txt",
101  int a_doFit=1,
104  std::array<double,3> a_offset = {0,0,0}
105  );
114  void buildOutgoingTOFHist(string a_outFileName = "outgoingTOF.root");
118  void reduceToCalibratedTrees(string a_outFileName = "calibrateEvents.root",
119  int a_detOption = 0);
120  void reduceToCloverTree(string a_outFileName = "calibratedGamma.root");
121  void buildEfficiencyAnaTree(bool a_buildForNeutrons,
122  string a_outFileName="",
123  double a_enThreshold=.2);
126  void buildEfficiencyAnaTreeScintScint(string a_outFileName,
127  double a_enThreshold=.2,
128  bool a_gammaGamma=false,
131  std::array<double,3> a_offset = {0,0,0});
133  void makeRandomTOFHists(string a_outFileName="",
134  double a_enThreshold=.2);
137  void buildGammaGammaCoins(string a_fileName="gammaGammaCoinHists.root");
138  void buildNeutronSinglesTree(string a_fileName="neutronSinglesTree.root");
140  virtual std::ostream& printEvent( std::ostream& a_stream = std::cout,
141  int a_eventToPrint = -1
142  );
143 private:
145  GenesisAnalysis();
146  GenesisConfig m_conf;
147  //overload of pure virtual functions to enable inheritance functionality
148  void setTreeName();
149  void setBranchName();
150  vector<MDPPScintEvent> m_scintEvents;
151  map<int, MDPPCloverEvent> m_cloverEvents;
152  vector<TH1*> m_coinTreeTestHists;
153  map<int, map<int ,vector<TH1*>>> m_ch_hist;
155  map<DetType, map<int, vector<TH1*>>> m_basicHists;
156 
160  int timeDiff(string a_outFile);
163  int m_lastPrintedEvent;
168  double m_TDCRes;
170  bool sortTrig(vector<double>& v1, vector<double>& v2);
171 
172 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173 };
Definition: GenesisAnalysis.h:30
void buildTOFHists(string a_outFileName="tofHists.root")
Definition: GenesisAnalysis.cpp:738
virtual std::ostream & printEvent(std::ostream &a_stream=std::cout, int a_eventToPrint=-1)
this is used for testing the internal state of events stored in the tree
Definition: GenesisAnalysis.cpp:3013
void buildGammaGammaCoins(string a_fileName="gammaGammaCoinHists.root")
Definition: GenesisAnalysis.cpp:2728
void buildPSDFHists(string a_outFileName="psdHists.root")
get psd histo, apply cuts isNeutron, isGamma
Definition: GenesisAnalysis.cpp:1108
void buildNeutronSinglesTree(string a_fileName="neutronSinglesTree.root")
Definition: GenesisAnalysis.cpp:2794
void findGammaGammaTimeOffset(string a_outFileNameRoot="gammaTimeOffset.root", string a_outFileNameTxt="gammaTimeOffset.txt", int a_doFit=1, std::array< double, 3 > a_offset={0, 0, 0})
Definition: GenesisAnalysis.cpp:1252
void readConfigFile(string a_configFileName)
Definition: GenesisAnalysis.cpp:31
void buildRFCalibrationTree(string a_outFileName="rfCalibrationResults.root", double a_dsFraction=0.1)
Definition: GenesisAnalysis.cpp:337
void buildEfficiencyAnaTreeScintScint(string a_outFileName, double a_enThreshold=.2, bool a_gammaGamma=false, std::array< double, 3 > a_offset={0, 0, 0})
Definition: GenesisAnalysis.cpp:2358
void accumulateBasicQuantities(string a_outFileName="genEventBasicQuantities.root")
Definition: GenesisAnalysis.cpp:41
void buildOutgoingTOFHist(string a_outFileName="outgoingTOF.root")
Definition: GenesisAnalysis.cpp:1824
void buildGammaSpectra(string a_outFileName="spec1.root", bool a_requireScint=false, bool a_integralCal=false, int a_maxE=8192)
Definition: GenesisAnalysis.cpp:425
void makeRandomTOFHists(string a_outFileName="", double a_enThreshold=.2)
build random n/g coincidences between EJ-309 detectors
Definition: GenesisAnalysis.cpp:2559
void buildEfficiencyAnaTree(bool a_buildForNeutrons, string a_outFileName="", double a_enThreshold=.2)
builds tree of PH, TOF, gamma energy for PSD-neutrons
Definition: GenesisAnalysis.cpp:2283
void reduceToCalibratedTrees(string a_outFileName="calibrateEvents.root", int a_detOption=0)
Definition: GenesisAnalysis.cpp:2124
void reduceToCloverTree(string a_outFileName="calibratedGamma.root")
Definition: GenesisAnalysis.cpp:2171
Definition: GENESISConfig.h:15
Definition: PostProcBase.h:21