Skip to content

Commit 89be488

Browse files
committed
More fixes
1 parent b380d01 commit 89be488

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

@@ -1136,8 +1136,8 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
11361136
template <typename T>
11371137
T UpdateTrackMomentum(const T& track, const double p, int sign)
11381138
{
1139-
double px = p * std::sin(M_PI / 2 - std::atan(track.tgl())) * std::cos(track.phi());
1140-
double py = p * std::sin(M_PI / 2 - std::atan(track.tgl())) * std::sin(track.phi());
1139+
double px = p * std::sin(o2::constants::math::PIHalf - std::atan(track.tgl())) * std::cos(track.phi());
1140+
double py = p * std::sin(o2::constants::math::PIHalf - std::atan(track.tgl())) * std::sin(track.phi());
11411141
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
11421142

11431143
SMatrix5 tpars = {track.x(), track.y(), track.phi(), track.tgl(), sign / pt};
@@ -1157,8 +1157,8 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
11571157
template <typename T>
11581158
T UpdateTrackMomentum(const T& track, const o2::mch::TrackParam& track4mom)
11591159
{
1160-
double px = track4mom.p() * std::sin(M_PI / 2 - std::atan(track.tgl())) * std::cos(track.phi());
1161-
double py = track4mom.p() * std::sin(M_PI / 2 - std::atan(track.tgl())) * std::sin(track.phi());
1160+
double px = track4mom.p() * std::sin(o2::constants::math::PIHalf - std::atan(track.tgl())) * std::cos(track.phi());
1161+
double py = track4mom.p() * std::sin(o2::constants::math::PIHalf - std::atan(track.tgl())) * std::sin(track.phi());
11621162
double pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2));
11631163
double sign = track4mom.getCharge();
11641164

@@ -1297,7 +1297,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
12971297
// static double Bz = -10001;
12981298
double chi2 = mftTrack.chi2();
12991299
double phiCorrDeg = 0;
1300-
double phiCorr = phiCorrDeg * TMath::Pi() / 180.f;
1300+
double phiCorr = phiCorrDeg * o2::constants::math::Deg2Rad;
13011301
double tR = std::hypot(mftTrack.x(), mftTrack.y());
13021302
double tphi = std::atan2(mftTrack.y(), mftTrack.x());
13031303
double tx = std::cos(tphi + phiCorr) * tR;
@@ -1325,7 +1325,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
13251325
// double centerZ[3] = {0, 0, -45.f / 2.f};
13261326
// o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
13271327
// Bz = field->getBz(centerZ);
1328-
//}
1328+
// }
13291329
fwdtrack.propagateToZ(collision.posZ() - zshift, mBzAtMftCenter);
13301330

13311331
propmuon.setParameters(fwdtrack.getParameters());
@@ -1341,7 +1341,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
13411341
// static double Bz = -10001;
13421342
double chi2 = mftTrack.chi2();
13431343
double phiCorrDeg = 0;
1344-
double phiCorr = phiCorrDeg * TMath::Pi() / 180.f;
1344+
double phiCorr = phiCorrDeg * o2::constants::math::Deg2Rad;
13451345
double tR = std::hypot(mftTrack.x(), mftTrack.y());
13461346
double tphi = std::atan2(mftTrack.y(), mftTrack.x());
13471347
double tx = std::cos(tphi + phiCorr) * tR;
@@ -1373,7 +1373,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
13731373
// double centerZ[3] = {0, 0, -45.f / 2.f};
13741374
// o2::field::MagneticField* field = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
13751375
// Bz = field->getBz(centerZ);
1376-
//}
1376+
// }
13771377
fwdtrack.propagateToZ(collision.posZ() - zshift, mBzAtMftCenter);
13781378

13791379
o2::dataformats::GlobalFwdTrack propmuon;
@@ -1469,7 +1469,7 @@ struct muonGlobalAlignment { // o2-linter: disable=name/workflow-file,name/struc
14691469
auto mftTrackAtDCA = PropagateMFTToDCA(mftTrack, collision, cfgVertexZshift);
14701470
double dcax = mftTrackAtDCA.getX() - collision.posX();
14711471
double dcay = mftTrackAtDCA.getY() - collision.posY();
1472-
double phi = mftTrack.phi() * 180 / TMath::Pi();
1472+
double phi = mftTrack.phi() * o2::constants::math::Rad2Deg;
14731473
int mftNclusters = mftTrack.nClusters();
14741474
double chi2NDF = static_cast<double>(mftNclusters) * 2 - 5;
14751475

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

18601860
auto dphi = mchTrackAtRefPlane.getPhi() - mftTrackAtRefPlane.getPhi();
1861-
if (dphi < -TMath::Pi()) {
1862-
dphi += TMath::Pi() * 2.0;
1863-
} else if (dphi > TMath::Pi()) {
1864-
dphi -= TMath::Pi() * 2.0;
1861+
if (dphi < -o2::constants::math::PI) {
1862+
dphi += o2::constants::math::TwoPI;
1863+
} else if (dphi > o2::constants::math::PI) {
1864+
dphi -= o2::constants::math::TwoPI;
18651865
}
18661866
dphiPlots[iRefPlane]->Fill(dphi, refTrackAtRefPlane.getX(), refTrackAtRefPlane.getY(), quadrant, posNeg, mchTrack.p());
18671867
}

0 commit comments

Comments
 (0)