Skip to content

Commit 22d1d5a

Browse files
authored
Merge branch 'master' into alice3Sim
2 parents c6200aa + c4f2d4e commit 22d1d5a

28 files changed

+1807
-548
lines changed

ALICE3/Core/FastTracker.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
442442
inputTrack.getXYZGlo(posIni);
443443
const float initialRadius = std::hypot(posIni[0], posIni[1]);
444444
const float kTrackingMargin = 0.1;
445-
const int kMaxNumberOfDetectors = 20;
446-
if (kMaxNumberOfDetectors < layers.size()) {
447-
LOG(fatal) << "Too many layers in FastTracker, increase kMaxNumberOfDetectors";
448-
return -1; // too many layers
449-
}
445+
450446
int firstActiveLayer = -1; // first layer that is not inert
451447
for (size_t i = 0; i < layers.size(); ++i) {
452448
if (!layers[i].isInert()) {
@@ -461,8 +457,12 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
461457
const int xrhosteps = 100;
462458
const bool applyAngularCorrection = true;
463459

460+
// Delphes sets this to 20 instead of the number of layers,
461+
// but does not count all points in the tpc as layers which we do here
462+
// Loop over all the added layers to prevent crash when adding the tpc
463+
// Should not affect efficiency calculation
464464
goodHitProbability.clear();
465-
for (int i = 0; i < kMaxNumberOfDetectors; ++i) {
465+
for (size_t i = 0; i < layers.size(); ++i) {
466466
goodHitProbability.push_back(-1.);
467467
}
468468
goodHitProbability[0] = 1.; // we use layer zero to accumulate
@@ -650,7 +650,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
650650

651651
// generate efficiency
652652
float eff = 1.;
653-
for (int i = 0; i < kMaxNumberOfDetectors; i++) {
653+
for (size_t i = 0; i < layers.size(); i++) {
654654
float iGoodHit = goodHitProbability[i];
655655
if (iGoodHit <= 0)
656656
continue;

ALICE3/DataModel/OTFMulticharm.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(XiCCPion, xiCCPion, int, Tracks, "_PiXiCC");
3636

3737
DECLARE_SOA_COLUMN(XicMass, xicMass, float);
3838
DECLARE_SOA_COLUMN(XiccMass, xiccMass, float);
39+
DECLARE_SOA_COLUMN(LUTConfigId, lutConfigId, int); //! Index for LUT configuration
3940

4041
// kine vars
4142
DECLARE_SOA_COLUMN(XiccPt, xiccPt, float);
@@ -155,7 +156,8 @@ DECLARE_SOA_TABLE(MCharmCores, "AOD", "MCharmCores",
155156
otfmulticharm::XiccProperLength,
156157
otfmulticharm::Pi1cPt,
157158
otfmulticharm::Pi2cPt,
158-
otfmulticharm::PiccPt);
159+
otfmulticharm::PiccPt,
160+
otfmulticharm::LUTConfigId);
159161

160162
DECLARE_SOA_TABLE(MCharmPID, "AOD", "MCharmPID",
161163
otfmulticharm::Pi1cTofDeltaInner,

ALICE3/DataModel/OTFTracks.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
///
13+
/// \file OTFTracks.h
14+
/// \author Jesper Karlsson Gumprecht
15+
/// \since 11/11/2025
16+
/// \brief Table to map track to LUT configuration
17+
///
18+
19+
#ifndef ALICE3_DATAMODEL_OTFTRACKS_H_
20+
#define ALICE3_DATAMODEL_OTFTRACKS_H_
21+
22+
// O2 includes
23+
#include "Framework/AnalysisDataModel.h"
24+
25+
namespace o2::aod
26+
{
27+
namespace otftracks
28+
{
29+
DECLARE_SOA_COLUMN(LUTConfigId, lutConfigId, int); //! Index for LUT configuration
30+
} // namespace otftracks
31+
32+
DECLARE_SOA_TABLE(OTFLUTConfigId, "AOD", "OTFLUTConfigId", otftracks::LUTConfigId);
33+
} // namespace o2::aod
34+
35+
#endif // ALICE3_DATAMODEL_OTFTRACKS_H_

ALICE3/TableProducer/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ o2physics_add_dpl_workflow(alice3-correlatorddbar
4545
SOURCES alice3-correlatorDDbar.cxx
4646
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter
4747
COMPONENT_NAME Analysis)
48+
49+
o2physics_add_dpl_workflow(alice3-tracking-translator
50+
SOURCES alice3TrackingTranslator.cxx
51+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter
52+
COMPONENT_NAME Analysis)

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 150 additions & 104 deletions
Large diffs are not rendered by default.

ALICE3/TableProducer/alice3-multicharmTable.cxx

Lines changed: 68 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "ALICE3/DataModel/OTFRICH.h"
2626
#include "ALICE3/DataModel/OTFStrangeness.h"
2727
#include "ALICE3/DataModel/OTFTOF.h"
28+
#include "ALICE3/DataModel/OTFTracks.h"
2829
#include "ALICE3/DataModel/tracksAlice3.h"
2930
#include "Common/Core/RecoDecay.h"
3031
#include "Common/Core/TrackSelection.h"
@@ -53,7 +54,9 @@
5354
#include <cstdlib>
5455
#include <iterator>
5556
#include <map>
57+
#include <string>
5658
#include <utility>
59+
#include <vector>
5760

5861
using namespace o2;
5962
using namespace o2::framework;
@@ -64,14 +67,15 @@ using std::array;
6467
// #define biton(var, nbit) ((var) |= (static_cast<uint32_t>(1) << (nbit)))
6568
#define bitoff(var, nbit) ((var) &= ~(static_cast<uint32_t>(1) << (nbit))) //((a) &= ~(1ULL<<(b)))
6669
#define bitcheck(var, nbit) ((var) & (static_cast<uint32_t>(1) << (nbit)))
70+
#define getHist(type, name) std::get<std::shared_ptr<type>>(histPointers[name])
6771

6872
using FullTracksExt = soa::Join<aod::Tracks, aod::TracksCov>;
6973

7074
// For MC association in pre-selection
7175
using labeledTracks = soa::Join<aod::Tracks, aod::McTrackLabels>;
7276
using tofTracks = soa::Join<aod::Tracks, aod::UpgradeTofs>;
7377
using richTracks = soa::Join<aod::Tracks, aod::UpgradeRichs, aod::UpgradeRichSignals>;
74-
using alice3tracks = soa::Join<aod::Tracks, aod::TracksCov, aod::Alice3DecayMaps, aod::McTrackLabels, aod::TracksDCA, aod::TracksExtraA3, aod::UpgradeTofs, aod::UpgradeTofExpectedTimes, aod::UpgradeRichs, aod::UpgradeRichSignals>;
78+
using alice3tracks = soa::Join<aod::Tracks, aod::TracksCov, aod::Alice3DecayMaps, aod::McTrackLabels, aod::TracksDCA, aod::TracksExtraA3, aod::UpgradeTofs, aod::UpgradeTofExpectedTimes, aod::UpgradeRichs, aod::UpgradeRichSignals, aod::OTFLUTConfigId>;
7579

7680
struct alice3multicharmTable {
7781
SliceCache cache;
@@ -111,7 +115,7 @@ struct alice3multicharmTable {
111115

112116
Configurable<float> minPiCPt{"minPiCPt", 0.15, "Minimum pT for XiC pions"};
113117
Configurable<float> minPiCCPt{"minPiCCPt", 0.3, "Minimum pT for XiCC pions"};
114-
Configurable<float> minNTracks{"minNTracks", -1, "Minimum number of tracks"};
118+
Configurable<std::vector<float>> minNTracks{"minNTracks", {-1}, "Minimum number of tracks"};
115119

116120
Configurable<float> minXiRadius{"minXiRadius", 0.5, "Minimum R2D for XiC decay (cm)"};
117121
Configurable<float> minXiCRadius{"minXiCRadius", 0.001, "Minimum R2D for XiC decay (cm)"};
@@ -149,6 +153,8 @@ struct alice3multicharmTable {
149153
o2::vertexing::DCAFitterN<3> fitter3;
150154

151155
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
156+
std::map<std::string, HistPtr> histPointers;
157+
std::vector<int> savedConfigs;
152158

153159
Partition<aod::McParticles> trueXi = aod::mcparticle::pdgCode == 3312;
154160
Partition<aod::McParticles> trueXiC = aod::mcparticle::pdgCode == 4232;
@@ -389,6 +395,15 @@ struct alice3multicharmTable {
389395
return returnValue;
390396
}
391397

398+
template <typename TTrackType>
399+
bool checkSameLUTConf(TTrackType const& track1, const int track2)
400+
{
401+
if (track1.lutConfigId() == track2) {
402+
return true;
403+
}
404+
return false;
405+
}
406+
392407
void init(InitContext&)
393408
{
394409
// initialize O2 2-prong fitter (only once)
@@ -484,6 +499,21 @@ struct alice3multicharmTable {
484499
}
485500
}
486501

502+
void initConf(const int icfg)
503+
{
504+
const bool confExists = std::find(savedConfigs.begin(), savedConfigs.end(), icfg) != savedConfigs.end();
505+
if (confExists) {
506+
return;
507+
}
508+
savedConfigs.push_back(icfg);
509+
510+
// do more plots
511+
std::string histPath = "Configuration_" + std::to_string(icfg) + "/";
512+
histPointers.insert({histPath + "hMassXiCC", histos.add((histPath + "hMassXiCC").c_str(), "hMassXiCC", {kTH1D, {{axisXiCCMass}}})});
513+
histPointers.insert({histPath + "hNCollisions", histos.add((histPath + "hNCollisions").c_str(), "hNCollisions", {kTH1D, {{2, 0.5, 2.5}}})});
514+
histPointers.insert({histPath + "hNTracks", histos.add((histPath + "hNTracks").c_str(), "hNTracks", {kTH1D, {{20000, 0, 20000}}})});
515+
}
516+
487517
//*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*
488518
void processGenerated(aod::McParticles const&)
489519
{
@@ -499,51 +529,50 @@ struct alice3multicharmTable {
499529
//*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*
500530
void processFindXiCC(aod::Collision const& collision, alice3tracks const& tracks, aod::McParticles const&, aod::UpgradeCascades const& cascades)
501531
{
502-
histos.fill(HIST("hNCollisions"), 1);
503-
histos.fill(HIST("hNTracks"), tracks.size());
504-
505-
if (tracks.size() < minNTracks)
506-
return;
507-
508-
histos.fill(HIST("hNCollisions"), 2);
509-
510532
// group with this collision
511533
// n.b. cascades do not need to be grouped, being used directly in iterator-grouping
512534
auto tracksPiFromXiCgrouped = tracksPiFromXiC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
513535
auto tracksPiFromXiCCgrouped = tracksPiFromXiCC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
514536

515-
if (doDCAplots) {
516-
for (auto const& cascade : cascades) {
517-
if (cascade.has_cascadeTrack()) {
518-
auto track = cascade.cascadeTrack_as<alice3tracks>(); // de-reference cascade track
519-
histos.fill(HIST("h2dDCAxyVsPtXiFromXiC"), track.pt(), track.dcaXY() * 1e+4);
520-
} else {
521-
LOGF(info, "Damn, something is wrong");
522-
}
523-
}
524-
for (auto const& track : tracks) {
525-
if (bitcheck(track.decayMap(), kTruePiFromXiC))
526-
histos.fill(HIST("h2dDCAxyVsPtPiFromXiC"), track.pt(), track.dcaXY() * 1e+4);
527-
if (bitcheck(track.decayMap(), kTruePiFromXiCC))
528-
histos.fill(HIST("h2dDCAxyVsPtPiFromXiCC"), track.pt(), track.dcaXY() * 1e+4);
529-
}
537+
static constexpr int kMaxLUTConfigs = 20;
538+
std::vector<int> nTracks(kMaxLUTConfigs);
539+
for (auto const& track : tracks) {
540+
int lutConfigId = track.lutConfigId();
541+
nTracks[lutConfigId]++;
542+
543+
if (bitcheck(track.decayMap(), kTruePiFromXiC))
544+
histos.fill(HIST("h2dDCAxyVsPtPiFromXiC"), track.pt(), track.dcaXY() * 1e+4);
545+
if (bitcheck(track.decayMap(), kTruePiFromXiCC))
546+
histos.fill(HIST("h2dDCAxyVsPtPiFromXiCC"), track.pt(), track.dcaXY() * 1e+4);
530547
}
531548

532549
for (auto const& xiCand : cascades) {
533-
histos.fill(HIST("hMassXi"), xiCand.mXi());
550+
auto xi = xiCand.cascadeTrack_as<alice3tracks>(); // de-reference cascade track
551+
int lutConfigId = xi.lutConfigId();
552+
initConf(lutConfigId);
553+
if (minNTracks.value.size() < static_cast<size_t>(lutConfigId)) {
554+
if (nTracks[lutConfigId] < minNTracks.value.front()) {
555+
continue; // fallback to first
556+
}
557+
} else {
558+
if (nTracks[lutConfigId] < minNTracks.value[lutConfigId]) {
559+
continue;
560+
}
561+
}
534562

563+
std::string histPath = "Configuration_" + std::to_string(lutConfigId) + "/";
564+
histos.fill(HIST("hMassXi"), xiCand.mXi());
565+
histos.fill(HIST("h2dDCAxyVsPtXiFromXiC"), xi.pt(), xi.dcaXY() * 1e+4);
535566
if (std::fabs(xiCand.mXi() - o2::constants::physics::MassXiMinus) > massWindowXi)
536567
continue; // out of mass region
537568

538569
uint32_t nCombinationsC = 0;
539-
auto xi = xiCand.cascadeTrack_as<alice3tracks>(); // de-reference cascade track
540570
auto piFromXi = xiCand.bachTrack_as<alice3tracks>(); // de-reference bach track
541571
auto piFromLa = xiCand.negTrack_as<alice3tracks>(); // de-reference neg track
542572
auto prFromLa = xiCand.posTrack_as<alice3tracks>(); // de-reference pos track
543573

544574
if (!bitcheck(xi.decayMap(), kTrueXiFromXiC))
545575
continue;
546-
547576
if (std::fabs(xi.dcaXY()) < xiFromXiC_dcaXYconstant || std::fabs(xi.dcaZ()) < xiFromXiC_dcaZconstant)
548577
continue; // likely a primary xi
549578

@@ -555,11 +584,12 @@ struct alice3multicharmTable {
555584

556585
histos.fill(HIST("hMinXiDecayRadius"), xiCand.cascRadius());
557586
for (auto const& pi1c : tracksPiFromXiCgrouped) {
587+
if (!checkSameLUTConf(pi1c, lutConfigId))
588+
continue;
558589
if (mcSameMotherCheck && !checkSameMother(xi, pi1c))
559590
continue;
560591
if (xiCand.posTrackId() == pi1c.globalIndex() || xiCand.negTrackId() == pi1c.globalIndex() || xiCand.bachTrackId() == pi1c.globalIndex())
561592
continue; // avoid using any track that was already used
562-
563593
if (pi1c.pt() < minPiCPt)
564594
continue; // too low momentum
565595

@@ -572,15 +602,14 @@ struct alice3multicharmTable {
572602
histos.fill(HIST("hInnerTOFTrackTimeRecoPi1c"), pi1cTOFDiffInner);
573603
// second pion from XiC decay for starts here
574604
for (auto const& pi2c : tracksPiFromXiCgrouped) {
605+
if (!checkSameLUTConf(pi2c, lutConfigId))
606+
continue;
575607
if (mcSameMotherCheck && !checkSameMother(xi, pi2c))
576608
continue; // keep only if same mother
577-
578609
if (pi1c.globalIndex() >= pi2c.globalIndex())
579610
continue; // avoid same-mother, avoid double-counting
580-
581611
if (xiCand.posTrackId() == pi2c.globalIndex() || xiCand.negTrackId() == pi2c.globalIndex() || xiCand.bachTrackId() == pi2c.globalIndex())
582612
continue; // avoid using any track that was already used
583-
584613
if (pi2c.pt() < minPiCPt)
585614
continue; // too low momentum
586615

@@ -644,6 +673,9 @@ struct alice3multicharmTable {
644673
// attempt XiCC finding
645674
uint32_t nCombinationsCC = 0;
646675
for (auto const& picc : tracksPiFromXiCCgrouped) {
676+
if (!checkSameLUTConf(picc, lutConfigId))
677+
continue;
678+
647679
if (mcSameMotherCheck && !checkSameMotherExtra(xi, picc))
648680
continue;
649681

@@ -736,6 +768,8 @@ struct alice3multicharmTable {
736768

737769
histos.fill(HIST("hCharmBuilding"), 3.0f);
738770
histos.fill(HIST("hMassXiCC"), thisXiCCcandidate.mass);
771+
getHist(TH1, histPath + "hMassXiCC")->Fill(thisXiCCcandidate.mass);
772+
739773
histos.fill(HIST("hPtXiCC"), thisXiCCcandidate.pt);
740774
histos.fill(HIST("hEtaXiCC"), thisXiCCcandidate.eta);
741775
histos.fill(HIST("h3dMassXiCC"), thisXiCCcandidate.pt, thisXiCCcandidate.eta, thisXiCCcandidate.mass);
@@ -762,9 +796,8 @@ struct alice3multicharmTable {
762796
xicProperLength,
763797
xicDecayDistanceFromPV,
764798
xiccProperLength,
765-
pi1c.pt(),
766-
pi2c.pt(),
767-
picc.pt());
799+
pi1c.pt(), pi2c.pt(), picc.pt(),
800+
lutConfigId);
768801

769802
multiCharmPID(
770803
pi1cTOFDiffInner, pi1c.nSigmaPionInnerTOF(),
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file alice3TrackingTranslator.cxx
13+
///
14+
/// \brief Translator task to convert tracking software to the AO2D format digestible with the O2Physics analysis framework
15+
///
16+
/// \author Nicolò Jacazio, Universita del Piemonte Orientale (IT)
17+
///
18+
19+
#include "ALICE3/DataModel/collisionAlice3.h"
20+
#include "ALICE3/DataModel/tracksAlice3.h"
21+
#include "Common/DataModel/TrackSelectionTables.h"
22+
23+
#include <Framework/AnalysisDataModel.h>
24+
#include <Framework/AnalysisHelpers.h>
25+
#include <Framework/AnalysisTask.h>
26+
#include <Framework/HistogramRegistry.h>
27+
#include <Framework/O2DatabasePDGPlugin.h>
28+
#include <Framework/runDataProcessing.h>
29+
30+
struct Alice3TrackingTranslator {
31+
o2::framework::Produces<o2::aod::Collisions> tableCollisions;
32+
o2::framework::Produces<o2::aod::McCollisionLabels> tableMcCollisionLabels;
33+
o2::framework::Produces<o2::aod::StoredTracks> tableStoredTracks;
34+
o2::framework::Produces<o2::aod::TracksExtension> tableTracksExtension;
35+
o2::framework::Produces<o2::aod::StoredTracksCov> tableStoredTracksCov;
36+
o2::framework::Produces<o2::aod::TracksCovExtension> tableTracksCovExtension;
37+
o2::framework::Produces<o2::aod::McTrackLabels> tableMcTrackLabels;
38+
o2::framework::Produces<o2::aod::TracksDCA> tableTracksDCA;
39+
o2::framework::Produces<o2::aod::TracksDCACov> tableTracksDCACov;
40+
o2::framework::Produces<o2::aod::CollisionsAlice3> tableCollisionsAlice3;
41+
o2::framework::Produces<o2::aod::TracksAlice3> tableTracksAlice3;
42+
o2::framework::Produces<o2::aod::TracksExtraA3> tableTracksExtraA3;
43+
44+
o2::framework::Produces<o2::aod::StoredTracksExtra_002> tableStoredTracksExtra;
45+
o2::framework::Produces<o2::aod::TrackSelection> tableTrackSelection;
46+
o2::framework::Produces<o2::aod::TrackSelectionExtension> tableTrackSelectionExtension;
47+
48+
void init(o2::framework::InitContext&)
49+
{
50+
// Initialization if needed
51+
LOG(info) << "Alice3TrackingTranslator init called";
52+
}
53+
54+
void process(o2::aod::BCs const&)
55+
{
56+
LOG(info) << "Alice3TrackingTranslator process called";
57+
}
58+
};
59+
60+
o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& cfgc)
61+
{
62+
o2::framework::WorkflowSpec w;
63+
w.push_back(adaptAnalysisTask<Alice3TrackingTranslator>(cfgc));
64+
return w;
65+
}

0 commit comments

Comments
 (0)