From ac05970845d68cb9d7a4d21a577756d8764e45d3 Mon Sep 17 00:00:00 2001
From: Dave Casper <dcasper@uci.edu>
Date: Wed, 5 Jul 2023 10:16:58 -0700
Subject: [PATCH] Add magnet covers on decay volume

---
 .../GeoModel/FaserGeoModel/data/geomDB.sql    | 33 ++++++++++
 .../DipoleGeoModel/DipoleDataBase.h           |  2 +
 .../DipoleGeoModel/DipoleWrappingParameters.h | 40 ++++++++++++
 .../DipoleGeoModel/src/DipoleDataBase.cxx     |  6 ++
 .../DipoleGeoModel/src/DipoleFactory.cxx      | 28 +++++++-
 .../src/DipoleWrappingParameters.cxx          | 64 +++++++++++++++++++
 .../src/VisAttributes.cxx                     |  2 +-
 7 files changed, 172 insertions(+), 3 deletions(-)
 create mode 100644 Tracker/TrackerDetDescr/DipoleGeoModel/DipoleGeoModel/DipoleWrappingParameters.h
 create mode 100644 Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleWrappingParameters.cxx

diff --git a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql
index c4d5b220e..046c5462f 100644
--- a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql
+++ b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql
@@ -927,6 +927,7 @@ INSERT INTO "HVS_NODE" VALUES (32,   "Dipole", 3, 1, NULL);
 INSERT INTO "HVS_NODE" VALUES (320,  "DipoleTopLevel", 32, 0, NULL);
 INSERT INTO "HVS_NODE" VALUES (321,  "DipoleGeneral", 32, 0, NULL);
 INSERT INTO "HVS_NODE" VALUES (324,  "DipoleSwitches", 32, 0, NULL);
+INSERT INTO "HVS_NODE" VALUES (329,  "DipoleWrappingGeneral", 32, 0, NULL);
 INSERT INTO "HVS_NODE" VALUES (4,    "Calorimeter", 0, 1, NULL);
 INSERT INTO "HVS_NODE" VALUES (41,   "Ecal", 4, 1, NULL);
 INSERT INTO "HVS_NODE" VALUES (410,  "EcalTopLevel", 41, 0, NULL);
