Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ana::Multiverse Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/CAFAna/XSec/Multiverse.h"

Public Member Functions

 Multiverse (SpectrumLoaderBase &, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
 
 Multiverse (SpectrumLoaderBase &, const NuTruthHistAxis &, const NuTruthCut &, std::vector< SystShifts >, const NuTruthVar &)
 
 Multiverse (SpectrumLoaderBase &, const NuTruthHistAxis &, const NuTruthCut &, const SystShifts &, std::vector< NuTruthVar >, const NuTruthVar &)
 
 Multiverse (SpectrumLoaderBase &, const HistAxis &, const Cut &, const SystShifts &, std::vector< Var >, const Var &)
 
 Multiverse (std::vector< SpectrumLoaderBase * >, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
 
 Multiverse (std::vector< SpectrumLoaderBase * >, const NuTruthHistAxis &, const NuTruthCut &, std::vector< SystShifts >, const NuTruthVar &)
 
 Multiverse (std::vector< SpectrumLoaderBase * >, const NuTruthHistAxis &, const NuTruthCut &, const SystShifts &, std::vector< NuTruthVar >, const NuTruthVar &)
 
 Multiverse (std::vector< SpectrumLoaderBase * >, const HistAxis &, const Cut &, const SystShifts &, std::vector< Var >, const Var &)
 
 Multiverse (std::vector< Spectrum * >)
 
 Multiverse (std::vector< TH1 * >, int)
 
void Transform (const Multiverse &rhs, const std::function< ProductFunc_t > &transform)
 
void Transform (const std::function< TransformFunc_t > &transform)
 
void Transform (const std::function< TransformSpectraFunc_t > &transform)
 
SpectrumGetPlusOneSigmaShift (const Spectrum *)
 
SpectrumGetMinusOneSigmaShift (const Spectrum *)
 
SpectrumGetNSigmaShift (const Spectrum *, double)
 
TH1 * GetPlusOneSigmaShift (const TH1 *)
 
TH1 * GetMinusOneSigmaShift (const TH1 *)
 
TH1 * GetNSigmaShift (const TH1 *, double)
 
const std::vector< TH1 * > GetUniversesHist ()
 
const std::vector< TH1 * > GetUniversesHist (int line_color, int line_style=kSolid)
 
void SaveTo (TDirectory *dir, const std::string &name) const
 
 Multiverse (const Multiverse &)
 
 Multiverse (Multiverse &&)
 
Multiverseoperator= (const Multiverse &)
 
Multiverseoperator= (Multiverse &&)
 
 ~Multiverse ()
 
void Divide (Multiverse &, bool=false)
 
void Scale (double scale)
 
Multiverseoperator*= (const Multiverse &)
 
Multiverse operator* (const Multiverse &) const
 
Multiverseoperator/= (const Spectrum &)
 
Multiverse operator/ (const Spectrum &) const
 
Multiverseoperator*= (const Spectrum &)
 
Multiverse operator* (const Spectrum &) const
 
Multiverseoperator/= (const TH1 &)
 
Multiverse operator/ (const TH1 &) const
 
Multiverseoperator*= (const TH1 &)
 
Multiverse operator* (const TH1 &) const
 
int GetNUniverses () const
 

Static Public Member Functions

static Multiverse CopyAndTransform (const Multiverse &rhs, const std::function< TransformFunc_t > &transform)
 
static std::unique_ptr< MultiverseLoadFrom (TDirectory *dir, const std::string &name)
 

Private Member Functions

void DivisionHelper (TH1 *, TH1 *, bool)
 
double BinSigma (std::vector< double >, double, double)
 
void InitFromSpectra ()
 
TH1 * ToHist (const Spectrum *, double=-1)
 
SpectrumToSpectrum (TH1 *h, double POT=1, double livetime=0)
 

Private Attributes

std::vector< Spectrum * > fSpectra
 
std::vector< BinningfBinning
 
std::vector< std::stringfLabels
 
std::vector< TH1 * > fHists
 
int fNUniverses
 

Detailed Description

Definition at line 10 of file Multiverse.h.

Constructor & Destructor Documentation

ana::Multiverse::Multiverse ( SpectrumLoaderBase loader,
const HistAxis histaxis,
const Cut cut,
std::vector< SystShifts shifts,
const Var weight 
)

Definition at line 315 of file Multiverse.cxx.

References fNUniverses, fSpectra, MECModelEnuComparisons::i, and makeTrainCVSamples::int.

Referenced by LoadFrom().

320  {
321  fNUniverses = shifts.size();
322  for(int i = 0; i < (int) shifts.size(); i++) {
323  fSpectra.push_back(new Spectrum(loader,
324  histaxis,
325  cut,
326  shifts[i],
327  weight));
328  }
329  }
const Var weight
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
loader
Definition: demo0.py:10
std::vector< float > Spectrum
Definition: Constants.h:610
const Cut cut
Definition: exporter_fd.C:30
ana::Multiverse::Multiverse ( SpectrumLoaderBase loader,
const NuTruthHistAxis histaxis,
const NuTruthCut cut,
std::vector< SystShifts shifts,
const NuTruthVar weight 
)

Definition at line 274 of file Multiverse.cxx.

References fNUniverses, fSpectra, MECModelEnuComparisons::i, and makeTrainCVSamples::int.

279  {
280  fNUniverses = shifts.size();
281  for(int i = 0; i < (int) shifts.size(); i++) {
282  fSpectra.push_back(new Spectrum(loader,
283  histaxis,
284  cut,
285  shifts[i],
286  weight));
287  }
288  }
const Var weight
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
loader
Definition: demo0.py:10
std::vector< float > Spectrum
Definition: Constants.h:610
const Cut cut
Definition: exporter_fd.C:30
ana::Multiverse::Multiverse ( SpectrumLoaderBase loader,
const NuTruthHistAxis histaxis,
const NuTruthCut cut,
const SystShifts shift,
std::vector< NuTruthVar weights,
const NuTruthVar common_weight 
)

Definition at line 356 of file Multiverse.cxx.

References fNUniverses, fSpectra, MECModelEnuComparisons::i, and makeTrainCVSamples::int.

362  {
363  fNUniverses = weights.size();
364  for(int i = 0; i < (int) weights.size(); i++) {
365  fSpectra.push_back(new Spectrum(loader,
366  histaxis,
367  cut,
368  shift,
369  weights[i] * common_weight));
370  }
371  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
Var weights
loader
Definition: demo0.py:10
std::vector< float > Spectrum
Definition: Constants.h:610
const Cut cut
Definition: exporter_fd.C:30
ana::Multiverse::Multiverse ( SpectrumLoaderBase loader,
const HistAxis histaxis,
const Cut cut,
const SystShifts shift,
std::vector< Var weights,
const Var common_weight 
)

Definition at line 399 of file Multiverse.cxx.

References fNUniverses, fSpectra, MECModelEnuComparisons::i, and makeTrainCVSamples::int.

405  {
406  fNUniverses = weights.size();
407  for(int i = 0; i < (int) weights.size(); i++) {
408  fSpectra.push_back(new Spectrum(loader,
409  histaxis,
410  cut,
411  shift,
412  weights[i] * common_weight));
413  }
414  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
Var weights
loader
Definition: demo0.py:10
std::vector< float > Spectrum
Definition: Constants.h:610
const Cut cut
Definition: exporter_fd.C:30
ana::Multiverse::Multiverse ( std::vector< SpectrumLoaderBase * >  loaders,
const HistAxis histaxis,
const Cut cut,
std::vector< SystShifts shifts,
const Var weight 
)

Definition at line 332 of file Multiverse.cxx.

References cut, fNUniverses, fSpectra, ana::_HistAxis< T >::GetVar1D(), MECModelEnuComparisons::i, makeTrainCVSamples::int, submit_hadd::u, and ana::weight.

337  {
338  fNUniverses = shifts.size();
339  for(int i = 0; i < (int) shifts.size(); i++) {
340  fSpectra.push_back(new Spectrum(*loaders[0],
341  histaxis,
342  cut,
343  shifts[i],
344  weight));
345  for(auto iload = 1u; iload < loaders.size(); iload++) {
346  loaders[iload]->AddSpectrum(*fSpectra.back(),
347  histaxis.GetVar1D(),
348  cut,
349  shifts[i],
350  weight);
351  }
352  }
353  }
const Var weight
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< float > Spectrum
Definition: Constants.h:610
const Cut cut
Definition: exporter_fd.C:30
std::vector< Loaders * > loaders
Definition: syst_header.h:386
ana::Multiverse::Multiverse ( std::vector< SpectrumLoaderBase * >  loaders,
const NuTruthHistAxis histaxis,
const NuTruthCut cut,
std::vector< SystShifts shifts,
const NuTruthVar weight 
)

Definition at line 291 of file Multiverse.cxx.

References cut, fNUniverses, fSpectra, ana::_HistAxis< T >::GetVar1D(), MECModelEnuComparisons::i, makeTrainCVSamples::int, submit_hadd::u, and ana::weight.

296  {
297  fNUniverses = shifts.size();
298  for(int i = 0; i < (int) shifts.size(); i++) {
299  fSpectra.push_back(new Spectrum(*loaders[0],
300  histaxis,
301  cut,
302  shifts[i],
303  weight));
304  for(auto iload = 1u; iload < loaders.size(); iload++) {
305  loaders[iload]->AddSpectrum(*fSpectra.back(),
306  histaxis.GetVar1D(),
307  cut,
308  shifts[i],
309  weight);
310  }
311  }
312  }
const Var weight
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< float > Spectrum
Definition: Constants.h:610
const Cut cut
Definition: exporter_fd.C:30
std::vector< Loaders * > loaders
Definition: syst_header.h:386
ana::Multiverse::Multiverse ( std::vector< SpectrumLoaderBase * >  loaders,
const NuTruthHistAxis histaxis,
const NuTruthCut cut,
const SystShifts shift,
std::vector< NuTruthVar weights,
const NuTruthVar common_weight 
)

Definition at line 374 of file Multiverse.cxx.

References cut, fNUniverses, fSpectra, ana::_HistAxis< T >::GetVar1D(), MECModelEnuComparisons::i, makeTrainCVSamples::int, and submit_hadd::u.

380  {
381  fNUniverses = weights.size();
382  for(int i = 0; i < (int) weights.size(); i++) {
383  fSpectra.push_back(new Spectrum(*loaders[0],
384  histaxis,
385  cut,
386  shift,
387  weights[i] * common_weight));
388  for(auto iload = 1u; iload < loaders.size(); iload++) {
389  loaders[iload]->AddSpectrum(*fSpectra.back(),
390  histaxis.GetVar1D(),
391  cut,
392  shift,
393  weights[i] * common_weight);
394  }
395  }
396  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
Var weights
std::vector< float > Spectrum
Definition: Constants.h:610
const Cut cut
Definition: exporter_fd.C:30
std::vector< Loaders * > loaders
Definition: syst_header.h:386
ana::Multiverse::Multiverse ( std::vector< SpectrumLoaderBase * >  loaders,
const HistAxis histaxis,
const Cut cut,
const SystShifts shift,
std::vector< Var weights,
const Var common_weight 
)

Definition at line 417 of file Multiverse.cxx.

References cut, fNUniverses, fSpectra, ana::_HistAxis< T >::GetVar1D(), MECModelEnuComparisons::i, makeTrainCVSamples::int, and submit_hadd::u.

423  {
424  fNUniverses = weights.size();
425  for(int i = 0; i < (int) weights.size(); i++) {
426  fSpectra.push_back(new Spectrum(*loaders[0],
427  histaxis,
428  cut,
429  shift,
430  weights[i] * common_weight));
431  for(auto iload = 1u; iload < loaders.size(); iload++) {
432  loaders[iload]->AddSpectrum(*fSpectra.back(),
433  histaxis.GetVar1D(),
434  cut,
435  shift,
436  weights[i] * common_weight);
437  }
438  }
439  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
Var weights
std::vector< float > Spectrum
Definition: Constants.h:610
const Cut cut
Definition: exporter_fd.C:30
std::vector< Loaders * > loaders
Definition: syst_header.h:386
ana::Multiverse::Multiverse ( std::vector< Spectrum * >  specs)

Definition at line 670 of file Multiverse.cxx.

References ana::assert(), fNUniverses, fSpectra, and MECModelEnuComparisons::i.

671  {
672  this->fNUniverses = specs.size();
673  assert(fNUniverses == (int) specs.size() && "fNUniverses does not match size of spectrum vector");
674  for(int i = 0; i < this->fNUniverses; i++) {
675  fSpectra.push_back(specs[i]);
676  specs[i] = NULL;
677  }
678  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
assert(nhit_max >=nhit_nbins)
ana::Multiverse::Multiverse ( std::vector< TH1 * >  hists,
int  ndims 
)

Definition at line 681 of file Multiverse.cxx.

References ana::assert(), fHists, fNUniverses, and MECModelEnuComparisons::i.

683  {
684  this->fNUniverses = hists.size();
685  assert(fNUniverses == (int) hists.size() && "fNUniverses does not match size of histogram vector");
686  for(int i = 0; i < this->fNUniverses; i++) {
687  fHists.push_back(hists[i]);
688  hists[i] = NULL;
689  }
690  }
TString hists[nhists]
Definition: bdt_com.C:3
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
ana::Multiverse::Multiverse ( const Multiverse rhs)

Definition at line 644 of file Multiverse.cxx.

References fHists, fNUniverses, fSpectra, MECModelEnuComparisons::i, and submit_hadd::u.

645  {
646  this->fNUniverses = rhs.fNUniverses;
647  for(auto i = 0u; i < rhs.fSpectra.size(); i++) {
648  this->fSpectra.push_back(new Spectrum(*rhs.fSpectra[i]));
649  }
650  for(auto i = 0u; i< rhs.fHists.size(); i++) {
651  this->fHists.push_back((TH1*) rhs.fHists[i]->Clone());
652  }
653 
654  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
std::vector< float > Spectrum
Definition: Constants.h:610
ana::Multiverse::Multiverse ( Multiverse &&  rhs)

Definition at line 657 of file Multiverse.cxx.

References fHists, fNUniverses, fSpectra, MECModelEnuComparisons::i, and submit_hadd::u.

658  {
659  this->fNUniverses = rhs.fNUniverses;
660  for(auto i = 0u; i < rhs.fSpectra.size(); i++) {
661  this->fSpectra.push_back(std::move(rhs.fSpectra[i]));
662  }
663  for(auto i = 0u; i< rhs.fHists.size(); i++) {
664  this->fHists.push_back(std::move(rhs.fHists[i]));
665  }
666 
667  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
ana::Multiverse::~Multiverse ( )

Definition at line 632 of file Multiverse.cxx.

References fHists, fSpectra, MECModelEnuComparisons::i, and makeTrainCVSamples::int.

633  {
634  for(int i = 0; i < (int) fSpectra.size(); i++) {
635  delete fSpectra[i];
636  }
637  for(int i = 0; i < (int) fHists.size(); i++) {
638  delete fHists[i];
639  }
640 
641  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< TH1 * > fHists
Definition: Multiverse.h:119

Member Function Documentation

double ana::Multiverse::BinSigma ( std::vector< double >  events,
double  nsigma,
double  pivot 
)
private

Definition at line 520 of file Multiverse.cxx.

References MECModelEnuComparisons::i, allTimeWatchdog::index, makeTrainCVSamples::int, std::max(), std::min(), and stan::math::normal_cdf().

Referenced by GetNSigmaShift(), and GetNUniverses().

523  {
524  int pivotbin = 0;
525  double pivotbincenter = 0;
526  std::sort(events.begin(), events.end());
527  for(int i = 0; i < (int) events.size() - 1; i++) {
528  if(pivot >= events[i] && pivot < events[i+1]) {
529  pivotbin = i;
530  break;
531  }
532  }
533  pivotbincenter = pivotbin+0.5;
534  double count_fraction = 2.0 * (ROOT::Math::normal_cdf(nsigma) - ROOT::Math::normal_cdf(0));
535 
536  int nsideevents = 0;
537  int lastbinindex = (int) events.size() - 1;
538  if(nsigma >= 0) nsideevents = lastbinindex - pivotbin;
539  else nsideevents = pivotbin;
540  int boundIdx = pivotbincenter + count_fraction*(double)nsideevents;
541 
542  int index = 0;
543  if(nsigma >= 0) index = std::min(boundIdx, (int)events.size() - 1);
544  else index = std::max(boundIdx, 0);
545  return events.at(index);
546  }
T max(const caf::Proxy< T > &a, T b)
T min(const caf::Proxy< T > &a, T b)
return_type< T_y, T_loc, T_scale >::type normal_cdf(const T_y &y, const T_loc &mu, const T_scale &sigma)
Definition: normal_cdf.hpp:39
void events(int which)
Definition: Cana.C:52
Multiverse ana::Multiverse::CopyAndTransform ( const Multiverse rhs,
const std::function< TransformFunc_t > &  transform 
)
static

Definition at line 29 of file Multiverse.cxx.

References runNovaSAM::ret, and Transform().

31  {
32  Multiverse ret(rhs);
33  ret.Transform(transform);
34  return ret;
35  }
Multiverse(SpectrumLoaderBase &, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
Definition: Multiverse.cxx:315
void ana::Multiverse::Divide ( Multiverse rhs,
bool  binomial_errors = false 
)

Definition at line 139 of file Multiverse.cxx.

References ana::assert(), DivisionHelper(), fHists, fNUniverses, MECModelEnuComparisons::i, and InitFromSpectra().

Referenced by ana::CutOptimization::Efficiency(), ana::TrivialCrossSectionAnalysis::FluxError(), ana::TrivialCrossSectionAnalysis::GenieError(), and wrong_sign_uncertainty().

140  {
141  if(fHists.size() == 0)
142  this->InitFromSpectra();
143  if(rhs.fHists.size() == 0)
144  rhs.InitFromSpectra();
145  assert(fHists.size() == rhs.fHists.size() &&
146  "Multiverses are not compatible");
147  for(int i = 0; i < fNUniverses; i++) {
148  DivisionHelper(fHists[i], rhs.fHists[i], binomial_errors);
149  }
150  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
void InitFromSpectra()
Definition: Multiverse.cxx:694
assert(nhit_max >=nhit_nbins)
void DivisionHelper(TH1 *, TH1 *, bool)
Definition: Multiverse.cxx:129
void ana::Multiverse::DivisionHelper ( TH1 *  h1,
TH1 *  h2,
bool  binomial_errors 
)
private

Definition at line 129 of file Multiverse.cxx.

Referenced by Divide(), and GetNUniverses().

130  {
131  if(binomial_errors)
132  h1->Divide(h1, h2, 1, 1, "B");
133  else
134  h1->Divide(h2);
135  }
TH1F * h2
Definition: plot.C:45
TH1F * h1
Spectrum * ana::Multiverse::GetMinusOneSigmaShift ( const Spectrum nominal)
TH1 * ana::Multiverse::GetMinusOneSigmaShift ( const TH1 *  nominal)

Definition at line 464 of file Multiverse.cxx.

References GetNSigmaShift().

465  {
466  return GetNSigmaShift(nominal, -1);
467  }
Spectrum * GetNSigmaShift(const Spectrum *, double)
Definition: Multiverse.cxx:471
Spectrum * ana::Multiverse::GetNSigmaShift ( const Spectrum nominal,
double  nsigma 
)

Definition at line 471 of file Multiverse.cxx.

References fSpectra, livetime, ana::Spectrum::Livetime(), POT, ana::Spectrum::POT(), ToSpectrum(), and ana::Spectrum::ToTH1().

Referenced by GetMinusOneSigmaShift(), and GetPlusOneSigmaShift().

472  {
473  // keep track of binning info to make a correct spectrum at the end
474  double POT = nominal->POT();
475  double livetime = nominal->Livetime();
476 
477 
478  // transform to 1D hists
479  TH1 * hnominal = nominal->ToTH1(fSpectra[0]->POT());
480  TH1D * shift = (TH1D*)GetNSigmaShift(hnominal, nsigma);
481  return ToSpectrum(shift, POT, livetime);
482  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< double > POT
double livetime
Definition: saveFDMCHists.C:21
Spectrum * ToSpectrum(TH1 *h, double POT=1, double livetime=0)
Definition: Multiverse.cxx:733
Spectrum * GetNSigmaShift(const Spectrum *, double)
Definition: Multiverse.cxx:471
TH1 * ana::Multiverse::GetNSigmaShift ( const TH1 *  nominal,
double  nsigma 
)

Definition at line 486 of file Multiverse.cxx.

References ana::assert(), BinSigma(), cv, fHists, fSpectra, MECModelEnuComparisons::i, InitFromSpectra(), makeTrainCVSamples::int, and calib::j.

487  {
488  if(fHists.empty())
489  InitFromSpectra();
490  // transform to 1D hists
491  TH1 * hret = (TH1*) nominal->Clone();
492  for(int i = 0; i < (int) fSpectra.size(); i++) {
493  // verify histograms are compatable
494  assert(nominal->GetNbinsX() == fHists[i]->GetNbinsX());
495  assert(nominal->GetNbinsY() == fHists[i]->GetNbinsY());
496  assert(nominal->GetNbinsZ() == fHists[i]->GetNbinsZ());
497  }
498 
499  // for each bin, calculate the shift
500  for(int i = 1; i <= nominal->GetNbinsX(); i++) {
501  for(int j = 1; j <= nominal->GetNbinsY(); j++) {
502  for(int k = 1; k <= nominal->GetNbinsZ(); k++) {
503  std::vector<double> vals;
504  for(int ihist = 0; ihist < (int) fHists.size(); ihist++) {
505  vals.push_back(fHists[ihist]->GetBinContent(i, j, k));
506  }
507  double cv = hret->GetBinContent(i, j, k);
508  hret->SetBinContent(i, j, k, BinSigma(vals, nsigma, cv));
509  }
510  }
511  }
512  return hret;
513  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
double BinSigma(std::vector< double >, double, double)
Definition: Multiverse.cxx:520
const std::string cv[Ncv]
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
const double j
Definition: BetheBloch.cxx:29
void InitFromSpectra()
Definition: Multiverse.cxx:694
assert(nhit_max >=nhit_nbins)
int ana::Multiverse::GetNUniverses ( ) const
inline
Spectrum * ana::Multiverse::GetPlusOneSigmaShift ( const Spectrum nominal)
TH1 * ana::Multiverse::GetPlusOneSigmaShift ( const TH1 *  nominal)

Definition at line 457 of file Multiverse.cxx.

References GetNSigmaShift().

458  {
459  return GetNSigmaShift(nominal, 1);
460  }
Spectrum * GetNSigmaShift(const Spectrum *, double)
Definition: Multiverse.cxx:471
const std::vector< TH1 * > ana::Multiverse::GetUniversesHist ( )

Definition at line 120 of file Multiverse.cxx.

References fHists, and InitFromSpectra().

Referenced by GetUniversesHist(), multiverse_efficiency_plot(), and PlotMultiverse().

121  {
122  if(fHists.size() == 0)
123  InitFromSpectra();
124  return fHists;
125  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
void InitFromSpectra()
Definition: Multiverse.cxx:694
const std::vector< TH1 * > ana::Multiverse::GetUniversesHist ( int  line_color,
int  line_style = kSolid 
)

Definition at line 107 of file Multiverse.cxx.

References fHists, GetUniversesHist(), InitFromSpectra(), and submit_hadd::u.

108  {
109  if(fHists.size() == 0)
110  InitFromSpectra();
111  for(auto ihist = 0u; ihist < fHists.size(); ihist++) {
112  fHists[ihist]->SetLineColor(line_color);
113  fHists[ihist]->SetLineStyle(line_style);
114  }
115  return this->GetUniversesHist();
116  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
void InitFromSpectra()
Definition: Multiverse.cxx:694
const std::vector< TH1 * > GetUniversesHist()
Definition: Multiverse.cxx:120
void ana::Multiverse::InitFromSpectra ( )
private

Definition at line 694 of file Multiverse.cxx.

References ana::assert(), fBinning, fHists, fLabels, fSpectra, MECModelEnuComparisons::i, makeTrainCVSamples::int, and ToHist().

Referenced by Divide(), GetNSigmaShift(), GetNUniverses(), GetUniversesHist(), Scale(), and Transform().

695  {
696  assert(fSpectra.size() != 0);
697  // assume universes share binning and labels
698  fBinning = fSpectra[0]->GetBinnings();
699  fLabels = fSpectra[0]->GetLabels();
700  for(int i = 0; i < (int) fSpectra.size(); i++) {
701  fHists.push_back(ToHist(fSpectra[i]));
702  }
703  }
std::vector< std::string > fLabels
Definition: Multiverse.h:117
TH1 * ToHist(const Spectrum *, double=-1)
Definition: Multiverse.cxx:707
std::vector< Binning > fBinning
Definition: Multiverse.h:116
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
std::unique_ptr< Multiverse > ana::Multiverse::LoadFrom ( TDirectory *  dir,
const std::string name 
)
static

Definition at line 573 of file Multiverse.cxx.

References ana::assert(), dir, genie::utils::style::Format(), MECModelEnuComparisons::i, ana::Spectrum::LoadFrom(), Multiverse(), nuniv, runNovaSAM::release, runNovaSAM::ret, and PandAna.Demos.tute_pid_validation::specs.

Referenced by ana::CutOptimization::LoadFrom(), ana::TrivialCrossSectionAnalysis::LoadFrom(), and multiverse_efficiency_plot().

574  {
575  dir = dir->GetDirectory(name.c_str()); // switch to subdir
576  assert(dir);
577 
578  TObjString * ptag = (TObjString*) dir->Get("type");
579  assert(ptag);
580  assert(ptag->GetString() == "Multiverse" && "Type does not match Multiverse");
581  delete ptag;
582 
583  TVectorD * vnuniv = (TVectorD*) dir->Get("nuniv");
584  int nuniv = (*vnuniv)[0];
585  std::vector<Spectrum*> specs;
586  for(int i = 0; i < nuniv; i++) {
587  specs.push_back(Spectrum::LoadFrom(dir, TString::Format("mvspectra_%d", i).Data()).release());
588  }
589 
590  delete dir;
591 
592  std::unique_ptr<Multiverse> ret(new Multiverse(specs));
593  ret->InitFromSpectra();
594 
595  return ret;
596  }
const XML_Char * name
Definition: expat.h:151
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:535
unsigned int nuniv
Definition: PlotUnfolding.C:14
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
Multiverse(SpectrumLoaderBase &, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
Definition: Multiverse.cxx:315
Multiverse ana::Multiverse::operator* ( const Multiverse rhs) const

Definition at line 167 of file Multiverse.cxx.

References ana::assert(), fHists, and runNovaSAM::ret.

168  {
169  Multiverse ret = *this;
170  assert(ret.fHists.size() == rhs.fHists.size() &&
171  ret.fHists.size() != 0 &&
172  "Multiverses are not compatible");
173  ret *= rhs;
174  return ret;
175  }
assert(nhit_max >=nhit_nbins)
Multiverse(SpectrumLoaderBase &, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
Definition: Multiverse.cxx:315
Multiverse ana::Multiverse::operator* ( const Spectrum rhs) const

Definition at line 218 of file Multiverse.cxx.

References ana::assert(), fHists, and runNovaSAM::ret.

219  {
220  Multiverse ret = *this;
221  assert(fHists.size() != 0 &&
222  "Multiverse must have histograms initialized");
223  ret *= rhs;
224  return ret;
225  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse(SpectrumLoaderBase &, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
Definition: Multiverse.cxx:315
Multiverse ana::Multiverse::operator* ( const TH1 &  rhs) const

Definition at line 264 of file Multiverse.cxx.

References ana::assert(), fHists, and runNovaSAM::ret.

265  {
266  Multiverse ret = *this;
267  assert(fHists.size() != 0 &&
268  "Multiverse must have histograms initialized");
269  ret *= rhs;
270  return ret;
271  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse(SpectrumLoaderBase &, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
Definition: Multiverse.cxx:315
Multiverse & ana::Multiverse::operator*= ( const Multiverse rhs)

Definition at line 154 of file Multiverse.cxx.

References ana::assert(), fHists, fNUniverses, and MECModelEnuComparisons::i.

155  {
156  assert(fHists.size() == rhs.fHists.size() &&
157  fHists.size() != 0 &&
158  "Multiverses are not compatible");
159  for(int i = 0; i < fNUniverses; i++) {
160  fHists[i]->Multiply(rhs.fHists[i]);
161  }
162  return *this;
163  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse & ana::Multiverse::operator*= ( const Spectrum rhs)

Definition at line 204 of file Multiverse.cxx.

References ana::assert(), fHists, fNUniverses, make_syst_table_plots::h, MECModelEnuComparisons::i, and ToHist().

205  {
206  assert(fHists.size() != 0 &&
207  "Multiverse must have histograms initialized");
208  TH1 * h = ToHist(&rhs);
209  for(int i = 0; i < fNUniverses; i++) {
210  fHists[i]->Multiply(h);
211  }
212  delete h;
213  return *this;
214  }
TH1 * ToHist(const Spectrum *, double=-1)
Definition: Multiverse.cxx:707
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse & ana::Multiverse::operator*= ( const TH1 &  rhs)

Definition at line 252 of file Multiverse.cxx.

References ana::assert(), fHists, fNUniverses, and MECModelEnuComparisons::i.

253  {
254  assert(fHists.size() != 0 &&
255  "Multiverse must have histograms initialized");
256  for(int i = 0; i < fNUniverses; i++) {
257  fHists[i]->Multiply(&rhs);
258  }
259  return *this;
260  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse ana::Multiverse::operator/ ( const Spectrum rhs) const

Definition at line 193 of file Multiverse.cxx.

References ana::assert(), fHists, and runNovaSAM::ret.

194  {
195  Multiverse ret = *this;
196  assert(fHists.size() != 0 &&
197  "Multiverse must have histograms initialized");
198  ret /= rhs;
199  return ret;
200  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse(SpectrumLoaderBase &, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
Definition: Multiverse.cxx:315
Multiverse ana::Multiverse::operator/ ( const TH1 &  rhs) const

Definition at line 241 of file Multiverse.cxx.

References ana::assert(), fHists, and runNovaSAM::ret.

242  {
243  Multiverse ret = *this;
244  assert(fHists.size() != 0 &&
245  "Multiverse must have histograms initialized");
246  ret /= rhs;
247  return ret;
248  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse(SpectrumLoaderBase &, const HistAxis &, const Cut &, std::vector< SystShifts >, const Var &)
Definition: Multiverse.cxx:315
Multiverse & ana::Multiverse::operator/= ( const Spectrum rhs)

Definition at line 179 of file Multiverse.cxx.

References ana::assert(), fHists, fNUniverses, make_syst_table_plots::h, MECModelEnuComparisons::i, and ToHist().

180  {
181  assert(fHists.size() != 0 &&
182  "Multiverse must have histograms initialized");
183  TH1 * h = ToHist(&rhs);
184  for(int i = 0; i < fNUniverses; i++) {
185  fHists[i]->Divide(h);
186  }
187  delete h;
188  return *this;
189  }
TH1 * ToHist(const Spectrum *, double=-1)
Definition: Multiverse.cxx:707
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse & ana::Multiverse::operator/= ( const TH1 &  rhs)

Definition at line 229 of file Multiverse.cxx.

References ana::assert(), fHists, fNUniverses, and MECModelEnuComparisons::i.

230  {
231  assert(fHists.size() != 0 &&
232  "Multiverse must have histograms initialized");
233  for(int i = 0; i < fNUniverses; i++) {
234  fHists[i]->Divide(&rhs);
235  }
236  return *this;
237  }
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
assert(nhit_max >=nhit_nbins)
Multiverse & ana::Multiverse::operator= ( const Multiverse rhs)

Definition at line 600 of file Multiverse.cxx.

References fHists, fNUniverses, fSpectra, MECModelEnuComparisons::i, and submit_hadd::u.

601  {
602  if( this == & rhs )
603  return *this;
604  this->fNUniverses = rhs.fNUniverses;
605  for(auto i = 0u; i < rhs.fSpectra.size(); i++) {
606  this->fSpectra.push_back(new Spectrum(*rhs.fSpectra[i]));
607  }
608  for(auto i = 0u; i< rhs.fHists.size(); i++) {
609  this->fHists.push_back((TH1*) rhs.fHists[i]->Clone());
610  }
611  return *this;
612  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
std::vector< float > Spectrum
Definition: Constants.h:610
Multiverse & ana::Multiverse::operator= ( Multiverse &&  rhs)

Definition at line 616 of file Multiverse.cxx.

References fHists, fNUniverses, fSpectra, MECModelEnuComparisons::i, and submit_hadd::u.

617  {
618  if( this == & rhs )
619  return *this;
620  this->fNUniverses = rhs.fNUniverses;
621  for(auto i = 0u; i < rhs.fSpectra.size(); i++) {
622  this->fSpectra.push_back(std::move(rhs.fSpectra[i]));
623  }
624  for(auto i = 0u; i< rhs.fHists.size(); i++) {
625  this->fHists.push_back(std::move(rhs.fHists[i]));
626  }
627 
628  return *this;
629  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
void ana::Multiverse::SaveTo ( TDirectory *  dir,
const std::string name 
) const

Definition at line 550 of file Multiverse.cxx.

References dir, fNUniverses, genie::utils::style::Format(), fSpectra, MECModelEnuComparisons::i, nuniv, and tmp.

Referenced by ana::TrivialCrossSectionAnalysis::SaveTo().

551  {
552  TDirectory * tmp = gDirectory;
553 
554  dir = dir->mkdir(name.c_str()); // switch to subdir
555  dir->cd();
556 
557  TObjString("Multiverse").Write("type");
558  for(int i = 0; i < fNUniverses; i++) {
559  fSpectra[i]->SaveTo(dir, TString::Format("mvspectra_%d",i).Data());
560  }
561  TVectorD nuniv(1);
562  nuniv[0] = fNUniverses;
563  nuniv.Write("nuniv");
564 
565  dir->Write();
566  delete dir;
567 
568  tmp->cd();
569  }
const XML_Char * name
Definition: expat.h:151
Float_t tmp
Definition: plot.C:36
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
unsigned int nuniv
Definition: PlotUnfolding.C:14
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
void ana::Multiverse::Scale ( double  scale)

Definition at line 19 of file Multiverse.cxx.

References fHists, fSpectra, MECModelEnuComparisons::i, InitFromSpectra(), and submit_hadd::u.

20  {
21  if(fSpectra.size() > 0 && fHists.size() == 0) InitFromSpectra();
22  for(auto i = 0u; i < fHists.size(); i++) {
23  fHists[i]->Scale(scale);
24  }
25  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
Double_t scale
Definition: plot.C:25
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
void InitFromSpectra()
Definition: Multiverse.cxx:694
TH1 * ana::Multiverse::ToHist ( const Spectrum spec,
double  POT = -1 
)
private

Definition at line 707 of file Multiverse.cxx.

References om::cout, fetch_tb_beamline_files::dims, allTimeWatchdog::endl, ana::Spectrum::NDimensions(), ana::Spectrum::POT(), ana::Spectrum::ToTH1(), ana::Spectrum::ToTH2(), and ana::Spectrum::ToTH3().

Referenced by GetNUniverses(), InitFromSpectra(), operator*=(), and operator/=().

709  {
710  int dims = spec->NDimensions();
711  if(POT < 0)
712  POT = spec->POT();
713 
714  switch(dims) {
715  case(1) : {
716  return spec->ToTH1(POT);
717  }
718  case(2) : {
719  return spec->ToTH2(POT);
720  }
721  case(3) : {
722  return spec->ToTH3(POT);
723  }
724  default : {
725  std::cout << "Dimension of multiverse spectra undetermined." << std::endl;
726  abort();
727  }
728  } // end switch case
729  }
OStream cout
Definition: OStream.cxx:6
std::vector< double > POT
Spectrum * ana::Multiverse::ToSpectrum ( TH1 *  h,
double  POT = 1,
double  livetime = 0 
)
private

Definition at line 733 of file Multiverse.cxx.

References bin, ana::bins, om::cout, fetch_tb_beamline_files::dims, allTimeWatchdog::endl, ana::Binning::FromTAxis(), PandAna.Demos.pi0_spectra::labels, livetime, POT, runNovaSAM::ret, ana::UniqueName(), and febshutoff_auto::val.

Referenced by GetNSigmaShift(), GetNUniverses(), and Transform().

734  {
735  int dims = h->GetDimension();
736 
737  switch(dims) {
738  case(1) : {
739  std::vector<Binning> bins = {Binning::FromTAxis(h->GetXaxis())};
740  std::vector<std::string> labels = {h->GetXaxis()->GetTitle()};
741  return new Spectrum(Eigen::ArrayXd(Eigen::Map<Eigen::ArrayXd>(((TH1D*)h)->GetArray(), h->GetNbinsX()+2)),
742  HistAxis(labels, bins), POT, livetime);
743  }
744  case(2) : {
745 
746  auto NX = h->GetNbinsX();
747  auto NY = h->GetNbinsY();
748 
749  TH1D* ret = new TH1D(UniqueName().c_str(), "",
750  NX*NY, 0, NX*NY);
751  std::vector<Binning> bins = {Binning::FromTAxis(h->GetXaxis()),
752  Binning::FromTAxis(h->GetYaxis())};
753  std::vector<std::string> labels = {h->GetXaxis()->GetTitle(),
754  h->GetYaxis()->GetTitle()};
755 
756 
757  for(auto ibinx = 0; ibinx < NX; ibinx++) {
758  for(auto ibiny = 0; ibiny < NY; ibiny++) {
759  int bin = ibinx * bins[1].NBins() + ibiny;
760  auto val = h->GetBinContent(ibinx+1, ibiny+1);
761  auto err = h->GetBinError(ibinx+1, ibiny+1);
762  ret->SetBinContent(bin+1, val);
763  ret->SetBinError(bin+1, err);
764  }
765  }
766  return new Spectrum(Eigen::ArrayXd(Eigen::Map<Eigen::ArrayXd>(ret->GetArray(), ret->GetNbinsX()+2)),
767  HistAxis(labels, bins), POT, livetime);
768  }
769  case(3) : {
770 
771  auto NX = h->GetNbinsX();
772  auto NY = h->GetNbinsY();
773  auto NZ = h->GetNbinsZ();
774  TH1D* ret = new TH1D(UniqueName().c_str(), "",
775  NX*NY*NZ, 0, NX*NY*NZ);
776  std::vector<Binning> bins = {Binning::FromTAxis(h->GetXaxis()),
777  Binning::FromTAxis(h->GetYaxis()),
778  Binning::FromTAxis(h->GetZaxis())};
779  std::vector<std::string> labels = {h->GetXaxis()->GetTitle(),
780  h->GetYaxis()->GetTitle(),
781  h->GetZaxis()->GetTitle()};
782 
783 
784  for(auto ibinx = 0; ibinx < NX; ibinx++) {
785  for(auto ibiny = 0; ibiny < NY; ibiny++) {
786  for(auto ibinz = 0; ibinz < NZ; ibinz++) {
787  int bin = ibinx * NY * NZ + ibiny * NX * ibinz;
788  auto val = h->GetBinContent(ibinx+1, ibiny+1, ibinz+1);
789  auto err = h->GetBinError(ibinx+1, ibiny+1, ibinz+1);
790  ret->SetBinContent(bin+1, val);
791  ret->SetBinError(bin+1, err);
792  }
793  }
794  }
795 
796  return new Spectrum(Eigen::ArrayXd(Eigen::Map<Eigen::ArrayXd>(ret->GetArray(), ret->GetNbinsX()+2)),
797  HistAxis(labels, bins), POT, livetime);
798 
799  }
800  default : {
801  std::cout << "Dimension " << dims << " not supported." << std::endl;
802  abort();
803  }
804  }
805 
806  }
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
static Binning FromTAxis(const TAxis *ax)
Definition: Binning.cxx:173
float bin[41]
Definition: plottest35.C:14
std::vector< float > Spectrum
Definition: Constants.h:610
OStream cout
Definition: OStream.cxx:6
std::vector< double > POT
const Binning bins
Definition: NumuCC_CPiBin.h:8
double livetime
Definition: saveFDMCHists.C:21
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:29
void ana::Multiverse::Transform ( const Multiverse rhs,
const std::function< ProductFunc_t > &  transform 
)

Definition at line 72 of file Multiverse.cxx.

References fHists, fSpectra, MECModelEnuComparisons::i, InitFromSpectra(), PandAna.Demos.pi0_spectra::labels, livetime, POT, PandAna.Demos.tute_pid_validation::specs, ToSpectrum(), PandAna.Demos.pi0_spectra::transform, and submit_hadd::u.

Referenced by CopyAndTransform(), ana::CutOptimization::Efficiency(), and ana::CutOptimization::Integrate().

74  {
75  // if rhs also has spectra and we want to transform those,
76  // do that
77  double POT = 0;
78  double livetime = 0;
79  std::vector<std::string> labels;
80  std::vector<Binning> binning;
81  if(fSpectra.size() != 0) {
82  POT = rhs.fSpectra[0]->POT();
83  livetime = rhs.fSpectra[0]->Livetime();
84  labels = rhs.fSpectra[0]->GetLabels();
85  binning = rhs.fSpectra[0]->GetBinnings();
86  if(fHists.size() == 0) InitFromSpectra();
87  }
88 
89  std::vector<TH1*> xformed;
90  std::vector<Spectrum*> specs;
91  for(auto i = 0u; i < fHists.size(); i++) {
92  xformed.push_back(transform(fHists[i], rhs.fHists[i]));
93  if(fSpectra.size() != 0) {
94  specs.push_back(ToSpectrum(xformed.back(), POT, livetime));
95  delete fSpectra[i];
96  }
97  delete fHists[i];
98 
99  }
100 
101  fHists = xformed;
102  fSpectra = specs;
103  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
void InitFromSpectra()
Definition: Multiverse.cxx:694
std::vector< double > POT
double livetime
Definition: saveFDMCHists.C:21
Spectrum * ToSpectrum(TH1 *h, double POT=1, double livetime=0)
Definition: Multiverse.cxx:733
void ana::Multiverse::Transform ( const std::function< TransformFunc_t > &  transform)

Definition at line 39 of file Multiverse.cxx.

References fHists, fSpectra, MECModelEnuComparisons::i, InitFromSpectra(), PandAna.Demos.pi0_spectra::labels, livetime, POT, PandAna.Demos.tute_pid_validation::specs, ToSpectrum(), PandAna.Demos.pi0_spectra::transform, and submit_hadd::u.

40  {
41  // if rhs also has spectra and we want to transform those,
42  // do that
43  double POT = 0;
44  double livetime = 0;
45  std::vector<std::string> labels;
46  std::vector<Binning> binning;
47  if(fSpectra.size() != 0) {
48  POT = fSpectra[0]->POT();
49  livetime = fSpectra[0]->Livetime();
50  labels = fSpectra[0]->GetLabels();
51  binning = fSpectra[0]->GetBinnings();
52  if(fHists.size() == 0) InitFromSpectra();
53  }
54 
55  std::vector<TH1*> xformed;
56  std::vector<Spectrum*> specs;
57  for(auto i = 0u; i < fHists.size(); i++) {
58  xformed.push_back(transform(fHists[i]));
59  if(fSpectra.size() != 0) {
60  specs.push_back(ToSpectrum(xformed.back(), POT, livetime));
61  delete fSpectra[i];
62  }
63  delete fHists[i];
64  }
65 
66  fHists = xformed;
67  fSpectra = specs;
68  }
std::vector< Spectrum * > fSpectra
Definition: Multiverse.h:115
std::vector< TH1 * > fHists
Definition: Multiverse.h:119
void InitFromSpectra()
Definition: Multiverse.cxx:694
std::vector< double > POT
double livetime
Definition: saveFDMCHists.C:21
Spectrum * ToSpectrum(TH1 *h, double POT=1, double livetime=0)
Definition: Multiverse.cxx:733
void ana::Multiverse::Transform ( const std::function< TransformSpectraFunc_t > &  transform)

Member Data Documentation

std::vector<Binning> ana::Multiverse::fBinning
private

Definition at line 116 of file Multiverse.h.

Referenced by InitFromSpectra().

std::vector<TH1 *> ana::Multiverse::fHists
private
std::vector<std::string> ana::Multiverse::fLabels
private

Definition at line 117 of file Multiverse.h.

Referenced by InitFromSpectra().

int ana::Multiverse::fNUniverses
private

Definition at line 121 of file Multiverse.h.

Referenced by Divide(), GetNUniverses(), Multiverse(), operator*=(), operator/=(), operator=(), and SaveTo().

std::vector<Spectrum*> ana::Multiverse::fSpectra
private

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