Skip to content

Commit 6a0e104

Browse files
authored
[PWGCF,PWGDQ,Tutorial] Do not depend on the character-pack type of HIST names (#18584)
1 parent b2b09f4 commit 6a0e104

12 files changed

Lines changed: 61 additions & 52 deletions

File tree

‎PWGCF/EbyEFluctuations/Tasks/partNumFluc.cxx‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <Framework/InitContext.h>
3939
#include <Framework/O2DatabasePDGPlugin.h>
4040
#include <Framework/OutputObjHeader.h>
41-
#include <Framework/StringHelpers.h>
4241
#include <Framework/runDataProcessing.h>
4342

4443
#include <TFormula.h>
@@ -73,17 +72,8 @@
7372
#include <utility>
7473
#include <vector>
7574

76-
#define C_CS(cs) /* NOLINT(cppcoreguidelines-macro-usage) */ \
77-
[]<std::size_t... indices>(const std::index_sequence<indices...>&) constexpr noexcept -> ConstStr<(cs)[indices]...> { \
78-
static_assert(std::is_array_v<std::remove_cvref_t<decltype(cs)>> && \
79-
std::same_as<std::remove_extent_t<std::remove_cvref_t<decltype(cs)>>, char>); \
80-
return ConstStr<(cs)[indices]...>{}; \
81-
}(std::make_index_sequence<sizeof(cs) - 1>{})
82-
#define C_SV(sv) /* NOLINT(cppcoreguidelines-macro-usage) */ \
83-
[]<std::size_t... indices>(const std::index_sequence<indices...>&) constexpr noexcept -> ConstStr<(sv)[indices]...> { \
84-
static_assert(std::same_as<std::remove_cvref_t<decltype(sv)>, std::string_view>); \
85-
return ConstStr<(sv)[indices]...>{}; \
86-
}(std::make_index_sequence<(sv).size()>{})
75+
#define C_CS(cs) HIST(cs) // NOLINT(cppcoreguidelines-macro-usage)
76+
#define C_SV(sv) HIST(sv) // NOLINT(cppcoreguidelines-macro-usage)
8777

8878
using namespace o2;
8979
using namespace o2::framework;

‎PWGCF/Flow/Tasks/flowGfwOmegaXi.cxx‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,9 @@ struct FlowGfwOmegaXi {
767767
}
768768

769769
// input HIST("name")
770-
template <char... chars>
771-
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
770+
template <typename TName>
771+
requires is_const_str<TName>::value
772+
void fillProfile(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent)
772773
{
773774
double dnx, val;
774775
dnx = fGFW->Calculate(corrconf, 0, kTRUE).real();
@@ -799,8 +800,9 @@ struct FlowGfwOmegaXi {
799800
return;
800801
}
801802

802-
template <char... chars>
803-
void fillProfilepT(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const int& ptbin, const double& cent)
803+
template <typename TName>
804+
requires is_const_str<TName>::value
805+
void fillProfilepT(const GFW::CorrConfig& corrconf, const TName& tarName, const int& ptbin, const double& cent)
804806
{
805807
float dnx = 0;
806808
float val = 0;
@@ -814,8 +816,9 @@ struct FlowGfwOmegaXi {
814816
return;
815817
}
816818

817-
template <char... chars>
818-
void fillProfilepTMC(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const int& ptbin, const int& PDGCode, const double& cent)
819+
template <typename TName>
820+
requires is_const_str<TName>::value
821+
void fillProfilepTMC(const GFW::CorrConfig& corrconf, const TName& tarName, const int& ptbin, const int& PDGCode, const double& cent)
819822
{
820823
TAxis* fpt = nullptr;
821824
if (PDGCode == kXiMinus) {
@@ -843,8 +846,9 @@ struct FlowGfwOmegaXi {
843846
}
844847

845848
// input HIST("name")
846-
template <char... chars>
847-
void fillProfilepTMass(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const int& ptbin, const int& PDGCode, const float& cent)
849+
template <typename TName>
850+
requires is_const_str<TName>::value
851+
void fillProfilepTMass(const GFW::CorrConfig& corrconf, const TName& tarName, const int& ptbin, const int& PDGCode, const float& cent)
848852
{
849853
int nMassBins = 0;
850854
int nptbins = 0;

‎PWGCF/Flow/Tasks/flowGfwTask.cxx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,9 @@ struct FlowGfwTask {
646646

647647
} // end of Initialization
648648

649-
template <char... chars>
650-
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
649+
template <typename TName>
650+
requires is_const_str<TName>::value
651+
void fillProfile(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent)
651652
{
652653
double dnx, val;
653654
dnx = fGFW->Calculate(corrconf, 0, kTRUE).real();

‎PWGCF/Flow/Tasks/flowPbpbPikp.cxx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,9 @@ struct FlowPbpbPikp {
601601
return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton
602602
}
603603

604-
template <char... chars>
605-
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
604+
template <typename TName>
605+
requires is_const_str<TName>::value
606+
void fillProfile(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent)
606607
{
607608
double dnx, val;
608609
if (!corrconf.pTDif) {

‎PWGCF/Flow/Tasks/flowPtEfficiency.cxx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,9 @@ struct FlowPtEfficiency {
271271
myTrackSel.SetMaxDcaZ(cfgCutDCAz);
272272
}
273273

274-
template <char... chars>
275-
void fillProfile(GFW* fGFW, const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
274+
template <typename TName>
275+
requires is_const_str<TName>::value
276+
void fillProfile(GFW* fGFW, const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent)
276277
{
277278
double dnx, val;
278279
dnx = fGFW->Calculate(corrconf, 0, kTRUE).real();

‎PWGCF/Flow/Tasks/flowQa.cxx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,9 @@ struct FlowQa {
402402
}
403403
}
404404

405-
template <char... chars>
406-
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
405+
template <typename TName>
406+
requires is_const_str<TName>::value
407+
void fillProfile(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent)
407408
{
408409
double dnx, val;
409410
dnx = fGFW->Calculate(corrconf, 0, kTRUE).real();

‎PWGCF/Flow/Tasks/flowTask.cxx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,9 @@ struct FlowTask {
837837
th3sPerRun.insert(std::make_pair(runNumber, histPhiEtaVtxz));
838838
}
839839

840-
template <char... chars>
841-
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
840+
template <typename TName>
841+
requires is_const_str<TName>::value
842+
void fillProfile(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent)
842843
{
843844
double dnx, val;
844845
dnx = fGFW->Calculate(corrconf, 0, kTRUE).real();
@@ -853,8 +854,9 @@ struct FlowTask {
853854
return;
854855
}
855856

856-
template <char... chars, char... chars2>
857-
void fillpTvnProfile(const GFW::CorrConfig& corrconf, const double& sum_pt, const double& WeffEvent, const ConstStr<chars...>& vnWeff, const ConstStr<chars2...>& vnpT, const double& cent)
857+
template <typename TName, typename TName2>
858+
requires(is_const_str<TName>::value && is_const_str<TName2>::value)
859+
void fillpTvnProfile(const GFW::CorrConfig& corrconf, const double& sum_pt, const double& WeffEvent, const TName& vnWeff, const TName2& vnpT, const double& cent)
858860
{
859861
double meanPt = sum_pt / WeffEvent;
860862
double dnx, val;

‎PWGCF/Flow/Tasks/pidFlowPtCorr.cxx‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,13 +2380,14 @@ struct PidFlowPtCorr {
23802380
/**
23812381
* @brief fill graphs like c22, c24, etc.
23822382
*
2383-
* @tparam chars
2383+
* @tparam TName
23842384
* @param corrconf
23852385
* @param tarName graph name
23862386
* @param cent
23872387
*/
2388-
template <char... chars>
2389-
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
2388+
template <typename TName>
2389+
requires is_const_str<TName>::value
2390+
void fillProfile(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent)
23902391
{
23912392
// calculate #sum exp{i * 0 (#phi_{i} - #phi_{j})} == N_{pairs}
23922393
// note that weight is ignored in the formula but not in the calculation, for c24 is similar
@@ -2453,16 +2454,17 @@ struct PidFlowPtCorr {
24532454
* @note why we need weightedc22? when calculating cov(v2,pt), we need N_{pair} * N_{charged} to be weight
24542455
* NOTICE!!! when filling weighted, value gave to param ptSum is nch, when filling diffpt, its just ptsum
24552456
*
2456-
* @tparam chars
2457+
* @tparam TName
24572458
* @param corrconf
24582459
* @param tarName
24592460
* @param cent
24602461
* @param ptSum
24612462
* @param nch
24622463
* @param meanPt
24632464
*/
2464-
template <char... chars>
2465-
void fillProfilevnpt(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent, const double& ptSum, const double& nch, const double& meanPt = 0)
2465+
template <typename TName>
2466+
requires is_const_str<TName>::value
2467+
void fillProfilevnpt(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent, const double& ptSum, const double& nch, const double& meanPt = 0)
24662468
{
24672469
double dnx = 0.0, val = 0.0;
24682470
dnx = fGFW->Calculate(corrconf, 0, true).real();
@@ -2475,8 +2477,9 @@ struct PidFlowPtCorr {
24752477
}
24762478
}
24772479

2478-
template <char... chars>
2479-
void fillProfilePOIvnpt(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent, const double& ptSum, const double& nch, const double& rndm)
2480+
template <typename TName>
2481+
requires is_const_str<TName>::value
2482+
void fillProfilePOIvnpt(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent, const double& ptSum, const double& nch, const double& rndm)
24802483
{
24812484
double dnx = 0.0, val = 0.0;
24822485
dnx = fGFW->Calculate(corrconf, 0, true).real();
@@ -2496,8 +2499,9 @@ struct PidFlowPtCorr {
24962499
* counts are added before division. The PID mean pT is only the profile
24972500
* coordinate, so the profile is weighted by the combined pair count alone.
24982501
*/
2499-
template <char... chars>
2500-
void fillProfilePOIvnpt(const GFW::CorrConfig& corrconfA, const GFW::CorrConfig& corrconfB, const ConstStr<chars...>& tarName, const double& cent, const double& ptSum, const double& nPid, const double& rndm)
2502+
template <typename TName>
2503+
requires is_const_str<TName>::value
2504+
void fillProfilePOIvnpt(const GFW::CorrConfig& corrconfA, const GFW::CorrConfig& corrconfB, const TName& tarName, const double& cent, const double& ptSum, const double& nPid, const double& rndm)
25012505
{
25022506
const double dnxA = fGFW->Calculate(corrconfA, 0, true).real();
25032507
const double dnxB = fGFW->Calculate(corrconfB, 0, true).real();

‎PWGCF/Flow/Tasks/resonancesGfwFlow.cxx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,9 @@ struct ResonancesGfwFlow {
921921
return true;
922922
}
923923

924-
template <typename TTrack, typename vector, char... chars, typename TCollision>
925-
void resurrectPhi(const TTrack& trackplus, const TTrack& trackminus, const TCollision& collision, vector plusdaug, vector minusdaug, vector mom, double plusmass, const ConstStr<chars...>& hist)
924+
template <typename TTrack, typename vector, typename TName, typename TCollision>
925+
requires is_const_str<TName>::value
926+
void resurrectPhi(const TTrack& trackplus, const TTrack& trackminus, const TCollision& collision, vector plusdaug, vector minusdaug, vector mom, double plusmass, const TName& hist)
926927
{
927928
for (auto const& [partplus, partminus] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(trackplus, trackminus))) {
928929
histos.fill(HIST("hPhiCount"), 0.5);
@@ -981,8 +982,9 @@ struct ResonancesGfwFlow {
981982
return;
982983
}
983984

984-
template <typename TTrack, char... chars, typename TCollision>
985-
void likeSignPhi(const TTrack& track, const TCollision& collision, double plusmass, const ConstStr<chars...>& hist)
985+
template <typename TTrack, typename TName, typename TCollision>
986+
requires is_const_str<TName>::value
987+
void likeSignPhi(const TTrack& track, const TCollision& collision, double plusmass, const TName& hist)
986988
{
987989
ROOT::Math::PxPyPzMVector daug1, daug2, mom;
988990
for (auto const& [part1, part2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(track, track))) {

‎PWGCF/TwoParticleCorrelations/Tasks/longRangeDihadronCor.cxx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,9 @@ struct LongRangeDihadronCor {
835835
return true;
836836
}
837837

838-
template <char... chars>
839-
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
838+
template <typename TName>
839+
requires is_const_str<TName>::value
840+
void fillProfile(const GFW::CorrConfig& corrconf, const TName& tarName, const double& cent)
840841
{
841842
double dnx, val;
842843
dnx = cfgCumulantConfig.fGFW->Calculate(corrconf, 0, kTRUE).real();

0 commit comments

Comments
 (0)