Uh oh!
There was an error while loading. Please reload this page.
[MFT] Move static arrays to be initialized before the processing starts - #10665
Conversation
shahor02
left a comment
There was a problem hiding this comment.
Hi @robincaron13
Thanks for taking care, but this not what I meant: moving the static array from the base class to the derived one will change nothing: it will still be allocated w/o the creation of the actual object, i.e. in any process which links to this library.
Instead, I would define in the TrackerConfig.h
using BinContainer = std::array<std::array<std::array<std::vector<Int_t>, constants::index_table::MaxRPhiBins>, (constants::mft::LayersNumber - 1)>, (constants::mft::LayersNumber - 1)>;
static std_unique_ptr<BinContainer> mBins;
static std_unique_ptr<BinContainer> mBinsS;
static initBinContainers() { // implementation can go to cxx file
if (!mBins) {
mBins = std::make_unique<BinContainer>();
initBins(mBins.get()); // init bins with static method. If not possible to do using static method, then make this method non-static and lock the code by mutex.
//
}
// same for mBinsS
}
In the TrackerSpec call this initBinContainersbefore instantiating the trackers (e.g. in its init method (or in the beginning of updateTimeDependentParams) if this method can be static.
Otherwise, put the non-static method (protected by mutex) in the Tracker constructed.
Same for destroying arrays via mBins.reset() : do this either in the Tracker destructor of the protecting the call with mutex or in the TrackerSpec destructor.
For the usage of the mutex see e.g. how the
is used inAliceO2/Detectors/Base/src/GeometryManager.cxx
Lines 37 to 48 in 816da25
robincaron13
commented
Feb 2, 2023
Hi @shahor02, Thanks a lot for your answer and your proposal. |
shahor02
commented
Feb 2, 2023
|
Hi @shahor02, Thanks for your answer. Some modifications are pushed according to your comments. |
shahor02
left a comment
There was a problem hiding this comment.
Thanks @robincaron13
In general ok, but please see some comments below.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
robincaron13
commented
Feb 6, 2023
Hi @shahor02 |
To follow PR#10654, here the arrays are kept as static member and are moved to the tracker class to be initialized before the processing starts (not sure if it was what you were thinking @shahor02)