diff --git a/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp b/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp index 73f96378713ebc2b8291432b61be165f31cf671a..b6040adf87b2ba7389a5c5d877048d8fd39dfe4f 100644 --- a/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp +++ b/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp @@ -35,6 +35,7 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { // create collections. auto trackercols = m_trackerCol.createAndPut(); + auto vxdcols = m_VXDCol.createAndPut(); // readout defined in DD4hep auto lcdd = &(dd4hep::Detector::getInstance()); @@ -111,7 +112,17 @@ ExampleAnaElemTool::EndOfEventAction(const G4Event* anEvent) { if (trk_hit) { info() << " cast to dd4hep::sim::Geant4TrackerHit. " << endmsg; - auto edm_trk_hit = trackercols->create(); + plcio::SimTrackerHitCollection* colptr = nullptr; + + if (collect->GetName() == "VXDCollection") { + colptr = vxdcols; + } else { + colptr = trackercols; + } + + // auto edm_trk_hit = trackercols->create(); + auto edm_trk_hit = (*colptr)->create(); + // Refer to: ./DDG4/lcio/LCIOConversions.cpp edm_trk_hit->setCellID0((trk_hit->cellID >> 0 ) & 0xFFFFFFFF); edm_trk_hit->setCellID1((trk_hit->cellID >> sizeof(int)*8) & 0xFFFFFFFF); diff --git a/Simulation/DetSimAna/src/ExampleAnaElemTool.h b/Simulation/DetSimAna/src/ExampleAnaElemTool.h index 156b604adc893d5e25987f1affdcd5e952184371..4428d777e34b4051934b1d3542e86069fc14944a 100644 --- a/Simulation/DetSimAna/src/ExampleAnaElemTool.h +++ b/Simulation/DetSimAna/src/ExampleAnaElemTool.h @@ -37,6 +37,8 @@ public: private: DataHandle<plcio::SimTrackerHitCollection> m_trackerCol{"SimTrackerCol", Gaudi::DataHandle::Writer, this}; + DataHandle<plcio::SimTrackerHitCollection> m_VXDCol{"VXDCollection", + Gaudi::DataHandle::Writer, this}; };