@@ -1022,6 +1023,8 @@ INSERT INTO "HVS_TAG2NODE" VALUES (320, "DipoleTopLevel-TB00", 107819, NULL, 0,
 INSERT INTO "HVS_TAG2NODE" VALUES (320, "DipoleTopLevel-03", 107838, NULL, 0, 0, 1652054400000000000, NULL, 22);
 INSERT INTO "HVS_TAG2NODE" VALUES (321, "DipoleGeneral-00", 100004, NULL, 0, 0, 1568678400000000000, NULL, 22);
 INSERT INTO "HVS_TAG2NODE" VALUES (324, "DipoleSwitches-00", 100028, NULL, 0, 0, 1568678400000000000, NULL, 22);
+INSERT INTO "HVS_TAG2NODE" VALUES (329, "DipoleWrappingGeneral-00", 107884, NULL, 0, 0, 1688515200000000000, NULL, 22);
+INSERT INTO "HVS_TAG2NODE" VALUES (329, "DipoleWrappingGeneral-01", 107885, NULL, 0, 0, 1688515200000000000, NULL, 22);
 INSERT INTO "HVS_TAG2NODE" VALUES (4, "Calorimeter-00", 100003, NULL, 0, 0, 1549238400000000000, NULL, 22);
 INSERT INTO "HVS_TAG2NODE" VALUES (4, "Calorimeter-02", 107795, NULL, 0, 0, 1619222400000000000, NULL, 22);
 INSERT INTO "HVS_TAG2NODE" VALUES (4, "Calorimeter-04", 107858, NULL, 0, 0, 1685836800000000000, NULL, 22);
@@ -1508,6 +1511,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "VetoPlateGeneral",   "VetoPlateG
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "VetoRadiatorGeneral",   "VetoRadiatorGeneral-00", 107810);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "VetoWrappingGeneral",   "VetoWrappingGeneral-00", 107863);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "SctWrappingGeneral", "SctWrappingGeneral-00",   107878);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "DipoleWrappingGeneral", "DipoleWrappingGeneral-00",   107884);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "TriggerWrappingGeneral", "TriggerWrappingGeneral-00", 107869);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "PreshowerWrappingGeneral",   "PreshowerWrappingGeneral-00",     107875);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "TriggerTopLevel",       "TriggerTopLevel-00",         110009);
@@ -1576,6 +1580,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-01", "VetoPlateGeneral",   "VetoPlateG
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-01", "VetoRadiatorGeneral",   "VetoRadiatorGeneral-00", 107810);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-01", "VetoWrappingGeneral",   "VetoWrappingGeneral-00", 107863);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-01", "SctWrappingGeneral", "SctWrappingGeneral-00",   107878);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-01", "DipoleWrappingGeneral", "DipoleWrappingGeneral-00",   107884);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-01", "TriggerWrappingGeneral", "TriggerWrappingGeneral-00", 107869);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-01", "PreshowerWrappingGeneral",   "PreshowerWrappingGeneral-00",     107875);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-01", "TriggerTopLevel",       "TriggerTopLevel-01",         100047);
@@ -1644,6 +1649,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-CR", "VetoPlateGeneral",   "VetoPlateG
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-CR", "VetoRadiatorGeneral",   "VetoRadiatorGeneral-00", 107810);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-CR", "VetoWrappingGeneral",   "VetoWrappingGeneral-00", 107863);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-CR", "SctWrappingGeneral", "SctWrappingGeneral-00",   107878);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-CR", "DipoleWrappingGeneral", "DipoleWrappingGeneral-00",   107884);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-CR", "TriggerWrappingGeneral", "TriggerWrappingGeneral-00", 107869);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-CR", "PreshowerWrappingGeneral",   "PreshowerWrappingGeneral-00",     107875);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-CR", "TriggerTopLevel",       "TriggerTopLevel-01",         100047);
@@ -1708,6 +1714,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-02", "VetoPlateGeneral",   "VetoPlateG
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-02", "VetoRadiatorGeneral",   "VetoRadiatorGeneral-00", 107810);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-02", "VetoWrappingGeneral",   "VetoWrappingGeneral-00", 107863);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-02", "SctWrappingGeneral", "SctWrappingGeneral-00",   107878);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-02", "DipoleWrappingGeneral", "DipoleWrappingGeneral-00",   107884);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-02", "TriggerWrappingGeneral", "TriggerWrappingGeneral-00", 107869);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-02", "PreshowerWrappingGeneral",   "PreshowerWrappingGeneral-00",     107875);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-02", "TriggerTopLevel",       "TriggerTopLevel-02",         107799);
@@ -1779,6 +1786,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-02", "VetoPlateGeneral",   "VetoPlat
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-02", "VetoRadiatorGeneral",   "VetoRadiatorGeneral-00", 107810);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-02", "VetoWrappingGeneral",   "VetoWrappingGeneral-00", 107863);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-02", "SctWrappingGeneral", "SctWrappingGeneral-00",   107878);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-02", "DipoleWrappingGeneral", "DipoleWrappingGeneral-00",   107884);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-02", "TriggerWrappingGeneral", "TriggerWrappingGeneral-00", 107869);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-02", "PreshowerWrappingGeneral",   "PreshowerWrappingGeneral-00",     107875);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-02", "TriggerTopLevel",       "TriggerTopLevel-02",         107799);
@@ -1840,6 +1848,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB00", "Dipole",             "Dipole-T
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB00", "DipoleTopLevel",     "DipoleTopLevel-TB00",     107819);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB00", "DipoleGeneral",      "DipoleGeneral-00",        100004);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB00", "DipoleSwitches",     "DipoleSwitches-00",       100028);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB00", "DipoleWrappingGeneral", "DipoleWrappingGeneral-00",   107884);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB00", "Calorimeter",        "Calorimeter-TB00",        107820);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB00", "Ecal",               "Ecal-TB00",               107821);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB00", "EcalTopLevel",       "EcalTopLevel-TB00",       107822);
@@ -1915,6 +1924,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-03", "Dipole",             "Dipole-0
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-03", "DipoleTopLevel",     "DipoleTopLevel-03",       107838);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-03", "DipoleGeneral",      "DipoleGeneral-00",        100004);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-03", "DipoleSwitches",     "DipoleSwitches-00",       100028);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-03", "DipoleWrappingGeneral", "DipoleWrappingGeneral-00",   107884);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-03", "Calorimeter",        "Calorimeter-02",          107795);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-03", "Ecal",               "Ecal-02",                 107796);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-03", "EcalTopLevel",       "EcalTopLevel-02",         107797);
@@ -1996,6 +2006,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-04", "Dipole",             "Dipole-0
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-04", "DipoleTopLevel",     "DipoleTopLevel-03",       107838);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-04", "DipoleGeneral",      "DipoleGeneral-00",        100004);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-04", "DipoleSwitches",     "DipoleSwitches-00",       100028);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-04", "DipoleWrappingGeneral", "DipoleWrappingGeneral-01",   107885);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-04", "Calorimeter",        "Calorimeter-04",          107858);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-04", "Ecal",               "Ecal-04",                 107856);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASERNU-04", "EcalTopLevel",       "EcalTopLevel-02",         107797);
@@ -2073,6 +2084,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB01", "Dipole",             "Dipole-T
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB01", "DipoleTopLevel",     "DipoleTopLevel-TB00",     107819);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB01", "DipoleGeneral",      "DipoleGeneral-00",        100004);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB01", "DipoleSwitches",     "DipoleSwitches-00",       100028);
+INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB01", "DipoleWrappingGeneral", "DipoleWrappingGeneral-01",   107885);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB01", "Calorimeter",        "Calorimeter-TB01",        107859);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB01", "Ecal",               "Ecal-TB01",               107857);
 INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-TB01", "EcalTopLevel",       "EcalTopLevel-TB00",       107822);
