Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static 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.06/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
 
int ID () 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)
 
static int MaxID ()
 

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)
 
static std::map< Binning, int > & IDMap ()
 

Protected Attributes

std::vector< double > fEdges
 
std::vector< std::string > fLabels
 
int fNBins
 
double fMin
 
double fMax
 
bool fIsSimple
 
int fID
 

Static Protected Attributes

static int fgNextID = 0
 The next ID that hasn't yet been assigned. More...
 

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 33 of file Binning.cxx.

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

34  {
35  if(&b == this) return;
36 
37  if(b.fNBins){
38  fEdges = b.fEdges;
39  fLabels = b.fLabels;
40  fNBins = b.fNBins;
41  fMin = b.fMin;
42  fMax = b.fMax;
43  fIsSimple = b.fIsSimple;
44  fID = b.fID;
45 
47  }
48  else{
49  fNBins = 0;
50  fMin = 0;
51  fMax = 0;
52  fIsSimple = false;
53  fID = 0;
54 
55  // If we are copying from a Binning with zero bins, that is probably
56  // because it is all zero because it hasn't been statically constructed
57  // yet. Register our interest of getting constructed in turn once it is.
59  }
60  }
std::vector< std::string > fLabels
Definition: Binning.h:59
std::vector< double > fEdges
Definition: Binning.h:58
bool fIsSimple
Definition: Binning.h:62
void RegisterDependency(const T *parent, T *child)
Call from copy constructor and assignment operator.
Definition: DepMan.cxx:122
double fMax
Definition: Binning.h:61
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:61
int fNBins
Definition: Binning.h:60
ana::Binning::~Binning ( )

Definition at line 27 of file Binning.cxx.

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

28  {
30  }
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 15 of file Binning.cxx.

Referenced by MaxID().

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

Member Function Documentation

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

Definition at line 161 of file Binning.cxx.

References ana::bins, CustomHelper(), febshutoff_auto::end, fgNextID, fID, IDMap(), ana::DepMan< T >::Instance(), it, and ana::DepMan< T >::RegisterConstruction().

Referenced by Analyse_Data2DataComp(), Analyse_Data2DataComp_HigherEnergyCuts(), Analyse_Data2DataComp_kNumu2020ND(), FHCFDBins(), FHCNDBins(), FromTAxis(), ana::covmx::CovarianceMatrix::GetBinning(), GetDefaultAxis(), ana::covmx::CovarianceMatrix::GetFullBinning(), GetHistsFD(), GetHistsND(), LoadFrom(), ana::covmx::CovarianceMatrix::LoadFrom(), LogUniform(), RHCFDBins(), RHCNDBins(), and ana::TrueEnergyBins().

162  {
163  Binning bins = CustomHelper(edges);
164 
165  auto it = IDMap().find(bins);
166  if(it == IDMap().end()){
167  bins.fID = fgNextID++;
168  IDMap().emplace(bins, bins.fID);
169  }
170  else{
171  bins.fID = it->second;
172  }
173 
175 
176  return bins;
177  }
set< int >::iterator it
static std::map< Binning, int > & IDMap()
Definition: Binning.cxx:330
static Binning CustomHelper(const std::vector< double > &edges)
Definition: Binning.cxx:146
static int fgNextID
The next ID that hasn&#39;t yet been assigned.
Definition: Binning.h:66
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
Binning ana::Binning::CustomHelper ( const std::vector< double > &  edges)
staticprotected

Definition at line 146 of file Binning.cxx.

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

Referenced by Custom(), and MaxID().

147  {
148  assert(edges.size() > 1);
149 
150  Binning bins;
151  bins.fEdges = edges;
152  bins.fNBins = edges.size()-1;
153  bins.fMin = edges.front();
154  bins.fMax = edges.back();
155  bins.fIsSimple = false;
156 
157  return bins;
158  }
std::vector< double > fEdges
Definition: Binning.h:58
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 180 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().

181  {
182  // Treat anything outside [fMin, fMax) as Underflow / Overflow
183  if (x < fMin) return 0; // Underflow
184  if (x >= fMax) return fEdges.size(); // Overflow
185 
186  // Follow ROOT convention, first bin of histogram is bin 1
187 
188  if(IsSimple()) return fNBins * (x - fMin) / (fMax - fMin) +1;
189 
190  int bin =
191  std::lower_bound(fEdges.begin(), fEdges.end(), x) - fEdges.begin();
192  if (x == fEdges[bin]) bin++;
193  assert(bin >= 0 && bin < (int)fEdges.size());
194  return bin;
195  }
std::vector< double > fEdges
Definition: Binning.h:58
bool IsSimple() const
Definition: Binning.h:33
float bin[41]
Definition: plottest35.C:14
double fMax
Definition: Binning.h:61
assert(nhit_max >=nhit_nbins)
double fMin
Definition: Binning.h:61
int fNBins
Definition: Binning.h:60
Binning ana::Binning::FromTAxis ( const TAxis *  ax)
static

