Skip to content

Commit ff48628

Browse files
vkuceraalibuild
andauthored
[PWGHF,Tutorial] HfHelper: Make methods static (#13525)
Co-authored-by: ALICE Builder <alibuild@users.noreply.github.com>
1 parent 2617ff2 commit ff48628

File tree

119 files changed

+1228
-1413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+1228
-1413
lines changed

PWGHF/ALICE3/TableProducer/candidateCreatorChic.cxx

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
///
1616
/// \author Alessandro De Falco <alessandro.de.falco@ca.infn.it>, Cagliari University
1717

18-
#include <utility>
19-
#include <vector>
18+
#include "PWGHF/Core/HfHelper.h"
19+
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
20+
#include "PWGHF/DataModel/CandidateSelectionTables.h"
21+
22+
#include "ALICE3/DataModel/ECAL.h"
23+
#include "Common/Core/trackUtilities.h"
2024

2125
#include "CommonConstants/PhysicsConstants.h"
2226
#include "DCAFitter/DCAFitterN.h"
2327
#include "Framework/AnalysisTask.h"
2428
#include "ReconstructionDataFormats/DCA.h"
2529
#include "ReconstructionDataFormats/V0.h"
2630

27-
#include "ALICE3/DataModel/ECAL.h"
28-
#include "Common/Core/trackUtilities.h"
29-
30-
#include "PWGHF/Core/HfHelper.h"
31-
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
32-
#include "PWGHF/DataModel/CandidateSelectionTables.h"
31+
#include <utility>
32+
#include <vector>
3333

3434
using namespace o2;
3535
using namespace o2::analysis;
@@ -67,7 +67,6 @@ struct HfCandidateCreatorChic {
6767
Configurable<double> yCandMax{"yCandMax", -1., "max. cand. rapidity"};
6868

6969
o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter (to rebuild Jpsi vertex)
70-
HfHelper hfHelper;
7170

7271
double massJpsi{0.};
7372
double massJpsiGamma{0.};
@@ -109,14 +108,14 @@ struct HfCandidateCreatorChic {
109108
if (!(jpsiCand.hfflag() & 1 << hf_cand_2prong::DecayType::JpsiToEE) && !(jpsiCand.hfflag() & 1 << hf_cand_2prong::DecayType::JpsiToMuMu)) {
110109
continue;
111110
}
112-
if (yCandMax >= 0. && std::abs(hfHelper.yJpsi(jpsiCand)) > yCandMax) {
111+
if (yCandMax >= 0. && std::abs(HfHelper::yJpsi(jpsiCand)) > yCandMax) {
113112
continue;
114113
}
115114
if (jpsiCand.isSelJpsiToEE() > 0) {
116-
hMassJpsiToEE->Fill(hfHelper.invMassJpsiToEE(jpsiCand));
115+
hMassJpsiToEE->Fill(HfHelper::invMassJpsiToEE(jpsiCand));
117116
}
118117
if (jpsiCand.isSelJpsiToMuMu() > 0) {
119-
hMassJpsiToMuMu->Fill(hfHelper.invMassJpsiToMuMu(jpsiCand));
118+
hMassJpsiToMuMu->Fill(HfHelper::invMassJpsiToMuMu(jpsiCand));
120119
}
121120
hPtJpsi->Fill(jpsiCand.pt());
122121
hCPAJpsi->Fill(jpsiCand.cpa());
@@ -189,7 +188,7 @@ struct HfCandidateCreatorChic {
189188
impactParameter0.getY(), 0.f, // impactParameter1.getY(),
190189
std::sqrt(impactParameter0.getSigmaY2()), 0.f, // std::sqrt(impactParameter1.getSigmaY2()),
191190
jpsiCand.globalIndex(), ecal.globalIndex(),
192-
hfFlag, hfHelper.invMassJpsiToMuMu(jpsiCand));
191+
hfFlag, HfHelper::invMassJpsiToMuMu(jpsiCand));
193192

194193
// calculate invariant mass
195194
auto arrayMomenta = std::array{pvecJpsi, pvecGamma};
@@ -201,9 +200,9 @@ struct HfCandidateCreatorChic {
201200
hMassChicToJpsiToMuMuGamma->Fill(massJpsiGamma);
202201
}
203202
} // ecal loop
204-
} // Jpsi loop
205-
} // process
206-
}; // struct
203+
} // Jpsi loop
204+
} // process
205+
}; // struct
207206

