|
9 | 9 | // granted to it by virtue of its status as an Intergovernmental Organization |
10 | 10 | // or submit itself to any jurisdiction. |
11 | 11 |
|
12 | | -#include <FairVolume.h> |
13 | | - |
14 | | -#include <TVirtualMC.h> |
15 | | -#include <TVirtualMCStack.h> |
16 | | -#include <TGeoVolume.h> |
| 12 | +#include "TRKSimulation/Detector.h" |
17 | 13 |
|
18 | 14 | #include "DetectorsBase/Stack.h" |
19 | | -#include "TRKSimulation/Hit.h" |
20 | | -#include "TRKSimulation/Detector.h" |
| 15 | + |
21 | 16 | #include "TRKBase/TRKBaseParam.h" |
| 17 | +#include "TRKSimulation/Hit.h" |
22 | 18 | #include "TRKSimulation/VDGeometryBuilder.h" |
23 | 19 | #include "TRKSimulation/VDSensorRegistry.h" |
| 20 | +#include <TGeoVolume.h> |
| 21 | +#include <TVirtualMC.h> |
| 22 | +#include <TVirtualMCStack.h> |
| 23 | + |
| 24 | +#include <FairVolume.h> |
24 | 25 |
|
25 | 26 | #include <string> |
26 | 27 | #include <type_traits> |
@@ -105,14 +106,21 @@ void Detector::configMLOT() |
105 | 106 | break; |
106 | 107 | } |
107 | 108 | case kSegmented: { |
| 109 | + const std::vector<float> tiltAngles{11.2f, 11.9f, 11.4f, 0.f, 0.f, 0.f, 0.f, 0.f}; |
| 110 | + // const std::vector<float> tiltAngles{10.f, 16.1f, 19.2f, 0.f, 0.f, 0.f, 0.f, 0.f}; |
| 111 | + const std::vector<int> nStaves{10, 14, 18, 26, 38, 32, 42, 56}; |
| 112 | + // const std::vector<int> nStaves{10, 16, 22, 26, 38, 32, 42, 56}; |
108 | 113 | const std::vector<int> nMods{10, 10, 10, 10, 10, 20, 20, 20}; |
| 114 | + |
| 115 | + const std::vector<float> stagOffsets{0.f, 0.f, 0.f, 1.17f, 0.89f}; |
| 116 | + |
109 | 117 | LOGP(warning, "Loading segmented configuration for ALICE3 TRK"); |
110 | 118 | for (int i{0}; i < 8; ++i) { |
111 | 119 | std::string name = GeometryTGeo::getTRKLayerPattern() + std::to_string(i); |
112 | | - if (i < 4) { |
113 | | - mLayers.push_back(std::make_unique<TRKMLLayer>(i, name, rInn[i], nMods[i], thick, MatBudgetParamMode::Thickness)); |
| 120 | + if (i < 5) { |
| 121 | + mLayers.push_back(std::make_unique<TRKMLLayer>(i, name, rInn[i], stagOffsets[i], tiltAngles[i], nStaves[i], nMods[i], thick, MatBudgetParamMode::Thickness)); |
114 | 122 | } else { |
115 | | - mLayers.push_back(std::make_unique<TRKOTLayer>(i, name, rInn[i], nMods[i], thick, MatBudgetParamMode::Thickness)); |
| 123 | + mLayers.push_back(std::make_unique<TRKOTLayer>(i, name, rInn[i], tiltAngles[i], nStaves[i], nMods[i], thick, MatBudgetParamMode::Thickness)); |
116 | 124 | } |
117 | 125 | } |
118 | 126 | break; |
@@ -153,16 +161,66 @@ void Detector::configFromFile(std::string fileName) |
153 | 161 | } |
154 | 162 |
|
155 | 163 | std::string name = GeometryTGeo::getTRKLayerPattern() + std::to_string(layerCount); |
| 164 | + |
156 | 165 | switch (trkPars.layoutMLOT) { |
157 | | - case kCylindrical: |
158 | | - mLayers.push_back(std::make_unique<TRKCylindricalLayer>(layerCount, name, tmpBuff[0], tmpBuff[1], tmpBuff[2], MatBudgetParamMode::Thickness)); |
| 166 | + case kCylindrical: { |
| 167 | + // Cylindrical requires at least 3 parameters |
| 168 | + if (tmpBuff.size() < 3) { |
| 169 | + LOGP(fatal, "Invalid configuration for cylindrical layer {}: insufficient parameters.", layerCount); |
| 170 | + } |
| 171 | + |
| 172 | + // Default mode is Thickness |
| 173 | + MatBudgetParamMode mode = MatBudgetParamMode::Thickness; |
| 174 | + if (tmpBuff.size() >= 4) { |
| 175 | + mode = static_cast<MatBudgetParamMode>(static_cast<int>(tmpBuff[3])); |
| 176 | + } |
| 177 | + |
| 178 | + mLayers.push_back(std::make_unique<TRKCylindricalLayer>(layerCount, name, tmpBuff[0], tmpBuff[1], tmpBuff[2], mode)); |
159 | 179 | break; |
| 180 | + } |
160 | 181 | case kSegmented: { |
161 | | - int nMods = static_cast<int>(tmpBuff[1]); |
162 | | - if (layerCount < 4) { |
163 | | - mLayers.push_back(std::make_unique<TRKMLLayer>(layerCount, name, tmpBuff[0], nMods, tmpBuff[2], MatBudgetParamMode::Thickness)); |
| 182 | + // Expected column mapping in the text file (separated by \t): |
| 183 | + // tmpBuff[0] = rInn |
| 184 | + // tmpBuff[1] = thick |
| 185 | + // tmpBuff[2] = tiltAngle |
| 186 | + // tmpBuff[3] = nStaves |
| 187 | + // tmpBuff[4] = nMods |
| 188 | + // tmpBuff[5] = stagOffset (required ONLY for ML) |
| 189 | + // tmpBuff[6] = matBudgetMode (optional, default = Thickness) |
| 190 | + |
| 191 | + // Base parameters for all segmented layers (at least 5 needed) |
| 192 | + if (tmpBuff.size() < 5) { |
| 193 | + LOGP(fatal, "Invalid configuration for segmented layer {}: missing base parameters.", layerCount); |
| 194 | + } |
| 195 | + |
| 196 | + float rInn = tmpBuff[0]; |
| 197 | + float thick = tmpBuff[1]; |
| 198 | + float tiltAngle = tmpBuff[2]; |
| 199 | + int nStaves = static_cast<int>(tmpBuff[3]); |
| 200 | + int nMods = static_cast<int>(tmpBuff[4]); |
| 201 | + |
| 202 | + // Default mode is Thickness |
| 203 | + MatBudgetParamMode mode = MatBudgetParamMode::Thickness; |
| 204 | + |
| 205 | + if (layerCount < 5) { |
| 206 | + // ML layers (0 to 4) require stagOffset (index 5) |
| 207 | + if (tmpBuff.size() < 6) { |
| 208 | + LOGP(fatal, "Invalid configuration for ML layer {}: stagOffset is missing.", layerCount); |
| 209 | + } |
| 210 | + float stagOffset = tmpBuff[5]; |
| 211 | + |
| 212 | + if (tmpBuff.size() >= 7) { |
| 213 | + mode = static_cast<MatBudgetParamMode>(static_cast<int>(tmpBuff[6])); |
| 214 | + } |
| 215 | + |
| 216 | + mLayers.push_back(std::make_unique<TRKMLLayer>(layerCount, name, rInn, stagOffset, tiltAngle, nStaves, nMods, thick, mode)); |
164 | 217 | } else { |
165 | | - mLayers.push_back(std::make_unique<TRKOTLayer>(layerCount, name, tmpBuff[0], nMods, tmpBuff[2], MatBudgetParamMode::Thickness)); |
| 218 | + // OT layers (5+) do NOT have stagOffset. The optional mode is at index 5. |
| 219 | + if (tmpBuff.size() >= 6) { |
| 220 | + mode = static_cast<MatBudgetParamMode>(static_cast<int>(tmpBuff[5])); |
| 221 | + } |
| 222 | + |
| 223 | + mLayers.push_back(std::make_unique<TRKOTLayer>(layerCount, name, rInn, tiltAngle, nStaves, nMods, thick, mode)); |
166 | 224 | } |
167 | 225 | break; |
168 | 226 | } |
|
0 commit comments