From d1ee9f93407f31288e39524ce594d34c03e4aa56 Mon Sep 17 00:00:00 2001
From: Markus Frank <markus.frank@cern.ch>
Date: Mon, 3 Jun 2013 11:07:58 +0000
Subject: [PATCH] Fix problems with invalid volume ids

---
 DDExamples/ILDExDet/src/ILDExTPC.cpp                     | 2 +-
 DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp         | 2 +-
 DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp         | 2 +-
 DDExamples/ILDExDet/src/compact/LP1_geo.cpp              | 2 +-
 DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp     | 2 +-
 DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp  | 2 +-
 DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp | 4 ++--
 DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp    | 2 +-
 DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp  | 6 +++---
 DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp      | 2 +-
 DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp     | 2 +-
 11 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/DDExamples/ILDExDet/src/ILDExTPC.cpp b/DDExamples/ILDExDet/src/ILDExTPC.cpp
index 8651d0c10..7d5a996cc 100644
--- a/DDExamples/ILDExDet/src/ILDExTPC.cpp
+++ b/DDExamples/ILDExDet/src/ILDExTPC.cpp
@@ -10,7 +10,7 @@ namespace DD4hep {
   
   ILDExTPC::ILDExTPC(const string& name, const string& type, int id)
   {
-    Value<TNamed,TPCData>* p = new Value<TNamed,TPCData>();
+    TPCData* p = new TPCData();
     assign(p,name, type);
     p->id = id;
   }
diff --git a/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp b/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp
index e47c62167..0731a058e 100644
--- a/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/ILDExTPC_geo.cpp
@@ -24,7 +24,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens)  {
   string      name  = x_det.nameStr();
   Material    mat    (lcdd.material(x_det.materialStr()));
   //if data is needed do this
-  Value<TNamed,TPCData>* tpcData = new Value<TNamed,TPCData>();
+  TPCData* tpcData = new TPCData();
   DetElement tpc(tpcData, name, x_det.typeStr());
   tpcData->id = x_det.id();
   //else do this
diff --git a/DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp b/DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp
index bfb7fdf60..41c789c86 100644
--- a/DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/ILDExVXD_geo.cpp
@@ -22,7 +22,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens)  {
   xml_det_t   x_det = e;
   string      name  = x_det.nameStr();
 
-  Value<TNamed,VXDData>* vxd_data = new Value<TNamed,VXDData>();
+  VXDData* vxd_data = new VXDData();
   vxd.assign(vxd_data,name,x_det.typeStr());
   vxd_data->id = x_det.id();
 
diff --git a/DDExamples/ILDExDet/src/compact/LP1_geo.cpp b/DDExamples/ILDExDet/src/compact/LP1_geo.cpp
index cddc006f5..511ff77ff 100644
--- a/DDExamples/ILDExDet/src/compact/LP1_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/LP1_geo.cpp
@@ -24,7 +24,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens)  {
   string      name  = x_det.nameStr();
   Material    mat    (lcdd.material(x_det.materialStr()));
   //if data is needed do this  
-  Value<TNamed,TPCData>* tpcData = new Value<TNamed,TPCData>();
+  TPCData* tpcData = new TPCData();
   DetElement tpc(tpcData, name, x_det.typeStr());
   tpcData->id = x_det.id();
   //else do this
diff --git a/DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp b/DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp
index 4fcb12e8d..35b30a4cc 100644
--- a/DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/TPCPrototype_geo.cpp
@@ -24,7 +24,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens)  {
   string      name  = x_det.nameStr();
   Material    mat    (lcdd.material(x_det.materialStr()));
   //if data is needed do this
-  Value<TNamed,TPCData>* tpcData = new Value<TNamed,TPCData>();
+  TPCData* tpcData = new TPCData();
   DetElement tpc(tpcData, name, x_det.typeStr());
   tpcData->id = x_det.id();
   //else do this
diff --git a/DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp
index 259677c34..6be12dc00 100644
--- a/DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/Tesla_BeamCal01_geo.cpp
@@ -61,7 +61,7 @@ namespace DD4hep { namespace Geometry {
     DetElement construct(LCDD& lcdd, xml_det_t e, SensitiveDetector sens_det);
     /// 
     static DetElement instance(LCDD& lcdd, xml_det_t e, SensitiveDetector sd) { 
-      Value<TNamed,BeamCal01>* p = new Value<TNamed,BeamCal01>(); 
+      BeamCal01* p = new BeamCal01(); 
       p->self.assign(p,e.nameStr(),e.typeStr());
       return p->construct(lcdd,e,sd);
     }
diff --git a/DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp
index 74528e997..17bd8c234 100644
--- a/DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/Tesla_ClicYoke01_geo.cpp
@@ -329,7 +329,7 @@ Volume ClicYoke01::buildBarrel() {
 DetElement ClicYoke01::construct(LCDD& l, xml_det_t x_det)  {
   lcdd     = &l;
   name     = x_det.nameStr();
-  self.assign(dynamic_cast<Value<TNamed,ClicYoke01>*>(this),name,x_det.typeStr());
+  self.assign(this,name,x_det.typeStr());
   self._data().id = x_det.id();
   Assembly    assembly(name);
   xml_comp_t  x_yoke       = x_det.child(_Unicode(yoke));
@@ -441,6 +441,6 @@ DetElement ClicYoke01::construct(LCDD& l, xml_det_t x_det)  {
 }
 
 static Ref_t create_detector(LCDD& lcdd, xml_h element, Ref_t)  {
-  return (new Value<TNamed,ClicYoke01>())->construct(lcdd,element);
+  return (new ClicYoke01())->construct(lcdd,element);
 }
 DECLARE_SUBDETECTOR(Tesla_ClicYoke01,create_detector);
diff --git a/DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp
index 3b8130200..d5d038874 100644
--- a/DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/Tesla_SEcal03_geo.cpp
@@ -139,7 +139,7 @@ using namespace DD4hep::Geometry;
 DetElement SEcal03::construct(LCDD& l, xml_det_t x_det)  {
   lcdd = &l;
   name = x_det.nameStr();
-  self.assign(dynamic_cast<Value<TNamed,SEcal03>*>(this),name,x_det.typeStr());
+  self.assign(this,name,x_det.typeStr());
   self._data().id = x_det.id();
   xml_comp_t x_param             = x_det.child(_Unicode(param));
   xml_comp_t x_barrel            = x_det.child(_U(barrel));
diff --git a/DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp
index e31e5df3c..4246652dc 100644
--- a/DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/Tesla_SHcalSc02_geo.cpp
@@ -132,8 +132,8 @@ using namespace DD4hep::Geometry;
 DetElement SHcalSc02::construct(LCDD& l, xml_det_t x_det)  {
   lcdd     = &l;
   name     = x_det.nameStr();
-  self.assign(dynamic_cast<Value<TNamed,SHcalSc02>*>(this),name,x_det.typeStr());
-  self._data().id = x_det.id();
+  self.assign(this,name,x_det.typeStr());
+  this->id = x_det.id();
 
   xml_comp_t x_barrel             = x_det.child(_U(barrel));
   xml_comp_t x_endcap             = x_det.child(_U(endcap));
@@ -977,7 +977,7 @@ bool SHcalSc02::PostConstructAction(CGAGeometryEnvironment& )   {
 
 
 static Ref_t create_detector(LCDD& lcdd, xml_h element, Ref_t)  {
-  return (new Value<TNamed,SHcalSc02>())->construct(lcdd,element);
+  return (new SHcalSc02())->construct(lcdd,element);
 }
 
 DECLARE_SUBDETECTOR(Tesla_SHcalSc02,create_detector);
diff --git a/DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp
index 9027d27e0..edd10aa3d 100644
--- a/DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/Tesla_VXD03_geo.cpp
@@ -81,7 +81,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens)  {
   Material silicon_233 = lcdd.material("silicon_2.33gccm");
 
   
-  Value<TNamed,VXD03Data>* vxd_data = new Value<TNamed,VXD03Data>();
+  VXD03Data* vxd_data = new VXD03Data();
   vxd.assign(vxd_data,name,x_det.typeStr());
   vxd_data->id = x_det.id();
 
diff --git a/DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp b/DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp
index 5ce299ec2..a8d86b53c 100644
--- a/DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp
+++ b/DDExamples/ILDExDet/src/compact/Tesla_hcal04_geo.cpp
@@ -620,6 +620,6 @@ Volume Hcal04::buildRPC1Box(const string& nam, Box box, const Layer& layer, Sens
 }
 
 static Ref_t create_detector(LCDD& lcdd, xml_h element, Ref_t)  {
-  return (new Value<TNamed,Hcal04>())->construct(lcdd,element);
+  return (new Hcal04())->construct(lcdd,element);
 }
 DECLARE_SUBDETECTOR(Tesla_hcal04,create_detector);
-- 
GitLab