Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ana::GenieMultiverseParameters Class Reference

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

Classes

struct  id
 
struct  knob_sampling_mode
 
struct  name
 

Public Member Functions

 GenieMultiverseParameters (unsigned int nuniverses, std::string config_pathname="knob_config.txt")
 This class generates the parameters of the multi-universes. No more, no less. More...
 
 GenieMultiverseParameters (unsigned int nuniverses, std::vector< const ISyst * > systs)
 
std::vector< std::map< const ISyst *, double > > ShiftTables ()
 Return the tables of knob shift values. More...
 
std::vector< std::map< const ISyst *, double > > NuTruthShiftTables ()
 
std::vector< SystShiftsGetSystShifts ()
 

Private Types

typedef multi_index_container< knob_sampling_mode, indexed_by< ordered_unique< tag< id >, BOOST_MULTI_INDEX_MEMBER(knob_sampling_mode, int, id)>, ordered_unique< tag< name >, BOOST_MULTI_INDEX_MEMBER(knob_sampling_mode, std::string, name)> > > knob_sampling_mode_set
 

Private Member Functions

void BuildKnobConfigTable (std::string config_pathname)
 Function for building knob configuration table. More...
 

Private Attributes

int fUniverseSeed
 
bool fIsNuTruth = false
 
std::vector< std::map< const ISyst *, double > > fShiftTables
 Container of shift tables for all universes. More...
 
std::vector< std::map< const ISyst *, double > > fNuTruthShiftTables
 Container of neutrino truth shift tables for all universes. More...
 
std::vector< SystShiftsfSystShifts
 
knob_sampling_mode_set fKnobConfigTable
 knob configuration table More...
 

Detailed Description

Definition at line 237 of file GenieMultiverseSyst.h.

Member Typedef Documentation

typedef multi_index_container< knob_sampling_mode, indexed_by< ordered_unique< tag<id>, BOOST_MULTI_INDEX_MEMBER(knob_sampling_mode,int,id)>, ordered_unique< tag<name>,BOOST_MULTI_INDEX_MEMBER(knob_sampling_mode,std::string,name)> > > ana::GenieMultiverseParameters::knob_sampling_mode_set
private

Definition at line 281 of file GenieMultiverseSyst.h.

Constructor & Destructor Documentation

ana::GenieMultiverseParameters::GenieMultiverseParameters ( unsigned int  nuniverses,
std::string  config_pathname = "knob_config.txt" 
)

This class generates the parameters of the multi-universes. No more, no less.

Definition at line 710 of file GenieMultiverseSyst.cxx.

References BuildKnobConfigTable(), fKnobConfigTable, fShiftTables, fSystShifts, fUniverseSeed, ana::getAllXsecNuTruthSysts_2017(), ana::GetGenieKnobSyst(), nuniverses, central_limit::rand, and systs.

