Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ana::Binning Class Reference

Represent the binning of a Spectrum's x-axis. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/cafanacore/v01.14/src/CAFAna/Core/Binning.h"

Public Member Functions

 Binning (const Binning &b)
 
Binningoperator= (const Binning &b)
 
 ~Binning ()
 
int NBins () const
 
double Min () const
 
double Max () const
 
int FindBin (double x) const
 
bool IsSimple () const
 
const std::vector< double > & Edges () const
 
const std::vector< std::string > & Labels () const
 
void SaveTo (TDirectory *dir, const std::string &name) const
 
bool operator== (const Binning &rhs) const
 
bool operator< (const Binning &rhs) const
 

Static Public Member Functions

static Binning Simple (int n, double lo, double hi, const std::vector< std::string > &labels={})
 
static Binning LogUniform (int n, double lo, double hi)
 
static Binning Custom (const std::vector< double > &edges)
 
static Binning FromTAxis (const TAxis *ax)
 
static std::unique_ptr< BinningLoadFrom (TDirectory *dir, const std::string &name)
 

Protected Member Functions

 Binning ()
 

Static Protected Member Functions

static Binning SimpleHelper (int n, double lo, double hi, const std::vector< std::string > &labels={})
 
static Binning CustomHelper (const std::vector< double > &edges)
 

Protected Attributes

std::vector< double > fEdges
 
std::vector< std::stringfLabels
 
int fNBins
 
double fMin
 
double fMax
 
bool fIsSimple
 

Detailed Description

Represent the binning of a Spectrum's x-axis.

May be "Simple" (equally spaced) or "Custom" (arbitrary binning)

Definition at line 16 of file Binning.h.

Constructor & Destructor Documentation

ana::Binning::Binning ( const Binning b)

Definition at line 30 of file Binning.cxx.

References fEdges, fIsSimple, fLabels, fMax, fMin, fNBins, ana::DepMan< T >::Instance(), ana::DepMan< T >::RegisterConstruction(), and ana::DepMan< T >::RegisterDependency().

31  {
32  if(&b == this) return;
33 
34  if(b.fNBins){
35  fEdges = b.fEdges;
36  fLabels = b.fLabels;
37  fNBins = b.fNBins;
38  fMin = b.fMin;
39  fMax = b.fMax;
40  fIsSimple = b.fIsSimple;
41 
43  }
44  else{
45  fNBins = 0;
46  fMin = 0;
47  fMax = 0;
48  fIsSimple = false;
49 
50  // If we are copying from a Binning with zero bins, that is probably
51  // because it is all zero because it hasn't been statically constructed
52  // yet. Register our interest of getting constructed in turn once it is.
54  }
55  }
std::vector< std::string > fLabels
Definition: Binning.h:56
std::vector< double > fEdges
Definition: Binning.h:55
bool fIsSimple
Definition: Binning.h:59
void RegisterDependency(const T *parent, T *child)
Call from copy constructor and assignment operator.
Definition: DepMan.cxx:122
double fMax
Definition: Binning.h:58
static DepMan & Instance()
Definition: DepMan.cxx:51
const hit & b
Definition: hits.cxx:21
void RegisterConstruction(T *x)
Call from constructor (in the success case)
Definition: DepMan.cxx:73
double fMin
Definition: Binning.h:58
int fNBins
Definition: Binning.h:57
ana::Binning::~Binning ( )

Definition at line 24 of file Binning.cxx.

References ana::DepMan< T >::Instance(), and ana::DepMan< T >::RegisterDestruction().

25  {
27  }
void RegisterDestruction(T *x)
Call from destructor.
Definition: DepMan.cxx:97
static DepMan & Instance()
Definition: DepMan.cxx:51
ana::Binning::Binning ( )
protected

Definition at line 13 of file Binning.cxx.

Referenced by Labels().

