MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
inputManager.h
Go to the documentation of this file.
1#pragma once
2
3// MaCh3 Includes
9
10// Other plotting includes
11#include "plottingUtils.h"
12
13namespace MaCh3Plotting {
14
21
23};
24
35struct InputFile {
44 InputFile(const std::string &fName) {
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 }
57
58 // NO COPYING!!
59 InputFile( const InputFile& ) = delete;
60 // Moving ok
61 InputFile( InputFile&& ) = default;
62 // EM: ^^ there should only really be one instance of an InputFile for each
63 // underlying root file. If copying is allowed then it can lead to bad bad things
64 // like pointers getting deleted and then trying to be accessed by a copied
65 // InputFile instance
66
69 MACH3LOG_DEBUG("###### Deleting InputFile Object holding file ######");
70 LLHScans_map.clear();
71 }
72
75 void Close(){
76 MACH3LOG_DEBUG("[InputFile] closing file {}", fileName);
77 file->Close();
78 }
79
83 void Summarise() const {
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 }
90
93 void Dump() const {
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 }
106
109 TTree *posteriorTree = nullptr;
110
111 std::shared_ptr<TFile> file;
112 std::string fileName;
113
114 std::string fitter;
115
122
123 // EM: info on the LLH scans
125 std::vector<std::string>
127 std::unordered_map<std::string, bool>
130 std::unordered_map<std::string, std::unordered_map<std::string, std::shared_ptr<TGraph>>>
133 std::unordered_map<std::string, std::unordered_map<std::string, bool>>
137 // EM: maybe don't really need the "availableParams.." "hasLLHScans...", could just implement
138 // these as functions that look for the given parameter in the existing maps, might make things
139 // nicer
140
141 // EM: info on LLH scans broken down by sample
144 std::vector<std::string> availableSamples_LLH;
146 std::unordered_map<std::string, std::unordered_map<std::string, std::shared_ptr<TGraph>>>
149 std::unordered_map<std::string, std::unordered_map<std::string, bool>>
153
154 // EM: info on post fit errors
156 std::vector<std::string>
158 std::unordered_map<std::string, std::unordered_map<std::string, double>>
161 std::unordered_map<std::string, std::unordered_map<std::string, double>>
164 std::string defaultErrorType;
165
166 // Stuff relating to MCMC
171
174
176 std::unordered_map<std::string, bool> availableParams_map_MCMCchain;
177 std::unordered_map<std::string, bool> availableParams_map_1dPosteriors;
178
179 std::vector<std::string> availableParams_1dPosteriors;
180 std::vector<std::string> availableParams_MCMCchain;
181
182 std::unordered_map<std::string, double*> MCMCstepParamsMap;
183 std::unordered_map<std::string, int> MCMCstepTreeIndicesMap;
184
185 std::unordered_map<std::string, std::shared_ptr<TGraph>> posteriors1d_map;
186
187 // EM: almost certainly won't want to load all of these into memory at the start
189};
190
215public:
216 const std::string NOT_FOUND_STR =
217 "__PARAM_NAME_NOT_FOUND__";
218
223 InputManager(const std::string &translationConfigName);
224
227 void addFile(const std::string &fileName);
228
232 {
233 MACH3LOG_DEBUG("##### Deleting InputManager Instance #####");
234 for (InputFile &file: _fileVec)
235 {
236 file.Close();
237 }
238
239 _fileVec.clear();
240 }
241
242 // NO COPYING!
243 InputManager(const InputManager&) = delete;
244 // moving is ok
246 // EM: ^^ Do this as there should only ever really be one instance of the
247 // InputManager (should maybe make it a singleton actually)
248 // if copied then it can lead to things being deleted that we really don't
249 // want to be deleted
250
255 static const std::string convertFileTypeNames(fileTypeEnum fileType) {
256 switch (fileType)
257 {
258 case kLLH:
259 return "LLH";
260 case kPostFit:
261 return "PostFit";
262 case kMCMC:
263 return "MCMC";
264 case kSigmaVar:
265 return "SigmaVar";
266 case kNFileTypes:
267 return "NFileTypes";
268 default:
269 return "UNKNOWN_FILE_TYPE";
270 }
271 }
272
276 void print(const std::string &printLevel = "summary") const;
277
278 // FNs to get to the tasty tasty data stored in the files
279
285 std::vector<std::vector<double>> getLLHScan(int fileNum, std::string paramName, std::string LLHType) const {
286 if (!getEnabledLLH(fileNum, paramName, LLHType))
287 {
288 MACH3LOG_WARN("file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
289 MACH3LOG_WARN("am returning an empty vector");
290 return std::vector<std::vector<double>>(2);
291 }
292 return TGraphToVector(*_fileVec[fileNum].LLHScans_map.at(LLHType).at(paramName));
293 }
294
298 void getMCMCentry(int fileNum, int entry) const {
299 // EM: the const here is a little bit of a lie since GetEntry will in fact modify
300 // the pointers to the stored data for the MCMC chain values but hopefully this should be ok
301 const InputFile &file = _fileVec[fileNum];
302
303 if( entry > file.nMCMCentries )
304 {
305 MACH3LOG_ERROR("Trying to access entries beyond what exist in file {}. No-can-do!", file.fileName);
306 }
307 else
308 {
309 MACH3LOG_TRACE("Getting entry {} in MCMC tree for file at index {}", entry, fileNum);
310 file.posteriorTree->GetEntry(entry);
311 MACH3LOG_TRACE(" Got successfuly");
312 }
313 }
314
318 double getMCMCvalue(int fileNum, std::string paramName) const {
319 if (!getEnabledMCMCchain(fileNum, paramName))
320 {
321 MACH3LOG_WARN("file at index {} does not have an MCMC entry for parameter {}", fileNum, paramName);
322 MACH3LOG_WARN("am returning a bad float");
323 return M3::_BAD_DOUBLE_;
324 }
325
326 return *_fileVec[fileNum].MCMCstepParamsMap.at(paramName);
327 }
328
333 std::vector<std::vector<double>> get1dPosterior(int fileNum, std::string paramName) const {
334 if (!getEnabled1dPosteriors(fileNum, paramName))
335 {
336 MACH3LOG_WARN("file at index {} does not have a 1d posterior for parameter {}", fileNum, paramName);
337 MACH3LOG_WARN("am returning an empty vector");
338 return std::vector<std::vector<double>>(2);
339 }
340 return TGraphToVector(*_fileVec[fileNum].posteriors1d_map.at(paramName));
341 }
342
345 int getnMCMCentries(int fileNum) const {
346 return _fileVec[fileNum].nMCMCentries;
347 }
348
356 inline TGraph getLLHScan_TGraph(int fileNum, std::string paramName, std::string LLHType) const {
357 if (!getEnabledLLH(fileNum, paramName, LLHType))
358 {
359 MACH3LOG_WARN("file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
360 MACH3LOG_WARN("am returning an empty TGraph");
361 return TGraph();
362 }
363 return *_fileVec[fileNum].LLHScans_map.at(LLHType).at(paramName);
364 }
365
366 inline TH1D getLLHScan_TH1D(int fileNum, std::string paramName, std::string LLHType) const {
367 if (!getEnabledLLH(fileNum, paramName, LLHType))
368 {
369 MACH3LOG_WARN("file at index {} does not have LLH scan for parameter {}", fileNum, paramName);
370 MACH3LOG_WARN("am returning an empty TH1D");
371 return TH1D();
372 }
373 return TGraphToTH1D(*_fileVec[fileNum].LLHScans_map.at(LLHType).at(paramName));
374 }
375
382 std::vector<std::vector<double>> getSampleSpecificLLHScan(int fileNum, std::string paramName, std::string sample) const {
383 if (!getEnabledLLHBySample(fileNum, paramName, sample))
384 {
385 MACH3LOG_WARN("file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
386 MACH3LOG_WARN("am returning an empty vector");
387 return std::vector<std::vector<double>>(2);
388 }
389 return TGraphToVector(*_fileVec[fileNum].LLHScansBySample_map.at(sample).at(paramName));
390 }
391
392 inline TGraph getSampleSpecificLLHScan_TGraph(int fileNum, std::string paramName,
393 std::string sample) const {
394 if (!getEnabledLLHBySample(fileNum, paramName, sample))
395 {
396 MACH3LOG_WARN("file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
397 MACH3LOG_WARN("am returning an empty TGraph");
398 return TGraph();
399 }
400 return *_fileVec[fileNum].LLHScansBySample_map.at(sample).at(paramName);
401 }
402
403 inline TH1D getSampleSpecificLLHScan_TH1D(int fileNum, std::string paramName, std::string sample) const {
404 if (!getEnabledLLHBySample(fileNum, paramName, sample))
405 {
406 MACH3LOG_WARN("file at index {} does not have LLH scan for sample {} for parameter {}", fileNum, sample, paramName);
407 MACH3LOG_WARN("am returning an empty TH1D");
408 return TH1D();
409 }
410 return TGraphToTH1D(*_fileVec[fileNum].LLHScansBySample_map.at(sample).at(paramName));
411 }
412
418 inline bool getEnabledLLH(int fileNum, std::string paramName,
419 std::string LLHType = "total") const {
420 return _fileVec[fileNum].availableParams_map_LLH.at(LLHType).at(paramName);
421 }
422
429 inline bool getEnabledLLHBySample(int fileNum, std::string paramName, std::string sample) const {
430 return _fileVec[fileNum].availableParams_map_LLHBySample.at(sample).at(paramName);
431 }
432
437 inline bool getEnabledMCMCchain(int fileNum, std::string paramName) const {
438 return _fileVec[fileNum].availableParams_map_MCMCchain.at(paramName);
439 }
440
445 inline bool getEnabled1dPosteriors(int fileNum, std::string paramName) const {
446 return _fileVec[fileNum].availableParams_map_1dPosteriors.at(paramName);
447 }
448
456 double getPostFitError(int fileNum, const std::string &paramName, std::string errorType = "") const;
457
465 double getPostFitValue(int fileNum, const std::string &paramName, std::string errorType = "") const;
466
469 inline const std::vector<std::string> &getKnownParameters() const { return _knownParameters; }
470 inline const std::vector<std::string> &getKnownSamples() const { return _knownSamples; }
471 inline size_t getNInputFiles() const { return _fileVec.size(); }
472
480 inline std::vector<std::string> getTaggedParameters(const std::vector<std::string> &tags, std::string checkType = "all") const {
481 return getTaggedValues(_knownParameters, _paramToTagsMap, tags, checkType);
482 }
483
491 inline std::vector<std::string> getTaggedSamples(const std::vector<std::string> &tags, std::string checkType = "all") const {
492 return getTaggedValues(_knownSamples, _sampleToTagsMap, tags, checkType);
493 }
495
498 inline InputFile const &getFile(int fileId) const { return _fileVec[fileId]; }
499 inline std::string translateName(int fileId, fileTypeEnum fileType, std::string paramName) const {
500 return getFitterSpecificParamName(_fileVec[fileId].fitter, fileType, paramName);
501 }
502 inline const std::vector<std::string> &getKnownLLHParameters(int fileId) const {
503 return _fileVec[fileId].availableParams_LLH;
504 }
505 inline const std::vector<std::string> &getKnownLLHSamples(int fileId) const {
506 return _fileVec[fileId].availableSamples_LLH;
507 }
508 inline const std::vector<std::string> &getKnownPostFitParameters(int fileId) const {
509 return _fileVec[fileId].availableParams_postFitErrors;
510 }
511 inline const std::vector<std::string> &getKnownMCMCParameters(int fileId) const {
512 return _fileVec[fileId].availableParams_MCMCchain;
513 }
514 inline const std::vector<std::string> &getKnown1dPosteriorParameters(int fileId) const {
515 return _fileVec[fileId].availableParams_1dPosteriors;
516 }
518
519private:
520 // Helper function to get tagged values from a vector of values
521 // specify the initial list of *values*, the map of values to their tags, the tags to check,
522 // and the type of check to perform (see getTaggedParameter() for details)
523 std::vector<std::string> getTaggedValues(const std::vector<std::string> &values,
524 const std::unordered_map<std::string,
525 std::vector<std::string>> &tagMap,
526 const std::vector<std::string> &tags, std::string checkType) const;
527
528 // Helper function to parse a root file location string
529 // any instance of {PARAMETER} gets replaced with fitter specific parameter name
530 // similar for {SAMPLE}
531 // any other token that gets added in future can also just be added here and added to end of the
532 // argument list The string will also be split by the ":" delimeter into a directory and a name to
533 // look for in that directory
534 std::vector<std::string> parseLocation(const std::string &locationString, std::string &fitter,
535 fileTypeEnum fileType, const std::string &parameter = "",
536 const std::string &sample = "", const std::string &parameter2 = "") const;
537
538 // helper function to look for an object defined by a vector of strings [ (directory to look in),
539 // (end of the name of the object) ] this just calls roots TDirectoryFile->Get() function so
540 // behaves in the same way:
541 // if the object exists then it is loaded and returned
542 // if it doesn't exist then just returns nullptr
543 std::shared_ptr<TObject> findRootObject(const InputFile &fileDef, const std::vector<std::string> &locationVec) const;
544
545 // Check the input file for a particular post fit error for a particular parameter. if
546 // setInputFileError, will add the information to the InputFiles postFitErrors histogram.
547 bool findPostFitParamError(InputFile &inputFileDef, const std::string &parameter, std::string &fitter,
548 const std::string &errorType, bool setInputFileError = false);
549
550 // Check the input file for a particular post fit error for a particular parameter. if
551 // setInputFileError, will add the information to the InputFiles postFitErrors histogram.
552 bool findBySampleLLH(InputFile &inputFileDef, const std::string &parameter, std::string &fitter,
553 const std::string &sample, bool setInputFileScan = false);
554
555 // check the input file for raw MCMC step values for a particular parameter
556 bool findRawChainSteps(InputFile &inputFileDef, const std::string &parameter, std::string &fitter, bool setInputBranch = false ) const ;
557
558 // check the input file for processed 1d posteriors for a particular parameter
559 bool find1dPosterior(InputFile &inputFileDef, const std::string &parameter, std::string &fitter, bool setFileData = false) const ;
560
561 // fns tp read an input file
562 void fillFileInfo(InputFile &inputFileDef, bool printThoughts = true);
563 void fillFileData(InputFile &inputFileDef, bool printThoughts = true);
564
565 // helper function to read from the translation config file to get an option for a particular sub
566 // node (e.g. Parameters or Samples) returns true and sets "ret" if the option is specified for this
567 // fitter and parameter otherwise returns false
568 template <typename T>
569 inline bool getFitterSpecificOption(const std::string &fitter, const std::string &option, T &ret, const std::string &parameter,
570 YAML::Node subConfig) const{
571 if (subConfig[parameter])
572 {
573 // EM: this is config definition of fitter specific names for this parameter
574 YAML::Node paramTranslation = subConfig[parameter];
575
576 if (paramTranslation[fitter])
577 {
578 // EM: then this is definition of how to find parameter in the specified fitter
579 YAML::Node fitterParamTranslation = paramTranslation[fitter];
580
581 if (fitterParamTranslation[option])
582 {
583 ret = fitterParamTranslation[option].as<T>();
584 return true;
585 }
586 }
587 }
588 return false;
589 }
590
591 // Specialised option getter for parameters
592 template <typename T>
593 inline bool getFitterSpecificParamOption(const std::string &fitter, const std::string &option, T &ret,
594 const std::string &parameter) const {
595 return getFitterSpecificOption<T>(fitter, option, ret, parameter, _parametersConfig);
596 }
597
598 // specialised option getter for samples
599 template <typename T>
600 inline bool getFitterSpecificSampleOption(const std::string &fitter, std::string option, T &ret,
601 std::string parameter) const {
602 return getFitterSpecificOption<T>(fitter, option, ret, parameter, _samplesConfig);
603 }
604
605 // helper function to read from the translation config to get the parameter name for a specific
606 // fitter and file type
607 inline std::string getFitterSpecificParamName(const std::string &fitter, fileTypeEnum fileType,
608 const std::string &parameter) const {
609 std::string specificName;
610 if (getFitterSpecificParamOption<std::string>(fitter, convertFileTypeNames(fileType),
611 specificName, parameter))
612 {
613 return specificName;
614 }
615 // EM: Default to just return the specified name
616 return parameter;
617 }
618
619 // helper function to read from the translation config file to get the sample name for a specific
620 // fitter and file type
621 inline std::string getFitterSpecificSampleName(const std::string &fitter, fileTypeEnum fileType,
622 const std::string &sample) const {
623 std::string specificName;
624 if (getFitterSpecificSampleOption<std::string>(fitter, convertFileTypeNames(fileType),
625 specificName, sample))
626 {
627 return specificName;
628 }
629 // EM: Default to just return the specified name
630 return sample;
631 }
632
633 // helper fn to test if string "str" ends with other string "ending"
634 inline bool strEndsWith(const std::string& str, const std::string& ending) const {
635 if (str.size() >= ending.size()) {
636 return str.compare(str.size() - ending.size(), ending.size(), ending) == 0;
637 }
638 return false;
639 }
640
641private:
642 // all parameters which are known to this InputManager: all the ones defined in the translation
643 // config used to create it
644 std::vector<std::string> _knownParameters;
645
646 // all samples which are known to this InputManager: all the ones defined in the translation
647 // config used to create it
648 std::vector<std::string> _knownSamples;
649
650 // hold the names of the fitters known to this manager
651 std::vector<std::string> _knownFitters;
652
653 // map parameter names to their specified tags
654 std::unordered_map<std::string, std::vector<std::string>> _paramToTagsMap;
655 // map sample names to their specified tags
656 std::unordered_map<std::string, std::vector<std::string>> _sampleToTagsMap;
657
658 // the configs defining the translation of parameters between fitters and also the directory
659 // structure for each fitter
663 YAML::Node _samplesConfig;
664
665 // vector of InputFile objects that this manager is responsible for
666 std::vector<InputFile> _fileVec;
667};
668} // namespace MaCh3Plotting
KS: Based on this https://github.com/gabime/spdlog/blob/a2b4262090fd3f005c2315dcb5be2f0f1774a005/incl...
#define MACH3LOG_DEBUG
Definition: MaCh3Logger.h:22
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:25
#define MACH3LOG_INFO
Definition: MaCh3Logger.h:23
#define MACH3LOG_WARN
Definition: MaCh3Logger.h:24
#define MACH3LOG_TRACE
Definition: MaCh3Logger.h:21
Utility functions for handling YAML nodes.
Class responsible for processing MCMC chains, performing diagnostics, generating plots,...
Definition: MCMCProcessor.h:65
This guy talks to the input files and is intended to smooth over the fact that our OA fitters use suc...
Definition: inputManager.h:214
double getPostFitError(int fileNum, const std::string &paramName, std::string errorType="") const
Get the post fit error for a particular parameter from a particular input file.
std::vector< std::string > parseLocation(const std::string &locationString, std::string &fitter, fileTypeEnum fileType, const std::string &parameter="", const std::string &sample="", const std::string &parameter2="") const
bool getEnabledLLH(int fileNum, std::string paramName, std::string LLHType="total") const
Get whether or not a particular parameter has an LLH scan in a particular input file.
Definition: inputManager.h:418
const std::vector< std::string > & getKnown1dPosteriorParameters(int fileId) const
Definition: inputManager.h:514
const std::vector< std::string > & getKnownLLHSamples(int fileId) const
Definition: inputManager.h:505
const std::vector< std::string > & getKnownMCMCParameters(int fileId) const
Definition: inputManager.h:511
std::unordered_map< std::string, std::vector< std::string > > _paramToTagsMap
Definition: inputManager.h:654
TH1D getLLHScan_TH1D(int fileNum, std::string paramName, std::string LLHType) const
Definition: inputManager.h:366
bool getFitterSpecificOption(const std::string &fitter, const std::string &option, T &ret, const std::string &parameter, YAML::Node subConfig) const
Definition: inputManager.h:569
const std::vector< std::string > & getKnownPostFitParameters(int fileId) const
Definition: inputManager.h:508
std::vector< std::vector< double > > getSampleSpecificLLHScan(int fileNum, std::string paramName, std::string sample) const
Get the log likelihood scan for a particular parameter, for a specific sample, from a particular inpu...
Definition: inputManager.h:382
std::vector< InputFile > _fileVec
Definition: inputManager.h:666
void getMCMCentry(int fileNum, int entry) const
Get the MCMC chain entry in an InputFile.
Definition: inputManager.h:298
InputFile const & getFile(int fileId) const
Definition: inputManager.h:498
void fillFileData(InputFile &inputFileDef, bool printThoughts=true)
std::vector< std::string > getTaggedParameters(const std::vector< std::string > &tags, std::string checkType="all") const
Get all parameters which have some set of tags.
Definition: inputManager.h:480
std::vector< std::string > _knownParameters
Definition: inputManager.h:644
bool find1dPosterior(InputFile &inputFileDef, const std::string &parameter, std::string &fitter, bool setFileData=false) const
static const std::string convertFileTypeNames(fileTypeEnum fileType)
Convert from fileTypeEnum to the name of the file type.
Definition: inputManager.h:255
std::vector< std::vector< double > > getLLHScan(int fileNum, std::string paramName, std::string LLHType) const
Get the log likelihood scan data for a particular parameter from a particular input file.
Definition: inputManager.h:285
int getnMCMCentries(int fileNum) const
Get the number of entries in the MCMC chain in a particular file.
Definition: inputManager.h:345
InputManager(const InputManager &)=delete
const std::string NOT_FOUND_STR
the default string to return if something can't be found
Definition: inputManager.h:216
const std::vector< std::string > & getKnownSamples() const
Definition: inputManager.h:470
TH1D getSampleSpecificLLHScan_TH1D(int fileNum, std::string paramName, std::string sample) const
Definition: inputManager.h:403
bool getEnabled1dPosteriors(int fileNum, std::string paramName) const
Get whether or not a particular parameter has 1d posteriors in a particular input file.
Definition: inputManager.h:445
std::vector< std::string > getTaggedValues(const std::vector< std::string > &values, const std::unordered_map< std::string, std::vector< std::string > > &tagMap, const std::vector< std::string > &tags, std::string checkType) const
std::shared_ptr< TObject > findRootObject(const InputFile &fileDef, const std::vector< std::string > &locationVec) const
std::vector< std::string > _knownFitters
Definition: inputManager.h:651
std::vector< std::vector< double > > get1dPosterior(int fileNum, std::string paramName) const
Get the 1d posterior particular parameter from a particular input file.
Definition: inputManager.h:333
void addFile(const std::string &fileName)
Add a new InputFile object to this input manager.
bool getFitterSpecificParamOption(const std::string &fitter, const std::string &option, T &ret, const std::string &parameter) const
Definition: inputManager.h:593
const std::vector< std::string > & getKnownLLHParameters(int fileId) const
Definition: inputManager.h:502
bool strEndsWith(const std::string &str, const std::string &ending) const
Definition: inputManager.h:634
std::string getFitterSpecificParamName(const std::string &fitter, fileTypeEnum fileType, const std::string &parameter) const
Definition: inputManager.h:607
TGraph getSampleSpecificLLHScan_TGraph(int fileNum, std::string paramName, std::string sample) const
Definition: inputManager.h:392
const std::vector< std::string > & getKnownParameters() const
Definition: inputManager.h:469
bool getFitterSpecificSampleOption(const std::string &fitter, std::string option, T &ret, std::string parameter) const
Definition: inputManager.h:600
void fillFileInfo(InputFile &inputFileDef, bool printThoughts=true)
InputManager(InputManager &&)=default
bool findPostFitParamError(InputFile &inputFileDef, const std::string &parameter, std::string &fitter, const std::string &errorType, bool setInputFileError=false)
std::string translateName(int fileId, fileTypeEnum fileType, std::string paramName) const
Definition: inputManager.h:499
bool findRawChainSteps(InputFile &inputFileDef, const std::string &parameter, std::string &fitter, bool setInputBranch=false) const
std::vector< std::string > _knownSamples
Definition: inputManager.h:648
std::string getFitterSpecificSampleName(const std::string &fitter, fileTypeEnum fileType, const std::string &sample) const
Definition: inputManager.h:621
double getPostFitValue(int fileNum, const std::string &paramName, std::string errorType="") const
Get the post fit value for a particular parameter from a particular input file.
double getMCMCvalue(int fileNum, std::string paramName) const
Get the parameter value for the current step for a particular parameter from a particular input file.
Definition: inputManager.h:318
std::vector< std::string > getTaggedSamples(const std::vector< std::string > &tags, std::string checkType="all") const
Get all samples which have some set of tags.
Definition: inputManager.h:491
std::unordered_map< std::string, std::vector< std::string > > _sampleToTagsMap
Definition: inputManager.h:656
bool findBySampleLLH(InputFile &inputFileDef, const std::string &parameter, std::string &fitter, const std::string &sample, bool setInputFileScan=false)
bool getEnabledLLHBySample(int fileNum, std::string paramName, std::string sample) const
Get whether or not a particular parameter has an LLH scan in a particular input file for a particular...
Definition: inputManager.h:429
size_t getNInputFiles() const
Definition: inputManager.h:471
TGraph getLLHScan_TGraph(int fileNum, std::string paramName, std::string LLHType) const
Get the log likelihood scan for a particular parameter from a particular input file.
Definition: inputManager.h:356
bool getEnabledMCMCchain(int fileNum, std::string paramName) const
Get whether or not a particular parameter has MCMC chain entries in a particular input file.
Definition: inputManager.h:437
void print(const std::string &printLevel="summary") const
Print out what this Inputmanager instance knows about.
std::vector< std::vector< double > > TGraphToVector(TGraph graph)
This handy little function lets you interpret a TGraph as a vector containing the same data.
TH1D TGraphToTH1D(TGraph graph, std::string newName, std::string newTitle)
This handy little function lets you interpret a TGraph as a TH1D.
static constexpr const double _BAD_DOUBLE_
Default value used for double initialisation.
Definition: Core.h:43
fileTypeEnum
Types of possible file that can be read.
Definition: inputManager.h:16
@ kNFileTypes
Number of types of file.
Definition: inputManager.h:22
@ kPostFit
Processed post fit errors.
Definition: inputManager.h:18
@ kLLH
Log Likelihood scan.
Definition: inputManager.h:17
@ kSigmaVar
Sigma variations.
Definition: inputManager.h:20
@ kMCMC
MCMC chain.
Definition: inputManager.h:19
Struct which wraps around the actual input file and also holds general information,...
Definition: inputManager.h:35
std::string fileName
The location of the underlying file.
Definition: inputManager.h:112
void Dump() const
Print out a more detailed summary of what is contained in the file.
Definition: inputManager.h:93
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
std::unordered_map< std::string, std::unordered_map< std::string, bool > > availableParams_map_LLH
Definition: inputManager.h:134
std::vector< std::string > availableParams_LLH
The parameters that this file contains likelihood scans for.
Definition: inputManager.h:126
std::unordered_map< std::string, bool > availableParams_map_MCMCchain
whether or not specific parameters exist in the MCMC posterior chain
Definition: inputManager.h:176
std::string defaultErrorType
Definition: inputManager.h:164
void Summarise() const
Print out a small summary of what is contained in the file.
Definition: inputManager.h:83
InputFile(const std::string &fName)
Create InputFile instance based on a specified file.
Definition: inputManager.h:44
InputFile(const InputFile &)=delete
std::unordered_map< std::string, std::unordered_map< std::string, std::shared_ptr< TGraph > > > LLHScans_map
Definition: inputManager.h:131
std::string fitter
Which fitter this file came from, detected by InputManager::fillFileInfo().
Definition: inputManager.h:114
bool hasLLHScans
Whether or not this file contains any log likelihood scans.
Definition: inputManager.h:124
bool has1dPosteriors
Whether or not the file has processed 1d posteriors.
Definition: inputManager.h:168
MCMCProcessor * mcmcProc
ptr to an MCMCProcessor instance to be used if this is a MaCh3 input file
Definition: inputManager.h:108
std::unordered_map< std::string, std::shared_ptr< TGraph > > posteriors1d_map
Definition: inputManager.h:185
std::unordered_map< std::string, std::unordered_map< std::string, double > > postFitErrors
Definition: inputManager.h:159
bool hasSigmaVars
Whether or not this file contains Sigma variations.
Definition: inputManager.h:188
std::vector< std::string > availableParams_MCMCchain
Definition: inputManager.h:180
std::unordered_map< std::string, bool > availableParams_map_1dPosteriors
Definition: inputManager.h:177
std::unordered_map< std::string, std::unordered_map< std::string, double > > postFitValues
Definition: inputManager.h:162
std::unordered_map< std::string, std::unordered_map< std::string, std::shared_ptr< TGraph > > > LLHScansBySample_map
Definition: inputManager.h:147
bool hasPostFitErrors
Whether or not this file contains any processed post fit errors.
Definition: inputManager.h:155
std::vector< std::string > availableParams_postFitErrors
The parameters that this file has post fit errors for.
Definition: inputManager.h:157
void Close()
Close out the underlying root file.
Definition: inputManager.h:75
std::unordered_map< std::string, int > MCMCstepTreeIndicesMap
Definition: inputManager.h:183
std::unordered_map< std::string, std::unordered_map< std::string, bool > > availableParams_map_LLHBySample
Definition: inputManager.h:150
std::unordered_map< std::string, double * > MCMCstepParamsMap
Definition: inputManager.h:182
InputFile(InputFile &&)=default
bool hasMCMCchain
Whether or not the file has unprocessed MCMC chain steps.
Definition: inputManager.h:170
int nMCMCentries
The number of steps in the MCMC chain.
Definition: inputManager.h:173
std::vector< std::string > availableSamples_LLH
Definition: inputManager.h:144
std::vector< std::string > availableParams_1dPosteriors
Definition: inputManager.h:179