Skip to content
Merged
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
54 changes: 28 additions & 26 deletions PWGDQ/Tasks/taskJPsiMu.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 PWGDQ/Tasks/taskJPsiMu.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.)

Check failure on line 1 in PWGDQ/Tasks/taskJPsiMu.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Use constant references for table subscriptions in process functions.
// 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 @@ -53,13 +53,13 @@

namespace dqanalysisflags
{
DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 8); //! Event decision
DECLARE_SOA_BITMAP_COLUMN(IsMuonSelected, isMuonSelected, 32); //! Muon track decisions (joinable to ReducedMuonsAssoc)
}
DECLARE_SOA_BITMAP_COLUMN(IsEventSelected, isEventSelected, 8); //! Event decision
DECLARE_SOA_BITMAP_COLUMN(IsMuonSelected, isMuonSelected, 32); //! Muon track decisions (joinable to ReducedMuonsAssoc)
} // namespace dqanalysisflags

DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTSA", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents
DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc
}
DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTSA", dqanalysisflags::IsEventSelected); //! joinable to ReducedEvents
DECLARE_SOA_TABLE(MuonTrackCuts, "AOD", "DQANAMUONCUTSA", dqanalysisflags::IsMuonSelected); //! joinable to ReducedMuonsAssoc
} // namespace o2::aod

// Declarations of various short names
using MyEvents = soa::Join<aod::ReducedEvents, aod::ReducedEventsExtended>;
Expand Down Expand Up @@ -97,7 +97,7 @@
// Configurables for histograms
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f, 20.0f}, "p_{T} (GeV/c)"};
ConfigurableAxis axisInvMass{"axisInvMass", {80, 1.0f, 5.0f}, "Invariant Mass (GeV/c^{2})"};
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {10, -constants::math::PI/2.0f, 3.0f*constants::math::PI/2.0f}, "#Delta#phi (rad)"};
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {10, -constants::math::PI / 2.0f, 3.0f * constants::math::PI / 2.0f}, "#Delta#phi (rad)"};
ConfigurableAxis axisDeltaEta{"axisDeltaEta", {10, -2.0f, 2.0f}, "#Delta#eta"};

// Configurable for acceptance efficiency correction
Expand All @@ -115,7 +115,7 @@
// Define the filter for the dileptons
Filter dileptonFilter = aod::reducedpair::sign == 0;

constexpr static uint32_t fgDimuonsFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::Pair; // fill map
constexpr static uint32_t fgDimuonsFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::Pair; // fill map

// use two values array to avoid mixing up the quantities
float* fValuesDilepton;
Expand All @@ -130,9 +130,9 @@
ccdb->setCreatedNotAfter(nolaterthan.value);

// Assert correct size of the efficiency correction vector
if (axisPt.value.size()-2 != fConfigBinEffJPsi.value.size() || axisPt.value.size()-2 != fConfigBinEffMuon.value.size()) {
if (axisPt.value.size() - 2 != fConfigBinEffJPsi.value.size() || axisPt.value.size() - 2 != fConfigBinEffMuon.value.size()) {

Check failure on line 133 in PWGDQ/Tasks/taskJPsiMu.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.
LOGF(fatal, "Configurables axisPt: %zu must have one more value than fConfigBinEffJPsi: %zu and fConfigBinEffMuon: %zu (excluding 'VARIABLE_WIDTH' entry)",
axisPt.value.size()-1, fConfigBinEffJPsi.value.size(), fConfigBinEffMuon.value.size());
axisPt.value.size() - 1, fConfigBinEffJPsi.value.size(), fConfigBinEffMuon.value.size());
}

// Set up varmanager variable names
Expand Down Expand Up @@ -175,7 +175,7 @@

if (dileptons.size() > 0) {

for (auto& dilepton : dileptons) {

Check failure on line 178 in PWGDQ/Tasks/taskJPsiMu.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
VarManager::FillTrack<fgDimuonsFillMap>(dilepton, fValuesDilepton);

// Dilepton kinematic cuts
Expand All @@ -188,7 +188,7 @@
(dilepton.pt1() < axisPt.value[1] || dilepton.pt1() > axisPt.value.back()) ||
(dilepton.eta2() < fConfigMuonEtaMin || dilepton.eta2() > fConfigMuonEtaMax) ||
(dilepton.pt2() < axisPt.value[1] || dilepton.pt2() > axisPt.value.back())) {
continue;
continue;
}

// Fill invariant mass vs pT histogram for the dileptons and for trigger counting
Expand All @@ -197,8 +197,8 @@
registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt(), w_dilepton);
registry.fill(HIST("h2dTriggersPtInvVsInvMassRegion"), dilepton.mass(), dilepton.pt(), w_dilepton);

