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#include <iostream>
12#include "FOCALBase/Hit.h"
13
14using namespace o2::focal;
15
16Hit::Hit(int primary, int trackID, int detID, Subsystem_t subsystem, double initialEnergy, const math_utils::Point3D<float>& pos,
17 double tof, double eLoss) : o2::BasicXYZEHit<float>(pos.X(), pos.Y(), pos.Z(), tof, eLoss, trackID, detID),
18 mSubSystem(subsystem),
19 mInitialEnergy(initialEnergy)
20
21{
22}
23
24bool Hit::operator==(const Hit& other) const
25{
26 return (GetDetectorID() == other.GetDetectorID()) && (GetTrackID() == other.GetTrackID() && mSubSystem == other.mSubSystem);
27}
28
29bool Hit::operator<(const Hit& other) const
30{
31 if (GetTrackID() != other.GetTrackID()) {
32 return GetTrackID() < other.GetTrackID();
33 }
34 if (mSubSystem != other.mSubSystem) {
35 return mSubSystem < other.mSubSystem;
36 }
37 return GetDetectorID() < other.GetDetectorID();
38}
39
41{
42 SetEnergyLoss(GetEnergyLoss() + other.GetEnergyLoss());
43 return *this;
44}
45
46void Hit::printStream(std::ostream& stream) const
47{
48 stream << "FOCAL point: Track " << GetTrackID() << " in detector segment " << GetDetectorID()
49 << " at position (" << GetX() << "|" << GetY() << "|" << GetZ() << "), energy loss " << GetEnergyLoss()
50 << ", initial (parent) energy " << mInitialEnergy << " from primary " << mPrimary;
51}
52
53Hit o2::focal::operator+(const Hit& lhs, const Hit& rhs)
54{
55 Hit summed(lhs);
56 summed += rhs;
57 return summed;
58}
59
60std::ostream& o2::focal::operator<<(std::ostream& stream, const o2::focal::Hit& point)
61{
62 point.printStream(stream);
63 return stream;
64}
uint16_t pos
Definition RawData.h:3
int GetTrackID() const
Definition BaseHits.h:30
float GetEnergyLoss() const
Definition BaseHits.h:103
void SetEnergyLoss(float val)
Definition BaseHits.h:104
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
Common FOCAL hit class for the detector simulation.
Definition Hit.h:28
void printStream(std::ostream &stream) const
Print information of this hit on the output stream.
Definition Hit.cxx:46
bool operator==(const Hit &other) const
Comparison operator for equalness.
Definition Hit.cxx:24
Subsystem_t
Subsystem index of the Hit.
Definition Hit.h:32
bool operator<(const Hit &other) const
Comparison operator for smaller.
Definition Hit.cxx:29
Hit & operator+=(const Hit &other)
Operator for incremental sum, adding energy loss of the other hit to this energy loss.
Definition Hit.cxx:40
Hit()=default
Dummy constructor.
GLuint GLuint stream
Definition glcorearb.h:1806
Hit operator+(const Hit &lhs, const Hit &rhs)
Sum operator, creating a new hit with the sum of the two energy losses.
Definition Hit.cxx:53
std::ostream & operator<<(std::ostream &in, const IndexExceptionEvent &error)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other