forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseHits.h
More file actions
126 lines (108 loc) · 3.94 KB
/
BaseHits.h
File metadata and controls
126 lines (108 loc) · 3.94 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// 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_BASE_HIT_H
#define ALICEO2_BASE_HIT_H
#include "MathUtils/Cartesian.h"
namespace o2
{
// Mother class of all hit classes for AliceO2
// just defines what is absolutely necessary to have
// as common interface
// at the moment ony GetTrackID() used by Stack.h
// eventually we could add some interfaces to retrieve
// the coordinates as floats or something
class BaseHit
{
public:
BaseHit() = default;
BaseHit(int id) : mTrackID{id} {}
int GetTrackID() const { return mTrackID; }
void SetTrackID(int id) { mTrackID = id; }
private:
int mTrackID = 0; // track_id
ClassDefNV(BaseHit, 1);
};
// a set of configurable classes to define basic hit types
// these are meant to be an alternative to FairMCPoint
// which always includes the momentum and is purely based on double values
// Generic class to keep position, time and hit value
// T is basic type for position,
// E is basic type for time,
// V is basic type for hit value.
template <typename T, typename E, typename V = float>
class BasicXYZVHit : public BaseHit
{
math_utils::Point3D<T> mPos; // cartesian position of Hit
E mTime; // time of flight
V mHitValue; // hit value
unsigned short mDetectorID; // the detector/sensor id
public:
BasicXYZVHit() = default; // for ROOT IO
// constructor
BasicXYZVHit(T x, T y, T z, E time, V val, int trackid, unsigned short did)
: mPos(x, y, z), mTime(time), mHitValue(val), BaseHit(trackid), mDetectorID(did)
{
}
// getting the cartesian coordinates
T GetX() const { return mPos.X(); }
T GetY() const { return mPos.Y(); }
T GetZ() const { return mPos.Z(); }
math_utils::Point3D<T> GetPos() const { return mPos; }
// getting hit value
V GetHitValue() const { return mHitValue; }
// getting the time
E GetTime() const { return mTime; }
// get detector + track information
unsigned short GetDetectorID() const { return mDetectorID; }
// modifiers
void SetTime(E time) { mTime = time; }
void SetHitValue(V val) { mHitValue = val; }
void SetDetectorID(unsigned short detID) { mDetectorID = detID; }
void SetX(T x) { mPos.SetX(x); }
void SetY(T y) { mPos.SetY(y); }
void SetZ(T z) { mPos.SetZ(z); }
void SetXYZ(T x, T y, T z)
{
SetX(x);
SetY(y);
SetZ(z);
}
void SetPos(math_utils::Point3D<T> const& p) { mPos = p; }
ClassDefNV(BasicXYZVHit, 2);
};
// Class for a hit containing energy loss as hit value
// T is basic type for position,
// E is basic type for time (float as default),
// V is basic type for hit value (float as default).
template <typename T, typename E = float, typename V = float>
class BasicXYZEHit : public BasicXYZVHit<T, E, V>
{
public:
using BasicXYZVHit<T, E, V>::BasicXYZVHit;
V GetEnergyLoss() const { return BasicXYZVHit<T, E, V>::GetHitValue(); }
void SetEnergyLoss(V val) { BasicXYZVHit<T, E, V>::SetHitValue(val); }
ClassDefNV(BasicXYZEHit, 1);
};
// Class for a hit containing charge as hit value
// T is basic type for position,
// E is basic type for time (float as default),
// V is basic type for hit value (int as default).
template <typename T, typename E = float, typename V = int>
class BasicXYZQHit : public BasicXYZVHit<T, E, V>
{
public:
using BasicXYZVHit<T, E, V>::BasicXYZVHit;
V GetCharge() const { return BasicXYZVHit<T, E, V>::GetHitValue(); }
void SetCharge(V val) { BasicXYZVHit<T, E, V>::SetHitValue(val); }
ClassDefNV(BasicXYZQHit, 1);
};
} // namespace o2
#endif