Skip to content

Commit 80f9588

Browse files
committed
A3 FastTracker: updated data member protection
1 parent d8b84ce commit 80f9588

File tree

4 files changed

+64
-34
lines changed

4 files changed

+64
-34
lines changed

ALICE3/Core/FastTracker.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include <vector>
13+
#include <string>
1314
#include "TMath.h"
1415
#include "TMatrixD.h"
1516
#include "TRandom.h"
@@ -214,7 +215,7 @@ float FastTracker::Dist(float z, float r)
214215
if (i == nSteps - 1)
215216
index = 1;
216217
z0 = -4 * sigmaD + i * dz0;
217-
dist += index * (dz0 / 3.) * (1 / o2::math_utils::sqrt(o2::constants::math::TwoPI) / sigmaD) * exp(-z0 * z0 / 2. / sigmaD / sigmaD) * (1 / o2::math_utils::sqrt((z - z0) * (z - z0) + r * r));
218+
dist += index * (dz0 / 3.) * (1 / o2::math_utils::sqrt(o2::constants::math::TwoPI) / sigmaD) * std::exp(-z0 * z0 / 2. / sigmaD / sigmaD) * (1 / o2::math_utils::sqrt((z - z0) * (z - z0) + r * r));
218219
if (index != 4)
219220
index = 4;
220221
else
@@ -295,7 +296,7 @@ float FastTracker::ProbGoodChiSqHit(float radius, float searchRadiusRPhi, float
295296

296297
// function to provide a reconstructed track from a perfect input track
297298
// returns number of intercepts (generic for now)
298-
int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackParCov& outputTrack, float nch)
299+
int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackParCov& outputTrack, const float nch)
299300
{
300301
hits.clear();
301302
nIntercepts = 0;

ALICE3/Core/FastTracker.h

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <fairlogger/Logger.h> // not a system header but megalinter thinks so
1616
#include <vector>
17+
#include <string>
1718
#include "DetLayer.h"
1819
#include "ReconstructionDataFormats/Track.h"
1920

@@ -34,16 +35,38 @@ class FastTracker
3435
FastTracker();
3536
virtual ~FastTracker() {}
3637

38+
// Layer and layer configuration
3739
void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0);
3840
DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true) const;
3941
int GetLayerIndex(const std::string name) const;
42+
void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].x0 = x0; }
43+
void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].r = r; }
44+
void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].resRPhi = resRPhi; }
45+
void SetResolutionZ(const std::string layerName, float resZ) { layers[GetLayerIndex(layerName)].resZ = resZ; }
46+
void SetResolution(const std::string layerName, float resRPhi, float resZ)
47+
{
48+
SetResolutionRPhi(layerName, resRPhi);
49+
SetResolutionZ(layerName, resZ);
50+
}
4051

4152
void AddSiliconALICE3v4(std::vector<float> pixelResolution);
4253
void AddSiliconALICE3v2(std::vector<float> pixelResolution);
4354
void AddTPC(float phiResMean, float zResMean);
4455

4556
void Print();
46-
int FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackParCov& outputTrack, float nch);
57+
58+
/**
59+
* @brief Performs fast tracking on the input track parameters.
60+
*
61+
* Propagates the given input track through the detector layers, applying
62+
* relevant corrections and updates, and stores the result in outputTrack.
63+
*
64+
* @param inputTrack The input track parameters and covariance (const, by value).
65+
* @param outputTrack Reference to the output track parameters and covariance, to be filled.
66+
* @param nch Charged particle multiplicity (used for hit density calculations).
67+
* @return int i.e. number of intercepts (implementation-defined).
68+
*/
69+
int FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackParCov& outputTrack, const float nch);
4770

4871
// For efficiency calculation
4972
float Dist(float z, float radius);
@@ -53,18 +76,35 @@ class FastTracker
5376
float HitDensity(float radius);
5477
float ProbGoodChiSqHit(float radius, float searchRadiusRPhi, float searchRadiusZ);
5578

79+
// Setters and getters for configuration
80+
void SetIntegrationTime(float t) { integrationTime = t; }
81+
void SetMaxRadiusOfSlowDetectors(float r) { maxRadiusSlowDet = r; }
82+
void SetAvgRapidity(float y) { avgRapidity = y; }
83+
void SetdNdEtaCent(float d) { dNdEtaCent = d; }
84+
void SetLhcUPCscale(float s) { lhcUPCScale = s; }
85+
void SetBField(float b) { magneticField = b; }
86+
void SetMinRadTrack(float r) { fMinRadTrack = r; }
87+
void SetMagneticField(float b) { magneticField = b; }
88+
void SetApplyZacceptance(bool b) { applyZacceptance = b; }
89+
void SetApplyMSCorrection(bool b) { applyMSCorrection = b; }
90+
void SetApplyElossCorrection(bool b) { applyElossCorrection = b; }
91+
92+
// Getters for the last track
93+
int GetNIntercepts() const { return nIntercepts; }
94+
int GetNSiliconPoints() const { return nSiliconPoints; }
95+
int GetNGasPoints() const { return nGasPoints; }
96+
float GetGoodHitProb(int layer) const { return goodHitProbability[layer]; }
97+
std::size_t GetNHits() const { return hits.size(); }
98+
float GetHitX(const int i) const { return hits[i][0]; }
99+
float GetHitY(const int i) const { return hits[i][1]; }
100+
float GetHitZ(const int i) const { return hits[i][2]; }
101+
uint64_t GetCovMatOK() const { return covMatOK; }
102+
uint64_t GetCovMatNotOK() const { return covMatNotOK; }
103+
104+
private:
56105
// Definition of detector layers
57106
std::vector<DetLayer> layers;
58107
std::vector<std::vector<float>> hits; // bookkeep last added hits
59-
void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].x0 = x0; }
60-
void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].r = r; }
61-
void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].resRPhi = resRPhi; }
62-
void SetResolutionZ(const std::string layerName, float resZ) { layers[GetLayerIndex(layerName)].resZ = resZ; }
63-
void SetResolution(const std::string layerName, float resRPhi, float resZ)
64-
{
65-
SetResolutionRPhi(layerName, resRPhi);
66-
SetResolutionZ(layerName, resZ);
67-
}
68108

