@@ -128,6 +128,8 @@ using CompactMFTTrack = CompactMFTTracks;
128128
129129struct muonGlobalAlignment {
130130
131+ static constexpr int GlobalTrackTypeMax = 2 ;
132+
131133 Produces<aod::CompactMFTTracks> mftTable;
132134 Configurable<bool > cfgProduceMFTTable{" cfgProduceMFTTable" , false , " flag to produce MFTsa table" };
133135
@@ -289,7 +291,7 @@ struct muonGlobalAlignment {
289291 collisionInfo.bc = bc.globalBC ();
290292 collisionInfo.zVertex = collision.posZ ();
291293
292- if (static_cast <int >(muonTrack.trackType ()) > 2 ) {
294+ if (static_cast <int >(muonTrack.trackType ()) > GlobalTrackTypeMax ) {
293295 // standalone MCH or MCH-MID tracks
294296 uint64_t mchTrackIndex = muonTrack.globalIndex ();
295297 collisionInfo.mchTracks .push_back (mchTrackIndex);
@@ -320,8 +322,8 @@ struct muonGlobalAlignment {
320322 return (track1.chi2MatchMCHMFT () < track2.chi2MatchMCHMFT ());
321323 };
322324
323- for (auto & [collisionIndex, collisionInfo] : collisionInfos) {
324- for (auto & [mchIndex, globalTracksVector] : collisionInfo.globalMuonTracks ) {
325+ for (auto & [collisionIndex, collisionInfo] : collisionInfos) { // o2-linter: disable=const-ref-in-for-loop (object is modified in loop)
326+ for (auto & [mchIndex, globalTracksVector] : collisionInfo.globalMuonTracks ) { // o2-linter: disable=const-ref-in-for-loop (object is modified in loop)
325327 std::sort (globalTracksVector.begin (), globalTracksVector.end (), compareChi2);
326328 }
327329 }
@@ -336,7 +338,7 @@ struct muonGlobalAlignment {
336338 InitCollisions (collisions, bcs, muonTracks, collisionInfos);
337339
338340 // fill collision information for MFT standalone tracks
339- for (auto mftTrack : mftTracks) {
341+ for (const auto & mftTrack : mftTracks) {
340342 if (!mftTrack.has_collision ())
341343 continue ;
342344
@@ -950,7 +952,7 @@ struct muonGlobalAlignment {
950952 }
951953
952954 if (!removeTrack) {
953- for (auto & param : track) {
955+ for (auto & param : track) { // o2-linter: disable=const-ref-in-for-loop (object is modified in loop)
954956 param.setParameters (param.getSmoothParameters ());
955957 param.setCovariances (param.getSmoothCovariances ());
956958 }
@@ -1093,12 +1095,6 @@ struct muonGlobalAlignment {
10931095 ((y > 0 ) ? configMFTAlignmentCorrections.cfgMFTAlignmentCorrYOffsetTop : configMFTAlignmentCorrections.cfgMFTAlignmentCorrYOffsetBottom );
10941096 track.setBendingCoor (y + yCorrection);
10951097 track.setBendingSlope (ySlope + ySlopeCorrection);
1096- /*
1097- std::cout << std::format("[TOTO] MFT position: pos={:0.3f},{:0.3f}", x, y) << std::endl;
1098- std::cout << std::format("[TOTO] MFT corrections: pos={:0.3f},{:0.3f} slope={:0.12f},{:0.12f} angle={:0.12f},{:0.12f}",
1099- xCorrection, yCorrection, xSlopeCorrection, ySlopeCorrection,
1100- std::atan2(xSlopeCorrection, 1), std::atan2(ySlopeCorrection, 1)) << std::endl;
1101- */
11021098 }
11031099
11041100 void TransformMFT (o2::dataformats::GlobalFwdTrack& track)
@@ -1133,8 +1129,8 @@ struct muonGlobalAlignment {
11331129 template <typename T>
11341130 T UpdateTrackMomentum (const T& track, const double p, int sign)
11351131 {
1136- double px = p * sin (M_PI / 2 - atan (track.tgl ())) * cos (track.phi ());
1137- double py = p * sin (M_PI / 2 - atan (track.tgl ())) * sin (track.phi ());
1132+ double px = p * std:: sin (M_PI / 2 - std:: atan (track.tgl ())) * std:: cos (track.phi ());
1133+ double py = p * std:: sin (M_PI / 2 - std:: atan (track.tgl ())) * std:: sin (track.phi ());
11381134 double pt = std::sqrt (std::pow (px, 2 ) + std::pow (py, 2 ));
11391135
11401136 SMatrix5 tpars = {track.x (), track.y (), track.phi (), track.tgl (), sign / pt};
@@ -1154,8 +1150,8 @@ struct muonGlobalAlignment {
11541150 template <typename T>
11551151 T UpdateTrackMomentum (const T& track, const o2::mch::TrackParam& track4mom)
11561152 {
1157- double px = track4mom.p () * sin (M_PI / 2 - atan (track.tgl ())) * cos (track.phi ());
1158- double py = track4mom.p () * sin (M_PI / 2 - atan (track.tgl ())) * sin (track.phi ());
1153+ double px = track4mom.p () * std:: sin (M_PI / 2 - std:: atan (track.tgl ())) * std:: cos (track.phi ());
1154+ double py = track4mom.p () * std:: sin (M_PI / 2 - std:: atan (track.tgl ())) * std:: sin (track.phi ());
11591155 double pt = std::sqrt (std::pow (px, 2 ) + std::pow (py, 2 ));
11601156 double sign = track4mom.getCharge ();
11611157
@@ -1427,7 +1423,7 @@ struct muonGlobalAlignment {
14271423 const std::map<uint64_t , CollisionInfo>& collisionInfos)
14281424 {
14291425 // outer loop over collisions
1430- for (auto & [collisionIndex, collisionInfo] : collisionInfos) {
1426+ for (const auto & [collisionIndex, collisionInfo] : collisionInfos) {
14311427 auto const & collision = collisions.rawIteratorAt (collisionIndex);
14321428 const auto & bc = bcs.rawIteratorAt (collision.bcId ());
14331429
@@ -1452,7 +1448,7 @@ struct muonGlobalAlignment {
14521448 mftTrackIds.resize (cfgMftTracksMultiplicityMax);
14531449 }
14541450
1455- for (auto mftIndex : mftTrackIds) {
1451+ for (const auto & mftIndex : mftTrackIds) {
14561452 auto const & mftTrack = mftTracks.rawIteratorAt (mftIndex);
14571453
14581454 if (mftTrack.isCA ()) {
@@ -1549,7 +1545,7 @@ struct muonGlobalAlignment {
15491545
15501546 if (cfgEnableGlobalFwdDcaAnalysis) {
15511547 // loop over global muon tracks
1552- for (auto & [muonIndex, globalTracksVector] : collisionInfo.globalMuonTracks ) {
1548+ for (const auto & [muonIndex, globalTracksVector] : collisionInfo.globalMuonTracks ) {
15531549 auto const & muonTrack = muonTracks.rawIteratorAt (globalTracksVector[0 ]);
15541550 const auto & mchTrack = muonTrack.template matchMCHTrack_as <MyMuonsWithCov>();
15551551 const auto & mftTrack = muonTrack.template matchMFTTrack_as <MyMFTs>();
@@ -1678,7 +1674,7 @@ struct muonGlobalAlignment {
16781674 }
16791675
16801676 // loop over collisions
1681- for (auto & [collisionIndex, collisionInfo] : collisionInfos) {
1677+ for (const auto & [collisionIndex, collisionInfo] : collisionInfos) {
16821678 auto const & collision = collisions.rawIteratorAt (collisionIndex);
16831679 const auto & bc = bcs.rawIteratorAt (collision.bcId ());
16841680
@@ -1688,7 +1684,7 @@ struct muonGlobalAlignment {
16881684 continue ;
16891685
16901686 // loop over global muon tracks
1691- for (auto & [muonIndex, globalTracksVector] : collisionInfo.globalMuonTracks ) {
1687+ for (const auto & [muonIndex, globalTracksVector] : collisionInfo.globalMuonTracks ) {
16921688 auto const & muonTrack = muonTracks.rawIteratorAt (globalTracksVector[0 ]);
16931689 const auto & mchTrack = muonTrack.template matchMCHTrack_as <MyMuonsWithCov>();
16941690 const auto & mftTrack = muonTrack.template matchMFTTrack_as <MyMFTs>();
@@ -1823,7 +1819,7 @@ struct muonGlobalAlignment {
18231819 }
18241820
18251821 // MFT-MCH track residuals analysis
1826- if (cfgEnableMftMchMatchingAnalysis && convertedTrackWithCorrOk)) {
1822+ if (cfgEnableMftMchMatchingAnalysis && convertedTrackWithCorrOk) {
18271823 double refPlaneZ[2 ] = {cfgRefPlaneZMFT, cfgRefPlaneZMCH};
18281824
18291825 std::shared_ptr<THnSparse> dxPlots[2 ]{registry.get <THnSparse>(HIST (" matching/dxAtMFT" )), registry.get <THnSparse>(HIST (" matching/dxAtMCH" ))};
0 commit comments