Skip to content

Commit 7a40200

Browse files
author
Zuzanna Chochulska
committed
Corrections for the PR part 1
1 parent 738e942 commit 7a40200

1 file changed

Lines changed: 22 additions & 98 deletions

File tree

PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx

Lines changed: 22 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ namespace
6161
{
6262
// static constexpr int NPart = 2;
6363
// static constexpr int NCuts = 5;
64-
static const std::vector<std::string> partNames{"PhiCandidate", "Track"};
65-
static const std::vector<std::string> cutNames{"MaxPt", "PIDthr", "nSigmaTPC", "nSigmaTPCTOF", "MaxP"};
64+
const std::vector<std::string> partNames{"PhiCandidate", "Track"};
65+
const std::vector<std::string> cutNames{"MaxPt", "PIDthr", "nSigmaTPC", "nSigmaTPCTOF", "MaxP"};
6666
// static const float cutsTable[NPart][NCuts]{ //unused variable
6767
// {4.05f, 1.f, 3.f, 3.f, 100.f},
6868
// {4.05f, 1.f, 3.f, 3.f, 100.f}};
6969
} // namespace
7070

7171
struct FemtoUniversePairTaskTrackPhi {
7272

73-
Service<o2::framework::O2DatabasePDG> pdgMC;
73+
Service<o2::framework::O2DatabasePDG> pdgMC = {};
7474

7575
using FilteredFemtoFullParticles = soa::Join<aod::FDParticles, aod::FDExtParticles>;
7676

@@ -215,17 +215,9 @@ struct FemtoUniversePairTaskTrackPhi {
215215
bool isProtonNSigma(float mom, float nsigmaTPCPr, float nsigmaTOFPr) // previous version from: https://github.com/alisw/AliPhysics/blob/master/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx
216216
{
217217
if (mom < ConfTrackPtPIDLimit) {
218-
if (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaTPC) {
219-
return true;
220-
} else {
221-
return false;
222-
}
218+
return std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaTPC;
223219
} else if (mom > ConfTrackPtPIDLimit) {
224-
if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaCombined) {
225-
return true;
226-
} else {
227-
return false;
228-
}
220+
return std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaCombined;
229221
}
230222
return false;
231223
}
@@ -236,13 +228,7 @@ struct FemtoUniversePairTaskTrackPhi {
236228
return true;
237229
}
238230
if (mom > 0.5) {
239-
if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaReject) {
240-
return true;
241-
} else if (std::hypot(nsigmaTOFK, nsigmaTPCK) < ConfPIDKaonNsigmaReject) {
242-
return true;
243-
} else {
244-
return false;
245-
}
231+
return std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaReject || std::hypot(nsigmaTOFK, nsigmaTPCK) < ConfPIDKaonNsigmaReject;
246232
} else {
247233
return false;
248234
}
@@ -252,26 +238,14 @@ struct FemtoUniversePairTaskTrackPhi {
252238
{
253239
if (ConfTrackUseRun3PIDforKaons) {
254240
if (mom < 0.5) {
255-
if (std::abs(nsigmaTPCK) < 3.0) {
256-
return true;
257-
} else {
258-
return false;
259-
}
241+
return std::abs(nsigmaTPCK) < 3.0;
260242
} else if (mom >= 0.5) {
261243
if (hasTOF) // if TOF is available, use combine nsigma
262244
{
263-
if (std::hypot(nsigmaTOFK, nsigmaTPCK) < 3.0) {
264-
return true;
265-
} else {
266-
return false;
267-
}
245+
return std::hypot(nsigmaTOFK, nsigmaTPCK) < 3.0;
268246
} else // if TOF is not available, use TPC nsigma only
269247
{
270-
if (std::abs(nsigmaTPCK) < 3.0) {
271-
return true;
272-
} else {
273-
return false;
274-
}
248+
return std::abs(nsigmaTPCK) < 3.0;
275249
}
276250
}
277251

@@ -280,37 +254,15 @@ struct FemtoUniversePairTaskTrackPhi {
280254
}
281255
} else {
282256
if (mom < 0.3) { // 0.0-0.3
283-
if (std::abs(nsigmaTPCK) < 3.0) {
284-
return true;
285-
} else {
286-
return false;
287-
}
257+
return std::abs(nsigmaTPCK) < 3.0;
288258
} else if (mom < 0.45) { // 0.30 - 0.45
289-
if (std::abs(nsigmaTPCK) < 2.0) {
290-
return true;
291-
} else {
292-
return false;
293-
}
259+
return std::abs(nsigmaTPCK) < 2.0;
294260
} else if (mom < 0.55) { // 0.45-0.55
295-
if (std::abs(nsigmaTPCK) < 1.0) {
296-
return true;
297-
} else {
298-
return false;
299-
}
261+
return std::abs(nsigmaTPCK) < 1.0;
300262
} else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF)
301-
if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) {
302-
{
303-
return true;
304-
}
305-
} else {
306-
return false;
307-
}
263+
return std::hypot(nsigmaTOFK, nsigmaTPCK) < 3.0;
308264
} else if (mom > 1.5) { // 1.5 -
309-
if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) {
310-
return true;
311-
} else {
312-
return false;
313-
}
265+
return (std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0);
314266
} else {
315267
return false;
316268
}
@@ -320,20 +272,10 @@ struct FemtoUniversePairTaskTrackPhi {
320272
bool isKaonRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi)
321273
{
322274
if (mom < 0.5) {
323-
if (std::abs(nsigmaTPCPi) < ConfPIDPionNsigmaReject) {
324-
return true;
325-
} else if (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaReject) {
326-
return true;
327-
}
275+
return (std::abs(nsigmaTPCPi) < ConfPIDPionNsigmaReject) || (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaReject);
328276
}
329277
if (mom > 0.5) {
330-
if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaReject) {
331-
return true;
332-
} else if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaReject) {
333-
return true;
334-
} else {
335-
return false;
336-
}
278+
return (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaReject) || (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaReject);
337279
} else {
338280
return false;
339281
}
@@ -343,17 +285,9 @@ struct FemtoUniversePairTaskTrackPhi {
343285
{
344286
if (true) {
345287
if (mom < 0.5) {
346-
if (std::abs(nsigmaTPCPi) < ConfPIDPionNsigmaTPC) {
347-
return true;
348-
} else {
349-
return false;
350-
}
288+
return (std::abs(nsigmaTPCPi) < ConfPIDPionNsigmaTPC);
351289
} else if (mom > 0.5) {
352-
if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaCombined) {
353-
return true;
354-
} else {
355-
return false;
356-
}
290+
return (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPIDPionNsigmaCombined);
357291
}
358292
}
359293
return false;
@@ -362,20 +296,10 @@ struct FemtoUniversePairTaskTrackPhi {
362296
bool isPionRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCK, float nsigmaTOFK)
363297
{
364298
if (mom < 0.5) {
365-
if (std::abs(nsigmaTPCK) < ConfPIDKaonNsigmaReject) {
366-
return true;
367-
} else if (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaReject) {
368-
return true;
369-
}
299+
return (std::abs(nsigmaTPCK) < ConfPIDKaonNsigmaReject) || (std::abs(nsigmaTPCPr) < ConfPIDProtonNsigmaReject);
370300
}
371301
if (mom > 0.5) {
372-
if (std::hypot(nsigmaTOFK, nsigmaTPCK) < ConfPIDKaonNsigmaReject) {
373-
return true;
374-
} else if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaReject) {
375-
return true;
376-
} else {
377-
return false;
378-
}
302+
return (std::hypot(nsigmaTOFK, nsigmaTPCK) < ConfPIDKaonNsigmaReject) || (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPIDProtonNsigmaReject);
379303
} else {
380304
return false;
381305
}
@@ -532,7 +456,7 @@ struct FemtoUniversePairTaskTrackPhi {
532456
}
533457

534458
template <bool isMC, typename PartitionType, typename PartType, typename MCParticles = std::nullptr_t>
535-
void doSameEvent(PartitionType groupPartsTrack, PartitionType groupPartsPhi, PartType parts, float magFieldTesla, int multCol, [[maybe_unused]] MCParticles mcParts = nullptr)
459+
void doSameEvent(const PartitionType& groupPartsTrack, const PartitionType& groupPartsPhi, const PartType& parts, float magFieldTesla, int multCol, [[maybe_unused]] MCParticles mcParts = nullptr)
536460
{
537461
for (auto const& phicandidate : groupPartsPhi) {
538462
// TODO: add phi meson minv cut here
@@ -660,7 +584,7 @@ struct FemtoUniversePairTaskTrackPhi {
660584
}
661585

662586
template <bool isMC, typename PartitionType, typename PartType, typename MCParticles = std::nullptr_t>
663-
void doMixedEvent(PartitionType groupPartsTrack, PartitionType groupPartsPhi, PartType parts, float magFieldTesla, int multCol, [[maybe_unused]] MCParticles mcParts = nullptr)
587+
void doMixedEvent(const PartitionType& groupPartsTrack, const PartitionType& groupPartsPhi, const PartType& parts, float magFieldTesla, int multCol, [[maybe_unused]] MCParticles mcParts = nullptr)
664588
{
665589
for (auto const& [track, phicandidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsPhi))) {
666590
if (ConfTrackIsIdentified) {

0 commit comments

Comments
 (0)