4 #include "Oscillator/OscillatorFactory.h"
5 #include "Constants/OscillatorConstants.h"
10 std::vector<const M3::float_t*> OscParams_,
const int SubChannels) {
17 auto OscillFactory = std::make_unique<OscillatorFactory>();
26 [](
const std::string& message) {
MACH3LOG_INFO(
"{}", message); },
27 [
this, &OscillFactory, &NuOscillatorConfigFile]() {
28 this->
NuOscProbCalcers[0][0] = std::unique_ptr<OscillatorBase>(OscillFactory->CreateOscillator(NuOscillatorConfigFile));
32 MACH3LOG_ERROR(
"Attempted to use equal binning per oscillation channel, but not binning has been set in the NuOscillator::Oscillator object");
38 for (
int iChannel = 0; iChannel < SubChannels; iChannel++) {
39 MACH3LOG_INFO(
"Setting up NuOscillator::Oscillator object in OscillationChannel: {}/{}", iChannel, SubChannels);
42 [](
const std::string& message) {
MACH3LOG_INFO(
"{}", message); },
43 [
this, iChannel, &OscillFactory, &NuOscillatorConfigFile]() {
45 OscillFactory->CreateOscillator(NuOscillatorConfigFile));
60 MACH3LOG_ERROR(
"Trying to add sample while EqualBinningPerOscChannel is enabled. This will not work...");
63 auto OscillFactory = std::make_unique<OscillatorFactory>();
65 std::vector<std::unique_ptr<OscillatorBase>> OscProbCalcersTemp(SubChannels);
67 for (
int iChannel = 0; iChannel < SubChannels; iChannel++) {
68 MACH3LOG_INFO(
"Setting up NuOscillator::Oscillator object in OscillationChannel: {}/{}", iChannel, SubChannels);
71 [](
const std::string& message) {
MACH3LOG_INFO(
"{}", message); },
72 [&OscProbCalcersTemp, iChannel, &OscillFactory, &NuOscillatorConfigFile]() {
73 OscProbCalcersTemp[iChannel] = std::unique_ptr<OscillatorBase>(
74 OscillFactory->CreateOscillator(NuOscillatorConfigFile));
86 std::vector<FLOAT_T> OscVec(
OscParams.size());
87 for (
size_t iPar = 0; iPar <
OscParams.size(); ++iPar) {
88 #pragma GCC diagnostic push
89 #pragma GCC diagnostic ignored "-Wuseless-cast"
90 OscVec[iPar] =
static_cast<FLOAT_T
>(*
OscParams[iPar]);
91 #pragma GCC diagnostic pop
98 for (
size_t iChannel = 0; iChannel <
NuOscProbCalcers[iSample].size(); iChannel++) {
108 const int FinalFlav,
const FLOAT_T TrueEnu,
const FLOAT_T TrueCosZenith) {
111 int IndexChannel = 0;
113 IndexSample = Sample;
114 IndexChannel = Channel;
117 if(TrueCosZenith != -999) {
118 return NuOscProbCalcers[IndexSample][IndexChannel]->ReturnWeightPointer(InitFlav ,FinalFlav, TrueEnu, TrueCosZenith);
120 return NuOscProbCalcers[IndexSample][IndexChannel]->ReturnWeightPointer(InitFlav ,FinalFlav, TrueEnu);
127 const std::vector<M3::float_t>& CosineZArray) {
131 if(CosineZArray.size() != 0)
NuOscProbCalcers[Sample][Channel]->SetCosineZArrayInCalcer(CosineZArray);
#define _MaCh3_Safe_Include_Start_
KS: Avoiding warning checking for headers.
#define _MaCh3_Safe_Include_End_
KS: Restore warning checking after including external headers.
void LoggerPrint(const std::string &LibName, LogFunc logFunction, Func &&func, Args &&... args)
KS: This is bit convoluted but this is to allow redirecting cout and errors from external library int...
Custom exception class used throughout MaCh3.
void AddSample(const std::string &NuOscillatorConfigFile, const int SubChannels)
Add different oscillator for sample.
OscillationHandler(const std::string &ConfigFile, bool EqualBinningPerChannel, std::vector< const M3::float_t * > OscParams_, const int SubChannels)
Constructor.
std::vector< std::vector< std::unique_ptr< OscillatorBase > > > NuOscProbCalcers
DB Variables required for oscillation.
void Evaluate()
DB Evaluate oscillation weights for each defined event/bin.
virtual ~OscillationHandler()
Destructor.
const M3::float_t * GetNuOscillatorPointers(const int Sample, const int Channel, const int InitFlav, const int FinalFlav, const FLOAT_T TrueEnu, const FLOAT_T TrueCosZenith=-999)
Get pointer to oscillation weight.
std::vector< const M3::float_t * > OscParams
pointer to osc params, since not all params affect every sample, we perform some operations before ha...
void SetOscillatorBinning(const int Sample, const int Channel, const std::vector< M3::float_t > &EnergyArray, const std::vector< M3::float_t > &CosineZArray)
Setup binning, arrays correspond to events and their energy bins.
bool EqualBinningPerOscChannel
flag used to define whether all oscillation channels have a probability calculated using the same bin...