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 "PHOSBase/Hit.h"
13
14using namespace o2::phos;
15
17
18void Hit::PrintStream(std::ostream& stream) const
19{
20 stream << "PHOS point: Track " << GetTrackID() << " in detector segment " << GetDetectorID() << " at position ("
21 << GetX() << "|" << GetY() << "|" << GetZ() << "), energy loss " << GetEnergyLoss() << " total energy "
22 << mInitialEnergy << std::endl;
23}
24// Hit& Hit::operator=(const Hit& rh)
25// {
26// mTrackID = rh.mTrackID;
27// mPos = rh.mPos;
28// mTime = rh.mTime;
29// mELoss = rh.mEloss;
30// mDetectorID = rh.mDetectorID;
31// mPvector = rh.mPvector ;
32// mInitialEnergy = rh.mInitialEnergy ;
33// }
34
35Bool_t Hit::operator<(const Hit& rhs) const
36{
37 if (GetDetectorID() == rhs.GetDetectorID()) {
38 return GetTrackID() < rhs.GetTrackID();
39 }
40 return GetDetectorID() < rhs.GetDetectorID();
41}
42
43Bool_t Hit::operator==(const Hit& rhs) const
44{
45 return ((GetDetectorID() == rhs.GetDetectorID()) && (GetTrackID() == rhs.GetTrackID()));
46}
47
49{
50 if (rhs.GetEnergyLoss() > GetEnergyLoss()) {
51 SetTime(rhs.GetTime());
52 }
53 SetEnergyLoss(GetEnergyLoss() + rhs.GetEnergyLoss());
54 return *this;
55}
56
57Hit Hit::operator+(const Hit& rhs) const
58{
59 Hit result = *this;
60 if (rhs.GetEnergyLoss() > result.GetEnergyLoss()) {
61 result.SetTime(rhs.GetTime());
62 }
63 result.SetEnergyLoss(result.GetEnergyLoss() + rhs.GetEnergyLoss());
64 return result;
65}
66
67std::ostream& operator<<(std::ostream& stream, const Hit& p)
68{
70 return stream;
71}
ClassImp(o2::phos::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
PHOS 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:48
Bool_t operator<(const Hit &rhs) const
Sorting points according to parent particle and detector volume.
Definition Hit.cxx:35
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:43
Hit operator+(const Hit &rhs) const
Creates a new Hit based on this Hit but adding the energy loss of the right hand side.
Definition Hit.cxx:57
GLuint64EXT * result
Definition glcorearb.h:5662
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &in, const BadChannelsMap &bcm)
Printing bad channel map on the stream.