|
24 | 24 | #include <TRandom.h> |
25 | 25 | #include <TSystem.h> |
26 | 26 |
|
| 27 | +#include <chrono> |
27 | 28 | #include <fstream> |
28 | 29 | #include <map> |
29 | 30 | #include <string> |
| 31 | +#include <thread> |
30 | 32 | #include <vector> |
31 | 33 |
|
32 | 34 | namespace o2 |
33 | 35 | { |
34 | 36 | namespace fastsim |
35 | 37 | { |
36 | 38 |
|
37 | | -std::map<std::string, std::map<std::string, std::string>> GeometryContainer::parseTEnvConfiguration(std::string& filename, std::vector<std::string>& layers) |
38 | | -{ |
39 | | - std::map<std::string, std::map<std::string, std::string>> configMap; |
40 | | - filename = gSystem->ExpandPathName(filename.c_str()); |
41 | | - LOG(info) << "Parsing TEnv configuration file: " << filename; |
42 | | - TEnv env(filename.c_str()); |
43 | | - THashList* table = env.GetTable(); |
44 | | - layers.clear(); |
45 | | - for (int i = 0; i < table->GetEntries(); ++i) { |
46 | | - const std::string key = table->At(i)->GetName(); |
47 | | - // key should contain exactly one dot |
48 | | - if (key.find('.') == std::string::npos || key.find('.') != key.rfind('.')) { |
49 | | - LOG(fatal) << "Key " << key << " does not contain exactly one dot"; |
50 | | - continue; |
51 | | - } |
52 | | - const std::string firstPart = key.substr(0, key.find('.')); |
53 | | - if (std::find(layers.begin(), layers.end(), firstPart) == layers.end()) { |
54 | | - layers.push_back(firstPart); |
55 | | - } |
56 | | - } |
57 | | - env.Print(); |
58 | | - // Layers |
59 | | - for (const auto& layer : layers) { |
60 | | - LOG(info) << " Reading layer " << layer; |
61 | | - for (int i = 0; i < table->GetEntries(); ++i) { |
62 | | - const std::string key = table->At(i)->GetName(); |
63 | | - if (key.find(layer + ".") == 0) { |
64 | | - const std::string paramName = key.substr(key.find('.') + 1); |
65 | | - const std::string value = env.GetValue(key.c_str(), ""); |
66 | | - configMap[layer][paramName] = value; |
67 | | - } |
68 | | - } |
69 | | - } |
70 | | - return configMap; |
71 | | -} |
72 | | - |
73 | | -void GeometryContainer::init(o2::framework::InitContext& initContext) |
74 | | -{ |
75 | | - std::vector<std::string> detectorConfiguration; |
76 | | - const bool found = common::core::getTaskOptionValue(initContext, "on-the-fly-detector-geometry-provider", "detectorConfiguration", detectorConfiguration, false); |
77 | | - if (!found) { |
78 | | - LOG(fatal) << "Could not retrieve detector configuration from OnTheFlyDetectorGeometryProvider task."; |
79 | | - return; |
80 | | - } |
81 | | - LOG(info) << "Size of detector configuration: " << detectorConfiguration.size(); |
82 | | - for (const auto& configFile : detectorConfiguration) { |
83 | | - LOG(info) << "Detector geometry configuration file used: " << configFile; |
84 | | - addEntry(configFile); |
85 | | - } |
86 | | -} |
87 | | - |
88 | | -std::map<std::string, std::string> GeometryContainer::GeometryEntry::getConfiguration(const std::string& layerName) const |
89 | | -{ |
90 | | - auto it = mConfigurations.find(layerName); |
91 | | - if (it != mConfigurations.end()) { |
92 | | - return it->second; |
93 | | - } else { |
94 | | - LOG(fatal) << "Layer " << layerName << " not found in geometry configurations."; |
95 | | - return {}; |
96 | | - } |
97 | | -} |
98 | | - |
99 | | -bool GeometryContainer::GeometryEntry::hasValue(const std::string& layerName, const std::string& key) const |
100 | | -{ |
101 | | - auto layerIt = mConfigurations.find(layerName); |
102 | | - if (layerIt != mConfigurations.end()) { |
103 | | - auto keyIt = layerIt->second.find(key); |
104 | | - return keyIt != layerIt->second.end(); |
105 | | - } |
106 | | - return false; |
107 | | -} |
108 | | - |
109 | | -std::string GeometryContainer::GeometryEntry::getValue(const std::string& layerName, const std::string& key, bool require) const |
110 | | -{ |
111 | | - auto layer = getConfiguration(layerName); |
112 | | - auto entry = layer.find(key); |
113 | | - if (entry != layer.end()) { |
114 | | - return layer.at(key); |
115 | | - } else if (require) { |
116 | | - LOG(fatal) << "Key " << key << " not found in layer " << layerName << " configurations."; |
117 | | - return ""; |
118 | | - } else { |
119 | | - return ""; |
120 | | - } |
121 | | -} |
122 | | - |
123 | | -void GeometryContainer::GeometryEntry::replaceValue(const std::string& layerName, const std::string& key, const std::string& value) |
124 | | -{ |
125 | | - if (!hasValue(layerName, key)) { // check that the key exists |
126 | | - LOG(fatal) << "Key " << key << " does not exist in layer " << layerName << ". Cannot replace value."; |
127 | | - } |
128 | | - setValue(layerName, key, value); |
129 | | -} |
130 | | - |
131 | 39 | // +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+ |
132 | 40 |
|
133 | 41 | DetLayer* FastTracker::AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type) |
@@ -188,106 +96,6 @@ void FastTracker::Print() |
188 | 96 | LOG(info) << "+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+"; |
189 | 97 | } |
190 | 98 |
|
191 | | -void FastTracker::AddSiliconALICE3v4(std::vector<float> pixelResolution) |
192 | | -{ |
193 | | - LOG(info) << " ALICE 3: Adding v4 tracking layers"; |
194 | | - float x0IT = 0.001; // 0.1% |
195 | | - float x0OT = 0.005; // 0.5% |
196 | | - float xrhoIB = 1.1646e-02; // 50 mum Si |
197 | | - float xrhoOT = 1.1646e-01; // 500 mum Si |
198 | | - float eff = 1.00; |
199 | | - |
200 | | - float resRPhiIT = pixelResolution[0]; |
201 | | - float resZIT = pixelResolution[1]; |
202 | | - float resRPhiOT = pixelResolution[2]; |
203 | | - float resZOT = pixelResolution[3]; |
204 | | - |
205 | | - AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be |
206 | | - AddLayer("ddd0", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); |
207 | | - AddLayer("ddd1", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); |
208 | | - AddLayer("ddd2", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); |
209 | | - AddLayer("bpipe1", 5.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be |
210 | | - AddLayer("ddd3", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
211 | | - AddLayer("ddd4", 10., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
212 | | - AddLayer("ddd5", 13., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
213 | | - AddLayer("ddd6", 16., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
214 | | - AddLayer("ddd7", 25., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
215 | | - AddLayer("ddd8", 40., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
216 | | - AddLayer("ddd9", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
217 | | -} |
218 | | - |
219 | | -void FastTracker::AddSiliconALICE3v2(std::vector<float> pixelResolution) |
220 | | -{ |
221 | | - LOG(info) << "ALICE 3: Adding v2 tracking layers;"; |
222 | | - float x0IT = 0.001; // 0.1% |
223 | | - float x0OT = 0.01; // 1.0% |
224 | | - float xrhoIB = 2.3292e-02; // 100 mum Si |
225 | | - float xrhoOT = 2.3292e-01; // 1000 mum Si |
226 | | - float eff = 1.00; |
227 | | - |
228 | | - float resRPhiIT = pixelResolution[0]; |
229 | | - float resZIT = pixelResolution[1]; |
230 | | - float resRPhiOT = pixelResolution[2]; |
231 | | - float resZOT = pixelResolution[3]; |
232 | | - |
233 | | - AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be |
234 | | - AddLayer("B00", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); |
235 | | - AddLayer("B01", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); |
236 | | - AddLayer("B02", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1); |
237 | | - AddLayer("bpipe1", 3.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be |
238 | | - AddLayer("B03", 3.75, 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
239 | | - AddLayer("B04", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
240 | | - AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
241 | | - AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
242 | | - AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
243 | | - AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
244 | | - AddLayer("B09", 60., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
245 | | - AddLayer("B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
246 | | -} |
247 | | - |
248 | | -void FastTracker::AddSiliconALICE3(float scaleX0VD, std::vector<float> pixelResolution) |
249 | | -{ |
250 | | - float x0Pipe0 = 0.001592; // 200 um AlBe |
251 | | - float x0VDL0 = 0.00076; // 30 um Si + 50 um glue + carbon foam 0.03% |
252 | | - float x0VDL1 = 0.00096; // 30 um Si + 50 um glue + carbon foam 0.05% |
253 | | - float x0VDL2 = 0.00167; // 30 um Si + 50 um glue + carbon foam 0.05% + 0.07% Be case |
254 | | - float x0Coldplate = 0.02f; // (1.5 mm Al2O3 2%) |
255 | | - float x0Pipe1 = 0.0023f; // 800 um Be |
256 | | - float x0OT = 0.01; // 1.0% |
257 | | - float x0iTOF = x0OT * 3.; |
258 | | - |
259 | | - float resRPhiVD = pixelResolution[0]; |
260 | | - float resZVD = pixelResolution[1]; |
261 | | - float resRPhiOT = pixelResolution[2]; |
262 | | - float resZOT = pixelResolution[3]; |
263 | | - |
264 | | - float xrhoPipe0 = 0; |
265 | | - float xrhoVDL0 = 0; |
266 | | - float xrhoVDL1 = 0; |
267 | | - float xrhoVDL2 = 0; |
268 | | - float xrhoColdplate = 0; |
269 | | - float xrhoPipe1 = 0; |
270 | | - float xrhoOT = 2.3292e-01; |
271 | | - float xrhoiTOF = 0.03; |
272 | | - float eff = 1.00; |
273 | | - |
274 | | - AddLayer("bpipe0", 0.48, 250, x0Pipe0, xrhoPipe0, 0.0f, 0.0f, 0.0f, 0); |
275 | | - AddLayer("B00", 0.5, 250, x0VDL0 * scaleX0VD, xrhoVDL0, resRPhiVD, resZVD, eff, 1); |
276 | | - AddLayer("B01", 1.2, 250, x0VDL1 * scaleX0VD, xrhoVDL1, resRPhiVD, resZVD, eff, 1); |
277 | | - AddLayer("B02", 2.5, 250, x0VDL2 * scaleX0VD, xrhoVDL2, resRPhiVD, resZVD, eff, 1); |
278 | | - AddLayer("coldplate", 2.6, 250, x0Coldplate, xrhoColdplate, 0.0f, 0.0f, 0.0f, 0); |
279 | | - AddLayer("bpipe1", 5.7, 250, x0Pipe1, xrhoPipe1, 0.0f, 0.0f, 0.0f, 0); |
280 | | - AddLayer("B03", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
281 | | - AddLayer("B04", 9., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
282 | | - AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
283 | | - AddLayer("iTOF", 19, 250, x0iTOF, xrhoiTOF, resRPhiOT, resZOT, eff, 0); |
284 | | - AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
285 | | - AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
286 | | - AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
287 | | - AddLayer("B09", 60., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
288 | | - AddLayer("B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1); |
289 | | -} |
290 | | - |
291 | 99 | void FastTracker::AddTPC(float phiResMean, float zResMean) |
292 | 100 | { |
293 | 101 | LOG(info) << " Adding standard time projection chamber"; |
@@ -333,7 +141,7 @@ void FastTracker::AddTPC(float phiResMean, float zResMean) |
333 | 141 | } |
334 | 142 | } |
335 | 143 |
|
336 | | -void FastTracker::AddGenericDetector(GeometryContainer::GeometryEntry configMap, o2::ccdb::BasicCCDBManager* ccdbManager) |
| 144 | +void FastTracker::AddGenericDetector(o2::fastsim::GeometryEntry configMap, o2::ccdb::BasicCCDBManager* ccdbManager) |
337 | 145 | { |
338 | 146 | // Layers |
339 | 147 | for (const auto& layer : configMap.getLayerNames()) { |
|
0 commit comments