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

Fix namespace pollution from std and o2::constants #11851

Merged
merged 5 commits into from
Sep 27, 2023
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
2 changes: 0 additions & 2 deletions CCDB/include/CCDB/CCDBDownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ typedef struct uv_signal_s uv_signal_t;
typedef struct uv_async_s uv_async_t;
typedef struct uv_handle_s uv_handle_t;

using namespace std;

namespace o2::ccdb
{

Expand Down
2 changes: 0 additions & 2 deletions Detectors/FIT/raw/include/FITRaw/DataBlockBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ namespace o2
namespace fit
{

using namespace std;

static constexpr size_t SIZE_WORD = 16;
static constexpr size_t SIZE_WORD_GBT = 10; // should be changed to gloabal variable
static constexpr size_t SIZE_MAX_PAGE = 8192; // should be changed to gloabal variable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "DataFormatsTPC/SAC.h"

using o2::constants::lhc::LHCBunchSpacingMUS;
using std::size_t;

namespace o2::tpc::sac
{
Expand Down
2 changes: 0 additions & 2 deletions Detectors/TPC/simulation/include/TPCSimulation/Digitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

#include <cmath>

using std::vector;

class TTree;
class TH3;

Expand Down
22 changes: 10 additions & 12 deletions Framework/Core/include/Framework/AnalysisDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
#include "CommonConstants/ZDCConstants.h"
#include "SimulationDataFormat/MCGenProperties.h"

using namespace o2::constants::math;

namespace o2
{
namespace aod
Expand Down Expand Up @@ -122,13 +120,13 @@ DECLARE_SOA_COLUMN(Snp, snp, float); //!
DECLARE_SOA_COLUMN(Tgl, tgl, float); //!
DECLARE_SOA_COLUMN(Signed1Pt, signed1Pt, float); //! (sign of charge)/Pt in c/GeV. Use pt() and sign() instead
DECLARE_SOA_EXPRESSION_COLUMN(Phi, phi, float, //! Phi of the track, in radians within [0, 2pi)
ifnode(nasin(aod::track::snp) + aod::track::alpha < 0.0f, nasin(aod::track::snp) + aod::track::alpha + TwoPI,
ifnode(nasin(aod::track::snp) + aod::track::alpha >= TwoPI, nasin(aod::track::snp) + aod::track::alpha - TwoPI,
ifnode(nasin(aod::track::snp) + aod::track::alpha < 0.0f, nasin(aod::track::snp) + aod::track::alpha + o2::constants::math::TwoPI,
ifnode(nasin(aod::track::snp) + aod::track::alpha >= o2::constants::math::TwoPI, nasin(aod::track::snp) + aod::track::alpha - o2::constants::math::TwoPI,
nasin(aod::track::snp) + aod::track::alpha)));
DECLARE_SOA_EXPRESSION_COLUMN(Eta, eta, float, //! Pseudorapidity
-1.f * nlog(ntan(PIQuarter - 0.5f * natan(aod::track::tgl))));
-1.f * nlog(ntan(o2::constants::math::PIQuarter - 0.5f * natan(aod::track::tgl))));
DECLARE_SOA_EXPRESSION_COLUMN(Pt, pt, float, //! Transverse momentum of the track in GeV/c
ifnode(nabs(aod::track::signed1Pt) <= Almost0, VeryBig, nabs(1.f / aod::track::signed1Pt)));
ifnode(nabs(aod::track::signed1Pt) <= o2::constants::math::Almost0, o2::constants::math::VeryBig, nabs(1.f / aod::track::signed1Pt)));
DECLARE_SOA_DYNAMIC_COLUMN(IsWithinBeamPipe, isWithinBeamPipe, //! Is the track within the beam pipe (= successfully propagated to a collision vertex)
[](float x) -> bool { return (std::fabs(x) < o2::constants::geom::XBeamPipeOuterRef); });
DECLARE_SOA_DYNAMIC_COLUMN(Sign, sign, //! Charge: positive: 1, negative: -1
Expand Down Expand Up @@ -156,18 +154,18 @@ DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! Momentum in z-direction in GeV/c
});

DECLARE_SOA_EXPRESSION_COLUMN(P, p, float, //! Momentum in Gev/c
ifnode(nabs(aod::track::signed1Pt) <= Almost0, VeryBig, 0.5f * (ntan(PIQuarter - 0.5f * natan(aod::track::tgl)) + 1.f / ntan(PIQuarter - 0.5f * natan(aod::track::tgl))) / nabs(aod::track::signed1Pt)));
ifnode(nabs(aod::track::signed1Pt) <= o2::constants::math::Almost0, o2::constants::math::VeryBig, 0.5f * (ntan(o2::constants::math::PIQuarter - 0.5f * natan(aod::track::tgl)) + 1.f / ntan(o2::constants::math::PIQuarter - 0.5f * natan(aod::track::tgl))) / nabs(aod::track::signed1Pt)));
DECLARE_SOA_DYNAMIC_COLUMN(Energy, energy, //! Track energy, computed under the mass assumption given as input
[](float signed1Pt, float tgl, float mass) -> float {
const auto pt = 1.f / std::abs(signed1Pt);
const auto p = 0.5f * (tan(PIQuarter - 0.5f * atan(tgl)) + 1.f / tan(PIQuarter - 0.5f * atan(tgl))) * pt;
const auto p = 0.5f * (tan(o2::constants::math::PIQuarter - 0.5f * atan(tgl)) + 1.f / tan(o2::constants::math::PIQuarter - 0.5f * atan(tgl))) * pt;
return sqrt(p * p + mass * mass);
});
DECLARE_SOA_DYNAMIC_COLUMN(Rapidity, rapidity, //! Track rapidity, computed under the mass assumption given as input
[](float signed1Pt, float tgl, float mass) -> float {
const auto pt = 1.f / std::abs(signed1Pt);
const auto pz = pt * tgl;
const auto p = 0.5f * (tan(PIQuarter - 0.5f * atan(tgl)) + 1.f / tan(PIQuarter - 0.5f * atan(tgl))) * pt;
const auto p = 0.5f * (tan(o2::constants::math::PIQuarter - 0.5f * atan(tgl)) + 1.f / tan(o2::constants::math::PIQuarter - 0.5f * atan(tgl))) * pt;
const auto energy = sqrt(p * p + mass * mass);
return 0.5f * log((energy + pz) / (energy - pz));
});
Expand Down Expand Up @@ -458,11 +456,11 @@ DECLARE_SOA_COLUMN(TrackTimeRes, trackTimeRes, float);
DECLARE_SOA_DYNAMIC_COLUMN(Sign, sign, //! Sign of the track eletric charge
[](float signed1Pt) -> short { return (signed1Pt > 0) ? 1 : -1; });
DECLARE_SOA_EXPRESSION_COLUMN(Eta, eta, float, //!
-1.f * nlog(ntan(PIQuarter - 0.5f * natan(aod::fwdtrack::tgl))));
-1.f * nlog(ntan(o2::constants::math::PIQuarter - 0.5f * natan(aod::fwdtrack::tgl))));
DECLARE_SOA_EXPRESSION_COLUMN(Pt, pt, float, //!
ifnode(nabs(aod::fwdtrack::signed1Pt) < o2::constants::math::Almost0, o2::constants::math::VeryBig, nabs(1.f / aod::fwdtrack::signed1Pt)));
DECLARE_SOA_EXPRESSION_COLUMN(P, p, float, //!
ifnode((nabs(aod::fwdtrack::signed1Pt) < o2::constants::math::Almost0) || (nabs(PIQuarter - 0.5f * natan(aod::fwdtrack::tgl)) < o2::constants::math::Almost0), o2::constants::math::VeryBig, 0.5f * (ntan(PIQuarter - 0.5f * natan(aod::fwdtrack::tgl)) + 1.f / ntan(PIQuarter - 0.5f * natan(aod::fwdtrack::tgl))) / nabs(aod::fwdtrack::signed1Pt)));
ifnode((nabs(aod::fwdtrack::signed1Pt) < o2::constants::math::Almost0) || (nabs(o2::constants::math::PIQuarter - 0.5f * natan(aod::fwdtrack::tgl)) < o2::constants::math::Almost0), o2::constants::math::VeryBig, 0.5f * (ntan(o2::constants::math::PIQuarter - 0.5f * natan(aod::fwdtrack::tgl)) + 1.f / ntan(o2::constants::math::PIQuarter - 0.5f * natan(aod::fwdtrack::tgl))) / nabs(aod::fwdtrack::signed1Pt)));
DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //!
[](float pt, float phi) -> float {
return pt * std::cos(phi);
Expand Down Expand Up @@ -1360,7 +1358,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(IsPhysicalPrimary, isPhysicalPrimary, //! True if par
[](uint8_t flags) -> bool { return (flags & o2::aod::mcparticle::enums::PhysicalPrimary) == o2::aod::mcparticle::enums::PhysicalPrimary; });

DECLARE_SOA_EXPRESSION_COLUMN(Phi, phi, float, //! Phi in the range [0, 2pi)
PI + natan2(-1.0f * aod::mcparticle::py, -1.0f * aod::mcparticle::px));
o2::constants::math::PI + natan2(-1.0f * aod::mcparticle::py, -1.0f * aod::mcparticle::px));
DECLARE_SOA_EXPRESSION_COLUMN(Eta, eta, float, //! Pseudorapidity, conditionally defined to avoid FPEs
ifnode((nsqrt(aod::mcparticle::px * aod::mcparticle::px +
aod::mcparticle::py * aod::mcparticle::py +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using namespace o2;
using namespace o2::framework;
using namespace o2::constants::math;

struct AodConsumerTestTask {

Expand Down