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
10 changes: 10 additions & 0 deletions Analysis/Tasks/PWGHF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ o2_add_dpl_workflow(hf-candidate-creator-2prong
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing ROOT::EG
COMPONENT_NAME Analysis)

o2_add_dpl_workflow(hf-tree-creator-d0-to-k-pi
SOURCES HFTreeCreatorD0ToKPi.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing ROOT::EG
COMPONENT_NAME Analysis)

o2_add_dpl_workflow(hf-candidate-creator-3prong
SOURCES HFCandidateCreator3Prong.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing ROOT::EG
COMPONENT_NAME Analysis)

o2_add_dpl_workflow(hf-tree-creator-lc-to-p-k-pi
SOURCES HFTreeCreatorLcToPKPi.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing ROOT::EG
COMPONENT_NAME Analysis)

o2_add_dpl_workflow(hf-d0-candidate-selector
SOURCES HFD0CandidateSelector.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing
Expand Down
221 changes: 221 additions & 0 deletions Analysis/Tasks/PWGHF/HFCandidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{
ConfigParamSpec optionDoMC{"doMC", VariantType::Bool, false, {"Perform MC matching."}};
workflowOptions.push_back(optionDoMC);
ConfigParamSpec optionWriteTree{"writeTree", VariantType::Bool, false, {"Writing debug tree."}};
workflowOptions.push_back(optionWriteTree);
}

#include "Framework/runDataProcessing.h"
Expand Down Expand Up @@ -180,6 +182,221 @@ struct HFCandidateCreator2ProngMC {
}
};

namespace o2::aod
{
namespace full
{
DECLARE_SOA_COLUMN(XSecondaryVertex, xSecondaryVertex, float);
DECLARE_SOA_COLUMN(RSecondaryVertex, rSecondaryVertex, float);
DECLARE_SOA_COLUMN(PtProng0, ptProng0, float);
DECLARE_SOA_COLUMN(PProng0, pProng0, float);
DECLARE_SOA_COLUMN(ImpactParameterNormalised0, impactParameterNormalised0, float);
DECLARE_SOA_COLUMN(PtProng1, ptProng1, float);
DECLARE_SOA_COLUMN(PProng1, pProng1, float);
DECLARE_SOA_COLUMN(ImpactParameterNormalised1, impactParameterNormalised1, float);
DECLARE_SOA_COLUMN(M, m, float);
DECLARE_SOA_COLUMN(Pt, pt, float);
DECLARE_SOA_COLUMN(P, p, float);
DECLARE_SOA_COLUMN(Eta, eta, float);
DECLARE_SOA_COLUMN(Phi, phi, float);
DECLARE_SOA_COLUMN(Y, y, float);
DECLARE_SOA_COLUMN(E, e, float);
DECLARE_SOA_COLUMN(NSigTPC_Pi_0, nsigTPC_Pi_0, float);
DECLARE_SOA_COLUMN(NSigTPC_Ka_0, nsigTPC_Ka_0, float);
DECLARE_SOA_COLUMN(NSigTOF_Pi_0, nsigTOF_Pi_0, float);
DECLARE_SOA_COLUMN(NSigTOF_Ka_0, nsigTOF_Ka_0, float);
DECLARE_SOA_COLUMN(NSigTPC_Pi_1, nsigTPC_Pi_1, float);
DECLARE_SOA_COLUMN(NSigTPC_Ka_1, nsigTPC_Ka_1, float);
DECLARE_SOA_COLUMN(NSigTOF_Pi_1, nsigTOF_Pi_1, float);
DECLARE_SOA_COLUMN(NSigTOF_Ka_1, nsigTOF_Ka_1, float);
DECLARE_SOA_COLUMN(DecayLength, decayLength, float);
DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float);
DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float);
DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float);
DECLARE_SOA_COLUMN(CPA, cpa, float);
DECLARE_SOA_COLUMN(CPAXY, cpaXY, float);
DECLARE_SOA_COLUMN(Ct, ct, float);
DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float);
DECLARE_SOA_COLUMN(CosThetaStar, cosThetaStar, float);
DECLARE_SOA_COLUMN(MCflag, mcflag, uint8_t);
// Events
DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int);
DECLARE_SOA_COLUMN(RunNumber, runNumber, int);
} // namespace full

DECLARE_SOA_TABLE(HfCandProng2Full, "AOD", "HFCANDP2Full",
collision::BCId,
collision::NumContrib,
collision::PosX,
collision::PosY,
collision::PosZ,
hf_cand::XSecondaryVertex,
hf_cand::YSecondaryVertex,
hf_cand::ZSecondaryVertex,
hf_cand::ErrorDecayLength,
hf_cand::ErrorDecayLengthXY,
hf_cand::Chi2PCA,
full::RSecondaryVertex,
full::DecayLength,
full::DecayLengthXY,
full::DecayLengthNormalised,
full::DecayLengthXYNormalised,
full::ImpactParameterNormalised0,
full::PtProng0,
full::PProng0,
full::ImpactParameterNormalised1,
full::PtProng1,
full::PProng1,
hf_cand::PxProng0,
hf_cand::PyProng0,
hf_cand::PzProng0,
hf_cand::PxProng1,
hf_cand::PyProng1,
hf_cand::PzProng1,
hf_cand::ImpactParameter0,
hf_cand::ImpactParameter1,
hf_cand::ErrorImpactParameter0,
hf_cand::ErrorImpactParameter1,
full::NSigTPC_Pi_0,
full::NSigTPC_Ka_0,
full::NSigTOF_Pi_0,
full::NSigTOF_Ka_0,
full::NSigTPC_Pi_1,
full::NSigTPC_Ka_1,
full::NSigTOF_Pi_1,
full::NSigTOF_Ka_1,
full::M,
full::ImpactParameterProduct,
full::CosThetaStar,
full::Pt,
full::P,
full::CPA,
full::CPAXY,
full::Ct,
full::Eta,
full::Phi,
full::Y,
full::E,
full::MCflag);

