MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
MaCh3Plotting::InputFile Struct Reference

Struct which wraps around the actual input file and also holds general information, and data from the file to be used by other classes. More...

#include <Plotting/plottingUtils/inputManager.h>

Collaboration diagram for MaCh3Plotting::InputFile:
[legend]

Public Member Functions

 InputFile (const std::string &fName)
 Create InputFile instance based on a specified file.
 
 InputFile (const InputFile &)=delete
 
 InputFile (InputFile &&)=default
 
 ~InputFile ()
 Destructor.
 
void Close ()
 Close out the underlying root file.
 
void Summarise () const
 Print out a small summary of what is contained in the file.
 
void Dump () const
 Print out a more detailed summary of what is contained in the file.
 

Public Attributes

MCMCProcessormcmcProc = nullptr
 ptr to an MCMCProcessor instance to be used if this is a MaCh3 input file
 
TTree * posteriorTree = nullptr
 
std::shared_ptr< TFile > file
 Pointer to the underlying file for this InputFile instance.
 
std::string fileName
 The location of the underlying file.
 
std::string fitter
 Which fitter this file came from, detected by InputManager::fillFileInfo().
 
bool hasLLHScans
 Whether or not this file contains any log likelihood scans.
 
std::vector< std::string > availableParams_LLH
 The parameters that this file contains likelihood scans for.
 
std::unordered_map< std::string, bool > hasLLHScans_map
 
std::unordered_map< std::string, std::unordered_map< std::string, std::shared_ptr< TGraph > > > LLHScans_map
 
std::unordered_map< std::string, std::unordered_map< std::string, bool > > availableParams_map_LLH
 
bool hasLLHScansBySample
 
std::vector< std::string > availableSamples_LLH
 
std::unordered_map< std::string, std::unordered_map< std::string, std::shared_ptr< TGraph > > > LLHScansBySample_map
 
std::unordered_map< std::string, std::unordered_map< std::string, bool > > availableParams_map_LLHBySample
 
bool hasPostFitErrors
 Whether or not this file contains any processed post fit errors.
 
std::vector< std::string > availableParams_postFitErrors
 The parameters that this file has post fit errors for.
 
std::unordered_map< std::string, std::unordered_map< std::string, double > > postFitErrors
 
std::unordered_map< std::string, std::unordered_map< std::string, double > > postFitValues
 
std::string defaultErrorType
 
bool has1dPosteriors
 Whether or not the file has processed 1d posteriors.
 
bool hasMCMCchain
 Whether or not the file has unprocessed MCMC chain steps.
 
int nMCMCentries
 The number of steps in the MCMC chain.
 
std::unordered_map< std::string, bool > availableParams_map_MCMCchain
 whether or not specific parameters exist in the MCMC posterior chain
 
std::unordered_map< std::string, bool > availableParams_map_1dPosteriors
 
std::vector< std::string > availableParams_1dPosteriors
 
std::vector< std::string > availableParams_MCMCchain
 
std::unordered_map< std::string, double * > MCMCstepParamsMap
 
std::unordered_map< std::string, int > MCMCstepTreeIndicesMap
 
std::unordered_map< std::string, std::shared_ptr< TGraph > > posteriors1d_map
 
bool hasSigmaVars
 Whether or not this file contains Sigma variations.
 

Detailed Description

Struct which wraps around the actual input file and also holds general information, and data from the file to be used by other classes.

This is just a little guy thats intended to be just a plain old data type which simply holds and organises information and data read from the underlying input file, just some methods to inspect the contents of the object. As such it does not implement methods to manipulate such data, which is all done via the InputManager() class. Reason for this object is to try to smooth over the cracks that come from very different file structures used by different fitters and provide a common format to be used for plot making. Intended use of this objects is only via InputManager which contains the methods to fill and manipulate it.

Definition at line 35 of file inputManager.h.

Constructor & Destructor Documentation

◆ InputFile() [1/3]

MaCh3Plotting::InputFile::InputFile ( const std::string &  fName)
inline

Create InputFile instance based on a specified file.

Parameters
fNameThe name of the file to open.
Returns
The constructed InputFile.

Constructor which opens the specified file and sets default values for information parameters. Currently this assumes the specified file is a root file, and opens it as a TFile. In future it would be nice to extend this to be able to read different types of files, perhaps also moving the opening of the file to a different place to keep this struct nice and simple, perhaps into the InputManager.

Definition at line 44 of file inputManager.h.

44 {
45 fileName = fName;
46
47 file = std::make_shared<TFile>(fileName.c_str());
48 hasLLHScans = false;
49 hasPostFitErrors = false;
50 hasSigmaVars = false;
51
52 for (std::string LLHType : {"sample", "penalty", "total"})
53 {
54 hasLLHScans_map[LLHType] = false;
55 }
56 }
std::string fileName
The location of the underlying file.
Definition: inputManager.h:112
std::shared_ptr< TFile > file
Pointer to the underlying file for this InputFile instance.
Definition: inputManager.h:111
std::unordered_map< std::string, bool > hasLLHScans_map
Definition: inputManager.h:128
bool hasLLHScans
Whether or not this file contains any log likelihood scans.
Definition: inputManager.h:124
bool hasSigmaVars
Whether or not this file contains Sigma variations.
Definition: inputManager.h:188
bool hasPostFitErrors
Whether or not this file contains any processed post fit errors.
Definition: inputManager.h:155

