All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Chi2Sensitivity.h
Go to the documentation of this file.
1 #ifndef __sbnanalysis_ana_SBNOsc_Chi2Sensitivity__
2 #define __sbnanalysis_ana_SBNOsc_Chi2Sensitivity__
3 
4 /**
5  * \file Chi2Sensitivity.h
6  */
7 
9 
10 #include "Covariance.h"
11 
12 #include <vector>
13 #include <string>
14 
15 #include <TGraph2D.h>
16 #include <TGraph.h>
17 
18 namespace ana {
19 namespace SBNOsc {
20 
22 
23  public:
24 
25  // Constructor
27  // Implement post-processor
28  void Initialize(fhicl::ParameterSet* config);
29  void ProcessEvent(const event::Event* event);
30  void ProcessSubRun(const SubRun *subrun);
31  void FileCleanup(TTree* eventTree);
32 
33  void Finalize() {
34  for (int i = 0; i < fEventSamples.size(); i++) {
35  std::cout << "POT: " << fEventSamples[i].fPOT << " to: " << fEventSamples[i].fScalePOT << " factor: " << fEventSamples[i].fScalePOT / fEventSamples[i].fPOT << std::endl;
36  }
37 
39 
40  // API Functions
41  void Scale();
42  void GetChi2();
43  void GetContours();
44  void Write();
45 
46  TH1D *Oscillate(double sinth, double dm2);
47 
48  // Output
49 
50  TGraph2D *chisqplot;
52 
53  private:
54  // struct for additional config on event sample detectors
55  class EventSample {
56  public:
57  // Constructor
58  EventSample(const fhicl::ParameterSet& config);
59  // Oscillate Signal counts into 1D Histogram
60  std::vector<double> Oscillate(double sinth, double dm2) const;
61  // Get Vector of Signal counts
62  std::vector<double> Signal() const;
63  // Get vector of Background counts
64  std::vector<double> Background() const;
65 
66  // Config
67  std::string fName;
68  double fBaseline; //!< baseline (along z) in cm
69  double fBeamCenterX; //!< Center of beam in detector coordinates in x-dir in cm
70  double fBeamCenterY; //!< Center of beam in detector coordinates in y-dir in cm
71  double fBeamFrontZ; //!< Front face of detector along z-dir in cm
72  std::array<double, 2> fXlim; //!< Detector size in cm
73  std::array<double, 2> fYlim; //!< Detector size in cm
74  std::array<double, 2> fZlim; //!< Detector size in cm
75  double fScalePOT; //!< Factor for POT (etc.) scaling
76  double fPOT;
77  int fOscType; //!< Oscilaltion type: 0 == None, 1 == numu -> nue, 2 == numu -> numu
78  std::vector<double> fEnergyBinScale;
79 
80  // Storage
81  TH1D *fBkgCounts; //!< Background count Histogram
82  TH3D *fSignalCounts; //!< Signal Count Histogram
83 
84  // bins
85  std::vector<double> fBins; //!< Reco Energy bin limits
86  std::vector<double> fTrueEBins; //!< True energy bin limits
87  std::vector<double> fDistBins; //!< Distance bin limits
88  };
89 
90  // From config file
91  std::string fEnergyType;
92 
94 
95  int fNumDm2;
96  int fNumSin;
97  std::vector <double> fLogDm2Lims, fLogSinLims;
98 
99  std::string fOutputFile;
100  // whether to save stuff
104  std::vector<std::array<double, 2>> fSaveOscillations;
105 
106  // index into sample
107  unsigned fSampleIndex;
108 
109  // keep internal covariance
111  // keep own Event Samples
112  std::vector<EventSample> fEventSamples;
113 
114  // containers for sin2theta and dm values
115  std::vector<double> sin2theta;
116  std::vector<double> dm2;
117 
118  std::vector <std::vector <double> > chisq_diffs; //!< Container for chi2 values
119 
120 };
121 
122 } // namespace SBNOsc
123 } // namespace ana
124 
125 #endif // __sbnanalysis_ana_SBNOsc_Chi2Sensitivity__
double fBeamCenterX
Center of beam in detector coordinates in x-dir in cm.
TH1D * fBkgCounts
Background count Histogram.
double fScalePOT
Factor for POT (etc.) scaling.
double fBeamCenterY
Center of beam in detector coordinates in y-dir in cm.
std::vector< double > Background() const
std::array< double, 2 > fZlim
Detector size in cm.
std::vector< std::vector< double > > chisq_diffs
Container for chi2 values.
void Initialize(fhicl::ParameterSet *config)
std::vector< double > fBins
Reco Energy bin limits.
void FileCleanup(TTree *eventTree)
std::vector< double > fDistBins
Distance bin limits.
process_name opflashCryoW ana
EventSample(const fhicl::ParameterSet &config)
std::vector< double > Signal() const
TH1D * Oscillate(double sinth, double dm2)
double fBaseline
baseline (along z) in cm
std::vector< double > sin2theta
std::vector< double > dm2
std::vector< std::array< double, 2 > > fSaveOscillations
std::vector< double > fLogDm2Lims
std::vector< double > fLogSinLims
The standard subrun data definition.
Definition: SubRun.hh:23
std::array< double, 2 > fXlim
Detector size in cm.
The standard event data definition.
Definition: Event.hh:228
std::vector< double > fTrueEBins
True energy bin limits.
std::vector< EventSample > fEventSamples
int fOscType
Oscilaltion type: 0 == None, 1 == numu -&gt; nue, 2 == numu -&gt; numu.
void ProcessEvent(const event::Event *event)
std::array< double, 2 > fYlim
Detector size in cm.
double fBeamFrontZ
Front face of detector along z-dir in cm.
void ProcessSubRun(const SubRun *subrun)
TH3D * fSignalCounts
Signal Count Histogram.
std::vector< double > Oscillate(double sinth, double dm2) const
A generic tree-reading event-by-event processor.
BEGIN_PROLOG could also be cout