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

Some Fixes #226

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/CIPythonValidations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ jobs:
export PYTHONPATH=$PYTHONPATH:$PWD/python-test-modules/
export MACH3=$PWD

python3 -m pytest --config Inputs/ManagerTest.yaml CIValidations/PythonTests
python3 -m pytest --config Inputs/FitterConfig.yaml CIValidations/PythonTests

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
# CMake version check
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(MaCh3 VERSION 1.2.0 LANGUAGES CXX)
project(MaCh3 VERSION 1.2.1 LANGUAGES CXX)
set(MaCh3_VERSION ${PROJECT_VERSION})

#LP - This option name is confusing, but I wont change it now.
Expand Down
2 changes: 1 addition & 1 deletion Doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "MaCh3"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.2.0
PROJECT_NUMBER = 1.2.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 3 additions & 1 deletion Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ RUN apt update && apt upgrade -y

RUN apt-get install -y nlohmann-json3-dev
#MISC_SW
RUN apt install -y --no-install-recommends vim less nano gdb csh tcsh ed quota python3 python3-dev python3-pip cvs procmail ca-certificates
RUN apt install -y --no-install-recommends \
vim less nano gdb csh tcsh ed quota python3 python3-dev python3-pip \
cvs procmail ca-certificates cmake ninja-build

# Declare the build argument
ARG MACH3_VERSION
Expand Down
17 changes: 13 additions & 4 deletions covariance/covarianceBase.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
#include "covariance/covarianceBase.h"

// ********************************************
covarianceBase::covarianceBase(std::string name, std::string file) : inputFile(file), pca(false) {
covarianceBase::covarianceBase(std::string name, std::string file, double threshold, int FirstPCA, int LastPCA) : inputFile(file), pca(false),
eigen_threshold(threshold), FirstPCAdpar(FirstPCA), LastPCAdpar(LastPCA) {
// ********************************************
MACH3LOG_INFO("Constructing instance of covarianceBase");
if (threshold < 0 || threshold >= 1) {
MACH3LOG_INFO("NOTE: {} {}", name, file);
MACH3LOG_INFO("Principal component analysis but given the threshold for the principal components to be less than 0, or greater than (or equal to) 1. This will not work");
MACH3LOG_INFO("Please specify a number between 0 and 1");
MACH3LOG_INFO("You specified: ");
MACH3LOG_INFO("Am instead calling the usual non-PCA constructor...");
pca = false;
}
init(name, file);
FirstPCAdpar = -999;
LastPCAdpar = -999;

// Call the innocent helper function
if (pca) ConstructPCA();
}
// ********************************************
covarianceBase::covarianceBase(const std::vector<std::string>& YAMLFile, std::string name, double threshold, int FirstPCA, int LastPCA) : inputFile(YAMLFile[0].c_str()), matrixName(name), pca(true), eigen_threshold(threshold), FirstPCAdpar(FirstPCA), LastPCAdpar(LastPCA) {
// ********************************************

MACH3LOG_INFO("Constructing instance of covarianceBase using ");
for(unsigned int i = 0; i < YAMLFile.size(); i++)
{
Expand Down
2 changes: 1 addition & 1 deletion covariance/covarianceBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class covarianceBase {
/// @brief "Usual" constructors from root file
/// @param name Matrix name
/// @param file Path to matrix root file
covarianceBase(std::string name, std::string file);
covarianceBase(std::string name, std::string file, double threshold = -1, int FirstPCAdpar = -999, int LastPCAdpar = -999);

/// @brief Destructor
virtual ~covarianceBase();
Expand Down
25 changes: 18 additions & 7 deletions plotting/GetPostfitParamPlots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ void MakeXsecRidgePlots()
auto blockContents = paramBlock[2].as<std::vector<std::string>>();

// the directory of histograms
TDirectoryFile *posteriorDir = man->input().getFile(0).file->Get<TDirectoryFile>("Post");
TDirectoryFile *posteriorDir = man->input().getFile(0).file->Get<TDirectoryFile>("Post_1d_hists");

// get num of params in the block
int nParams = static_cast<int>(blockContents.size());
Expand All @@ -579,12 +579,10 @@ void MakeXsecRidgePlots()
// use this to set the limits and also to plot the x axis and grid
TH1D *axisPlot = new TH1D("axis plot", "", 1, blockLimits[0], blockLimits[1]);

for(int parId = 0; parId < nParams; parId++){
for(int parId = 0; parId < nParams; parId++) {
std::string paramName = blockContents[parId];

TCanvas *posteriorDistCanv = nullptr;
TH1D *posteriorDist = nullptr;

// get the list of objects in the directory
TIter next(posteriorDir->GetListOfKeys());
while (TKey* key = static_cast<TKey*>(next())) {
Expand All @@ -595,13 +593,12 @@ void MakeXsecRidgePlots()
bool foundPar = (pos == str.length() - name.length());

if(foundPar){
posteriorDistCanv = posteriorDir->Get<TCanvas>(key->GetName());
posteriorDist = static_cast<TH1D*>(posteriorDistCanv->GetPrimitive(key->GetName()));
posteriorDist = posteriorDir->Get<TH1D>(key->GetName());
}
}

if(posteriorDist == nullptr){
MACH3LOG_WARN("Couldnt find parameter {} when making ridgeline plots", paramName);
MACH3LOG_WARN("Couldn't find parameter {} when making ridgeline plots", paramName);
continue;
}

Expand Down Expand Up @@ -758,6 +755,20 @@ void GetPostfitParamPlots()
postFitHist_tmp->SetLineWidth(man->getOption<int>("plotLineWidth"));
leg->AddEntry(postFitHist_tmp, man->getFileLabel(fileId).c_str(), "lpf");
}
/// @todo this is temporary hack
for(unsigned int fileId = 0; fileId < man->getNFiles(); fileId++)
{
TH1D *Hist = static_cast<TH1D*>((man->input().getFile(fileId).file->Get( ("param_xsec_"+plotType).c_str()))->Clone());

Hist->SetMarkerColor(TColor::GetColorPalette(fileId));
Hist->SetLineColor(TColor::GetColorPalette(fileId));
Hist->SetMarkerStyle(7);
Hist->SetLineStyle(1+fileId);
Hist->SetLineWidth(man->getOption<int>("plotLineWidth"));

PostfitHistVec.push_back(Hist);
}

canv->cd();
canv->Clear();
leg->Draw();
Expand Down