Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 9, 2023
1 parent e86521e commit 0641aec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
5 changes: 3 additions & 2 deletions source/bin/restRoot.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ int main(int argc, char* argv[]) {
if (loadMacros) {
if (!silent) printf("= Loading macros ...\n");
vector<string> macroFiles;
const vector<string> patterns = {REST_PATH + "/macros/REST_*.C", // framework
REST_PATH + "/macros/*/REST_*.C" // libraries
const vector<string> patterns = {
REST_PATH + "/macros/REST_*.C", // framework
REST_PATH + "/macros/*/REST_*.C" // libraries
};
for (const auto& pattern : patterns) {
for (const auto& macroFile : TRestTools::GetFilesMatchingPattern(pattern)) {
Expand Down
20 changes: 11 additions & 9 deletions source/framework/core/src/TRestDataSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void TRestDataSet::GenerateDataSet() {
fDataSet = MakeCut(fCut);

// Adding new user columns added to the dataset
for (const auto & [ cName, cExpression ] : fColumnNameExpressions) {
for (const auto& [cName, cExpression] : fColumnNameExpressions) {
RESTInfo << "Adding column to dataset: " << cName << RESTendl;
finalList.emplace_back(cName);
fDataSet = DefineColumn(cName, cExpression);
Expand Down Expand Up @@ -384,7 +384,8 @@ std::vector<std::string> TRestDataSet::FileSelection() {

if (!time_stamp_end || !time_stamp_start) {
RESTError << "TRestDataSet::FileSelect. Start or end dates not properly formed. Please, check "
"REST_StringHelper::StringToTimeStamp documentation for valid formats" << RESTendl;
"REST_StringHelper::StringToTimeStamp documentation for valid formats"
<< RESTendl;
return fFileSelection;
}

Expand Down Expand Up @@ -439,7 +440,7 @@ std::vector<std::string> TRestDataSet::FileSelection() {
if (!accept) continue;

Double_t acc = 0;
for (auto & [ name, properties ] : fQuantity) {
for (auto& [name, properties] : fQuantity) {
std::string value = run.ReplaceMetadataMembers(properties.metadata);
const Double_t val = REST_StringHelper::StringToDouble(value);

Expand Down Expand Up @@ -496,7 +497,7 @@ ROOT::RDF::RNode TRestDataSet::MakeCut(const TRestCut* cut) {

auto paramCut = cut->GetParamCut();
auto obsList = df.GetColumnNames();
for (const auto & [ param, condition ] : paramCut) {
for (const auto& [param, condition] : paramCut) {
if (std::find(obsList.begin(), obsList.end(), param) != obsList.end()) {
std::string pCut = param + condition;
RESTDebug << "Applying cut " << pCut << RESTendl;
Expand Down Expand Up @@ -543,7 +544,7 @@ ROOT::RDF::RNode TRestDataSet::DefineColumn(const std::string& columnName, const
auto df = fDataSet;

std::string evalFormula = formula;
for (auto const & [ name, properties ] : fQuantity)
for (auto const& [name, properties] : fQuantity)
evalFormula = REST_StringHelper::Replace(evalFormula, name, properties.value);

df = df.Define(columnName, evalFormula);
Expand Down Expand Up @@ -609,7 +610,7 @@ void TRestDataSet::PrintMetadata() {
RESTMetadata << " Relevant quantities: " << RESTendl;
RESTMetadata << " -------------------- " << RESTendl;

for (auto const & [ name, properties ] : fQuantity) {
for (auto const& [name, properties] : fQuantity) {
RESTMetadata << " - Name : " << name << ". Value : " << properties.value
<< ". Strategy: " << properties.strategy << RESTendl;
RESTMetadata << " - Metadata: " << properties.metadata << RESTendl;
Expand All @@ -621,7 +622,7 @@ void TRestDataSet::PrintMetadata() {
if (!fColumnNameExpressions.empty()) {
RESTMetadata << " New columns added to generated dataframe: " << RESTendl;
RESTMetadata << " ---------------------------------------- " << RESTendl;
for (const auto & [ cName, cExpression ] : fColumnNameExpressions) {
for (const auto& [cName, cExpression] : fColumnNameExpressions) {
RESTMetadata << " - Name : " << cName << RESTendl;
RESTMetadata << " - Expression: " << cExpression << RESTendl;
RESTMetadata << " " << RESTendl;
Expand Down Expand Up @@ -794,7 +795,8 @@ void TRestDataSet::Export(const std::string& filename) {
if (type != "Double_t" && type != "Int_t") {
RESTError << "Branch name : " << bName << " is type : " << type << RESTendl;
RESTError << "Only Int_t and Double_t types are allowed for "
"exporting to ASCII table" << RESTendl;
"exporting to ASCII table"
<< RESTendl;
RESTError << "File will not be generated" << RESTendl;
return;
}
Expand Down Expand Up @@ -829,7 +831,7 @@ void TRestDataSet::Export(const std::string& filename) {
}
fprintf(f, "###\n");
fprintf(f, "### Relevant quantities: \n");
for (auto & [ name, properties ] : fQuantity) {
for (auto& [name, properties] : fQuantity) {
fprintf(f, "### - %s : %s - %s\n", name.c_str(), properties.value.c_str(),
properties.description.c_str());
}
Expand Down
4 changes: 2 additions & 2 deletions source/framework/core/src/startup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ template <class T>
vector<T> StringToVector(string vec) {
vector<T> result;

if ( vec.empty() ) return result;
if (vec.empty()) return result;

if (vec[0] == '{' && vec[vec.size() - 1] == '}') {
vec.erase(vec.begin());
Expand All @@ -292,7 +292,7 @@ vector<T> StringToVector(string vec) {

} else {
cout << "Startup. StringToVector. Illegal format!" << endl;
cout << "The vector string is : " << vec << endl;
cout << "The vector string is : " << vec << endl;
cout << "A vector should be defined using brackets and comma separated elements: {a,b,c,d}" << endl;
return vector<T>{};
}
Expand Down

0 comments on commit 0641aec

Please sign in to comment.