-
Notifications
You must be signed in to change notification settings - Fork 508
Expand file tree
/
Copy pathTrackDump.h
More file actions
131 lines (107 loc) · 4.68 KB
/
Copy pathTrackDump.h
File metadata and controls
131 lines (107 loc) · 4.68 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
127
128
129
130
131
// 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 O2_TPC_TrackDump_H_
#define O2_TPC_TrackDump_H_
#include <Rtypes.h>
#include <cstdint>
#include <memory>
#include <string>
#include <gsl/span>
#include <string_view>
#include <vector>
#include "DataFormatsTPC/TrackTPC.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "CommonUtils/TreeStreamRedirector.h"
#include "DataFormatsTPC/Constants.h"
#include "TPCFastTransformPOD.h"
/// \file TrackDump.h
/// \author Jens Wiechula (Jens.Wiechula@ikf.uni-frankfurt.de)
using namespace o2::tpc::constants;
namespace o2::tpc
{
class ClusterNativeAccess;
/// The class can be used to dump track and associated clusters to a tree to easily iterate over them and draw them
class TrackDump
{
public:
struct ClusterGlobal {
float gx{};
float gy{};
uint16_t qMax; //< QMax of the cluster
uint32_t qTot; //< Total charge of the cluster
uint8_t sector = 0;
uint8_t padrow = 0;
ClassDefNV(ClusterGlobal, 2);
};
struct ClusterNativeAdd : public ClusterNative {
ClusterNativeAdd() = default;
ClusterNativeAdd(const ClusterNative& cl) : ClusterNative(cl){};
~ClusterNativeAdd() = default;
// float z = 0.f;
float tgl = 0.f;
float snp = 0.f;
uint8_t sector = 0;
uint8_t padrow = 0;
// uncorrected values
float lx() const;
float ly() const;
float gx() const;
float gy() const;
float cpad() const;
// corrected values
float lxc(float vertexTime = 0) const;
float lyc(float vertexTime = 0) const;
float gxc(float vertexTime = 0) const;
float gyc(float vertexTime = 0) const;
float zc(float vertexTime = 0) const;
inline static o2::gpu::aligned_unique_buffer_ptr<o2::gpu::TPCFastTransformPOD> corrMapBuffer; // buffer for owning the correction map in case of update during runtime
inline static const o2::gpu::TPCFastTransformPOD* corrMap{nullptr}; // local copy of the correction map for quick access to the transform functions
static void loadCorrMaps(std::string_view corrMapFile, std::string_view corrMapFileRef = "");
ClassDefNV(ClusterNativeAdd, 1);
};
struct TrackInfo : public TrackTPC {
TrackInfo() = default;
TrackInfo(const TrackTPC& track) : TrackTPC(track) {};
TrackInfo(const TrackInfo&) = default;
~TrackInfo() = default;
std::vector<ClusterNativeAdd> clusters{};
ClassDefNV(TrackInfo, 1);
};
/// how to store clusters associated to tracks
enum class ClStorageType {
InsideTrack = 0,
SeparateBranch = 1,
SeparateTree = 2,
SeparateFile = 3,
};
/// how to store clusters NOT associated to tracks
enum class ClUnStorageType {
DontStore = 0,
SeparateTree = 1,
SeparateFile = 2,
};
using ClExcludes = std::vector<int>[MAXSECTOR][MAXGLOBALPADROW];
void filter(const gsl::span<const TrackTPC> tracks, ClusterNativeAccess const& clusterIndex, const gsl::span<const o2::tpc::TPCClRefElem> clRefs, const gsl::span<const MCCompLabel> mcLabels);
void finalize();
void fillClNativeAdd(ClusterNativeAccess const& clusterIndex, std::vector<ClusterNativeAdd>& clInfos, ClExcludes* excludes = nullptr);
std::string outputFileName{"filtered-tracks-and-clusters.root"}; ///< Name of the output file with the tree
bool writeTracks{true}; ///< write global cluster information for quick drawing
bool writeGlobal{false}; ///< write global cluster information for quick drawing
bool writeMC{false}; ///< write MC track information for quick drawing
ClStorageType clusterStorageType{ClStorageType::InsideTrack}; ///< instead of storing the clusters with the tracks, store them in a separate tree
ClUnStorageType noTrackClusterType{ClUnStorageType::DontStore}; ///< store unassociated clusters in separate tree
private:
std::unique_ptr<o2::utils::TreeStreamRedirector> mTreeDump; ///< Tree writer tracks (+ clusters)
std::unique_ptr<o2::utils::TreeStreamRedirector> mTreeDumpClOnly; ///< Tree writer only clusters
std::unique_ptr<o2::utils::TreeStreamRedirector> mTreeDumpUnassCl; ///< Tree writer unassociated clusters
};
} // namespace o2::tpc
#endif