[MFT] Move static arrays to be initialized before the processing starts#10665
[MFT] Move static arrays to be initialized before the processing starts#10665shahor02 merged 5 commits intoAliceO2Group:devAliceO2Group/AliceO2:devfrom robincaron13:mft-fix-trackingrobincaron13/AliceO2:mft-fix-trackingCopy head branch name to clipboard
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 initBinContainers before 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
|
Hi @shahor02, Thanks a lot for your answer and your proposal. |
|
|
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.
Detectors/ITSMFT/MFT/tracking/include/MFTTracking/TrackerConfig.h
Outdated
Show resolved
Hide resolved
Detectors/ITSMFT/MFT/tracking/include/MFTTracking/TrackerConfig.h
Outdated
Show resolved
Hide resolved
|
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)