Project
Loading...
Searching...
No Matches
Number.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/core.h>
14#include <fmt/format.h>
15#include <cstdint>
16
17namespace
18{
19
20int parseNumber(std::string_view alias, std::string_view key, uint8_t len)
21{
22 auto pos = alias.find(key);
23 std::string s{alias.substr(pos + key.size(), len)};
24 return std::stoi(s);
25}
26
27} // namespace
28
29namespace o2::mch::dcs
30{
31int aliasToNumber(std::string_view alias)
32{
33 if (alias.find("Slat") != std::string_view::npos) {
34 return parseNumber(alias, "Slat", 2);
35 } else if (alias.find("Quad") != std::string_view::npos) {
36 auto quad = parseNumber(alias, "Quad", 1);
37 auto sector = parseNumber(alias, "Sect", 1);
38 return quad * 10 + sector;
39 } else if (alias.find("SolCh") != std::string_view::npos) {
40 return parseNumber(alias, "Cr", 2);
41 } else if (alias.find("Group") != std::string_view::npos) {
42 return parseNumber(alias, "Group", 2);
43 }
44 throw std::invalid_argument(fmt::format("Cannot extract number from alias={}", alias));
45}
46} // namespace o2::mch::dcs
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
uint16_t pos
Definition RawData.h:3
StringRef key
GLenum GLenum GLsizei len
Definition glcorearb.h:4232
int aliasToNumber(std::string_view dcsAlias)
Definition Number.cxx:31