diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/CMakeLists.txt index 575cd3f9b8fe4f2206bb871c38e0caaad8a251ad..2bf80d78e42d8ea1f8462812826fc425e9e80d41 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/CMakeLists.txt @@ -10,12 +10,13 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps Event/xAOD/xAODTracking GaudiKernel + MagneticField/MagFieldConditions # exposed by FullLinearizedTrackFactory.h Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkParametersBase Tracking/TrkVertexFitter/TrkVertexFitterInterfaces PRIVATE AtlasTest/TestTools - MagneticField/MagFieldInterfaces + MagneticField/MagFieldElements Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkNeutralParameters @@ -24,7 +25,8 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/TrkTrackLink Tracking/TrkEvent/VxVertex Tracking/TrkExtrapolation/TrkExInterfaces - Tracking/TrkExtrapolation/TrkExUtils ) + Tracking/TrkExtrapolation/TrkExUtils + Tools/PathResolver ) # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -34,7 +36,7 @@ atlas_add_component( TrkVertexFitterUtils src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldInterfaces TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldConditions MagFieldElements TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils ) # Install files from the package: atlas_install_headers( TrkVertexFitterUtils ) @@ -44,17 +46,17 @@ atlas_install_joboptions( share/*.txt ) atlas_add_test( DummyAnnealingMaker_test SOURCES test/DummyAnnealingMaker_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldInterfaces TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldConditions MagFieldElements PathResolver TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools LOG_IGNORE_PATTERN "AtlasFieldSvc" ) atlas_add_test( DetAnnealingMaker_test SOURCES test/DetAnnealingMaker_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldInterfaces TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldConditions MagFieldElements PathResolver TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools LOG_IGNORE_PATTERN "AtlasFieldSvc" ) atlas_add_test( ImpactPoint3dEstimator_test SOURCES test/ImpactPoint3dEstimator_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldInterfaces TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel TrkParameters TrkParametersBase TrkVertexFitterInterfaces MagFieldConditions MagFieldElements PathResolver TrkSurfaces TrkEventPrimitives TrkNeutralParameters TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkExUtils TestTools LOG_IGNORE_PATTERN "AtlasFieldSvc" ) diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/TrkVertexFitterUtils/FullLinearizedTrackFactory.h b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/TrkVertexFitterUtils/FullLinearizedTrackFactory.h index f3746a16594953bd195223032327d0088e508afa..ee646536959e9dd358a07c962fcda1754017550c 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/TrkVertexFitterUtils/FullLinearizedTrackFactory.h +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/TrkVertexFitterUtils/FullLinearizedTrackFactory.h @@ -14,6 +14,8 @@ #include "TrkParametersBase/Neutral.h" #include "TrkParameters/TrackParameters.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" + /** * @class Trk::FullLinearizedTrackFactory * @@ -44,10 +46,6 @@ * */ -namespace MagField { - class IMagFieldSvc; -} - namespace Trk { class IExtrapolator; @@ -103,8 +101,9 @@ namespace Trk private: ToolHandle< Trk::IExtrapolator > m_extrapolator; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; - + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey + {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; + }; } #endif diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/TrkVertexFitterUtils_tests.txt b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/TrkVertexFitterUtils_tests.txt index 368d5425d490d57faaf75cf70f825808a054590d..3fff4b5b518bfd5e65ba56580e15efcd1b3c53f4 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/TrkVertexFitterUtils_tests.txt +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/share/TrkVertexFitterUtils_tests.txt @@ -1,5 +1 @@ -ApplicationMgr.ExtSvc={"MagField::AtlasFieldSvc/AtlasFieldSvc", "StoreGateSvc/ConditionStore"}; -AtlasFieldSvc.UseDCS=false; -AtlasFieldSvc.UseMapsFromCool=false; - ToolSvc.Trk::DetAnnealingMaker.SetOfTemperatures = {3, 2, 1}; diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx index c7aca429d33091ec4dad06fb71aadbfb71e3572b..5bb223ae36a0d1476ce12cae375b3d55136042ab 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx @@ -12,7 +12,7 @@ #include "VxVertex/VxTrackAtVertex.h" #include "TrkExInterfaces/IExtrapolator.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "MagFieldElements/AtlasFieldCache.h" #include "TrkSurfaces/PerigeeSurface.h" #include "TrkEventPrimitives/ParamDefs.h" @@ -23,11 +23,9 @@ namespace Trk { FullLinearizedTrackFactory::FullLinearizedTrackFactory(const std::string& t, const std::string& n, const IInterface* p) : - AthAlgTool(t,n,p),m_extrapolator("Trk::Extrapolator", this), - m_magFieldSvc("AtlasFieldSvc", n) + AthAlgTool(t,n,p),m_extrapolator("Trk::Extrapolator", this) { declareProperty("Extrapolator", m_extrapolator); - declareProperty("MagFieldSvc", m_magFieldSvc); declareInterface<IVertexLinearizedTrackFactory>(this); } @@ -36,18 +34,8 @@ namespace Trk StatusCode FullLinearizedTrackFactory::initialize() { - if ( m_extrapolator.retrieve().isFailure() ) - { - ATH_MSG_FATAL ("Failed to retrieve tool " << m_extrapolator); - return StatusCode::FAILURE; - } else { - ATH_MSG_INFO ("Retrieved tool " << m_extrapolator); - } - - if (m_magFieldSvc.retrieve().isFailure() ) { - msg(MSG::FATAL)<<"Could not find magnetic field service." << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK( m_extrapolator.retrieve() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); msg(MSG::INFO) << "Initialize successful" << endmsg; return StatusCode::SUCCESS; @@ -130,8 +118,16 @@ namespace Trk Amg::Vector3D expMomentum(phi_v, th, q_ov_p); // magnetic field + + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + double mField[3]; - m_magFieldSvc->getField(expPoint.data(),mField); + fieldCache.getField(expPoint.data(),mField); + double B_z=mField[2]*299.792;//Magnetic field is returned in kT. //The scaling is a factor of c needed for computing rho. diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx index c3672752f37df716ad6812d18634fc4ce97c7d41..31cedce0d3a5d825079997c8081c3c5fbc916f55 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx @@ -11,7 +11,7 @@ #include "TrkSurfaces/PlaneSurface.h" #include "VxVertex/VxTrackAtVertex.h" #include "TrkEventPrimitives/ParamDefs.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "MagFieldElements/AtlasFieldCache.h" // #define IMPACTPOINT3DESTIMATOR_DEBUG @@ -27,12 +27,10 @@ namespace Trk ImpactPoint3dEstimator::ImpactPoint3dEstimator(const std::string& t, const std::string& n, const IInterface* p) : base_class(t,n,p), m_extrapolator("Trk::Extrapolator"), - m_magFieldSvc("AtlasFieldSvc", n), m_maxiterations(20), m_precision(1e-10)//DeltaPhi { declareProperty("Extrapolator",m_extrapolator); - declareProperty("MagFieldSvc", m_magFieldSvc); declareProperty("MaxIterations",m_maxiterations); declareProperty("Precision",m_precision); } @@ -42,15 +40,8 @@ namespace Trk StatusCode ImpactPoint3dEstimator::initialize() { - if ( m_extrapolator.retrieve().isFailure() ) { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_extrapolator ); - return StatusCode::FAILURE; - } - - if (m_magFieldSvc.retrieve().isFailure() ) { - ATH_MSG_FATAL("Could not find magnetic field service." ); - return StatusCode::FAILURE; - } + ATH_CHECK( m_extrapolator.retrieve() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); ATH_MSG_DEBUG( "Initialize successful" ); return StatusCode::SUCCESS; @@ -123,8 +114,14 @@ namespace Trk const Amg::Vector3D* theVertex, double& distance) const { + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + double magnFieldVect[3]; - m_magFieldSvc->getField(trackPerigee->associatedSurface().center().data(),magnFieldVect); + fieldCache.getField(trackPerigee->associatedSurface().center().data(),magnFieldVect); if(magnFieldVect[2] == 0 ){ ATH_MSG_DEBUG("Magnetic field in the Z direction is 0 -- propagate like a straight line"); return Estimate3dIPNoCurvature(trackPerigee, theVertex, distance); diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.h b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.h index 9c20db67cd135642c53d516c9e265e5c6439d913..214b31b9d12897817ffc64ec7b0db0c6136f9fef 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.h +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.h @@ -9,6 +9,7 @@ #include "GaudiKernel/ToolHandle.h" #include "TrkVertexFitterInterfaces/IImpactPoint3dEstimator.h" #include "TrkNeutralParameters/NeutralParameters.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" /** * @class Trk::ImpactPoint3dEstimator @@ -28,10 +29,6 @@ * */ -namespace MagField { - class IMagFieldSvc; -} - namespace Trk { class IExtrapolator; @@ -86,8 +83,9 @@ namespace Trk ToolHandle< Trk::IExtrapolator > m_extrapolator; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; - + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey + {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; + int m_maxiterations; double m_precision; diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/test/ImpactPoint3dEstimator_test.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/test/ImpactPoint3dEstimator_test.cxx index 6a68890534dac3929908eff2ddcf6a2df809f122..c74dc2b01b3b4c045a3b9b97f374b51c01a6501c 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/test/ImpactPoint3dEstimator_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/test/ImpactPoint3dEstimator_test.cxx @@ -11,9 +11,6 @@ #undef NDEBUG #include "TrkVertexFitterInterfaces/IImpactPoint3dEstimator.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" -#include "GaudiKernel/Incident.h" -#include "GaudiKernel/IIncidentListener.h" #include "TestTools/initGaudi.h" #include "CxxUtils/ubsan_suppress.h" #include "GaudiKernel/ToolHandle.h" @@ -24,6 +21,19 @@ #include <cassert> #include <cmath> +// for the field map +#include "PathResolver/PathResolver.h" +#include "TFile.h" +#include "TTree.h" + +// for populating conditions store +#include "SGTools/TestStore.h" +#include "StoreGate/WriteCondHandleKey.h" +#include "StoreGate/WriteCondHandle.h" + +// for the conditions data +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" using Gaudi::Units::mm; using Gaudi::Units::MeV; @@ -104,6 +114,53 @@ void test1 (Trk::IImpactPoint3dEstimator& tool) // not tested here. } +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { + // find the path to the map file + std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); + assert ( !resolvedMapFile.empty() ); + // Do checks and extract root file to initialize the map + assert ( resolvedMapFile.find(".root") != std::string::npos ); + + std::unique_ptr<TFile> rootfile( std::make_unique<TFile>(resolvedMapFile.c_str(), "OLD") ); + assert ( rootfile ); + assert ( rootfile->cd() ); + // open the tree + TTree* tree = (TTree*)rootfile->Get("BFieldMap"); + assert(tree); + + // create map + std::unique_ptr<MagField::AtlasFieldMap> field_map=std::make_unique<MagField::AtlasFieldMap>(); + + // initialize map + assert (field_map->initializeMap( rootfile.get(), sol_current, tor_current )); + return field_map; + +} + +void createNewtonTrkDistanceFinderCondData(SGTest::TestStore &store) { + SG::WriteCondHandleKey<AtlasFieldCacheCondObj> fieldKey {"fieldCondObj"}; + assert( fieldKey.initialize().isSuccess()); + + // from StoreGate/test/WriteCondHandle_test.cxx + EventIDBase now(0, EventIDBase::UNDEFEVT, 1); + EventContext ctx(1, 1); + ctx.setEventID( now ); + ctx.setExtension( Atlas::ExtendedEventContext(&store) ); + Gaudi::Hive::setCurrentContext(ctx); + + EventIDBase s1_1(0, EventIDBase::UNDEFEVT, 0); + EventIDBase e1_1(0, EventIDBase::UNDEFEVT, 3); + EventIDRange r1_1 (s1_1,e1_1); + + + SG::WriteCondHandle<AtlasFieldCacheCondObj> fieldHandle {fieldKey}; + { + std::unique_ptr<MagField::AtlasFieldMap> fieldMap=getFieldMap("MagneticFieldMaps/bfieldmap_7730_20400_14m.root",7730,20400); + auto fieldCondObj = std::make_unique<AtlasFieldCacheCondObj>(); + assert( fieldCondObj->initialize(1. /*solenoid current scale factor*/, 1. /*toroid current scale factor*/, fieldMap.release())); + assert( fieldHandle.record(r1_1, std::move(fieldCondObj)).isSuccess()); + } +} int main() { @@ -112,9 +169,11 @@ int main() ISvcLocator* svcloc = nullptr; Athena_test::initGaudi ("TrkVertexFitterUtils/TrkVertexFitterUtils_tests.txt", svcloc); - ServiceHandle<MagField::IMagFieldSvc> field ("MagField::AtlasFieldSvc/AtlasFieldSvc", "test"); - Incident inc_br ("test", IncidentType::BeginRun); - dynamic_cast<IIncidentListener*>(&*field)->handle (inc_br); + StoreGateSvc *cs=nullptr; + assert (svcloc->service("StoreGateSvc/ConditionStore",cs).isSuccess()); + + SGTest::TestStore dumstore; + createNewtonTrkDistanceFinderCondData(dumstore); ToolHandle<Trk::IImpactPoint3dEstimator> tool ("Trk::ImpactPoint3dEstimator"); assert( tool.retrieve().isSuccess() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/CMakeLists.txt index 3f982a9e14a0b77bbabdcd13a260442657c20bf9..9fb2689a44eeafa78d76327547b4734f0c919266 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/CMakeLists.txt @@ -13,6 +13,7 @@ atlas_depends_on_subdirs( DetectorDescription/GeoPrimitives Event/xAOD/xAODTracking GaudiKernel + MagneticField/MagFieldConditions # Exposed by NewtonTrkDistanceFinder.h and Trk2dDistanceSeeder.h Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkParticleBase Tracking/TrkEvent/VxVertex @@ -23,11 +24,12 @@ atlas_depends_on_subdirs( Event/xAOD/xAODTruth InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetRecTools/InDetTrackSelectionTool - MagneticField/MagFieldInterfaces + MagneticField/MagFieldElements Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkLinks Tracking/TrkEvent/TrkTrack - Tracking/TrkVertexFitter/TrkVertexFitterInterfaces ) + Tracking/TrkVertexFitter/TrkVertexFitterInterfaces + Tools/PathResolver ) # External dependencies: find_package( FFTW ) @@ -45,7 +47,7 @@ atlas_add_component( TrkVertexSeedFinderUtils src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${FFTW_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib ) atlas_install_joboptions( share/*.py ) @@ -56,7 +58,7 @@ atlas_add_test( NewtonTrkDistanceFinder_test SOURCES test/NewtonTrkDistanceFinder_test.cxx LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} TestTools EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements PathResolver TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib LOG_IGNORE_PATTERN "reading the map|field map" ) @@ -65,7 +67,7 @@ atlas_add_test( Trk2dDistanceSeeder_test SOURCES test/Trk2dDistanceSeeder_test.cxx LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} TestTools EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements PathResolver TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib LOG_IGNORE_PATTERN "reading the map|field map" ) @@ -74,7 +76,7 @@ atlas_add_test( SeedNewtonTrkDistanceFinder_test SOURCES test/SeedNewtonTrkDistanceFinder_test.cxx LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} TestTools EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements PathResolver TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib LOG_IGNORE_PATTERN "reading the map|field map" ) @@ -83,7 +85,7 @@ atlas_add_test( Trk2DDistanceFinder_test SOURCES test/Trk2DDistanceFinder_test.cxx LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} TestTools EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements PathResolver TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib LOG_IGNORE_PATTERN "reading the map|field map" ) @@ -92,7 +94,7 @@ atlas_add_test( GaussianTrackDensity_test SOURCES test/GaussianTrackDensity_test.cxx LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} TestTools EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib ) # Needed to avoid spurious ubsan warnings. set_target_properties( TrkVertexSeedFinderUtils_GaussianTrackDensity_test PROPERTIES ENABLE_EXPORTS True ) @@ -102,7 +104,7 @@ atlas_add_test( SimpleVertexClusterFinder_test SOURCES test/SimpleVertexClusterFinder_test.cxx LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} TestTools EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib ) @@ -110,7 +112,7 @@ atlas_add_test( Mode3dFromFsmw1dFinder_test SOURCES test/Mode3dFromFsmw1dFinder_test.cxx LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} TestTools EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib ) # Needed to avoid spurious ubsan warnings. set_target_properties( TrkVertexSeedFinderUtils_Mode3dFromFsmw1dFinder_test PROPERTIES ENABLE_EXPORTS True ) @@ -120,5 +122,5 @@ atlas_add_test( Mode3dTo1dFinder_test SOURCES test/Mode3dTo1dFinder_test.cxx LINK_LIBRARIES ${ROOT_LIBRARIES} ${FFTW_LIBRARIES} TestTools EventPrimitives - xAODTruth InDetTrackSelectionToolLib MagFieldInterfaces TrkEventPrimitives + xAODTruth InDetTrackSelectionToolLib MagFieldConditions MagFieldElements TrkEventPrimitives TrkLinks TrkTrack TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib ) diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h index 3ff045850c1d3e471f7af9133e60b6555433ba83..2826134d4ca83f1944a798edc1d72488d1f79bba 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h @@ -8,10 +8,7 @@ #include "GaudiKernel/ToolHandle.h" #include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" #include "AthenaBaseComps/AthAlgTool.h" - -namespace MagField { - class IMagFieldSvc; -} +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" namespace Trk { @@ -72,8 +69,9 @@ namespace Trk double m_maxloopnumber;//as job option //variables for magnetic field service needed to retrieve the correct Bz - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; - + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey + {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; + }; namespace Error { diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h index 5e8b912306ba5a7acd383ead1abace147007d2bd..fdcd923f5418208d91f117c532eacad524dab69a 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h @@ -10,10 +10,7 @@ #include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" #include "GeoPrimitives/GeoPrimitives.h" #include "AthenaBaseComps/AthAlgTool.h" - -namespace MagField { - class IMagFieldSvc; -} +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" namespace Trk { @@ -60,12 +57,13 @@ namespace Trk private: - double getBField (const Perigee& p) const; + double getBField (const Perigee& p, MagField::AtlasFieldCache& cache) const; //option bool m_solveAmbiguityUsingZ; - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey + {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"}; }; } #endif diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/GaussianTrackDensity_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/GaussianTrackDensity_test.ref index c4510526b6dae4c2663d21cb66bbcabd6f39e634..3dba3377b8051e7ec308cd3683d64d77d26daeeb 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/GaussianTrackDensity_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/GaussianTrackDensity_test.ref @@ -1,25 +1,16 @@ TrkVertexSeedFinderUtils/GaussianTrackDensity_test -Initializing Gaudi ApplicationMgr using job opts /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +JobOptionsSvc INFO Job options successfully read in from /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Mon Jun 24 09:28:34 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on localhost.localdomain on Thu May 14 05:42:53 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready test1 diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Mode3dFromFsmw1dFinder_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Mode3dFromFsmw1dFinder_test.ref index b079a115c260b6d589bd8ec6d29f6e8c815f0e89..c95c87668b18df951f65f269ab4b54617dbc7805 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Mode3dFromFsmw1dFinder_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Mode3dFromFsmw1dFinder_test.ref @@ -1,25 +1,16 @@ TrkVertexSeedFinderUtils/Mode3dFromFsmw1dFinder_test -Initializing Gaudi ApplicationMgr using job opts /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +JobOptionsSvc INFO Job options successfully read in from /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Wed Jun 26 14:49:01 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on localhost.localdomain on Thu May 14 05:43:53 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready ToolSvc.Trk::Mo... INFO Initialize successful diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Mode3dTo1dFinder_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Mode3dTo1dFinder_test.ref index a584664ce726aa42edbabb6cf68d7858bd76e560..ac386076ea9c27b4ec59af5ec41e7026e9772d29 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Mode3dTo1dFinder_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Mode3dTo1dFinder_test.ref @@ -1,25 +1,16 @@ TrkVertexSeedFinderUtils/Mode3dTo1dFinder_test -Initializing Gaudi ApplicationMgr using job opts /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +JobOptionsSvc INFO Job options successfully read in from /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Thu Jun 27 11:26:14 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on localhost.localdomain on Thu May 14 05:44:16 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready ToolSvc.Trk::Mo... INFO Initialize successfull diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/NewtonTrkDistanceFinder_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/NewtonTrkDistanceFinder_test.ref index 3f0be1694fe3addef9bdd975dc63c2d06968cae2..d575cc9aba1ff73dc4019a6aa2da4852ed687138 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/NewtonTrkDistanceFinder_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/NewtonTrkDistanceFinder_test.ref @@ -1,33 +1,19 @@ TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder_test -Initializing Gaudi ApplicationMgr using job opts /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +JobOptionsSvc INFO Job options successfully read in from /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== Welcome to ApplicationMgr (GaudiCoreSvc v33r1) - running on lxplus775.cern.ch on Fri Apr 10 21:24:03 2020 + running on localhost.localdomain on Thu May 14 05:38:41 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -AtlasFieldSvc INFO handling incidents ... -AtlasFieldSvc INFO importCurrents() ... -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Solenoid zone id 7000 -AtlasFieldSvc INFO Currents imported and map initialized -AtlasFieldSvc INFO BeginRun incident handled -AtlasFieldSvc INFO incidents handled successfully +ClassIDSvc INFO getRegistryEntries: read 1460 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 372 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 3256 CLIDRegistry entries for module ALL test1 diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/SeedNewtonTrkDistanceFinder_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/SeedNewtonTrkDistanceFinder_test.ref index f563812010089ed0103ca6a421a35a98d093defe..59d2edcf9dfb2c5e59fa298954bb9be6567c7899 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/SeedNewtonTrkDistanceFinder_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/SeedNewtonTrkDistanceFinder_test.ref @@ -1,33 +1,19 @@ TrkVertexSeedFinderUtils/SeedNewtonTrkDistanceFinder_test -Initializing Gaudi ApplicationMgr using job opts /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +JobOptionsSvc INFO Job options successfully read in from /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== Welcome to ApplicationMgr (GaudiCoreSvc v33r1) - running on lxplus775.cern.ch on Fri Apr 10 21:35:29 2020 + running on localhost.localdomain on Thu May 14 05:41:52 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -AtlasFieldSvc INFO handling incidents ... -AtlasFieldSvc INFO importCurrents() ... -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Solenoid zone id 7000 -AtlasFieldSvc INFO Currents imported and map initialized -AtlasFieldSvc INFO BeginRun incident handled -AtlasFieldSvc INFO incidents handled successfully +ClassIDSvc INFO getRegistryEntries: read 1460 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 372 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 3256 CLIDRegistry entries for module ALL test1 diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/SimpleVertexClusterFinder_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/SimpleVertexClusterFinder_test.ref index 4e54e75df837669fc3bad38146b018dac0e1beb3..421d4ce48025288b367d13e6de43fba00faff30d 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/SimpleVertexClusterFinder_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/SimpleVertexClusterFinder_test.ref @@ -1,25 +1,16 @@ TrkVertexSeedFinderUtils/SimpleVertexClusterFinder_test -Initializing Gaudi ApplicationMgr using job opts /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /home/sss/atlas/rootaccess/build/joboptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +JobOptionsSvc INFO Job options successfully read in from /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) - running on karma on Mon Jun 24 22:40:35 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v33r1) + running on localhost.localdomain on Thu May 14 05:43:15 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. -HistogramPersis...WARNING Histograms saving not required. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready ToolSvc.Trk::Ve... INFO Initializing frequency space filter diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Trk2DDistanceFinder_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Trk2DDistanceFinder_test.ref index 5337bb18a7c13ef5d9e147c249acecab467caeb5..13b71e0e1c47ea35b1db72a02e7b1acb83d73fef 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Trk2DDistanceFinder_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Trk2DDistanceFinder_test.ref @@ -1,33 +1,19 @@ TrkVertexSeedFinderUtils/Trk2DDistanceFinder_test -Initializing Gaudi ApplicationMgr using job opts /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +JobOptionsSvc INFO Job options successfully read in from /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== Welcome to ApplicationMgr (GaudiCoreSvc v33r1) - running on lxplus775.cern.ch on Fri Apr 10 21:22:38 2020 + running on localhost.localdomain on Thu May 14 05:42:27 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -AtlasFieldSvc INFO handling incidents ... -AtlasFieldSvc INFO importCurrents() ... -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Solenoid zone id 7000 -AtlasFieldSvc INFO Currents imported and map initialized -AtlasFieldSvc INFO BeginRun incident handled -AtlasFieldSvc INFO incidents handled successfully +ClassIDSvc INFO getRegistryEntries: read 1460 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 372 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 3256 CLIDRegistry entries for module ALL test1 diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Trk2dDistanceSeeder_test.ref b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Trk2dDistanceSeeder_test.ref index 64450b55cc258b17f6d1a9051a3d524d18fdc44b..293869f2d3cf37bc2301916a139b9e538a9ff197 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Trk2dDistanceSeeder_test.ref +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/Trk2dDistanceSeeder_test.ref @@ -1,33 +1,19 @@ TrkVertexSeedFinderUtils/Trk2dDistanceSeeder_test -Initializing Gaudi ApplicationMgr using job opts /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt -JobOptionsSvc INFO # (1,1): ApplicationMgr.ExtSvc = ["MagField::AtlasFieldSvc/AtlasFieldSvc"] -JobOptionsSvc INFO # (2,1): AtlasFieldSvc.UseDCS = 0 -JobOptionsSvc INFO # (3,1): AtlasFieldSvc.UseMapsFromCool = 0 -JobOptionsSvc INFO Job options successfully read in from /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +Initializing Gaudi ApplicationMgr using job opts /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt +JobOptionsSvc INFO Job options successfully read in from /home/dcasper/Work/atlas/vtx/build/x86_64-centos7-gcc8-opt/jobOptions/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt ApplicationMgr SUCCESS ==================================================================================================================================== Welcome to ApplicationMgr (GaudiCoreSvc v33r1) - running on lxplus775.cern.ch on Fri Apr 10 21:36:13 2020 + running on localhost.localdomain on Thu May 14 05:41:16 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully -AtlasFieldSvc INFO initialize() ... -AtlasFieldSvc INFO Currents are set-up by jobOptions - delaying map initialization until BeginRun incident happens -AtlasFieldSvc INFO Added listener to BeginRun incident -AtlasFieldSvc INFO initialize() successful EventLoopMgr WARNING Unable to locate service "EventSelector" EventLoopMgr WARNING No events will be processed from external input. ApplicationMgr INFO Application Manager Initialized successfully ApplicationMgr Ready -AtlasFieldSvc INFO handling incidents ... -AtlasFieldSvc INFO importCurrents() ... -AtlasFieldSvc INFO Initializing the field map (solenoidCurrent=7730 toroidCurrent=20400) -AtlasFieldSvc INFO reading the map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Initialized the field map from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/atlas/offline/ReleaseData/v20/MagneticFieldMaps/bfieldmap_7730_20400_14m.root -AtlasFieldSvc INFO Solenoid zone id 7000 -AtlasFieldSvc INFO Currents imported and map initialized -AtlasFieldSvc INFO BeginRun incident handled -AtlasFieldSvc INFO incidents handled successfully +ClassIDSvc INFO getRegistryEntries: read 1460 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 372 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 3256 CLIDRegistry entries for module ALL test1 diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/TrkVertexSeedFinderUtils_tests.txt b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/TrkVertexSeedFinderUtils_tests.txt index ce532aaa3b830d9f4a755d386296875e63b20929..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/TrkVertexSeedFinderUtils_tests.txt +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/share/TrkVertexSeedFinderUtils_tests.txt @@ -1,3 +0,0 @@ -ApplicationMgr.ExtSvc={"MagField::AtlasFieldSvc/AtlasFieldSvc"}; -AtlasFieldSvc.UseDCS=false; -AtlasFieldSvc.UseMapsFromCool=false; diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/NewtonTrkDistanceFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/NewtonTrkDistanceFinder.cxx index dedcdc698e289a18aa518b3d82821bc12260e0a7..364a6f9f8a32f4aaba6a52d4cc62d3e15e753779 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/NewtonTrkDistanceFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/NewtonTrkDistanceFinder.cxx @@ -8,10 +8,12 @@ //#define TrkDistance_DEBUG +#include "GaudiKernel/EventContext.h" + #include "TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h" #include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "MagFieldElements/AtlasFieldCache.h" #include "TrkEventPrimitives/ParamDefs.h" #include <math.h> @@ -29,10 +31,8 @@ namespace Trk NewtonTrkDistanceFinder::NewtonTrkDistanceFinder(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), m_precision(1e-8), - m_maxloopnumber(20), - m_magFieldSvc("AtlasFieldSvc", n) + m_maxloopnumber(20) { - declareProperty("MagFieldSvc", m_magFieldSvc); declareProperty("Precision",m_precision); declareProperty("MaxLoops",m_maxloopnumber); declareInterface<NewtonTrkDistanceFinder>(this); @@ -43,7 +43,7 @@ namespace Trk StatusCode NewtonTrkDistanceFinder::initialize() { ATH_CHECK( AlgTool::initialize() ); - ATH_CHECK( m_magFieldSvc.retrieve() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); ATH_MSG_DEBUG( "Initialize successful" ); return StatusCode::SUCCESS; } @@ -75,12 +75,19 @@ NewtonTrkDistanceFinder::GetClosestPoints (const PointOnTrack & firsttrack, ATH_MSG_DEBUG( "m_a_phi0 " << a_phi0 ); #endif + // Setup magnetic field retrieval + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + double magnFieldVect[3]; double posXYZ[3]; posXYZ[0] = firsttrack.getPerigee().associatedSurface().center().x(); posXYZ[1] = firsttrack.getPerigee().associatedSurface().center().y(); posXYZ[2] = firsttrack.getPerigee().associatedSurface().center().z(); - m_magFieldSvc->getField(posXYZ,magnFieldVect); + fieldCache.getField(posXYZ,magnFieldVect); //Magnetic field at (x0,y0,z0) @@ -117,7 +124,7 @@ NewtonTrkDistanceFinder::GetClosestPoints (const PointOnTrack & firsttrack, posXYZ[0] = secondtrack.getPerigee().associatedSurface().center().x(); posXYZ[1] = secondtrack.getPerigee().associatedSurface().center().y(); posXYZ[2] = secondtrack.getPerigee().associatedSurface().center().z(); - m_magFieldSvc->getField(posXYZ,magnFieldVect); + fieldCache.getField(posXYZ,magnFieldVect); //Magnetic field at (x0,y0,z0) const double b_Bz = magnFieldVect[2]*299.792;//B field in Gev/mm - for the moment use a constant field offline diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2dDistanceSeeder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2dDistanceSeeder.cxx index 22318bdaf8a1be5169985c3a462ec5d1e6a5565e..06d662ce3cdce098c4b23785ea56c920909b49d7 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2dDistanceSeeder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2dDistanceSeeder.cxx @@ -10,9 +10,10 @@ #include "TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h" #include "TrkVertexSeedFinderUtils/TwoTracks.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "TrkParameters/TrackParameters.h" #include "GaudiKernel/SystemOfUnits.h" +#include "GaudiKernel/EventContext.h" +#include "MagFieldElements/AtlasFieldCache.h" #include <math.h> #include <TMath.h> @@ -99,10 +100,8 @@ namespace Trk { Trk2dDistanceSeeder::Trk2dDistanceSeeder(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_solveAmbiguityUsingZ(true), - m_magFieldSvc("AtlasFieldSvc", n) + m_solveAmbiguityUsingZ(true) { - declareProperty("MagFieldSvc", m_magFieldSvc); declareProperty("SolveAmbiguityUsingZ",m_solveAmbiguityUsingZ); declareInterface<Trk2dDistanceSeeder>(this); } @@ -112,7 +111,7 @@ namespace Trk StatusCode Trk2dDistanceSeeder::initialize() { ATH_CHECK( AlgTool::initialize() ); - ATH_CHECK( m_magFieldSvc.retrieve() ); + ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() ); ATH_MSG_DEBUG( "Initialize successful" ); return StatusCode::SUCCESS; } @@ -128,8 +127,14 @@ StatusCode Trk2dDistanceSeeder::finalize() Trk2dDistanceSeeder::GetSeed (const TwoTracks & mytracks, TwoPoints* twopoints /*=nullptr*/) const { - const double bfield1 = getBField (mytracks.getFirstPerigee()); - const double bfield2 = getBField (mytracks.getSecondPerigee()); + SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, Gaudi::Hive::currentContext()}; + const AtlasFieldCacheCondObj* fieldCondObj{*readHandle}; + + MagField::AtlasFieldCache fieldCache; + fieldCondObj->getInitializedCache (fieldCache); + + const double bfield1 = getBField (mytracks.getFirstPerigee(), fieldCache); + const double bfield2 = getBField (mytracks.getSecondPerigee(), fieldCache); //phitanpoca here means not the tan to poca (which is phi0) but the direction from perigee to the center of curvature (I don't know //why I chose this strange name, sorry!) @@ -374,14 +379,15 @@ StatusCode Trk2dDistanceSeeder::finalize() } - double Trk2dDistanceSeeder::getBField (const Perigee& p) const + double Trk2dDistanceSeeder::getBField (const Perigee& p, MagField::AtlasFieldCache& cache) const { double magnFieldVect[3]; double posXYZ[3]; posXYZ[0] = p.associatedSurface().center().x(); posXYZ[1] = p.associatedSurface().center().y(); posXYZ[2] = p.associatedSurface().center().z(); - m_magFieldSvc->getField(posXYZ,magnFieldVect); + + cache.getField(posXYZ,magnFieldVect); const double bfield = magnFieldVect[2]*299.792;//should be in GeV/mm if (bfield==0. || isnan(bfield)) { ATH_MSG_DEBUG( "Could not find a magnetic field different from zero: very very strange" ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/GaussianTrackDensity_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/GaussianTrackDensity_test.cxx index b50659d0850b2ddede5f7c4aa36985ddaa209ad6..906dac6f629d8c726d571e5b233970de6476893b 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/GaussianTrackDensity_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/GaussianTrackDensity_test.cxx @@ -18,8 +18,6 @@ #include "GaudiKernel/SystemOfUnits.h" #include "CxxUtils/ubsan_suppress.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Incident.h" -#include "GaudiKernel/IIncidentListener.h" #include "TInterpreter.h" #include <iostream> #include <cassert> diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/NewtonTrkDistanceFinder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/NewtonTrkDistanceFinder_test.cxx index 6b0d6194fddd8154ecdd59a3aad555507bf9a721..a52582a5e6a60b05b51070e5ec4e969cc3d25b3e 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/NewtonTrkDistanceFinder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/NewtonTrkDistanceFinder_test.cxx @@ -11,19 +11,31 @@ #undef NDEBUG #include "TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "TestTools/initGaudi.h" #include "TestTools/FLOATassert.h" #include "TestTools/expect_exception.h" #include "CxxUtils/ubsan_suppress.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Incident.h" -#include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/EventContext.h" #include "TInterpreter.h" #include <iostream> #include <cassert> #include <cmath> +// for the field map +#include "PathResolver/PathResolver.h" +#include "TFile.h" +#include "TTree.h" + +// for populating conditions store +#include "SGTools/TestStore.h" +#include "StoreGate/WriteCondHandleKey.h" +#include "StoreGate/WriteCondHandle.h" + +// for the conditions data +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" // Can't link against these --- they're in a component library. #include "../src/NewtonTrkDistanceFinder.cxx" @@ -78,6 +90,53 @@ void test1 (Trk::NewtonTrkDistanceFinder& tool) assertVec3D (pp.second, { -4.46622, 4.67974, -2.14596 }); } +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { + // find the path to the map file + std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); + assert ( !resolvedMapFile.empty() ); + // Do checks and extract root file to initialize the map + assert ( resolvedMapFile.find(".root") != std::string::npos ); + + std::unique_ptr<TFile> rootfile( std::make_unique<TFile>(resolvedMapFile.c_str(), "OLD") ); + assert ( rootfile ); + assert ( rootfile->cd() ); + // open the tree + TTree* tree = (TTree*)rootfile->Get("BFieldMap"); + assert(tree); + + // create map + std::unique_ptr<MagField::AtlasFieldMap> field_map=std::make_unique<MagField::AtlasFieldMap>(); + + // initialize map + assert (field_map->initializeMap( rootfile.get(), sol_current, tor_current )); + return field_map; + +} + +void createNewtonTrkDistanceFinderCondData(SGTest::TestStore &store) { + SG::WriteCondHandleKey<AtlasFieldCacheCondObj> fieldKey {"fieldCondObj"}; + assert( fieldKey.initialize().isSuccess()); + + // from StoreGate/test/WriteCondHandle_test.cxx + EventIDBase now(0, EventIDBase::UNDEFEVT, 1); + EventContext ctx(1, 1); + ctx.setEventID( now ); + ctx.setExtension( Atlas::ExtendedEventContext(&store) ); + Gaudi::Hive::setCurrentContext(ctx); + + EventIDBase s1_1(0, EventIDBase::UNDEFEVT, 0); + EventIDBase e1_1(0, EventIDBase::UNDEFEVT, 3); + EventIDRange r1_1 (s1_1,e1_1); + + + SG::WriteCondHandle<AtlasFieldCacheCondObj> fieldHandle {fieldKey}; + { + std::unique_ptr<MagField::AtlasFieldMap> fieldMap=getFieldMap("MagneticFieldMaps/bfieldmap_7730_20400_14m.root",7730,20400); + auto fieldCondObj = std::make_unique<AtlasFieldCacheCondObj>(); + assert( fieldCondObj->initialize(1. /*solenoid current scale factor*/, 1. /*toroid current scale factor*/, fieldMap.release())); + assert( fieldHandle.record(r1_1, std::move(fieldCondObj)).isSuccess()); + } +} int main() { @@ -85,9 +144,12 @@ int main() CxxUtils::ubsan_suppress ([]() { TInterpreter::Instance(); }); ISvcLocator* svcloc = nullptr; Athena_test::initGaudi ("TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt", svcloc); - ServiceHandle<MagField::IMagFieldSvc> field ("MagField::AtlasFieldSvc/AtlasFieldSvc", "test"); - Incident inc_br ("test", IncidentType::BeginRun); - dynamic_cast<IIncidentListener*>(&*field)->handle (inc_br); + + StoreGateSvc *cs=nullptr; + assert (svcloc->service("StoreGateSvc/ConditionStore",cs).isSuccess()); + + SGTest::TestStore dumstore; + createNewtonTrkDistanceFinderCondData(dumstore); ToolHandle<Trk::NewtonTrkDistanceFinder> tool ("Trk::NewtonTrkDistanceFinder"); assert( tool.retrieve().isSuccess() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SeedNewtonTrkDistanceFinder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SeedNewtonTrkDistanceFinder_test.cxx index 4a7c3253a5aa1761c6837194b8db912c12c03b02..9dc1a3a02cca42c9a5fb41386ce3b0a27d931989 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SeedNewtonTrkDistanceFinder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SeedNewtonTrkDistanceFinder_test.cxx @@ -11,19 +11,31 @@ #undef NDEBUG #include "TrkVertexSeedFinderUtils/ITrkDistanceFinder.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "TestTools/initGaudi.h" #include "TestTools/FLOATassert.h" #include "TestTools/expect_exception.h" #include "CxxUtils/ubsan_suppress.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Incident.h" -#include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/EventContext.h" #include "TInterpreter.h" #include <iostream> #include <cassert> #include <cmath> +// for the field map +#include "PathResolver/PathResolver.h" +#include "TFile.h" +#include "TTree.h" + +// for populating conditions store +#include "SGTools/TestStore.h" +#include "StoreGate/WriteCondHandleKey.h" +#include "StoreGate/WriteCondHandle.h" + +// for the conditions data +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" void assertVec3D (const Amg::Vector3D& a, const Amg::Vector3D& b) { @@ -85,6 +97,53 @@ void test1 (Trk::ITrkDistanceFinder& tool) assertVec3D (pp.second, { -4.46622, 4.67974, -2.14596 }); } +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { + // find the path to the map file + std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); + assert ( !resolvedMapFile.empty() ); + // Do checks and extract root file to initialize the map + assert ( resolvedMapFile.find(".root") != std::string::npos ); + + std::unique_ptr<TFile> rootfile( std::make_unique<TFile>(resolvedMapFile.c_str(), "OLD") ); + assert ( rootfile ); + assert ( rootfile->cd() ); + // open the tree + TTree* tree = (TTree*)rootfile->Get("BFieldMap"); + assert(tree); + + // create map + std::unique_ptr<MagField::AtlasFieldMap> field_map=std::make_unique<MagField::AtlasFieldMap>(); + + // initialize map + assert (field_map->initializeMap( rootfile.get(), sol_current, tor_current )); + return field_map; + +} + +void createNewtonTrkDistanceFinderCondData(SGTest::TestStore &store) { + SG::WriteCondHandleKey<AtlasFieldCacheCondObj> fieldKey {"fieldCondObj"}; + assert( fieldKey.initialize().isSuccess()); + + // from StoreGate/test/WriteCondHandle_test.cxx + EventIDBase now(0, EventIDBase::UNDEFEVT, 1); + EventContext ctx(1, 1); + ctx.setEventID( now ); + ctx.setExtension( Atlas::ExtendedEventContext(&store) ); + Gaudi::Hive::setCurrentContext(ctx); + + EventIDBase s1_1(0, EventIDBase::UNDEFEVT, 0); + EventIDBase e1_1(0, EventIDBase::UNDEFEVT, 3); + EventIDRange r1_1 (s1_1,e1_1); + + + SG::WriteCondHandle<AtlasFieldCacheCondObj> fieldHandle {fieldKey}; + { + std::unique_ptr<MagField::AtlasFieldMap> fieldMap=getFieldMap("MagneticFieldMaps/bfieldmap_7730_20400_14m.root",7730,20400); + auto fieldCondObj = std::make_unique<AtlasFieldCacheCondObj>(); + assert( fieldCondObj->initialize(1. /*solenoid current scale factor*/, 1. /*toroid current scale factor*/, fieldMap.release())); + assert( fieldHandle.record(r1_1, std::move(fieldCondObj)).isSuccess()); + } +} int main() { @@ -92,9 +151,12 @@ int main() CxxUtils::ubsan_suppress ([]() { TInterpreter::Instance(); }); ISvcLocator* svcloc = nullptr; Athena_test::initGaudi ("TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt", svcloc); - ServiceHandle<MagField::IMagFieldSvc> field ("MagField::AtlasFieldSvc/AtlasFieldSvc", "test"); - Incident inc_br ("test", IncidentType::BeginRun); - dynamic_cast<IIncidentListener*>(&*field)->handle (inc_br); + + StoreGateSvc *cs=nullptr; + assert (svcloc->service("StoreGateSvc/ConditionStore",cs).isSuccess()); + + SGTest::TestStore dumstore; + createNewtonTrkDistanceFinderCondData(dumstore); ToolHandle<Trk::ITrkDistanceFinder> tool ("Trk::SeedNewtonTrkDistanceFinder"); assert( tool.retrieve().isSuccess() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SimpleVertexClusterFinder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SimpleVertexClusterFinder_test.cxx index e967d55d16c1914affadc731a85689b2d7c005b2..c8a99749a08f027b89f8910a726b5409543aa7ad 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SimpleVertexClusterFinder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SimpleVertexClusterFinder_test.cxx @@ -19,8 +19,6 @@ #include "GaudiKernel/SystemOfUnits.h" #include "CxxUtils/ubsan_suppress.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Incident.h" -#include "GaudiKernel/IIncidentListener.h" #include "TInterpreter.h" #include <iostream> #include <cassert> diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2DDistanceFinder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2DDistanceFinder_test.cxx index 456cec13c4dd2438ee93a894a36f0e3ee4781ff6..e54dacaa979fe31c835b682f391b2b07998e770c 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2DDistanceFinder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2DDistanceFinder_test.cxx @@ -11,19 +11,31 @@ #undef NDEBUG #include "TrkVertexSeedFinderUtils/ITrkDistanceFinder.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "TestTools/initGaudi.h" #include "TestTools/FLOATassert.h" #include "TestTools/expect_exception.h" #include "CxxUtils/ubsan_suppress.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Incident.h" -#include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/EventContext.h" #include "TInterpreter.h" #include <iostream> #include <cassert> #include <cmath> +// for the field map +#include "PathResolver/PathResolver.h" +#include "TFile.h" +#include "TTree.h" + +// for populating conditions store +#include "SGTools/TestStore.h" +#include "StoreGate/WriteCondHandleKey.h" +#include "StoreGate/WriteCondHandle.h" + +// for the conditions data +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" std::ostream& printVec3D (const Amg::Vector3D& a) { @@ -92,6 +104,53 @@ void test1 (Trk::ITrkDistanceFinder& tool) assertVec3D (pp.second, { 12.501, 9.50104, 0 }); } +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { + // find the path to the map file + std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); + assert ( !resolvedMapFile.empty() ); + // Do checks and extract root file to initialize the map + assert ( resolvedMapFile.find(".root") != std::string::npos ); + + std::unique_ptr<TFile> rootfile( std::make_unique<TFile>(resolvedMapFile.c_str(), "OLD") ); + assert ( rootfile ); + assert ( rootfile->cd() ); + // open the tree + TTree* tree = (TTree*)rootfile->Get("BFieldMap"); + assert(tree); + + // create map + std::unique_ptr<MagField::AtlasFieldMap> field_map=std::make_unique<MagField::AtlasFieldMap>(); + + // initialize map + assert (field_map->initializeMap( rootfile.get(), sol_current, tor_current )); + return field_map; + +} + +void createNewtonTrkDistanceFinderCondData(SGTest::TestStore &store) { + SG::WriteCondHandleKey<AtlasFieldCacheCondObj> fieldKey {"fieldCondObj"}; + assert( fieldKey.initialize().isSuccess()); + + // from StoreGate/test/WriteCondHandle_test.cxx + EventIDBase now(0, EventIDBase::UNDEFEVT, 1); + EventContext ctx(1, 1); + ctx.setEventID( now ); + ctx.setExtension( Atlas::ExtendedEventContext(&store) ); + Gaudi::Hive::setCurrentContext(ctx); + + EventIDBase s1_1(0, EventIDBase::UNDEFEVT, 0); + EventIDBase e1_1(0, EventIDBase::UNDEFEVT, 3); + EventIDRange r1_1 (s1_1,e1_1); + + + SG::WriteCondHandle<AtlasFieldCacheCondObj> fieldHandle {fieldKey}; + { + std::unique_ptr<MagField::AtlasFieldMap> fieldMap=getFieldMap("MagneticFieldMaps/bfieldmap_7730_20400_14m.root",7730,20400); + auto fieldCondObj = std::make_unique<AtlasFieldCacheCondObj>(); + assert( fieldCondObj->initialize(1. /*solenoid current scale factor*/, 1. /*toroid current scale factor*/, fieldMap.release())); + assert( fieldHandle.record(r1_1, std::move(fieldCondObj)).isSuccess()); + } +} int main() { @@ -99,9 +158,12 @@ int main() CxxUtils::ubsan_suppress ([]() { TInterpreter::Instance(); }); ISvcLocator* svcloc = nullptr; Athena_test::initGaudi ("TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt", svcloc); - ServiceHandle<MagField::IMagFieldSvc> field ("MagField::AtlasFieldSvc/AtlasFieldSvc", "test"); - Incident inc_br ("test", IncidentType::BeginRun); - dynamic_cast<IIncidentListener*>(&*field)->handle (inc_br); + + StoreGateSvc *cs=nullptr; + assert (svcloc->service("StoreGateSvc/ConditionStore",cs).isSuccess()); + + SGTest::TestStore dumstore; + createNewtonTrkDistanceFinderCondData(dumstore); ToolHandle<Trk::ITrkDistanceFinder> tool ("Trk::Trk2DDistanceFinder"); assert( tool.retrieve().isSuccess() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2dDistanceSeeder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2dDistanceSeeder_test.cxx index d9214bcb13efad71e2ec21c5f1b84b4cdac12061..639fa14f6c5b74ea906665e046ac2e48241c2004 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2dDistanceSeeder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2dDistanceSeeder_test.cxx @@ -11,25 +11,36 @@ #undef NDEBUG #include "TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" #include "TestTools/initGaudi.h" #include "TestTools/FLOATassert.h" #include "TestTools/expect_exception.h" #include "CxxUtils/ubsan_suppress.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Incident.h" -#include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/EventContext.h" #include "TInterpreter.h" #include <iostream> #include <cassert> #include <cmath> - // Can't link against these --- they're in a component library. #include "../src/Trk2dDistanceSeeder.cxx" #include "../src/PointOnTrack.cxx" #include "../src/TwoTracks.cxx" +// for the field map +#include "PathResolver/PathResolver.h" +#include "TFile.h" +#include "TTree.h" + +// for populating conditions store +#include "SGTools/TestStore.h" +#include "StoreGate/WriteCondHandleKey.h" +#include "StoreGate/WriteCondHandle.h" + +// for the conditions data +#include "MagFieldConditions/AtlasFieldCacheCondObj.h" +#include "MagFieldElements/AtlasFieldCache.h" void assertVec3D (const Amg::Vector3D& a, const Amg::Vector3D& b) { @@ -111,6 +122,53 @@ void test1 (Trk::Trk2dDistanceSeeder& tool) #endif } +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { + // find the path to the map file + std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); + assert ( !resolvedMapFile.empty() ); + // Do checks and extract root file to initialize the map + assert ( resolvedMapFile.find(".root") != std::string::npos ); + + std::unique_ptr<TFile> rootfile( std::make_unique<TFile>(resolvedMapFile.c_str(), "OLD") ); + assert ( rootfile ); + assert ( rootfile->cd() ); + // open the tree + TTree* tree = (TTree*)rootfile->Get("BFieldMap"); + assert(tree); + + // create map + std::unique_ptr<MagField::AtlasFieldMap> field_map=std::make_unique<MagField::AtlasFieldMap>(); + + // initialize map + assert (field_map->initializeMap( rootfile.get(), sol_current, tor_current )); + return field_map; + +} + +void createNewtonTrkDistanceFinderCondData(SGTest::TestStore &store) { + SG::WriteCondHandleKey<AtlasFieldCacheCondObj> fieldKey {"fieldCondObj"}; + assert( fieldKey.initialize().isSuccess()); + + // from StoreGate/test/WriteCondHandle_test.cxx + EventIDBase now(0, EventIDBase::UNDEFEVT, 1); + EventContext ctx(1, 1); + ctx.setEventID( now ); + ctx.setExtension( Atlas::ExtendedEventContext(&store) ); + Gaudi::Hive::setCurrentContext(ctx); + + EventIDBase s1_1(0, EventIDBase::UNDEFEVT, 0); + EventIDBase e1_1(0, EventIDBase::UNDEFEVT, 3); + EventIDRange r1_1 (s1_1,e1_1); + + + SG::WriteCondHandle<AtlasFieldCacheCondObj> fieldHandle {fieldKey}; + { + std::unique_ptr<MagField::AtlasFieldMap> fieldMap=getFieldMap("MagneticFieldMaps/bfieldmap_7730_20400_14m.root",7730,20400); + auto fieldCondObj = std::make_unique<AtlasFieldCacheCondObj>(); + assert( fieldCondObj->initialize(1. /*solenoid current scale factor*/, 1. /*toroid current scale factor*/, fieldMap.release())); + assert( fieldHandle.record(r1_1, std::move(fieldCondObj)).isSuccess()); + } +} int main() { @@ -118,9 +176,12 @@ int main() CxxUtils::ubsan_suppress ([]() { TInterpreter::Instance(); }); ISvcLocator* svcloc = nullptr; Athena_test::initGaudi ("TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils_tests.txt", svcloc); - ServiceHandle<MagField::IMagFieldSvc> field ("MagField::AtlasFieldSvc/AtlasFieldSvc", "test"); - Incident inc_br ("test", IncidentType::BeginRun); - dynamic_cast<IIncidentListener*>(&*field)->handle (inc_br); + + StoreGateSvc *cs=nullptr; + assert (svcloc->service("StoreGateSvc/ConditionStore",cs).isSuccess()); + + SGTest::TestStore dumstore; + createNewtonTrkDistanceFinderCondData(dumstore); ToolHandle<Trk::Trk2dDistanceSeeder> tool ("Trk::Trk2dDistanceSeeder"); assert( tool.retrieve().isSuccess() );