From 14dbc14ac838a246dcb8922acbfe8fa253687d3b Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Tue, 22 Dec 2020 09:46:39 +0800
Subject: [PATCH] WIP: register HCal simulation output.

---
 .../DetSimAna/src/Edm4hepWriterAnaElemTool.cpp  | 16 ++++++++++++++++
 .../DetSimAna/src/Edm4hepWriterAnaElemTool.h    | 17 +++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
index a9d739a6..951ff463 100644
--- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
+++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp
@@ -59,6 +59,13 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
     auto ecalendcapringcol        = m_EcalEndcapRingCol.createAndPut();
     auto ecalendcapringcontribcol = m_EcalEndcapRingContributionCol.createAndPut();
 
+    auto hcalbarrelcol            = m_HcalBarrelCol.createAndPut();
+    auto hcalbarrelcontribcols    = m_HcalBarrelContributionCol.createAndPut();
+    auto hcalendcapscol           = m_HcalEndcapsCol.createAndPut();
+    auto hcalendcapscontribcols   = m_HcalEndcapsContributionCol.createAndPut();
+    auto hcalendcapringcol        = m_HcalEndcapRingCol.createAndPut();
+    auto hcalendcapringcontribcol = m_HcalEndcapRingContributionCol.createAndPut();
+
     auto driftchamberhitscol = m_DriftChamberHitsCol.createAndPut();
 
     // readout defined in DD4hep
@@ -121,6 +128,15 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) {
         } else if (collect->GetName() == "EcalEndcapRingCollection") {
             calo_col_ptr = ecalendcapringcol;
             calo_contrib_col_ptr = ecalendcapringcontribcol;
+        } else if (collect->GetName() == "HcalBarrelCollection") {
+            calo_col_ptr = hcalbarrelcol;
+            calo_contrib_col_ptr = hcalbarrelcontribcols;
+        } else if (collect->GetName() == "HcalEndcapsCollection") {
+            calo_col_ptr = hcalendcapscol;
+            calo_contrib_col_ptr = hcalendcapscontribcols;
+        } else if (collect->GetName() == "HcalEndcapRingCollection") {
+            calo_col_ptr = hcalendcapringcol;
+            calo_contrib_col_ptr = hcalendcapringcontribcol;
         } else if (collect->GetName() == "DriftChamberHitsCollection") {
             tracker_col_ptr = driftchamberhitscol;
         } else {
diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
index 746c2a4b..bd71f932 100644
--- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
+++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h
@@ -81,6 +81,23 @@ private:
             "EcalEndcapRingContributionCollection", 
             Gaudi::DataHandle::Writer, this};
 
+    // Hcal
+    DataHandle<edm4hep::SimCalorimeterHitCollection> m_HcalBarrelCol{"HcalBarrelCollection", 
+            Gaudi::DataHandle::Writer, this};
+    DataHandle<edm4hep::CaloHitContributionCollection> m_HcalBarrelContributionCol{
+            "HcalBarrelContributionCollection", 
+            Gaudi::DataHandle::Writer, this};
+    DataHandle<edm4hep::SimCalorimeterHitCollection> m_HcalEndcapsCol{"HcalEndcapsCollection", 
+            Gaudi::DataHandle::Writer, this};
+    DataHandle<edm4hep::CaloHitContributionCollection> m_HcalEndcapsContributionCol{
+            "HcalEndcapsContributionCollection", 
+            Gaudi::DataHandle::Writer, this};
+    DataHandle<edm4hep::SimCalorimeterHitCollection> m_HcalEndcapRingCol{"HcalEndcapRingCollection", 
+            Gaudi::DataHandle::Writer, this};
+    DataHandle<edm4hep::CaloHitContributionCollection> m_HcalEndcapRingContributionCol{
+            "HcalEndcapRingContributionCollection", 
+            Gaudi::DataHandle::Writer, this};
+
     // Drift Chamber
     // - DriftChamberHitsCollection
     DataHandle<edm4hep::SimTrackerHitCollection> m_DriftChamberHitsCol{
-- 
GitLab