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
2 changes: 1 addition & 1 deletion PWGLF/Tasks/Strangeness/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Use kebab-case for names of workflows and match the name of the workflow file.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
Expand All @@ -9,7 +9,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

o2physics_add_dpl_workflow(hyperon-reco-test

Check failure on line 12 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name hyperon-reco-test does not match its file name hyperon-reco-test.cxx. (Matches hyperonRecoTest.cxx.)
SOURCES hyperon-reco-test.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
Expand All @@ -19,7 +19,7 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(lambdakzeroanalysis-mc

Check failure on line 22 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name lambdakzeroanalysis-mc does not match its file name lambdakzeroanalysisMC.cxx. (Matches lambdakzeroanalysisMc.cxx.)
SOURCES lambdakzeroanalysisMC.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
Expand All @@ -29,12 +29,12 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(sigmaminus-task

Check failure on line 32 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name sigmaminus-task does not match its file name sigmaminustask.cxx. (Matches sigmaminusTask.cxx.)
SOURCES sigmaminustask.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(cascadeanalysismc

Check failure on line 37 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name cascadeanalysismc does not match its file name cascadeanalysisMC.cxx. (Matches cascadeanalysismc.cxx.)
SOURCES cascadeanalysisMC.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
Expand All @@ -51,15 +51,15 @@

o2physics_add_dpl_workflow(non-prompt-cascade
SOURCES nonPromptCascade.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::ReconstructionDataFormats O2Physics::AnalysisCore O2::DetectorsBase O2Physics::EventFilteringUtils
PUBLIC_LINK_LIBRARIES O2::Framework O2::ReconstructionDataFormats O2Physics::AnalysisCore O2::DetectorsBase O2::DetectorsVertexing O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(k0mixedevents

Check failure on line 57 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name k0mixedevents does not match its file name k0_mixed_events.cxx. (Matches k0mixedevents.cxx.)
SOURCES k0_mixed_events.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(vzero-cascade-absorption

Check failure on line 62 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name vzero-cascade-absorption does not match its file name vzero_cascade_absorption.cxx. (Matches vzeroCascadeAbsorption.cxx.)
SOURCES vzero_cascade_absorption.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
Expand All @@ -74,7 +74,7 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(hstrangecorrelation

Check failure on line 77 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name hstrangecorrelation does not match its file name hStrangeCorrelation.cxx. (Matches hstrangecorrelation.cxx.)
SOURCES hStrangeCorrelation.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)
Expand Down Expand Up @@ -141,7 +141,7 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(lambdajetpolarization

Check failure on line 144 in PWGLF/Tasks/Strangeness/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name lambdajetpolarization does not match its file name lambdaJetpolarization.cxx. (Matches lambdajetpolarization.cxx.)
SOURCES lambdaJetpolarization.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib O2Physics::EventFilteringUtils
COMPONENT_NAME Analysis)
66 changes: 55 additions & 11 deletions PWGLF/Tasks/Strangeness/nonPromptCascade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "Common/DataModel/Multiplicity.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/trackUtilities.h"
#include "DetectorsVertexing/PVertexer.h"
#include "ReconstructionDataFormats/Vertex.h"
#include "DataFormatsParameters/GRPMagField.h"
#include "DataFormatsParameters/GRPObject.h"
#include "DataFormatsTPC/BetheBlochAleph.h"
Expand Down Expand Up @@ -128,7 +130,7 @@
if (particle.has_mothers()) {
auto mom = particle.template mothers_as<aod::McParticles>()[0];
int pdgCodeMom = mom.pdgCode();
fromBeauty = std::abs(pdgCodeMom) / 5000 == 1 || std::abs(pdgCodeMom) / 500 == 1 || std::abs(pdgCodeMom) == 5;

Check failure on line 133 in PWGLF/Tasks/Strangeness/nonPromptCascade.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
fromCharm = std::abs(pdgCodeMom) / 4000 == 1 || std::abs(pdgCodeMom) / 400 == 1 || std::abs(pdgCodeMom) == 4;
while (mom.has_mothers()) {
const auto grandma = mom.template mothers_as<aod::McParticles>()[0];
Expand Down Expand Up @@ -171,8 +173,12 @@
using CollisionCandidatesRun3 = soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults>;
using CollisionCandidatesRun3MC = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels, aod::FT0Mults>;

Preslice<TracksExtData> perCollision = aod::track::collisionId;
Preslice<TracksExtMC> perCollisionMC = aod::track::collisionId;

Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<bool> cfgPropToPCA{"cfgPropToPCA", true, "create tracks version propagated to PCA"};
Configurable<bool> cfgRedoPV{"cfgRedoPV", true, "redo PV"};
Configurable<bool> cfgUseAbsDCA{"cfgUseAbsDCA", true, "Minimise abs. distance rather than chi2"};
Configurable<double> cfgMaxR{"cfgMaxR", 200., "reject PCA's above this radius"};
Configurable<double> cfgMaxDZIni{"cfgMaxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"};
Expand All @@ -189,6 +195,7 @@

Zorro mZorro;
OutputObj<ZorroSummary> mZorroSummary{"ZorroSummary"};
SliceCache cache;

Service<o2::ccdb::BasicCCDBManager> mCCDB;
int mRunNumber = 0;
Expand All @@ -212,7 +219,7 @@

if (static_cast<o2::base::Propagator::MatCorrType>(cfgMaterialCorrection.value) == o2::base::Propagator::MatCorrType::USEMatCorrLUT) {
auto* lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(mCCDB->getForRun<o2::base::MatLayerCylSet>("GLO/Param/MatLUT", mRunNumber));
o2::base::Propagator::Instance(true)->setMatLUT(lut);
o2::base::Propagator::Instance()->setMatLUT(lut);
}
}

Expand Down Expand Up @@ -244,6 +251,38 @@
}
}

template <typename CollisionType, typename TrackType>
bool recalculatePV(CollisionType const& collision, TrackType const& tracks, int idToRemove, o2::dataformats::VertexBase& primaryVertex)
{
// slice tracks by collision
o2::vertexing::PVertexer vertexer;
std::vector<o2::track::TrackParCov> pvContributors = {};
std::vector<bool> pvContributorsMask = {};

auto tracksInCollision = doprocessTrackedCascadesMC ? tracks.sliceBy(perCollisionMC, collision.globalIndex()) : tracks.sliceBy(perCollision, collision.globalIndex());
// loop over tracks
for (auto const& trkInColl : tracksInCollision) { // Loop on tracks
if (trkInColl.isPVContributor()) {
pvContributors.push_back(getTrackParCov(trkInColl));
idToRemove == trkInColl.globalIndex() ? pvContributorsMask.push_back(false) : pvContributorsMask.push_back(true);
}
}
LOG(debug) << "Tracks pushed to the vector: " << pvContributors.size();
vertexer.init();
bool canRefit = vertexer.prepareVertexRefit(pvContributors, primaryVertex);
if (!canRefit) {
return false;
}
// refit the vertex
auto newPV = vertexer.refitVertex(pvContributorsMask, primaryVertex);
// set the new vertex to primaryVertex
primaryVertex.setX(newPV.getX());
primaryVertex.setY(newPV.getY());
primaryVertex.setZ(newPV.getZ());
primaryVertex.setCov(newPV.getCov());
return true;
}

void zorroAccounting(const auto& collisions)
{
if (cfgSkimmedProcessing) {
Expand All @@ -261,7 +300,7 @@
}

template <typename TrackType, typename CollisionType>
void fillCandidatesVector(CollisionType const&, auto const& cascades, auto& candidates)
void fillCandidatesVector(CollisionType const&, TrackType const& tracks, auto const& cascades, auto& candidates)
{

const auto& getCascade = [](auto const& candidate) {
Expand All @@ -279,7 +318,7 @@
auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
initCCDB(bc);

const auto primaryVertex = getPrimaryVertex(collision);
auto primaryVertex = getPrimaryVertex(collision);

const auto& casc = getCascade(candidate);
const auto& bachelor = casc.template bachelor_as<TrackType>();
Expand Down Expand Up @@ -435,6 +474,11 @@
if constexpr (requires { candidate.track(); }) {
const auto& track = candidate.template track_as<TrackType>();
const auto& ITStrack = candidate.template itsTrack_as<TrackType>();
if (cfgRedoPV && ITStrack.isPVContributor()) {
if (!recalculatePV(collision, tracks, ITStrack.globalIndex(), primaryVertex)) {
continue;
}
}
cascPVContribs |= ITStrack.isPVContributor() << 0;
auto trackTrkParCov = getTrackParCov(track);
o2::base::Propagator::Instance()->propagateToDCA(primaryVertex, trackTrkParCov, mBz, 2.f, matCorr, &motherDCA);
Expand Down Expand Up @@ -555,19 +599,19 @@

void processTrackedCascadesMC(CollisionCandidatesRun3MC const& collisions,
aod::AssignedTrackedCascades const& trackedCascades, aod::Cascades const& /*cascades*/,
aod::V0s const& /*v0s*/, TracksExtMC const& /*tracks*/,
aod::V0s const& /*v0s*/, TracksExtMC const& tracks,
aod::McParticles const& mcParticles, aod::McCollisions const&, aod::BCsWithTimestamps const&)
{
fillCandidatesVector<TracksExtMC>(collisions, trackedCascades, gCandidates);
fillCandidatesVector<TracksExtMC>(collisions, tracks, trackedCascades, gCandidates);
fillMCtable<aod::AssignedTrackedCascades>(mcParticles, collisions, gCandidates);
}
PROCESS_SWITCH(NonPromptCascadeTask, processTrackedCascadesMC, "process cascades from strangeness tracking: MC analysis", true);

void processCascadesMC(CollisionCandidatesRun3MC const& collisions, aod::Cascades const& cascades,
aod::V0s const& /*v0s*/, TracksExtMC const& /*tracks*/,
aod::V0s const& /*v0s*/, TracksExtMC const& tracks,
aod::McParticles const& mcParticles, aod::McCollisions const&, aod::BCsWithTimestamps const&)
{
fillCandidatesVector<TracksExtMC>(collisions, cascades, gCandidatesNT);
fillCandidatesVector<TracksExtMC>(collisions, tracks, cascades, gCandidatesNT);
fillMCtable<aod::Cascades>(mcParticles, collisions, gCandidatesNT);
}
PROCESS_SWITCH(NonPromptCascadeTask, processCascadesMC, "process cascades: MC analysis", false);
Expand Down Expand Up @@ -603,21 +647,21 @@

void processTrackedCascadesData(CollisionCandidatesRun3 const& collisions,
aod::AssignedTrackedCascades const& trackedCascades, aod::Cascades const& /*cascades*/,
aod::V0s const& /*v0s*/, TracksExtData const& /*tracks*/,
aod::V0s const& /*v0s*/, TracksExtData const& tracks,
aod::BCsWithTimestamps const&)
{
zorroAccounting(collisions);
fillCandidatesVector<TracksExtData>(collisions, trackedCascades, gCandidates);
fillCandidatesVector<TracksExtData>(collisions, tracks, trackedCascades, gCandidates);
fillDataTable<aod::AssignedTrackedCascades>(gCandidates);
}
PROCESS_SWITCH(NonPromptCascadeTask, processTrackedCascadesData, "process cascades from strangeness tracking: Data analysis", false);

void processCascadesData(CollisionCandidatesRun3 const& collisions, aod::Cascades const& cascades,
aod::V0s const& /*v0s*/, TracksExtData const& /*tracks*/,
aod::V0s const& /*v0s*/, TracksExtData const& tracks,
aod::BCsWithTimestamps const&)
{
zorroAccounting(collisions);
fillCandidatesVector<TracksExtData>(collisions, cascades, gCandidatesNT);
fillCandidatesVector<TracksExtData>(collisions, tracks, cascades, gCandidatesNT);
fillDataTable<aod::Cascades>(gCandidatesNT);
}
PROCESS_SWITCH(NonPromptCascadeTask, processCascadesData, "process cascades: Data analysis", false);
Expand Down
Loading