69109
// operational
70110
bool applyZacceptance; // check z acceptance or not
@@ -87,16 +127,6 @@ class FastTracker
87127
float upcBackgroundMultiplier;
88128
float fMinRadTrack = 132.;
89129

90-
// Setters and getters
91-
void SetIntegrationTime(float t) { integrationTime = t; }
92-
void SetMaxRadiusOfSlowDetectors(float r) { maxRadiusSlowDet = r; }
93-
void SetAvgRapidity(float y) { avgRapidity = y; }
94-
void SetdNdEtaCent(float d) { dNdEtaCent = d; }
95-
void SetLhcUPCscale(float s) { lhcUPCScale = s; }
96-
void SetBField(float b) { magneticField = b; }
97-
void SetMinRadTrack(float r) { fMinRadTrack = r; }
98-
// void SetAtLeastHits(int n) { fMinRadTrack = n; }
99-
100130
uint64_t covMatOK; // cov mat has negative eigenvals
101131
uint64_t covMatNotOK; // cov mat has negative eigenvals
102132

@@ -105,7 +135,6 @@ class FastTracker
105135
int nSiliconPoints; // silicon-based space points added to track
106136
int nGasPoints; // tpc-based space points added to track
107137
std::vector<float> goodHitProbability;
108-
float GetGoodHitProb(int layer) const { return goodHitProbability[layer]; }
109138

110139
ClassDef(FastTracker, 1);
111140
};

ALICE3/TableProducer/OTF/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ o2physics_add_dpl_workflow(onthefly-richpid
2424
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2Physics::ALICE3Core
2525
COMPONENT_NAME Analysis)
2626

27-
o2physics_add_dpl_workflow(onthefly-trkpid
27+
o2physics_add_dpl_workflow(on-the-fly-tracker-pid
2828
SOURCES onTheFlyTrackerPid.cxx
2929
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2::ReconstructionDataFormats O2::DetectorsCommonDataFormats O2Physics::ALICE3Core
3030
COMPONENT_NAME Analysis)

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,10 @@ struct OnTheFlyTracker {
423423
rand.SetSeed(seed);
424424

425425
// configure FastTracker
426-
fastTracker.magneticField = magneticField;
427-
fastTracker.applyZacceptance = fastTrackerSettings.applyZacceptance;
428-
fastTracker.applyMSCorrection = fastTrackerSettings.applyMSCorrection;
429-
fastTracker.applyElossCorrection = fastTrackerSettings.applyElossCorrection;
426+
fastTracker.SetMagneticField(magneticField);
427+
fastTracker.SetApplyZacceptance(fastTrackerSettings.applyZacceptance);
428+
fastTracker.SetApplyMSCorrection(fastTrackerSettings.applyMSCorrection);
429+
fastTracker.SetApplyElossCorrection(fastTrackerSettings.applyElossCorrection);
430430

431431
if (fastTrackerSettings.alice3detector == 0) {
432432
fastTracker.AddSiliconALICE3v2(fastTrackerSettings.pixelRes);
@@ -633,8 +633,8 @@ struct OnTheFlyTracker {
633633
nTPCHits[i] = 0;
634634
if (enableSecondarySmearing) {
635635
nHits[i] = fastTracker.FastTrack(xiDaughterTrackParCovsPerfect[i], xiDaughterTrackParCovsTracked[i], dNdEta);
636-
nSiliconHits[i] = fastTracker.nSiliconPoints;
637-
nTPCHits[i] = fastTracker.nGasPoints;
636+
nSiliconHits[i] = fastTracker.GetNSiliconPoints();
637+
nTPCHits[i] = fastTracker.GetNGasPoints();
638638

639639
if (nHits[i] < 0) { // QA
640640
histos.fill(HIST("hFastTrackerQA"), o2::math_utils::abs(nHits[i]));
@@ -645,8 +645,8 @@ struct OnTheFlyTracker {
645645
} else {
646646
continue; // extra sure
647647
}
648-
for (uint32_t ih = 0; ih < fastTracker.hits.size(); ih++) {
649-
histos.fill(HIST("hFastTrackerHits"), fastTracker.hits[ih][2], std::hypot(fastTracker.hits[ih][0], fastTracker.hits[ih][1]));
648+
for (uint32_t ih = 0; ih < fastTracker.GetNHits(); ih++) {
649+
histos.fill(HIST("hFastTrackerHits"), fastTracker.GetHitZ(ih), std::hypot(fastTracker.GetHitX(ih), fastTracker.GetHitY(ih)));
650650
}
651651
} else {
652652
isReco[i] = true;
@@ -1116,8 +1116,8 @@ struct OnTheFlyTracker {
11161116
}
11171117

11181118
// do bookkeeping of fastTracker tracking
1119-
histos.fill(HIST("hCovMatOK"), 0.0f, fastTracker.covMatNotOK);
1120-
histos.fill(HIST("hCovMatOK"), 1.0f, fastTracker.covMatOK);
1119+
histos.fill(HIST("hCovMatOK"), 0.0f, fastTracker.GetCovMatNotOK());
1120+
histos.fill(HIST("hCovMatOK"), 1.0f, fastTracker.GetCovMatOK());
11211121
} // end process
11221122
};
11231123

0 commit comments

Comments
 (0)