Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions PWGCF/Femto/Core/cascadeBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,44 @@ class CascadeBuilderDerivedToDerived
}
}

/// Same as processXis, but also resolves the daughters' MC labels (via the
/// MC-aware trackBuilder.getDaughterIndex overload) and writes the xi's own
/// FXiLabels row. xiTable must be joined with FXiLabels upstream.
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
void processXisWithMc(T1 const& col, T2 const& /*xiTable*/, T3 const& oldTrackTable, T4& partitionXi, T5& trackBuilder, T6& cache, T7& newXiTable, T8& newTrackTable, T9& newCollisionTable,
T10& mcBuilder, T11 const& mcCols, T12 const& mcParticles, T13 const& mcMothers, T14 const& mcPartonicMothers, auto& mcProducts)
{
if (mLimitXi == 0) { // xis disabled
return;
}

auto xiSlice = partitionXi->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache);

for (auto const& xi : xiSlice) {
auto bachelor = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.bachelorId(), oldTrackTable));
auto posDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.posDauId(), oldTrackTable));
auto negDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(xi.negDauId(), oldTrackTable));

int64_t bachelorIndex = trackBuilder.getDaughterIndex(bachelor, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
int64_t posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
int64_t negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);

newXiTable.producedXis(newCollisionTable.producedCollision.lastIndex(),
xi.signedPt(),
xi.eta(),
xi.phi(),
xi.mass(),
bachelorIndex,
posDaughterIndex,
negDaughterIndex);
newXiTable.producedXiMasks(xi.mask());
if constexpr (utils::HasCascadeCosPa<decltype(xi)>) {
newXiTable.producedXiFrac(xi.cascadeCosPa());
}
mcBuilder.fillXiWithLabel(xi, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
}
}

