Optimizations in the CM tracker - #1642
Conversation
| std::array<Int_t, Cluster::maxLabels * CookedTracker::kNLayers> mx; | ||
|
|
||
| int nLabels = 0; | ||
| std::map<Label, int> map; |
There was a problem hiding this comment.
Please use a more descriptive variable name, e.g. labelMap, labelUsage, labelOccurence, also to make sure not to be mixed with the type.
There was a problem hiding this comment.
@matthiasrichter Thank you very much, Matthias, for checking this piece of my code.
You are certainly right: this map is actually "labelOccurence". Fixed.
| // Tracking "road" from layer to layer | ||
| const Double_t kRoadY = 0.2; | ||
| const Double_t kRoadZ = 0.7; | ||
| const Float_t kRoadZ = 0.3; |
There was a problem hiding this comment.
do you want to change also kRoadY to float for consistency? Maybe you can also add a comment about the changed value. Is this because the inclination of the track is taken into account to calculate an effective value?
There was a problem hiding this comment.
In fact, all these parameters should now in O2 become "float". (This is because our "base track" is made of floats). Fixed as well !
Yes, the initial value was changed, because this "road" now becomes a function of the
track inclination angle.
|
One could also consider to use |
… map used for label cooking.
|
| continue; | ||
|
|
||
| auto xyz3 = c3->getXYZGloRot(*mGeom); | ||
| Point3Df txyz2 = c2->getXYZ(); // tracking coordinates |
There was a problem hiding this comment.
it is better to use const Point3Df& txyz2 here.
| phi -= pi2; | ||
| phi += k2PI; | ||
| else if (phi >= k2PI) | ||
| phi -= k2PI; |
There was a problem hiding this comment.
Why do you still use doubles here?
Just for the info: the file O2/Common/MathUtils/include/MathUtils/Utils.h provides a set of methods for dealing with angle wrapping, including the BringTo02Pi
There was a problem hiding this comment.
@shahor02 Thank you, Ruben, for the suggestions.
Actually, I have found one more place like that. All are fixed now.
shahor02
left a comment
There was a problem hiding this comment.
just small comments below:
|
@shahor02 Hi Ruben, ah interesting. Though here it concerns a local variable in a function implemented in cxx file. So I suppose root dictionary generation would not tough it. But good to know. |
|
@matthiasrichter @shahor02 Hi Matthias, Ruben. Asking your opinion about the std::map. |
|
@iouribelikov in general, the unordered_map is more efficient, the only advantage std:map gives you is sorted order of the iteration. Hashing is const time operation, while std:map needs to rebalance the tree at every insertion, which is |
|
@shahor02 Thank you. Always good to learn something new. |
Co-authored-by: smonira <shirajum.monira@cern.ch>
This PR contains a couple of fixes and optimizations that improve the performance of the Cooked Matrix tracker ( see https://indico.cern.ch/event/792935/ )