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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,15 @@ It is possible to compare several LLH scan files simply by adding more files as
./bin/PlotLLH LLH_Test.root LLH_Test_2.root
```

An estimate of the optimal step scale for each parameter can be made using the LLH scan. If many parameters step scale need to be updated, this is a good initial step.

To return an updated covariance matrix with the new step scales, you can run as:
```bash
./bin/GetStepScaleLLHScanTutorial TutorialConfigs/FitterConfig.yaml
```
Optionally if you have an existing file with the LLH scans, you can avoid re-running this step by including the file as an additional argument.


### Sigma Variations
Sigma Variations are conceptually similar to the LLH scan, where we vary individual parameters and reweight the MC correspondingly, however here instead of looking at how the LLH changes, the focus is actually on how the sample spectra themselves respond to the parameter movements.

Expand Down
1 change: 1 addition & 0 deletions Tutorial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ add_custom_target(TutorialApps)

foreach(app
LLHScanTutorial
GetStepScaleLLHScanTutorial
PredictiveTutorial
SigmaVarTutorial
KinemDistributionTutorial
Expand Down
41 changes: 41 additions & 0 deletions Tutorial/GetStepScaleLLHScanTutorial.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// MaCh3 spline includes
#include "Algorithms/MaCh3Factory.h"
#include "SamplesTutorial/SampleHandlerTutorial.h"

int main(int argc, char *argv[]){

std::string filename = "";
// Initialise manger responsible for config handling
std::unique_ptr<Manager> FitManager;
if (argc == 2)
FitManager = MaCh3ManagerFactory(argc, argv);
else
FitManager = MaCh3ManagerFactory(argc - 1, argv);

if (argc > 2)
filename = argv[2];

std::string OutputName = "LLH_" + FitManager->raw()["General"]["OutputFile"].as<std::string>();

FitManager->OverrideSettings("General", "OutputFile", OutputName);
// Initialise covariance class reasonable for Systematics
auto xsec = MaCh3CovarianceFactory<ParameterHandlerGeneric>(FitManager.get(), "Xsec");

// Initialise samplePDF
auto SampleConfig = Get<std::vector<std::string>>(FitManager->raw()["General"]["TutorialSamples"], __FILE__ , __LINE__);
auto mySamples = MaCh3SampleHandlerFactory<SampleHandlerTutorial>(SampleConfig, xsec.get());

// Create MCMC Class
std::unique_ptr<FitterBase> MaCh3Fitter = MaCh3FitterFactory(FitManager.get());
// Add covariance to MCM
MaCh3Fitter->AddSystObj(xsec.get());
for (size_t i = 0; i < SampleConfig.size(); ++i) {
MaCh3Fitter->AddSampleHandler(mySamples[i]);
}
// Run Step Scale Tuning from LLH scan
MaCh3Fitter->GetStepScaleBasedOnLLHScan(filename);
for (size_t i = 0; i < SampleConfig.size(); ++i) {
delete mySamples[i];
}
return 0;
}
2 changes: 2 additions & 0 deletions TutorialConfigs/FitterConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ LLHScan:
ScanRanges:
delta_cp: [-3.14,3.14]
sin2th_23: [0.35,0.65]
LLHType: "Total_LLH"
StepScaleParameters: []

SigmaVar:
# Values of sigma you want to perform, it must contain 0!
Expand Down