DECLARE_SOA_TABLE(HfCandProng2FullEvents, "AOD", "HFCANDP2FullE",
collision::BCId,
collision::NumContrib,
collision::PosX,
collision::PosY,
collision::PosZ,
full::IsEventReject,
full::RunNumber);

DECLARE_SOA_TABLE(HfCandProng2FullParticles, "AOD", "HFCANDP2FullP",
collision::BCId,
full::Pt,
full::Eta,
full::Phi,
full::Y,
full::MCflag);

} // namespace o2::aod

/// Writes a debug tree
struct CandidateTreeWriter {
Produces<o2::aod::HfCandProng2Full> rowCandidateFull;
Produces<o2::aod::HfCandProng2FullEvents> rowCandidateFullEvents;
Produces<o2::aod::HfCandProng2FullParticles> rowCandidateFullParticles;
void init(InitContext const&)
{
}
void process(aod::Collisions const& collisions,
aod::McCollisions const& mccollisions,
soa::Join<aod::HfCandProng2, aod::HfCandProng2MCRec> const& candidates,
soa::Join<aod::McParticles, aod::HfCandProng2MCGen> const& particles,
aod::BigTracksPID const& tracks)
{
rowCandidateFullEvents.reserve(collisions.size());
for (auto& collision : collisions) {
rowCandidateFullEvents(
collision.bcId(),
collision.numContrib(),
collision.posX(),
collision.posY(),
collision.posZ(),
0,
1);
}
rowCandidateFull.reserve(candidates.size());
for (auto& candidate : candidates) {
rowCandidateFull(
candidate.index0_as<aod::BigTracksPID>().collision().bcId(),
candidate.index0_as<aod::BigTracksPID>().collision().numContrib(),
candidate.posX(),
candidate.posY(),
candidate.posZ(),
candidate.xSecondaryVertex(),
candidate.ySecondaryVertex(),
candidate.zSecondaryVertex(),
candidate.errorDecayLength(),
candidate.errorDecayLengthXY(),
candidate.chi2PCA(),
candidate.rSecondaryVertex(),
candidate.decayLength(),
candidate.decayLengthXY(),
candidate.decayLengthNormalised(),
candidate.decayLengthXYNormalised(),
candidate.impactParameterNormalised0(),
TMath::Abs(candidate.ptProng0()),
TMath::Sqrt(RecoDecay::P(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0())),
candidate.impactParameterNormalised1(),
TMath::Abs(candidate.ptProng1()),
TMath::Sqrt(RecoDecay::P(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1())),
candidate.pxProng0(),
candidate.pyProng0(),
candidate.pzProng0(),
candidate.pxProng1(),
candidate.pyProng1(),
candidate.pzProng1(),
candidate.impactParameter0(),
candidate.impactParameter1(),
candidate.errorImpactParameter0(),
candidate.errorImpactParameter1(),
candidate.index0_as<aod::BigTracksPID>().tpcNSigmaPi(),
candidate.index0_as<aod::BigTracksPID>().tpcNSigmaKa(),
candidate.index0_as<aod::BigTracksPID>().tofNSigmaPi(),
candidate.index0_as<aod::BigTracksPID>().tofNSigmaKa(),
candidate.index1_as<aod::BigTracksPID>().tpcNSigmaPi(),
candidate.index1_as<aod::BigTracksPID>().tpcNSigmaKa(),
candidate.index1_as<aod::BigTracksPID>().tofNSigmaPi(),
candidate.index1_as<aod::BigTracksPID>().tofNSigmaKa(),
InvMassD0(candidate),
candidate.impactParameterProduct(),
CosThetaStarD0(candidate),
candidate.pt(),
candidate.p(),
candidate.cpa(),
candidate.cpaXY(),
CtD0(candidate),
candidate.eta(),
candidate.phi(),
YD0(candidate),
ED0(candidate),
candidate.flagMCMatchRec());
}

int npart = 0;
rowCandidateFullParticles.reserve(particles.size());
for (auto& particle : particles) {
if (particle.flagMCMatchGen()) {
rowCandidateFullParticles(
particle.mcCollision().bcId(),
particle.pt(),
particle.eta(),
particle.phi(),
RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode())),
particle.flagMCMatchGen());
}
}
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
WorkflowSpec workflow{
Expand All @@ -189,5 +406,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
if (doMC) {
workflow.push_back(adaptAnalysisTask<HFCandidateCreator2ProngMC>("hf-cand-creator-2prong-mc"));
}
const bool writeTree = cfgc.options().get<bool>("writeTree");
if (writeTree) {
workflow.push_back(adaptAnalysisTask<CandidateTreeWriter>("hf-cand-tree-2prong-writer"));
}
return workflow;
}
Loading