Skip to content

Commit 588c66f

Browse files
authored
Merge 3f08377 into sapling-pr-archive-ktf
2 parents e3f97d8 + 3f08377 commit 588c66f

File tree

280 files changed

+14967
-4655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+14967
-4655
lines changed

CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
/DataFormats/Detectors/TRD @f3sch @bazinski @wille10
4444
/DataFormats/Detectors/Upgrades @mconcas
4545
/DataFormats/Detectors/Upgrades/ITS3 @fgrosa @arossi81
46-
/DataFormats/Detectors/ZDC @coppedis
46+
/DataFormats/Detectors/ZDC @coppedis @cortesep
4747

4848
#/DataFormats/Headers
4949
#/DataFormats/Legacy
@@ -75,7 +75,7 @@
7575
/Detectors/Upgrades @mconcas
7676
/Detectors/Upgrades/ALICE3 @mconcas @njacazio
7777
/Detectors/Upgrades/ITS3 @fgrosa @arossi81 @mconcas @f3sch
78-
/Detectors/ZDC @coppedis
78+
/Detectors/ZDC @coppedis @cortesep
7979
/Detectors/CTF @shahor02
8080
/Detectors/Raw @shahor02
8181
/Detectors/StrangenessTracking @mconcas @mpuccio @fmazzasc

Common/DCAFitter/include/DCAFitter/DCAFitterN.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ GPUd() o2::math_utils::SMatrix<double, 3, 3, o2::math_utils::MatRepSym<double, 3
818818
MatSym3D covmSum;
819819
for (int i = N; i--;) {
820820
MatSym3D covTr = o2::math_utils::Similarity(getTrackRotMatrix(i), getTrackCovMatrix(i, cand));
821+
covmSum += covTr;
821822
}
822823
return covmSum;
823824
}

Common/SimConfig/include/SimConfig/G4Params.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,22 @@ enum class EG4Physics {
3333
kUSER = 8 /* allows to give own string combination */
3434
};
3535

