Project
Loading...
Searching...
No Matches
TRUDataHandler.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
12#include <iostream>
14
15using namespace o2::emcal;
16
21
23{
24 mTRUIndex = -1;
25 mL0Fired = false;
26 mL0Time = -1;
27 std::fill(mPatchTimes.begin(), mPatchTimes.end(), UCHAR_MAX);
28}
29
30void TRUDataHandler::printStream(std::ostream& stream) const
31{
32 std::string patchstring;
33 for (auto index = 0; index < mPatchTimes.size(); index++) {
34 if (hasPatch(index)) {
35 if (patchstring.length()) {
36 patchstring += ", ";
37 }
38 patchstring += std::to_string(index);
39 }
40 }
41 if (!patchstring.length()) {
42 patchstring = "-";
43 }
44 stream << "TRU: " << static_cast<int>(mTRUIndex) << ", time " << static_cast<int>(mL0Time) << ", fired: " << (mL0Fired ? "yes" : "no") << ", patches: " << patchstring;
45}
46
48{
49 mMessage = "Invalid patch index " + std::to_string(index);
50}
51
53{
54 stream << what();
55}
56
57std::ostream& o2::emcal::operator<<(std::ostream& stream, const TRUDataHandler& data)
58{
59 data.printStream(stream);
60 return stream;
61}
62
63std::ostream& o2::emcal::operator<<(std::ostream& stream, const TRUDataHandler::PatchIndexException& error)
64{
65 error.printStream(stream);
66 return stream;
67}
Handler of errors related to invalid trigger patch IDs.
void printStream(std::ostream &stream) const
Print error on output stream.
Helper class to handle decoded TRU data during the reconstruction.
bool hasPatch(unsigned int index) const
Check whehther the patch at the given index has fired.
void printStream(std::ostream &stream) const
Print TRU information to an output stream.
void reset()
Reset handler.
GLuint index
Definition glcorearb.h:781
GLboolean * data
Definition glcorearb.h:298
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
Definition Cell.cxx:355
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52