Skip to content

Commit d04a89c

Browse files
authored
Merge branch 'AliceO2Group:dev' into new-detector4
2 parents 84943c2 + 18b692e commit d04a89c

87 files changed

Lines changed: 2166 additions & 1833 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/datamodel-doc.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
run: |
4949
python3 -m pip install --user -U numpy nltk
5050
python3 -m nltk.downloader -d ~/nltk_data punkt
51+
python3 -m nltk.downloader -d ~/nltk_data punkt_tab
5152
5253
- name: Generate documentation
5354
run: exec bash -exo pipefail O2/scripts/datamodel-doc/update-datamodel.sh
@@ -71,7 +72,7 @@ jobs:
7172
# Send pull request
7273
# We need to use "gh" ourselves because alisw/pull-request gets
7374
# confused when multiple repos are checked out.
74-
GH_TOKEN="$GITHUB_TOKEN" gh pr create -B master \
75+
GH_TOKEN="$GITHUB_TOKEN" gh pr create -R AliceO2Group/analysis-framework -B master \
7576
--no-maintainer-edit -t 'Automatic data model update' -b "This update \
7677
to the data model documentation was automatically created from \
7778
tonight's O2 dev branch." || true

Detectors/GlobalTracking/include/GlobalTracking/MatchGlobalFwd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class MatchGlobalFwd
333333
std::vector<o2::mft::TrackMFT> mMFTMatchPlaneParams; ///< MFT track parameters at matching plane
334334
std::vector<o2::track::TrackParCovFwd> mMCHMatchPlaneParams; ///< MCH track parameters at matching plane
335335

336-
std::map<int, std::vector<std::pair<int, int>>> mCandidates; ///< map each MCH track id to vector of best match candidates
336+
std::map<int, std::vector<std::pair<float, int>>> mCandidates; ///< map each MCH track id to vector of best match candidates
337337

338338
const o2::itsmft::TopologyDictionary* mMFTDict{nullptr}; // cluster patterns dictionary
339339
o2::itsmft::ChipMappingMFT mMFTMapping;

Detectors/GlobalTracking/src/MatchGlobalFwd.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,9 @@ void MatchGlobalFwd::ROFMatch(int MFTROFId, int firstMCHROFId, int lastMCHROFId)
494494
}
495495
}
496496

