From a2eb0fa7dedbe42a7fdb04a036185d8625b70c4d Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Wed, 6 May 2020 17:48:23 +0800
Subject: [PATCH] WIP: put the dim into xml file.

---
 Detector/DetEcalMatrix/compact/det.xml                | 3 ++-
 Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Detector/DetEcalMatrix/compact/det.xml b/Detector/DetEcalMatrix/compact/det.xml
index ef4c0ed9..fb39af73 100644
--- a/Detector/DetEcalMatrix/compact/det.xml
+++ b/Detector/DetEcalMatrix/compact/det.xml
@@ -32,7 +32,8 @@
 
   <detectors>
     <detector id="1" name="CaloDetector" type="EcalMatrix" readout="CaloHitsCollection" vis="VisibleGreen" sensitive="true">
-      <position x="0"  y="0"  z="1800*mm"/>
+      <position x="0"  y="0"  z="1835*mm+30*cm"/>
+      <dimensions dx="30*cm"  dy="30*cm"  dz="30*cm"/>
     </detector>
   </detectors>
   
diff --git a/Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp b/Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp
index 08698506..274330ba 100644
--- a/Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp
+++ b/Detector/DetEcalMatrix/src/calorimeter/EcalMatrix.cpp
@@ -27,6 +27,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector,
     MYDEBUGVAL(det_name);
     MYDEBUGVAL(det_type);
     xml_dim_t   pos    (x_det.child(_U(position)));
+    xml_dim_t   dim    (x_det.child(_U(dimensions)));
 
 
     dd4hep::DetElement sdet(det_name, x_det.id());
@@ -34,7 +35,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector,
     dd4hep::Volume motherVol = theDetector.pickMotherVolume(sdet);
 
     dd4hep::Material det_mat(theDetector.material("G4_BGO"));
-    dd4hep::Volume det_vol(det_name+"_vol", dd4hep::Box(60, 60, 60), det_mat);
+    dd4hep::Volume det_vol(det_name+"_vol", dd4hep::Box(dim.dx(), dim.dy(), dim.dz()), det_mat);
 
     dd4hep::Transform3D transform(dd4hep::Rotation3D(),
                                   dd4hep::Position(pos.x(),pos.y(),pos.z()));
-- 
GitLab