Skip to content

Commit 3f7ce72

Browse files
authored
Merge 51b4524 into sapling-pr-archive-ehellbar
2 parents 58ffb89 + 51b4524 commit 3f7ce72

File tree

20 files changed

+352
-642
lines changed

20 files changed

+352
-642
lines changed

Detectors/ITSMFT/ITS/tracking/GPU/ITStrackingGPU/TrackingKernels.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,17 @@ void processNeighboursHandler(const int startLayer,
209209
template <int nLayers = 7>
210210
void trackSeedHandler(CellSeed<nLayers>* trackSeeds,
211211
const TrackingFrameInfo** foundTrackingFrameInfo,
212+
const Cluster** unsortedClusters,
212213
o2::its::TrackITSExt* tracks,
213-
std::vector<float>& minPtsHost,
214+
const std::vector<float>& layerRadiiHost,
215+
const std::vector<float>& minPtsHost,
214216
const unsigned int nSeeds,
215217
const float Bz,
216218
const int startLevel,
217-
float maxChi2ClusterAttachment,
218-
float maxChi2NDF,
219+
const float maxChi2ClusterAttachment,
220+
const float maxChi2NDF,
221+
const int reseedIfShorter,
222+
const bool shiftRefToCluster,
219223
const o2::base::Propagator* propagator,
220224
const o2::base::PropagatorF::MatCorrType matCorrType,
221225
const int nBlocks,

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackerTraitsGPU.cxx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,17 +325,21 @@ void TrackerTraitsGPU<nLayers>::findRoads(const int iteration)
325325
mTimeFrameGPU->createTrackITSExtDevice(trackSeeds);
326326
mTimeFrameGPU->loadTrackSeedsDevice(trackSeeds);
327327

328-
trackSeedHandler(mTimeFrameGPU->getDeviceTrackSeeds(), // CellSeed* trackSeeds
329-
mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(), // TrackingFrameInfo** foundTrackingFrameInfo
330-
mTimeFrameGPU->getDeviceTrackITSExt(), // o2::its::TrackITSExt* tracks
331-
this->mTrkParams[iteration].MinPt, // std::vector<float>& minPtsHost,
328+
trackSeedHandler(mTimeFrameGPU->getDeviceTrackSeeds(), // CellSeed*
329+
mTimeFrameGPU->getDeviceArrayTrackingFrameInfo(), // TrackingFrameInfo**
330+
mTimeFrameGPU->getDeviceArrayUnsortedClusters(), // Cluster**
331+
mTimeFrameGPU->getDeviceTrackITSExt(), // o2::its::TrackITSExt*
332+
this->mTrkParams[iteration].LayerRadii, // const std::vector<float>&
333+
this->mTrkParams[iteration].MinPt, // const std::vector<float>&
332334
trackSeeds.size(), // const size_t nSeeds
333335
this->mBz, // const float Bz
334336
startLevel, // const int startLevel,
335337
this->mTrkParams[0].MaxChi2ClusterAttachment, // float maxChi2ClusterAttachment
336338
this->mTrkParams[0].MaxChi2NDF, // float maxChi2NDF
337-
mTimeFrameGPU->getDevicePropagator(), // const o2::base::Propagator* propagator
338-
this->mTrkParams[0].CorrType, // o2::base::PropagatorImpl<float>::MatCorrType
339+
this->mTrkParams[0].ReseedIfShorter,
340+
this->mTrkParams[0].ShiftRefToCluster,
341+
mTimeFrameGPU->getDevicePropagator(), // const o2::base::Propagator* propagator
342+
this->mTrkParams[0].CorrType, // o2::base::PropagatorImpl<float>::MatCorrType
339343
conf.nBlocksTracksSeeds[iteration],
340344
conf.nThreadsTracksSeeds[iteration]);
341345

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu

Lines changed: 160 additions & 72 deletions
Large diffs are not rendered by default.

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Configuration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ struct TrackingParameters {
6666
o2::base::PropagatorImpl<float>::MatCorrType CorrType = o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrNONE;
6767
float MaxChi2ClusterAttachment = 60.f;
6868
float MaxChi2NDF = 30.f;
69-
int reseedIfShorter = 6; // reseed for the final fit track with the length shorter than this
69+
int ReseedIfShorter = 6; // reseed for the final fit track with the length shorter than this
7070
std::vector<float> MinPt = {0.f, 0.f, 0.f, 0.f};
7171
unsigned char StartLayerMask = 0x7F;
72-
bool shiftRefToCluster = true; // TrackFit: after update shift the linearization reference to cluster
72+
bool ShiftRefToCluster = true; // TrackFit: after update shift the linearization reference to cluster
7373
bool FindShortTracks = false;
7474
bool PerPrimaryVertexProcessing = false;
7575
bool SaveTimeBenchmarks = false;

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackerTraits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class TrackerTraits
9292
virtual int getTFNumberOfCells() const { return mTimeFrame->getNumberOfCells(); }
9393

9494
private:
95-
track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3);
95+
track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3, bool reverse = false);
9696
TrackITSExt seedTrackForRefit(const CellSeedN& seed);
9797
bool fitTrack(TrackITSExt& track, int start, int end, int step, float chi2clcut = o2::constants::math::VeryBig, float chi2ndfcut = o2::constants::math::VeryBig, float maxQoverPt = o2::constants::math::VeryBig, int nCl = 0, o2::track::TrackPar* refLin = nullptr);
9898

Detectors/ITSMFT/ITS/tracking/src/Configuration.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ std::vector<TrackingParameters> TrackingMode::getTrackingParameters(TrackingMode
186186
int lslot = tc.MaxTrackLength - ilg;
187187
p.MinPt[lslot] *= bFactor;
188188
}
189-
p.reseedIfShorter = tc.reseedIfShorter;
190-
p.shiftRefToCluster = tc.shiftRefToCluster;
189+
p.ReseedIfShorter = tc.reseedIfShorter;
190+
p.ShiftRefToCluster = tc.shiftRefToCluster;
191191
p.createArtefactLabels = tc.createArtefactLabels;
192192

193193
p.PrintMemory = tc.printMemory;

Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -765,15 +765,14 @@ void TrackerTraits<nLayers>::findRoads(const int iteration)
765765
auto forSeed = [&](auto Tag, int iSeed, int offset = 0) {
766766
TrackITSExt temporaryTrack = seedTrackForRefit(trackSeeds[iSeed]);
767767
o2::track::TrackPar linRef{temporaryTrack};
768-
o2::track::TrackParCov savTr = temporaryTrack; // REMOVE
769768
bool fitSuccess = fitTrack(temporaryTrack, 0, mTrkParams[0].NLayers, 1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF, o2::constants::math::VeryBig, 0, &linRef);
770769
if (!fitSuccess) {
771770
return 0;
772771
}
773772
temporaryTrack.getParamOut() = temporaryTrack.getParamIn();
774773
linRef = temporaryTrack.getParamOut(); // use refitted track as lin.reference
775774
temporaryTrack.resetCovariance();
776-
temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[14], 14);
775+
temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[o2::track::CovLabels::kSigQ2Pt2], o2::track::CovLabels::kSigQ2Pt2);
777776
temporaryTrack.setChi2(0);
778777
fitSuccess = fitTrack(temporaryTrack, mTrkParams[0].NLayers - 1, -1, -1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF, 50.f, 0, &linRef);
779778
if (!fitSuccess || temporaryTrack.getPt() < mTrkParams[iteration].MinPt[mTrkParams[iteration].NLayers - temporaryTrack.getNClusters()]) {
@@ -1082,7 +1081,7 @@ bool TrackerTraits<nLayers>::fitTrack(TrackITSExt& track, int start, int end, in
10821081
if (!track.o2::track::TrackParCov::update(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)) {
10831082
return false;
10841083
}
1085-
if (linRef && mTrkParams[0].shiftRefToCluster) { // displace the reference to the last updated cluster
1084+
if (linRef && mTrkParams[0].ShiftRefToCluster) { // displace the reference to the last updated cluster
10861085
linRef->setY(trackingHit.positionTrackingFrame[0]);
10871086
linRef->setZ(trackingHit.positionTrackingFrame[1]);
10881087
}
@@ -1208,27 +1207,22 @@ template <int nLayers>
12081207
TrackITSExt TrackerTraits<nLayers>::seedTrackForRefit(const CellSeedN& seed)
12091208
{
12101209
TrackITSExt temporaryTrack(seed);
1210+
int lrMin = nLayers, lrMax = 0, lrMid = 0;
12111211
for (int iL = 0; iL < nLayers; ++iL) {
1212-
temporaryTrack.setExternalClusterIndex(iL, seed.getCluster(iL), seed.getCluster(iL) != constants::UnusedIndex);
1212+
const int idx = seed.getCluster(iL);
1213+
temporaryTrack.setExternalClusterIndex(iL, idx, idx != constants::UnusedIndex);
1214+
if (idx != constants::UnusedIndex) {
1215+
lrMin = o2::gpu::CAMath::Min(lrMin, iL);
1216+
lrMax = o2::gpu::CAMath::Max(lrMax, iL);
1217+
}
12131218
}
12141219
int ncl = temporaryTrack.getNClusters();
1215-
if (ncl < mTrkParams[0].reseedIfShorter) { // reseed with circle passing via edges and the midpoint
1216-
int lrMin = 999, lrMax = 0, lrMid = 0;
1220+
if (ncl < mTrkParams[0].ReseedIfShorter) { // reseed with circle passing via edges and the midpoint
12171221
if (ncl == mTrkParams[0].NLayers) {
12181222
lrMin = 0;
12191223
lrMax = mTrkParams[0].NLayers - 1;
12201224
lrMid = (lrMin + lrMax) / 2;
12211225
} else {
1222-
for (int iL = 0; iL < nLayers; ++iL) {
1223-
if (seed.getCluster(iL) != constants::UnusedIndex) {
1224-
if (iL < lrMin) {
1225-
lrMin = iL;
1226-
}
1227-
if (iL > lrMax) {
1228-
lrMax = iL;
1229-
}
1230-
}
1231-
}
12321226
lrMid = lrMin + 1;
12331227
float midR = 0.5 * (mTrkParams[0].LayerRadii[lrMax] + mTrkParams[0].LayerRadii[lrMin]), dstMidR = o2::gpu::GPUCommonMath::Abs(midR - mTrkParams[0].LayerRadii[lrMid]);
12341228
for (int iL = lrMid + 1; iL < lrMax; ++iL) { // find the midpoint as closest to the midR
@@ -1242,45 +1236,48 @@ TrackITSExt TrackerTraits<nLayers>::seedTrackForRefit(const CellSeedN& seed)
12421236
const auto& cluster0_tf = mTimeFrame->getTrackingFrameInfoOnLayer(lrMin)[seed.getCluster(lrMin)]; // if the sensor frame!
12431237
const auto& cluster1_gl = mTimeFrame->getUnsortedClusters()[lrMid][seed.getCluster(lrMid)]; // global frame
12441238
const auto& cluster2_gl = mTimeFrame->getUnsortedClusters()[lrMax][seed.getCluster(lrMax)]; // global frame
1245-
temporaryTrack.getParamIn() = buildTrackSeed(cluster2_gl, cluster1_gl, cluster0_tf);
1246-
temporaryTrack.setQ2Pt(-temporaryTrack.getQ2Pt()); // we are calling buildTrackSeed with the clusters order opposite to what it expects
1247-
temporaryTrack.setSnp(-temporaryTrack.getSnp()); // we are calling buildTrackSeed with the clusters order opposite to what it expects
1239+
temporaryTrack.getParamIn() = buildTrackSeed(cluster2_gl, cluster1_gl, cluster0_tf, true);
12481240
}
12491241
temporaryTrack.resetCovariance();
1250-
temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[14], 14);
1242+
temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[o2::track::CovLabels::kSigQ2Pt2], o2::track::CovLabels::kSigQ2Pt2);
12511243
return temporaryTrack;
12521244
}
12531245

12541246
/// Clusters are given from inside outward (cluster3 is the outermost). The outermost cluster is given in the tracking
12551247
/// frame coordinates whereas the others are referred to the global frame.
12561248
template <int nLayers>
1257-
track::TrackParCov TrackerTraits<nLayers>::buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3)
1249+
track::TrackParCov TrackerTraits<nLayers>::buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3, bool reverse)
12581250
{
1259-
float ca{-999.f}, sa{-999.f};
1251+
const float sign = reverse ? -1.f : 1.f;
1252+
1253+
float ca, sa;
12601254
o2::gpu::CAMath::SinCos(tf3.alphaTrackingFrame, sa, ca);
1255+
12611256
const float x1 = cluster1.xCoordinate * ca + cluster1.yCoordinate * sa;
12621257
const float y1 = -cluster1.xCoordinate * sa + cluster1.yCoordinate * ca;
1263-
const float z1 = cluster1.zCoordinate;
12641258
const float x2 = cluster2.xCoordinate * ca + cluster2.yCoordinate * sa;
12651259
const float y2 = -cluster2.xCoordinate * sa + cluster2.yCoordinate * ca;
1266-
const float z2 = cluster2.zCoordinate;
12671260
const float x3 = tf3.xTrackingFrame;
12681261
const float y3 = tf3.positionTrackingFrame[0];
1269-
const float z3 = tf3.positionTrackingFrame[1];
1270-
float tgp{1.f}, crv{1.f}, snp{-999.f}, tgl12{-999.f}, tgl23{-999.f}, q2pt{1.f / track::kMostProbablePt}, q2pt2{1.f}, sg2q2pt{-999.f};
1262+
1263+
float snp, q2pt, q2pt2;
12711264
if (mIsZeroField) {
1272-
tgp = o2::gpu::CAMath::ATan2(y3 - y1, x3 - x1);
1273-
snp = tgp / o2::gpu::CAMath::Sqrt(1.f + tgp * tgp);
1265+
const float tgp = o2::gpu::CAMath::ATan2(y3 - y1, x3 - x1);
1266+
snp = sign * tgp / o2::gpu::CAMath::Sqrt(1.f + tgp * tgp);
1267+
q2pt = sign / track::kMostProbablePt;
1268+
q2pt2 = 1.f;
12741269
} else {
1275-
crv = math_utils::computeCurvature(x3, y3, x2, y2, x1, y1);
1276-
snp = crv * (x3 - math_utils::computeCurvatureCentreX(x3, y3, x2, y2, x1, y1));
1277-
q2pt = crv / (mBz * o2::constants::math::B2C);
1270+
const float crv = math_utils::computeCurvature(x3, y3, x2, y2, x1, y1);
1271+
snp = sign * crv * (x3 - math_utils::computeCurvatureCentreX(x3, y3, x2, y2, x1, y1));
1272+
q2pt = sign * crv / (mBz * o2::constants::math::B2C);
12781273
q2pt2 = crv * crv;
12791274
}
1280-
tgl12 = math_utils::computeTanDipAngle(x1, y1, x2, y2, z1, z2);
1281-
tgl23 = math_utils::computeTanDipAngle(x2, y2, x3, y3, z2, z3);
1282-
sg2q2pt = track::kC1Pt2max * (q2pt2 > 0.0005f ? (q2pt2 < 1.f ? q2pt2 : 1.f) : 0.0005f);
1283-
return {tf3.xTrackingFrame, tf3.alphaTrackingFrame, {y3, z3, snp, 0.5f * (tgl12 + tgl23), q2pt}, {tf3.covarianceTrackingFrame[0], tf3.covarianceTrackingFrame[1], tf3.covarianceTrackingFrame[2], 0.f, 0.f, track::kCSnp2max, 0.f, 0.f, 0.f, track::kCTgl2max, 0.f, 0.f, 0.f, 0.f, sg2q2pt}};
1275+
1276+
const float tgl = 0.5f * (math_utils::computeTanDipAngle(x1, y1, x2, y2, cluster1.zCoordinate, cluster2.zCoordinate) +
1277+
math_utils::computeTanDipAngle(x2, y2, x3, y3, cluster2.zCoordinate, tf3.positionTrackingFrame[1]));
1278+
const float sg2q2pt = track::kC1Pt2max * (q2pt2 > 0.0005f ? (q2pt2 < 1.f ? q2pt2 : 1.f) : 0.0005f);
1279+
1280+
return {x3, tf3.alphaTrackingFrame, {y3, tf3.positionTrackingFrame[1], snp, tgl, q2pt}, {tf3.covarianceTrackingFrame[0], tf3.covarianceTrackingFrame[1], tf3.covarianceTrackingFrame[2], 0.f, 0.f, track::kCSnp2max, 0.f, 0.f, 0.f, track::kCTgl2max, 0.f, 0.f, 0.f, 0.f, sg2q2pt}};
12841281
}
12851282

12861283
template <int nLayers>

Detectors/TPC/base/test/testTPCCalDet.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ BOOST_AUTO_TEST_CASE(CalDetStreamerTest)
351351
o2::tpc::DeadChannelMapCreator creator{};
352352
creator.init("https://alice-ccdb.cern.ch");
353353
creator.loadIDCPadFlags(1731274461770);
354+
creator.loadFEEConfig(1731274461770);
354355
}
355356

356357
} // namespace o2::tpc

Framework/Core/include/Framework/FairMQDeviceProxy.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ class FairMQDeviceProxy
3838
FairMQDeviceProxy() = default;
3939
FairMQDeviceProxy(FairMQDeviceProxy const&) = delete;
4040
void bind(std::vector<OutputRoute> const& outputs, std::vector<InputRoute> const& inputs,
41-
std::vector<ForwardRoute> const& forwards, fair::mq::Device& device);
41+
std::vector<ForwardRoute> const& forwards,
42+
std::function<fair::mq::Channel&(std::string const&)> bindChannelByName,
43+
std::function<bool(void)> newStateRequestedCallback);
4244

4345
/// Retrieve the transport associated to a given route.
4446
[[nodiscard]] OutputRoute const& getOutputRoute(RouteIndex routeIndex) const { return mOutputs.at(routeIndex.value); }

Framework/Core/src/CommonMessageBackends.cxx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,18 @@ o2::framework::ServiceSpec CommonMessageBackends::fairMQDeviceProxy()
5757
/// some of the channels are added only later on to the party,
5858
/// (e.g. by ECS) and Init might not be late enough to
5959
/// account for them.
60-
proxy->bind(outputs, inputs, forwards, *device); },
60+
std::function<fair::mq::Channel&(std::string const&)> bindByName = [device](std::string const& channelName) -> fair::mq::Channel& {
61+
auto channel = device->GetChannels().find(channelName);
62+
if (channel == device->GetChannels().end()) {
63+
LOGP(fatal, "Expected channel {} not configured.", channelName);
64+
}
65+
return channel->second.at(0);
66+
};
67+
68+
std::function<bool()> newStateCallback = [device]() -> bool {
69+
return device->NewStatePending();
70+
};
71+
proxy->bind(outputs, inputs, forwards, bindByName, newStateCallback); },
6172
};
6273
}
6374

0 commit comments

Comments
 (0)