Skip to content

Commit 4cd7bb9

Browse files
committed
Implement Vit's comments
1 parent 2619406 commit 4cd7bb9

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

PWGHF/D2H/Core/DataCreationCharmReso.h

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ enum D0Sel : uint8_t {
8787
ND0Sel
8888
};
8989

90+
enum TrackSel : uint8_t {
91+
GlobalTrack = 0,
92+
GlobalTrackWoDca,
93+
QualityTrackITS
94+
};
95+
9096
// Helper structs to pass D and V0 informations
9197

9298
struct HfResoCandidateV0 {
@@ -152,12 +158,12 @@ struct HfResoConfigSingleTrackCuts : o2::framework::ConfigurableGroup {
152158
struct HfResoConfigQaPlots : o2::framework::ConfigurableGroup {
153159
std::string prefix = "qaPlots"; // JSON group name
154160
o2::framework::Configurable<bool> applyCutsForQaHistograms{"applyCutsForQaHistograms", true, "flag to apply cuts to QA histograms"};
155-
o2::framework::Configurable<float> cutMassDMin{"cutMassDMin", 1.83, "minimum mass for D0 and Dplus candidates"}; // o2-linter: disable=pdg/explicit-mass (false positive)
156-
o2::framework::Configurable<float> cutMassDMax{"cutMassDMax", 1.92, "maximum mass for D0 and Dplus candidates"}; // o2-linter: disable=pdg/explicit-mass (false positive)
161+
o2::framework::Configurable<float> cutMassDMin{"cutMassDMin", 1.83, "minimum mass for D0 and Dplus candidates"};
162+
o2::framework::Configurable<float> cutMassDMax{"cutMassDMax", 1.92, "maximum mass for D0 and Dplus candidates"};
157163
o2::framework::Configurable<float> cutMassDstarMin{"cutMassDstarMin", 0.139, "minimum mass for Dstar candidates"}; // o2-linter: disable=pdg/explicit-mass (false positive)
158-
o2::framework::Configurable<float> cutMassDstarMax{"cutMassDstarMax", 0.175, "maximum mass for Dstar candidates"}; // o2-linter: disable=pdg/explicit-mass (false positive)
159-
o2::framework::Configurable<float> cutMassK0sMin{"cutMassK0sMin", 0.485, "minimum mass for K0s candidates"}; // o2-linter: disable=pdg/explicit-mass (false positive)
160-
o2::framework::Configurable<float> cutMassK0sMax{"cutMassK0sMax", 0.509, "maximum mass for K0s candidates"}; // o2-linter: disable=pdg/explicit-mass (false positive)
164+
o2::framework::Configurable<float> cutMassDstarMax{"cutMassDstarMax", 0.175, "maximum mass for Dstar candidates"};
165+
o2::framework::Configurable<float> cutMassK0sMin{"cutMassK0sMin", 0.485, "minimum mass for K0s candidates"};
166+
o2::framework::Configurable<float> cutMassK0sMax{"cutMassK0sMax", 0.509, "maximum mass for K0s candidates"};
161167
o2::framework::Configurable<float> cutMassLambdaMin{"cutMassLambdaMin", 1.11, "minimum mass for Lambda candidates"};
162168
o2::framework::Configurable<float> cutMassLambdaMax{"cutMassLambdaMax", 1.12, "maximum mass for Lambda candidates"};
163169
};
@@ -167,14 +173,14 @@ struct HfResoConfigQaPlots : o2::framework::ConfigurableGroup {
167173
template <bool DoMc, DMesonType DType>
168174
void addHistograms(o2::framework::HistogramRegistry& registry)
169175
{
170-
constexpr uint8_t kNBinsEvents = EventType::NEventType;
171-
std::string labels[kNBinsEvents];
176+
constexpr uint8_t NumBinsEvents = EventType::NEventType;
177+
std::string labels[NumBinsEvents];
172178
labels[EventType::Processed] = "processed";
173179
labels[EventType::NoDV0Selected] = "without DV0 pairs";
174180
labels[EventType::DV0Selected] = "with DV0 pairs";
175-
const o2::framework::AxisSpec axisEvents = {kNBinsEvents, 0.5, kNBinsEvents + 0.5, ""};
181+
const o2::framework::AxisSpec axisEvents = {NumBinsEvents, 0.5, NumBinsEvents + 0.5, ""};
176182
registry.add("hEvents", "Events;;entries", o2::framework::HistType::kTH1D, {axisEvents});
177-
for (auto iBin{0u}; iBin < kNBinsEvents; iBin++) {
183+
for (auto iBin{0u}; iBin < NumBinsEvents; iBin++) {
178184
registry.get<TH1>(HIST("hEvents"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data());
179185
}
180186

@@ -275,7 +281,7 @@ bool selectV0Daughter(Tr const& track, const std::array<int, 3>& dDaughtersIds,
275281
/// \return alphaAP
276282
float alphaAP(std::array<float, 3> const& momV0, std::array<float, 3> const& momDau0, std::array<float, 3> const& momDau1)
277283
{
278-
float const momTot = std::sqrt(std::pow(momV0[0], 2.) + std::pow(momV0[1], 2.) + std::pow(momV0[2], 2.));
284+
float const momTot = std::hypot(momV0[0], momV0[1], momV0[2]);
279285
float const lQlPos = (momDau0[0] * momV0[0] + momDau0[1] * momV0[1] + momDau0[2] * momV0[2]) / momTot;
280286
float const lQlNeg = (momDau1[0] * momV0[0] + momDau1[1] * momV0[1] + momDau1[2] * momV0[2]) / momTot;
281287
return (lQlPos - lQlNeg) / (lQlPos + lQlNeg);
@@ -294,7 +300,7 @@ float alphaAP(std::array<float, 3> const& momV0, std::array<float, 3> const& mom
294300
/// \return the DCA
295301
float calculateDCAStraightToPV(float x, float y, float z, float px, float py, float pz, float pvX, float pvY, float pvZ)
296302
{
297-
return std::sqrt((std::pow((pvY - y) * pz - (pvZ - z) * py, 2) + std::pow((pvX - x) * pz - (pvZ - z) * px, 2) + std::pow((pvX - x) * py - (pvY - y) * px, 2)) / (px * px + py * py + pz * pz));
303+
return std::hypot((pvY - y) * pz - (pvZ - z) * py, (pvX - x) * pz - (pvZ - z) * px, (pvX - x) * py - (pvY - y) * px) / (px * px + py * py + pz * pz);
298304
}
299305

300306
/// Basic selection of V0 candidates
@@ -440,17 +446,17 @@ bool isTrackSelected(const Tr& track, const std::array<int, 3>& dDaughtersIds, c
440446
return false;
441447
}
442448
switch (cfgSingleTrackCuts.setTrackSelections.value) {
443-
case 1:
444-
if (!track.isGlobalTrackWoDCA()) {
449+
case TrackSel::GlobalTrack:
450+
if (!track.isGlobalTrack()) {
445451
return false;
446452
}
447453
break;
448-
case 2:
449-
if (!track.isGlobalTrack()) {
454+
case TrackSel::GlobalTrackWoDca:
455+
if (!track.isGlobalTrackWoDCA()) {
450456
return false;
451457
}
452458
break;
453-
case 3:
459+
case TrackSel::QualityTrackITS:
454460
if (!track.isQualityTrackITS()) {
455461
return false;
456462
}

0 commit comments

Comments
 (0)