1#ifndef __OSCPROBCALCER_BASE_H__
2#define __OSCPROBCALCER_BASE_H__
9#include "yaml-cpp/yaml.h"
78 void Reweight(
const std::vector<FLOAT_T>& OscParams_);
362 std::cerr <<
"No oscillation parameter names to print" << std::endl;
366 std::cout <<
"Expected Parameters:" << std::endl;
float FLOAT_T
Definition OscillatorConstants.h:16
#define DUMMYVAL
Definition OscillatorConstants.h:4
Oscillation calculation engine (CUDAProb3, ProbGPU, Prob3++, etc.) implementation agnostic base class...
Definition OscProbCalcerBase.h:18
int fNOscillationChannels
The number of oscillation channels which have been configured.
Definition OscProbCalcerBase.h:447
void PrintKnownOscillationChannels()
Print the oscillation channels which a particular instance has been configured with.
Definition OscProbCalcerBase.cpp:706
int fNEnergyPoints
The number of Energy points which are being evaluated by the oscillation probability engine.
Definition OscProbCalcerBase.h:457
int ReturnNOscParams()
Return the number of oscillation parameters the specific implementation expects.
Definition OscProbCalcerBase.h:120
virtual int ReturnWeightArrayIndex(int NuTypeIndex, int OscChanIndex, int EnergyIndex, int CosineZIndex=-1)=0
Return the index in the weight array for a specific combination of neutrino oscillation channel,...
int fNOscParams
Store the oscillation parameter set used to calculate the previous and current probabilities.
Definition OscProbCalcerBase.h:540
std::vector< bool > fOscillationParametersSetCheck
Check to determine which of the expected oscillation parameters have been registered.
Definition OscProbCalcerBase.h:560
YAML::Node Config
YAML Config object used to get runtime specific variables.
Definition OscProbCalcerBase.h:502
void SetEnergyArray(std::vector< FLOAT_T > EnergyArray)
Define the Energy which will be used when calculating the oscillation probabilities.
Definition OscProbCalcerBase.cpp:101
bool fWeightArrayInit
Boolean declaring whether fWeightArray has been initialised correctly.
Definition OscProbCalcerBase.h:525
bool fNuMappingSet
Boolean declaring whether fNeutrinoTypes and fOscillationChannels have been initialised correctly.
Definition OscProbCalcerBase.h:530
int ReturnEnergyIndexFromValue(FLOAT_T EnergyVal)
Return the index in fEnergyArray for a particular value of Energy. If it's not found,...
Definition OscProbCalcerBase.cpp:533
int ReturnNuTypeFromFlavour(int NuFlav)
Return the index in fNeutrinoTypes for a particular neutrino flavour (neutrino or antineutrino)
Definition OscProbCalcerBase.cpp:598
bool fPropagatorSet
Boolean declaring whether the specific propagator SetupPropagator() function has been called.
Definition OscProbCalcerBase.h:520
void IgnoreCosineZBinning(bool Ignore)
Some implementations don't care about the CosineZ values, so this is a method to set fCosineZArraySet...
Definition OscProbCalcerBase.cpp:181
int fNNeutrinoTypes
The number of neutrino types (neutrino and antineutrino)
Definition OscProbCalcerBase.h:437
int ReturnCosineZIndexFromValue(FLOAT_T CosineZVal)
Return the index in fCosineZArray for a particular value of CosineZ. If it's not found,...
Definition OscProbCalcerBase.cpp:562
std::vector< NuOscillator::OscillationChannel > ReturnOscChannels()
Return the oscillation channels the specific implementation expects.
Definition OscProbCalcerBase.h:126
std::string fImplementationName
Define the implementation name - Can be used for recasting later (similar to TObject::InheritsFrom() ...
Definition OscProbCalcerBase.h:492
OscProbCalcerBase(YAML::Node InputConfig_)
Default constructor.
Definition OscProbCalcerBase.cpp:9
void SanitiseProbabilities()
Ensure that the oscillation probabilities are within [0.,1.] range, if not throw error.
Definition OscProbCalcerBase.cpp:438
std::vector< FLOAT_T * > fOscParams
Vector of pointers to oscillation parameter values.
Definition OscProbCalcerBase.h:550
std::string ReturnImplementationName()
Return the specific implementation name.
Definition OscProbCalcerBase.h:168
bool ReturnCosineZIgnored()
Return a boolean which describes whether the specific implementation cares about CosineZ.
Definition OscProbCalcerBase.h:174
void SetCurrOscParams()
Save the oscillation parameters which have been requested.
Definition OscProbCalcerBase.cpp:501
bool fCosineZIgnored
Flag to define whether the CosineZ binning has been ignored in the specific implementation.
Definition OscProbCalcerBase.h:497
std::vector< FLOAT_T > fEnergyArray
The vector of Energy values being evaluated by the oscillation probability engine.
Definition OscProbCalcerBase.h:467
void PrintWeights()
Print the calculated oscillation probabilities.
Definition OscProbCalcerBase.cpp:508
virtual void CalculateProbabilities()=0
Calculate some oscillation probabilities for a particular oscillation parameter set.
void SetExpectedParameterNames(const std::vector< std::string > &ExpectedOscParNames_)
Define the list of parameter names that a particular instance of OscProbCalcer expects.
Definition OscProbCalcerBase.h:350
std::vector< FLOAT_T > ReturnOscParamsCurr()
Return the oscillation parameters which were used for the last calculation.
Definition OscProbCalcerBase.h:138
bool fUseLegacyMode_OscParsSet
Check to determine in Reweight(std::vector<FLOAT_T> OscParams) has been called.
Definition OscProbCalcerBase.h:570
std::vector< FLOAT_T > fWeightArray
Vector which stores the oscillation probabilities.
Definition OscProbCalcerBase.h:482
virtual long DefineWeightArraySize()=0
Define the size of fWeightArray.
int fNWeights
The number of oscillation probabilities being calculated.
Definition OscProbCalcerBase.h:477
void Reweight()
General function used to call the oscillation probability calculation.
Definition OscProbCalcerBase.cpp:327
bool ReturnHasSetEnergyArray()
Return whether the instance of OscProbCalcerBase() has already been assigned the Energy binning.
Definition OscProbCalcerBase.h:201
bool AreOscParamsChanged()
Check whether the oscillation parameters have changed since their previous value.
Definition OscProbCalcerBase.cpp:486
int fNCosineZPoints
The number of CosineZ points which are being evaluated by the oscillation probability engine.
Definition OscProbCalcerBase.h:462
void InitialiseNeutrinoTypesArray(int Size)
Initialise the fNeutrinoTypes mapping array to a particular size with dummy values.
Definition OscProbCalcerBase.cpp:628
std::vector< NuOscillator::OscillationChannel > fOscillationChannels
The mapping of oscillation channels which have been requested from the YAML config.
Definition OscProbCalcerBase.h:452
bool HasOscillationChannel(int GeneratedFlavour, int DetectedFlavour)
Check whether a particular oscillation channel has been configured in a particular instance of OscPro...
Definition OscProbCalcerBase.cpp:713
std::vector< FLOAT_T > ReturnWeightArray()
Return the vector of oscillation probabilites which have been calculated.
Definition OscProbCalcerBase.h:186
const FLOAT_T * ReturnPointerToWeight(int InitNuFlav, int FinalNuFlav, FLOAT_T Energy, FLOAT_T CosineZ=DUMMYVAL)
Return pointer to the weight array for a specific Energy and CosineZ.
Definition OscProbCalcerBase.cpp:218
bool fNoSanity
Boolean declaring whether the SanitiseProbabilities function should be called in the Reweight functio...
Definition OscProbCalcerBase.h:575
int ReturnOscChannelIndexFromFlavours(int InitNuFlav, int FinalNuFlav)
Loop through fOscillationChannels and determine which index corresponds to the requested flavours.
Definition OscProbCalcerBase.cpp:586
int ReturnNCosineZPoints()
Return the number of CosineZ points which are being used by the specific instance of OscProbCalcerBas...
Definition OscProbCalcerBase.h:150
void PrintOscParamsCurr()
Print current oscillation parameters.
Definition OscProbCalcerBase.cpp:430
void IntialiseWeightArray()
Initialise the array in which the oscillation probabilities will be stored with dummy values.
Definition OscProbCalcerBase.cpp:614
int ReturnNEnergyPoints()
Return the number of Energy points which are being used by the specific instance of OscProbCalcerBase...
Definition OscProbCalcerBase.h:144
void PrintExpectedParameterNames()
Print the expected parameter names.
Definition OscProbCalcerBase.h:360
void ResetCurrOscParams()
(Re-)Initialise the saved oscillation parameters in fOscParamsCurr
Definition OscProbCalcerBase.cpp:497
void InitialiseOscillationChannelMapping()
Read the [OscProbCalcerSetup][Implementation][OscChannelMapping] YAML node and configure fOscillation...
Definition OscProbCalcerBase.cpp:637
OscProbCalcerBase(std::string ConfigName_)
Wrapper Construct.
Definition OscProbCalcerBase.h:248
std::vector< FLOAT_T > fOscParamsCurr
Vector which stores the saved oscillation probabilities.
Definition OscProbCalcerBase.h:545
void CheckOscillationParametersDefined()
Check that all the expected oscillation parameters have been assigned a value.
Definition OscProbCalcerBase.cpp:374
void SetCosineZArray(std::vector< FLOAT_T > CosineZArray)
Define the CosineZ which will be used when calculating the oscillation probabilities.
Definition OscProbCalcerBase.cpp:141
std::vector< FLOAT_T > ReturnCosineZArray()
Return the vector of CosineZ points which are being used by the specific instance of OscProbCalcerBas...
Definition OscProbCalcerBase.h:162
void CheckNuFlavourMapping()
Check that the NuType/NuFlav mapping is set correctly based on the inputs from the particular impleme...
Definition OscProbCalcerBase.cpp:647
void Setup()
General function used to setup all variables used within the reweighting.
Definition OscProbCalcerBase.cpp:189
std::vector< FLOAT_T > ReturnEnergyArray()
Return the vector of Energy points which are being used by the specific instance of OscProbCalcerBase...
Definition OscProbCalcerBase.h:156
FLOAT_T PrecisionLimit
Precision limit which allows a slight unphysical probability to pass the SanitiseProbabilities check.
Definition OscProbCalcerBase.h:535
virtual void SetupPropagator()=0
Setup any implementation specific variables/functions.
bool fUseLegacyMode
Check to determine if LegacyMode has been requested.
Definition OscProbCalcerBase.h:565
std::vector< int > fNeutrinoTypes
The mapping of neutrino types to uniquely defined integers (i.e. index)
Definition OscProbCalcerBase.h:442
bool SanityCheck()
Ensures that the specific implementation has been correctly initialised.
Definition OscProbCalcerBase.cpp:688
std::vector< std::string > fExpectedOscillationParameterNames
Vector of expected oscillation parameter names.
Definition OscProbCalcerBase.h:555
virtual ~OscProbCalcerBase()
Destructor.
Definition OscProbCalcerBase.cpp:98
bool ReturnHasSetCosineZArray()
Return whether the instance of OscProbCalcerBase() has already been assigned the CosineZ binning.
Definition OscProbCalcerBase.h:207
std::vector< int > ReturnNeutrinoTypes()
Return the neutrino types the specific implementation expects.
Definition OscProbCalcerBase.h:132
void DefineParameter(const std::string &ParName, FLOAT_T *ParValue)
Function to register an oscillation parameter name and pointer to a value that will be used when calc...
Definition OscProbCalcerBase.cpp:387
int ReturnNWeights()
Return the number of oscillation probabilities that are being calculated.
Definition OscProbCalcerBase.h:180
bool fEnergyArraySet
Boolean declaring whether the Energy array has been set.
Definition OscProbCalcerBase.h:510
std::vector< NuOscillator::OscillationProbability > ReturnProbabilities()
Return vector of oscillation probabilities with associated neutrin type, oscillation channel,...
Definition OscProbCalcerBase.cpp:257
FLOAT_T GetOscillationParameter(int Index)
Return the value of the oscillation parameter associated with the index.
Definition OscProbCalcerBase.cpp:414
std::vector< FLOAT_T > fCosineZArray
The vector of CosineZ values being evaluated by the oscillation probability engine.
Definition OscProbCalcerBase.h:472
int fVerbose
Define the verbosity of the console output.
Definition OscProbCalcerBase.h:487
bool fCosineZArraySet
Boolean declaring whether the CosineZ array has been set.
Definition OscProbCalcerBase.h:515