Project
Loading...
Searching...
No Matches
Hit.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 "DataFormatsCPV/Hit.h"
13
14using namespace o2::cpv;
15
17
18void Hit::PrintStream(std::ostream& stream) const
19{
20 stream << "CPV hit: Track " << GetTrackID() << " in detector segment " << GetDetectorID() << " at position ("
21 << GetX() << "|" << GetY() << "|" << GetZ() << "), charge deposited " << GetEnergyLoss() << std::endl;
22}
23
24Bool_t Hit::operator<(const Hit& rhs) const
25{
26 if (GetDetectorID() == rhs.GetDetectorID()) {
27 return GetTrackID() < rhs.GetTrackID();
28 }
29 return GetDetectorID() < rhs.GetDetectorID();
30}
31
32Bool_t Hit::operator==(const Hit& rhs) const
33{
34 return ((GetDetectorID() == rhs.GetDetectorID()) && (GetTrackID() == rhs.GetTrackID()));
35}
36
38{
39 if (rhs.GetEnergyLoss() > GetEnergyLoss()) {
40 SetTime(rhs.GetTime());
41 }
42 SetEnergyLoss(GetEnergyLoss() + rhs.GetEnergyLoss());
43 return *this;
44}
45
46Hit operator+(const Hit& lhs, const Hit& rhs)
47{
48 // Hit::Hit(int trackID, int detID, const math_utils::Point3D<float>& pos, double tof, double qLoss)
49 return Hit(lhs.GetTrackID(), lhs.GetDetectorID(), lhs.GetPos(),
50 lhs.GetEnergyLoss() > rhs.GetEnergyLoss() ? lhs.GetTime() : rhs.GetTime(),
51 lhs.GetEnergyLoss() + rhs.GetEnergyLoss());
52}
53
54std::ostream& operator<<(std::ostream& stream, const Hit& p)
55{
57 return stream;
58}
Hit operator+(const Hit &lhs, const Hit &rhs)
Definition Hit.cxx:46
ClassImp(o2::cpv::Hit)
int GetTrackID() const
Definition BaseHits.h:30
float GetEnergyLoss() const
Definition BaseHits.h:103
void SetEnergyLoss(float val)
Definition BaseHits.h:104
void SetTime(E time)
Definition BaseHits.h:76
T GetZ() const
Definition BaseHits.h:66
T GetY() const
Definition BaseHits.h:65
T GetX() const
Definition BaseHits.h:64
short GetDetectorID() const
Definition BaseHits.h:73
CPV simulation hit information.
Definition Hit.h:25
Hit & operator+=(const Hit &rhs)
Adds energy loss from the other Hit to this Hit.
Definition Hit.cxx:37
Bool_t operator<(const Hit &rhs) const
Sorting points according to parent particle and detector volume.
Definition Hit.cxx:24
void PrintStream(std::ostream &stream) const
Writing Hit information to an output stream;.
Definition Hit.cxx:18
Bool_t operator==(const Hit &rhs) const
Check whether the points are from the same SuperParent and in the same detector volume.
Definition Hit.cxx:32
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &in, const BadChannelMap &bcm)
Printing bad channel map on the stream.