Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider the following formatting changes to #6008 #29

Closed
wants to merge 2 commits into from
Closed
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
18 changes: 18 additions & 0 deletions PWGJE/DataModel/Jet.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,21 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! absolute p
DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##MCDetectorLevelEventWiseSubtracted, _shortname_ "DJET2DEWS") \
DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevelEventWiseSubtracted, _jet_type_##MCDetectorLevel, _shortname_ "JETDEWS2D") \
DECLARE_JET_TABLES(JMcCollision, _jet_type_##MCParticleLevelEventWiseSubtracted, _subtracted_track_type_, _hfparticle_type_, _shortname_ "PJETEWS")

#define STRINGIFY(x) #x

// add duplicate tables for each predefined jet table so that the same jets can be run with multiple settings
#define DECLARE_JET_DUPLICATE_TABLES_LEVELS(_jet_type_, _subtracted_track_type_, _hfcand_type_, _hfparticle_type_, _shortname_, _duplicatenumber_) \
DECLARE_JET_TABLES_LEVELS(_jet_type_##_duplicatenumber_, _subtracted_track_type_, _hfcand_type_, _hfparticle_type_, _shortname_ STRINGIFY(_duplicatenumber_)) \
DECLARE_JETMATCHING_TABLE(_jet_type_, _jet_type_##_duplicatenumber_, _shortname_ "JET2" STRINGIFY(_duplicatenumber_)) \
DECLARE_JETMATCHING_TABLE(_jet_type_##_duplicatenumber_, _jet_type_, _shortname_ "JET" STRINGIFY(_duplicatenumber_) "2") \
DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##_duplicatenumber_##MCDetectorLevel, _shortname_ "JETD2" STRINGIFY(_duplicatenumber_)) \
DECLARE_JETMATCHING_TABLE(_jet_type_##_duplicatenumber_##MCDetectorLevel, _jet_type_##MCDetectorLevel, _shortname_ "JET" STRINGIFY(_duplicatenumber_) "2D") \
DECLARE_JETMATCHING_TABLE(_jet_type_##MCParticleLevel, _jet_type_##_duplicatenumber_##MCParticleLevel, _shortname_ "JETP2" STRINGIFY(_duplicatenumber_)) \
DECLARE_JETMATCHING_TABLE(_jet_type_##_duplicatenumber_##MCParticleLevel, _jet_type_##MCParticleLevel, _shortname_ "JET" STRINGIFY(_duplicatenumber_) "2P") \
DECLARE_JETMATCHING_TABLE(_jet_type_##EventWiseSubtracted, _jet_type_##_duplicatenumber_##EventWiseSubtracted, _shortname_ "JETEWS2" STRINGIFY(_duplicatenumber_)) \
DECLARE_JETMATCHING_TABLE(_jet_type__duplicatenumber_##EventWiseSubtracted, _jet_type_##EventWiseSubtracted, _shortname_ "JET" STRINGIFY(_duplicatenumber_) "2EWS")

namespace o2::aod
{
DECLARE_JET_TABLES_LEVELS(Charged, JTrackSub, HfD0Bases, HfD0PBases, "C");
Expand All @@ -170,6 +185,9 @@ DECLARE_JET_TABLES_LEVELS(LcCharged, JTrackLcSub, Hf3PBases, Hf3PPBases, "Lc");
DECLARE_JET_TABLES_LEVELS(BplusCharged, JTrackBplusSub, HfCandBplus, HfD0PBases, "BPl");
DECLARE_JET_TABLES_LEVELS(V0Charged, JTrackSub, V0Cores, V0Cores, "V0");

// duplicate jet tables (added as needed for analyses)
DECLARE_JET_DUPLICATE_TABLES_LEVELS(Charged, JTrackSub, HfD0Bases, HfD0PBases, "C", 1);

} // namespace o2::aod

using JetCollisions = o2::aod::JCollisions;
Expand Down
15 changes: 15 additions & 0 deletions PWGJE/JetFinders/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,20 @@ o2physics_add_dpl_workflow(jet-finder-v0-mcp-charged
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-data-charged-1
SOURCES Duplicates/jetfinderdatacharged1.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-mcd-charged-1
SOURCES Duplicates/jetfindermcdcharged1.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-finder-mcp-charged-1
SOURCES Duplicates/jetfindermcpcharged1.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport
COMPONENT_NAME Analysis)


endif()
29 changes: 29 additions & 0 deletions PWGJE/JetFinders/Duplicates/jetfinderdatacharged1.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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 data charged 1 task
//
/// \author Nima Zardoshti <[email protected]>

#include "PWGJE/JetFinders/jetfinder.cxx"

using JetFinderDataCharged1 = JetFinderTask<aod::Charged1Jets, aod::Charged1JetConstituents, aod::Charged1EventWiseSubtractedJets, aod::Charged1EventWiseSubtractedJetConstituents>;

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

tasks.emplace_back(
adaptAnalysisTask<JetFinderDataCharged1>(cfgc,
SetDefaultProcesses{{{"processChargedJets", true}}}, TaskName{"jet-finder-data-charged-1"}));

return WorkflowSpec{tasks};
}
29 changes: 29 additions & 0 deletions PWGJE/JetFinders/Duplicates/jetfindermcdcharged1.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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 mcd charged task
//
/// \author Nima Zardoshti <[email protected]>

#include "PWGJE/JetFinders/jetfinder.cxx"

using JetFinderMCDetectorLevelCharged1 = JetFinderTask<aod::Charged1MCDetectorLevelJets, aod::Charged1MCDetectorLevelJetConstituents, aod::Charged1MCDetectorLevelEventWiseSubtractedJets, aod::Charged1MCDetectorLevelEventWiseSubtractedJetConstituents>;

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

tasks.emplace_back(
adaptAnalysisTask<JetFinderMCDetectorLevelCharged1>(cfgc,
SetDefaultProcesses{{{"processChargedJets", true}}}, TaskName{"jet-finder-mcd-charged-1"}));

return WorkflowSpec{tasks};
}
29 changes: 29 additions & 0 deletions PWGJE/JetFinders/Duplicates/jetfindermcpcharged1.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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 mcp charged task
//
/// \author Nima Zardoshti <[email protected]>

#include "PWGJE/JetFinders/jetfinder.cxx"

using JetFinderMCParticleLevelCharged1 = JetFinderTask<aod::Charged1MCParticleLevelJets, aod::Charged1MCParticleLevelJetConstituents, aod::Charged1MCParticleLevelEventWiseSubtractedJets, aod::Charged1MCParticleLevelEventWiseSubtractedJetConstituents>;

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

tasks.emplace_back(
adaptAnalysisTask<JetFinderMCParticleLevelCharged1>(cfgc,
SetDefaultProcesses{{{"processParticleLevelChargedJets", true}}}, TaskName{"jet-finder-mcp-charged-1"}));

return WorkflowSpec{tasks};
}
5 changes: 5 additions & 0 deletions PWGJE/TableProducer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ o2physics_add_dpl_workflow(jet-matching-mc-sub
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-matching-duplicates
SOURCES jetmatchingduplicates.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(jet-eventweight-mcd
SOURCES jeteventweightmcd.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
Expand Down
125 changes: 125 additions & 0 deletions PWGJE/TableProducer/jetmatchingduplicates.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// 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.

/// \file jetmatching.cxx
/// \brief matching duplicate jets
/// \author Nima Zardoshti <[email protected]>

#include "Framework/AnalysisTask.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/ASoA.h"
#include "Framework/runDataProcessing.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "PWGJE/DataModel/Jet.h"
#include "PWGJE/Core/JetUtilities.h"
#include "PWGJE/Core/JetFindingUtilities.h"
#include "PWGJE/Core/JetMatchingUtilities.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"

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

template <typename JetsBase, typename JetsTag, typename JetsBasetoTagMatchingTable, typename JetsTagtoBaseMatchingTable, typename Tracks, typename Candidates>
struct JetMatchingDuplicates {

Configurable<bool> doMatchingGeo{"doMatchingGeo", true, "Enable geometric matching"};
Configurable<bool> doMatchingPt{"doMatchingPt", true, "Enable pt matching"};
Configurable<bool> doMatchingHf{"doMatchingHf", false, "Enable HF matching"};
Configurable<float> maxMatchingDistance{"maxMatchingDistance", 0.24f, "Max matching distance"};
Configurable<float> minPtFraction{"minPtFraction", 0.5f, "Minimum pt fraction for pt matching"};

Produces<JetsBasetoTagMatchingTable> jetsBasetoTagMatchingTable;
Produces<JetsTagtoBaseMatchingTable> jetsTagtoBaseMatchingTable;

// preslicing jet collections, only for Mc-based collection
static constexpr bool jetsBaseIsMc = o2::soa::relatedByIndex<aod::JMcCollisions, JetsBase>();
static constexpr bool jetsTagIsMc = o2::soa::relatedByIndex<aod::JMcCollisions, JetsTag>();

Preslice<JetsBase> baseJetsPerCollision = jetsBaseIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId;
Preslice<JetsTag> tagJetsPerCollision = jetsTagIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId;

void init(InitContext const&)
{
}

void processDummy(JetCollisions const&)
{
}
PROCESS_SWITCH(JetMatchingDuplicates, processDummy, "Dummy process", true);

void processJets(JetCollisions const& collisions,
JetsBase const& jetsBase, JetsTag const& jetsTag,
Tracks const& tracks, Candidates const& candidates)
{

// initialise objects used to store the matching index arrays (array in case a mcCollision is split) before filling the matching tables
std::vector<std::vector<int>> jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF;
std::vector<std::vector<int>> jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF;
// waiting for framework fix to make sliced collection of same type as original collection:
jetsBasetoTagMatchingGeo.assign(jetsBase.size(), {});
jetsBasetoTagMatchingPt.assign(jetsBase.size(), {});
jetsBasetoTagMatchingHF.assign(jetsBase.size(), {});
jetsTagtoBaseMatchingGeo.assign(jetsTag.size(), {});
jetsTagtoBaseMatchingPt.assign(jetsTag.size(), {});
jetsTagtoBaseMatchingHF.assign(jetsTag.size(), {});

for (const auto& collision : collisions) {

const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, collision.globalIndex());
const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, collision.globalIndex());
// initialise template parameters as false since even if they are Mc we are not matching between detector and particle level
jetmatchingutilities::doAllMatching<false, false>(jetsBasePerColl, jetsTagPerColl, jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF, jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF, candidates, candidates, tracks, tracks, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction);
}

for (auto i = 0; i < jetsBase.size(); ++i) {
jetsBasetoTagMatchingTable(jetsBasetoTagMatchingGeo[i], jetsBasetoTagMatchingPt[i], jetsBasetoTagMatchingHF[i]); // is (and needs to) be filled in order
}
for (auto i = 0; i < jetsTag.size(); i++) {
jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order
}
}
PROCESS_SWITCH(JetMatchingDuplicates, processJets, "Perform jet matching", false);
};

using Charged1JetDataMatching = JetMatchingDuplicates<soa::Join<aod::ChargedJets, aod::ChargedJetConstituents>,
soa::Join<aod::Charged1Jets, aod::Charged1JetConstituents>,
aod::ChargedJetsMatchedToCharged1Jets,
aod::Charged1JetsMatchedToChargedJets,
aod::JTracks,
aod::JDummys>;

using Charged1JetMCDMatching = JetMatchingDuplicates<soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents>,
soa::Join<aod::Charged1MCDetectorLevelJets, aod::Charged1MCDetectorLevelJetConstituents>,
aod::ChargedMCDetectorLevelJetsMatchedToCharged1MCDetectorLevelJets,
aod::Charged1MCDetectorLevelJetsMatchedToChargedMCDetectorLevelJets,
aod::JTracks,
aod::JDummys>;

using Charged1JetMCPMatching = JetMatchingDuplicates<soa::Join<aod::ChargedMCParticleLevelJets, aod::ChargedMCParticleLevelJetConstituents>,
soa::Join<aod::Charged1MCParticleLevelJets, aod::Charged1MCParticleLevelJetConstituents>,
aod::ChargedMCParticleLevelJetsMatchedToCharged1MCParticleLevelJets,
aod::Charged1MCParticleLevelJetsMatchedToChargedMCParticleLevelJets,
aod::JMcParticles,
aod::JDummys>;

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

tasks.emplace_back(adaptAnalysisTask<Charged1JetDataMatching>(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-data-ch-1"}));
tasks.emplace_back(adaptAnalysisTask<Charged1JetMCDMatching>(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mcd-ch-1"}));
tasks.emplace_back(adaptAnalysisTask<Charged1JetMCPMatching>(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mcp-ch-1"}));

return WorkflowSpec{tasks};
}
Loading