File indexing completed on 2025-12-11 09:40:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Material/MaterialInteraction.hpp"
0013 #include "Acts/Surfaces/Surface.hpp"
0014
0015 #include <memory>
0016 #include <utility>
0017 #include <vector>
0018
0019 class TChain;
0020 class TTree;
0021
0022 namespace Acts {
0023 class Surface;
0024 class TrackingVolume;
0025 }
0026
0027 namespace ActsPlugins {
0028
0029
0030
0031 class RootMaterialTrackIo {
0032 public:
0033 struct Config {
0034
0035 bool prePostStepInfo = false;
0036
0037 bool surfaceInfo = false;
0038
0039 bool volumeInfo = false;
0040
0041 bool recalculateTotals = false;
0042 };
0043
0044
0045
0046
0047 explicit RootMaterialTrackIo(const Config& cfg) : m_cfg(cfg) {}
0048
0049
0050 ~RootMaterialTrackIo() = default;
0051
0052
0053
0054
0055 void connectForRead(TChain& materialChain);
0056
0057
0058
0059
0060 void connectForWrite(TTree& materialTree);
0061
0062
0063
0064
0065
0066
0067
0068
0069 void write(const Acts::GeometryContext& gctx, std::uint32_t eventNum,
0070 const Acts::RecordedMaterialTrack& materialTrack);
0071
0072
0073
0074
0075
0076
0077 Acts::RecordedMaterialTrack read() const;
0078
0079 private:
0080 struct MateriaSummaryPayload {
0081
0082 float vX = 0;
0083
0084 float vY = 0;
0085
0086 float vZ = 0;
0087
0088 float vPx = 0;
0089
0090 float vPy = 0;
0091
0092 float vPz = 0;
0093
0094 float vPhi = 0;
0095
0096 float vEta = 0;
0097
0098 float tX0 = 0;
0099
0100 float tL0 = 0;
0101 };
0102
0103 struct MaterialStepPayload {
0104
0105 std::vector<float> stepXs;
0106
0107 std::vector<float> stepYs;
0108
0109 std::vector<float> stepZs;
0110
0111 std::vector<float> stepXe;
0112
0113 std::vector<float> stepYe;
0114
0115 std::vector<float> stepZe;
0116
0117
0118 std::vector<float> stepX;
0119 std::vector<float>* stepXPtr = &stepX;
0120
0121 std::vector<float> stepY;
0122 std::vector<float>* stepYPtr = &stepY;
0123
0124 std::vector<float> stepZ;
0125 std::vector<float>* stepZPtr = &stepZ;
0126
0127 std::vector<float> stepR;
0128
0129 std::vector<float> stepDx;
0130 std::vector<float>* stepDxPtr = &stepDx;
0131
0132 std::vector<float> stepDy;
0133 std::vector<float>* stepDyPtr = &stepDy;
0134
0135 std::vector<float> stepDz;
0136 std::vector<float>* stepDzPtr = &stepDz;
0137
0138 std::vector<float> stepLength;
0139 std::vector<float>* stepLengthPtr = &stepLength;
0140
0141 std::vector<float> stepMatX0;
0142 std::vector<float>* stepMatX0Ptr = &stepMatX0;
0143
0144 std::vector<float> stepMatL0;
0145 std::vector<float>* stepMatL0Ptr = &stepMatL0;
0146
0147 std::vector<float> stepMatA;
0148 std::vector<float>* stepMatAPtr = &stepMatA;
0149
0150 std::vector<float> stepMatZ;
0151 std::vector<float>* stepMatZPtr = &stepMatZ;
0152
0153 std::vector<float> stepMatRho;
0154 std::vector<float>* stepMatRhoPtr = &stepMatRho;
0155 };
0156
0157 struct MaterialSurfacePayload {
0158
0159 std::vector<std::uint64_t> surfaceId;
0160 std::vector<std::uint64_t>* surfaceIdPtr = &surfaceId;
0161
0162 std::vector<float> surfaceX;
0163 std::vector<float>* surfaceXPtr = &surfaceX;
0164
0165 std::vector<float> surfaceY;
0166 std::vector<float>* surfaceYPtr = &surfaceY;
0167
0168 std::vector<float> surfaceZ;
0169 std::vector<float>* surfaceZPtr = &surfaceZ;
0170
0171 std::vector<float> surfaceR;
0172
0173 std::vector<float> surfaceDistance;
0174
0175 std::vector<float> surfacePathCorrection;
0176 std::vector<float>* surfacePathCorrectionPtr = &surfacePathCorrection;
0177 };
0178
0179 struct MaterialVolumePayload {
0180
0181 std::vector<std::uint64_t> volumeId;
0182 };
0183
0184
0185 Config m_cfg;
0186
0187
0188 std::uint32_t m_eventId = 0;
0189
0190
0191
0192 std::vector<long long> m_entryNumbers = {};
0193
0194
0195 MateriaSummaryPayload m_summaryPayload = {};
0196
0197
0198 MaterialStepPayload m_stepPayload = {};
0199
0200
0201 MaterialSurfacePayload m_surfacePayload = {};
0202
0203
0204 MaterialVolumePayload m_volumePayload = {};
0205 };
0206
0207 }