712  :
713  fUniverseSeed(1001)
714  {
715  // Retrieve knob configuration from file.
716  BuildKnobConfigTable(config_pathname);
717  // Generate tables of knobs for all universes.
718  // The first entry corresponds to the nominal universe.
719  for(unsigned int uIdx = 0; uIdx < nuniverses; uIdx++)
720  {
721  map<const ISyst*, double> knob_weight_table;
722  for(auto& idIt: fKnobConfigTable.get<0>())
723  {
724  rwgt::ReweightLabel_t knoblabel = (rwgt::ReweightLabel_t)idIt.id;
725  double nsigma = 0;
726  if(uIdx > 0){
727  TRandom3 rand(fUniverseSeed++);
728  if(idIt.mode == 0) continue;
729  else if(idIt.mode == 1) nsigma = rand.Gaus();
730  else if(idIt.mode == 2) nsigma = rand.Integer(2);
731  }
732  // For tags later than 2017/08/14, when the underlying framework
733  // underwent an overhaul, this conditional check is needed.
734  vector<const ISyst*> systs = getAllXsecNuTruthSysts_2017();
735  if(find(systs.begin(), systs.end(), GetGenieKnobSyst(knoblabel)) != systs.end())
736  knob_weight_table[GetGenieKnobSyst(knoblabel)] = nsigma;
737  }
738  fShiftTables.push_back(knob_weight_table);
739  fSystShifts.push_back(SystShifts(knob_weight_table));
740  }
741  }
std::vector< std::map< const ISyst *, double > > fShiftTables
Container of shift tables for all universes.
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
void BuildKnobConfigTable(std::string config_pathname)
Function for building knob configuration table.
std::vector< SystShifts > fSystShifts
knob_sampling_mode_set fKnobConfigTable
knob configuration table
std::vector< const ISyst * > getAllXsecNuTruthSysts_2017()
Get master XSec syst list for 2017 analyses (NuTruthSyst variant)
const int nuniverses
const NOvARwgtSyst * GetGenieKnobSyst(rwgt::ReweightLabel_t knobIdx, std::string altName, std::string altLabel)
Convenience function to get a GENIE knob syst. (Allows using the GENIE knob name & description as the...
Definition: XSecSysts.cxx:119
ana::GenieMultiverseParameters::GenieMultiverseParameters ( unsigned int  nuniverses,
std::vector< const ISyst * >  systs 
)

Definition at line 744 of file GenieMultiverseSyst.cxx.

References fIsNuTruth, fShiftTables, fSystShifts, fUniverseSeed, nuniverses, and central_limit::rand.

746  :
747  fUniverseSeed(1001)
748  {
749  // Generate tables of knobs for all universes.
750  // The first entry corresponds to the nominal universe.
751  for(unsigned int uIdx = 0; uIdx < nuniverses; uIdx++)
752  {
753  map<const ISyst*, double> knob_weight_table;
754  for(auto& knobIt: sel_systs)
755  {
756  double nsigma = 0;
757  if(uIdx > 0){
758  TRandom3 rand(fUniverseSeed++);
759  nsigma = rand.Gaus();
760  }
761  knob_weight_table[knobIt] = nsigma;
762  }
763  fShiftTables.push_back(knob_weight_table);
764  fSystShifts.push_back(SystShifts(knob_weight_table));
765  }
766  fIsNuTruth = false;
767  }
std::vector< std::map< const ISyst *, double > > fShiftTables
Container of shift tables for all universes.
std::vector< SystShifts > fSystShifts
const int nuniverses

Member Function Documentation

void ana::GenieMultiverseParameters::BuildKnobConfigTable ( std::string  config_pathname)
private

Function for building knob configuration table.

Definition at line 769 of file GenieMultiverseSyst.cxx.

References om::cerr, allTimeWatchdog::endl, exit(), MakeMiniprodValidationCuts::f, fKnobConfigTable, ana::GenieMultiverseNormalizedSpectra::GenieMultiverseNormalizedSpectra(), MECModelEnuComparisons::i, and allTimeWatchdog::index.

Referenced by GenieMultiverseParameters().

770  {
771  // check file existence
772  ifstream f(fpn.c_str());
773  if(!f.good()){
774  cerr << "ERROR: GENIE knob configuration file \033[1;31m" << fpn << "\033[0m is not found." << endl;
775  exit(0);
776  }
777 
778  string knobname;
779  int sample_mode;
780  int index = 0;
781  while(f >> knobname >> sample_mode)
782  fKnobConfigTable.insert(knob_sampling_mode(index++,knobname,sample_mode));
783  }
OStream cerr
Definition: OStream.cxx:7
knob_sampling_mode_set fKnobConfigTable
knob configuration table
exit(0)
std::vector<SystShifts> ana::GenieMultiverseParameters::GetSystShifts ( )
inline
std::vector<std::map<const ISyst*, double> > ana::GenieMultiverseParameters::NuTruthShiftTables ( )
inline

Definition at line 247 of file GenieMultiverseSyst.h.

247 {return fNuTruthShiftTables;};
std::vector< std::map< const ISyst *, double > > fNuTruthShiftTables
Container of neutrino truth shift tables for all universes.
std::vector<std::map<const ISyst*, double> > ana::GenieMultiverseParameters::ShiftTables ( )
inline

Return the tables of knob shift values.

Definition at line 246 of file GenieMultiverseSyst.h.

Referenced by uncertainty1png(), and uncertainty2png().

246 {return fShiftTables;};
std::vector< std::map< const ISyst *, double > > fShiftTables
Container of shift tables for all universes.

Member Data Documentation

bool ana::GenieMultiverseParameters::fIsNuTruth = false
private

Definition at line 254 of file GenieMultiverseSyst.h.

Referenced by GenieMultiverseParameters().

knob_sampling_mode_set ana::GenieMultiverseParameters::fKnobConfigTable
private
std::vector<std::map<const ISyst*, double> > ana::GenieMultiverseParameters::fNuTruthShiftTables
private

Container of neutrino truth shift tables for all universes.

Definition at line 257 of file GenieMultiverseSyst.h.

std::vector<std::map<const ISyst*, double> > ana::GenieMultiverseParameters::fShiftTables
private

Container of shift tables for all universes.

Definition at line 256 of file GenieMultiverseSyst.h.

Referenced by GenieMultiverseParameters().

std::vector<SystShifts> ana::GenieMultiverseParameters::fSystShifts
private

Definition at line 258 of file GenieMultiverseSyst.h.

Referenced by GenieMultiverseParameters().

int ana::GenieMultiverseParameters::fUniverseSeed
private

Random seed sequence. Need to have each universe with the same physical parameters. Start from 1001, giving way to the PPFX multi-universe.

Definition at line 248 of file GenieMultiverseSyst.h.

Referenced by ana::GenieMultiverseNormalizedSpectra::CreateUniverse(), and GenieMultiverseParameters().


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