Project
Loading...
Searching...
No Matches
Digit.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#include <fairlogger/Logger.h>
12
14#include "DataFormatsCPV/Hit.h"
15#include <iostream>
16
17using namespace o2::cpv;
18
20
21Digit::Digit(unsigned short absId, float amplitude, int label)
22 : DigitBase(0), mAbsId(absId), mLabel(label), mAmplitude(amplitude)
23{
24}
25bool Digit::canAdd(const Digit other) const
26{
27 return (mAbsId == other.getAbsId() && fabs(getTimeStamp() - other.getTimeStamp()) <= kTimeGate);
28}
29
31{
32
33 // Adds the amplitude of digits
34 if (mLabel == -1) {
35 mLabel = other.mLabel;
36 } else {
37 if (mLabel != other.mLabel && other.mLabel != -1) {
38 // if Label indexes are different, something wrong
39 LOG(error) << "Adding digits with different references to Labels:" << mLabel << " and " << other.mLabel;
40 }
41 }
42
43 mAmplitude += other.mAmplitude;
44
45 return *this;
46}
47
48void Digit::PrintStream(std::ostream& stream) const
49{
50 stream << "CPV Digit: cell absId " << mAbsId << ", Time " << getTimeStamp() << " with amplitude " << mAmplitude;
51}
52
53std::ostream& operator<<(std::ostream& stream, const Digit& digi)
54{
55 digi.PrintStream(stream);
56 return stream;
57}
ClassImp(Digit)
bool canAdd(const Digit other) const
Check, if one can add two digits.
Definition Digit.cxx:25
Digit & operator+=(const Digit &other)
if addable, adds energy and list of primaries.
Definition Digit.cxx:30
Digit()=default
static constexpr int kTimeGate
Definition Digit.h:32
void PrintStream(std::ostream &stream) const
Definition Digit.cxx:48
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &in, const BadChannelMap &bcm)
Printing bad channel map on the stream.
VectorOfTObjectPtrs other
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"