Project
Loading...
Searching...
No Matches
NameConf.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13#include <fmt/format.h>
14#include <memory>
15
17
18using namespace o2::base;
19
20std::string NameConf::buildFileName(const std::string_view prefix, const std::string_view delimiter, const std::string_view defPrefix, const std::string_view defName,
21 const std::string_view extension, const std::string_view optDir)
22{
23 if (o2::utils::Str::pathIsDirectory(prefix)) { // if path is directory, just add to default name, ignoring optional directory optDir argument
24 return o2::utils::Str::concat_string(prefix, "/", defPrefix, delimiter, defName, '.', extension);
25 } else if (!prefix.empty() && o2::utils::Str::pathExists(prefix)) { // explicit file path is provided, use it directly
26 return std::string(prefix);
27 }
28 auto dir = o2::utils::Str::rectifyDirectory(optDir); // directory might have been provided
29 // is the prefix really prefix or a file-name
30 if (!prefix.empty()) {
31 auto path = o2::utils::Str::concat_string(dir, prefix);
33 return path;
34 }
35 }
36 return o2::utils::Str::concat_string(dir, prefix.empty() ? defPrefix : prefix, delimiter, defName, '.', extension);
37}
38
39// Filename to store geometry file
40std::string NameConf::getGeomFileName(const std::string_view prefix)
41{
43}
44
45// Filename to store geometry file
46std::string NameConf::getAlignedGeomFileName(const std::string_view prefix)
47{
49}
50
51// Filename to store general run parameters (GRP)
52std::string NameConf::getCollisionContextFileName(const std::string_view prefix)
53{
55}
56
57// Filename to store general run parameters (GRP)
58std::string NameConf::getGRPFileName(const std::string_view prefix)
59{
61}
62
63// Filename to store general run parameters from ECS (GRPECS)
64std::string NameConf::getGRPECSFileName(const std::string_view prefix)
65{
67}
68
69// Filename to store general run parameters from LHCIF (GRPLHCIF)
70std::string NameConf::getGRPLHCIFFileName(const std::string_view prefix)
71{
73}
74
75// Filename to store general run parameters from ECS (GRPECS)
76std::string NameConf::getGRPMagFieldFileName(const std::string_view prefix)
77{
79}
80
81// Filename to store simulation cuts/process summary
82std::string NameConf::getCutProcFileName(std::string_view prefix)
83{
85}
86
87// Filename to store material LUT file
88std::string NameConf::getMatLUTFileName(const std::string_view prefix)
89{
90 return buildFileName(prefix, "", "", MATBUDLUT, ROOT_EXT_STRING, Instance().mDirMatLUT);
91}
92
93std::string NameConf::getCTFFileName(uint32_t run, uint32_t orb, uint32_t id, const std::string& host, const std::string_view prefix)
94{
95 return o2::utils::Str::concat_string(prefix, '_', fmt::format("run{:08d}_orbit{:010d}_tf{:010d}_{}", run, orb, id, host), ".root");
96}
97
99{
100 return o2::utils::Str::concat_string(CTFDICT, ".root");
101}
102
103// Filename to store general run parameters (GRP)
104std::string NameConf::getTFIDInfoFileName(const std::string_view prefix)
105{
106 return buildFileName(prefix, "_", "o2", TFIDINFO, ROOT_EXT_STRING, Instance().mDirTFIDINFO);
107}
108
109// Default CCDB server
111{
112 return Instance().mCCDBServer;
113}
#define O2ParamImpl(classname)
Definition of the Names Generator class.
static std::string getAlignedGeomFileName(const std::string_view prefix="")
Definition NameConf.cxx:46
std::string mDirGRPECS
Definition NameConf.h:136
static constexpr std::string_view GRP_STRING
Definition NameConf.h:115
std::string mDirTFIDINFO
Definition NameConf.h:142
static constexpr std::string_view GRPMAGFIELD_STRING
Definition NameConf.h:118
std::string mDirGRPLHCIF
Definition NameConf.h:137
static std::string getGRPECSFileName(const std::string_view prefix=STANDARDSIMPREFIX)
Definition NameConf.cxx:64
static constexpr std::string_view ROOT_EXT_STRING
Definition NameConf.h:125
static std::string getGeomFileName(const std::string_view prefix="")
Definition NameConf.cxx:40
static std::string getGRPLHCIFFileName(const std::string_view prefix=STANDARDSIMPREFIX)
Definition NameConf.cxx:70
static std::string getCTFFileName(uint32_t run, uint32_t orb, uint32_t id, const std::string &host, const std::string_view prefix="o2_ctf")
Definition NameConf.cxx:93
static constexpr std::string_view DAT_EXT_STRING
Definition NameConf.h:126
static std::string getCutProcFileName(const std::string_view prefix="")
Definition NameConf.cxx:82
static std::string getCTFDictFileName()
Definition NameConf.cxx:98
static std::string getGRPFileName(const std::string_view prefix=STANDARDSIMPREFIX)
Definition NameConf.cxx:58
std::string mDirCollContext
Definition NameConf.h:141
std::string mDirGeom
Definition NameConf.h:139
std::string mDirGRP
Definition NameConf.h:135
static std::string getMatLUTFileName(const std::string_view prefix="")
Definition NameConf.cxx:88
static std::string buildFileName(const std::string_view prefix, const std::string_view delimiter, const std::string_view defPrefix, const std::string_view defName, const std::string_view extension, const std::string_view optDir="")
Definition NameConf.cxx:20
static constexpr std::string_view GRPLHCIF_STRING
Definition NameConf.h:117
static constexpr std::string_view ALIGNEDGEOM_FILE_STRING
Definition NameConf.h:122
static std::string getCollisionContextFileName(const std::string_view prefix="")
Definition NameConf.cxx:52
static constexpr std::string_view CUT_FILE_STRING
Definition NameConf.h:123
static constexpr std::string_view STANDARDSIMPREFIX
Definition NameConf.h:112
static constexpr std::string_view COLLISIONCONTEXT
Definition NameConf.h:130
static constexpr std::string_view MATBUDLUT
Definition NameConf.h:129
static constexpr std::string_view GRPECS_STRING
Definition NameConf.h:116
std::string mDirMatLUT
Definition NameConf.h:140
static std::string getTFIDInfoFileName(const std::string_view prefix="o2")
Definition NameConf.cxx:104
static std::string getCCDBServer()
Definition NameConf.cxx:110
std::string mDirGRPMagField
Definition NameConf.h:138
std::string mCCDBServer
Definition NameConf.h:143
static std::string getGRPMagFieldFileName(const std::string_view prefix=STANDARDSIMPREFIX)
Definition NameConf.cxx:76
static constexpr std::string_view GEOM_FILE_STRING
Definition NameConf.h:121
static constexpr std::string_view CTFDICT
Definition NameConf.h:92
static constexpr std::string_view TFIDINFO
Definition NameConf.h:132
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
static bool pathIsDirectory(const std::string_view p)
static std::string rectifyDirectory(const std::string_view p)
static bool pathExists(const std::string_view p)
static std::string concat_string(Ts const &... ts)