ATLAS Offline Software
FileHelpers.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 #include "GeoModelKernel/throwExcept.h"
7 #include <filesystem>
8 #include <algorithm>
9 namespace MuonValR4{
10  std::string removeNonAlphaNum(std::string str) {
11  str.erase(std::remove_if(str.begin(),str.end(),
12  [](const unsigned char c){
13  return !std::isalnum(c);
14  }), str.end());
15  return str;
16  }
17  void ensureDirectory(const std::string& path) {
18  const std::string dir = path.substr(0, path.rfind("/"));
19  if (dir.rfind("/") != std::string::npos){
21  } else if (dir.empty()) {
22  return;
23  }
24  if (!std::filesystem::is_directory(dir) && !std::filesystem::create_directory(dir)) {
25  THROW_EXCEPTION("Failed to create "<<dir);
26  }
27  }
28 }
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
MuonValR4::removeNonAlphaNum
std::string removeNonAlphaNum(std::string str)
Removes all non-alpha numerical characters from a string.
Definition: FileHelpers.cxx:10
python.CaloAddPedShiftConfig.str
str
Definition: CaloAddPedShiftConfig.py:42
beamspotman.dir
string dir
Definition: beamspotman.py:619
MuonValR4
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Definition: IPatternVisualizationTool.h:23
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition: throwExcept.h:10
str
Definition: BTagTrackIpAccessor.cxx:11
FileHelpers.h
python.compressB64.c
def c
Definition: compressB64.py:93
MuonValR4::ensureDirectory
void ensureDirectory(const std::string &path)
Ensures that the subdirectory in the path is created.
Definition: FileHelpers.cxx:17