@@ -3177,6 +3189,27 @@ CREATE TABLE "DIPOLEGENERAL_DATA2TAG" ( "DIPOLEGENERAL_TAG_ID" SLONGLONG, "DIPOL
 INSERT INTO "DIPOLEGENERAL_DATA2TAG" VALUES(100004, 0);
 --
 --
+DROP TABLE IF EXISTS "DIPOLEWRAPPINGGENERAL_DATA";
+CREATE TABLE IF NOT EXISTS "DIPOLEWRAPPINGGENERAL_DATA" (
+	"DIPOLEWRAPPINGGENERAL_DATA_ID" SLONGLONG UNIQUE,
+	"RADIUS" DOUBLE,
+	"THICKNESS1" DOUBLE,
+	"THICKNESS2" DOUBLE,
+	"MATERIAL1" TEXT,
+	"MATERIAL2" TEXT
+);
+--
+DROP TABLE IF EXISTS "DIPOLEWRAPPINGGENERAL_DATA2TAG";
+CREATE TABLE IF NOT EXISTS "DIPOLEWRAPPINGGENERAL_DATA2TAG" (
+	"DIPOLEWRAPPINGGENERAL_TAG_ID" SLONGLONG,
+	"DIPOLEWRAPPINGGENERAL_DATA_ID" SLONGLONG
+);
+INSERT INTO "DIPOLEWRAPPINGGENERAL_DATA" VALUES (0, 101.0, 0.4, 3.0, "std::Air",  "std::Air");
+INSERT INTO "DIPOLEWRAPPINGGENERAL_DATA" VALUES (1, 101.0, 0.4, 3.0, "sct::CFRP", "std::Polystyrene");
+INSERT INTO "DIPOLEWRAPPINGGENERAL_DATA2TAG" VALUES (107884, 0);
+INSERT INTO "DIPOLEWRAPPINGGENERAL_DATA2TAG" VALUES (107885, 1);
+--
+--
 DROP TABLE IF EXISTS "SCTMATCOMPONENTS_DATA";
 CREATE TABLE "SCTMATCOMPONENTS_DATA" ( "SCTMATCOMPONENTS_DATA_ID" SLONGLONG ,"MATERIAL_ID" SLONGLONG ,"COMPNAME" TEXT ,"FRACTION" DOUBLE , UNIQUE ( "SCTMATCOMPONENTS_DATA_ID" ) );
 INSERT INTO "SCTMATCOMPONENTS_DATA" VALUES(201,50,'Carbon',0.4816);
diff --git a/Tracker/TrackerDetDescr/DipoleGeoModel/DipoleGeoModel/DipoleDataBase.h b/Tracker/TrackerDetDescr/DipoleGeoModel/DipoleGeoModel/DipoleDataBase.h
index 0e4416346..f49af0bf1 100644
--- a/Tracker/TrackerDetDescr/DipoleGeoModel/DipoleGeoModel/DipoleDataBase.h
+++ b/Tracker/TrackerDetDescr/DipoleGeoModel/DipoleGeoModel/DipoleDataBase.h
@@ -30,6 +30,7 @@ public:
   // const IRDBRecord* conditions() const;
 
   const IRDBRecord* dipoleGeneral() const;
+  const IRDBRecord* dipoleWrapping() const;
   // Return the Dipole version tag.
   const std::string & versionTag() const;
 
@@ -52,6 +53,7 @@ private:
   // IRDBRecordset_ptr m_conditions;
 
   IRDBRecordset_ptr m_dipoleGeneral;
+  IRDBRecordset_ptr m_dipoleWrapping;
 
 };
 