208207
/// Extends the base table with expression columns.
209208
struct HfCandidateCreatorChicExpressions {
@@ -217,8 +216,6 @@ struct HfCandidateCreatorChicMc {
217216
Produces<aod::HfCandChicMcRec> rowMcMatchRec;
218217
Produces<aod::HfCandChicMcGen> rowMcMatchGen;
219218

220-
HfHelper hfHelper;
221-
222219
OutputObj<TH1F> hMassJpsiToMuMuMatched{TH1F("hMassChicToJpsiToMuMuMatched", "2-prong candidates;inv. mass (J/#psi (#rightarrow #mu+ #mu-)) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
223220
OutputObj<TH1F> hMassEMatched{TH1F("hMassEMatched", "2-prong candidates;inv. mass (J/#psi (#rightarrow #mu+ #mu-)) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
224221
OutputObj<TH1F> hEphotonMatched{TH1F("hEphotonMatched", "2-prong candidates;inv. mass (J/#psi (#rightarrow #mu+ #mu-)) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
@@ -249,7 +246,7 @@ struct HfCandidateCreatorChicMc {
249246
// chi_c → J/ψ gamma
250247
indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayJpsiDaughters, Pdg::kJPsi, std::array{+kMuonPlus, -kMuonPlus}, true);
251248
if (indexRec > -1) {
252-
hMassJpsiToMuMuMatched->Fill(hfHelper.invMassJpsiToMuMu(candidate.prong0()));
249+
hMassJpsiToMuMuMatched->Fill(HfHelper::invMassJpsiToMuMu(candidate.prong0()));
253250

254251
int indexMother = RecoDecay::getMother(mcParticles, mcParticles.rawIteratorAt(indexRec), Pdg::kChiC1);
255252
int indexMotherGamma = RecoDecay::getMother(mcParticles, mcParticles.rawIteratorAt(candidate.prong1().mcparticleId()), Pdg::kChiC1);
@@ -262,7 +259,7 @@ struct HfCandidateCreatorChicMc {
262259
RecoDecay::getDaughters(particleMother, &arrAllDaughtersIndex, std::array{static_cast<int>(kGamma), static_cast<int>(Pdg::kJPsi)}, 1);
263260
if (arrAllDaughtersIndex.size() == 2) {
264261
flag = 1 << hf_cand_chic::DecayType::ChicToJpsiToMuMuGamma;
265-
hMassChicToJpsiToMuMuGammaMatched->Fill(hfHelper.invMassChicToJpsiGamma(candidate));
262+
hMassChicToJpsiToMuMuGammaMatched->Fill(HfHelper::invMassChicToJpsiGamma(candidate));
266263
}
267264
}
268265
}
@@ -299,8 +296,8 @@ struct HfCandidateCreatorChicMc {
299296

300297
rowMcMatchGen(flag, origin, channel);
301298
} // candidate loop
302-
} // process
303-
}; // struct
299+
} // process
300+
}; // struct
304301

305302
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
306303
{

PWGHF/ALICE3/TableProducer/candidateCreatorX.cxx

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
/// \author Rik Spijkers <r.spijkers@students.uu.nl>, Utrecht University
1717
/// \author Luca Micheletti <luca.micheletti@to.infn.it>, INFN
1818

19-
#include <utility>
20-
#include <vector>
19+
#include "PWGHF/Core/HfHelper.h"
20+
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
21+
#include "PWGHF/DataModel/CandidateSelectionTables.h"
22+
23+
#include "Common/Core/trackUtilities.h"
2124

2225
#include "CommonConstants/PhysicsConstants.h"
2326
#include "DCAFitter/DCAFitterN.h"
2427
#include "Framework/AnalysisTask.h"
2528
#include "ReconstructionDataFormats/DCA.h"
2629
#include "ReconstructionDataFormats/V0.h"
2730

28-
#include "Common/Core/trackUtilities.h"
29-
30-
#include "PWGHF/Core/HfHelper.h"
31-
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
32-
#include "PWGHF/DataModel/CandidateSelectionTables.h"
31+
#include <utility>
32+
#include <vector>
3333

3434
using namespace o2;
3535
using namespace o2::analysis;
@@ -67,7 +67,6 @@ struct HfCandidateCreatorX {
6767

6868
o2::vertexing::DCAFitterN<2> df2; // 2-prong vertex fitter (to rebuild Jpsi vertex)
6969
o2::vertexing::DCAFitterN<3> df3; // 3-prong vertex fitter
70-
HfHelper hfHelper;
7170

7271
double massPi{0.};
7372
double massJpsi{0.};
@@ -119,20 +118,20 @@ struct HfCandidateCreatorX {
119118
if (!(jpsiCand.hfflag() & 1 << hf_cand_2prong::DecayType::JpsiToEE) && !(jpsiCand.hfflag() & 1 << hf_cand_2prong::DecayType::JpsiToMuMu)) {
120119
continue;
121120
}
122-
if (yCandMax >= 0. && std::abs(hfHelper.yJpsi(jpsiCand)) > yCandMax) {
121+
if (yCandMax >= 0. && std::abs(HfHelper::yJpsi(jpsiCand)) > yCandMax) {
123122
continue;
124123
}
125124
if (jpsiCand.isSelJpsiToEE() > 0) {
126-
if (std::abs(hfHelper.invMassJpsiToEE(jpsiCand) - massJpsi) > diffMassJpsiMax) {
125+
if (std::abs(HfHelper::invMassJpsiToEE(jpsiCand) - massJpsi) > diffMassJpsiMax) {
127126
continue;
128127
}
129-
hMassJpsiToEE->Fill(hfHelper.invMassJpsiToEE(jpsiCand));
128+
hMassJpsiToEE->Fill(HfHelper::invMassJpsiToEE(jpsiCand));
130129
}
131130
if (jpsiCand.isSelJpsiToMuMu() > 0) {
132-
if (std::abs(hfHelper.invMassJpsiToMuMu(jpsiCand) - massJpsi) > diffMassJpsiMax) {
131+
if (std::abs(HfHelper::invMassJpsiToMuMu(jpsiCand) - massJpsi) > diffMassJpsiMax) {
133132
continue;
134133
}
135-
hMassJpsiToMuMu->Fill(hfHelper.invMassJpsiToMuMu(jpsiCand));
134+
hMassJpsiToMuMu->Fill(HfHelper::invMassJpsiToMuMu(jpsiCand));
136135
}
137136

138137
hPtJpsi->Fill(jpsiCand.pt());
@@ -255,10 +254,10 @@ struct HfCandidateCreatorX {
255254
hMassXToJpsiToMuMuPiPi->Fill(massJpsiPiPi);
256255
}
257256
} // pi- loop
258-
} // pi+ loop
259-
} // Jpsi loop
260-
} // process
261-
}; // struct
257+
} // pi+ loop
258+
} // Jpsi loop
259+
} // process
260+
}; // struct
262261

263262
/// Extends the base table with expression columns.
264263
struct HfCandidateCreatorXExpressions {
@@ -363,8 +362,8 @@ struct HfCandidateCreatorXMc {
363362

364363
rowMcMatchGen(flag, origin, channel);
365364
} // candidate loop
366-
} // process
367-
}; // struct
365+
} // process
366+
}; // struct
368367

