diff --git a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialManipulation.cxx b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialManipulation.cxx index 1342af941a6cef495fcd176909be0a7812ce4e06..7a445edbab5789d7547380bc3fa15474237a667f 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialManipulation.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialManipulation.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 */ /////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ Trk::MaterialManipulation::MaterialManipulation(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), m_inputLayerMaterialMapName("/GLOBAL/TrackingGeo/Input"), - m_inputLayerMaterialMap(0), + m_inputLayerMaterialMap(nullptr), m_outputLayerMaterialMapName("/GLOBAL/TrackingGeo/Output"), m_layerMaterialManipulator("") { @@ -65,7 +65,7 @@ StatusCode Trk::MaterialManipulation::execute() // create the output material map outputLayerMaterialMap = new Trk::LayerMaterialMap(); // now create the new one and manipulate - for ( auto& lmIter : (*m_inputLayerMaterialMap) ){ + for ( const auto & lmIter : (*m_inputLayerMaterialMap) ){ // copy the layer material ATH_MSG_VERBOSE(" -> Found map for layer with index " << lmIter.first); // use the virtual constructor diff --git a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.cxx b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.cxx index fb4f7d9c942ede85e9a23fd8f8d157c9eef4e5a5..2b4f1875558a263f2a9e7f02d8d225979e992985 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialMapping.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 */ /////////////////////////////////////////////////////////////////// @@ -44,10 +44,10 @@ Trk::MaterialMapping::MaterialMapping(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), m_trackingGeometrySvc("AtlasTrackingGeometrySvc",name), - m_trackingGeometry(0), + m_trackingGeometry(nullptr), m_checkForEmptyHits(true), m_mappingVolumeName("Atlas"), - m_mappingVolume(0), + m_mappingVolume(nullptr), m_inputMaterialStepCollection("MaterialStepRecords"), m_etaCutOff(6.0), m_etaSide(0), @@ -58,7 +58,7 @@ Trk::MaterialMapping::MaterialMapping(const std::string& name, ISvcLocator* pSvc m_materialMapper(""), m_mapComposition(true), m_minCompositionFraction(0.005), - m_elementTable(0), + m_elementTable(nullptr), m_inputEventElementTable("ElementTable"), m_accumulatedMaterialXX0(0.), m_accumulatedRhoS(0.), @@ -122,10 +122,10 @@ StatusCode Trk::MaterialMapping::initialize() if ( !m_layerMaterialRecordAnalyser.empty() && m_layerMaterialRecordAnalyser.retrieve().isFailure() ) ATH_MSG_WARNING("Could not retrieve LayerMaterialAnalyser"); - if ( m_layerMaterialCreators.size() && m_layerMaterialCreators.retrieve().isFailure() ) + if ( !m_layerMaterialCreators.empty() && m_layerMaterialCreators.retrieve().isFailure() ) ATH_MSG_WARNING("Could not retrieve any LayerMaterialCreators"); - if ( m_layerMaterialAnalysers.size() && m_layerMaterialAnalysers.retrieve().isFailure() ) + if ( !m_layerMaterialAnalysers.empty() && m_layerMaterialAnalysers.retrieve().isFailure() ) ATH_MSG_WARNING("Could not retrieve any LayerMaterialAnalysers"); ATH_CHECK( m_inputMaterialStepCollection.initialize() ); @@ -157,7 +157,7 @@ StatusCode Trk::MaterialMapping::execute() SG::ReadHandle<Trk::ElementTable> eTableEvent(m_inputEventElementTable); (*m_elementTable) += (*eTableEvent); // accummulate the table - m_mapComposition = eTableEvent.isValid() ? true : false; + m_mapComposition = eTableEvent.isValid(); // event parameters - associated asteps, and layers hit per event @@ -166,7 +166,7 @@ StatusCode Trk::MaterialMapping::execute() m_accumulatedRhoS = 0.; m_layersRecordedPerEvent.clear(); // clearing the recorded layers per event - if (materialStepCollection.isValid() && materialStepCollection->size()){ + if (materialStepCollection.isValid() && !materialStepCollection->empty()){ // get the number of material steps size_t materialSteps = materialStepCollection->size(); @@ -208,7 +208,7 @@ StatusCode Trk::MaterialMapping::execute() // for screen output size_t ilayer = 0; // find all the intersected material - remember the last parameters - const Trk::NeutralParameters* parameters = 0; + const Trk::NeutralParameters* parameters = nullptr; // loop over the collected information for (auto& es : ecc.extrapolationSteps){ // continue if we have parameters @@ -233,7 +233,7 @@ StatusCode Trk::MaterialMapping::execute() if (ecc.endParameters != parameters) delete ecc.endParameters; // we have no layers and Hits - if (!layersAndHits.size()){ + if (layersAndHits.empty()){ ATH_MSG_VERBOSE("[!] No Layer was intersected - skipping."); return StatusCode::SUCCESS; } @@ -390,7 +390,7 @@ void Trk::MaterialMapping::assignLayerMaterialProperties( const Trk::TrackingVol ATH_MSG_INFO("--> found : "<< layers.size() << "confined Layers"); // the iterator over the vector // loop over layers - for (auto& layer : layers) { + for (const auto & layer : layers) { // assign the material and output if (layer && (*layer).layerIndex().value() ) { ATH_MSG_INFO(" > LayerIndex: "<< (*layer).layerIndex() ); @@ -415,7 +415,7 @@ void Trk::MaterialMapping::assignLayerMaterialProperties( const Trk::TrackingVol const std::vector<const Trk::TrackingVolume*>& volumes = confinedVolumes->arrayObjects(); ATH_MSG_INFO("--> found : "<< volumes.size() << "confined TrackingVolumes"); // loop over volumes - for (auto& volume : volumes) { + for (const auto & volume : volumes) { // assing the material and output if (volume) assignLayerMaterialProperties(*volume, propSet); // call itself recursively @@ -620,7 +620,7 @@ void Trk::MaterialMapping::insertLayerMaterialRecord(const Trk::Layer& lay){ const Trk::BinnedLayerMaterial* layerBinnedMaterial = dynamic_cast<const Trk::BinnedLayerMaterial*>(layerMaterialProperties); // get the binned array - const Trk::BinUtility* layerMaterialBinUtility = (layerBinnedMaterial) ? layerBinnedMaterial->binUtility() : 0; + const Trk::BinUtility* layerMaterialBinUtility = (layerBinnedMaterial) ? layerBinnedMaterial->binUtility() : nullptr; // now fill the layer material record if (layerMaterialBinUtility){ // create a new Layer Material record in the map diff --git a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx index 4a1ad42709ae9de737bfd8d426ed03b283b1aac2..a4a83403772b7d2dc115e21027b0674982c9c69e 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.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 */ /////////////////////////////////////////////////////////////////// @@ -30,10 +30,10 @@ Trk::MaterialValidation::MaterialValidation(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator) , m_trackingGeometrySvc("AtlasTrackingGeometrySvc",name), - m_trackingGeometry(0), + m_trackingGeometry(nullptr), m_materialMapper("Trk::MaterialMapper/MappingMaterialMapper"), m_maxMaterialMappingEvents(25000), - m_flatDist(0), + m_flatDist(nullptr), m_etaMin(-3.), m_etaMax(3.), m_runNativeNavigation(true), @@ -131,7 +131,7 @@ Trk::PositionAtBoundary Trk::MaterialValidation::collectMaterialAndExit(const Tr if (m_runNativeNavigation){ // A : collect all hit layers - auto layerIntersections = tvol.materialLayersOrdered<Trk::NeutralCurvilinearParameters>(NULL,NULL,cvp,Trk::alongMomentum); + auto layerIntersections = tvol.materialLayersOrdered<Trk::NeutralCurvilinearParameters>(nullptr,nullptr,cvp,Trk::alongMomentum); // loop over the layers for (auto& lCandidate : layerIntersections ) { // get the layer @@ -148,11 +148,11 @@ Trk::PositionAtBoundary Trk::MaterialValidation::collectMaterialAndExit(const Tr } } // B : collect all boundary layers, start from last hit layer - Amg::Vector3D lastPosition = collectedMaterial.size() ? collectedMaterial.rbegin()->second.materialPosition() : (position + direction.unit()); + Amg::Vector3D lastPosition = !collectedMaterial.empty() ? collectedMaterial.rbegin()->second.materialPosition() : (position + direction.unit()); Trk::NeutralCurvilinearParameters lcp(lastPosition,direction,0.); // boundary surfaces auto boundaryIntersections = tvol.boundarySurfacesOrdered<Trk::NeutralCurvilinearParameters>(lcp,Trk::alongMomentum); - if (boundaryIntersections.size()){ + if (!boundaryIntersections.empty()){ // by definition is the first one lastPosition = boundaryIntersections.begin()->intersection.position; const Trk::BoundarySurface<Trk::TrackingVolume>* bSurfaceTV = boundaryIntersections.begin()->object; @@ -210,7 +210,7 @@ Trk::PositionAtBoundary Trk::MaterialValidation::collectMaterialAndExit(const Tr // material for confined layers collected, now go to boundary // update the position to the last one - Amg::Vector3D lastPosition = intersectedLayers.size() ? (*(--(intersectedLayers.end()))).second.second : position; + Amg::Vector3D lastPosition = !intersectedLayers.empty() ? (*(--(intersectedLayers.end()))).second.second : position; std::map<double, Trk::VolumeExit > volumeExits; // now find the exit point @@ -235,7 +235,7 @@ Trk::PositionAtBoundary Trk::MaterialValidation::collectMaterialAndExit(const Tr ATH_MSG_VERBOSE("[>>>>] starting position is on surface ! " ); } // prepare the boundary - if (volumeExits.size()){ + if (!volumeExits.empty()){ // get the first entry in the map: closest next volume VolumeExit closestVolumeExit = (*volumeExits.begin()).second; // check if the volume exit boundary has material attached diff --git a/Tracking/TrkDetDescr/TrkDetDescrSvc/src/TrackingGeometrySvc.cxx b/Tracking/TrkDetDescr/TrkDetDescrSvc/src/TrackingGeometrySvc.cxx index f4444202dba6feb6f0d8c813fd20bb303298f912..a58cb229e50ba086eab1d88fc6626517be4fdeeb 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrSvc/src/TrackingGeometrySvc.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrSvc/src/TrackingGeometrySvc.cxx @@ -66,7 +66,7 @@ StatusCode Trk::TrackingGeometrySvc::initialize() std::vector< std::string > tagInfoKeys = m_pDetStore->keys<TagInfo> (); std::string tagInfoKey = ""; - if(tagInfoKeys.size()==0) ATH_MSG_WARNING( " No TagInfo keys in DetectorStore "); + if(tagInfoKeys.empty()) ATH_MSG_WARNING( " No TagInfo keys in DetectorStore "); else { if(tagInfoKeys.size() > 1) ATH_MSG_WARNING( " More than one TagInfo key in the DetectorStore, using the first one " ); tagInfoKey = tagInfoKeys[0]; @@ -163,7 +163,7 @@ StatusCode Trk::TrackingGeometrySvc::trackingGeometryInit(IOVSVC_CALLBACK_ARGS_P if ( m_pDetStore->contains<Trk::TrackingGeometry>(m_trackingGeometryName) ) { ATH_MSG_VERBOSE( "New Callback evoked remove of existing object!" ); // you need to retrieve the object first to remove it - const Trk::TrackingGeometry* oldTrackingGeometry = 0; + const Trk::TrackingGeometry* oldTrackingGeometry = nullptr; if ( m_pDetStore->retrieve(oldTrackingGeometry,m_trackingGeometryName).isFailure() ) ATH_MSG_WARNING( "Callback evoked remove of '" << m_trackingGeometryName << "'. But retrieve did not succeed! " ); if (oldTrackingGeometry && m_pDetStore->remove<Trk::TrackingGeometry>(oldTrackingGeometry).isFailure() ) diff --git a/Tracking/TrkDetDescr/TrkDetDescrSvc/src/TrackingVolumesSvc.cxx b/Tracking/TrkDetDescr/TrkDetDescrSvc/src/TrackingVolumesSvc.cxx index 4c0753354d6f7696f74b997a0c20964bce79ddf1..e9f4f385ef2d210bad3da7a0d6570b6730368d2a 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrSvc/src/TrackingVolumesSvc.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrSvc/src/TrackingVolumesSvc.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 */ /////////////////////////////////////////////////////////////////// @@ -30,20 +30,20 @@ Trk::TrackingVolumesSvc::TrackingVolumesSvc(const std::string& a_name,ISvcLocato m_volumeNames.reserve(Trk::ITrackingVolumesSvc::NumIdentifiers); //set defaults - m_volumeNames.push_back("CalorimeterEntryLayer"); - m_volumeNames.push_back("MuonSpectrometerEntryLayer"); - m_volumeNames.push_back("MuonSpectrometerExitLayer"); + m_volumeNames.emplace_back("CalorimeterEntryLayer"); + m_volumeNames.emplace_back("MuonSpectrometerEntryLayer"); + m_volumeNames.emplace_back("MuonSpectrometerExitLayer"); // For the moment, assuming volumes are at 0,0,0 and perfectly aligned (i.e. passing 0) // Adding values by hand - this should be changed (i.e. retrieved from a database?) // EJWM m_volumes[Trk::ITrackingVolumesSvc::CalorimeterEntryLayer] - = new Trk::Volume(0, new Trk::CylinderVolumeBounds(1100.0, 3200.0)); + = new Trk::Volume(nullptr, new Trk::CylinderVolumeBounds(1100.0, 3200.0)); m_volumes[Trk::ITrackingVolumesSvc::MuonSpectrometerEntryLayer] - = new Trk::Volume(0, new Trk::CylinderVolumeBounds(4250.0, 6779.0)); + = new Trk::Volume(nullptr, new Trk::CylinderVolumeBounds(4250.0, 6779.0)); m_volumes[Trk::ITrackingVolumesSvc::MuonSpectrometerExitLayer] - = new Trk::Volume(0, new Trk::CylinderVolumeBounds(15000.0, 21000.0)); // FIXME! Put in correct values. EJWM + = new Trk::Volume(nullptr, new Trk::CylinderVolumeBounds(15000.0, 21000.0)); // FIXME! Put in correct values. EJWM // the name of the TrackingVolume to be built -------------------------------- //declareProperty( "VolumeNames", m_volumeNames, "The names of the TrackingVolume to be built"); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryJsonDumper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryJsonDumper.cxx index 43d78d6609e61e3e94dcf547f5572077dc4f5bc4..288b93effb23c99e226018bd036cbbabab68dfd9 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryJsonDumper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryJsonDumper.cxx @@ -89,7 +89,7 @@ StatusCode Trk::GeometryJsonDumper::processNode(const Trk::Layer& lay, size_t /* size_t is = 1; // now loop of the surfaces and dumpt their position m_outputFile << "\"Coords\": ["; - for (auto& sf : lay.surfaceArray()->arrayObjects()){ + for (const auto & sf : lay.surfaceArray()->arrayObjects()){ // get x,y,z double cx = sf->center().x(); double cy = sf->center().y(); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryTTreeDumper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryTTreeDumper.cxx index 235a3b74adb3296bafffbcbe9d7da385bf9df8ac..571d164def3e3a7662fe212708330f8ed19dc42e 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryTTreeDumper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryTTreeDumper.cxx @@ -24,7 +24,7 @@ // constructor Trk::GeometryTTreeDumper::GeometryTTreeDumper(const std::string& t, const std::string& n, const IInterface* p) : Trk::RecursiveGeometryProcessor(t,n,p), - m_currentTree(0), + m_currentTree(nullptr), m_treeFolder("/val/") {} @@ -41,7 +41,7 @@ StatusCode Trk::GeometryTTreeDumper::processNode(const Trk::TrackingVolume& tvol // create the Tree for this TrackingVolume m_currentTree = new TTree(tvol.volumeName().c_str(),"Geometrical information"); - ITHistSvc* tHistSvc = 0; + ITHistSvc* tHistSvc = nullptr; if (service("THistSvc",tHistSvc).isFailure()) { ATH_MSG_FATAL( "initialize() Could not find Hist Service! Aborting." ); delete m_currentTree; diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialAnalyser.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialAnalyser.cxx index a6581c7997fba500cd26d67a1a1130f3d839a378..2e5ea721968bb0dd7857ab09b88f68b25168f6ab 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialAnalyser.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialAnalyser.cxx @@ -65,7 +65,7 @@ StatusCode Trk::LayerMaterialAnalyser::initialize() { // now register the Tree - ITHistSvc* tHistSvc = 0; + ITHistSvc* tHistSvc = nullptr; // ------------- validation section ------------------------------------------ m_validationTree = new TTree(m_validationTreeName.c_str(), m_validationTreeDescription.c_str()); @@ -94,12 +94,12 @@ StatusCode Trk::LayerMaterialAnalyser::initialize() // now register the Tree if (service("THistSvc",tHistSvc).isFailure()) { ATH_MSG_ERROR("initialize() Could not find Hist Service -> Switching ValidationMode Off !" ); - delete m_validationTree; m_validationTree = 0; + delete m_validationTree; m_validationTree = nullptr; return StatusCode::SUCCESS; } if ((tHistSvc->regTree(m_validationTreeFolder.c_str(), m_validationTree)).isFailure()) { ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !" ); - delete m_validationTree; m_validationTree = 0; + delete m_validationTree; m_validationTree = nullptr; return StatusCode::SUCCESS; } @@ -140,7 +140,7 @@ StatusCode Trk::LayerMaterialAnalyser::analyseLayerMaterial(const Trk::Layer& la size_t mBins0 = bUtility ? bUtility->max(0)+1 : 1; size_t mBins1 = bUtility ? bUtility->max(1)+1 : 1; - Trk::MaterialPropertiesMatrix mpMatrix(mBins1, std::vector< const Trk::MaterialProperties*>(mBins0, 0)); + Trk::MaterialPropertiesMatrix mpMatrix(mBins1, std::vector< const Trk::MaterialProperties*>(mBins0, nullptr)); for (size_t ibin1 = 0; ibin1 < mBins1; ++ ibin1){ for (size_t ibin0 = 0; ibin0 < mBins0; ++ibin0) mpMatrix[ibin1][ibin0] = lMaterial.material(ibin0, ibin1); @@ -210,9 +210,9 @@ StatusCode Trk::LayerMaterialAnalyser::analyse(const Trk::Layer& layer, m_layerBins1 = 0; m_layerBins = 0; int bin1 = 0; - for (auto& outerIter : mpMatrix){ + for (const auto & outerIter : mpMatrix){ int bin0 = 0; - for (auto& innerIter : outerIter ){ + for (const auto & innerIter : outerIter ){ m_bin0[m_layerBins] = bin0; m_bin1[m_layerBins] = bin1; // get the material diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialInspector.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialInspector.cxx index a3efa72db2145047228b4564b84627da883c5bb0..95eea86082cb82e298de73ca2ac4f7ecb7a6eb33 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialInspector.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialInspector.cxx @@ -123,7 +123,7 @@ StatusCode Trk::LayerMaterialInspector::processNode(const Trk::Layer& lay, size_ TString regHistName = folderName+"/"+hName+"/"+hName+pXo; TString regTreeName = folderName+"/"+hName+"/"+hName+info; - ITHistSvc* tHistSvc = 0; + ITHistSvc* tHistSvc = nullptr; if (service("THistSvc",tHistSvc).isFailure()) { ATH_MSG_FATAL( "initialize() Could not find Hist Service! Aborting." ); return StatusCode::FAILURE; diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/MaterialMapper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/MaterialMapper.cxx index 09bf5c434a27184fe3dcf82b7e826fa2a49f5c99..d88ac68c5090af1df3580dede9ba460ab8a4d527 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/MaterialMapper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/MaterialMapper.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 */ /////////////////////////////////////////////////////////////////// @@ -26,7 +26,7 @@ Trk::MaterialMapper::MaterialMapper(const std::string& t, const std::string& n, m_maxMappingEvents(100000), m_processedEvents(0), m_totalMaterialTree("TotalMaterial"), - m_validationTree(0), + m_validationTree(nullptr), m_validationTreeName("MaterialMapper"), m_validationTreeDescription("Material Effects Updator information"), m_validationTreeFolder("/val/MaterialMapper"), @@ -426,7 +426,7 @@ Trk::VolumeTreeObject* Trk::MaterialMapper::volumeTreeObject(const Trk::Layer* l auto endIter = lay ? m_volumeTrees.end() : m_volumeTreesUnmapped.end(); auto findIter = lay ? m_volumeTrees.end() : m_volumeTreesUnmapped.end(); - Trk::VolumeTreeObject* tvolTreeObj = 0; + Trk::VolumeTreeObject* tvolTreeObj = nullptr; findIter = lay ? m_volumeTrees.find(tvol) : m_volumeTreesUnmapped.find(tvol); @@ -457,14 +457,14 @@ Trk::VolumeTreeObject* Trk::MaterialMapper::volumeTreeObject(const Trk::Layer* l m_volumeTreesUnmapped.insert(std::make_pair(tvol,tvolTreeObj)); // now register the Tree - ITHistSvc* tHistSvc = 0; + ITHistSvc* tHistSvc = nullptr; if (service("THistSvc",tHistSvc).isFailure()) { ATH_MSG_ERROR( "initialize() Could not find Hist Service -> Switching Tree output for this volume off !" ); - delete tvolTreeObj; tvolTreeObj = 0; + delete tvolTreeObj; tvolTreeObj = nullptr; } else if (tHistSvc && (tHistSvc->regTree(treeRegName.Data(), (*tvolTreeObj).tree)).isFailure()) { ATH_MSG_ERROR( "initialize() Could not register the validation Tree -> Switching Tree output for this volume off !" ); - delete tvolTreeObj; tvolTreeObj = 0; + delete tvolTreeObj; tvolTreeObj = nullptr; } } else // a tree is found @@ -476,13 +476,13 @@ Trk::VolumeTreeObject* Trk::MaterialMapper::volumeTreeObject(const Trk::Layer* l Trk::LayerTreeObject* Trk::MaterialMapper::layerTreeObject(const Trk::Layer& lay, bool full) const { - if (!lay.layerIndex().value()) return 0; + if (!lay.layerIndex().value()) return nullptr; // try to find the histogram auto endIter = m_layerTrees.end(); auto findIter = m_layerTrees.end(); - Trk::LayerTreeObject* layTreeObj = 0; + Trk::LayerTreeObject* layTreeObj = nullptr; findIter = full ? m_layerFullTrees.find(&lay) : m_layerTrees.find(&lay); if (findIter == endIter) { @@ -520,14 +520,14 @@ Trk::LayerTreeObject* Trk::MaterialMapper::layerTreeObject(const Trk::Layer& lay else m_layerTrees.insert(std::make_pair(&lay,layTreeObj)); // now register the Tree - ITHistSvc* tHistSvc = 0; + ITHistSvc* tHistSvc = nullptr; if (service("THistSvc",tHistSvc).isFailure()) { ATH_MSG_ERROR( "initialize() Could not find Hist Service -> Switching Tree output for this layer off !" ); - delete layTreeObj; layTreeObj = 0; + delete layTreeObj; layTreeObj = nullptr; } else if (tHistSvc && (tHistSvc->regTree(treeRegName.Data(), (*layTreeObj).tree)).isFailure()) { ATH_MSG_ERROR( "initialize() Could not register the validation Tree -> Switching Tree output for this layer off !" ); - delete layTreeObj; layTreeObj = 0; + delete layTreeObj; layTreeObj = nullptr; } } else // a tree is found @@ -543,7 +543,7 @@ Trk::SurfaceTreeObject* Trk::MaterialMapper::surfaceTreeObject(const Trk::Layer& auto endIter = m_surfaceTrees.end(); auto findIter = m_surfaceTrees.end(); - Trk::SurfaceTreeObject* surfTreeObj = 0; + Trk::SurfaceTreeObject* surfTreeObj = nullptr; findIter = m_surfaceTrees.find(&lay); if (findIter == endIter) { @@ -568,14 +568,14 @@ Trk::SurfaceTreeObject* Trk::MaterialMapper::surfaceTreeObject(const Trk::Layer& m_surfaceTrees.insert(std::make_pair(&lay,surfTreeObj)); // now register the Tree - ITHistSvc* tHistSvc = 0; + ITHistSvc* tHistSvc = nullptr; if (service("THistSvc",tHistSvc).isFailure()) { ATH_MSG_INFO( "initialize() Could not find Hist Service -> Switching Tree output for this surface off !" ); - delete surfTreeObj; surfTreeObj = 0; + delete surfTreeObj; surfTreeObj = nullptr; } else if (tHistSvc && (tHistSvc->regTree(treeRegName.Data(), (*surfTreeObj).tree)).isFailure()) { ATH_MSG_INFO( "initialize() Could not register the validation Tree -> Switching Tree output for this surface off !" ); - delete surfTreeObj; surfTreeObj = 0; + delete surfTreeObj; surfTreeObj = nullptr; } } else // a tree is found @@ -624,7 +624,7 @@ void Trk::MaterialMapper::bookValidationTree() ATH_MSG_INFO( "Booking the Validation Tree ... " ); // now register the Tree - ITHistSvc* tHistSvc = 0; + ITHistSvc* tHistSvc = nullptr; // (1) Main MaterialMapper TTree // ------------- validation section ------------------------------------------ @@ -662,12 +662,12 @@ void Trk::MaterialMapper::bookValidationTree() // now register the Tree if (service("THistSvc",tHistSvc).isFailure()) { ATH_MSG_ERROR("initialize() Could not find Hist Service -> Switching ValidationMode Off !" ); - delete m_validationTree; m_validationTree = 0; + delete m_validationTree; m_validationTree = nullptr; return; } if ((tHistSvc->regTree(m_validationTreeFolder.c_str(), m_validationTree)).isFailure()) { ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !" ); - delete m_validationTree; m_validationTree = 0; + delete m_validationTree; m_validationTree = nullptr; return; } diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/RandomSurfacesBuilder.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/RandomSurfacesBuilder.cxx index 52c9b6566b1036227bb2dc305630fee98cd9631e..d8d98a00be5bde59795e96c195d7fabe2c95a6ca 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/RandomSurfacesBuilder.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/RandomSurfacesBuilder.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 */ /////////////////////////////////////////////////////////////////// @@ -23,8 +23,8 @@ Trk::RandomSurfaceBuilder::RandomSurfaceBuilder(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), m_rndmSvc("RndmGenSvc", n), - m_gaussDist(0), - m_flatDist(0), + m_gaussDist(nullptr), + m_flatDist(nullptr), m_numberOfSurfaces(100), m_enableCones(false) { @@ -89,9 +89,9 @@ const std::vector<const Trk::Surface*>* Trk::RandomSurfaceBuilder::surfaces() co const Trk::Surface* Trk::RandomSurfaceBuilder::surface() const { - if (m_worldDimensions.size() < 3 ) return 0; + if (m_worldDimensions.size() < 3 ) return nullptr; - const Trk::Surface* surface = 0; + const Trk::Surface* surface = nullptr; int sType = std::floor(m_flatDist->shoot()*6); // neglect 0 if you don't do cones diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/RecursiveGeometryProcessor.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/RecursiveGeometryProcessor.cxx index 1fe9d38a6c1e62ec583fa0b7892a23d70c452a38..56d827d8198cb7e16b518362c9ba938132297b25 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/RecursiveGeometryProcessor.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/RecursiveGeometryProcessor.cxx @@ -75,9 +75,9 @@ StatusCode Trk::RecursiveGeometryProcessor::process(const Trk::TrackingVolume& t const Trk::LayerArray* layerArray = tvol.confinedLayers(); if (layerArray) { // display output - auto& layers = layerArray->arrayObjects(); + const auto & layers = layerArray->arrayObjects(); ATH_MSG_VERBOSE(displayBuffer.str() << "--> has " << layers.size() << " confined layers." ); - for (auto& layIter : layers){ + for (const auto & layIter : layers){ if (!layIter) ATH_MSG_WARNING("Zero-pointer found in LayerArray - indicates problem !"); if ((layIter) && process(*layIter, level).isFailure()){ @@ -88,8 +88,8 @@ StatusCode Trk::RecursiveGeometryProcessor::process(const Trk::TrackingVolume& t } // Process the boundary surface layers - auto& bSurfaces = tvol.boundarySurfaces(); - for (auto& bsIter : bSurfaces ){ + const auto & bSurfaces = tvol.boundarySurfaces(); + for (const auto & bsIter : bSurfaces ){ if (bsIter->surfaceRepresentation().associatedLayer()){ ATH_MSG_VERBOSE(displayBuffer.str() << "--> has a boundary layer." ); if ( process(*bsIter->surfaceRepresentation().associatedLayer(), level).isFailure() ){ @@ -104,8 +104,8 @@ StatusCode Trk::RecursiveGeometryProcessor::process(const Trk::TrackingVolume& t const Trk::BinnedArray< Trk::TrackingVolume >* confinedVolumes = tvol.confinedVolumes(); // register the next round if (confinedVolumes) { - auto& volumes = confinedVolumes->arrayObjects(); - for (auto& volumesIter : volumes){ + const auto & volumes = confinedVolumes->arrayObjects(); + for (const auto & volumesIter : volumes){ if (!volumesIter) ATH_MSG_WARNING("Zero-pointer found in VolumeArray - indicates problem !"); if (volumesIter && process(*volumesIter, ++level).isFailure() ){ diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/TrackingVolumeDisplayer.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/TrackingVolumeDisplayer.cxx index a90f95cfec6d9c364391e2f58e0c9e6e29d4d0d9..7258fa2ccbca279d703643fb01830c83a3eb0a5d 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/TrackingVolumeDisplayer.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/TrackingVolumeDisplayer.cxx @@ -146,7 +146,7 @@ StatusCode Trk::TrackingVolumeDisplayer::processNode(const Trk::TrackingVolume& } // get the name - std::string volumeName = tvol.volumeName(); + const std::string& volumeName = tvol.volumeName(); // write a debug line m_fileVolumeOutput << "// Processing TrackingVolume '" << volumeName << "'. " << '\n'; m_fileVolumeOutput << "CylinderVolume" << m_volumeCounter << " = new TTUBE(\"" << volumeName << "\",\"" << volumeName << "\",\"void\","; @@ -186,9 +186,9 @@ StatusCode Trk::TrackingVolumeDisplayer::processNode(const Trk::Layer& lay, size if (m_fileSurfaceOutputMode) { const Trk::SurfaceArray* surfArray = lay.surfaceArray(); if (surfArray) { - auto& layerSurfaces = surfArray->arrayObjects(); + const auto & layerSurfaces = surfArray->arrayObjects(); // loop over the surfaces and draw them - for (auto& laySurfIter : layerSurfaces) { + for (const auto & laySurfIter : layerSurfaces) { if ( laySurfIter && processNode(*laySurfIter).isFailure()){ ATH_MSG_FATAL("Failed to call processNode(const Surface& sf) on sub surface. Abort."); return StatusCode::FAILURE; @@ -291,8 +291,8 @@ StatusCode Trk::TrackingVolumeDisplayer::processNode(const Trk::Surface& sf, siz nodeString += s_displaySurfaces; // test version just with planar bounds const Trk::RectangleBounds* recBo = dynamic_cast<const Trk::RectangleBounds*>(&(sf.bounds())); - const Trk::TrapezoidBounds* traBo = recBo ? 0 : dynamic_cast<const Trk::TrapezoidBounds*>(&(sf.bounds())); - const Trk::DiscTrapezoidalBounds* disctraBo = (recBo || traBo) ? 0 : dynamic_cast<const Trk::DiscTrapezoidalBounds*>(&(sf.bounds())); + const Trk::TrapezoidBounds* traBo = recBo ? nullptr : dynamic_cast<const Trk::TrapezoidBounds*>(&(sf.bounds())); + const Trk::DiscTrapezoidalBounds* disctraBo = (recBo || traBo) ? nullptr : dynamic_cast<const Trk::DiscTrapezoidalBounds*>(&(sf.bounds())); if (recBo) { // it is a rectangle surface double halfX = recBo->halflengthX(); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/VertexMapper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/VertexMapper.cxx index ec23211d40ae6656df54deea4aee0e32e737c6b1..026faaee7fb31ff5dc6f641c82e4cbebc56c7742 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/VertexMapper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/VertexMapper.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 */ /////////////////////////////////////////////////////////////////// @@ -15,7 +15,7 @@ // constructor Trk::VertexMapper::VertexMapper(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_trackingGeometry(0), + m_trackingGeometry(nullptr), m_trackingGeometryName("AtlasTrackingGeometry") { declareInterface<IVertexMapper>(this); @@ -73,14 +73,14 @@ Trk::MappedVertex Trk::VertexMapper::mapToLocal(const Amg::Vector3D& vertex) con const std::vector<const Trk::Layer*>& mLayerObjects = mLayerArray->arrayObjects(); std::vector<const Trk::Layer*> mSensitiveLayers; // loop over for the extraction - and check if they have a sub surface array - for (auto& mLayer : mLayerObjects){ + for (const auto & mLayer : mLayerObjects){ if (mLayer->surfaceArray()){ // remember this layer mSensitiveLayers.push_back(mLayer); } } // now find out the closest - if you have layers to test - if (mSensitiveLayers.size()){ + if (!mSensitiveLayers.empty()){ // prepare the book keepint double mDistance = 10e10; const Layer* mLayer = nullptr; diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/CompoundLayerMaterialCreator.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/CompoundLayerMaterialCreator.cxx index f9ed73428b74c007bd74de234f7971d3d80094f4..6267cbde18cb17168678d151cadc1a4d142bb0a8 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/CompoundLayerMaterialCreator.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/CompoundLayerMaterialCreator.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 */ /////////////////////////////////////////////////////////////////// @@ -7,6 +7,8 @@ /////////////////////////////////////////////////////////////////// // STL +#include <cmath> + #include <sstream> // Trk include #include "TrkDetDescrTools/CompoundLayerMaterialCreator.h" @@ -115,8 +117,8 @@ Trk::LayerMaterialProperties* Trk::CompoundLayerMaterialCreator::createCompoundL double tMax = 0., xMax = 0., lMax = 0., aMax = 0., zMax = 0., rMax = 0.; // first loop to get the min/max values - for (auto& mo : materialMatrix) - for (auto& mi : mo) { + for (const auto & mo : materialMatrix) + for (const auto & mi : mo) { if (mi){ const Trk::MaterialProperties& mp = (*mi); // macro defined in GeometryStatics @@ -177,17 +179,17 @@ Trk::LayerMaterialProperties* Trk::CompoundLayerMaterialCreator::createCompoundL // second loop : assign the bins & and copy the material composition size_t obin = 0; - for (auto& mo : materialMatrix){ + for (const auto & mo : materialMatrix){ size_t ibin =0; - for (auto& mi : mo) { + for (const auto & mi : mo) { if (mi){ const Trk::MaterialProperties& mp = (*mi); - if (tStore.valueStep > 0.) tStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(lrint(mp.thickness()/tStore.valueStep)+1); - xStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(lrint(mp.x0()/xStore.valueStep)+1); - lStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(lrint(mp.l0()/lStore.valueStep)+1); - aStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(lrint(mp.averageA()/aStore.valueStep)+1); - zStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(lrint(mp.averageZ()/zStore.valueStep)+1); - rStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(lrint(mp.averageRho()/rStore.valueStep)+1); + if (tStore.valueStep > 0.) tStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.thickness()/tStore.valueStep)+1); + xStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.x0()/xStore.valueStep)+1); + lStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.l0()/lStore.valueStep)+1); + aStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.averageA()/aStore.valueStep)+1); + zStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.averageZ()/zStore.valueStep)+1); + rStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.averageRho()/rStore.valueStep)+1); // set the material composition if (mp.material().composition) { compositionMatrix[obin][ibin] = Trk::MaterialComposition(*(mp.material().composition)); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/CompressedLayerMaterialCreator.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/CompressedLayerMaterialCreator.cxx index 7df7b4cc588de3b6bb6de6a4971f40ed55200cbe..f42aa208c246057ab09a0665feace6d721ad86dc 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/CompressedLayerMaterialCreator.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/CompressedLayerMaterialCreator.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 */ /////////////////////////////////////////////////////////////////// @@ -186,13 +186,13 @@ Trk::LayerMaterialProperties* Trk::CompressedLayerMaterialCreator::createCompres } } // merge the bins and ready - materialVector.push_back(0); + materialVector.push_back(nullptr); // prepare the histogram for (size_t izarho = 0; izarho < m_compressedMaterialZARhoBins; ++izarho) { for (size_t ix0 = 0; ix0 < m_compressedMaterialX0Bins; ++ix0) { // get the indexed material properties std::vector< Trk::IndexedMaterial > indexedMaterial = materialHistogram[izarho][ix0]; - if (indexedMaterial.size()) { + if (!indexedMaterial.empty()) { double avT = 0.; // thickness: by default on one layer it should be the same ! double tinX0 = 0.; double tinL0 = 0.; diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/CylinderVolumeCreator.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/CylinderVolumeCreator.cxx index ec1a327cf44b384e67f00b319ca56ff87adde0ec..cd1f441c39aac4a31086202871e630349315a20e 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/CylinderVolumeCreator.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/CylinderVolumeCreator.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 */ /////////////////////////////////////////////////////////////////// @@ -107,14 +107,14 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createTrackingVolume( { // the final one to build / sensitive Volume / Bounds - Trk::TrackingVolume* tVolume = 0; + Trk::TrackingVolume* tVolume = nullptr; // cases are: // (1) volBounds && transform : use both information // (2) volBounds && !transform : centered around 0, but with given bounds // (3) !volBounds && transform : estimate size from layers, use transform // (4) !volBounds && !transform : estimate size & translation from layers - Trk::CylinderVolumeBounds* cylinderBounds = 0; + Trk::CylinderVolumeBounds* cylinderBounds = nullptr; // this is the implementation of CylinderVolumeCreator if (volBounds) { cylinderBounds = dynamic_cast<Trk::CylinderVolumeBounds*>(volBounds); @@ -176,7 +176,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createTrackingVolume( ATH_MSG_VERBOSE("Filling the layers into an appropriate layer array"); // create the Layer Array - Trk::BinnedArray<Trk::Layer>* layerArray = cylLayers.size() ? + Trk::BinnedArray<Trk::Layer>* layerArray = !cylLayers.empty() ? m_layerArrayCreator->cylinderLayerArray(cylLayers, rMin, rMax, @@ -190,7 +190,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createTrackingVolume( tVolume = new Trk::TrackingVolume(transform, cylinderBounds, matprop, - layerArray,0, + layerArray,nullptr, volumeName); // screen output ATH_MSG_VERBOSE( "Created cylindrical volume at z-position :" << tVolume->center().z() ); @@ -210,7 +210,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createTrackingVolume( Trk::BinningType btype) const { // that's what is needed - Trk::CylinderVolumeBounds* cBounds = 0; + Trk::CylinderVolumeBounds* cBounds = nullptr; // screen output ATH_MSG_VERBOSE( "Create cylindrical TrackingVolume '" << volumeName << "'."); @@ -223,7 +223,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createTrackingVolume( << ( ( zMin > zMax ) ? " zMin > zMax (" : " rMin > rMax (" ) << ( ( zMin > zMax ) ? zMin : rMin ) << " > " << ( ( zMin > zMax ) ? zMax : rMax ) << " ) - return 0" ); - return 0; + return nullptr; } // create a Amg::Transform3D and VolumeBounds out of the zMin/zMax @@ -235,7 +235,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createTrackingVolume( cBounds = rMin > 0.1 ? new Trk::CylinderVolumeBounds(rMin, rMax, halflengthZ) : new Trk::CylinderVolumeBounds(rMax, halflengthZ); // transform - Amg::Transform3D* transform = (zPosition != 0) ? new Amg::Transform3D : 0; + Amg::Transform3D* transform = (zPosition != 0) ? new Amg::Transform3D : nullptr; if (transform) (*transform) = Amg::Translation3D(0.,0.,zPosition); @@ -360,7 +360,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createContainerTrackingVo // check if you have more than one volume if (volumes.size() <= (unsigned int)1) { ATH_MSG_WARNING( "None (only one) TrackingVolume given to create container volume (min required: 2) - returning 0 " ); - return 0; + return nullptr; } // screen output @@ -382,7 +382,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createContainerTrackingVo if (firstVolume == lastVolume) { ATH_MSG_WARNING( "Only one TrackingVolume given to create Top level volume (min required: 2) - returning 0 " ); - return 0; + return nullptr; } // get the bounds @@ -393,7 +393,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createContainerTrackingVo // check the dynamic cast if (!firstVolumeBounds || !lastVolumeBounds) { ATH_MSG_WARNING( "VolumeBounds given are not of type: Trk::CylinderVolumeBounds (required) - returning 0 " ); - return 0; + return nullptr; } // check whether it is a r-binned case or a z-binned case @@ -418,7 +418,7 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createContainerTrackingVo // estimate the z - position double zPos = 0.5*(zMin+zMax); // create the HEP transform from the stuff known so far - Amg::Transform3D* topVolumeTransform = fabs(zPos) > 0.1 ? new Amg::Transform3D : 0; + Amg::Transform3D* topVolumeTransform = fabs(zPos) > 0.1 ? new Amg::Transform3D : nullptr; if (topVolumeTransform) (*topVolumeTransform) = Amg::Translation3D(0.,0.,zPos); // create the bounds from the information gathered so far @@ -431,21 +431,21 @@ const Trk::TrackingVolume* Trk::CylinderVolumeCreator::createContainerTrackingVo if (!volumeArray) { ATH_MSG_WARNING( "Creation of TrackingVolume array did not succeed - returning 0 " ); delete topVolumeTransform; delete topVolumeBounds; - return 0; + return nullptr; } // we have the bounds and the volume array, create the volume Trk::TrackingVolume* topVolume = new Trk::TrackingVolume(topVolumeTransform, topVolumeBounds, matprop, - 0, volumeArray, + nullptr, volumeArray, volumeName); // glueing section -------------------------------------------------------------------------------------- if (interGlueTrackingVolume(*topVolume,rCase,buildBoundaryLayers,replaceBoundaryFace).isFailure()) { ATH_MSG_WARNING( "Problem with inter-glueing of TrackingVolumes (needed) - returning 0 " ); delete topVolume; - return 0; + return nullptr; } ATH_MSG_VERBOSE( "[ end ] return newly created container : " << topVolume->volumeName() ); @@ -466,7 +466,7 @@ StatusCode Trk::CylinderVolumeCreator::estimateAndCheckDimension( Trk::BinningType bType) const { // check and bail out if no layers are given - if (!layers.size()) { + if (layers.empty()) { ATH_MSG_VERBOSE( "No layers given, you shouldn't use : "<< type() ); return StatusCode::FAILURE; } @@ -488,7 +488,7 @@ StatusCode Trk::CylinderVolumeCreator::estimateAndCheckDimension( zMaxClean = -10e10; // find out what is there - for (auto& layerIter : layers) { + for (const auto & layerIter : layers) { // initialize double currentRmin = 0.; double currentRmax = 0.; @@ -565,7 +565,7 @@ StatusCode Trk::CylinderVolumeCreator::estimateAndCheckDimension( // create the CylinderBounds from parsed layer inputs cylinderVolumeBounds = new Trk::CylinderVolumeBounds(layerRmin,layerRmax,halflengthFromLayer); // and the transform - transform = concentric ? new Amg::Transform3D : 0; + transform = concentric ? new Amg::Transform3D : nullptr; if (transform) (*transform) = Amg::Translation3D(0.,0.,zEstFromLayerEnv); } else if (cylinderVolumeBounds && !transform &&!concentric){ @@ -711,7 +711,7 @@ void Trk::CylinderVolumeCreator::addFaceVolumes(const Trk::TrackingVolume& tvol, // retrieve the gluevolume descriptor const Trk::GlueVolumesDescriptor& gvDescriptor = tvol.glueVolumesDescriptor(); // if volumes are registered: take them - if (gvDescriptor.glueVolumes(glueFace).size()) { + if (!gvDescriptor.glueVolumes(glueFace).empty()) { // get the navigation level subvolumes std::vector<const Trk::TrackingVolume*>::const_iterator volIter = gvDescriptor.glueVolumes(glueFace).begin(); std::vector<const Trk::TrackingVolume*>::const_iterator volEnd = gvDescriptor.glueVolumes(glueFace).end(); @@ -809,10 +809,10 @@ Trk::CylinderLayer* Trk::CylinderVolumeCreator::createCylinderLayer(double z, { ATH_MSG_VERBOSE( "Creating a CylinderLayer at position " << z << " and radius " << r ); // prepare the material - Trk::LayerMaterialProperties* cylinderMaterial = 0; + Trk::LayerMaterialProperties* cylinderMaterial = nullptr; // positioning - Amg::Transform3D* transform = 0; - transform = (fabs(z)>0.1) ? new Amg::Transform3D : 0; + Amg::Transform3D* transform = nullptr; + transform = (fabs(z)>0.1) ? new Amg::Transform3D : nullptr; if (transform) (*transform) = Amg::Translation3D(0.,0.,z); @@ -842,11 +842,11 @@ Trk::CylinderLayer* Trk::CylinderVolumeCreator::createCylinderLayer(double z, cylinderBounds, *cylinderMaterial, thickness, - 0, int(Trk::passive)) : + nullptr, int(Trk::passive)) : new Trk::CylinderLayer(cylinderBounds, *cylinderMaterial, thickness, - 0, int(Trk::passive)) ; + nullptr, int(Trk::passive)) ; // delete the material delete cylinderMaterial; // and return it @@ -865,10 +865,10 @@ Trk::DiscLayer* Trk::CylinderVolumeCreator::createDiscLayer(double z, ATH_MSG_VERBOSE( "Creating a DiscLayer at position " << z << " and rMin/rMax " << rMin << " / " << rMax); // positioning - Amg::Transform3D* transform = fabs(z)>0.1 ? new Amg::Transform3D : 0; + Amg::Transform3D* transform = fabs(z)>0.1 ? new Amg::Transform3D : nullptr; if (transform) (*transform) = Amg::Translation3D(0.,0.,z); - Trk::BinnedLayerMaterial* discMaterial = 0; + Trk::BinnedLayerMaterial* discMaterial = nullptr; // R is the primary binning for the material Trk::BinUtility layerBinUtility(binsR, rMin, rMax, Trk::open, Trk::binR); @@ -890,7 +890,7 @@ Trk::DiscLayer* Trk::CylinderVolumeCreator::createDiscLayer(double z, discBounds, *discMaterial, thickness, - 0, int(Trk::passive)); + nullptr, int(Trk::passive)); // delete the material delete discMaterial; // and return it diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilder.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilder.cxx index 1681a09595f823a3ab80bef7fbe723307dcf390e..9528e4d184db97f518dd0eeef966fa6e4ecc72db 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilder.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilder.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 */ /////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ const Trk::TrackingGeometry* Trk::GenericGeometryBuilder::trackingGeometry(const ATH_MSG_VERBOSE("Starting to build TrackingGeometry for GeometrySignature : " << m_geometrySignature ); // the geometry to be constructed - const Trk::TrackingGeometry* tGeometry = 0; + const Trk::TrackingGeometry* tGeometry = nullptr; double innerVolumeRadius = 0.; double innerVolumeHalfZ = 0.; @@ -129,7 +129,7 @@ const Trk::TrackingGeometry* Trk::GenericGeometryBuilder::trackingGeometry(const // ------------------------------- overall dimensions ---------------------------------------------- // get the maximum extend in R - for ( auto& rzIter : envelopeDefs){ + for ( const auto & rzIter : envelopeDefs){ if ( rzIter.first > enclosingVolumeRadius ) { // maximal r-extend enclosingVolumeRadius = rzIter.first; @@ -149,7 +149,7 @@ const Trk::TrackingGeometry* Trk::GenericGeometryBuilder::trackingGeometry(const << envelopeDefs[0].second << ", " << envelopeDefs[0].first << " and " << envelopeDefs[1].second << ", " << envelopeDefs[1].first ); // now parse for the extended barrel size_t irz = 0; - for ( auto& rzIter : envelopeDefs){ + for ( const auto & rzIter : envelopeDefs){ if (irz > 1 && rzIter.second > 0 && rzIter.first >= enclosingVolumeRadius ) { // maximal r-extend enclosingExtendedVolumeRadius = envelopeDefs[irz-clockwise*2].first; @@ -166,7 +166,7 @@ const Trk::TrackingGeometry* Trk::GenericGeometryBuilder::trackingGeometry(const // -------------------------------------------------------------------------------------------------- // get the inner radius and half length if a volume is provided - const Trk::CylinderVolumeBounds* cvb = 0; + const Trk::CylinderVolumeBounds* cvb = nullptr; if (innerVol){ cvb = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(innerVol->volumeBounds())); if (cvb){ @@ -253,7 +253,7 @@ const Trk::TrackingGeometry* Trk::GenericGeometryBuilder::trackingGeometry(const } } // and now create the triple - allVolumes = extendedVolumes.size() ? std::vector<const Trk::TrackingVolume*>{extendedVolumes[0],nSector,cSector,pSector,extendedVolumes[1]} : + allVolumes = !extendedVolumes.empty() ? std::vector<const Trk::TrackingVolume*>{extendedVolumes[0],nSector,cSector,pSector,extendedVolumes[1]} : std::vector<const Trk::TrackingVolume*>{nSector,cSector,pSector}; const Trk::TrackingVolume* tVolume = m_trackingVolumeCreator->createContainerTrackingVolume(allVolumes, vacuum, diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilderCond.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilderCond.cxx index 6ffd400006ea46d1f1b02e0ff7a15c206408ca3c..40228a026de79f5e6d460973331a370f50e7a425 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilderCond.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GenericGeometryBuilderCond.cxx @@ -99,7 +99,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GenericGeometryBuilde ATH_MSG_VERBOSE("Starting to build TrackingGeometry for GeometrySignature : " << m_geometrySignature ); // the geometry to be constructed - const Trk::TrackingGeometry* tGeometry = 0; + const Trk::TrackingGeometry* tGeometry = nullptr; double innerVolumeRadius = 0.; double innerVolumeHalfZ = 0.; @@ -129,7 +129,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GenericGeometryBuilde // ------------------------------- overall dimensions ---------------------------------------------- // get the maximum extend in R - for ( auto& rzIter : envelopeDefs){ + for ( const auto & rzIter : envelopeDefs){ if ( rzIter.first > enclosingVolumeRadius ) { // maximal r-extend enclosingVolumeRadius = rzIter.first; @@ -149,7 +149,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GenericGeometryBuilde << envelopeDefs[0].second << ", " << envelopeDefs[0].first << " and " << envelopeDefs[1].second << ", " << envelopeDefs[1].first ); // now parse for the extended barrel size_t irz = 0; - for ( auto& rzIter : envelopeDefs){ + for ( const auto & rzIter : envelopeDefs){ if (irz > 1 && rzIter.second > 0 && rzIter.first >= enclosingVolumeRadius ) { // maximal r-extend enclosingExtendedVolumeRadius = envelopeDefs[irz-clockwise*2].first; @@ -169,7 +169,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GenericGeometryBuilde EventIDRange range; // get the inner radius and half length if a volume is provided - const Trk::CylinderVolumeBounds* cvb = 0; + const Trk::CylinderVolumeBounds* cvb = nullptr; const Trk::TrackingVolume* innerVol = innerVolPair.second; if (innerVol){ range = innerVolPair.first; @@ -258,7 +258,7 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GenericGeometryBuilde } } // and now create the triple - allVolumes = extendedVolumes.size() ? std::vector<const Trk::TrackingVolume*>{extendedVolumes[0],nSector,cSector,pSector,extendedVolumes[1]} : + allVolumes = !extendedVolumes.empty() ? std::vector<const Trk::TrackingVolume*>{extendedVolumes[0],nSector,cSector,pSector,extendedVolumes[1]} : std::vector<const Trk::TrackingVolume*>{nSector,cSector,pSector}; const Trk::TrackingVolume* tVolume = m_trackingVolumeCreator->createContainerTrackingVolume(allVolumes, vacuum, diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GeometryBuilder.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GeometryBuilder.cxx index a7b59ae65ed12c65871c3c4085cc74f36c11b540..15a72963e33b69c08d6ea2c815757392f1e3e556 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GeometryBuilder.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GeometryBuilder.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 */ /////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ StatusCode Trk::GeometryBuilder::initialize() } // if no world dimensions are declared, take default ones - if (!m_worldDimension.size()) + if (m_worldDimension.empty()) m_worldDimension = std::vector<double>{0.*Gaudi::Units::meter, 10.*Gaudi::Units::meter, 15.*Gaudi::Units::meter}; // if no world materials are declared, take default ones - set vacuum @@ -129,7 +129,7 @@ const Trk::TrackingGeometry* Trk::GeometryBuilder::trackingGeometry(const Trk::T { // the geometry to be constructed - const Trk::TrackingGeometry* tGeometry = 0; + const Trk::TrackingGeometry* tGeometry = nullptr; if ( m_inDetGeometryBuilder.empty() && m_caloGeometryBuilder.empty() && m_muonGeometryBuilder.empty() ) { ATH_MSG_VERBOSE( "Configured to only create world TrackingVolume." ); @@ -138,11 +138,11 @@ const Trk::TrackingGeometry* Trk::GeometryBuilder::trackingGeometry(const Trk::T m_worldDimension[1], m_worldDimension[2]); - Trk::TrackingVolume* worldVolume = new Trk::TrackingVolume(0, + Trk::TrackingVolume* worldVolume = new Trk::TrackingVolume(nullptr, worldBounds, m_worldMaterial, - (const LayerArray*) 0, - (const TrackingVolumeArray*) 0, + (const LayerArray*) nullptr, + (const TrackingVolumeArray*) nullptr, "EmptyWorldVolume"); // create a new geometry @@ -159,19 +159,19 @@ const Trk::TrackingGeometry* Trk::GeometryBuilder::trackingGeometry(const Trk::T const Trk::TrackingGeometry* Trk::GeometryBuilder::atlasTrackingGeometry() const { // the return geometry - const Trk::TrackingGeometry* atlasTrackingGeometry = 0; + const Trk::TrackingGeometry* atlasTrackingGeometry = nullptr; // A ------------- INNER DETECTOR SECTION -------------------------------------------------------------------------------- // get the Inner Detector and/or Calorimeter trackingGeometry - const Trk::TrackingGeometry* inDetTrackingGeometry = 0; - const Trk::TrackingGeometry* caloTrackingGeometry = 0; + const Trk::TrackingGeometry* inDetTrackingGeometry = nullptr; + const Trk::TrackingGeometry* caloTrackingGeometry = nullptr; // the volumes to be given to higher level tracking geometry builders - const Trk::TrackingVolume* inDetVolume = 0; - const Trk::TrackingVolume* caloVolume = 0; + const Trk::TrackingVolume* inDetVolume = nullptr; + const Trk::TrackingVolume* caloVolume = nullptr; // mark the highest volume - const Trk::TrackingVolume* highestVolume = 0; + const Trk::TrackingVolume* highestVolume = nullptr; #ifdef TRKDETDESCR_MEMUSAGE m_memoryLogger.refresh(getpid()); @@ -311,8 +311,8 @@ const Trk::TrackingGeometry* Trk::GeometryBuilder::atlasTrackingGeometry() const atlasInnerNegativeSectorTransf, innerCylinderSectorBounds, m_worldMaterial, - (const LayerArray*) 0, - (const TrackingVolumeArray*) 0, + (const LayerArray*) nullptr, + (const TrackingVolumeArray*) nullptr, "AtlasInnerNegativeSector"); // the AtlasInnerPositiveSector @@ -322,8 +322,8 @@ const Trk::TrackingGeometry* Trk::GeometryBuilder::atlasTrackingGeometry() const atlasInnerPositiveSectorTransf, innerCylinderSectorBounds->clone(), m_worldMaterial, - (const LayerArray*) 0, - (const TrackingVolumeArray*) 0, + (const LayerArray*) nullptr, + (const TrackingVolumeArray*) nullptr, "AtlasInnerPositiveSector"); ATH_MSG_VERBOSE( "Inner Negative/Positive Sectors built successfully." ); @@ -333,27 +333,27 @@ const Trk::TrackingGeometry* Trk::GeometryBuilder::atlasTrackingGeometry() const ATH_MSG_VERBOSE( "Create the Atlas Inner Sector volumes. " ); Trk::BinnedArray<Trk::TrackingVolume>* atlasInnerSectorVolumeArray = m_trackingVolumeArrayCreator ? - m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(atlasInnerSectorVolumes) : 0; + m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(atlasInnerSectorVolumes) : nullptr; // Atlas inner Sector bounds Trk::CylinderVolumeBounds* innerSectorBounds = new Trk::CylinderVolumeBounds(0., innerVolumeOuterR, m_worldDimension[2]); // build the Tracking volumes - Trk::TrackingVolume* atlasInnerSector = new Trk::TrackingVolume(0, + Trk::TrackingVolume* atlasInnerSector = new Trk::TrackingVolume(nullptr, innerSectorBounds, m_worldMaterial, - 0,atlasInnerSectorVolumeArray, + nullptr,atlasInnerSectorVolumeArray, "AtlasInnerSector"); // Atlas outer Sector Trk::CylinderVolumeBounds* outerSectorBounds = new Trk::CylinderVolumeBounds(innerVolumeOuterR, m_worldDimension[1], m_worldDimension[2]); - Trk::TrackingVolume* atlasOuterSector = new Trk::TrackingVolume(0, + Trk::TrackingVolume* atlasOuterSector = new Trk::TrackingVolume(nullptr, outerSectorBounds, m_worldMaterial, - (const LayerArray*) 0, - (const TrackingVolumeArray*) 0, + (const LayerArray*) nullptr, + (const TrackingVolumeArray*) nullptr, "AtlasOuterSector"); ATH_MSG_VERBOSE( "Atlas Inner/Outer Sectors built successfully." ); @@ -362,16 +362,16 @@ const Trk::TrackingGeometry* Trk::GeometryBuilder::atlasTrackingGeometry() const auto atlasVolumes = std::vector<const Trk::TrackingVolume*>{atlasInnerSector, atlasOuterSector}; Trk::BinnedArray<Trk::TrackingVolume>* atlasVolumeArray = m_trackingVolumeArrayCreator ? - m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(atlasVolumes) : 0; + m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(atlasVolumes) : nullptr; // create the Atlas volume bounds Trk::CylinderVolumeBounds* atlasBounds = new Trk::CylinderVolumeBounds(0., m_worldDimension[1], m_worldDimension[2]); // create the Atlas TrackingVolume - Trk::TrackingVolume* atlasVolume = new Trk::TrackingVolume(0, + Trk::TrackingVolume* atlasVolume = new Trk::TrackingVolume(nullptr, atlasBounds, m_worldMaterial, - 0,atlasVolumeArray, + nullptr,atlasVolumeArray, "Atlas"); ATH_MSG_VERBOSE( "Atlas Tracking World volume built successfully." ); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GeometryBuilderCond.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GeometryBuilderCond.cxx index c0d068d95a28e5899cc03540b94aabd6be8b491e..cfc87302e47101ca03818e09a0fe7e37a1ede438 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/GeometryBuilderCond.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/GeometryBuilderCond.cxx @@ -99,7 +99,7 @@ StatusCode Trk::GeometryBuilderCond::initialize() } // if no world dimensions are declared, take default ones - if (!m_worldDimension.size()) + if (m_worldDimension.empty()) m_worldDimension = std::vector<double>{0.*Gaudi::Units::meter, 10.*Gaudi::Units::meter, 15.*Gaudi::Units::meter}; // if no world materials are declared, take default ones - set vacuum @@ -138,11 +138,11 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GeometryBuilderCond:: m_worldDimension[1], m_worldDimension[2]); - Trk::TrackingVolume* worldVolume = new Trk::TrackingVolume(0, + Trk::TrackingVolume* worldVolume = new Trk::TrackingVolume(nullptr, worldBounds, m_worldMaterial, - (const LayerArray*) 0, - (const TrackingVolumeArray*) 0, + (const LayerArray*) nullptr, + (const TrackingVolumeArray*) nullptr, "EmptyWorldVolume"); //dummy infinite IOV range EventIDRange range; @@ -171,11 +171,11 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GeometryBuilderCond:: std::pair<EventIDRange, const Trk::TrackingGeometry*> caloTrackingGeometry ; // the volumes to be given to higher level tracking geometry builders - const Trk::TrackingVolume* inDetVolume = 0; - const Trk::TrackingVolume* caloVolume = 0; + const Trk::TrackingVolume* inDetVolume = nullptr; + const Trk::TrackingVolume* caloVolume = nullptr; // mark the highest volume - const Trk::TrackingVolume* highestVolume = 0; + const Trk::TrackingVolume* highestVolume = nullptr; #ifdef TRKDETDESCR_MEMUSAGE m_memoryLogger.refresh(getpid()); @@ -317,8 +317,8 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GeometryBuilderCond:: atlasInnerNegativeSectorTransf, innerCylinderSectorBounds, m_worldMaterial, - (const LayerArray*) 0, - (const TrackingVolumeArray*) 0, + (const LayerArray*) nullptr, + (const TrackingVolumeArray*) nullptr, "AtlasInnerNegativeSector"); // the AtlasInnerPositiveSector @@ -328,8 +328,8 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GeometryBuilderCond:: atlasInnerPositiveSectorTransf, innerCylinderSectorBounds->clone(), m_worldMaterial, - (const LayerArray*) 0, - (const TrackingVolumeArray*) 0, + (const LayerArray*) nullptr, + (const TrackingVolumeArray*) nullptr, "AtlasInnerPositiveSector"); ATH_MSG_VERBOSE( "Inner Negative/Positive Sectors built successfully." ); @@ -339,27 +339,27 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GeometryBuilderCond:: ATH_MSG_VERBOSE( "Create the Atlas Inner Sector volumes. " ); Trk::BinnedArray<Trk::TrackingVolume>* atlasInnerSectorVolumeArray = m_trackingVolumeArrayCreator ? - m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(atlasInnerSectorVolumes) : 0; + m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(atlasInnerSectorVolumes) : nullptr; // Atlas inner Sector bounds Trk::CylinderVolumeBounds* innerSectorBounds = new Trk::CylinderVolumeBounds(0., innerVolumeOuterR, m_worldDimension[2]); // build the Tracking volumes - Trk::TrackingVolume* atlasInnerSector = new Trk::TrackingVolume(0, + Trk::TrackingVolume* atlasInnerSector = new Trk::TrackingVolume(nullptr, innerSectorBounds, m_worldMaterial, - 0,atlasInnerSectorVolumeArray, + nullptr,atlasInnerSectorVolumeArray, "AtlasInnerSector"); // Atlas outer Sector Trk::CylinderVolumeBounds* outerSectorBounds = new Trk::CylinderVolumeBounds(innerVolumeOuterR, m_worldDimension[1], m_worldDimension[2]); - Trk::TrackingVolume* atlasOuterSector = new Trk::TrackingVolume(0, + Trk::TrackingVolume* atlasOuterSector = new Trk::TrackingVolume(nullptr, outerSectorBounds, m_worldMaterial, - (const LayerArray*) 0, - (const TrackingVolumeArray*) 0, + (const LayerArray*) nullptr, + (const TrackingVolumeArray*) nullptr, "AtlasOuterSector"); ATH_MSG_VERBOSE( "Atlas Inner/Outer Sectors built successfully." ); @@ -368,16 +368,16 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Trk::GeometryBuilderCond:: auto atlasVolumes = std::vector<const Trk::TrackingVolume*>{atlasInnerSector, atlasOuterSector}; Trk::BinnedArray<Trk::TrackingVolume>* atlasVolumeArray = m_trackingVolumeArrayCreator ? - m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(atlasVolumes) : 0; + m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(atlasVolumes) : nullptr; // create the Atlas volume bounds Trk::CylinderVolumeBounds* atlasBounds = new Trk::CylinderVolumeBounds(0., m_worldDimension[1], m_worldDimension[2]); // create the Atlas TrackingVolume - Trk::TrackingVolume* atlasVolume = new Trk::TrackingVolume(0, + Trk::TrackingVolume* atlasVolume = new Trk::TrackingVolume(nullptr, atlasBounds, m_worldMaterial, - 0,atlasVolumeArray, + nullptr,atlasVolumeArray, "Atlas"); ATH_MSG_VERBOSE( "Atlas Tracking World volume built successfully." ); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerArrayCreator.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerArrayCreator.cxx index da61f11d7eddd876e072c9384a885d8c233886c8..4a862ae0f8fce13c59313f59e785da4afca9744f 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerArrayCreator.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerArrayCreator.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 */ /////////////////////////////////////////////////////////////////// @@ -66,9 +66,9 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co std::sort(cylLayers.begin(), cylLayers.end(), rSorter); // needed for all cases - const Trk::Layer* cylinderLayer = 0; - Trk::LayerArray* cylinderLayerArray = 0; - Trk::BinUtility* binUtility = 0; + const Trk::Layer* cylinderLayer = nullptr; + Trk::LayerArray* cylinderLayerArray = nullptr; + Trk::BinUtility* binUtility = nullptr; std::vector< LayerOrderPosition > layerOrderVector; switch (btype) { @@ -84,8 +84,8 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co const Trk::CylinderSurface& layerSurface = layIter->surfaceRepresentation(); double currentR = layerSurface.bounds().r(); ATH_MSG_VERBOSE( "equidistant : registering cylindrical MaterialLayer at radius : " << currentR ); - layerOrderVector.push_back( Trk::LayerOrderPosition(Trk::SharedObject<const Layer>(layIter), - Amg::Vector3D(currentR, 0.,0.))); + layerOrderVector.emplace_back(Trk::SharedObject<const Layer>(layIter), + Amg::Vector3D(currentR, 0.,0.)); } // create the binUtility binUtility = new Trk::BinUtility(layers,rmin,rmax,Trk::open, Trk::binR); @@ -106,16 +106,16 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co // the radialstep double radialStep = (rmax-rmin)/(layers-1); // the next step - Trk::NavigationLayer* navLayer = 0; + Trk::NavigationLayer* navLayer = nullptr; double navigationR = 0.; double navLayerHalflengthZ = 0.; - const Amg::Transform3D* layerTransform = 0; + const Amg::Transform3D* layerTransform = nullptr; // loop over layers for (auto& layIter : cylLayers ) { // get the dimensions const Trk::CylinderSurface& layerSurface = layIter->surfaceRepresentation(); - layerTransform = layerSurface.transform().isApprox(Amg::Transform3D::Identity()) ? 0 : &layerSurface.transform(); + layerTransform = layerSurface.transform().isApprox(Amg::Transform3D::Identity()) ? nullptr : &layerSurface.transform(); double currentR = layerSurface.bounds().r(); navigationR = currentR - 0.5*radialStep; @@ -128,12 +128,12 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co // the navigation layer navLayer = new Trk::NavigationLayer(navLayerSurface); // push the navigation layer in - layerOrderVector.push_back(Trk::LayerOrderPosition(Trk::SharedObject<const Trk::Layer>(navLayer), - Amg::Vector3D(navigationR, 0., 0.))); + layerOrderVector.emplace_back(Trk::SharedObject<const Trk::Layer>(navLayer), + Amg::Vector3D(navigationR, 0., 0.)); ATH_MSG_VERBOSE( "bi-equidistant : registering cylindrical MaterialLayer at radius : " << currentR ); // push the original layer in - layerOrderVector.push_back(Trk::LayerOrderPosition(Trk::SharedObject<const Trk::Layer>(layIter), - Amg::Vector3D(currentR, 0., 0.))); + layerOrderVector.emplace_back(Trk::SharedObject<const Trk::Layer>(layIter), + Amg::Vector3D(currentR, 0., 0.)); } // special treatment for the last one @@ -144,8 +144,8 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co // the navigation layer navLayer = new Trk::NavigationLayer(navLayerSurfacFinal); // push the navigation layer in - layerOrderVector.push_back(Trk::LayerOrderPosition(Trk::SharedObject<const Trk::Layer>(navLayer), - Amg::Vector3D(navigationR+radialStep, 0., 0.))); + layerOrderVector.emplace_back(Trk::SharedObject<const Trk::Layer>(navLayer), + Amg::Vector3D(navigationR+radialStep, 0., 0.)); ATH_MSG_VERBOSE( layerOrderVector.size() << " cylindrical Layers (material + navigation) built. " ); @@ -166,7 +166,7 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co std::vector<float> boundaries; // maz z extension double halfLengthZ = 0; - const Amg::Transform3D* layerTransform = 0; + const Amg::Transform3D* layerTransform = nullptr; // initial step boundaries.push_back(rmin); @@ -175,7 +175,7 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co for (auto& layIter : cylLayers) { // get the cylinder surface const Trk::CylinderSurface& layerSurface = layIter->surfaceRepresentation(); - layerTransform = layerSurface.transform().isApprox(Amg::Transform3D::Identity()) ? 0 : &layerSurface.transform(); + layerTransform = layerSurface.transform().isApprox(Amg::Transform3D::Identity()) ? nullptr : &layerSurface.transform(); // and get the halflength double currentHalfLengthZ = layerSurface.bounds().halflengthZ(); takeBigger(halfLengthZ, currentHalfLengthZ); @@ -190,13 +190,13 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co cylinderLayer = checkAndReplaceEmptyLayer(layIter); if (cylinderLayer){ ATH_MSG_VERBOSE( "arbitrary : creating cylindrical NavigationLayer at radius : " << navLayerRadius ); - layerOrderVector.push_back(Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurface)), - Amg::Vector3D(navLayerRadius, 0., 0.))); + Amg::Vector3D(navLayerRadius, 0., 0.)); ATH_MSG_VERBOSE( "arbitrary : registering cylindrical MaterialLayer at radius :" << layerRadius ); - layerOrderVector.push_back(Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(cylinderLayer), - Amg::Vector3D(layerRadius, 0.,0.))); + Amg::Vector3D(layerRadius, 0.,0.)); boundaries.push_back(layerRadius-0.5*layerThickness); boundaries.push_back(layerRadius+0.5*layerThickness); } else { @@ -211,9 +211,9 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co new Trk::CylinderSurface(navLayerRadiusFinal, halfLengthZ); boundaries.push_back(rmax); ATH_MSG_VERBOSE( "arbitrary : creating cylindrical NavigationLayer at radius : " << navLayerRadiusFinal ); - layerOrderVector.push_back(Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurfaceFinal)), - Amg::Vector3D(navLayerRadiusFinal, 0., 0.))); + Amg::Vector3D(navLayerRadiusFinal, 0., 0.)); ATH_MSG_VERBOSE( layerOrderVector.size() << " cylindrical Layers (material + navigation) built. " ); // create the BinUtility @@ -226,7 +226,7 @@ Trk::LayerArray* Trk::LayerArrayCreator::cylinderLayerArray(const std::vector<co } break; // default return 0 - default : { return 0; } + default : { return nullptr; } } return cylinderLayerArray; @@ -243,8 +243,8 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const ATH_MSG_VERBOSE( " zmin/zmax provided : " << zmin << " / " << zmax ); // needed for all cases - Trk::LayerArray* discLayerArray = 0; - Trk::BinUtility* binUtility = 0; + Trk::LayerArray* discLayerArray = nullptr; + Trk::BinUtility* binUtility = nullptr; std::vector< LayerOrderPosition > layerOrderVector; //copy so that you can sort @@ -253,7 +253,7 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const Trk::DiscLayerSorterZ zSorter; std::sort(discLayers.begin(), discLayers.end(), zSorter); // the layer to be pushed back - const Trk::Layer* discLayer = 0; + const Trk::Layer* discLayer = nullptr; switch (btype) { @@ -268,8 +268,8 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const // get the Z const Trk::Surface& layerSurface = discLayer->surfaceRepresentation(); ATH_MSG_VERBOSE( "equidistant : registering disc-like MaterialLayer at z-Position : " << layerSurface.center().z() ); - layerOrderVector.push_back( Trk::LayerOrderPosition(Trk::SharedObject<const Layer>(discLayer), - layerSurface.center())); + layerOrderVector.emplace_back(Trk::SharedObject<const Layer>(discLayer), + layerSurface.center()); } // create the binUitlity binUtility = new Trk::BinUtility(layers,zmin,zmax,Trk::open,Trk::binZ); @@ -293,8 +293,8 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const double minR = 0.; double maxR = 0.; - Amg::Transform3D* navLayerTransform = 0; - Trk::DiscSurface* navLayerSurface = 0; + Amg::Transform3D* navLayerTransform = nullptr; + Trk::DiscSurface* navLayerSurface = nullptr; double navigationZ = 0.; // loop over layers for (auto& layIter : discLayers) { @@ -308,9 +308,9 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const navLayerSurface = new Trk::DiscSurface(navLayerTransform, minR, maxR); // push that layer back ATH_MSG_VERBOSE( "bi-equidistant : creating disc-like NavigationLayer at z-Position : " << navigationZ ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurface)), - navLayerSurface->center())); + navLayerSurface->center()); // and get dimensions const Trk::DiscBounds* dbounds = dynamic_cast<const Trk::DiscBounds*>(&(layerSurface.bounds())); if (dbounds) { @@ -322,17 +322,17 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const } // get the material layer first ATH_MSG_VERBOSE( "bi-equidistant : registering disc-like MaterialLayer at z-Position : " << currentZ ); - layerOrderVector.push_back( Trk::LayerOrderPosition(Trk::SharedObject<const Trk::Layer>(layIter), - layerSurface.center())); + layerOrderVector.emplace_back(Trk::SharedObject<const Trk::Layer>(layIter), + layerSurface.center()); } // special treatment for last bin ATH_MSG_VERBOSE( "bi-equidistant : creating disc-like NavigationLayer at z-Position : " << navigationZ + zStep ); navLayerTransform = new Amg::Transform3D; (*navLayerTransform) = Amg::Translation3D(0.,0.,navigationZ+zStep); navLayerSurface = new Trk::DiscSurface(navLayerTransform, minR, maxR); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurface)), - navLayerSurface->center())); + navLayerSurface->center()); // verbose output ATH_MSG_VERBOSE( layerOrderVector.size() << " disc Layers (material + navigation) built. " ); @@ -389,13 +389,13 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const discLayer = checkAndReplaceEmptyLayer(layIter); if (discLayer) { ATH_MSG_VERBOSE( "arbitrary : creating disc-like NavigationLayer at z-Position : " << navLayerPositionZ ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurface)), - Amg::Vector3D(0., 0., navLayerPositionZ))); + Amg::Vector3D(0., 0., navLayerPositionZ)); ATH_MSG_VERBOSE( "arbitrary : registering disc-like MaterialLayer at z-Position : " << layerPositionZ ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(discLayer), - Amg::Vector3D(0.,0., layerPositionZ))); + Amg::Vector3D(0.,0., layerPositionZ)); boundaries.push_back(layerPositionZ-0.5*layerThickness); boundaries.push_back(layerPositionZ+0.5*layerThickness); } else { @@ -409,9 +409,9 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const (*navLayerTransformFinal) = Amg::Translation3D(0.,0.,navLayerPositionZFinal); Trk::DiscSurface* navLayerSurfaceFinal = new Trk::DiscSurface(navLayerTransformFinal, minR, maxR); ATH_MSG_VERBOSE( "arbitrary : creating disc-like NavigationLayer at z-Position : " << navLayerPositionZFinal ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurfaceFinal)), - Amg::Vector3D(0., 0., navLayerPositionZFinal))); + Amg::Vector3D(0., 0., navLayerPositionZFinal)); ATH_MSG_VERBOSE( layerOrderVector.size() << " disc Layers (material + navigation) built. " ); // register the last bounday boundaries.push_back(zmax); @@ -426,7 +426,7 @@ Trk::LayerArray* Trk::LayerArrayCreator::discLayerArray(const std::vector<const } break; // default return 0 - default : { return 0; } + default : { return nullptr; } } return discLayerArray; @@ -439,8 +439,8 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const ATH_MSG_VERBOSE( " build LayerArray with " << planeLayersInput.size() << " plane-like material layers." ); // needed for all cases - Trk::LayerArray* planeLayerArray = 0; - Trk::BinUtility* binUtility = 0; + Trk::LayerArray* planeLayerArray = nullptr; + Trk::BinUtility* binUtility = nullptr; std::vector< LayerOrderPosition > layerOrderVector; Amg::Vector3D layerCenter(0.,0.,0.); @@ -455,7 +455,7 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const case Trk::binZ : { std::sort(sortBegin, sortEnd, Trk::PlaneLayerSorterZ()); } break; default : { ATH_MSG_WARNING("Plane Layers can only be sorted in x/y/z. Returning 0."); - return 0; + return nullptr; } } @@ -475,9 +475,9 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const const Trk::PlaneSurface& layerSurface = (*layIter)->surfaceRepresentation(); ATH_MSG_VERBOSE( "equidistant : registering plane-like MaterialLayer at position : " << layerSurface.center() ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Layer>(*layIter), - layerSurface.center())); + layerSurface.center()); } // create the binUitlity binUtility = new Trk::BinUtility(layers,posmin,posmax, Trk::open, bv); @@ -538,7 +538,7 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const double navigationZ = (bv == Trk::binZ) ? navigationPos : 0.; Amg::Translation3D(navigationX,navigationY,navigationZ); - Trk::PlaneSurface* navLayerSurface = 0; + Trk::PlaneSurface* navLayerSurface = nullptr; Amg::Transform3D* navLayerTransform = new Amg::Transform3D; (*navLayerTransform) = Amg::Translation3D(navigationX,0.,0.); @@ -555,17 +555,17 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const ATH_MSG_VERBOSE( "bi-equidistant : creating plane-like NavigationLayer at position : " << navigationX ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurface)), - Amg::Vector3D(navigationX, 0.,0.))); + Amg::Vector3D(navigationX, 0.,0.)); // restore lastPos = currentPos; // the material Layer ATH_MSG_VERBOSE( "bi-equidistant : registering plane-like MaterialLayer at position : " << currentPos ); - layerOrderVector.push_back( Trk::LayerOrderPosition ( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(*layIter), - layerSurface.center())); + layerSurface.center()); // increase the Step currentPos += posStep; @@ -586,9 +586,9 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const ATH_MSG_VERBOSE( "bi-equidistant : creating plane-like NavigationLayer at position : " << navLayerSurface->center() ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurface)), - navLayerSurface->center() )); + navLayerSurface->center() ); // create the binUtility binUtility = new Trk::BinUtility(layers, layerThickness, posmin, posmax, Trk::open, bv); @@ -653,15 +653,15 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const new Trk::PlaneSurface( navLayerTransform, maxHalfX, halfY ) : new Trk::PlaneSurface( navLayerTransform, minHalfX, maxHalfX, halfY ); ATH_MSG_VERBOSE( "arbitrary : creating plane-like NavigationLayer at position : " << navLayerPositionX ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurface)), - Amg::Vector3D(navLayerPositionX, navLayerPositionY, navLayerPositionZ))); + Amg::Vector3D(navLayerPositionX, navLayerPositionY, navLayerPositionZ)); // register the material layer boundaries.push_back(layerPosition+0.5*layerThickness); // material layer - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(*layIter), - layerSurface.center())); + layerSurface.center()); } // last NavigationLayer @@ -676,9 +676,9 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const new Trk::PlaneSurface( navLayerTransformFinal, maxHalfX, halfY ) : new Trk::PlaneSurface( navLayerTransformFinal, minHalfX, maxHalfX, halfY ); ATH_MSG_VERBOSE( "arbitrary : creating plane-like NavigationLayer at position : " << 0.5*(posmax+boundaries[boundaries.size()-1]) ); - layerOrderVector.push_back( Trk::LayerOrderPosition( + layerOrderVector.emplace_back( Trk::SharedObject<const Trk::Layer>(new Trk::NavigationLayer(navLayerSurfaceFinal)), - Amg::Vector3D(navLayerPositionXFinal, navLayerPositionYFinal, navLayerPositionZFinal))); + Amg::Vector3D(navLayerPositionXFinal, navLayerPositionYFinal, navLayerPositionZFinal)); ATH_MSG_VERBOSE( layerOrderVector.size() << " plane Layers (material + navigation) built. " ); @@ -689,7 +689,7 @@ Trk::LayerArray* Trk::LayerArrayCreator::planeLayerArray(const std::vector<const } break; // default return 0 - default : { return 0; } + default : { return nullptr; } } return planeLayerArray; @@ -701,7 +701,7 @@ const Trk::Layer* Trk::LayerArrayCreator::checkAndReplaceEmptyLayer(const Trk::L if (m_emptyLayerMode){ if (lay->layerMaterialProperties() || lay->surfaceArray()) return lay; ATH_MSG_VERBOSE(" replacing dummyMaterial layer with " << ( m_emptyLayerMode > 1 ? " nothing" :" NavigationLayer." ) ); - Trk::NavigationLayer* nLayer = m_emptyLayerMode > 1 ? 0 : new Trk::NavigationLayer(lay->surfaceRepresentation().clone(), 1.); + Trk::NavigationLayer* nLayer = m_emptyLayerMode > 1 ? nullptr : new Trk::NavigationLayer(lay->surfaceRepresentation().clone(), 1.); delete lay; return nLayer; } diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerMaterialProvider.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerMaterialProvider.cxx index 6054b6d539ceaa3e42431ac181c00c1dd73311ac..46f4b1aef011bb747b447c0fa618e1efed24fed5 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerMaterialProvider.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerMaterialProvider.cxx @@ -20,7 +20,7 @@ // constructor Trk::LayerMaterialProvider::LayerMaterialProvider(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_layerMaterialMap(0), + m_layerMaterialMap(nullptr), m_layerMaterialMapName("/GLOBAL/TrackingGeo/LayerMaterialV2") { declareInterface<Trk::IGeometryProcessor>(this); @@ -50,7 +50,7 @@ StatusCode Trk::LayerMaterialProvider::process(const Trk::TrackingGeometry& tgeo return StatusCode::FAILURE; } // Boundary layers - if (tgeo.boundaryLayers().size()){ + if (!tgeo.boundaryLayers().empty()){ ATH_MSG_VERBOSE("TrackingGeometry has " << tgeo.boundaryLayers().size() << " unique bounday layers, loading material."); auto bLayerIter = tgeo.boundaryLayers().begin(); auto bLayerE = tgeo.boundaryLayers().end(); @@ -106,7 +106,7 @@ StatusCode Trk::LayerMaterialProvider::process(const Trk::TrackingVolume& tvol, // display output const std::vector<const Trk::Layer*>& layers = layerArray->arrayObjects(); ATH_MSG_VERBOSE(displayBuffer.str() << "--> has " << layers.size() << " confined layers." ); - for ( auto& layIter : layers ){ + for ( const auto & layIter : layers ){ if (!layIter) ATH_MSG_WARNING("Zero-pointer found in LayerArray - indicates problem !"); else { @@ -212,7 +212,7 @@ StatusCode Trk::LayerMaterialProvider::loadMaterialMap() const { // screen output as most VERBOSE debugging if (msgLvl (MSG::VERBOSE)) { ATH_MSG_VERBOSE("Listing the layer indeces found in the loaded LayerMaterialMap"); - for ( auto& lmIter : (*m_layerMaterialMap) ){ + for ( const auto & lmIter : (*m_layerMaterialMap) ){ ATH_MSG_VERBOSE(" -> Found map for layer with index " << lmIter.first); } } diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerProvider.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerProvider.cxx index 5422a5a819e31bbfbb5a6765eab52c95b80a27e9..d9a58152af3d68673cb24acb067944ce5ce40732 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerProvider.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerProvider.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 */ /////////////////////////////////////////////////////////////////// @@ -43,7 +43,7 @@ StatusCode Trk::LayerProvider::initialize() const std::vector< const Trk::Layer* > Trk::LayerProvider::negativeLayers() const { // if any cache is there it has to be returned - if (m_layerCache.size()) return m_layerCache; + if (!m_layerCache.empty()) return m_layerCache; // this will fill the cache with positive layers return discLayers(-1); } @@ -57,7 +57,7 @@ const std::vector< const Trk::Layer* > Trk::LayerProvider::centralLayers() const const std::vector< const Trk::CylinderLayer* >* cylinderLayers = m_layerBuilder->cylindricalLayers(); // loop over it and push into the return vector; if (cylinderLayers){ - for (auto& cL : (*cylinderLayers)) + for (const auto & cL : (*cylinderLayers)) cLayers.push_back(cL); } // memory cleanup @@ -70,7 +70,7 @@ const std::vector< const Trk::Layer* > Trk::LayerProvider::centralLayers() const const std::vector< const Trk::Layer* > Trk::LayerProvider::positiveLayers() const { // if any cache is there it has to be returned - if (m_layerCache.size()) return m_layerCache; + if (!m_layerCache.empty()) return m_layerCache; // this will fill the cache with negative layers return discLayers(1); } @@ -85,7 +85,7 @@ const std::vector< const Trk::Layer* > Trk::LayerProvider::discLayers(int posneg // loop and fill either cache or dLayers if (discLayers){ // loop over and push into the return/cache vector - for (auto& dL : (*discLayers) ){ + for (const auto & dL : (*discLayers) ){ // get the center posituion double zpos = dL->surfaceRepresentation().center().z(); if (posneg > 0){ diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerProviderCond.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerProviderCond.cxx index 350c99121c501c0ccba147beb8b82b68a2f47be0..ef3ccafbde4ad114edb05ccc7f0f98cbc1eb1351 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerProviderCond.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/LayerProviderCond.cxx @@ -53,10 +53,10 @@ std::pair<EventIDRange, const std::vector< const Trk::Layer* > > Trk::LayerProvi std::vector< const Trk::Layer* > cLayers; // retrieving the cylinder layers from the layer builder std::pair<EventIDRange, const std::vector< const Trk::CylinderLayer* >* > cylinderLayersPair = m_layerBuilder->cylindricalLayers(ctx); - auto cylinderLayers = cylinderLayersPair.second; + const auto *cylinderLayers = cylinderLayersPair.second; // loop over it and push into the return vector; if (cylinderLayers){ - for (auto& cL : (*cylinderLayers)) + for (const auto & cL : (*cylinderLayers)) cLayers.push_back(cL); } // memory cleanup @@ -79,11 +79,11 @@ std::pair<EventIDRange, const std::vector< const Trk::Layer* > > Trk::LayerProvi std::vector < const Trk::Layer* > dLayers; // retrieving the cylinder layers from the layer builder std::pair<EventIDRange, const std::vector<const Trk::DiscLayer*>*> discLayersPair = m_layerBuilder->discLayers(ctx); - auto discLayers = discLayersPair.second; + const auto *discLayers = discLayersPair.second; // loop and fill either cache or dLayers if (discLayers){ // loop over and push into the return/cache vector - for (auto& dL : (*discLayers) ){ + for (const auto & dL : (*discLayers) ){ // get the center posituion double zpos = dL->surfaceRepresentation().center().z(); if (posneg > 0){ diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeArrayCreator.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeArrayCreator.cxx index 9988ba6f1c10281102492dda51cf402e015cd0db..7d875f9ca92aa18cd51fc07dcae6b550e20ec2ce 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeArrayCreator.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeArrayCreator.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 */ /////////////////////////////////////////////////////////////////// @@ -69,12 +69,12 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI // loop over volumes and fill primaries std::vector<const Trk::TrackingVolume*>::const_iterator volIter = vols.begin(); for (unsigned int ivol=0 ; volIter != vols.end(); ++volIter, ++ivol) { - const Trk::CylinderVolumeBounds* currentCylBounds = 0; + const Trk::CylinderVolumeBounds* currentCylBounds = nullptr; if (*volIter) currentCylBounds = dynamic_cast<const Trk::CylinderVolumeBounds*>(&((*volIter)->volumeBounds())); if (!currentCylBounds) { ATH_MSG_ERROR( "Given TrackingVolume doesn't exist or is not of shape 'CylinderVolumeBounds': return 0" ); - return 0; + return nullptr; } // current rmin/rmax double currentRmin = currentCylBounds->innerRadius(); @@ -95,13 +95,13 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI ATH_MSG_ERROR( "Given TrackingVolume(s) do not extend in z to the same point (required) : return 0" ); ATH_MSG_VERBOSE( "Information : lastZmin / lastZmin = " << lastZmin << " / " << currentZmin ); ATH_MSG_VERBOSE( " lastZmax / currentZmax = " << lastZmax << " / " << currentZmax ); - return 0; + return nullptr; } // radial clinch if (fabs(currentRmin-lastOuterRadius)>0.1 ){ ATH_MSG_ERROR( "Given TrackingVolume(s) are not wrapping, neither inside-out, nor v.v. : return 0" ); ATH_MSG_VERBOSE( "Information : currentRmin / lastOuterRadius = " << currentRmin << " / " << lastOuterRadius ); - return 0; + return nullptr; } } // register for next round @@ -111,22 +111,22 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI // output ATH_MSG_VERBOSE("Adding Volume '" << (*volIter)->volumeName() << "' to Array" ); // push back the volume order position - if(navtype ==false){ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>((*volIter)), - Amg::Vector3D(currentCylBounds->mediumRadius(), 0.0, 0.0))); + if(!navtype){ + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>((*volIter)), + Amg::Vector3D(currentCylBounds->mediumRadius(), 0.0, 0.0)); }else{ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>((*volIter), do_not_delete<const TrackingVolume>), - Amg::Vector3D(currentCylBounds->mediumRadius(), 0.0, 0.0))); + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>((*volIter), do_not_delete<const TrackingVolume>), + Amg::Vector3D(currentCylBounds->mediumRadius(), 0.0, 0.0)); } } - if (volOrder.size()) { + if (!volOrder.empty()) { Trk::BinUtility* volBinUtilR = new Trk::BinUtility(boundaries, Trk::open, Trk::binR); ATH_MSG_VERBOSE("Return created Array. " ); return new Trk::BinnedArray1D<Trk::TrackingVolume>(volOrder, volBinUtilR); } ATH_MSG_ERROR( "No TrackingVolumes provided to the TrackingVolumeArrayCreator: return 0" ); - return 0; + return nullptr; } @@ -150,12 +150,12 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI // loop over volumes and fill primaries std::vector<const Trk::TrackingVolume*>::const_iterator volIter = vols.begin(); for (unsigned int ivol =0 ; volIter != vols.end(); ++volIter, ++ivol) { - const Trk::CylinderVolumeBounds* currentCylBounds = 0; + const Trk::CylinderVolumeBounds* currentCylBounds = nullptr; if (*volIter) currentCylBounds = dynamic_cast<const Trk::CylinderVolumeBounds*>(&((*volIter)->volumeBounds())); if (!currentCylBounds) { ATH_MSG_ERROR( "Given TrackingVolume doesn't exist or is not of shape 'CylinderVolumeBounds': return 0" ); - return 0; + return nullptr; } // const Amg::Vector3D& volCenter = (*volIter)->center(); @@ -178,12 +178,12 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI ATH_MSG_ERROR( "Given TrackingVolume(s) do not have same radial extends (required): return 0" ); ATH_MSG_VERBOSE( "Information : lastRmin / currentRmin = " << lastRmin << " / " << currentRmin ); ATH_MSG_VERBOSE( " lastRmax / currentRmax = " << lastRmax << " / " << currentRmax ); - return 0; + return nullptr; } // then let's see whether they leave gaps in z if ( fabs(lastZmax-currentZmin) > 0.1 ) { ATH_MSG_ERROR( "Given TrackingVolume(s) are not attaching in z (required) : return 0" ); - return 0; + return nullptr; } } // for the next round @@ -193,25 +193,25 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI // output ATH_MSG_VERBOSE("Adding Volume '" << (*volIter)->volumeName() << "' to Array" ); // push back the volume order position - if(navtype==false){ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>((*volIter)), - Amg::Vector3D((*volIter)->center()))); + if(!navtype){ + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>((*volIter)), + Amg::Vector3D((*volIter)->center())); } else{ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>((*volIter),do_not_delete<const TrackingVolume>), - Amg::Vector3D((*volIter)->center()))); + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>((*volIter),do_not_delete<const TrackingVolume>), + Amg::Vector3D((*volIter)->center())); } } - if (volOrder.size()) { + if (!volOrder.empty()) { Trk::BinUtility* volBinUtil = new Trk::BinUtility(boundaries, Trk::open, Trk::binZ); ATH_MSG_VERBOSE("Return created Array. " ); return new Trk::BinnedArray1D<Trk::TrackingVolume>(volOrder, volBinUtil); } ATH_MSG_ERROR( "No TrackingVolumes provided to the TrackingVolumeArrayCreator: return 0" ); - return 0; + return nullptr; } @@ -223,39 +223,39 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI ATH_MSG_VERBOSE("Create VolumeArray of "<< vols.size() << " Volumes (with CylinderVolumeBounds) with Phi-binning. " ); // phi binning; assume equidistant - int nPhiBins = vols.size() ? vols.size() : 1 ; + int nPhiBins = !vols.empty() ? vols.size() : 1 ; double phi = M_PI; // the vector needed for the BinnedArray std::vector<Trk::TrackingVolumeOrderPosition> volOrder; // loop over volumes and fill primaries std::vector<const Trk::TrackingVolume*>::const_iterator volIter = vols.begin(); for ( ; volIter != vols.end(); ++volIter) { - const Trk::CylinderVolumeBounds* cyl = 0; + const Trk::CylinderVolumeBounds* cyl = nullptr; if (*volIter) cyl = dynamic_cast<const Trk::CylinderVolumeBounds*>(&((*volIter)->volumeBounds())); if (!cyl) { ATH_MSG_ERROR( "Given TrackingVolume doesn't exist or is not of shape 'CylinderVolumeBounds': return 0" ); - return 0; + return nullptr; } // output ATH_MSG_VERBOSE("Adding Volume '" << (*volIter)->volumeName() << "' to Array" ); // push back the volume order position Amg::Vector3D gp( cyl->mediumRadius(),0.,0.); - if(navtype==false){ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>((*volIter)), - Amg::Vector3D(((*volIter)->transform())*gp))); + if(!navtype){ + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>((*volIter)), + Amg::Vector3D(((*volIter)->transform())*gp)); }else{ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>((*volIter), do_not_delete<const TrackingVolume>), - Amg::Vector3D(((*volIter)->transform())*gp))); + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>((*volIter), do_not_delete<const TrackingVolume>), + Amg::Vector3D(((*volIter)->transform())*gp)); } } - if (volOrder.size()) { + if (!volOrder.empty()) { Trk::BinUtility* volBinUtil = new Trk::BinUtility(nPhiBins,-phi,+phi,Trk::closed,Trk::binPhi); return new Trk::BinnedArray1D<Trk::TrackingVolume>(volOrder, volBinUtil); } ATH_MSG_ERROR( "No TrackingVolumes provided to the TrackingVolumeArrayCreator: return 0" ); - return 0; + return nullptr; } @@ -263,7 +263,7 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI const std::vector<const Trk::TrackingVolume*>& vols, bool navtype) const { - if (!vols.size()) return 0; + if (vols.empty()) return nullptr; bool bevelled = false; for (unsigned int i=0; i<vols.size(); i++) { @@ -303,21 +303,20 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI type = bcyl->type(); } else { ATH_MSG_ERROR( "volume not cylinder nor bevelled cylinder " ); - return 0; + return nullptr; } if (dphi<M_PI) { // push back the volume order position Amg::Vector3D gp( mRad,0.,0.); Amg::Vector3D ngp((vols[i]->transform())*gp); - if(navtype==false){ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>(vols[i]),ngp)); + if(!navtype){ + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>(vols[i]),ngp); }else{ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>(vols[i],do_not_delete<const TrackingVolume>),ngp)); + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>(vols[i],do_not_delete<const TrackingVolume>),ngp); } // push back volume position to avoid another loop - volPos.push_back( std::pair< std::pair<double,int>, std::pair<double,double> > - (std::pair<double,int>(ngp.phi(),type), std::pair<double,double>(rmin,rmax))); + volPos.emplace_back(std::pair<double,int>(ngp.phi(),type), std::pair<double,double>(rmin,rmax)); // phi binning double phi1 = ngp.phi() - dphi; double phi2 = ngp.phi() + dphi; @@ -326,7 +325,7 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI if ( phi1 > 2*M_PI ) phi1 -= 2*M_PI; if ( phi2 > 2*M_PI ) phi2 -= 2*M_PI; - if (phiSteps.size() > 0) { + if (!phiSteps.empty()) { std::vector<float>::iterator iter = phiSteps.begin(); bool known = false; while (iter!=phiSteps.end() ) { @@ -352,7 +351,7 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI } } // end of first loop over volumes // collect volumes with full phi range - if (!phiSteps.size()) { + if (phiSteps.empty()) { phiSteps.push_back(-M_PI); phiSteps.push_back(+M_PI); } @@ -375,15 +374,14 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI cyl->mediumRadius()*sin(phiRef), 0.); - if(navtype==false){ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>(fullPhiVols[iv]),ngp)); + if(!navtype){ + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>(fullPhiVols[iv]),ngp); } else{ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>(fullPhiVols[iv],do_not_delete<const TrackingVolume>),ngp)); + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>(fullPhiVols[iv],do_not_delete<const TrackingVolume>),ngp); } // push back volume position to avoid another loop - volPos.push_back(std::pair< std::pair<double,int>, std::pair<double,double> > - (std::pair<double,int>(ngp.phi(),0), std::pair<double,double>(rmin,rmax))); + volPos.emplace_back(std::pair<double,int>(ngp.phi(),0), std::pair<double,double>(rmin,rmax)); } } // all volumes in arrays : build bin utilities @@ -416,7 +414,7 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI int phibin = phiBinUtil->bin(volOrder[i].second); - if (hSteps[phibin].size() > 0) { + if (!hSteps[phibin].empty()) { std::vector<std::pair<int,float> > ::iterator iter = hSteps[phibin].begin(); bool known = false; while (iter!=hSteps[phibin].end() ) { @@ -471,15 +469,15 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI // push back the volume order position Amg::Vector3D gp( cyl->mediumRadius(),0.,0.); Amg::Vector3D ngp((vols[i]->transform())*gp); - if(navtype==false){ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>(vols[i]),ngp)); + if(!navtype){ + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>(vols[i]),ngp); }else{ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>(vols[i],do_not_delete<const TrackingVolume>),ngp)); + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>(vols[i],do_not_delete<const TrackingVolume>),ngp); } // push back volume position to avoid another loop - volPos.push_back(std::pair<double,std::pair<double,double> >(cyl->mediumRadius(),std::pair<double,double>(ngp.phi(),dphi))); + volPos.emplace_back(cyl->mediumRadius(),std::pair<double,double>(ngp.phi(),dphi)); // r binning - if (rSteps.size() > 0) { + if (!rSteps.empty()) { std::vector<float>::iterator iter = rSteps.begin(); bool known = false; while (iter!=rSteps.end() ) { @@ -545,7 +543,7 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI if ( phi1 < 0 ) phi1 += 2*M_PI; if ( phi2 < 0 ) phi2 += 2*M_PI; - if (phiSteps[binr].size() > 0) { + if (!phiSteps[binr].empty()) { std::vector<float>::iterator iter = phiSteps[binr].begin(); bool known = false; while (iter!=phiSteps[binr].end() ) { @@ -613,7 +611,7 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI mRad = bcyl->mediumRadius(); } else { ATH_MSG_ERROR( "volume not cylinder nor bevelled cylinder " ); - return 0; + return nullptr; } if ( phiSector>0. && fabs(dphi-phiSector)>0.001 ) phiSector = phiSector<M_PI ? -1. : dphi; @@ -621,15 +619,15 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI // push back the volume order position Amg::Vector3D gp( mRad,0.,0.); Amg::Vector3D ngp((vols[i]->transform())*gp); - if(navtype==false){ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>(vols[i]),ngp)); + if(!navtype){ + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>(vols[i]),ngp); }else{ - volOrder.push_back(Trk::TrackingVolumeOrderPosition(Trk::SharedObject<const TrackingVolume>(vols[i], do_not_delete<const TrackingVolume>),ngp)); + volOrder.emplace_back(Trk::SharedObject<const TrackingVolume>(vols[i], do_not_delete<const TrackingVolume>),ngp); } // push back volume position to avoid another loop - volPos.push_back(std::pair<float,std::pair<float,float> >(vols[i]->center()[2],std::pair<float,float>(ngp.phi(),dphi))); + volPos.emplace_back(vols[i]->center()[2],std::pair<float,float>(ngp.phi(),dphi)); // z binning - if (zSteps.size() > 0) { + if (!zSteps.empty()) { std::vector<float>::iterator iter = zSteps.begin(); bool known = false; while (iter!=zSteps.end() ) { @@ -693,7 +691,7 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cylinderVolumesArrayI if ( phi1 < 0 ) phi1 += 2*M_PI; if ( phi2 < 0 ) phi2 += 2*M_PI; - if (phiSteps[binZ].size() > 0) { + if (!phiSteps[binZ].empty()) { std::vector<float>::iterator iter = phiSteps[binZ].begin(); bool known = false; while (iter!=phiSteps[binZ].end() ) { @@ -737,7 +735,7 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cuboidVolumesArrayInZ bool) const { ATH_MSG_ERROR( " cuboidVolumesArrayInZ not implemented " ); - return 0; + return nullptr; } @@ -755,22 +753,22 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::cuboidVolumesArrayNav dynamic_cast<const Trk::CuboidVolumeBounds*>(&((*volIter)->volumeBounds())); if (!currentCubBounds) { ATH_MSG_ERROR( "Given TrackingVolume to TrackingVolumeArrayCreator didn't match specified shape: return 0" ); - return 0; + return nullptr; } // push back the volume order position - if(navtype==false){ + if(!navtype){ volOrder.push_back(Trk::SharedObject<const TrackingVolume>((*volIter))); }else{ volOrder.push_back(Trk::SharedObject<const TrackingVolume>((*volIter), do_not_delete<const TrackingVolume>)); } } - if (volOrder.size()) { + if (!volOrder.empty()) { Amg::Transform3D* navTransform = new Amg::Transform3D; navTransform->setIdentity(); return new Trk::NavBinnedArray1D<Trk::TrackingVolume>(volOrder, binUtil, navTransform); } ATH_MSG_ERROR( "No TrackingVolumes provided to the TrackingVolumeArrayCreator: return 0" ); - return 0; + return nullptr; } @@ -788,23 +786,23 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::trapezoidVolumesArray dynamic_cast<const Trk::TrapezoidVolumeBounds*>(&((*volIter)->volumeBounds())); if (!currentTrdBounds) { ATH_MSG_ERROR( "Given TrackingVolume to TrackingVolumeArrayCreator didn't match specified shape: return 0" ); - return 0; + return nullptr; } // push back the volume order position - if(navtype==false){ + if(!navtype){ volOrder.push_back(Trk::SharedObject<const TrackingVolume>(*volIter)); }else { volOrder.push_back(Trk::SharedObject<const TrackingVolume>(*volIter,do_not_delete<const TrackingVolume>)); } } - if (volOrder.size()) { + if (!volOrder.empty()) { Amg::Transform3D* navTransform = new Amg::Transform3D; navTransform->setIdentity(); return new Trk::NavBinnedArray1D<Trk::TrackingVolume>(volOrder, binUtil, navTransform); } ATH_MSG_ERROR( "No TrackingVolumes provided to the TrackingVolumeArrayCreator: return 0" ); - return 0; + return nullptr; } @@ -822,22 +820,22 @@ Trk::TrackingVolumeArray* Trk::TrackingVolumeArrayCreator::doubleTrapezoidVolume dynamic_cast<const Trk::DoubleTrapezoidVolumeBounds*>(&((*volIter)->volumeBounds())); if (!currentDTrdBounds) { ATH_MSG_ERROR( "Given TrackingVolume to TrackingVolumeArrayCreator didn't match specified shape: return 0" ); - return 0; + return nullptr; } // push back the volume order position - if(navtype==false){ + if(!navtype){ volOrder.push_back(Trk::SharedObject<const TrackingVolume>((*volIter))); } else{ volOrder.push_back(Trk::SharedObject<const TrackingVolume>((*volIter),do_not_delete<const TrackingVolume>)); } } - if (volOrder.size()) { + if (!volOrder.empty()) { Amg::Transform3D* navTransform = new Amg::Transform3D; navTransform->setIdentity(); return new Trk::NavBinnedArray1D<Trk::TrackingVolume>(volOrder, binUtil, navTransform); } ATH_MSG_ERROR( "No TrackingVolumes provided to the TrackingVolumeArrayCreator: return 0" ); - return 0; + return nullptr; } diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeHelper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeHelper.cxx index be59a07251c02dc54555dca8617763a96c5480b9..0b7bea4b2189b3db8ac7cb87af66b8099f5b7c0d 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeHelper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeHelper.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 */ /////////////////////////////////////////////////////////////////// @@ -31,6 +31,8 @@ // Gaudi #include "GaudiKernel/SystemOfUnits.h" +#include <memory> + #include <stdexcept> double Trk::TrackingVolumeHelper::s_layerThickness = 1.*Gaudi::Units::mm; @@ -134,11 +136,11 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const Trk::TrackingVolume& f if (msgLvl(MSG::VERBOSE)) { ATH_MSG_VERBOSE( "Glue Volume '" << firstVol.volumeName() << "' to " << secondVolumes.size() << " volume(s): " ); - for (auto& volIter : secondVolumes) + for (const auto & volIter : secondVolumes) ATH_MSG_VERBOSE( " -> " << (volIter)->volumeName() ); } // prepare the material layer if needed - const Trk::Layer* mLayer = 0; + const Trk::Layer* mLayer = nullptr; // ---------------------------------------------------------------------------------------- // create a MaterialLayer as a boundary if (buildBoundaryLayer){ @@ -159,7 +161,7 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const Trk::TrackingVolume& f glueTrackingVolumes(firstVol, firstFace, *(secondVolumes[0]), secondFace); } else { // create the navigation bin array - Trk::BinnedArray<Trk::TrackingVolume>* navArray = 0; + Trk::BinnedArray<Trk::TrackingVolume>* navArray = nullptr; // create the Array - either r-binned or z-binned if (firstFace == Trk::negativeFaceXY || firstFace == Trk::positiveFaceXY ) navArray = m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(secondVolumes, true); @@ -179,12 +181,12 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const Trk::TrackingVolume& f // get the dimension of boundary surface of the first volume const Trk::SharedObject< const BoundarySurface<TrackingVolume> > bSurface = firstVol.boundarySurfaces()[firstFace]; // replace the boundary surface - for ( auto& volIter: secondVolumes ) + for ( const auto & volIter: secondVolumes ) setBoundarySurface(*volIter, bSurface, secondFace); } else { // [2] the traditional way, keeping two boundary surfaces // now set the face to the volume array ------------------------------------------------------------------------------- - for ( auto& volIter: secondVolumes ) { + for ( const auto & volIter: secondVolumes ) { // the secondGlueFace Trk::BoundarySurfaceFace secondGlueFace = secondFace; if (secondFace == Trk::tubeOuterCover) { @@ -219,8 +221,8 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: { - Trk::BinnedArray<Trk::TrackingVolume>* navArrayOne = 0; - Trk::BinnedArray<Trk::TrackingVolume>* navArrayTwo = 0; + Trk::BinnedArray<Trk::TrackingVolume>* navArrayOne = nullptr; + Trk::BinnedArray<Trk::TrackingVolume>* navArrayTwo = nullptr; std::unique_ptr<const Trk::Surface> mLayerSurface; std::unique_ptr<const Trk::Layer> mLayer; @@ -235,7 +237,7 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: // build a disc to separate the two if (buildBoundaryLayer || boundaryFaceExchange){ double rmin = 10e10; double rmax = 0; double boundaryz = 0.; double centerzOne = 0.; - for (auto& volIter : firstVolumes ){ + for (const auto & volIter : firstVolumes ){ const Trk::CylinderVolumeBounds* cb = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(volIter->volumeBounds())); if (cb) { takeSmaller(rmin,cb->innerRadius()); @@ -249,15 +251,15 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: Amg::Transform3D* mLayerTransform = new Amg::Transform3D; (*mLayerTransform) = Amg::Translation3D(0.,0.,boundaryz); // layer surface - mLayerSurface.reset( new Trk::DiscSurface(mLayerTransform,rmin,rmax) ); + mLayerSurface = std::make_unique<Trk::DiscSurface>( mLayerTransform,rmin,rmax ); // create a MaterialLayer std::unique_ptr<const Trk::LayerMaterialProperties> lmps( layerMaterialProperties(*mLayerSurface) ); // MaterialLayer clones the LayerMaterialPropteries. if (lmps) { - mLayer.reset( new Trk::MaterialLayer( + mLayer = std::make_unique<Trk::MaterialLayer>( std::shared_ptr<const Trk::Surface>(std::move(mLayerSurface)), - *lmps) ); + *lmps ); } } if (boundaryFaceExchange){ @@ -287,11 +289,11 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: boundarySurface->surfaceRepresentation().setMaterialLayer(*(mLayer.release())); } // set the boundary surface to the volumes of both sides - for (auto& volIter : firstVolumes){ + for (const auto & volIter : firstVolumes){ ATH_MSG_VERBOSE(" -> first array : setting a newly created boundary surface to " << volIter->volumeName()); setBoundarySurface(*volIter,sharedBoundarySurface,firstFace); } - for (auto& volIter : secondVolumes){ + for (const auto & volIter : secondVolumes){ ATH_MSG_VERBOSE(" -> second array : setting a newly created boundary surface to " << volIter->volumeName()); setBoundarySurface(*volIter,sharedBoundarySurface,secondFace); } @@ -307,7 +309,7 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: if (buildBoundaryLayer || boundaryFaceExchange){ // build a cylinder to separate the two double zmin = 10e10; double zmax = -10e10; double boundaryr = 0.; double volumerOne = 0.; double volumerTwo = 10e10; - for (auto& volIter : firstVolumes ){ + for (const auto & volIter : firstVolumes ){ const Trk::CylinderVolumeBounds* cb = dynamic_cast<const Trk::CylinderVolumeBounds*>(&(volIter->volumeBounds())); if (cb) { takeSmaller(zmin,volIter->center().z()-cb->halflengthZ()); @@ -320,23 +322,23 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: } // check if boundary layer should be built if (buildBoundaryLayer){ - Amg::Transform3D* mLayerTransform = ((zmin+zmax)*(zmin+zmax)<10e-4) ? 0 : new Amg::Transform3D; + Amg::Transform3D* mLayerTransform = ((zmin+zmax)*(zmin+zmax)<10e-4) ? nullptr : new Amg::Transform3D; if (mLayerTransform) (*mLayerTransform) = Amg::Translation3D(0.,0.,0.5*(zmin+zmax)); mLayerSurface.reset( mLayerTransform ? new Trk::CylinderSurface(mLayerTransform,boundaryr,0.5*(zmax-zmin)) : new Trk::CylinderSurface(boundaryr,0.5*(zmax-zmin)) ); // create a MaterialLayer std::unique_ptr<const Trk::LayerMaterialProperties> lmps( layerMaterialProperties(*mLayerSurface) ); // LayerMaterialProperties will be cloned in MaterialLayer - if (lmps) mLayer.reset( new Trk::MaterialLayer( + if (lmps) mLayer = std::make_unique<Trk::MaterialLayer>( std::shared_ptr<const Trk::Surface>(std::move(mLayerSurface)), - *lmps) ); + *lmps ); } // check if boundary face should be exchanged if (boundaryFaceExchange) { // creating only one boundary surface ATH_MSG_VERBOSE("Creating a joint boundary surface for n-to-n glueing case."); // the boundary transform can be 0 for cylinder surfaces - Amg::Transform3D* boundaryTransform = ((zmin+zmax)*(zmin+zmax)<10e-4) ? 0 : new Amg::Transform3D; + Amg::Transform3D* boundaryTransform = ((zmin+zmax)*(zmin+zmax)<10e-4) ? nullptr : new Amg::Transform3D; if (boundaryTransform) (*boundaryTransform) = Amg::Translation3D(0.,0.,0.5*(zmin+zmax)); // create the cylinder surface for the shared boundary Trk::CylinderSurface cSurface = boundaryTransform ? Trk::CylinderSurface(boundaryTransform,boundaryr,0.5*(zmax-zmin)) : @@ -364,11 +366,11 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: boundarySurface->surfaceRepresentation().setMaterialLayer(*(mLayer.release())); } // set the boundary surface to the volumes of both sides - for (auto& volIter : firstVolumes){ + for (const auto & volIter : firstVolumes){ ATH_MSG_VERBOSE(" -> first array : setting a newly created boundary surface to " << volIter->volumeName()); setBoundarySurface(*volIter,sharedBoundarySurface,firstFace); } - for (auto& volIter : secondVolumes){ + for (const auto & volIter : secondVolumes){ ATH_MSG_VERBOSE(" -> second array : setting a newly created boundary surface to " << volIter->volumeName()); setBoundarySurface(*volIter,sharedBoundarySurface,secondFace); } @@ -389,7 +391,7 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: const Trk::Layer *mLayer_ptr=mLayer.get(); // (a) to the first set of volumes - for (auto& tVolIter: firstVolumes) { + for (const auto & tVolIter: firstVolumes) { // take care of the orientation of the normal vector if (firstFace != Trk::tubeInnerCover) { setOutsideTrackingVolumeArray(*tVolIter,firstFace,navArrayTwoShared); @@ -409,7 +411,7 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: } // (b) to the second set of volumes - for (auto& tVolIter : secondVolumes) { + for (const auto & tVolIter : secondVolumes) { // take care of the orientation of the normal vector if (secondFace != Trk::tubeInnerCover) { ATH_MSG_VERBOSE( "Set outsideTrackingVolumeArray at face " << secondFace << " to " << (*tVolIter).volumeName() ); @@ -435,7 +437,7 @@ Trk::TrackingVolume* Trk::TrackingVolumeHelper::glueTrackingVolumeArrays( const Trk::TrackingVolume& secondVol, Trk::BoundarySurfaceFace secondFace, std::string name) const { - Trk::TrackingVolume* enclosingVolume = 0; + Trk::TrackingVolume* enclosingVolume = nullptr; const Trk::CylinderVolumeBounds* cyl1 = dynamic_cast<const Trk::CylinderVolumeBounds*> (&(firstVol.volumeBounds())); const Trk::CylinderVolumeBounds* cyl2 = dynamic_cast<const Trk::CylinderVolumeBounds*> (&(secondVol.volumeBounds())); @@ -456,9 +458,9 @@ Trk::TrackingVolume* Trk::TrackingVolumeHelper::glueTrackingVolumeArrays( // build volume envelope std::vector<const Trk::TrackingVolume*> vols; - Trk::CylinderVolumeBounds* envBounds = 0; - Amg::Transform3D* envTransf = 0; - Trk::BinnedArray<Trk::TrackingVolume>* subVols = 0; + Trk::CylinderVolumeBounds* envBounds = nullptr; + Amg::Transform3D* envTransf = nullptr; + Trk::BinnedArray<Trk::TrackingVolume>* subVols = nullptr; vols.push_back(&firstVol); vols.push_back(&secondVol); std::vector<const Trk::TrackingVolume*> envGlueNegXY; @@ -509,7 +511,7 @@ Trk::TrackingVolume* Trk::TrackingVolumeHelper::glueTrackingVolumeArrays( envBounds = new Trk::CylinderVolumeBounds(cyl1->outerRadius(), cyl1->halflengthZ()); } - envTransf = firstVol.transform().isApprox(Amg::Transform3D::Identity()) ? 0 : new Amg::Transform3D; + envTransf = firstVol.transform().isApprox(Amg::Transform3D::Identity()) ? nullptr : new Amg::Transform3D; if (envTransf) (*envTransf) = Amg::Translation3D(firstVol.center()); // revert vols @@ -529,7 +531,7 @@ Trk::TrackingVolume* Trk::TrackingVolumeHelper::glueTrackingVolumeArrays( envBounds = new Trk::CylinderVolumeBounds(cyl1->innerRadius(), cyl2->outerRadius(), cyl1->halflengthZ()); - envTransf = firstVol.transform().isApprox(Amg::Transform3D::Identity()) ? 0 : new Amg::Transform3D; + envTransf = firstVol.transform().isApprox(Amg::Transform3D::Identity()) ? nullptr : new Amg::Transform3D; if (envTransf) (*envTransf) = Amg::Translation3D(firstVol.center()); subVols = m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(vols,false); @@ -546,7 +548,7 @@ Trk::TrackingVolume* Trk::TrackingVolumeHelper::glueTrackingVolumeArrays( enclosingVolume = new Trk::TrackingVolume(envTransf, envBounds, firstVol, - 0,subVols, + nullptr,subVols, name); // ENVELOPE GLUE DESCRIPTION ----------------------------------------------------------------- @@ -592,7 +594,7 @@ void Trk::TrackingVolumeHelper::fillGlueVolumes(const std::vector< const Trackin // get the GlueVolumesDescriptor const Trk::GlueVolumesDescriptor& glueVolDescriptor = (*refVolIter)->glueVolumesDescriptor(); // if the size of glue volumes is 0 -> the referenceVolume is at navigation level - if ( (glueVolDescriptor.glueVolumes(glueFace)).size() == 0) { + if ( (glueVolDescriptor.glueVolumes(glueFace)).empty()) { glueVols.push_back(*refVolIter); } else { // fill all the sub-volumes described by the glueVolumeDescriptor @@ -640,14 +642,14 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: // trivial cases // (glue one to the other) - if (glueVols1.size()==0 && glueVols2.size()==0) { + if (glueVols1.empty() && glueVols2.empty()) { glueTrackingVolumes(**firstVol,firstFace,**secondVol,secondFace); continue; // (glue one to many) - } else if (glueVols1.size()==0 && glueVols2.size()>0) { + } else if (glueVols1.empty() && !glueVols2.empty()) { glueVols1.push_back(*firstVol); // (glue the other one to many) - } else if (glueVols1.size()>0 && glueVols2.size()==0) { + } else if (!glueVols1.empty() && glueVols2.empty()) { glueVols2.push_back(*secondVol); } @@ -715,7 +717,7 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector<const Trk: const Trk::LayerMaterialProperties* Trk::TrackingVolumeHelper::layerMaterialProperties(const Trk::Surface& boundarySurface) const { - Trk::LayerMaterialProperties* layerMaterial = 0; + Trk::LayerMaterialProperties* layerMaterial = nullptr; if (boundarySurface.type() == Trk::Surface::Cylinder){ const Trk::CylinderBounds* cb = dynamic_cast<const Trk::CylinderBounds*>(&boundarySurface.bounds()); if (!cb) throw std::logic_error("Not CylinderBounds"); diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/AssociatedMaterial.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/AssociatedMaterial.h index ca0560e5768d09ab8fa7924f9aff9bd6bab6ecae..870f452fa29c00866ac8ab933cb92487edb6722d 100644 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/AssociatedMaterial.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/AssociatedMaterial.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 */ /////////////////////////////////////////////////////////////////// @@ -79,7 +79,7 @@ namespace Trk { AssociatedMaterial(const AssociatedMaterial& am); /** Move constructor*/ - AssociatedMaterial(AssociatedMaterial&& am); + AssociatedMaterial(AssociatedMaterial&& am) noexcept; /** Destructor */ virtual ~AssociatedMaterial(); @@ -88,7 +88,7 @@ namespace Trk { AssociatedMaterial& operator=(const AssociatedMaterial& am); /**Move Assignment operator */ - AssociatedMaterial& operator=(AssociatedMaterial&& am); + AssociatedMaterial& operator=(AssociatedMaterial&& am) noexcept; /** Trivial Access methods */ const Trk::MaterialProperties* materialProperties() const; diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/AssociatedMaterial.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/AssociatedMaterial.cxx index 0f1e26a2f3adc49c0a8ed89f47ad801cc121ade0..92eb4eb0670087c403987972de5c1b95acfae4f0 100644 --- a/Tracking/TrkDetDescr/TrkGeometry/src/AssociatedMaterial.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/AssociatedMaterial.cxx @@ -16,7 +16,7 @@ Trk::AssociatedMaterial::AssociatedMaterial() : m_materialPosition(Amg::Vector3D(0.,0.,0.)), - m_correctionFactor(0.), + m_correctionFactor(0.), m_materialProperties(nullptr), m_materialStep(nullptr), m_trackingVolume(nullptr), @@ -36,12 +36,12 @@ Trk::AssociatedMaterial::AssociatedMaterial( const TrackingVolume* tvol, const Layer* lay) : m_materialPosition(hitpos), - m_correctionFactor(cFactor), + m_correctionFactor(cFactor), m_materialProperties(nullptr), m_materialStep(new Trk::MaterialStep(hitpos.x(),hitpos.y(),hitpos.z(), steplength, X0, L0, A, Z, rho)), m_trackingVolume(tvol), m_layer(lay), - m_cleanup(true) + m_cleanup(true) {} Trk::AssociatedMaterial::AssociatedMaterial( @@ -52,12 +52,12 @@ Trk::AssociatedMaterial::AssociatedMaterial( const TrackingVolume* tvol, const Layer* lay) : m_materialPosition(hitpos), - m_correctionFactor(cFactor), + m_correctionFactor(cFactor), m_materialProperties(new Trk::MaterialProperties(mat,steplength)), m_materialStep(nullptr), m_trackingVolume(tvol), m_layer(lay), - m_cleanup(true) + m_cleanup(true) {} Trk::AssociatedMaterial::AssociatedMaterial(const Amg::Vector3D& hitpos, @@ -66,13 +66,13 @@ Trk::AssociatedMaterial::AssociatedMaterial(const Amg::Vector3D& hitpos, const Trk::TrackingVolume* tvol, const Trk::Layer* lay) : m_materialPosition(hitpos), - m_correctionFactor(cFactor), + m_correctionFactor(cFactor), m_materialProperties(mprop), m_materialStep(nullptr), m_trackingVolume(tvol), m_layer(lay), m_cleanup(false) - + {} Trk::AssociatedMaterial::AssociatedMaterial(const Trk::MaterialStep* ms, @@ -80,29 +80,29 @@ Trk::AssociatedMaterial::AssociatedMaterial(const Trk::MaterialStep* ms, const Trk::TrackingVolume* tvol, const Trk::Layer* lay) : m_materialPosition( Amg::Vector3D(ms->hitX(), ms->hitY(), ms->hitZ()) ), - m_correctionFactor(cFactor), + m_correctionFactor(cFactor), m_materialProperties(nullptr), m_materialStep(ms), m_trackingVolume(tvol), m_layer(lay), m_cleanup(false) {} - + Trk::AssociatedMaterial::AssociatedMaterial(const Amg::Vector3D& hitpos, const Trk::TrackingVolume* tvol, const Trk::Layer* lay) : m_materialPosition(hitpos), - m_correctionFactor(0.), + m_correctionFactor(0.), m_materialProperties(nullptr), m_materialStep(nullptr), m_trackingVolume(tvol), m_layer(lay), m_cleanup(false) -{} - +{} + Trk::AssociatedMaterial::AssociatedMaterial(const Trk::AssociatedMaterial& am) : m_materialPosition(am.m_materialPosition), - m_correctionFactor(am.m_correctionFactor), + m_correctionFactor(am.m_correctionFactor), m_materialProperties(am.m_cleanup && am.m_materialProperties ? am.m_materialProperties->clone() : am.m_materialProperties), m_materialStep( (am.m_cleanup && am.m_materialStep ) ? new Trk::MaterialStep(*am.m_materialStep) : am.m_materialStep), m_trackingVolume(am.m_trackingVolume), @@ -110,14 +110,15 @@ Trk::AssociatedMaterial::AssociatedMaterial(const Trk::AssociatedMaterial& am) m_cleanup(am.m_cleanup) {} -Trk::AssociatedMaterial::AssociatedMaterial( Trk::AssociatedMaterial&& am ) - : m_materialPosition(std::move(am.m_materialPosition)), - m_correctionFactor(am.m_correctionFactor), - m_materialProperties(am.m_materialProperties), - m_materialStep(am.m_materialStep), - m_trackingVolume(am.m_trackingVolume), - m_layer(am.m_layer), - m_cleanup(am.m_cleanup) +Trk::AssociatedMaterial::AssociatedMaterial( + Trk::AssociatedMaterial&& am) noexcept + : m_materialPosition(std::move(am.m_materialPosition)) + , m_correctionFactor(am.m_correctionFactor) + , m_materialProperties(am.m_materialProperties) + , m_materialStep(am.m_materialStep) + , m_trackingVolume(am.m_trackingVolume) + , m_layer(am.m_layer) + , m_cleanup(am.m_cleanup) { am.m_materialProperties = nullptr; am.m_materialStep = nullptr; @@ -133,8 +134,8 @@ Trk::AssociatedMaterial& Trk::AssociatedMaterial::operator =( const Trk::Associa } m_materialPosition = am.m_materialPosition; m_correctionFactor = am.m_correctionFactor; - m_materialProperties = (am.m_cleanup && am.m_materialProperties ) ? am.m_materialProperties->clone() : am.m_materialProperties; - m_materialStep = (am.m_cleanup && am.m_materialStep ) ? new Trk::MaterialStep(*am.m_materialStep) : am.m_materialStep; + m_materialProperties = (am.m_cleanup && am.m_materialProperties ) ? am.m_materialProperties->clone() : am.m_materialProperties; + m_materialStep = (am.m_cleanup && am.m_materialStep ) ? new Trk::MaterialStep(*am.m_materialStep) : am.m_materialStep; m_trackingVolume = am.m_trackingVolume ; m_layer = am.m_layer; m_cleanup = am.m_cleanup; @@ -142,8 +143,8 @@ Trk::AssociatedMaterial& Trk::AssociatedMaterial::operator =( const Trk::Associa return (*this); } - -Trk::AssociatedMaterial& Trk::AssociatedMaterial::operator =( Trk::AssociatedMaterial&& am ) +Trk::AssociatedMaterial& +Trk::AssociatedMaterial::operator=(Trk::AssociatedMaterial&& am) noexcept { m_materialPosition = std::move(am.m_materialPosition); @@ -168,7 +169,7 @@ Trk::AssociatedMaterial& Trk::AssociatedMaterial::operator =( Trk::AssociatedMat return *this; } -Trk::AssociatedMaterial::~AssociatedMaterial() +Trk::AssociatedMaterial::~AssociatedMaterial() { if (m_cleanup) { delete m_materialStep; diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/BinnedLayerMaterial.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/BinnedLayerMaterial.cxx index ce77ebdb63fed8926e7ab408d0eacd17a25d8e12..4f516d5efe569e57daf10e0965d58287ca939067 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/BinnedLayerMaterial.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/BinnedLayerMaterial.cxx @@ -102,12 +102,12 @@ void Trk::BinnedLayerMaterial::clearMaterial() void Trk::BinnedLayerMaterial::fillMaterial(const Trk::MaterialPropertiesMatrix& matMatrix) { m_fullMaterial.reserve(m_binUtility->max(1)+1); - for (auto& matMatrixIter : matMatrix){ + for (const auto & matMatrixIter : matMatrix){ // the vector to be copied Trk::MaterialPropertiesVector matVector; matVector.reserve(m_binUtility->max(0)+1); // reassign - for (auto& matIter : matMatrixIter) + for (const auto & matIter : matMatrixIter) matVector.push_back( matIter ? matIter->clone() : nullptr); m_fullMaterial.push_back(matVector); } @@ -151,10 +151,10 @@ MsgStream& Trk::BinnedLayerMaterial::dump( MsgStream& sl) const sl << " - Parse full update material : " << std::endl; // output the full material unsigned int imat2 = 0; - for (auto& matMatrixIter : m_fullMaterial){ + for (const auto & matMatrixIter : m_fullMaterial){ unsigned int imat1 = 0; // the vector iterator - for (auto& matIter : matMatrixIter){ + for (const auto & matIter : matMatrixIter){ if (matIter) sl << " Bin [" << imat2 << "][" << imat1 << "] - " << (*matIter) << std::endl; else sl << " Bin [" << imat2 << "][" << imat1 << "] - empty " << std::endl; ++imat1; @@ -171,10 +171,10 @@ std::ostream& Trk::BinnedLayerMaterial::dump( std::ostream& sl) const sl << " - Parse full update material : " << std::endl; // // output the full material unsigned int imat2 = 0; - for (auto& matMatrixIter : m_fullMaterial){ + for (const auto & matMatrixIter : m_fullMaterial){ unsigned int imat1 = 0; // the vector iterator - for (auto& matIter : matMatrixIter){ + for (const auto & matIter : matMatrixIter){ if (matIter) sl << " Bin [" << imat2 << "][" << imat1 << "] - " << (*matIter) << std::endl; else sl << " Bin [" << imat2 << "][" << imat1 << "] - empty " << std::endl; ++imat1; diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/CompoundLayerMaterial.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/CompoundLayerMaterial.cxx index 730fe2bc5a881889faff74c857fc913207a3b1c2..318fc2f51de051f2839c734ab29bcdf7519b65c8 100644 --- a/Tracking/TrkDetDescr/TrkGeometry/src/CompoundLayerMaterial.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/CompoundLayerMaterial.cxx @@ -123,7 +123,7 @@ const Trk::MaterialProperties* Trk::CompoundLayerMaterial::material(size_t bin0, // the full composition calculation if (m_fullComposition && m_elementTable.get()){ //!< @todo measure if this is slow - for ( auto& eFraction : m_composition[bin1][bin0] ){ + for ( const auto & eFraction : m_composition[bin1][bin0] ){ double fraction = eFraction.fraction(); const Trk::Material* material = m_elementTable->element(eFraction.element()); if (material){ diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/CompressedLayerMaterial.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/CompressedLayerMaterial.cxx index e723c08863f44379113a2b98ece1f30993eb60e8..215ad2ea26e5e49b6190eea5d21edbe461b106b8 100644 --- a/Tracking/TrkDetDescr/TrkGeometry/src/CompressedLayerMaterial.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/CompressedLayerMaterial.cxx @@ -90,7 +90,7 @@ void Trk::CompressedLayerMaterial::fillMaterial(const Trk::MaterialPropertiesVec // reassign m_fullMaterial.clear(); m_fullMaterial.reserve(matVector.size()); - for ( auto& matIter : matVector ) + for ( const auto & matIter : matVector ) m_fullMaterial.push_back( matIter ? matIter->clone() : nullptr); } @@ -132,7 +132,7 @@ MsgStream& Trk::CompressedLayerMaterial::dump( MsgStream& sl) const sl << " - Parse full update material : " << std::endl; // ------------------------- size_t imat1 = 0; - for ( auto& matIter : m_fullMaterial ){ + for ( const auto & matIter : m_fullMaterial ){ if (matIter) sl << " Bin [" << imat1 << "] - " << matIter << std::endl; else sl << " Bin [" << imat1 << "] - empty " << std::endl; ++imat1; @@ -146,7 +146,7 @@ std::ostream& Trk::CompressedLayerMaterial::dump( std::ostream& sl) const sl << " - Number of Material bins (1/2) : " << m_binUtility->max(0)+1 << " / " << m_binUtility->max(1)+1 << std::endl; sl << " - Parse full update material : " << std::endl; // size_t imat1 = 0; - for ( auto& matIter : m_fullMaterial ){ + for ( const auto & matIter : m_fullMaterial ){ if (matIter) sl << " Bin [" << imat1 << "] - " << matIter << std::endl; else sl << " Bin [" << imat1 << "] - empty " << std::endl; ++imat1; diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/CylinderLayer.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/CylinderLayer.cxx index 8a46f927731b3b66faf74626c460712c32fb3dca..299f560def4c85e9215d88f42e484b8df31bb90b 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/CylinderLayer.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/CylinderLayer.cxx @@ -246,7 +246,7 @@ const Trk::Surface& Trk::CylinderLayer::approachSurface(const Amg::Vector3D& pos const Trk::Surface* aSurface = nullptr; double aPathLength = 10e10; // get the surfaces - for (auto& sfIter : (*surfacesOnApproach)){ + for (const auto & sfIter : (*surfacesOnApproach)){ // get the intersection with the surface Trk::Intersection sIntersection = sfIter->straightLineIntersection(pos, dir, true, bcheck); // validation diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/DetachedTrackingVolume.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/DetachedTrackingVolume.cxx index 015a41b2a8187aa5144795f9f70581e29703fe72..fd6925aedb5c38a9e8d2d847a03888394177f9d5 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/DetachedTrackingVolume.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/DetachedTrackingVolume.cxx @@ -147,7 +147,7 @@ void Trk::DetachedTrackingVolume::compactify ATLAS_NOT_THREAD_SAFE(size_t& cSurf // deal with the multi-layer representation if ( multilayerRepresentation() ){ tSurfaces += m_multilayerRepresentation->size(); - for ( auto& mLayerIter : (*m_multilayerRepresentation) ){ + for ( const auto & mLayerIter : (*m_multilayerRepresentation) ){ if ( (*mLayerIter).surfaceRepresentation().owner() == Trk::noOwn ){ (*mLayerIter).surfaceRepresentation().setOwner(Trk::TGOwn); ++cSurfaces; diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/DiscLayer.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/DiscLayer.cxx index 5350136ed628000e84805b12c1aaf4f37dba5b92..520ab76c3f5a6b4a9c581c539b75001701b70fa2 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/DiscLayer.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/DiscLayer.cxx @@ -198,7 +198,7 @@ const Trk::Surface& Trk::DiscLayer::approachSurface(const Amg::Vector3D& pos, const Trk::Surface* aSurface = nullptr; double aPathLength = 10e10; //!< @TODO -> optimise by breaking the loop if possible - for (auto& sfIter : (*surfacesOnApproach)){ + for (const auto & sfIter : (*surfacesOnApproach)){ // get the intersection with the surface Trk::Intersection sIntersection = sfIter->straightLineIntersection(pos, dir, true, bcheck); // validation diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/Layer.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/Layer.cxx index cbdde4c2ebd1755d9df78a7ec499a8ff85d19f90..5e4c4e2abb70a2afbe614bd769a6c7fe8ad40487 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/Layer.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/Layer.cxx @@ -208,7 +208,7 @@ bool Trk::Layer::needsMaterialProperties() const { //!< @todo this is temporary if (m_surfaceArray){ const std::vector<const Trk::Surface*>& surfaces = m_surfaceArray->arrayObjects(); - for ( auto& sIter : surfaces ) { + for ( const auto & sIter : surfaces ) { if (sIter && sIter->materialLayer() && (sIter->materialLayer())->layerMaterialProperties()) return false; } @@ -234,7 +234,7 @@ void Trk::Layer::compactify(size_t& cSurfaces, size_t& tSurfaces) const { // set the subsurface representation, usually already owned by DetElement if (m_surfaceArray){ const std::vector<const Trk::Surface*>& surfaces = m_surfaceArray->arrayObjects(); - for ( auto& sIter : surfaces ){ + for ( const auto & sIter : surfaces ){ if ( sIter && (*sIter).owner() == Trk::noOwn){ (*sIter).setOwner(Trk::TGOwn); ++cSurfaces; diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/MaterialStep.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/MaterialStep.cxx index 39e3a36e97dc2ec43914c519b97545529c93ab37..8420d59c18b31be6f47f13833a87f60d3d3bd867 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/MaterialStep.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/MaterialStep.cxx @@ -10,6 +10,8 @@ // Gaudi #include "GaudiKernel/MsgStream.h" // STD +#include <cmath> + #include <iostream> Trk::MaterialStep::MaterialStep() @@ -34,7 +36,7 @@ Trk::MaterialStep::MaterialStep( m_hitX(x), m_hitY(y), m_hitZ(z), - m_hitR(sqrt(x*x+y*y)), + m_hitR(std::sqrt(x*x+y*y)), m_material(matX0, matL0, matA, matZ, matRho, matdEdX) {} @@ -53,7 +55,7 @@ Trk::MaterialStep::MaterialStep( m_hitX(x), m_hitY(y), m_hitZ(z), - m_hitR(sqrt(x*x+y*y)), + m_hitR(std::sqrt(x*x+y*y)), m_material(matX0, matL0, matA, matZ, matRho, matdEdX, new Trk::MaterialComposition(elements, fractions)) {} diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingGeometry.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingGeometry.cxx index cf19f65d68ede06c8d51b53c847110d488d85ba2..25108439759a1a5c257454a4ae31ab6de7dd88eb 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingGeometry.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingGeometry.cxx @@ -78,25 +78,25 @@ void Trk::TrackingGeometry::registerTrackingVolumes ATLAS_NOT_THREAD_SAFE (const const Trk::BinnedArray< Trk::TrackingVolume >* confinedVolumes = tvol.confinedVolumes(); if (confinedVolumes){ const std::vector<const Trk::TrackingVolume*>& volumes = confinedVolumes->arrayObjects(); - for (auto& volumesIter: volumes) + for (const auto & volumesIter: volumes) if (volumesIter) registerTrackingVolumes(*volumesIter, &tvol, sublvl); } const std::vector<const Trk::TrackingVolume* >* confinedDenseVolumes = tvol.confinedDenseVolumes(); if (confinedDenseVolumes){ - for (auto& volumesIter : (*confinedDenseVolumes) ) + for (const auto & volumesIter : (*confinedDenseVolumes) ) if (volumesIter) registerTrackingVolumes(*volumesIter, &tvol, sublvl); } /** should detached tracking volumes be part of the tracking geometry ? */ const std::vector< const Trk::DetachedTrackingVolume* >* confinedDetachedVolumes = tvol.confinedDetachedVolumes(); if (confinedDetachedVolumes){ - for (auto& volumesIter : (*confinedDetachedVolumes) ) + for (const auto & volumesIter : (*confinedDetachedVolumes) ) if (volumesIter && tvol.inside(volumesIter->trackingVolume()->center(),0.) ) registerTrackingVolumes(*(volumesIter->trackingVolume()), &tvol, sublvl); } /** register the boundary layers */ // boundary layers - for (auto& bSurface : tvol.boundarySurfaces()){ + for (const auto & bSurface : tvol.boundarySurfaces()){ const Trk::Layer* bLayer = bSurface->surfaceRepresentation().materialLayer(); if (bLayer){ auto bfIter = m_boundaryLayers.find(bLayer); @@ -177,7 +177,7 @@ void Trk::TrackingGeometry::printVolumeInformation(MsgStream& msg, const Trk::Tr msg << " "; msg << "- found : " << volumes.size() << " confined TrackingVolumes" << std::endl; - for (auto& volumesIter : volumes ) + for (const auto & volumesIter : volumes ) if (volumesIter) printVolumeInformation(msg, *volumesIter, sublevel); } @@ -187,7 +187,7 @@ void Trk::TrackingGeometry::printVolumeInformation(MsgStream& msg, const Trk::Tr msg << " "; msg << "- found : " << confinedDenseVolumes->size() << " confined unordered (dense) TrackingVolumes" << std::endl; - for (auto& volumesIter : (*confinedDenseVolumes) ) + for (const auto & volumesIter : (*confinedDenseVolumes) ) if (volumesIter) printVolumeInformation(msg, *volumesIter, sublevel); } } diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx index 673b66f310f0abb2240fd7cc8aef8d77a124c6da..afe35d648875f18de471faf38b92c52170bbf5d4 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx @@ -567,7 +567,7 @@ Trk::LayerIntersection<Amg::Vector3D> // ---------------- BOUNDARY LAYER SECTION (only for mapping) ---------- if (pDir == mappingMode){ - for (auto& bSurface : boundarySurfaces()){ + for (const auto & bSurface : boundarySurfaces()){ if (bSurface->surfaceRepresentation().materialLayer()) layerCandidates.push_back(bSurface->surfaceRepresentation().materialLayer()); } @@ -651,7 +651,7 @@ const Trk::TrackingVolume* Trk::TrackingVolume::nextVolume(const Amg::Vector3D& double pathLength = 10e10; // now loop through the and find the closest const auto &bSurfaces = boundarySurfaces(); - for (auto& bSurfIter : bSurfaces ){ + for (const auto & bSurfIter : bSurfaces ){ // get the intersection soltuion Trk::Intersection sfI = (*bSurfIter).surfaceRepresentation().straightLineIntersection(gp, cDir, forceDir, true); if (sfI.valid && (sfI.pathLength*sfI.pathLength) < (pathLength*pathLength) ){ @@ -693,7 +693,7 @@ void Trk::TrackingVolume::indexContainedStaticLayers ATLAS_NOT_THREAD_SAFE(Geome // the static layers first ------------------------------------------------------------------ if (m_confinedLayers){ const std::vector<const Trk::Layer*>& layers = m_confinedLayers->arrayObjects(); - for ( auto& layerIter : layers){ + for ( const auto & layerIter : layers){ // only index the material layers & only those that have not yet been singed if ( layerIter && layerIter->layerIndex().value() < 0 ){ // sign only those with material properties - rest goes to 0 @@ -706,8 +706,8 @@ void Trk::TrackingVolume::indexContainedStaticLayers ATLAS_NOT_THREAD_SAFE(Geome } // the boundary surface layer - auto& bSurfaces = boundarySurfaces(); - for (auto& bsIter : bSurfaces ){ + const auto & bSurfaces = boundarySurfaces(); + for (const auto & bsIter : bSurfaces ){ const Trk::Layer* mLayer = bsIter->surfaceRepresentation().materialLayer(); if (mLayer && mLayer->layerIndex().value() < 0.){ Trk::LayerIndex layIndex = Trk::LayerIndex(int(geoSig)*TRKDETDESCR_GEOMETRYSIGNATUREWEIGHT+(++offset)); @@ -718,7 +718,7 @@ void Trk::TrackingVolume::indexContainedStaticLayers ATLAS_NOT_THREAD_SAFE(Geome // step down the hierarchy to the contained volumes and index those ------------------------ if (confinedVolumes()){ const std::vector<const Trk::TrackingVolume*>& volumes = confinedVolumes()->arrayObjects(); - for (auto& volumesIter : volumes){ + for (const auto & volumesIter : volumes){ if (volumesIter) volumesIter->indexContainedStaticLayers(geoSig, offset); } @@ -731,14 +731,14 @@ void Trk::TrackingVolume::indexContainedMaterialLayers ATLAS_NOT_THREAD_SAFE (Ge // the static layers first and check if they have surfaces with material layers that need index if (m_confinedLayers){ const std::vector<const Trk::Layer*>& layers = m_confinedLayers->arrayObjects(); - for ( auto& layerIter : layers){ + for ( const auto & layerIter : layers){ // only index the material layers & only those that have not yet been singed if ( layerIter ){ const Trk::SurfaceArray* surfArray = layerIter->surfaceArray(); if (surfArray) { const std::vector<const Trk::Surface*>& layerSurfaces = surfArray->arrayObjects(); // loop over the surfaces - there can be 0 entries - for (auto& laySurfIter : layerSurfaces) { + for (const auto & laySurfIter : layerSurfaces) { const Trk::Layer* materialLayer = laySurfIter ? laySurfIter->materialLayer() : nullptr; if ( materialLayer && materialLayer->layerIndex().value() < 0 ){ // sign only those with material properties - rest goes to 0 @@ -756,7 +756,7 @@ void Trk::TrackingVolume::indexContainedMaterialLayers ATLAS_NOT_THREAD_SAFE (Ge // step down the hierarchy to the contained volumes and index those ------------------------ if (confinedVolumes()){ const std::vector<const Trk::TrackingVolume*>& volumes = confinedVolumes()->arrayObjects(); - for (auto& volumesIter : volumes){ + for (const auto & volumesIter : volumes){ if (volumesIter) volumesIter->indexContainedMaterialLayers(geoSig, offset); } @@ -812,7 +812,7 @@ void Trk::TrackingVolume::propagateMaterialProperties ATLAS_NOT_THREAD_SAFE(cons const Trk::BinnedArray< Trk::TrackingVolume >* confVolumes = confinedVolumes(); if (confVolumes){ const std::vector<const Trk::TrackingVolume*>& volumes = confVolumes->arrayObjects(); - for (auto& volumesIter : volumes ){ + for (const auto & volumesIter : volumes ){ if (volumesIter) volumesIter->propagateMaterialProperties(mprop); } } @@ -830,18 +830,18 @@ void Trk::TrackingVolume::sign ATLAS_NOT_THREAD_SAFE (Trk::GeometrySignature geo const Trk::BinnedArray< Trk::TrackingVolume >* confVolumes = confinedVolumes(); if (confVolumes){ const std::vector<const Trk::TrackingVolume*>& volumes = confVolumes->arrayObjects(); - for ( auto& volumesIter : volumes ) + for ( const auto & volumesIter : volumes ) if (volumesIter) volumesIter->sign(geosign, geotype); } // same procedure for the detached volumes const std::vector<const Trk::DetachedTrackingVolume* >* confDetachedVolumes = confinedDetachedVolumes(); if (confDetachedVolumes) - for (auto& volumesIter : (*confDetachedVolumes) ) + for (const auto & volumesIter : (*confDetachedVolumes) ) if (volumesIter) volumesIter->sign(geosign, geotype); // confined dense volumes const std::vector<const Trk::TrackingVolume* >* confDenseVolumes = confinedDenseVolumes(); if (confDenseVolumes) - for (auto& volumesIter : (*confDenseVolumes) ) + for (const auto & volumesIter : (*confDenseVolumes) ) if (volumesIter) volumesIter->sign(geosign, geotype); } @@ -1203,27 +1203,27 @@ void Trk::TrackingVolume::moveTV ATLAS_NOT_THREAD_SAFE (Amg::Transform3D& trans // confined 'ordered' layers const Trk::BinnedArray< Trk::Layer >* confLayers = confinedLayers(); if (confLayers) - for (auto& clayIter : confLayers->arrayObjects() ) + for (const auto & clayIter : confLayers->arrayObjects() ) clayIter->moveLayer( transform ); // confined 'unordered' layers const std::vector<const Trk::Layer* >* confArbLayers = confinedArbitraryLayers(); if (confArbLayers) - for (auto& calayIter : (*confArbLayers) ) + for (const auto & calayIter : (*confArbLayers) ) calayIter->moveLayer( transform ); // confined volumes const Trk::BinnedArray< Trk::TrackingVolume >* confVolumes = confinedVolumes(); if (confVolumes) // retrieve array objects and apply the transform - for (auto& cVolumesIter : confVolumes->arrayObjects()) + for (const auto & cVolumesIter : confVolumes->arrayObjects()) cVolumesIter->moveTV( transform ); // confined unordered volumes const std::vector<const Trk::TrackingVolume* >* confDenseVolumes = confinedDenseVolumes(); if (confDenseVolumes) // retrieve array objects and apply the transform - for (auto& cVolumesIter : (*confDenseVolumes) ) + for (const auto & cVolumesIter : (*confDenseVolumes) ) cVolumesIter->moveTV( transform ); } @@ -1233,7 +1233,7 @@ void Trk::TrackingVolume::synchronizeLayers ATLAS_NOT_THREAD_SAFE (MsgStream& ms // case a : Layers exist const Trk::BinnedArray< Trk::Layer >* confLayers = confinedLayers(); if (confLayers){ - for (auto& clayIter : confLayers->arrayObjects()) + for (const auto & clayIter : confLayers->arrayObjects()) if (clayIter){ if (clayIter->surfaceRepresentation().type() == Trk::Surface::Cylinder && !(center().isApprox(clayIter->surfaceRepresentation().center())) ) clayIter->resizeAndRepositionLayer(volumeBounds(),center(),envelope); @@ -1245,7 +1245,7 @@ void Trk::TrackingVolume::synchronizeLayers ATLAS_NOT_THREAD_SAFE (MsgStream& ms // case b : container volume -> step down const Trk::BinnedArray< Trk::TrackingVolume >* confVolumes = confinedVolumes(); if (confVolumes){ - for (auto& cVolumesIter : confVolumes->arrayObjects()) + for (const auto & cVolumesIter : confVolumes->arrayObjects()) cVolumesIter->synchronizeLayers(msgstream, envelope); } } @@ -1256,7 +1256,7 @@ void Trk::TrackingVolume::compactify ATLAS_NOT_THREAD_SAFE (size_t& cSurfaces, s const Trk::BinnedArray< Trk::Layer >* confLayers = confinedLayers(); if (confLayers){ const std::vector<const Trk::Layer*>& layers = confLayers->arrayObjects(); - for (auto& clayIter : layers ) { + for (const auto & clayIter : layers ) { if (&(*clayIter)!=nullptr) clayIter->compactify(cSurfaces,tSurfaces); else @@ -1266,7 +1266,7 @@ void Trk::TrackingVolume::compactify ATLAS_NOT_THREAD_SAFE (size_t& cSurfaces, s // confined 'unordered' layers const std::vector<const Trk::Layer* >* confArbLayers = confinedArbitraryLayers(); if (confArbLayers) { - for (auto& calayIter : (*confArbLayers ) ) { + for (const auto & calayIter : (*confArbLayers ) ) { if (&(*calayIter)!=nullptr) calayIter->compactify(cSurfaces,tSurfaces); else @@ -1277,15 +1277,15 @@ void Trk::TrackingVolume::compactify ATLAS_NOT_THREAD_SAFE (size_t& cSurfaces, s const Trk::BinnedArray< Trk::TrackingVolume >* confVolumes = confinedVolumes(); if (confVolumes){ const std::vector<const Trk::TrackingVolume*>& volumes = confVolumes->arrayObjects(); - for (auto& cVolumesIter : volumes) cVolumesIter->compactify(cSurfaces,tSurfaces); + for (const auto & cVolumesIter : volumes) cVolumesIter->compactify(cSurfaces,tSurfaces); } // confined unordered volumes const std::vector<const Trk::TrackingVolume* >* confDenseVolumes = confinedDenseVolumes(); if (confDenseVolumes) - for (auto& cVolumesIter : (*confDenseVolumes) ) cVolumesIter->compactify(cSurfaces,tSurfaces); + for (const auto & cVolumesIter : (*confDenseVolumes) ) cVolumesIter->compactify(cSurfaces,tSurfaces); // detached volumes if any if (m_confinedDetachedVolumes) - for (auto& cdVolumesIter : (*m_confinedDetachedVolumes) ) cdVolumesIter->compactify(cSurfaces,tSurfaces); + for (const auto & cdVolumesIter : (*m_confinedDetachedVolumes) ) cdVolumesIter->compactify(cSurfaces,tSurfaces); } void Trk::TrackingVolume::screenDump(MsgStream& msg) const diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/BevelledCylinderVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/BevelledCylinderVolumeBounds.cxx index 29dd0cfa2f711c239fea61bd8574a956d905a4fb..30844d1507599cece8ae78234707a69d4e6bbee4 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/BevelledCylinderVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/BevelledCylinderVolumeBounds.cxx @@ -25,8 +25,8 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" //STD +#include <cmath> #include <iostream> -#include <math.h> const double Trk::BevelledCylinderVolumeBounds::s_numericalStable = 10e-2 * Gaudi::Units::millimeter; diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/CuboidVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/CuboidVolumeBounds.cxx index 0717995df2199f3f9c5a08d1032835506308b17a..0fbc55d4b902d368d8488fc09e1cf007705b691f 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/CuboidVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/CuboidVolumeBounds.cxx @@ -2,137 +2,137 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// CuboidVolumeBounds.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -//Trk -#include "TrkVolumes/CuboidVolumeBounds.h" -//TrkSurfaces -#include "TrkSurfaces/Surface.h" -#include "TrkSurfaces/PlaneSurface.h" -#include "TrkSurfaces/RectangleBounds.h" -//Gaudi -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/SystemOfUnits.h" -//STD -#include <iostream> -#include <math.h> - -Trk::CuboidVolumeBounds::CuboidVolumeBounds() : - VolumeBounds(), - m_halfX(0.), - m_halfY(0.), - m_halfZ(0.), - m_objectAccessor() -{} - -Trk::CuboidVolumeBounds::CuboidVolumeBounds(double halex, double haley, double halez) : - VolumeBounds(), - m_halfX(halex), - m_halfY(haley), - m_halfZ(halez), - m_objectAccessor() -{} - -Trk::CuboidVolumeBounds::CuboidVolumeBounds(const Trk::CuboidVolumeBounds& bobo) : - VolumeBounds(), - m_halfX(bobo.m_halfX), - m_halfY(bobo.m_halfY), - m_halfZ(bobo.m_halfZ), - m_objectAccessor(bobo.m_objectAccessor) -{} - -Trk::CuboidVolumeBounds::~CuboidVolumeBounds() -{} - -Trk::CuboidVolumeBounds& Trk::CuboidVolumeBounds::operator=(const Trk::CuboidVolumeBounds& bobo) -{ - if (this!=&bobo){ - m_halfX = bobo.m_halfX; - m_halfY = bobo.m_halfY; - m_halfZ = bobo.m_halfZ; - m_objectAccessor = bobo.m_objectAccessor; - } - return *this; -} - -const std::vector<const Trk::Surface*>* Trk::CuboidVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const -{ - - std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; - // memory optimisation - retsf->reserve(6); - // face surfaces xy - // (1) - at negative local z - retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform * Amg::AngleAxis3D(180.*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.)) - *Amg::Translation3D(Amg::Vector3D(0.,0.,this->halflengthZ())) ), - this->faceXYRectangleBounds() ) ); - // (2) - at positive local z - retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform*Amg::Translation3D(Amg::Vector3D(0.,0.,this->halflengthZ()))), - this->faceXYRectangleBounds() ) ); - // face surfaces yz - // transmute cyclical - // (3) - at negative local x - retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform * Amg::AngleAxis3D(180.*Gaudi::Units::deg, Amg::Vector3D(0.,0.,1.)) - *Amg::Translation3D(Amg::Vector3D(this->halflengthX(), 0.,0)) - *Amg::AngleAxis3D(90.*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0))*Amg::AngleAxis3D(90.*Gaudi::Units::deg, Amg::Vector3D(0.,0.,1.)) ), - this->faceYZRectangleBounds())); - // (4) - at positive local x - retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform*Amg::Translation3D(Amg::Vector3D(this->halflengthX(),0.,0.)) - *Amg::AngleAxis3D(90.*Gaudi::Units::deg,Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(90.*Gaudi::Units::deg, Amg::Vector3D(0.,0.,1.)) ), - this->faceYZRectangleBounds())); - // face surfaces zx - // (5) - at negative local y - retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform * Amg::AngleAxis3D(180.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) - *Amg::Translation3D(Amg::Vector3D(0.,this->halflengthY(),0.)) - *Amg::AngleAxis3D(-90*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(-90.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) ), - this->faceZXRectangleBounds())); - // (6) - at positive local y - retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform*Amg::Translation3D(Amg::Vector3D(0.,this->halflengthY(),0.)) - *Amg::AngleAxis3D(-90*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(-90.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) ), - this->faceZXRectangleBounds())); - - return retsf; - -} - -Trk::RectangleBounds* Trk::CuboidVolumeBounds::faceXYRectangleBounds() const -{ return new Trk::RectangleBounds(m_halfX, m_halfY); } - -Trk::RectangleBounds* Trk::CuboidVolumeBounds::faceYZRectangleBounds() const -{ return new Trk::RectangleBounds(m_halfY, m_halfZ); } - -Trk::RectangleBounds* Trk::CuboidVolumeBounds::faceZXRectangleBounds() const -{ return new Trk::RectangleBounds(m_halfZ, m_halfX); } - -// ostream operator overload - -MsgStream& Trk::CuboidVolumeBounds::dump( MsgStream& sl ) const -{ - - std::stringstream temp_sl; - temp_sl << std::setiosflags(std::ios::fixed); - temp_sl << std::setprecision(7); - temp_sl << "Trk::CuboidVolumeBounds: (halfX, halfY, halfZ) = "; - temp_sl << "(" << m_halfX << ", " << m_halfY << ", " << m_halfZ << ")"; - sl << temp_sl.str(); - return sl; -} - -std::ostream& Trk::CuboidVolumeBounds::dump( std::ostream& sl ) const -{ - std::stringstream temp_sl; - temp_sl << std::setiosflags(std::ios::fixed); - temp_sl << std::setprecision(7); - temp_sl << "Trk::CuboidVolumeBounds: (halfX, halfY, halfZ) = "; - temp_sl << "(" << m_halfX << ", " << m_halfY << ", " << m_halfZ << ")"; - sl << temp_sl.str(); - return sl; -} - - - - - - +/////////////////////////////////////////////////////////////////// +// CuboidVolumeBounds.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +//Trk +#include "TrkVolumes/CuboidVolumeBounds.h" +//TrkSurfaces +#include "TrkSurfaces/Surface.h" +#include "TrkSurfaces/PlaneSurface.h" +#include "TrkSurfaces/RectangleBounds.h" +//Gaudi +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/SystemOfUnits.h" +//STD +#include <cmath> +#include <iostream> + +Trk::CuboidVolumeBounds::CuboidVolumeBounds() : + VolumeBounds(), + m_halfX(0.), + m_halfY(0.), + m_halfZ(0.), + m_objectAccessor() +{} + +Trk::CuboidVolumeBounds::CuboidVolumeBounds(double halex, double haley, double halez) : + VolumeBounds(), + m_halfX(halex), + m_halfY(haley), + m_halfZ(halez), + m_objectAccessor() +{} + +Trk::CuboidVolumeBounds::CuboidVolumeBounds(const Trk::CuboidVolumeBounds& bobo) : + VolumeBounds(), + m_halfX(bobo.m_halfX), + m_halfY(bobo.m_halfY), + m_halfZ(bobo.m_halfZ), + m_objectAccessor(bobo.m_objectAccessor) +{} + +Trk::CuboidVolumeBounds::~CuboidVolumeBounds() +{} + +Trk::CuboidVolumeBounds& Trk::CuboidVolumeBounds::operator=(const Trk::CuboidVolumeBounds& bobo) +{ + if (this!=&bobo){ + m_halfX = bobo.m_halfX; + m_halfY = bobo.m_halfY; + m_halfZ = bobo.m_halfZ; + m_objectAccessor = bobo.m_objectAccessor; + } + return *this; +} + +const std::vector<const Trk::Surface*>* Trk::CuboidVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const +{ + + std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; + // memory optimisation + retsf->reserve(6); + // face surfaces xy + // (1) - at negative local z + retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform * Amg::AngleAxis3D(180.*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.)) + *Amg::Translation3D(Amg::Vector3D(0.,0.,this->halflengthZ())) ), + this->faceXYRectangleBounds() ) ); + // (2) - at positive local z + retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform*Amg::Translation3D(Amg::Vector3D(0.,0.,this->halflengthZ()))), + this->faceXYRectangleBounds() ) ); + // face surfaces yz + // transmute cyclical + // (3) - at negative local x + retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform * Amg::AngleAxis3D(180.*Gaudi::Units::deg, Amg::Vector3D(0.,0.,1.)) + *Amg::Translation3D(Amg::Vector3D(this->halflengthX(), 0.,0)) + *Amg::AngleAxis3D(90.*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0))*Amg::AngleAxis3D(90.*Gaudi::Units::deg, Amg::Vector3D(0.,0.,1.)) ), + this->faceYZRectangleBounds())); + // (4) - at positive local x + retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform*Amg::Translation3D(Amg::Vector3D(this->halflengthX(),0.,0.)) + *Amg::AngleAxis3D(90.*Gaudi::Units::deg,Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(90.*Gaudi::Units::deg, Amg::Vector3D(0.,0.,1.)) ), + this->faceYZRectangleBounds())); + // face surfaces zx + // (5) - at negative local y + retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform * Amg::AngleAxis3D(180.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) + *Amg::Translation3D(Amg::Vector3D(0.,this->halflengthY(),0.)) + *Amg::AngleAxis3D(-90*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(-90.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) ), + this->faceZXRectangleBounds())); + // (6) - at positive local y + retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform*Amg::Translation3D(Amg::Vector3D(0.,this->halflengthY(),0.)) + *Amg::AngleAxis3D(-90*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(-90.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) ), + this->faceZXRectangleBounds())); + + return retsf; + +} + +Trk::RectangleBounds* Trk::CuboidVolumeBounds::faceXYRectangleBounds() const +{ return new Trk::RectangleBounds(m_halfX, m_halfY); } + +Trk::RectangleBounds* Trk::CuboidVolumeBounds::faceYZRectangleBounds() const +{ return new Trk::RectangleBounds(m_halfY, m_halfZ); } + +Trk::RectangleBounds* Trk::CuboidVolumeBounds::faceZXRectangleBounds() const +{ return new Trk::RectangleBounds(m_halfZ, m_halfX); } + +// ostream operator overload + +MsgStream& Trk::CuboidVolumeBounds::dump( MsgStream& sl ) const +{ + + std::stringstream temp_sl; + temp_sl << std::setiosflags(std::ios::fixed); + temp_sl << std::setprecision(7); + temp_sl << "Trk::CuboidVolumeBounds: (halfX, halfY, halfZ) = "; + temp_sl << "(" << m_halfX << ", " << m_halfY << ", " << m_halfZ << ")"; + sl << temp_sl.str(); + return sl; +} + +std::ostream& Trk::CuboidVolumeBounds::dump( std::ostream& sl ) const +{ + std::stringstream temp_sl; + temp_sl << std::setiosflags(std::ios::fixed); + temp_sl << std::setprecision(7); + temp_sl << "Trk::CuboidVolumeBounds: (halfX, halfY, halfZ) = "; + temp_sl << "(" << m_halfX << ", " << m_halfY << ", " << m_halfZ << ")"; + sl << temp_sl.str(); + return sl; +} + + + + + + diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/CylinderVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/CylinderVolumeBounds.cxx index 6200f44cd7589f5797f2a2c8b0b7e1e36612d38e..d65c9a6694ac8349cd6d9d2a5c81d089d4600f39 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/CylinderVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/CylinderVolumeBounds.cxx @@ -21,8 +21,8 @@ #include "GaudiKernel/SystemOfUnits.h" //STD +#include <cmath> #include <iostream> -#include <math.h> const double Trk::CylinderVolumeBounds::s_numericalStable = 10e-2 * Gaudi::Units::mm; diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/DoubleTrapezoidVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/DoubleTrapezoidVolumeBounds.cxx index 575b38d5dc415427f104360b0648b9423bcb1cb3..0b8601d52d37bd3b35ecc57b51f07c6cdfc32ca9 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/DoubleTrapezoidVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/DoubleTrapezoidVolumeBounds.cxx @@ -16,9 +16,9 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" //STD -#include <iostream> +#include <cmath> #include <iomanip> -#include <math.h> +#include <iostream> Trk::DoubleTrapezoidVolumeBounds::DoubleTrapezoidVolumeBounds() : VolumeBounds(), diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/PrismVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/PrismVolumeBounds.cxx index eaab739e292098d24186be470f6f02a0c0d40dcb..a7356ee82c4ccce8cfc458bb2eca59305c8c659b 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/PrismVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/PrismVolumeBounds.cxx @@ -17,9 +17,9 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" //STD -#include <iostream> +#include <cmath> #include <iomanip> -#include <math.h> +#include <iostream> Trk::PrismVolumeBounds::PrismVolumeBounds() : VolumeBounds(), diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/SimplePolygonBrepVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/SimplePolygonBrepVolumeBounds.cxx index 021f41e512bb288c2b58d174c0596a09f25b04df..2dc659476c7e14b9cbc8b9693698f3aae06d2135 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/SimplePolygonBrepVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/SimplePolygonBrepVolumeBounds.cxx @@ -21,9 +21,9 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" //STD -#include <iostream> +#include <cmath> #include <iomanip> -#include <math.h> +#include <iostream> Trk::SimplePolygonBrepVolumeBounds::SimplePolygonBrepVolumeBounds() : VolumeBounds(), diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/SubtractedVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/SubtractedVolumeBounds.cxx index d9cd15ee0bf1730a3e9c3a0fa287aca72ef4eee5..89395bb8ff9e2ba92861fc5e259d42cd1f27d925 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/SubtractedVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/SubtractedVolumeBounds.cxx @@ -2,268 +2,268 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// SubtractedVolumeBounds.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -//Trk -#include "TrkVolumes/SubtractedVolumeBounds.h" -#include "TrkVolumes/CombinedVolumeBounds.h" -#include "TrkVolumes/VolumeExcluder.h" -#include "TrkVolumes/SimplePolygonBrepVolumeBounds.h" -//TrkSurfaces -#include "TrkSurfaces/Surface.h" -#include "TrkSurfaces/PlaneSurface.h" -#include "TrkSurfaces/CylinderSurface.h" -#include "TrkSurfaces/DiscSurface.h" -#include "TrkSurfaces/DiscBounds.h" -#include "TrkSurfaces/EllipseBounds.h" -#include "TrkGeometrySurfaces/SubtractedPlaneSurface.h" -#include "TrkGeometrySurfaces/SubtractedCylinderSurface.h" -#include "TrkSurfaces/RectangleBounds.h" -#include "TrkVolumes/Volume.h" -#include "TrkVolumes/CylinderVolumeBounds.h" -//Gaudi -#include "GaudiKernel/MsgStream.h" -//STD -#include <iostream> -#include <math.h> - -Trk::SubtractedVolumeBounds::SubtractedVolumeBounds() : - VolumeBounds(), - m_outer(nullptr), - m_inner(nullptr), - m_objectAccessor(), - m_boundsOrientation() -{} - -Trk::SubtractedVolumeBounds::SubtractedVolumeBounds(Volume* vol1,Volume* vol2) : - VolumeBounds(), - m_outer(vol1), - m_inner(vol2), - m_objectAccessor(), - m_boundsOrientation() -{} - -Trk::SubtractedVolumeBounds::SubtractedVolumeBounds(const Trk::SubtractedVolumeBounds& bobo) : - VolumeBounds(), - m_outer(bobo.m_outer), - m_inner(bobo.m_inner), - m_objectAccessor(bobo.m_objectAccessor), - m_boundsOrientation() -{ - m_boundsOrientation.resize(bobo.m_boundsOrientation.size()); - for (unsigned int i=0;i<bobo.m_boundsOrientation.size();i++) m_boundsOrientation[i]=bobo.m_boundsOrientation[i]; -} - -Trk::SubtractedVolumeBounds::~SubtractedVolumeBounds() -{ - m_boundsOrientation.clear(); - delete m_outer; - delete m_inner; -} - -Trk::SubtractedVolumeBounds& Trk::SubtractedVolumeBounds::operator=(const Trk::SubtractedVolumeBounds& bobo) -{ - if (this!=&bobo){ - m_outer = bobo.m_outer; - m_inner = bobo.m_inner; - m_objectAccessor = bobo.m_objectAccessor; - m_boundsOrientation = bobo.m_boundsOrientation; - m_boundsOrientation.resize(bobo.m_boundsOrientation.size()); - for (unsigned int i=0;i<bobo.m_boundsOrientation.size();i++) m_boundsOrientation[i]=bobo.m_boundsOrientation[i]; - } - return *this; -} - -const std::vector<const Trk::Surface*>* Trk::SubtractedVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transf) const -{ - //double tol=0.001; - // get surfaces for outer boundaries - const std::vector<const Trk::Surface*>* outerSurfaces = m_outer->volumeBounds().decomposeToSurfaces(transf*m_outer->transform()); - // get surfaces for inner boundaries - const std::vector<const Trk::Surface*>* innerSurfaces = m_inner->volumeBounds().decomposeToSurfaces(transf*m_inner->transform()); - std::vector<unsigned int> subtrInner; - std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; - - unsigned int nSurf = outerSurfaces->size() + innerSurfaces->size(); - m_boundsOrientation.resize(nSurf); - - const Trk::CylinderVolumeBounds* cylVol = dynamic_cast<const Trk::CylinderVolumeBounds*> (&(m_outer->volumeBounds())); - const Trk::SimplePolygonBrepVolumeBounds* spbVol = dynamic_cast<const Trk::SimplePolygonBrepVolumeBounds*> (&(m_outer->volumeBounds())); - const Trk::CombinedVolumeBounds* comVol = dynamic_cast<const Trk::CombinedVolumeBounds*> (&(m_outer->volumeBounds())); - const Trk::SubtractedVolumeBounds* subVol = dynamic_cast<const Trk::SubtractedVolumeBounds*> (&(m_outer->volumeBounds())); - - // loop over 'outer' boundary surfaces; modified by subtracted volume - for (unsigned int out=0; out < outerSurfaces->size(); out++) { - const SubtractedPlaneSurface* splo = dynamic_cast<const SubtractedPlaneSurface*> ((*outerSurfaces)[out]); - const PlaneSurface* plo = dynamic_cast<const PlaneSurface*> ((*outerSurfaces)[out]); - const SubtractedCylinderSurface* sclo = dynamic_cast<const SubtractedCylinderSurface*> ((*outerSurfaces)[out]); - const CylinderSurface* clo = dynamic_cast<const CylinderSurface*> ((*outerSurfaces)[out]); - const DiscSurface* dlo = dynamic_cast<const DiscSurface*> ((*outerSurfaces)[out]); - if (!(splo || plo || sclo || clo || dlo )) { - throw std::runtime_error("Unhandled surface."); - } - // resolve bounds orientation : copy from combined/subtracted, swap inner cyl, swap bottom spb - if (comVol) m_boundsOrientation[out]=comVol->boundsOrientation()[out]; - else if (subVol) m_boundsOrientation[out]=subVol->boundsOrientation()[out]; - else if (cylVol && clo && out==3 ) m_boundsOrientation[out]= false; - else if (spbVol && out==0 ) m_boundsOrientation[out]= false; - else m_boundsOrientation[out] = true; - // - Trk::Volume* innerSub = createSubtractedVolume((*outerSurfaces)[out]->transform().inverse()*transf,m_inner) ; - - if ( splo || sclo ) { // multiple subtraction - SharedObject<Trk::AreaExcluder> vEx; - bool shared = false; - if (splo) { - vEx = splo->subtractedVolume(); - shared = splo->shared(); - } - if (sclo) { - vEx = sclo->subtractedVolume(); - shared = sclo->shared(); - } - const Trk::VolumeExcluder* volExcl = dynamic_cast<const Trk::VolumeExcluder*> (vEx.get()); - if (!volExcl) throw std::logic_error("Not a VolumeExcluder"); - Trk::Volume* outerSub = new Trk::Volume(*volExcl->volume()); - - Trk::Volume* comb_sub = nullptr; - if (!shared) comb_sub = new Trk::Volume(nullptr,new Trk::CombinedVolumeBounds(innerSub,outerSub,false)); - else comb_sub = new Trk::Volume(nullptr,new Trk::SubtractedVolumeBounds(outerSub,innerSub)); - Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(comb_sub); - if (splo) retsf->push_back(new Trk::SubtractedPlaneSurface(*splo,volEx,shared)); - if (sclo) retsf->push_back(new Trk::SubtractedCylinderSurface(*sclo,volEx,shared)); - } else { - Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(innerSub); - if (plo) retsf->push_back(new Trk::SubtractedPlaneSurface(*plo,volEx,false)); - if (clo) retsf->push_back(new Trk::SubtractedCylinderSurface(*clo,volEx,false)); - if (dlo) { - // turn disc into ellipse for simplification - const DiscBounds* db = dynamic_cast<const DiscBounds*> (&(dlo->bounds())); - if (!db) throw std::logic_error("Not DiscBounds"); - EllipseBounds* eb = new EllipseBounds(db->rMin(),db->rMin(),db->rMax(),db->rMax(),db->halfPhiSector()); - plo = new PlaneSurface(new Amg::Transform3D(dlo->transform()),eb); - retsf->push_back(new Trk::SubtractedPlaneSurface(*plo,volEx,false)); - delete plo; - } - } - } - - // loop over 'inner' boundary surfaces; include only if represent a new surface - // change: include allways otherwise orientation messed up - // bonus : solves 'double boundary' problem - - cylVol = dynamic_cast<const Trk::CylinderVolumeBounds*> (&(m_inner->volumeBounds())); - spbVol = dynamic_cast<const Trk::SimplePolygonBrepVolumeBounds*> (&(m_inner->volumeBounds())); - comVol = dynamic_cast<const Trk::CombinedVolumeBounds*> (&(m_inner->volumeBounds())); - subVol = dynamic_cast<const Trk::SubtractedVolumeBounds*> (&(m_inner->volumeBounds())); - unsigned int nOut = outerSurfaces->size(); - - for (unsigned int in=0; in< innerSurfaces->size(); in++) { - const SubtractedPlaneSurface* spli = dynamic_cast<const SubtractedPlaneSurface*> ((*innerSurfaces)[in]); - const PlaneSurface* pli = dynamic_cast<const PlaneSurface*> ((*innerSurfaces)[in]); - const SubtractedCylinderSurface* scli = dynamic_cast<const SubtractedCylinderSurface*> ((*innerSurfaces)[in]); - const CylinderSurface* cli = dynamic_cast<const CylinderSurface*> ((*innerSurfaces)[in]); - const DiscSurface* dli = dynamic_cast<const DiscSurface*> ((*innerSurfaces)[in]); - // resolve bounds orientation : copy from combined/subtracted, swap inner cyl, swap bottom spb, swap all - if (comVol) m_boundsOrientation[nOut+in]=!comVol->boundsOrientation()[in]; - else if (subVol) m_boundsOrientation[nOut+in]=!subVol->boundsOrientation()[in]; - else if (cylVol && cli && in==3 ) m_boundsOrientation[nOut+in]= true; - else if (spbVol && in==0 ) m_boundsOrientation[nOut+in]= true; - else m_boundsOrientation[nOut+in]= false; - // - Trk::Volume* outerSub = createSubtractedVolume((*innerSurfaces)[in]->transform().inverse()*transf, m_outer); - - if ( spli || scli ) { - bool shared = false; - SharedObject<Trk::AreaExcluder> vEx; - if (spli) { - vEx = spli->subtractedVolume(); - shared = spli->shared(); - } - if (scli) { - vEx = scli->subtractedVolume(); - shared = scli->shared(); - } - const Trk::VolumeExcluder* volExcl = dynamic_cast<const Trk::VolumeExcluder*> (vEx.get()); - if (!volExcl) throw std::logic_error("Not a VolumeExcluder"); - Trk::Volume* innerSub = new Trk::Volume(*volExcl->volume()); - - // combined volume - Trk::Volume* comb_sub=nullptr; - if (!shared) comb_sub = new Trk::Volume(nullptr,new Trk::SubtractedVolumeBounds(outerSub,innerSub)); - else comb_sub = new Trk::Volume(nullptr,new Trk::CombinedVolumeBounds(innerSub,outerSub,true)); - Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(comb_sub); - if (spli) retsf->push_back(new Trk::SubtractedPlaneSurface(*spli,volEx,true)); - if (scli) retsf->push_back(new Trk::SubtractedCylinderSurface(*scli,volEx,true)); - - } - else if (pli || cli){ - Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(outerSub); - if (pli) retsf->push_back(new Trk::SubtractedPlaneSurface(*pli,volEx,true)); - if (cli) retsf->push_back(new Trk::SubtractedCylinderSurface(*cli,volEx,true)); - } - else if (dli) { - // turn disc into ellipse for simplification - const DiscBounds* db = dynamic_cast<const DiscBounds*> (&(dli->bounds())); - if (!db) throw std::logic_error("Not DiscBounds"); - EllipseBounds* eb = new EllipseBounds(db->rMin(),db->rMin(),db->rMax(),db->rMax(),db->halfPhiSector()); - PlaneSurface pla(new Amg::Transform3D(dli->transform()),eb); - Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(outerSub); - retsf->push_back(new Trk::SubtractedPlaneSurface(pla,volEx,true)); - } else { - throw std::runtime_error("Unhandled surface in Trk::SubtractedVolumeBounds::decomposeToSurfaces." ); - } - } - - for (size_t i=0; i < outerSurfaces->size(); i++) - delete (*outerSurfaces)[i]; - for (size_t i=0; i < innerSurfaces->size(); i++) - delete (*innerSurfaces)[i]; - delete outerSurfaces; - delete innerSurfaces; - - return retsf; -} - -// ostream operator overload - -MsgStream& Trk::SubtractedVolumeBounds::dump( MsgStream& sl ) const -{ - std::stringstream temp_sl; - temp_sl << std::setiosflags(std::ios::fixed); - temp_sl << std::setprecision(7); - temp_sl << "Trk::SubtractedVolumeBounds: outer,inner "; - sl << temp_sl.str(); - m_outer->volumeBounds().dump(sl); - m_inner->volumeBounds().dump(sl); - return sl; -} - -std::ostream& Trk::SubtractedVolumeBounds::dump( std::ostream& sl ) const -{ - std::stringstream temp_sl; - temp_sl << std::setiosflags(std::ios::fixed); - temp_sl << std::setprecision(7); - temp_sl << "Trk::SubtractedVolumeBounds: outer,inner "; - sl << temp_sl.str(); - m_outer->volumeBounds().dump(sl); - m_inner->volumeBounds().dump(sl); - return sl; -} - -Trk::Volume* Trk::SubtractedVolumeBounds::createSubtractedVolume(const Amg::Transform3D& transf, Trk::Volume* subtrVol) const -{ - Trk::Volume* subVol = nullptr; - if (!subtrVol) return subVol; - - subVol = new Trk::Volume( *subtrVol, transf ); - - return subVol; -} - - - - - +/////////////////////////////////////////////////////////////////// +// SubtractedVolumeBounds.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +//Trk +#include "TrkVolumes/SubtractedVolumeBounds.h" +#include "TrkVolumes/CombinedVolumeBounds.h" +#include "TrkVolumes/VolumeExcluder.h" +#include "TrkVolumes/SimplePolygonBrepVolumeBounds.h" +//TrkSurfaces +#include "TrkSurfaces/Surface.h" +#include "TrkSurfaces/PlaneSurface.h" +#include "TrkSurfaces/CylinderSurface.h" +#include "TrkSurfaces/DiscSurface.h" +#include "TrkSurfaces/DiscBounds.h" +#include "TrkSurfaces/EllipseBounds.h" +#include "TrkGeometrySurfaces/SubtractedPlaneSurface.h" +#include "TrkGeometrySurfaces/SubtractedCylinderSurface.h" +#include "TrkSurfaces/RectangleBounds.h" +#include "TrkVolumes/Volume.h" +#include "TrkVolumes/CylinderVolumeBounds.h" +//Gaudi +#include "GaudiKernel/MsgStream.h" +//STD +#include <cmath> +#include <iostream> + +Trk::SubtractedVolumeBounds::SubtractedVolumeBounds() : + VolumeBounds(), + m_outer(nullptr), + m_inner(nullptr), + m_objectAccessor(), + m_boundsOrientation() +{} + +Trk::SubtractedVolumeBounds::SubtractedVolumeBounds(Volume* vol1,Volume* vol2) : + VolumeBounds(), + m_outer(vol1), + m_inner(vol2), + m_objectAccessor(), + m_boundsOrientation() +{} + +Trk::SubtractedVolumeBounds::SubtractedVolumeBounds(const Trk::SubtractedVolumeBounds& bobo) : + VolumeBounds(), + m_outer(bobo.m_outer), + m_inner(bobo.m_inner), + m_objectAccessor(bobo.m_objectAccessor), + m_boundsOrientation() +{ + m_boundsOrientation.resize(bobo.m_boundsOrientation.size()); + for (unsigned int i=0;i<bobo.m_boundsOrientation.size();i++) m_boundsOrientation[i]=bobo.m_boundsOrientation[i]; +} + +Trk::SubtractedVolumeBounds::~SubtractedVolumeBounds() +{ + m_boundsOrientation.clear(); + delete m_outer; + delete m_inner; +} + +Trk::SubtractedVolumeBounds& Trk::SubtractedVolumeBounds::operator=(const Trk::SubtractedVolumeBounds& bobo) +{ + if (this!=&bobo){ + m_outer = bobo.m_outer; + m_inner = bobo.m_inner; + m_objectAccessor = bobo.m_objectAccessor; + m_boundsOrientation = bobo.m_boundsOrientation; + m_boundsOrientation.resize(bobo.m_boundsOrientation.size()); + for (unsigned int i=0;i<bobo.m_boundsOrientation.size();i++) m_boundsOrientation[i]=bobo.m_boundsOrientation[i]; + } + return *this; +} + +const std::vector<const Trk::Surface*>* Trk::SubtractedVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transf) const +{ + //double tol=0.001; + // get surfaces for outer boundaries + const std::vector<const Trk::Surface*>* outerSurfaces = m_outer->volumeBounds().decomposeToSurfaces(transf*m_outer->transform()); + // get surfaces for inner boundaries + const std::vector<const Trk::Surface*>* innerSurfaces = m_inner->volumeBounds().decomposeToSurfaces(transf*m_inner->transform()); + std::vector<unsigned int> subtrInner; + std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; + + unsigned int nSurf = outerSurfaces->size() + innerSurfaces->size(); + m_boundsOrientation.resize(nSurf); + + const Trk::CylinderVolumeBounds* cylVol = dynamic_cast<const Trk::CylinderVolumeBounds*> (&(m_outer->volumeBounds())); + const Trk::SimplePolygonBrepVolumeBounds* spbVol = dynamic_cast<const Trk::SimplePolygonBrepVolumeBounds*> (&(m_outer->volumeBounds())); + const Trk::CombinedVolumeBounds* comVol = dynamic_cast<const Trk::CombinedVolumeBounds*> (&(m_outer->volumeBounds())); + const Trk::SubtractedVolumeBounds* subVol = dynamic_cast<const Trk::SubtractedVolumeBounds*> (&(m_outer->volumeBounds())); + + // loop over 'outer' boundary surfaces; modified by subtracted volume + for (unsigned int out=0; out < outerSurfaces->size(); out++) { + const SubtractedPlaneSurface* splo = dynamic_cast<const SubtractedPlaneSurface*> ((*outerSurfaces)[out]); + const PlaneSurface* plo = dynamic_cast<const PlaneSurface*> ((*outerSurfaces)[out]); + const SubtractedCylinderSurface* sclo = dynamic_cast<const SubtractedCylinderSurface*> ((*outerSurfaces)[out]); + const CylinderSurface* clo = dynamic_cast<const CylinderSurface*> ((*outerSurfaces)[out]); + const DiscSurface* dlo = dynamic_cast<const DiscSurface*> ((*outerSurfaces)[out]); + if (!(splo || plo || sclo || clo || dlo )) { + throw std::runtime_error("Unhandled surface."); + } + // resolve bounds orientation : copy from combined/subtracted, swap inner cyl, swap bottom spb + if (comVol) m_boundsOrientation[out]=comVol->boundsOrientation()[out]; + else if (subVol) m_boundsOrientation[out]=subVol->boundsOrientation()[out]; + else if (cylVol && clo && out==3 ) m_boundsOrientation[out]= false; + else if (spbVol && out==0 ) m_boundsOrientation[out]= false; + else m_boundsOrientation[out] = true; + // + Trk::Volume* innerSub = createSubtractedVolume((*outerSurfaces)[out]->transform().inverse()*transf,m_inner) ; + + if ( splo || sclo ) { // multiple subtraction + SharedObject<Trk::AreaExcluder> vEx; + bool shared = false; + if (splo) { + vEx = splo->subtractedVolume(); + shared = splo->shared(); + } + if (sclo) { + vEx = sclo->subtractedVolume(); + shared = sclo->shared(); + } + const Trk::VolumeExcluder* volExcl = dynamic_cast<const Trk::VolumeExcluder*> (vEx.get()); + if (!volExcl) throw std::logic_error("Not a VolumeExcluder"); + Trk::Volume* outerSub = new Trk::Volume(*volExcl->volume()); + + Trk::Volume* comb_sub = nullptr; + if (!shared) comb_sub = new Trk::Volume(nullptr,new Trk::CombinedVolumeBounds(innerSub,outerSub,false)); + else comb_sub = new Trk::Volume(nullptr,new Trk::SubtractedVolumeBounds(outerSub,innerSub)); + Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(comb_sub); + if (splo) retsf->push_back(new Trk::SubtractedPlaneSurface(*splo,volEx,shared)); + if (sclo) retsf->push_back(new Trk::SubtractedCylinderSurface(*sclo,volEx,shared)); + } else { + Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(innerSub); + if (plo) retsf->push_back(new Trk::SubtractedPlaneSurface(*plo,volEx,false)); + if (clo) retsf->push_back(new Trk::SubtractedCylinderSurface(*clo,volEx,false)); + if (dlo) { + // turn disc into ellipse for simplification + const DiscBounds* db = dynamic_cast<const DiscBounds*> (&(dlo->bounds())); + if (!db) throw std::logic_error("Not DiscBounds"); + EllipseBounds* eb = new EllipseBounds(db->rMin(),db->rMin(),db->rMax(),db->rMax(),db->halfPhiSector()); + plo = new PlaneSurface(new Amg::Transform3D(dlo->transform()),eb); + retsf->push_back(new Trk::SubtractedPlaneSurface(*plo,volEx,false)); + delete plo; + } + } + } + + // loop over 'inner' boundary surfaces; include only if represent a new surface + // change: include allways otherwise orientation messed up + // bonus : solves 'double boundary' problem + + cylVol = dynamic_cast<const Trk::CylinderVolumeBounds*> (&(m_inner->volumeBounds())); + spbVol = dynamic_cast<const Trk::SimplePolygonBrepVolumeBounds*> (&(m_inner->volumeBounds())); + comVol = dynamic_cast<const Trk::CombinedVolumeBounds*> (&(m_inner->volumeBounds())); + subVol = dynamic_cast<const Trk::SubtractedVolumeBounds*> (&(m_inner->volumeBounds())); + unsigned int nOut = outerSurfaces->size(); + + for (unsigned int in=0; in< innerSurfaces->size(); in++) { + const SubtractedPlaneSurface* spli = dynamic_cast<const SubtractedPlaneSurface*> ((*innerSurfaces)[in]); + const PlaneSurface* pli = dynamic_cast<const PlaneSurface*> ((*innerSurfaces)[in]); + const SubtractedCylinderSurface* scli = dynamic_cast<const SubtractedCylinderSurface*> ((*innerSurfaces)[in]); + const CylinderSurface* cli = dynamic_cast<const CylinderSurface*> ((*innerSurfaces)[in]); + const DiscSurface* dli = dynamic_cast<const DiscSurface*> ((*innerSurfaces)[in]); + // resolve bounds orientation : copy from combined/subtracted, swap inner cyl, swap bottom spb, swap all + if (comVol) m_boundsOrientation[nOut+in]=!comVol->boundsOrientation()[in]; + else if (subVol) m_boundsOrientation[nOut+in]=!subVol->boundsOrientation()[in]; + else if (cylVol && cli && in==3 ) m_boundsOrientation[nOut+in]= true; + else if (spbVol && in==0 ) m_boundsOrientation[nOut+in]= true; + else m_boundsOrientation[nOut+in]= false; + // + Trk::Volume* outerSub = createSubtractedVolume((*innerSurfaces)[in]->transform().inverse()*transf, m_outer); + + if ( spli || scli ) { + bool shared = false; + SharedObject<Trk::AreaExcluder> vEx; + if (spli) { + vEx = spli->subtractedVolume(); + shared = spli->shared(); + } + if (scli) { + vEx = scli->subtractedVolume(); + shared = scli->shared(); + } + const Trk::VolumeExcluder* volExcl = dynamic_cast<const Trk::VolumeExcluder*> (vEx.get()); + if (!volExcl) throw std::logic_error("Not a VolumeExcluder"); + Trk::Volume* innerSub = new Trk::Volume(*volExcl->volume()); + + // combined volume + Trk::Volume* comb_sub=nullptr; + if (!shared) comb_sub = new Trk::Volume(nullptr,new Trk::SubtractedVolumeBounds(outerSub,innerSub)); + else comb_sub = new Trk::Volume(nullptr,new Trk::CombinedVolumeBounds(innerSub,outerSub,true)); + Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(comb_sub); + if (spli) retsf->push_back(new Trk::SubtractedPlaneSurface(*spli,volEx,true)); + if (scli) retsf->push_back(new Trk::SubtractedCylinderSurface(*scli,volEx,true)); + + } + else if (pli || cli){ + Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(outerSub); + if (pli) retsf->push_back(new Trk::SubtractedPlaneSurface(*pli,volEx,true)); + if (cli) retsf->push_back(new Trk::SubtractedCylinderSurface(*cli,volEx,true)); + } + else if (dli) { + // turn disc into ellipse for simplification + const DiscBounds* db = dynamic_cast<const DiscBounds*> (&(dli->bounds())); + if (!db) throw std::logic_error("Not DiscBounds"); + EllipseBounds* eb = new EllipseBounds(db->rMin(),db->rMin(),db->rMax(),db->rMax(),db->halfPhiSector()); + PlaneSurface pla(new Amg::Transform3D(dli->transform()),eb); + Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(outerSub); + retsf->push_back(new Trk::SubtractedPlaneSurface(pla,volEx,true)); + } else { + throw std::runtime_error("Unhandled surface in Trk::SubtractedVolumeBounds::decomposeToSurfaces." ); + } + } + + for (size_t i=0; i < outerSurfaces->size(); i++) + delete (*outerSurfaces)[i]; + for (size_t i=0; i < innerSurfaces->size(); i++) + delete (*innerSurfaces)[i]; + delete outerSurfaces; + delete innerSurfaces; + + return retsf; +} + +// ostream operator overload + +MsgStream& Trk::SubtractedVolumeBounds::dump( MsgStream& sl ) const +{ + std::stringstream temp_sl; + temp_sl << std::setiosflags(std::ios::fixed); + temp_sl << std::setprecision(7); + temp_sl << "Trk::SubtractedVolumeBounds: outer,inner "; + sl << temp_sl.str(); + m_outer->volumeBounds().dump(sl); + m_inner->volumeBounds().dump(sl); + return sl; +} + +std::ostream& Trk::SubtractedVolumeBounds::dump( std::ostream& sl ) const +{ + std::stringstream temp_sl; + temp_sl << std::setiosflags(std::ios::fixed); + temp_sl << std::setprecision(7); + temp_sl << "Trk::SubtractedVolumeBounds: outer,inner "; + sl << temp_sl.str(); + m_outer->volumeBounds().dump(sl); + m_inner->volumeBounds().dump(sl); + return sl; +} + +Trk::Volume* Trk::SubtractedVolumeBounds::createSubtractedVolume(const Amg::Transform3D& transf, Trk::Volume* subtrVol) const +{ + Trk::Volume* subVol = nullptr; + if (!subtrVol) return subVol; + + subVol = new Trk::Volume( *subtrVol, transf ); + + return subVol; +} + + + + + diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/TrapezoidVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/TrapezoidVolumeBounds.cxx index af0d333b47a6196cc53fa3cdc40823790c19a017..d78ee7875ce15c6bf45d458354f6f331bb58095c 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/TrapezoidVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/TrapezoidVolumeBounds.cxx @@ -2,221 +2,221 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TrapezoidVolumeBounds.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -//Trk -#include "TrkVolumes/TrapezoidVolumeBounds.h" - -#include "TrkDetDescrUtils/GeometryStatics.h" - -//TrkSurfaces -#include "TrkSurfaces/PlaneSurface.h" -#include "TrkSurfaces/TrapezoidBounds.h" -#include "TrkSurfaces/RectangleBounds.h" -//Gaudi -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/SystemOfUnits.h" -//STD -#include <iostream> -#include <iomanip> -#include <math.h> - -Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds() : - VolumeBounds(), - m_minHalfX(0.), - m_maxHalfX(0.), - m_halfY(0.), - m_halfZ(0.), - m_alpha(0.), - m_beta(0.), - m_objectAccessor() -{} - -Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, double maxhalex, double haley, double halez) : - VolumeBounds(), - m_minHalfX(minhalex), - m_maxHalfX(maxhalex), - m_halfY(haley), - m_halfZ(halez), - m_alpha(0.), - m_beta(0.), - m_objectAccessor() -{ - m_alpha = atan((m_maxHalfX-m_minHalfX)/2/m_halfY) + 0.5*M_PI; - m_beta = m_alpha; -} - -Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, double haley, double halez, double alpha, double beta) : - VolumeBounds(), - m_minHalfX(minhalex), - m_maxHalfX(0.), - m_halfY(haley), - m_halfZ(halez), - m_alpha(alpha), - m_beta(beta), - m_objectAccessor() -{ - double gamma = (alpha > beta) ? (alpha - 0.5*M_PI) : (beta - 0.5*M_PI); - m_maxHalfX = m_minHalfX + (2.*m_halfY)*tan(gamma); -} - -Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds(const Trk::TrapezoidVolumeBounds& trabo) : - VolumeBounds(), - m_minHalfX(trabo.m_minHalfX), - m_maxHalfX(trabo.m_maxHalfX), - m_halfY(trabo.m_halfY), - m_halfZ(trabo.m_halfZ), - m_alpha(trabo.m_alpha), - m_beta(trabo.m_beta), - m_objectAccessor(trabo.m_objectAccessor) -{} - -Trk::TrapezoidVolumeBounds::~TrapezoidVolumeBounds() -{} - -Trk::TrapezoidVolumeBounds& Trk::TrapezoidVolumeBounds::operator=(const Trk::TrapezoidVolumeBounds& trabo) -{ - if (this!=&trabo){ - m_minHalfX = trabo.m_minHalfX; - m_maxHalfX = trabo.m_maxHalfX; - m_halfY = trabo.m_halfY; - m_halfZ = trabo.m_halfZ; - m_alpha = trabo.m_alpha; - m_beta = trabo.m_beta; - m_objectAccessor = trabo.m_objectAccessor; - } - return *this; -} - -const std::vector<const Trk::Surface*>* Trk::TrapezoidVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const -{ - std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; - - // face surfaces xy - Amg::RotationMatrix3D trapezoidRotation(transform.rotation()); - Amg::Vector3D trapezoidX(trapezoidRotation.col(0)); - Amg::Vector3D trapezoidY(trapezoidRotation.col(1)); - Amg::Vector3D trapezoidZ(trapezoidRotation.col(2)); - Amg::Vector3D trapezoidCenter(transform.translation()); - - // (1) - at negative local z - retsf->push_back(new Trk::PlaneSurface(new Amg::Transform3D(transform*Amg::AngleAxis3D(180*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.)) - *Amg::Translation3D(Amg::Vector3D(0.,0.,this->halflengthZ()))), - this->faceXYTrapezoidBounds() ) ); - // (2) - at positive local z - retsf->push_back(new Trk::PlaneSurface(new Amg::Transform3D(transform*Amg::Translation3D(Amg::Vector3D(0.,0.,this->halflengthZ()))), - this->faceXYTrapezoidBounds() ) ); - // face surfaces yz - // transmute cyclical - // (3) - at point A, attached to alpha opening angle - Amg::Vector3D A(this->minHalflengthX(), this->halflengthY(), trapezoidCenter.z()); - Amg::RotationMatrix3D alphaZRotation = (s_idRotation * Amg::AngleAxis3D (this->alpha() - 0.5*M_PI, Amg::Vector3D(0.,0.,1.))).toRotationMatrix(); - //CLHEP::HepRotation alphaRotation(alphaZRotation*trapezoidRotation); - Amg::RotationMatrix3D faceAlphaRotation; - faceAlphaRotation.col(0) = alphaZRotation.col(1); - faceAlphaRotation.col(1) = -alphaZRotation.col(2); - faceAlphaRotation.col(2) = -alphaZRotation.col(0); - RectangleBounds* faceAlphaBounds = this->faceAlphaRectangleBounds(); - // Amg::Vector3D faceAlphaPosition(A+faceAlphaRotation.colX()*faceAlphaBounds->halflengthX()); - Amg::Vector3D faceAlphaPosition0(-0.5*(this->minHalflengthX()+this->maxHalflengthX()),0.,0.); - Amg::Vector3D faceAlphaPosition = transform*faceAlphaPosition0; - retsf->push_back(new Trk::PlaneSurface(new Amg::Transform3D((trapezoidRotation*faceAlphaRotation) * Amg::Translation3D(faceAlphaPosition)),faceAlphaBounds)); - // (4) - at point B, attached to beta opening angle - Amg::Vector3D B(this->minHalflengthX(), -this->halflengthY(), trapezoidCenter.z()); - Amg::RotationMatrix3D betaZRotation = (s_idRotation * Amg::AngleAxis3D (-(this->beta() - 0.5*M_PI),Amg::Vector3D(0.,0.,1.))).toRotationMatrix(); - //CLHEP::HepRotation betaRotation(betaZRotation*trapezoidRotation); - Amg::RotationMatrix3D faceBetaRotation; - faceBetaRotation.col(0) = betaZRotation.col(1); - faceBetaRotation.col(1) = betaZRotation.col(2); - faceBetaRotation.col(2) = betaZRotation.col(0); - RectangleBounds* faceBetaBounds = this->faceBetaRectangleBounds(); - // Amg::Vector3D faceBetaPosition(B+faceBetaRotation.colX()*faceBetaBounds->halflengthX()); - Amg::Vector3D faceBetaPosition0( 0.5*(this->minHalflengthX()+this->maxHalflengthX()),0.,0.); - Amg::Vector3D faceBetaPosition = transform*faceBetaPosition0; - retsf->push_back(new Trk::PlaneSurface(new Amg::Transform3D(trapezoidRotation*faceBetaRotation * Amg::Translation3D(faceBetaPosition)),faceBetaBounds)); - // face surfaces zx - // (5) - at negative local x - retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform * Amg::AngleAxis3D(180.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) - *Amg::Translation3D(Amg::Vector3D(0.,this->halflengthY(),0.)) - *Amg::AngleAxis3D(-90*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(-90.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) ), - this->faceZXRectangleBoundsBottom())); - // (6) - at positive local x - retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform *Amg::Translation3D(Amg::Vector3D(0.,this->halflengthY(), 0.)) - *Amg::AngleAxis3D(-90*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(-90.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) ), - this->faceZXRectangleBoundsTop())); - - return retsf; -} - -// faces in xy -Trk::TrapezoidBounds* Trk::TrapezoidVolumeBounds::faceXYTrapezoidBounds() const -{ - // return new Trk::TrapezoidBounds(m_minHalfX,m_halfY, m_alpha, m_beta); - return new Trk::TrapezoidBounds(m_minHalfX, m_maxHalfX, m_halfY); -} - -Trk::RectangleBounds* Trk::TrapezoidVolumeBounds::faceAlphaRectangleBounds() const -{ - return new Trk::RectangleBounds(m_halfY/cos(m_alpha-0.5*M_PI), m_halfZ); -} - -Trk::RectangleBounds* Trk::TrapezoidVolumeBounds::faceBetaRectangleBounds() const -{ - return new Trk::RectangleBounds(m_halfY/cos(m_beta-0.5*M_PI), m_halfZ); -} - -Trk::RectangleBounds* Trk::TrapezoidVolumeBounds::faceZXRectangleBoundsBottom() const -{ - return new Trk::RectangleBounds(m_halfZ, m_minHalfX); -} - -Trk::RectangleBounds* Trk::TrapezoidVolumeBounds::faceZXRectangleBoundsTop() const -{ - //double delta = (m_alpha < m_beta) ? m_alpha - M_PI/2. : m_beta - M_PI/2.; - // return new Trk::RectangleBounds(m_halfZ, 0.5*(m_minHalfX+m_minHalfX+2.*m_halfY/cos(delta))); - return new Trk::RectangleBounds(m_halfZ, m_maxHalfX); -} - -bool Trk::TrapezoidVolumeBounds::inside(const Amg::Vector3D& pos, double tol) const -{ - if (fabs(pos.z()) > m_halfZ + tol) return false; - if (fabs(pos.y()) > m_halfY + tol) return false; - Trk::TrapezoidBounds* faceXYBounds = this->faceXYTrapezoidBounds(); - Amg::Vector2D locp(pos.x(), pos.y()); - bool inside(faceXYBounds->inside(locp, tol, tol)); - delete faceXYBounds; - return inside; -} - -// ostream operator overload -MsgStream& Trk::TrapezoidVolumeBounds::dump( MsgStream& sl ) const -{ - std::stringstream temp_sl; - temp_sl << std::setiosflags(std::ios::fixed); - temp_sl << std::setprecision(7); - temp_sl << "Trk::TrapezoidVolumeBounds: (minhalfX, halfY, halfZ, alpha, beta) = "; - temp_sl << "(" << m_minHalfX << ", " << m_halfY << ", " << m_halfZ; - temp_sl << ", " << m_alpha << ", " << m_beta << ")"; - sl << temp_sl.str(); - return sl; -} - -std::ostream& Trk::TrapezoidVolumeBounds::dump( std::ostream& sl ) const -{ - std::stringstream temp_sl; - temp_sl << std::setiosflags(std::ios::fixed); - temp_sl << std::setprecision(7); - temp_sl << "Trk::TrapezoidVolumeBounds: (minhalfX, halfY, halfZ, alpha, beta) = "; - temp_sl << "(" << m_minHalfX << ", " << m_halfY << ", " << m_halfZ; - temp_sl << ", " << m_alpha << ", " << m_beta << ")"; - sl << temp_sl.str(); - return sl; -} - - - - - - +/////////////////////////////////////////////////////////////////// +// TrapezoidVolumeBounds.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +//Trk +#include "TrkVolumes/TrapezoidVolumeBounds.h" + +#include "TrkDetDescrUtils/GeometryStatics.h" + +//TrkSurfaces +#include "TrkSurfaces/PlaneSurface.h" +#include "TrkSurfaces/TrapezoidBounds.h" +#include "TrkSurfaces/RectangleBounds.h" +//Gaudi +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/SystemOfUnits.h" +//STD +#include <cmath> +#include <iomanip> +#include <iostream> + +Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds() : + VolumeBounds(), + m_minHalfX(0.), + m_maxHalfX(0.), + m_halfY(0.), + m_halfZ(0.), + m_alpha(0.), + m_beta(0.), + m_objectAccessor() +{} + +Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, double maxhalex, double haley, double halez) : + VolumeBounds(), + m_minHalfX(minhalex), + m_maxHalfX(maxhalex), + m_halfY(haley), + m_halfZ(halez), + m_alpha(0.), + m_beta(0.), + m_objectAccessor() +{ + m_alpha = atan((m_maxHalfX-m_minHalfX)/2/m_halfY) + 0.5*M_PI; + m_beta = m_alpha; +} + +Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds(double minhalex, double haley, double halez, double alpha, double beta) : + VolumeBounds(), + m_minHalfX(minhalex), + m_maxHalfX(0.), + m_halfY(haley), + m_halfZ(halez), + m_alpha(alpha), + m_beta(beta), + m_objectAccessor() +{ + double gamma = (alpha > beta) ? (alpha - 0.5*M_PI) : (beta - 0.5*M_PI); + m_maxHalfX = m_minHalfX + (2.*m_halfY)*tan(gamma); +} + +Trk::TrapezoidVolumeBounds::TrapezoidVolumeBounds(const Trk::TrapezoidVolumeBounds& trabo) : + VolumeBounds(), + m_minHalfX(trabo.m_minHalfX), + m_maxHalfX(trabo.m_maxHalfX), + m_halfY(trabo.m_halfY), + m_halfZ(trabo.m_halfZ), + m_alpha(trabo.m_alpha), + m_beta(trabo.m_beta), + m_objectAccessor(trabo.m_objectAccessor) +{} + +Trk::TrapezoidVolumeBounds::~TrapezoidVolumeBounds() +{} + +Trk::TrapezoidVolumeBounds& Trk::TrapezoidVolumeBounds::operator=(const Trk::TrapezoidVolumeBounds& trabo) +{ + if (this!=&trabo){ + m_minHalfX = trabo.m_minHalfX; + m_maxHalfX = trabo.m_maxHalfX; + m_halfY = trabo.m_halfY; + m_halfZ = trabo.m_halfZ; + m_alpha = trabo.m_alpha; + m_beta = trabo.m_beta; + m_objectAccessor = trabo.m_objectAccessor; + } + return *this; +} + +const std::vector<const Trk::Surface*>* Trk::TrapezoidVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const +{ + std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; + + // face surfaces xy + Amg::RotationMatrix3D trapezoidRotation(transform.rotation()); + Amg::Vector3D trapezoidX(trapezoidRotation.col(0)); + Amg::Vector3D trapezoidY(trapezoidRotation.col(1)); + Amg::Vector3D trapezoidZ(trapezoidRotation.col(2)); + Amg::Vector3D trapezoidCenter(transform.translation()); + + // (1) - at negative local z + retsf->push_back(new Trk::PlaneSurface(new Amg::Transform3D(transform*Amg::AngleAxis3D(180*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.)) + *Amg::Translation3D(Amg::Vector3D(0.,0.,this->halflengthZ()))), + this->faceXYTrapezoidBounds() ) ); + // (2) - at positive local z + retsf->push_back(new Trk::PlaneSurface(new Amg::Transform3D(transform*Amg::Translation3D(Amg::Vector3D(0.,0.,this->halflengthZ()))), + this->faceXYTrapezoidBounds() ) ); + // face surfaces yz + // transmute cyclical + // (3) - at point A, attached to alpha opening angle + Amg::Vector3D A(this->minHalflengthX(), this->halflengthY(), trapezoidCenter.z()); + Amg::RotationMatrix3D alphaZRotation = (s_idRotation * Amg::AngleAxis3D (this->alpha() - 0.5*M_PI, Amg::Vector3D(0.,0.,1.))).toRotationMatrix(); + //CLHEP::HepRotation alphaRotation(alphaZRotation*trapezoidRotation); + Amg::RotationMatrix3D faceAlphaRotation; + faceAlphaRotation.col(0) = alphaZRotation.col(1); + faceAlphaRotation.col(1) = -alphaZRotation.col(2); + faceAlphaRotation.col(2) = -alphaZRotation.col(0); + RectangleBounds* faceAlphaBounds = this->faceAlphaRectangleBounds(); + // Amg::Vector3D faceAlphaPosition(A+faceAlphaRotation.colX()*faceAlphaBounds->halflengthX()); + Amg::Vector3D faceAlphaPosition0(-0.5*(this->minHalflengthX()+this->maxHalflengthX()),0.,0.); + Amg::Vector3D faceAlphaPosition = transform*faceAlphaPosition0; + retsf->push_back(new Trk::PlaneSurface(new Amg::Transform3D((trapezoidRotation*faceAlphaRotation) * Amg::Translation3D(faceAlphaPosition)),faceAlphaBounds)); + // (4) - at point B, attached to beta opening angle + Amg::Vector3D B(this->minHalflengthX(), -this->halflengthY(), trapezoidCenter.z()); + Amg::RotationMatrix3D betaZRotation = (s_idRotation * Amg::AngleAxis3D (-(this->beta() - 0.5*M_PI),Amg::Vector3D(0.,0.,1.))).toRotationMatrix(); + //CLHEP::HepRotation betaRotation(betaZRotation*trapezoidRotation); + Amg::RotationMatrix3D faceBetaRotation; + faceBetaRotation.col(0) = betaZRotation.col(1); + faceBetaRotation.col(1) = betaZRotation.col(2); + faceBetaRotation.col(2) = betaZRotation.col(0); + RectangleBounds* faceBetaBounds = this->faceBetaRectangleBounds(); + // Amg::Vector3D faceBetaPosition(B+faceBetaRotation.colX()*faceBetaBounds->halflengthX()); + Amg::Vector3D faceBetaPosition0( 0.5*(this->minHalflengthX()+this->maxHalflengthX()),0.,0.); + Amg::Vector3D faceBetaPosition = transform*faceBetaPosition0; + retsf->push_back(new Trk::PlaneSurface(new Amg::Transform3D(trapezoidRotation*faceBetaRotation * Amg::Translation3D(faceBetaPosition)),faceBetaBounds)); + // face surfaces zx + // (5) - at negative local x + retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform * Amg::AngleAxis3D(180.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) + *Amg::Translation3D(Amg::Vector3D(0.,this->halflengthY(),0.)) + *Amg::AngleAxis3D(-90*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(-90.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) ), + this->faceZXRectangleBoundsBottom())); + // (6) - at positive local x + retsf->push_back(new Trk::PlaneSurface( new Amg::Transform3D( transform *Amg::Translation3D(Amg::Vector3D(0.,this->halflengthY(), 0.)) + *Amg::AngleAxis3D(-90*Gaudi::Units::deg, Amg::Vector3D(0.,1.,0.))*Amg::AngleAxis3D(-90.*Gaudi::Units::deg, Amg::Vector3D(1.,0.,0.)) ), + this->faceZXRectangleBoundsTop())); + + return retsf; +} + +// faces in xy +Trk::TrapezoidBounds* Trk::TrapezoidVolumeBounds::faceXYTrapezoidBounds() const +{ + // return new Trk::TrapezoidBounds(m_minHalfX,m_halfY, m_alpha, m_beta); + return new Trk::TrapezoidBounds(m_minHalfX, m_maxHalfX, m_halfY); +} + +Trk::RectangleBounds* Trk::TrapezoidVolumeBounds::faceAlphaRectangleBounds() const +{ + return new Trk::RectangleBounds(m_halfY/cos(m_alpha-0.5*M_PI), m_halfZ); +} + +Trk::RectangleBounds* Trk::TrapezoidVolumeBounds::faceBetaRectangleBounds() const +{ + return new Trk::RectangleBounds(m_halfY/cos(m_beta-0.5*M_PI), m_halfZ); +} + +Trk::RectangleBounds* Trk::TrapezoidVolumeBounds::faceZXRectangleBoundsBottom() const +{ + return new Trk::RectangleBounds(m_halfZ, m_minHalfX); +} + +Trk::RectangleBounds* Trk::TrapezoidVolumeBounds::faceZXRectangleBoundsTop() const +{ + //double delta = (m_alpha < m_beta) ? m_alpha - M_PI/2. : m_beta - M_PI/2.; + // return new Trk::RectangleBounds(m_halfZ, 0.5*(m_minHalfX+m_minHalfX+2.*m_halfY/cos(delta))); + return new Trk::RectangleBounds(m_halfZ, m_maxHalfX); +} + +bool Trk::TrapezoidVolumeBounds::inside(const Amg::Vector3D& pos, double tol) const +{ + if (fabs(pos.z()) > m_halfZ + tol) return false; + if (fabs(pos.y()) > m_halfY + tol) return false; + Trk::TrapezoidBounds* faceXYBounds = this->faceXYTrapezoidBounds(); + Amg::Vector2D locp(pos.x(), pos.y()); + bool inside(faceXYBounds->inside(locp, tol, tol)); + delete faceXYBounds; + return inside; +} + +// ostream operator overload +MsgStream& Trk::TrapezoidVolumeBounds::dump( MsgStream& sl ) const +{ + std::stringstream temp_sl; + temp_sl << std::setiosflags(std::ios::fixed); + temp_sl << std::setprecision(7); + temp_sl << "Trk::TrapezoidVolumeBounds: (minhalfX, halfY, halfZ, alpha, beta) = "; + temp_sl << "(" << m_minHalfX << ", " << m_halfY << ", " << m_halfZ; + temp_sl << ", " << m_alpha << ", " << m_beta << ")"; + sl << temp_sl.str(); + return sl; +} + +std::ostream& Trk::TrapezoidVolumeBounds::dump( std::ostream& sl ) const +{ + std::stringstream temp_sl; + temp_sl << std::setiosflags(std::ios::fixed); + temp_sl << std::setprecision(7); + temp_sl << "Trk::TrapezoidVolumeBounds: (minhalfX, halfY, halfZ, alpha, beta) = "; + temp_sl << "(" << m_minHalfX << ", " << m_halfY << ", " << m_halfZ; + temp_sl << ", " << m_alpha << ", " << m_beta << ")"; + sl << temp_sl.str(); + return sl; +} + + + + + + diff --git a/Tracking/TrkEvent/TrkCaloExtension/src/CaloExtension.cxx b/Tracking/TrkEvent/TrkCaloExtension/src/CaloExtension.cxx index 2f9edb420681eadf7ae549cdfad80ccd61087d3e..50c63da3c87db9a58cef829708fc66dfefe36951 100644 --- a/Tracking/TrkEvent/TrkCaloExtension/src/CaloExtension.cxx +++ b/Tracking/TrkEvent/TrkCaloExtension/src/CaloExtension.cxx @@ -19,7 +19,7 @@ namespace Trk { CaloExtension::~CaloExtension() { delete m_caloEntryLayerIntersection; delete m_muonEntryLayerIntersection; - for( auto ptr : m_caloLayerIntersections ) { delete ptr;} + for( const auto *ptr : m_caloLayerIntersections ) { delete ptr;} } } diff --git a/Tracking/TrkEvent/TrkCompetingRIOsOnTrack/TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h b/Tracking/TrkEvent/TrkCompetingRIOsOnTrack/TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h index 042cb3a2fb3d8116a5794789f22a9ecd6fe27a3f..5896f834849728198d2bdc78cd371861743b9f5d 100755 --- a/Tracking/TrkEvent/TrkCompetingRIOsOnTrack/TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h +++ b/Tracking/TrkEvent/TrkCompetingRIOsOnTrack/TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h @@ -73,8 +73,8 @@ public: CompetingRIOsOnTrack(const CompetingRIOsOnTrack& compROT); //! Assignment operator CompetingRIOsOnTrack& operator=(const CompetingRIOsOnTrack& compROT); - CompetingRIOsOnTrack& operator=( CompetingRIOsOnTrack&& compROT); - //! Constructor with parameters + CompetingRIOsOnTrack& operator=(CompetingRIOsOnTrack&& compROT) noexcept; + //! Constructor with parameters CompetingRIOsOnTrack( std::vector<AssignmentProb>* assgnProb); //! Destructor diff --git a/Tracking/TrkEvent/TrkCompetingRIOsOnTrack/src/CompetingRIOsOnTrack.cxx b/Tracking/TrkEvent/TrkCompetingRIOsOnTrack/src/CompetingRIOsOnTrack.cxx index 7336ccfa10d2b4e20cf36e41456eff5815892d5c..ce028ea3fd885c95d144c39f2759b6f1391ee6a0 100755 --- a/Tracking/TrkEvent/TrkCompetingRIOsOnTrack/src/CompetingRIOsOnTrack.cxx +++ b/Tracking/TrkEvent/TrkCompetingRIOsOnTrack/src/CompetingRIOsOnTrack.cxx @@ -13,7 +13,7 @@ #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include <iostream> -#include <boost/io/ios_state.hpp> +#include <boost/io/ios_state.hpp> // default constructor Trk::CompetingRIOsOnTrack::CompetingRIOsOnTrack(): @@ -56,18 +56,21 @@ Trk::CompetingRIOsOnTrack& Trk::CompetingRIOsOnTrack::operator=(const Trk::Compe return (*this); } -Trk::CompetingRIOsOnTrack& Trk::CompetingRIOsOnTrack::operator=(Trk::CompetingRIOsOnTrack&& compROT) { - if (this!=&compROT) { - Trk::MeasurementBase::operator=(compROT); +Trk::CompetingRIOsOnTrack& +Trk::CompetingRIOsOnTrack::operator=( + Trk::CompetingRIOsOnTrack&& compROT) noexcept +{ + if (this != &compROT) { + Trk::MeasurementBase::operator=(compROT); - delete m_assignProb; - m_assignProb = compROT.m_assignProb; - compROT.m_assignProb = nullptr; + delete m_assignProb; + m_assignProb = compROT.m_assignProb; + compROT.m_assignProb = nullptr; - m_indexMaxAssignProb = compROT.m_indexMaxAssignProb.load(); - m_maxProbCalculated = compROT.m_maxProbCalculated; - } - return (*this); + m_indexMaxAssignProb = compROT.m_indexMaxAssignProb.load(); + m_maxProbCalculated = compROT.m_maxProbCalculated; + } + return (*this); } Trk::CompetingRIOsOnTrack::~CompetingRIOsOnTrack() { @@ -85,7 +88,7 @@ void Trk::CompetingRIOsOnTrack::setLocalParametersAndErrorMatrix() { // std::cout << "CompROT - [1] " << rioOnTrack(0).localCovariance() << std::endl; Amg::MatrixX meanWeightMatrix = assignmentProbability(0) * rioOnTrack(0).localCovariance().inverse(); for (unsigned int i=1; i<numberOfContainedROTs(); i++) { - meanWeightMatrix += assignmentProbability(i) * rioOnTrack(i).localCovariance().inverse(); + meanWeightMatrix += assignmentProbability(i) * rioOnTrack(i).localCovariance().inverse(); // std::cout << "CompROT - ["<< i << "] " << rioOnTrack(i).localCovariance() << std::endl; } // limit weight values against values too close to 0, otherwise inversion will fail! @@ -135,10 +138,10 @@ void Trk::CompetingRIOsOnTrack::setLocalParametersAndErrorMatrix() { } } -unsigned int +unsigned int Trk::CompetingRIOsOnTrack::indexOfMaxAssignProb() const { // Check to see if it is calculated yet? - if (!m_maxProbCalculated) { + if (!m_maxProbCalculated) { // No, so work it out. double maxAssgnProb = 0; for (unsigned int i=0; i<numberOfContainedROTs(); i++) { @@ -149,13 +152,13 @@ Trk::CompetingRIOsOnTrack::indexOfMaxAssignProb() const { } //m_maxProbCalculated = true; } - + return m_indexMaxAssignProb; } MsgStream& Trk::CompetingRIOsOnTrack::dump( MsgStream& out ) const { - + boost::io::ios_all_saver ias(out.stream()); out << " - effective pars locX : "; if (m_localParams.contains(Trk::locX)) { @@ -190,7 +193,7 @@ MsgStream& Trk::CompetingRIOsOnTrack::dump( MsgStream& out ) const /* out << std::resetiosflags(std::ios::right)<<std::resetiosflags(std::ios::adjustfield) << std::resetiosflags(std::ios::showpoint)<<std::resetiosflags(std::ios::fixed) << std::setprecision(7) << std::endl;*/ - ias.restore(); + ias.restore(); return out; } diff --git a/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/TrackParticleBase.h b/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/TrackParticleBase.h index 1d5a84e70952d1cb1297d5f2d93f81646d1b5592..9c46b57f9b64b8594019dafb7d237df699fac733 100755 --- a/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/TrackParticleBase.h +++ b/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/TrackParticleBase.h @@ -84,7 +84,7 @@ namespace Trk /** Assignement operator */ TrackParticleBase &operator= (const TrackParticleBase &); - TrackParticleBase &operator= (TrackParticleBase &&); + TrackParticleBase &operator= (TrackParticleBase &&) noexcept; /** Destructor */ virtual ~TrackParticleBase(); diff --git a/Tracking/TrkEvent/TrkParticleBase/src/TrackParticleBase.cxx b/Tracking/TrkEvent/TrkParticleBase/src/TrackParticleBase.cxx index deb1787f7fb8d4ebda19006d691a8625e99262f8..0c97caf58ba3456e673996aac8cdad43ef9f3b4f 100755 --- a/Tracking/TrkEvent/TrkParticleBase/src/TrackParticleBase.cxx +++ b/Tracking/TrkEvent/TrkParticleBase/src/TrackParticleBase.cxx @@ -25,25 +25,25 @@ namespace Trk m_fitQuality(nullptr), m_trackInfo() { - #ifdef DEBUG_CTOR_DTOR + #ifdef DEBUG_CTOR_DTOR std::cout<<"TrackParticleBase blank ctr :"<<this<<std::endl; #endif } /** Merged old Constructors 0.5a, 2a and 1a from old (pre 13) TrackParticle constructors & added new info*/ - TrackParticleBase::TrackParticleBase( const Track* trk, - const TrackParticleOrigin trkPrtOrigin, + TrackParticleBase::TrackParticleBase( const Track* trk, + const TrackParticleOrigin trkPrtOrigin, const VxCandidate* vxCandidate, - const TrackSummary* trkSummary, + const TrackSummary* trkSummary, std::vector<const TrackParameters*>& parameters, const TrackParameters* definingParameter, const FitQuality* fitQuality) : m_originalTrack(), - m_trackParticleOrigin( trkPrtOrigin ), + m_trackParticleOrigin( trkPrtOrigin ), m_elVxCandidate(), m_trackParameters( parameters ), - m_trackSummary( trkSummary ), + m_trackSummary( trkSummary ), m_fitQuality(fitQuality) { #ifdef DEBUG_CTOR_DTOR @@ -52,12 +52,12 @@ namespace Trk // if no vxCandidate set, then trkPrtOrigin should be NoVtx assert ((vxCandidate!=0)||(trkPrtOrigin==NoVtx)); - + // Defining parameter is always last. m_trackParameters.push_back(definingParameter); // establish element links - if (trk!=nullptr) + if (trk!=nullptr) { m_originalTrack.setElement(trk); m_trackInfo = trk->info(); @@ -65,9 +65,9 @@ namespace Trk if (vxCandidate!=nullptr) { m_elVxCandidate.setElement(vxCandidate); } } - + TrackParticleBase::TrackParticleBase( const ElementLink<TrackCollection>& trackLink, - const TrackParticleOrigin trkPrtOrigin, + const TrackParticleOrigin trkPrtOrigin, const ElementLink<VxContainer>& vxCandidate, std::unique_ptr<Trk::TrackSummary> trkSummary, std::vector<const Trk::TrackParameters*>&& parameters, @@ -75,7 +75,7 @@ namespace Trk const TrackInfo& info) : m_originalTrack(trackLink), - m_trackParticleOrigin( trkPrtOrigin ), + m_trackParticleOrigin( trkPrtOrigin ), m_elVxCandidate(vxCandidate), m_trackParameters( std::move(parameters) ), m_trackSummary( trkSummary.release() ), @@ -85,11 +85,11 @@ namespace Trk // if no vxCandidate set, then trkPrtOrigin should be NoVtx assert (!vxCandidate.isDefault() || trkPrtOrigin==NoVtx); } - + /** Copy Constructor */ - TrackParticleBase::TrackParticleBase(const TrackParticleBase& rhs) + TrackParticleBase::TrackParticleBase(const TrackParticleBase& rhs) : m_originalTrack(rhs.m_originalTrack), m_trackParticleOrigin(rhs.m_trackParticleOrigin), @@ -118,56 +118,56 @@ namespace Trk if (this!=&rhs) { // only delete objects where these two pointers point to - // the other pointers point to objects in storegate + // the other pointers point to objects in storegate if (m_trackSummary!=nullptr) { delete m_trackSummary; m_trackSummary = nullptr; } if (m_fitQuality !=nullptr) { delete m_fitQuality ; m_fitQuality = nullptr; } std::vector<const TrackParameters*>::const_iterator it = m_trackParameters.begin(); std::vector<const TrackParameters*>::const_iterator itEnd = m_trackParameters.end(); for (; it!=itEnd; ++it) { delete (*it); -} - + } + m_originalTrack = rhs.m_originalTrack; m_trackParticleOrigin = rhs.m_trackParticleOrigin; m_elVxCandidate = rhs.m_elVxCandidate; - + //the following are owned, and so must be copied. m_trackSummary = (rhs.m_trackSummary) ? new TrackSummary(*(rhs.m_trackSummary)) : nullptr; m_fitQuality = (rhs.m_fitQuality) ? new FitQuality(*(rhs.m_fitQuality)) : nullptr; m_trackInfo = rhs.m_trackInfo; - + it = rhs.m_trackParameters.begin(); itEnd = rhs.m_trackParameters.end(); for (; it!=itEnd; ++it) { m_trackParameters.push_back( (*it)->clone() ); -} + } } return *this; } - TrackParticleBase& TrackParticleBase::operator= (TrackParticleBase&& rhs) + TrackParticleBase& + TrackParticleBase::operator=(TrackParticleBase&& rhs) noexcept { - if (this!=&rhs) - { - delete m_trackSummary; - m_trackSummary = rhs.m_trackSummary; - rhs.m_trackSummary = nullptr; - - delete m_fitQuality; - m_fitQuality = rhs.m_fitQuality; - rhs.m_fitQuality = nullptr; + if (this != &rhs) { + delete m_trackSummary; + m_trackSummary = rhs.m_trackSummary; + rhs.m_trackSummary = nullptr; - for (const TrackParameters* p : m_trackParameters) { - delete p; -} + delete m_fitQuality; + m_fitQuality = rhs.m_fitQuality; + rhs.m_fitQuality = nullptr; - m_trackParameters = std::move (rhs.m_trackParameters); - - m_originalTrack = rhs.m_originalTrack; - m_trackParticleOrigin = rhs.m_trackParticleOrigin; - m_elVxCandidate = rhs.m_elVxCandidate; - - m_trackInfo = rhs.m_trackInfo; + for (const TrackParameters* p : m_trackParameters) { + delete p; } - return *this; + + m_trackParameters = std::move(rhs.m_trackParameters); + + m_originalTrack = rhs.m_originalTrack; + m_trackParticleOrigin = rhs.m_trackParticleOrigin; + m_elVxCandidate = rhs.m_elVxCandidate; + + m_trackInfo = rhs.m_trackInfo; + } + return *this; } /** @@ -186,9 +186,9 @@ namespace Trk if (m_fitQuality !=nullptr) { delete m_fitQuality; } } - + MsgStream& TrackParticleBase::dump( MsgStream& sl ) const - { + { // DO NOT specificy an output level like MSG::VERBOSE (should be done by the caller) sl << "Printing TrackParticle. OriginType: " << this->particleOriginType() << endmsg; if (this->trackElementLink()->isValid()) @@ -212,10 +212,10 @@ namespace Trk sl << (**itr) << endmsg; } sl<<"TrackInfo inherited from original Track comes below:"<<endmsg; - sl<<m_trackInfo.dumpInfo(); + sl<<m_trackInfo.dumpInfo(); return sl; } - + std::ostream& TrackParticleBase::dump( std::ostream& sl ) const { sl << "Printing TrackParticle. OriginType: " << this->particleOriginType() << std::endl; @@ -238,18 +238,18 @@ namespace Trk for (std::vector<const TrackParameters*>::const_iterator itr = trackParameters.begin() ; itr != trackParameters.end() ; ++itr) { sl << (**itr) << std::endl; - } + } sl<<"TrackInfo inherited from original Track comes below:"<<std::endl; - sl<<m_trackInfo.dumpInfo(); + sl<<m_trackInfo.dumpInfo(); return sl; } - + MsgStream& operator << ( MsgStream& sl, const TrackParticleBase& trackParticleBase) - { + { trackParticleBase.dump(sl); return sl; } - + std::ostream& operator << ( std::ostream& sl, const TrackParticleBase& trackParticleBase) { trackParticleBase.dump(sl); diff --git a/Tracking/TrkEvent/TrkPseudoMeasurementOnTrack/TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h b/Tracking/TrkEvent/TrkPseudoMeasurementOnTrack/TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h index d0f58bef11e2276bd7ce1c3c84a548dabf4d345e..9355be9b9464f2c611c079095b46260022bdd287 100755 --- a/Tracking/TrkEvent/TrkPseudoMeasurementOnTrack/TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h +++ b/Tracking/TrkEvent/TrkPseudoMeasurementOnTrack/TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h @@ -65,10 +65,10 @@ namespace Trk{ virtual PseudoMeasurementOnTrack* clone() const override final; //! move constructor - PseudoMeasurementOnTrack(PseudoMeasurementOnTrack&& pmot); + PseudoMeasurementOnTrack(PseudoMeasurementOnTrack&& pmot) noexcept; //! move assignment operator - PseudoMeasurementOnTrack& operator=(PseudoMeasurementOnTrack&& pmot); + PseudoMeasurementOnTrack& operator=(PseudoMeasurementOnTrack&& pmot) noexcept; //! returns the surface for the local to global transformation (interface from MeasurementBase) virtual const Surface& associatedSurface() const override final; diff --git a/Tracking/TrkEvent/TrkPseudoMeasurementOnTrack/src/PseudoMeasurementOnTrack.cxx b/Tracking/TrkEvent/TrkPseudoMeasurementOnTrack/src/PseudoMeasurementOnTrack.cxx index 8185cb0ad72e329a2aa78e5fcec2b96ec167a55d..48c10c1c192d784efd7dba62bfc8e419465fd485 100755 --- a/Tracking/TrkEvent/TrkPseudoMeasurementOnTrack/src/PseudoMeasurementOnTrack.cxx +++ b/Tracking/TrkEvent/TrkPseudoMeasurementOnTrack/src/PseudoMeasurementOnTrack.cxx @@ -78,10 +78,11 @@ Trk::PseudoMeasurementOnTrack::PseudoMeasurementOnTrack( const Trk::PseudoMeasur } // move constructor: -Trk::PseudoMeasurementOnTrack::PseudoMeasurementOnTrack(Trk::PseudoMeasurementOnTrack&& pmot) : - Trk::MeasurementBase(pmot), - m_associatedSurface(move_ptr(pmot.m_associatedSurface)), - m_globalPosition(move_ptr(pmot.m_globalPosition)) +Trk::PseudoMeasurementOnTrack::PseudoMeasurementOnTrack( + Trk::PseudoMeasurementOnTrack&& pmot) noexcept + : Trk::MeasurementBase(pmot) + , m_associatedSurface(move_ptr(pmot.m_associatedSurface)) + , m_globalPosition(move_ptr(pmot.m_globalPosition)) {} @@ -93,25 +94,27 @@ Trk::PseudoMeasurementOnTrack& Trk::PseudoMeasurementOnTrack::operator=(const Ps delete m_associatedSurface; } delete m_globalPosition; - + Trk::MeasurementBase::operator=(pmot); - - m_associatedSurface = + + m_associatedSurface = ( pmot.m_associatedSurface? (pmot.m_associatedSurface->isFree() ? pmot.m_associatedSurface->clone():pmot.m_associatedSurface) : nullptr); - m_globalPosition=nullptr; - if(pmot.m_globalPosition){ + m_globalPosition=nullptr; + if(pmot.m_globalPosition){ m_globalPosition = new Amg::Vector3D(*(pmot.m_globalPosition)); } - + } return *this; } // move assignment operator: -Trk::PseudoMeasurementOnTrack& Trk::PseudoMeasurementOnTrack::operator=(PseudoMeasurementOnTrack&& pmot) +Trk::PseudoMeasurementOnTrack& +Trk::PseudoMeasurementOnTrack::operator=( + PseudoMeasurementOnTrack&& pmot) noexcept { - if ( &pmot != this) { + if (&pmot != this) { Trk::MeasurementBase::operator=(pmot); if (m_associatedSurface && m_associatedSurface->isFree()){ delete m_associatedSurface; diff --git a/Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h b/Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h index c3fdb11539bd7151bd49f6292e6a03f0ab87fff9..b0feae315a543c1e16165e4e6fd808ab5ee1e3d4 100755 --- a/Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h +++ b/Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h @@ -79,11 +79,11 @@ class FitQuality; /** Copy Constructor */ Segment(const Segment& seg); /** Move Constructor */ - Segment(Segment&&); + Segment(Segment&&) noexcept; /** Assignment operator */ Segment& operator=(const Segment& seg); /** Move assignment operator*/ - Segment& operator=(Segment&&); + Segment& operator=(Segment&&) noexcept; /** Constructor with parameters */ Segment( const LocalParameters& locpars, diff --git a/Tracking/TrkEvent/TrkSegment/TrkSegment/TrackSegment.h b/Tracking/TrkEvent/TrkSegment/TrkSegment/TrackSegment.h index ea3a01131d6054f262fe7d6d2e070a18dda71148..9948fbd92378a027fb9ea89f724f0af48cb0bc8b 100755 --- a/Tracking/TrkEvent/TrkSegment/TrkSegment/TrackSegment.h +++ b/Tracking/TrkEvent/TrkSegment/TrkSegment/TrackSegment.h @@ -55,11 +55,11 @@ class FitQuality; /** Copy Constructor */ TrackSegment(const TrackSegment& seg); /** Move Constructor */ - TrackSegment(TrackSegment&&); + TrackSegment(TrackSegment&&) noexcept; /** Assignment operator */ TrackSegment& operator=(const TrackSegment& seg); /** Move assignment operator*/ - TrackSegment& operator=(TrackSegment&&); + TrackSegment& operator=(TrackSegment&&) noexcept; /** Constructor with parameters */ TrackSegment( const LocalParameters& locpars, diff --git a/Tracking/TrkEvent/TrkSegment/src/Segment.cxx b/Tracking/TrkEvent/TrkSegment/src/Segment.cxx index 70b669af8669ab2dfb469f0c13de24f87377873e..21c168d91433570eb84714ea5b7ef810b556da10 100755 --- a/Tracking/TrkEvent/TrkSegment/src/Segment.cxx +++ b/Tracking/TrkEvent/TrkSegment/src/Segment.cxx @@ -45,7 +45,7 @@ Trk::Segment::Segment(const Trk::Segment& seg) Trk::Segment::Segment(const Trk::LocalParameters& locpars, const Amg::MatrixX& locerr, DataVector<const MeasurementBase>* measurements, - FitQuality* fitqual, + FitQuality* fitqual, Author author ) : Trk::MeasurementBase(locpars,locerr), @@ -60,20 +60,19 @@ Trk::Segment::Segment(const Trk::LocalParameters& locpars, // move constructor -Trk::Segment::Segment(Trk::Segment&& seg) - : Trk::MeasurementBase(seg), - m_author( seg.m_author) +Trk::Segment::Segment(Trk::Segment&& seg) noexcept + : Trk::MeasurementBase(seg) + , m_author(seg.m_author) { - m_fitQuality = seg.m_fitQuality; - seg.m_fitQuality = nullptr; - m_containedMeasBases = seg.m_containedMeasBases; - seg.m_containedMeasBases = nullptr; + m_fitQuality = seg.m_fitQuality; + seg.m_fitQuality = nullptr; + m_containedMeasBases = seg.m_containedMeasBases; + seg.m_containedMeasBases = nullptr; #ifndef NDEBUG s_numberOfInstantiations++; // new Segment, so increment total count -#endif +#endif } - // destructor - child save Trk::Segment::~Segment() { @@ -93,47 +92,45 @@ Trk::Segment& Trk::Segment::operator=(const Trk::Segment& seg) if (this!=&seg){ Trk::MeasurementBase::operator=(seg); delete m_fitQuality; - + m_fitQuality = seg.m_fitQuality ? seg.m_fitQuality->clone() : nullptr; if (seg.m_containedMeasBases) { if (!m_containedMeasBases) { m_containedMeasBases = new DataVector<const Trk::MeasurementBase>; - } + } else { m_containedMeasBases->clear(); } m_containedMeasBases->reserve(seg.m_containedMeasBases->size()); for(const Trk::MeasurementBase *const measurement : *(seg.m_containedMeasBases)) { m_containedMeasBases->push_back(measurement->clone()); - } + } } else { delete m_containedMeasBases; - m_containedMeasBases = nullptr; + m_containedMeasBases = nullptr; } m_author = seg.m_author; } return (*this); } - // move assignment operator -Trk::Segment& Trk::Segment::operator=(Trk::Segment&& seg) { - if (this!=&seg){ - Trk::MeasurementBase::operator=(seg); - delete m_fitQuality; - m_fitQuality = seg.m_fitQuality; - seg.m_fitQuality = nullptr; - delete m_containedMeasBases; - m_containedMeasBases = seg.m_containedMeasBases; - seg.m_containedMeasBases = nullptr; - m_author = seg.m_author; - } - return (*this); - } - - - +Trk::Segment& +Trk::Segment::operator=(Trk::Segment&& seg) noexcept +{ + if (this != &seg) { + Trk::MeasurementBase::operator=(seg); + delete m_fitQuality; + m_fitQuality = seg.m_fitQuality; + seg.m_fitQuality = nullptr; + delete m_containedMeasBases; + m_containedMeasBases = seg.m_containedMeasBases; + seg.m_containedMeasBases = nullptr; + m_author = seg.m_author; + } + return (*this); +} unsigned int Trk::Segment::numberOfInstantiations() { diff --git a/Tracking/TrkEvent/TrkSegment/src/TrackSegment.cxx b/Tracking/TrkEvent/TrkSegment/src/TrackSegment.cxx index 98cec8fdb242ac4fbc3134a2a07e8181acf2252a..e6b92d1db61f371a485f9c1cf52e73de75d85443 100755 --- a/Tracking/TrkEvent/TrkSegment/src/TrackSegment.cxx +++ b/Tracking/TrkEvent/TrkSegment/src/TrackSegment.cxx @@ -39,12 +39,12 @@ Trk::TrackSegment::TrackSegment(const Trk::LocalParameters& locpars, m_globalPosition(nullptr) { if(m_associatedSurface){ - m_globalPosition = m_associatedSurface->localToGlobal(localParameters()); + m_globalPosition = m_associatedSurface->localToGlobal(localParameters()); } } // copy constructor -Trk::TrackSegment::TrackSegment(const Trk::TrackSegment& tseg) +Trk::TrackSegment::TrackSegment(const Trk::TrackSegment& tseg) : Trk::Segment(tseg), m_associatedSurface(tseg.m_associatedSurface ? tseg.m_associatedSurface->clone() : nullptr), @@ -52,18 +52,16 @@ Trk::TrackSegment::TrackSegment(const Trk::TrackSegment& tseg) { } - // move constructor -Trk::TrackSegment::TrackSegment(Trk::TrackSegment&& tseg) -: Trk::Segment(tseg) +Trk::TrackSegment::TrackSegment(Trk::TrackSegment&& tseg) noexcept + : Trk::Segment(tseg) { - m_associatedSurface = tseg.m_associatedSurface; - tseg.m_associatedSurface = nullptr; - m_globalPosition = tseg.m_globalPosition; - tseg.m_globalPosition = nullptr; + m_associatedSurface = tseg.m_associatedSurface; + tseg.m_associatedSurface = nullptr; + m_globalPosition = tseg.m_globalPosition; + tseg.m_globalPosition = nullptr; } - Trk::TrackSegment& Trk::TrackSegment::operator=(const Trk::TrackSegment& tseg) { if (this!=&tseg){ @@ -72,35 +70,36 @@ Trk::TrackSegment& Trk::TrackSegment::operator=(const Trk::TrackSegment& tseg) delete m_associatedSurface; } delete m_globalPosition; - + // assingment operator of base class - Trk::Segment::operator=(tseg); - + Trk::Segment::operator=(tseg); + if (tseg.m_associatedSurface){ // copy only if surface is not one owned by a detector Element m_associatedSurface = (!tseg.m_associatedSurface->associatedDetectorElement()) ? tseg.m_associatedSurface->clone() : tseg.m_associatedSurface; - } else { - m_associatedSurface = nullptr; + } else { + m_associatedSurface = nullptr; } - m_globalPosition = tseg.m_globalPosition ? new Amg::Vector3D(*tseg.m_globalPosition) : nullptr; + m_globalPosition = tseg.m_globalPosition ? new Amg::Vector3D(*tseg.m_globalPosition) : nullptr; } return (*this); } - // move assignment operator -Trk::TrackSegment& Trk::TrackSegment::operator=(Trk::TrackSegment&& tseg) { - if (this!=&tseg){ - Trk::Segment::operator=(tseg); - delete m_associatedSurface; - m_associatedSurface = tseg.m_associatedSurface; - tseg.m_associatedSurface = nullptr; - delete m_globalPosition; - m_globalPosition = tseg.m_globalPosition; - tseg.m_globalPosition = nullptr; - } - return (*this); - } +Trk::TrackSegment& +Trk::TrackSegment::operator=(Trk::TrackSegment&& tseg) noexcept +{ + if (this != &tseg) { + Trk::Segment::operator=(tseg); + delete m_associatedSurface; + m_associatedSurface = tseg.m_associatedSurface; + tseg.m_associatedSurface = nullptr; + delete m_globalPosition; + m_globalPosition = tseg.m_globalPosition; + tseg.m_globalPosition = nullptr; + } + return (*this); +} Trk::TrackSegment::~TrackSegment() { @@ -111,12 +110,12 @@ Trk::TrackSegment::~TrackSegment() } const Amg::Vector3D& Trk::TrackSegment::globalPosition() const -{ +{ if (m_globalPosition) { return (*m_globalPosition); } - return INVALID_VECTOR3D; -} + return INVALID_VECTOR3D; +} MsgStream& Trk::TrackSegment::dump( MsgStream& out ) const { @@ -126,7 +125,7 @@ MsgStream& Trk::TrackSegment::dump( MsgStream& out ) const out << " - parameter key : " << std::endl; //TODO - out proper output (see MuonSegment) EJWM return out; - } + } std::ostream& Trk::TrackSegment::dump( std::ostream& out ) const { diff --git a/Tracking/TrkEvent/TrkTrack/TrkTrack/TrackStateOnSurface.h b/Tracking/TrkEvent/TrkTrack/TrkTrack/TrackStateOnSurface.h index 8880ce45f482d576eb370ec98ff1b4b1d12155c7..ab604e83c239592060a72d3b1ac66ff40a795686 100755 --- a/Tracking/TrkEvent/TrkTrack/TrkTrack/TrackStateOnSurface.h +++ b/Tracking/TrkEvent/TrkTrack/TrkTrack/TrackStateOnSurface.h @@ -242,7 +242,7 @@ namespace Trk virtual ~TrackStateOnSurface(); Trk::TrackStateOnSurface& operator=(const Trk::TrackStateOnSurface& rhs); - Trk::TrackStateOnSurface& operator=(Trk::TrackStateOnSurface&& rhs); + Trk::TrackStateOnSurface& operator=(Trk::TrackStateOnSurface&& rhs) noexcept; /** returns 0 if there is no FQOS object assigned*/ const FitQualityOnSurface* fitQualityOnSurface() const; diff --git a/Tracking/TrkEvent/TrkTrack/src/TrackStateOnSurface.cxx b/Tracking/TrkEvent/TrkTrack/src/TrackStateOnSurface.cxx index 4ae7975acf8efd0a96a06b48bc3634be377ec39e..2b170163e9c2e1845f40711cda35dbf0f0099c95 100755 --- a/Tracking/TrkEvent/TrkTrack/src/TrackStateOnSurface.cxx +++ b/Tracking/TrkEvent/TrkTrack/src/TrackStateOnSurface.cxx @@ -69,8 +69,8 @@ TrackStateOnSurface::TrackStateOnSurface( assert(isSane()); //setFlags(); } - - + + TrackStateOnSurface::TrackStateOnSurface ( const MeasurementBase* meas, @@ -89,11 +89,11 @@ TrackStateOnSurface::TrackStateOnSurface TrackStateOnSurface::TrackStateOnSurface( const TrackStateOnSurface& rhs ): - m_fitQualityOnSurface(rhs.m_fitQualityOnSurface + m_fitQualityOnSurface(rhs.m_fitQualityOnSurface ? new FitQualityOnSurface(*rhs.m_fitQualityOnSurface) : nullptr ), - m_trackParameters(rhs.m_trackParameters + m_trackParameters(rhs.m_trackParameters ? rhs.m_trackParameters->clone() : nullptr), - m_measurementOnTrack(rhs.m_measurementOnTrack + m_measurementOnTrack(rhs.m_measurementOnTrack ? rhs.m_measurementOnTrack->clone() : nullptr), m_materialEffectsOnTrack(rhs.m_materialEffectsOnTrack ? rhs.m_materialEffectsOnTrack->clone() : nullptr), @@ -119,12 +119,12 @@ TrackStateOnSurface& TrackStateOnSurface::operator=(const TrackStateOnSurface& r delete m_measurementOnTrack; delete m_materialEffectsOnTrack; delete m_alignmentEffectsOnTrack; - m_fitQualityOnSurface = rhs.m_fitQualityOnSurface + m_fitQualityOnSurface = rhs.m_fitQualityOnSurface ? new FitQualityOnSurface(*rhs.m_fitQualityOnSurface) : nullptr ; - m_trackParameters = rhs.m_trackParameters + m_trackParameters = rhs.m_trackParameters ? rhs.m_trackParameters->clone() : nullptr; - m_measurementOnTrack = rhs.m_measurementOnTrack - ? rhs.m_measurementOnTrack->clone() : nullptr ; + m_measurementOnTrack = rhs.m_measurementOnTrack + ? rhs.m_measurementOnTrack->clone() : nullptr ; m_materialEffectsOnTrack = rhs.m_materialEffectsOnTrack ? rhs.m_materialEffectsOnTrack->clone() : nullptr; m_alignmentEffectsOnTrack = rhs.m_alignmentEffectsOnTrack @@ -136,33 +136,33 @@ TrackStateOnSurface& TrackStateOnSurface::operator=(const TrackStateOnSurface& r } Trk::TrackStateOnSurface& -Trk::TrackStateOnSurface::operator=(Trk::TrackStateOnSurface&& rhs) +Trk::TrackStateOnSurface::operator=(Trk::TrackStateOnSurface&& rhs) noexcept { - if (this!=&rhs){ - delete m_fitQualityOnSurface; - m_fitQualityOnSurface = rhs.m_fitQualityOnSurface; - rhs.m_fitQualityOnSurface = nullptr; + if (this != &rhs) { + delete m_fitQualityOnSurface; + m_fitQualityOnSurface = rhs.m_fitQualityOnSurface; + rhs.m_fitQualityOnSurface = nullptr; - delete m_trackParameters; - m_trackParameters = rhs.m_trackParameters; - rhs.m_trackParameters = nullptr; + delete m_trackParameters; + m_trackParameters = rhs.m_trackParameters; + rhs.m_trackParameters = nullptr; - delete m_measurementOnTrack; - m_measurementOnTrack = rhs.m_measurementOnTrack; - rhs.m_measurementOnTrack = nullptr; + delete m_measurementOnTrack; + m_measurementOnTrack = rhs.m_measurementOnTrack; + rhs.m_measurementOnTrack = nullptr; - delete m_alignmentEffectsOnTrack; - m_alignmentEffectsOnTrack = rhs.m_alignmentEffectsOnTrack; - rhs.m_alignmentEffectsOnTrack = nullptr; + delete m_alignmentEffectsOnTrack; + m_alignmentEffectsOnTrack = rhs.m_alignmentEffectsOnTrack; + rhs.m_alignmentEffectsOnTrack = nullptr; - delete m_materialEffectsOnTrack; - m_materialEffectsOnTrack = rhs.m_materialEffectsOnTrack; - rhs.m_materialEffectsOnTrack = nullptr; + delete m_materialEffectsOnTrack; + m_materialEffectsOnTrack = rhs.m_materialEffectsOnTrack; + rhs.m_materialEffectsOnTrack = nullptr; - m_typeFlags = std::move (rhs.m_typeFlags); - assert(isSane()); - } - return *this; + m_typeFlags = std::move(rhs.m_typeFlags); + assert(isSane()); + } + return *this; } std::string TrackStateOnSurface::dumpType() const{ @@ -192,7 +192,7 @@ std::string TrackStateOnSurface::dumpType() const{ return type; } -const Surface& +const Surface& TrackStateOnSurface::surface() const { if (m_trackParameters) { return m_trackParameters->associatedSurface();} if (m_measurementOnTrack) { return m_measurementOnTrack->associatedSurface();} @@ -203,7 +203,7 @@ TrackStateOnSurface::surface() const { // return *dummy; } -bool +bool TrackStateOnSurface::isSane() const { std::vector<const Surface* > surfaces; @@ -222,7 +222,7 @@ TrackStateOnSurface::isSane() const { } surfaceIt++; } - + if (surfacesDiffer){ std::cerr<<"TrackStateOnSurface::isSane. Surfaces differ! "<<std::endl; if (m_trackParameters) { @@ -243,7 +243,7 @@ TrackStateOnSurface::isSane() const { } return false; } - + return true; } @@ -269,85 +269,85 @@ TrackStateOnSurface::isSane() const { } -/**Overload of << operator for both, MsgStream and std::ostream for debug output*/ +/**Overload of << operator for both, MsgStream and std::ostream for debug output*/ MsgStream& operator << ( MsgStream& sl, const TrackStateOnSurface& tsos) -{ +{ std::string name("TrackStateOnSurface: "); sl <<name<<"\t of type : "<<tsos.dumpType()<<endmsg; //write out "type" of object - - if (sl.level()<MSG::INFO) + + if (sl.level()<MSG::INFO) { sl<<name<<"Detailed dump of contained objects follows:"<<endmsg; - if ( tsos.fitQualityOnSurface()!=nullptr) { + if ( tsos.fitQualityOnSurface()!=nullptr) { sl << *(tsos.fitQualityOnSurface() )<<"\n (end of FitQualityOnSurface dump)"<<endmsg;} - - if ( tsos.trackParameters() !=nullptr) { + + if ( tsos.trackParameters() !=nullptr) { sl << *(tsos.trackParameters() )<<"\n (end of TrackParameters dump)"<<endmsg;} - - if ( tsos.measurementOnTrack()!=nullptr) { + + if ( tsos.measurementOnTrack()!=nullptr) { sl << *(tsos.measurementOnTrack() )<<"\n (end of MeasurementBase dump"<<endmsg;} - - if (tsos.materialEffectsOnTrack()!=nullptr) { + + if (tsos.materialEffectsOnTrack()!=nullptr) { sl << *(tsos.materialEffectsOnTrack() )<<"\n (end of MaterialEffectsBase dump)"<<endmsg;} - - if (tsos.alignmentEffectsOnTrack()!=nullptr) { + + if (tsos.alignmentEffectsOnTrack()!=nullptr) { sl << *(tsos.alignmentEffectsOnTrack() )<<"\n (end of AlignmentEffectsOnTrack dump)"<<endmsg;} } - return sl; + return sl; } std::ostream& operator << ( std::ostream& sl, const TrackStateOnSurface& tsos) { std::string name("TrackStateOnSurface: "); sl <<name<<"\t of type : "<<tsos.dumpType()<<std::endl; - - if ( tsos.fitQualityOnSurface()!=nullptr) + + if ( tsos.fitQualityOnSurface()!=nullptr) { sl <<"\t HAS FitQualityOnSurface(s)."<<std::endl; sl <<"\t \t"<< *(tsos.fitQualityOnSurface() )<<std::endl; - } - else + } + else { sl <<"\t NO FitQualityOnSurfaces."<<std::endl; } - if ( tsos.trackParameters()!=nullptr) + if ( tsos.trackParameters()!=nullptr) { sl <<"\t HAS TrackParameter(s)."<<std::endl; sl <<"\t \t"<< *(tsos.trackParameters() )<<std::endl; - } - else + } + else { sl <<"\t NO TrackParameters."<<std::endl; } - if (tsos.measurementOnTrack()!=nullptr) + if (tsos.measurementOnTrack()!=nullptr) { sl <<"\t HAS MeasurementBase(s)."<<std::endl; sl <<"\t \t"<< *(tsos.measurementOnTrack() )<<std::endl; - } - else + } + else { sl <<"\t NO MeasurementBase."<<std::endl; } - if (tsos.materialEffectsOnTrack()!=nullptr) + if (tsos.materialEffectsOnTrack()!=nullptr) { sl <<"\t HAS MaterialEffectsBase."<<std::endl; sl <<"\t \t"<< *(tsos.materialEffectsOnTrack() )<<std::endl; - } - else + } + else { sl <<"\t NO MaterialEffects."<<std::endl; } /**return sl; don't return here, the next code becomes dead**/ - - if (tsos.alignmentEffectsOnTrack()!=nullptr) + + if (tsos.alignmentEffectsOnTrack()!=nullptr) { sl <<"\t HAS AlignmentEffectsOnTrack."<<std::endl; sl <<"\t \t"<< *(tsos.alignmentEffectsOnTrack() )<<std::endl; - } - else + } + else { sl <<"\t NO AlignmentEffectsOnTrack."<<std::endl; } return sl; diff --git a/Tracking/TrkEvent/TrkV0Vertex/TrkV0Vertex/V0Candidate.h b/Tracking/TrkEvent/TrkV0Vertex/TrkV0Vertex/V0Candidate.h index e0aff4c02a84bf107629936556ecf2c8069c4968..5a377b30f9c31f58ea8d021b3ecde16597ca8a57 100755 --- a/Tracking/TrkEvent/TrkV0Vertex/TrkV0Vertex/V0Candidate.h +++ b/Tracking/TrkEvent/TrkV0Vertex/TrkV0Vertex/V0Candidate.h @@ -54,22 +54,22 @@ class V0Candidate /** * Assignement constructor */ - V0Candidate &operator= (const V0Candidate & rhs); - V0Candidate &operator= (V0Candidate && rhs); + V0Candidate &operator= (const V0Candidate & rhs); + V0Candidate& operator=(V0Candidate&& rhs) noexcept; /** - * Clone method - */ - virtual V0Candidate* clone() const; - -/** - * Destructor. - */ - virtual ~V0Candidate(); + * Clone method + */ + virtual V0Candidate* clone() const; -/** - * Unconst access to the vector of V0Hypothesis - * Required by the finder to set the element links properly. - */ + /** + * Destructor. + */ + virtual ~V0Candidate(); + + /** + * Unconst access to the vector of V0Hypothesis + * Required by the finder to set the element links properly. + */ std::vector<Trk::V0Hypothesis *>* v0Hypothesis(void); /** diff --git a/Tracking/TrkEvent/TrkV0Vertex/src/V0Candidate.cxx b/Tracking/TrkEvent/TrkV0Vertex/src/V0Candidate.cxx index 6678130785eb76c904772afeabac0064da94597b..9706d6cc008d823d32ab07d2e220e50daa136637 100755 --- a/Tracking/TrkEvent/TrkV0Vertex/src/V0Candidate.cxx +++ b/Tracking/TrkEvent/TrkV0Vertex/src/V0Candidate.cxx @@ -29,13 +29,13 @@ namespace Trk { V0Candidate::V0Candidate(const V0Candidate& rhs) : m_v0Hyp(std::vector<Trk::V0Hypothesis *>()) { - std::vector<Trk::V0Hypothesis *>::const_iterator itr = rhs.m_v0Hyp.begin(); + std::vector<Trk::V0Hypothesis *>::const_iterator itr = rhs.m_v0Hyp.begin(); std::vector<Trk::V0Hypothesis *>::const_iterator itre = rhs.m_v0Hyp.end(); for(;itr!=itre;++itr) m_v0Hyp.push_back((*itr)->clone()); } //destructor taking care of produced pointers - V0Candidate::~V0Candidate() + V0Candidate::~V0Candidate() { std::vector<Trk::V0Hypothesis *>::iterator i = m_v0Hyp.begin(); std::vector<Trk::V0Hypothesis *>::iterator ie = m_v0Hyp.end(); @@ -44,14 +44,14 @@ namespace Trk { if(0!=(*i)) delete (*i); (*i)=0; } - m_v0Hyp.clear(); + m_v0Hyp.clear(); } V0Candidate & V0Candidate::operator= (const V0Candidate & rhs) { if (this!=&rhs) { - + //cleaning the local vector before assignement std::vector<Trk::V0Hypothesis *>::iterator i = m_v0Hyp.begin(); std::vector<Trk::V0Hypothesis *>::iterator ie = m_v0Hyp.end(); @@ -60,22 +60,22 @@ namespace Trk { if(0!=(*i)) delete (*i); (*i)=0; } - m_v0Hyp.clear(); - -//now copying the rhs content over - std::vector<Trk::V0Hypothesis *>::const_iterator itr = rhs.m_v0Hyp.begin(); + m_v0Hyp.clear(); + +//now copying the rhs content over + std::vector<Trk::V0Hypothesis *>::const_iterator itr = rhs.m_v0Hyp.begin(); std::vector<Trk::V0Hypothesis *>::const_iterator itre = rhs.m_v0Hyp.end(); - for(;itr!=itre;++itr) m_v0Hyp.push_back((*itr)->clone()); + for(;itr!=itre;++itr) m_v0Hyp.push_back((*itr)->clone()); } - return *this; + return *this; } - V0Candidate & V0Candidate::operator= (V0Candidate && rhs) + V0Candidate& + V0Candidate::operator=(V0Candidate&& rhs) noexcept { - if (this!=&rhs) - { - m_v0Hyp = std::move (rhs.m_v0Hyp); - } - return *this; + if (this != &rhs) { + m_v0Hyp = std::move(rhs.m_v0Hyp); + } + return *this; } } // end of namespace diff --git a/Tracking/TrkEvent/VxVertex/VxVertex/VxCandidate.h b/Tracking/TrkEvent/VxVertex/VxVertex/VxCandidate.h index 9dc43b6dc7cabf8c055a9ff08761036dc11b482e..2eab40394ae5f0363dab7dbf4867a25b60264ab9 100755 --- a/Tracking/TrkEvent/VxVertex/VxVertex/VxCandidate.h +++ b/Tracking/TrkEvent/VxVertex/VxVertex/VxCandidate.h @@ -47,7 +47,7 @@ class VxCandidate virtual ~VxCandidate(); VxCandidate(const VxCandidate& rhs); VxCandidate &operator= (const VxCandidate &); - VxCandidate &operator= (VxCandidate &&); + VxCandidate &operator= (VxCandidate &&) noexcept; virtual VxCandidate* clone() const; /** Output Method for MsgStream, to be overloaded by child classes */ diff --git a/Tracking/TrkEvent/VxVertex/src/VxCandidate.cxx b/Tracking/TrkEvent/VxVertex/src/VxCandidate.cxx index b18b338f9344030d529e81dc1a4541b7a9b97329..85bcc5ad472bcaadcd3f82e6cc6c4bae4798032e 100755 --- a/Tracking/TrkEvent/VxVertex/src/VxCandidate.cxx +++ b/Tracking/TrkEvent/VxVertex/src/VxCandidate.cxx @@ -58,7 +58,7 @@ std::atomic<unsigned int> VxCandidate::s_numberOfInstantiations=0; s_numberOfInstantiations++; #endif }//end of copy-constructor - + VxCandidate &VxCandidate::operator= (const VxCandidate& rhs) { if (this!=&rhs) @@ -84,10 +84,10 @@ std::atomic<unsigned int> VxCandidate::s_numberOfInstantiations=0; return *this; } - VxCandidate &VxCandidate::operator= (VxCandidate&& rhs) + VxCandidate& + VxCandidate::operator=(VxCandidate&& rhs) noexcept { - if (this!=&rhs) - { + if (this != &rhs) { m_recVertex = std::move(rhs.m_recVertex); m_vertexType = rhs.m_vertexType; for (Trk::VxTrackAtVertex* tav : m_vxTrackAtVertex) @@ -97,7 +97,7 @@ std::atomic<unsigned int> VxCandidate::s_numberOfInstantiations=0; return *this; } - VxCandidate::~VxCandidate() { + VxCandidate::~VxCandidate() { for (std::vector<Trk::VxTrackAtVertex*>::iterator i = m_vxTrackAtVertex.begin(); i != m_vxTrackAtVertex.end() ; ++i) { delete (*i); @@ -131,11 +131,11 @@ std::atomic<unsigned int> VxCandidate::s_numberOfInstantiations=0; } return sl; } - - MsgStream& operator << ( MsgStream& sl, const VxCandidate& sf) + + MsgStream& operator << ( MsgStream& sl, const VxCandidate& sf) { return sf.dump(sl); } - std::ostream& operator << ( std::ostream& sl, const VxCandidate& sf) + std::ostream& operator << ( std::ostream& sl, const VxCandidate& sf) { return sf.dump(sl); } unsigned int VxCandidate::numberOfInstantiations()