Project
Loading...
Searching...
No Matches
Helpers.h
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
15
16#include <string>
17#include <algorithm>
18
19#ifndef ALICEO2_ZDC_HELPERS_H
20#define ALICEO2_ZDC_HELPERS_H
21
22namespace o2
23{
24namespace zdc
25{
26
27// std::string removeNamespace(const std::string& strin);
28// bool endsWith(const std::string& str, const std::string& suffix);
29// std::string ccdbShortcuts(std::string ccdbHost, std::string cln, std::string path);
30
31//______________________________________________________________________________
32std::string removeNamespace(const std::string& strin)
33{
34 std::string str = strin;
35 for (auto pos = str.find(":"); pos != std::string::npos; pos = str.find(":")) {
36 str = str.substr(pos + 1);
37 }
38 return str;
39}
40
41//______________________________________________________________________________
42bool endsWith(const std::string& str, const std::string& suffix)
43{
44 return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix);
45}
46
47//______________________________________________________________________________
48std::string ccdbShortcuts(std::string ccdbHost, std::string cln, std::string path)
49{
50 // Commonly used shortcuts for ccdbHost
51 if (ccdbHost.size() == 0 || ccdbHost == "external") {
52 ccdbHost = "http://alice-ccdb.cern.ch:8080";
53 } else if (ccdbHost == "internal") {
54 ccdbHost = "http://o2-ccdb.internal/";
55 } else if (ccdbHost == "test") {
56 ccdbHost = "http://ccdb-test.cern.ch:8080";
57 } else if (ccdbHost == "local") {
58 ccdbHost = "http://localhost:8080";
59 } else if (ccdbHost == "root") {
60 std::replace(path.begin(), path.end(), '/', '_');
61 ccdbHost = path + "_" + removeNamespace(cln) + ".root";
62 }
63 return ccdbHost;
64}
65
66} // namespace zdc
67} // namespace o2
68
69#endif
uint16_t pos
Definition RawData.h:3
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
struct o2::upgrades_utils::@463 zdc
structure to keep FT0 information
bool endsWith(const std::string &str, const std::string &suffix)
Definition Helpers.h:42
std::string ccdbShortcuts(std::string ccdbHost, std::string cln, std::string path)
Definition Helpers.h:48
std::string removeNamespace(const std::string &strin)
Definition Helpers.h:32
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
const std::string str