Skip to content

Commit 27f48a3

Browse files
committed
Implement Vit's comments
1 parent fa54966 commit 27f48a3

File tree

6 files changed

+24
-34
lines changed

6 files changed

+24
-34
lines changed

PWGHF/Core/CentralityEstimation.h

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,42 +120,36 @@ float getCentralityColl(const Coll&)
120120
template <typename Coll>
121121
float getCentralityColl(const Coll& collision, int centEstimator)
122122
{
123-
float cent = -999.;
124123
switch (centEstimator) {
125124
case CentralityEstimator::FT0A:
126125
if constexpr (hasFT0ACent<Coll>) {
127-
cent = collision.centFT0A();
128-
} else {
129-
LOG(warning) << "Warning: Collision does not have centFT0A().\n";
126+
return collision.centFT0A();
130127
}
128+
LOG(fatal) << "Collision does not have centFT0A().";
131129
break;
132130
case CentralityEstimator::FT0C:
133131
if constexpr (hasFT0CCent<Coll>) {
134-
cent = collision.centFT0C();
135-
} else {
136-
LOG(warning) << "Warning: Collision does not have centFT0C().\n";
132+
return collision.centFT0C();
137133
}
134+
LOG(fatal) << "Collision does not have centFT0C().";
138135
break;
139136
case CentralityEstimator::FT0M:
140137
if constexpr (hasFT0MCent<Coll>) {
141-
cent = collision.centFT0M();
142-
} else {
143-
LOG(warning) << "Warning: Collision does not have centFT0M().\n";
138+
return collision.centFT0M();
144139
}
140+
LOG(fatal) << "Collision does not have centFT0M().";
145141
break;
146142
case CentralityEstimator::FV0A:
147143
if constexpr (hasFV0ACent<Coll>) {
148-
cent = collision.centFV0A();
149-
} else {
150-
LOG(warning) << "Warning: Collision does not have centFV0A().\n";
144+
return collision.centFV0A();
151145
}
146+
LOG(fatal) << "Collision does not have centFV0A().";
152147
break;
153148
default:
154-
LOG(warning) << "Centrality estimator not valid. Possible values are V0A, T0M, T0A, T0C. Setting value to -999.";
155-
cent = -999.;
149+
LOG(fatal) << "Centrality estimator not valid. Possible values are V0A, T0M, T0A, T0C.";
156150
break;
157151
}
158-
return cent;
152+
return -999.f;
159153
}
160154

161155
/// \brief Function to get MC collision centrality

PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ struct HfTaskFlowCharmHadrons {
607607
aod::BCsWithTimestamps const& bcs)
608608
{
609609
float centrality{-1.f};
610-
if (!isCollSelected<o2::hf_centrality::CentralityEstimator::None>(collision, bcs, centrality)) {
610+
if (!isCollSelected<o2::hf_centrality::CentralityEstimator::FT0C>(collision, bcs, centrality)) {
611611
// no selection on the centrality is applied on purpose to allow for the resolution study in post-processing
612612
return;
613613
}

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ struct HfCandidateCreator2Prong {
628628

629629
/// bitmask with event. selection info
630630
float centrality{-1.f};
631-
float occupancy = getOccupancyColl(collision);
631+
float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its);
632632
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
633633

634634
/// monitor the satisfied event selections
@@ -646,7 +646,7 @@ struct HfCandidateCreator2Prong {
646646

647647
/// bitmask with event. selection info
648648
float centrality{-1.f};
649-
float occupancy = getOccupancyColl(collision);
649+
float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its);
650650
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
651651

652652
/// monitor the satisfied event selections
@@ -664,7 +664,7 @@ struct HfCandidateCreator2Prong {
664664

665665
/// bitmask with event. selection info
666666
float centrality{-1.f};
667-
float occupancy = getOccupancyColl(collision);
667+
float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its);
668668
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
669669

670670
/// monitor the satisfied event selections

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ struct HfCandidateCreator3Prong {
406406

407407
/// bitmask with event. selection info
408408
float centrality{-1.f};
409-
float occupancy = getOccupancyColl(collision);
409+
float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its);
410410
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
411411

412412
/// monitor the satisfied event selections
@@ -424,7 +424,7 @@ struct HfCandidateCreator3Prong {
424424

425425
/// bitmask with event. selection info
426426
float centrality{-1.f};
427-
float occupancy = getOccupancyColl(collision);
427+
float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its);
428428
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
429429

430430
/// monitor the satisfied event selections
@@ -442,7 +442,7 @@ struct HfCandidateCreator3Prong {
442442

443443
/// bitmask with event. selection info
444444
float centrality{-1.f};
445-
float occupancy = getOccupancyColl(collision);
445+
float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its);
446446
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
447447

448448
/// monitor the satisfied event selections

PWGHF/Utils/utilsAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ enum BHadMothers { NotMatched = 0,
3131
/// Convert the B hadron mother PDG for non prompt candidates to a flag
3232
/// \param pdg of the b hadron mother
3333
/// \return integer map to specific mothers' PDG codes
34-
int getBHadMotherFlag(const int& flagBHad)
34+
BHadMothers getBHadMotherFlag(const int flagBHad)
3535
{
3636
if (std::abs(flagBHad) == o2::constants::physics::kBPlus) {
3737
return BHadMothers::BPlus;

PWGHF/Utils/utilsEvSelHf.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,25 @@ enum OccupancyEstimator { None = 0,
4242
/// \param collision is the collision with the occupancy information
4343
/// \return collision occupancy
4444
template <typename Coll>
45-
float getOccupancyColl(Coll const& collision, int occEstimator = OccupancyEstimator::Its)
45+
float getOccupancyColl(Coll const& collision, int occEstimator)
4646
{
47-
float occupancy = -999.;
4847
switch (occEstimator) {
4948
case OccupancyEstimator::Its:
50-
occupancy = collision.trackOccupancyInTimeRange();
51-
break;
49+
return collision.trackOccupancyInTimeRange();
5250
case OccupancyEstimator::Ft0c:
53-
occupancy = collision.ft0cOccupancyInTimeRange();
54-
break;
51+
return collision.ft0cOccupancyInTimeRange();
5552
default:
56-
LOG(warning) << "Occupancy estimator not valid. Possible values are ITS or FT0C. Fallback to ITS";
57-
occupancy = collision.trackOccupancyInTimeRange();
53+
LOG(fatal) << "Occupancy estimator not valid. Possible values are ITS or FT0C.";
5854
break;
5955
}
60-
return occupancy;
56+
return -999.f;
6157
};
6258

6359
/// \brief Function to get MC collision occupancy
6460
/// \param collSlice collection of reconstructed collisions associated to a generated one
6561
/// \return generated MC collision occupancy
6662
template <typename CCs>
67-
int getOccupancyGenColl(CCs const& collSlice, int occEstimator = OccupancyEstimator::Its)
63+
int getOccupancyGenColl(CCs const& collSlice, int occEstimator)
6864
{
6965
float multiplicity{0.f};
7066
int occupancy = 0;

0 commit comments

Comments
 (0)