36+
// enumerating possible geometry navigation modes
37+
// (understanding that geometry description is always done with TGeo)
38+
enum class EG4Nav {
39+
kTGeo = 0, /* navigate with TGeo */
40+
kG4 = 1 /* navigate with G4 native geometry */
41+
};
42+
3643
// parameters to influence the G4 engine
3744
struct G4Params : public o2::conf::ConfigurableParamHelper<G4Params> {
3845
EG4Physics physicsmode = EG4Physics::kFTFP_BERT_EMV_optical; // default physics mode with which to configure G4
3946

4047
std::string configMacroFile = ""; // a user provided g4Config.in file (otherwise standard one fill be taken)
4148
std::string userPhysicsList = ""; // possibility to directly give physics list as string
4249

50+
EG4Nav navmode = EG4Nav::kTGeo; // geometry navigation mode (default TGeo)
51+
4352
std::string const& getPhysicsConfigString() const;
4453

4554
O2ParamDef(G4Params, "G4");

Common/SimConfig/src/SimConfigLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::conf::DigiParams> + ;
3030

3131
#pragma link C++ enum o2::conf::EG4Physics;
32+
#pragma link C++ enum o2::conf::EG4Nav;
3233
#pragma link C++ enum o2::conf::SimFieldMode;
3334
#pragma link C++ struct o2::conf::G4Params + ;
3435
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::conf::G4Params> + ;

Common/Utils/include/CommonUtils/ConfigurableParam.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ class ConfigurableParam
187187
// writes a human readable INI file of all parameters
188188
static void writeINI(std::string const& filename, std::string const& keyOnly = "");
189189

190+
// writes a human readable INI or JSON file depending on the extension
191+
static void write(std::string const& filename, std::string const& keyOnly = "");
192+
190193
// can be used instead of using API on concrete child classes
191194
template <typename T>
192195
static T getValueAs(std::string key)

Common/Utils/include/CommonUtils/NameConf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ class NameConf : public o2::conf::ConfigurableParamHelper<NameConf>
103103
// Default CCDB server
104104
static std::string getCCDBServer();
105105

106+
// create name to dump config file
107+
static std::string getConfigOutputFileName(const std::string& procName, const std::string& confName = "", bool json = true);
108+
106109
protected:
107110
// helper method to build filenames
108111
static std::string buildFileName(const std::string_view prefix, const std::string_view delimiter, const std::string_view defPrefix, const std::string_view defName,

Common/Utils/include/CommonUtils/StringUtils.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ struct Str {
136136
// return vector of tokens from the string with provided delimiter. If requested, trim the spaces from tokens
137137
static std::vector<std::string> tokenize(const std::string& src, char delim, bool trimToken = true, bool skipEmpty = true);
138138

139+
// return vector of tokens from the string with provided delimiters. If requested, trim the spaces from tokens
140+
static std::vector<std::string> tokenize(const std::string& src, const std::string& delim, bool trimToken = true, bool skipEmpty = true);
141+
139142
// concatenate arbitrary number of strings
140143
template <typename... Ts>
141144
static std::string concat_string(Ts const&... ts)

Common/Utils/src/ConfigurableParam.cxx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,19 @@ int EnumLegalValues::getIntValue(const std::string& value) const
192192

193193
// -----------------------------------------------------------------
194194

195+
void ConfigurableParam::write(std::string const& filename, std::string const& keyOnly)
196+
{
197+
if (o2::utils::Str::endsWith(filename, ".ini")) {
198+
writeINI(filename, keyOnly);
199+
} else if (o2::utils::Str::endsWith(filename, ".json")) {
200+
writeJSON(filename, keyOnly);
201+
} else {
202+
throw std::invalid_argument(fmt::format("ConfigurabeParam output file name {} extension is neither .json nor .ini", filename));
203+
}
204+
}
205+
206+
// -----------------------------------------------------------------
207+
195208
void ConfigurableParam::writeINI(std::string const& filename, std::string const& keyOnly)
196209
{
197210
if (sOutputDir == "/dev/null") {
@@ -203,7 +216,10 @@ void ConfigurableParam::writeINI(std::string const& filename, std::string const&
203216
if (!keyOnly.empty()) { // write ini for selected key only
204217
try {
205218
boost::property_tree::ptree kTree;
206-
kTree.add_child(keyOnly, sPtree->get_child(keyOnly));
219+
auto keys = o2::utils::Str::tokenize(keyOnly, " ,;", true, true);
220+
for (const auto& k : keys) {
221+
kTree.add_child(k, sPtree->get_child(k));
222+
}
207223
boost::property_tree::write_ini(outfilename, kTree);
208224
} catch (const boost::property_tree::ptree_bad_path& err) {
209225
LOG(fatal) << "non-existing key " << keyOnly << " provided to writeINI";
@@ -284,7 +300,10 @@ void ConfigurableParam::writeJSON(std::string const& filename, std::string const
284300
if (!keyOnly.empty()) { // write ini for selected key only
285301
try {
286302
boost::property_tree::ptree kTree;
287-
kTree.add_child(keyOnly, sPtree->get_child(keyOnly));
303+
auto keys = o2::utils::Str::tokenize(keyOnly, " ,;", true, true);
304+
for (const auto& k : keys) {
305+
kTree.add_child(k, sPtree->get_child(k));
306+
}
288307
boost::property_tree::write_json(outfilename, kTree);
289308
} catch (const boost::property_tree::ptree_bad_path& err) {
290309
LOG(fatal) << "non-existing key " << keyOnly << " provided to writeJSON";

Common/Utils/src/NameConf.cxx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,12 @@ std::string NameConf::getCCDBServer()
111111
{
112112
return Instance().mCCDBServer;
113113
}
114+
115+
std::string NameConf::getConfigOutputFileName(const std::string& procName, const std::string& confName, bool json)
116+
{
117+
std::string nm = procName;
118+
if (!confName.empty()) {
119+
nm += '_' + confName;
120+
}
121+
return fmt::format("ConfigParam_{}.{}", nm, json ? "json" : "ini");
122+
}

Common/Utils/src/StringUtils.cxx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <fmt/format.h>
1818
#endif
1919
#include <unistd.h>
20+
#include <cstring>
2021

2122
using namespace o2::utils;
2223

@@ -37,6 +38,35 @@ std::vector<std::string> Str::tokenize(const std::string& src, char delim, bool
3738
return tokens;
3839
}
3940

41+
std::vector<std::string> Str::tokenize(const std::string& src, const std::string& delim, bool trimToken, bool skipEmpty)
42+
{
43+
std::string inptStr{src};
44+
char* input = inptStr.data();
45+
auto mystrtok = [&]() -> char* {
46+
input += std::strspn(input, delim.c_str());
47+
if (*input == '\0') {
48+
return nullptr;
49+
}
50+
char* const token = input;
51+
input += std::strcspn(input, delim.c_str());
52+
if (*input != '\0') {
53+
*input++ = '\0';
54+
}
55+
return token;
56+
};
57+
std::vector<std::string> tokens;
58+
while (*input != '\0') {
59+
std::string token = mystrtok();
60+
if (trimToken) {
61+
trim(token);
62+
}
63+
if (!token.empty() || !skipEmpty) {
64+
tokens.push_back(std::move(token));
65+
}
66+
}
67+
return tokens;
68+
}
69+
4070
// replace all occurencies of from by to, return count
4171
int Str::replaceAll(std::string& s, const std::string& from, const std::string& to)
4272
{

0 commit comments

Comments
 (0)