Project
Loading...
Searching...
No Matches
LabeledDigit.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 <iostream>
14
15using namespace o2::emcal;
16
18 : mDigit(digit)
19{
20 mLabels.push_back(label);
21}
22
23LabeledDigit::LabeledDigit(Short_t tower, Double_t amplitudeGeV, Double_t time, o2::emcal::MCLabel label)
24 : mDigit(tower, amplitudeGeV, time)
25{
26 mLabels.push_back(label);
27}
28
29LabeledDigit::LabeledDigit(Short_t tower, uint16_t noiseLG, uint16_t noiseHG, Double_t time, o2::emcal::MCLabel label)
30 : mDigit(tower, noiseLG, noiseHG, time)
31{
32 mLabels.push_back(label);
33}
34
36{
37 if (canAdd(other)) {
38 double a1 = getAmplitude();
39 double a2 = other.getAmplitude();
40 double r = ((a1 + a2) != 0) ? 1.0 / (a1 + a2) : 0.0;
41 mDigit += other.getDigit();
42
43 for (int j = 0; j < mLabels.size(); j++) {
44 mLabels.at(j).setAmplitudeFraction(mLabels.at(j).getAmplitudeFraction() * a1 * r);
45 }
46
47 for (auto label : other.getLabels()) {
48 label.setAmplitudeFraction(label.getAmplitudeFraction() * a2 * r);
49 mLabels.push_back(label);
50 }
51 }
52 // Does nothing if the digits are in different towers or have incompatible times.
53 return *this;
54}
55
56void LabeledDigit::PrintStream(std::ostream& stream) const
57{
58 stream << "EMCAL LabeledDigit: Tower " << getTower() << ", Time " << getTimeStamp() << ", Amplitude " << getAmplitude() << " GeV, Type " << channelTypeToString(getType()) << ", Labels ( ";
59 for (auto label : mLabels) {
60 stream << label.getRawValue() << " ";
61 }
62 stream << ")";
63}
64
65std::ostream& operator<<(std::ostream& stream, const LabeledDigit& digi)
66{
67 digi.PrintStream(stream);
68 return stream;
69}
int16_t time
Definition RawEventData.h:4
const GPUTPCGMMerger::trackCluster & a1
uint32_t j
Definition RawData.h:0
EMCAL digit implementation.
Definition Digit.h:34
EMCAL labeled digit implementation.
Double_t getAmplitude() const
void PrintStream(std::ostream &stream) const
Double_t getTimeStamp() const
ChannelType_t getType() const
bool canAdd(const LabeledDigit other)
LabeledDigit & operator+=(const LabeledDigit &other)
Short_t getTower() const
Monte-Carlo label for EMCAL clusters / digits.
Definition MCLabel.h:28
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLboolean r
Definition glcorearb.h:1233
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 channelTypeToString(ChannelType_t chantype)
Create string representation of the channel type object.
Definition Constants.cxx:20
VectorOfTObjectPtrs other