From a6df09961a84d21042134c2667346eb30e42d068 Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Tue, 1 Sep 2020 00:24:23 +0800
Subject: [PATCH] Register the collection name of the Drift Chamber.

---
 Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp | 4 ++++
 Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h   | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
index 1efe317d..9ef16425 100644
--- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
+++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
@@ -56,6 +56,8 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
     auto ecalendcapringcol        = m_EcalEndcapRingCol.createAndPut();
     auto ecalendcapringcontribcol = m_EcalEndcapRingContributionCol.createAndPut();
 
+    auto driftchamberhitscol = m_DriftChamberHitsCol.createAndPut();
+
     // readout defined in DD4hep
     auto lcdd = &(dd4hep::Detector::getInstance());
     auto allReadouts = lcdd->readouts();
@@ -116,6 +118,8 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
         } else if (collect->GetName() == "EcalEndcapRingCollection") {
             calo_col_ptr = ecalendcapringcol;
             calo_contrib_col_ptr = ecalendcapringcontribcol;
+        } else if (collect->GetName() == "DriftChamberHitsCollection") {
+            tracker_col_ptr = driftchamberhitscol;
         } else {
             warning() << "Unknown collection name: " << collect->GetName()
                       << ". Please register in Edm4hepWriterAnaElemTool. " << endmsg;
diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
index 2e69d24e..17a9d518 100644
--- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
+++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
@@ -81,6 +81,13 @@ private:
             "EcalEndcapRingContributionCollection", 
             Gaudi::DataHandle::Writer, this};
 
+    // Drift Chamber
+    // - DriftChamberHitsCollection
+    DataHandle<edm4hep::SimTrackerHitCollection> m_DriftChamberHitsCol{
+            "DriftChamberHitsCollection", 
+            Gaudi::DataHandle::Writer, this};
+
+
 private:
     // in order to associate the hit contribution with the primary track,
     // we have a bookkeeping of every track.
-- 
GitLab