Skip to content

Commit 42aa52e

Browse files
committed
More fixes
1 parent 0b26228 commit 42aa52e

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

PWGDQ/Tasks/muonGlobalAlignment.cxx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <Framework/HistogramSpec.h>
3636
#include <Framework/InitContext.h>
3737
#include <Framework/runDataProcessing.h>
38+
#include <GPU/GPUROOTCartesianFwd.h>
3839
#include <GlobalTracking/MatchGlobalFwd.h>
3940
#include <MCHBase/TrackerParam.h>
4041
#include <MCHGeometryTransformer/Transformations.h>
@@ -58,7 +59,6 @@
5859
#include <THnSparse.h>
5960
#include <TMath.h>
6061

61-
#include <GPU/GPUROOTCartesianFwd.h>
6262
#include <rapidjson/document.h>
6363
#include <rapidjson/error/error.h>
6464

@@ -1144,8 +1144,8 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
11441144
template <typename T>
11451145
T UpdateTrackMomentum(const T& track, const double p, int sign)
11461146
{
1147-
double px = p * std::sin(M_PI / 2 - std::atan(track.tgl())) * std::cos(track.phi());
1148-
double py = p * std::sin(M_PI / 2 - std::atan(track.tgl())) * std::sin(track.phi());
1147+
double px = p * std::sin(o2::constants::math::PIHalf - std::atan(track.tgl())) * std::cos(track.phi());
1148+
double py = p * std::sin(o2::constants::math::PIHalf - std::atan(track.tgl())) * std::sin(track.phi());
11491149
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
11501150

11511151
SMatrix5 tpars = {track.x(), track.y(), track.phi(), track.tgl(), sign / pt};
@@ -1165,8 +1165,8 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
11651165
template <typename T>
11661166
T UpdateTrackMomentum(const T& track, const o2::mch::TrackParam& track4mom)
11671167
{
1168-
double px = track4mom.p() * std::sin(M_PI / 2 - std::atan(track.tgl())) * std::cos(track.phi());
1169-
double py = track4mom.p() * std::sin(M_PI / 2 - std::atan(track.tgl())) * std::sin(track.phi());
1168+
double px = track4mom.p() * std::sin(o2::constants::math::PIHalf - std::atan(track.tgl())) * std::cos(track.phi());
1169+
double py = track4mom.p() * std::sin(o2::constants::math::PIHalf - std::atan(track.tgl())) * std::sin(track.phi());
11701170
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
11711171
double sign = track4mom.getCharge();
11721172

@@ -1305,7 +1305,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
13051305
// static double Bz = -10001;
13061306
double chi2 = mftTrack.chi2();
13071307
double phiCorrDeg = 0;
1308-
double phiCorr = phiCorrDeg * TMath::Pi() / 180.f;
1308+
double phiCorr = phiCorrDeg * o2::constants::math::Deg2Rad;
13091309
double tR = std::hypot(mftTrack.x(), mftTrack.y());
13101310
double tphi = std::atan2(mftTrack.y(), mftTrack.x());
13111311
double tx = std::cos(tphi + phiCorr) * tR;
@@ -1333,7 +1333,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
13331333
// double centerZ[3] = {0, 0, -45.f / 2.f};
13341334
// o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
13351335
// Bz = field->getBz(centerZ);
1336-
//}
1336+
// }
13371337
fwdtrack.propagateToZ(collision.posZ() - zshift, mBzAtMftCenter);
13381338

13391339
propmuon.setParameters(fwdtrack.getParameters());
@@ -1349,7 +1349,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
13491349
// static double Bz = -10001;
13501350
double chi2 = mftTrack.chi2();
13511351
double phiCorrDeg = 0;
1352-
double phiCorr = phiCorrDeg * TMath::Pi() / 180.f;
1352+
double phiCorr = phiCorrDeg * o2::constants::math::Deg2Rad;
13531353
double tR = std::hypot(mftTrack.x(), mftTrack.y());
13541354
double tphi = std::atan2(mftTrack.y(), mftTrack.x());
13551355
double tx = std::cos(tphi + phiCorr) * tR;
@@ -1381,7 +1381,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
13811381
// double centerZ[3] = {0, 0, -45.f / 2.f};
13821382
// o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
13831383
// Bz = field->getBz(centerZ);
1384-
//}
1384+
// }
13851385
fwdtrack.propagateToZ(collision.posZ() - zshift, mBzAtMftCenter);
13861386

13871387
o2::dataformats::GlobalFwdTrack propmuon;
@@ -1477,7 +1477,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
14771477
auto mftTrackAtDCA = PropagateMFTToDCA(mftTrack, collision, cfgVertexZshift);
14781478
double dcax = mftTrackAtDCA.getX() - collision.posX();
14791479
double dcay = mftTrackAtDCA.getY() - collision.posY();
1480-
double phi = mftTrack.phi() * 180 / TMath::Pi();
1480+
double phi = mftTrack.phi() * o2::constants::math::Rad2Deg;
14811481
int mftNclusters = mftTrack.nClusters();
14821482
double chi2NDF = static_cast<double>(mftNclusters) * 2 - 5;
14831483

@@ -1866,10 +1866,10 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
18661866
dsyPlots[iRefPlane]->Fill(dsy, refTrackAtRefPlane.getX(), refTrackAtRefPlane.getY(), quadrant, posNeg, mchTrack.p());
18671867

18681868
auto dphi = mchTrackAtRefPlane.getPhi() - mftTrackAtRefPlane.getPhi();
1869-
if (dphi < -TMath::Pi()) {
1870-
dphi += TMath::Pi() * 2.0;
1871-
} else if (dphi > TMath::Pi()) {
1872-
dphi -= TMath::Pi() * 2.0;
1869+
if (dphi < -o2::constants::math::PI) {
1870+
dphi += o2::constants::math::TwoPI;
1871+
} else if (dphi > o2::constants::math::PI) {
1872+
dphi -= o2::constants::math::TwoPI;
18731873
}
18741874
dphiPlots[iRefPlane]->Fill(dphi, refTrackAtRefPlane.getX(), refTrackAtRefPlane.getY(), quadrant, posNeg, mchTrack.p());
18751875
}

0 commit comments

Comments
 (0)