Skip to content

Commit

Permalink
add more logger after Ewan comments
Browse files Browse the repository at this point in the history
  • Loading branch information
KSkwarczynski committed Oct 24, 2024
1 parent 777a08f commit 8461aeb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
21 changes: 10 additions & 11 deletions samplePDF/Structs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ namespace MaCh3Utils {
return 0.0;
break;
default:
std::cerr << "Haven't got a saved mass for PDG " << PDG << std::endl;
std::cerr << "Please implement me! " << __FILE__ << ":" << __LINE__ << std::endl;
throw;
MACH3LOG_ERROR("Haven't got a saved mass for PDG: {}", PDG);
MACH3LOG_ERROR("Please implement me!");
throw MaCh3Exception(__FILE__, __LINE__);
} // End switch

std::cerr << "Warning, didn't catch a saved mass" << std::endl;
MACH3LOG_ERROR("Warning, didn't catch a saved mass");
return 0;
}

Expand Down Expand Up @@ -109,11 +108,10 @@ void CheckTH2PolyFileVersion(TFile *file) {

if(MainFileROOTVersion != MainSystemROOTVersion)
{
std::cerr<<"File was produced with: "<<FileROOTVersion<<" ROOT version"<<std::endl;
std::cerr<<"Found: "<<SystemROOTVersion<<" ROOT version in the system"<<std::endl;
std::cerr<<"For some documentation please visit me"<<std::endl;
std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
throw;
MACH3LOG_ERROR("File was produced with: {} ROOT version", FileROOTVersion);
MACH3LOG_ERROR("Found: {} ROOT version in the system", SystemROOTVersion);
MACH3LOG_ERROR("For some documentation please visit me");
throw MaCh3Exception(__FILE__, __LINE__);
}
}

Expand Down Expand Up @@ -322,7 +320,8 @@ TH2D* ConvertTH2PolyToTH2D(TH2Poly *poly, TH2D *h2dhist) {
xbin = hist->GetXaxis()->FindBin(xlow+(xup-xlow)/2);
ybin = hist->GetYaxis()->FindBin(ylow+(yup-ylow)/2);

//std::cout << "Poly bin " << i << ", xlow: " << xlow << ", xup: " << xup << ", ylow: " << ylow << ", yup: " << yup << ". Finding bin for (" << (xlow+(xup-xlow)/2) << "," << (ylow+(yup-ylow)/2) << ")" << ". Found Bin (" << xbin << "," << ybin << ") with content " << polybin->GetContent() << ". But Poly content: " << poly->GetBinContent(i) << std::endl;
MACH3LOG_TRACE("Poly bin {}, xlow: {}, xup: {}, ylow: {}, yup: {}. Finding bin for ({}, {}). Found Bin ({}, {}) with content {}. But Poly content: {}",
i, xlow, xup, ylow, yup, (xlow + (xup - xlow) / 2), (ylow + (yup - ylow) / 2), xbin, ybin, polybin->GetContent(), poly->GetBinContent(i));
hist->SetBinContent(xbin, ybin, polybin->GetContent());
}
return hist;
Expand Down
81 changes: 41 additions & 40 deletions samplePDF/Structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
#include "omp.h"
#endif

#include "manager/MaCh3Exception.h"
#include "manager/MaCh3Logger.h"

// *******************
/// @brief Template to make vector out of an array of any length
template< typename T, size_t N >
Expand Down Expand Up @@ -360,59 +363,57 @@ inline int PDGToProbs(NuPDG pdg){

switch (pdg){
case kNue:
ReturnProbNu = kProbNue;
break;
ReturnProbNu = kProbNue;
break;
case kNumu:
ReturnProbNu = kProbNumu;
break;
ReturnProbNu = kProbNumu;
break;
case kNutau:
ReturnProbNu = kProbNutau;
break;
ReturnProbNu = kProbNutau;
break;
case kNueBar:
ReturnProbNu = kProbNueBar;
break;
case kNumuBar:
ReturnProbNu = kProbNumuBar;
break;
case kNutauBar:
ReturnProbNu = kProbNutauBar;
break;
default:
std::cout << "Unrecognised pdg for the neutrino so can't map this to an int for Prob3++" << std::endl;
break;
ReturnProbNu = kProbNueBar;
break;
case kNumuBar:
ReturnProbNu = kProbNumuBar;
break;
case kNutauBar:
ReturnProbNu = kProbNutauBar;
break;
default:
MACH3LOG_WARN("Unrecognised pdg for the neutrino so can't map this to an int for Prob3++");
break;
}

return ReturnProbNu;
}

inline int ProbsToPDG(ProbNu NuType){

int ReturnNuPDG = -999;

switch (NuType){
case kProbNue:
ReturnNuPDG = static_cast<int>(kNue);
break;
case kProbNumu:
ReturnNuPDG = static_cast<int>(kNumu);
break;
case kProbNutau:
ReturnNuPDG = static_cast<int>(kNutau);
break;
case kProbNueBar:
ReturnNuPDG = static_cast<int>(kNueBar);
break;
case kProbNumuBar:
ReturnNuPDG = static_cast<int>(kNumuBar);
break;
case kProbNutauBar:
ReturnNuPDG = static_cast<int>(kNutauBar);
break;
default:
std::cout << "Unrecognised NuType for the neutrino so can't map this to a PDG code" << std::endl;
break;
case kProbNue:
ReturnNuPDG = static_cast<int>(kNue);
break;
case kProbNumu:
ReturnNuPDG = static_cast<int>(kNumu);
break;
case kProbNutau:
ReturnNuPDG = static_cast<int>(kNutau);
break;
case kProbNueBar:
ReturnNuPDG = static_cast<int>(kNueBar);
break;
case kProbNumuBar:
ReturnNuPDG = static_cast<int>(kNumuBar);
break;
case kProbNutauBar:
ReturnNuPDG = static_cast<int>(kNutauBar);
break;
default:
MACH3LOG_WARN("Unrecognised NuType for the neutrino so can't map this to a PDG code");
break;
}

return ReturnNuPDG;
}

Expand Down

0 comments on commit 8461aeb

Please sign in to comment.