diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py index 8864dfd23ddd30ae4cc966b4db93c42df83417f6..73ffcae339d5278038d4f9dee701110ea1397454 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/ConstituentPileupIso.py @@ -127,8 +127,7 @@ def ConstituentPileupIso(privateSeq): HadCaloNums = [], TopoClusterEDCentralContainer = "LCTopoClusterIsoCentralEventShape", TopoClusterEDForwardContainer = "LCTopoClusterIsoForwardEventShape", - UseEMScale = False, - addCaloExtensionDecoration = False) + UseEMScale = False) ToolSvc += LCCaloIsolationTool OrigTimeCSCaloIsolationTool = xAOD__CaloIsolationTool(name = "OrigTimeCSCaloIsolationTool", @@ -139,8 +138,7 @@ def ConstituentPileupIso(privateSeq): saveOnlyRequestedCorrections = False, EMCaloNums = [], HadCaloNums = [], - UseEMScale = False, - addCaloExtensionDecoration = False) + UseEMScale = False) ToolSvc += OrigTimeCSCaloIsolationTool OrigTimeSKCaloIsolationTool = xAOD__CaloIsolationTool(name = "OrigTimeSKCaloIsolationTool", CaloFillRectangularClusterTool = None, @@ -150,8 +148,7 @@ def ConstituentPileupIso(privateSeq): saveOnlyRequestedCorrections = False, EMCaloNums = [], HadCaloNums = [], - UseEMScale = False, - addCaloExtensionDecoration = False) + UseEMScale = False) ToolSvc += OrigTimeSKCaloIsolationTool OrigTimeCSSKCaloIsolationTool = xAOD__CaloIsolationTool(name = "OrigTimeCSSKCaloIsolationTool", CaloFillRectangularClusterTool = None, @@ -161,8 +158,7 @@ def ConstituentPileupIso(privateSeq): saveOnlyRequestedCorrections = False, EMCaloNums = [], HadCaloNums = [], - UseEMScale = False, - addCaloExtensionDecoration = False) + UseEMScale = False) ToolSvc += OrigTimeCSSKCaloIsolationTool TimePFCSCaloIsolationTool = xAOD__CaloIsolationTool(name = "TimePFCSCaloIsolationTool", @@ -173,8 +169,7 @@ def ConstituentPileupIso(privateSeq): saveOnlyRequestedCorrections = False, EMCaloNums = [], HadCaloNums = [], - UseEMScale = True, - addCaloExtensionDecoration = False) + UseEMScale = True) ToolSvc += TimePFCSCaloIsolationTool TimePFSKCaloIsolationTool = xAOD__CaloIsolationTool(name = "TimePFSKCaloIsolationTool", CaloFillRectangularClusterTool = None, @@ -184,8 +179,7 @@ def ConstituentPileupIso(privateSeq): saveOnlyRequestedCorrections = False, EMCaloNums = [], HadCaloNums = [], - UseEMScale = True, - addCaloExtensionDecoration = False) + UseEMScale = True) ToolSvc += TimePFSKCaloIsolationTool TimePFCSSKCaloIsolationTool = xAOD__CaloIsolationTool(name = "TimePFCSSKCaloIsolationTool", CaloFillRectangularClusterTool = None, @@ -195,8 +189,7 @@ def ConstituentPileupIso(privateSeq): saveOnlyRequestedCorrections = False, EMCaloNums = [], HadCaloNums = [], - UseEMScale = True, - addCaloExtensionDecoration = False) + UseEMScale = True) ToolSvc += TimePFCSSKCaloIsolationTool # Import the xAOD isolation parameters. diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py index 518fdf6886822abfc088aedbfd0be767db13b412..fb48387f4a860a63c9d8a76ff4fe4cd5b0c7318e 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMuons/python/TrackIsolationDecorator.py @@ -34,7 +34,6 @@ CaloIsoTool.HadCaloNums = [SUBCALO.LARHEC, SUBCALO.TILE] CaloIsoTool.UseEMScale = True CaloIsoTool.UseCaloExtensionCaching = False CaloIsoTool.saveOnlyRequestedCorrections = True -CaloIsoTool.addCaloExtensionDecoration = False # if hasattr(CaloIsoTool, 'addCaloExtensionDecoration'): ### somehow does not work # CaloIsoTool.addCaloExtensionDecoration = False # CaloIsoTool.OutputLevel = 2 diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py index ffbd4604e370542569667899905d7096122b2aad..d2a9c43567914920b08862f63f465a240ba1c8cb 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METAssocConfig.py @@ -221,7 +221,6 @@ class METAssocConfig: CaloCellAssocTool = Rec__ParticleCaloCellAssociationTool(ParticleCaloExtensionTool = CaloExtensionTool) self.caloisotool = CfgMgr.xAOD__CaloIsolationTool("CaloIsolationTool_MET", saveOnlyRequestedCorrections=True, - addCaloExtensionDecoration=False, ParticleCaloExtensionTool = CaloExtensionTool, ParticleCaloCellAssociationTool = CaloCellAssocTool) #if not hasattr(ToolSvc,self.caloisotool.name()): diff --git a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py index a689ef77774f9aac7a59c829c99a9aba7eb11f7f..f8d4dfb203cdeb9194cd467fd5bd0b175ee92b1e 100644 --- a/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py +++ b/Reconstruction/MET/METReconstruction/python/LegacyRunII/METRecoConfig.py @@ -250,7 +250,6 @@ class METConfig: CaloCellAssocTool = Rec__ParticleCaloCellAssociationTool(ParticleCaloExtensionTool = CaloExtensionTool) self.caloisotool = CfgMgr.xAOD__CaloIsolationTool("CaloIsolationTool_MET", saveOnlyRequestedCorrections=True, - addCaloExtensionDecoration=False, ParticleCaloExtensionTool = CaloExtensionTool, ParticleCaloCellAssociationTool = CaloCellAssocTool) diff --git a/Reconstruction/MET/METReconstruction/python/METAssocCfg.py b/Reconstruction/MET/METReconstruction/python/METAssocCfg.py index cd92a470c9bff9d338da593d6c6cff8458109f02..f1d01e4e3df8887002bc5c82ad780a36165cc4fc 100644 --- a/Reconstruction/MET/METReconstruction/python/METAssocCfg.py +++ b/Reconstruction/MET/METReconstruction/python/METAssocCfg.py @@ -174,7 +174,6 @@ class METAssocConfig: CaloCellAssocTool = CompFactory.getComp("Rec::ParticleCaloCellAssociationTool")(ParticleCaloExtensionTool = CaloExtensionTool) self.caloisotool = CompFactory.getComp("xAOD::CaloIsolationTool")("CaloIsolationTool_MET", saveOnlyRequestedCorrections=True, - addCaloExtensionDecoration=False, ParticleCaloExtensionTool = CaloExtensionTool, ParticleCaloCellAssociationTool = CaloCellAssocTool) self.associators = {} diff --git a/Reconstruction/MET/METReconstruction/python/METRecoCfg.py b/Reconstruction/MET/METReconstruction/python/METRecoCfg.py index 32fab8ba55a9a6d0eaa6a936f69610b8ec0e6aa9..32bdc6c980274c2018278a8265586cbc2f743424 100644 --- a/Reconstruction/MET/METReconstruction/python/METRecoCfg.py +++ b/Reconstruction/MET/METReconstruction/python/METRecoCfg.py @@ -225,7 +225,6 @@ class METConfig: CaloCellAssocTool = CompFactory.getComp("Rec::ParticleCaloCellAssociationTool")(ParticleCaloExtensionTool = CaloExtensionTool) self.caloisotool = CompFactory.getComp("xAOD::CaloIsolationTool")("CaloIsolationTool_MET", saveOnlyRequestedCorrections=True, - addCaloExtensionDecoration=False, ParticleCaloExtensionTool = CaloExtensionTool, ParticleCaloCellAssociationTool = CaloCellAssocTool) diff --git a/Reconstruction/RecoTools/IsolationTool/IsolationTool/CaloIsolationTool.h b/Reconstruction/RecoTools/IsolationTool/IsolationTool/CaloIsolationTool.h index a5a057dd481eebd874aa61a47d3bb0c273cd8061..2efc26cae8eac6e9fbfabef7dc905ae4364c6673 100644 --- a/Reconstruction/RecoTools/IsolationTool/IsolationTool/CaloIsolationTool.h +++ b/Reconstruction/RecoTools/IsolationTool/IsolationTool/CaloIsolationTool.h @@ -363,16 +363,11 @@ namespace xAOD { /** map to the orignal particle */ std::map<const IParticle*, const IParticle*> m_derefMap; - - /** Property: Turn on/off the calo extension decoration. */ - // JM: set to false since I am not sure it's thread-safe - Gaudi::Property<bool> m_addCaloDeco {this, - "addCaloExtensionDecoration", false, "Add the calo decorations"}; /** Property: Initialize read Handles. Default True. For HLT these need to be off. */ Gaudi::Property<bool> m_InitializeReadHandles {this, - "InitializeReadHandles", true, - "Initialize all ReadHandles."}; + "InitializeReadHandles", true, + "Initialize all ReadHandles."}; #ifdef XAOD_ANALYSIS // particlesInCone tool will not be avaible. Write our own... diff --git a/Reconstruction/RecoTools/IsolationTool/Root/CaloIsolationTool.cxx b/Reconstruction/RecoTools/IsolationTool/Root/CaloIsolationTool.cxx index 70b040dd18da9d27a253de9fc7583c8c4394fe25..1ce9a2dc9f8a13a77c15ddfc01ebb411f34d16e2 100644 --- a/Reconstruction/RecoTools/IsolationTool/Root/CaloIsolationTool.cxx +++ b/Reconstruction/RecoTools/IsolationTool/Root/CaloIsolationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -312,13 +312,13 @@ namespace xAOD { // core energy subtraction if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::core57cells))) { if (!correctIsolationEnergy_Eeg57(result,isoTypes,&eg)) - ATH_MSG_WARNING("Could not compute core cell energy for egamma in etcone"); + ATH_MSG_WARNING("Could not compute core cell energy for egamma in etcone"); } // leakage correction if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::ptCorrection))) { if (!PtCorrection(result, eg, isoTypes)) - ATH_MSG_WARNING("Could not apply pt correction to etcone isolation"); + ATH_MSG_WARNING("Could not apply pt correction to etcone isolation"); } return true; @@ -342,6 +342,8 @@ namespace xAOD { initresult(result, corrlist, typesize); std::vector<float> coneSizes; + coneSizes.reserve(isoTypes.size()); + for( auto isoType : isoTypes ){ coneSizes.push_back(Iso::coneSize(isoType)); } @@ -361,7 +363,7 @@ namespace xAOD { if (fwdClus == nullptr && (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::core57cells)))) { // Apply core energy subtraction if (!correctIsolationEnergy_Eeg57(result,isoTypes,&eg)) - ATH_MSG_WARNING("Could not compute core cell energy for egamma in topoetcone"); + ATH_MSG_WARNING("Could not compute core cell energy for egamma in topoetcone"); } // leakage : at least for the time being, no meaning for fwd electron @@ -373,7 +375,7 @@ namespace xAOD { if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::pileupCorrection))) { // do pile-up correction if (!EDCorrection(result,isoTypes,eta,"topo",fwdClus)) - ATH_MSG_WARNING("Could not apply ED correction to topo isolation"); + ATH_MSG_WARNING("Could not apply ED correction to topo isolation"); } return true; @@ -397,6 +399,8 @@ namespace xAOD { initresult(result, corrlist, typesize); std::vector<float> coneSizes; + coneSizes.reserve(isoTypes.size()); + for( auto isoType : isoTypes ){ coneSizes.push_back(Iso::coneSize(isoType)); } @@ -412,20 +416,20 @@ namespace xAOD { if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::core57cells))) { // Apply core energy subtraction if (!correctIsolationEnergy_Eeg57(result,isoTypes,&eg)) - ATH_MSG_WARNING("Could not compute core cell energy for egamma in neflowisol"); + ATH_MSG_WARNING("Could not compute core cell energy for egamma in neflowisol"); } if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::ptCorrection))) { // do pt correction if (!PtCorrection(result, eg, isoTypes)) - ATH_MSG_WARNING("Could not apply pt correction to isolation"); + ATH_MSG_WARNING("Could not apply pt correction to isolation"); } if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::pileupCorrection))) { // do pile-up correction std::string type = "PFlow"; if (!EDCorrection(result,isoTypes,eta,type,nullptr)) - ATH_MSG_WARNING("Could not apply ED correction to topo isolation"); + ATH_MSG_WARNING("Could not apply ED correction to topo isolation"); } return true; @@ -451,13 +455,17 @@ namespace xAOD { initresult(result, corrlist, typesize); std::vector<float> coneSizes; + coneSizes.reserve(isoTypes.size()); + for( auto isoType : isoTypes ){ coneSizes.push_back(Iso::coneSize(isoType)); } float phi = tp.phi(); float eta = tp.eta(); - if(!GetExtrapEtaPhi(&tp,eta,phi,derefMap)) ATH_MSG_WARNING("TrackParticle eta = " << tp.eta() << ", phi = " << tp.phi() << " not updated from extraplation!"); + if(!GetExtrapEtaPhi(&tp,eta,phi,derefMap)) { + ATH_MSG_WARNING("TrackParticle eta = " << tp.eta() << ", phi = " << tp.phi() << " not updated from extraplation!"); + } ATH_MSG_DEBUG("TrackParticle eta = " << tp.eta() << ", phi = " << tp.phi() << ", extrap eta = " << eta << ", phi = " << phi); // The core subtraction with pflow removal is done in the method below @@ -496,7 +504,7 @@ namespace xAOD { /// get it from calo-cluster if it's muon const Muon* mu = dynamic_cast<const Muon*>(derefMap[tp]); if(mu){ - auto cluster = mu->cluster(); + const auto *cluster = mu->cluster(); if(cluster){ float etaT = 0, phiT = 0, dphiT = 0.; int nSample = 0; @@ -506,17 +514,17 @@ namespace xAOD { if(!cluster->hasSampling(s)) continue; ATH_MSG_DEBUG("Sampling: " << i << "eta-phi (" << cluster->etaSample(s) << ", " << cluster->phiSample(s) << ")"); etaT += cluster->etaSample(s); - if( nSample == 0 ) + if( nSample == 0 ){ phiT = cluster->phiSample(s); - else + } + else{ dphiT += xAOD::P4Helpers::deltaPhi( cluster->phiSample(s), phiT ) ; + } nSample++; } if(nSample>0){ eta = etaT/nSample; phi = phiT + dphiT/nSample; - - if(m_addCaloDeco && !Decorated.isAvailable(*tp)) decorateTrackCaloPosition(*tp, eta, phi); return true; }else{ ATH_MSG_WARNING("Muon calo cluster is empty????"); @@ -547,15 +555,11 @@ namespace xAOD { avePoint = (1./intersections.size())*avePoint; eta = avePoint.eta(); phi = avePoint.phi(); - - //JBdVtestif(m_addCaloDeco) decorateTrackCaloPosition(*tp, eta, phi); - if(m_addCaloDeco && !Decorated.isAvailable(*tp)) decorateTrackCaloPosition(*tp, eta, phi); return true; }else{ ATH_MSG_WARNING("Muon Calo extension got no intersection!!!"); } #endif // xAOD - /// if still not got the updated eta & phi ATH_MSG_WARNING("Calo extension can not be obtained!!!"); return false; @@ -579,7 +583,9 @@ namespace xAOD { unsigned int typesize = isoTypes.size(); initresult(result, corrlist, typesize); std::vector<float> coneSizes; - for( auto isoType : isoTypes ){ + coneSizes.reserve(isoTypes.size()); + +for( auto isoType : isoTypes ){ coneSizes.push_back(Iso::coneSize(isoType)); } @@ -654,7 +660,7 @@ namespace xAOD { for(unsigned int i=0; i<conesf.size(); i++){ double totE = 0.; selector.setConeSize(conesf[i]); - for (auto aCell : association->data()){ + for (const auto *aCell : association->data()){ if( !selector.select(*aCell) ) continue; if (m_ExcludeTG3 && CaloCell_ID::TileGap3 == aCell->caloDDE()->getSampling()) continue; totE += aCell->et(); @@ -669,7 +675,7 @@ namespace xAOD { ATH_MSG_DEBUG("starting etcone, coreCone"); double totE = 0.; selector.setConeSize(coreConeDR); - for (auto aCell : association->data()){ + for (const auto *aCell : association->data()){ if( !selector.select(*aCell) ) continue; if (m_ExcludeTG3 && CaloCell_ID::TileGap3 == aCell->caloDDE()->getSampling()) continue; totE += aCell->et(); @@ -851,7 +857,7 @@ namespace xAOD { // get the cells for the first one; by convention, it must be bigger than all the other cones. EMccl.select(eta,phi,Rmax); - for (auto it: EMccl) { + for (const auto *it: EMccl) { double etacel=it->eta(); double phicel=it->phi(); @@ -869,7 +875,7 @@ namespace xAOD { // get the cells for the first one; by convention, it must be bigger than all the other cones. HADccl.select(eta, phi, Rmax); - for (auto it: HADccl) { + for (const auto *it: HADccl) { // Optionally remove TileGap cells if (m_ExcludeTG3 && CaloCell_ID::TileGap3 == it->caloDDE()->getSampling()) { ATH_MSG_DEBUG("Excluding cell with Et = " << it->et()); @@ -1514,20 +1520,5 @@ bool CaloIsolationTool::correctIsolationEnergy_pflowCore(CaloIsolation& result, return true; } #endif // XAOD_ANALYSIS - // FIXME! This should be updated to use the standard caching of extrapolation to calo - void CaloIsolationTool::decorateTrackCaloPosition(const IParticle& p, float eta, float phi) const{ - static const SG::AuxElement::Decorator< char > dec_Decorated("caloExt_Decorated"); - static const SG::AuxElement::Decorator< float > dec_Eta("caloExt_eta"); - static const SG::AuxElement::Decorator< float > dec_Phi("caloExt_phi"); - - if(!dec_Decorated.isAvailable(p) || dec_Decorated.isAvailableWritable(p)){ - dec_Decorated(p) = 1; - dec_Eta(p) = eta; - dec_Phi(p) = phi; - }else{ - ATH_MSG_WARNING("The writing of caloExt decoration was requested, but couldn't be accomplished"); - } - } - } // end of namespace diff --git a/Reconstruction/RecoTools/IsolationTool/Root/IsolationHelper.cxx b/Reconstruction/RecoTools/IsolationTool/Root/IsolationHelper.cxx index 5068eb74e220b89c3dc31e191fd2af288fa63f5b..db2f9bb5e80c6f1873727c944e7fd00e4e2e94bc 100644 --- a/Reconstruction/RecoTools/IsolationTool/Root/IsolationHelper.cxx +++ b/Reconstruction/RecoTools/IsolationTool/Root/IsolationHelper.cxx @@ -35,7 +35,7 @@ namespace CP { bool IsolationHelper::isolation(float& value, const xAOD::IParticle& par, xAOD::Iso::IsolationType type) const { - auto acc = xAOD::getIsolationAccessor( type ); + const auto *acc = xAOD::getIsolationAccessor( type ); if(acc) { value = (*acc)(par); } else { @@ -125,7 +125,7 @@ namespace CP { for(auto type: types){ float value = 0; if(!isolation(value, *par, type, corrMask)) return false; - auto acc = xAOD::getIsolationAccessor( type ); + const auto *acc = xAOD::getIsolationAccessor( type ); if(acc){ (*acc)(*par) = value; } else { diff --git a/Reconstruction/RecoTools/IsolationTool/Root/TrackIsolationTool.cxx b/Reconstruction/RecoTools/IsolationTool/Root/TrackIsolationTool.cxx index 8518cd768e6274dac09a14b06496280437244c87..1da9b9126ffa503232c97771e9ca5ee4f5ea0b05 100644 --- a/Reconstruction/RecoTools/IsolationTool/Root/TrackIsolationTool.cxx +++ b/Reconstruction/RecoTools/IsolationTool/Root/TrackIsolationTool.cxx @@ -222,7 +222,7 @@ namespace xAOD { if( !indetTrackParticles ) return false; // loop over all track particles - for( const auto tp : *indetTrackParticles ) { + for( const auto *const tp : *indetTrackParticles ) { if( (!m_trkselTool->accept(*tp, input.vertex)) || (m_useTTVATool && !m_ttvaTool->isCompatible(*tp, *input.vertex))){ ATH_MSG_DEBUG("[2] reject track pt = " << tp->pt()); diff --git a/Reconstruction/RecoTools/IsolationTool/src/IsolationTool_AthTest.cxx b/Reconstruction/RecoTools/IsolationTool/src/IsolationTool_AthTest.cxx index 8bc3d40fc4af798c0c2ade634e275f210bdb2070..76a2e741ed1d5efb240160290217104ab2b1f67b 100644 --- a/Reconstruction/RecoTools/IsolationTool/src/IsolationTool_AthTest.cxx +++ b/Reconstruction/RecoTools/IsolationTool/src/IsolationTool_AthTest.cxx @@ -67,7 +67,7 @@ StatusCode IsolationTool_AthTest::initialize() { StatusCode IsolationTool_AthTest::finalize() { ATH_MSG_INFO ("Finalizing " << name() << "..."); - for(auto d: m_decorators) {if(d) delete d;} + for(auto *d: m_decorators) {if(d) delete d;} return StatusCode::SUCCESS; } @@ -83,7 +83,7 @@ StatusCode IsolationTool_AthTest::execute() { } /// Loop over tracks - for(auto particle : *toDecorate) { + for(const auto *particle : *toDecorate) { /// track isolation xAOD::TrackIsolation resultTrack; diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/AdaptiveMultiVertexFitter.h b/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/AdaptiveMultiVertexFitter.h index ec186fb12fe594d69225ebcf5c8a14fa9376557a..a3ce01dfaef3c9a6e3e7541d069e9b2d26c7a15f 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/AdaptiveMultiVertexFitter.h +++ b/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/AdaptiveMultiVertexFitter.h @@ -196,7 +196,7 @@ namespace Trk */ std::vector<double> - collectWeights(const TrackToVtxLink & tracklink) const; + collectWeights(TrackToVtxLink & tracklink) const; /** * Internal function to prepare the compatibility information of all the tracks of the diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveMultiVertexFitter.cxx b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveMultiVertexFitter.cxx index 29caee7f0fb9b65a1e7654c16869f0fe2c1636e6..dbb727f9f7614f6e99f7e3e76660626389dec06d 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveMultiVertexFitter.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveMultiVertexFitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -91,11 +91,11 @@ void AdaptiveMultiVertexFitter::fit(std::vector<xAOD::Vertex*>& allVertices) const { // TODO: put this in a better place - // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata + // Prepare objects needed to add MVF auxdata to the xAOD::Vertex // For optimization of access speed - static const xAOD::Vertex::Decorator<MvfFitInfo*> MvfFitInfo("MvfFitInfo"); - static const xAOD::Vertex::Decorator<bool> isInitialized("isInitialized"); - static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>> VTAV( + static const xAOD::Vertex::Accessor<MvfFitInfo*> MvfFitInfo("MvfFitInfo"); + static const xAOD::Vertex::Accessor<bool> isInitialized("isInitialized"); + static const xAOD::Vertex::Accessor<std::vector<Trk::VxTrackAtVertex*>> VTAV( "VTAV"); ATH_MSG_DEBUG(" Now fitting all vertices "); // create a vector of vertices, to store the old position... @@ -110,7 +110,7 @@ AdaptiveMultiVertexFitter::fit(std::vector<xAOD::Vertex*>& allVertices) const bool shiftIsSmall(true); // now start to iterate do { - for (const auto& pThisVertex : allVertices) { + for (auto* pThisVertex : allVertices) { // now store all the "old positions"; if vertex is added for the first // time this corresponds to the seed (at the same time fitted vertex will // be updated with the constraint information) check if you need to @@ -183,7 +183,7 @@ AdaptiveMultiVertexFitter::fit(std::vector<xAOD::Vertex*>& allVertices) const ATH_MSG_DEBUG("Finished first candidates cycle"); // after having estimated the compatibility of all the vertices, you have to // run again on all vertices, to compute the weights - for (const auto& pThisVertex : allVertices) { + for (auto* pThisVertex : allVertices) { // TODO: crude and quite possibly time consuming, but best solution I // could think of... // updated VxTrackAtVertices are stored in VTAV decoration: @@ -288,7 +288,7 @@ AdaptiveMultiVertexFitter::fit(std::vector<xAOD::Vertex*>& allVertices) const } } } else { // TODO: I added this during xAOD migration - for (const auto& pThisVertex : allVertices) { + for (auto* pThisVertex : allVertices) { const auto& theseTrackPointersAtVtx = VTAV(*pThisVertex); for (const auto& pTrack : theseTrackPointersAtVtx) { if (pTrack->initialPerigee()) @@ -300,13 +300,13 @@ AdaptiveMultiVertexFitter::fit(std::vector<xAOD::Vertex*>& allVertices) const std::vector<double> AdaptiveMultiVertexFitter::collectWeights( - const Trk::TrackToVtxLink& tracklink) const + Trk::TrackToVtxLink& tracklink) const { ATH_MSG_DEBUG("Collecting weights for tracklink " << &tracklink); // TODO: put this in a better place // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata // For optimization of access speed - static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>> VTAV( + static const xAOD::Vertex::Accessor<std::vector<Trk::VxTrackAtVertex*>> VTAV( "VTAV"); const auto& theseVertices = *(tracklink.vertices()); std::vector<double> myvector; @@ -338,7 +338,7 @@ AdaptiveMultiVertexFitter::addVtxToFit(xAOD::Vertex* newvertex) const // TODO: put this in a better place // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata // For optimization of access speed - static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>> VTAV( + static const xAOD::Vertex::Accessor<std::vector<Trk::VxTrackAtVertex*>> VTAV( "VTAV"); if (VTAV(*newvertex).empty()) { @@ -391,8 +391,8 @@ AdaptiveMultiVertexFitter::prepareCompatibility(xAOD::Vertex* newvertex) const // TODO: put this in a better place // Prepare objects holding the decoration of xAOD::Vertex with MVF auxdata // For optimization of access speed - static const xAOD::Vertex::Decorator<MvfFitInfo*> MvfFitInfo("MvfFitInfo"); - static const xAOD::Vertex::Decorator<std::vector<Trk::VxTrackAtVertex*>> VTAV( + static const xAOD::Vertex::Accessor<MvfFitInfo*> MvfFitInfo("MvfFitInfo"); + static const xAOD::Vertex::Accessor<std::vector<Trk::VxTrackAtVertex*>> VTAV( "VTAV"); const Amg::Vector3D* seedPoint = MvfFitInfo(*newvertex)->seedVertex(); ATH_MSG_VERBOSE("Now adding compatibility info to the track"); diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitterTestAlg.cxx b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitterTestAlg.cxx index c2c2f764cfc17584579e8f3ed6e0a84b336a278e..23b276d99feb82630686c074096f1f3a70a47892 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitterTestAlg.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveVertexFitterTestAlg.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. + * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration. */ /** * @file TrkVertexFitters/src/AdaptiveVertexFitterTestAlg.cxx @@ -35,6 +35,8 @@ template <class T> std::vector<const T*> asVec (const std::vector<std::unique_ptr<T> >& v) { std::vector<const T*> ret; + ret.reserve(v.size()); + for (const std::unique_ptr<T>& p : v) { ret.push_back (p.get()); } @@ -46,6 +48,8 @@ std::vector<const Trk::TrackParameters*> asVec (const std::vector<std::unique_ptr<Trk::Perigee> >& v) { std::vector<const Trk::TrackParameters*> ret; + ret.reserve(v.size()); + for (const std::unique_ptr<Trk::Perigee>& p : v) { ret.push_back (p.get()); } @@ -57,7 +61,9 @@ std::vector<const Trk::NeutralParameters*> asVec (const std::vector<std::unique_ptr<Trk::NeutralPerigee> >& v) { std::vector<const Trk::NeutralParameters*> ret; - for (const std::unique_ptr<Trk::NeutralPerigee>& p : v) { + ret.reserve(v.size()); + +for (const std::unique_ptr<Trk::NeutralPerigee>& p : v) { ret.push_back (p.get()); } return ret;