diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h index 851385e9283f70e2eda77e55e524e03fb2a9e4bc..fab109ace9273bf16d9ce6257574f58ae4484cb3 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h @@ -91,7 +91,13 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon Trk::Track* standaloneRefit(const Trk::Track& combinedTrack, float bs_x, float bs_y, float bs_z) const; /** ITrackFitter interface: - refit a track */ + * + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; + + /*refit a track */ Trk::Track* fit(const Trk::Track& track, const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis particleHypothesis = Trk::muon) const; @@ -151,7 +157,7 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon const std::vector<const Trk::TrackStateOnSurface*>& trackStateOnSurfaces, const Trk::RecVertex* vertex, const Trk::RecVertex* mbeamAxis, const Trk::PerigeeSurface* mperigeeSurface, - const Trk::Perigee* seedParameter = 0) const; + const Trk::Perigee* seedParameter = nullptr) const; Trk::Track* createIndetTrack(const Trk::TrackInfo& info, DataVector<const Trk::TrackStateOnSurface>::const_iterator begin, @@ -259,7 +265,7 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon const Trk::Volume* m_indetVolume; // constant initialized the first time it's needed - mutable std::atomic<const Trk::TrackingVolume*> m_spectrometerEntrance{0}; + mutable std::atomic<const Trk::TrackingVolume*> m_spectrometerEntrance{nullptr}; // vertex region and phi modularity for pseudo-measurement constraints Trk::RecVertex* m_beamAxis; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h index 41ff3afd839b5a9467d2d64b3da3f6b60b1c4834..5885f322e4754db98d602ef4241a36872e82dc19 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h @@ -79,9 +79,15 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb refit a track removing any indet measurements with optional addition of pseudoMeasurements according to original extrapolation */ Trk::Track* standaloneRefit(const Trk::Track& combinedTrack, float bs_x, float bs_y, float bs_z) const; - + /** ITrackFitter interface: - refit a track */ + * + * Bring in default impl with + * EventContext for now + */ + + using ITrackFitter::fit; + /** refit a track */ Trk::Track* fit(const Trk::Track& track, const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis particleHypothesis = Trk::muon) const; @@ -91,7 +97,7 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*particleHypothesis*/) const { - return 0; + return nullptr; }; /**ITrackFitter interface: @@ -100,7 +106,7 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*particleHypothesis*/) const { - return 0; + return nullptr; }; /** ITrackFitter interface: @@ -109,7 +115,7 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*particleHypothesis*/) const { - return 0; + return nullptr; }; /** ITrackFitter interface: diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index 4d5d4ef9cefc976de8134653d8801917b3b2a90d..b81678f01a40614fb930a16be0cedfee4a81d9b9 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx @@ -16,6 +16,8 @@ #include <cmath> #include <iomanip> +#include <memory> + #include "AthenaKernel/Units.h" #include "EventPrimitives/EventPrimitivesHelpers.h" @@ -104,12 +106,12 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder(const std::string& type, cons m_IDMS_rzSigma(1. * Gaudi::Units::mm), m_indetSlimming(false), m_inputSlimming(false), - m_calorimeterVolume(0), - m_indetVolume(0), - m_beamAxis(0), - m_perigeeSurface(0), + m_calorimeterVolume(nullptr), + m_indetVolume(nullptr), + m_beamAxis(nullptr), + m_perigeeSurface(nullptr), m_sigmaPhiSector(0), - m_vertex(0), + m_vertex(nullptr), m_countAcceptedStandaloneFit(0), m_countBeamAxis(0), m_countCombinedCleanerVeto(0), @@ -117,7 +119,7 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder(const std::string& type, cons m_countExtensionCleanerVeto(0), m_countStandaloneCleanerVeto(0), m_countVertexRegion(0), - m_messageHelper(0), + m_messageHelper(nullptr), m_updateWithCaloTG(false), m_useCaloTG(false), m_iterateCombinedTrackFit(false), @@ -414,11 +416,11 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!indetPerigee) { // missing MeasuredPerigee for indet track m_messageHelper->printWarning(0); - return 0; + return nullptr; } // take inner calorimeter scattering surface from extrapolated track - const Trk::Surface* surface = 0; + const Trk::Surface* surface = nullptr; if (m_trackQuery->isCaloAssociated(extrapolatedTrack)) { auto it = extrapolatedTrack.trackStateOnSurfaces()->begin(); @@ -441,7 +443,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T // match extrapolated indet track to inner calorimeter scattering surface // provided momentum defined (solenoid on) if (surface && m_magFieldSvc->solenoidOn() && !m_updateWithCaloTG) { - const Trk::TrackStateOnSurface* innerTSOS = 0; + const Trk::TrackStateOnSurface* innerTSOS = nullptr; if (m_useCaloTG) { ATH_MSG_VERBOSE(" Retriving Calorimeter TSOS from " << __func__ << " at line " << __LINE__); @@ -465,7 +467,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!innerTSOS) { ATH_MSG_DEBUG(" indet track fails to intersect the calorimeter "); - return 0; + return nullptr; } // will re-associate the calorimeter if they are not the same surface @@ -480,16 +482,16 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T << "surface reference " << surface->globalReferencePoint() << " with offset " << surfaceOffset << "mm. Re-evaluate the caloTSOS "); - surface = 0; + surface = nullptr; } } - Trk::Track* muonTrack = 0; + Trk::Track* muonTrack = nullptr; if (!m_magFieldSvc->toroidOn()) { ATH_MSG_VERBOSE(" SL MS track: Calling createMuonTrack from " << __func__ << " at line " << __LINE__); muonTrack = createMuonTrack( - indetTrack, indetTrack.perigeeParameters(), 0, extrapolatedTrack.trackStateOnSurfaces()->begin(), + indetTrack, indetTrack.perigeeParameters(), nullptr, extrapolatedTrack.trackStateOnSurfaces()->begin(), extrapolatedTrack.trackStateOnSurfaces()->end(), extrapolatedTrack.trackStateOnSurfaces()->size()); } else { // create a muon track without perigee in case of non-optimal precision - @@ -497,16 +499,16 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!surface) { // extrapolate outwards to associate calorimeter material effects ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); muonTrack = createMuonTrack( - extrapolatedTrack, indetTrack.perigeeParameters(), 0, extrapolatedTrack.trackStateOnSurfaces()->begin(), + extrapolatedTrack, indetTrack.perigeeParameters(), nullptr, extrapolatedTrack.trackStateOnSurfaces()->begin(), extrapolatedTrack.trackStateOnSurfaces()->end(), extrapolatedTrack.trackStateOnSurfaces()->size()); } else if (m_trackQuery->numberPseudoMeasurements(extrapolatedTrack) > 1) { // remove pseudo meas ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); - muonTrack = createMuonTrack(extrapolatedTrack, 0, 0, extrapolatedTrack.trackStateOnSurfaces()->begin(), + muonTrack = createMuonTrack(extrapolatedTrack, nullptr, nullptr, extrapolatedTrack.trackStateOnSurfaces()->begin(), extrapolatedTrack.trackStateOnSurfaces()->end(), extrapolatedTrack.trackStateOnSurfaces()->size()); } else { // otherwise can just copy the extrapolated track ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); - muonTrack = createMuonTrack(extrapolatedTrack, extrapolatedTrack.perigeeParameters(), 0, + muonTrack = createMuonTrack(extrapolatedTrack, extrapolatedTrack.perigeeParameters(), nullptr, extrapolatedTrack.trackStateOnSurfaces()->begin(), extrapolatedTrack.trackStateOnSurfaces()->end(), extrapolatedTrack.trackStateOnSurfaces()->size()); @@ -514,7 +516,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T } // no combined muon when failure to intersect calo - if (!muonTrack) return 0; + if (!muonTrack) return nullptr; countAEOTs(muonTrack, " muonTrack track before fit "); @@ -560,18 +562,18 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!combinedTrack || !combinedTrack->fitQuality() || !haveMS || perigeeOutside) { - bool hasFitQ = combinedTrack ? (combinedTrack->fitQuality() != 0) : false; + bool hasFitQ = combinedTrack ? (combinedTrack->fitQuality() != nullptr) : false; ATH_MSG_DEBUG("combinedTrack fails with bad fit" << combinedTrack << " " << hasFitQ << " " << haveMS << " " << perigeeOutside); delete combinedTrack; delete muonTrack; - return 0; + return nullptr; } // Get parameters at calo position - const Trk::TrackParameters* combinedEnergyParameters = 0; - const Trk::TrackParameters* muonEnergyParameters = 0; + const Trk::TrackParameters* combinedEnergyParameters = nullptr; + const Trk::TrackParameters* muonEnergyParameters = nullptr; const CaloEnergy* caloEnergy = caloEnergyParameters(combinedTrack, muonTrack, combinedEnergyParameters, muonEnergyParameters); @@ -580,7 +582,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T m_messageHelper->printWarning(3); delete combinedTrack; delete muonTrack; - return 0; + return nullptr; } // if significant momentum change: re-evaluate calo energy and refit @@ -602,7 +604,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T Trk::Track* oldTrack = muonTrack; ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); - muonTrack = createMuonTrack(extrapolatedTrack, combinedEnergyParameters, 0, combinedTSOS->begin(), + muonTrack = createMuonTrack(extrapolatedTrack, combinedEnergyParameters, nullptr, combinedTSOS->begin(), combinedTSOS->end(), combinedTSOS->size()); if (indetNewTrack && muonTrack) { @@ -641,7 +643,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T double energyBalance = combinedEnergyParameters->momentum().mag() + caloEnergy->deltaE() - indetMaxE; // get parametrised eloss if large energy imbalance and refit track - CaloEnergy* paramEnergy = 0; + CaloEnergy* paramEnergy = nullptr; if (indetMaxE > 0. && energyBalance > m_numberSigmaFSR * caloEnergy->sigmaMinusDeltaE()) { // parametrized energy deposition // run-2 schema, update default eloss with parametrised value @@ -671,7 +673,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T Trk::Track* oldTrack = muonTrack; ATH_MSG_VERBOSE("Calling createMuonTrack from " << __func__ << " at line " << __LINE__); muonTrack = - createMuonTrack(extrapolatedTrack, 0, paramEnergy, oldTrack->trackStateOnSurfaces()->begin(), + createMuonTrack(extrapolatedTrack, nullptr, paramEnergy, oldTrack->trackStateOnSurfaces()->begin(), oldTrack->trackStateOnSurfaces()->end(), oldTrack->trackStateOnSurfaces()->size()); delete oldTrack; @@ -690,7 +692,7 @@ CombinedMuonTrackBuilder::combinedFit(const Trk::Track& indetTrack, const Trk::T if (!combinedTrack) { // final combined track lost, this should not happen m_messageHelper->printWarning(4); - return 0; + return nullptr; } if (m_refineELossCombinedTrackFit) { @@ -793,14 +795,14 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, // for material effects, fit starting value etc if (!m_magFieldSvc->solenoidOn()) { ATH_MSG_VERBOSE("indetExtension: method switched off when solenoid 'off' / toroid 'on'"); - return 0; + return nullptr; } propagator = m_propagator; } - const Trk::TrackParameters* frontParameters = 0; - const Trk::TrackParameters* backParameters = 0; + const Trk::TrackParameters* frontParameters = nullptr; + const Trk::TrackParameters* backParameters = nullptr; if (innerParameters) { if (innerParameters->associatedSurface() == spectrometerMeasurements.front()->associatedSurface()) { @@ -840,8 +842,8 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, } // find middle measurement - const Trk::TrackParameters* midParameters = 0; - const Trk::MeasurementBase* midMeasurement = 0; + const Trk::TrackParameters* midParameters = nullptr; + const Trk::MeasurementBase* midMeasurement = nullptr; if (middleParameters && innerParameters && outerParameters) { Amg::Vector3D direction = (outerParameters->position() - innerParameters->position()).unit(); @@ -866,9 +868,9 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, } // create muon track from spectrometer measurements - const Trk::FitQualityOnSurface* fitQoS = 0; - const Trk::MaterialEffectsOnTrack* materialEffects = 0; - const Trk::TrackParameters* trackParameters = 0; + const Trk::FitQualityOnSurface* fitQoS = nullptr; + const Trk::MaterialEffectsOnTrack* materialEffects = nullptr; + const Trk::TrackParameters* trackParameters = nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typeM; typeM.set(Trk::TrackStateOnSurface::Measurement); std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typeP; @@ -887,7 +889,7 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, trackStateOnSurfaces->push_back( new const Trk::TrackStateOnSurface((**m).clone(), frontParameters, fitQoS, materialEffects, typeP)); - frontParameters = 0; + frontParameters = nullptr; } else if (*m == midMeasurement) { trackStateOnSurfaces->push_back( new const Trk::TrackStateOnSurface((**m).clone(), midParameters, fitQoS, materialEffects, typeP)); @@ -902,7 +904,7 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, Trk::TrackInfo trackInfo(Trk::TrackInfo::Unknown, Trk::muon); - Trk::Track muonTrack(trackInfo, trackStateOnSurfaces, 0); + Trk::Track muonTrack(trackInfo, trackStateOnSurfaces, nullptr); countAEOTs(&muonTrack, " in detExtension muonTrack "); // perform combined fit @@ -925,7 +927,7 @@ CombinedMuonTrackBuilder::indetExtension(const Trk::Track& indetTrack, // reject with insufficient MS measurements ATH_MSG_DEBUG("indetExtension:: reject with insufficient MS measurements"); delete combinedTrack; - combinedTrack = 0; + combinedTrack = nullptr; } else { countAEOTs(combinedTrack, " in detExtension final combinedTrack "); } @@ -943,7 +945,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack { // no SA fit with vertex constraint for Toroid off data if (m_trackQuery->isLineFit(inputSpectrometerTrack) && !m_magFieldSvc->toroidOn()) { - return 0; + return nullptr; } if (msgLvl(MSG::DEBUG)) { @@ -1010,7 +1012,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (inputVertex && !vertex) { // input vertex fails dynamic_cast m_messageHelper->printWarning(6); - return 0; + return nullptr; } // fail input tracks with insufficient measurements or inconsistent structure @@ -1035,14 +1037,14 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (measurements < 4) { m_messageHelper->printWarning(48); ATH_MSG_VERBOSE(" SA::failed (1)"); - return 0; + return nullptr; } // inconsistent TSOS on input track if (fitQuality && measurements < fitQuality->numberDoF() + 4) { m_messageHelper->printWarning(49); ATH_MSG_VERBOSE(" SA::failed (2)"); - return 0; + return nullptr; } } @@ -1050,7 +1052,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (!m_trackQuery->isExtrapolated(inputSpectrometerTrack) && !m_trackQuery->isProjective(inputSpectrometerTrack)) { ATH_MSG_VERBOSE(" SA::failed (3)"); - return 0; + return nullptr; } // possibly refit the spectrometer track with material reallocation @@ -1062,7 +1064,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack spectrometerFit = reallocateMaterial(inputSpectrometerTrack); if (!spectrometerFit) { ATH_MSG_VERBOSE(" SA::failed (4)"); - return 0; + return nullptr; } haveSpectrometerRefit = true; } @@ -1079,7 +1081,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (haveSpectrometerRefit) delete spectrometerFit; ATH_MSG_VERBOSE(" SA::failed (5)"); - return 0; + return nullptr; } // set measured momentum error and starting parameters @@ -1094,7 +1096,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ATH_MSG_WARNING("standaloneFit: measuredPerigee has non-positive-definite covariance "); ATH_MSG_VERBOSE(" SA::failed (5.5)"); - return 0; + return nullptr; } double errorP = @@ -1104,7 +1106,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack std::unique_ptr<Trk::RecVertex> mbeamAxis = std::make_unique<Trk::RecVertex>(*m_beamAxis); std::unique_ptr<Trk::PerigeeSurface> mperigeeSurface = std::make_unique<Trk::PerigeeSurface>(*m_perigeeSurface); - const Trk::TrackParameters* parameters = 0; + const Trk::TrackParameters* parameters = nullptr; if (vertex) { // vertex association only makes sense for magnet-on tracks with measured curvature @@ -1112,7 +1114,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ATH_MSG_VERBOSE("standaloneFit: vertex fit not attempted as curvature badly measured"); ATH_MSG_VERBOSE(" SA::failed (6)"); - return 0; + return nullptr; } parameters = new Trk::Perigee(*spectrometerTrack.perigeeParameters()); } else { @@ -1126,21 +1128,21 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack // recreate beamAxis and vertexRegion for constrained (projective) track fits Amg::Vector3D origin(bs_x, bs_y, bs_z); - mperigeeSurface.reset(new Trk::PerigeeSurface(origin)); + mperigeeSurface = std::make_unique<Trk::PerigeeSurface>(origin); AmgSymMatrix(3) beamAxisCovariance; beamAxisCovariance.setZero(); (beamAxisCovariance)(0, 0) = m_vertex2DSigmaRPhi * m_vertex2DSigmaRPhi; (beamAxisCovariance)(1, 1) = m_vertex2DSigmaRPhi * m_vertex2DSigmaRPhi; (beamAxisCovariance)(2, 2) = m_vertex2DSigmaZ * m_vertex2DSigmaZ; - mbeamAxis.reset(new Trk::RecVertex(origin, beamAxisCovariance)); + mbeamAxis = std::make_unique<Trk::RecVertex>(origin, beamAxisCovariance); AmgSymMatrix(3) vertexRegionCovariance; vertexRegionCovariance.setZero(); (vertexRegionCovariance)(0, 0) = m_vertex3DSigmaRPhi * m_vertex3DSigmaRPhi; (vertexRegionCovariance)(1, 1) = m_vertex3DSigmaRPhi * m_vertex3DSigmaRPhi; (vertexRegionCovariance)(2, 2) = m_vertex3DSigmaZ * m_vertex3DSigmaZ; - mvertex.reset(new Trk::RecVertex(origin, vertexRegionCovariance)); + mvertex = std::make_unique<Trk::RecVertex>(origin, vertexRegionCovariance); } parameters = @@ -1151,7 +1153,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (haveSpectrometerRefit) delete spectrometerFit; ATH_MSG_VERBOSE(" SA::failed (7)"); - return 0; + return nullptr; } // create the spectrometer TSOS's for the extrapolated fit @@ -1162,9 +1164,9 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (haveSpectrometerRefit) delete spectrometerFit; ATH_MSG_VERBOSE(" SA::failed (8)"); - return 0; + return nullptr; } - const Trk::TrackParameters* caloParameters = 0; + const Trk::TrackParameters* caloParameters = nullptr; const Trk::TrackParameters* spectrometerParameters = parameters; Trk::ParticleHypothesis particleHypothesis = Trk::muon; @@ -1185,7 +1187,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } // badly defined tracks use weak vertex constraint with prefit before calo association - Trk::Track* prefit = 0; + Trk::Track* prefit = nullptr; const Trk::RecVertex* vertexInFit = vertex; @@ -1235,7 +1237,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } } - const Trk::Perigee* prefitResult = 0; + const Trk::Perigee* prefitResult = nullptr; // prefit to stabilize calo look-up and/or provide trackParameters if (performPrefit) { @@ -1259,12 +1261,12 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (!prefit || !prefit->fitQuality() || !prefit->perigeeParameters()) { ATH_MSG_DEBUG(" prefit failure "); delete prefit; - prefit = 0; + prefit = nullptr; } if (prefit) { dumpCaloEloss(prefit, " prefit "); - bool hasCov = prefit->perigeeParameters() ? (prefit->perigeeParameters()->covariance() != 0) : false; + bool hasCov = prefit->perigeeParameters() ? (prefit->perigeeParameters()->covariance() != nullptr) : false; ATH_MSG_VERBOSE(" got prefit " << m_printer->print(*prefit) << " hasCov " << hasCov); if (prefit->perigeeParameters()) { @@ -1296,7 +1298,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } else { // this shouldn't happen, but best be safe... delete prefit; - prefit = 0; + prefit = nullptr; // prefit: no parameter extrapolation to calo m_messageHelper->printWarning(9); } @@ -1313,7 +1315,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ATH_MSG_VERBOSE(" SA::failed (9)"); delete prefitResult; - return 0; + return nullptr; } // create spectrometerTSOS corresponding to prefit @@ -1355,7 +1357,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (!m_idHelperSvc->isMuon(id)) continue; - const Trk::RIO_OnTrack* updatedRot = 0; + const Trk::RIO_OnTrack* updatedRot = nullptr; if (!m_cscRotCreator.empty() && m_idHelperSvc->isCsc(id)) { updatedRot = m_cscRotCreator->correct(*rot->prepRawData(), *(**t).trackParameters()); } else if (!m_mdtRotCreator.empty() && m_idHelperSvc->isMdt(id)) { @@ -1371,7 +1373,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack type.set(Trk::TrackStateOnSurface::Outlier); } - *t = new const Trk::TrackStateOnSurface(updatedRot, (**t).trackParameters()->clone(), 0, 0, type); + *t = new const Trk::TrackStateOnSurface(updatedRot, (**t).trackParameters()->clone(), nullptr, nullptr, type); delete tsos; } } @@ -1412,13 +1414,13 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (vertexInFit) type.set(Trk::TrackStateOnSurface::Measurement); trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface( - vertexInFit, extrapolated->perigeeParameters()->clone(), 0, 0, type)); + vertexInFit, extrapolated->perigeeParameters()->clone(), nullptr, nullptr, type)); for (++s; s != badfit->trackStateOnSurfaces()->end(); ++s) { trackStateOnSurfaces->push_back((**s).clone()); } - Trk::Track* track = new Trk::Track(spectrometerTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* track = new Trk::Track(spectrometerTrack.info(), trackStateOnSurfaces, nullptr); extrapolated = fit(*track, m_cleanStandalone, particleHypothesis); delete badfit; delete track; @@ -1451,12 +1453,12 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack mperigeeSurface.get(), prefitResult); delete prefit; - prefit = 0; + prefit = nullptr; returnAfterCleaner = true; } if (!extrapolated || !extrapolated->fitQuality()) { - bool hasFQ = extrapolated ? (extrapolated->fitQuality() != 0) : false; + bool hasFQ = extrapolated ? (extrapolated->fitQuality() != nullptr) : false; ATH_MSG_DEBUG("fail track as back extrapolation fit failed " << extrapolated << " hasFQ " << hasFQ); delete prefit; delete caloParameters; @@ -1469,14 +1471,14 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ATH_MSG_VERBOSE(" SA::failed (10)"); delete prefitResult; - return 0; + return nullptr; } } } // delete prefitResult delete prefitResult; - prefitResult = 0; + prefitResult = nullptr; // keep statistics for successful fits ++m_countAcceptedStandaloneFit; @@ -1498,7 +1500,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } else { // pRatio is the ratio of fitted to start momentum value at calo exit // find parameters at calo exit - parameters = 0; + parameters = nullptr; while (!(**s).trackParameters() || m_calorimeterVolume->inside((**s).trackParameters()->position())) { if ((**s).trackParameters() && !(**s).type(Trk::TrackStateOnSurface::Perigee)) @@ -1545,7 +1547,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack double fitChi2 = normalizedChi2(*track); if (fitChi2 < m_badFitChi2 || fitChi2 < extrapChi2 + 0.5) { delete extrapolated; - extrapolated = 0; + extrapolated = nullptr; } } @@ -1567,7 +1569,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack } ATH_MSG_VERBOSE(" SA::failed (12)"); - return 0; + return nullptr; } int improvementsFailed = 0; // count the number of times the fit fails after improvements @@ -1644,7 +1646,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ++m_countDegradedStandaloneFit; if (improvementsFailed == 2) { ATH_MSG_WARNING("reject track, quality degraded and improvements failed"); - return 0; + return nullptr; } } } @@ -1672,7 +1674,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float if (!m_magFieldSvc->toroidOn()) { // no standalone refit for Toroid off - return 0; + return nullptr; } if (msgLvl(MSG::DEBUG)) { @@ -1748,7 +1750,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float m_messageHelper->printWarning(13); delete trackStateOnSurfaces; delete vertex; - return 0; + return nullptr; } if ((**s).type(Trk::TrackStateOnSurface::CaloDeposit)) { haveCaloDeposit = true; @@ -1758,12 +1760,12 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float // inner calo scatterer - keep scattering angles for vertex constraint // Amg::Vector3D direction; - const Trk::ScatteringAngles* innerScattering = 0; - Trk::TrackStateOnSurface* innerTSOS = 0; + const Trk::ScatteringAngles* innerScattering = nullptr; + Trk::TrackStateOnSurface* innerTSOS = nullptr; const Trk::MaterialEffectsBase* materialEffects = (**s).materialEffectsOnTrack(); - const Trk::TrackParameters* middleParameters = 0; - const Trk::TrackParameters* oldParameters = 0; - const Trk::ScatteringAngles* outerScattering = 0; + const Trk::TrackParameters* middleParameters = nullptr; + const Trk::TrackParameters* oldParameters = nullptr; + const Trk::ScatteringAngles* outerScattering = nullptr; const Trk::TrackParameters* parameters = (**s).trackParameters(); if (materialEffects && parameters && m_calorimeterVolume->inside(parameters->position())) { @@ -1778,7 +1780,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float // innerScattering dynamic_cast failed m_messageHelper->printWarning(16); delete vertex; - return 0; + return nullptr; } innerScattering = meot->scatteringAngles(); @@ -1790,8 +1792,8 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float if (s == combinedTrack.trackStateOnSurfaces()->end()) { // no TSOS of type CaloDeposit found m_messageHelper->printWarning(17); - materialEffects = 0; - parameters = 0; + materialEffects = nullptr; + parameters = nullptr; } else { materialEffects = (**s).materialEffectsOnTrack(); parameters = (**s).trackParameters(); @@ -1811,7 +1813,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float // middle calo scatterer (for energy deposit) double energyDeposit = 0.; - Trk::TrackStateOnSurface* middleTSOS = 0; + Trk::TrackStateOnSurface* middleTSOS = nullptr; if (materialEffects && parameters && m_calorimeterVolume->inside(parameters->position())) { middleTSOS = (**s).clone(); @@ -1824,8 +1826,8 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float materialEffects = (**s).materialEffectsOnTrack(); parameters = (**s).trackParameters(); } else { - materialEffects = 0; - parameters = 0; + materialEffects = nullptr; + parameters = nullptr; } } else { // no middle material or parameters @@ -1839,7 +1841,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float } // outer calo scatterer - Trk::TrackStateOnSurface* outerTSOS = 0; + Trk::TrackStateOnSurface* outerTSOS = nullptr; double pInner = 0.; double pOuter = 0.; @@ -1854,7 +1856,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float // outerScattering dynamic_cast failed m_messageHelper->printWarning(24); delete vertex; - return 0; + return nullptr; } outerScattering = meot->scatteringAngles(); @@ -1867,7 +1869,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float } else { // otherwise extrapolate outer to middleSurface without scattering correction if (!middleTSOS) { - parameters = 0; + parameters = nullptr; // no outerScattering or CaloDeposit TSOS found m_messageHelper->printWarning(25); } else { @@ -1897,7 +1899,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float delete middleTSOS; delete outerTSOS; delete vertex; - return 0; + return nullptr; } // create perigee by back extrapolation from middleSurface via innerSurface @@ -1912,7 +1914,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float momentumUpdate(parameters, pInner, true, -innerScattering->deltaPhi(), -innerScattering->deltaTheta()); } - const Trk::Perigee* perigee = 0; + const Trk::Perigee* perigee = nullptr; if (parameters) { perigee = dynamic_cast<const Trk::Perigee*>(m_propagator->propagate( *parameters, *m_perigeeSurface, Trk::oppositeMomentum, false, m_magFieldProperties, Trk::nonInteracting)); @@ -1961,7 +1963,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float delete middleTSOS; delete outerTSOS; delete vertex; - return 0; + return nullptr; } if (outerScattering) { @@ -1985,7 +1987,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Perigee); - trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(0, perigee, 0, 0, type)); + trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(nullptr, perigee, nullptr, nullptr, type)); // including vertex region pseudoMeas if requested: in r21, this is always requested std::unique_ptr<Trk::RecVertex> mbeamAxis = std::make_unique<Trk::RecVertex>(*m_beamAxis); @@ -1994,7 +1996,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Measurement); - trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, 0, 0, 0, type)); + trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, nullptr, nullptr, nullptr, type)); } @@ -2087,7 +2089,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float typePatternScat.set(Trk::TrackStateOnSurface::Scatterer); const Trk::TrackStateOnSurface* newTSOS = - new Trk::TrackStateOnSurface(0, parsNew, 0, meotNew, typePatternScat); + new Trk::TrackStateOnSurface(nullptr, parsNew, nullptr, meotNew, typePatternScat); trackStateOnSurfaces->push_back(newTSOS); ATH_MSG_DEBUG(" add new TSOS for ID "); @@ -2122,7 +2124,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float if (t == combinedTrack.trackStateOnSurfaces()->end()) { ATH_MSG_WARNING("At end of TSOS vector"); delete vertex; - return 0; + return nullptr; } if (haveLeadingMaterial) appendSelectedTSOS(*trackStateOnSurfaces, s, ++t); @@ -2137,7 +2139,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float appendSelectedTSOS(*trackStateOnSurfaces, t, combinedTrack.trackStateOnSurfaces()->end()); // create track for refit - Trk::Track* standaloneTrack = new Trk::Track(combinedTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* standaloneTrack = new Trk::Track(combinedTrack.info(), trackStateOnSurfaces, nullptr); standaloneTrack->info().setPatternRecognitionInfo(Trk::TrackInfo::MuidStandaloneRefit); if (m_trackQuery->isCombined(*standaloneTrack)) { ATH_MSG_WARNING(" This should not happen standalone Track has ID hits "); @@ -2151,14 +2153,14 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float if (!checkTrack("standaloneRefit", refittedTrack, standaloneTrack)) { delete refittedTrack; delete vertex; - return 0; + return nullptr; } if (refittedTrack) { if (!refittedTrack->fitQuality()) { delete refittedTrack; delete vertex; - return 0; + return nullptr; } if (!m_trackQuery->isCaloAssociated(*refittedTrack)) { @@ -2166,7 +2168,7 @@ CombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrack, float m_messageHelper->printWarning(28); delete refittedTrack; delete vertex; - return 0; + return nullptr; } countAEOTs(refittedTrack, " standaloneRefit final refittedTrack "); @@ -2209,7 +2211,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo std::stringstream ss; ss << particleHypothesis; m_messageHelper->printWarning(29, ss.str()); - return 0; + return nullptr; } // check if combined or subsystem track @@ -2227,7 +2229,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo // perform fit after ensuring calo is associated for combined tracks // calo association for combined tracks (WARN if missing from input) - Trk::Track* fittedTrack = 0; + Trk::Track* fittedTrack = nullptr; if (isCombined && particleHypothesis == Trk::muon && !m_trackQuery->isCaloAssociated(track)) { // about to add the TSOS's describing calorimeter association to a combined muon; @@ -2276,7 +2278,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo } } - Trk::Track* combinedTrack = new Trk::Track(track.info(), combinedTSOS, 0); + Trk::Track* combinedTrack = new Trk::Track(track.info(), combinedTSOS, nullptr); if (combinedTrack) countAEOTs(combinedTrack, " combinedTrack track before fit "); @@ -2304,11 +2306,11 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo } // quit if fit has failed - if (!fittedTrack) return 0; + if (!fittedTrack) return nullptr; if (!checkTrack("fitInterface1", fittedTrack, fittedTrack)) { delete fittedTrack; - return 0; + return nullptr; } // track cleaning @@ -2355,7 +2357,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOutlierRemo ATH_MSG_DEBUG(" cleaner veto A "); ++m_countStandaloneCleanerVeto; delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } else { ATH_MSG_DEBUG(" keep original standalone track despite cleaner veto "); } @@ -2395,7 +2397,7 @@ CombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& measurementSet, const T std::stringstream ss; ss << particleHypothesis; m_messageHelper->printWarning(31, ss.str()); - return 0; + return nullptr; } // select straightLine fitter when magnets downstream of leading measurement are off @@ -2413,7 +2415,7 @@ CombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& measurementSet, const T // create Perigee if starting parameters given for a different surface type const Trk::TrackParameters* perigee = &perigeeStartValue; - Trk::PerigeeSurface* perigeeSurface = 0; + Trk::PerigeeSurface* perigeeSurface = nullptr; if (!dynamic_cast<const Trk::Perigee*>(perigee)) { Amg::Vector3D origin(perigeeStartValue.position()); @@ -2430,11 +2432,11 @@ CombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& measurementSet, const T delete perigee; } - if (!fittedTrack) return 0; + if (!fittedTrack) return nullptr; if (!checkTrack("fitInterface2", fittedTrack, fittedTrack)) { delete fittedTrack; - return 0; + return nullptr; } // track cleaning @@ -2479,7 +2481,7 @@ CombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& measurementSet, const T ATH_MSG_DEBUG(" cleaner veto B"); ++m_countExtensionCleanerVeto; delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } else { ATH_MSG_DEBUG(" keep original extension track despite cleaner veto "); } @@ -2516,7 +2518,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::Track& ex std::stringstream ss; ss << particleHypothesis; m_messageHelper->printWarning(32, ss.str()); - return 0; + return nullptr; } // select straightLine fitter when solenoid and toroid are off @@ -2548,7 +2550,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::Track& ex Trk::Track* fittedTrack = fitter->fit(indetTrack, extrapolatedTrack, false, particleHypothesis); - if (!fittedTrack) return 0; + if (!fittedTrack) return nullptr; // track cleaning if (runOutlier) { @@ -2587,7 +2589,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::Track& ex ATH_MSG_DEBUG(" cleaner veto C"); ++m_countCombinedCleanerVeto; delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } else { ATH_MSG_DEBUG(" keep original combined track despite cleaner veto "); } @@ -2616,7 +2618,7 @@ CombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::Track& ex bool CombinedMuonTrackBuilder::optimizeErrors(Trk::Track* track) const { - const Trk::MuonTrackSummary* muonSummary = 0; + const Trk::MuonTrackSummary* muonSummary = nullptr; const Trk::TrackSummary* summary = track->trackSummary(); if (summary) { @@ -2834,7 +2836,7 @@ CombinedMuonTrackBuilder::addIDMSerrors(Trk::Track* track) const typePatternScat.set(Trk::TrackStateOnSurface::Scatterer); const Trk::TrackStateOnSurface* newTSOS = - new Trk::TrackStateOnSurface(0, parsNew, 0, meotNew, typePatternScat); + new Trk::TrackStateOnSurface(nullptr, parsNew, nullptr, meotNew, typePatternScat); trackStateOnSurfaces->push_back(newTSOS); @@ -2866,7 +2868,7 @@ CombinedMuonTrackBuilder::addIDMSerrors(Trk::Track* track) const << " trackStateOnSurfaces found " << trackStateOnSurfaces->size()); - Trk::Track* newTrack = new Trk::Track(track->info(), trackStateOnSurfaces, 0); + Trk::Track* newTrack = new Trk::Track(track->info(), trackStateOnSurfaces, nullptr); if (newTrack) countAEOTs(newTrack, " add IDMS errors "); return newTrack; } @@ -2880,7 +2882,7 @@ CombinedMuonTrackBuilder::appendSelectedTSOS(DataVector<const Trk::TrackStateOnS // spectrometer measurement selection std::vector<const Trk::Surface*> measurementSurfaces; measurementSurfaces.reserve(trackStateOnSurfaces.size()); - const Trk::Surface* previousSurface = 0; + const Trk::Surface* previousSurface = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = begin; for (; s != end; ++s) { @@ -2945,11 +2947,11 @@ CombinedMuonTrackBuilder::caloEnergyParameters(const Trk::Track* combinedTrack, const Trk::TrackParameters*& muonEnergyParameters) const { // will also set the caloEnergyParameters (from both combinedTrack and muonTrack) - combinedEnergyParameters = 0; - muonEnergyParameters = 0; + combinedEnergyParameters = nullptr; + muonEnergyParameters = nullptr; // quit if missing track - if (!combinedTrack || !muonTrack) return 0; + if (!combinedTrack || !muonTrack) return nullptr; // muonTrack: get parameters at CaloDeposit DataVector<const Trk::TrackStateOnSurface>::const_iterator s = muonTrack->trackStateOnSurfaces()->begin(); @@ -2958,7 +2960,7 @@ CombinedMuonTrackBuilder::caloEnergyParameters(const Trk::Track* combinedTrack, if (++s == muonTrack->trackStateOnSurfaces()->end()) { // muonTrack without caloEnergy association m_messageHelper->printWarning(35); - return 0; + return nullptr; } } muonEnergyParameters = (**s).trackParameters(); @@ -2969,7 +2971,7 @@ CombinedMuonTrackBuilder::caloEnergyParameters(const Trk::Track* combinedTrack, if (++s == combinedTrack->trackStateOnSurfaces()->end()) { // combinedTrack without caloEnergy association m_messageHelper->printWarning(36); - return 0; + return nullptr; } } @@ -2999,13 +3001,13 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp << parameters.position().z() << " cov " << parameters.covariance() << " muonfit " << (particleHypothesis == Trk::muon)); - std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = 0; - std::vector<const Trk::TrackStateOnSurface*>* leadingTSOS = 0; + std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = nullptr; + std::vector<const Trk::TrackStateOnSurface*>* leadingTSOS = nullptr; std::vector<const Trk::TrackStateOnSurface*>::const_iterator s; - const Trk::TrackParameters* trackParameters = 0; - const Trk::Perigee* perigee = 0; + const Trk::TrackParameters* trackParameters = nullptr; + const Trk::Perigee* perigee = nullptr; if (vertex && m_indetVolume->inside(parameters.position())) { perigee = dynamic_cast<const Trk::Perigee*>(¶meters); @@ -3059,7 +3061,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp } const Trk::TrackParameters* correctedParameters = parameters.associatedSurface().createTrackParameters( parameterVector[Trk::loc1], parameterVector[Trk::loc2], parameterVector[Trk::phi], - parameterVector[Trk::theta], parameterVector[Trk::qOverP], 0); + parameterVector[Trk::theta], parameterVector[Trk::qOverP], nullptr); Trk::IMaterialAllocator::Garbage_t garbage; leadingTSOS = m_materialAllocator->leadingSpectrometerTSOS(*correctedParameters, garbage); @@ -3179,7 +3181,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp if (trackParameters && !m_indetVolume->inside(trackParameters->position())) { ATH_MSG_DEBUG(" back extrapolation problem: probably outside indet volume "); delete trackParameters; - trackParameters = 0; + trackParameters = nullptr; caloAssociated = false; } @@ -3205,7 +3207,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp } delete caloTSOS; - caloTSOS = 0; + caloTSOS = nullptr; } // track out from vertex @@ -3232,7 +3234,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp caloTSOS->push_back(tsos); } else { delete trackParameters; - trackParameters = 0; + trackParameters = nullptr; } } } @@ -3266,7 +3268,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp } ATH_MSG_DEBUG(" perigee back-extrapolation fails "); - return 0; + return nullptr; } } // if (perigee) { @@ -3300,7 +3302,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp if (trackParameters) { trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface( - 0, dynamic_cast<const Trk::Perigee*>(trackParameters), 0, 0, perigeeType)); + nullptr, dynamic_cast<const Trk::Perigee*>(trackParameters), nullptr, nullptr, perigeeType)); } // optionally append a pseudoMeasurement describing the vertex @@ -3313,7 +3315,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Measurement); - trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, 0, 0, 0, type)); + trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, nullptr, nullptr, nullptr, type)); } } @@ -3368,7 +3370,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp } // create track - Trk::Track* track = new Trk::Track(spectrometerTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* track = new Trk::Track(spectrometerTrack.info(), trackStateOnSurfaces, nullptr); dumpCaloEloss(track, " createExtrapolatedTrack "); countAEOTs(track, " createExtrapolatedTrack before fit "); @@ -3398,7 +3400,7 @@ CombinedMuonTrackBuilder::createExtrapolatedTrack(const Trk::Track& sp if (fittedTrack->perigeeParameters() && !m_indetVolume->inside(fittedTrack->perigeeParameters()->position())) { ATH_MSG_DEBUG(" back extrapolation problem: fitted perigee outside indet volume "); delete fittedTrack; - return 0; + return nullptr; } // limit momentum for future energy loss allocation @@ -3449,7 +3451,7 @@ CombinedMuonTrackBuilder::createIndetTrack(const Trk::TrackInfo& // then append selected TSOS appendSelectedTSOS(*trackStateOnSurfaces, begin, end); - return new Trk::Track(info, trackStateOnSurfaces, 0); + return new Trk::Track(info, trackStateOnSurfaces, nullptr); } Trk::Track* @@ -3463,7 +3465,7 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk countAEOTs(&muonTrack, " createMuonTrack "); // set iterator to current TSOS on input track to be after the indet - const Trk::TrackParameters* lastIDtp = 0; + const Trk::TrackParameters* lastIDtp = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = begin; while ((**s).trackParameters() && (m_indetVolume->inside((**s).trackParameters()->position()) @@ -3518,7 +3520,7 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk delete caloTSOS; } delete trackStateOnSurfaces; - return 0; + return nullptr; } size += caloTSOS->size(); @@ -3551,8 +3553,8 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk (**s).trackParameters()->associatedSurface(), typePattern); // create TSOS - const Trk::FitQualityOnSurface* fitQoS = 0; - const Trk::MeasurementBase* measurementBase = 0; + const Trk::FitQualityOnSurface* fitQoS = nullptr; + const Trk::MeasurementBase* measurementBase = nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::CaloDeposit); @@ -3584,7 +3586,7 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk } // add entrance TSOS if not already present - const Trk::TrackStateOnSurface* entranceTSOS = 0; + const Trk::TrackStateOnSurface* entranceTSOS = nullptr; if ((**s).type(Trk::TrackStateOnSurface::Perigee)) { hasAlreadyPerigee = true; @@ -3617,7 +3619,7 @@ CombinedMuonTrackBuilder::createMuonTrack(const Trk::Track& muonTrack, const Trk // then append selected TSOS from the extrapolated or spectrometer track appendSelectedTSOS(*trackStateOnSurfaces, s, end); - Trk::Track* newMuonTrack = new Trk::Track(muonTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* newMuonTrack = new Trk::Track(muonTrack.info(), trackStateOnSurfaces, nullptr); // Updates the calo TSOS with the ones from TG+corrections (if needed) if (m_updateWithCaloTG && !m_useCaloTG && redoCaloAssoc) { @@ -3643,7 +3645,7 @@ CombinedMuonTrackBuilder::createPhiPseudoMeasurement(const Trk::Track& track) co std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Measurement); - const Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(pseudo, parameters, 0, 0, type); + const Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(pseudo, parameters, nullptr, nullptr, type); return tsos; } @@ -3657,7 +3659,7 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT if (!measuredPerigee || !measuredPerigee->covariance()) { // missing MeasuredPerigee for spectrometer track m_messageHelper->printWarning(38); - return 0; + return nullptr; } double errorPhi = sqrt((*measuredPerigee->covariance())(Trk::phi0, Trk::phi0)); @@ -3692,8 +3694,8 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT unsigned numberMaterial = 0; unsigned numberParameters = 0; - const Trk::Surface* previousSurface = 0; - const Trk::TrackStateOnSurface* previousTSOS = 0; + const Trk::Surface* previousSurface = nullptr; + const Trk::TrackStateOnSurface* previousTSOS = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = spectrometerTrack.trackStateOnSurfaces()->begin(); auto sEnd = spectrometerTrack.trackStateOnSurfaces()->end(); @@ -3781,7 +3783,7 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT } } else if (previousTSOS) { spectrometerTSOS->push_back(previousTSOS); - previousTSOS = 0; + previousTSOS = nullptr; } // trapezoid precedes rotatedTrapezoid @@ -3793,7 +3795,7 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT } else { spectrometerTSOS->push_back(previousTSOS); } - previousTSOS = 0; + previousTSOS = nullptr; } if (rotatedTrap) { @@ -3818,7 +3820,7 @@ const Trk::TrackStateOnSurface* CombinedMuonTrackBuilder::entrancePerigee(const Trk::TrackParameters* parameters) const { // make sure the spectrometer entrance volume is available - if (!parameters) return 0; + if (!parameters) return nullptr; if (!m_spectrometerEntrance.load()) { if (!m_trackingGeometrySvc) { @@ -3832,19 +3834,19 @@ CombinedMuonTrackBuilder::entrancePerigee(const Trk::TrackParameters* parameters } if (!m_spectrometerEntrance.load()) { - return 0; + return nullptr; } const Trk::TrackParameters* entranceParameters = m_extrapolator->extrapolateToVolume( *parameters, *m_spectrometerEntrance.load(), Trk::anyDirection, Trk::nonInteracting); - if (!entranceParameters) return 0; + if (!entranceParameters) return nullptr; Trk::PerigeeSurface surface(entranceParameters->position()); const Trk::TrackParameters* trackParameters = m_extrapolator->extrapolateDirectly(*entranceParameters, surface); delete entranceParameters; - if (!trackParameters) return 0; + if (!trackParameters) return nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> perigeeType; perigeeType.set(Trk::TrackStateOnSurface::Perigee); @@ -3853,7 +3855,7 @@ CombinedMuonTrackBuilder::entrancePerigee(const Trk::TrackParameters* parameters new Trk::Perigee(trackParameters->position(), trackParameters->momentum(), trackParameters->charge(), surface); delete trackParameters; - return new const Trk::TrackStateOnSurface(0, perigee, 0, 0, perigeeType); + return new const Trk::TrackStateOnSurface(nullptr, perigee, nullptr, nullptr, perigeeType); } @@ -3868,7 +3870,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (!measuredPerigee || !measuredPerigee->covariance()) { // missing MeasuredPerigee for spectrometer track m_messageHelper->printWarning(42); - return 0; + return nullptr; } // set starting parameters and measured momentum error @@ -3876,14 +3878,14 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (!parameters || !parameters->covariance()) { // missing spectrometer parameters on spectrometer track m_messageHelper->printWarning(43); - return 0; + return nullptr; } double errorP = sqrt(measuredPerigee->momentum().mag2() * (*measuredPerigee->covariance())(Trk::qOverP, Trk::qOverP)); // corrected parameters ensure the track fitting starts with a projective approximation - const Trk::TrackParameters* correctedParameters = 0; + const Trk::TrackParameters* correctedParameters = nullptr; Amg::VectorX parameterVector = parameters->parameters(); double trackEnergy = 1. / std::abs(parameterVector[Trk::qOverP]); @@ -3898,7 +3900,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, delete parameters; parameters = correctedParameters; - correctedParameters = 0; + correctedParameters = nullptr; } // check if the track curvature is well determined (with sufficient energy to penetrate material) @@ -3926,7 +3928,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, delete caloEnergy; delete parameters; - return 0; + return nullptr; } parameterVector[Trk::qOverP] = parameters->charge() / (trackEnergy + caloEnergy->deltaE()); @@ -3964,18 +3966,18 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, ATH_MSG_WARNING( "deleting parameters pointer that could be used further down in execution, setting it to zero!"); - parameters = 0; + parameters = nullptr; } delete correctedParameters; - correctedParameters = 0; + correctedParameters = nullptr; ATH_MSG_DEBUG("standaloneFit: excessive energy loss in spectrometer " << std::abs(spectrometerEnergyLoss / Units::GeV) << " GeV" << " in calo " << std::abs(caloEnergy->deltaE() / Units::GeV) << " GeV"); } delete caloEnergy; - caloEnergy = 0; + caloEnergy = nullptr; } // check perigee in indet volume when the curvature is well determined @@ -3989,7 +3991,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, ATH_MSG_DEBUG("standaloneFit: failed back extrapolation to perigee"); delete correctedParameters; delete parameters; - return 0; + return nullptr; } // large impact: set phi to be projective (note iteration) @@ -3997,10 +3999,10 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (correctedParameters == parameters) { ATH_MSG_WARNING( "deleting parameters pointer that could be used further down in execution, setting it to zero!"); - parameters = 0; + parameters = nullptr; } delete correctedParameters; - correctedParameters = 0; + correctedParameters = nullptr; } else { Amg::Vector3D position = correctedParameters->position(); @@ -4071,7 +4073,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (correctedParameters == parameters) { ATH_MSG_WARNING( "deleting parameters pointer that could be used further down in execution, setting it to zero!"); - parameters = 0; + parameters = nullptr; } delete correctedParameters; @@ -4095,7 +4097,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, delete parameters; delete perigee; /// if (haveSpectrometerRefit) delete spectrometerFit; - return 0; + return nullptr; } } delete perigee; @@ -4132,7 +4134,7 @@ CombinedMuonTrackBuilder::extrapolatedParameters(bool& badlyDeterminedCurvature, if (!parameters) { ATH_MSG_DEBUG("standaloneFit: failed back extrapolation to perigee"); - return 0; + return nullptr; } } @@ -4173,7 +4175,7 @@ CombinedMuonTrackBuilder::finalTrackBuild(Trk::Track*& track) const delete recoveredTrack; if (chi2Before > m_badFitChi2) { delete track; - track = 0; + track = nullptr; return; } } @@ -4203,7 +4205,7 @@ CombinedMuonTrackBuilder::interfaceNotImplemented() const { ATH_MSG_WARNING(" this ITrackFitter interface has not been implemented." << " It is not relevant for combined muon tracks"); - return 0; + return nullptr; } void @@ -4213,7 +4215,7 @@ CombinedMuonTrackBuilder::momentumUpdate(const Trk::TrackParameters*& parameters if (!parameters) return; const Trk::TrackParameters* originalParameters = parameters; - const Trk::TrackParameters* updatedParameters = 0; + const Trk::TrackParameters* updatedParameters = nullptr; // update for angle change Amg::Vector3D direction = parameters->momentum().unit(); @@ -4252,7 +4254,7 @@ CombinedMuonTrackBuilder::momentumUpdate(const Trk::TrackParameters*& parameters // create updated parameters double charge = parameters->charge(); Amg::Vector3D position = parameters->position(); - AmgSymMatrix(5)* covariance = parameters->covariance() ? new AmgSymMatrix(5)(*(parameters->covariance())) : 0; + AmgSymMatrix(5)* covariance = parameters->covariance() ? new AmgSymMatrix(5)(*(parameters->covariance())) : nullptr; const Trk::Surface* surface = &(parameters->associatedSurface()); updatedParameters = surface->createTrackParameters(position, momentum, charge, covariance); @@ -4286,7 +4288,7 @@ const Trk::Track* CombinedMuonTrackBuilder::reallocateMaterial(const Trk::Track& spectrometerTrack) const { // build MeasurementSet for the spectrometer - const Trk::TrackParameters* perigeeStartValue = 0; + const Trk::TrackParameters* perigeeStartValue = nullptr; double perigeeDistance = 0.; Trk::MeasurementSet spectrometerMeasurements; @@ -4323,7 +4325,7 @@ CombinedMuonTrackBuilder::reallocateMaterial(const Trk::Track& spectrometerTrack // FIXME: use spectrometerTrack.perigeeParameters() // null perigeeStartValue m_messageHelper->printWarning(46); - return 0; + return nullptr; } // fit with various recovery strategies @@ -4391,10 +4393,10 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const } // remove spectrometer material from track - const Trk::FitQualityOnSurface* fitQoS = 0; - const Trk::MaterialEffectsBase* materialEffects = 0; - const Trk::MeasurementBase* measurementBase = 0; - const Trk::TrackParameters* trackParameters = 0; + const Trk::FitQualityOnSurface* fitQoS = nullptr; + const Trk::MaterialEffectsBase* materialEffects = nullptr; + const Trk::MeasurementBase* measurementBase = nullptr; + const Trk::TrackParameters* trackParameters = nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> defaultType; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type = defaultType; @@ -4446,7 +4448,7 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const if ((**s).measurementOnTrack()) { - materialEffects = 0; + materialEffects = nullptr; Amg::VectorX parameterVector = (**s).trackParameters()->parameters(); if (limitMomentum) { parameterVector[Trk::qOverP] = qOverP; @@ -4455,7 +4457,7 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const parameterVector[Trk::loc1], parameterVector[Trk::loc2], parameterVector[Trk::phi], parameterVector[Trk::theta], parameterVector[Trk::qOverP], (**s).trackParameters()->covariance() ? new AmgSymMatrix(5)(*(**s).trackParameters()->covariance()) - : 0); + : nullptr); type = defaultType; type.set(Trk::TrackStateOnSurface::Measurement); @@ -4475,8 +4477,8 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const } if (limitMomentum && (**s).trackParameters()) { - materialEffects = 0; - measurementBase = 0; + materialEffects = nullptr; + measurementBase = nullptr; Amg::VectorX parameterVector = (**s).trackParameters()->parameters(); parameterVector[Trk::qOverP] = qOverP; @@ -4484,7 +4486,7 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const parameterVector[Trk::loc1], parameterVector[Trk::loc2], parameterVector[Trk::phi], parameterVector[Trk::theta], parameterVector[Trk::qOverP], (**s).trackParameters()->covariance() ? new AmgSymMatrix(5)(*(**s).trackParameters()->covariance()) - : 0); + : nullptr); type = defaultType; @@ -4518,7 +4520,7 @@ CombinedMuonTrackBuilder::removeSpectrometerMaterial(Trk::Track*& track) const // replace track Trk::TrackInfo trackInfo = track->info(); - Trk::FitQuality* fitQuality = 0; + Trk::FitQuality* fitQuality = nullptr; if (track->fitQuality()) { fitQuality = new Trk::FitQuality(*track->fitQuality()); } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx index 4410e7a498ef124f830dc4ec38200cf023d0a4be..8a9c0c8aa7c7e6886ebc7316cb7feddc0ed745f2 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx @@ -97,7 +97,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac || indetTrack.perigeeParameters()->momentum().perp() < m_minPt) { - return 0; + return nullptr; } ++m_recoveryAttempts; @@ -107,23 +107,23 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac << " MS track " << m_printer->print(spectrometerTrack) << std::endl << m_printer->printStations(spectrometerTrack)); - const Trk::TrackParameters* lastIndetPars = 0; + const Trk::TrackParameters* lastIndetPars = nullptr; int index = static_cast<int>(indetTrack.trackParameters()->size()); while (!lastIndetPars && index > 0) { --index; - lastIndetPars = (*indetTrack.trackParameters())[index] ? (*indetTrack.trackParameters())[index] : 0; + lastIndetPars = (*indetTrack.trackParameters())[index] ? (*indetTrack.trackParameters())[index] : nullptr; } if (!lastIndetPars) { ATH_MSG_WARNING("ID track parameters don't have error matrix!"); - return 0; + return nullptr; } // track builder prefers estimate of inner, middle and outer spectrometer track parameters - const Trk::TrackParameters* innerParameters = 0; - const Trk::TrackParameters* middleParameters = 0; - const Trk::TrackParameters* outerParameters = 0; + const Trk::TrackParameters* innerParameters = nullptr; + const Trk::TrackParameters* middleParameters = nullptr; + const Trk::TrackParameters* outerParameters = nullptr; const Trk::TrackParameters* lastPars = lastIndetPars; std::vector<const Trk::TrackStateOnSurface*> stations; @@ -163,7 +163,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac continue; } - const Trk::TrackParameters* exPars = 0; + const Trk::TrackParameters* exPars = nullptr; if (lastPars->associatedSurface() == meas->associatedSurface()) { ATH_MSG_DEBUG("Using existing pars"); exPars = lastPars; @@ -193,7 +193,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac if (msgLvl(MSG::DEBUG)) { if (!m_idHelperSvc->measuresPhi(id)) { - const MuonGM::MuonReadoutElement* detEl = 0; + const MuonGM::MuonReadoutElement* detEl = nullptr; if (m_idHelperSvc->isMdt(id)) { const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(meas); @@ -253,11 +253,11 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac } } else { middleParameters = innerParameters; - innerParameters = 0; + innerParameters = nullptr; if (!middleParameters) { ATH_MSG_DEBUG("parameter extrapolation failed"); - return 0; + return nullptr; } } @@ -269,7 +269,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac delete innerParameters; delete middleParameters; delete outerParameters; - return 0; + return nullptr; } if (badEtaIndices.size() == etaIndices.size()) { @@ -277,7 +277,7 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac delete innerParameters; delete middleParameters; delete outerParameters; - return 0; + return nullptr; } Trk::MeasurementSet spectrometerMeasurements; @@ -305,11 +305,11 @@ MuidMuonRecovery::recoverableMatch(const Trk::Track& indetTrack, const Trk::Trac delete innerParameters; delete middleParameters; delete outerParameters; - return 0; + return nullptr; } // fit the combined track - Trk::Track* combinedTrack = 0; + Trk::Track* combinedTrack = nullptr; if (!m_trackBuilder.empty()) { combinedTrack = m_trackBuilder->indetExtension(indetTrack, spectrometerMeasurements, innerParameters, middleParameters, outerParameters); diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx index c431faa251751a2b9545371e84645e6f67e4886c..d6f7ce12fa211474fa56171fae5d50c2fa95bbc2 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx @@ -20,7 +20,7 @@ namespace Rec { MuonMatchQuality::MuonMatchQuality(const std::string& type, const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent), m_alignmentUncertainty(0) + : AthAlgTool(type, name, parent), m_alignmentUncertainty(nullptr) { declareInterface<IMuonMatchQuality>(this); } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx index 43d492aa387ce6fe4a966084fa47e972cce921dc..18c3ce6d9231c9965d816acf26e82a1bc10deed3 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonTrackQuery.cxx @@ -78,7 +78,7 @@ MuonTrackQuery::initialize() const CaloEnergy* MuonTrackQuery::caloEnergy(const Trk::Track& track) const { - const CaloEnergy* caloEnergy = 0; + const CaloEnergy* caloEnergy = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -126,8 +126,8 @@ MuonTrackQuery::caloEnergyDeposit(const Trk::Track& track) const return 0.; } - const Trk::TrackParameters* indetExitParameters = 0; - const Trk::TrackParameters* caloExitParameters = 0; + const Trk::TrackParameters* indetExitParameters = nullptr; + const Trk::TrackParameters* caloExitParameters = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -191,7 +191,7 @@ MuonTrackQuery::fieldIntegral(const Trk::Track& track) const Amg::Vector3D integratedMomentumKick = Amg::Vector3D(0., 0., 0.); - const Trk::TrackParameters* parameters = 0; + const Trk::TrackParameters* parameters = nullptr; // loop over TSOS to integrate vector Bdl int hit = 1; @@ -643,8 +643,8 @@ MuonTrackQuery::momentumBalanceSignificance(const Trk::Track& track) const // compare parameters with those from previous TSOS double energyBalance = 0.; - const Trk::EnergyLoss* energyLoss = 0; - const Trk::TrackParameters* previousParameters = 0; + const Trk::EnergyLoss* energyLoss = nullptr; + const Trk::TrackParameters* previousParameters = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -778,7 +778,7 @@ MuonTrackQuery::scatteringAngleSignificance(const Trk::Track& track) const // provide refit for slimmed tracks const Trk::Track* fullTrack = &track; - const Trk::Track* refittedTrack = 0; + const Trk::Track* refittedTrack = nullptr; if (isSlimmed(track)) { if (!m_fitter.empty()) { @@ -908,12 +908,12 @@ MuonTrackQuery::spectrometerParameters(const Trk::Track& track) const if (!calorimeterVolume) { ATH_MSG_WARNING("Failed to retrieve Calo volume "); - return 0; + return nullptr; } // find parameters at innermost spectrometer measurement // clone perigee if track has been slimmed - const Trk::TrackParameters* parameters = 0; + const Trk::TrackParameters* parameters = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -963,8 +963,8 @@ MuonTrackQuery::spectrometerPhiQuality(const Trk::Track& track) const // quality 0 - no additional phi measurement needed // 1 - phi direction un- (or poorly) constrained // 2 - no phi hits on track - const Trk::TrackStateOnSurface* leadingPhiMeasurement = 0; - const Trk::TrackStateOnSurface* trailingPhiMeasurement = 0; + const Trk::TrackStateOnSurface* leadingPhiMeasurement = nullptr; + const Trk::TrackStateOnSurface* trailingPhiMeasurement = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -1045,12 +1045,12 @@ MuonTrackQuery::triggerStationParameters(const Trk::Track& track) const if (!calorimeterVolume) { ATH_MSG_WARNING("Failed to retrieve Calo volume "); - return 0; + return nullptr; } // find parameters at innermost trigger station measurement // fails if track has been slimmed - const Trk::TrackParameters* parameters = 0; + const Trk::TrackParameters* parameters = nullptr; DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); for (; s != track.trackStateOnSurfaces()->end(); ++s) { @@ -1068,7 +1068,7 @@ MuonTrackQuery::triggerStationParameters(const Trk::Track& track) const parameters = (**s).trackParameters(); } - if (!parameters) return 0; + if (!parameters) return nullptr; // if necessary, flip to outgoing parameters if (parameters->momentum().dot(parameters->position()) > 0.) { @@ -1086,7 +1086,7 @@ const Trk::TrackParameters* MuonTrackQuery::flippedParameters(const Trk::TrackParameters& parameters) const { // flip parameters - const Trk::TrackParameters* flippedParams = 0; + const Trk::TrackParameters* flippedParams = nullptr; double phi = parameters.parameters()[Trk::phi0]; if (phi > 0.) { @@ -1101,7 +1101,7 @@ MuonTrackQuery::flippedParameters(const Trk::TrackParameters& parameters) const flippedParams = surface->createTrackParameters( parameters.parameters()[Trk::d0], parameters.parameters()[Trk::z0], phi, theta, qOverP, - parameters.covariance() ? new AmgSymMatrix(5)(*parameters.covariance()) : 0); + parameters.covariance() ? new AmgSymMatrix(5)(*parameters.covariance()) : nullptr); return flippedParams; } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx index d9b838834deb93e8ea74188d20e0c849d654bfa7..5601441f387b03e62cd83f7f0e470ca18d7c4138 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx @@ -43,8 +43,8 @@ OutwardsCombinedMuonTrackBuilder::OutwardsCombinedMuonTrackBuilder(const std::st const IInterface* parent) : AthAlgTool(type, name, parent), m_trackingVolumesSvc("TrackingVolumesSvc/TrackingVolumesSvc", name), - m_calorimeterVolume(0), - m_indetVolume(0), + m_calorimeterVolume(nullptr), + m_indetVolume(nullptr), m_allowCleanerVeto(true), m_cleanCombined(true), m_recoverCombined(false), @@ -184,12 +184,12 @@ OutwardsCombinedMuonTrackBuilder::indetExtension(const Trk::Track& inde // Only measurements so not needed // if(spectrometerMeas[i]->alignmentEffectsOnTrack()) continue; - Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(spectrometerMeas[i]->clone(), 0, 0, 0, typeM); + Trk::TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(spectrometerMeas[i]->clone(), nullptr, nullptr, nullptr, typeM); trajectory->push_back(tsos); } Trk::TrackInfo trackInfo(Trk::TrackInfo::Unknown, Trk::muon); - Trk::Track inputtrack2(trackInfo, trajectory, 0); + Trk::Track inputtrack2(trackInfo, trajectory, nullptr); Trk::Track* track = fit(indetTrack, inputtrack2, m_cleanCombined, Trk::muon); return track; @@ -202,7 +202,7 @@ Trk::Track* OutwardsCombinedMuonTrackBuilder::standaloneFit(const Trk::Track& /*spectrometerTrack*/, const Trk::Vertex* /*vertex*/, float /*bs_x*/, float /*bs_y*/, float /*bs_z*/) const { - return 0; + return nullptr; } @@ -257,7 +257,7 @@ OutwardsCombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrac if (vertexInFit) { std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type; type.set(Trk::TrackStateOnSurface::Measurement); - trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, 0, 0, 0, type)); + trackStateOnSurfaces->push_back(new const Trk::TrackStateOnSurface(vertexInFit, nullptr, nullptr, nullptr, type)); ATH_MSG_DEBUG(" found Perigee and added vertex " << itsos); } } @@ -321,7 +321,7 @@ OutwardsCombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrac typePatternScat.set(Trk::TrackStateOnSurface::Scatterer); const Trk::TrackStateOnSurface* newTSOS = - new Trk::TrackStateOnSurface(0, parsNew, 0, meotNew, typePatternScat); + new Trk::TrackStateOnSurface(nullptr, parsNew, nullptr, meotNew, typePatternScat); trackStateOnSurfaces->push_back(newTSOS); } @@ -345,7 +345,7 @@ OutwardsCombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrac ATH_MSG_DEBUG(" trackStateOnSurfaces found " << trackStateOnSurfaces->size() << " from total " << itsos); - Trk::Track* standaloneTrack = new Trk::Track(combinedTrack.info(), trackStateOnSurfaces, 0); + Trk::Track* standaloneTrack = new Trk::Track(combinedTrack.info(), trackStateOnSurfaces, nullptr); standaloneTrack->info().setPatternRecognitionInfo(Trk::TrackInfo::MuidStandaloneRefit); Trk::Track* refittedTrack = fit(*standaloneTrack, false, Trk::muon); @@ -353,7 +353,7 @@ OutwardsCombinedMuonTrackBuilder::standaloneRefit(const Trk::Track& combinedTrac if (!refittedTrack) { ATH_MSG_DEBUG(" OutwardsCombinedMuonTrackBuilder standaloneRefit FAILED "); - return 0; + return nullptr; } ATH_MSG_DEBUG(" OutwardsCombinedMuonTrackBuilder standaloneRefit OK "); @@ -372,14 +372,14 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOut if (particleHypothesis != Trk::muon && particleHypothesis != Trk::nonInteracting) { ATH_MSG_WARNING(" invalid particle hypothesis " << particleHypothesis << " requested. Must be 0 or 2 (nonInteracting or muon) "); - return 0; + return nullptr; } ToolHandle<Trk::ITrackFitter> fitter = m_fitter; // fit Trk::Track* fittedTrack = fitter->fit(track, false, particleHypothesis); - if (!fittedTrack) return 0; + if (!fittedTrack) return nullptr; // track cleaning if (runOutlier) { @@ -403,7 +403,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& track, const Trk::RunOut if (m_allowCleanerVeto) { delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } } else if (!(*cleanTrack->perigeeParameters() == *fittedTrack->perigeeParameters())) { ATH_MSG_VERBOSE(" found and removed spectrometer outlier(s) "); @@ -431,7 +431,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::MeasurementSet& /*measurementSe const Trk::RunOutlierRemoval /*runOutlier*/, const Trk::ParticleHypothesis /*particleHypothesis*/) const { - return 0; + return nullptr; } @@ -445,7 +445,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (particleHypothesis != Trk::muon && particleHypothesis != Trk::nonInteracting) { ATH_MSG_WARNING(" invalid particle hypothesis " << particleHypothesis << " requested. Must be 0 or 2 (nonInteracting or muon) "); - return 0; + return nullptr; } ToolHandle<Trk::ITrackFitter> fitter = m_fitter; @@ -454,13 +454,13 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T Trk::Track* fittedTrack = fitter->fit(indetTrack, extrapolatedTrack, false, particleHypothesis); if (!fittedTrack) { - return 0; + return nullptr; } if (!fittedTrack->perigeeParameters()) { ATH_MSG_WARNING(" Fitter returned a track without perigee, failing fit"); delete fittedTrack; - return 0; + return nullptr; } // track cleaning @@ -482,7 +482,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (m_allowCleanerVeto) { delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } } else if (!(*cleanTrack->perigeeParameters() == *fittedTrack->perigeeParameters())) { ATH_MSG_VERBOSE(" found and removed spectrometer outlier(s) "); @@ -534,7 +534,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (fittedTrack && !fittedTrack->perigeeParameters()) { ATH_MSG_WARNING(" Fitter returned a track without perigee, failing fit"); delete fittedTrack; - return 0; + return nullptr; } if (runOutlier && fittedTrack) { @@ -542,7 +542,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (fitqual > 5 || (fittedTrack->perigeeParameters()->pT() < 20000 && fitqual > 2.5)) { delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; } else { DataVector<const Trk::TrackStateOnSurface>::const_iterator itStates = fittedTrack->trackStateOnSurfaces()->begin(); @@ -566,7 +566,7 @@ OutwardsCombinedMuonTrackBuilder::fit(const Trk::Track& indetTrack, const Trk::T if (pullphi > 7 || pulltheta > 7) { delete fittedTrack; - fittedTrack = 0; + fittedTrack = nullptr; break; } } @@ -729,7 +729,7 @@ OutwardsCombinedMuonTrackBuilder::addIDMSerrors(Trk::Track* track) const typePatternScat.set(Trk::TrackStateOnSurface::Scatterer); const Trk::TrackStateOnSurface* newTSOS = - new Trk::TrackStateOnSurface(0, parsNew, 0, meotNew, typePatternScat); + new Trk::TrackStateOnSurface(nullptr, parsNew, nullptr, meotNew, typePatternScat); trackStateOnSurfaces->push_back(newTSOS); @@ -760,7 +760,7 @@ OutwardsCombinedMuonTrackBuilder::addIDMSerrors(Trk::Track* track) const << " trackStateOnSurfaces found " << trackStateOnSurfaces->size()); - Trk::Track* newTrack = new Trk::Track(track->info(), trackStateOnSurfaces, 0); + Trk::Track* newTrack = new Trk::Track(track->info(), trackStateOnSurfaces, nullptr); return newTrack; } diff --git a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx index b61d42bbb62c7f52a4ae84aa2d720b694c4e324c..053c0291cc56f7de23a4342b8a2542190141f5ed 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx +++ b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx @@ -24,7 +24,7 @@ #include <algorithm> -#include <math.h> +#include <cmath> #include <vector> @@ -166,29 +166,26 @@ StatusCode egammaTrkRefitterTool::refitTrack(const EventContext& ctx, cache.originalTrack, cache.electron); if(collect.m_measurements.size()>4){ - cache.refittedTrack.reset(m_ITrackFitter->fit(collect.m_measurements, - *cache.originalTrack->perigeeParameters(), - m_runOutlier, - m_ParticleHypothesis) - ); + cache.refittedTrack = + m_ITrackFitter->fit(ctx, + collect.m_measurements, + *cache.originalTrack->perigeeParameters(), + m_runOutlier, + m_ParticleHypothesis); }else { ATH_MSG_WARNING("Could **NOT** add BeamSpot information into Vector, refitting without BS"); - cache.refittedTrack.reset( - m_ITrackFitter->fit(*cache. - originalTrack, - m_runOutlier, - m_ParticleHypothesis) - ); + cache.refittedTrack = m_ITrackFitter->fit( + ctx, *cache.originalTrack, m_runOutlier, m_ParticleHypothesis); } } else { std::vector<const Trk::MeasurementBase*> measurements = getIDHits(cache.originalTrack); if(measurements.size()>4){ - cache.refittedTrack.reset( - m_ITrackFitter->fit(measurements, - *cache.originalTrack->perigeeParameters(), - m_runOutlier, - m_ParticleHypothesis) - ); + cache.refittedTrack = + m_ITrackFitter->fit(ctx, + measurements, + *cache.originalTrack->perigeeParameters(), + m_runOutlier, + m_ParticleHypothesis); } else { ATH_MSG_DEBUG("Not enough measurements on tracks"); cache.refittedTrack=nullptr; diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/TrkDeterministicAnnealingFilter/DeterministicAnnealingFilter.h b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/TrkDeterministicAnnealingFilter/DeterministicAnnealingFilter.h index 816e9f34d07afe82efda23148d09ffd9fd7b1dd1..b4f496c2b5650529f0ec07f0753da5df02b97e20 100755 --- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/TrkDeterministicAnnealingFilter/DeterministicAnnealingFilter.h +++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/TrkDeterministicAnnealingFilter/DeterministicAnnealingFilter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -68,10 +68,13 @@ public: DeterministicAnnealingFilter(); ~DeterministicAnnealingFilter(); // standard Athena methods - StatusCode initialize(); - StatusCode finalize(); - - + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; /** refit a track (the main method; it uses most information from pattern recognition): This function should normally be called with tracks containing Trk::CompetingRIOsOnTrack. @@ -80,7 +83,7 @@ public: runOutlier has no meaning in all of the DAF's fitting methods */ virtual Track* fit (const Track&, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const; + const ParticleHypothesis matEffects=Trk::nonInteracting) const override; /** refit a track adding a PrepRawDataSet: Trk::ICompetingRIOsOnTrackCreator is used to create Trk::CompetingRIOsOnTrack out of the additional PrepRawData first. @@ -90,7 +93,7 @@ public: virtual Track* fit(const Track&, const PrepRawDataSet&, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const; + const ParticleHypothesis matEffects=Trk::nonInteracting) const override; /** fit a track to a PrepRawDataSet: Trk::ICompetingRIOsOnTrackCreator is used to create Trk::CompetingRIOsOnTrack out of the additional PrepRawData first. diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_SimpleWeightCalculator.cxx b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_SimpleWeightCalculator.cxx index ef04a120660c4587656b1e87e0ee116d88a5e99d..c3bcaae2c2a9ea3e02fefa7be3df7fd6f8f3b7ac 100755 --- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_SimpleWeightCalculator.cxx +++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_SimpleWeightCalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -72,7 +72,7 @@ const std::vector< Trk::CompetingRIOsOnTrack::AssignmentProb >* Trk::DAF_SimpleW if ( ROTs->size() != trkPars->size() ) { ATH_MSG_ERROR("vector of RIO_OnTrack and TrackParameters do not have the same size: assignmentProbabilities cannot be calculated"); delete assgnProbVec; - return 0; + return nullptr; } else { // ----------------------------- // loop over ROTs to calc non-normalized assignment probabilities diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_WeightCalculator.cxx b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_WeightCalculator.cxx index fd2497591761e63ef1487e8167a1b86a6785feda..42d86ad40d0ac7178db00706d66b7c459cd20a85 100755 --- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_WeightCalculator.cxx +++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DAF_WeightCalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ const std::vector< Trk::CompetingRIOsOnTrack::AssignmentProb >* Trk::DAF_WeightC if ( ROTs->size() != trkPars->size() ) { ATH_MSG_ERROR("vector of RIO_OnTrack and TrackParameters do not have the same size: assignmentProbabilities cannot be calculated"); delete assgnProbVec; - return 0; + return nullptr; } else { // ----------------------------- // loop over ROTs to calc non-normalized assignment probbailities diff --git a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx index 807b2a89ff6d51bc6bb115d81a30562bf85aafc8..f6da1c324d8e396e658c865b9ce9ff626f27e014 100755 --- a/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx +++ b/Tracking/TrkFitter/TrkDeterministicAnnealingFilter/src/DeterministicAnnealingFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -64,8 +64,8 @@ m_FitterValidationTool(""), m_doValidation(false), m_haveValidationTool(false), m_option_callValidationToolForFailedFitsOnly(false), -m_tparScaleSetter(0), -m_utility(0), +m_tparScaleSetter(nullptr), +m_utility(nullptr), //m_inputPreparator(0), m_directionToPerigee(Trk::oppositeMomentum), m_fitStatistics(0), @@ -186,17 +186,17 @@ StatusCode Trk::DeterministicAnnealingFilter::initialize() { } // configure ForwardKalmanFitter - sc = m_forwardFitter->configureWithTools((m_extrapolator?(&(*m_extrapolator)):0), + sc = m_forwardFitter->configureWithTools((m_extrapolator?(&(*m_extrapolator)):nullptr), &(*m_updator), - 0, // no ROT creator needed! - (!m_dna.empty()?(&(*m_dna)):0), // dynamic noise adjustment tool - 0); // no alignable Surface Provider + nullptr, // no ROT creator needed! + (!m_dna.empty()?(&(*m_dna)):nullptr), // dynamic noise adjustment tool + nullptr); // no alignable Surface Provider if(sc.isFailure()) return sc; // configure KalmanSmoother - sc = m_smoother->configureWithTools( (m_extrapolator?(&(*m_extrapolator)):0), + sc = m_smoother->configureWithTools( (m_extrapolator?(&(*m_extrapolator)):nullptr), &(*m_updator), - (!m_dna.empty()?(&(*m_dna)):0), // dynamic noise adjustment tool - 0, // no alignable Surface Provider + (!m_dna.empty()?(&(*m_dna)):nullptr), // dynamic noise adjustment tool + nullptr, // no alignable Surface Provider true, // always do smoothing false); // no creation of FitQualityOnSurface objects, because the Kalman smoother // does not take assignment probabilities into account, @@ -233,7 +233,7 @@ StatusCode Trk::DeterministicAnnealingFilter::initialize() { if (msgLvl(MSG::DEBUG)) { // Set up ATLAS ID helper to be able to identify the measurement's det-subsystem. - const AtlasDetectorID* idHelper = 0; + const AtlasDetectorID* idHelper = nullptr; if (detStore()->retrieve(idHelper, "AtlasID").isFailure()) { ATH_MSG_ERROR ("Could not get AtlasDetectorID helper"); return StatusCode::FAILURE; @@ -264,14 +264,14 @@ StatusCode Trk::DeterministicAnnealingFilter::finalize() { std::cout << "-------------------------------------------------------------------------------" << std::endl; std::cout << " track fits by eta range ------All---Barrel---Trans.-- Endcap-- " << std::endl; std::vector<std::string> statusNames(0); - statusNames.push_back(" Number of fitter calls :"); - statusNames.push_back(" Number of successful track fits :"); - statusNames.push_back(" Number of calls with bad input :"); - statusNames.push_back(" Number of extrapolation failures:"); - statusNames.push_back(" fits with failed forward filter :"); - statusNames.push_back(" fits with failed smoother :"); - statusNames.push_back(" fits w/ failed outlier strategy :"); - statusNames.push_back(" fits w/ failed perigee making :"); + statusNames.emplace_back(" Number of fitter calls :"); + statusNames.emplace_back(" Number of successful track fits :"); + statusNames.emplace_back(" Number of calls with bad input :"); + statusNames.emplace_back(" Number of extrapolation failures:"); + statusNames.emplace_back(" fits with failed forward filter :"); + statusNames.emplace_back(" fits with failed smoother :"); + statusNames.emplace_back(" fits w/ failed outlier strategy :"); + statusNames.emplace_back(" fits w/ failed perigee making :"); for (unsigned int i=0; i<statusNames.size(); i++) { std::cout << (statusNames[i]) << std::setiosflags(std::ios::dec) << std::setw(iw) << (m_fitStatistics[i])[iAll] << std::setiosflags(std::ios::dec) << std::setw(iw) @@ -308,14 +308,14 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const Trk::Track& inputTrack ATH_MSG_FATAL( "need estimated track parameters near origin, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // protection against not having measurements on the input track if (!inputTrack.trackStateOnSurfaces() || inputTrack.trackStateOnSurfaces()->size() < 2) { ATH_MSG_WARNING( "called to refit empty track or track with too little information, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // determine the Track Parameter which is the start of the trajectory, @@ -382,7 +382,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const Trk::Track& inputTrack // ------------------------ // start the DAF procedure: - Track* theTrack = 0; + Track* theTrack = nullptr; if (minPar) { ATH_MSG_VERBOSE( "got track parameters near origine" ); // do the DAF fit @@ -420,7 +420,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const Trk::PrepRawDataSet& , //bool verbose = (m_log.level() <= MSG::VERBOSE); ATH_MSG_ERROR( "fit(PRDset, , ) not implemented" ); - return 0; + return nullptr; } ////////////////////////////////////////////// @@ -435,7 +435,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit( const Trk::MeasurementSet& if ( inputMeasSet.empty() ) { monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } //monitorTrackFits( Call, estimatedStartParameters.eta() ); @@ -516,7 +516,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const Track&, const ParticleHypothesis) const { //bool verbose = (m_log.level() <= MSG::VERBOSE); ATH_MSG_ERROR( "fit(Track, PRDset, , ) not implemented" ); - return 0; + return nullptr; } ////////////////////////////////////////////// @@ -538,21 +538,21 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit( const Trk::Track& ATH_MSG_ERROR( "need estimated track parameters near origine, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // protection against not having Measurements if (inputTrack.measurementsOnTrack()->empty()) { ATH_MSG_ERROR( "try to fit track+vec<MB> with an empty track, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // protection, if empty MeasurementSet if (addMeasColl.empty()) { ATH_MSG_ERROR( "try to add an empty MeasurementSet to the track, reject fit" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } @@ -602,7 +602,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit( const Trk::Track& ATH_MSG_WARNING( "Cannot get valid track parameters from input track, reject fit!" ); monitorTrackFits( Call, 100. ); monitorTrackFits( BadInput, 100. ); - return 0; + return nullptr; } // fit set of MeasurementBase using main method, // start with first TrkParameter in inputTrack @@ -633,7 +633,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit(const SpacePointSet&, //bool verbose = (m_log.level() <= MSG::VERBOSE); ATH_MSG_ERROR( "fit(SpacePointSet, , , ) does not make sense for the Deterministic Annealing Filter, return NULL" ); - return 0; + return nullptr; } /////////////////////////////////////// // combined fit of two tracks @@ -643,7 +643,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::fit( const Trk::Track&, const Trk::RunOutlierRemoval, const Trk::ParticleHypothesis ) const { ATH_MSG_ERROR( "fit(Track, Track, ...) not implemented yet, return NULL pointer" ); - return 0; + return nullptr; } ///////////////////////////////// @@ -757,8 +757,8 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( ATH_MSG_VERBOSE( "-----> enter DeterministicAnnealingFilter::doDAFfit()" ); const TrackParameters* estimatedStartParameters = &trkPar; - const TrackParameters* clonedParameters = 0; - FitQuality* fitQual = 0; + const TrackParameters* clonedParameters = nullptr; + FitQuality* fitQual = nullptr; KalmanMatEffectsController controlledMatEff(matEffects, !m_dna.empty()); //---------------------------------- @@ -801,7 +801,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( // extrapolate previous track parameters to the surface of the outlier: // TODO search of the next valid TrackParameters can be coded more elegantly: - const Trk::TrackParameters* previousTrkPar = 0; + const Trk::TrackParameters* previousTrkPar = nullptr; Trk::PropDirection direction = Trk::alongMomentum; Trajectory::const_iterator it2 = it; while (!previousTrkPar) { @@ -842,7 +842,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( CompetingRIOsOnTrack* newCompROT = compROT->clone(); m_compROTcreator->updateCompetingROT(*newCompROT, *extrapolatedTrkPar, m_option_annealingScheme[annealingIteration]); delete extrapolatedTrkPar; - extrapolatedTrkPar = 0; + extrapolatedTrkPar = nullptr; it->replaceMeasurement(newCompROT); compROT = newCompROT; } @@ -889,7 +889,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( } //m_smoother->clearFitResultsAfterOutlier(m_trajectory,fitQual,1); delete fitQual; - fitQual = 0; + fitQual = nullptr; ATH_MSG_VERBOSE( endmsg << "********** call forward kalman filter, iteration #"<< annealingIteration << " **********" << endmsg ); } // end if(annealingIteration > 0 ) @@ -906,7 +906,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( ATH_MSG_DEBUG( "forward fitter #" << annealingIteration << " rejected fit" << endmsg << endmsg ); monitorTrackFits( ForwardFilterFailure, estimatedStartParameters->eta(), annealingIteration); if (m_doValidation) callValidation(annealingIteration, matEffects, fitstatus); - return 0; + return nullptr; } if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << endmsg << "********** Forward fit passed, now call smoother #" @@ -921,7 +921,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( if (fitstatus.isFailure()) { ATH_MSG_DEBUG( "smoother #" << annealingIteration << " rejected fit" << endmsg << endmsg ); monitorTrackFits( SmootherFailure, estimatedStartParameters->eta(), annealingIteration ); - return 0; + return nullptr; } if (msgLvl(MSG::VERBOSE)) { msg(MSG::VERBOSE) << endmsg @@ -932,12 +932,12 @@ Trk::Track* Trk::DeterministicAnnealingFilter::doDAFfitWithKalman( //if (m_option_doValidationAction) m_extrapolator->validationAction(); delete clonedParameters; - clonedParameters = 0; + clonedParameters = nullptr; } // end for: annealing iteration loop // FitQuality is calculate in makeTrack() to take assignment probabilties into account, delete the one // made by the smoother delete fitQual; - fitQual = 0; + fitQual = nullptr; return makeTrack(matEffects); } @@ -1103,7 +1103,7 @@ Trk::Track* Trk::DeterministicAnnealingFilter::makeTrack(const Trk::ParticleHypo const Trk::TrackStateOnSurface* Trk::DeterministicAnnealingFilter::internallyMakePerigee( const Trk::PerigeeSurface& perSurf, const Trk::ParticleHypothesis matEffects) const { - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; Trajectory::const_iterator it = m_trajectory.begin(); while (!nearestParam) { // FIXME this can be coded more elegantly if (!it->isOutlier() && (it->smoothedTrackParameters())) { @@ -1111,7 +1111,7 @@ const Trk::TrackStateOnSurface* Trk::DeterministicAnnealingFilter::internallyMak } else { if (it == m_trajectory.end()) { ATH_MSG_ERROR( "Perigee-making failed: no useful parameters on track!" ); - return 0; + return nullptr; } } ++it; @@ -1121,13 +1121,13 @@ const Trk::TrackStateOnSurface* Trk::DeterministicAnnealingFilter::internallyMak m_directionToPerigee, false, matEffects); if (!per) { ATH_MSG_WARNING( "Perigee-making failed: extrapolation did not succeed." ); - return 0; + return nullptr; } else { ATH_MSG_VERBOSE( "Perigee parameters have been made." ); } std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Perigee); - TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(0, per, 0, 0, typePattern); + TrackStateOnSurface* tsos = new Trk::TrackStateOnSurface(nullptr, per, nullptr, nullptr, typePattern); return tsos; } @@ -1216,22 +1216,22 @@ void Trk::DeterministicAnnealingFilter::addToTrajectory(const MeasurementBase* m const Trk::TrackStateOnSurface* Trk::DeterministicAnnealingFilter::createStateFromProtoState(ProtoTrackStateOnSurface& protoState) const { - if (!(protoState.measurement())) return 0; + if (!(protoState.measurement())) return nullptr; // set correct TrackStateOnSurfaceType std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0); // create the TrackStateOnSurface const Trk::MaterialEffectsBase* mefot = protoState.dnaMaterialEffects() ? - protoState.dnaMaterialEffects()->makeMEFOT() : 0; + protoState.dnaMaterialEffects()->makeMEFOT() : nullptr; if (protoState.isOutlier()) { typePattern.set(TrackStateOnSurface::Outlier); // do not use the track parameters for outliers return new TrackStateOnSurface( protoState.checkoutMeasurement(), - 0,0,0,typePattern ); + nullptr,nullptr,nullptr,typePattern ); } else { typePattern.set(TrackStateOnSurface::Measurement); return new TrackStateOnSurface( protoState.checkoutMeasurement(), // the measurement protoState.checkoutSmoothedPar(), // smoothed track parameter - 0, // no fit quality + nullptr, // no fit quality mefot, // no material effects typePattern ); // type pattern } @@ -1263,7 +1263,7 @@ void Trk::DeterministicAnnealingFilter::callValidation( int iterationIndex, ATH_MSG_DEBUG( "call validation for track iteration " << iterationIndex << "with status " << fitStatCode.getCode() << "/" << fitStatCode ); // extrapolate to perigee at origin for validation data const Trk::PerigeeSurface perSurf; // default perigee at origin - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; Trajectory::const_iterator it = m_trajectory.begin(); for ( ; it != m_trajectory.end(); it++ ) { // FIXME this can be coded more elegantly if (!it->isOutlier() && (it->smoothedTrackParameters())) { @@ -1279,8 +1279,8 @@ void Trk::DeterministicAnnealingFilter::callValidation( int iterationIndex, } } } - const Trk::Perigee* per = 0; - const Trk::TrackParameters* perPar = 0; + const Trk::Perigee* per = nullptr; + const Trk::TrackParameters* perPar = nullptr; if (nearestParam) { // extrapolate to perigee perPar = m_extrapolator->extrapolate( *nearestParam, perSurf, diff --git a/Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/DistributedKalmanFilter.h b/Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/DistributedKalmanFilter.h index 06a21e3500a60cce2a2f513366910592ae2703c9..8598627a48969774b41995ce88116fb2fbab64d5 100755 --- a/Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/DistributedKalmanFilter.h +++ b/Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/DistributedKalmanFilter.h @@ -56,7 +56,12 @@ namespace Trk { // Filter settings: // RunOutlierRemoval - use logic to remove bad hits // ParticleHypothesis - allow for multiple scattering and energy loss? - + + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; virtual Track* fit(const Track&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting) const; diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/CMakeLists.txt b/Tracking/TrkFitter/TrkFitterInterfaces/CMakeLists.txt index a51e02ba0ce5e7b3e840d421c21e800b933f4f9d..ab951dad449bd7cee8985834fbc9c7116d4b5ca8 100644 --- a/Tracking/TrkFitter/TrkFitterInterfaces/CMakeLists.txt +++ b/Tracking/TrkFitter/TrkFitterInterfaces/CMakeLists.txt @@ -12,10 +12,11 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParameters + Tracking/TrkEvent/TrkTrack Tracking/TrkFitter/TrkFitterUtils ) # Component(s) in the package: atlas_add_library( TrkFitterInterfaces PUBLIC_HEADERS TrkFitterInterfaces - LINK_LIBRARIES AthContainers EventPrimitives GaudiKernel TrkEventPrimitives TrkParameters TrkFitterUtils ) + LINK_LIBRARIES AthContainers EventPrimitives GaudiKernel TrkEventPrimitives TrkParameters TrkTrack TrkFitterUtils ) diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IDynamicNoiseAdjustor.h b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IDynamicNoiseAdjustor.h index 7fe90ce80a6b7e1ea28967f3204e421e8f9bf429..a74ce0a9d3d6c2bef1442d45d80c5e55be8551fa 100755 --- a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IDynamicNoiseAdjustor.h +++ b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IDynamicNoiseAdjustor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -56,7 +56,7 @@ public: const MeasurementBase*, const Trk::KalmanMatEffectsController&, PropDirection, - const DNA_MaterialEffects* = 0) const = 0; + const DNA_MaterialEffects* = nullptr) const = 0; // virtual double calculateDna(double, double, double) const = 0; diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IForwardKalmanFitter.h b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IForwardKalmanFitter.h index 2f58fbeaf367822128e07898cb20d5cd357df963..30e7fc7bb1967b2261a98a2ec69496e2f6c1e72a 100755 --- a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IForwardKalmanFitter.h +++ b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IForwardKalmanFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -62,10 +62,10 @@ namespace Trk { */ virtual StatusCode configureWithTools(const IExtrapolator*, const IUpdator*, const IRIO_OnTrackCreator*, - const IDynamicNoiseAdjustor* = 0, - const IAlignableSurfaceProvider* = 0, - const IMeasurementRecalibrator* = 0, - const IKalmanPiecewiseAnnealingFilter* =0 ) = 0; + const IDynamicNoiseAdjustor* = nullptr, + const IAlignableSurfaceProvider* = nullptr, + const IMeasurementRecalibrator* = nullptr, + const IKalmanPiecewiseAnnealingFilter* =nullptr ) = 0; /** @brief forward kalman filter working on a set of PrepRawData, for example intended for fitting during pattern regognition diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IKalmanPiecewiseAnnealingFilter.h b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IKalmanPiecewiseAnnealingFilter.h index 0bcdc675208ce2ae4611507b055f6965971e715a..37bf69d7ed9545d99078fb4f4951c0663e276917 100644 --- a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IKalmanPiecewiseAnnealingFilter.h +++ b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/IKalmanPiecewiseAnnealingFilter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ namespace Trk const IUpdator*, const IMeasurementRecalibrator*, const ProtoTrajectoryUtility*, - const IDynamicNoiseAdjustor* = 0 ) = 0; + const IDynamicNoiseAdjustor* = nullptr ) = 0; /** @brief run DAF on the full trajectory, starting from first fittable state and parameters therein, do not do last smoother */ diff --git a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/ITrackFitter.h b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/ITrackFitter.h index 7342e6a52a2bd8f2a72b76cf56bbda8ccb54e5e2..60fe43887dcd3271986b442de2acc9a29d8218c9 100755 --- a/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/ITrackFitter.h +++ b/Tracking/TrkFitter/TrkFitterInterfaces/TrkFitterInterfaces/ITrackFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -17,10 +17,11 @@ #include "TrkFitterUtils/FitterStatusCode.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkParameters/TrackParameters.h" - +#include "GaudiKernel/EventContext.h" +#include "TrkTrack/Track.h" namespace Trk { - class Track; //!> ATLAS standard track class + class Track; //!> ATLAS standard track class static const InterfaceID IID_ITrackFitter("ITrackFitter",1,0); @@ -37,7 +38,16 @@ namespace Trk { Regarding athena, it is implemented using the IAlgTool inheritance, so fitter implementations should be a component_library. + Athena MT notes, there are 2 sets of methods + 1. EventContext aware returning unique_ptr + 2. Without EventContext returning plain ptr. + + By default the ones set call the other, so a client needs + to implement only one of the 2. + This is needed to facilitate migration + @author M. Elsing, W. Liebig <http://consult.cern.ch/xwho> + @author C. Anastopoulos (Athena MT) */ class ITrackFitter : virtual public IAlgTool { @@ -50,22 +60,150 @@ namespace Trk { { return IID_ITrackFitter; } - /** RE-FIT A TRACK. - Since it is not our but the fitter model's decision if to - re-fit on PRD or ROT level, it is made pure virtual. */ - virtual Track* fit (const Track&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + /* + * First the context aware retun unique_ptr + * methods. + * If this set is not overloaded , it + * will call the methods without EventContext + */ + + /** Event context aware (Athena MT) RE-FIT A TRACK. */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track& track, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>(fit(track, runOutlier, matEffects)); + } + /** Event context aware (Athena MT) RE-FIT A TRACK, ADDING A PRD SET. + this method will disintegrate the track back to PRD + and call the fit(PRDset) method. + */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track& track, + const PrepRawDataSet& prepRawSet, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + + (void)(ctx); + return std::unique_ptr<Track>( + fit(track, prepRawSet, runOutlier, matEffects)); + } + /** Event context aware FIT A TRACK TO A SET OF PrepRawData. + Main fit method. The TrackParameters is a first + estimate for the track, represented close to the origin. + Use-cases can be thought of that make it necessary + to control toggling outlier removal and material effects not + via job options (once-per-job) but at each call (toggle + within event, large set of fast fit followed by one final full fit). + */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const PrepRawDataSet& prepRawSet, + const TrackParameters& params, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>( + fit(prepRawSet, params, runOutlier, matEffects)); + } + + /** Event context aware RE-FIT A TRACK, ADDING A FITTABLE MEASUREMENT SET. + this method will use the vector of measurements from the + existing track and refit adding the new measurements. The code + is in this class, but can be overwritten by inheriting classes. + */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track& track, + const MeasurementSet& measSet, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>( + fit(track, measSet, runOutlier, matEffects)); + } + + /** Event context aware FIT A TRACK TO A SET OF MEASUREMENTBASE. + Main fit method. The TrackParameters is a first + estimate for the track, represented close to the origin. + */ + virtual std::unique_ptr<Track> fit( + const ::EventContext& ctx, + const MeasurementSet& measSet, + const TrackParameters& params, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>( + fit(measSet, params, runOutlier, matEffects)); + } + + /** Event context aware COMBINE TWO TRACKS BY REFITTING. + Specifically designed for combined muon fits, allowing to extract + extra informations (ID-exit & MS-entrance parameters, layers, Mefos) + from already fitted tracks. + */ + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track& track1, + const Track& track2, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + (void)(ctx); + return std::unique_ptr<Track>( + fit(track1, track2, runOutlier, matEffects)); + } + + /* + * Then the context unaware retun unique_ptr + * methods. + * If this set is not overloaded , it + * will call the methods with EventContext + */ + + /** RE-FIT A TRACK. + It is the fitter model's decision if to + re-fit on PRD or ROT level*/ + virtual Track* fit( + const Track& track, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + return fit(Gaudi::Hive::currentContext(), + track, + runOutlier, + matEffects).release(); + } /** RE-FIT A TRACK, ADDING A PRD SET. this method will disintegrate the track back to PRD and call the fit(PRDset) method. The code is in this class, but can be overwritten by inheriting classes. */ - virtual Track* fit(const Track&, - const PrepRawDataSet&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + virtual Track* fit( + const Track& track, + const PrepRawDataSet& prepRawSet, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + + return fit(Gaudi::Hive::currentContext(), + track, + prepRawSet, + runOutlier, + matEffects) + .release(); + } + /** FIT A TRACK TO A SET OF PrepRawData. Main fit method. The TrackParameters is a first estimate for the track, represented close to the origin. @@ -74,48 +212,85 @@ namespace Trk { via job options (once-per-job) but at each call (toggle within event, large set of fast fit followed by one final full fit). */ - virtual Track* fit(const PrepRawDataSet&, - const TrackParameters&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + virtual Track* fit( + const PrepRawDataSet& prepRawSet, + const TrackParameters& params, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + return fit(Gaudi::Hive::currentContext(), + prepRawSet, + params, + runOutlier, + matEffects) + .release(); + } + /** RE-FIT A TRACK, ADDING A FITTABLE MEASUREMENT SET. this method will use the vector of measurements from the existing track and refit adding the new measurements. The code is in this class, but can be overwritten by inheriting classes. */ - - virtual Track* fit(const Track&, - const MeasurementSet&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + virtual Track* fit( + const Track& track, + const MeasurementSet& measSet, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + return fit(Gaudi::Hive::currentContext(), + track, + measSet, + runOutlier, + matEffects) + .release(); + } /** FIT A TRACK TO A SET OF MEASUREMENTBASE. Main fit method. The TrackParameters is a first estimate for the track, represented close to the origin. */ - virtual Track* fit(const MeasurementSet&, - const TrackParameters&, + virtual Track* fit(const MeasurementSet& measSet, + const TrackParameters& params, const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; + const ParticleHypothesis matEffects=Trk::nonInteracting) const + { + + return fit(Gaudi::Hive::currentContext(), + measSet, + params, + runOutlier, + matEffects) + .release(); + } /** COMBINE TWO TRACKS BY REFITTING. Specifically designed for combined muon fits, allowing to extract extra informations (ID-exit & MS-entrance parameters, layers, Mefos) from already fitted tracks. */ - virtual Track* fit(const Track&, - const Track&, - const RunOutlierRemoval runOutlier=false, - const ParticleHypothesis matEffects=Trk::nonInteracting) const = 0; - - /** provides way of getting more detailed information about failing fits than NULL track pointer */ - virtual FitterStatusCode statusCodeOfLastFit() const; + virtual Track* fit( + const Track& track1, + const Track& track2, + const RunOutlierRemoval runOutlier = false, + const ParticleHypothesis matEffects = Trk::nonInteracting) const + { + return fit(Gaudi::Hive::currentContext(), + track1, + track2, + runOutlier, + matEffects) + .release(); + } + /** provides way of getting more detailed information about failing fits + * than NULL track pointer */ + virtual FitterStatusCode statusCodeOfLastFit() const; - }; // end of class + }; // end of class } // end of namespace // wait until all fitters have it implemented -inline Trk::FitterStatusCode Trk::ITrackFitter::statusCodeOfLastFit() const +inline Trk::FitterStatusCode +Trk::ITrackFitter::statusCodeOfLastFit() const { return Trk::FitterStatusCode::Success; } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h index 3fee5b8a477265ee0e72597666d174c9a71100df..160dcea5aa5e442f31e82db531a4a802871c9989 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h @@ -21,6 +21,7 @@ #include "GaudiKernel/IChronoStatSvc.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/EventContext.h" #include <atomic> @@ -55,31 +56,38 @@ public: /** Refit a track using the Gaussian Sum Filter */ - virtual Track* fit(const Track&, - const RunOutlierRemoval outlierRemoval = false, - const ParticleHypothesis particleHypothesis = - nonInteracting) const override final; + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const Track&, + const RunOutlierRemoval outlierRemoval = false, + const ParticleHypothesis particleHypothesis = + nonInteracting) const override final; /** Fit a collection of 'PrepRawData' objects using the Gaussian Sum Filter - This requires that an trackParameters object be supplied also as an initial guess */ - virtual Track* fit(const PrepRawDataSet&, - const TrackParameters&, - const RunOutlierRemoval outlierRemoval = false, - const ParticleHypothesis particleHypothesis = - nonInteracting) const override final; + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const PrepRawDataSet&, + const TrackParameters&, + const RunOutlierRemoval outlierRemoval = false, + const ParticleHypothesis particleHypothesis = + nonInteracting) const override final; /** Fit a collection of 'RIO_OnTrack' objects using the Gaussian Sum Filter - This requires that an trackParameters object be supplied also as an initial guess */ - virtual Track* fit(const MeasurementSet&, - const TrackParameters&, - const RunOutlierRemoval outlierRemoval = false, - const ParticleHypothesis particleHypothesis = - nonInteracting) const override final; + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, + const MeasurementSet&, + const TrackParameters&, + const RunOutlierRemoval outlierRemoval = false, + const ParticleHypothesis particleHypothesis = + nonInteracting) const override final; /** Refit a track adding a PrepRawDataSet - Not done! */ - virtual Track* fit( + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, const Track&, const PrepRawDataSet&, const RunOutlierRemoval runOutlier = false, @@ -88,14 +96,16 @@ public: /** Refit a track adding a RIO_OnTrack set - This has no form of outlier rejection and will use all hits on orginal track... i.e. very basic impleneation at the moment*/ - virtual Track* fit( + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, const Track&, const MeasurementSet&, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting) const override final; /** Combine two tracks by refitting - Not done! */ - virtual Track* fit( + virtual std::unique_ptr<Track> fit( + const EventContext& ctx, const Track&, const Track&, const RunOutlierRemoval runOutlier = false, diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx index eff345b24e9fbc0c5e08a26d1d1f471974ad583b..84097f46c88a6e2930267b25884c5a9c1a62ea75 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx @@ -170,8 +170,9 @@ Trk::GaussianSumFitter::finalize() /* * Refitting of a track */ -Trk::Track* +std::unique_ptr<Trk::Track> Trk::GaussianSumFitter::fit( + const EventContext& ctx, const Trk::Track& inputTrack, const Trk::RunOutlierRemoval outlierRemoval, const Trk::ParticleHypothesis particleHypothesis) const @@ -227,7 +228,8 @@ Trk::GaussianSumFitter::fit( } // Apply GSF fit to MeasurementBase objects - return fit(measurementSet, + return fit(ctx, + measurementSet, *parametersNearestReference, outlierRemoval, particleHypothesis); @@ -275,7 +277,8 @@ Trk::GaussianSumFitter::fit( } // Apply GSF fit to PrepRawData objects - return fit(prepRawDataSet, + return fit(ctx, + prepRawDataSet, *parametersNearestReference, outlierRemoval, particleHypothesis); @@ -285,8 +288,9 @@ Trk::GaussianSumFitter::fit( Fitting of a set of PrepRawData objects */ -Trk::Track* +std::unique_ptr<Trk::Track> Trk::GaussianSumFitter::fit( + const EventContext& ctx, const Trk::PrepRawDataSet& prepRawDataSet, const Trk::TrackParameters& estimatedParametersNearOrigin, const Trk::RunOutlierRemoval outlierRemoval, @@ -320,7 +324,6 @@ Trk::GaussianSumFitter::fit( prdComparisonFunction); } - const EventContext& ctx= Gaudi::Hive::currentContext(); // Perform GSF forwards fit ForwardTrajectory* forwardTrajectory = m_forwardGsfFitter @@ -365,8 +368,6 @@ Trk::GaussianSumFitter::fit( return nullptr; } - Track* fittedTrack = nullptr; - if (m_makePerigee) { const Trk::MultiComponentStateOnSurface* perigeeMultiStateOnSurface = this->makePerigee(ctx,smoothedTrajectory, particleHypothesis); @@ -393,17 +394,16 @@ Trk::GaussianSumFitter::fit( Trk::TrackInfo info(Trk::TrackInfo::GaussianSumFilter, particleHypothesis); info.setTrackProperties(TrackInfo::BremFit); info.setTrackProperties(TrackInfo::BremFitSuccessful); - fittedTrack = new Track(info, smoothedTrajectory, fitQuality); - - return fittedTrack; + return std::make_unique<Track>(info, smoothedTrajectory, fitQuality); } /* * Fitting of a set of MeasurementBase objects */ -Trk::Track* +std::unique_ptr<Trk::Track> Trk::GaussianSumFitter::fit( + const EventContext& ctx, const Trk::MeasurementSet& measurementSet, const Trk::TrackParameters& estimatedParametersNearOrigin, const Trk::RunOutlierRemoval outlierRemoval, @@ -465,7 +465,6 @@ Trk::GaussianSumFitter::fit( measurementBaseComparisonFunction); } - const EventContext& ctx = Gaudi::Hive::currentContext(); // Perform GSF forwards fit - new memory allocated in forwards fitter ForwardTrajectory* forwardTrajectory = m_forwardGsfFitter @@ -540,13 +539,12 @@ Trk::GaussianSumFitter::fit( Trk::TrackInfo info(Trk::TrackInfo::GaussianSumFilter, particleHypothesis); info.setTrackProperties(TrackInfo::BremFit); info.setTrackProperties(TrackInfo::BremFitSuccessful); - Track* fittedTrack = new Track(info, smoothedTrajectory, fitQuality); - - return fittedTrack; + return std::make_unique<Track>(info, smoothedTrajectory, fitQuality); } -Trk::Track* -Trk::GaussianSumFitter::fit(const Track& intrk, +std::unique_ptr<Trk::Track> +Trk::GaussianSumFitter::fit(const EventContext& ctx, + const Track& intrk, const PrepRawDataSet& addPrdColl, const RunOutlierRemoval runOutlier, const ParticleHypothesis matEffects) const @@ -556,7 +554,7 @@ Trk::GaussianSumFitter::fit(const Track& intrk, if (addPrdColl.empty()) { ATH_MSG_WARNING( "client tries to add an empty PrepRawDataSet to the track fit."); - return fit(intrk, runOutlier, matEffects); + return fit(ctx, intrk, runOutlier, matEffects); } /* determine the Track Parameter which is the start of the trajectory, @@ -584,11 +582,13 @@ Trk::GaussianSumFitter::fit(const Track& intrk, delete inputPreparator; - return fit(orderedPRDColl, *estimatedStartParameters, runOutlier, matEffects); + return fit( + ctx, orderedPRDColl, *estimatedStartParameters, runOutlier, matEffects); } -Trk::Track* -Trk::GaussianSumFitter::fit(const Track& inputTrack, +std::unique_ptr<Trk::Track> +Trk::GaussianSumFitter::fit(const EventContext& ctx, + const Track& inputTrack, const MeasurementSet& measurementSet, const RunOutlierRemoval runOutlier, const ParticleHypothesis matEffects) const @@ -598,7 +598,7 @@ Trk::GaussianSumFitter::fit(const Track& inputTrack, if (measurementSet.empty()) { ATH_MSG_WARNING( "Client tries to add an empty MeasurementSet to the track fit."); - return fit(inputTrack, runOutlier, matEffects); + return fit(ctx, inputTrack, runOutlier, matEffects); } // Check that the input track has well defined parameters @@ -624,11 +624,13 @@ Trk::GaussianSumFitter::fit(const Track& inputTrack, inputTrack, measurementSet, true, false); // Apply GSF fit to MeasurementBase objects - return fit(combinedMS, *parametersNearestReference, runOutlier, matEffects); + return fit( + ctx, combinedMS, *parametersNearestReference, runOutlier, matEffects); } -Trk::Track* -Trk::GaussianSumFitter::fit(const Track& intrk1, +std::unique_ptr<Trk::Track> +Trk::GaussianSumFitter::fit(const EventContext& ctx, + const Track& intrk1, const Track& intrk2, const RunOutlierRemoval runOutlier, const ParticleHypothesis matEffects) const @@ -690,7 +692,7 @@ Trk::GaussianSumFitter::fit(const Track& intrk1, ms.push_back((*itStates2)->measurementOnTrack()); } - return fit(ms, *minPar, runOutlier, matEffects); + return fit(ctx, ms, *minPar, runOutlier, matEffects); } const Trk::MultiComponentStateOnSurface* diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h index eed6c07f1cae6489a33f290f41e66765b8f17936..cc37d08003c335187385a3f96e6fd47377c34593 100755 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h @@ -148,49 +148,54 @@ namespace Trk { virtual ~ GlobalChi2Fitter(); - StatusCode initialize(); - StatusCode finalize(); - + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; + virtual Track *fit( const PrepRawDataSet &, - const TrackParameters &, + const TrackParameters &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track *fit( const Track &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track *fit( const MeasurementSet &, const TrackParameters &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override ; virtual Track *fit( const Track &, const PrepRawDataSet &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track *fit( const Track &, const Track &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track *fit( const Track &, const MeasurementSet &, const RunOutlierRemoval runOutlier = false, const ParticleHypothesis matEffects = nonInteracting - ) const; + ) const override; virtual Track* alignmentFit( AlignmentCache&, diff --git a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardKalmanFitter.h b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardKalmanFitter.h index 869cca2e2d6ddebc39ca531307a9cbb864e313c0..5626b399f11d7d5383e9cf50c53ced5fd48a6f26 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardKalmanFitter.h +++ b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardKalmanFitter.h @@ -67,10 +67,10 @@ public: */ virtual StatusCode configureWithTools(const Trk::IExtrapolator*, const Trk::IUpdator*, const Trk::IRIO_OnTrackCreator*, - const Trk::IDynamicNoiseAdjustor* = 0, - const Trk::IAlignableSurfaceProvider* = 0, - const Trk::IMeasurementRecalibrator* = 0, - const Trk::IKalmanPiecewiseAnnealingFilter* = 0); + const Trk::IDynamicNoiseAdjustor* = nullptr, + const Trk::IAlignableSurfaceProvider* = nullptr, + const Trk::IMeasurementRecalibrator* = nullptr, + const Trk::IKalmanPiecewiseAnnealingFilter* = nullptr); //! standard athena AlgTool initialize StatusCode initialize(); @@ -131,7 +131,7 @@ private: //! internal method printing the current state void printGlobalParams(int istate, std::string ptype, const TrackParameters*, - const DNA_MaterialEffects* = 0) const; + const DNA_MaterialEffects* = nullptr) const; // all toolhandles are passed in through a configure method, for reasons of // consistency among the KF-subtools and to avoid recursive tool retrieval diff --git a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardRefTrackKalmanFitter.h b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardRefTrackKalmanFitter.h index ae91959aca55516bda0d3cd5eb585e84011a68de..5e1ef675f133ee25ea486b98515ee9ff926d87e9 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardRefTrackKalmanFitter.h +++ b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/ForwardRefTrackKalmanFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -68,10 +68,10 @@ public: */ virtual StatusCode configureWithTools(const Trk::IExtrapolator*, const Trk::IUpdator*, const Trk::IRIO_OnTrackCreator*, - const Trk::IDynamicNoiseAdjustor* = 0, - const Trk::IAlignableSurfaceProvider* =0, - const Trk::IMeasurementRecalibrator* = 0, - const Trk::IKalmanPiecewiseAnnealingFilter* =0); + const Trk::IDynamicNoiseAdjustor* = nullptr, + const Trk::IAlignableSurfaceProvider* =nullptr, + const Trk::IMeasurementRecalibrator* = nullptr, + const Trk::IKalmanPiecewiseAnnealingFilter* =nullptr); //! standard athena AlgTool initialize StatusCode initialize(); diff --git a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanFitter.h b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanFitter.h index a8323a0950873d6b39b1a81cdc6c483256a30fa2..7fc1fc20363e748adf405e58a71d9a124c143721 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanFitter.h +++ b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -72,49 +72,54 @@ namespace Trk { virtual ~KalmanFitter(); // standard Athena methods - StatusCode initialize(); - StatusCode finalize(); - + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; + //! refit a track virtual Track* fit(const Track&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! fit a set of PrepRawData objects virtual Track* fit(const PrepRawDataSet&, const TrackParameters&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! fit a set of MeasurementBase objects virtual Track* fit(const MeasurementSet&, const TrackParameters&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! extend a track fit including a new set of PrepRawData objects virtual Track* fit(const Track&, const PrepRawDataSet&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! extend a track fit including a new set of MeasurementBase objects virtual Track* fit(const Track&, const MeasurementSet&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; //! combined track fit virtual Track* fit(const Track&, const Track&, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting - ) const; + ) const override; /** @brief retrieve statuscode of last fit. diff --git a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanSmoother.h b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanSmoother.h index 6641f8efaedf43b17092014e43e97aa081bfa846..54719f5163546608eaff2f224c853e70aeeb774f 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanSmoother.h +++ b/Tracking/TrkFitter/TrkKalmanFitter/TrkKalmanFitter/KalmanSmoother.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ private: //! internal method printing the current state (debugging) void printGlobalParams(int istate, std::string ptype, const TrackParameters*, - const DNA_MaterialEffects* = 0) const; + const DNA_MaterialEffects* = nullptr) const; /** @brief method trying to define inital error for bw smoother in a smart way. diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx index d62ceec819a4b95d30d0ecd95102bd862e737d1a..83d12fba83811c42d25128f5194c50fb801b7ac7 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx @@ -179,7 +179,7 @@ Trk::ForwardKalmanFitter::fit(Trk::Trajectory& trajectory, ATH_MSG_VERBOSE ("Prepare the old start parameters..."); // copy input TrkParameter into prediction without Errors const TrackParameters* updatedPar = estParamNear0.clone(); - Trk::ProtoTrackStateOnSurface* bremStateIfBremFound = 0; + Trk::ProtoTrackStateOnSurface* bremStateIfBremFound = nullptr; // loop over all PreRawData objects in Set int itcounter=1; @@ -253,8 +253,8 @@ Trk::ForwardKalmanFitter::fit(Trk::Trajectory& trajectory, } if (allowRecalibrate) m_utility->identifyMeasurements(trajectory); Trk::Trajectory::iterator it = m_utility->firstFittableState(trajectory); - const TrackParameters* updatedPar = 0; // delete & remake during filter - Trk::ProtoTrackStateOnSurface* bremStateIfBremFound = 0; + const TrackParameters* updatedPar = nullptr; // delete & remake during filter + Trk::ProtoTrackStateOnSurface* bremStateIfBremFound = nullptr; ATH_MSG_DEBUG ("-F- entering FwFilter with matEff="<<controlledMatEffects.particleType()<< ", "<<(allowRecalibrate?"recalibrate:yes":"recalibrate:no")<< " and start state "<<filterStartState); @@ -375,7 +375,7 @@ const Trk::TrackParameters* Trk::ForwardKalmanFitter::predict m_alignableSurfaceProvider->retrieveAlignableSurface(nominalDestSurface): nominalDestSurface ; - const Trk::TrackParameters* predPar = 0; + const Trk::TrackParameters* predPar = nullptr; if (filterCounter == 1) { //////////////////////////////////////////////////////////////////////////// @@ -468,7 +468,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::buildAndAnalyseTrajectory Trk::ProtoTrackStateOnSurface*& bremEffectsState, const bool allowRecalibrate) const { - bremEffectsState = 0; // means no brem + bremEffectsState = nullptr; // means no brem const MeasurementBase* fittableMeasurement = predictedState->measurement(); int I = predictedState->positionOnTrajectory(); @@ -497,7 +497,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::buildAndAnalyseTrajectory if(!predPar) { ATH_MSG_DEBUG ((I<10?"T0":"T") << I << " --- missed surface with " << "extrapolation, flag state as outlier --- " ); - if (0 != dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(fittableMeasurement) ) { + if (nullptr != dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(fittableMeasurement) ) { ATH_MSG_INFO ("lost PseudoMeasurement during fwd extrapolation - " << "PM-surface or sorting problem."); if (msgLvl(MSG::DEBUG)) { @@ -535,7 +535,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::buildAndAnalyseTrajectory // search for brem and adjust the error according to target measurement (brem fit) if (filterCounter>2) { const Trk::DNA_MaterialEffects* updMomNoise = - !controlledMatEffects.doDNA() ? 0 : + !controlledMatEffects.doDNA() ? nullptr : m_dynamicNoiseAdjustor->DNA_Adjust(predPar, // change according to where meas is updatedPar, // re-start from old pars fittableMeasurement, // the meas't @@ -610,7 +610,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::updateOrSkip // if extrapolation had failed, skip this method altogether. if (predPar==nullptr) return FitterStatusCode::Success; const MeasurementBase* fittableMeasurement = predictedState->measurement(); - FitQualityOnSurface* fitQuality=0; + FitQualityOnSurface* fitQuality=nullptr; delete updatedPar; //////////////////////////////////////////////////////////////////// @@ -683,7 +683,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::updateOrSkip ); fittableMeasurement = predictedState->measurement(); ATH_MSG_DEBUG ("Broadened TRT hit instead of outlier"); - delete updatedPar; delete fitQuality; fitQuality=0; + delete updatedPar; delete fitQuality; fitQuality=nullptr; //////////////////////////////////////////////////////////////////// // make the update updatedPar = m_updator->addToState(*predPar, fittableMeasurement->localParameters(), @@ -758,7 +758,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::enterSeedIntoTrajectory return FitterStatusCode::BadInput; } const Trk::Surface& startSurface = ffs->measurement()->associatedSurface(); - const Trk::TrackParameters* inputParAtStartSurface = 0; + const Trk::TrackParameters* inputParAtStartSurface = nullptr; // chk if TPar are already in correct local frame: first pointer check (quick) then geometric if ( &startSurface == &inputPar.associatedSurface() || diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx index 8a65a3ec6ae5ea75b4e616e22f76b436d7dfaef1..5ae320df75642846fe84ea5bfa112b54f1d0e098 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx @@ -11,6 +11,10 @@ // Markus.Elsing@cern.ch /////////////////////////////////////////////////////////////////// +#include <memory> + + + #include "TrkKalmanFitter/ForwardRefTrackKalmanFitter.h" #include "AtlasDetDescr/AtlasDetectorID.h" #include "TrkFitterUtils/FitterStatusCode.h" @@ -193,15 +197,15 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, return FitterStatusCode::BadInput; } - const TransportJacobian* jacobian = 0; + const TransportJacobian* jacobian = nullptr; ////////////////////////////////////////////////////////////////////////////////////////// // the regular filter loop after finding the correct initialisation for( ; it!=trajectory.end(); it++) { - const AmgVector(5)* predDiffPar = 0; - const AmgSymMatrix(5)* predDiffCov = 0; - if (jacobian==0) { + const AmgVector(5)* predDiffPar = nullptr; + const AmgSymMatrix(5)* predDiffCov = nullptr; + if (jacobian==nullptr) { ATH_MSG_DEBUG ("-F- beginning of trajectory, have already predPar"); predDiffPar = it->parametersDifference(); predDiffCov = it->parametersCovariance(); @@ -239,15 +243,14 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, const MeasurementBase* fittableMeasurement = it->measurement(); if ((!fittableMeasurement) || it->isOutlier()) { // pure material state - updatedDifference.reset( new std::pair<AmgVector(5),AmgSymMatrix(5)> - (std::make_pair(*predDiffPar,*predDiffCov)) ); + updatedDifference = std::make_unique<std::pair<AmgVector(5),AmgSymMatrix(5)>>( std::make_pair(*predDiffPar,*predDiffCov) ); } else { // Posibly re-calibrate. TRT extension finder leaves many TRT hits as wire-hits w/o LR solution if (allowRecalibrate && m_recalibrator && it->measurementType() == TrackState::TRT) { const AmgVector(5) x = it->referenceParameters()->parameters()+(*predDiffPar); - const Trk::TrackParameters* param = CREATE_PARAMETERS(*it->referenceParameters(),x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(*it->referenceParameters(),x,nullptr); Trk::TrackState::CalibrationType oldType = it->calibrationType(); // the replaceMeas.-method does ownership right and detects if the @@ -261,14 +264,14 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, delete param; } - Trk::FitQualityOnSurface* fitQS=0; + Trk::FitQualityOnSurface* fitQS=nullptr; updatedDifference.reset( m_updator->updateParameterDifference(*predDiffPar, *predDiffCov, *(it->measurementDifference()), fittableMeasurement->localCovariance(), fittableMeasurement->localParameters().parameterKey(), fitQS, /*doFQ=*/true ) ); - if (!updatedDifference || fitQS == 0) { + if (!updatedDifference || fitQS == nullptr) { delete fitQS; ATH_MSG_DEBUG("update in reference-parameter formalism failed."); return FitterStatusCode::UpdateFailure; @@ -290,7 +293,7 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, // allow making of wire-hits for TRT fits with L/R-solving on the fly if ( m_recalibrator && it->measurementType() == TrackState::TRT) { const AmgVector(5) x = it->referenceParameters()->parameters()+(*predDiffPar); - const Trk::TrackParameters* param = CREATE_PARAMETERS(*it->referenceParameters(),x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(*it->referenceParameters(),x,nullptr); if ( Trk::SensorBoundsCheck::areParamsInside (*fittableMeasurement, param->parameters(), *predDiffCov, 1.0, -1.0)) { Trk::TrackState::CalibrationType oldType = it->calibrationType(); @@ -301,7 +304,7 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, fittableMeasurement = it->measurement(); ATH_MSG_VERBOSE ("TRT ROT calibration changed, from "<<oldType<<" to broad hit "<< it->calibrationType()<< " instead of outlier"); - delete fitQS; fitQS=0; + delete fitQS; fitQS=nullptr; updatedDifference.reset( m_updator->updateParameterDifference(*predDiffPar, *predDiffCov, *(it->measurementDifference()), @@ -344,8 +347,7 @@ Trk::ForwardRefTrackKalmanFitter::fit(Trk::Trajectory& trajectory, return FitterStatusCode::BadInput; } // copy over prePar to updatedPar because we ignore this update - updatedDifference.reset( new std::pair<AmgVector(5),AmgSymMatrix(5)> - (std::make_pair(*predDiffPar,*predDiffCov)) ); + updatedDifference = std::make_unique<std::pair<AmgVector(5),AmgSymMatrix(5)>>( std::make_pair(*predDiffPar,*predDiffCov) ); } // @TODO fitQS maybe NULL in case it points to an outlier. // Shall this part of the code be reached for outliers ? @@ -398,13 +400,13 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory "trajectory is EMPTY.\n This can not work!"); return FitterStatusCode::BadInput; } - if (ffs->measurement() == NULL) { + if (ffs->measurement() == nullptr) { ATH_MSG_WARNING ("-Fe mess-up in enterSeedIntoTraj: can not find a first measurement!"); trajectory.clear(); return FitterStatusCode::BadInput; } const Trk::Surface& startSurface = ffs->measurement()->associatedSurface(); - const Trk::TrackParameters* inputParAtStartSurface = 0; + const Trk::TrackParameters* inputParAtStartSurface = nullptr; // chk if TPar are already in correct local frame: first pointer check (quick) then geometric if ( &startSurface == &inputPar.associatedSurface() || @@ -418,7 +420,7 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory startSurface, Trk::anyDirection, false, Trk::nonInteracting); - if (inputParAtStartSurface == NULL) { + if (inputParAtStartSurface == nullptr) { ATH_MSG_WARNING ("-Fe can not transport input param to first measurement => extrap problem or bad input"); ATH_MSG_INFO ("-Fe parameters R="<< inputPar.position().perp() << ", z="<< inputPar.position().z()<<" q/p="<<inputPar.parameters()[Trk::qOverP]<< @@ -431,7 +433,7 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory } // make first seed for filtering - AmgVector(5)* diffPar = 0; + AmgVector(5)* diffPar = nullptr; if (ffs->referenceParameters()) diffPar = new AmgVector(5)(inputParAtStartSurface->parameters() -ffs->referenceParameters()->parameters()); @@ -452,15 +454,15 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory // lazy initialization because the tracking geometry is built after conditions are there Trk::MagneticFieldProperties useFullField(Trk::FullField); - if (m_idEnclosingVolume == 0 ) m_idEnclosingVolume = + if (m_idEnclosingVolume == nullptr ) m_idEnclosingVolume = m_extrapolator->trackingGeometry()->trackingVolume("InDet::Containers::InnerDetector"); - if (m_msCompleteVolume == 0 ) m_msCompleteVolume = + if (m_msCompleteVolume == nullptr ) m_msCompleteVolume = m_extrapolator->trackingGeometry()->trackingVolume("All::Container::CompleteDetector"); - if (m_idEnclosingVolume==0 && m_msCompleteVolume == 0) { + if (m_idEnclosingVolume==nullptr && m_msCompleteVolume == nullptr) { ATH_MSG_WARNING ("Could not get any detector enclosing volume from tracking geometry."); return FitterStatusCode::BadInput; } - const IPropagator* propagator = 0; + const IPropagator* propagator = nullptr; bool isInsideID = true; if (m_idEnclosingVolume && m_idEnclosingVolume->inside(inputParAtStartSurface->position())) { ATH_MSG_VERBOSE ("subPropagator detection: found id volume of signature ID " << @@ -478,12 +480,12 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory const Trk::TrackParameters* lastPropagatedPar = CREATE_PARAMETERS((*inputParAtStartSurface), - inputParAtStartSurface->parameters(), 0); // remove covariance + inputParAtStartSurface->parameters(), nullptr); // remove covariance for (auto it=m_utility->firstFittableState ( trajectory ); it!=trajectory.end(); ++it) { if (!it->referenceParameters()) { it->checkinReferenceParameters (lastPropagatedPar); } else { - delete lastPropagatedPar; lastPropagatedPar=0; + delete lastPropagatedPar; lastPropagatedPar=nullptr; // FIXME study this further, whether cov really not needed and how close in param // space the old and new references are. ATH_MSG_VERBOSE("At state T"<<it->positionOnTrajectory()<<" have already reference."); @@ -503,7 +505,7 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory propagator = m_extrapolator->subPropagator(*m_idEnclosingVolume); ATH_MSG_DEBUG ("changed from MS to ID propagator."); } - TransportJacobian* jac = 0; + TransportJacobian* jac = nullptr; double pathLimit = -1.; if (!propagator) { ATH_MSG_WARNING("NO propagator!!"); @@ -538,7 +540,7 @@ void Trk::ForwardRefTrackKalmanFitter::printGlobalParams(int istate, std::string const AmgVector(5)& diff) const { const AmgVector(5) x = ref.parameters()+diff; - const Trk::TrackParameters* param = CREATE_PARAMETERS(ref,x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(ref,x,nullptr); char tt[80]; snprintf(tt,79,"T%.2d",istate); msg(MSG::VERBOSE) << tt << ptype << " GP:" << std::setiosflags(std::ios::fixed | std::ios::showpoint | std::ios::right ) diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx index 02b235cbcbe49efeb161b452f4ec905dd6178ec6..d6ad48c74cb9d2b73240dff9527cc78ca09f3cf1 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx @@ -70,11 +70,11 @@ Trk::KalmanFitter::KalmanFitter(const std::string& t,const std::string& n, m_callValidationTool(false), m_haveValidationTool(false), m_doDNAForElectronsOnly(false), - m_tparScaleSetter(0), + m_tparScaleSetter(nullptr), m_sortingRefPoint(0., 0., 0.), - m_idHelper(0), - m_utility(0), - m_inputPreparator(0), + m_idHelper(nullptr), + m_utility(nullptr), + m_inputPreparator(nullptr), m_cov0(std::vector<double>(0)), m_fitStatus(Trk::FitterStatusCode::BadInput), m_maximalNdof(0), @@ -260,13 +260,13 @@ StatusCode Trk::KalmanFitter::initialize() // main helper to convert different type of inputs into unified trajectory m_inputPreparator = new TrackFitInputPreparator(m_sortingRefPoint, m_forwardFitter->needsReferenceTrajectory()? - (&(*m_extrapolator)) : 0); + (&(*m_extrapolator)) : nullptr); // configure internal DAF if (!m_internalDAF.empty() && - m_internalDAF->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):0), - (!m_updator.empty()?(&(*m_updator)):0), - (!m_recalibrator.empty()?(&(*m_recalibrator)):0), + m_internalDAF->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):nullptr), + (!m_updator.empty()?(&(*m_updator)):nullptr), + (!m_recalibrator.empty()?(&(*m_recalibrator)):nullptr), m_utility ).isFailure()) { ATH_MSG_WARNING ("failure while configuring internal DAF!"); ATH_MSG_INFO ("debugging info: ex = " << m_extrapolator << " up = " << m_updator << @@ -275,42 +275,42 @@ StatusCode Trk::KalmanFitter::initialize() } // configure ForwardKalmanFitter - StatusCode sc = m_forwardFitter->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):0), - (!m_updator.empty()?(&(*m_updator)):0), - (!m_ROTcreator.empty()?(&(*m_ROTcreator)):0), - (!m_dynamicNoiseAdjustor.empty()?(&(*m_dynamicNoiseAdjustor)):0), - (!m_alignableSfProvider.empty()?(&(*m_alignableSfProvider)):0), - (!m_recalibrator.empty()?(&(*m_recalibrator)):0), - 0 // for hybrid-fitter use: (!m_internalDAF.empty()?(&(*m_internalDAF)):0) + StatusCode sc = m_forwardFitter->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):nullptr), + (!m_updator.empty()?(&(*m_updator)):nullptr), + (!m_ROTcreator.empty()?(&(*m_ROTcreator)):nullptr), + (!m_dynamicNoiseAdjustor.empty()?(&(*m_dynamicNoiseAdjustor)):nullptr), + (!m_alignableSfProvider.empty()?(&(*m_alignableSfProvider)):nullptr), + (!m_recalibrator.empty()?(&(*m_recalibrator)):nullptr), + nullptr // for hybrid-fitter use: (!m_internalDAF.empty()?(&(*m_internalDAF)):0) ); if(sc.isFailure()) return sc; // configure KalmanSmoother - sc = m_smoother->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):0), - (!m_updator.empty()?(&(*m_updator)):0), - (!m_dynamicNoiseAdjustor.empty()?(&(*m_dynamicNoiseAdjustor)):0), - (!m_alignableSfProvider.empty()?(&(*m_alignableSfProvider)):0), + sc = m_smoother->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):nullptr), + (!m_updator.empty()?(&(*m_updator)):nullptr), + (!m_dynamicNoiseAdjustor.empty()?(&(*m_dynamicNoiseAdjustor)):nullptr), + (!m_alignableSfProvider.empty()?(&(*m_alignableSfProvider)):nullptr), m_option_doSmoothing, true); if(sc.isFailure()) return sc; // configure outlier logic sc = m_outlierLogic->configureWithTools(&(*m_extrapolator), &(*m_updator), - (!m_recalibrator.empty()?(&(*m_recalibrator)):0)); + (!m_recalibrator.empty()?(&(*m_recalibrator)):nullptr)); if(sc.isFailure()) return sc; // configure outlier logic if (!m_outlierRecovery.empty()) { sc = m_outlierRecovery->configureWithTools(&(*m_extrapolator), &(*m_updator), - (!m_recalibrator.empty()?(&(*m_recalibrator)):0)); + (!m_recalibrator.empty()?(&(*m_recalibrator)):nullptr)); if(sc.isFailure()) return sc; } // configure DNA tool (if present) if (!m_dynamicNoiseAdjustor.empty()) { - sc = m_dynamicNoiseAdjustor->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):0), - (!m_updator.empty()?(&(*m_updator)):0)); + sc = m_dynamicNoiseAdjustor->configureWithTools((!m_extrapolator.empty()?(&(*m_extrapolator)):nullptr), + (!m_updator.empty()?(&(*m_updator)):nullptr)); if(sc.isFailure()) return sc; } if (!m_dynamicNoiseAdjustor.empty() && !m_alignableSfProvider.empty()) { @@ -414,14 +414,14 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, // protection against not having measurements on the input track if (!inputTrack.trackStateOnSurfaces() || inputTrack.trackStateOnSurfaces()->size() < 2) { ATH_MSG_INFO ("called to refit empty track or track with too little information, reject fit"); - return 0; + return nullptr; } /* determine the Track Parameter which is the start of the trajectory, i.e. closest to the reference point */ if (!inputTrack.trackParameters() || inputTrack.trackParameters()->empty()) { ATH_MSG_INFO ("input fails to provide track parameters for seeding the KF, reject fit"); - return 0; + return nullptr; } if (msgLvl(MSG::VERBOSE)) { ATH_MSG_VERBOSE( "list of parameters as they are on the input track:"); @@ -435,13 +435,13 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, << (m_option_enforceSorting? "via STL sort" : "as first TP (convention)")); } // fill internal trajectory through external preparator class - const TrackParameters* minPar = 0; + const TrackParameters* minPar = nullptr; if (m_inputPreparator->copyToTrajectory(m_trajectory, minPar, inputTrack,m_option_enforceSorting, m_option_reintegrateOutliers, prtHypothesis) == StatusCode::FAILURE) { ATH_MSG_WARNING ("Could not decode input track!"); - m_trajectory.clear(); return 0; + m_trajectory.clear(); return nullptr; } m_utility->identifyMeasurements(m_trajectory); m_maximalNdof = m_utility->rankedNumberOfMeasurements(m_trajectory)-5; @@ -462,12 +462,12 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, // --- perform first forward filter on measurement set extracted from track ATH_MSG_VERBOSE ("\n***** call forward kalman filter, iteration # 1 *****\n"); if (m_forwardFitter->enterSeedIntoTrajectory(m_trajectory,*minPar,m_cov0,kalMec,true) - != Trk::FitterStatusCode::Success) return 0; + != Trk::FitterStatusCode::Success) return nullptr; m_fitStatus = m_forwardFitter->fit(m_trajectory,*minPar,runOutlier,kalMec,true); if (m_callValidationTool) callValidation(0, kalMec.particleType(), m_fitStatus); // call KalmanFilter with iterations on the outliers - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(minPar, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(minPar, fitQual, runOutlier, kalMec, this_eta) ) { // make output track from the internal trajectory @@ -489,7 +489,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, m_callValidationTool = false; } ATH_MSG_DEBUG( "fit(track) during iterations failed." ); - return 0; + return nullptr; } } @@ -502,7 +502,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::PrepRawDataSet& inputPRDColl, const Trk::ParticleHypothesis prtHypothesis) const { m_fitStatus = Trk::FitterStatusCode::BadInput; - if (!check_operability(1, runOutlier, prtHypothesis,inputPRDColl.empty())) return 0; + if (!check_operability(1, runOutlier, prtHypothesis,inputPRDColl.empty())) return nullptr; bool doDNA = !m_dynamicNoiseAdjustor.empty(); if (m_doDNAForElectronsOnly && prtHypothesis != Trk::electron) doDNA = false; Trk::KalmanMatEffectsController kalMec(prtHypothesis, doDNA); @@ -552,7 +552,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::PrepRawDataSet& inputPRDColl, // call KalmanFilter with iterations on the outliers const Trk::TrackParameters* startPar = &estimatedStartParameters; - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(startPar, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(startPar, fitQual, runOutlier, kalMec, this_eta) ) { // make output track from the internal trajectory @@ -564,7 +564,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::PrepRawDataSet& inputPRDColl, } else { delete fitQual; m_trajectory.clear(); - return 0; + return nullptr; } } @@ -576,7 +576,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::MeasurementSet& inputMeasSet, const Trk::ParticleHypothesis matEffects) const { m_fitStatus = Trk::FitterStatusCode::BadInput; - if (!check_operability(2 ,runOutlier, matEffects,inputMeasSet.empty())) return 0; + if (!check_operability(2 ,runOutlier, matEffects,inputMeasSet.empty())) return nullptr; bool doDNA = !m_dynamicNoiseAdjustor.empty(); if (m_doDNAForElectronsOnly && matEffects != Trk::electron) doDNA = false; Trk::KalmanMatEffectsController kalMec(matEffects, doDNA); @@ -641,7 +641,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::MeasurementSet& inputMeasSet, if (m_forwardFitter->enterSeedIntoTrajectory(m_trajectory,estimatedStartParameters, m_cov0,kalMec,true) - != Trk::FitterStatusCode::Success) return 0; + != Trk::FitterStatusCode::Success) return nullptr; ATH_MSG_VERBOSE ("\n***** call forward kalman filter, iteration # 1 *****\n"); m_fitStatus = m_forwardFitter->fit(m_trajectory, estimatedStartParameters, runOutlier, kalMec, false); @@ -649,7 +649,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::MeasurementSet& inputMeasSet, // --- call KalmanFilter with iterations on the outliers const Trk::TrackParameters* startPar = &estimatedStartParameters; - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(startPar, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(startPar,fitQual,runOutlier, kalMec, this_eta) ) { // make output track from the internal trajectory: @@ -670,7 +670,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::MeasurementSet& inputMeasSet, m_callValidationTool = false; } ATH_MSG_DEBUG( "fit(vec<MB>) during iteration failed." ); - return 0; + return nullptr; } } @@ -734,14 +734,14 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, } // fill internal trajectory through external preparator class - const TrackParameters* estimatedStartParameters = 0; + const TrackParameters* estimatedStartParameters = nullptr; if (m_inputPreparator->copyToTrajectory(m_trajectory, estimatedStartParameters, inputTrack,addMeasColl, m_option_enforceSorting, m_option_reintegrateOutliers, matEffects) == StatusCode::FAILURE) { ATH_MSG_WARNING( "Could not decode input track!" ); - m_trajectory.clear(); return 0; + m_trajectory.clear(); return nullptr; } m_utility->identifyMeasurements(m_trajectory); m_maximalNdof = m_utility->rankedNumberOfMeasurements(m_trajectory)-5; @@ -763,7 +763,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, // --- perform first forward filter on measurement set extracted from track if (m_forwardFitter->enterSeedIntoTrajectory(m_trajectory,*estimatedStartParameters,m_cov0, kalMec,true) - != Trk::FitterStatusCode::Success) return 0; + != Trk::FitterStatusCode::Success) return nullptr; ATH_MSG_VERBOSE ("\n***** call forward kalman filter, iteration # 1 *****\n"); m_fitStatus = m_forwardFitter->fit(m_trajectory, *estimatedStartParameters, runOutlier, kalMec, true); @@ -771,7 +771,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, // --- call KalmanFilter with iterations on the outliers - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(estimatedStartParameters, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(estimatedStartParameters, fitQual, runOutlier, kalMec, this_eta) ) { @@ -783,7 +783,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, return fittedTrack; } else { delete fitQual; - fitQual = 0; + fitQual = nullptr; m_trajectory.clear(); // iterations failed: // if m_option_callValidationToolForFailedFitsOnly repeat the track fit with calls of validation tool @@ -797,7 +797,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& inputTrack, m_callValidationTool = false; } ATH_MSG_DEBUG ("fit(track,vec<MB>) during iteration failed."); - return 0; + return nullptr; } } @@ -819,7 +819,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& intrk1, intrk1.trackStateOnSurfaces()->size() < 2) { ATH_MSG_WARNING ("called to refit empty track or track with too little information," << " reject fit"); - return 0; + return nullptr; } /* determine the Track Parameter which is the start of the trajectory, @@ -829,17 +829,17 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& intrk1, if (!intrk1.trackParameters() || intrk1.trackParameters()->empty()) { ATH_MSG_WARNING( "input #1 fails to provide track parameters for seeding the " << "KF, reject fit" ); - return 0; + return nullptr; } // fill internal trajectory through external preparator class - const TrackParameters* minPar = 0; + const TrackParameters* minPar = nullptr; if (m_inputPreparator->copyToTrajectory(m_trajectory, minPar, intrk1,intrk2,m_option_enforceSorting, m_option_reintegrateOutliers, matEffects) == StatusCode::FAILURE) { ATH_MSG_WARNING( "Could not decode input tracks!" ); - m_trajectory.clear(); return 0; + m_trajectory.clear(); return nullptr; } m_utility->identifyMeasurements(m_trajectory); m_maximalNdof = m_utility->rankedNumberOfMeasurements(m_trajectory)-5; @@ -861,13 +861,13 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& intrk1, // --- perform first forward filter on measurement set extracted from track if (m_forwardFitter->enterSeedIntoTrajectory(m_trajectory,*minPar,m_cov0,kalMec,true) - != Trk::FitterStatusCode::Success) return 0; + != Trk::FitterStatusCode::Success) return nullptr; ATH_MSG_VERBOSE ("\n***** call forward kalman filter, iteration # 1 *****\n"); m_fitStatus = m_forwardFitter->fit(m_trajectory,*minPar,runOutlier, kalMec, true); if (m_callValidationTool) callValidation(0, kalMec.particleType(), m_fitStatus); // call KalmanFilter with iterations on the outliers - FitQuality* fitQual = 0; + FitQuality* fitQual = nullptr; if ( iterateKalmanFilter(minPar, fitQual, runOutlier, kalMec, this_eta) || invokeAnnealingFilter(minPar,fitQual,runOutlier, kalMec, this_eta) ) { // make output track from the internal trajectory @@ -890,7 +890,7 @@ Trk::Track* Trk::KalmanFitter::fit(const Trk::Track& intrk1, } m_callValidationTool = false; } - return 0; + return nullptr; } } @@ -1202,7 +1202,7 @@ bool Trk::KalmanFitter::prepareNextIteration(const unsigned int& upcomingIterati int& iFilterBeginState, const Trk::TrackParameters& backupParams) const { - const Trk::TrackParameters* newSeedPars = 0; + const Trk::TrackParameters* newSeedPars = nullptr; ATH_MSG_VERBOSE ("In ::prepareNextIteration with filterBeginState = "<<iFilterBeginState); // get chi2 asymmetry @@ -1286,7 +1286,7 @@ Trk::Track* Trk::KalmanFitter::makeTrack(const Trk::FitQuality* FQ, << "to form track! **********\n"); if (msgLvl(MSG::DEBUG)) monitorTrackFits( MinimalTrackFailure, this_eta ); m_fitStatus = Trk::FitterStatusCode::FewFittableMeasurements; - return 0; + return nullptr; } else { SmoothedTrajectory* finalTrajectory = new SmoothedTrajectory(); @@ -1299,7 +1299,7 @@ Trk::Track* Trk::KalmanFitter::makeTrack(const Trk::FitQuality* FQ, ATH_MSG_DEBUG ("********** perigee making failed, drop track"); if (msgLvl(MSG::DEBUG)) monitorTrackFits( Trk::KalmanFitter::PerigeeMakingFailure, this_eta ); m_fitStatus = Trk::FitterStatusCode::PerigeeMakingFailure; - delete finalTrajectory; return 0; + delete finalTrajectory; return nullptr; } } else { const TrackStateOnSurface* refState = makeReferenceState(refPar.associatedSurface(), @@ -1366,7 +1366,7 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::internallyMakePerigee const Trk::ParticleHypothesis matEffects) const { Trajectory::const_iterator it = m_trajectory.begin(); - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; // --- simple case to get "first" track parameters: ID track if (!it->isOutlier() && (it->smoothedTrackParameters()) && @@ -1381,7 +1381,7 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::internallyMakePerigee } if (parameterTrajectory.empty()) { ATH_MSG_WARNING ("Perigee-making failed: no useful parameters on track!"); - return 0; + return nullptr; } nearestParam = *(std::min_element(parameterTrajectory.begin(), parameterTrajectory.end(), @@ -1395,12 +1395,12 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::internallyMakePerigee false, matEffects); if (!per) { ATH_MSG_DEBUG ("Perigee-making failed: extrapolation did not succeed."); - return 0; + return nullptr; } else ATH_MSG_VERBOSE ("Perigee parameters have been made."); std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(TrackStateOnSurface::Perigee); - return new TrackStateOnSurface(0 , per, 0, 0, typePattern ); + return new TrackStateOnSurface(nullptr , per, nullptr, nullptr, typePattern ); } const Trk::TrackStateOnSurface* Trk::KalmanFitter::makeReferenceState @@ -1408,11 +1408,11 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::makeReferenceState const Trk::ParticleHypothesis matEffects) const { Trajectory::const_iterator it = m_trajectory.begin(); - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; // --- simple case: ref surface was entered at first measurement if (!it->isOutlier() && (&(it->measurement()->associatedSurface()) == &refSurface) ) - return 0; + return nullptr; Trk::TrkParametersComparisonFunction nearestSurfaceDefinition(refSurface.center()); std::vector<const Trk::TrackParameters*> parameterTrajectory; for ( ; it!= m_trajectory.end(); ++it) @@ -1420,7 +1420,7 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::makeReferenceState parameterTrajectory.push_back(it->smoothedTrackParameters()); if (parameterTrajectory.empty()) { ATH_MSG_WARNING ("Reference state making failed: no useful parameters on track!"); - return 0; + return nullptr; } nearestParam = *(std::min_element(parameterTrajectory.begin(), parameterTrajectory.end(), @@ -1432,12 +1432,12 @@ const Trk::TrackStateOnSurface* Trk::KalmanFitter::makeReferenceState false, matEffects); if (!fittedRefParams) { ATH_MSG_DEBUG (" No ref-params made: extrapolation failed."); - return 0; + return nullptr; } else ATH_MSG_VERBOSE ("Reference parameters have been made."); std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(TrackStateOnSurface::Perigee); - return new TrackStateOnSurface(0, fittedRefParams, 0, 0, typePattern ); + return new TrackStateOnSurface(nullptr, fittedRefParams, nullptr, nullptr, typePattern ); } void Trk::KalmanFitter::monitorTrackFits(FitStatisticsCode code, const double& eta) const { @@ -1526,7 +1526,7 @@ void Trk::KalmanFitter::callValidation( int iterationIndex, ATH_MSG_DEBUG( "call validation for track iteration " << iterationIndex << "with status " << fitStatCode.getCode() ); // extrapolate to perigee at origin for validation data const Trk::PerigeeSurface perSurf; // default perigee at origin - const Trk::TrackParameters* nearestParam = 0; + const Trk::TrackParameters* nearestParam = nullptr; Trajectory::const_iterator it = m_trajectory.begin(); for ( ; it != m_trajectory.end(); it++ ) { // FIXME this can be coded more elegantly if (!it->isOutlier() && (it->smoothedTrackParameters())) { @@ -1542,8 +1542,8 @@ void Trk::KalmanFitter::callValidation( int iterationIndex, } } } - const Trk::Perigee* per = 0; - const Trk::TrackParameters* perPar = 0; + const Trk::Perigee* per = nullptr; + const Trk::TrackParameters* perPar = nullptr; if (nearestParam) { // extrapolate to perigee perPar = m_extrapolator->extrapolate( *nearestParam, perSurf, diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx index fbdb638880260941ec430a816f0078dc7c27ae42..505a37674aeb5194f61e56056569f983f80b7a2f 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx @@ -260,7 +260,7 @@ bool Trk::KalmanOutlierLogic::flagNewOutliers(Trk::Trajectory& T, "with AFB "<<chi2_AFB<<" trying if this comes from problem in last hits"); int nLastCandidates = 0; double candidateChi2 = 0.0; - Trk::ProtoTrackStateOnSurface* suspiciousState = 0; + Trk::ProtoTrackStateOnSurface* suspiciousState = nullptr; Trk::Trajectory::reverse_iterator rit = Trk::Trajectory::reverse_iterator(++(m_utility->lastFittableState(T))); for( ; rit!=T.rend(); ++rit) { diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx index 70d50cea5ef85c2ed87237e970f959e8c479923e..9732e4d7d5da48aaffda2c6ac2ffd20f33c0e4f6 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -164,7 +164,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, ") -- " << c_outSct<<"("<< c_allSct<<") -- " << c_outTrt<<"("<<c_allTrt<<")"); // === part 1: pixel === recover occas. pixel outliers as broad clusters if SCT is reliable - if (fitIteration <= 2 && m_recalibrator!=NULL + if (fitIteration <= 2 && m_recalibrator!=nullptr && c_allPix > 0 && 2*c_outPix <= c_allPix && 2*c_outSct < c_allSct ) { @@ -178,7 +178,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, m_extrapolator->extrapolate(*restartState->smoothedTrackParameters(), it->measurement()->associatedSurface(), Trk::oppositeMomentum, false, Trk::nonInteracting) : - NULL ); + nullptr ); if (!smoothedParAtOutlier) continue; if ( (it->measurement()->localCovariance()(Trk::locX,Trk::locX) < 0.02*0.02) @@ -186,7 +186,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, const Trk::MeasurementBase* broadPixel = m_recalibrator->makeBroadMeasurement(*it->measurement(), *smoothedParAtOutlier, Pixel); - if (broadPixel!=NULL) { + if (broadPixel!=nullptr) { if (( broadPixel->localCovariance()(Trk::locX,Trk::locX) > 1.05*1.05* it->measurement()->localCovariance()(Trk::locX,Trk::locX)) && ( broadPixel->localCovariance()(Trk::locY,Trk::locY) @@ -213,7 +213,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, // === part 2: SCT === recover lost SCT filtering (again using broad pixels clusters) // int nSCT = m_utility->numberOfSpecificStates(T,SCT,AnyState); - if (m_recalibrator!=NULL + if (m_recalibrator!=nullptr && (fabs(filterInputPar->parameters()[Trk::qOverP])<0.00125) // dont try on lowPT && (c_allPix - c_outPix > 1 ) && (c_allSct + c_allPix > 7 ) @@ -240,7 +240,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, lastSctState->measurement()->associatedSurface(), Trk::alongMomentum, false, Trk::nonInteracting); - if (sctExitTemp == NULL) { + if (sctExitTemp == nullptr) { ATH_MSG_DEBUG ("-O- can not reproduce trajectory in SCT recovery!"); for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) it->isOutlier(GeneralOutlier,fitIteration); @@ -282,12 +282,12 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, for( ; rit!=T.rend(); ++rit) { if ( rit->measurementType() == SCT) { const Trk::TrackParameters* predPar = - (sctFitResult!=NULL ? + (sctFitResult!=nullptr ? m_extrapolator->extrapolate(*sctFitResult, rit->measurement()->associatedSurface(), Trk::oppositeMomentum, false, Trk::muon) : - NULL); + nullptr); delete sctFitResult; if (!predPar) { ATH_MSG_DEBUG ("-O- internal mini-filter failed in SCT recovery!"); @@ -309,22 +309,22 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, int numberOfChangedStates=0; const Trk::TrackParameters* updatedPar = sctFitResult; - sctFitResult=NULL; + sctFitResult=nullptr; rit = firstSctState_r + 1; // now on last Pixel state! for( ; rit!=T.rend(); ++rit) { const Trk::TrackParameters* filteredPar = - ( updatedPar != NULL ? + ( updatedPar != nullptr ? m_extrapolator->extrapolate(*updatedPar, rit->measurement()->associatedSurface(), Trk::oppositeMomentum, false, Trk::muon) : - NULL ); + nullptr ); delete updatedPar; - const Trk::FitQualityOnSurface* testQuality = (filteredPar==NULL)? NULL : + const Trk::FitQualityOnSurface* testQuality = (filteredPar==nullptr)? nullptr : m_updator->predictedStateFitQuality(*filteredPar, rit->measurement()->localParameters(), rit->measurement()->localCovariance()); - if (testQuality == NULL) { + if (testQuality == nullptr) { ATH_MSG_DEBUG ("-O- can not reproduce trajectory at the end of SCT recovery!"); for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) it->isOutlier(GeneralOutlier,fitIteration); @@ -340,7 +340,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, && (rit->measurement()->localCovariance()(Trk::locY) < 0.2) ) { const Trk::MeasurementBase* broadPixel = m_recalibrator->makeBroadMeasurement(*rit->measurement(), *filteredPar, Pixel); - if (broadPixel!=NULL) { + if (broadPixel!=nullptr) { if (( broadPixel->localCovariance()(Trk::locX) > rit->measurement()->localCovariance()(Trk::locX)) && ( broadPixel->localCovariance()(Trk::locY) @@ -372,14 +372,14 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, if (!testQuality || testQuality->chiSquared() > 4*m_State_Chi2PerNdfCut * testQuality->numberDoF() ) { updatedPar = filteredPar; - filteredPar=NULL; + filteredPar=nullptr; ATH_MSG_DEBUG ("At "<<rit->positionOnTrajectory() <<": decided not to use this state, chi2="<< (testQuality ? testQuality->chiSquared() : -1.0) ); } else { updatedPar = m_updator->addToState(*filteredPar, rit->measurement()->localParameters(), rit->measurement()->localCovariance()); - if (updatedPar==NULL) updatedPar=filteredPar; else delete filteredPar; + if (updatedPar==nullptr) updatedPar=filteredPar; else delete filteredPar; ATH_MSG_DEBUG ("At "<<rit->positionOnTrajectory()<<": using this state to proceed."); } if (!testQuality || @@ -426,15 +426,15 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, } // stop recovery for bad cases // === part 3: TRT === - if (c_allTrt-c_outTrt > 0 && m_recalibrator!=NULL ) { + if (c_allTrt-c_outTrt > 0 && m_recalibrator!=nullptr ) { if (numberOfRejections > 0 ) { for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) { if (msgLvl(MSG::VERBOSE)) { - const Trk::RIO_OnTrack* rot=0; + const Trk::RIO_OnTrack* rot=nullptr; Trk::RoT_Extractor::extract(rot,it->measurement()); - if (it->isDriftCircle() && rot!=NULL && rot->prepRawData()!=NULL) + if (it->isDriftCircle() && rot!=nullptr && rot->prepRawData()!=nullptr) msg(MSG::VERBOSE) << "Testing L/R of " << (it->isOutlier() ? "Outl." : "Hit " ) << it->positionOnTrajectory() << " : Par = " << (it->smoothedTrackParameters() ? @@ -447,7 +447,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, const Trk::TrackParameters* refTrkPar = it->smoothedTrackParameters(); // step 1 - try re-integrating drift radius outliers as tube hit inlayers - if (it->measurementType() == Trk::TrackState::TRT && refTrkPar!=NULL + if (it->measurementType() == Trk::TrackState::TRT && refTrkPar!=nullptr && (it->trackStateType() == Trk::TrackState::StateOutlier || it->trackStateType() == Trk::TrackState::TrackOutlier) && it->iterationShowingThisOutlier() == fitIteration @@ -457,7 +457,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, const Trk::RIO_OnTrack* recalibratedROT = m_recalibrator->makeBroadMeasurement(*it->measurement(),*refTrkPar, Trk::TrackState::TRT); - if (recalibratedROT!=NULL) { + if (recalibratedROT!=nullptr) { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "-O- re-integrating drift circle outlier dR=" << it->measurement()->localCovariance()(Trk::locR); it->replaceMeasurement(recalibratedROT,Trk::TrackState::TubeHit); @@ -468,7 +468,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, } else // step 2 - try re-integrating tube hits as drift radius hits - if (it->measurementType() == Trk::TrackState::TRT && refTrkPar!=NULL + if (it->measurementType() == Trk::TrackState::TRT && refTrkPar!=nullptr && !it->isOutlier() && (Trk::TrackState::TubeHit == m_recalibrator->calibrationStatus(*it->measurement(),Trk::TrackState::TRT)) @@ -508,7 +508,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T, for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) { const Trk::RIO_OnTrack* trt=dynamic_cast<const Trk::RIO_OnTrack*>(it->measurement()); if (it->measurementType() == Trk::TrackState::TRT - && !it->isOutlier() && it->smoothedTrackParameters()!=NULL + && !it->isOutlier() && it->smoothedTrackParameters()!=nullptr && trt && trt->prepRawData() ) { bool tubeHitMade=false; if ( (m_recalibrator->calibrationStatus(*it->measurement(),Trk::TrackState::TRT) diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx index 36e305113270114d79fefb7953f5d5a6c11f9a60..90da23c3f950914a4703263d057f179b05274d6e 100644 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx @@ -1,11 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// // KalmanPiecewiseAnnealingFilter.cxx, (c) ATLAS Detector software /////////////////////////////////////////////////////////////////// +#include <memory> + + + #include "TrkKalmanFitter/KalmanPiecewiseAnnealingFilter.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" @@ -101,7 +105,7 @@ StatusCode Trk::KalmanPiecewiseAnnealingFilter::configureWithTools const Trk::ProtoTrajectoryUtility* utility, const Trk::IDynamicNoiseAdjustor* dna) { - if (extrap==NULL || updator == NULL || recalibrator == NULL || utility==NULL) + if (extrap==nullptr || updator == nullptr || recalibrator == nullptr || utility==nullptr) return StatusCode::FAILURE; m_extrapolator = extrap; m_updator = updator; @@ -112,12 +116,12 @@ StatusCode Trk::KalmanPiecewiseAnnealingFilter::configureWithTools // configure piecewise ForwardKalmanFitter StatusCode sc; sc = m_forwardFitter->configureWithTools(const_cast<Trk::IExtrapolator*>(m_extrapolator), m_updator, - 0 /* no rot-creator needed */, m_dynamicNoiseAdjustor); + nullptr /* no rot-creator needed */, m_dynamicNoiseAdjustor); if(sc.isFailure()) return sc; sc = m_smoother->configureWithTools(const_cast<Trk::IExtrapolator*>(m_extrapolator), m_updator, m_dynamicNoiseAdjustor, - 0, // no alignable Surface Provider + nullptr, // no alignable Surface Provider true, // always do smoothing false); // no creation of FitQualityOnSurface objects (DAF-like) if(sc.isFailure()) return sc; @@ -217,7 +221,7 @@ bool Trk::KalmanPiecewiseAnnealingFilter::annealingProblem_all for(Trajectory::iterator it = m_trajPiece.begin(); it != m_trajPiece.end(); ++it) { const Trk::CompetingRIOsOnTrack* compROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(it->measurement()); - if (compROT == NULL || it->isOutlier()) continue; + if (compROT == nullptr || it->isOutlier()) continue; double assPrb = compROT->assignmentProbability(compROT->indexOfMaxAssignProb()); double msErrX = sqrt(compROT->rioOnTrack(compROT->indexOfMaxAssignProb()).localCovariance()(Trk::locX,Trk::locX)); @@ -238,7 +242,7 @@ bool Trk::KalmanPiecewiseAnnealingFilter::annealingProblem_all const Trk::RIO_OnTrack* broadCluster = m_recalibrator->makeBroadMeasurement(*compROT, *refPars, it->measurementType()); - if (broadCluster!=NULL) { + if (broadCluster!=nullptr) { ATH_MSG_DEBUG ("annealing in silicon deemed to be failing, replace CompROT-cluster dLocX="<< sqrt(compROT->rioOnTrack(compROT->indexOfMaxAssignProb()).localCovariance()(Trk::locX,Trk::locX)) <<" by hit with dLocX="<<sqrt(broadCluster->localCovariance()(Trk::locX,Trk::locX))); @@ -289,7 +293,7 @@ bool Trk::KalmanPiecewiseAnnealingFilter::annealingProblem_all for(Trajectory::iterator it = m_trajPiece.begin(); it != m_trajPiece.end(); ++it) { const Trk::CompetingRIOsOnTrack* compROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(it->measurement()); - if (compROT == NULL || it->isOutlier()) continue; + if (compROT == nullptr || it->isOutlier()) continue; double msErrX = sqrt(compROT->rioOnTrack(compROT->indexOfMaxAssignProb()).localCovariance()(Trk::locX,Trk::locX)); double msErrY = (compROT->localParameters().contains(Trk::locY) ? @@ -307,7 +311,7 @@ bool Trk::KalmanPiecewiseAnnealingFilter::annealingProblem_all const Trk::RIO_OnTrack* broadCluster = m_recalibrator->makeBroadMeasurement(*compROT, *refPars, it->measurementType()); - if (broadCluster!=NULL) { + if (broadCluster!=nullptr) { ATH_MSG_DEBUG ("annealing in silicon deemed to be failing, replace CompROT-cluster dLocX="<< sqrt(compROT->rioOnTrack(compROT->indexOfMaxAssignProb()).localCovariance()(Trk::locX,Trk::locX)) @@ -333,8 +337,8 @@ const Trk::FitterStatusCode Trk::KalmanPiecewiseAnnealingFilter::filterTrajectory (Trajectory& trajectory, const ParticleHypothesis& particleType) const { - const Trk::TrackParameters* predPar = 0; - const Trk::TrackParameters* updPar = 0; + const Trk::TrackParameters* predPar = nullptr; + const Trk::TrackParameters* updPar = nullptr; Trk::Trajectory::iterator start = m_utility->firstFittableState(trajectory); return this->filterTrajectoryPiece(trajectory, start, updPar, predPar, trajectory.size(), particleType); @@ -359,14 +363,14 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece msg(MSG::DEBUG) << endmsg; } if (pieceSize<3) pieceSize=8; // some reasonable size for annealing - Trk::KalmanMatEffectsController dafMec(particleType, m_dynamicNoiseAdjustor!=NULL); + Trk::KalmanMatEffectsController dafMec(particleType, m_dynamicNoiseAdjustor!=nullptr); ////////////////////////////////////////////////////////////////////////////// // step 1: make first loop while turning ROT/PRDs into competing ones ////////////////////////////////////////////////////////////////////////////// - const TrackParameters* predPar = 0; + const TrackParameters* predPar = nullptr; std::unique_ptr<const AmgVector(5)> predDiffPar; - const TrackParameters* updatedPar = 0; + const TrackParameters* updatedPar = nullptr; bool end_reached = false; bool hadAnnealingProblemDC = false; bool hadAnnealingProblem = false; @@ -380,8 +384,8 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece if (input_it->referenceParameters()) { if (start_predPar) { predPar = start_predPar->clone(); - predDiffPar.reset( new AmgVector(5)(start_predPar->parameters() - - start->referenceParameters()->parameters() ) ); + predDiffPar = std::make_unique<AmgVector(5)>( start_predPar->parameters() + - start->referenceParameters()->parameters() ); } else { predDiffPar.reset( start->checkoutParametersDifference() ); predPar = CREATE_PARAMETERS(*start->referenceParameters(), @@ -405,7 +409,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece const TransportJacobian& jac = *m_trajPiece.back().jacobian(); AmgVector(5) updDiffPar = updatedPar->parameters() - m_trajPiece.back().referenceParameters()->parameters(); - predDiffPar.reset( new AmgVector(5)(jac*updDiffPar) ); + predDiffPar = std::make_unique<AmgVector(5)>( jac*updDiffPar ); AmgSymMatrix(5)* C = new AmgSymMatrix(5) (jac*(*updatedPar->covariance())*jac.transpose()); // add uncertainties from material effects: if (input_it->materialEffects()) { @@ -438,7 +442,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece const Trk::RIO_OnTrack* testROT = dynamic_cast<const Trk::RIO_OnTrack*>(input_it->measurement()); - if (input_it->isOutlier() || testROT==NULL || input_it->measurement()==NULL) { + if (input_it->isOutlier() || testROT==nullptr || input_it->measurement()==nullptr) { // outlier, material and unambiguous hits: *COPY* into piecewise trajectory. if (input_it->measurement()) @@ -491,11 +495,11 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece if (input_it->isOutlier() || !m_trajPiece.back().measurement() ) { delete updatedPar; updatedPar = predPar; - predPar = 0; + predPar = nullptr; } else { m_trajPiece.back().checkinForwardPar(predPar); delete updatedPar; - FitQualityOnSurface* fitQuality=0; + FitQualityOnSurface* fitQuality=nullptr; updatedPar = m_updator->addToState(*predPar, m_trajPiece.back().measurement()->localParameters(), m_trajPiece.back().measurement()->localCovariance(), @@ -506,7 +510,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece delete fitQuality; return Trk::FitterStatusCode::UpdateFailure; } - if (fitQuality != NULL) { + if (fitQuality != nullptr) { m_trajPiece.back().setForwardStateFitQuality(*fitQuality); delete fitQuality; } @@ -523,7 +527,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece ////////////////////////////////////////////////////////////////////////////// // === step 2: enter annealing loop acting on pairs of forward-backward filters ////////////////////////////////////////////////////////////////////////////// - FitQuality* newFitQuality = 0; + FitQuality* newFitQuality = nullptr; FitQuality savedForwardFQ = m_utility->forwardFilterQuality(m_trajPiece); for (unsigned int annealer=0; annealer < m_option_annealingScheme.size(); ++annealer) { @@ -577,7 +581,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece for(Trajectory::iterator it = m_trajPiece.begin(); it != m_trajPiece.end(); ++it) { const Trk::CompetingRIOsOnTrack* compROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(it->measurement()); - if (compROT != NULL && !it->isOutlier()) assgnProbSum += + if (compROT != nullptr && !it->isOutlier()) assgnProbSum += compROT->assignmentProbability(compROT->indexOfMaxAssignProb()); } if (assgnProbSum < 0.5) { @@ -628,7 +632,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece for(Trajectory::iterator it = m_trajPiece.begin(); it != m_trajPiece.end(); ++it) { const Trk::CompetingRIOsOnTrack* compROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(it->measurement()); - const Trk::FitQuality* testFQ = 0; + const Trk::FitQuality* testFQ = nullptr; if (it->smoothedTrackParameters() && it->measurement()) { testFQ = m_updator->fullStateFitQuality(*(it->smoothedTrackParameters()), it->measurement()->localParameters(), @@ -733,7 +737,7 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece if (it->parametersCovariance()) itForKF->checkinParametersCovariance(it->checkoutParametersCovariance()); itForKF->setForwardStateFitQuality(it->forwardStateChiSquared(),it->forwardStateNumberDoF()); - if (it->dnaMaterialEffects()!=NULL) + if (it->dnaMaterialEffects()!=nullptr) itForKF->checkinDNA_MaterialEffects(it->checkoutDNA_MaterialEffects()); // } } diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx index ee9dd181296e4725c477af79cdc0ee1992c55ad9..b0f52fae4a6df55e68782946ab18720bfa4ba731 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx @@ -25,10 +25,12 @@ #include "TrkFitterUtils/ProtoMaterialEffects.h" // common tracking tools +#include "TrkDetDescrInterfaces/IAlignableSurfaceProvider.h" #include "TrkExInterfaces/IExtrapolator.h" -#include "TrkToolInterfaces/IUpdator.h" #include "TrkFitterInterfaces/IDynamicNoiseAdjustor.h" -#include "TrkDetDescrInterfaces/IAlignableSurfaceProvider.h" +#include "TrkToolInterfaces/IUpdator.h" +#include <memory> + #include <sstream> #include <iomanip> @@ -193,8 +195,8 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fit(Trk::Trajectory& tra // take care of different fit Quality objects in place during smoothing: // - Trk::FitQualityOnSurface* fitQual = 0; // FQ of a given smoothed state - Trk::FitQualityOnSurface* trackQualityIncrement = 0; // increment to build total fitQ + Trk::FitQualityOnSurface* fitQual = nullptr; // FQ of a given smoothed state + Trk::FitQualityOnSurface* trackQualityIncrement = nullptr; // increment to build total fitQ if (trackFitQuality) { // object to hold total fit quality ATH_MSG_WARNING ("fitQuality pointer is not NULL, cancel Kalman fit to prevent mem leak!"); if (msgLvl(MSG::INFO)) monitorTrackFits( Call, 1000. ); @@ -346,7 +348,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fit(Trk::Trajectory& tra //////////////////////////////////////////////////////////////////// // adjust the momentum + error according to target measurement (brem fit) - const Trk::DNA_MaterialEffects* detectedMomentumNoise = 0; + const Trk::DNA_MaterialEffects* detectedMomentumNoise = nullptr; Trk::Trajectory::reverse_iterator stateWithNoise = m_utility->previousFittableState(trajectory, rit); if (kalMec.doDNA() && stateWithNoise!=trajectory.rend()) { @@ -457,8 +459,8 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& // take care of different fit Quality objects in place during smoothing: // - Trk::FitQualityOnSurface* fitQual = 0; // FQ of a given smoothed state - Trk::FitQualityOnSurface* trackQualityIncrement = 0; // increment to build total fitQ + Trk::FitQualityOnSurface* fitQual = nullptr; // FQ of a given smoothed state + Trk::FitQualityOnSurface* trackQualityIncrement = nullptr; // increment to build total fitQ if (trackFitQuality) { // object to hold total fit quality ATH_MSG_WARNING ("fitQuality pointer is not NULL, cancel Kalman fit to prevent mem leak!"); if (msgLvl(MSG::INFO)) monitorTrackFits( BadInput, 1000. ); @@ -498,7 +500,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& const AmgVector(5) x = lastPredictedState->referenceParameters()->parameters() + updatedDifference->first; smooPar.reset( updatedDifference? CREATE_PARAMETERS(*lastPredictedState->referenceParameters(), - x,new AmgSymMatrix(5)(updatedDifference->second)) : 0 ); + x,new AmgSymMatrix(5)(updatedDifference->second)) : nullptr ); if (msgLvl(MSG::INFO)) monitorTrackFits( Call, ( smooPar ? smooPar->eta() : 1000. ) ); if (!smooPar || !fitQual) { ATH_MSG_WARNING ("first smoother update failed, reject track"); @@ -575,15 +577,14 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& updatedDifference.reset(); if (msgLvl(MSG::DEBUG)) { const AmgVector(5) x = rit->referenceParameters()->parameters()+predDiffPar; - const Trk::TrackParameters* param = CREATE_PARAMETERS(*rit->referenceParameters(),x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(*rit->referenceParameters(),x,nullptr); printGlobalParams( rit->positionOnTrajectory(), " extrp", param ); delete param; } const MeasurementBase* fittableMeasurement = rit->measurement(); if (!fittableMeasurement || rit->isOutlier() ) { // pure material state or outlier - updatedDifference.reset( new std::pair<AmgVector(5),AmgSymMatrix(5)> - (std::make_pair(predDiffPar,predCov)) ); + updatedDifference = std::make_unique<std::pair<AmgVector(5),AmgSymMatrix(5)>>( std::make_pair(predDiffPar,predCov) ); } else { updatedDifference.reset( m_updator->updateParameterDifference(predDiffPar, predCov, @@ -591,7 +592,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& fittableMeasurement->localCovariance(), fittableMeasurement->localParameters().parameterKey(), trackQualityIncrement, /*doFQ=*/true ) ); - if (!updatedDifference || trackQualityIncrement == 0) { + if (!updatedDifference || trackQualityIncrement == nullptr) { if (msgLvl(MSG::INFO)) monitorTrackFits( UpdateFailure, rit->referenceParameters()->eta() ); ATH_MSG_INFO ("could not update Track Parameters, reject track"); delete trackQualityIncrement; @@ -615,7 +616,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& if (msgLvl(MSG::DEBUG)) { const AmgVector(5) x = rit->referenceParameters()->parameters() + updatedDifference->first; - const Trk::TrackParameters* param = CREATE_PARAMETERS(*rit->referenceParameters(),x,0); + const Trk::TrackParameters* param = CREATE_PARAMETERS(*rit->referenceParameters(),x,nullptr); printGlobalParams (rit->positionOnTrajectory()," updat", param ); delete param; } @@ -666,7 +667,7 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fitWithReference(Trk::Trajectory& if (msgLvl(MSG::INFO)) monitorTrackFits( FitQualityFailure, rit->smoothedTrackParameters()->eta()); return FitterStatusCode::FitQualityFailure; } - rit->checkinFitQuality(fitQual);fitQual=0; + rit->checkinFitQuality(fitQual);fitQual=nullptr; } if (rit->smoothedTrackParameters()) { smooPar_eta_for_monitoring = rit->smoothedTrackParameters()->eta(); @@ -745,7 +746,7 @@ void Trk::KalmanSmoother::addChi2IncrementAndDelete(Trk::FitQualityOnSurface*& f totalChi2 += fitQualIncrement->chiSquared(); totalNdof += fitQualIncrement->numberDoF(); delete fitQualIncrement; - fitQualIncrement = 0; + fitQualIncrement = nullptr; } else if (msgLvl(MSG::INFO)) { ATH_MSG_DEBUG ("incremental fitQuality object does not exist, assuming zero increment."); } diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/MeasRecalibSteeringTool.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/MeasRecalibSteeringTool.cxx index e386eeb8484ad3712392e45358968f614fef2d5b..777c4a4656a4bc2e1ae50848a6f07e968a36adda 100644 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/MeasRecalibSteeringTool.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/MeasRecalibSteeringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -33,8 +33,8 @@ Trk::MeasRecalibSteeringTool::MeasRecalibSteeringTool(const std::string& t, m_trtTubeHitCreator("InDet::TRT_DriftCircleOnTrackNoDriftTimeTool/TRT_StrawTubeOnTrackTool"), m_haveInDetTools(true), //m_haveMuonTools(false), - m_idHelper(0), - m_mbHelper(0) + m_idHelper(nullptr), + m_mbHelper(nullptr) { declareInterface<IMeasurementRecalibrator>(this); @@ -119,16 +119,16 @@ Trk::MeasRecalibSteeringTool::makePreciseMeasurement const MeasurementType inputMtype) const { // prepare guaranteed input - const Trk::RIO_OnTrack* rot = 0; + const Trk::RIO_OnTrack* rot = nullptr; Trk::RoT_Extractor::extract( rot, &meas); // std and competing ROTs - if (rot==NULL) { + if (rot==nullptr) { ATH_MSG_WARNING ("Misconfigured fitters: no recalibration input!" ); - return 0; + return nullptr; } - if (rot->prepRawData() == NULL) { + if (rot->prepRawData() == nullptr) { ATH_MSG_WARNING ("Misconfigured fitters: re-calibration called " << "on data without PrepRawData objects available." ); - return 0; + return nullptr; } MeasurementType mType = inputMtype; if (inputMtype == unidentified) mType = m_mbHelper->defineType(&meas); @@ -162,7 +162,7 @@ Trk::MeasRecalibSteeringTool::makePreciseMeasurement return newrot; // } } - return 0; + return nullptr; } else { return m_rotCreator->correct(*(rot->prepRawData()), trkPar); } @@ -204,16 +204,16 @@ Trk::MeasRecalibSteeringTool::makeBroadMeasurement(const MeasurementBase& meas, const { // prepare guaranteed input - const Trk::RIO_OnTrack* rot = 0; + const Trk::RIO_OnTrack* rot = nullptr; Trk::RoT_Extractor::extract( rot, &meas); // std and competing ROTs - if (rot==NULL) { + if (rot==nullptr) { ATH_MSG_WARNING ("Misconfigured fitters: no recalibration input!" ); - return 0; + return nullptr; } - if (rot->prepRawData() == NULL) { + if (rot->prepRawData() == nullptr) { ATH_MSG_WARNING ("Misconfigured fitters: re-calibration called " << "on data without PrepRawData objects available." ); - return 0; + return nullptr; } MeasurementType mType = inputMtype; if (inputMtype == unidentified) mType = m_mbHelper->defineType(&meas); @@ -232,7 +232,7 @@ Trk::MeasRecalibSteeringTool::makeBroadMeasurement(const MeasurementBase& meas, return m_trtTubeHitCreator->correct(*rot->prepRawData(), trkPar); } - return 0; + return nullptr; } //================================================================================ diff --git a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h index 6f269e8329b491fa51be717a4ecb50519520b202..2d87fb1779f42915aa388ff22a3ae2eb05daf40a 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h +++ b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h @@ -52,11 +52,15 @@ public: virtual StatusCode initialize() override; virtual StatusCode finalize() override; - // using TrackFitter::fit; - // iPat Fitter settings (FIXME: to provide??): - // RunOutlierRemoval - use logic to remove bad hits - + // RunOutlierRemoval - use logic to remove bad hits + + /* + * Bring in default impl with + * EventContext for now + */ + using ITrackFitter::fit; + // refit a track virtual Track* fit (const Track&, const RunOutlierRemoval runOutlier=false, diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx index 1443a9166da43219623b87f6d8fbd1924081f926..be5e4226be8957662d3a8701ee332597b551edca 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx @@ -53,10 +53,10 @@ namespace Trk m_scatteringLogCoeff(0.038), // Coulomb scattering constant m_sectorMaxPhi(0.28), m_stationMaxGap(0.6 * Gaudi::Units::meter), - m_calorimeterVolume(0), - m_indetVolume(0), - m_spectrometerEntrance(0), - m_messageHelper(0) { + m_calorimeterVolume(nullptr), + m_indetVolume(nullptr), + m_spectrometerEntrance(nullptr), + m_messageHelper(nullptr) { m_messageHelper = new MessageHelper(*this); declareInterface<IMaterialAllocator>(this); declareProperty("Extrapolator", m_extrapolator); @@ -184,9 +184,9 @@ namespace Trk // check if leading scatterer(s) already present or need to be added (up to delimiter) bool energyGain = false; bool haveDelimiter = false; - const TrackSurfaceIntersection* intersection = 0; + const TrackSurfaceIntersection* intersection = nullptr; int leadingScatterers = 0; - Trk::FitMeasurement* leadingScatterer = 0; + Trk::FitMeasurement* leadingScatterer = nullptr; for (std::vector<Trk::FitMeasurement*>::const_iterator m = measurements.begin(); m != measurements.end(); ++m) { @@ -209,10 +209,10 @@ namespace Trk // find first measurement after delimiter haveDelimiter = false; Amg::Vector3D endPosition = fitParameters.vertex(); - const Surface* firstMeasurementSurface = 0; - Trk::FitMeasurement* leadingOutlier = 0; + const Surface* firstMeasurementSurface = nullptr; + Trk::FitMeasurement* leadingOutlier = nullptr; std::vector<Trk::FitMeasurement*> leadingOutliers; - const Surface* surface = 0; + const Surface* surface = nullptr; for (std::vector<Trk::FitMeasurement*>::const_iterator m = measurements.begin(); m != measurements.end(); ++m) { @@ -248,7 +248,7 @@ namespace Trk charge, fitParameters.vertex()); bool haveMaterial = false; - const std::vector<const TrackStateOnSurface*>* indetMaterial = 0; + const std::vector<const TrackStateOnSurface*>* indetMaterial = nullptr; if (haveDelimiter && intersection && surface && m_indetVolume->inside(endPosition)) { // debug if (msgLvl(MSG::VERBOSE)) { @@ -292,10 +292,10 @@ namespace Trk // clean up after previous attempt deleteMaterial(indetMaterial, garbage); - indetMaterial = 0; + indetMaterial = nullptr; - std::vector<const TrackStateOnSurface*>* indetMaterialF = 0; - const std::vector<const TrackStateOnSurface*>* indetMaterialR = 0; + std::vector<const TrackStateOnSurface*>* indetMaterialF = nullptr; + const std::vector<const TrackStateOnSurface*>* indetMaterialR = nullptr; CurvilinearUVT uvt(intersection->direction()); Amg::Vector2D localPos; PlaneSurface* plane = new PlaneSurface(intersection->position(), uvt); @@ -336,7 +336,7 @@ namespace Trk haveMaterial = true; } indetMaterial = indetMaterialF; - indetMaterialF = 0; + indetMaterialF = nullptr; } } delete indetMaterialR; @@ -402,7 +402,7 @@ namespace Trk // create scatterer FitMeasurement's corresponding to leading material // (intersector running inwards to give parameters with qOverP update) - FitMeasurement* leadingMeas = 0; + FitMeasurement* leadingMeas = nullptr; if (indetMaterial && !indetMaterial->empty()) { std::vector<const TrackStateOnSurface*>::const_reverse_iterator r = indetMaterial->rbegin(); for (; r != indetMaterial->rend(); ++r) { @@ -492,7 +492,7 @@ namespace Trk if (leadingOutliers.size()) { leadingOutlier = leadingOutliers.back(); } else { - leadingOutlier = 0; + leadingOutlier = nullptr; } } } @@ -545,11 +545,11 @@ namespace Trk } } else { delete intersection; - intersection = 0; + intersection = nullptr; } delete perigee; deleteMaterial(indetMaterial, garbage); - indetMaterial = 0; + indetMaterial = nullptr; } // integrate X0, energy loss and contribution to covariance (from leading scatterer towards perigee) @@ -722,14 +722,14 @@ namespace Trk if (!m_trackingGeometrySvc) { // missing TrackingGeometrySvc - no leading material will be added m_messageHelper->printWarning(0); - return 0; + return nullptr; } else { createSpectrometerEntranceOnce(); } } // check input parameters are really in the spectrometer - if (m_calorimeterVolume->inside(spectrometerParameters.position())) return 0; + if (m_calorimeterVolume->inside(spectrometerParameters.position())) return nullptr; const TrackParameters* entranceParameters = m_extrapolator->extrapolateToVolume(spectrometerParameters, @@ -745,7 +745,7 @@ namespace Trk << spectrometerParameters.position().z() << " with p " << std::setw(8) << std::setprecision(3) << spectrometerParameters.momentum().mag() / Gaudi::Units::GeV); - return 0; + return nullptr; } const Surface& entranceSurface = entranceParameters->associatedSurface(); @@ -770,7 +770,7 @@ namespace Trk << " with p " << std::setw(8) << std::setprecision(3) << spectrometerParameters.momentum().mag() / Gaudi::Units::GeV); delete extrapolatedTSOS; - return 0; + return nullptr; } std::vector<FitMeasurement*> leadingMeasurements; @@ -796,9 +796,9 @@ namespace Trk // convert back to TSOS std::vector<FitMeasurement*>::iterator m = leadingMeasurements.begin(); for (; m != leadingMeasurements.end(); ++m) - leadingTSOS->push_back(new TrackStateOnSurface(0, - 0, - 0, + leadingTSOS->push_back(new TrackStateOnSurface(nullptr, + nullptr, + nullptr, (**m).materialEffects()->clone())); deleteMaterial(extrapolatedTSOS, garbage); @@ -843,8 +843,8 @@ namespace Trk startDirection.dot((**m).intersection(FittedTrajectory).position() - startPosition); if (distance < previousDistance) distance += m_orderingTolerance; previousDistance = distance - m_orderingTolerance; - measurementOrder.push_back(std::make_pair(distance, *m)); - originalOrder.push_back(std::make_pair(distance, *m)); + measurementOrder.emplace_back(distance, *m); + originalOrder.emplace_back(distance, *m); } std::sort(measurementOrder.begin(), measurementOrder.end(), compareByDistance()); std::vector< std::pair<double, FitMeasurement*> >::const_iterator orig = originalOrder.begin(); @@ -937,7 +937,7 @@ namespace Trk parameterVector[Trk::loc2], parameterVector[Trk::phi], parameterVector[Trk::theta], - parameterVector[Trk::qOverP], 0); + parameterVector[Trk::qOverP], nullptr); for (std::vector<Trk::FitMeasurement*>::reverse_iterator r = measurements.rbegin(); r != measurements.rend(); @@ -1005,7 +1005,7 @@ namespace Trk // FIXME: modify aggregation function: no aggregation in EC toroid region (~11m) // FIXME: single scatterer in outer delimited pair //printMeasurements(measurements); - FitMeasurement* previous = 0; + FitMeasurement* previous = nullptr; double previousDistance = 0.; Amg::Vector3D startDirection; @@ -1124,7 +1124,7 @@ namespace Trk if (!TGMaterial || TGMaterial->empty()) return TGMaterial; - std::vector<const TrackStateOnSurface*>* duplicates = 0; + std::vector<const TrackStateOnSurface*>* duplicates = nullptr; std::vector<const TrackStateOnSurface*>* material = new std::vector<const TrackStateOnSurface*>; material->reserve(TGMaterial->size()); std::vector<const TrackStateOnSurface*>::const_iterator tg = TGMaterial->begin(); @@ -1167,7 +1167,7 @@ namespace Trk // loop over measurements to define portions of track needing indet material double endIndetDistance = 0.; - FitMeasurement* endIndetMeasurement = 0; + FitMeasurement* endIndetMeasurement = nullptr; double qOverP = startParameters.charge() / startParameters.momentum().mag(); Amg::Vector3D startDirection = startParameters.momentum().unit(); @@ -1349,7 +1349,7 @@ namespace Trk } // firstly: add the material belonging to each measurement layer (and skip leading material) - FitMeasurement* leadingDelimiter = 0; + FitMeasurement* leadingDelimiter = nullptr; Amg::Vector3D nextMomentum(0., 0., 0.); Amg::Vector3D nextPosition(0., 0., 0.); m = measurements.begin(); @@ -1361,9 +1361,9 @@ namespace Trk Amg::Vector3D direction = (**m).intersection(FittedTrajectory).direction(); Amg::Vector3D position = (**m).intersection(FittedTrajectory).position(); double closestDistance = direction.dot(position - startPosition); - const MaterialEffectsOnTrack* materialEffects = 0; - const TrackParameters* materialParameters = 0; - const Surface* materialSurface = 0; + const MaterialEffectsOnTrack* materialEffects = nullptr; + const TrackParameters* materialParameters = nullptr; + const Surface* materialSurface = nullptr; // find the closest material TSOS (inside radial tolerance) for (; s != indetMaterialEnd; ++s) { @@ -1384,7 +1384,7 @@ namespace Trk --m; if (std::abs(nextDistance) < distance && distance > tolerance) { if (s != indetMaterial->begin()) --s; - materialSurface = 0; + materialSurface = nullptr; break; } closestDistance = distance; @@ -1427,7 +1427,7 @@ namespace Trk // insert material at measurement surface const std::bitset<MaterialEffectsBase::NumberOfMaterialEffectsTypes> typePattern; - const Trk::EnergyLoss* energyLoss = 0; + const Trk::EnergyLoss* energyLoss = nullptr; if (materialEffects->energyLoss()) energyLoss = materialEffects->energyLoss()->clone(); MaterialEffectsOnTrack* meot = new MaterialEffectsOnTrack(materialEffects->thicknessInX0(), energyLoss, @@ -1537,11 +1537,11 @@ namespace Trk double /*particleMass*/) const { // aggregation possible in indet and MS. Frequent occurrence in MS ATH_MSG_INFO("segment material aggregation " << material.size()); - FitMeasurement* measurement1 = 0; - FitMeasurement* measurement2 = 0; + FitMeasurement* measurement1 = nullptr; + FitMeasurement* measurement2 = nullptr; if (!material.size()) return std::pair<FitMeasurement*, FitMeasurement*>(measurement1, measurement2); - Amg::Vector3D* referencePosition = 0; + Amg::Vector3D* referencePosition = nullptr; int adjacentScatterers = 0; @@ -1775,8 +1775,8 @@ namespace Trk bool haveAggregation = false; bool makeAggregation = false; double maxDistance = 0.; - FitMeasurement* measurement1 = 0; - FitMeasurement* measurement2 = 0; + FitMeasurement* measurement1 = nullptr; + FitMeasurement* measurement2 = nullptr; double totalDistance = 0.; double totalDistanceSq = 0.; double totalEnergyDeposit = 0.; @@ -1870,7 +1870,7 @@ namespace Trk // msg() << " distance out of bounds: range " << distance // << " to " << 0. << endmsg; } else { - FitMeasurement* after = 0; + FitMeasurement* after = nullptr; FitMeasurement* before = *start; double previousDistance = 0.; haveAggregation = true; @@ -1960,8 +1960,8 @@ namespace Trk if (measurement1) aggregateScatterers.push_back(measurement1); if (measurement2) aggregateScatterers.push_back(measurement2); if (keepCurrentMeas) aggregateScatterers.push_back(*m); - measurement1 = 0; - measurement2 = 0; + measurement1 = nullptr; + measurement2 = nullptr; break; } before = *s; @@ -2091,7 +2091,7 @@ namespace Trk MaterialAllocator::measurementFromTSOS(const TrackStateOnSurface& tsos, double outgoingEnergy, double particleMass) const { - if (!tsos.trackParameters() || !tsos.materialEffectsOnTrack()) return 0; + if (!tsos.trackParameters() || !tsos.materialEffectsOnTrack()) return nullptr; double deltaE = outgoingEnergy - tsos.trackParameters()->momentum().mag(); double thicknessInX0 = tsos.materialEffectsOnTrack()->thicknessInX0(); @@ -2296,8 +2296,8 @@ namespace Trk ATH_MSG_DEBUG(" spectrometerMaterial: ALARM no material found on track can happen for MuGirl"); // material has to be added: need inner and outer TrackParameters - FitMeasurement* innerMeasurement = 0; - FitMeasurement* outerMeasurement = 0; + FitMeasurement* innerMeasurement = nullptr; + FitMeasurement* outerMeasurement = nullptr; for (m = measurements.begin(); m != measurements.end(); ++m) { if (!(**m).isPositionMeasurement() || (**m).isOutlier()) continue; Amg::Vector3D position = (**m).intersection(FittedTrajectory).position(); @@ -2326,7 +2326,7 @@ namespace Trk } // entranceParameters are at the MS entrance surface (0 if perigee downstream) - TrackSurfaceIntersection* entranceIntersection = 0; + TrackSurfaceIntersection* entranceIntersection = nullptr; std::unique_ptr<const TrackParameters> entranceParameters; MsgStream log(msgSvc(), name()); if (m_calorimeterVolume->inside(startParameters.position())) { @@ -2398,7 +2398,7 @@ namespace Trk double endSpectrometerDistance = startDirection.dot( measurements.back()->intersection(FittedTrajectory).position() - startPosition); - const std::vector<const TrackStateOnSurface*>* spectrometerMaterial = 0; + const std::vector<const TrackStateOnSurface*>* spectrometerMaterial = nullptr; // protect the momentum to avoid excessive Eloss @@ -2416,7 +2416,7 @@ namespace Trk parameterVector[Trk::loc2], parameterVector[Trk::phi], parameterVector[Trk::theta], - parameterVector[Trk::qOverP], 0)); + parameterVector[Trk::qOverP], nullptr)); if (entranceParameters) { const Surface& entranceSurface = entranceParameters->associatedSurface(); @@ -2480,7 +2480,7 @@ namespace Trk if (!spectrometerMaterial || spectrometerMaterial->empty()) { m_messageHelper->printWarning(5); delete spectrometerMaterial; - spectrometerMaterial = 0; + spectrometerMaterial = nullptr; } else { std::vector<const TrackStateOnSurface*>::const_reverse_iterator s = spectrometerMaterial->rbegin(); diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx index faf22e2e7c3f99fc88d72cd0f03ad13deb068bd8..05b7a54a139069f1df081997d010d4806a67a9d3 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx @@ -426,7 +426,7 @@ namespace Trk const Perigee* indetPerigee = dynamic_cast<const Perigee*>(indetTrack.perigeeParameters()); const Perigee* spectrometerPerigee = dynamic_cast<const Perigee*>(spectrometerTrack.perigeeParameters()); if (spectrometerPerigee - && !m_indetVolume->inside(spectrometerPerigee->associatedSurface().center())) { spectrometerPerigee = 0; } + && !m_indetVolume->inside(spectrometerPerigee->associatedSurface().center())) { spectrometerPerigee = nullptr; } if (!spectrometerTrack.info().trackProperties(Trk::TrackInfo::StraightTrack) && spectrometerPerigee) { if (indetTrack.info().trackProperties(Trk::TrackInfo::StraightTrack) diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx index 19730ec79700779d6328158bb20a475326a4394f..ab2a1f12ecae3455e389fef671c8014f3616a650 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatGlobalFitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -74,7 +74,7 @@ namespace Trk rows += m->numberDoF(); } - if (!numberParameters || !rows) { return 0; } + if (!numberParameters || !rows) { return nullptr; } ATH_MSG_VERBOSE(" DerivMatrix : " << fitState.getMeasurements().size() << " measurement objects giving " << rows << " rows and " << numberParameters << " columns (parameters)");