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
28 changes: 13 additions & 15 deletions PWGCF/TableProducer/filter2Prong.cxx
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 PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Provide mandatory file documentation.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -9,28 +9,26 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \author Jasper Parkkila <jasper.parkkila@cern.ch>

Check failure on line 12 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \brief is missing, incorrect or misplaced.

Check failure on line 12 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

#include <experimental/type_traits>
#include <vector>
#include <string>
#include <memory>

#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/ASoAHelpers.h"

#include "MathUtils/detail/TypeTruncation.h"

#include "PWGCF/DataModel/CorrelationsDerived.h"

#include "PWGHF/Core/HfHelper.h"
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"

#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"
#include "MathUtils/detail/TypeTruncation.h"

#include <TFormula.h>

#include <experimental/type_traits>
#include <memory>
#include <string>
#include <vector>

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
Expand Down Expand Up @@ -106,10 +104,10 @@
prongCFId[0], prongCFId[1], c.pt(), c.eta(), c.phi(), hfHelper.invMassD0ToPiK(c), aod::cf2prongtrack::D0ToPiK);
if constexpr (std::experimental::is_detected<HasMLProb, typename HFCandidatesType::iterator>::value) {
mlvecd.clear();
for (const float val : c.mlProbD0())

Check failure on line 107 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
mlvecd.push_back(val);
mlvecdbar.clear();
for (const float val : c.mlProbD0bar())

Check failure on line 110 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
mlvecdbar.push_back(val);
output2ProngTrackmls(cfcollisions.begin().globalIndex(), mlvecd, mlvecdbar);
}
Expand All @@ -120,10 +118,10 @@
prongCFId[0], prongCFId[1], c.pt(), c.eta(), c.phi(), hfHelper.invMassD0barToKPi(c), aod::cf2prongtrack::D0barToKPi);
if constexpr (std::experimental::is_detected<HasMLProb, typename HFCandidatesType::iterator>::value) {
mlvecd.clear();
for (const float val : c.mlProbD0())

Check failure on line 121 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
mlvecd.push_back(val);
mlvecdbar.clear();
for (const float val : c.mlProbD0bar())

Check failure on line 124 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
mlvecdbar.push_back(val);
output2ProngTrackmls(cfcollisions.begin().globalIndex(), mlvecd, mlvecdbar);
}
Expand All @@ -143,17 +141,17 @@
}
PROCESS_SWITCH(Filter2Prong, processData, "Process data D0 candidates", true);

void processMC(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles, aod::McParticles const& mcparticles)
void processMC(aod::McCollisions::iterator const&, aod::CFMcParticleRefs const& cfmcparticles, [[maybe_unused]] aod::McParticles const& mcparticles)
{
// The main filter outputs the primary MC particles. Here we just resolve the daughter indices that are needed for the efficiency matching.
for (const auto& r : cfmcparticles) {
const auto& mcParticle = mcparticles.iteratorAt(r.mcParticleId());
const auto& mcParticle = r.mcParticle();
if (mcParticle.daughtersIds().size() != 2) {

Check failure on line 149 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
output2ProngMcParts(-1, -1);
continue;
}
int prongCFId[2] = {-1, -1};
for (uint i = 0; i < 2; ++i) {

Check failure on line 154 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
for (const auto& cfmcpart : cfmcparticles) {
if (mcParticle.daughtersIds()[i] == cfmcpart.mcParticleId()) {
prongCFId[i] = cfmcpart.globalIndex();
Expand Down Expand Up @@ -204,5 +202,5 @@
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<Filter2Prong>(cfgc, TaskName{"filter-2prong"})};

Check failure on line 205 in PWGCF/TableProducer/filter2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Device names filter-2prong and filter2-prong generated from the specified task name filter-2prong and from the struct name Filter2Prong, respectively, differ in hyphenation. Consider fixing capitalisation of the struct name to Filter2Prong and removing TaskName.
}
57 changes: 31 additions & 26 deletions PWGCF/Tasks/correlations.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,37 @@
/// \brief task for the correlation calculations with CF-filtered tracks for O2 analysis
/// \author Jan Fiete Grosse-Oetringhaus <jan.fiete.grosse-oetringhaus@cern.ch>, Jasper Parkkila <jasper.parkkila@cern.ch>

#include <experimental/type_traits>
#include <vector>
#include <string>
#include "PWGCF/Core/CorrelationContainer.h"
#include "PWGCF/Core/PairCuts.h"
#include "PWGCF/DataModel/CorrelationsDerived.h"

#include <TH1F.h>
#include <cmath>
#include <TDirectory.h>
#include <THn.h>
#include <TFile.h>
#include <TVector2.h>
#include "Common/Core/RecoDecay.h"
#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/ASoAHelpers.h"
#include "CCDB/BasicCCDBManager.h"
#include "Framework/StepTHn.h"
#include "CommonConstants/MathConstants.h"
#include "DataFormatsParameters/GRPMagField.h"
#include "DataFormatsParameters/GRPObject.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/RunningWorkflowInfo.h"
#include "CommonConstants/MathConstants.h"
#include "Common/Core/RecoDecay.h"
#include "Framework/StepTHn.h"
#include "Framework/runDataProcessing.h"

#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "Common/DataModel/Centrality.h"
#include "PWGCF/DataModel/CorrelationsDerived.h"
#include "PWGCF/Core/CorrelationContainer.h"
#include "PWGCF/Core/PairCuts.h"
#include "DataFormatsParameters/GRPObject.h"
#include "DataFormatsParameters/GRPMagField.h"
#include <TDirectory.h>
#include <TFile.h>
#include <TH1F.h>
#include <THn.h>
#include <TVector2.h>

#include <cmath>
#include <experimental/type_traits>
#include <string>
#include <vector>

using namespace o2;
using namespace o2::framework;
Expand Down Expand Up @@ -1065,17 +1066,21 @@ struct CorrelationTask {

for (const auto& p2track : grouped2ProngTracks) {
// Check if the mc particles of the prongs are found.
if (p2track.cfTrackProng0Id() < 0 || p2track.cfTrackProng1Id() < 0) {
// fake track
same->getTrackHistEfficiency()->Fill(CorrelationContainer::Fake, p2track.eta(), p2track.pt(), 0, multiplicity, mcCollision.posZ());
}
const auto& p0 = p2track.cfTrackProng0_as<aod::CFTracksWithLabel>();
const auto& p1 = p2track.cfTrackProng1_as<aod::CFTracksWithLabel>();
if (p0.has_cfMCParticle() && p1.has_cfMCParticle()) {
// find the 2-prong MC particle by the daughter MC particle IDs
auto m = std::find_if(p2indexCache.begin(), p2indexCache.end(), [&](const auto& t) -> bool {
const auto& mcParticle = mcParticles.iteratorAt(t);
const auto& mcParticle = mcParticles.iteratorAt(t - mcParticles.begin().globalIndex());
return p0.cfMCParticleId() == mcParticle.cfParticleDaugh0Id() && p1.cfMCParticleId() == mcParticle.cfParticleDaugh1Id();
});
if (m == p2indexCache.end())
continue;
const auto& mcParticle = mcParticles.iteratorAt(*m);
const auto& mcParticle = mcParticles.iteratorAt(*m - mcParticles.begin().globalIndex());
if (mcParticle.isPhysicalPrimary()) {
same->getTrackHistEfficiency()->Fill(CorrelationContainer::RecoPrimaries, mcParticle.eta(), mcParticle.pt(), getSpecies(mcParticle.pdgCode()), multiplicity, mcCollision.posZ());
}
Expand Down
Loading