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
27 changes: 26 additions & 1 deletion EventFiltering/PWGHF/HFFilter.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -37,6 +37,7 @@
#include "Common/DataModel/PIDResponseTPC.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "Framework/RunningWorkflowInfo.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use <> for all external headers.

#include <CCDB/BasicCCDBManager.h>
#include <CCDB/CcdbApi.h>
#include <CommonConstants/PhysicsConstants.h>
Expand Down Expand Up @@ -157,8 +158,8 @@

// CCDB configuration
o2::ccdb::CcdbApi ccdbApi;
Service<o2::ccdb::BasicCCDBManager> ccdb;

Check failure on line 161 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pwghf/struct-member-order]

HfFilter: Service< appears too early (before end of Configurable<).
Configurable<std::string> url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};

Check failure on line 162 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
int currentRun{0}; // needed to detect if the run changed and trigger update of calibrations etc.

// TPC PID calibrations
Expand Down Expand Up @@ -188,7 +189,7 @@
o2::vertexing::DCAFitterN<3> dfBtoDstar; // fitter for Beauty Hadron to D* vertex (3-prong vertex fitter)
o2::vertexing::DCAFitterN<2> dfStrangeness; // fitter for V0s and cascades (2-prong vertex fitter)

HistogramRegistry registry{"registry"};

Check failure on line 192 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pwghf/struct-member-order]

HfFilter: HistogramRegistry appears too early (before end of PresliceUnsorted<).
std::shared_ptr<TH1> hProcessedEvents;

// QA histos
Expand Down Expand Up @@ -217,7 +218,7 @@
// helper object
HfFilterHelper helper;

void init(InitContext&)
void init(InitContext& initContext)
{
helper.setHighPtTriggerThresholds(ptThresholds->get(0u, 0u), ptThresholds->get(0u, 1u));
helper.setPtTriggerThresholdsForFemto(ptThresholdsForFemto->get(0u, 0u), ptThresholdsForFemto->get(0u, 1u));
Expand Down Expand Up @@ -262,9 +263,33 @@
helper.setVtxConfiguration(dfBtoDstar, true);
}

// fetch config of track-index-skim-creator to apply the same cut on DeltaMassKK for Ds
std::vector<double> ptBinsDsSkimCreator{};
LabeledArray<double> cutsDsSkimCreator{};
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
for (const DeviceSpec& device : workflows.devices) {
if (device.name.compare("hf-track-index-skim-creator") == 0) {
for (const auto& option : device.options) {
if (option.name.compare("binsPtDsToKKPi") == 0) {
auto ptBins = option.defaultValue.get<double*>();
double lastEl{-1.e6};
int iPt{0};
while (ptBins[iPt] > lastEl) {
ptBinsDsSkimCreator.push_back(ptBins[iPt]);
lastEl = ptBins[iPt];
iPt++;
}
} else if (option.name.compare("cutsDsToKKPi") == 0) {
cutsDsSkimCreator = option.defaultValue.get<LabeledArray<double>>();
}
}
}
}
helper.setPreselDsToKKPi(ptBinsDsSkimCreator, cutsDsSkimCreator);

