Skip to content

Commit 7c9e4ac

Browse files
author
Victor Gonzalez
committed
[PWGCF] DptDpt - Filter and skimming framework fix MegaLinter issues
1 parent 0abad0c commit 7c9e4ac

7 files changed

Lines changed: 38 additions & 40 deletions

‎PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,9 @@ void EventSelectionFilterAndAnalysis::constructCutFromString(const TString& cuts
329329
if (lev2str.Length() == 0) {
330330
break;
331331
}
332-
regex cutregex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}");
333-
std::string in(lev2str.Data());
334-
smatch m;
335-
bool res = regex_search(in, m, cutregex);
332+
cutregex = regex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}");
333+
in = (lev2str.Data());
334+
res = regex_search(in, m, cutregex);
336335
constexpr int ExpectedComponents = 3;
337336

338337
if (not res or m.empty() or (m.size() != ExpectedComponents)) {

‎PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class EventSelectionConfigurable
4343
friend class EventSelectionFilterAndAnalysis;
4444

4545
public:
46-
EventSelectionConfigurable(std::string bfieldsel = "",
47-
std::string multsel = "",
48-
std::string trigsel = "",
49-
std::string zvtxsel = "",
50-
std::string pileuprej = "")
46+
explicit EventSelectionConfigurable(std::string bfieldsel = "",
47+
std::string multsel = "",
48+
std::string trigsel = "",
49+
std::string zvtxsel = "",
50+
std::string pileuprej = "")
5151
: mBFiledSel(std::move(bfieldsel)), mMultSel{std::move(multsel)}, mTriggerSel{std::move(trigsel)}, mZVertexSel{std::move(zvtxsel)}, mPileUpRejection{std::move(pileuprej)}
5252
{
5353
}
@@ -187,7 +187,7 @@ inline bool EventSelectionFilterAndAnalysis::ComplexBrickHelper::filter(uint64_t
187187
/* and now the variants */
188188
TList& varlst = dynamic_cast<CutWithVariations<float>*>(mBrick)->getVariantBricks();
189189
for (int i = 0; i < varlst.GetEntries(); ++i) {
190-
bool acc = filter(mask, bit, dynamic_cast<CutBrick<float>*>(varlst.At(i)), mAlternateEstimatorIndex[i]);
190+
acc = filter(mask, bit, dynamic_cast<CutBrick<float>*>(varlst.At(i)), mAlternateEstimatorIndex[i]);
191191
atleastonealternative = atleastonealternative || acc;
192192
}
193193
acceptcollision = acceptcollision && atleastonealternative;

‎PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,9 @@ void PIDSelectionFilterAndAnalysis::constructCutFromString(const TString& cutstr
235235
if (lev2str.Length() == 0) {
236236
break;
237237
}
238-
regex cutregex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}");
239-
std::string in(lev2str.Data());
240-
smatch m;
241-
bool res = regex_search(in, m, cutregex);
238+
cutregex = regex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}");
239+
in = std::string(lev2str.Data());
240+
res = regex_search(in, m, cutregex);
242241
constexpr int ExpectedComponents = 3;
243242
if (not res or m.empty() or (m.size() != ExpectedComponents)) {
244243
LOGF(fatal, "PIDSelectionFilterAndAnalysis::::ConstructCutFromString. Wrong RE: %s, try pidsel{tpcsel{tpcpi{cwv{rg{-3.0,3.0}:rg{-2.0,2.0},rg{-3.0,5.0}}}}} for instance", cutstr.Data());

‎PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ class PIDSelectionConfigurable
4343

4444
public:
4545
#ifdef INCORPORATEBAYESIANPID
46-
PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "",
47-
std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "",
48-
std::string pidbayel = "", std::string pidbaymu = "", std::string pidbaypi = "", std::string pidbayka = "", std::string pidbaypr = "")
46+
explicit PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "",
47+
std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "",
48+
std::string pidbayel = "", std::string pidbaymu = "", std::string pidbaypi = "", std::string pidbayka = "", std::string pidbaypr = "")
4949
: mPidTpcSelEl{pidtpcel}, mPidTpcSelMu{pidtpcmu}, mPidTpcSelPi{pidtpcpi}, mPidTpcSelKa{pidtpcka}, mPidTpcSelPr{pidtpcpr}, mPidTofSelEl{pidtofel}, mPidTofSelMu{pidtofmu}, mPidTofSelPi{pidtofpi}, mPidTofSelKa{pidtofka}, mPidTofSelPr{pidtofpr}, mPidBaySelEl{pidbayel}, mPidBaySelMu{pidbaymu}, mPidBaySelPi{pidbaypi}, mPidBaySelKa{pidbayka}, mPidBaySelPr{pidbaypr}
5050
{
5151
}
5252
PIDSelectionConfigurable(std::vector<std::string> pidtpcel, std::vector<std::string> pidtpcmu, std::vector<std::string> pidtpcpi, std::vector<std::string> pidtpcka, std::vector<std::string> pidtpcpr,
5353
std::vector<std::string> pidtofel, std::vector<std::string> pidtofmu, std::vector<std::string> pidtofpi, std::vector<std::string> pidtofka, std::vector<std::string> pidtofpr,
5454
std::vector<std::string> pidbayel, std::vector<std::string> pidbaymu, std::vector<std::string> pidbaypi, std::vector<std::string> pidbayka, std::vector<std::string> pidbaypr);
5555
#else
56-
PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "",
57-
std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "")
56+
explicit PIDSelectionConfigurable(std::string pidtpcel = "", std::string pidtpcmu = "", std::string pidtpcpi = "", std::string pidtpcka = "", std::string pidtpcpr = "",
57+
std::string pidtofel = "", std::string pidtofmu = "", std::string pidtofpi = "", std::string pidtofka = "", std::string pidtofpr = "")
5858
: mPidTpcSelEl{std::move(pidtpcel)},
5959
mPidTpcSelMu{std::move(pidtpcmu)},
6060
mPidTpcSelPi{std::move(pidtpcpi)},

