Skip to content

Commit

Permalink
Implement Vit's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcellocosti committed Jan 9, 2025
1 parent fa54966 commit 27f48a3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 34 deletions.
26 changes: 10 additions & 16 deletions PWGHF/Core/CentralityEstimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,42 +120,36 @@ float getCentralityColl(const Coll&)
template <typename Coll>
float getCentralityColl(const Coll& collision, int centEstimator)
{
float cent = -999.;
switch (centEstimator) {
case CentralityEstimator::FT0A:
if constexpr (hasFT0ACent<Coll>) {
cent = collision.centFT0A();
} else {
LOG(warning) << "Warning: Collision does not have centFT0A().\n";
return collision.centFT0A();
}
LOG(fatal) << "Collision does not have centFT0A().";
break;
case CentralityEstimator::FT0C:
if constexpr (hasFT0CCent<Coll>) {
cent = collision.centFT0C();
} else {
LOG(warning) << "Warning: Collision does not have centFT0C().\n";
return collision.centFT0C();
}
LOG(fatal) << "Collision does not have centFT0C().";
break;
case CentralityEstimator::FT0M:
if constexpr (hasFT0MCent<Coll>) {
cent = collision.centFT0M();
} else {
LOG(warning) << "Warning: Collision does not have centFT0M().\n";
return collision.centFT0M();
}
LOG(fatal) << "Collision does not have centFT0M().";
break;
case CentralityEstimator::FV0A:
if constexpr (hasFV0ACent<Coll>) {
cent = collision.centFV0A();
} else {
LOG(warning) << "Warning: Collision does not have centFV0A().\n";
return collision.centFV0A();
}
LOG(fatal) << "Collision does not have centFV0A().";
break;
default:
LOG(warning) << "Centrality estimator not valid. Possible values are V0A, T0M, T0A, T0C. Setting value to -999.";
cent = -999.;
LOG(fatal) << "Centrality estimator not valid. Possible values are V0A, T0M, T0A, T0C.";
break;
}
return cent;
return -999.f;
}

/// \brief Function to get MC collision centrality
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ struct HfTaskFlowCharmHadrons {
aod::BCsWithTimestamps const& bcs)
{
float centrality{-1.f};
if (!isCollSelected<o2::hf_centrality::CentralityEstimator::None>(collision, bcs, centrality)) {
if (!isCollSelected<o2::hf_centrality::CentralityEstimator::FT0C>(collision, bcs, centrality)) {
// no selection on the centrality is applied on purpose to allow for the resolution study in post-processing
return;
}
Expand Down
6 changes: 3 additions & 3 deletions PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ struct HfCandidateCreator2Prong {

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

/// monitor the satisfied event selections
Expand All @@ -646,7 +646,7 @@ struct HfCandidateCreator2Prong {

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

/// monitor the satisfied event selections
Expand All @@ -664,7 +664,7 @@ struct HfCandidateCreator2Prong {

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

/// monitor the satisfied event selections
Expand Down
6 changes: 3 additions & 3 deletions PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ struct HfCandidateCreator3Prong {

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

/// monitor the satisfied event selections
Expand All @@ -424,7 +424,7 @@ struct HfCandidateCreator3Prong {

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

/// monitor the satisfied event selections
Expand All @@ -442,7 +442,7 @@ struct HfCandidateCreator3Prong {

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

/// monitor the satisfied event selections
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/Utils/utilsAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum BHadMothers { NotMatched = 0,
/// Convert the B hadron mother PDG for non prompt candidates to a flag
/// \param pdg of the b hadron mother
/// \return integer map to specific mothers' PDG codes
int getBHadMotherFlag(const int& flagBHad)
BHadMothers getBHadMotherFlag(const int flagBHad)
{
if (std::abs(flagBHad) == o2::constants::physics::kBPlus) {
return BHadMothers::BPlus;
Expand Down
16 changes: 6 additions & 10 deletions PWGHF/Utils/utilsEvSelHf.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,25 @@ enum OccupancyEstimator { None = 0,
/// \param collision is the collision with the occupancy information
/// \return collision occupancy
template <typename Coll>
float getOccupancyColl(Coll const& collision, int occEstimator = OccupancyEstimator::Its)
float getOccupancyColl(Coll const& collision, int occEstimator)
{
float occupancy = -999.;
switch (occEstimator) {
case OccupancyEstimator::Its:
occupancy = collision.trackOccupancyInTimeRange();
break;
return collision.trackOccupancyInTimeRange();
case OccupancyEstimator::Ft0c:
occupancy = collision.ft0cOccupancyInTimeRange();
break;
return collision.ft0cOccupancyInTimeRange();
default:
LOG(warning) << "Occupancy estimator not valid. Possible values are ITS or FT0C. Fallback to ITS";
occupancy = collision.trackOccupancyInTimeRange();
LOG(fatal) << "Occupancy estimator not valid. Possible values are ITS or FT0C.";
break;
}
return occupancy;
return -999.f;
};

/// \brief Function to get MC collision occupancy
/// \param collSlice collection of reconstructed collisions associated to a generated one
/// \return generated MC collision occupancy
template <typename CCs>
int getOccupancyGenColl(CCs const& collSlice, int occEstimator = OccupancyEstimator::Its)
int getOccupancyGenColl(CCs const& collSlice, int occEstimator)
{
float multiplicity{0.f};
int occupancy = 0;
Expand Down

0 comments on commit 27f48a3

Please sign in to comment.