Definition at line 198 of file Binning.cxx.

References ana::bins, Custom(), febshutoff_auto::end, fgNextID, fID, IDMap(), it, and SimpleHelper().

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

199  {
200  Binning bins;
201 
202  // Evenly spaced binning
203  if(!ax->GetXbins()->GetArray()){
204  bins = SimpleHelper(ax->GetNbins(), ax->GetXmin(), ax->GetXmax());
205  }
206  else{
207  std::vector<double> edges(ax->GetNbins()+1);
208  ax->GetLowEdge(&edges.front());
209  edges[ax->GetNbins()] = ax->GetBinUpEdge(ax->GetNbins());
210 
211  bins = Binning::Custom(edges);
212  }
213 
214  auto it = IDMap().find(bins);
215  if(it != IDMap().end()){
216  bins.fID = it->second;
217  }
218  else{
219  bins.fID = fgNextID++;
220  IDMap().emplace(bins, bins.fID);
221  }
222 
223  return bins;
224  }
set< int >::iterator it
static std::map< Binning, int > & IDMap()
Definition: Binning.cxx:330
static int fgNextID
The next ID that hasn&#39;t yet been assigned.
Definition: Binning.h:66
static Binning Custom(const std::vector< double > &edges)
Definition: Binning.cxx:161
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:95
int ana::Binning::ID ( ) const
inline

Definition at line 44 of file Binning.h.

References fID.

44 {return fID;}
std::map< Binning, int > & ana::Binning::IDMap ( )
staticprotected

Definition at line 330 of file Binning.cxx.

References runNovaSAM::ret.

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

331  {
332  static std::map<Binning, int> ret;
333  return ret;
334  }
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:62
const std::vector<std::string>& ana::Binning::Labels ( ) const
inline

Definition at line 39 of file Binning.h.

References dir, fLabels, LoadFrom(), and SaveTo().

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

Definition at line 264 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().

265  {
266  dir = dir->GetDirectory(name.c_str()); // switch to subdir
267  assert(dir);
268 
269  TObjString* tag = (TObjString*)dir->Get("type");
270  assert(tag);
271  assert(tag->GetString() == "Binning");
272 
273  TVectorD* vMinMax = (TVectorD*)dir->Get("nminmax");
274  assert(vMinMax);
275 
276  Binning ret;
277 
278  const TVectorD* issimple = (TVectorD*)dir->Get("issimple");
279  if((*issimple)[0]){
280  ret = Binning::Simple((*vMinMax)[0],
281  (*vMinMax)[1],
282  (*vMinMax)[2]);
283  }
284  else{
285  const TVectorD* vEdges = (TVectorD*)dir->Get("edges");
286  std::vector<double> edges(vEdges->GetNrows());
287  for(int i = 0; i < vEdges->GetNrows(); ++i) edges[i] = (*vEdges)[i];
288 
289  ret = Binning::Custom(edges);
290  }
291 
292  for(unsigned int i = 0; ; ++i){
293  TObjString* s = (TObjString*)dir->Get(TString::Format("label%d", i).Data());
294  if(!s) break;
295  ret.fLabels.push_back(s->GetString().Data());
296  }
297 
298  delete dir;
299 
300  return std::make_unique<Binning>(ret);
301  }
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:161
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:114
Binning ana::Binning::LogUniform ( int  n,
double  lo,
double  hi 
)
static

Definition at line 134 of file Binning.cxx.

References Custom(), stan::math::exp(), MECModelEnuComparisons::i, lo(), test_ParserArtEvents::log, and getGoodRuns4SAM::n.

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

135  {
136  std::vector<double> edges(n+1);
137  const double logSpacing = exp( (log(hi) - log(lo)) / n );
138  for (int i = 0; i <= n; ++i) {
139  if (i == 0) edges[i] = lo;
140  else edges[i] = logSpacing*edges[i-1];
141  }
142  return Custom(edges);
143  }
TSpline3 lo("lo", xlo, ylo, 12,"0")
TSpline3 hi("hi", xhi, yhi, 18,"0")
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
static Binning Custom(const std::vector< double > &edges)
Definition: Binning.cxx:161
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:61
static int ana::Binning::MaxID ( )
inlinestatic

Definition at line 45 of file Binning.h.

References Binning(), CustomHelper(), fgNextID, PandAna.Demos.pi0_spectra::labels, operator<(), operator==(), and SimpleHelper().

