Skip to content

Commit fde6b3b

Browse files
bovulpesshahor02
authored andcommitted
MFT: further optimizations in the tracker
1 parent 6e1039c commit fde6b3b

File tree

11 files changed

+140
-202
lines changed

11 files changed

+140
-202
lines changed

Detectors/ITSMFT/MFT/tracking/include/MFTTracking/Cell.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace o2
2626
namespace mft
2727
{
2828

29-
class Cell final
29+
class Cell
3030
{
3131
public:
3232
Cell();
@@ -131,24 +131,16 @@ inline void Cell::setLevel(const Int_t level) { mLevel = level; }
131131

132132
inline void Cell::addRightNeighbour(const Int_t layer, const Int_t clusterId)
133133
{
134-
//std::cout << "Cell::addRightNeighbour " << layer << " " << clusterId << std::endl;
135-
try {
136-
mRightNeighbours.at(mNRightNeighbours++) = std::pair<Int_t, Int_t>(layer, clusterId);
137-
} catch (const std::out_of_range& err) {
138-
std::cout << "Maximum number of right neighbours for this cell!" << std::endl;
139-
}
140-
//std::cout << "Cell::addRightNeighbour done..." << std::endl;
134+
mRightNeighbours.at(mNRightNeighbours++) = std::pair<Int_t, Int_t>(layer, clusterId);
141135
}
142136

143137
inline void Cell::addLeftNeighbour(const Int_t layer, const Int_t clusterId)
144138
{
145-
//std::cout << "Cell::addLeftNeighbour " << layer << " " << clusterId << std::endl;
146139
try {
147140
mLeftNeighbours.at(mNLeftNeighbours++) = std::pair<Int_t, Int_t>(layer, clusterId);
148141
} catch (const std::out_of_range& err) {
149142
std::cout << "Maximum number of left neighbours for this cell!" << std::endl;
150143
}
151-
//std::cout << "Cell::addLeftNeighbour done..." << std::endl;
152144
}
153145

154146
inline const std::array<std::pair<Int_t, Int_t>, constants::mft::MaxCellNeighbours>& Cell::getLeftNeighbours() const

Detectors/ITSMFT/MFT/tracking/include/MFTTracking/Constants.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ constexpr std::array<Float_t, LayersNumber> InverseLayerZCoordinate()
4848
{
4949
return std::array<Float_t, LayersNumber>{-1. / 45.3, -1. / 46.7, -1. / 48.6, -1. / 50.0, -1. / 52.4, -1. / 53.8, -1. / 67.7, -1. / 69.1, -1. / 76.1, -1. / 77.5};
5050
}
51-
constexpr Int_t MaxCellNeighbours{10};
51+
constexpr Int_t MaxCellNeighbours{50};
52+
constexpr Int_t MaxPointsInRoad{100};
53+
constexpr Int_t MaxCellsInRoad{100};
5254
} // namespace mft
5355

5456
namespace index_table

Detectors/ITSMFT/MFT/tracking/include/MFTTracking/IOUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <vector>
2222
#include <gsl/gsl>
2323

24-
#include "MFTTracking/TrackerConfig.h"
24+
#include "MFTTracking/Tracker.h"
2525
#include "MFTTracking/ROframe.h"
2626
#include "ITSMFTBase/SegmentationAlpide.h"
2727
#include "DataFormatsITSMFT/ROFRecord.h"
@@ -57,7 +57,7 @@ constexpr float DefClusError2Col = DefClusErrorCol * DefClusErrorCol;
5757

5858
int loadROFrameData(const o2::itsmft::ROFRecord& rof, ROframe& events, gsl::span<const itsmft::CompClusterExt> clusters,
5959
gsl::span<const unsigned char>::iterator& pattIt, const itsmft::TopologyDictionary& dict,
60-
const dataformats::MCTruthContainer<MCCompLabel>* mClsLabels = nullptr, const o2::mft::TrackerConfig* trkParam = nullptr);
60+
const dataformats::MCTruthContainer<MCCompLabel>* mClsLabels = nullptr, const o2::mft::Tracker* tracker = nullptr);
6161

6262
} // namespace ioutils
6363
} // namespace mft

Detectors/ITSMFT/MFT/tracking/include/MFTTracking/ROframe.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace mft
3939
class TrackCA;
4040
class TrackLTF;
4141

42-
class ROframe final
42+
class ROframe
4343
{
4444
public:
4545
ROframe(Int_t ROframeId);

Detectors/ITSMFT/MFT/tracking/include/MFTTracking/Road.h

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ namespace o2
2323
namespace mft
2424
{
2525

26-
class Road final
26+
class Road
2727
{
2828
public:
29-
Road();
29+
Road() { mRoadId = 0; };
30+
void reset();
31+
void initialize();
3032

3133
void setPoint(const Int_t layer, const Int_t clusterId)
3234
{
@@ -64,10 +66,24 @@ class Road final
6466
std::array<std::vector<Cell>, (constants::mft::LayersNumber - 1)> mCell;
6567
};
6668

67-
inline Road::Road()
68-
: mRoadId{0}
69+
inline void Road::reset()
6970
{
70-
// Nothing to do
71+
Int_t layer;
72+
for (layer = 0; layer < (constants::mft::LayersNumber - 1); ++layer) {
73+
mCell[layer].clear();
74+
mClusterId[layer].clear();
75+
}
76+
mClusterId[layer].clear();
77+
}
78+
79+
inline void Road::initialize()
80+
{
81+
Int_t layer;
82+
for (layer = 0; layer < (constants::mft::LayersNumber - 1); ++layer) {
83+
mCell[layer].reserve(constants::mft::MaxCellsInRoad);
84+
mClusterId[layer].reserve(constants::mft::MaxPointsInRoad);
85+
}
86+
mClusterId[layer].reserve(constants::mft::MaxPointsInRoad);
7187
}
7288

7389
inline const Int_t Road::getNPointsInLayer(Int_t layer) const

Detectors/ITSMFT/MFT/tracking/include/MFTTracking/Tracker.h

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace mft
3434

3535
class TrackLTF;
3636

37-
class Tracker
37+
class Tracker : public TrackerConfig
3838
{
3939

4040
public:
@@ -60,20 +60,16 @@ class Tracker
6060
std::uint32_t getROFrame() const { return mROFrame; }
6161

6262
void initialize();
63-
const o2::mft::TrackerConfig* getConfig() { return mTrackerConfig.get(); }
64-
void setConfig(const TrackerConfig& conf)
65-
{
66-
mTrackerConfig = std::make_unique<o2::mft::TrackerConfig>(conf);
67-
}
63+
void initConfig(const MFTTrackingParam& trkParam);
6864

6965
private:
7066
void findTracks(ROframe&);
7167
void findTracksLTF(ROframe&);
7268
void findTracksCA(ROframe&);
7369
void computeCellsInRoad(ROframe&);
74-
void runForwardInRoad(ROframe&);
70+
void runForwardInRoad();
7571
void runBackwardInRoad(ROframe&);
76-
void updateCellStatusInRoad(Road&);
72+
void updateCellStatusInRoad();
7773

7874
bool fitTracks(ROframe&);
7975

@@ -100,6 +96,7 @@ class Tracker
10096
std::array<std::array<std::array<std::vector<Int_t>, constants::index_table::MaxRPhiBins>, (constants::mft::LayersNumber - 1)>, (constants::mft::LayersNumber - 1)> mBinsS;
10197
std::array<std::array<std::array<std::vector<Int_t>, constants::index_table::MaxRPhiBins>, (constants::mft::LayersNumber - 1)>, (constants::mft::LayersNumber - 1)> mBins;
10298

99+
/// helper to store points of a track candidate
103100
struct TrackElement {
104101
TrackElement() = default;
105102
TrackElement(Int_t la, Int_t id)
@@ -111,10 +108,8 @@ class Tracker
111108
Int_t idInLayer;
112109
};
113110

114-
std::vector<TrackElement> roadPoints;
115-
116-
/// tracking configuration parameters
117-
std::unique_ptr<o2::mft::TrackerConfig> mTrackerConfig = nullptr;
111+
/// current road for CA algorithm
112+
Road mRoad;
118113
};
119114

120115
//_________________________________________________________________________________________________

Detectors/ITSMFT/MFT/tracking/include/MFTTracking/TrackerConfig.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ namespace mft
2424
{
2525
class TrackerConfig
2626
{
27-
public:
27+
public:
2828
TrackerConfig();
29-
TrackerConfig(const TrackerConfig& conf);
30-
TrackerConfig& operator=(const TrackerConfig& conf);
29+
TrackerConfig(const TrackerConfig& conf) = default;
30+
TrackerConfig& operator=(const TrackerConfig& conf) = default;
3131

3232
void initialize(const MFTTrackingParam& trkParam);
33-
33+
3434
const Int_t getRBinIndex(const Float_t r) const;
3535
const Int_t getPhiBinIndex(const Float_t phi) const;
3636
const Int_t getBinIndex(const Int_t rIndex, const Int_t phiIndex) const;
37-
37+
3838
// tracking configuration parameters
3939
Int_t mMinTrackPointsLTF = 5;
4040
Int_t mMinTrackPointsCA = 4;
@@ -53,7 +53,6 @@ class TrackerConfig
5353
Float_t mInversePhiBinSize = 50. / constants::index_table::PhiMax;
5454

5555
private:
56-
5756
ClassDefNV(TrackerConfig, 1);
5857
};
5958

@@ -75,7 +74,7 @@ inline const Int_t TrackerConfig::getBinIndex(const Int_t rIndex, const Int_t ph
7574
}
7675
return (mRBins * mPhiBins);
7776
}
78-
77+
7978
} // namespace mft
8079
} // namespace o2
8180

Detectors/ITSMFT/MFT/tracking/src/IOUtils.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace mft
3535
{
3636

3737
int ioutils::loadROFrameData(const o2::itsmft::ROFRecord& rof, ROframe& event, gsl::span<const itsmft::CompClusterExt> clusters, gsl::span<const unsigned char>::iterator& pattIt, const itsmft::TopologyDictionary& dict,
38-
const dataformats::MCTruthContainer<MCCompLabel>* mcLabels, const o2::mft::TrackerConfig* trkParam)
38+
const dataformats::MCTruthContainer<MCCompLabel>* mcLabels, const o2::mft::Tracker* tracker)
3939
{
4040
event.clear();
4141
GeometryTGeo* geom = GeometryTGeo::Instance();
@@ -72,9 +72,9 @@ int ioutils::loadROFrameData(const o2::itsmft::ROFRecord& rof, ROframe& event, g
7272
Float_t rCoord = clsPoint2D.R();
7373
Float_t phiCoord = clsPoint2D.Phi();
7474
o2::math_utils::bringTo02PiGen(phiCoord);
75-
int rBinIndex = trkParam->getRBinIndex(rCoord);
76-
int phiBinIndex = trkParam->getPhiBinIndex(phiCoord);
77-
int binIndex = trkParam->getBinIndex(rBinIndex, phiBinIndex);
75+
int rBinIndex = tracker->getRBinIndex(rCoord);
76+
int phiBinIndex = tracker->getPhiBinIndex(phiCoord);
77+
int binIndex = tracker->getBinIndex(rBinIndex, phiBinIndex);
7878
// TODO: Check consistency of sigmaX2 and sigmaY2
7979
event.addClusterToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), phiCoord, rCoord, event.getClustersInLayer(layer).size(), binIndex, sigmaX2, sigmaY2, sensorID);
8080
if (mcLabels) {

0 commit comments

Comments
 (0)