template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
void processOmegas(T1 const& col, T2 const& /*omegaTable*/, T3 const& oldTrackTable, T4& partitionOmega, T5& trackBuilder, T6& cache, T7& newOmegaTable, T8& newTrackTable, T9& newCollisionTable)
{
Expand Down
7 changes: 5 additions & 2 deletions PWGCF/Femto/Core/collisionBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct ConfCollisionBits : o2::framework::ConfigurableGroup {
o2::framework::Configurable<std::vector<float>> sphericityMin{"sphericityMin", {}, "Minimum sphericity"};
o2::framework::Configurable<std::vector<float>> sphericityMax{"sphericityMax", {}, "Maximum sphericity"};
o2::framework::Configurable<std::vector<std::string>> triggers{"triggers", {}, "List of all triggers to be used"};
o2::framework::Configurable<int> triggerBcTolerance{"triggerBcTolerance", 100, "Tolerance for +-(bc range) around triggered collisions"};
o2::framework::Configurable<int> eventPlaneAngleDetector{"eventPlaneAngleDetector", 0, "Detector used to estimate the event plane angle: 0 -> FT0C, 1 -> FT0A"};
o2::framework::Configurable<int> qvecDetector{"qvecDetector", 0, "Detector used to estimate the Q-vector: 0 -> FT0C, 1 -> FT0A"};
o2::framework::Configurable<int> qvecHarmonic{"qvecHarmonic", 2, "Harmonic n of the Q-vector and event plane angle Psi_n: 2 -> elliptic, 3 -> triangular"};
Expand Down Expand Up @@ -235,6 +236,7 @@ class CollisionSelection : public baseselection::BaseSelection<float, o2::analys
// trigger (Zorro) setup
if (!config.triggers.value.empty()) {
mUseTrigger = true;
mTriggerBcTolerance = config.triggerBcTolerance.value;
for (size_t i = 0; i < config.triggers.value.size(); ++i) {
mTriggerNames += config.triggers.value[i];
if (i != config.triggers.value.size() - 1) {
Expand Down Expand Up @@ -309,7 +311,7 @@ class CollisionSelection : public baseselection::BaseSelection<float, o2::analys
return;
}
LOG(info) << "Init Zorro with Run Number: " << runNumber << "; timestamp: " << timestamp << "; Trigger Names: " << mTriggerNames;
mZorro.initCCDB(ccdb.service, runNumber, timestamp, mTriggerNames);
mZorro.initCCDB(ccdb.service, runNumber, timestamp, mTriggerNames, mTriggerBcTolerance);
mZorro.populateHistRegistry(histRegistry, runNumber);
}

Expand All @@ -320,7 +322,7 @@ class CollisionSelection : public baseselection::BaseSelection<float, o2::analys
if (!mUseTrigger) {
return {};
}
return mZorro.getTriggerOfInterestResults(globalBC);
return mZorro.getTriggerOfInterestResults(globalBC, mTriggerBcTolerance);
}

void setMagneticField(int MagField)
Expand Down Expand Up @@ -587,6 +589,7 @@ class CollisionSelection : public baseselection::BaseSelection<float, o2::analys
// trigger (Zorro)
Zorro mZorro;
bool mUseTrigger = false;
int mTriggerBcTolerance = 100;
std::string mTriggerNames = std::string("");
};

Expand Down
28 changes: 28 additions & 0 deletions PWGCF/Femto/Core/mcBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,8 @@ struct McBuilderDerivedToDerivedProducts : o2::framework::ProducesGroup {
o2::framework::Produces<o2::aod::StoredFSigmaLabels> producedSigmaLabels;
o2::framework::Produces<o2::aod::StoredFSigmaPlusLabels> producedSigmaPlusLabels;
o2::framework::Produces<o2::aod::StoredFSigmaPlusPcmLabels> producedSigmaPlusPcmLabels;
o2::framework::Produces<o2::aod::StoredFLambdaLabels> producedLambdaLabels;
o2::framework::Produces<o2::aod::StoredFXiLabels> producedXiLabels;
};

struct ConfMcTablesDerivedToDerived : o2::framework::ConfigurableGroup {
Expand Down Expand Up @@ -876,6 +878,32 @@ class McBuilderDerivedToDerived
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
}

/// Write one FLambdaLabels row. lambda must be joined with FLambdaLabels upstream.
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
void fillLambdaWithLabel(T1 const& lambda, T2 const& mcCols, T3 const& /*mcParticles*/, T4 const& mcMothers, T5 const& mcPartonicMothers, T6& mcProducts)
{
if (!lambda.has_fMcParticle()) {
mcProducts.producedLambdaLabels(-1);
return;
}
auto mcParticle = lambda.template fMcParticle_as<T3>();
mcProducts.producedLambdaLabels(
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
}

/// Write one FXiLabels row. xi must be joined with FXiLabels upstream.
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
void fillXiWithLabel(T1 const& xi, T2 const& mcCols, T3 const& /*mcParticles*/, T4 const& mcMothers, T5 const& mcPartonicMothers, T6& mcProducts)
{
if (!xi.has_fMcParticle()) {
mcProducts.producedXiLabels(-1);
return;
}
auto mcParticle = xi.template fMcParticle_as<T3>();
mcProducts.producedXiLabels(
this->getOrCreateMcParticleRow(mcParticle, mcCols, mcMothers, mcPartonicMothers, mcProducts));
}

template <typename T1, typename T2>
void reset(T1 const& mcCols, T2 const& mcParticles)
{
Expand Down
35 changes: 35 additions & 0 deletions PWGCF/Femto/Core/v0Builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,41 @@ class V0BuilderDerivedToDerived
}
}

/// Same as processLambdas, but also resolves the daughters' MC labels (via the
/// MC-aware trackBuilder.getDaughterIndex overload) and writes the lambda's own
/// FLambdaLabels row. lambdaTable must be joined with FLambdaLabels upstream.
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
void processLambdasWithMc(T1 const& col, T2 const& /*lambdaTable*/, T3 const& oldTrackTable, T4& partitionLambda, T5& trackBuilder, T6& cache, T7& newLambdaTable, T8& newTrackTable, T9& newCollisionTable,
T10& mcBuilder, T11 const& mcCols, T12 const& mcParticles, T13 const& mcMothers, T14 const& mcPartonicMothers, auto& mcProducts)
{
if (mLimitLambda == 0) { // lambdas disabled
return;
}

auto lambdaSlice = partitionLambda->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache);

for (auto const& lambda : lambdaSlice) {
auto posDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(lambda.posDauId(), oldTrackTable));
auto negDaughter = oldTrackTable.rawIteratorAt(utils::daughterRow(lambda.negDauId(), oldTrackTable));

int64_t posDaughterIndex = trackBuilder.getDaughterIndex(posDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
int64_t negDaughterIndex = trackBuilder.getDaughterIndex(negDaughter, newTrackTable, newCollisionTable, mcBuilder, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);

newLambdaTable.producedLambdas(newCollisionTable.producedCollision.lastIndex(),
lambda.signedPt(),
lambda.eta(),
lambda.phi(),
lambda.mass(),
posDaughterIndex,
negDaughterIndex);
newLambdaTable.producedLambdaMasks(lambda.mask());
if constexpr (utils::HasCosPa<decltype(lambda)>) {
newLambdaTable.producedLambdaFrac(lambda.cosPa());
}
mcBuilder.fillLambdaWithLabel(lambda, mcCols, mcParticles, mcMothers, mcPartonicMothers, mcProducts);
}
}

template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
void processK0shorts(T1 const& col, T2 const& /*k0shortTable*/, T3 const& oldTrackTable, T4& partitionK0short, T5& trackBuilder, T6& cache, T7& newK0shortTable, T8& newTrackTable, T9& newCollisionTable)
{
Expand Down
Loading
Loading