for (auto& assoc : assocs) {

Check failure on line 200 in PWGDQ/Tasks/taskJPsiMu.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
// Check selection bit
// Check selection bit
if (!assoc.isMuonSelected_bit(0)) {
continue;
}
Expand All @@ -220,10 +220,10 @@
// Compute deltaEta and deltaPhi between the dilepton and the associated muon
float deltaEta = dilepton.eta() - track.eta();
float deltaPhi = dilepton.phi() - track.phi();
if (deltaPhi < -constants::math::PI/2.0f) {
if (deltaPhi < -constants::math::PI / 2.0f) {
deltaPhi += 2.0f * constants::math::PI;

Check failure on line 224 in PWGDQ/Tasks/taskJPsiMu.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Use RecoDecay::constrainAngle to restrict angle to a given range.
} else if (deltaPhi > constants::math::PI*3.0f/2.0f) {
} else if (deltaPhi > constants::math::PI * 3.0f / 2.0f) {
deltaPhi -= 2.0f * constants::math::PI;

Check failure on line 226 in PWGDQ/Tasks/taskJPsiMu.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[two-pi-add-subtract]

Use RecoDecay::constrainAngle to restrict angle to a given range.
}

// Fill signal and background histograms based on the dilepton mass
Expand All @@ -245,7 +245,7 @@
{
runDileptonMuon<VarManager::kDecayToMuMu, gkEventFillMap, gkMuonFillMap>(event, muonassocs, muontracks, dileptons);
}
void processDummy(MyEvents&)

Check failure on line 248 in PWGDQ/Tasks/taskJPsiMu.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-process]

Argument MyEvents& is not const&.
{
}

Expand All @@ -259,20 +259,22 @@
adaptAnalysisTask<DqJPsiMuonCorrelations>(cfgc)};
}

double getRapidity(const double pT, const double eta) {
double mJPsi = 3.096916; // J/Psi mass in GeV/c^2
return log((sqrt(pow(mJPsi, 2) + (pow(pT, 2) * pow(cosh(eta), 2))) + pT * sinh(eta)) / (sqrt(pow(mJPsi, 2) + pow(pT, 2))));
double getRapidity(const double pT, const double eta)
{
double mJPsi = 3.096916; // J/Psi mass in GeV/c^2

Check failure on line 264 in PWGDQ/Tasks/taskJPsiMu.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-mass]

Avoid hard-coded particle masses. Use o2::constants::physics::Mass... instead.
return log((sqrt(pow(mJPsi, 2) + (pow(pT, 2) * pow(cosh(eta), 2))) + pT * sinh(eta)) / (sqrt(pow(mJPsi, 2) + pow(pT, 2))));

Check failure on line 265 in PWGDQ/Tasks/taskJPsiMu.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
}

double getWeight(const double pT, const std::vector<double>& pT_bins, const std::vector<double>& efficiency, const double eta_min, const double eta_max) {
double getWeight(const double pT, const std::vector<double>& pT_bins, const std::vector<double>& efficiency, const double eta_min, const double eta_max)
{

int eff_bin = -1;
for (size_t b = 0; b < pT_bins.size() - 1; ++b) {
// Shift pT index by one to account for the VARIABLE_WIDTH entry in the axis configuration
if (pT >= pT_bins[b + 1] && pT < pT_bins[b + 2]) {
eff_bin = b;
break;
}
int eff_bin = -1;
for (size_t b = 0; b < pT_bins.size() - 1; ++b) {
// Shift pT index by one to account for the VARIABLE_WIDTH entry in the axis configuration
if (pT >= pT_bins[b + 1] && pT < pT_bins[b + 2]) {
eff_bin = b;
break;
}
return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min)));
}
return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min)));
}
Loading