hProcessedEvents = registry.add<TH1>("fProcessedEvents", "HF - event filtered;;counts", HistType::kTH1D, {{kNtriggersHF + 2, -0.5, +kNtriggersHF + 1.5}});
for (auto iBin = 0; iBin < kNtriggersHF + 2; ++iBin) {
if (iBin < 2)

Check failure on line 292 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
hProcessedEvents->GetXaxis()->SetBinLabel(iBin + 1, eventTitles[iBin].data());
else
hProcessedEvents->GetXaxis()->SetBinLabel(iBin + 1, hfTriggerNames[iBin - 2].data());
Expand Down Expand Up @@ -411,7 +436,7 @@
for (const auto& collision : collisions) {

bool keepEvent[kNtriggersHF]{false};
if (!collision.sel8() || std::fabs(collision.posZ()) > 11.f) { // safety margin for Zvtx

Check failure on line 439 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
tags(keepEvent[kHighPt2P], keepEvent[kHighPt3P], keepEvent[kBeauty3P], keepEvent[kBeauty4P], keepEvent[kFemto2P], keepEvent[kFemto3P], keepEvent[kDoubleCharm2P], keepEvent[kDoubleCharm3P], keepEvent[kDoubleCharmMix], keepEvent[kV0Charm2P], keepEvent[kV0Charm3P], keepEvent[kCharmBarToXiBach], keepEvent[kSigmaCPPK], keepEvent[kSigmaC0K0], keepEvent[kPhotonCharm2P], keepEvent[kPhotonCharm3P], keepEvent[kSingleCharm2P], keepEvent[kSingleCharm3P], keepEvent[kSingleNonPromptCharm2P], keepEvent[kSingleNonPromptCharm3P], keepEvent[kCharmBarToXi2Bach], keepEvent[kPrCharm2P], keepEvent[kBtoJPsiKa], keepEvent[kBtoJPsiKstar], keepEvent[kBtoJPsiPhi], keepEvent[kBtoJPsiPrKa], keepEvent[kBtoJPsiPi]);
continue;
}
Expand Down Expand Up @@ -490,7 +515,7 @@
std::vector<float> scores{};
if (preselD0) {
scores.insert(scores.end(), cand2Prong.mlProbSkimD0ToKPi().begin(), cand2Prong.mlProbSkimD0ToKPi().end());
if (scores.size() != 3) {

Check failure on line 518 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
scores.resize(3);
scores[0] = 2.;
scores[1] = -1.;
Expand Down Expand Up @@ -1209,7 +1234,7 @@
continue;
}

if (scores[iCharmPart].size() != 3) {

Check failure on line 1237 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
scores[iCharmPart].resize(3);
scores[iCharmPart][0] = 2.;
scores[iCharmPart][1] = -1.;
Expand Down Expand Up @@ -1436,7 +1461,7 @@
// check the candidate SigmaC++ charge
std::array<int, 4> chargesSc = {trackFirst.sign(), trackSecond.sign(), trackThird.sign(), trackSoftPi.sign()};
int chargeSc = std::accumulate(chargesSc.begin(), chargesSc.end(), 0); // SIGNED electric charge of SigmaC candidate
if (std::abs(chargeSc) != 2) {

Check failure on line 1464 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
}

Expand Down Expand Up @@ -1758,7 +1783,7 @@
std::array<float, 2> dcaInfo;
o2::track::TrackParCov trackParCasc;
o2::track::TrackParCov trackParCascTrack;
if (requireStrangenessTrackingAny < 2) { // needed for at least one of the two

Check failure on line 1786 in EventFiltering/PWGHF/HFFilter.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
trackParCasc = o2::track::TrackParCov(cascCand.vtx, cascCand.mom, cascCand.cov, cascCand.sign, true);
trackParCasc.setPID(o2::track::PID::XiMinus);
trackParCasc.setAbsCharge(1); // to be sure
Expand Down
22 changes: 19 additions & 3 deletions EventFiltering/PWGHF/HFFilterHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ constexpr float massB0 = o2::constants::physics::MassB0;
constexpr float massBs = o2::constants::physics::MassBS;
constexpr float massLb = o2::constants::physics::MassLambdaB0;
constexpr float massXib = o2::constants::physics::MassXiB0;
constexpr float massBc = 6.2744700f; // TODO add Bc mass to o2::constants::physics
constexpr float massBc = o2::constants::physics::MassBCPlus;
constexpr float massSigmaCPlusPlus = o2::constants::physics::MassSigmaCPlusPlus;
constexpr float massSigmaC0 = o2::constants::physics::MassSigmaC0;
constexpr float massK0Star892 = o2::constants::physics::MassK0Star892;
Expand Down Expand Up @@ -601,6 +601,12 @@ class HfFilterHelper

void setNumSigmaForDeltaMassCharmHadCut(float nSigma) { mNumSigmaDeltaMassCharmHad = nSigma; }

void setPreselDsToKKPi(std::vector<double> ptBins, o2::framework::LabeledArray<double> preselections)
{
mPtBinsPreselDsToKKPi = ptBins;
mPreselDsToKKPi = preselections;
}

// helper functions for selections
template <typename T>
bool isSelectedHighPt2Prong(const T& pt);
Expand Down Expand Up @@ -790,6 +796,9 @@ class HfFilterHelper
int mTpcPidCalibrationOption{0}; // Option for TPC PID calibration (0 -> AO2D, 1 -> postcalibrations, 2 -> alternative bethe bloch parametrisation)
std::array<TH3F*, 8> mHistMapPiPrKaDe{}; // Map for TPC PID postcalibrations for pions, kaon, protons and deuterons
std::array<std::vector<double>, 8> mBetheBlochPiKaPrDe{}; // Bethe-Bloch parametrisations for pions, antipions, kaons, antikaons, protons, antiprotons, deuterons, antideuterons in TPC
// Ds cuts from track-index-skim-creator
std::vector<double> mPtBinsPreselDsToKKPi{}; // pT bins for pre-selections for Ds from track-index-skim-creator
o2::framework::LabeledArray<double> mPreselDsToKKPi{}; // pre-selections for Ds from track-index-skim-creator
};

/// Selection of high-pt 2-prong candidates
Expand Down Expand Up @@ -1071,13 +1080,20 @@ inline int8_t HfFilterHelper::isDsPreselected(const P& pTrackSameChargeFirst, co
}

// check delta-mass for phi resonance
auto ptDs = RecoDecay::pt(pTrackSameChargeFirst, pTrackSameChargeSecond, pTrackOppositeCharge);
auto ptBinDs = findBin(mPtBinsPreselDsToKKPi, ptDs);
if (ptBinDs == -1) {
return retValue;
}

auto invMassKKFirst = RecoDecay::m(std::array{pTrackSameChargeFirst, pTrackOppositeCharge}, std::array{massKa, massKa});
auto invMassKKSecond = RecoDecay::m(std::array{pTrackSameChargeSecond, pTrackOppositeCharge}, std::array{massKa, massKa});

if (std::fabs(invMassKKFirst - massPhi) < 0.02) {
float cutValueMassKK = mPreselDsToKKPi.get(ptBinDs, 4u);
if (std::fabs(invMassKKFirst - massPhi) < cutValueMassKK) {
retValue |= BIT(0);
}
if (std::fabs(invMassKKSecond - massPhi) < 0.02) {
if (std::fabs(invMassKKSecond - massPhi) < cutValueMassKK) {
retValue |= BIT(1);
}

Expand Down
Loading