Project
Loading...
Searching...
No Matches
GlobalTrackID.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
15
17#include "Framework/Logger.h"
18#include <fmt/printf.h>
19#include <iostream>
20#include <bitset>
21
22using namespace o2::dataformats;
24
25std::string GlobalTrackID::asString() const
26{
27 std::bitset<NBitsFlags()> bits{getFlags()};
28 return fmt::format("[{:s}/{:d}/{:s}]", getSourceName(), getIndex(), bits.to_string());
29}
30
32{
34 std::string ss(srcList), sname{};
35 if (ss.find(NONE) != std::string::npos) {
36 return mask;
37 }
38 if (ss.find(ALL) != std::string::npos) {
39 mask = MASK_ALL;
40 return mask;
41 }
42 std::replace(ss.begin(), ss.end(), ' ', ',');
43 std::stringstream sss(ss);
44 while (getline(sss, sname, ',')) {
45 for (auto id = 0; id < NSources; id++) {
46 if (sname == getSourceName(id)) {
47 mask.set(id);
48 sname = "";
49 break;
50 }
51 }
52 if (!sname.empty()) {
53 throw std::runtime_error(fmt::format("Wrong entry {:s} in reco-sources list {:s}", sname, srcList));
54 }
55 }
56 return mask;
57}
58
59std::ostream& o2::dataformats::operator<<(std::ostream& os, const o2::dataformats::GlobalTrackID& v)
60{
61 // stream itself
62 os << v.asString();
63 return os;
64}
65
67{
68 LOG(info) << asString();
69}
70
72{
73 std::string s = "[";
74 for (int i = 0; i < NSources; i++) {
75 if (srcm[i]) {
76 if (s.size() > 1) {
77 s += ',';
78 }
79 s += getSourceName(i);
80 }
81 }
82 s += ']';
83 return std::move(s);
84}
int32_t i
Global index for barrel track: provides provenance (detectors combination), index in respective array...
static mask_t getSourcesMask(const std::string_view srcList)
GPUdi() static const expr DetID GPUdi() static const expr DetID GlobalTrackID::mask_t srcm
static std::string getSourcesNames(mask_t srcm)
static constexpr mask_t MASK_ALL
static constexpr std::string_view NONE
keywork for no sources
static constexpr std::string_view ALL
keywork for all sources
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
const GLdouble * v
Definition glcorearb.h:832
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
Definition glcorearb.h:4150
GLint GLuint mask
Definition glcorearb.h:291
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
std::ostream & operator<<(std::ostream &os, const o2::dataformats::MeanVertexObject &o)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"