14  : fNBins(-1) // need a non-zero value so we count as constructed
15  {
16  // Don't want children copying from us at this point. Only when we're
17  // "fully constructed". So I inserted explicit calls in Simple() and
18  // Custom() instead.
19 
20  // DepMan<Binning>::Instance().RegisterConstruction(this);
21  }
int fNBins
Definition: Binning.h:57

Member Function Documentation

Binning ana::Binning::Custom ( const std::vector< double > &  edges)
static
Binning ana::Binning::CustomHelper ( const std::vector< double > &  edges)
staticprotected

Definition at line 130 of file Binning.cxx.

References ana::assert(), ana::bins, and fEdges.

Referenced by Custom(), and Labels().

131  {
132  assert(edges.size() > 1);
133 
134  Binning bins;
135  bins.fEdges = edges;
136  bins.fNBins = edges.size()-1;
137  bins.fMin = edges.front();
138  bins.fMax = edges.back();
139  bins.fIsSimple = false;
140 
141  return bins;
142  }
std::vector< double > fEdges
Definition: Binning.h:55
const Binning bins
Definition: NumuCC_CPiBin.h:8
assert(nhit_max >=nhit_nbins)
const std::vector<double>& ana::Binning::Edges ( ) const
inline
int ana::Binning::FindBin ( double  x) const

Definition at line 155 of file Binning.cxx.

References ana::assert(), bin, fEdges, fMax, fMin, fNBins, IsSimple(), and submit_syst::x.

Referenced by ana::ReweightableSpectrum::Fill(), ana::Hist::Fill(), and Max().

156  {
157  // Treat anything outside [fMin, fMax) as Underflow / Overflow
158  if (x < fMin) return 0; // Underflow
159  if (x >= fMax) return fEdges.size(); // Overflow
160 
161  // Follow ROOT convention, first bin of histogram is bin 1
162 
163  if(IsSimple()) return fNBins * (x - fMin) / (fMax - fMin) +1;
164 
165  int bin =
166  std::lower_bound(fEdges.begin(), fEdges.end(), x) - fEdges.begin();
167  if (x == fEdges[bin]) bin++;
168  assert(bin >= 0 && bin < (int)fEdges.size());
169  return bin;
170  }
std::vector< double > fEdges
Definition: Binning.h:55
bool IsSimple() const
Definition: Binning.h:33
float bin[41]
Definition: plottest35.C:14
double fMax
Definition: Binning.h:58
assert(nhit_max >=nhit_nbins)
double fMin
Definition: Binning.h:58
int fNBins
Definition: Binning.h:57
Binning ana::Binning::FromTAxis ( const TAxis *  ax)
static

Definition at line 173 of file Binning.cxx.

References ana::bins, Custom(), and SimpleHelper().

Referenced by ana::ReweightableSpectrum::LoadFrom(), and ana::Multiverse::ToSpectrum().