45 {return fgNextID-1;}
static int fgNextID
The next ID that hasn&#39;t yet been assigned.
Definition: Binning.h:66
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:61
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::LikelihoodCovMxExperiment::ChiSq(), ana::OscCovMxExperiment::ChiSq(), ana::covmx::CovarianceMatrix::CovarianceMatrix(), ana::CovMxSurface::CovMxSurface(), 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(), MakeFakeData(), 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::ToEigen(), ana::Bayesian1DMarginal::ToTH1(), ana::Hist::ToTH1(), ana::ToTH2Helper(), ana::ToTH3Helper(), UnpackMatrix(), and ana::Hist::Write().

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

Definition at line 318 of file Binning.cxx.

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

Referenced by MaxID().

319  {
320  if(fIsSimple != rhs.fIsSimple) return fIsSimple < rhs.fIsSimple;
321  if(fIsSimple){
322  return std::make_tuple(fNBins, fMin, fMax) < std::make_tuple(rhs.fNBins, rhs.fMin, rhs.fMax);
323  }
324  else{
325  return fEdges < rhs.fEdges;
326  }
327  }
std::vector< double > fEdges
Definition: Binning.h:58
bool fIsSimple
Definition: Binning.h:62
double fMax
Definition: Binning.h:61
double fMin
Definition: Binning.h:61
int fNBins
Definition: Binning.h:60
Binning & ana::Binning::operator= ( const Binning b)

Definition at line 63 of file Binning.cxx.

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

64  {
65  if(&b == this) return *this;
66 
67  if(b.fNBins){
68  fEdges = b.fEdges;
69  fLabels = b.fLabels;
70  fNBins = b.fNBins;
71  fMin = b.fMin;
72  fMax = b.fMax;
73  fIsSimple = b.fIsSimple;
74  fID = b.fID;
75 
77  }
78  else{
79  fNBins = 0;
80  fMin = 0;
81  fMax = 0;
82  fIsSimple = false;
83  fID = 0;
84 
85  // If we are copying from a Binning with zero bins, that is probably
86  // because it is all zero because it hasn't been statically constructed
87  // yet. Register our interest of getting constructed in turn once it is.
89  }
90 
91  return *this;
92  }
std::vector< std::string > fLabels
Definition: Binning.h:59
std::vector< double > fEdges
Definition: Binning.h:58
bool fIsSimple
Definition: Binning.h:62
void RegisterDependency(const T *parent, T *child)
Call from copy constructor and assignment operator.
Definition: DepMan.cxx:122
double fMax
Definition: Binning.h:61
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:61
int fNBins
Definition: Binning.h:60
bool ana::Binning::operator== ( const Binning rhs) const

Definition at line 304 of file Binning.cxx.

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

Referenced by MaxID().

305  {
306  // NB don't look at ID here or in < because we use these in the maps below
307  // that are used to find the IDs in the first place
308  if(fIsSimple != rhs.fIsSimple) return false;
309  if(fIsSimple){
310  return fNBins == rhs.fNBins && fMin == rhs.fMin && fMax == rhs.fMax;
311  }
312  else{
313  return fEdges == rhs.fEdges;
314  }
315  }
std::vector< double > fEdges
Definition: Binning.h:58
bool fIsSimple
Definition: Binning.h:62
double fMax
Definition: Binning.h:61
double fMin
Definition: Binning.h:61
int fNBins
Definition: Binning.h:60
void ana::Binning::SaveTo ( TDirectory *  dir,
const std::string &  name 
) const

Definition at line 227 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().

228  {
229  TDirectory* tmp = gDirectory;
230 
231  dir = dir->mkdir(name.c_str()); // switch to subdir
232  dir->cd();
233 
234  TObjString("Binning").Write("type");
235 
236  TVectorD nminmax(3);
237 
238  nminmax[0] = fNBins;
239  nminmax[1] = fMin;
240  nminmax[2] = fMax;
241 
242  nminmax.Write("nminmax");
243 
244  TVectorD issimple(1);
245  issimple[0] = fIsSimple;
246  issimple.Write("issimple");
247 
248  TVectorD edges(fEdges.size());
249  for(unsigned int i = 0; i < fEdges.size(); ++i)
250  edges[i] = fEdges[i];
251 
252  edges.Write("edges");
253 
254  for(unsigned int i = 0; i < fLabels.size(); ++i)
255  TObjString(fLabels[i].c_str()).Write(TString::Format("label%d", i).Data());
256 
257  dir->Write();
258  delete dir;
259 
260  tmp->cd();
261  }
const XML_Char * name
Definition: expat.h:151
std::vector< std::string > fLabels
Definition: Binning.h:59
Float_t tmp
Definition: plot.C:36
std::vector< double > fEdges
Definition: Binning.h:58
bool fIsSimple
Definition: Binning.h:62
double fMax
Definition: Binning.h:61
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:61
int fNBins
Definition: Binning.h:60
gm Write()
Binning ana::Binning::Simple ( int  n,
double  lo,
double  hi,
const std::vector< std::string > &  labels = {} 
)
static