369368
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
370369
{

PWGHF/ALICE3/TableProducer/candidateSelectorChicToJpsiGamma.cxx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
///
1616
/// \author Alessandro De Falco <alessandro.de.falco@ca.infn.it>, Università/INFN Cagliari
1717

18-
#include <vector>
18+
#include "PWGHF/Core/HfHelper.h"
19+
#include "PWGHF/Core/SelectorCuts.h"
20+
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
21+
#include "PWGHF/DataModel/CandidateSelectionTables.h"
1922

2023
#include "CommonConstants/PhysicsConstants.h"
2124
#include "Framework/AnalysisTask.h"
2225
#include "Framework/runDataProcessing.h"
2326

24-
#include "PWGHF/Core/HfHelper.h"
25-
#include "PWGHF/Core/SelectorCuts.h"
26-
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
27-
#include "PWGHF/DataModel/CandidateSelectionTables.h"
27+
#include <vector>
2828

2929
using namespace o2;
3030
using namespace o2::aod;
@@ -50,8 +50,6 @@ struct HfCandidateSelectorChicToJpsiGamma {
5050
Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_chic_to_jpsi_gamma::vecBinsPt}, "pT bin limits"};
5151
Configurable<LabeledArray<double>> cuts{"cuts", {hf_cuts_chic_to_jpsi_gamma::Cuts[0], hf_cuts_chic_to_jpsi_gamma::NBinsPt, hf_cuts_chic_to_jpsi_gamma::NCutVars, hf_cuts_chic_to_jpsi_gamma::labelsPt, hf_cuts_chic_to_jpsi_gamma::labelsCutVar}, "Jpsi candidate selection per pT bin"};
5252