497-
if constexpr (saveAllMode == SaveMode::kSaveNCandidates) { // In saveAllmode save all pairs to output container
497+
if constexpr (saveAllMode == SaveMode::kSaveNCandidates) { // Save best N matching candidates
498498
auto score = mMatchFunc(thisMCHTrack, thisMFTTrack);
499-
std::pair<int, int> scoreID = {score, MFTId};
499+
std::pair<float, int> scoreID = {score, MFTId};
500500
mCandidates[MCHId].push_back(scoreID);
501501
std::sort(mCandidates[MCHId].begin(), mCandidates[MCHId].end(), compare);
502502
if (mCandidates[MCHId].size() > mNCandidates) {

Detectors/GlobalTracking/src/MatchTOF.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ bool MatchTOF::prepareTPCData()
449449
mTracksLblWork[sector][trkType::UNCONS].emplace_back(mTracksLblWork[sec][trkType::UNCONS][it]);
450450
}
451451
mLTinfos[sector][trkType::UNCONS].emplace_back(mLTinfos[sec][trkType::UNCONS][it]);
452+
mVZtpcOnly[sector].push_back(mVZtpcOnly[sec][it]);
452453
mTracksSectIndexCache[trkType::UNCONS][sector].push_back(itnew);
453454
}
454455
}

Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyTypes.h

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ namespace o2::trackstudy
2626
struct MCTrackInfo {
2727

2828
inline float getMCTimeMUS() const { return bcInTF * o2::constants::lhc::LHCBunchSpacingMUS; }
29+
inline bool hasITSHitOnLr(int i) const { return (pattITSCl & ((0x1 << i) & 0x7f)) != 0; }
30+
int getNITSClusCont() const;
31+
int getNITSClusForAB() const;
32+
int getLowestITSLayer() const;
33+
int getHighestITSLayer() const;
2934

3035
o2::track::TrackPar track{};
3136
o2::MCCompLabel label{};
@@ -44,16 +49,33 @@ struct MCTrackInfo {
4449
};
4550

4651
struct RecTrack {
52+
enum FakeFlag {
53+
FakeITS = 0x1 << 0,
54+
FakeTPC = 0x1 << 1,
55+
FakeTRD = 0x1 << 2,
56+
FakeTOF = 0x1 << 3,
57+
FakeITSTPC = 0x1 << 4,
58+
FakeITSTPCTRD = 0x1 << 5,
59+
FakeGLO = 0x1 << 7
60+
};
4761
o2::track::TrackParCov track{};
4862
o2::dataformats::VtxTrackIndex gid{};
4963
o2::dataformats::TimeStampWithError<float, float> ts{};
5064
o2::MCEventLabel pvLabel{};
51-
int pvID = -1;
65+
short pvID = -1;
66+
uint8_t flags = 0;
5267
uint8_t nClITS = 0;
5368
uint8_t nClTPC = 0;
5469
uint8_t pattITS = 0;
5570
int8_t lowestPadRow = -1;
56-
bool isFake = false;
71+
72+
bool isFakeGLO() const { return flags & FakeGLO; }
73+
bool isFakeITS() const { return flags & FakeITS; }
74+
bool isFakeTPC() const { return flags & FakeTPC; }
75+
bool isFakeTRD() const { return flags & FakeTRD; }
76+
bool isFakeTOF() const { return flags & FakeTOF; }
77+
bool isFakeITSTPC() const { return flags & FakeITSTPC; }
78+
5779
ClassDefNV(RecTrack, 1);
5880
};
5981

@@ -65,7 +87,10 @@ struct TrackFamily { // set of tracks related to the same MC label
6587
int8_t entITS = -1;
6688
int8_t entTPC = -1;
6789
int8_t entITSTPC = -1;
90+
int8_t entITSFound = -1; // ITS track for this MC track, regardless if it was matched to TPC of another track
91+
int8_t flags = 0;
6892
float tpcT0 = -999.;
93+
6994
bool contains(const o2::dataformats::VtxTrackIndex& ref) const
7095
{
7196
for (const auto& tr : recTracks) {
@@ -75,6 +100,11 @@ struct TrackFamily { // set of tracks related to the same MC label
75100
}
76101
return false;
77102
}
103+
const RecTrack& getTrackWithITS() const { return entITS < 0 ? dummyRecTrack : recTracks[entITS]; }
104+
const RecTrack& getTrackWithTPC() const { return entTPC < 0 ? dummyRecTrack : recTracks[entTPC]; }
105+
const RecTrack& getTrackWithITSTPC() const { return entITSTPC < 0 ? dummyRecTrack : recTracks[entITSTPC]; }
106+
const RecTrack& getTrackWithITSFound() const { return entITSFound < 0 ? dummyRecTrack : recTracks[entITSFound]; }
107+
static RecTrack dummyRecTrack; //
78108

79109
ClassDefNV(TrackFamily, 1);
80110
};

Detectors/GlobalTrackingWorkflow/study/src/TrackMCStudy.cxx

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,28 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
369369
trf.gid = vid; // account(iv, vid);
370370
trf.pvID = pvID;
371371
trf.pvLabel = pvLbl;
372+
while (dm[DetID::ITS] && dm[DetID::TPC]) { // this track should have both ITS and TPC parts, if ITS was mismatched, fill it to its proper MC track slot
373+
auto gidSet = recoData.getSingleDetectorRefs(vid);
374+
if (!gidSet[GTrackID::ITS].isSourceSet()) {
375+
break; // AB track, nothing to check
376+
}
377+
auto lblITS = recoData.getTrackMCLabel(gidSet[GTrackID::ITS]);
378+
if (lblITS == trackFamily.mcTrackInfo.label) {
379+
break; // correct match, no need for special treatment
380+
}
381+
const auto& trcITSF = recoData.getTrackParam(gidSet[GTrackID::ITS]);
382+
if (trcITSF.getPt() < params.minPt || std::abs(trcITSF.getTgl()) > params.maxTgl) {
383+
break; // ignore this track
384+
}
385+
auto entryOfFake = mSelMCTracks.find(lblITS);
386+
if (entryOfFake == mSelMCTracks.end()) { // this MC track was not selected
387+
break;
388+
}
389+
auto& trackFamilyOfFake = entryOfFake->second;
390+
auto& trfOfFake = trackFamilyOfFake.recTracks.emplace_back();
391+
trfOfFake.gid = gidSet[GTrackID::ITS]; // account(iv, vid);
392+
break;
393+
}
372394
if (mVerbose > 1) {
373395
LOGP(info, "Matched rec track {} to MC track {}", vid.asString(), entry->first.asString());
374396
}
@@ -408,28 +430,49 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
408430
int tcnt = 0;
409431
for (auto& tref : tracks) {
410432
if (tref.gid.isSourceSet()) {
433+
auto gidSet = recoData.getSingleDetectorRefs(tref.gid);
411434
tref.track = recoData.getTrackParam(tref.gid);
412-
tref.isFake = recoData.getTrackMCLabel(tref.gid).isFake();
435+
if (recoData.getTrackMCLabel(tref.gid).isFake()) {
436+
tref.flags |= RecTrack::FakeGLO;
437+
}
413438
auto msk = tref.gid.getSourceDetectorsMask();
414439
if (msk[DetID::ITS]) {
415-
auto gidITS = recoData.getITSContributorGID(tref.gid);
416-
tref.pattITS = getITSPatt(gidITS, tref.nClITS);
417-
if (gidITS.getSource() == VTIndex::ITS && trackFam.entITS < 0) { // has ITS track rather than AB tracklet
418-
trackFam.entITS = tcnt;
440+
if (gidSet[GTrackID::ITS].isSourceSet()) { // has ITS track rather than AB tracklet
441+
tref.pattITS = getITSPatt(gidSet[GTrackID::ITS], tref.nClITS);
442+
if (trackFam.entITS < 0) {
443+
trackFam.entITS = tcnt;
444+
}
445+
auto lblITS = recoData.getTrackMCLabel(gidSet[GTrackID::ITS]);
446+
if (lblITS.isFake()) {
447+
tref.flags |= RecTrack::FakeITS;
448+
}
449+
if (lblITS == trackFam.mcTrackInfo.label) {
450+
trackFam.entITSFound = tcnt;
451+
}
452+
} else { // AB ITS tracklet
453+
tref.pattITS = getITSPatt(gidSet[GTrackID::ITSAB], tref.nClITS);
454+
if (recoData.getTrackMCLabel(gidSet[GTrackID::ITSAB]).isFake()) {
455+
tref.flags |= RecTrack::FakeITS;
456+
}
419457
}
420458
if (msk[DetID::TPC] && trackFam.entITSTPC < 0) { // has both ITS and TPC contribution
421459
trackFam.entITSTPC = tcnt;
460+
if (recoData.getTrackMCLabel(gidSet[GTrackID::ITSTPC]).isFake()) {
461+
tref.flags |= RecTrack::FakeITSTPC;
462+
}
422463
}
423464
}
424465
if (msk[DetID::TPC]) {
425-
auto gidTPC = recoData.getTPCContributorGID(tref.gid);
426-
const auto& trtpc = recoData.getTPCTrack(gidTPC);
466+
const auto& trtpc = recoData.getTPCTrack(gidSet[GTrackID::TPC]);
427467
tref.nClTPC = trtpc.getNClusters();
428468
tref.lowestPadRow = getLowestPadrow(trtpc);
429469
if (trackFam.entTPC < 0) {
430470
trackFam.entTPC = tcnt;
431471
trackFam.tpcT0 = trtpc.getTime0();
432472
}
473+
if (recoData.getTrackMCLabel(gidSet[GTrackID::TPC]).isFake()) {
474+
tref.flags |= RecTrack::FakeTPC;
475+
}
433476
}
434477
float ts = 0, terr = 0;
435478
if (tref.gid.getSource() != GTrackID::ITS) {
@@ -473,16 +516,20 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
473516
std::string decTreeName = fmt::format("dec{}", params.decayPDG[id]);
474517
for (const auto& dec : mDecaysMaps[id]) {
475518
decFam.clear();
519+
bool skip = false;
476520
for (int idd = dec.daughterFirst; idd <= dec.daughterLast; idd++) {
477521
auto dtLbl = mDecProdLblPool[idd]; // daughter MC label
478522
const auto& dtFamily = mSelMCTracks[dtLbl];
479523
if (dtFamily.mcTrackInfo.pdgParent != dec.pdg) {
480524
LOGP(error, "{}-th decay (pdg={}): {} in {}:{} range refers to MC track with pdgParent = {}", id, params.decayPDG[id], idd, dec.daughterFirst, dec.daughterLast, dtFamily.mcTrackInfo.pdgParent);
481-
continue;
525+
skip = true;
526+
break;
482527
}
483528
decFam.push_back(dtFamily);
484529
}
485-
(*mDBGOut) << decTreeName.c_str() << "pdgPar=" << dec.pdg << "trPar=" << dec.parent << "prod=" << decFam << "\n";
530+
if (!skip) {
531+
(*mDBGOut) << decTreeName.c_str() << "pdgPar=" << dec.pdg << "trPar=" << dec.parent << "prod=" << decFam << "\n";
532+
}
486533
}
487534
}
488535

@@ -745,7 +792,7 @@ bool TrackMCStudy::addMCParticle(const MCTrack& mcPart, const o2::MCCompLabel& l
745792
mcEntry.mcTrackInfo.occITS = mITSOcc[lb.getEventID()];
746793
int moth = -1;
747794
o2::MCCompLabel mclbPar;
748-
if (!mcPart.isPrimary() && (moth = mcPart.getMotherTrackId()) >= 0) {
795+
if ((moth = mcPart.getMotherTrackId()) >= 0) {
749796
const auto& mcPartPar = mCurrMCTracks[moth];
750797
mcEntry.mcTrackInfo.pdgParent = mcPartPar.GetPdgCode();
751798
}

Detectors/GlobalTrackingWorkflow/study/src/TrackMCStudyTypes.cxx

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

1212
#include "GlobalTrackingStudy/TrackMCStudyTypes.h"
13+
14+
namespace o2::trackstudy
15+
{
16+
17+
RecTrack TrackFamily::dummyRecTrack;
18+
19+
// get longest number of clusters on consecutive layers
20+
int MCTrackInfo::getNITSClusCont() const
21+
{
22+
if (nITSCl < 2) {
23+
return nITSCl;
24+
}
25+
int longest = 0, current = 0;
26+
for (int i = 0; i < 7; i++) {
27+
if (pattITSCl & (0x1 << i)) {
28+
longest = ++current;
29+
} else {
30+
current = 0;
31+
}
32+
}
33+
return longest;
34+
}
35+
36+
// check how many clusters ITS-TPC afterburner could see (consecutively occupied layers starting from the last one)
37+
int MCTrackInfo::getNITSClusForAB() const
38+
{
39+
int ncl = 0;
40+
if (nITSCl) {
41+
for (int i = 6; i > 2; i--) {
42+
if (pattITSCl & (0x1 << i)) {
43+
ncl++;
44+
} else {
45+
break;
46+
}
47+
}
48+
}
49+
return ncl;
50+
}
51+
52+
// lowest ITS layer with cluster
53+
int MCTrackInfo::getLowestITSLayer() const
54+
{
55+
if (nITSCl) {
56+
for (int i = 0; i < 7; i++) {
57+
if (pattITSCl & (0x1 << i)) {
58+
return i;
59+
}
60+
}
61+
}
62+
return -1;
63+
}
64+
65+
// highest ITS layer with cluster
66+
int MCTrackInfo::getHighestITSLayer() const
67+
{
68+
if (nITSCl) {
69+
for (int i = 7; i--;) {
70+
if (pattITSCl & (0x1 << i)) {
71+
return i;
72+
}
73+
}
74+
}
75+
return -1;
76+
}
77+
78+
} // namespace o2::trackstudy

Detectors/TPC/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
148148
if (clusters.nTracks && clusters.solenoidBz != -1e6f && clusters.solenoidBz != mParam->bzkG) {
149149
throw std::runtime_error("Configured solenoid Bz does not match value used for track model encoding");
150150
}
151-
if (clusters.nTracks && clusters.maxTimeBin != -1e6 && clusters.maxTimeBin != mParam->par.continuousMaxTimeBin) {
151+
if (clusters.nTracks && clusters.maxTimeBin != -1e6 && clusters.maxTimeBin != mParam->continuousMaxTimeBin) {
152152
throw std::runtime_error("Configured max time bin does not match value used for track model encoding");
153153
}
154154
mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
@@ -162,7 +162,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
162162
const float totalT = std::max(mFastTransform->getMaxDriftTime(0), mFastTransform->getMaxDriftTime(GPUCA_NSLICES / 2));
163163

164164
unsigned int offset = 0, lasti = 0;
165-
const unsigned int maxTime = (mParam->par.continuousMaxTimeBin + 1) * o2::tpc::ClusterNative::scaleTimePacked - 1;
165+
const unsigned int maxTime = (mParam->continuousMaxTimeBin + 1) * o2::tpc::ClusterNative::scaleTimePacked - 1;
166166
#ifdef WITH_OPENMP
167167
#pragma omp parallel for firstprivate(offset, lasti) num_threads(mNThreads)
168168
#endif

Framework/AODMerger/src/aodStrainer.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ int main(int argc, char* argv[])
9898
auto outputFile = TFile::Open(outputFileName.c_str(), "RECREATE", "", 505);
9999
TDirectory* outputDir = nullptr;
100100
TString line(inputAO2D.c_str());
101-
if (line.BeginsWith("alien://")) {
102-
TGrid::Connect("alien:");
101+
if (line.BeginsWith("alien://") && !gGrid && !TGrid::Connect("alien:")) {
102+
printf("Error: Could not connect to AliEn.\n");
103+
return -1;
103104
}
104105
printf("Processing input file: %s\n", line.Data());
105106
auto inputFile = TFile::Open(line);

GPU/GPUTracking/Base/GPUParam.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void GPUParam::SetDefaults(float solenoidBz)
119119
par.assumeConstantBz = false;
120120
par.toyMCEventsFlag = false;
121121
par.continuousTracking = false;
122-
par.continuousMaxTimeBin = 0;
122+
continuousMaxTimeBin = 0;
123123
par.debugLevel = 0;
124124
par.earlyTpcTransform = false;
125125
}
@@ -131,7 +131,7 @@ void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessi
131131
par.assumeConstantBz = g->constBz;
132132
par.toyMCEventsFlag = g->homemadeEvents;
133133
par.continuousTracking = g->continuousMaxTimeBin != 0;
134-
par.continuousMaxTimeBin = g->continuousMaxTimeBin == -1 ? GPUSettings::TPC_MAX_TF_TIME_BIN : g->continuousMaxTimeBin;
134+
continuousMaxTimeBin = g->continuousMaxTimeBin == -1 ? GPUSettings::TPC_MAX_TF_TIME_BIN : g->continuousMaxTimeBin;
135135
}
136136
par.earlyTpcTransform = rec.tpc.forceEarlyTransform == -1 ? (!par.continuousTracking) : rec.tpc.forceEarlyTransform;
137137
qptB5Scaler = CAMath::Abs(bzkG) > 0.1f ? CAMath::Abs(bzkG) / 5.006680f : 1.f; // Repeat here, since passing in g is optional
@@ -140,9 +140,9 @@ void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessi
140140
UpdateRun3ClusterErrors(p->param.tpcErrorParamY, p->param.tpcErrorParamZ);
141141
}
142142
if (w) {
143-
par.dodEdx = w->steps.isSet(GPUDataTypes::RecoStep::TPCdEdx);
143+
par.dodEdx = dodEdxDownscaled = w->steps.isSet(GPUDataTypes::RecoStep::TPCdEdx);
144144
if (par.dodEdx && p && p->tpcDownscaledEdx != 0) {
145-
par.dodEdx = (rand() % 100) < p->tpcDownscaledEdx;
145+
dodEdxDownscaled = (rand() % 100) < p->tpcDownscaledEdx;
146146
}
147147
}
148148
}

0 commit comments

Comments
 (0)