From 0dba7d39be1c8154078b0e075a6ecae2188af71f Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Tue, 26 Jun 2018 20:07:57 +0200
Subject: [PATCH] Elaborate a bit more the DDG4_MySensDet example and fix the
 persistency of the Geant4 hits

---
 examples/DDCodex/src/CODEXb_geo.cpp | 32 ++++++++++++++---------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/examples/DDCodex/src/CODEXb_geo.cpp b/examples/DDCodex/src/CODEXb_geo.cpp
index 7e104a07d..6c0cb0c30 100644
--- a/examples/DDCodex/src/CODEXb_geo.cpp
+++ b/examples/DDCodex/src/CODEXb_geo.cpp
@@ -52,19 +52,19 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens)  {
 
   int num_sensitive = 0;
   for(xml_coll_t i(x_det,_U(shield)); i; ++i)  {
-    xml_comp_t s = i;
-    double     z  = s.z(), dz = s.dz();
+    xml_comp_t shield = i;
+    double     z  = shield.z(), dz = shield.dz();
     double     r1 = sin_cone*z, r2 = sin_cone*(z+dz);
-    string     nam = s.nameStr();
+    string     nam = shield.nameStr();
     Cone       con(dz/2., 0., r1, 0., r2);
-    Material   mat(description.material(s.attr<string>(_U(material))));
+    Material   mat(description.material(shield.attr<string>(_U(material))));
     Volume     vol(nam,con,mat);
 
     printout(INFO,"CODEX-b","%s Shield: %-12s %-12s z=%7g dz=%7g r1=%7g r2=%7g",
              det_name.c_str(), vol.name(), ('['+string(mat.name())+']').c_str(), z, dz, r1, r2);
-    vol.setVisAttributes(description, s.visStr());
+    vol.setVisAttributes(description, shield.visStr());
     pv = env_vol.placeVolume(vol, Position(0,0,-env_dz+z+dz/2.0));
-    if ( s.isSensitive() )   {
+    if ( shield.isSensitive() )   {
       DetElement det(sdet, "shield_"+nam, x_det.id());
       pv.addPhysVolID("type", 0);
       pv.addPhysVolID("module", num_sensitive);
@@ -76,25 +76,25 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens)  {
   int type_num = 0, station_number = 0;
   double z0 = 0.0, x0 = 0.0, x_tot = 0.0;
   for(xml_coll_t i(x_det,_U(station)); i; ++i, ++type_num)  {
-    xml_comp_t s = i;
-    x_tot += double(s.repeat())*(s.distance()+s.thickness());
+    xml_comp_t station = i;
+    x_tot += double(station.repeat())*(station.distance()+station.thickness());
   }
   printout(INFO,"CODEX-b","%s X_tot= %g",det_name.c_str(), x_tot);
   for(xml_coll_t i(x_det,_U(station)); i; ++i, ++type_num)  {
-    xml_comp_t s = i;
-    int        repeat = s.repeat();
+    xml_comp_t station = i;
+    int        repeat = station.repeat();
     string     nam = _toString(station_number,"CODEX_station_type%d");
-    Box        box(s.width()/2., s.height()/2., s.thickness()/2.);
-    Material   mat(description.material(s.attr<string>(_U(material))));
+    Box        box(station.width()/2., station.height()/2., station.thickness()/2.);
+    Material   mat(description.material(station.attr<string>(_U(material))));
     Volume     vol(nam,box,mat);
-    double     dist = s.thickness()+s.distance();
+    double     dist = station.thickness()+station.distance();
     double     dx = dist/sin_beam;
     double     dz = dist/cos_beam;
-    if ( s.hasAttr(_U(z)) ) {
-      z0 = s.z()+x_tot/2.0/cos_beam;
+    if ( station.hasAttr(_U(z)) ) {
+      z0 = station.z()+x_tot/2.0/cos_beam;
       x0 = -x_tot/2.0/sin_beam;
     }    
-    vol.setVisAttributes(description, s.visStr());
+    vol.setVisAttributes(description, station.visStr());
     for(int j=0; j < repeat; ++j)    {
       DetElement det(sdet, _toString(station_number,"module%d"), station_number);
       pv = env_vol.placeVolume(vol, Transform3D(RotationZYX(0,M_PI/2.0-env_angle,0), Position(x0,0,z0)));
-- 
GitLab