diff --git a/Simulation/DetSimAna/CMakeLists.txt b/Simulation/DetSimAna/CMakeLists.txt index 458772ae86508a07062e64a94d4afd4df8a2fc82..9ce9742255109c63a8b3f1898f0c4d945214dfe7 100644 --- a/Simulation/DetSimAna/CMakeLists.txt +++ b/Simulation/DetSimAna/CMakeLists.txt @@ -2,6 +2,7 @@ gaudi_subdir(DetSimAna v0r0) gaudi_depends_on_subdirs( + FWCore Simulation/DetSimInterface ) @@ -20,8 +21,8 @@ set(DetSimAna_srcs message("podio_LIBRARIES: ${podio_LIBRARIES}") message("plcio_LIBRARIES: ${plcio_LIBRARIES}") gaudi_add_module(DetSimAna ${DetSimAna_srcs} - INCLUDE_DIRS DetSimInterface DD4hep GaudiKernel Geant4 + INCLUDE_DIRS DetSimInterface FWCore DD4hep GaudiKernel Geant4 ${plcio_INCLUDE_DIRS} ${podio_INCLUDE_DIRS} - LINK_LIBRARIES DetSimInterface DD4hep ${DD4hep_COMPONENT_LIBRARIES} GaudiKernel Geant4 + LINK_LIBRARIES DetSimInterface FWCore DD4hep ${DD4hep_COMPONENT_LIBRARIES} GaudiKernel Geant4 ${plcio_LIBRARIES} ${podio_LIBRARIES} ) diff --git a/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp b/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp index 0b59081dcf0148be9aea5784f01cea89753845ba..518debacd9725d1a4f1e2665280f02d14f7de09e 100644 --- a/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp +++ b/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp @@ -33,6 +33,9 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { // save all data + // create collections. + auto trackercols = m_trackerCol.createAndPut(); + // readout defined in DD4hep auto lcdd = &(dd4hep::Detector::getInstance()); auto allReadouts = lcdd->readouts(); @@ -107,6 +110,9 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { dd4hep::sim::Geant4TrackerHit* trk_hit = dynamic_cast<dd4hep::sim::Geant4TrackerHit*>(h); if (trk_hit) { info() << " cast to dd4hep::sim::Geant4TrackerHit. " << endmsg; + + auto edm_trk_hit = trackercols->create(); + } dd4hep::sim::Geant4CalorimeterHit* cal_hit = dynamic_cast<dd4hep::sim::Geant4CalorimeterHit*>(h); diff --git a/Simulation/DetSimAna/src/ExampleAnaElemTool.h b/Simulation/DetSimAna/src/ExampleAnaElemTool.h index 01e6275effad184ba638a0d5d053c45738a164a0..156b604adc893d5e25987f1affdcd5e952184371 100644 --- a/Simulation/DetSimAna/src/ExampleAnaElemTool.h +++ b/Simulation/DetSimAna/src/ExampleAnaElemTool.h @@ -2,8 +2,11 @@ #define ExampleAnaElemTool_h #include "GaudiKernel/AlgTool.h" +#include "FWCore/DataHandle.h" #include "DetSimInterface/IAnaElemTool.h" +#include "plcio/SimTrackerHitCollection.h" + class ExampleAnaElemTool: public extends<AlgTool, IAnaElemTool> { public: @@ -31,6 +34,10 @@ public: StatusCode initialize() override; StatusCode finalize() override; +private: + DataHandle<plcio::SimTrackerHitCollection> m_trackerCol{"SimTrackerCol", + Gaudi::DataHandle::Writer, this}; + }; #endif