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] Add centrality information to Xic0 #9128

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
69 changes: 66 additions & 3 deletions PWGHF/TableProducer/treeCreatorToXiPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
///
/// \author Federica Zanone <[email protected]>, Heidelberg University

#include "CommonConstants/PhysicsConstants.h"
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"

#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/Multiplicity.h"

#include "Common/Core/RecoDecay.h"

#include "PWGHF/DataModel/CandidateReconstructionTables.h"
Expand All @@ -31,9 +35,20 @@ namespace o2::aod
namespace full
{
// collision info
DECLARE_SOA_INDEX_COLUMN(Collision, collision);
DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision);
DECLARE_SOA_COLUMN(IsEventSel8, isEventSel8, bool);
DECLARE_SOA_COLUMN(IsEventSelZ, isEventSelZ, bool);
DECLARE_SOA_COLUMN(RunNumber, runNumber, int);
DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int);
DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float);
DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float);
DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float);
DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float);
DECLARE_SOA_COLUMN(CentFDDM, centFDDM, float);
DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float);
// from creator
DECLARE_SOA_COLUMN(Cent, cent, float);
DECLARE_SOA_COLUMN(XPv, xPv, float);
DECLARE_SOA_COLUMN(YPv, yPv, float);
DECLARE_SOA_COLUMN(ZPv, zPv, float);
Expand Down Expand Up @@ -147,9 +162,24 @@ DECLARE_SOA_COLUMN(TofNSigmaPrFromLambda, tofNSigmaPrFromLambda, float);
} // namespace full

DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV",
full::IsEventSel8, full::IsEventSelZ);
full::IsEventSel8, full::IsEventSelZ,
full::CollisionId,
full::McCollisionId,
collision::NumContrib,
collision::PosX,
collision::PosY,
collision::PosZ,
full::IsEventReject,
full::RunNumber,
full::CentFT0A,
full::CentFT0C,
full::CentFT0M,
full::CentFV0A,
full::CentFDDM,
full::MultZeqNTracksPV);

DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL",
full::CollisionId,
full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2,
full::XDecayVtxCharmBaryon, full::YDecayVtxCharmBaryon, full::ZDecayVtxCharmBaryon,
full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade,
Expand Down Expand Up @@ -184,6 +214,7 @@ DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL",
full::FlagMcMatchRec, full::DebugMcRec, full::OriginRec, full::CollisionMatched);

DECLARE_SOA_TABLE(HfToXiPiLites, "AOD", "HFTOXIPILITE",
full::CollisionId,
full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2,
full::XDecayVtxCharmBaryon, full::YDecayVtxCharmBaryon, full::ZDecayVtxCharmBaryon,
full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade,
Expand Down Expand Up @@ -218,9 +249,11 @@ struct HfTreeCreatorToXiPi {
Produces<o2::aod::HfToXiPiEvs> rowEv;

Configurable<float> zPvCut{"zPvCut", 10., "Cut on absolute value of primary vertex z coordinate"};
Configurable<bool> useCentrality{"useCentrality", false, "Decide whether to use centrality information"};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding a configurable, I would templetize the process function in order to have one version that consumes the centrality tables, and another one that doesn't (otherwise regardless the value of this configurable, the user must always add the centrality task since this workflow always consumes the centrality tables)


using Cents = soa::Join<aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFDDMs>;
using MyEventTable = soa::Join<aod::Collisions, aod::EvSels, aod::PVMultZeqs, Cents>;
using MyTrackTable = soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra>;
using MyEventTable = soa::Join<aod::Collisions, aod::EvSels>;

void init(InitContext const&)
{
Expand All @@ -232,13 +265,42 @@ struct HfTreeCreatorToXiPi {
template <typename T>
void fillEvent(const T& collision, float cutZPv)
{
rowEv(collision.sel8(), std::abs(collision.posZ()) < cutZPv);
float centFT0A = -1.f;
float centFT0C = -1.f;
float centFT0M = -1.f;
float centFV0A = -1.f;
float centFDDM = -1.f;
if (useCentrality) {
centFT0A = collision.centFT0A();
centFT0C = collision.centFT0C();
centFT0M = collision.centFT0M();
centFV0A = collision.centFV0A();
centFDDM = collision.centFDDM();
}

rowEv(
collision.sel8(), std::abs(collision.posZ()) < cutZPv,
collision.globalIndex(),
-1,
collision.numContrib(),
collision.posX(),
collision.posY(),
collision.posZ(),
0,
1,
centFT0A,
centFT0C,
centFT0M,
centFV0A,
centFDDM,
collision.multZeqNTracksPV());
}

template <typename T>
void fillCandidate(const T& candidate, int8_t flagMc, int8_t debugMc, int8_t originMc, bool collisionMatched)
{
rowCandidateFull(
candidate.collisionId(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to keep the collision Id? Please note that this doesn't allow you to link it to your event table, since the same collisionId can be found in different original DF, and you loose the info of the original DF in self-contained derived data due to AO2D merging. In fact, the addition of this index implies the error of unbound indices since the original collision table is not stored.
Also, even in case you want to store the collision Id (which is however not useful for the reason mentioned above), there is no need to declare the column as index column (because it doesn't point to any table that you store).

candidate.xPv(),
candidate.yPv(),
candidate.zPv(),
Expand Down Expand Up @@ -356,6 +418,7 @@ struct HfTreeCreatorToXiPi {
if (candidate.resultSelections() && candidate.statusPidCharmBaryon() && candidate.statusInvMassLambda() && candidate.statusInvMassCascade() && candidate.statusInvMassCharmBaryon()) {

rowCandidateLite(
candidate.collisionId(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of this index implies the error of unbound indices since the original collision table is not stored. We should not add it here (especially in the lite table which is typically meant for the production of samples for ML trainings and does not require the collisionId info)

candidate.xPv(),
candidate.yPv(),
candidate.zPv(),
Expand Down
Loading