Project
Loading...
Searching...
No Matches
Point.h
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
14#ifndef ALICEO2_TPC_POINT_H
15#define ALICEO2_TPC_POINT_H
16
18#include <vector>
20
21namespace o2
22{
23namespace tpc
24{
25
26// a minimal and plain TPC hit class
28{
29 public:
30 //:: so as to get the right Point3D
31 math_utils::Point3D<float> mPos; // cartesian position of Hit
32 float mTime = -1; // time of flight
33 float mELoss = -2; // energy loss
34
35 float GetX() const { return mPos.X(); }
36 float GetY() const { return mPos.Y(); }
37 float GetZ() const { return mPos.Z(); }
38 const math_utils::Point3D<float>& getPos() const { return mPos; }
39 float GetEnergyLoss() const { return mELoss; }
40 float GetTime() const { return mTime; }
41
42 public:
43 ElementalHit() = default; // for ROOT IO
44 ~ElementalHit() = default;
45 ElementalHit(ElementalHit const&) = default;
46
47 // constructor
48 ElementalHit(float x, float y, float z, float time, float e)
49 : mPos(x, y, z), mTime(time), mELoss(e) {}
50
52};
53
54} // namespace tpc
55} // namespace o2
56
57#ifdef USESHM
58namespace std
59{
60template <>
61class allocator<o2::tpc::ElementalHit> : public o2::utils::ShmAllocator<o2::tpc::ElementalHit>
62{
63};
64} // namespace std
65#endif
66
67namespace o2
68{
69namespace tpc
70{
71
72// an index to uniquely identify a single hit group of TPC
74 TPCHitGroupID() = default;
75 TPCHitGroupID(int sindex, int c, int e, int gid, int src = 0)
76 : storeindex{sindex}, collision{c}, entry{e}, groupID{gid}, sourceID{src}
77 {
78 }
79 int storeindex = -1; // tells in which index/entry of some hitvector I should look up this hit group
80 int collision = -1; // the collision id --> determines the time
81 int entry = -1; // the real entry/eventID in some branch (not necessarily the same as collision but often the case)
82 int groupID = -1;
83 int sourceID = 0;
84};
85
86// a higher order hit class encapsulating
87// a set of elemental hits belonging to the same trackid (and sector)
88// construct used to do less MC truth linking and to save memory
89class HitGroup : public o2::BaseHit
90{
91 public:
93#ifdef HIT_AOS
94 mHits()
95#else
96 mHitsXVctr(),
97 mHitsYVctr(),
98 mHitsZVctr(),
99 mHitsTVctr(),
100 mHitsEVctr()
101#endif
102 {
103 }
104
105 HitGroup(int trackID) : o2::BaseHit(trackID),
106#ifdef HIT_AOS
107 mHits()
108#else
109 mHitsXVctr(),
110 mHitsYVctr(),
111 mHitsZVctr(),
112 mHitsTVctr(),
113 mHitsEVctr()
114#endif
115 {
116 }
117
118 void addHit(float x, float y, float z, float time, float e)
119 {
120#ifdef HIT_AOS
121 mHits.emplace_back(x, y, z, time, e);
122#else
123 mHitsXVctr.emplace_back(x);
124 mHitsYVctr.emplace_back(y);
125 mHitsZVctr.emplace_back(z);
126 mHitsTVctr.emplace_back(time);
127 mHitsEVctr.emplace_back(e);
128#endif
129 }
130
131 size_t getSize() const
132 {
133#ifdef HIT_AOS
134 return mHits.size();
135#else
136 return mHitsXVctr.size();
137#endif
138 }
139
141 {
142#ifdef HIT_AOS
143 // std::vector storage
144 return mHits[index];
145#else
147#endif
148 }
149
151 {
152 // shrink all the containers to have exactly the required size
153 // might improve overall memory consumption
154#ifdef HIT_AOS
155 // std::vector storage
156 mHits.shrink_to_fit();
157#else
158 mHitsXVctr.shrink_to_fit();
159 mHitsYVctr.shrink_to_fit();
160 mHitsZVctr.shrink_to_fit();
161 mHitsTVctr.shrink_to_fit();
162 mHitsEVctr.shrink_to_fit();
163#endif
164 }
165
166 // in future we might want to have a method
167 // FitAndCompress()
168 // which does a track fit and produces a parametrized hit
169 // (such as done in a similar form in AliRoot)
170 public:
171#ifdef HIT_AOS
172 std::vector<o2::tpc::ElementalHit> mHits; // the hits for this group
173#else
174 using vec_t = std::vector<float, o2::utils::ShmAllocator<float>>;
180#endif
182};
183
184class Point : public o2::BasicXYZEHit<float>
185{
186 public:
188 Point() = default;
189
198 Point(float x, float y, float z, float time, float nElectrons, float trackID, float detID);
199
201 ~Point() = default;
202
204 void Print(const Option_t* opt) const;
205
206 private:
208 Point(const Point& point);
209 Point operator=(const Point& point);
210
211 ClassDefNV(o2::tpc::Point, 1);
212};
213
214inline Point::Point(float x, float y, float z, float time, float nElectrons, float trackID, float detID)
215 : BasicXYZEHit<float>(x, y, z, time, nElectrons, trackID, detID)
216{
217}
218
219} // namespace tpc
220} // namespace o2
221
222#ifdef USESHM
223namespace std
224{
225template <>
226class allocator<o2::tpc::HitGroup> : public o2::utils::ShmAllocator<o2::tpc::HitGroup>
227{
228};
229} // namespace std
230#endif
231
232#endif
int16_t time
Definition RawEventData.h:4
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
configStandalone Reconstruction rec_tpc float
uint32_t c
Definition RawData.h:2
float GetEnergyLoss() const
Definition Point.h:39
float GetY() const
Definition Point.h:36
float GetZ() const
Definition Point.h:37
math_utils::Point3D< float > mPos
Definition Point.h:31
float GetTime() const
Definition Point.h:40
const math_utils::Point3D< float > & getPos() const
Definition Point.h:38
ElementalHit(float x, float y, float z, float time, float e)
Definition Point.h:48
ClassDefNV(ElementalHit, 1)
ElementalHit(ElementalHit const &)=default
float GetX() const
Definition Point.h:35
void shrinkToFit()
Definition Point.h:150
void addHit(float x, float y, float z, float time, float e)
Definition Point.h:118
vec_t mHitsYVctr
Definition Point.h:176
ElementalHit getHit(size_t index) const
Definition Point.h:140
HitGroup(int trackID)
Definition Point.h:105
ClassDefNV(HitGroup, 1)
size_t getSize() const
Definition Point.h:131
std::vector< float, o2::utils::ShmAllocator< float > > vec_t
Definition Point.h:174
vec_t mHitsXVctr
Definition Point.h:175
vec_t mHitsTVctr
Definition Point.h:178
vec_t mHitsZVctr
Definition Point.h:177
vec_t mHitsEVctr
Definition Point.h:179
void Print(const Option_t *opt) const
Output to screen.
Definition Point.cxx:20
Point()=default
Default constructor.
~Point()=default
Destructor.
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint index
Definition glcorearb.h:781
GLint y
Definition glcorearb.h:270
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
TPCHitGroupID(int sindex, int c, int e, int gid, int src=0)
Definition Point.h:75