<commit_before>// Run configuration class
// Author: <NAME>  18/11/2010
#include <iostream>
#include <sstream>
#include <cassert>
#include <stdexcept>

#include "Algorithms.h"
#include "DataAnalysis.h"
#include "Constants.h"
#include "Units.h"

#include "RunConfig.h"
#include "ConfigFile.h"

using namespace std;

ClassImp(RunConfig);

//__________________________________________________________________________
RunConfig::RunConfig()
          :TObject(), fNames(), fOptions(), fParams()
{
   #ifdef PRINT_CONSTRUCTORS
      cout << "RunConfig::Default Constructor" << endl;
   #endif
}

//__________________________________________________________________________
RunConfig::RunConfig(const ConfigFile& masterConfig, int runNumber)
          :TObject(), fNames(), fOptions(), fParams()
{
   #ifdef PRINT_CONSTRUCTORS
      cout << "RunConfig::Constructor" << endl;
   #endif
   //////////////////////////////////////////////////////////////////
   // -- Extract full path to directory containing configuration files 
   const string compressedfolderpath = masterConfig.GetString("Path","Folder");
   const string folderpath = Algorithms::FileSystem::ExpandFilePath(compressedfolderpath);
   //////////////////////////////////////////////////////////////////
   // -- Use full folder path to find and build the run-config file
   ostringstream runID;
   runID << "Run" << runNumber; 
   string runConfigFileName = folderpath + masterConfig.GetString("Config", runID.str());
   if (runConfigFileName.empty() == kTRUE) {
      cout << "Error: Run Configuration file name specified is either empty of invalid" << endl;
      throw runtime_error("Error fetching name of Run Config file");
   }
   ConfigFile runConfigFile(runConfigFileName);
   // -----------------------------------
   ReadInRunConfig(runConfigFile, folderpath);
   // -- Check for Override parameters
   // Get the section of the master config file containing this run's configfile and override params
   map<string,string> section = masterConfig.GetSection(runID.str());
   CheckForOverrideParameters(section);
   // -----------------------------------
   // Print properties
   this->Print();
}

//__________________________________________________________________________
RunConfig::RunConfig(const RunConfig& other)
          :TObject(other),
           fNames(other.fNames),
           fOptions(other.fOptions),
           fParams(other.fParams)
{
   #ifdef PRINT_CONSTRUCTORS
      cout << "RunConfig::Copy Constructor" << endl;
   #endif
}

//__________________________________________________________________________
RunConfig::~RunConfig()
{
   #ifdef PRINT_CONSTRUCTORS
      cout << "RunConfig::Destructor" << endl;
   #endif<commit_msg>Remove Print() from RunConfig constructor<commit_after>// Run configuration class
// Author: <NAME>  18/11/2010
#include <iostream>
#include <sstream>
#include <cassert>
#include <stdexcept>

#include "Algorithms.h"
#include "DataAnalysis.h"
#include "Constants.h"
#include "Units.h"

#include "RunConfig.h"
#include "ConfigFile.h"

using namespace std;

ClassImp(RunConfig);

//__________________________________________________________________________
RunConfig::RunConfig()
          :TObject(), fNames(), fOptions(), fParams()
{
   #ifdef PRINT_CONSTRUCTORS
      cout << "RunConfig::Default Constructor" << endl;
   #endif
}

//__________________________________________________________________________
RunConfig::RunConfig(const ConfigFile& masterConfig, int runNumber)
          :TObject(), fNames(), fOptions(), fParams()
{
   #ifdef PRINT_CONSTRUCTORS
      cout << "RunConfig::Constructor" << endl;
   #endif
   //////////////////////////////////////////////////////////////////
   // -- Extract full path to directory containing configuration files 
   const string compressedfolderpath = masterConfig.GetString("Path","Folder");
   const string folderpath = Algorithms::FileSystem::ExpandFilePath(compressedfolderpath);
   //////////////////////////////////////////////////////////////////
   // -- Use full folder path to find and build the run-config file
   ostringstream runID;
   runID << "Run" << runNumber; 
   string runConfigFileName = folderpath + masterConfig.GetString("Config", runID.str());
   if (runConfigFileName.empty() == kTRUE) {
      cout << "Error: Run Configuration file name specified is either empty of invalid" << endl;
      throw runtime_error("Error fetching name of Run Config file");
   }
   ConfigFile runConfigFile(runConfigFileName);
   // -----------------------------------
   ReadInRunConfig(runConfigFile, folderpath);
   // -- Check for Override parameters
   // Get the section of the master config file containing this run's configfile and override params
   map<string,string> section = masterConfig.GetSection(runID.str());
   CheckForOverrideParameters(section);
}

//__________________________________________________________________________
RunConfig::RunConfig(const RunConfig& other)
          :TObject(other),
           fNames(other.fNames),
           fOptions(other.fOptions),
           fParams(other.fParams)
{
   #ifdef PRINT_CONSTRUCTORS
      cout << "RunConfig::Copy Constructor" << endl;
   #endif
}

//__________________________________________________________________________
RunConfig::~RunConfig()
{
   #ifdef PRINT_CONSTRUCTORS
      cout << "RunConfig::Destructor" << endl;
   #endif
{'fraction_non_alphanumeric': 0.17072717128510323, 'fraction_numerical': 0.0029756369722893808, 'mean_word_length': 3.2015625, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2728482', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1313, 'n_words': 340}