diff --git a/Tracker/TrackerDetDescr/DipoleGeoModel/DipoleGeoModel/DipoleWrappingParameters.h b/Tracker/TrackerDetDescr/DipoleGeoModel/DipoleGeoModel/DipoleWrappingParameters.h
new file mode 100644
index 000000000..c6976f917
--- /dev/null
+++ b/Tracker/TrackerDetDescr/DipoleGeoModel/DipoleGeoModel/DipoleWrappingParameters.h
@@ -0,0 +1,40 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef DipoleGeoModel_DipoleWrappingParameters_H
+#define DipoleGeoModel_DipoleWrappingParameters_H
+
+#include "GeoModelKernel/GeoDefinitions.h"
+
+#include <map>
+#include <string>
+
+class DipoleDataBase;
+
+class DipoleWrappingParameters {
+
+public:
+
+  DipoleWrappingParameters(DipoleDataBase* rdb);
+  ~DipoleWrappingParameters();
+  //Explicitly disallow copy, assignment to appease coverity
+  DipoleWrappingParameters(const DipoleWrappingParameters &) = delete;
+  DipoleWrappingParameters & operator=(const DipoleWrappingParameters &) = delete;
+
+  // General
+  double safety() const;
+
+  std::string material1() const;
+  std::string material2() const;
+  double      radius() const;
+  double      thickness1() const;
+  double      thickness2() const;
+private:
+
+  DipoleDataBase * m_rdb;
+    
+};
+
+
+#endif // DipoleGeoModel_DipoleWrappingParameters_H
diff --git a/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleDataBase.cxx b/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleDataBase.cxx
index 2feae9b62..cda5f7e9e 100644
--- a/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleDataBase.cxx
+++ b/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleDataBase.cxx
@@ -77,6 +77,10 @@ DipoleDataBase::DipoleDataBase(const TrackerDD::AthenaComps * athenaComps)
   m_dipoleGeneral = rdbSvc->getRecordsetPtr("DipoleGeneral", versionTag, versionNode, "FASERDD");
   msg(MSG::DEBUG) << "Table DipoleGeneral Fetched" << endmsg;
 
+  // Dipole Wrapping
+  m_dipoleWrapping = rdbSvc->getRecordsetPtr("DipoleWrappingGeneral", versionTag, versionNode, "FASERDD");
+  msg(MSG::DEBUG) << "Table DipoleWrappingGeneral Fetched" << endmsg;
+
 }
 
 const TrackerDD::AthenaComps* DipoleDataBase::athenaComps() const { return m_athenaComps; }