174  {
175  Binning bins;
176 
177  // Evenly spaced binning
178  if(!ax->GetXbins()->GetArray()){
179  bins = SimpleHelper(ax->GetNbins(), ax->GetXmin(), ax->GetXmax());
180  }
181  else{
182  std::vector<double> edges(ax->GetNbins()+1);
183  ax->GetLowEdge(&edges.front());
184  edges[ax->GetNbins()] = ax->GetBinUpEdge(ax->GetNbins());
185 
186  bins = Binning::Custom(edges);
187  }
188 
189  return bins;
190  }
static Binning Custom(const std::vector< double > &edges)
Definition: Binning.cxx:145
const Binning bins
Definition: NumuCC_CPiBin.h:8
static Binning SimpleHelper(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:88
bool ana::Binning::IsSimple ( ) const
inline

Definition at line 33 of file Binning.h.

References fIsSimple.

Referenced by ana::AlmostEqual(), FindBin(), ana::ToTH3Helper(), and ana::Hist::Write().

33 {return fIsSimple;}
bool fIsSimple
Definition: Binning.h:59
const std::vector<std::string>& ana::Binning::Labels ( ) const
inline

Definition at line 39 of file Binning.h.

References Binning(), CustomHelper(), dir, fLabels, PandAna.Demos.pi0_spectra::labels, LoadFrom(), operator<(), operator==(), SaveTo(), SimpleHelper(), and string.

39 {return fLabels;}
std::vector< std::string > fLabels
Definition: Binning.h:56
std::unique_ptr< Binning > ana::Binning::LoadFrom ( TDirectory *  dir,
const std::string name 
)
static

Definition at line 230 of file Binning.cxx.

References ana::assert(), Custom(), dir, fLabels, genie::utils::style::Format(), MECModelEnuComparisons::i, runNovaSAM::ret, Simple(), and getGoodRuns4SAM::tag.

Referenced by Labels(), ana::PredictionExtendToPeripheral::LoadFrom(), ana::NDOscillatableSpectrum::LoadFrom(), ana::ReweightableSpectrum::LoadFrom(), ana::OscillatableSpectrum::LoadFrom(), and ana::Spectrum::LoadFrom().

231  {
232  dir = dir->GetDirectory(name.c_str()); // switch to subdir
233  assert(dir);
234 
235  TObjString* tag = (TObjString*)dir->Get("type");
236  assert(tag);
237  assert(tag->GetString() == "Binning");
238 
239  TVectorD* vMinMax = (TVectorD*)dir->Get("nminmax");
240  assert(vMinMax);
241 
242  Binning ret;
243 
244  const TVectorD* issimple = (TVectorD*)dir->Get("issimple");
245  if((*issimple)[0]){
246  ret = Binning::Simple((*vMinMax)[0],
247  (*vMinMax)[1],
248  (*vMinMax)[2]);
249  }
250  else{
251  const TVectorD* vEdges = (TVectorD*)dir->Get("edges");
252  std::vector<double> edges(vEdges->GetNrows());
253  for(int i = 0; i < vEdges->GetNrows(); ++i) edges[i] = (*vEdges)[i];
254 
255  ret = Binning::Custom(edges);
256  }
257 
258  for(unsigned int i = 0; ; ++i){
259  TObjString* s = (TObjString*)dir->Get(TString::Format("label%d", i).Data());
260  if(!s) break;
261  ret.fLabels.push_back(s->GetString().Data());
262  }
263 
264  delete dir;
265 
266  return std::make_unique<Binning>(ret);
267  }
const XML_Char * name
Definition: expat.h:151
const XML_Char * s
Definition: expat.h:262
static Binning Custom(const std::vector< double > &edges)
Definition: Binning.cxx:145
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
Binning ana::Binning::LogUniform ( int  n,
double  lo,
double  hi 
)
static

Definition at line 118 of file Binning.cxx.

References Custom(), MECModelEnuComparisons::i, lo(), and test_ParserArtEvents::log.

Referenced by DrawBackgrounds(), DrawCCOscillations(), MakeSurface(), MatrixDeterminant(), and ana::TrueLOverTrueEBins().

119  {
120  std::vector<double> edges(n+1);
121  const double logSpacing = exp( (log(hi) - log(lo)) / n );
122  for (int i = 0; i <= n; ++i) {
123  if (i == 0) edges[i] = lo;
124  else edges[i] = logSpacing*edges[i-1];
125  }
126  return Custom(edges);
127  }
TSpline3 lo("lo", xlo, ylo, 12,"0")
TSpline3 hi("hi", xhi, yhi, 18,"0")
std::void_t< T > n
static Binning Custom(const std::vector< double > &edges)
Definition: Binning.cxx:145
double ana::Binning::Max ( ) const
inline

Definition at line 31 of file Binning.h.

References FindBin(), fMax, and submit_syst::x.

Referenced by ana::AlmostEqual(), plot_3flavor_withsysts(), ana::ToTH3Helper(), and ana::Hist::Write().

31 {return fMax;}
double fMax
Definition: Binning.h:58
double ana::Binning::Min ( ) const
inline

Definition at line 30 of file Binning.h.

References fMin.

Referenced by ana::AlmostEqual(), plot_3flavor_withsysts(), ana::ToTH3Helper(), and ana::Hist::Write().

30 {return fMin;}
double fMin
Definition: Binning.h:58
int ana::Binning::NBins ( ) const
inline

Definition at line 29 of file Binning.h.

References fNBins.

Referenced by ana::covmx::CovarianceMatrix::AddMatrix(), ana::AlmostEqual(), ana::covmx::CovarianceMatrix::BuildFullCovMx(), ana::OscCovMxExperiment::ChiSq(), ana::LikelihoodCovMxExperiment::ChiSq(), ana::covmx::CovarianceMatrix::CovarianceMatrix(), DecorrelateFD(), DecorrelateMatrix(), DrawBackgrounds(), DrawCCOscillations(), DrawSensitivityDip(), DrawSystShifts(), ana::covmx::CovarianceMatrix::GetCorrMxTH2(), ana::covmx::CovarianceMatrix::GetCovMxAbsoluteTH2(), ana::covmx::CovarianceMatrix::GetCovMxRelativeTH2(), ana::covmx::CovarianceMatrix::GetFullCorrMxTH2(), ana::covmx::CovarianceMatrix::GetFullCovMxTH2(), ana::GetQuantileBins(), ana::ReweightableSpectrum::LoadFrom(), ana::NumuCCIncAnalysis::LoadFrom(), ana::Make2DFrom1D(), ana::MakeTH3D(), MatrixDeterminant(), ana::Spectrum::Mean(), ana::PredictionExtendToPeripheral::MergePeripheralOsc(), NominalRat(), PackMatrix(), plot_3flavor_withsysts(), ana::NumuCCIncAnalysis::PlotHelper(), ana::covmx::CovarianceMatrix::Predict(), ana::Bayesian1DMarginal::QuantileRanges(), ana::PredictionExtendToPeripheral::ReduceHelper(), ana::PredictionExtendToPeripheral::ReduceHelperNC(), ana::LikelihoodCovMxExperiment::SaveHists(), SetBinsOnOffShift(), SetBinsPlusMinusOne(), ana::Spectrum::Spectrum(), ana::ToEigenSterile(), ana::Bayesian1DMarginal::ToTH1(), ana::Hist::ToTH1(), ana::ToTH2Helper(), ana::ToTH3Helper(), UnpackMatrix(), and ana::Hist::Write().

29 {return fNBins;}
int fNBins
Definition: Binning.h:57
bool ana::Binning::operator< ( const Binning rhs) const

Definition at line 282 of file Binning.cxx.

References fEdges, fIsSimple, fMax, fMin, and fNBins.

Referenced by Labels().

283  {
284  if(fIsSimple != rhs.fIsSimple) return fIsSimple < rhs.fIsSimple;
285  if(fIsSimple){
286  return std::make_tuple(fNBins, fMin, fMax) < std::make_tuple(rhs.fNBins, rhs.fMin, rhs.fMax);
287  }
288  else{
289  return fEdges < rhs.fEdges;
290  }
291  }
std::vector< double > fEdges
Definition: Binning.h:55
bool fIsSimple
Definition: Binning.h:59
double fMax
Definition: Binning.h:58
double fMin
Definition: Binning.h:58
int fNBins
Definition: Binning.h:57
Binning & ana::Binning::operator= ( const Binning b)

Definition at line 58 of file Binning.cxx.

References fEdges, fIsSimple, fLabels, fMax, fMin, fNBins, ana::DepMan< T >::Instance(), ana::DepMan< T >::RegisterConstruction(), and ana::DepMan< T >::RegisterDependency().

59  {
60  if(&b == this) return *this;
61 
62  if(b.fNBins){
63  fEdges = b.fEdges;
64  fLabels = b.fLabels;
65  fNBins = b.fNBins;
66  fMin = b.fMin;
67  fMax = b.fMax;
68  fIsSimple = b.fIsSimple;
69 
71  }
72  else{
73  fNBins = 0;
74  fMin = 0;
75  fMax = 0;
76  fIsSimple = false;
77 
78  // If we are copying from a Binning with zero bins, that is probably
79  // because it is all zero because it hasn't been statically constructed
80  // yet. Register our interest of getting constructed in turn once it is.
82  }
83 
84  return *this;
85  }
std::vector< std::string > fLabels
Definition: Binning.h:56
std::vector< double > fEdges
Definition: Binning.h:55
bool fIsSimple
Definition: Binning.h:59
void RegisterDependency(const T *parent, T *child)
Call from copy constructor and assignment operator.
Definition: DepMan.cxx:122
double fMax
Definition: Binning.h:58
static DepMan & Instance()
Definition: DepMan.cxx:51
const hit & b
Definition: hits.cxx:21
void RegisterConstruction(T *x)
Call from constructor (in the success case)
Definition: DepMan.cxx:73
double fMin
Definition: Binning.h:58
int fNBins
Definition: Binning.h:57
bool ana::Binning::operator== ( const Binning rhs) const

Definition at line 270 of file Binning.cxx.

References fEdges, fIsSimple, fMax, fMin, and fNBins.

Referenced by Labels().

271  {
272  if(fIsSimple != rhs.fIsSimple) return false;
273  if(fIsSimple){
274  return fNBins == rhs.fNBins && fMin == rhs.fMin && fMax == rhs.fMax;
275  }
276  else{
277  return fEdges == rhs.fEdges;
278  }
279  }
std::vector< double > fEdges
Definition: Binning.h:55
bool fIsSimple
Definition: Binning.h:59
double fMax
Definition: Binning.h:58
double fMin
Definition: Binning.h:58
int fNBins
Definition: Binning.h:57
void ana::Binning::SaveTo ( TDirectory *  dir,
const std::string name 
) const

Definition at line 193 of file Binning.cxx.

References dir, fEdges, fIsSimple, fLabels, fMax, fMin, fNBins, genie::utils::style::Format(), MECModelEnuComparisons::i, tmp, and Write().

Referenced by Labels(), and ana::PredictionExtendToPeripheral::SaveTo().

194  {
195  TDirectory* tmp = gDirectory;
196 
197  dir = dir->mkdir(name.c_str()); // switch to subdir
198  dir->cd();
199 
200  TObjString("Binning").Write("type");
201 
202  TVectorD nminmax(3);
203 
204  nminmax[0] = fNBins;
205  nminmax[1] = fMin;
206  nminmax[2] = fMax;
207 
208  nminmax.Write("nminmax");
209 
210  TVectorD issimple(1);
211  issimple[0] = fIsSimple;
212  issimple.Write("issimple");
213 
214  TVectorD edges(fEdges.size());
215  for(unsigned int i = 0; i < fEdges.size(); ++i)
216  edges[i] = fEdges[i];
217 
218  edges.Write("edges");
219 
220  for(unsigned int i = 0; i < fLabels.size(); ++i)
221  TObjString(fLabels[i].c_str()).Write(TString::Format("label%d", i).Data());
222 
223  dir->Write();
224  delete dir;
225 
226  tmp->cd();
227  }
const XML_Char * name
Definition: expat.h:151
std::vector< std::string > fLabels
Definition: Binning.h:56
Float_t tmp
Definition: plot.C:36
std::vector< double > fEdges
Definition: Binning.h:55
bool fIsSimple
Definition: Binning.h:59
double fMax
Definition: Binning.h:58
TDirectory * dir
Definition: macro.C:5
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
double fMin
Definition: Binning.h:58
int fNBins
Definition: Binning.h:57
gm Write()
Binning ana::Binning::Simple ( int  n,
double  lo,
double  hi,
const std::vector< std::string > &  labels = {} 
)
static

Definition at line 107 of file Binning.cxx.

References ana::bins, ana::DepMan< T >::Instance(), ana::DepMan< T >::RegisterConstruction(), and SimpleHelper().

Referenced by ana::AddHistDefNueEnergy(), ana::AddHistDefNueFD(), ana::AddHistDefNueLID(), ana::AddHistDefNueND(), ana::AddHistDefNuePID(), ana::AddHistDefNueSelectionExtras(), ana::AddHistDefNueShower(), ana::AddHistDefNumuMuon(), ana::AddHistDefNumuNDDataMC(), ana::AddHistDefNumuRecoE(), ana::AddHistDefPIDs(), ana::AddHistDefProngCVN(), ana::AddHistDefRecoFD(), ana::AddHistDefRecoND(), ana::AddHistDefSlice(), ana::AddHistDefSliceTruth(), ana::AddHistDefWeights(), ana::AddMultiHistDefProng(), ana::AddNTHistDef(), ana::AddNueHistDefBasic(), ana::AddNueHistDefConfusion(), ana::AddNueHistDefFinalStatesCvn(), ana::AddNueHistDefForLid(), ana::AddNueHistDefPIDs(), ana::AddNueHistDefProngCVN(), ana::AddNueHistDefSelectionExtras(), ana::AddNueHistDefShower(), ana::AddNueHistDefShowerFD(), ana::AddNueHistDefShowerND(), ana::AddNueHistDefTruth(), ana::AddNueHistDefVertexFD(), ana::AddNueHistDefVertexND(), ana::AddNueHistDefWeight(), AddNumuHistDef(), ana::AddNumuHistDefBasic(), ana::AddNumuHistDefBPF(), ana::AddNumuHistDefCosRej(), ana::AddNumuHistDefEnergy(), ana::AddNumuHistDefFD(), ana::AddNumuHistDefKalman(), AddNumuHistDefMoreTruth(), ana::AddNumuHistDefND(), ana::AddNumuHistDefNuTruth(), ana::AddNumuHistDefPIDs(), ana::AddNumuHistDefProng(), ana::AddNumuHistDefProngCVN(), ana::AddNumuHistDefReMId(), ana::AddNumuHistDefSliceTruth(), ana::AddNumuHistDefWeight(), AddNumuHistDefWeight(), ana::AddNusHistDefAna01Basic(), ana::AddNusHistDefFDExtra(), ana::AddNusHistDefTrack(), ana::AddNusHistDefTruth(), Ana2017_box_opening_macro(), Ana2017_sb_opening_macro(), Ana2018_box_opening_macro(), Analyse_Data2DataComp(), Analyse_Data2DataComp_HigherEnergyCuts(), Analyse_Data2DataComp_kNumu2020ND(), AnaResultsLoad(), Helper::Bins(), ana::BayesianSurface::BuildHist(), cafana_vars(), CalcCutVals(), cc(), compare_cos_numi(), CutFlow_Cosmic(), CutFlow_Data(), CutFlow_MC(), CutTableLoad(), CVNphoton(), CVNphotonSplit(), datamc_ND_numu_kinematics(), datamc_ND_numu_kinematics_FHC(), datamc_ND_numu_kinematics_FHC_pTBins(), datamc_ND_numu_kinematics_FHC_REW(), datamc_ND_numu_kinematics_FHC_REW_pTBins(), datamc_ND_numu_kinematics_REW(), datamc_ND_numu_kinematics_RHC(), datamc_ND_numu_kinematics_RHC_pTBins(), datamc_ND_numu_kinematics_RHC_REW(), datamc_ND_numu_kinematics_RHC_REW_pTBins(), DataMCLoad(), DataMCNDLoad_nus17(), DataVtxDistributionLoad(), demo0(), demo1(), demo2(), demo2p5a(), demo3(), demo4(), demo5(), demo6(), demo_cut_optimization(), demo_trivial_xsec_analysis(), demoSysts(), DrawBackgrounds(), DrawCCOscillations(), drawIntensityEffect_2019(), drawLongTerm(), drawLongTerm_2019(), DrawSensitivityDip(), drawShortTerm_2019(), drawTimePlots(), drawVsPOT(), efficiencySA(), EHadVisMECpairs(), energy_resolution(), EnergyCont_macro(), energyResolution(), Evaluate_BDTMLP_Algs_PredNoExtrap(), Evaluate_BDTMLP_Algs_Spectra(), example_macro(), ExtendedAxesLoad(), extract_resolution(), FD_Data_PosComp(), FD_plots(), FDDataMC(), FidOpt(), fiducial_accounting(), fiducial_opt(), FidWShwCuts(), FillSpectra(), generate_fd_fake_events(), GenFile(), genie_preds_make(), genie_syst_make(), get_cosmic_sample(), get_spectra_2dplots(), ana::LabelsAndBins::GetBins1D(), getBNBPlots(), getData(), GetHistsFD(), GetHistsND(), ana::GetNumuEhadFracQuantCuts2020(), getPredictions(), getStabilitySpectra(), getTimePeakPlots(), getTimePeakTotal(), hadEFrac_nd_data_mc_systs(), hyperon_macro(), hyperon_nom_macro(), InitAxes(), InitHistDefs(), load_files(), LoadFrom(), make_decomp(), make_michel(), make_nue_filesyst_pred(), make_nueFDprediction_kinematics(), make_nueFDprediction_kinematics_FHC(), make_nueFDprediction_kinematics_FHC_REW(), make_nueFDprediction_kinematics_REW(), make_nueFDprediction_kinematics_RHC(), make_nueFDprediction_kinematics_RHC_REW(), make_rhcpred_2017(), make_rockpred_2017(), make_xsec_tuning_hists_mp5(), make_xsec_wgts_2018_hists(), MakeCutFlowSpectra(), makeFakeDataFluxes(), MakeKin2DSpectra(), MakeNus17CosBkgd(), MakeNus17Prediction(), MakeNus18CosBkgd(), MakeNus18SidebandPred(), makeRealDataFluxes(), MakeSurface(), MakeTruthSpectra(), meanWeight_macro(), mec_tuning(), mec_tuning_preds_2020(), ana::PredictionExtendToPeripheral::MergePeripheral(), ana::PredictionExtendToPeripheral::MergePeripheralOsc(), MichelDecompTest(), modularextrap_demo_nue(), modularextrap_demo_numu(), mrbrem_get_initial_spectra(), mrbrem_get_reweighted_spectra(), mrbrem_plots(), MRDiFStudy_FHC_Step1(), MRDiFStudy_FHC_Step2(), MRDiFStudy_RHC_Step1(), MRDiFStudy_RHC_Step2(), mre_blessed(), mre_comp_split(), ana::MultiVar2D(), multiverse_efficiency_macro(), multiverse_macro(), muonID(), muonid_fhc_dist(), muonid_opt(), muonid_optimization(), muonid_rhc_dist(), nc_bkgd_by_interaction_mode(), ND_DataMC_Comp_Systs(), NDDataMC(), NDDataMCSystBandLoad(), neutKEsyst(), neutronE_macro(), nue_data_mc_validation(), nue_fd_mc_validation(), nue_michelDataMC(), nue_pid_effs(), nue_pid_effs_miniprod(), nue_pid_effs_paper_numu_neweff(), NuMu2019_BasicPIDPlots_FD(), NuMu2019_BasicPIDPlots_ND(), NuMu2019_BasicPIDPlots_Spectrum(), numu_cut_flow(), numu_data_mc_validation(), numu_validation_numuvars(), nus17_box_opening(), nus17_fiducial_accounting(), nus18_box_opening(), nus_ana01_box_opening(), nus_ana01_sideband_box_opening(), pi0_xcheck(), plot_3flavor_withsysts(), plot_kinematics_cafana(), PlotVisibleEnergy(), PositionComparison(), ppfx_make_systs(), ppfx_smooth_weights_save(), preselection_cutflow(), prod4_pid(), prongcvn_optimization(), purity(), ReMId(), resolution2018(), resolutionspectrums(), resolutionstudy(), runCheatDecomp(), runTwoSampleDecomp(), Selection_Opt_Multi(), Selection_Optimization(), ShwZOpt(), SideBandLoad(), specprod_numuccinc(), sterile_demo(), test_ana(), test_beam_errorband(), test_flux(), test_fluxhadr_prod_weights_Flux(), test_genieweights(), test_micheldecomp(), test_newloader(), test_nueextrapsyst(), test_prediction_interp(), test_predictionscalecomp(), test_saloaders(), test_sam(), test_sam_project(), test_stanfit_statsonly(), test_stanfit_systpulls(), test_stanfit_withsysts(), test_xsecanalysis(), timingPeak(), TrueNCSpectrum(), TrueSpectrumFromKaons(), uncertainty1png(), validation_numu_nd(), ana::Var2D(), ana::Var3D(), vertex_fiducial_optimization(), and vertex_optimize().

109  {
111 
113 
114  return bins;
115  }
TSpline3 lo("lo", xlo, ylo, 12,"0")
TSpline3 hi("hi", xhi, yhi, 18,"0")
std::void_t< T > n
const Binning bins
Definition: NumuCC_CPiBin.h:8
static DepMan & Instance()
Definition: DepMan.cxx:51
void RegisterConstruction(T *x)
Call from constructor (in the success case)
Definition: DepMan.cxx:73
static Binning SimpleHelper(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:88
Binning ana::Binning::SimpleHelper ( int  n,
double  lo,
double  hi,
const std::vector< std::string > &  labels = {} 
)
staticprotected

Definition at line 88 of file Binning.cxx.

References ana::assert(), ana::bins, fEdges, fIsSimple, fLabels, fMax, fMin, fNBins, hi(), MECModelEnuComparisons::i, makeTrainCVSamples::int, PandAna.Demos.pi0_spectra::labels, and lo().

Referenced by FromTAxis(), Labels(), and Simple().

90  {
91  assert(labels.empty() || int(labels.size()) == n);
92 
93  Binning bins;
94  bins.fNBins = n;
95  bins.fMin = lo;
96  bins.fMax = hi;
97  bins.fEdges.resize(n+1);
98  for (int i = 0; i <= n; i++)
99  bins.fEdges[i] = lo + i*(hi-lo)/n;
100  bins.fLabels = labels;
101  bins.fIsSimple = true;
102 
103  return bins;
104  }
TSpline3 lo("lo", xlo, ylo, 12,"0")
TSpline3 hi("hi", xhi, yhi, 18,"0")
std::void_t< T > n
const Binning bins
Definition: NumuCC_CPiBin.h:8
assert(nhit_max >=nhit_nbins)
int fNBins
Definition: Binning.h:57

Member Data Documentation

std::vector<double> ana::Binning::fEdges
protected
bool ana::Binning::fIsSimple
protected

Definition at line 59 of file Binning.h.

Referenced by Binning(), IsSimple(), operator<(), operator=(), operator==(), SaveTo(), and SimpleHelper().

std::vector<std::string> ana::Binning::fLabels
protected

Definition at line 56 of file Binning.h.

Referenced by Binning(), Labels(), LoadFrom(), operator=(), SaveTo(), and SimpleHelper().

double ana::Binning::fMax
protected

Definition at line 58 of file Binning.h.

Referenced by Binning(), FindBin(), Max(), operator<(), operator=(), operator==(), SaveTo(), and SimpleHelper().

double ana::Binning::fMin
protected

Definition at line 58 of file Binning.h.

Referenced by Binning(), FindBin(), Min(), operator<(), operator=(), operator==(), SaveTo(), and SimpleHelper().

int ana::Binning::fNBins
protected

Definition at line 57 of file Binning.h.

Referenced by Binning(), FindBin(), NBins(), operator<(), operator=(), operator==(), SaveTo(), and SimpleHelper().


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