All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
ana::SBNOsc::Chi2Sensitivity::EventSample Class Reference

Public Member Functions

 EventSample (const fhicl::ParameterSet &config)
 
std::vector< double > Oscillate (double sinth, double dm2) const
 
std::vector< double > Signal () const
 
std::vector< double > Background () const
 

Public Attributes

std::string fName
 
double fBaseline
 baseline (along z) in cm More...
 
double fBeamCenterX
 Center of beam in detector coordinates in x-dir in cm. More...
 
double fBeamCenterY
 Center of beam in detector coordinates in y-dir in cm. More...
 
double fBeamFrontZ
 Front face of detector along z-dir in cm. More...
 
std::array< double, 2 > fXlim
 Detector size in cm. More...
 
std::array< double, 2 > fYlim
 Detector size in cm. More...
 
std::array< double, 2 > fZlim
 Detector size in cm. More...
 
double fScalePOT
 Factor for POT (etc.) scaling. More...
 
double fPOT
 
int fOscType
 Oscilaltion type: 0 == None, 1 == numu -> nue, 2 == numu -> numu. More...
 
std::vector< double > fEnergyBinScale
 
TH1D * fBkgCounts
 Background count Histogram. More...
 
TH3D * fSignalCounts
 Signal Count Histogram. More...
 
std::vector< double > fBins
 Reco Energy bin limits. More...
 
std::vector< double > fTrueEBins
 True energy bin limits. More...
 
std::vector< double > fDistBins
 Distance bin limits. More...
 

Detailed Description

Definition at line 55 of file Chi2Sensitivity.h.

Constructor & Destructor Documentation

ana::SBNOsc::Chi2Sensitivity::EventSample::EventSample ( const fhicl::ParameterSet &  config)

Definition at line 161 of file Chi2Sensitivity.cxx.

161  {
162  // scaling stuff
163  fName = config.get<std::string>("name", "");
164  fScalePOT = config.get<double>("ScalePOT", 0.);
165  fPOT = 0.;
166 
167  // setup detector stuff
168  std::vector<double> xlim = config.get<std::vector<double> >("DetX");
169  std::vector<double> ylim = config.get<std::vector<double> >("DetY");
170  std::vector<double> zlim = config.get<std::vector<double> >("DetZ");
171  fXlim[0] = xlim[0];
172  fXlim[1] = xlim[1];
173  fYlim[0] = ylim[0];
174  fYlim[1] = ylim[1];
175  fZlim[0] = zlim[0];
176  fZlim[1] = zlim[1];
177 
178  // oscillation type
179  fOscType = config.get<int>("OscType", 0);
180 
181  // bins of things
182  //
183  // Reco energy
184  std::vector<double> bins = config.get<std::vector<double> >("binlims");
185  for (auto const& bin: bins) {
186  fBins.push_back(bin);
187  }
188 
189  // True energy
190  std::vector<double> truee = config.get<std::vector<double> >("TrueELims");
191  double minTrueE = truee.at(0);
192  double maxTrueE = truee.at(1);
193  int numTrueEBinLimits = config.get<int>("NumTrueEBins", 1) + 1;
194  double trueE_binwidth = (maxTrueE - minTrueE) / numTrueEBinLimits;
195  for (int i = 0; i < numTrueEBinLimits; i ++) {
196  fTrueEBins.push_back(minTrueE + i * trueE_binwidth);
197  }
198 
199  // distance
200  //
201  // Take distance along z-axis as limits
202  int numBinsPerMeter = config.get<int>("NumDistanceBinsPerMeter", 1);
203  double numBinsPerCM = numBinsPerMeter * 0.01; // unit conversion
204 
205  // get beam center and baseline in cm
206  fBaseline = config.get<double>("Baseline");
207  fBeamCenterX = config.get<double>("BeamCenterX", 0.);
208  fBeamCenterY = config.get<double>("BeamCenterY", 0.);
209  fBeamFrontZ = config.get<double>("BeamFrontZ", 0.);
210 
211  // get full range of distances across detector
212  double detector_distance = sqrt((fZlim[1] - fZlim[0]) * (fZlim[1] - fZlim[0]) \
213  + (fXlim[1] - fXlim[0]) * (fXlim[1] - fXlim[0]) \
214  + (fYlim[1] - fYlim[0]) * (fYlim[1] - fYlim[0]));
215  // get full range of beam
216  // taken approximately from eyeballing MCFlux information
217  double beam_width = sqrt( 125. * 125. /* x */ + 125. * 125. /* y */ + 5500. * 5500. /* z */);
218  unsigned n_bins = (unsigned) ((detector_distance + beam_width) * numBinsPerCM) + 1;
219  unsigned n_limits = n_bins + 1;
220  double dist_binwidth = 1./numBinsPerCM;
221 
222  // minimum distance from decayed vertex to detector
223  // taken approximately from MCFlux info
224  double min_baseline = fBaseline - 5500.;
225 
226  for (unsigned i = 0; i < n_limits; i++) {
227  fDistBins.push_back((min_baseline + (i * dist_binwidth)) / 100000. /* cm -> km */);
228  }
229 
230  // scaling in reco energy bins
231  fEnergyBinScale = config.get<std::vector<double>>("energy_bin_scale", {});
232  if (fEnergyBinScale.size() == 0) {
233  fEnergyBinScale = std::vector<double>(fBins.size() - 1, 1.0);
234  }
235  else assert(fEnergyBinScale.size() == fBins.size() - 1);
236 
237  // setup histograms
238  fBkgCounts = new TH1D((fName + " Background").c_str(), (fName + " Background").c_str(), fBins.size() - 1, &fBins[0]);
239  fSignalCounts = new TH3D((fName + " Signal").c_str(), (fName + " Signal").c_str(),
240  fBins.size() - 1, &fBins[0], fTrueEBins.size() - 1, &fTrueEBins[0], fDistBins.size() - 1, &fDistBins[0]);
241 
242 }
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::array< double, 2 > fZlim
Detector size in cm.
std::vector< double > fBins
Reco Energy bin limits.
std::vector< double > fDistBins
Distance bin limits.
double fBaseline
baseline (along z) in cm
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::array< double, 2 > fXlim
Detector size in cm.
std::vector< double > fTrueEBins
True energy bin limits.
int fOscType
Oscilaltion type: 0 == None, 1 == numu -&gt; nue, 2 == numu -&gt; numu.
std::array< double, 2 > fYlim
Detector size in cm.
double fBeamFrontZ
Front face of detector along z-dir in cm.
TH3D * fSignalCounts
Signal Count Histogram.

