From a05da0b57a96b0510965cf6840d33cf385c99521 Mon Sep 17 00:00:00 2001
From: "jihee.kim" <jihee.kim@anl.gov>
Date: Thu, 25 Mar 2021 22:41:39 -0500
Subject: [PATCH] Created ZDC source file and added read in parameters

---
 src/ffi_ZDC.cpp | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 src/ffi_ZDC.cpp

diff --git a/src/ffi_ZDC.cpp b/src/ffi_ZDC.cpp
new file mode 100644
index 0000000..7e78893
--- /dev/null
+++ b/src/ffi_ZDC.cpp
@@ -0,0 +1,39 @@
+#include <XML/Helper.h>
+///////////////////////////////////////////
+// Far Forward Ion Zero Degree Calorimeter
+///////////////////////////////////////////
+
+using namespace std;
+using namespace dd4hep;
+
+static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens)
+{
+  xml_det_t x_det     = e;
+  string    detName   = x_det.nameStr();
+  int       detID     = x_det.id();
+
+  xml_dim_t dim       = x_det.dimensions();
+  double    Width     = dim.x();
+  double    Thickness = dim.z();
+  
+  xml_dim_t pos       = x_det.position();
+  double    x_pos     = dd4hep::getAttrOrDefault(pos, _Unicode(x),0.0);
+  double    z_pos     = dd4hep::getAttrOrDefault(pos, _Unicode(z),0.0);
+
+  xml_dim_t rot       = x_det.rotation();
+  double    x_rot     = dd4hep::getAttrOrDefault(rot, _Unicode(x),0.0);
+  double    y_rot     = dd4hep::getAttrOrDefault(rot, _Unicode(y),0.0);
+  double    z_rot     = dd4hep::getAttrOrDefault(rot, _Unicode(z),0.0);
+
+
+
+
+  DetElement   det(detName, detID);
+  Volume       motherVol = desc.pickMotherVolume(det);
+  Transform3D  tr(RotationZYX(0., 0., 0.), Position(0., 0., 0.));
+  PlacedVolume detPV = motherVol.placeVolume(detVol, tr);
+  det.setPlacement(detPV);
+  return det;
+}
+
+DECLARE_DETELEMENT(ffi_ZDC, createDetector)
-- 
GitLab