Repository navigation
Commit 379e9b6
committed
Mutex-free TGeo material budget in Propagator for multithreaded users
Propagator::getMatBudget (TGeo branch) used the shared TGeo navigator under
GeometryManager::sTGMutex. Add opt-in per-thread navigators:
* GeometryManager::setMaxThreads(n): wraps TGeoManager::SetMaxThreads and
raises the flag enabling per-thread navigators (one-way, like TGeo's).
* GeometryManager::getThreadNavigator(): lazily books a thread_local
navigator; returns nullptr if setMaxThreads() was never called or if more
than n threads ask for one, in which case meanMaterialBudget(..., nullptr)
falls back to the old mutexed shared-navigator path.
* Propagator::getMatBudget passes getThreadNavigator() to
GeometryManager::meanMaterialBudget.
* MatLayerCylSet LUT build uses GeometryManager::setMaxThreads.
How to use in code calling Propagator methods from several threads:
1. Load the geometry (GeometryManager::loadGeometry or from CCDB).
2. Serially, BEFORE starting the worker threads, call
o2::base::GeometryManager::setMaxThreads(nThreads);
with nThreads >= the maximum number of threads that will call the
Propagator (it walks all volumes, so do it once, not per call).
3. Call Propagator methods (propagateToDCA, propagateTo with
MatCorrType::USEMatCorrTGeo, or with the TGeo fall-back when no MatLUT)
from the worker threads as usual; each thread gets its own navigator
on first use and releases it on thread exit. No other change needed.
Without step 2 behaviour is unchanged (mutexed, thread-safe but serialized).
Threads beyond nThreads log a warning and use the mutexed path. Using a
MatLayerCylSet LUT (MatCorrType::USEMatCorrLUT) never touches TGeo.
Co-Authored-By: Claude Sonnet 5.51 parent cf1343c commit 379e9b6
4 files changed
Lines changed: 65 additions & 3 deletions
File tree
- Detectors/Base
- include/DetectorsBase
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
108 | 120 | | |
109 | 121 | | |
110 | 122 | | |
| |||
182 | 194 | | |
183 | 195 | | |
184 | 196 | | |
| 197 | + | |
| 198 | + | |
185 | 199 | | |
186 | 200 | | |
187 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 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 | + | |
69 | 117 | | |
70 | 118 | | |
71 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1011 | 1011 | | |
1012 | 1012 | | |
1013 | 1013 | | |
1014 | | - | |
| 1014 | + | |
1015 | 1015 | | |
1016 | 1016 | | |
1017 | 1017 | | |
1018 | | - | |
| 1018 | + | |
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
| |||
0 commit comments