Member Function Documentation

std::vector< double > ana::SBNOsc::Chi2Sensitivity::EventSample::Background ( ) const

Definition at line 101 of file Chi2Sensitivity.cxx.

101  {
102  std::vector<double> ret(fBkgCounts->GetNbinsX(), 0);
103  for (unsigned bin = 0; bin < fBkgCounts->GetNbinsX(); bin++) {
104  ret[bin] = fBkgCounts->GetBinContent(bin+1);
105  }
106  return ret;
107 }
TH1D * fBkgCounts
Background count Histogram.
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::vector< double > ana::SBNOsc::Chi2Sensitivity::EventSample::Oscillate ( double  sinth,
double  dm2 
) const

Definition at line 57 of file Chi2Sensitivity.cxx.

57  {
58  ROOT::Math::IntegratorOneDim integrator;
59  // return histogram binned by reco energy
60  std::vector<double> ret(fBkgCounts->GetNbinsX(), 0);
61  // iterate over signal bins
62  for (unsigned Ebin = 0; Ebin < fSignalCounts->GetNbinsY(); Ebin++) {
63  double energy = (fTrueEBins[Ebin] + fTrueEBins[Ebin+1]) / 2.;
64  for (unsigned Dbin = 0; Dbin < fSignalCounts->GetNbinsZ(); Dbin++) {
65  double distance = (fDistBins[Dbin] + fDistBins[Dbin+1]) / 2.;
66  for (unsigned bin = 0; bin < fSignalCounts->GetNbinsX(); bin++) {
67  double counts = fSignalCounts->GetBinContent(bin+1, Ebin+1, Dbin+1);
68 
69  if (fOscType == 1) {
70  counts *= numu_to_nue(distance/energy, sinth, dm2);
71  }
72  else if (fOscType == 2) {
73  counts *= NumuOscillate(integrator, fDistBins[Dbin], fDistBins[Dbin+1], fTrueEBins[Ebin], fTrueEBins[Ebin+1], dm2, sinth);
74  }
75 
76  ret[bin] += counts;
77  }
78  }
79  }
80 
81  return ret;
82 }
TH1D * fBkgCounts
Background count Histogram.
std::vector< double > fDistBins
Distance bin limits.
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::vector< double > dm2
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
double numu_to_nue(double x, double sin, double dm2)
counts_as<> counts
Number of ADC counts, represented by signed short int.
Definition: electronics.h:116
double NumuOscillate(ROOT::Math::IntegratorOneDim &integrator, double l_min, double l_max, double e_min, double e_max, double dm2, double sinth)
std::vector< double > fTrueEBins
True energy bin limits.
int fOscType
Oscilaltion type: 0 == None, 1 == numu -&gt; nue, 2 == numu -&gt; numu.
TH3D * fSignalCounts
Signal Count Histogram.
std::vector< double > ana::SBNOsc::Chi2Sensitivity::EventSample::Signal ( ) const

