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 Jan 11, 2024
1 parent 3759218 commit fd4c0a9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
5 changes: 3 additions & 2 deletions source/bin/restRoot.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ int main(int argc, char* argv[]) {
printf("= HINT. E.g. REST_Detector_XYZ(arg1,arg2) may be called as: restManager XYZ arg1 arg2\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 @@ -437,7 +438,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 @@ -494,7 +495,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 @@ -541,7 +542,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 @@ -607,7 +608,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 @@ -619,7 +620,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 @@ -792,7 +793,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 @@ -827,7 +829,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
1 change: 0 additions & 1 deletion source/framework/sensitivity/src/TRestComponent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ Double_t TRestComponent::GetNormalizedRate(std::vector<Double_t> point) {
/// be applied.
///
Double_t TRestComponent::GetRateWithResponse(std::vector<Double_t> point) {

if (!fResponse) {
RESTError << "TRestComponent::GetRateWithResponse. Response has not been defined!" << RESTendl;
RESTError << "You may directly call GetRate in order to get the raw expected rate without warning."
Expand Down
9 changes: 6 additions & 3 deletions source/framework/sensitivity/src/TRestComponentDataSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,15 @@ TCanvas* TRestComponentDataSet::DrawComponent(std::vector<std::string> drawVaria
TString drawOption) {
if (drawVariables.size() > 2 || drawVariables.size() == 0) {
RESTError << "TRestComponentDataSet::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 << "TRestComponentDataSet::DrawComponent. The number of variables to be scanned must "
"be 1 or 2!" << RESTendl;
"be 1 or 2!"
<< RESTendl;
return fCanvas;
}

Expand Down Expand Up @@ -730,7 +732,8 @@ std::vector<Int_t> TRestComponentDataSet::ExtractNodeStatistics(Double_t precisi
Bool_t TRestComponentDataSet::LoadDataSets() {
if (fDataSetFileNames.empty()) {
RESTWarning << "Dataset filename was not defined. You may still use "
"TRestComponentDataSet::LoadDataSet( filename );" << RESTendl;
"TRestComponentDataSet::LoadDataSet( filename );"
<< RESTendl;
fDataSetLoaded = false;
return fDataSetLoaded;
}
Expand Down

0 comments on commit fd4c0a9

Please sign in to comment.