@@ -92,6 +96,8 @@ IRDBRecordset_ptr DipoleDataBase::topLevelTable() const {return m_topLevel;}
 
 const IRDBRecord* DipoleDataBase::dipoleGeneral() const {return (*m_dipoleGeneral)[0];}
 
+const IRDBRecord* DipoleDataBase::dipoleWrapping() const {return (*m_dipoleWrapping)[0];}
+
 const std::string & DipoleDataBase::versionTag() const {
   return m_dipoleVersionTag;
 }
diff --git a/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleFactory.cxx b/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleFactory.cxx
index 44a341686..6129c49cc 100644
--- a/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleFactory.cxx
+++ b/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleFactory.cxx
@@ -6,6 +6,7 @@
 
 #include "DipoleGeoModel/DipoleDataBase.h"
 #include "DipoleGeoModel/DipoleGeneralParameters.h"
+#include "DipoleGeoModel/DipoleWrappingParameters.h"
 
 // Extra material
 #include "TrackerGeoModelUtils/DistortedMaterialManager.h"
@@ -83,15 +84,37 @@ void DipoleFactory::create(GeoPhysVol *world )
 //   materialManager->addScalingTable(scalingTable);
 
   auto parameters = std::make_unique<DipoleGeneralParameters>(m_db);
+  auto wrappingParameters = std::make_unique<DipoleWrappingParameters>(m_db);
 
-//   const GeoMaterial* air = materialManager->getMaterial("std::Air");
+  const GeoMaterial* air = materialManager->getMaterial("std::Air");
   const GeoMaterial* NdFeB = materialManager->getMaterial(parameters->material());
+  const GeoMaterial* upstreamMaterial = materialManager->getMaterial(wrappingParameters->material1());
+  const GeoMaterial* downstreamMaterial = materialManager->getMaterial(wrappingParameters->material2());
+  double upstreamThickness = wrappingParameters->thickness1();
+  double downstreamThickness = wrappingParameters->thickness2();
+  double wrappingRadius = wrappingParameters->radius();
 
   GeoTrf::Transform3D dipoleTransform = parameters->partTransform("Dipole");
   const GeoTube* shortShape = new GeoTube(parameters->innerRadius(), parameters->outerRadius(), parameters->shortLength()/2);
   GeoLogVol* shortLog = new GeoLogVol("ShortDipole", shortShape, NdFeB);
   const GeoTube* longShape = new GeoTube(parameters->innerRadius(), parameters->outerRadius(), parameters->longLength()/2);
   GeoLogVol* longLog = new GeoLogVol("LongDipole", longShape, NdFeB);
+  const GeoTube* wrappedShape = new GeoTube(parameters->innerRadius(), std::max(parameters->outerRadius(), wrappingRadius), parameters->longLength()/2 + std::max(upstreamThickness, downstreamThickness));
+  GeoLogVol* wrappedLog = new GeoLogVol("WrappedLongDipole", wrappedShape, air);
+  GeoPhysVol* wrappedPV = new GeoPhysVol(wrappedLog);
+  GeoPhysVol* longPV = new GeoPhysVol(longLog);
+  wrappedPV->add(longPV);
+  const GeoTube* upstreamShape = new GeoTube(0.0, wrappingRadius, upstreamThickness/2);
+  GeoLogVol* upstreamLog = new GeoLogVol("UpstreamWrapping", upstreamShape, upstreamMaterial);
+  GeoPhysVol* upstreamPV = new GeoPhysVol(upstreamLog);
+  wrappedPV->add(new GeoTransform(GeoTrf::Translate3D(0.0, 0.0, -(parameters->longLength() + upstreamThickness)/2)));
+  wrappedPV->add(upstreamPV);
+
+  const GeoTube* downstreamShape = new GeoTube(0.0, wrappingRadius, downstreamThickness/2);
+  GeoLogVol* downstreamLog = new GeoLogVol("DownstreamWrapping", downstreamShape, downstreamMaterial);
+  GeoPhysVol* downstreamPV = new GeoPhysVol(downstreamLog);
+  wrappedPV->add(new GeoTransform(GeoTrf::Translate3D(0.0, 0.0, (parameters->longLength() + upstreamThickness)/2)));
+  wrappedPV->add(downstreamPV);
 
   std::vector<std::string> partNames {"UpstreamDipole", "CentralDipole", "DownstreamDipole"};
   for (int station = 0; station < 3; station++)