◆ InputFile() [2/3]

MaCh3Plotting::InputFile::InputFile ( const InputFile )
delete

◆ InputFile() [3/3]

MaCh3Plotting::InputFile::InputFile ( InputFile &&  )
default

◆ ~InputFile()

MaCh3Plotting::InputFile::~InputFile ( )
inline

Destructor.

Definition at line 68 of file inputManager.h.

68 {
69 MACH3LOG_DEBUG("###### Deleting InputFile Object holding file ######");
70 LLHScans_map.clear();
71 }
#define MACH3LOG_DEBUG
Definition: MaCh3Logger.h:22
std::unordered_map< std::string, std::unordered_map< std::string, std::shared_ptr< TGraph > > > LLHScans_map
Definition: inputManager.h:131

Member Function Documentation

◆ Close()

void MaCh3Plotting::InputFile::Close ( )
inline

Close out the underlying root file.

Should only be done once this InputFile is done with, should only really ever be done by the InputManager that holds this object

Definition at line 75 of file inputManager.h.

75 {
76 MACH3LOG_DEBUG("[InputFile] closing file {}", fileName);
77 file->Close();
78 }

◆ Dump()

void MaCh3Plotting::InputFile::Dump ( ) const
inline

Print out a more detailed summary of what is contained in the file.

Todo:
Same as for Summarise(), could add a check that the file info has actually been filled.

Definition at line 93 of file inputManager.h.

93 {
94 Summarise();
95 MACH3LOG_INFO("Available LLH parameters: ");
96 for (std::string paramName : availableParams_LLH)
97 {
98 MACH3LOG_INFO(" {}", paramName);
99 }
100 MACH3LOG_INFO("Available Post Fit errors: ");
101 for (std::string paramName : availableParams_postFitErrors)
102 {
103 MACH3LOG_INFO(" {}", paramName);
104 }
105 }
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:23
std::vector< std::string > availableParams_LLH
The parameters that this file contains likelihood scans for.
Definition: inputManager.h:126
void Summarise() const
Print out a small summary of what is contained in the file.
Definition: inputManager.h:83
std::vector< std::string > availableParams_postFitErrors
The parameters that this file has post fit errors for.
Definition: inputManager.h:157

◆ Summarise()

void MaCh3Plotting::InputFile::Summarise ( ) const
inline

Print out a small summary of what is contained in the file.

Todo:
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.

Definition at line 83 of file inputManager.h.

83 {
84 MACH3LOG_INFO("### Input File Summary ###");
85 MACH3LOG_INFO(" Root file loc: {}", fileName);
86 MACH3LOG_INFO(" Came from fitter: {}", fitter);
87 MACH3LOG_INFO(" N LLH scans: {}", availableParams_LLH.size());
88 MACH3LOG_INFO(" N Processed post fit errors: {}", availableParams_postFitErrors.size());
89 }
std::string fitter
Which fitter this file came from, detected by InputManager::fillFileInfo().
Definition: inputManager.h:114

Member Data Documentation

◆ availableParams_1dPosteriors

std::vector<std::string> MaCh3Plotting::InputFile::availableParams_1dPosteriors

Definition at line 179 of file inputManager.h.

◆ availableParams_LLH

std::vector<std::string> MaCh3Plotting::InputFile::availableParams_LLH

The parameters that this file contains likelihood scans for.

Definition at line 126 of file inputManager.h.

◆ availableParams_map_1dPosteriors

std::unordered_map<std::string, bool> MaCh3Plotting::InputFile::availableParams_map_1dPosteriors

Definition at line 177 of file inputManager.h.

◆ availableParams_map_LLH

std::unordered_map<std::string, std::unordered_map<std::string, bool> > MaCh3Plotting::InputFile::availableParams_map_LLH

Whether this file has LLH scans of a particular type for a particular parameter, organised as availableParams_map_LLH.at(LLHType).at(parameter)

Definition at line 134 of file inputManager.h.

◆ availableParams_map_LLHBySample

std::unordered_map<std::string, std::unordered_map<std::string, bool> > MaCh3Plotting::InputFile::availableParams_map_LLHBySample

Whether this file has LLH scans of a particular type for a particular parameter, organised as availableParams_map_LLH.at(sample).at(parameter)

Definition at line 150 of file inputManager.h.

◆ availableParams_map_MCMCchain

std::unordered_map<std::string, bool> MaCh3Plotting::InputFile::availableParams_map_MCMCchain

whether or not specific parameters exist in the MCMC posterior chain

Definition at line 176 of file inputManager.h.

◆ availableParams_MCMCchain

std::vector<std::string> MaCh3Plotting::InputFile::availableParams_MCMCchain

