Skip to content

Commit 8b08256

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 9c12ab5 + 29f4897 commit 8b08256

File tree

60 files changed

+4998
-1758
lines changed

Some content is hidden

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

60 files changed

+4998
-1758
lines changed

Common/CCDB/RCTSelectionFlags.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
#define COMMON_CCDB_RCTSELECTIONFLAGS_H_
1919

2020
#include <CommonUtils/EnumFlags.h>
21-
#include <Rtypes.h>
21+
2222
#include <TMath.h>
2323

24-
#include <stdexcept>
24+
#include <Rtypes.h>
25+
2526
#include <algorithm>
27+
#include <stdexcept>
2628
#include <string>
2729
#include <vector>
2830

@@ -98,7 +100,7 @@ class RCTFlagsChecker : public o2::utils::EnumFlags<RCTSelectionFlags>
98100
// - "CBT"
99101
// - "CBT_hadronPID"
100102
// - "CBT_electronPID"
101-
// - "CCBT_calo"
103+
// - "CBT_calo"
102104
// - "CBT_muon"
103105
// - "CBT_muon_glo"
104106
// The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data)
@@ -121,7 +123,7 @@ class RCTFlagsChecker : public o2::utils::EnumFlags<RCTSelectionFlags>
121123
// - "CBT"
122124
// - "CBT_hadronPID"
123125
// - "CBT_electronPID"
124-
// - "CCBT_calo"
126+
// - "CBT_calo"
125127
// - "CBT_muon"
126128
// - "CBT_muon_glo"
127129
// The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data)

Common/Tools/Multiplicity/MultModule.h

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ class MultModule
440440
internalOpts.mEnabledTables.resize(nTablesConst, 0);
441441

442442
LOGF(info, "Configuring tables to generate");
443+
LOGF(info, "Metadata information: isMC? %i", metadataInfo.isMC());
443444
const auto& workflows = context.services().template get<o2::framework::RunningWorkflowInfo const>();
444445

445446
TString listOfRequestors[nTablesConst];
@@ -505,16 +506,6 @@ class MultModule
505506
listOfRequestors[kPVMults].Append(Form("%s ", "dependency check"));
506507
}
507508

508-
// capture the need for PYTHIA calibration in Pb-Pb runs
509-
if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) {
510-
internalOpts.generatorName.value = "PYTHIA";
511-
}
512-
513-
// capture the need for PYTHIA calibration in light ion runs automatically
514-
if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) {
515-
internalOpts.generatorName.value = "PYTHIA";
516-
}
517-
518509
// list enabled tables
519510
for (int i = 0; i < nTablesConst; i++) {
520511
// printout to be improved in the future
@@ -1145,6 +1136,20 @@ class MultModule
11451136
{
11461137
if (bc.runNumber() != mRunNumberCentrality) {
11471138
mRunNumberCentrality = bc.runNumber(); // mark that this run has been attempted already regardless of outcome
1139+
LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber());
1140+
1141+
// capture the need for PYTHIA calibration in Pb-Pb runs
1142+
if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) {
1143+
LOGF(info, "This is MC for Pb-Pb. Setting generatorName automatically to PYTHIA");
1144+
internalOpts.generatorName.value = "PYTHIA";
1145+
}
1146+
1147+
// capture the need for PYTHIA calibration in light ion runs automatically
1148+
if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) {
1149+
LOGF(info, "This is MC for light ion runs. Setting generatorName automatically to PYTHIA");
1150+
internalOpts.generatorName.value = "PYTHIA";
1151+
}
1152+
11481153
LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber());
11491154
TList* callst = nullptr;
11501155
// Check if the ccdb path is a root file
@@ -1258,6 +1263,10 @@ class MultModule
12581263
auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity, bool isInelGt0) {
12591264
const bool assignOutOfRange = internalOpts.embedINELgtZEROselection && !isInelGt0;
12601265
auto scaleMC = [](float x, const float pars[6]) {
1266+
float core = ((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4];
1267+
if (core < 0.0f) {
1268+
return 0.0f; // this should be marked as low multiplicity and not mapped, core^pars[5] would be NaN
1269+
}
12611270
return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]);
12621271
};
12631272

@@ -1343,6 +1352,10 @@ class MultModule
13431352
ConfigureCentralityRun2(ccdb, metadataInfo, firstbc);
13441353