‎PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ CutBrickLimit<TValueToFilter>::CutBrickLimit()
125125
/// \param value The limit value
126126
template <typename TValueToFilter>
127127
CutBrickLimit<TValueToFilter>::CutBrickLimit(const char* name, const TValueToFilter& value)
128-
: CutBrick<TValueToFilter>(name, TString::Format("%s{lim{%f}}", name, float(value))),
128+
: CutBrick<TValueToFilter>(name, TString::Format("%s{lim{%f}}", name, static_cast<float>(value))),
129129
mLimit(value)
130130
{
131131
}
@@ -261,7 +261,7 @@ CutBrickThreshold<TValueToFilter>::CutBrickThreshold()
261261
/// \param value The threshold value
262262
template <typename TValueToFilter>
263263
CutBrickThreshold<TValueToFilter>::CutBrickThreshold(const char* name, const TValueToFilter& value)
264-
: CutBrick<TValueToFilter>(name, TString::Format("%s{th{%f}}", name, float(value))),
264+
: CutBrick<TValueToFilter>(name, TString::Format("%s{th{%f}}", name, static_cast<float>(value))),
265265
mThreshold(value)
266266
{
267267
}
@@ -399,7 +399,7 @@ CutBrickRange<TValueToFilter>::CutBrickRange()
399399
/// \param high The high value for the cut range
400400
template <typename TValueToFilter>
401401
CutBrickRange<TValueToFilter>::CutBrickRange(const char* name, const TValueToFilter& low, const TValueToFilter& high)
402-
: CutBrick<TValueToFilter>(name, TString::Format("%s{rg{%f,%f}}", name, float(low), float(high))),
402+
: CutBrick<TValueToFilter>(name, TString::Format("%s{rg{%f,%f}}", name, static_cast<float>(low), static_cast<float>(high))),
403403
mLow(low),
404404
mUp(high)
405405
{
@@ -543,7 +543,7 @@ CutBrickExtToRange<TValueToFilter>::CutBrickExtToRange()
543543
/// \param high The high value for the cut excluded range
544544
template <typename TValueToFilter>
545545
CutBrickExtToRange<TValueToFilter>::CutBrickExtToRange(const char* name, const TValueToFilter& low, const TValueToFilter& high)
546-
: CutBrick<TValueToFilter>(name, TString::Format("%s{xrg{%f,%f}}", name, float(low), float(high))),
546+
: CutBrick<TValueToFilter>(name, TString::Format("%s{xrg{%f,%f}}", name, static_cast<float>(low), static_cast<float>(high))),
547547
mLow(low),
548548
mUp(high)
549549
{
@@ -691,9 +691,10 @@ CutBrickSelectorMultipleRanges<TValueToFilter>::CutBrickSelectorMultipleRanges(c
691691
for (const auto& edge : edges) {
692692
mEdges.push_back(edge);
693693
if (first) {
694-
title += TString::Format("%.2f", float(edge));
694+
title += TString::Format("%.2f", static_cast<float>(edge));
695+
first = false;
695696
} else {
696-
title += TString::Format(",%.2f", float(edge));
697+
title += TString::Format(",%.2f", static_cast<float>(edge));
697698
}
698699
}
699700
title += "}";

‎PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,9 @@ void TrackSelectionFilterAndAnalysis::constructCutFromString(const TString& cuts
328328
if (lev2str.Length() == 0) {
329329
break;
330330
}
331-
regex cutregex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}");
332-
std::string in(lev2str.Data());
333-
smatch m;
334-
bool res = regex_search(in, m, cutregex);
331+
cutregex = regex("^(\\w+)\\{((?:[^{}]++|\\{(?2)\\})*)\\}");
332+
in = std::string(lev2str.Data());
333+
res = regex_search(in, m, cutregex);
335334
constexpr int ExpectedComponents = 3;
336335
if (not res or m.empty() or (m.size() != ExpectedComponents)) {
337336
Fatal("TrackSelectionFilterAndAnalysis::::ConstructCutFromString", "Wrong RE: %s, try tracksel{ttype{FB32,FB96};nclstpc{th{70}},nxr{cwv{th{70},th{80}}}} for instance", cutstr.Data());

‎PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.h‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ class TrackSelectionConfigurable
4242
friend class TrackSelectionFilterAndAnalysis;
4343

4444
public:
45-
TrackSelectionConfigurable(std::string ttype = "",
46-
std::string nclstpc = "",
47-
std::string nxrtpc = "",
48-
std::string nclsits = "",
49-
std::string chi2clustpc = "",
50-
std::string chi2clusits = "",
51-
std::string xrofctpc = "",
52-
std::string dcaxy = "",
53-
std::string dcaz = "",
54-
std::string ptrange = "",
55-
std::string etarange = "")
45+
explicit TrackSelectionConfigurable(std::string ttype = "",
46+
std::string nclstpc = "",
47+
std::string nxrtpc = "",
48+
std::string nclsits = "",
49+
std::string chi2clustpc = "",
50+
std::string chi2clusits = "",
51+
std::string xrofctpc = "",
52+
std::string dcaxy = "",
53+
std::string dcaz = "",
54+
std::string ptrange = "",
55+
std::string etarange = "")
5656
: mTrackTypes{std::move(ttype)},
5757
mNClustersTPC{std::move(nclstpc)},
5858
mNCrossedRowsTPC{std::move(nxrtpc)},

0 commit comments

Comments
 (0)