Project
Loading...
Searching...
No Matches
VtxTrackRef.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#include <climits>
22
23using namespace o2::dataformats;
24
25std::string VtxTrackRef::asString(bool skipEmpty) const
26{
27 std::string str = mVtxID < 0 ? "Orphan " : fmt::format("Vtx {:3d}", mVtxID);
28 str += fmt::format(" : 1st entry: {:d} ", getFirstEntry());
29 for (int i = 0; i < VtxTrackIndex::NSources; i++) {
30 if (!skipEmpty || getEntriesOfSource(i)) {
31 str += fmt::format(", N{:s} : {:d}", VtxTrackIndex::getSourceName(i), getEntriesOfSource(i));
32 }
33 }
34 return str;
35}
36
37// set the last +1 element index and finalize all references
38void VtxTrackRef::print(bool skipEmpty) const
39{
40 LOG(info) << asString(skipEmpty);
41}
42
43// set the last +1 element index and check consistency
45{
46 if (end <= 0) {
47 return; // empty
48 }
49 setEntries(end - getFirstEntry());
50 for (int i = VtxTrackIndex::NSources - 1; i--;) {
51 if (getFirstEntryOfSource(i) < 0) {
52 throw std::runtime_error(fmt::format("1st entry for source {:d} was not set", i));
53 }
54 if (getEntriesOfSource(i) < 0) {
55 throw std::runtime_error(fmt::format("Source {:d} has negative number of entrie", getEntriesOfSource(i)));
56 }
57 }
58}
59
60std::ostream& o2::dataformats::operator<<(std::ostream& os, const o2::dataformats::VtxTrackRef& v)
61{
62 // stream itself
63 os << v.asString();
64 return os;
65}
int32_t i
Referenc on track indices contributing to the vertex, with possibility chose tracks from specific sou...
void print(bool skipEmpty=true) const
std::string asString(bool skipEmpty=true) const
int getEntriesOfSource(int s) const
Definition VtxTrackRef.h:62
int getFirstEntryOfSource(int s) const
Definition VtxTrackRef.h:55
GLuint GLuint end
Definition glcorearb.h:469
const GLdouble * v
Definition glcorearb.h:832
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"
const std::string str