Definition at line 114 of file Binning.cxx.

References ana::bins, febshutoff_auto::end, fgNextID, fID, IDMap(), ana::DepMan< T >::Instance(), it, 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(), caf_nue_data_mc(), caf_numu_fd_validation_data(), caf_numu_fd_validation_MC(), caf_numu_fd_validation_MC_no_tau(), caf_numu_nd_cutflow(), caf_numu_nuenergy_vs_xy(), caf_numu_reco_minus_true(), caf_numu_sensitivity(), caf_numu_sensitivity_no_tau(), caf_numu_validation(), caf_numu_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(), EnergyCont_macro(), energyResolution(), Evaluate_BDTMLP_Algs_PredNoExtrap(), Evaluate_BDTMLP_Algs_Spectra(), ExtendedAxesLoad(), extract_resolution(), FD_Data_PosComp(), FD_plots(), FDDataMC(), FidOpt(), fiducial_accounting(), 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(), 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(), MakeSurfaceJoint(), MakeSurfaceLLTest(), MakeSurfaceNoNDOsc(), MakeTruthSpectra(), 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(), muonid_opt(), muonid_optimization(), 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(), PositionComparison(), ppfx_make_systs(), ppfx_smooth_weights_save(), preselection_cutflow(), prod4_pid(), prongcvn_optimization(), ReMId(), resolution2018(), resolutionspectrums(), resolutionstudy(), runCheatDecomp(), runTwoSampleDecomp(), ShwZOpt(), SideBandLoad(), specprod_numuccinc(), sterile_demo(), test_ana(), test_beam_errorband(), test_flux(), test_fluxhadr_prod_weights_Flux(), test_genieweights(), test_micheldecomp(), 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(), and vertex_optimize().

116  {
118 
119  auto it = IDMap().find(bins);
120  if(it == IDMap().end()){
121  bins.fID = fgNextID++;
122  IDMap().emplace(bins, bins.fID);
123  }
124  else{
125  bins.fID = it->second;
126  }
127 
129 
130  return bins;
131  }
TSpline3 lo("lo", xlo, ylo, 12,"0")
set< int >::iterator it
static std::map< Binning, int > & IDMap()
Definition: Binning.cxx:330
static int fgNextID
The next ID that hasn&#39;t yet been assigned.
Definition: Binning.h:66
TSpline3 hi("hi", xhi, yhi, 18,"0")
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:95
Binning ana::Binning::SimpleHelper ( int  n,
double  lo,
double  hi,
const std::vector< std::string > &  labels = {} 
)
staticprotected

Definition at line 95 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, lo(), and getGoodRuns4SAM::n.

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

97  {
98  assert(labels.empty() || int(labels.size()) == n);
99 
100  Binning bins;
101  bins.fNBins = n;
102  bins.fMin = lo;
103  bins.fMax = hi;
104  bins.fEdges.resize(n+1);
105  for (int i = 0; i <= n; i++)
106  bins.fEdges[i] = lo + i*(hi-lo)/n;
107  bins.fLabels = labels;
108  bins.fIsSimple = true;
109 
110  return bins;
111  }
TSpline3 lo("lo", xlo, ylo, 12,"0")
TSpline3 hi("hi", xhi, yhi, 18,"0")
const Binning bins
Definition: NumuCC_CPiBin.h:8
assert(nhit_max >=nhit_nbins)
int fNBins
Definition: Binning.h:60

Member Data Documentation

std::vector<double> ana::Binning::fEdges
protected
int ana::Binning::fgNextID = 0
staticprotected

The next ID that hasn't yet been assigned.

Definition at line 66 of file Binning.h.

Referenced by Custom(), FromTAxis(), MaxID(), and Simple().

int ana::Binning::fID
protected

Definition at line 64 of file Binning.h.

Referenced by Binning(), Custom(), FromTAxis(), ID(), operator=(), and Simple().

bool ana::Binning::fIsSimple
protected

Definition at line 62 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 59 of file Binning.h.

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

double ana::Binning::fMax
protected

Definition at line 61 of file Binning.h.

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

double ana::Binning::fMin
protected

Definition at line 61 of file Binning.h.

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

int ana::Binning::fNBins
protected

Definition at line 60 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: