Skip to content

Commit 2d36475

Browse files
iouribelikovsawenzel
authored andcommitted
Optimizations in the CM tracker (#1642)
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/ ) * Adding the estimation of fake-track rate * Printing the number of processed clusters * Optimizing the search in Z, and making it faster * Optimizing the cluster selection, and fixing the discontinuity at phi~2pi * An std::map-based track-label cooking * A command-line argument for setting the number of threads * Clang-formatting * Making the tracking parameters float. Using a meaningful name for the map used for label cooking.
1 parent 42e4c3d commit 2d36475

4 files changed

Lines changed: 125 additions & 121 deletions

File tree

Detectors/ITSMFT/ITS/macros/test/CheckTracks.C

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,22 @@ void CheckTracks(std::string tracfile = "o2trac_its.root", std::string clusfile
7171
Int_t tf = 0, nrec = 0;
7272
Int_t lastEventID = -1;
7373
Int_t nev = mcTree->GetEntries();
74-
TH1D* den = new TH1D("den", ";#it{p}_{T} (GeV/#it{c});Den", 100, 0.01, 10);
75-
TH1D* num = new TH1D("num", ";#it{p}_{T} (GeV/#it{c});Num", 100, 0.01, 10);
74+
75+
Int_t nb = 100;
76+
Double_t xbins[nb + 1], ptcutl = 0.01, ptcuth = 10.;
77+
Double_t a = TMath::Log(ptcuth / ptcutl) / nb;
78+
for (Int_t i = 0; i <= nb; i++)
79+
xbins[i] = ptcutl * TMath::Exp(i * a);
80+
TH1D* num = new TH1D("num", ";#it{p}_{T} (GeV/#it{c});Efficiency (fake-track rate)", nb, xbins);
81+
num->Sumw2();
82+
TH1D* fak = new TH1D("fak", ";#it{p}_{T} (GeV/#it{c});Fak", nb, xbins);
83+
fak->Sumw2();
84+
TH1D* den = new TH1D("den", ";#it{p}_{T} (GeV/#it{c});Den", nb, xbins);
85+
den->Sumw2();
86+
7687
for (Int_t n = 0; n < nev; n++) {
7788
std::cout << "\nMC event " << n << '/' << nev << std::endl;
78-
Int_t nGen = 0, nGoo = 0;
89+
Int_t nGen = 0, nGoo = 0, nFak = 0;
7990
mcTree->GetEvent(n);
8091
Int_t nmc = mcArr->size();
8192
Int_t nmcrefs = mcTrackRefs->size();
@@ -106,7 +117,7 @@ void CheckTracks(std::string tracfile = "o2trac_its.root", std::string clusfile
106117

107118
int ok = 0;
108119
// Check the availability of clusters
109-
for (int i = 0; i < clusArr->size(); i++) {
120+
for (uint i = 0; i < clusArr->size(); i++) {
110121
const Cluster& c = (*clusArr)[i];
111122
auto lab = (clusLabArr->getLabels(i))[0];
112123
if (lab.getEventID() != n)
@@ -190,15 +201,21 @@ void CheckTracks(std::string tracfile = "o2trac_its.root", std::string clusfile
190201
if (label > 0) {
191202
nGoo++; // Good found tracks for the efficiency calculation
192203
num->Fill(mcPt);
204+
} else {
205+
nFak++; // Fake-track rate calculation
206+
fak->Fill(mcPt);
193207
}
194208
}
195209

196210
nt->Fill( // mcYOut,recYOut,
197211
mcZOut, recZOut, mcPhiOut, recPhiOut, mcThetaOut, recThetaOut, mcPhi, recPhi, mcLam, recLam, mcPt, recPt, ip[0],
198212
ip[1], label);
199213
}
200-
Float_t eff = (nGen > 0) ? nGoo / Float_t(nGen) : -1.;
201-
std::cout << "Good found tracks: " << nGoo << ", efficiency: " << eff << std::endl;
214+
if (nGen > 0) {
215+
Float_t eff = nGoo / Float_t(nGen);
216+
Float_t rat = nFak / Float_t(nGen);
217+
std::cout << "Good found tracks: " << nGoo << ", efficiency: " << eff << ", fake-track rate: " << rat << std::endl;
218+
}
202219
}
203220

204221
// "recPt>0" means "found tracks only"
@@ -215,9 +232,15 @@ void CheckTracks(std::string tracfile = "o2trac_its.root", std::string clusfile
215232
nt->Draw("mcPhiOut-recPhiOut", "recPt>0 && label>0");
216233
new TCanvas;
217234
nt->Draw("mcThetaOut-recThetaOut", "recPt>0 && label>0");
218-
new TCanvas;
219-
num->Divide(den);
220-
num->Draw();
235+
TCanvas* c1 = new TCanvas;
236+
c1->SetLogx();
237+
c1->SetGridx();
238+
c1->SetGridy();
239+
num->Divide(num, den, 1, 1, "b");
240+
num->Draw("histe");
241+
fak->Divide(fak, den, 1, 1, "b");
242+
fak->SetLineColor(2);
243+
fak->Draw("histesame");
221244
f->Write();
222245
f->Close();
223246
}

Detectors/ITSMFT/ITS/reconstruction/include/ITSReconstruction/CookedTracker.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class CookedTracker::Layer
145145
void setR(Double_t r) { mR = r; }
146146
void unloadClusters();
147147
void selectClusters(std::vector<Int_t>& s, Float_t phi, Float_t dy, Float_t z, Float_t dz);
148-
Int_t findClusterIndex(Double_t z) const;
148+
Int_t findClusterIndex(Float_t z) const;
149149
Float_t getR() const { return mR; }
150150
const Cluster* getCluster(Int_t i) const { return mClusters[i]; }
151151
Float_t getAlphaRef(Int_t i) const { return mAlphaRef[i]; }
@@ -161,7 +161,7 @@ class CookedTracker::Layer
161161
std::vector<const Cluster*> mClusters; ///< All clusters
162162
std::vector<Float_t> mAlphaRef; ///< alpha of the reference plane
163163
std::vector<Float_t> mPhi; ///< cluster phi
164-
std::vector<Int_t> mSectors[kNSectors]; ///< Cluster indices sector-by-sector
164+
std::vector<std::pair<int, float>> mSectors[kNSectors]; ///< Cluster indices sector-by-sector
165165
};
166166
} // namespace ITS
167167
} // namespace o2

0 commit comments

Comments
 (0)