-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathHit.h
More file actions
104 lines (86 loc) · 3.39 KB
/
Hit.h
File metadata and controls
104 lines (86 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICEO2_PHOS_HIT_H
#define ALICEO2_PHOS_HIT_H
#include "SimulationDataFormat/BaseHits.h"
#include "CommonUtils/ShmAllocator.h"
namespace o2
{
namespace phos
{
/// \class Hit
/// \brief PHOS simulation hit information
class Hit : public o2::BasicXYZEHit<float>
{
public:
/// \brief Default constructor
Hit() = default;
/// \brief Hit constructor
///
/// Fully defining information of the PHOS Hit (position,
/// momentum, energy, track, ...)
///
/// \param trackID Index of the track entered PHOS
/// \param detID ID of the detector segment
/// \param pos Position vector of the Hit
/// \param mom Momentum vector for the particle at the Hit
/// \param initialEnergy Energy of the primary particle enering the EMCAL
/// \param tof Time of the hit
/// \param length Length of the segment
Hit(Int_t trackID, Int_t detID, const math_utils::Point3D<float>& pos, const math_utils::Vector3D<float>& mom, Double_t totE, Double_t tof,
Double_t eLoss)
: o2::BasicXYZEHit<float>(pos.X(), pos.Y(), pos.Z(), tof, eLoss, trackID, detID),
mPvector(mom),
mInitialEnergy(totE)
{
}
Hit& operator=(const Hit& hit) = default;
/// \brief Check whether the points are from the same SuperParent and in the same detector volume
/// \return True if points are the same (origin and detector), false otherwise
Bool_t operator==(const Hit& rhs) const;
/// \brief Sorting points according to parent particle and detector volume
/// \return True if this Hit is smaller, false otherwise
Bool_t operator<(const Hit& rhs) const;
/// \brief Adds energy loss from the other Hit to this Hit
/// \param rhs phos::Hit to add to this Hit
/// \return This Hit with the summed energy loss
Hit& operator+=(const Hit& rhs);
/// \brief Creates a new Hit based on this Hit but adding the energy loss of the right hand side
/// \param
/// \return New Hit based on this Hit
Hit operator+(const Hit& rhs) const;
/// \brief Destructor
~Hit() = default;
/// \brief Get the initial energy of the primary particle entering PHOS
/// \return Energy of the primary particle entering PHOS
Double_t getInitialEnergy() const { return mInitialEnergy; }
void addEnergyLoss(Double_t eloss) { SetEnergyLoss(GetEnergyLoss() + eloss); }
/// \brief Writing Hit information to an output stream;
/// \param stream target output stream
void PrintStream(std::ostream& stream) const;
private:
math_utils::Vector3D<float> mPvector; // Momentum Vector
Double32_t mInitialEnergy; // Energy of the parent particle that entered the PHOS front surface
ClassDefNV(Hit, 1);
};
std::ostream& operator<<(std::ostream& stream, const Hit& point);
} // namespace phos
} // namespace o2
#ifdef USESHM
namespace std
{
template <>
class allocator<o2::phos::Hit> : public o2::utils::ShmAllocator<o2::phos::Hit>
{
};
} // namespace std
#endif
#endif /* Hit_h */