|
| 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 | +#ifndef ALICEO2_TRD_LINKRECORD_H |
| 12 | +#define ALICEO2_TRD_LINKRECORD_H |
| 13 | + |
| 14 | +#include <iosfwd> |
| 15 | +#include "Rtypes.h" |
| 16 | +#include "CommonDataFormat/InteractionRecord.h" |
| 17 | +#include "CommonDataFormat/RangeReference.h" |
| 18 | +#include "DataFormatsTRD/RawData.h" |
| 19 | + |
| 20 | +namespace o2 |
| 21 | +{ |
| 22 | + |
| 23 | +namespace trd |
| 24 | +{ |
| 25 | + |
| 26 | +/// \class LinkRecord |
| 27 | +/// \brief Header for data corresponding to the indexing of the links in the raw data output |
| 28 | +/// adapted from DataFormatsTRD/TriggerRecord |
| 29 | +class LinkRecord |
| 30 | +{ |
| 31 | + using DataRange = o2::dataformats::RangeReference<int>; |
| 32 | + |
| 33 | + public: |
| 34 | + LinkRecord() = default; |
| 35 | + LinkRecord(const uint32_t hcid, int firstentry, int nentries) : mLinkId(hcid), mDataRange(firstentry, nentries) {} |
| 36 | + ~LinkRecord() = default; |
| 37 | + |
| 38 | + void setLinkId(const uint32_t linkid) { mLinkId = linkid; } |
| 39 | + void setDataRange(int firstentry, int nentries) { mDataRange.set(firstentry, nentries); } |
| 40 | + void setIndexFirstObject(int firstentry) { mDataRange.setFirstEntry(firstentry); } |
| 41 | + void setNumberOfObjects(int nentries) { mDataRange.setEntries(nentries); } |
| 42 | + |
| 43 | + uint32_t getLinkId() { return mLinkId; } |
| 44 | + int getNumberOfObjects() const { return mDataRange.getEntries(); } |
| 45 | + int getFirstEntry() const { return mDataRange.getFirstEntry(); } |
| 46 | + |
| 47 | + void printStream(std::ostream& stream) const; |
| 48 | + |
| 49 | + private: |
| 50 | + uint32_t mLinkId; /// The link ID for this set of data, hcid as well |
| 51 | + DataRange mDataRange; /// Index of the triggering event (event index and first entry in the container) |
| 52 | + |
| 53 | + ClassDefNV(LinkRecord, 1); |
| 54 | +}; |
| 55 | + |
| 56 | +std::ostream& operator<<(std::ostream& stream, const LinkRecord& trg); |
| 57 | + |
| 58 | +} // namespace trd |
| 59 | + |
| 60 | +} // namespace o2 |
| 61 | + |
| 62 | +#endif |
0 commit comments