Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LF] use std::abs #7879

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions PWGLF/TableProducer/Nuspex/spectraDerivedMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct spectraDerivedMaker {
histos.fill(HIST("evsel"), 6.f);
}
}
if (abs(collision.posZ()) > cfgCutVertex) {
if (std::abs(collision.posZ()) > cfgCutVertex) {
return false;
}
if constexpr (fillHistograms) {
Expand Down Expand Up @@ -235,7 +235,7 @@ struct spectraDerivedMaker {
if constexpr (fillHistograms) {
histos.fill(HIST("tracksel"), 1);
}
if (abs(track.eta()) > cfgCutEta) {
if (std::abs(track.eta()) > cfgCutEta) {
return false;
}
if constexpr (fillHistograms) {
Expand Down Expand Up @@ -388,4 +388,4 @@ struct spectraDerivedMaker {
PROCESS_SWITCH(spectraDerivedMaker, processMC, "Process MC for derived dataset production", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<spectraDerivedMaker>(cfgc)}; }
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<spectraDerivedMaker>(cfgc)}; }
10 changes: 5 additions & 5 deletions PWGLF/TableProducer/Strangeness/v0qaanalysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ struct LfV0qaanalysis {
}
auto v0mcparticle = v0.mcParticle();

if (abs(v0mcparticle.y()) > 0.5f) {
if (std::abs(v0mcparticle.y()) > 0.5f) {
continue;
}

Expand Down Expand Up @@ -372,7 +372,7 @@ struct LfV0qaanalysis {
continue;
}

if (abs(mcParticle.y()) > 0.5f) {
if (std::abs(mcParticle.y()) > 0.5f) {
continue;
}

Expand Down Expand Up @@ -432,7 +432,7 @@ struct LfV0qaanalysis {
if (!mcParticle.isPhysicalPrimary()) {
continue;
}
if (abs(mcParticle.y()) > 0.5f) {
if (std::abs(mcParticle.y()) > 0.5f) {
continue;
}

Expand Down Expand Up @@ -491,7 +491,7 @@ struct LfV0qaanalysis {
continue;
}

if (abs(mcParticle.y()) > 0.5f) {
if (std::abs(mcParticle.y()) > 0.5f) {
continue;
}

Expand Down Expand Up @@ -543,7 +543,7 @@ struct LfV0qaanalysis {
continue;
}

if (abs(mcParticle.y()) > 0.5f) {
if (std::abs(mcParticle.y()) > 0.5f) {
continue;
}

Expand Down
14 changes: 7 additions & 7 deletions PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ struct hadronnucleicorrelation {
hEtaPhi_PrAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt());
hCorrEtaPhi_PrAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (pcorr * antipcorr));

if (doQA && abs(deltaEta) < threta && abs(deltaPhi) < thrphi) {
if (doQA && std::abs(deltaEta) < threta && std::abs(deltaPhi) < thrphi) {
QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_Debug"), it1->pt(), it1->tpcNSigmaPr());
QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_Debug"), -1.f * it2->pt(), it2->tpcNSigmaPr());
QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_Debug"), it1->pt(), it1->tofNSigmaPr());
Expand Down Expand Up @@ -496,7 +496,7 @@ struct hadronnucleicorrelation {
hEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt());
hCorrEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (antipcorr * antidcorr));

if (doQA && abs(deltaEta) < threta && abs(deltaPhi) < thrphi) {
if (doQA && std::abs(deltaEta) < threta && std::abs(deltaPhi) < thrphi) {
QA.fill(HIST("QA/hnSigmaTPCVsPt_De_Debug"), -1.f * it1->pt(), it1->tpcNSigmaDe());
QA.fill(HIST("QA/hnSigmaTPCVsPt_APrDe_Debug"), -1.f * it2->pt(), it2->tpcNSigmaPr());
QA.fill(HIST("QA/hnSigmaTOFVsPt_De_Debug"), -1.f * it1->pt(), it1->tofNSigmaDe());
Expand Down Expand Up @@ -566,9 +566,9 @@ struct hadronnucleicorrelation {
void processData(FilteredCollisions const& collisions, FilteredTracks const& tracks)
{
for (auto track : tracks) {
if (abs(track.template singleCollSel_as<FilteredCollisions>().posZ()) > cutzvertex)
if (std::abs(track.template singleCollSel_as<FilteredCollisions>().posZ()) > cutzvertex)
continue;
if (abs(track.dcaXY()) > max_dcaxy || abs(track.dcaZ()) > max_dcaz) { // For now no filtering on the DCAxy or DCAz (casting not supported)
if (std::abs(track.dcaXY()) > max_dcaxy || std::abs(track.dcaZ()) > max_dcaz) { // For now no filtering on the DCAxy or DCAz (casting not supported)
continue;
}
if (track.tpcFractionSharedCls() > max_tpcSharedCls || track.itsNCls() < min_itsNCls)
Expand Down Expand Up @@ -831,13 +831,13 @@ struct hadronnucleicorrelation {
void processMC(FilteredCollisions const& collisions, FilteredTracksMC const& tracks)
{
for (auto track : tracks) {
if (abs(track.template singleCollSel_as<FilteredCollisions>().posZ()) > cutzvertex)
if (std::abs(track.template singleCollSel_as<FilteredCollisions>().posZ()) > cutzvertex)
continue;

if (abs(track.dcaXY()) > max_dcaxy || abs(track.dcaZ()) > max_dcaz) { // For now no filtering on the DCAxy or DCAz (casting not supported)
if (std::abs(track.dcaXY()) > max_dcaxy || std::abs(track.dcaZ()) > max_dcaz) { // For now no filtering on the DCAxy or DCAz (casting not supported)
continue;
}
if (abs(track.pdgCode()) != pdgProton && abs(track.pdgCode()) != pdgDeuteron)
if (std::abs(track.pdgCode()) != pdgProton && std::abs(track.pdgCode()) != pdgDeuteron)
continue;

if (doQA) {
Expand Down
22 changes: 11 additions & 11 deletions PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ struct nuclei_in_jets {
registryData.fill(HIST("number_of_events_data"), 1.5);

// Cut on z-vertex
if (abs(collision.posZ()) > zVtx)
if (std::abs(collision.posZ()) > zVtx)
return;

// Event Counter: after z-vertex cut
Expand Down Expand Up @@ -454,7 +454,7 @@ struct nuclei_in_jets {
int n_jets_selected(0);
for (int i = 0; i < static_cast<int>(jet.size()); i++) {

if ((abs(jet[i].Eta()) + Rjet) > max_eta)
if ((std::abs(jet[i].Eta()) + Rjet) > max_eta)
continue;

// Perpendicular cones
Expand Down Expand Up @@ -688,7 +688,7 @@ struct nuclei_in_jets {
if (!collision.sel8())
continue;

if (abs(collision.posZ()) > 10)
if (std::abs(collision.posZ()) > 10)
continue;

// Event Counter (after event sel)
Expand Down Expand Up @@ -792,7 +792,7 @@ struct nuclei_in_jets {
continue;
registryMC.fill(HIST("number_of_events_mc"), 4.5);

if (abs(collision.posZ()) > zVtx)
if (std::abs(collision.posZ()) > zVtx)
continue;
registryMC.fill(HIST("number_of_events_mc"), 5.5);

Expand Down Expand Up @@ -859,7 +859,7 @@ struct nuclei_in_jets {
int n_jets_selected(0);
for (int i = 0; i < static_cast<int>(jet.size()); i++) {

if ((abs(jet[i].Eta()) + Rjet) > max_eta)
if ((std::abs(jet[i].Eta()) + Rjet) > max_eta)
continue;

// Perpendicular cones
Expand Down Expand Up @@ -973,7 +973,7 @@ struct nuclei_in_jets {
registryMC.fill(HIST("number_of_events_mc"), 7.5);

// Selection on z_{vertex}
if (abs(mccollision.posZ()) > 10)
if (std::abs(mccollision.posZ()) > 10)
continue;
registryMC.fill(HIST("number_of_events_mc"), 8.5);

Expand All @@ -993,7 +993,7 @@ struct nuclei_in_jets {
double dy = particle.vy() - mccollision.posY();
double dz = particle.vz() - mccollision.posZ();
double dcaxy = sqrt(dx * dx + dy * dy);
double dcaz = abs(dz);
double dcaz = std::abs(dz);

if (setDCAselectionPtDep) {
if (dcaxy > (0.004f + 0.013f / particle.pt()))
Expand All @@ -1008,7 +1008,7 @@ struct nuclei_in_jets {
continue;
}

if (abs(particle.eta()) > 0.8)
if (std::abs(particle.eta()) > 0.8)
continue;
if (particle.pt() < 0.15)
continue;
Expand Down Expand Up @@ -1071,7 +1071,7 @@ struct nuclei_in_jets {
int n_jets_selected(0);
for (int i = 0; i < static_cast<int>(jet.size()); i++) {

if ((abs(jet[i].Eta()) + Rjet) > max_eta)
if ((std::abs(jet[i].Eta()) + Rjet) > max_eta)
continue;

// Perpendicular cones
Expand All @@ -1094,7 +1094,7 @@ struct nuclei_in_jets {
double dy = particle.vy() - mccollision.posY();
double dz = particle.vz() - mccollision.posZ();
double dcaxy = sqrt(dx * dx + dy * dy);
double dcaz = abs(dz);
double dcaz = std::abs(dz);

if (setDCAselectionPtDep) {
if (dcaxy > (0.004f + 0.013f / particle.pt()))
Expand All @@ -1109,7 +1109,7 @@ struct nuclei_in_jets {
continue;
}

if (abs(particle.eta()) > 0.8)
if (std::abs(particle.eta()) > 0.8)
continue;
if (particle.pt() < 0.15)
continue;
Expand Down
10 changes: 5 additions & 5 deletions PWGLF/Tasks/Nuspex/spectraTOF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ struct tofSpectra {
template <bool fillFullInfo, PID::ID id, typename T, typename C>
void fillParticleHistos(const T& track, const C& collision)
{
if (abs(track.rapidity(PID::getMass(id))) > trkselOptions.cfgCutY) {
if (std::abs(track.rapidity(PID::getMass(id))) > trkselOptions.cfgCutY) {
return;
}
if constexpr (id == PID::Kaon) {
Expand Down Expand Up @@ -1025,7 +1025,7 @@ struct tofSpectra {
histos.fill(HIST("evsel"), 12.f);
}
}
if (abs(collision.posZ()) > evselOptions.cfgCutVertex) {
if (std::abs(collision.posZ()) > evselOptions.cfgCutVertex) {
return false;
}
if constexpr (fillHistograms) {
Expand Down Expand Up @@ -1075,7 +1075,7 @@ struct tofSpectra {
return false;
}
}
return (abs(track.dcaXY()) <= (maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f))));
return (std::abs(track.dcaXY()) <= (maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f))));
}
return track.isGlobalTrack();
}
Expand Down Expand Up @@ -1843,7 +1843,7 @@ struct tofSpectra {

const float multiplicity = getMultiplicityMC(mcCollision);
if (mcParticle.isPhysicalPrimary()) {
if (abs(mcCollision.posZ()) < evselOptions.cfgCutVertex) {
if (std::abs(mcCollision.posZ()) < evselOptions.cfgCutVertex) {
histos.fill(HIST(hpt_den_prm_mcgoodev[i]), mcParticle.pt(), multiplicity);
} else {
histos.fill(HIST(hpt_den_prm_mcbadev[i]), mcParticle.pt(), multiplicity);
Expand Down Expand Up @@ -1962,7 +1962,7 @@ struct tofSpectra {

// Loop on generated collisions
for (const auto& mcCollision : mcCollisions) {
if (abs(mcCollision.posZ()) > evselOptions.cfgCutVertex) {
if (std::abs(mcCollision.posZ()) > evselOptions.cfgCutVertex) {
continue;
}
histos.fill(HIST("MC/Multiplicity"), getMultiplicityMC(mcCollision));
Expand Down
6 changes: 3 additions & 3 deletions PWGLF/Tasks/Nuspex/spectraTOFRun2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ struct tofSpectraRun2 {
template <bool fillFullInfo, PID::ID id, typename T, typename C>
void fillParticleHistos(const T& track, const C& /*collision*/)
{
if (abs(track.rapidity(PID::getMass(id))) > cfgCutY) {
if (std::abs(track.rapidity(PID::getMass(id))) > cfgCutY) {
return;
}
const auto& nsigmaTOF = o2::aod::pidutils::tofNSigma<id>(track);
Expand Down Expand Up @@ -468,7 +468,7 @@ struct tofSpectraRun2 {
if constexpr (fillHistograms) {
histos.fill(HIST("evsel"), 2);
}
if (abs(collision.posZ()) > cfgCutVertex) {
if (std::abs(collision.posZ()) > cfgCutVertex) {
return false;
}
if constexpr (fillHistograms) {
Expand Down Expand Up @@ -496,7 +496,7 @@ struct tofSpectraRun2 {
if constexpr (fillHistograms) {
histos.fill(HIST("tracksel"), 1);
}
if (abs(track.eta()) > cfgCutEta) {
if (std::abs(track.eta()) > cfgCutEta) {
return false;
}
if constexpr (fillHistograms) {
Expand Down
12 changes: 6 additions & 6 deletions PWGLF/Tasks/Nuspex/spectraTPC.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct tpcSpectra {
void fillParticleHistos(const T& track)
{
const float y = TMath::ASinH(track.pt() / TMath::Sqrt(PID::getMass2(id) + track.pt() * track.pt()) * TMath::SinH(track.eta()));
if (abs(y) > 0.5) {
if (std::abs(y) > 0.5) {
return;
}
const auto& nsigma = o2::aod::pidutils::tpcNSigma<id>(track);
Expand All @@ -131,7 +131,7 @@ struct tpcSpectra {
if (!track.isGlobalTrack()) {
return;
}
if (abs(nsigma) > cfgNSigmaCut) {
if (std::abs(nsigma) > cfgNSigmaCut) {
return;
}
histos.fill(HIST(hp[id]), track.p());
Expand All @@ -155,15 +155,15 @@ struct tpcSpectra {
return;
}
histos.fill(HIST("evsel"), 2);
if (abs(collision.posZ()) > cfgCutVertex) {
if (std::abs(collision.posZ()) > cfgCutVertex) {
return;
}
histos.fill(HIST("evsel"), 3);
histos.fill(HIST("event/vertexz"), collision.posZ());

for (const auto& track : tracks) {
histos.fill(HIST("tracksel"), 1);
if (abs(track.eta()) > cfgCutEta) {
if (std::abs(track.eta()) > cfgCutEta) {
continue;
}
histos.fill(HIST("tracksel"), 2);
Expand Down Expand Up @@ -279,15 +279,15 @@ struct tpcPidQaSignalwTof {
TrackCandidates const& tracks)
{
histos.fill(HIST("evsel"), 1);
if (abs(collision.posZ()) > cfgCutVertex) {
if (std::abs(collision.posZ()) > cfgCutVertex) {
return;
}
histos.fill(HIST("evsel"), 2);
histos.fill(HIST("event/vertexz"), collision.posZ());

for (const auto& track : tracks) {
histos.fill(HIST("tracksel"), 1);
if (abs(track.eta()) > cfgCutEta) {
if (std::abs(track.eta()) > cfgCutEta) {
continue;
}
histos.fill(HIST("tracksel"), 2);
Expand Down
6 changes: 3 additions & 3 deletions PWGLF/Tasks/Nuspex/spectraTPCtiny.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct tpcSpectraTiny {
template <std::size_t i, typename T>
void fillParticleHistos(const T& track, const float& nsigma)
{
if (abs(nsigma) > cfgNSigmaCut) {
if (std::abs(nsigma) > cfgNSigmaCut) {
return;
}
histos.fill(HIST(hp[i]), track.p());
Expand All @@ -78,15 +78,15 @@ struct tpcSpectraTiny {
TrackCandidates const& tracks)
{
histos.fill(HIST("evsel"), 1);
if (abs(collision.posZ()) > cfgCutVertex) {
if (std::abs(collision.posZ()) > cfgCutVertex) {
return;
}
histos.fill(HIST("evsel"), 2);
histos.fill(HIST("event/vertexz"), collision.posZ());

for (const auto& track : tracks) {
histos.fill(HIST("tracksel"), 1);
if (abs(track.eta()) > cfgCutEta) {
if (std::abs(track.eta()) > cfgCutEta) {
continue;
}
histos.fill(HIST("tracksel"), 2);
Expand Down
2 changes: 1 addition & 1 deletion PWGLF/Tasks/Nuspex/spectraTPCtinyPiKaPr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct tpcSpectraTinyPiKaPr {
template <std::size_t i, typename T>
void fillParticleHistos(const T& track, const float& nsigma)
{
if (abs(nsigma) > cfgNSigmaCut) {
if (std::abs(nsigma) > cfgNSigmaCut) {
return;
}
histos.fill(HIST(hp[i]), track.p());
Expand Down
Loading
Loading