diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index b97060d5a3f..39cd9004ca2 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -44,6 +44,11 @@ o2physics_add_dpl_workflow(candidate-creator-xicc PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(candidate-creator-chic + SOURCES HFCandidateCreatorChic.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(candidate-creator-lb SOURCES HFCandidateCreatorLb.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG @@ -54,11 +59,6 @@ o2physics_add_dpl_workflow(candidate-creator-x PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(candidate-creator-chic - SOURCES HFCandidateCreatorChic.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(tree-creator-lc-topkpi SOURCES HFTreeCreatorLcToPKPi.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG @@ -74,6 +74,11 @@ o2physics_add_dpl_workflow(tree-creator-xicc-topkpipi PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(tree-creator-chic-tojpsigamma + SOURCES HFTreeCreatorChicToJpsiGamma.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(d0-candidate-selector SOURCES HFD0CandidateSelector.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing diff --git a/PWGHF/TableProducer/HFTreeCreatorChicToJpsiGamma.cxx b/PWGHF/TableProducer/HFTreeCreatorChicToJpsiGamma.cxx new file mode 100644 index 00000000000..905afcbe0e7 --- /dev/null +++ b/PWGHF/TableProducer/HFTreeCreatorChicToJpsiGamma.cxx @@ -0,0 +1,227 @@ +// 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 HFTreeCreator3Prong.cxx +/// \brief Writer of the 3 prong candidates in the form of flat tables to be stored in TTrees. +/// Intended for debug or for the local optimization of analysis on small samples. +/// In this file are defined and filled the output tables +/// +/// \author Alessandro De Falco , Università/INFN Cagliari +/// \note based on O2Physics/Tasks/PWGHF/HFTreeCreatorXToJPsiPiPi.cxx +/// \author Luca Micheletti , INFN + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "DetectorsVertexing/DCAFitterN.h" +#include "PWGHF/DataModel/HFSecondaryVertex.h" +#include "PWGHF/DataModel/HFCandidateSelectionTables.h" +#include "Common/Core/trackUtilities.h" +#include "ReconstructionDataFormats/DCA.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::aod::hf_cand_chic; + +namespace o2::aod +{ +namespace full +{ +DECLARE_SOA_COLUMN(ImpactParameterNormalised0, impactParameterNormalised0, float); +DECLARE_SOA_COLUMN(RSecondaryVertex, rSecondaryVertex, float); +DECLARE_SOA_COLUMN(DecayLength, decayLength, float); +DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); +DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); +DECLARE_SOA_COLUMN(PProng0, pProng0, float); +DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); +DECLARE_SOA_COLUMN(PProng1, pProng1, float); +DECLARE_SOA_COLUMN(Alpha, alpha, float); +DECLARE_SOA_COLUMN(Qt, qt, float); +DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); +DECLARE_SOA_COLUMN(M, m, float); +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(P, p, float); +DECLARE_SOA_COLUMN(CPA, cpa, float); +DECLARE_SOA_COLUMN(CPAXY, cpaXY, float); +DECLARE_SOA_COLUMN(Ct, ct, 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(MCflag, mcflag, int8_t); +// Events +DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); +DECLARE_SOA_COLUMN(RunNumber, runNumber, int); +} // namespace full + +DECLARE_SOA_TABLE(HfCandChicFull, "AOD", "HFCANDChicFull", + collision::BCId, + collision::NumContrib, + collision::PosX, + collision::PosY, + collision::PosZ, + full::ImpactParameterNormalised0, + full::RSecondaryVertex, + full::DecayLength, + full::DecayLengthXY, + full::PtProng0, + full::PProng0, + full::PtProng1, + full::PProng1, + full::Alpha, + full::Qt, + hf_cand::Chi2PCA, + hf_cand::ImpactParameter0, + full::CandidateSelFlag, + full::M, + full::Pt, + full::P, + full::CPA, + full::CPAXY, + full::Ct, + full::Eta, + full::Phi, + full::Y, + hf_cand_chic::JpsiToMuMuMass, + full::MCflag); + +DECLARE_SOA_TABLE(HfCandChicFullEvents, "AOD", "HFCANDChicFullE", + collision::BCId, + collision::NumContrib, + collision::PosX, + collision::PosY, + collision::PosZ, + full::IsEventReject, + full::RunNumber); + +DECLARE_SOA_TABLE(HfCandChicFullParticles, "AOD", "HFCANDChicFullP", + collision::BCId, + full::Pt, + full::Eta, + full::Phi, + full::Y, + hf_cand_chic::JpsiToMuMuMass, + full::MCflag); + +} // namespace o2::aod + +/// Writes the full information in an output TTree +struct HfTreeCreatorChicToJpsiGamma { + Produces rowCandidateFull; + Produces rowCandidateFullEvents; + Produces rowCandidateFullParticles; + + void init(InitContext const&) + { + } + + void process(aod::Collisions const& collisions, + aod::McCollisions const& mccollisions, + soa::Join const& candidates, + soa::Join const& particles, + aod::BigTracksPID const& tracks, + aod::HfCandProng2 const& jpsiCands) + { + + // Filling event properties + rowCandidateFullEvents.reserve(collisions.size()); + for (auto& collision : collisions) { + rowCandidateFullEvents( + collision.bcId(), + collision.numContrib(), + collision.posX(), + collision.posY(), + collision.posZ(), + 0, + 1); + } + + // Filling candidate properties + int indexCand = 0; + rowCandidateFull.reserve(candidates.size()); + for (auto& candidate : candidates) { + array pvecChic = {candidate.px(), candidate.py(), candidate.pz()}; + array pvecJpsi = {candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()}; + array pvecGamma = {candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}; + auto pchic = RecoDecay::P(pvecChic); + auto pjpsi = RecoDecay::P(pvecJpsi); + auto pl1 = std::abs(RecoDecay::dotProd(pvecChic, pvecJpsi)) / pchic; + auto pl2 = std::abs(RecoDecay::dotProd(pvecChic, pvecGamma)) / pchic; + auto alpha = (pl1 - pl2) / (pl1 + pl2); + auto qt = std::sqrt(pjpsi * pjpsi - pl1 * pl1); + + indexCand++; + auto fillTable = [&](int CandFlag, + int FunctionSelection, + float FunctionInvMass, + float FunctionCt, + float FunctionY) { + if (FunctionSelection >= 1) { + rowCandidateFull( + candidate.index0().index0_as().collision().bcId(), + candidate.index0().index0_as().collision().numContrib(), + candidate.posX(), + candidate.posY(), + candidate.posZ(), + candidate.impactParameterNormalised0(), + candidate.rSecondaryVertex(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.ptProng0(), + RecoDecay::P(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()), + candidate.ptProng1(), + RecoDecay::P(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), + alpha, + qt, + candidate.chi2PCA(), + candidate.impactParameter0(), + 1 << CandFlag, + FunctionInvMass, + candidate.pt(), + candidate.p(), + candidate.cpa(), + candidate.cpaXY(), + FunctionCt, + candidate.eta(), + candidate.phi(), + FunctionY, + candidate.jpsiToMuMuMass(), + candidate.flagMCMatchRec()); + } + }; + fillTable(0, candidate.isSelChicToJpsiToMuMuGamma(), InvMassChicToJpsiGamma(candidate), CtChic(candidate), YChic(candidate)); + // fillTable(1, candidate.isSelChicToJpsiToEEGamma(), InvMassChicToJpsiGamma(candidate), CtChic(candidate), YChic(candidate)); + } + + // Filling particle properties + float massChic = RecoDecay::getMassPDG(pdg::Code::kChic1); + rowCandidateFullParticles.reserve(particles.size()); + for (auto& particle : particles) { + if (std::abs(particle.flagMCMatchGen()) == 1 << DecayType::ChicToJpsiToEEGamma || std::abs(particle.flagMCMatchGen()) == 1 << DecayType::ChicToJpsiToMuMuGamma) { + rowCandidateFullParticles( + particle.mcCollision().bcId(), + particle.pt(), + particle.eta(), + particle.phi(), + RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, massChic), + 0., // put here the jpsi mass + particle.flagMCMatchGen()); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + WorkflowSpec workflow; + workflow.push_back(adaptAnalysisTask(cfgc)); + return workflow; +}