MaCh3  2.6.1
Reference Guide
Todo List
Member __cudaSafeCall (cudaError err, const char *file, const int line)

KS: There is plenty of useful stuff here https://github.com/NVIDIA/cuda-samples/blob/master/Samples/1_Utilities/deviceQuery/deviceQuery.cpp

KS: We might want to port some of these utilities, for example having bool if there is unified memory etc.

Member BinnedSplineHandler::CalcSplineWeights () final
KS: Once could use "ParamValues" but this will result in tiny bit different results due to floating point precision
Member CalculateEnu (double PLep, double cosTheta, double EB, bool neutrino)
WARNING this is hardcoded
Member CompareHistograms (const TH1 *h1, const TH1 *h2, const std::string &histName, const std::string &folderName)
add checks for stuff like bin content etc
Member FitterBase::SanitiseInputs ()
consider expanding into ParmaterHandler and add more sanitisers
Member GetMulticanonicalWeightGenGaussian (double deltacp, double mean, double width)
modify this to instead use atan2 implementation for wrapping
File GetPenaltyTermModule.hpp

This should really be moved to MCMC Processor

Member Graph_interpolate1D (TGraph *graph, double theta13)
double check implementation of TGraph interpolation for 1D
Member M3::Plotting::InputFile::Dump () const
Same as for Summarise(), could add a check that the file info has actually been filled.
Member M3::Plotting::InputFile::hasLLHScans

I think it would be nice to store all the InputFile data in some non root, maybe custom c++ types, and have separate reader classes for potential different input file formats that can convert to these types.

Currently all fitters use root but maybe some wonderful day in the far far future this wont be the case. Doing things this way we could maintain the possible future option of moving away from root???

Member M3::Plotting::InputFile::Summarise () const
Could add some flag to this to check if the relevant information has actually been filled already and if not give some warning or print only some of the values.
Class M3::Plotting::InputManager

A lot of string comparisons going on in the code for the post fit errors, would maybe be good to implement some kind of indexing for parameters and just have a map between the parameter names and this index to be used internally by the class.

Add code to read MCMC from input file

Add code to read Sigma variations. There are usually so many of these that we might not want to read them all into memory at once when adding the file but maybe just check to see what ones are in the file, then be able to read them on the fly later.

Add code to read in Violin plots from the postfit error output files.

Member M3::Plotting::InputManager::fillFileInfo (InputFile &inputFileDef, const bool printThoughts=true)

add a check here to make sure all the scans that are in the file are being picked up by the reader, and warn if any are not being used

Would like to be able to specify what kind of file and what fitter an input is from on the command like: e.g., like plotApp [options] fileName1;fileType;fitterName and only try to auto-detect it if it's not specified. this would save some time and would also be very helpful in situations where we can't auto-detect e.g. if there is some kind of overlap in the file structure between two fitters

Member M3::Plotting::PlottingManager::addUserOption ()

Implement this.

Would be good to add functionality to this to allow user to add their own options.

The way I can think to do this would be have fn addUserOption() to set the options, defining the cmd line option (e.g. -x), the name of the option, and maybe some description of the option to be used in the help message

can then store these options in some map or something to be retrieved later by getUserOption()

Member M3::Plotting::PlottingManager::getUserOption (const std::string &option)
Implement this.
Member M3::Plotting::PlottingManager::initialise ()
should add some kind of validataConfigs() method to got through all of the specified config files and make sure that all provided options are valid and all necessary options are provided as it can be pretty annoying and difficult to identify what's going wrong when yaml just fails to find an option at runtime
Member M3::Plotting::PlottingManager::parseInputs (int argc, char *const *argv)
make this able to return any un-parsed arguments so that user can specify their own arguments for use in their plotting scripts
Member M3::Plotting::PlottingManager::usage () const
could add some function to allow user to specify the help message for their particular script, then auto generate what the cmd line syntax looks like based on user specified options?
Member MaCh3CovarianceFactory (Manager *FitManager, const std::string &PreFix)
add adaptive stuff
Member MaCh3ManagerFactory (int argc, char **argv)

KS: May need some recursive magic to reduce amount of hardcoding

