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 if (mITSGloContributors.getEntries()) {
35 str += fmt::format("| ITScontributors: {} from {}", mITSGloContributors.getEntries(), mITSGloContributors.getFirstEntry());
36 }
37 return str;
38}
39
40// set the last +1 element index and finalize all references
41void VtxTrackRef::print(bool skipEmpty) const
42{
43 LOG(info) << asString(skipEmpty);
44}
45
46// set the last +1 element index and check consistency
48{
49 if (end <= 0) {
50 return; // empty
51 }
52 setEntries(end - getFirstEntry());
53 for (int i = VtxTrackIndex::NSources - 1; i--;) {
54 if (getFirstEntryOfSource(i) < 0) {
55 throw std::runtime_error(fmt::format("1st entry for source {:d} was not set", i));
56 }
57 if (getEntriesOfSource(i) < 0) {
58 throw std::runtime_error(fmt::format("Source {:d} has negative number of entrie", getEntriesOfSource(i)));
59 }
60 }
61}
62
63std::ostream& o2::dataformats::operator<<(std::ostream& os, const o2::dataformats::VtxTrackRef& v)
64{
65 // stream itself
66 os << v.asString();
67 return os;
68}
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