From 3cdcf5f5d895398d62068396c31e5d01e4843d48 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 28 Jan 2024 21:41:42 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../sensitivity/inc/TRestComponent.h | 3 +- .../sensitivity/inc/TRestExperimentList.h | 20 +++++----- .../sensitivity/inc/TRestSensitivity.h | 8 ++-- .../sensitivity/src/TRestComponent.cxx | 9 +++-- .../sensitivity/src/TRestComponentDataSet.cxx | 3 +- .../sensitivity/src/TRestExperiment.cxx | 2 +- .../sensitivity/src/TRestExperimentList.cxx | 38 ++++++++++--------- .../sensitivity/src/TRestSensitivity.cxx | 15 ++++---- 8 files changed, 50 insertions(+), 48 deletions(-) diff --git a/source/framework/sensitivity/inc/TRestComponent.h b/source/framework/sensitivity/inc/TRestComponent.h index 5c220707a..dce197d2d 100644 --- a/source/framework/sensitivity/inc/TRestComponent.h +++ b/source/framework/sensitivity/inc/TRestComponent.h @@ -23,10 +23,9 @@ #ifndef REST_TRestComponent #define REST_TRestComponent -#include - #include #include +#include #include #include diff --git a/source/framework/sensitivity/inc/TRestExperimentList.h b/source/framework/sensitivity/inc/TRestExperimentList.h index acb8e6220..5d1737e40 100644 --- a/source/framework/sensitivity/inc/TRestExperimentList.h +++ b/source/framework/sensitivity/inc/TRestExperimentList.h @@ -48,31 +48,31 @@ class TRestExperimentList : public TRestMetadata { std::vector > fExperimentsTable; //< /// A vector with a list of experiments includes the background components in this model - std::vector fExperiments; //< + std::vector fExperiments; //< /// If not zero this will be the common exposure time in micro-seconds (standard REST units) Double_t fExposureTime = 0; /// If not null this will be the common signal used in each experiment - TRestComponent *fSignal = nullptr; //< + TRestComponent* fSignal = nullptr; //< /// If not null this will be the common signal used in each experiment - TRestComponent *fBackground = nullptr; //< + TRestComponent* fBackground = nullptr; //< protected: - TRestComponent *GetComponent(std::string compName); + TRestComponent* GetComponent(std::string compName); void InitFromConfigFile() override; public: void Initialize() override; - void SetExposure(const Double_t &exposure) { fExposureTime = exposure; } - void SetSignal(TRestComponent *comp) { fSignal = comp; } - void SetBackground(TRestComponent *comp) { fBackground = comp; } + void SetExposure(const Double_t& exposure) { fExposureTime = exposure; } + void SetSignal(TRestComponent* comp) { fSignal = comp; } + void SetBackground(TRestComponent* comp) { fBackground = comp; } - std::vector GetExperiments() { return fExperiments; } - TRestExperiment *GetExperiment(const size_t &n) { + std::vector GetExperiments() { return fExperiments; } + TRestExperiment* GetExperiment(const size_t& n) { if (n >= GetNumberOfExperiments()) return nullptr; else @@ -83,7 +83,7 @@ class TRestExperimentList : public TRestMetadata { void PrintMetadata() override; - TRestExperimentList(const char *cfgFileName, const std::string &name); + TRestExperimentList(const char* cfgFileName, const std::string& name); TRestExperimentList(); ~TRestExperimentList(); diff --git a/source/framework/sensitivity/inc/TRestSensitivity.h b/source/framework/sensitivity/inc/TRestSensitivity.h index 44b67bbc4..41bbe84bb 100644 --- a/source/framework/sensitivity/inc/TRestSensitivity.h +++ b/source/framework/sensitivity/inc/TRestSensitivity.h @@ -29,7 +29,7 @@ class TRestSensitivity : public TRestMetadata { private: /// A list of experimental conditions included to get a final sensitivity plot - std::vector fExperiments; //< + std::vector fExperiments; //< protected: void InitFromConfigFile() override; @@ -37,8 +37,8 @@ class TRestSensitivity : public TRestMetadata { public: void Initialize() override; - std::vector GetExperiments() { return fExperiments; } - TRestExperiment *GetExperiment(const size_t &n) { + std::vector GetExperiments() { return fExperiments; } + TRestExperiment* GetExperiment(const size_t& n) { if (n >= GetNumberOfExperiments()) return nullptr; else @@ -49,7 +49,7 @@ class TRestSensitivity : public TRestMetadata { void PrintMetadata() override; - TRestSensitivity(const char *cfgFileName, const std::string &name = ""); + TRestSensitivity(const char* cfgFileName, const std::string& name = ""); TRestSensitivity(); ~TRestSensitivity(); diff --git a/source/framework/sensitivity/src/TRestComponent.cxx b/source/framework/sensitivity/src/TRestComponent.cxx index db849f8c9..ef9b26189 100644 --- a/source/framework/sensitivity/src/TRestComponent.cxx +++ b/source/framework/sensitivity/src/TRestComponent.cxx @@ -301,7 +301,8 @@ ROOT::RVecD TRestComponent::GetRandom() { if (!GetDensity()) { for (size_t n = 0; n < GetDimensions(); n++) result.push_back(0); RESTWarning << "TRestComponent::GetRandom. Component might not be initialized! Use " - "TRestComponent::Initialize()." << RESTendl; + "TRestComponent::Initialize()." + << RESTendl; return result; } @@ -345,13 +346,15 @@ TCanvas* TRestComponent::DrawComponent(std::vector drawVariables, TString drawOption) { if (drawVariables.size() > 2 || drawVariables.size() == 0) { RESTError << "TRestComponent::DrawComponent. The number of variables to be drawn must " - "be 1 or 2!" << RESTendl; + "be 1 or 2!" + << RESTendl; return fCanvas; } if (scanVariables.size() > 2 || scanVariables.size() == 0) { RESTError << "TRestComponent::DrawComponent. The number of variables to be scanned must " - "be 1 or 2!" << RESTendl; + "be 1 or 2!" + << RESTendl; return fCanvas; } diff --git a/source/framework/sensitivity/src/TRestComponentDataSet.cxx b/source/framework/sensitivity/src/TRestComponentDataSet.cxx index fbcc1f3e9..01fa3c079 100644 --- a/source/framework/sensitivity/src/TRestComponentDataSet.cxx +++ b/source/framework/sensitivity/src/TRestComponentDataSet.cxx @@ -350,7 +350,6 @@ std::vector TRestComponentDataSet::ExtractNodeStatistics() { RESTInfo << "Counting statistics for each node ..." << RESTendl; RESTInfo << "Number of nodes : " << fParameterizationNodes.size() << RESTendl; for (const auto& p : fParameterizationNodes) { - Double_t pUp = p * (1 + fPrecision / 2); Double_t pDown = p * (1 - fPrecision / 2); std::string filter = @@ -363,7 +362,7 @@ std::vector TRestComponentDataSet::ExtractNodeStatistics() { nEv = fDataSet.GetDataFrame().Filter(filter).Range(fSamples).Count(); } - if ((Int_t) * nEv < fSamples) { + if ((Int_t)*nEv < fSamples) { RESTWarning << "The number of requested samples (" << fSamples << ") is higher than the number of dataset entries (" << *nEv << ")" << RESTendl; } diff --git a/source/framework/sensitivity/src/TRestExperiment.cxx b/source/framework/sensitivity/src/TRestExperiment.cxx index 50049a5cd..917efdb5d 100644 --- a/source/framework/sensitivity/src/TRestExperiment.cxx +++ b/source/framework/sensitivity/src/TRestExperiment.cxx @@ -190,7 +190,7 @@ void TRestExperiment::PrintMetadata() { RESTMetadata << "Random seed : " << fSeed << RESTendl; RESTMetadata << " " << RESTendl; if (fExposureTime > 0) - RESTMetadata << " - Exposure time : " << fExposureTime* units("s") << " s" << RESTendl; + RESTMetadata << " - Exposure time : " << fExposureTime * units("s") << " s" << RESTendl; if (fSignal) RESTMetadata << " - Signal component : " << fSignal->GetName() << RESTendl; diff --git a/source/framework/sensitivity/src/TRestExperimentList.cxx b/source/framework/sensitivity/src/TRestExperimentList.cxx index 25b5dfa7e..6fc681339 100644 --- a/source/framework/sensitivity/src/TRestExperimentList.cxx +++ b/source/framework/sensitivity/src/TRestExperimentList.cxx @@ -65,7 +65,7 @@ TRestExperimentList::~TRestExperimentList() {} /// \param cfgFileName A const char* giving the path to an RML file. /// \param name The name of the specific metadata. /// -TRestExperimentList::TRestExperimentList(const char *cfgFileName, const std::string &name) +TRestExperimentList::TRestExperimentList(const char* cfgFileName, const std::string& name) : TRestMetadata(cfgFileName) { LoadConfigFromFile(fConfigFileName, name); } @@ -85,8 +85,8 @@ void TRestExperimentList::InitFromConfigFile() { if (!fExperimentsFile.empty() && fExperiments.empty()) { TRestTools::ReadASCIITable(fExperimentsFile, fExperimentsTable); - for (auto &row : fExperimentsTable) - for (auto &el : row) el = REST_StringHelper::ReplaceMathematicalExpressions(el); + for (auto& row : fExperimentsTable) + for (auto& el : row) el = REST_StringHelper::ReplaceMathematicalExpressions(el); if (fExperimentsTable.empty()) { RESTError << "TRestExperimentList::InitFromConfigFile. The experiments table is empty!" @@ -97,7 +97,7 @@ void TRestExperimentList::InitFromConfigFile() { Int_t nTableColumns = fExperimentsTable[0].size(); int cont = 0; - TRestComponent *comp = (TRestComponent *)this->InstantiateChildMetadata(cont, "Component"); + TRestComponent* comp = (TRestComponent*)this->InstantiateChildMetadata(cont, "Component"); while (comp != nullptr) { if (ToLower(comp->GetNature()) == "background") fBackground = comp; @@ -107,7 +107,7 @@ void TRestExperimentList::InitFromConfigFile() { RESTWarning << "TRestExperimentList::InitFromConfigFile. Unknown component!" << RESTendl; cont++; - comp = (TRestComponent *)this->InstantiateChildMetadata(cont, "Component"); + comp = (TRestComponent*)this->InstantiateChildMetadata(cont, "Component"); } Int_t nExpectedColumns = 3; @@ -117,7 +117,8 @@ void TRestExperimentList::InitFromConfigFile() { if (nExpectedColumns == 0) { RESTError << "TRestExperimentList::InitFromConfigFile. At least one free parameter required! " - "(Exposure/Background/Signal)" << RESTendl; + "(Exposure/Background/Signal)" + << RESTendl; return; } @@ -134,7 +135,8 @@ void TRestExperimentList::InitFromConfigFile() { } RESTError << "TRestExperimentList::InitFromConfigFile. Number of expected columns does not match " - "the number of table columns" << RESTendl; + "the number of table columns" + << RESTendl; RESTError << "Number of table columns : " << nTableColumns << RESTendl; RESTError << "Number of expected columns : " << nExpectedColumns << RESTendl; RESTError << "Expected columns : " << expectedColumns << RESTendl; @@ -144,11 +146,11 @@ void TRestExperimentList::InitFromConfigFile() { fComponentFiles = TRestTools::GetFilesMatchingPattern(fComponentPattern); Bool_t generateMockData = false; - for (const auto &experimentRow : fExperimentsTable) { - TRestExperiment *experiment = new TRestExperiment(); + for (const auto& experimentRow : fExperimentsTable) { + TRestExperiment* experiment = new TRestExperiment(); std::string rowStr = ""; - for (const auto &el : experimentRow) { + for (const auto& el : experimentRow) { rowStr += el + " "; } @@ -181,7 +183,7 @@ void TRestExperimentList::InitFromConfigFile() { } if (!fSignal) { - TRestComponent *sgnl = (TRestComponent *)GetComponent(experimentRow[column])->Clone(); + TRestComponent* sgnl = (TRestComponent*)GetComponent(experimentRow[column])->Clone(); experiment->SetSignal(sgnl); column++; } else { @@ -189,7 +191,7 @@ void TRestExperimentList::InitFromConfigFile() { } if (!fBackground) { - TRestComponent *bck = (TRestComponent *)GetComponent(experimentRow[column])->Clone(); + TRestComponent* bck = (TRestComponent*)GetComponent(experimentRow[column])->Clone(); experiment->SetBackground(bck); } else { experiment->SetBackground(fBackground); @@ -205,16 +207,16 @@ void TRestExperimentList::InitFromConfigFile() { } } -TRestComponent *TRestExperimentList::GetComponent(std::string compName) { - TRestComponent *component = nullptr; - for (const auto &c : fComponentFiles) { - TFile *f = TFile::Open(c.c_str(), "READ"); - TObject *obj = f->Get((TString)compName); +TRestComponent* TRestExperimentList::GetComponent(std::string compName) { + TRestComponent* component = nullptr; + for (const auto& c : fComponentFiles) { + TFile* f = TFile::Open(c.c_str(), "READ"); + TObject* obj = f->Get((TString)compName); if (!obj) continue; if (obj->InheritsFrom("TRestComponent")) { - return (TRestComponent *)obj; + return (TRestComponent*)obj; } else { RESTError << "An object named : " << compName << " exists inside the file, but it does not inherit from TRestComponent" << RESTendl; diff --git a/source/framework/sensitivity/src/TRestSensitivity.cxx b/source/framework/sensitivity/src/TRestSensitivity.cxx index 714cb8ad2..7ea97ae6d 100644 --- a/source/framework/sensitivity/src/TRestSensitivity.cxx +++ b/source/framework/sensitivity/src/TRestSensitivity.cxx @@ -38,8 +38,8 @@ /// ///
/// -#include #include +#include ClassImp(TRestSensitivity); @@ -67,7 +67,7 @@ TRestSensitivity::~TRestSensitivity() {} /// \param name The name of the specific metadata. It will be used to find the /// corresponding TRestAxionMagneticField section inside the RML. /// -TRestSensitivity::TRestSensitivity(const char *cfgFileName, const std::string &name) +TRestSensitivity::TRestSensitivity(const char* cfgFileName, const std::string& name) : TRestMetadata(cfgFileName) { LoadConfigFromFile(fConfigFileName, name); } @@ -85,19 +85,18 @@ void TRestSensitivity::InitFromConfigFile() { TRestMetadata::InitFromConfigFile(); int cont = 0; - TRestMetadata *metadata = (TRestMetadata *)this->InstantiateChildMetadata(cont, "Experiment"); + TRestMetadata* metadata = (TRestMetadata*)this->InstantiateChildMetadata(cont, "Experiment"); while (metadata != nullptr) { - cont++; if (metadata->InheritsFrom("TRestExperimentList")) { - TRestExperimentList *experimentsList = (TRestExperimentList *)metadata; - std::vector exList = experimentsList->GetExperiments(); + TRestExperimentList* experimentsList = (TRestExperimentList*)metadata; + std::vector exList = experimentsList->GetExperiments(); fExperiments.insert(fExperiments.end(), exList.begin(), exList.end()); } else if (metadata->InheritsFrom("TRestExperiment")) { - fExperiments.push_back((TRestExperiment *)metadata); + fExperiments.push_back((TRestExperiment*)metadata); } - metadata = (TRestMetadata *)this->InstantiateChildMetadata(cont, "Experiment"); + metadata = (TRestMetadata*)this->InstantiateChildMetadata(cont, "Experiment"); } Initialize();