Project
Loading...
Searching...
No Matches
MCCompLabel.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 <iomanip>
14#include <ios>
15#include <iostream>
16#include <cassert>
17#include <fmt/format.h>
18
19namespace o2
20{
21
22//_____________________________________________
23std::ostream& operator<<(std::ostream& os, MCCompLabel const& c)
24{
25 // stream itself
26 if (c.isValid()) {
27 os << '[' << c.getSourceID() << '/' << c.getEventID() << '/'
28 << (c.isFake() ? '-' : '+') << std::setw(6) << c.getTrackID() << ']';
29 } else {
30 os << (c.isNoise() ? "[noise]" : "[unset]");
31 }
32 return os;
33}
34
35//_____________________________________________
36std::string MCCompLabel::asString() const
37{
38 // describe itself
39 if (isValid()) {
40 return fmt::format("[{}/{}{}/{:6d}]", getSourceID(), getEventID(), isFake() ? '-' : '+', getTrackID());
41 }
42 return isNoise() ? "[noise]" : "[unset]";
43}
44
45//_____________________________________________
47{
48 // print itself
49 std::cout << (MCCompLabel) * this << std::endl;
50}
51
52} // namespace o2
uint32_t c
Definition RawData.h:2
bool isFake() const
Definition MCCompLabel.h:78
bool isNoise() const
Definition MCCompLabel.h:73
int getTrackID() const
void print() const
int getSourceID() const
int getEventID() const
bool isValid() const
Definition MCCompLabel.h:75
std::string asString() const
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::ostream & operator<<(std::ostream &stream, o2::InteractionRecord const &ir)