@@ -105,7 +128,8 @@ void DipoleFactory::create(GeoPhysVol *world )
       GeoPhysVol* dipolePV {nullptr};
       if (station == 0)
       {
-        dipolePV = new GeoPhysVol(longLog);
+        // dipolePV = new GeoPhysVol(longLog);
+        dipolePV = wrappedPV;
       }
       else
       {
diff --git a/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleWrappingParameters.cxx b/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleWrappingParameters.cxx
new file mode 100644
index 000000000..4cf4eef59
--- /dev/null
+++ b/Tracker/TrackerDetDescr/DipoleGeoModel/src/DipoleWrappingParameters.cxx
@@ -0,0 +1,64 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "DipoleGeoModel/DipoleWrappingParameters.h"
+#include "DipoleGeoModel/DipoleDataBase.h"
+#include "RDBAccessSvc/IRDBRecord.h"
+#include "RDBAccessSvc/IRDBRecordset.h"
+#include "GaudiKernel/SystemOfUnits.h"
+#include "GeoModelKernel/GeoDefinitions.h"
+
+const double DIPOLE_SAFETY = 0.01 * Gaudi::Units::mm; // Used in some places to make envelopes slightly larger to ensure
+                                     // no overlaps due to rounding errors.
+
+
+DipoleWrappingParameters::DipoleWrappingParameters(DipoleDataBase* rdb)
+{
+  m_rdb = rdb;
+}
+
+
+DipoleWrappingParameters::~DipoleWrappingParameters()
+{ }
+
+//
+// General
+//
+double 
+DipoleWrappingParameters::safety() const
+{
+  return DIPOLE_SAFETY;
+}
+
+std::string
+DipoleWrappingParameters::material1() const
+{
+    return m_rdb->dipoleWrapping()->getString("MATERIAL1");
+}
+
+std::string
+DipoleWrappingParameters::material2() const
+{
+    return m_rdb->dipoleWrapping()->getString("MATERIAL2");
+}
+
+double
+DipoleWrappingParameters::radius() const
+{
+    return m_rdb->dipoleWrapping()->getDouble("RADIUS");
+}
+
+double
+DipoleWrappingParameters::thickness1() const
+{
+    return m_rdb->dipoleWrapping()->getDouble("THICKNESS1");
+}
+
+double
+DipoleWrappingParameters::thickness2() const
+{
+    return m_rdb->dipoleWrapping()->getDouble("THICKNESS2");
+}
+
+
diff --git a/graphics/VTI12/VTI12Systems/VTI12GeometrySystems/src/VisAttributes.cxx b/graphics/VTI12/VTI12Systems/VTI12GeometrySystems/src/VisAttributes.cxx
index 27fd3362c..2365c7989 100644
--- a/graphics/VTI12/VTI12Systems/VTI12GeometrySystems/src/VisAttributes.cxx
+++ b/graphics/VTI12/VTI12Systems/VTI12GeometrySystems/src/VisAttributes.cxx
@@ -375,7 +375,6 @@ MatVisAttributes::MatVisAttributes() {
     add("Polystyrene",material);
   }
 
-
   {
     // C02:
     SoMaterial *m = new SoMaterial;
@@ -926,6 +925,7 @@ MatVisAttributes::MatVisAttributes() {
     m->emissiveColor.setValue (0.028, 0.028, 0.028);
     m->shininess.setValue(.60);
     add("Glass",m);
+    add("CFRP", m);
   }
 
   {
-- 
GitLab