Definition at line 84 of file Chi2Sensitivity.cxx.

84  {
85  // return histogram binned by reco energy
86  std::vector<double> ret(fBkgCounts->GetNbinsX(), 0);
87  // iterate over signal bins
88  for (unsigned Ebin = 0; Ebin < fSignalCounts->GetNbinsY(); Ebin++) {
89  for (unsigned Dbin = 0; Dbin < fSignalCounts->GetNbinsZ(); Dbin++) {
90  for (unsigned bin = 0; bin < fSignalCounts->GetNbinsX(); bin++) {
91  double counts = fSignalCounts->GetBinContent(bin+1, Ebin+1, Dbin+1);
92  ret[bin] += counts;
93  }
94  }
95  }
96 
97  return ret;
98 }
TH1D * fBkgCounts
Background count Histogram.
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
counts_as<> counts
Number of ADC counts, represented by signed short int.
Definition: electronics.h:116
TH3D * fSignalCounts
Signal Count Histogram.

Member Data Documentation

double ana::SBNOsc::Chi2Sensitivity::EventSample::fBaseline

baseline (along z) in cm

Definition at line 68 of file Chi2Sensitivity.h.

double ana::SBNOsc::Chi2Sensitivity::EventSample::fBeamCenterX

Center of beam in detector coordinates in x-dir in cm.

Definition at line 69 of file Chi2Sensitivity.h.

double ana::SBNOsc::Chi2Sensitivity::EventSample::fBeamCenterY

Center of beam in detector coordinates in y-dir in cm.

Definition at line 70 of file Chi2Sensitivity.h.

double ana::SBNOsc::Chi2Sensitivity::EventSample::fBeamFrontZ

Front face of detector along z-dir in cm.

Definition at line 71 of file Chi2Sensitivity.h.

std::vector<double> ana::SBNOsc::Chi2Sensitivity::EventSample::fBins

Reco Energy bin limits.

Definition at line 85 of file Chi2Sensitivity.h.

TH1D* ana::SBNOsc::Chi2Sensitivity::EventSample::fBkgCounts

Background count Histogram.

Definition at line 81 of file Chi2Sensitivity.h.

std::vector<double> ana::SBNOsc::Chi2Sensitivity::EventSample::fDistBins

Distance bin limits.

Definition at line 87 of file Chi2Sensitivity.h.

std::vector<double> ana::SBNOsc::Chi2Sensitivity::EventSample::fEnergyBinScale

Definition at line 78 of file Chi2Sensitivity.h.

std::string ana::SBNOsc::Chi2Sensitivity::EventSample::fName

Definition at line 67 of file Chi2Sensitivity.h.

int ana::SBNOsc::Chi2Sensitivity::EventSample::fOscType

Oscilaltion type: 0 == None, 1 == numu -> nue, 2 == numu -> numu.

Definition at line 77 of file Chi2Sensitivity.h.

double ana::SBNOsc::Chi2Sensitivity::EventSample::fPOT

Definition at line 76 of file Chi2Sensitivity.h.

double ana::SBNOsc::Chi2Sensitivity::EventSample::fScalePOT

Factor for POT (etc.) scaling.

Definition at line 75 of file Chi2Sensitivity.h.

TH3D* ana::SBNOsc::Chi2Sensitivity::EventSample::fSignalCounts

Signal Count Histogram.

Definition at line 82 of file Chi2Sensitivity.h.

std::vector<double> ana::SBNOsc::Chi2Sensitivity::EventSample::fTrueEBins

True energy bin limits.

Definition at line 86 of file Chi2Sensitivity.h.

std::array<double, 2> ana::SBNOsc::Chi2Sensitivity::EventSample::fXlim

Detector size in cm.

Definition at line 72 of file Chi2Sensitivity.h.

std::array<double, 2> ana::SBNOsc::Chi2Sensitivity::EventSample::fYlim

Detector size in cm.

Definition at line 73 of file Chi2Sensitivity.h.

std::array<double, 2> ana::SBNOsc::Chi2Sensitivity::EventSample::fZlim

Detector size in cm.

Definition at line 74 of file Chi2Sensitivity.h.


The documentation for this class was generated from the following files: