|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +/// @file GlobalTrackID.h |
| 12 | +/// \brief Global index for barrel track: provides provenance (detectors combination), index in respective array and some number of bits |
| 13 | +/// \author ruben.shahoyan@cern.ch |
| 14 | + |
| 15 | +#ifndef O2_GLOBAL_TRACK_ID |
| 16 | +#define O2_GLOBAL_TRACK_ID |
| 17 | + |
| 18 | +#include "CommonDataFormat/AbstractRef.h" |
| 19 | +#include <iosfwd> |
| 20 | +#include <string> |
| 21 | +#include <array> |
| 22 | +#include <string_view> |
| 23 | + |
| 24 | +namespace o2 |
| 25 | +{ |
| 26 | +namespace dataformats |
| 27 | +{ |
| 28 | + |
| 29 | +class GlobalTrackID : public AbstractRef<25, 4, 3> |
| 30 | +{ |
| 31 | + public: |
| 32 | + enum Source : uint8_t { // provenance of the |
| 33 | + ITS, |
| 34 | + TPC, |
| 35 | + TRD, // standalone tracks |
| 36 | + ITSTPC, |
| 37 | + TPCTOF, |
| 38 | + TPCTRD, // 2-detector tracks |
| 39 | + ITSTPCTRD, |
| 40 | + ITSTPCTOF, |
| 41 | + TPCTRDTOF, // 3-detector tracks |
| 42 | + ITSTPCTRDTOF, // full barrel track |
| 43 | + NSources |
| 44 | + }; |
| 45 | + static constexpr std::array<std::string_view, NSources> SourceNames = { |
| 46 | + "ITS", "TPC", "TRD", // standalone tracks |
| 47 | + "ITSTPC", "TPCTOF", "TPCTRD", // 2-detector tracks |
| 48 | + "ITSTPCTRD", "ITSTPCTOF", "TPCTRDTOF", // 3-detector tracks |
| 49 | + "ITSTPCTRDTOF" // full barrel track |
| 50 | + }; |
| 51 | + |
| 52 | + using AbstractRef<25, 4, 3>::AbstractRef; |
| 53 | + |
| 54 | + static constexpr std::string_view getSourceName(int i) { return SourceNames[i]; } |
| 55 | + void print() const; |
| 56 | + std::string asString() const; |
| 57 | + |
| 58 | + operator auto() const { return AbstractRef<25, 4, 3>(); } |
| 59 | + |
| 60 | + ClassDefNV(GlobalTrackID, 1); |
| 61 | +}; |
| 62 | + |
| 63 | +std::ostream& operator<<(std::ostream& os, const o2::dataformats::GlobalTrackID& v); |
| 64 | + |
| 65 | +} // namespace dataformats |
| 66 | +} // namespace o2 |
| 67 | + |
| 68 | +#endif |
0 commit comments