Definition at line 180 of file inputManager.h.

◆ availableParams_postFitErrors

std::vector<std::string> MaCh3Plotting::InputFile::availableParams_postFitErrors

The parameters that this file has post fit errors for.

Definition at line 157 of file inputManager.h.

◆ availableSamples_LLH

std::vector<std::string> MaCh3Plotting::InputFile::availableSamples_LLH

The samples that this file contains individual likelihood scans for.

Definition at line 144 of file inputManager.h.

◆ defaultErrorType

std::string MaCh3Plotting::InputFile::defaultErrorType

Definition at line 164 of file inputManager.h.

◆ file

std::shared_ptr<TFile> MaCh3Plotting::InputFile::file

Pointer to the underlying file for this InputFile instance.

Definition at line 111 of file inputManager.h.

◆ fileName

std::string MaCh3Plotting::InputFile::fileName

The location of the underlying file.

Definition at line 112 of file inputManager.h.

◆ fitter

std::string MaCh3Plotting::InputFile::fitter

Which fitter this file came from, detected by InputManager::fillFileInfo().

Definition at line 114 of file inputManager.h.

◆ has1dPosteriors

bool MaCh3Plotting::InputFile::has1dPosteriors

Whether or not the file has processed 1d posteriors.

Definition at line 168 of file inputManager.h.

◆ hasLLHScans

bool MaCh3Plotting::InputFile::hasLLHScans

Whether or not this file contains any log likelihood scans.

Todo:

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???

Definition at line 124 of file inputManager.h.

◆ hasLLHScans_map

std::unordered_map<std::string, bool> MaCh3Plotting::InputFile::hasLLHScans_map

Whether this file contains specific types of likelihood scans, e.g. hasLLHScans_map.at("prior").

Definition at line 128 of file inputManager.h.

◆ hasLLHScansBySample

bool MaCh3Plotting::InputFile::hasLLHScansBySample

Whether or not this file contains log likelihood scans broken down per sample.

Definition at line 142 of file inputManager.h.

◆ hasMCMCchain

bool MaCh3Plotting::InputFile::hasMCMCchain

Whether or not the file has unprocessed MCMC chain steps.

Definition at line 170 of file inputManager.h.

◆ hasPostFitErrors

bool MaCh3Plotting::InputFile::hasPostFitErrors

Whether or not this file contains any processed post fit errors.

Definition at line 155 of file inputManager.h.

◆ hasSigmaVars

bool MaCh3Plotting::InputFile::hasSigmaVars

Whether or not this file contains Sigma variations.

Definition at line 188 of file inputManager.h.

◆ LLHScans_map

std::unordered_map<std::string, std::unordered_map<std::string, std::shared_ptr<TGraph> > > MaCh3Plotting::InputFile::LLHScans_map

The actual graphs of the likelihood scans, organised as LLHScans_map.at(LLHType).at(parameter).

Definition at line 131 of file inputManager.h.

◆ LLHScansBySample_map

std::unordered_map<std::string, std::unordered_map<std::string, std::shared_ptr<TGraph> > > MaCh3Plotting::InputFile::LLHScansBySample_map

The actual graphs of the likelihood scans, organised as LLHScans_map.at(sample).at(parameter).

Definition at line 147 of file inputManager.h.

◆ mcmcProc

MCMCProcessor* MaCh3Plotting::InputFile::mcmcProc = nullptr

ptr to an MCMCProcessor instance to be used if this is a MaCh3 input file

Definition at line 108 of file inputManager.h.

◆ MCMCstepParamsMap

std::unordered_map<std::string, double*> MaCh3Plotting::InputFile::MCMCstepParamsMap

Definition at line 182 of file inputManager.h.

◆ MCMCstepTreeIndicesMap

std::unordered_map<std::string, int> MaCh3Plotting::InputFile::MCMCstepTreeIndicesMap

Definition at line 183 of file inputManager.h.

◆ nMCMCentries

int MaCh3Plotting::InputFile::nMCMCentries

The number of steps in the MCMC chain.

Definition at line 173 of file inputManager.h.

◆ posteriors1d_map

std::unordered_map<std::string, std::shared_ptr<TGraph> > MaCh3Plotting::InputFile::posteriors1d_map

Definition at line 185 of file inputManager.h.

◆ posteriorTree

TTree* MaCh3Plotting::InputFile::posteriorTree = nullptr

Definition at line 109 of file inputManager.h.

◆ postFitErrors

std::unordered_map<std::string, std::unordered_map<std::string, double> > MaCh3Plotting::InputFile::postFitErrors

The actual errors on the parameters, organised as postFitErrors.at(errorType).at(parameter).

Definition at line 159 of file inputManager.h.

◆ postFitValues

std::unordered_map<std::string, std::unordered_map<std::string, double> > MaCh3Plotting::InputFile::postFitValues

The post fit values of the parameters, organised as postFitValues.at(errorType).at(parameter).

Definition at line 162 of file inputManager.h.


The documentation for this struct was generated from the following file: