Skip to content

Commit 8285661

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 2e35cfe + b5a757c commit 8285661

File tree

215 files changed

+17799
-7765
lines changed

Some content is hidden

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

215 files changed

+17799
-7765
lines changed

.github/labeler.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@ common:
99

1010
infrastructure:
1111
- changed-files:
12-
- any-glob-to-any-file: ['.github/**', 'cmake/**', 'dependencies/**', 'packaging/**']
12+
- any-glob-to-any-file:
13+
- '.clang-format'
14+
- '.clang-tidy'
15+
- '.flake8'
16+
- '.github/**'
17+
- '.checkov.yml'
18+
- '.mega-linter.yml'
19+
- 'cmake/**'
20+
- 'CODEOWNERS'
21+
- 'CPPLINT.cfg'
22+
- 'dependencies/**'
23+
- 'packaging/**'
24+
- 'pyproject.toml'
1325

1426
dpg:
1527
- changed-files:

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct OnTheFlyTracker {
8181
Produces<aod::UpgradeCascades> upgradeCascades;
8282

8383
// optionally produced, empty (to be tuned later)
84-
Produces<aod::StoredTracksExtra> tracksExtra; // base table, extend later
84+
Produces<aod::StoredTracksExtra_001> tracksExtra; // base table, extend later
8585
Produces<aod::TrackSelection> trackSelection;
8686
Produces<aod::TrackSelectionExtension> trackSelectionExtension;
8787

ALICE3/TableProducer/alice3-multicharm.cxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,14 @@ struct alice3multicharm {
499499
continue; // do not take if radius too small, likely a primary combination
500500

501501
o2::dataformats::DCA dcaInfo;
502-
float xicdcaXY = 1e+10, xicdcaZ = 1e+10;
502+
float xicdcaXY = 1e+10;
503503
o2::track::TrackParCov xicTrackCopy(xicTrack); // paranoia
504504

505505
o2::vertexing::PVertex primaryVertex;
506506
primaryVertex.setXYZ(collision.posX(), collision.posY(), collision.posZ());
507507

508508
if (xicTrackCopy.propagateToDCA(primaryVertex, magneticField, &dcaInfo)) {
509509
xicdcaXY = dcaInfo.getY();
510-
xicdcaZ = dcaInfo.getZ();
511510
}
512511

513512
histos.fill(HIST("hMassXiC"), thisXiCcandidate.mass);
@@ -543,10 +542,9 @@ struct alice3multicharm {
543542

544543
o2::track::TrackParCov xiccTrack(thisXiCCcandidate.xyz, momentumCC, thisXiCCcandidate.parentTrackCovMatrix, +2);
545544

546-
float xiccdcaXY = 1e+10, xiccdcaZ = 1e+10;
545+
float xiccdcaXY = 1e+10;
547546
if (xiccTrack.propagateToDCA(primaryVertex, magneticField, &dcaInfo)) {
548547
xiccdcaXY = dcaInfo.getY();
549-
xiccdcaZ = dcaInfo.getZ();
550548
}
551549

552550
// produce multi-charm table for posterior analysis

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
/PWGMM/UE @alibuild @aalkin @aortizve
5656

5757
/PWGUD @alibuild @pbuehler @abylinkin @rolavick
58-
/PWGJE @alibuild @lhavener @maoyx @nzardosh @ddobrigk @mfasDa
58+
/PWGJE @alibuild @lhavener @maoyx @nzardosh @fjonasALICE @mfasDa
5959
/Tools/PIDML @alibuild @saganatt
6060
/Tools/ML @alibuild @fcatalan92 @fmazzasc
6161
/Tutorials/PWGCF @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul

CPPLINT.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
filter=-build/c++11,-build/namespaces,-readability/fn_size,-readability/todo,-runtime/references,-whitespace/blank_line,-whitespace/braces,-whitespace/comments,-whitespace/line_length,-whitespace/semicolon,-whitespace/todo
1+
filter=-build/c++11,-build/namespaces,-readability/fn_size,-readability/todo,-runtime/references,-whitespace/blank_line,-whitespace/braces,-whitespace/comments,-whitespace/indent_namespace,-whitespace/line_length,-whitespace/semicolon,-whitespace/todo

Common/Core/RecoDecay.h

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
#include <algorithm> // std::find
2121
#include <array> // std::array
2222
#include <cmath> // std::abs, std::sqrt
23+
#include <cstdio>
2324
#include <utility> // std::move
2425
#include <vector> // std::vector
2526

2627
#include "TMCProcess.h" // for VMC Particle Production Process
28+
#include "TPDGCode.h" // for PDG codes
2729
#include "CommonConstants/MathConstants.h"
2830

2931
/// Base class for calculating properties of reconstructed decays
@@ -663,26 +665,33 @@ struct RecoDecay {
663665
/// Checks whether the reconstructed decay candidate is the expected decay.
664666
/// \param checkProcess switch to accept only decay daughters by checking the production process of MC particles
665667
/// \param acceptIncompleteReco switch to accept candidates with only part of the daughters reconstructed
668+
/// \tparam acceptTrackDecay switch to accept candidates with daughter tracks of pions and kaons which decayed
666669
/// \param particlesMC table with MC particles
667670
/// \param arrDaughters array of candidate daughters
668671
/// \param PDGMother expected mother PDG code
669672
/// \param arrPDGDaughters array of expected daughter PDG codes
670673
/// \param acceptAntiParticles switch to accept the antiparticle version of the expected decay
671674
/// \param sign antiparticle indicator of the found mother w.r.t. PDGMother; 1 if particle, -1 if antiparticle, 0 if mother not found
672675
/// \param depthMax maximum decay tree level to check; Daughters up to this level will be considered. If -1, all levels are considered.
676+
/// \param nPiToMu number of pion prongs decayed to a muon
677+
/// \param nKaToPi number of kaon prongs decayed to a pion
673678
/// \return index of the mother particle if the mother and daughters are correct, -1 otherwise
674-
template <bool acceptFlavourOscillation = false, bool checkProcess = false, bool acceptIncompleteReco = false, std::size_t N, typename T, typename U>
679+
template <bool acceptFlavourOscillation = false, bool checkProcess = false, bool acceptIncompleteReco = false, bool acceptTrackDecay = false, std::size_t N, typename T, typename U>
675680
static int getMatchedMCRec(const T& particlesMC,
676681
const std::array<U, N>& arrDaughters,
677682
int PDGMother,
678683
std::array<int, N> arrPDGDaughters,
679684
bool acceptAntiParticles = false,
680685
int8_t* sign = nullptr,
681-
int depthMax = 1)
686+
int depthMax = 1,
687+
int8_t* nPiToMu = nullptr,
688+
int8_t* nKaToPi = nullptr)
682689
{
683690
// Printf("MC Rec: Expected mother PDG: %d", PDGMother);
684691
int8_t coefFlavourOscillation = 1; // 1 if no B0(s) flavour oscillation occured, -1 else
685692
int8_t sgn = 0; // 1 if the expected mother is particle, -1 if antiparticle (w.r.t. PDGMother)
693+
int8_t nPiToMuLocal = 0; // number of pion prongs decayed to a muon
694+
int8_t nKaToPiLocal = 0; // number of kaon prongs decayed to a pion
686695
int indexMother = -1; // index of the mother particle
687696
std::vector<int> arrAllDaughtersIndex; // vector of indices of all daughters of the mother of the first provided daughter
688697
std::array<int, N> arrDaughtersIndex; // array of indices of provided daughters
@@ -708,6 +717,21 @@ struct RecoDecay {
708717
return -1;
709718
}
710719
auto particleI = arrDaughters[iProng].mcParticle(); // ith daughter particle
720+
if constexpr (acceptTrackDecay) {
721+
// Replace the MC particle associated with the prong by its mother for π → μ and K → π.
722+
auto motherI = particleI.template mothers_first_as<T>();
723+
auto pdgI = std::abs(particleI.pdgCode());
724+
auto pdgMotherI = std::abs(motherI.pdgCode());
725+
if (pdgI == kMuonMinus && pdgMotherI == kPiPlus) {
726+
// π → μ
727+
nPiToMuLocal++;
728+
particleI = motherI;
729+
} else if (pdgI == kPiPlus && pdgMotherI == kKPlus) {
730+
// K → π
731+
nKaToPiLocal++;
732+
particleI = motherI;
733+
}
734+
}
711735
arrDaughtersIndex[iProng] = particleI.globalIndex();
712736
// Get the list of daughter indices from the mother of the first prong.
713737
if (iProng == 0) {
@@ -780,6 +804,14 @@ struct RecoDecay {
780804
if (sign) {
781805
*sign = sgn;
782806
}
807+
if constexpr (acceptTrackDecay) {
808+
if (nPiToMu) {
809+
*nPiToMu = nPiToMuLocal;
810+
}
811+
if (nKaToPi) {
812+
*nKaToPi = nKaToPiLocal;
813+
}
814+
}
783815
return indexMother;
784816
}
785817

Common/Core/TPCVDriftManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ class TPCVDriftManager
116116
if (dDriftErr < 0.f || dDrift > 250.f) { // we cannot move a track outside the drift volume
117117
if (mOutside < mWarningLimit) {
118118
LOGP(warn, "Skipping correction outside of tpc volume with dDrift={} +- {}", dDrift, dDriftErr);
119-
const auto& trackBC = trackExtra.template collision_as<Collisions>().template foundBC_as<BCs>().globalBC();
120-
const auto& colBC = col.template foundBC_as<BCs>().globalBC();
119+
const auto trackBC = trackExtra.template collision_as<Collisions>().template foundBC_as<BCs>().globalBC();
120+
const auto colBC = col.template foundBC_as<BCs>().globalBC();
121121
int diffBC = colBC - trackBC;
122122
LOGP(info, "ct={}; ctr={}; tTB={}; t0={}; dTime={}; dDrift={}; tgl={}: colBC={} trackBC={} diffBC={}", col.collisionTime(), col.collisionTimeRes(), tTB, trackExtra.trackTime(), dTime, dDrift, track.getTgl(), colBC, trackBC, diffBC);
123123
if (mOutside == mWarningLimit - 1) {

Common/DataModel/TrackSelectionTables.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct TrackSelectionFlags {
6060
static constexpr flagtype kGlobalTrackWoTPCCluster = kQualityTracksWoTPCCluster | kPrimaryTracks | kInAcceptanceTracks;
6161
static constexpr flagtype kGlobalTrackWoPtEta = kQualityTracks | kPrimaryTracks;
6262
static constexpr flagtype kGlobalTrackWoDCA = kQualityTracks | kInAcceptanceTracks;
63+
static constexpr flagtype kGlobalTrackWoDCAxy = kQualityTracks | kInAcceptanceTracks | kDCAz;
6364
static constexpr flagtype kGlobalTrackWoDCATPCCluster = kQualityTracksWoTPCCluster | kInAcceptanceTracks;
6465

6566
/// @brief Function to check flag content

Common/TableProducer/Converters/bcFlagsCreator.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct bcFlagsCreator {
2222

2323
void process(aod::BCs const& bcTable)
2424
{
25-
for (auto& _ : bcTable) {
25+
for (int64_t i = 0; i < bcTable.size(); ++i) {
2626
bcFlags(0);
2727
}
2828
}

Common/TableProducer/ft0CorrectedTable.cxx

Lines changed: 157 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,89 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include <bitset>
13-
#include "Common/DataModel/FT0Corrected.h"
1413
#include "Framework/ConfigParamSpec.h"
1514
#include "Framework/runDataProcessing.h"
1615
#include "Framework/AnalysisTask.h"
17-
#include "Common/DataModel/EventSelection.h"
1816
#include "Framework/AnalysisDataModel.h"
17+
#include "Framework/HistogramRegistry.h"
18+
#include "Common/DataModel/FT0Corrected.h"
19+
#include "Common/DataModel/EventSelection.h"
1920
#include "CommonConstants/LHCConstants.h"
2021
#include "CommonConstants/PhysicsConstants.h"
2122
#include "DataFormatsFT0/Digit.h"
23+
#include "CCDB/BasicCCDBManager.h"
24+
#include "CollisionTypeHelper.h"
25+
#include "TRandom3.h"
2226

2327
using namespace o2;
2428
using namespace o2::framework;
25-
2629
using namespace o2::aod;
27-
struct FT0CorrectedTable {
30+
31+
struct ft0CorrectedTable {
32+
// Configurables
33+
Configurable<float> resoFT0A{"resoFT0A", 20.f, "FT0A resolution"};
34+
Configurable<float> resoFT0C{"resoFT0C", 20.f, "FT0C resolution"};
35+
Configurable<bool> addHistograms{"addHistograms", false, "Add QA histograms"};
36+
Configurable<int> cfgCollisionSystem{"collisionSystem", -2, "Collision system: -2 (use cfg values), -1 (autoset), 0 (pp), 1 (PbPb), 2 (XeXe), 3 (pPb)"};
37+
Configurable<std::string> cfgUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
38+
Configurable<std::string> cfgPathGrpLhcIf{"ccdb-path-grplhcif", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};
39+
Configurable<int64_t> cfgTimestamp{"ccdb-timestamp", -1, "timestamp of the object"};
40+
Service<o2::ccdb::BasicCCDBManager> ccdb;
41+
42+
// Producer
2843
Produces<o2::aod::FT0sCorrected> table;
2944
using BCsWithMatchings = soa::Join<aod::BCs, aod::Run3MatchedToBCSparse>;
3045
using CollisionEvSel = soa::Join<aod::Collisions, aod::EvSels>::iterator;
46+
static constexpr float invLightSpeedCm2NS = 1.f / o2::constants::physics::LightSpeedCm2NS;
3147

32-
void process(BCsWithMatchings const&, soa::Join<aod::Collisions, aod::EvSels> const& collisions, aod::FT0s const&)
48+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
49+
void init(o2::framework::InitContext&)
3350
{
51+
if (doprocessStandard && doprocessWithBypassFT0timeInMC) {
52+
LOG(fatal) << "Both processStandard and processWithBypassFT0timeInMC are enabled. Pick one of the two";
53+
}
54+
if (!doprocessStandard && !doprocessWithBypassFT0timeInMC) {
55+
LOG(fatal) << "No process is enabled. Pick one";
56+
}
57+
ccdb->setURL(cfgUrl);
58+
ccdb->setTimestamp(cfgTimestamp);
59+
ccdb->setCaching(true);
60+
ccdb->setLocalObjectValidityChecking();
61+
// Not later than now objects
62+
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
63+
64+
if (!addHistograms) {
65+
return;
66+
}
67+
histos.add("t0A", "t0A", kTH1D, {{1000, -1, 1, "t0A (ns)"}});
68+
histos.add("t0C", "t0C", kTH1D, {{1000, -1, 1, "t0C (ns)"}});
69+
histos.add("t0AC", "t0AC", kTH1D, {{1000, -1000, 1000, "t0AC (ns)"}});
70+
histos.add("deltat0AC", "deltat0AC", kTH1D, {{1000, -10, 10, "#Deltat0AC (ns)"}});
71+
if (doprocessWithBypassFT0timeInMC) {
72+
histos.add("MC/deltat0A", "t0A", kTH1D, {{1000, -50, 50, "t0A (ps)"}});
73+
histos.add("MC/deltat0C", "t0C", kTH1D, {{1000, -50, 50, "t0C (ps)"}});
74+
histos.add("MC/deltat0AC", "t0AC", kTH1D, {{1000, -50, 50, "t0AC (ps)"}});
75+
}
76+
}
77+
78+
void processStandard(soa::Join<aod::Collisions, aod::EvSels> const& collisions,
79+
BCsWithMatchings const&,
80+
aod::FT0s const&)
81+
{
82+
table.reserve(collisions.size());
83+
float t0A = 1e10f;
84+
float t0C = 1e10f;
3485
for (auto& collision : collisions) {
35-
float vertexPV = collision.posZ();
36-
float vertex_corr = vertexPV / o2::constants::physics::LightSpeedCm2NS;
37-
float t0A = 1e10;
38-
float t0C = 1e10;
86+
t0A = 1e10f;
87+
t0C = 1e10f;
88+
const float vertexPV = collision.posZ();
89+
const float vertex_corr = vertexPV * invLightSpeedCm2NS;
3990
constexpr float dummyTime = 30.; // Due to HW limitations time can be only within range (-25,25) ns, dummy time is around 32 ns
4091
if (collision.has_foundFT0()) {
41-
auto ft0 = collision.foundFT0();
42-
std::bitset<8> triggers = ft0.triggerMask();
43-
bool ora = triggers[o2::ft0::Triggers::bitA];
44-
bool orc = triggers[o2::ft0::Triggers::bitC];
92+
const auto& ft0 = collision.foundFT0();
93+
const std::bitset<8>& triggers = ft0.triggerMask();
94+
const bool ora = triggers[o2::ft0::Triggers::bitA];
95+
const bool orc = triggers[o2::ft0::Triggers::bitC];
4596
LOGF(debug, "triggers OrA %i OrC %i ", ora, orc);
4697
LOGF(debug, " T0A = %f, T0C %f, vertex_corr %f", ft0.timeA(), ft0.timeC(), vertex_corr);
4798
if (ora && ft0.timeA() < dummyTime) {
@@ -52,11 +103,100 @@ struct FT0CorrectedTable {
52103
}
53104
}
54105
LOGF(debug, " T0 collision time T0A = %f, T0C = %f", t0A, t0C);
106+
if (addHistograms) {
107+
histos.fill(HIST("t0A"), t0A);
108+
histos.fill(HIST("t0C"), t0C);
109+
histos.fill(HIST("t0AC"), (t0A + t0C) * 0.5f);
110+
histos.fill(HIST("deltat0AC"), t0A - t0C);
111+
}
112+
table(t0A, t0C);
113+
}
114+
}
115+
PROCESS_SWITCH(ft0CorrectedTable, processStandard, "Process standard table (default)", true);
116+
117+
void processWithBypassFT0timeInMC(soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const& collisions,
118+
soa::Join<BCsWithMatchings, aod::Timestamps> const& bcs,
119+
aod::FT0s const&,
120+
aod::McCollisions const&)
121+
{
122+
if (cfgCollisionSystem.value == -1) {
123+
o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp<o2::parameters::GRPLHCIFData>(cfgPathGrpLhcIf,
124+
bcs.iteratorAt(0).timestamp());
125+
cfgCollisionSystem.value = CollisionSystemType::getCollisionTypeFromGrp(grpo);
126+
switch (cfgCollisionSystem.value) {
127+
case CollisionSystemType::kCollSyspp:
128+
resoFT0A.value = 24.f;
129+
resoFT0C.value = 24.f;
130+
break;
131+
case CollisionSystemType::kCollSysPbPb:
132+
resoFT0A.value = 5.65f;
133+
resoFT0C.value = 5.65f;
134+
break;
135+
default:
136+
break;
137+
}
138+
}
139+
table.reserve(collisions.size());
140+
float t0A = 1e10f;
141+
float t0C = 1e10f;
142+
float eventtimeMC = 1e10f;
143+
float posZMC = 0;
144+
bool hasMCcoll = false;
145+
146+
for (auto& collision : collisions) {
147+
hasMCcoll = false;
148+
eventtimeMC = 1e10f;
149+
t0A = 1e10f;
150+
t0C = 1e10f;
151+
posZMC = 0;
152+
const float vertexPV = collision.posZ();
153+
const float vertex_corr = vertexPV * invLightSpeedCm2NS;
154+
constexpr float dummyTime = 30.; // Due to HW limitations time can be only within range (-25,25) ns, dummy time is around 32 ns
155+
if (collision.has_mcCollision()) {
156+
hasMCcoll = true;
157+
const auto& collisionMC = collision.mcCollision();
158+
eventtimeMC = collisionMC.t();
159+
posZMC = collisionMC.posZ();
160+
}
161+
if (collision.has_foundFT0()) {
162+
const auto& ft0 = collision.foundFT0();
163+
const std::bitset<8>& triggers = ft0.triggerMask();
164+
const bool ora = triggers[o2::ft0::Triggers::bitA];
165+
const bool orc = triggers[o2::ft0::Triggers::bitC];
166+
167+
if (ora && ft0.timeA() < dummyTime) {
168+
t0A = ft0.timeA();
169+
if (hasMCcoll) {
170+
const float diff = eventtimeMC - posZMC * invLightSpeedCm2NS + gRandom->Gaus(0.f, resoFT0A);
171+
t0A = diff;
172+
}
173+
t0A += vertex_corr;
174+
}
175+
if (orc && ft0.timeC() < dummyTime) {
176+
t0C = ft0.timeC();
177+
if (hasMCcoll) {
178+
const float diff = eventtimeMC + posZMC * invLightSpeedCm2NS + gRandom->Gaus(0.f, resoFT0C);
179+
t0C = diff;
180+
}
181+
t0C -= vertex_corr;
182+
}
183+
}
184+
LOGF(debug, " T0 collision time T0A = %f, T0C = %f", t0A, t0C);
185+
if (addHistograms) {
186+
histos.fill(HIST("t0A"), t0A);
187+
histos.fill(HIST("t0C"), t0C);
188+
histos.fill(HIST("t0AC"), (t0A + t0C) * 0.5f);
189+
histos.fill(HIST("deltat0AC"), t0A - t0C);
190+
if (hasMCcoll) {
191+
histos.fill(HIST("MC/deltat0A"), (t0A - eventtimeMC) * 1000.f);
192+
histos.fill(HIST("MC/deltat0C"), (t0C - eventtimeMC) * 1000.f);
193+
histos.fill(HIST("MC/deltat0AC"), ((t0A + t0C) * 0.5f - eventtimeMC) * 1000.f);
194+
}
195+
}
55196
table(t0A, t0C);
56197
}
57198
}
199+
PROCESS_SWITCH(ft0CorrectedTable, processWithBypassFT0timeInMC, "Process MC with bypass of the AO2D information. Use with care!", false);
58200
};
59-
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
60-
{
61-
return WorkflowSpec{adaptAnalysisTask<FT0CorrectedTable>(cfgc, TaskName{"ft0-corrected-table"})};
62-
}
201+
202+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<ft0CorrectedTable>(cfgc)}; }

0 commit comments

Comments
 (0)