Berkeley Nuclear Data Software
CompSpecAna.h
Go to the documentation of this file.
1 #ifndef _COMPSPEC_ANA_
2 #define _COMPSPEC_ANA_
3 //project
4 #include "PostProcBase.h"
5 #include "CompSpecEvent.h"
6 #include "CutManager.h"
7 #include "CutBuilder.h"
8 #include "ConfigBuilder.h"
9 #include "HistHelpers.h"
10 #include "COMPASSWFAna.h"
11 //root
12 #include "TH1.h"
13 #include "TH2.h"
14 #include "TF1.h"
15 #include "TGraphErrors.h"
16 #include "TFitResult.h"
17 //c++
18 #include <string>
19 #include <map>
20 #include <random>
21 #include <fstream>
22 #include <TStyle.h>
23 #include <cmath>
24 #include <nlohmann/json.hpp>
25 
29 class CompSpecAna : public PostProcBase<CompSpecEvent>
30 {
31 public:
32  //default constructor
33  CompSpecAna();
34 
36  CompSpecAna(std::string a_jsonConfigName);
37 
38  //used to read the config after the class has already been instantiated.
39  void loadConfig(std::string a_jsonConfigName);
40 
41  // used to build and store histogram of target scintillator
42  // light yield vs electron energy deposition in target scintillator
43  void buildTargetLightYield(bool a_applyCuts = true);
44 
45  void buildRelativeLightYield(std::string a_outfile="relativeLightYield.root",
46  bool a_applyCuts = true,
47  bool a_debug = true);
48 
49  void plotWFs(int a_numWFs = 10);
50 
51  std::map<string, bool> m_cutState;
52 
53 private:
56  ExperimentConfig m_targetConfig;
57  ExperimentConfig m_scatterConfig;
58  PointSourceInfo m_sourceConfig;
59  nlohmann::json m_jsonConfig;
60 
61  CutManager m_cutManager;
62 
63  bool passesCuts(CompSpecEvent* a_event);
64  bool m_isSim;
65 
66  //these are used to functionalize the templated base class
67  void setTreeName();
68  void setBranchName();
69 
70  //used to store 2D hists from relative light yield procedure
71  std::map<int, TH2*> m_hists;
72 
73  // used to store relative light yield curve
74  TGraphErrors m_relativeLightYield;
75 };
76 
77 
78 #endif
nlohmann::json json
Definition: PSDCutFinder.cpp:13
Definition: CompSpecAna.h:30
std::map< string, bool > m_cutState
Definition: CompSpecAna.h:51
void loadConfig(std::string a_jsonConfigName)
Definition: CompSpecAna.cpp:24
void plotWFs(int a_numWFs=10)
Definition: CompSpecAna.cpp:468
CompSpecAna()
Definition: CompSpecAna.cpp:10
void buildRelativeLightYield(std::string a_outfile="relativeLightYield.root", bool a_applyCuts=true, bool a_debug=true)
Definition: CompSpecAna.cpp:83
void buildTargetLightYield(bool a_applyCuts=true)
Definition: CompSpecAna.cpp:45
Definition: CompSpecEvent.h:12
Definition: CutManager.h:21
Definition: ConfigClasses.h:431
Definition: ConfigClasses.h:40
Definition: PostProcBase.h:21