DL: Should probably replace this with something that doesn't require modifying core code

Class MCMCProcessor
KS: Implement Diagnostics/GetPenaltyTerm.cpp here.
Member MCMCProcessor::PowerSpectrumAnalysis ()
KS: Code is awfully slow... I know how to make it faster (GPU scream in a distant) but for now just make it for two params, bit hacky sry...
Member MinuitFit::MinuitFit (Manager *const fitMan)
KS: Make this in future configurable, for more see: https://root.cern.ch/doc/master/classROOT_1_1Math_1_1Minimizer.html
Member MulticanonicalMCMCHandler::AdjustUmbrellaStepScale (const std::vector< ParameterHandlerBase * > &systematics)
grab the step scale from the object directly and update based on the radtio to the umbrella width, removing assumption that its dcp
Member MulticanonicalMCMCHandler::GetMulticanonicalWeightGenGaussian (double deltacp)

implement the wrapping with circular distance function to avoid the need to calculate the weight multiple times for each parameter to ensure it receives a bias even when it jumps the boundary

implement the normalisation for n != 2, and allow n to be set in the yaml configuration file

Member MulticanonicalMCMCHandler::InitializeMulticanonicalHandlerConfig (Manager *fitMan, std::vector< ParameterHandlerBase * > &systematics)
DR: I realised this will fail if you set spline to true but don't
Member OscProcessor::LoadAdditionalInfo () final

we should actually calculate central value and prior error but leave it for now...

remove this hardcoding (e.g., use a map or enum-to-name function)

Member PCAHandler::ThrowParameters (const std::vector< std::unique_ptr< TRandom3 >> &random_number, double **throwMatrixCholDecomp, double *randParams, double *corr_throw, const std::vector< double > &fPreFitValue, const std::vector< double > &fLowBound, const std::vector< double > &fUpBound, int _fNumPar)
KS: We don't check if param is out of bounds. This is more problematic for PCA params.
File PlotMCMCDiag.cpp
this need serious refactor
File PlotSigmaVariation.cpp
add maybe ratio for PlotSigVar1D
Member PredictiveThrower::StudyByMode1DProjections (const std::vector< TDirectory * > &SampleDirectories) const
KS: Here we assume each sample has same modes, this is because ProduceSpectra function, expects vector [sample], [toy], [dim], so we make ProjectionToys with [mode], [sample], [toy], [dim] so we can reuse this functionality
Member ReweightMCMC (const std::string &configFile, const std::string &inputFile)

add a generic 2D reweight that is not dm32 and theta13 specific DWR

Get list only of unique parameters, this is repeating unnecessarily when adding more than 1 weight DWR

Finish Asimov shifting implementation, for now just warn that Asimovs are not being properly handled

add tracking for how many events are outside the graph ranges for diagnostics DWR

Member SampleBinningInfo::InitNonUniform (const std::vector< std::vector< std::vector< double >>> &InputBins)
KS: Now we create "Large Bins" automatically, in future we can expand to add more user control
Member SampleHandlerBase::ReturnKinematicParameterBinning (const int Sample, const std::string &KinematicParameter) const final
might be useful to allow overwriting this
Member SampleHandlerBase::SetupSplines ()=0
abstract the spline initialisation completely to core
Member SystType
KS: Consider using enum class, it is generally recommended as safer. It will require many static_cast
Member UmbrellaSolver (const std::string &config_file)
code now assumes it is only for delta CP
Member zSolver (const std::vector< double > &z_current, const std::vector< WindowConfig > &windows, const std::vector< std::vector< double >> &samples, const std::vector< std::vector< std::vector< double >>> &window_cache, bool use_openmp=true, bool verbose=false, [[maybe_unused]] int *total_lines=nullptr)
: try this with magnitude = 1, the absolute scale doesn't matter but maybee this condition is preventing elements meeting their required values? also just try completely disabled double z_sum = 0.0; for (int i = 0; i < n_windows; i++) { z_sum += z_new[i]; } if (z_sum > 0) { for (int i = 0; i < n_windows; i++) { z_new[i] /= z_sum; }