13451354
auto scaleMC = [](float x, const float pars[6]) {
1355+
float core = ((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4];
1356+
if (core < 0.0f) {
1357+
return 0.0f; // this should be marked as low multiplicity and not mapped, core^pars[5] would be NaN
1358+
}
13461359
return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]);
13471360
};
13481361

EventFiltering/Zorro.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ std::vector<int> Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber
202202
mTOIidx.push_back(bin);
203203
}
204204
mTOIcounts.resize(mTOIs.size(), 0);
205+
mATcounts.resize(mSelections->GetNbinsX() - 2, 0);
205206
LOGF(info, "Zorro initialized for run %d, triggers of interest:", runNumber);
206207
for (size_t i{0}; i < mTOIs.size(); ++i) {
207208
LOGF(info, ">>> %s : %i", mTOIs[i].data(), mTOIidx[i]);
@@ -235,8 +236,11 @@ std::bitset<128> Zorro::fetch(uint64_t bcGlobalId, uint64_t tolerance)
235236
for (int iTOI{0}; iTOI < 64; ++iTOI) {
236237
if (mZorroHelpers->at(i).selMask[iMask] & (1ull << iTOI)) {
237238
mLastResult.set(iMask * 64 + iTOI, 1);
238-
if (mAnalysedTriggers && !mAccountedBCranges[i]) {
239-
mAnalysedTriggers->Fill(iMask * 64 + iTOI);
239+
if (!mAccountedBCranges[i]) {
240+
mATcounts[iMask * 64 + iTOI]++;
241+
if (mAnalysedTriggers) {
242+
mAnalysedTriggers->Fill(iMask * 64 + iTOI);
243+
}
240244
}
241245
}
242246
}

EventFiltering/Zorro.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class Zorro
5959
TH1D* getInspectedTVX() const { return mInspectedTVX; }
6060
std::bitset<128> getLastResult() const { return mLastResult; }
6161
std::vector<int> getTOIcounters() const { return mTOIcounts; }
62+
std::vector<int> getATcounters() const { return mATcounts; }
6263
std::vector<bool> getTriggerOfInterestResults(uint64_t bcGlobalId, uint64_t tolerance = 100);
6364
std::vector<bool> getTriggerOfInterestResults() const;
6465
int getNTOIs() const { return mTOIs.size(); }
@@ -98,6 +99,7 @@ class Zorro
9899
std::vector<std::string> mTOIs;
99100
std::vector<int> mTOIidx;
100101
std::vector<int> mTOIcounts;
102+
std::vector<int> mATcounts;
101103
o2::ccdb::BasicCCDBManager* mCCDB = nullptr;
102104
};
103105

PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx

Lines changed: 154 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,16 @@ using namespace o2::constants::physics;
7474
namespace o2::aod
7575
{
7676

77-
using FemtoFullCollision =
78-
soa::Join<aod::Collisions, aod::EvSels, aod::Mults>::iterator;
79-
using FemtoFullCollisionCentPP =
80-
soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::Mults>::iterator;
81-
using FemtoFullCollisionCentRun2 =
82-
soa::Join<aod::Collisions, aod::EvSels, aod::CentRun2V0Ms, aod::Mults>::iterator;
83-
using FemtoFullCollisionCentRun3 =
84-
soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults>::iterator;
77+
using FemtoFullCollision = soa::Join<aod::Collisions, aod::EvSels, aod::Mults>::iterator;
78+
using FemtoFullCollisionCentPP = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::Mults>::iterator;
79+
using FemtoFullCollisionCentRun2 = soa::Join<aod::Collisions, aod::EvSels, aod::CentRun2V0Ms, aod::Mults>::iterator;
80+
using FemtoFullCollisionCentRun3 = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults>::iterator;
8581
using FemtoFullCollisionMC = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::McCollisionLabels>::iterator;
86-
using FemtoFullCollisionCentRun3MCs =
87-
soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults, aod::McCollisionLabels>;
88-
using FemtoFullCollisionCentRun3MC =
89-
soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults, aod::McCollisionLabels>::iterator;
90-
using FemtoFullTracks =
91-
soa::Join<aod::FullTracks, aod::TracksDCA, aod::TOFSignal, aod::pidTPCEl, aod::TrackSelection,
92-
aod::pidTPCMu, aod::pidTPCPi, aod::pidTPCKa, aod::pidTPCPr,
93-
aod::pidTPCDe, aod::pidTOFEl, aod::pidTOFMu, aod::pidTOFPi,
94-
aod::pidTOFKa, aod::pidTOFPr, aod::pidTOFDe>;
82+
using FemtoFullCollisionCentRun3MCs = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults, aod::McCollisionLabels>;
83+
using FemtoFullCollisionCentRun3MC = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults, aod::McCollisionLabels>::iterator;
84+
using FemtoFullTracks = soa::Join<aod::FullTracks, aod::TracksDCA, aod::TOFSignal, aod::TrackSelection,
85+
aod::pidTPCEl, aod::pidTPCMu, aod::pidTPCPi, aod::pidTPCKa, aod::pidTPCPr, aod::pidTPCDe,
86+
aod::pidTOFEl, aod::pidTOFMu, aod::pidTOFPi, aod::pidTOFKa, aod::pidTOFPr, aod::pidTOFDe>;
9587

9688
// using FilteredFullV0s = soa::Filtered<aod::V0Datas>; /// predefined Join
9789
// table for o2::aod::V0s = soa::Join<o2::aod::TransientV0s, o2::aod::StoredV0s>
@@ -232,6 +224,8 @@ struct FemtoUniverseProducerTask {
232224
Configurable<bool> confV0RejectKaons{"confV0RejectKaons", false, "Switch to reject kaons"};
233225
Configurable<float> confV0InvKaonMassLowLimit{"confV0InvKaonMassLowLimit", 0.48, "Lower limit of the V0 invariant mass for Kaon rejection"};
234226
Configurable<float> confV0InvKaonMassUpLimit{"confV0InvKaonMassUpLimit", 0.515, "Upper limit of the V0 invariant mass for Kaon rejection"};
227+
228+
Configurable<std::vector<int>> confV0PDGMCTruth{"confV0PDGMCTruth", std::vector<int>{2212, -211, 3122}, "PDG codes of V0 daughters and mother, the order must be as follows -- positive daughter, negative daughter, mother"};
235229
} ConfV0Selection;
236230

237231
struct : o2::framework::ConfigurableGroup {
@@ -875,6 +869,37 @@ struct FemtoUniverseProducerTask {
875869
}
876870
}
877871

872+
template <typename MCParticleType>
873+
void fillMCTruthParticle(MCParticleType const& mcparticle, o2::aod::femtouniverseparticle::ParticleType fdparttype)
874+
{
875+
auto pdgCode = mcparticle.pdgCode();
876+
int particleOrigin = 99;
877+
878+
// Determine particle origin
879+
if (std::abs(pdgCode) == std::abs(confPDGCodePartOne.value) || std::abs(pdgCode) == std::abs(confPDGCodePartTwo.value)) {
880+
if (mcparticle.isPhysicalPrimary()) {
881+
particleOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kPrimary;
882+
} else {
883+
auto mothers = mcparticle.template mothers_as<aod::McParticles>();
884+
if (!mothers.empty()) {
885+
auto mother = mothers.front();
886+
if (mother.producedByGenerator()) {
887+
particleOrigin = checkDaughterType(fdparttype, mother.pdgCode());
888+
} else {
889+
particleOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kMaterial;
890+
}
891+
}
892+
}
893+
} else {
894+
particleOrigin = aod::femtouniverse_mc_particle::ParticleOriginMCTruth::kFake;
895+
}
896+
897+
// Fill MC companion tables
898+
outputPartsMC(particleOrigin, pdgCode, mcparticle.pt(), mcparticle.eta(), mcparticle.phi());
899+
fillDebugParticleMC(mcparticle);
900+
outputPartsMCLabels(outputPartsMC.lastIndex());
901+
}
902+
878903
template <typename ParticleType>
879904
void fillMCParticlePhi(ParticleType const& kaon1, ParticleType const& kaon2)
880905
{
@@ -1244,6 +1269,77 @@ struct FemtoUniverseProducerTask {
12441269
}
12451270
}
12461271

1272+
template <typename MCParticlesType>
1273+
void fillV0MCTruth(MCParticlesType const& mcParticles)
1274+
{
1275+
for (const auto& mc : mcParticles) { // Loop over all MC Truth particles
1276+
if (mc.pdgCode() != ConfV0Selection.confV0PDGMCTruth.value[2])
1277+
continue; // Artificially single out V0s
1278+
1279+
auto daughters = mc.template daughters_as<aod::McParticles>(); // Access daughters (no differentiation of signs, it needs to be checked separately)
1280+
1281+
bool foundPos = false, foundNeg = false;
1282+
1283+
std::vector<int> childIDs = {0, 0};
1284+
int rowPos = 0;
1285+
int rowNeg = 0;
1286+
1287+
for (auto const& d : daughters) { // Loop over daughters
1288+
if (d.pdgCode() == ConfV0Selection.confV0PDGMCTruth.value[0]) { // Check for a positive child
1289+
foundPos = true;
1290+
1291+
outputParts(outputCollision.lastIndex(),
1292+
d.pt(),
1293+
d.eta(),
1294+
d.phi(),
1295+
aod::femtouniverseparticle::ParticleType::kMCTruthTrack,
1296+
0,
1297+
0,
1298+
d.pdgCode(),
1299+
childIDs, // {0, 0}
1300+
0,
1301+
0);
1302+
rowPos = outputParts.lastIndex();
1303+
fillMCTruthParticle(d, aod::femtouniverseparticle::ParticleType::kMCTruthTrack);
1304+
} else if (d.pdgCode() == ConfV0Selection.confV0PDGMCTruth.value[1]) { // Check for a negative child
1305+
foundNeg = true;
1306+
1307+
outputParts(outputCollision.lastIndex(),
1308+
d.pt(),
1309+
d.eta(),
1310+
d.phi(),
1311+
aod::femtouniverseparticle::ParticleType::kMCTruthTrack,
1312+
0,
1313+
0,
1314+
d.pdgCode(),
1315+
childIDs, // {0, 0}
1316+
0,
1317+
0);
1318+
rowNeg = outputParts.lastIndex();
1319+
fillMCTruthParticle(d, aod::femtouniverseparticle::ParticleType::kMCTruthTrack);
1320+
}
1321+
}
1322+
1323+
if (!foundPos || !foundNeg)
1324+
continue;
1325+
1326+
childIDs[0] = rowPos;
1327+
childIDs[1] = rowNeg;
1328+
outputParts(outputCollision.lastIndex(),
1329+
mc.pt(),
1330+
mc.eta(),
1331+
mc.phi(),
1332+
aod::femtouniverseparticle::ParticleType::kMCTruthTrack,
1333+
0,
1334+
0,
1335+
mc.pdgCode(),
1336+
childIDs,
1337+
0,
1338+
0);
1339+
fillMCTruthParticle(mc, aod::femtouniverseparticle::ParticleType::kMCTruthTrack);
1340+
}
1341+
}
1342+
12471343
template <bool isMC, typename CollisionType, typename CascadeType, typename TrackType>
12481344
void fillCascade(CollisionType const& col, CascadeType const& fullCascades, TrackType const&)
12491345
{
@@ -2429,47 +2525,6 @@ struct FemtoUniverseProducerTask {
24292525
}
24302526
PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCV0, "Provide both MC truth and reco for tracks and V0s", false);
24312527

2432-
void processTruthAndFullMCCentRun3V0(
2433-
aod::McCollisions const& mccols,
2434-
aod::McParticles const& mcParticles,
2435-
aod::FemtoFullCollisionCentRun3MCs const& collisions,
2436-
soa::Filtered<soa::Join<aod::FemtoFullTracks, aod::McTrackLabels>> const& tracks,
2437-
soa::Join<o2::aod::V0Datas, aod::McV0Labels> const& fullV0s,
2438-
aod::BCsWithTimestamps const&)
2439-
{
2440-
2441-
// recos
2442-
std::set<int> recoMcIds;
2443-
for (const auto& col : collisions) {
2444-
auto groupedTracks = tracks.sliceBy(perCollisionTracks, col.globalIndex());
2445-
auto groupedV0Parts = fullV0s.sliceBy(perCollisionV0s, col.globalIndex());
2446-
getMagneticFieldTesla(col.bc_as<aod::BCsWithTimestamps>());
2447-
const auto colcheck = fillCollisionsCentRun3<false>(col);
2448-
if (colcheck) {
2449-
fillTracks<true>(groupedTracks);
2450-
fillV0<true>(col, groupedV0Parts, groupedTracks);
2451-
}
2452-
for (const auto& track : groupedTracks) {
2453-
if (trackCuts.isSelectedMinimal(track))
2454-
recoMcIds.insert(track.mcParticleId());
2455-
}
2456-
}
2457-
2458-
// truth
2459-
for (const auto& mccol : mccols) {
2460-
auto groupedCollisions = collisions.sliceBy(recoCollsPerMCCollCentPbPb, mccol.globalIndex());
2461-
for (const auto& col : groupedCollisions) {
2462-
const auto colcheck = fillMCTruthCollisionsCentRun3(col); // fills the reco collisions for mc collision
2463-
if (colcheck) {
2464-
auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex());
2465-
outputCollExtra(1.0, 1.0);
2466-
fillParticles<decltype(groupedMCParticles), true, true>(groupedMCParticles, recoMcIds); // fills mc particles
2467-
}
2468-
}
2469-
}
2470-
}
2471-
PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCCentRun3V0, "Provide both MC truth and reco for tracks and V0s with centrality", false);
2472-
24732528
Preslice<soa::Join<o2::aod::CascDatas, aod::McCascLabels>> perCollisionCascs = aod::track::collisionId;
24742529
void processTruthAndFullMCCasc(
24752530
aod::McCollisions const& mccols,
@@ -2673,6 +2728,47 @@ struct FemtoUniverseProducerTask {
26732728
}
26742729
PROCESS_SWITCH(FemtoUniverseProducerTask, processV0CentRun3Data, "Provide experimental data for Run 3 with centrality for track track", false);
26752730

2731+
void processTruthAndFullMCCentRun3V0(
2732+
aod::McCollisions const& mccols,
2733+
aod::McParticles const& mcParticles,
2734+
aod::FemtoFullCollisionCentRun3MCs const& collisions,
2735+
soa::Filtered<soa::Join<aod::FemtoFullTracks, aod::McTrackLabels>> const& tracks,
2736+
soa::Join<o2::aod::V0Datas, aod::McV0Labels> const& fullV0s,
2737+
aod::BCsWithTimestamps const&)
2738+
{
2739+
2740+
// MCReco
2741+
std::set<int> recoMcIds;
2742+
for (const auto& col : collisions) { // loop over collisions
2743+
auto groupedTracks = tracks.sliceBy(perCollisionTracks, col.globalIndex()); // slicing for tracks
2744+
auto groupedV0Parts = fullV0s.sliceBy(perCollisionV0s, col.globalIndex()); // slicing for V0
2745+
getMagneticFieldTesla(col.bc_as<aod::BCsWithTimestamps>());
2746+
const auto colcheck = fillCollisionsCentRun3<false>(col);
2747+
if (colcheck) {
2748+
fillTracks<true>(groupedTracks);
2749+
fillV0<true>(col, groupedV0Parts, groupedTracks);
2750+
}
2751+
for (const auto& track : groupedTracks) {
2752+
if (trackCuts.isSelectedMinimal(track))
2753+
recoMcIds.insert(track.mcParticleId());
2754+
}
2755+
}
2756+
2757+
// MCTruth
2758+
for (const auto& mccol : mccols) {
2759+
auto groupedCollisions = collisions.sliceBy(recoCollsPerMCCollCentPbPb, mccol.globalIndex()); // slicing for MC collisions
2760+
auto groupedMCParticles = mcParticles.sliceBy(perMCCollision, mccol.globalIndex()); // slicing for MC particles
2761+
for (const auto& col : groupedCollisions) {
2762+
const auto colcheck = fillMCTruthCollisionsCentRun3(col);
2763+
if (colcheck) {
2764+
outputCollExtra(1.0, 1.0);
2765+
fillV0MCTruth(groupedMCParticles); // fills MC V0s and its daughters
2766+
}
2767+
}
2768+
}
2769+
}
2770+
PROCESS_SWITCH(FemtoUniverseProducerTask, processTruthAndFullMCCentRun3V0, "Provide both MC truth and reco for tracks and V0s with centrality", false);
2771+
26762772
void processCascadeCentRun3Data(aod::FemtoFullCollisionCentRun3 const& col,
26772773
aod::BCsWithTimestamps const&,
26782774
soa::Filtered<aod::FemtoFullTracks> const& tracks,

0 commit comments

Comments
 (0)