Skip to content
Snippets Groups Projects
Commit a599bfc6 authored by Robert Langenberg's avatar Robert Langenberg
Browse files

testAlg now uses dumper to dump both TGSvc and TGCondAlg geometries

parent 01cd7237
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ class ConfiguredTrackingGeometryCondAlg( Trk__TrackingGeometryCondAlg ) : ...@@ -43,7 +43,7 @@ class ConfiguredTrackingGeometryCondAlg( Trk__TrackingGeometryCondAlg ) :
# the geometry builder alg tool # the geometry builder alg tool
from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__GeometryBuilderCond from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__GeometryBuilderCond
AtlasGeometryBuilder = Trk__GeometryBuilderCond(name = 'AtlasGeometryBuilder') AtlasGeometryBuilder = Trk__GeometryBuilderCond(name = 'AtlasGeometryBuilderCond')
# switch the building outputlevel on # switch the building outputlevel on
AtlasGeometryBuilder.OutputLevel = TrkDetFlags.ConfigurationOutputLevel() AtlasGeometryBuilder.OutputLevel = TrkDetFlags.ConfigurationOutputLevel()
...@@ -67,7 +67,7 @@ class ConfiguredTrackingGeometryCondAlg( Trk__TrackingGeometryCondAlg ) : ...@@ -67,7 +67,7 @@ class ConfiguredTrackingGeometryCondAlg( Trk__TrackingGeometryCondAlg ) :
from InDetTrackingGeometry.ConfiguredInDetTrackingGeometryBuilderCond import ConfiguredInDetTrackingGeometryBuilderCond as IDGeometryBuilder from InDetTrackingGeometry.ConfiguredInDetTrackingGeometryBuilderCond import ConfiguredInDetTrackingGeometryBuilderCond as IDGeometryBuilder
else: else:
from InDetTrackingGeometry.ConfiguredStagedTrackingGeometryBuilderCond import ConfiguredStagedTrackingGeometryBuilderCond as IDGeometryBuilder from InDetTrackingGeometry.ConfiguredStagedTrackingGeometryBuilderCond import ConfiguredStagedTrackingGeometryBuilderCond as IDGeometryBuilder
InDetTrackingGeometryBuilder = IDGeometryBuilder(name ='InDetTrackingGeometryBuilder') InDetTrackingGeometryBuilder = IDGeometryBuilder(name ='InDetTrackingGeometryBuilderCond')
InDetTrackingGeometryBuilder.EnvelopeDefinitionSvc = AtlasEnvelopeSvc InDetTrackingGeometryBuilder.EnvelopeDefinitionSvc = AtlasEnvelopeSvc
InDetTrackingGeometryBuilder.OutputLevel = TrkDetFlags.InDetBuildingOutputLevel() InDetTrackingGeometryBuilder.OutputLevel = TrkDetFlags.InDetBuildingOutputLevel()
...@@ -82,7 +82,7 @@ class ConfiguredTrackingGeometryCondAlg( Trk__TrackingGeometryCondAlg ) : ...@@ -82,7 +82,7 @@ class ConfiguredTrackingGeometryCondAlg( Trk__TrackingGeometryCondAlg ) :
ToolSvc += CaloVolumeCreator ToolSvc += CaloVolumeCreator
from CaloTrackingGeometry.ConfiguredCaloTrackingGeometryBuilderCond import ConfiguredCaloTrackingGeometryBuilderCond as ConfiguredCaloGeo from CaloTrackingGeometry.ConfiguredCaloTrackingGeometryBuilderCond import ConfiguredCaloTrackingGeometryBuilderCond as ConfiguredCaloGeo
CaloTrackingGeometryBuilder = ConfiguredCaloGeo(name='CaloTrackingGeometryBuilder'); CaloTrackingGeometryBuilder = ConfiguredCaloGeo(name='CaloTrackingGeometryBuilderCond');
CaloTrackingGeometryBuilder.TrackingVolumeCreator = CaloVolumeCreator CaloTrackingGeometryBuilder.TrackingVolumeCreator = CaloVolumeCreator
CaloTrackingGeometryBuilder.EnvelopeDefinitionSvc = AtlasEnvelopeSvc CaloTrackingGeometryBuilder.EnvelopeDefinitionSvc = AtlasEnvelopeSvc
CaloTrackingGeometryBuilder.OutputLevel = TrkDetFlags.CaloBuildingOutputLevel() CaloTrackingGeometryBuilder.OutputLevel = TrkDetFlags.CaloBuildingOutputLevel()
......
...@@ -2,14 +2,15 @@ ...@@ -2,14 +2,15 @@
* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#ifndef TRACKINGGEOMETRYCONDALG_H #ifndef TRACKINGGEOMETRYCONDALGTEST_H
#define TRACKINGGEOMETRYCONDALG_H #define TRACKINGGEOMETRYCONDALGTEST_H
#include "AthenaBaseComps/AthAlgorithm.h" #include "AthenaBaseComps/AthAlgorithm.h"
#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "PersistentDataModel/AthenaAttributeList.h" #include "PersistentDataModel/AthenaAttributeList.h"
#include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h" #include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ServiceHandle.h"
#include "TrkGeometry/TrackingGeometry.h" #include "TrkGeometry/TrackingGeometry.h"
#include "TrkDetDescrInterfaces/IGeometryBuilder.h" #include "TrkDetDescrInterfaces/IGeometryBuilder.h"
...@@ -18,8 +19,11 @@ ...@@ -18,8 +19,11 @@
#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ToolHandle.h"
#include "AthenaKernel/CLASS_DEF.h" #include "AthenaKernel/CLASS_DEF.h"
#include "TrkDetDescrInterfaces/ITrackingGeometrySvc.h"
namespace Trk{ namespace Trk{
class TrackingGeometryCondAlgTest : public AthReentrantAlgorithm class TrackingGeometryCondAlgTest : public AthReentrantAlgorithm
{ {
public: public:
...@@ -27,14 +31,17 @@ public: ...@@ -27,14 +31,17 @@ public:
virtual ~TrackingGeometryCondAlgTest() override = default; virtual ~TrackingGeometryCondAlgTest() override = default;
virtual StatusCode initialize() override; virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx)const override; virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode finalize() override {return StatusCode::SUCCESS;} virtual StatusCode finalize() override {return StatusCode::SUCCESS;}
private: private:
/// Input conditions object. /// Input conditions object.
SG::ReadCondHandleKey<TrackingGeometry> m_trackingGeometryReadKey{this, "TrackingGeometryReadKey", "AlignedTrackingGeometry", "Key of input TrackingGeometry"}; SG::ReadCondHandleKey<TrackingGeometry> m_trackingGeometryReadKey{this, "TrackingGeometryReadKey", "AlignedTrackingGeometry", "Key of input TrackingGeometry"};
mutable std::vector<Amg::Vector3D> m_worldVolumeCenterCollection; mutable const TrackingGeometry* m_trackingGeometry; //!< the tracking geometry
ServiceHandle<Trk::ITrackingGeometrySvc> m_trackingGeometrySvc; //!< ToolHandle to the TrackingGeometrySvc
ToolHandleArray<Trk::IGeometryProcessor> m_trackingGeometryProcessors; //!< Tool to write out a Display format for external viewers
}; };
} }
#endif //TRACKINGGEOMETRYCONDALG_H #endif //TRACKINGGEOMETRYCONDALGTEST_H
...@@ -62,6 +62,8 @@ TrkDetFlags.TRT_BuildingOutputLevel = VERBOSE ...@@ -62,6 +62,8 @@ TrkDetFlags.TRT_BuildingOutputLevel = VERBOSE
TrkDetFlags.InDetBuildingOutputLevel = VERBOSE TrkDetFlags.InDetBuildingOutputLevel = VERBOSE
TrkDetFlags.ConfigurationOutputLevel = VERBOSE TrkDetFlags.ConfigurationOutputLevel = VERBOSE
from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc
# load the tracking geometry cond alg # load the tracking geometry cond alg
from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlg import ConfiguredTrackingGeometryCondAlg from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlg import ConfiguredTrackingGeometryCondAlg
...@@ -70,8 +72,16 @@ from AthenaCommon.AlgSequence import AthSequencer ...@@ -70,8 +72,16 @@ from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq") condSeq = AthSequencer("AthCondSeq")
condSeq+= TrkGeoCondAlg condSeq+= TrkGeoCondAlg
# ----------------------
from TrkDetDescrTestTools.TrkDetDescrTestToolsConf import Trk__GeometryAsciiDumper
GeometryAsciiDumper = Trk__GeometryAsciiDumper(name= 'GeometryAsciiDumper')
ToolSvc += GeometryAsciiDumper
GeometryProcessors = [ GeometryAsciiDumper ]
from TrkCondTest.TrackingGeometryCondAlgTestConf import Trk__TrackingGeometryCondAlgTest from TrkCondTest.TrackingGeometryCondAlgTestConf import Trk__TrackingGeometryCondAlgTest
TrkGeomCondAlgTest = Trk__TrackingGeometryCondAlgTest(name = "TrkGeomTest") TrkGeomCondAlgTest = Trk__TrackingGeometryCondAlgTest(name = "TrkGeomTest")
TrkGeomCondAlgTest.GeometryProcessors = GeometryProcessors
job += TrkGeomCondAlgTest job += TrkGeomCondAlgTest
#-------------------------------------------------------------- #--------------------------------------------------------------
...@@ -88,7 +98,8 @@ job += TrkGeomCondAlgTest ...@@ -88,7 +98,8 @@ job += TrkGeomCondAlgTest
# Event related parameters # Event related parameters
#-------------------------------------------------------------- #--------------------------------------------------------------
theApp.EvtMax = 22
theApp.EvtMax = 2
from AthenaCommon.AppMgr import ServiceMgr from AthenaCommon.AppMgr import ServiceMgr
# output level # output level
......
...@@ -2,15 +2,22 @@ ...@@ -2,15 +2,22 @@
* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
// Trk includes #include "GaudiKernel/ISvcLocator.h"
#include "AthenaKernel/IOVSvcDefs.h" #include "AthenaKernel/IOVSvcDefs.h"
// Trk includes
#include "TrkCondTest/TrackingGeometryCondAlgTest.h" #include "TrkCondTest/TrackingGeometryCondAlgTest.h"
#include "TrkGeometry/Layer.h"
Trk::TrackingGeometryCondAlgTest::TrackingGeometryCondAlgTest(const std::string& name, ISvcLocator* pSvcLocator) Trk::TrackingGeometryCondAlgTest::TrackingGeometryCondAlgTest(const std::string& name, ISvcLocator* pSvcLocator)
: AthReentrantAlgorithm(name, pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator),
m_trackingGeometry(nullptr),
m_trackingGeometrySvc("AtlasTrackingGeometrySvc", name),
m_trackingGeometryProcessors()
{ {
declareProperty("GeometryProcessors", m_trackingGeometryProcessors);
} }
StatusCode Trk::TrackingGeometryCondAlgTest::initialize() StatusCode Trk::TrackingGeometryCondAlgTest::initialize()
...@@ -20,6 +27,19 @@ StatusCode Trk::TrackingGeometryCondAlgTest::initialize() ...@@ -20,6 +27,19 @@ StatusCode Trk::TrackingGeometryCondAlgTest::initialize()
// Read Handle Key // Read Handle Key
ATH_CHECK(m_trackingGeometryReadKey.initialize()); ATH_CHECK(m_trackingGeometryReadKey.initialize());
if (m_trackingGeometrySvc.retrieve().isSuccess()) {
ATH_MSG_INFO("Successfully retrieved " << m_trackingGeometrySvc);
} else {
ATH_MSG_WARNING("Couldn't retrieve " << m_trackingGeometrySvc << ". ");
return StatusCode::FAILURE;
}
if ((m_trackingGeometryProcessors.retrieve()).isFailure()) {
ATH_MSG_FATAL( "Failed to retrieve tool(s) in " << m_trackingGeometryProcessors );
return StatusCode::FAILURE;
} else{
ATH_MSG_INFO( "Retrieved tools : " << m_trackingGeometryProcessors );
}
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -33,15 +53,34 @@ StatusCode Trk::TrackingGeometryCondAlgTest::execute(const EventContext& ctx) co ...@@ -33,15 +53,34 @@ StatusCode Trk::TrackingGeometryCondAlgTest::execute(const EventContext& ctx) co
} }
const Trk::TrackingGeometry* trkGeom = *readHandle; const Trk::TrackingGeometry* trkGeom = *readHandle;
ATH_MSG_INFO( "eventID: " << ctx.eventID()); ATH_MSG_INFO( "eventID: " << ctx.eventID());
m_trackingGeometry = m_trackingGeometrySvc->trackingGeometry();
if( m_trackingGeometry == nullptr){
std::cout << "TRACKING GEOMETRY NOT FOUND IN SVC" << std::endl;
return StatusCode::FAILURE;
}
Amg::Vector3D center = trkGeom->highestTrackingVolume()->center(); for (ToolHandle<Trk::IGeometryProcessor> proc : m_trackingGeometryProcessors) {
ATH_MSG_INFO("Center coordinates of highest tracking volume"); std::cout << "PRINT SVC TG" << std::endl;
ATH_MSG_INFO(center); if(proc->process(*m_trackingGeometry).isFailure()){
if(m_worldVolumeCenterCollection.size()>=1 && m_worldVolumeCenterCollection.back() != center){ ATH_MSG_FATAL("Could not process the TrackingGeometry from SVC");
ATH_MSG_INFO("hooray, we have moved the world"); return StatusCode::FAILURE;
}
std::cout << "PRINT COND TG" << std::endl;
if(proc->process(*trkGeom).isFailure()){
ATH_MSG_FATAL("Could not process the TrackingGeometry from CONDALG");
return StatusCode::FAILURE;
}
} }
m_worldVolumeCenterCollection.push_back(center);
ATH_MSG_INFO("TrackingGeometry retrieved"); // const std::vector<const Trk::Layer*>* layersCond = trkGeom->highestTrackingVolume()->confinedArbitraryLayers();
// const std::vector<const Trk::Layer*>* layersSvc = m_trackingGeometry->highestTrackingVolume()->confinedArbitraryLayers();
// std::cout << "Layers in highestTrackingVolume from condAlg and svc:" << std::endl;
// if(layersCond != nullptr){
// for (size_t i = 0; i<layersCond->size(); i++){
// std::cout << "Layer subsurface from CondAlg at 0,0:" << std::endl<< layersCond->at(i)->subSurface(Amg::Vector2D(0.,0.)) << std::endl;
// std::cout << "Layer subsurface from Svc at 0,0:" << std::endl<< layersSvc->at(i)->subSurface(Amg::Vector2D(0.,0.)) << std::endl;
// }
// }
// ATH_MSG_INFO("TrackingGeometry retrieved");
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment