forked from cms-patatrack/pixeltrack-standalone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPixelTrackHeterogeneous.h
74 lines (56 loc) · 2.46 KB
/
PixelTrackHeterogeneous.h
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
#ifndef CUDADataFormatsTrackTrackHeterogeneous_H
#define CUDADataFormatsTrackTrackHeterogeneous_H
#include "CUDADataFormats/TrajectoryStateSoA.h"
#include "CUDACore/HistoContainer.h"
#include "CUDADataFormats/HeterogeneousSoA.h"
namespace trackQuality {
enum Quality : uint8_t { bad = 0, dup, loose, strict, tight, highPurity };
}
template <int32_t S>
class TrackSoAT {
public:
static constexpr int32_t stride() { return S; }
using Quality = trackQuality::Quality;
using hindex_type = uint16_t;
using HitContainer = cms::cuda::OneToManyAssoc<hindex_type, S, 5 * S>;
// Always check quality is at least loose!
// CUDA does not support enums in __lgc ...
eigenSoA::ScalarSoA<uint8_t, S> m_quality;
constexpr Quality quality(int32_t i) const { return (Quality)(m_quality(i)); }
constexpr Quality &quality(int32_t i) { return (Quality &)(m_quality(i)); }
constexpr Quality const *qualityData() const { return (Quality const *)(m_quality.data()); }
constexpr Quality *qualityData() { return (Quality *)(m_quality.data()); }
// this is chi2/ndof as not necessarely all hits are used in the fit
eigenSoA::ScalarSoA<float, S> chi2;
constexpr int nHits(int i) const { return detIndices.size(i); }
// State at the Beam spot
// phi,tip,1/pt,cotan(theta),zip
TrajectoryStateSoA<S> stateAtBS;
eigenSoA::ScalarSoA<float, S> eta;
eigenSoA::ScalarSoA<float, S> pt;
constexpr float charge(int32_t i) const { return std::copysign(1.f, stateAtBS.state(i)(2)); }
constexpr float phi(int32_t i) const { return stateAtBS.state(i)(0); }
constexpr float tip(int32_t i) const { return stateAtBS.state(i)(1); }
constexpr float zip(int32_t i) const { return stateAtBS.state(i)(4); }
// state at the detector of the outermost hit
// representation to be decided...
// not yet filled on GPU
// TrajectoryStateSoA<S> stateAtOuterDet;
HitContainer hitIndices;
HitContainer detIndices;
// total number of tracks (including those not fitted)
uint32_t m_nTracks;
};
namespace pixelTrack {
#ifdef GPU_SMALL_EVENTS
constexpr uint32_t maxNumber() { return 2 * 1024; }
#else
constexpr uint32_t maxNumber() { return 32 * 1024; }
#endif
using TrackSoA = TrackSoAT<maxNumber()>;
using TrajectoryState = TrajectoryStateSoA<maxNumber()>;
using HitContainer = TrackSoA::HitContainer;
using Quality = trackQuality::Quality;
} // namespace pixelTrack
using PixelTrackHeterogeneous = HeterogeneousSoA<pixelTrack::TrackSoA>;
#endif // CUDADataFormatsTrackTrackSoA_H