Skip to content

Commit 9a533cf

Browse files
committed
Fix linter, misc
1 parent de4f0a0 commit 9a533cf

1 file changed

Lines changed: 31 additions & 28 deletions

File tree

PWGDQ/Tasks/taskJPsiMu.cxx

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ using MyMuonTracks = soa::Join<aod::ReducedMuons, aod::ReducedMuonsExtra>;
6363
using MyMuonAssocsSelected = soa::Join<aod::ReducedMuonsAssoc, aod::MuonTrackCuts>;
6464

6565
// bit maps used for the Fill functions of the VarManager
66-
constexpr static uint32_t gkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended;
67-
constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::ReducedMuonExtra;
66+
constexpr static uint32_t GkEventFillMap = VarManager::ObjTypes::ReducedEvent | VarManager::ObjTypes::ReducedEventExtended;
67+
constexpr static uint32_t GkMuonFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::ReducedMuonExtra;
6868

6969
// Declare helper function
7070
double getRapidity(const double pT, const double eta);
71-
double getWeight(const double pT, const std::vector<double>& pT_bins, const std::vector<double>& efficiency, const double eta_min, const double eta_max);
71+
double getWeight(const double pT, const std::vector<double>& binsPT, const std::vector<double>& efficiency, const double etaMin, const double etaMax);
7272

7373
struct DqJPsiMuonCorrelations {
7474

@@ -89,7 +89,7 @@ struct DqJPsiMuonCorrelations {
8989
// Configurables for histograms
9090
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)"};
9191
ConfigurableAxis axisInvMass{"axisInvMass", {80, 1.0f, 5.0f}, "Invariant Mass (GeV/c^{2})"};
92-
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {10, -constants::math::PI / 2.0f, 3.0f * constants::math::PI / 2.0f}, "#Delta#phi (rad)"};
92+
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {10, -constants::math::PIHalf, 3.0f * constants::math::PIHalf}, "#Delta#phi (rad)"};
9393
ConfigurableAxis axisDeltaEta{"axisDeltaEta", {10, -2.0f, 2.0f}, "#Delta#eta"};
9494

