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
37 changes: 22 additions & 15 deletions PWGJE/Core/JetMatchingUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/**
* Duplicates jets around the phi boundary which are within the matching distance.
*
* NOTE: Assumes, but does not validate, that 0 <= phi < 2pi.

Check failure on line 49 in PWGJE/Core/JetMatchingUtilities.h

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.
*
* @param jetsPhi Jets phi
* @param jetsEta Jets eta
Expand Down Expand Up @@ -79,13 +79,13 @@
for (std::size_t i = 0; i < nJets; i++) {
// Handle lower edge
if (jetsPhi[i] <= (maxMatchingDistance + additionalMargin)) {
jetsPhiComparison.emplace_back(jetsPhi[i] + 2 * M_PI);

Check failure on line 82 in PWGJE/Core/JetMatchingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Use RecoDecay::constrainAngle to restrict angle to a given range.
jetsEtaComparison.emplace_back(jetsEta[i]);
jetsMapToJetIndex.emplace_back(jetsMapToJetIndex[i]);
}
// Handle upper edge
if (jetsPhi[i] >= (2 * M_PI - (maxMatchingDistance + additionalMargin))) {
jetsPhiComparison.emplace_back(jetsPhi[i] - 2 * M_PI);

Check failure on line 88 in PWGJE/Core/JetMatchingUtilities.h

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Use RecoDecay::constrainAngle to restrict angle to a given range.
jetsEtaComparison.emplace_back(jetsEta[i]);
jetsMapToJetIndex.emplace_back(jetsMapToJetIndex[i]);
}
Expand Down Expand Up @@ -202,7 +202,7 @@

// Convert indices in the duplicated jet vectors into the original jet indices.
// First for the base -> tag map.
for (auto& v : matchIndexTag) {

Check failure on line 205 in PWGJE/Core/JetMatchingUtilities.h

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.
// If it's -1, it means that it didn't find a matching jet.
// We have to explicitly check for it here because it would be an invalid index.
if (v != -1) {
Expand All @@ -210,7 +210,7 @@
}
}
// Then for the index -> base map.
for (auto& v : matchIndexBase) {

Check failure on line 213 in PWGJE/Core/JetMatchingUtilities.h

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.
if (v != -1) {
v = jetMapBaseToJetIndex[v];
}
Expand Down Expand Up @@ -306,7 +306,7 @@
jetsR.push_back(std::round(jetTag.r()));
}
}
for (auto jetR : jetsR) {

Check failure on line 309 in PWGJE/Core/JetMatchingUtilities.h

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.
std::vector<double> jetsBasePhi;
std::vector<double> jetsBaseEta;
std::vector<int> baseToTagMatchingGeoIndex;
Expand Down Expand Up @@ -364,30 +364,37 @@
if (jetBase.candidatesIds().size() == 0) {
continue;
}
const auto candidateBase = jetBase.template candidates_first_as<V>();
for (const auto& jetTag : jetsTagPerCollision) {
if (jetTag.candidatesIds().size() == 0) {
continue;
}
if (std::round(jetBase.r()) != std::round(jetTag.r())) {
continue;
}
if constexpr (jetsBaseIsMc || jetsTagIsMc) {
if (jetcandidateutilities::isMatchedCandidate(candidateBase)) {
const auto candidateBaseMcId = jetcandidateutilities::matchedParticleId(candidateBase, tracksBase, tracksTag);
const auto candidateTag = jetTag.template candidates_first_as<M>();
const auto candidateTagId = candidateTag.mcParticleId();
if (candidateBaseMcId == candidateTagId) {
baseToTagMatchingHF[jetBase.globalIndex()].push_back(jetTag.globalIndex());
tagToBaseMatchingHF[jetTag.globalIndex()].push_back(jetBase.globalIndex());
auto const& candidatesBase = jetBase.template candidates_as<V>();
std::size_t iCandidateBaseMatched = 0;
for (auto const& candidateBase : candidatesBase) {
if constexpr (jetsBaseIsMc || jetsTagIsMc) {
if (jetcandidateutilities::isMatchedCandidate(candidateBase)) {
const auto candidateBaseMcId = jetcandidateutilities::matchedParticleId(candidateBase, tracksBase, tracksTag);
for (auto const& candidateTag : jetTag.template candidates_as<M>()) {
const auto candidateTagId = candidateTag.mcParticleId();
if (candidateBaseMcId == candidateTagId) {
iCandidateBaseMatched++;
}
}
}
} else {
for (auto const& candidateTag : jetTag.template candidates_as<M>()) {
if (candidateBase.globalIndex() == candidateTag.globalIndex()) {
iCandidateBaseMatched++;
}
}
}
} else {
const auto candidateTag = jetTag.template candidates_first_as<M>();
if (candidateBase.globalIndex() == candidateTag.globalIndex()) {
baseToTagMatchingHF[jetBase.globalIndex()].push_back(jetTag.globalIndex());
tagToBaseMatchingHF[jetTag.globalIndex()].push_back(jetBase.globalIndex());
}
}
if (iCandidateBaseMatched == candidatesBase.size()) {
baseToTagMatchingHF[jetBase.globalIndex()].push_back(jetTag.globalIndex());
tagToBaseMatchingHF[jetTag.globalIndex()].push_back(jetBase.globalIndex());
}
}
}
Expand Down Expand Up @@ -602,7 +609,7 @@
hasCandidateBase2 = true;
}
int matchedPairTagIndex = -1;
for (auto pairTagIndex : pairsTagIndices) {

Check failure on line 612 in PWGJE/Core/JetMatchingUtilities.h

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.
const auto& pairTag = pairsTag.iteratorAt(pairTagIndex);
if (hasTrackBase1 && !pairTag.has_track1()) {
continue;
Expand Down Expand Up @@ -727,7 +734,7 @@
}
}

if (nMatched == 2) {

Check failure on line 737 in PWGJE/Core/JetMatchingUtilities.h

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.
baseToTagMatching[pairBase.globalIndex()].push_back(pairTag.globalIndex());
tagToBaseMatching[pairTag.globalIndex()].push_back(pairBase.globalIndex());
matchedPairTagIndex = pairTagIndex;
Expand Down
3 changes: 2 additions & 1 deletion PWGJE/DataModel/JetSubstructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ DECLARE_SOA_DYNAMIC_COLUMN(R, r, //!
{ \
DECLARE_SOA_INDEX_COLUMN_CUSTOM(_jet_type_##CO, collision, _jet_description_ "COs"); \
DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(Candidate, candidate, int, _cand_type_, _cand_description_ "S", "_0"); \
DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(Candidates, candidates, int32_t, _cand_type_, _cand_description_ "S", "_0"); \
DECLARE_SOA_INDEX_COLUMN(_jet_recoil_type_, jet); \
} \
DECLARE_SOA_TABLE(_jet_type_##Os, "AOD", _jet_description_ "O", o2::soa::Index<>, _name_##jetoutput::_jet_type_##COId, _name_##jetoutput::CandidateId, jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetoutput::JetY, jetoutput::JetR, jetoutput::JetArea, jetoutput::JetRho, jetoutput::JetPerpConeRho, jetoutput::JetNConstituents); \
DECLARE_SOA_TABLE(_jet_type_##Os, "AOD", _jet_description_ "O", o2::soa::Index<>, _name_##jetoutput::_jet_type_##COId, _name_##jetoutput::CandidatesIds, jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetoutput::JetY, jetoutput::JetR, jetoutput::JetArea, jetoutput::JetRho, jetoutput::JetPerpConeRho, jetoutput::JetNConstituents); \
DECLARE_SOA_TABLE(_jet_type_##Rs, "AOD", _jet_description_ "R", _name_##jetoutput::_jet_recoil_type_##Id, _name_##jetoutput::CandidateId, jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetoutput::JetR, jetoutput::JetNConstituents, jetoutput::Pt<jetoutput::JetPt>, jetoutput::Phi<jetoutput::JetPhi>, jetoutput::Eta<jetoutput::JetEta>, jetoutput::R<jetoutput::JetR>); \
DECLARE_SOA_TABLE(_jet_type_##ROs, "AOD", _jet_description_ "RO", o2::soa::Index<>, _name_##jetoutput::CandidateId, jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetoutput::JetR, jetoutput::JetNConstituents); \
using _jet_type_##O = _jet_type_##Os::iterator; \
Expand Down
30 changes: 30 additions & 0 deletions PWGJE/JetFinders/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-mcd-charged

Check failure on line 21 in PWGJE/JetFinders/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name jet-finder-mcd-charged does not match its file name jetFinderMCDCharged.cxx. (Matches jetFinderMcdCharged.cxx.)
SOURCES jetFinderMCDCharged.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-mcp-charged

Check failure on line 26 in PWGJE/JetFinders/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name jet-finder-mcp-charged does not match its file name jetFinderMCPCharged.cxx. (Matches jetFinderMcpCharged.cxx.)
SOURCES jetFinderMCPCharged.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)
Expand Down Expand Up @@ -209,4 +209,34 @@
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-d0d0bar-data-charged
SOURCES jetFinderD0D0BarDataCharged.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-d0d0bar-mcd-charged
SOURCES jetFinderD0D0BarMCDCharged.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-d0d0bar-mcp-charged
SOURCES jetFinderD0D0BarMCPCharged.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-dplusdminus-data-charged
SOURCES jetFinderDplusDminusDataCharged.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-dplusdminus-mcd-charged
SOURCES jetFinderDplusDminusMCDCharged.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-dplusdminus-mcp-charged
SOURCES jetFinderDplusDminusMCPCharged.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

endif()
41 changes: 41 additions & 0 deletions PWGJE/JetFinders/jetFinderD0D0BarDataCharged.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

// jet finder d0-d0bar data charged task
//
/// \author Nima Zardoshti <nima.zardoshti@cern.ch>

#include "PWGJE/DataModel/Jet.h"
#include "PWGJE/JetFinders/jetFinderHFHFBar.h"

#include <Framework/AnalysisTask.h>
#include <Framework/ConfigContext.h>
#include <Framework/DataProcessorSpec.h>
#include <Framework/runDataProcessing.h>

#include <vector>

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;

using JetFinderD0D0BarDataCharged = JetFinderHFHFBarTask<aod::CandidatesD0Data, aod::CandidatesD0MCD, aod::CandidatesD0MCP, aod::JetTracksSubD0, aod::JetParticlesSubD0, aod::D0ChargedJets, aod::D0ChargedJetConstituents, aod::D0ChargedEventWiseSubtractedJets, aod::D0ChargedEventWiseSubtractedJetConstituents>;

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
std::vector<o2::framework::DataProcessorSpec> tasks;

tasks.emplace_back(adaptAnalysisTask<JetFinderD0D0BarDataCharged>(cfgc,
SetDefaultProcesses{{{"processChargedJetsData", true}}},
TaskName{"jet-finder-d0d0bar-data-charged"}));

return WorkflowSpec{tasks};
}
41 changes: 41 additions & 0 deletions PWGJE/JetFinders/jetFinderD0D0BarMCDCharged.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

// jet finder d0-d0bar mcd charged task
//
/// \author Nima Zardoshti <nima.zardoshti@cern.ch>

#include "PWGJE/DataModel/Jet.h"
#include "PWGJE/JetFinders/jetFinderHFHFBar.h"

#include <Framework/AnalysisTask.h>
#include <Framework/ConfigContext.h>
#include <Framework/DataProcessorSpec.h>
#include <Framework/runDataProcessing.h>

#include <vector>

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;

using JetFinderD0D0BarMCDetectorLevelCharged = JetFinderHFHFBarTask<aod::CandidatesD0Data, aod::CandidatesD0MCD, aod::CandidatesD0MCP, aod::JetTracksSubD0, aod::JetParticlesSubD0, aod::D0ChargedMCDetectorLevelJets, aod::D0ChargedMCDetectorLevelJetConstituents, aod::D0ChargedMCDetectorLevelEventWiseSubtractedJets, aod::D0ChargedMCDetectorLevelEventWiseSubtractedJetConstituents>;

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
std::vector<o2::framework::DataProcessorSpec> tasks;

tasks.emplace_back(adaptAnalysisTask<JetFinderD0D0BarMCDetectorLevelCharged>(cfgc,
SetDefaultProcesses{{{"processChargedJetsMCD", true}}},
TaskName{"jet-finder-d0d0bar-mcd-charged"}));

return WorkflowSpec{tasks};
}
Loading
Loading