Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy: NuOsc fancy logger #272

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions samplePDF/samplePDFFDBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,6 @@ void samplePDFFDBase::SetupNormParameters() {

//A way to check whether a normalisation parameter applies to an event or not
void samplePDFFDBase::CalcXsecNormsBins(int iSample){

FarDetectorCoreInfo *fdobj = &MCSamples[iSample];
#ifdef DEBUG
std::vector<int> VerboseCounter(xsec_norms.size(), 0);
Expand Down Expand Up @@ -883,13 +882,10 @@ void samplePDFFDBase::CalcXsecNormsBins(int iSample){
}
MACH3LOG_DEBUG("└──────────────────────────────────────────────────────────┘");
#endif

return;
}

//ETA - this is all a bit (less) stupid
void samplePDFFDBase::set1DBinning(std::vector<double> &XVec){

_hPDF1D->Reset();
_hPDF1D->SetBins(int(XVec.size()-1), XVec.data());
dathist->SetBins(int(XVec.size()-1), XVec.data());
Expand Down Expand Up @@ -1146,8 +1142,9 @@ void samplePDFFDBase::set2DBinning(int nbins1, double low1, double high1, int nb
FindNominalBinAndEdges2D();
}

// ************************************************
void samplePDFFDBase::FindNominalBinAndEdges2D() {

// ************************************************
//Set rw_pdf_bin and rw_upper_xbinedge and rw_lower_xbinedge for each skmc_base
for(int mc_i = 0 ; mc_i < int(MCSamples.size()) ; mc_i++){
for(int event_i = 0 ; event_i < MCSamples[mc_i].nEvents ; event_i++){
Expand Down Expand Up @@ -1297,14 +1294,22 @@ void samplePDFFDBase::addData(TH2D* Data) {
}
}

// ************************************************
void samplePDFFDBase::SetupNuOscillator() {
// ************************************************
OscillatorFactory* OscillFactory = new OscillatorFactory();

NuOscProbCalcers = std::vector<OscillatorBase*>(int(MCSamples.size()));
for (size_t iSample=0;iSample<MCSamples.size();iSample++) {
if(OscCov){
MACH3LOG_INFO("Setting up NuOscillator::Oscillator object in OscillationChannel: {}/{}", iSample, MCSamples.size());
NuOscProbCalcers[iSample] = OscillFactory->CreateOscillator(NuOscillatorConfigFile);

LoggerPrint("NuOscillator",
[](const std::string& message) { MACH3LOG_INFO("{}", message); },
[this, iSample, &OscillFactory]() {
this->NuOscProbCalcers[iSample] = OscillFactory->CreateOscillator(this->NuOscillatorConfigFile);
});
//NuOscProbCalcers[iSample] = OscillFactory->CreateOscillator(NuOscillatorConfigFile);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could remove the comment


if (!NuOscProbCalcers[iSample]->EvalPointsSetInConstructor()) {
std::vector<M3::float_t> EnergyArray;
Expand Down Expand Up @@ -1384,7 +1389,6 @@ void samplePDFFDBase::SetupNuOscillator() {
} // end if NC
} // end loop over events
}// end loop over channels

delete OscillFactory;
}

Expand Down Expand Up @@ -1436,7 +1440,10 @@ void samplePDFFDBase::fillSplineBins() {
}
}

// ************************************************
double samplePDFFDBase::GetLikelihood() {
// ************************************************

if (samplePDFFD_data == nullptr) {
MACH3LOG_ERROR("Data sample is empty! Can't calculate a likelihood!");
throw MaCh3Exception(__FILE__, __LINE__);
Expand Down
Loading