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
18 changes: 17 additions & 1 deletion PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/D2H/DataModel/ReducedDataModel.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::hf_trkcandsel;

/// Reconstruction of B0 candidates
struct HfCandidateCreatorB0Reduced {
Expand Down Expand Up @@ -64,6 +66,7 @@ struct HfCandidateCreatorB0Reduced {
Preslice<soa::Join<aod::HfRed3Prongs, aod::HfRed3ProngsCov, aod::HfRed3ProngsMl>> candsDWithMlPerCollision = hf_track_index_reduced::hfRedCollisionId;
Preslice<soa::Join<aod::HfRedTrackBases, aod::HfRedTracksCov>> tracksPionPerCollision = hf_track_index_reduced::hfRedCollisionId;

std::shared_ptr<TH1> hCandidates;
HistogramRegistry registry{"registry"};

void init(InitContext const&)
Expand Down Expand Up @@ -92,6 +95,10 @@ struct HfCandidateCreatorB0Reduced {
registry.add("hCovPVXX", "2-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 1.e-4}}});
registry.add("hCovSVXX", "2-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 0.2}}});
registry.add("hEvents", "Events;;entries", HistType::kTH1F, {{1, 0.5, 1.5}});

/// candidate monitoring
hCandidates = registry.add<TH1>("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}});
setLabelHistoCands(hCandidates);
}

/// Main function to perform B0 candidate creation
Expand Down Expand Up @@ -135,9 +142,18 @@ struct HfCandidateCreatorB0Reduced {
}
// ---------------------------------
// reconstruct the 2-prong B0 vertex
if (df2.process(trackParCovD, trackParCovPi) == 0) {
hCandidates->Fill(SVFitting::BeforeFit);
try {
if (df2.process(trackParCovD, trackParCovPi) == 0) {
continue;
}
} catch (const std::runtime_error& error) {
LOG(info) << "Run time error found: " << error.what() << ". DCFitterN cannot work, skipping the candidate.";
hCandidates->Fill(SVFitting::Fail);
continue;
}
hCandidates->Fill(SVFitting::FitOk);

// DPi passed B0 reconstruction

// calculate relevant properties
Expand Down
18 changes: 17 additions & 1 deletion PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/D2H/DataModel/ReducedDataModel.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::hf_trkcandsel;

/// Reconstruction of B+ candidates
struct HfCandidateCreatorBplusReduced {
Expand Down Expand Up @@ -61,6 +63,7 @@ struct HfCandidateCreatorBplusReduced {
Preslice<soa::Join<aod::HfRed2Prongs, aod::HfRed2ProngsCov>> candsDPerCollision = hf_track_index_reduced::hfRedCollisionId;
Preslice<soa::Join<aod::HfRedTracks, aod::HfRedTracksCov>> tracksPionPerCollision = hf_track_index_reduced::hfRedCollisionId;

std::shared_ptr<TH1> hCandidates;
HistogramRegistry registry{"registry"};

void init(InitContext const&)
Expand All @@ -84,6 +87,10 @@ struct HfCandidateCreatorBplusReduced {
registry.add("hCovPVXX", "2-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 1.e-4}}});
registry.add("hCovSVXX", "2-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 0.2}}});
registry.add("hEvents", "Events;;entries", HistType::kTH1F, {{1, 0.5, 1.5}});

/// candidate monitoring
hCandidates = registry.add<TH1>("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}});
setLabelHistoCands(hCandidates);
}

void process(HfRedCollisionsWithExtras const& collisions,
Expand Down Expand Up @@ -138,9 +145,18 @@ struct HfCandidateCreatorBplusReduced {
}
// ---------------------------------
// reconstruct the 2-prong B+ vertex
if (df2.process(trackParCovD, trackParCovPi) == 0) {
hCandidates->Fill(SVFitting::BeforeFit);
try {
if (df2.process(trackParCovD, trackParCovPi) == 0) {
continue;
}
} catch (const std::runtime_error& error) {
LOG(info) << "Run time error found: " << error.what() << ". DCFitterN cannot work, skipping the candidate.";
hCandidates->Fill(SVFitting::Fail);
continue;
}
hCandidates->Fill(SVFitting::FitOk);

// D0Pi passed B+ reconstruction

// calculate relevant properties
Expand Down
33 changes: 31 additions & 2 deletions PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/Utils/utilsBfieldCCDB.h"
#include "PWGHF/D2H/DataModel/ReducedDataModel.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"

using namespace o2;
using namespace o2::analysis;
using namespace o2::aod;
using namespace o2::constants::physics;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::hf_trkcandsel;

enum Event : uint8_t {
Processed = 0,
Expand Down Expand Up @@ -148,6 +150,7 @@ struct HfDataCreatorCharmHadPiReduced {
Preslice<CandsD0FilteredWithMl> candsD0PerCollisionWithMl = aod::track_association::collisionId;
Preslice<aod::TrackAssoc> trackIndicesPerCollision = aod::track_association::collisionId;

std::shared_ptr<TH1> hCandidatesD0, hCandidatesDPlus;
HistogramRegistry registry{"registry"};

void init(InitContext const&)
Expand Down Expand Up @@ -232,6 +235,12 @@ struct HfDataCreatorCharmHadPiReduced {
registry.add(Form("hPt%s", histMassTitle0.data()), Form("%s candidates candidates;%s candidate #it{p}_{T} (GeV/#it{c});entries", charmHadTitle0.data(), charmHadTitle0.data()), {HistType::kTH1F, {{100, 0., 10.}}});
registry.add("hPtPion", "#pi^{#plus} candidates;#pi^{#plus} candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}});
registry.add(Form("hCpa%s", histMassTitle0.data()), Form("%s candidates;%s cosine of pointing angle;entries", charmHadTitle0.data(), charmHadTitle0.data()), {HistType::kTH1F, {{110, -1.1, 1.1}}});

/// candidate monitoring
hCandidatesD0 = registry.add<TH1>("hCandidatesD0", "D candidate counter", {HistType::kTH1D, {axisCands}});
hCandidatesDPlus = registry.add<TH1>("hCandidatesDPlus", "B candidate counter", {HistType::kTH1D, {axisCands}});
setLabelHistoCands(hCandidatesD0);
setLabelHistoCands(hCandidatesDPlus);
}

/// Pion selection (D Pi <-- B0)
Expand Down Expand Up @@ -518,9 +527,19 @@ struct HfDataCreatorCharmHadPiReduced {
o2::track::TrackParCov trackParCovCharmHad{};
std::array<float, 3> pVecCharm{};
if constexpr (decChannel == DecayChannel::B0ToDminusPi) { // D∓ → π∓ K± π∓
if (df3.process(trackParCov0, trackParCov1, trackParCov2) == 0) {

hCandidatesDPlus->Fill(SVFitting::BeforeFit);
try {
if (df3.process(trackParCov0, trackParCov1, trackParCov2) == 0) {
continue;
}
} catch (const std::runtime_error& error) {
LOG(info) << "Run time error found: " << error.what() << ". DCFitterN cannot work, skipping the candidate.";
hCandidatesDPlus->Fill(SVFitting::Fail);
continue;
}
hCandidatesDPlus->Fill(SVFitting::FitOk);

auto secondaryVertexCharm = df3.getPCACandidate();
trackParCov0.propagateTo(secondaryVertexCharm[0], bz);
trackParCov1.propagateTo(secondaryVertexCharm[0], bz);
Expand All @@ -532,9 +551,19 @@ struct HfDataCreatorCharmHadPiReduced {
trackParCovCharmHad = df3.createParentTrackParCov();
trackParCovCharmHad.setAbsCharge(charmHadDauTracks[1].sign()); // to be sure
} else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓
if (df2.process(trackParCov0, trackParCov1) == 0) {

hCandidatesD0->Fill(SVFitting::BeforeFit);
try {
if (df2.process(trackParCov0, trackParCov1) == 0) {
continue;
}
} catch (const std::runtime_error& error) {
LOG(info) << "Run time error found: " << error.what() << ". DCFitterN cannot work, skipping the candidate.";
hCandidatesD0->Fill(SVFitting::Fail);
continue;
}
hCandidatesD0->Fill(SVFitting::FitOk);

auto secondaryVertexCharm = df2.getPCACandidate();
trackParCov0.propagateTo(secondaryVertexCharm[0], bz);
trackParCov1.propagateTo(secondaryVertexCharm[0], bz);
Expand Down
19 changes: 17 additions & 2 deletions PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsBfieldCCDB.h"
#include "PWGHF/Utils/utilsEvSelHf.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"

using namespace o2;
using namespace o2::analysis;
using namespace o2::hf_evsel;
using namespace o2::hf_trkcandsel;
using namespace o2::aod::hf_cand_2prong;
using namespace o2::aod::hf_collision_centrality;
using namespace o2::constants::physics;
Expand Down Expand Up @@ -92,7 +94,7 @@ struct HfCandidateCreator2Prong {
double massKPi{0.};
double bz{0.};

std::shared_ptr<TH1> hCollisions, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel;
std::shared_ptr<TH1> hCollisions, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hCandidates;
HistogramRegistry registry{"registry"};

void init(InitContext const&)
Expand Down Expand Up @@ -143,6 +145,7 @@ struct HfCandidateCreator2Prong {
hPosXAfterEvSel = registry.add<TH1>("hPosXAfterEvSel", "selected events;#it{x}_{prim. vtx.} (cm);entries", {HistType::kTH1D, {{200, -0.5, 0.5}}});
hPosYAfterEvSel = registry.add<TH1>("hPosYAfterEvSel", "selected events;#it{y}_{prim. vtx.} (cm);entries", {HistType::kTH1D, {{200, -0.5, 0.5}}});
hNumPvContributorsAfterSel = registry.add<TH1>("hNumPvContributorsAfterSel", "selected events;#it{y}_{prim. vtx.} (cm);entries", {HistType::kTH1D, {{500, -0.5, 499.5}}});
hCandidates = registry.add<TH1>("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}});

massPi = MassPiPlus;
massK = MassKPlus;
Expand Down Expand Up @@ -171,6 +174,9 @@ struct HfCandidateCreator2Prong {

/// collision monitoring
setLabelHistoEvSel(hCollisions);

/// candidate monitoring
setLabelHistoCands(hCandidates);
}

template <bool doPvRefit, o2::aod::hf_collision_centrality::CentralityEstimator centEstimator, typename Coll, typename CandType, typename TTracks>
Expand Down Expand Up @@ -211,9 +217,18 @@ struct HfCandidateCreator2Prong {
df.setBz(bz);

// reconstruct the 2-prong secondary vertex
if (df.process(trackParVarPos1, trackParVarNeg1) == 0) {
hCandidates->Fill(SVFitting::BeforeFit);
try {
if (df.process(trackParVarPos1, trackParVarNeg1) == 0) {
continue;
}
} catch (const std::runtime_error& error) {
LOG(info) << "Run time error found: " << error.what() << ". DCFitterN cannot work, skipping the candidate.";
hCandidates->Fill(SVFitting::Fail);
continue;
}
hCandidates->Fill(SVFitting::FitOk);

const auto& secondaryVertex = df.getPCACandidate();
auto chi2PCA = df.getChi2AtPCACandidate();
auto covMatrixPCA = df.calcPCACovMatrixFlat();
Expand Down
19 changes: 17 additions & 2 deletions PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/Utils/utilsBfieldCCDB.h"
#include "PWGHF/Utils/utilsEvSelHf.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"

using namespace o2;
using namespace o2::analysis;
using namespace o2::hf_evsel;
using namespace o2::hf_trkcandsel;
using namespace o2::aod::hf_cand_3prong;
using namespace o2::aod::hf_collision_centrality;
using namespace o2::constants::physics;
Expand Down Expand Up @@ -90,7 +92,7 @@ struct HfCandidateCreator3Prong {
// filter candidates
Filter filterSelected3Prongs = (createDplus && (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi))) != static_cast<uint8_t>(0)) || (createDs && (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi))) != static_cast<uint8_t>(0)) || (createLc && (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_3prong::DecayType::LcToPKPi))) != static_cast<uint8_t>(0)) || (createXic && (o2::aod::hf_track_index::hfflag & static_cast<uint8_t>(BIT(aod::hf_cand_3prong::DecayType::XicToPKPi))) != static_cast<uint8_t>(0));

std::shared_ptr<TH1> hCollisions, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel;
std::shared_ptr<TH1> hCollisions, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hCandidates;
HistogramRegistry registry{"registry"};

void init(InitContext const&)
Expand Down Expand Up @@ -142,6 +144,7 @@ struct HfCandidateCreator3Prong {
hPosXAfterEvSel = registry.add<TH1>("hPosXAfterEvSel", "selected events;#it{x}_{prim. vtx.} (cm);entries", {HistType::kTH1D, {{200, -0.5, 0.5}}});
hPosYAfterEvSel = registry.add<TH1>("hPosYAfterEvSel", "selected events;#it{y}_{prim. vtx.} (cm);entries", {HistType::kTH1D, {{200, -0.5, 0.5}}});
hNumPvContributorsAfterSel = registry.add<TH1>("hNumPvContributorsAfterSel", "selected events;#it{y}_{prim. vtx.} (cm);entries", {HistType::kTH1D, {{500, -0.5, 499.5}}});
hCandidates = registry.add<TH1>("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}});

massPi = MassPiPlus;
massK = MassKPlus;
Expand All @@ -164,6 +167,9 @@ struct HfCandidateCreator3Prong {

/// collision monitoring
setLabelHistoEvSel(hCollisions);

/// candidate monitoring
setLabelHistoCands(hCandidates);
}

template <bool doPvRefit = false, o2::aod::hf_collision_centrality::CentralityEstimator centEstimator, typename Coll, typename Cand>
Expand Down Expand Up @@ -206,9 +212,18 @@ struct HfCandidateCreator3Prong {
df.setBz(bz);

// reconstruct the 3-prong secondary vertex
if (df.process(trackParVar0, trackParVar1, trackParVar2) == 0) {
hCandidates->Fill(SVFitting::BeforeFit);
try {
if (df.process(trackParVar0, trackParVar1, trackParVar2) == 0) {
continue;
}
} catch (const std::runtime_error& error) {
LOG(info) << "Run time error found: " << error.what() << ". DCFitterN cannot work, skipping the candidate.";
hCandidates->Fill(SVFitting::Fail);
continue;
}
hCandidates->Fill(SVFitting::FitOk);

const auto& secondaryVertex = df.getPCACandidate();
auto chi2PCA = df.getChi2AtPCACandidate();
auto covMatrixPCA = df.calcPCACovMatrixFlat();
Expand Down
33 changes: 30 additions & 3 deletions PWGHF/TableProducer/candidateCreatorB0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
#include "PWGHF/DataModel/CandidateSelectionTables.h"
#include "PWGHF/Utils/utilsBfieldCCDB.h"
#include "PWGHF/Utils/utilsTrkCandHf.h"

using namespace o2;
using namespace o2::analysis;
using namespace o2::aod;
using namespace o2::constants::physics;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::hf_trkcandsel;

/// Reconstruction of B0 candidates
struct HfCandidateCreatorB0 {
Produces<aod::HfCandB0Base> rowCandidateBase; // table defined in CandidateReconstructionTables.h
Produces<aod::HfCandB0Base> rowCandidateBase; // table defined in CandidateReconstructionTables.h
Produces<aod::HfCandB0Prongs> rowCandidateProngs; // table defined in CandidateReconstructionTables.h

// vertexing
Expand Down Expand Up @@ -99,6 +101,9 @@ struct HfCandidateCreatorB0 {
OutputObj<TH1F> hCovPVXX{TH1F("hCovPVXX", "2-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", 100, 0., 1.e-4)};
OutputObj<TH1F> hCovSVXX{TH1F("hCovSVXX", "2-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", 100, 0., 0.2)};

std::shared_ptr<TH1> hCandidatesD, hCandidatesB;
HistogramRegistry registry{"registry"};

void init(InitContext const&)
{
// invariant-mass window cut
Expand Down Expand Up @@ -132,6 +137,12 @@ struct HfCandidateCreatorB0 {
ccdb->setLocalObjectValidityChecking();
lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get<o2::base::MatLayerCylSet>(ccdbPathLut));
runNumber = 0;

/// candidate monitoring
hCandidatesD = registry.add<TH1>("hCandidatesD", "D candidate counter", {HistType::kTH1D, {axisCands}});
hCandidatesB = registry.add<TH1>("hCandidatesB", "B candidate counter", {HistType::kTH1D, {axisCands}});
setLabelHistoCands(hCandidatesD);
setLabelHistoCands(hCandidatesB);
}

/// Single-track cuts for pions on dcaXY
Expand Down Expand Up @@ -224,9 +235,17 @@ struct HfCandidateCreatorB0 {

// ---------------------------------
// reconstruct 3-prong secondary vertex (D±)
if (df3.process(trackParCov0, trackParCov1, trackParCov2) == 0) {
hCandidatesD->Fill(SVFitting::BeforeFit);
try {
if (df3.process(trackParCov0, trackParCov1, trackParCov2) == 0) {
continue;
}
} catch (const std::runtime_error& error) {
LOG(info) << "Run time error found: " << error.what() << ". DCFitterN for D cannot work, skipping the candidate.";
hCandidatesD->Fill(SVFitting::Fail);
continue;
}
hCandidatesD->Fill(SVFitting::FitOk);

const auto& secondaryVertexD = df3.getPCACandidate();
// propagate the 3 prongs to the secondary vertex
Expand Down Expand Up @@ -278,9 +297,17 @@ struct HfCandidateCreatorB0 {

// ---------------------------------
// reconstruct the 2-prong B0 vertex
if (df2.process(trackParCovD, trackParCovPi) == 0) {
hCandidatesB->Fill(SVFitting::BeforeFit);
try {
if (df2.process(trackParCovD, trackParCovPi) == 0) {
continue;
}
} catch (const std::runtime_error& error) {
LOG(info) << "Run time error found: " << error.what() << ". DCFitterN for B cannot work, skipping the candidate.";
hCandidatesB->Fill(SVFitting::Fail);
continue;
}
hCandidatesB->Fill(SVFitting::FitOk);

// calculate relevant properties
const auto& secondaryVertexB0 = df2.getPCACandidate();
Expand Down
Loading