Skip to content
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
10 changes: 10 additions & 0 deletions CIValidations/CovarianceValidations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ void TestAdaptive(std::ostream& outFile,
int main(int argc, char *argv[])
{
SetMaCh3LoggerFormat();
M3::rand::SetSeed(2137);
#ifdef MULTITHREAD
int oldThreads = omp_get_num_threads();
omp_set_num_threads(4);
#endif

if (argc != 1) {
MACH3LOG_CRITICAL("You specified arguments, but none are needed. (Program name: {})", argv[0]);
Expand Down Expand Up @@ -266,8 +271,13 @@ int main(int argc, char *argv[])
}
xsec->ThrowParameters();
}

for (int i = 0; i < xsec->GetNumParams(); ++i) {
outFile << "Thrown param " << i << " is equal to "<< xsec->GetParCurr(i) << std::endl;
}
xsec->SetParameters(ParProp);
xsec->AcceptStep();

///// Test Params from DetId /////
const std::vector<std::string> AffectedSamples = {"Tutorial_Beam", "Tutorial_ATM", "tutorial_beam", "blarb" "ATM"};
for (size_t id = 0; id < AffectedSamples.size(); ++id)
Expand Down
23 changes: 22 additions & 1 deletion CIValidations/PredictiveValidations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,27 @@ void PrepareConfig(const std::string& OriginalConfig) {
configOut.close();
}


void pValueCheck(std::ostream& outFile, TDirectory* predictiveDir) {
std::vector<std::string> SampleNames = {"Tutorial_Beam", "Tutorial_ATM", "ND_CC0pi", "ND_CC1pip", "ND_CCPi0", "ND_NC0pi", "ND_NC1pi0", "Total"};

for (const auto& sampleName : SampleNames) {
TDirectory* sampleDir = static_cast<TDirectory*>(predictiveDir->Get(sampleName.c_str()));
if (!sampleDir) {
MACH3LOG_CRITICAL("Sample directory '{}' not found in 'Predictive'", sampleName);
throw MaCh3Exception(__FILE__, __LINE__);
}
auto histName = sampleName + "_predfluc_draw";
TH2D* hist_pvalue = dynamic_cast<TH2D*>(sampleDir->Get(histName.c_str()));
outFile << "Sample "<< sampleName<< " pvale " << hist_pvalue->GetTitle() << std::endl;
}
}


int main(int argc, char *argv[])
{
SetMaCh3LoggerFormat();
M3::rand::SetSeed(2137);

if (argc != 1) {
MACH3LOG_CRITICAL("You specified arguments, but none are needed. (Program name: {})", argv[0]);
Expand All @@ -52,7 +70,8 @@ int main(int argc, char *argv[])
std::string tutorialPath = std::string(rootEnv);

std::string command = tutorialPath + "/bin/PredictiveTutorial " +
tutorialPath + "/mach3_temp_config.yaml";
tutorialPath + "/mach3_temp_config.yaml General:Seed:2137";

int ret = system(command.c_str());
if (ret != 0) {
MACH3LOG_WARN("Error: system call failed with code {}", ret);
Expand Down Expand Up @@ -144,6 +163,8 @@ int main(int argc, char *argv[])
}
}

pValueCheck(outFile, predictiveDir);

const char* MaCh3Env = std::getenv("MaCh3_ROOT");
std::string MaCh3Path = std::string(MaCh3Env);

Expand Down
1 change: 1 addition & 0 deletions CIValidations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

## PredictiveValidations
* Checking if Predictive Thrower produces same format and posterior predictive value and errors are identical using stored toys
* Checking if pValue is always the same

## SplineValidations
* Initialisation of SplineMonolith
Expand Down
10 changes: 10 additions & 0 deletions CIValidations/TestOutputs/CovarianceOut.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
Likelihood Xsec=266.956
Thrown param 0 is equal to 0.955297
Thrown param 1 is equal to 0.934278
Thrown param 2 is equal to 0.847934
Thrown param 3 is equal to 1.3331
Thrown param 4 is equal to 1.61124
Thrown param 5 is equal to 1.33056
Thrown param 6 is equal to 1.09364
Thrown param 7 is equal to 1.54087
Thrown param 8 is equal to -0.000381615
Thrown param 9 is equal to 0.00454828
Found 3 for Tutorial_Beam Params of type Norm
Found 5 for Tutorial_Beam Params of type Spline
Found 2 for Tutorial_Beam Params of type Functional
Expand Down
8 changes: 8 additions & 0 deletions CIValidations/TestOutputs/Predictive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -989,3 +989,11 @@ Sample ND_NC0pi bin (14, 5) content: 0
Sample ND_NC0pi bin (14, 5) error: 0
Sample ND_NC0pi bin (14, 6) content: 0
Sample ND_NC0pi bin (14, 6) error: 0
Sample Tutorial_Beam pvale Tutorial_Beam_predfluc_draw_990/999=0.990991
Sample Tutorial_ATM pvale Tutorial_ATM_predfluc_draw_937/999=0.937938
Sample ND_CC0pi pvale ND_CC0pi_predfluc_draw_999/999=1
Sample ND_CC1pip pvale ND_CC1pip_predfluc_draw_999/999=1
Sample ND_CCPi0 pvale ND_CCPi0_predfluc_draw_999/999=1
Sample ND_NC0pi pvale ND_NC0pi_predfluc_draw_999/999=1
Sample ND_NC1pi0 pvale ND_NC1pi0_predfluc_draw_999/999=1
Sample Total pvale Total_predfluc_draw_999/999=1
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

# Create project
project(MaCh3Tutorial VERSION 2.7.1 LANGUAGES CXX)
project(MaCh3Tutorial VERSION 2.8.0 LANGUAGES CXX)
set(MaCh3Tutorial_VERSION ${PROJECT_VERSION})

set(CMAKE_CXX_STANDARD_REQUIRED True)
Expand Down Expand Up @@ -32,7 +32,7 @@ LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/Modules)
# download CPM.cmake
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.43.1/CPM.cmake
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.43.2/CPM.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
)
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)
Expand Down
Loading