53-
HfHelper hfHelper;
54-
5553
/// Selection on goodness of daughter tracks
5654
/// \note should be applied at candidate selection
5755
/// \param track is daughter track
@@ -80,7 +78,7 @@ struct HfCandidateSelectorChicToJpsiGamma {
8078
}
8179

8280
auto mchic = o2::constants::physics::MassChiC1; // chi_c1(1p)
83-
if (std::abs(hfHelper.invMassChicToJpsiGamma(hfCandChic) - mchic) > cuts->get(pTBin, "m")) {
81+
if (std::abs(HfHelper::invMassChicToJpsiGamma(hfCandChic) - mchic) > cuts->get(pTBin, "m")) {
8482
// LOGF(debug, "Chic topol selection failed at mass diff check");
8583
return false; // check that mass difference is within bounds
8684
}

PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Barrel.cxx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
/// \author Nima Zardoshti <nima.zardoshti@cern.ch>, CERN
1616
/// \author Vít Kučera <vit.kucera@cern.ch>, CERN
1717

18-
#include <vector>
19-
#include <algorithm>
18+
#include "PWGHF/Core/HfHelper.h"
19+
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
20+
#include "PWGHF/DataModel/CandidateSelectionTables.h"
21+
22+
#include "ALICE3/DataModel/RICH.h"
2023

2124
#include "CommonConstants/PhysicsConstants.h"
2225
#include "Framework/AnalysisTask.h"
2326
#include "Framework/runDataProcessing.h"
2427

25-
#include "ALICE3/DataModel/RICH.h"
26-
27-
#include "PWGHF/Core/HfHelper.h"
28-
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
29-
#include "PWGHF/DataModel/CandidateSelectionTables.h"
28+
#include <algorithm>
29+
#include <vector>
3030

3131
using namespace o2;
3232
using namespace o2::analysis;
@@ -70,8 +70,6 @@ struct HfCandidateSelectorD0Alice3Barrel {
7070
Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"};
7171
Configurable<LabeledArray<double>> cuts{"cuts", {hf_cuts_d0_to_pi_k::Cuts[0], hf_cuts_d0_to_pi_k::NBinsPt, hf_cuts_d0_to_pi_k::NCutVars, hf_cuts_d0_to_pi_k::labelsPt, hf_cuts_d0_to_pi_k::labelsCutVar}, "D0 candidate selection per pT bin"};
7272

73-
HfHelper hfHelper;
74-
7573
using TracksSel = soa::Join<aod::TracksWDcaExtra, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::RICHTracksIndex, aod::McTrackLabels>;
7674

7775
/// Conjugate-independent topological cuts
@@ -147,11 +145,11 @@ struct HfCandidateSelectorD0Alice3Barrel {
147145

148146
// invariant-mass cut
149147
if (trackPion.sign() > 0) {
150-
if (std::abs(hfHelper.invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) {
148+
if (std::abs(HfHelper::invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) {
151149
return false;
152150
}
153151
} else {
154-
if (std::abs(hfHelper.invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) {
152+
if (std::abs(HfHelper::invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) {
155153
return false;
156154
}
157155
}
@@ -168,11 +166,11 @@ struct HfCandidateSelectorD0Alice3Barrel {
168166

169167
// cut on cos(theta*)
170168
if (trackPion.sign() > 0) {
171-
if (std::abs(hfHelper.cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) {
169+
if (std::abs(HfHelper::cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) {
172170
return false;
173171
}
174172
} else {
175-
if (std::abs(hfHelper.cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) {
173+
if (std::abs(HfHelper::cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) {
176174
return false;
177175
}
178176
}

PWGHF/ALICE3/TableProducer/candidateSelectorD0Alice3Forward.cxx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
/// \author Nima Zardoshti <nima.zardoshti@cern.ch>, CERN
1616
/// \author Vít Kučera <vit.kucera@cern.ch>, CERN
1717

18-
#include <vector>
19-
#include <algorithm>
18+
#include "PWGHF/Core/HfHelper.h"
19+
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
20+
#include "PWGHF/DataModel/CandidateSelectionTables.h"
21+
22+
#include "ALICE3/DataModel/RICH.h"
2023

2124
#include "CommonConstants/PhysicsConstants.h"
2225
#include "Framework/AnalysisTask.h"
2326
#include "Framework/runDataProcessing.h"
2427

25-
#include "ALICE3/DataModel/RICH.h"
26-
27-
#include "PWGHF/Core/HfHelper.h"
28-
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
29-
#include "PWGHF/DataModel/CandidateSelectionTables.h"
28+
#include <algorithm>
29+
#include <vector>
3030

3131
using namespace o2;
3232
using namespace o2::analysis;
@@ -70,8 +70,6 @@ struct HfCandidateSelectorD0Alice3Forward {
7070
Configurable<std::vector<double>> binsPt{"binsPt", std::vector<double>{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"};
7171
Configurable<LabeledArray<double>> cuts{"cuts", {hf_cuts_d0_to_pi_k::Cuts[0], hf_cuts_d0_to_pi_k::NBinsPt, hf_cuts_d0_to_pi_k::NCutVars, hf_cuts_d0_to_pi_k::labelsPt, hf_cuts_d0_to_pi_k::labelsCutVar}, "D0 candidate selection per pT bin"};
7272

73-
HfHelper hfHelper;
74-
7573
using TracksSel = soa::Join<aod::TracksWDca, aod::FRICHTracksIndex>;
7674

7775
/// Conjugate-independent topological cuts
@@ -147,11 +145,11 @@ struct HfCandidateSelectorD0Alice3Forward {
147145

148146
// invariant-mass cut
149147
if (trackPion.sign() > 0) {
150-
if (std::abs(hfHelper.invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) {
148+
if (std::abs(HfHelper::invMassD0ToPiK(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) {
151149
return false;
152150
}
153151
} else {
154-
if (std::abs(hfHelper.invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) {
152+
if (std::abs(HfHelper::invMassD0barToKPi(candidate) - o2::constants::physics::MassD0) > cuts->get(pTBin, "m")) {
155153
return false;
156154
}
157155
}
@@ -168,11 +166,11 @@ struct HfCandidateSelectorD0Alice3Forward {
168166

169167
// cut on cos(theta*)
170168
if (trackPion.sign() > 0) {
171-
if (std::abs(hfHelper.cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) {
169+
if (std::abs(HfHelper::cosThetaStarD0(candidate)) > cuts->get(pTBin, "cos theta*")) {
172170
return false;
173171
}
174172
} else {
175-
if (std::abs(hfHelper.cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) {
173+
if (std::abs(HfHelper::cosThetaStarD0bar(candidate)) > cuts->get(pTBin, "cos theta*")) {
176174
return false;
177175
}
178176
}

0 commit comments

Comments
 (0)