9595
// Configurable for acceptance efficiency correction
@@ -107,7 +107,7 @@ struct DqJPsiMuonCorrelations {
107107
// Define the filter for the dileptons
108108
Filter dileptonFilter = aod::reducedpair::sign == 0;
109109

110-
constexpr static uint32_t fgDimuonsFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::Pair; // fill map
110+
constexpr static uint32_t FgDimuonsFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::Pair; // fill map
111111

112112
// use two values array to avoid mixing up the quantities
113113
std::vector<float> fValuesDilepton;
@@ -122,7 +122,8 @@ struct DqJPsiMuonCorrelations {
122122
ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
123123

124124
// Assert correct size of the efficiency correction vector
125-
if (axisPt.value.size() - 2 != fConfigBinEffJPsi.value.size() || axisPt.value.size() - 2 != fConfigBinEffMuon.value.size()) {
125+
int nAxisPtBins = axisPt.value.size() - 2;
126+
if (nAxisPtBins != fConfigBinEffJPsi.value.size() || nAxisPtBins != fConfigBinEffMuon.value.size()) {
126127
LOGF(fatal, "Configurables axisPt: %zu must have one more value than fConfigBinEffJPsi: %zu and fConfigBinEffMuon: %zu (excluding 'VARIABLE_WIDTH' entry)",
127128
axisPt.value.size() - 1, fConfigBinEffJPsi.value.size(), fConfigBinEffMuon.value.size());
128129
}
@@ -165,8 +166,8 @@ struct DqJPsiMuonCorrelations {
165166

166167
if (dileptons.size() > 0) {
167168

168-
for (auto& dilepton : dileptons) {
169-
VarManager::FillTrack<fgDimuonsFillMap>(dilepton, fValuesDilepton.data());
169+
for (const auto& dilepton : dileptons) {
170+
VarManager::FillTrack<FgDimuonsFillMap>(dilepton, fValuesDilepton.data());
170171

171172
// Dilepton kinematic cuts
172173
if ((dilepton.eta() < fConfigDileptonEtaMin || dilepton.eta() > fConfigDileptonEtaMax) ||
@@ -182,12 +183,12 @@ struct DqJPsiMuonCorrelations {
182183
}
183184

184185
// Fill invariant mass vs pT histogram for the dileptons and for trigger counting
185-
double w_dilepton = getWeight(dilepton.pt(), axisPt.value, fConfigBinEffJPsi.value, fConfigDileptonEtaMin, fConfigDileptonEtaMax);
186+
double weightDilepton = getWeight(dilepton.pt(), axisPt.value, fConfigBinEffJPsi.value, fConfigDileptonEtaMin, fConfigDileptonEtaMax);
186187

187-
registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt(), w_dilepton);
188-
registry.fill(HIST("h2dTriggersPtInvVsInvMassRegion"), dilepton.mass(), dilepton.pt(), w_dilepton);
188+
registry.fill(HIST("h2dDimuonPtInvVsInvMass"), dilepton.mass(), dilepton.pt(), weightDilepton);
189+
registry.fill(HIST("h2dTriggersPtInvVsInvMassRegion"), dilepton.mass(), dilepton.pt(), weightDilepton);
189190

190-
for (auto& assoc : assocs) {
191+
for (const auto& assoc : assocs) {
191192
// Check selection bit
192193
if (!assoc.isMuonSelected_bit(0)) {
193194
continue;
@@ -212,14 +213,14 @@ struct DqJPsiMuonCorrelations {
212213
float deltaPhi = RecoDecay::constrainAngle(dilepton.phi() - track.phi(), -constants::math::PIHalf);
213214

214215
// Fill signal and background histograms based on the dilepton mass
215-
double w_muon = getWeight(track.pt(), axisPt.value, fConfigBinEffMuon.value, fConfigMuonEtaMin, fConfigMuonEtaMax);
216+
double weightMuon = getWeight(track.pt(), axisPt.value, fConfigBinEffMuon.value, fConfigMuonEtaMin, fConfigMuonEtaMax);
216217

217218
if (dilepton.mass() > fConfigDileptonLowMass && dilepton.mass() < fConfigDileptonHighMass) {
218-
registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtSignal"), deltaEta, track.pt(), w_dilepton * w_muon);
219-
registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtSignal"), deltaPhi, track.pt(), w_dilepton * w_muon);
219+
registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtSignal"), deltaEta, track.pt(), weightDilepton * weightMuon);
220+
registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtSignal"), deltaPhi, track.pt(), weightDilepton * weightMuon);
220221
} else if (dilepton.mass() > fConfigBackgroundLowMass && dilepton.mass() < fConfigBackgroundHighMass) {
221-
registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtBackground"), deltaEta, track.pt(), w_dilepton * w_muon);
222-
registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtBackground"), deltaPhi, track.pt(), w_dilepton * w_muon);
222+
registry.fill(HIST("h2dDimuonMuonDeltaEtaVsMuonPtBackground"), deltaEta, track.pt(), weightDilepton * weightMuon);
223+
registry.fill(HIST("h2dDimuonMuonDeltaPhiVsMuonPtBackground"), deltaPhi, track.pt(), weightDilepton * weightMuon);
223224
}
224225
}
225226
}
@@ -228,9 +229,9 @@ struct DqJPsiMuonCorrelations {
228229

229230
void processSkimmedDimuon(MyEventsSelected::iterator const& event, MyMuonAssocsSelected const& muonassocs, MyMuonTracks const& muontracks, soa::Filtered<MyPairCandidatesSelected> const& dileptons)
230231
{
231-
runDileptonMuon<VarManager::kDecayToMuMu, gkEventFillMap, gkMuonFillMap>(event, muonassocs, muontracks, dileptons);
232+
runDileptonMuon<VarManager::kDecayToMuMu, GkEventFillMap, GkMuonFillMap>(event, muonassocs, muontracks, dileptons);
232233
}
233-
void processDummy(MyEvents&)
234+
void processDummy(MyEvents const&)
234235
{
235236
}
236237

@@ -246,26 +247,28 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
246247

247248
double getRapidity(const double pT, const double eta)
248249
{
249-
double mJPsi = 3.096916; // J/Psi mass in GeV/c^2
250-
return std::log((std::sqrt(std::pow(mJPsi, 2) + (std::pow(pT, 2) * std::pow(std::cosh(eta), 2))) + pT * std::sinh(eta)) / (std::sqrt(std::pow(mJPsi, 2) + std::pow(pT, 2))));
250+
return std::log(
251+
(std::sqrt(std::pow(o2::constants::physics::MassJPsi, 2) + (std::pow(pT, 2) * std::pow(std::cosh(eta), 2))) + pT * std::sinh(eta)) /
252+
(std::sqrt(std::pow(o2::constants::physics::MassJPsi, 2) + std::pow(pT, 2)))
253+
);
251254
}
252255

253-
double getWeight(const double pT, const std::vector<double>& pT_bins, const std::vector<double>& efficiency, const double eta_min, const double eta_max)
256+
double getWeight(const double pT, const std::vector<double>& binsPT, const std::vector<double>& efficiency, const double etaMin, const double etaMax)
254257
{
255258

256-
int eff_bin = -1;
257-
for (size_t b = 0; b < pT_bins.size() - 1; ++b) {
259+
int binEff = -1;
260+
for (size_t b = 0; b < binsPT.size() - 1; ++b) {
258261
// Shift pT index by one to account for the VARIABLE_WIDTH entry in the axis configuration
259-
if (pT >= pT_bins[b + 1] && pT < pT_bins[b + 2]) {
260-
eff_bin = b;
262+
if (pT >= binsPT[b + 1] && pT < binsPT[b + 2]) {
263+
binEff = b;
261264
break;
262265
}
263266
}
264267

265-
if (eff_bin == -1) {
268+
if (binEff == -1) {
266269
LOGF(warn, "pT value %f is outside the defined pT bins", pT);
267270
return 0.0;
268271
} else {
269-
return 1.0 / (efficiency[eff_bin] * (getRapidity(pT, eta_max) - getRapidity(pT, eta_min)));
272+
return 1.0 / (efficiency[binEff] * (getRapidity(pT, etaMax) - getRapidity(pT, etaMin)));
270273
}
271274
}

0 commit comments

Comments
 (0)