File indexing completed on 2026-11-10 09:28:25
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 TTree;
0020
0021 namespace Acts {
0022 class Surface;
0023 class TrackingVolume;
0024 }
0025
0026 namespace ActsPlugins {
0027
0028
0029
0030
0031
0032 class RootMaterialTrackIo {
0033 public:
0034
0035 struct Config {
0036
0037 bool prePostStepInfo = false;
0038
0039 bool surfaceInfo = false;
0040
0041 bool volumeInfo = false;
0042
0043 bool recalculateTotals = false;
0044 };
0045
0046
0047
0048
0049 explicit RootMaterialTrackIo(const Config& cfg) : m_cfg(cfg) {}
0050
0051
0052 ~RootMaterialTrackIo() = default;
0053
0054
0055
0056
0057 void connectForRead(TTree& materialChain);
0058
0059
0060
0061
0062 void connectForWrite(TTree& materialTree);
0063
0064
0065
0066
0067
0068
0069
0070
0071 void write(const Acts::GeometryContext& gctx, std::uint32_t eventNum,
0072 const Acts::RecordedMaterialTrack& materialTrack);
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086 void write(std::uint32_t eventNum,
0087 const Acts::RecordedMaterialTrack& materialTrack);
0088
0089
0090
0091
0092
0093
0094 Acts::RecordedMaterialTrack read() const;
0095
0096
0097 std::uint32_t eventId() const;
0098
0099 private:
0100 struct MateriaSummaryPayload {
0101
0102 float vX = 0;
0103
0104 float vY = 0;
0105
0106 float vZ = 0;
0107
0108 float vPx = 0;
0109
0110 float vPy = 0;
0111
0112 float vPz = 0;
0113
0114 float vPhi = 0;
0115
0116 float vEta = 0;
0117
0118 float tX0 = 0;
0119
0120 float tL0 = 0;
0121 };
0122
0123 struct MaterialStepPayload {
0124
0125 std::vector<float> stepXs;
0126
0127 std::vector<float> stepYs;
0128
0129 std::vector<float> stepZs;
0130
0131 std::vector<float> stepXe;
0132
0133 std::vector<float> stepYe;
0134
0135 std::vector<float> stepZe;
0136
0137
0138 std::vector<float> stepX;
0139 std::vector<float>* stepXPtr = &stepX;
0140
0141 std::vector<float> stepY;
0142 std::vector<float>* stepYPtr = &stepY;
0143
0144 std::vector<float> stepZ;
0145 std::vector<float>* stepZPtr = &stepZ;
0146
0147 std::vector<float> stepR;
0148
0149 std::vector<float> stepDx;
0150 std::vector<float>* stepDxPtr = &stepDx;
0151
0152 std::vector<float> stepDy;
0153 std::vector<float>* stepDyPtr = &stepDy;
0154
0155 std::vector<float> stepDz;
0156 std::vector<float>* stepDzPtr = &stepDz;
0157
0158 std::vector<float> stepLength;
0159 std::vector<float>* stepLengthPtr = &stepLength;
0160
0161 std::vector<float> stepMatX0;
0162 std::vector<float>* stepMatX0Ptr = &stepMatX0;
0163
0164 std::vector<float> stepMatL0;
0165 std::vector<float>* stepMatL0Ptr = &stepMatL0;
0166
0167 std::vector<float> stepMatA;
0168 std::vector<float>* stepMatAPtr = &stepMatA;
0169
0170 std::vector<float> stepMatZ;
0171 std::vector<float>* stepMatZPtr = &stepMatZ;
0172
0173 std::vector<float> stepMatRho;
0174 std::vector<float>* stepMatRhoPtr = &stepMatRho;
0175
0176 std::vector<std::vector<unsigned int>> stepElementZ;
0177 std::vector<std::vector<unsigned int>>* stepElementZPtr = &stepElementZ;
0178
0179 std::vector<std::vector<float>> stepFraction;
0180 std::vector<std::vector<float>>* stepFractionPtr = &stepFraction;
0181 };
0182
0183 struct MaterialSurfacePayload {
0184
0185 std::vector<std::uint64_t> surfaceId;
0186 std::vector<std::uint64_t>* surfaceIdPtr = &surfaceId;
0187
0188 std::vector<float> surfaceX;
0189 std::vector<float>* surfaceXPtr = &surfaceX;
0190
0191 std::vector<float> surfaceY;
0192 std::vector<float>* surfaceYPtr = &surfaceY;
0193
0194 std::vector<float> surfaceZ;
0195 std::vector<float>* surfaceZPtr = &surfaceZ;
0196
0197 std::vector<float> surfaceR;
0198
0199 std::vector<float> surfaceDistance;
0200
0201 std::vector<float> surfacePathCorrection;
0202 std::vector<float>* surfacePathCorrectionPtr = &surfacePathCorrection;
0203 };
0204
0205 struct MaterialVolumePayload {
0206
0207 std::vector<std::uint64_t> volumeId;
0208 };
0209
0210
0211 Config m_cfg;
0212
0213
0214 std::uint32_t m_eventId = 0;
0215
0216
0217
0218 std::vector<long long> m_entryNumbers = {};
0219
0220
0221 MateriaSummaryPayload m_summaryPayload = {};
0222
0223
0224 MaterialStepPayload m_stepPayload = {};
0225
0226
0227 MaterialSurfacePayload m_surfacePayload = {};
0228
0229
0230 MaterialVolumePayload m_volumePayload = {};
0231 };
0232
0233
0234 }