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

[PWGHF,PWGJE] Adding B+ to the jet workflow #8726

Closed
wants to merge 1 commit 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
114 changes: 114 additions & 0 deletions PWGHF/Core/HfDerivedData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// 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 HfDerivedData.h
/// \brief Class with helper functions for HF derived data format
///
/// \author Nima Zardoshti <[email protected]>, CERN

#ifndef PWGHF_CORE_HFDERIVEDDATA_H_
#define PWGHF_CORE_HFDERIVEDDATA_H_

#include "Common/Core/RecoDecay.h"

class HfDerivedData
{
public:
/// Default constructor
HfDerivedData() = default;

/// Default destructor
~HfDerivedData() = default;

template <bool isMC, typename T, typename U, typename V, typename M>
void fillCollTables(const T& collision, bool fillCollBase, U& collBaseTable, bool fillCollId, V& collIdTable, bool fillMcRCollId, M& matchedCollisions)
{
if (fillCollBase) {
collBaseTable(
collision.posX(),
collision.posY(),
collision.posZ(),
collision.numContrib(),
collision.centFT0A(),
collision.centFT0C(),
collision.centFT0M(),
collision.centFV0A(),
collision.multZeqNTracksPV());
}
if (fillCollId) {
collIdTable(collision.globalIndex());
}

if constexpr (isMC) {
if (fillMcRCollId && collision.has_mcCollision()) {
LOGF(debug, "Rec. collision %d: Filling derived-collision index %d for MC collision %d", collision.globalIndex(), collBaseTable.lastIndex(), collision.mcCollisionId());
matchedCollisions[collision.mcCollisionId()].push_back(collBaseTable.lastIndex()); // [] inserts an empty element if it does not exist
}
}
}

template <typename T, typename U, typename V, typename M, typename N>
void fillCollMcTables(const T& mcCollision, bool fillMcCollBase, U& mcCollBaseTable, bool fillMcCollId, V& mcCollIdTable, bool fillMcRCollId, M& matchedCollisions, N& rmcRCollIdTable)
{
if (fillMcCollBase) {
mcCollBaseTable(
mcCollision.posX(),
mcCollision.posY(),
mcCollision.posZ());
}
if (fillMcCollId) {
mcCollIdTable(
mcCollision.globalIndex());
}
if (fillMcRCollId) {
rmcRCollIdTable(
matchedCollisions[mcCollision.globalIndex()]);
}
}

template <typename T, typename U, typename V>
void fillCandidateTables(const T& candidate, bool fillCandidateBase, U& candidateBaseTable, V& collBaseTable, double invMass, double y)
{
if (fillCandidateBase) {
candidateBaseTable(
collBaseTable.lastIndex(), // lastIndex is not marked as const so collBaseTable cannot be passed as const either. Should be ok here though
candidate.pt(),
candidate.eta(),
candidate.phi(),
invMass,
y);
}
}

template <typename T, typename U, typename V, typename M, typename N>
void fillParticleTables(const T& particle, bool fillParticleBase, U& particleBaseTable, V& mcCollBaseTable, M mass, bool fillParticleId, N& particleIdTable)
{
if (fillParticleBase) {
particleBaseTable(
mcCollBaseTable.lastIndex(), // lastIndex is not marked as const so mcCollBaseTable cannot be passed as const either. Should be ok here though
particle.pt(),
particle.eta(),
particle.phi(),
RecoDecayPtEtaPhi::y(particle.pt(), particle.eta(), mass),
particle.flagMcMatchGen(),
particle.originMcGen());
}
if (fillParticleId) {
particleIdTable(
particle.mcCollisionId(),
particle.globalIndex());
}
}

private:
};

#endif // PWGHF_CORE_HFDERIVEDDATA_H_
Loading
Loading