Skip to content
Snippets Groups Projects
Commit 7a855d4e authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: Create sim tracker collections.

parent e423b1d7
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
gaudi_subdir(DetSimAna v0r0) gaudi_subdir(DetSimAna v0r0)
gaudi_depends_on_subdirs( gaudi_depends_on_subdirs(
FWCore
Simulation/DetSimInterface Simulation/DetSimInterface
) )
...@@ -20,8 +21,8 @@ set(DetSimAna_srcs ...@@ -20,8 +21,8 @@ set(DetSimAna_srcs
message("podio_LIBRARIES: ${podio_LIBRARIES}") message("podio_LIBRARIES: ${podio_LIBRARIES}")
message("plcio_LIBRARIES: ${plcio_LIBRARIES}") message("plcio_LIBRARIES: ${plcio_LIBRARIES}")
gaudi_add_module(DetSimAna ${DetSimAna_srcs} 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} ${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} ${plcio_LIBRARIES} ${podio_LIBRARIES}
) )
...@@ -33,6 +33,9 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { ...@@ -33,6 +33,9 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
// save all data // save all data
// create collections.
auto trackercols = m_trackerCol.createAndPut();
// readout defined in DD4hep // readout defined in DD4hep
auto lcdd = &(dd4hep::Detector::getInstance()); auto lcdd = &(dd4hep::Detector::getInstance());
auto allReadouts = lcdd->readouts(); auto allReadouts = lcdd->readouts();
...@@ -107,6 +110,9 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { ...@@ -107,6 +110,9 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
dd4hep::sim::Geant4TrackerHit* trk_hit = dynamic_cast<dd4hep::sim::Geant4TrackerHit*>(h); dd4hep::sim::Geant4TrackerHit* trk_hit = dynamic_cast<dd4hep::sim::Geant4TrackerHit*>(h);
if (trk_hit) { if (trk_hit) {
info() << " cast to dd4hep::sim::Geant4TrackerHit. " << endmsg; info() << " cast to dd4hep::sim::Geant4TrackerHit. " << endmsg;
auto edm_trk_hit = trackercols->create();
} }
dd4hep::sim::Geant4CalorimeterHit* cal_hit = dynamic_cast<dd4hep::sim::Geant4CalorimeterHit*>(h); dd4hep::sim::Geant4CalorimeterHit* cal_hit = dynamic_cast<dd4hep::sim::Geant4CalorimeterHit*>(h);
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
#define ExampleAnaElemTool_h #define ExampleAnaElemTool_h
#include "GaudiKernel/AlgTool.h" #include "GaudiKernel/AlgTool.h"
#include "FWCore/DataHandle.h"
#include "DetSimInterface/IAnaElemTool.h" #include "DetSimInterface/IAnaElemTool.h"
#include "plcio/SimTrackerHitCollection.h"
class ExampleAnaElemTool: public extends<AlgTool, IAnaElemTool> { class ExampleAnaElemTool: public extends<AlgTool, IAnaElemTool> {
public: public:
...@@ -31,6 +34,10 @@ public: ...@@ -31,6 +34,10 @@ public:
StatusCode initialize() override; StatusCode initialize() override;
StatusCode finalize() override; StatusCode finalize() override;
private:
DataHandle<plcio::SimTrackerHitCollection> m_trackerCol{"SimTrackerCol",
Gaudi::DataHandle::Writer, this};
}; };
#endif #endif
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