From 2e02814f7d0a3c1d11ef149963618280a2b23058 Mon Sep 17 00:00:00 2001 From: noferini <9963644+noferini@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:37:12 +0200 Subject: [PATCH] assure TOF code uses std::abs everywhere --- Detectors/GlobalTracking/src/MatchTOF.cxx | 50 +++++++++---------- .../src/TOFEventTimeChecker.cxx | 8 +-- Detectors/TOF/base/src/EventTimeMaker.cxx | 8 +-- Detectors/TOF/base/src/Geo.cxx | 14 +++--- Detectors/TOF/base/src/Utils.cxx | 24 ++++----- Detectors/TOF/calibration/src/CalibTOF.cxx | 12 ++--- .../calibration/src/TOFChannelCalibrator.cxx | 6 +-- .../TOF/prototyping/findTOFclusterFromLabel.C | 13 ++++- .../reconstruction/src/CosmicProcessor.cxx | 6 +-- Detectors/TOF/simulation/src/Digitizer.cxx | 14 +++--- macro/checkTOFMatching.C | 19 +++++-- macro/compareTOFClusters.C | 18 +++---- 12 files changed, 107 insertions(+), 85 deletions(-) diff --git a/Detectors/GlobalTracking/src/MatchTOF.cxx b/Detectors/GlobalTracking/src/MatchTOF.cxx index 2db453b0f62be..9bb741ee4443f 100644 --- a/Detectors/GlobalTracking/src/MatchTOF.cxx +++ b/Detectors/GlobalTracking/src/MatchTOF.cxx @@ -192,15 +192,15 @@ void MatchTOF::run(const o2::globaltracking::RecoContainer& inp, unsigned long f bct0--; } float tof = matchingPair.getSignal() - bct0 * Geo::BC_TIME_INPS; - if (abs(tof - matchingPair.getLTIntegralOut().getTOF(2)) < 600) { - } else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(3)) < 600) { - } else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(4)) < 600) { - } else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(0)) < 600) { - } else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(1)) < 600) { - } else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(5)) < 600) { - } else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(6)) < 600) { - } else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(7)) < 600) { - } else if (abs(tof - matchingPair.getLTIntegralOut().getTOF(8)) < 600) { + if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(2)) < 600) { + } else if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(3)) < 600) { + } else if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(4)) < 600) { + } else if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(0)) < 600) { + } else if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(1)) < 600) { + } else if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(5)) < 600) { + } else if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(6)) < 600) { + } else if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(7)) < 600) { + } else if (std::abs(tof - matchingPair.getLTIntegralOut().getTOF(8)) < 600) { } else { // no pion, kaon, proton, electron, muon, deuteron, triton, 3He, 4He matchingPair.setFakeMatch(); } @@ -557,7 +557,7 @@ void MatchTOF::propagateTPCTracks(int sec) } if (trc.getX() < o2::constants::geom::XTPCOuterRef - 1.) { - if (!propagateToRefXWithoutCov(trc, o2::constants::geom::XTPCOuterRef, 10, mBz) || TMath::Abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagat> + if (!propagateToRefXWithoutCov(trc, o2::constants::geom::XTPCOuterRef, 10, mBz) || std::abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagat> mNotPropagatedToTOF[trkType::UNCONS]++; continue; } @@ -566,7 +566,7 @@ void MatchTOF::propagateTPCTracks(int sec) o2::base::Propagator::Instance()->estimateLTFast(intLT0, trc); // the "rough" propagation worked; now we can propagate considering also the cov matrix - if (!propagateToRefX(trc, mXRef, 2, intLT0)) { // || TMath::Abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagation with the cov matrix w> + if (!propagateToRefX(trc, mXRef, 2, intLT0)) { // || std::abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagation with the cov matrix w> mNotPropagatedToTOF[trkType::UNCONS]++; continue; } @@ -603,7 +603,7 @@ void MatchTOF::propagateConstrTracks(int sec) } // the "rough" propagation worked; now we can propagate considering also the cov matrix - if (!propagateToRefX(trc, mXRef, 2, intLT0) || TMath::Abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagation with the cov matrix worked;> + if (!propagateToRefX(trc, mXRef, 2, intLT0) || std::abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagation with the cov matrix worked;> mNotPropagatedToTOF[trkType::CONSTR]++; continue; } @@ -706,7 +706,7 @@ void MatchTOF::addTPCSeed(const o2::tpc::TrackTPC& _tr, o2::dataformats::GlobalT // compute track length up to now mLTinfos[sector][trkType::UNCONS].emplace_back(intLT0); float vz0 = _tr.getZAt(0, mBz); - if (abs(vz0) > 9000) { + if (std::abs(vz0) > 9000) { vz0 = _tr.getZ() - _tr.getX() * _tr.getTgl(); } mVZtpcOnly[sector].push_back(vz0); @@ -727,14 +727,14 @@ void MatchTOF::addTPCSeed(const o2::tpc::TrackTPC& _tr, o2::dataformats::GlobalT } if (trc.getX() < o2::constants::geom::XTPCOuterRef - 1.) { - if (!propagateToRefX(trc, o2::constants::geom::XTPCOuterRef, 10, intLT0) || TMath::Abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagation with the cov matrix worked; CHECK: can it happ + if (!propagateToRefX(trc, o2::constants::geom::XTPCOuterRef, 10, intLT0) || std::abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagation with the cov matrix worked; CHECK: can it happ mNotPropagatedToTOF[trkType::UNCONS]++; return; } } // the "rough" propagation worked; now we can propagate considering also the cov matrix - if (!propagateToRefX(trc, mXRef, 2, intLT0)) { // || TMath::Abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagation with the cov matrix worked; CHECK: can it happen that it does not if the prop> + if (!propagateToRefX(trc, mXRef, 2, intLT0)) { // || std::abs(trc.getZ()) > Geo::MAXHZTOF) { // we check that the propagation with the cov matrix worked; CHECK: can it happen that it does not if the prop> mNotPropagatedToTOF[trkType::UNCONS]++; return; } @@ -1411,10 +1411,10 @@ void MatchTOF::doMatchingForTPC(int sec) } if (mMatchParams->applyPIDcutTPConly) { // for TPC only tracks allowing possibility to apply a PID cut - if (abs(tof - trkLTInt[ibc][iPropagation].getTOF(2)) < 2000) { // pion hypotesis - } else if (abs(tof - trkLTInt[ibc][iPropagation].getTOF(3)) < 2000) { // kaon hypoteis - } else if (abs(tof - trkLTInt[ibc][iPropagation].getTOF(4)) < 2000) { // proton hypotesis - } else { // reject matching + if (std::abs(tof - trkLTInt[ibc][iPropagation].getTOF(2)) < 2000) { // pion hypotesis + } else if (std::abs(tof - trkLTInt[ibc][iPropagation].getTOF(3)) < 2000) { // kaon hypoteis + } else if (std::abs(tof - trkLTInt[ibc][iPropagation].getTOF(4)) < 2000) { // proton hypotesis + } else { // reject matching continue; } } @@ -1518,7 +1518,7 @@ int MatchTOF::findFITIndex(int bc, const gsl::span& FI if (mHasFillScheme && !mFillScheme[ir.bc]) { continue; } - bool quality = (fabs(FITRecPoints[i].getCollisionTime(0)) < 1000 && fabs(FITRecPoints[i].getVertex()) < 1000); + bool quality = (std::abs(FITRecPoints[i].getCollisionTime(0)) < 1000 && std::abs(FITRecPoints[i].getVertex()) < 1000); if (bestQuality && !quality) { // if current has no good quality and the one previoulsy selected has -> discard the current one continue; } @@ -1596,7 +1596,7 @@ void MatchTOF::BestMatches(std::vector& match float timeNew = TOFClusWork[matchingPair.getTOFClIndex()].getTime() - deltaT; float timeOld = TOFClusWork[prevMatching.getTOFClIndex()].getTime(); - if (fabs(timeNew - timeOld) < 200) { + if (std::abs(timeNew - timeOld) < 200) { // update time information averaging the two (the second one corrected for the difference in the track length) prevMatching.setSignal((timeNew + timeOld) * 0.5); prevMatching.setChi2(0); // flag such cases with chi2 equal to zero @@ -1820,7 +1820,7 @@ bool MatchTOF::propagateToRefX(o2::track::TrackParCov& trc, float xRef, float st refReached = true; // we reached the 371cm reference } istep++; - if (fabs(trc.getY()) > trc.getX() * tanHalfSector) { // we are still in the same sector + if (std::abs(trc.getY()) > trc.getX() * tanHalfSector) { // we are still in the same sector // we need to rotate the track to go to the new sector //Printf("propagateToRefX: changing sector"); auto alphaNew = o2::math_utils::angle2Alpha(trc.getPhiPos()); @@ -1860,7 +1860,7 @@ bool MatchTOF::propagateToRefXWithoutCov(const o2::track::TrackParCov& trc, floa refReached = true; // we reached the 371cm reference } istep++; - if (fabs(trcNoCov.getY()) > trcNoCov.getX() * tanHalfSector) { // we are still in the same sector + if (std::abs(trcNoCov.getY()) > trcNoCov.getX() * tanHalfSector) { // we are still in the same sector // we need to rotate the track to go to the new sector //Printf("propagateToRefX: changing sector"); auto alphaNew = o2::math_utils::angle2Alpha(trcNoCov.getPhiPos()); @@ -1877,7 +1877,7 @@ bool MatchTOF::propagateToRefXWithoutCov(const o2::track::TrackParCov& trc, floa // if (std::abs(trc.getSnp()) > MAXSNP) Printf("propagateToRefX: condition on snp not ok, returning false"); //Printf("propagateToRefX: snp of teh track is %f (--> %f grad)", trcNoCov.getSnp(), TMath::ASin(trcNoCov.getSnp())*TMath::RadToDeg()); - return refReached && std::abs(trcNoCov.getSnp()) < 0.95 && TMath::Abs(trcNoCov.getZ()) < Geo::MAXHZTOF; // Here we need to put MAXSNP + return refReached && std::abs(trcNoCov.getSnp()) < 0.95 && std::abs(trcNoCov.getZ()) < Geo::MAXHZTOF; // Here we need to put MAXSNP } //______________________________________________ @@ -1900,7 +1900,7 @@ void MatchTOF::updateTimeDependentParams() mTPCBin2Z = mTPCTBinMUS * mTPCVDrift; mBz = o2::base::Propagator::Instance()->getNominalBz(); - mMaxInvPt = abs(mBz) > 0.1 ? 1. / (abs(mBz) * 0.05) : 999.; + mMaxInvPt = std::abs(mBz) > 0.1 ? 1. / (std::abs(mBz) * 0.05) : 999.; const auto& trackTune = TrackTuneParams::Instance(); float scale = mTPCCorrMapsHelper->getInstLumiCTP(); diff --git a/Detectors/GlobalTrackingWorkflow/src/TOFEventTimeChecker.cxx b/Detectors/GlobalTrackingWorkflow/src/TOFEventTimeChecker.cxx index eb212f2507786..3d8b36043ddeb 100644 --- a/Detectors/GlobalTrackingWorkflow/src/TOFEventTimeChecker.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/TOFEventTimeChecker.cxx @@ -266,10 +266,10 @@ void TOFEventTimeChecker::processEvent(std::vector& tracks) float betaexpPr = mL / mExpPr * cinv; //Mass - float mass = mP / beta * TMath::Sqrt(TMath::Abs(1 - beta * beta)); - float massexpPi = mP / betaexpPi * TMath::Sqrt(TMath::Abs(1 - betaexpPi * betaexpPi)); - float massexpKa = mP / betaexpKa * TMath::Sqrt(TMath::Abs(1 - betaexpKa * betaexpKa)); - float massexpPr = mP / betaexpPr * TMath::Sqrt(TMath::Abs(1 - betaexpPr * betaexpPr)); + float mass = mP / beta * TMath::Sqrt(std::abs(1 - beta * beta)); + float massexpPi = mP / betaexpPi * TMath::Sqrt(std::abs(1 - betaexpPi * betaexpPi)); + float massexpKa = mP / betaexpKa * TMath::Sqrt(std::abs(1 - betaexpKa * betaexpKa)); + float massexpPr = mP / betaexpPr * TMath::Sqrt(std::abs(1 - betaexpPr * betaexpPr)); if (massexpPi < 0.13) { // remove wrong track lengths continue; diff --git a/Detectors/TOF/base/src/EventTimeMaker.cxx b/Detectors/TOF/base/src/EventTimeMaker.cxx index 802be496ae495..132bd26fcfe52 100644 --- a/Detectors/TOF/base/src/EventTimeMaker.cxx +++ b/Detectors/TOF/base/src/EventTimeMaker.cxx @@ -152,7 +152,7 @@ void computeEvTime(const std::vector& tracks, const std::vector< } float err = evtime.mTrackTimes[i] - averageBest; err *= sqrt(evtime.mWeights[i]); - err = fabs(err); + err = std::abs(err); if (err > errworse) { errworse = err; worse = i; @@ -293,7 +293,7 @@ int getStartTimeInSet(const std::vector& tracks, std::vector& tracks, std::vector errworse) { errworse = err; worse = itrk; @@ -404,7 +404,7 @@ int getStartTimeInSetFast(const std::vector& tracks, std::vector const eventTimeTrack& ctrack = tracks[trackInSet[itrk]]; float err = ctrack.mSignal - ctrack.expTimes[hypo[itrk]] - averageBest; err /= ctrack.expSigma[hypo[itrk]]; - err = fabs(err); + err = std::abs(err); if (err > errworse) { errworse = err; worse = itrk; diff --git a/Detectors/TOF/base/src/Geo.cxx b/Detectors/TOF/base/src/Geo.cxx index 655addbb3007e..c76e6b4d83943 100644 --- a/Detectors/TOF/base/src/Geo.cxx +++ b/Detectors/TOF/base/src/Geo.cxx @@ -773,10 +773,10 @@ Int_t Geo::fromPlateToStrip(Float_t* pos, Int_t iplate, Int_t isector) step[2] = -getGeoDistances(isector, iplate, istrip); translate(posLoc2[0], posLoc2[1], posLoc2[2], step); - if (fabs(posLoc2[1]) > 10) { + if (std::abs(posLoc2[1]) > 10) { continue; } - if (fabs(posLoc2[2]) > 10) { + if (std::abs(posLoc2[2]) > 10) { continue; } @@ -788,8 +788,8 @@ Int_t Geo::fromPlateToStrip(Float_t* pos, Int_t iplate, Int_t isector) rotateToStrip(posLoc2, iplate, istrip, isector); - if ((TMath::Abs(posLoc2[0]) <= STRIPLENGTH * 0.5) && (TMath::Abs(posLoc2[1]) <= HSTRIPY * 0.5) && - (TMath::Abs(posLoc2[2]) <= WCPCBZ * 0.5)) { + if ((std::abs(posLoc2[0]) <= STRIPLENGTH * 0.5) && (std::abs(posLoc2[1]) <= HSTRIPY * 0.5) && + (std::abs(posLoc2[2]) <= WCPCBZ * 0.5)) { step[0] = -0.5 * NPADX * XPAD; step[1] = 0.; step[2] = -0.5 * NPADZ * ZPAD; @@ -891,11 +891,11 @@ Int_t Geo::getPlate(const Float_t* pos) Float_t zLocal = pos[2]; Float_t deltaRhoLoc = (RMAX - RMIN) * 0.5 - MODULEWALLTHICKNESS + yLocal; - Float_t deltaZetaLoc = TMath::Abs(zLocal); + Float_t deltaZetaLoc = std::abs(zLocal); Float_t deltaRHOmax = 0.; - if (TMath::Abs(zLocal) >= EXTERINTERMODBORDER1 && TMath::Abs(zLocal) <= EXTERINTERMODBORDER2) { + if (std::abs(zLocal) >= EXTERINTERMODBORDER1 && std::abs(zLocal) <= EXTERINTERMODBORDER2) { deltaRhoLoc -= LENGTHEXINMODBORDER; deltaZetaLoc = EXTERINTERMODBORDER2 - deltaZetaLoc; deltaRHOmax = (RMAX - RMIN) * 0.5 - MODULEWALLTHICKNESS - 2. * LENGTHEXINMODBORDER; // old 5.35, new 4.8 @@ -913,7 +913,7 @@ Int_t Geo::getPlate(const Float_t* pos) iPlate = 3; } } - } else if (TMath::Abs(zLocal) >= INTERCENTRMODBORDER1 && TMath::Abs(zLocal) <= INTERCENTRMODBORDER2) { + } else if (std::abs(zLocal) >= INTERCENTRMODBORDER1 && std::abs(zLocal) <= INTERCENTRMODBORDER2) { deltaRhoLoc -= LENGTHINCEMODBORDERD; deltaZetaLoc = deltaZetaLoc - INTERCENTRMODBORDER1; deltaRHOmax = (RMAX - RMIN) * 0.5 - MODULEWALLTHICKNESS - 2. * LENGTHINCEMODBORDERD; // old 0.39, new 0.2 diff --git a/Detectors/TOF/base/src/Utils.cxx b/Detectors/TOF/base/src/Utils.cxx index 265cb0247b544..36fc3d2d61c6f 100644 --- a/Detectors/TOF/base/src/Utils.cxx +++ b/Detectors/TOF/base/src/Utils.cxx @@ -143,20 +143,20 @@ double Utils::subtractInteractionBC(double time, int& mask, bool subLatency) if (deltaCBC >= -8 && deltaCBC < 8) { mask += (1 << (deltaCBC + 8)); // fill bc candidates } - if (abs(deltaCBC) < dbc) { + if (std::abs(deltaCBC) < dbc) { bcc = bc - deltaCBC; dbcSigned = deltaCBC; - dbc = abs(dbcSigned); + dbc = std::abs(dbcSigned); } - if (abs(deltaCBC + o2::constants::lhc::LHCMaxBunches) < dbc) { // in case k is close to the right border (last BC of the orbit) + if (std::abs(deltaCBC + o2::constants::lhc::LHCMaxBunches) < dbc) { // in case k is close to the right border (last BC of the orbit) bcc = bc - deltaCBC - o2::constants::lhc::LHCMaxBunches; dbcSigned = deltaCBC + o2::constants::lhc::LHCMaxBunches; - dbc = abs(dbcSigned); + dbc = std::abs(dbcSigned); } - if (abs(deltaCBC - o2::constants::lhc::LHCMaxBunches) < dbc) { // in case k is close to the left border (BC=0) + if (std::abs(deltaCBC - o2::constants::lhc::LHCMaxBunches) < dbc) { // in case k is close to the left border (BC=0) bcc = bc - deltaCBC + o2::constants::lhc::LHCMaxBunches; dbcSigned = deltaCBC - o2::constants::lhc::LHCMaxBunches; - dbc = abs(dbcSigned); + dbc = std::abs(dbcSigned); } } if (dbcSigned >= -8 && dbcSigned < 8) { @@ -192,20 +192,20 @@ float Utils::subtractInteractionBC(float time, int& mask, bool subLatency) if (deltaCBC >= -8 && deltaCBC < 8) { mask += (1 << (deltaCBC + 8)); // fill bc candidates } - if (abs(deltaCBC) < dbc) { + if (std::abs(deltaCBC) < dbc) { bcc = bc - deltaCBC; dbcSigned = deltaCBC; - dbc = abs(dbcSigned); + dbc = std::abs(dbcSigned); } - if (abs(deltaCBC + o2::constants::lhc::LHCMaxBunches) < dbc) { // in case k is close to the right border (last BC of the orbit) + if (std::abs(deltaCBC + o2::constants::lhc::LHCMaxBunches) < dbc) { // in case k is close to the right border (last BC of the orbit) bcc = bc - deltaCBC - o2::constants::lhc::LHCMaxBunches; dbcSigned = deltaCBC + o2::constants::lhc::LHCMaxBunches; - dbc = abs(dbcSigned); + dbc = std::abs(dbcSigned); } - if (abs(deltaCBC - o2::constants::lhc::LHCMaxBunches) < dbc) { // in case k is close to the left border (BC=0) + if (std::abs(deltaCBC - o2::constants::lhc::LHCMaxBunches) < dbc) { // in case k is close to the left border (BC=0) bcc = bc - deltaCBC + o2::constants::lhc::LHCMaxBunches; dbcSigned = deltaCBC - o2::constants::lhc::LHCMaxBunches; - dbc = abs(dbcSigned); + dbc = std::abs(dbcSigned); } } if (dbcSigned >= -8 && dbcSigned < 8) { diff --git a/Detectors/TOF/calibration/src/CalibTOF.cxx b/Detectors/TOF/calibration/src/CalibTOF.cxx index 52fdd5ebd8e02..826b20a63ba6d 100644 --- a/Detectors/TOF/calibration/src/CalibTOF.cxx +++ b/Detectors/TOF/calibration/src/CalibTOF.cxx @@ -212,7 +212,7 @@ void CalibTOF::run(int flag, int sector) int channelInSector = (ipad + ich) % o2::tof::Geo::NPADSXSECTOR; mTimeSlewingObj->setFractionUnderPeak(sector, channelInSector, fractionUnderPeak); - mTimeSlewingObj->setSigmaPeak(sector, channelInSector, abs(funcChOffset->GetParameter(2))); + mTimeSlewingObj->setSigmaPeak(sector, channelInSector, std::abs(funcChOffset->GetParameter(2))); // now fill 2D histo for time-slewing using current channel offset @@ -603,8 +603,8 @@ Int_t CalibTOF::FitPeak(TF1* fitFunc, TH1* h, Float_t startSigma, Float_t nSigma /* refit with better range */ for (Int_t i = 0; i < 3; i++) { fitCent = fitFunc->GetParameter(1); - fitMin = fitCent - nSigmaMin * abs(fitFunc->GetParameter(2)); - fitMax = fitCent + nSigmaMax * abs(fitFunc->GetParameter(2)); + fitMin = fitCent - nSigmaMin * std::abs(fitFunc->GetParameter(2)); + fitMax = fitCent + nSigmaMax * std::abs(fitFunc->GetParameter(2)); if (fitMin < -12500) { fitMin = -12500; } @@ -735,9 +735,9 @@ void CalibTOF::flagProblematics() hsigmapeak->Fit(fFuncSigma, "WWq0"); hfractionpeak->Fit(fFuncFraction, "WWq0"); - sigmaMin = fFuncSigma->GetParameter(1) - mNsigmaSigmaProblematicCut * abs(fFuncSigma->GetParameter(2)); - sigmaMax = fFuncSigma->GetParameter(1) + mNsigmaSigmaProblematicCut * abs(fFuncSigma->GetParameter(3)); - fractionMin = fFuncFraction->GetParameter(1) - mNsigmaFractionProblematicCut * abs(fFuncFraction->GetParameter(2)); + sigmaMin = fFuncSigma->GetParameter(1) - mNsigmaSigmaProblematicCut * std::abs(fFuncSigma->GetParameter(2)); + sigmaMax = fFuncSigma->GetParameter(1) + mNsigmaSigmaProblematicCut * std::abs(fFuncSigma->GetParameter(3)); + fractionMin = fFuncFraction->GetParameter(1) - mNsigmaFractionProblematicCut * std::abs(fFuncFraction->GetParameter(2)); for (int k = 0; k < o2::tof::Geo::NPADX; k++) { ipad = 48 * iz + k; diff --git a/Detectors/TOF/calibration/src/TOFChannelCalibrator.cxx b/Detectors/TOF/calibration/src/TOFChannelCalibrator.cxx index fbaa555013f9c..c0568125b8d5e 100644 --- a/Detectors/TOF/calibration/src/TOFChannelCalibrator.cxx +++ b/Detectors/TOF/calibration/src/TOFChannelCalibrator.cxx @@ -627,7 +627,7 @@ void TOFChannelCalibrator::finalizeSlotWithCosmics(Slot& slot) mFitCal->Fill(ich, localFitter.GetParameter(ichLocal)); #endif ts.setFractionUnderPeak(ich / Geo::NPADSXSECTOR, ich % Geo::NPADSXSECTOR, fracUnderPeak[ichLocal]); - ts.setSigmaPeak(ich / Geo::NPADSXSECTOR, ich % Geo::NPADSXSECTOR, abs(std::sqrt(localFitter.GetCovarianceMatrixElement(ichLocal, ichLocal)))); + ts.setSigmaPeak(ich / Geo::NPADSXSECTOR, ich % Geo::NPADSXSECTOR, std::abs(std::sqrt(localFitter.GetCovarianceMatrixElement(ichLocal, ichLocal)))); } } // end loop strips @@ -783,12 +783,12 @@ void TOFChannelCalibrator::finalizeSlotWithTracks(Slot& slot) fractionUnderPeak = entriesInChannel > 0 ? c->integral(ich, intmin, intmax) / entriesInChannel : 0; // now we need to store the results in the TimeSlewingObject ts.setFractionUnderPeak(ich / Geo::NPADSXSECTOR, ich % Geo::NPADSXSECTOR, fractionUnderPeak); - ts.setSigmaPeak(ich / Geo::NPADSXSECTOR, ich % Geo::NPADSXSECTOR, abs(fitValues[2])); + ts.setSigmaPeak(ich / Geo::NPADSXSECTOR, ich % Geo::NPADSXSECTOR, std::abs(fitValues[2])); int tobeused = o2::tof::Utils::getMaxUsedChannel(ich); fitValues[1] += tobeused * o2::tof::Geo::BC_TIME_INPS; // adjust by adding the right BC - if (abs(fitValues[1]) > mRange) { + if (std::abs(fitValues[1]) > mRange) { ts.setFractionUnderPeak(ich / Geo::NPADSXSECTOR, ich % Geo::NPADSXSECTOR, -1); ts.setSigmaPeak(ich / Geo::NPADSXSECTOR, ich % Geo::NPADSXSECTOR, 99999); } diff --git a/Detectors/TOF/prototyping/findTOFclusterFromLabel.C b/Detectors/TOF/prototyping/findTOFclusterFromLabel.C index 67ed487ecebc1..cacf9fbbfd50d 100644 --- a/Detectors/TOF/prototyping/findTOFclusterFromLabel.C +++ b/Detectors/TOF/prototyping/findTOFclusterFromLabel.C @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #if !defined(__CLING__) || defined(__ROOTCLING__) #include "TFile.h" #include "TTree.h" @@ -95,7 +106,7 @@ void findTOFclusterFromLabel(int trackID, int eventID = 0, int sourceID = 0) for (int i = 0; i < mcArr->size(); ++i) { const auto& mcTrack = (*mcArr)[i]; if (i == trackID) { - Printf("Particle %d: pdg = %d, pT = %f, px = %f, py = %f, pz = %f, vx = %f, vy = %f, vz = %f", i, mcTrack.GetPdgCode(), TMath::Abs(mcTrack.GetStartVertexMomentumX() * mcTrack.GetStartVertexMomentumX() + mcTrack.GetStartVertexMomentumY() * mcTrack.GetStartVertexMomentumY()), mcTrack.GetStartVertexMomentumX(), mcTrack.GetStartVertexMomentumY(), mcTrack.GetStartVertexMomentumZ(), mcTrack.GetStartVertexCoordinatesX(), mcTrack.GetStartVertexCoordinatesY(), mcTrack.GetStartVertexCoordinatesZ()); + Printf("Particle %d: pdg = %d, pT = %f, px = %f, py = %f, pz = %f, vx = %f, vy = %f, vz = %f", i, mcTrack.GetPdgCode(), std::abs(mcTrack.GetStartVertexMomentumX() * mcTrack.GetStartVertexMomentumX() + mcTrack.GetStartVertexMomentumY() * mcTrack.GetStartVertexMomentumY()), mcTrack.GetStartVertexMomentumX(), mcTrack.GetStartVertexMomentumY(), mcTrack.GetStartVertexMomentumZ(), mcTrack.GetStartVertexCoordinatesX(), mcTrack.GetStartVertexCoordinatesY(), mcTrack.GetStartVertexCoordinatesZ()); } } diff --git a/Detectors/TOF/reconstruction/src/CosmicProcessor.cxx b/Detectors/TOF/reconstruction/src/CosmicProcessor.cxx index 886435c299265..eb2f6ea9eec9e 100644 --- a/Detectors/TOF/reconstruction/src/CosmicProcessor.cxx +++ b/Detectors/TOF/reconstruction/src/CosmicProcessor.cxx @@ -103,7 +103,7 @@ void CosmicProcessor::process(DigitDataReader& reader, bool fill) for (int j = i + 1; j < ndig2; j++) { auto& dig2 = (*array)[j]; int64_t bc2 = int64_t(dig2.getBC()) - bc1; - if (labs(bc2) > bcdist) { + if (std::abs(bc2) > bcdist) { continue; } @@ -126,7 +126,7 @@ void CosmicProcessor::process(DigitDataReader& reader, bool fill) float lt2 = pos2[0] * pos2[0] + pos2[1] * pos2[1]; float l = sqrt(lt2 + pos2[2] * pos2[2]); - if (!trackFound && lt2 < 40000 && fabs(dtime) < 10000) { + if (!trackFound && lt2 < 40000 && std::abs(dtime) < 10000) { mCosmicTrackTemp.emplace_back(ch2, pos2or[0], pos2or[1], pos2or[2], dtime, tot2); } @@ -139,7 +139,7 @@ void CosmicProcessor::process(DigitDataReader& reader, bool fill) dtime -= l * 33.356409; // corrected for pad distance assuiming muonn downward - if (fabs(dtime) > thr) { + if (std::abs(dtime) > thr) { continue; } diff --git a/Detectors/TOF/simulation/src/Digitizer.cxx b/Detectors/TOF/simulation/src/Digitizer.cxx index f44c40808af93..50ea2c194616c 100644 --- a/Detectors/TOF/simulation/src/Digitizer.cxx +++ b/Detectors/TOF/simulation/src/Digitizer.cxx @@ -302,8 +302,8 @@ void Digitizer::addDigit(Int_t channel, UInt_t istrip, Double_t time, Float_t x, tot = 0; } - Float_t xborder = Geo::XPAD * 0.5 - TMath::Abs(x); - Float_t zborder = Geo::ZPAD * 0.5 - TMath::Abs(z); + Float_t xborder = Geo::XPAD * 0.5 - std::abs(x); + Float_t zborder = Geo::ZPAD * 0.5 - std::abs(z); Float_t border = TMath::Min(xborder, zborder); Float_t timewalkX = x * mTimeWalkeSlope; @@ -326,7 +326,7 @@ void Digitizer::addDigit(Int_t channel, UInt_t istrip, Double_t time, Float_t x, // Decalibrate float tsCorr = mCalibApi->getTimeDecalibration(channel, tot); - if (TMath::Abs(tsCorr) > 200E3) { // accept correction up to 200 ns + if (std::abs(tsCorr) > 200E3) { // accept correction up to 200 ns LOG(error) << "Wrong de-calibration correction for ch = " << channel << ", tot = " << tot << " (Skip it)"; return; } @@ -483,10 +483,10 @@ Float_t Digitizer::getCharge(Float_t eDep) //______________________________________________________________________ Bool_t Digitizer::isFired(Float_t x, Float_t z, Float_t charge) { - if (TMath::Abs(x) > Geo::XPAD * 0.5 + 0.3) { + if (std::abs(x) > Geo::XPAD * 0.5 + 0.3) { return kFALSE; } - if (TMath::Abs(z) > Geo::ZPAD * 0.5 + 0.3) { + if (std::abs(z) > Geo::ZPAD * 0.5 + 0.3) { return kFALSE; } @@ -505,7 +505,7 @@ Bool_t Digitizer::isFired(Float_t x, Float_t z, Float_t charge) //______________________________________________________________________ Float_t Digitizer::getEffX(Float_t x) { - Float_t xborder = Geo::XPAD * 0.5 - TMath::Abs(x); + Float_t xborder = Geo::XPAD * 0.5 - std::abs(x); if (xborder > 0) { if (xborder > mBound1) { @@ -532,7 +532,7 @@ Float_t Digitizer::getEffX(Float_t x) //______________________________________________________________________ Float_t Digitizer::getEffZ(Float_t z) { - Float_t zborder = Geo::ZPAD * 0.5 - TMath::Abs(z); + Float_t zborder = Geo::ZPAD * 0.5 - std::abs(z); if (zborder > 0) { if (zborder > mBound1) { diff --git a/macro/checkTOFMatching.C b/macro/checkTOFMatching.C index ed6a2355bdd94..7e5e84431c220 100644 --- a/macro/checkTOFMatching.C +++ b/macro/checkTOFMatching.C @@ -1,3 +1,14 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + #if !defined(__CLING__) || defined(__ROOTCLING__) #include "TFile.h" #include "TF1.h" @@ -111,7 +122,7 @@ void checkTOFMatching(bool batchMode = true) // loop over tracks for (uint i = 0; i < mTracksArrayInp->size(); i++) { o2::dataformats::TrackTPCITS trackITSTPC = mTracksArrayInp->at(i); - if (TMath::Abs(trackITSTPC.getEta()) < 0.9) { + if (std::abs(trackITSTPC.getEta()) < 0.9) { htrack->Fill(trackITSTPC.getPt()); if (trackITSTPC.getPt() > 0.5) { htrack_t->Fill(trackITSTPC.getTimeMUS().getTimeStamp()); @@ -287,7 +298,7 @@ void checkTOFMatching(bool batchMode = true) #endif bool bMatched = kFALSE; for (uint ilabel = 0; ilabel < labelsTOF.size(); ilabel++) { - if ((abs(labelsTPC.getTrackID()) == labelsTOF[ilabel].getTrackID() && labelsTPC.getEventID() == labelsTOF[ilabel].getEventID() && labelsTPC.getSourceID() == labelsTOF[ilabel].getSourceID()) || (labelsITS.getTrackID() == labelsTOF[ilabel].getTrackID() && labelsITS.getEventID() == labelsTOF[ilabel].getEventID() && labelsITS.getSourceID() == labelsTOF[ilabel].getSourceID())) { + if ((std::abs(labelsTPC.getTrackID()) == labelsTOF[ilabel].getTrackID() && labelsTPC.getEventID() == labelsTOF[ilabel].getEventID() && labelsTPC.getSourceID() == labelsTOF[ilabel].getSourceID()) || (labelsITS.getTrackID() == labelsTOF[ilabel].getTrackID() && labelsITS.getEventID() == labelsTOF[ilabel].getEventID() && labelsITS.getSourceID() == labelsTOF[ilabel].getSourceID())) { nGoodMatches++; bMatched = kTRUE; break; @@ -325,7 +336,7 @@ void checkTOFMatching(bool batchMode = true) } } - if (TMath::Abs(trackITSTPC.getEta()) < 0.9) { + if (std::abs(trackITSTPC.getEta()) < 0.9) { htof->Fill(trackITSTPC.getPt()); if (bMatched) htofGood->Fill(trackITSTPC.getPt()); @@ -350,7 +361,7 @@ void checkTOFMatching(bool batchMode = true) const auto idxTPCcheck = trackITSTPC.getRefTPC(); const auto idxITScheck = trackITSTPC.getRefITS(); const auto& labelsTPCcheck = (*mcTPC)[idxTPCcheck.getIndex()]; - if (abs(labelsTPCcheck.getTrackID()) == trackIdTOF && labelsTPCcheck.getEventID() == eventIdTOF && labelsTPCcheck.getSourceID() == sourceIdTOF) { + if (std::abs(labelsTPCcheck.getTrackID()) == trackIdTOF && labelsTPCcheck.getEventID() == eventIdTOF && labelsTPCcheck.getSourceID() == sourceIdTOF) { #ifdef DEBUG LOGF(info, "The TPC track that should have been matched to TOF is number %d", i); #endif diff --git a/macro/compareTOFClusters.C b/macro/compareTOFClusters.C index 07029215e9dee..778a5a2be5dd5 100644 --- a/macro/compareTOFClusters.C +++ b/macro/compareTOFClusters.C @@ -68,17 +68,17 @@ bool compareTOFClusters(std::string inpName1 = "tofclustersOr.root", std::string clstatus = false; } - if (TMath::Abs(cl1.getTimeRaw() - cl2.getTimeRaw()) > 1E-6) { + if (std::abs(cl1.getTimeRaw() - cl2.getTimeRaw()) > 1E-6) { printf("cluster %d - Different Raw Times %lf != %lf \n", i, cl1.getTimeRaw(), cl2.getTimeRaw()); clstatus = false; } - if (TMath::Abs(cl1.getTime() - cl2.getTime()) > 1E-6) { + if (std::abs(cl1.getTime() - cl2.getTime()) > 1E-6) { printf("cluster %d - Different Calbrated Times %lf != %lf \n", i, cl1.getTime(), cl2.getTime()); clstatus = false; } - if (TMath::Abs(cl1.getTot() - cl2.getTot()) > 1E-6) { + if (std::abs(cl1.getTot() - cl2.getTot()) > 1E-6) { printf("cluster %d - Different ToTs %f != %f \n", i, cl1.getTot(), cl2.getTot()); clstatus = false; } @@ -93,32 +93,32 @@ bool compareTOFClusters(std::string inpName1 = "tofclustersOr.root", std::string clstatus = false; } - if (TMath::Abs(cl1.getX() - cl2.getX()) > 1E-6) { + if (std::abs(cl1.getX() - cl2.getX()) > 1E-6) { printf("cluster %d - Different X positions %lf != %lf \n", i, cl1.getX(), cl2.getX()); clstatus = false; } - if (TMath::Abs(cl1.getY() - cl2.getY()) > 1E-6) { + if (std::abs(cl1.getY() - cl2.getY()) > 1E-6) { printf("cluster %d - Different Y positions %lf != %lf \n", i, cl1.getY(), cl2.getY()); clstatus = false; } - if (TMath::Abs(cl1.getZ() - cl2.getZ()) > 1E-6) { + if (std::abs(cl1.getZ() - cl2.getZ()) > 1E-6) { printf("cluster %d - Different Z positions %lf != %lf \n", i, cl1.getZ(), cl2.getZ()); clstatus = false; } - if (TMath::Abs(cl1.getSigmaY2() - cl2.getSigmaY2()) > 1E-6) { + if (std::abs(cl1.getSigmaY2() - cl2.getSigmaY2()) > 1E-6) { printf("cluster %d - Different Y2 sigmas %lf != %lf \n", i, cl1.getSigmaY2(), cl2.getSigmaY2()); clstatus = false; } - if (TMath::Abs(cl1.getSigmaZ2() - cl2.getSigmaZ2()) > 1E-6) { + if (std::abs(cl1.getSigmaZ2() - cl2.getSigmaZ2()) > 1E-6) { printf("cluster %d - Different Z2 sigmas %lf != %lf \n", i, cl1.getSigmaZ2(), cl2.getSigmaZ2()); clstatus = false; } - if (TMath::Abs(cl1.getSigmaYZ() - cl2.getSigmaYZ()) > 1E-6) { + if (std::abs(cl1.getSigmaYZ() - cl2.getSigmaYZ()) > 1E-6) { printf("cluster %d - Different YZ sigmas %lf != %lf \n", i, cl1.getSigmaYZ(), cl2.getSigmaYZ()); clstatus = false; }