From 864f0e6ef801dec26722e7ffe19c7a4c20b2423a Mon Sep 17 00:00:00 2001
From: Atlas-Software Librarian <Atlas-Software.Librarian@cern.ch>
Date: Fri, 8 Apr 2016 18:43:56 +0200
Subject: [PATCH] 'CMakeLists.txt' (G4Field-00-01-01)

---
 Simulation/G4Utilities/G4Field/CMakeLists.txt |  41 ++
 .../G4Field/G4Field/ConstantField.h           |  66 +++
 .../G4Field/G4Field/ConstantFieldHandler.h    |  21 +
 .../G4Field/G4Field/ConstantFieldXMLHandler.h |  21 +
 .../G4Utilities/G4Field/G4Field/FieldMapMgr.h |  24 +
 .../G4Field/G4Field/G4AtlasFieldSvc.h         |  36 ++
 .../G4Utilities/G4Field/G4Field/G4FieldDict.h |   5 +
 .../G4Utilities/G4Field/G4Field/selection.xml |   3 +
 .../G4Utilities/G4Field/cmt/requirements      |  36 ++
 Simulation/G4Utilities/G4Field/data/field.dtd |  17 +
 Simulation/G4Utilities/G4Field/data/field.xml |  11 +
 Simulation/G4Utilities/G4Field/doc/mainpage.h |  35 ++
 .../G4Utilities/G4Field/run/atlasfield.mac    |   3 +
 Simulation/G4Utilities/G4Field/run/clid       |  33 ++
 Simulation/G4Utilities/G4Field/run/clid.db    | 508 ++++++++++++++++++
 Simulation/G4Utilities/G4Field/run/clid.py    | 244 +++++++++
 Simulation/G4Utilities/G4Field/run/clidGen.py | 101 ++++
 .../G4Field/run/jobOptions.G4Svc.txt          |  40 ++
 .../G4Utilities/G4Field/src/ConstantField.cxx |  67 +++
 .../G4Field/src/ConstantFieldHandler.cxx      |  96 ++++
 .../G4Field/src/ConstantFieldXMLHandler.cxx   |  33 ++
 .../G4Utilities/G4Field/src/FieldMapMgr.cxx   |  42 ++
 .../G4Field/src/G4AtlasFieldSvc.cxx           |  62 +++
 23 files changed, 1545 insertions(+)
 create mode 100644 Simulation/G4Utilities/G4Field/CMakeLists.txt
 create mode 100755 Simulation/G4Utilities/G4Field/G4Field/ConstantField.h
 create mode 100755 Simulation/G4Utilities/G4Field/G4Field/ConstantFieldHandler.h
 create mode 100755 Simulation/G4Utilities/G4Field/G4Field/ConstantFieldXMLHandler.h
 create mode 100755 Simulation/G4Utilities/G4Field/G4Field/FieldMapMgr.h
 create mode 100644 Simulation/G4Utilities/G4Field/G4Field/G4AtlasFieldSvc.h
 create mode 100755 Simulation/G4Utilities/G4Field/G4Field/G4FieldDict.h
 create mode 100755 Simulation/G4Utilities/G4Field/G4Field/selection.xml
 create mode 100755 Simulation/G4Utilities/G4Field/cmt/requirements
 create mode 100755 Simulation/G4Utilities/G4Field/data/field.dtd
 create mode 100755 Simulation/G4Utilities/G4Field/data/field.xml
 create mode 100644 Simulation/G4Utilities/G4Field/doc/mainpage.h
 create mode 100755 Simulation/G4Utilities/G4Field/run/atlasfield.mac
 create mode 100755 Simulation/G4Utilities/G4Field/run/clid
 create mode 100755 Simulation/G4Utilities/G4Field/run/clid.db
 create mode 100755 Simulation/G4Utilities/G4Field/run/clid.py
 create mode 100755 Simulation/G4Utilities/G4Field/run/clidGen.py
 create mode 100755 Simulation/G4Utilities/G4Field/run/jobOptions.G4Svc.txt
 create mode 100755 Simulation/G4Utilities/G4Field/src/ConstantField.cxx
 create mode 100755 Simulation/G4Utilities/G4Field/src/ConstantFieldHandler.cxx
 create mode 100755 Simulation/G4Utilities/G4Field/src/ConstantFieldXMLHandler.cxx
 create mode 100755 Simulation/G4Utilities/G4Field/src/FieldMapMgr.cxx
 create mode 100644 Simulation/G4Utilities/G4Field/src/G4AtlasFieldSvc.cxx

diff --git a/Simulation/G4Utilities/G4Field/CMakeLists.txt b/Simulation/G4Utilities/G4Field/CMakeLists.txt
new file mode 100644
index 00000000000..ea8c159d86f
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/CMakeLists.txt
@@ -0,0 +1,41 @@
+################################################################################
+# Package: G4Field
+################################################################################
+
+# Declare the package name:
+atlas_subdir( G4Field )
+
+# Declare the package's dependencies:
+atlas_depends_on_subdirs( PUBLIC
+                          GaudiKernel
+                          Simulation/G4Sim/FADS/FadsField
+                          Simulation/G4Sim/FADS/FadsXMLParser
+                          Tools/PathResolver
+                          PRIVATE
+                          MagneticField/MagFieldInterfaces )
+
+# External dependencies:
+find_package( CLHEP )
+find_package( Geant4 )
+find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+find_package( XercesC )
+
+# this line failed automatic conversion in cmt2cmake :
+# macro_prepend G4FieldDict_shlibflags " -lG4Field "
+
+# Component(s) in the package:
+atlas_add_library( G4Field
+                   src/*.cxx
+                   PUBLIC_HEADERS G4Field
+                   INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
+                   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                   DEFINITIONS ${CLHEP_DEFINITIONS}
+                   LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel FadsField FadsXMLParser PathResolver
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} MagFieldInterfaces )
+
+atlas_add_dictionary( G4FieldDict
+                      G4Field/G4FieldDict.h
+                      G4Field/selection.xml
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel FadsField FadsXMLParser PathResolver MagFieldInterfaces G4Field )
+
diff --git a/Simulation/G4Utilities/G4Field/G4Field/ConstantField.h b/Simulation/G4Utilities/G4Field/G4Field/ConstantField.h
new file mode 100755
index 00000000000..3f48ecbc53f
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/G4Field/ConstantField.h
@@ -0,0 +1,66 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef ConstantField_H
+#define ConstantField_H
+
+#include "FadsField/MagneticFieldMap.h"
+#include "G4Field/ConstantFieldXMLHandler.h"
+// Geant4 includes
+#include "G4SystemOfUnits.hh"
+
+#include <iostream>
+
+class ConstantField : public FADS::MagneticFieldMap 
+{
+public:
+	ConstantField();
+	ConstantField(std::string);
+	~ConstantField();
+	
+	void FieldValue(const double *xyzPos, double *bfield) const;
+	void Initialize();
+	void SetXComponent(double xf) 
+	{
+		std::cout<<"Setting X component for field "<<GetName()<< 
+			" to "<<xf/CLHEP::tesla<<" Tesla"<<std::endl;
+		FieldValueX=xf;
+	}
+	void SetYComponent(double yf) 
+	{
+		std::cout<<"Setting Y component for field "<<GetName()<< 
+			" to "<<yf/CLHEP::tesla<<" Tesla"<<std::endl;
+		FieldValueY=yf;
+	}
+	void SetZComponent(double zf) 
+	{
+		std::cout<<"Setting Z component for field "<<GetName()<< 
+			" to "<<zf/CLHEP::tesla<<" Tesla"<<std::endl;
+		FieldValueZ=zf;
+	}
+	void SetXMinField(double xm) {checkXdim=true;xMinField=xm;}
+	void SetYMinField(double ym) {checkYdim=true;yMinField=ym;}
+	void SetZMinField(double zm) {checkZdim=true;zMinField=zm;}
+	void SetXMaxField(double xm) {checkXdim=true;xMaxField=xm;}
+	void SetYMaxField(double ym) {checkYdim=true;yMaxField=ym;}
+	void SetZMaxField(double zm) {checkZdim=true;zMaxField=zm;}
+	
+private:
+	ConstantFieldXMLHandler *theHandler;
+	double FieldValueX;
+	double FieldValueY;
+	double FieldValueZ;
+	
+	bool checkXdim;
+	bool checkYdim;
+	bool checkZdim;
+	double xMinField;
+	double xMaxField;
+	double yMinField;
+	double yMaxField;
+	double zMinField;
+	double zMaxField;
+};
+
+#endif
diff --git a/Simulation/G4Utilities/G4Field/G4Field/ConstantFieldHandler.h b/Simulation/G4Utilities/G4Field/G4Field/ConstantFieldHandler.h
new file mode 100755
index 00000000000..953a9512875
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/G4Field/ConstantFieldHandler.h
@@ -0,0 +1,21 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef ConstantFieldHandler_H
+#define ConstantFieldHandler_H
+#include <string>
+
+#include "FadsField/FieldManager.h"
+#include "G4Field/ConstantField.h"
+
+class ConstantFieldHandler{
+public:
+    ConstantFieldHandler();
+
+    static void setFieldValues(std::string fieldName, float Bx, float By, float Bz); 
+    static void setXField(std::string fieldName, double xmin, double xmax);
+    static void setYField(std::string fieldName, double ymin, double ymax);
+    static void setZField(std::string fieldName, double zmin, double zmax);
+};
+#endif
diff --git a/Simulation/G4Utilities/G4Field/G4Field/ConstantFieldXMLHandler.h b/Simulation/G4Utilities/G4Field/G4Field/ConstantFieldXMLHandler.h
new file mode 100755
index 00000000000..dcc8e00d041
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/G4Field/ConstantFieldXMLHandler.h
@@ -0,0 +1,21 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef ConstantFieldXMLHandler_H
+#define ConstantFieldXMLHandler_H
+
+#include "FadsXMLParser/DescriptionFactory.h"
+#include <string>
+
+class ConstantField;
+
+class ConstantFieldXMLHandler: public FADS::DescriptionFactory {
+public:
+        ConstantFieldXMLHandler(std::string s,ConstantField *);
+        void BuildDescription();
+private:
+	ConstantField *theField;
+};
+
+#endif
diff --git a/Simulation/G4Utilities/G4Field/G4Field/FieldMapMgr.h b/Simulation/G4Utilities/G4Field/G4Field/FieldMapMgr.h
new file mode 100755
index 00000000000..d233bf03e43
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/G4Field/FieldMapMgr.h
@@ -0,0 +1,24 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef FieldMapMgr_H
+#define FieldMapMgr_H
+
+#include <string>
+
+#include "PathResolver/PathResolver.h"
+
+class FieldMapMgr {
+public:
+        static FieldMapMgr* GetFieldMapMgr();
+	static std::string GetFieldMapFile();
+	static std::string GetFieldMapFileName();
+	static std::string FindPath(std::string);
+	static void SetFieldMapFile(std::string);
+private:
+        static FieldMapMgr* thePointer;        
+        static std::string fieldMapFile;
+};
+
+#endif
diff --git a/Simulation/G4Utilities/G4Field/G4Field/G4AtlasFieldSvc.h b/Simulation/G4Utilities/G4Field/G4Field/G4AtlasFieldSvc.h
new file mode 100644
index 00000000000..6fa3a9f6713
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/G4Field/G4AtlasFieldSvc.h
@@ -0,0 +1,36 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef G4AtlasFieldSvc_H
+#define G4AtlasFieldSvc_H
+
+#include "FadsField/MagneticFieldMap.h"
+#include "GaudiKernel/ServiceHandle.h"
+
+
+// forward declarations
+namespace MagField {
+  class IMagFieldSvc;
+}
+
+class G4AtlasFieldSvc : public FADS::MagneticFieldMap {
+  public:
+
+    G4AtlasFieldSvc();
+    G4AtlasFieldSvc(const std::string& n);
+    ~G4AtlasFieldSvc() { }
+    
+    void FieldValue(const double *xyzPos, double *xyzField) const;
+    void Initialize();
+    
+  private:
+    /** status flag for field initialization status */
+    static bool fieldinitialized;
+    
+    /** the MagneticField service */
+    ServiceHandle<MagField::IMagFieldSvc>   m_magFieldSvc;       //!< athena service handle
+    MagField::IMagFieldSvc                 *m_magFieldSvcQuick;  //!< fast access, removing gaudi overhead
+};
+
+#endif
diff --git a/Simulation/G4Utilities/G4Field/G4Field/G4FieldDict.h b/Simulation/G4Utilities/G4Field/G4Field/G4FieldDict.h
new file mode 100755
index 00000000000..20caa3486b2
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/G4Field/G4FieldDict.h
@@ -0,0 +1,5 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "G4Field/ConstantFieldHandler.h"
diff --git a/Simulation/G4Utilities/G4Field/G4Field/selection.xml b/Simulation/G4Utilities/G4Field/G4Field/selection.xml
new file mode 100755
index 00000000000..3e1b3a0c4b6
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/G4Field/selection.xml
@@ -0,0 +1,3 @@
+<lcgdict>
+   <class name="ConstantFieldHandler"/>
+</lcgdict>
diff --git a/Simulation/G4Utilities/G4Field/cmt/requirements b/Simulation/G4Utilities/G4Field/cmt/requirements
new file mode 100755
index 00000000000..29215b45e23
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/cmt/requirements
@@ -0,0 +1,36 @@
+package G4Field
+
+version G4Field-00-00-01
+
+author ADA <dellacqu@mail.cern.ch>
+
+branches src cmt
+
+use AtlasPolicy         AtlasPolicy-*
+use PathResolver	PathResolver-*		Tools
+
+use FadsField           FadsField-*          	Simulation/G4Sim/FADS
+use FadsXMLParser	FadsXMLParser-*		Simulation/G4Sim/FADS
+
+use Geant4        Geant4-*        External
+
+private
+use AtlasReflex         AtlasReflex-*           External
+use MagFieldInterfaces  MagFieldInterfaces-*    MagneticField
+end_private
+
+use GaudiInterface GaudiInterface-* External
+
+include_dirs "$(G4Field_root)" "$(G4Field_root)/dict"
+
+#  macro G4Field_linkopts "-lMagneticFieldStand"
+
+library G4Field ../src/*.cxx
+apply_pattern installed_library
+
+private
+
+apply_pattern lcgdict dict=G4Field \
+                headerfiles="../G4Field/G4FieldDict.h" \
+                selectionfile=selection.xml
+macro_prepend G4FieldDict_shlibflags " -lG4Field "
diff --git a/Simulation/G4Utilities/G4Field/data/field.dtd b/Simulation/G4Utilities/G4Field/data/field.dtd
new file mode 100755
index 00000000000..6dc117e2935
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/data/field.dtd
@@ -0,0 +1,17 @@
+<?xml encoding="ISO-8859-1"?>
+
+<!-- @version: -->
+
+<!ELEMENT FADS (ConstantField*)+>
+
+<!ELEMENT  ConstantField  EMPTY>
+<!ATTLIST  ConstantField
+        Bx    	CDATA #IMPLIED
+        By      CDATA #IMPLIED
+        Bz     	CDATA #IMPLIED
+	Xmin	CDATA #IMPLIED
+	Xmax	CDATA #IMPLIED
+	Ymin	CDATA #IMPLIED
+	Ymax	CDATA #IMPLIED
+	Zmin	CDATA #IMPLIED
+	Zmax	CDATA #IMPLIED>
diff --git a/Simulation/G4Utilities/G4Field/data/field.xml b/Simulation/G4Utilities/G4Field/data/field.xml
new file mode 100755
index 00000000000..af7c146fe8c
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/data/field.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE FADS SYSTEM "field.dtd">
+
+<FADS>
+
+<ConstantField 
+        Bx="0.0" 
+        By="0.0"
+        Bz="2.0"/>
+
+</FADS>
diff --git a/Simulation/G4Utilities/G4Field/doc/mainpage.h b/Simulation/G4Utilities/G4Field/doc/mainpage.h
new file mode 100644
index 00000000000..c6bf2bd9796
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/doc/mainpage.h
@@ -0,0 +1,35 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+@mainpage  G4Field
+@author Andrea Dell'Acqua (dellacqu@mail.cern.ch)
+
+@section G4Field Introduction
+
+This package provides a simple interface to G4 Fields and for modifying the magnetic field to be used during simulation.
+
+@section G4Field Class Overview
+
+The package includes the following classes:
+ - AtlasField , H8Field , H8FieldSym , ConstantField : Various base classes for fields which can be used during simulation (including, of course, test beam simulation)
+ - ConstantFieldHandler : An interface for constructing constant fields
+ - ConstantFieldXMLHandler : An interface for constructing constant fields from an XML file
+ - FieldMapMgr : The manager that handles the fields which will be used during the simulation
+
+@ref used_G4Field
+
+@ref requirements_G4Field
+
+*/
+
+/**
+@page used_G4Field Used Packages
+@htmlinclude used_packages.html
+*/
+
+/**
+@page requirements_G4Field Requirements
+@include requirements
+*/
diff --git a/Simulation/G4Utilities/G4Field/run/atlasfield.mac b/Simulation/G4Utilities/G4Field/run/atlasfield.mac
new file mode 100755
index 00000000000..87f03df3558
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/run/atlasfield.mac
@@ -0,0 +1,3 @@
+/load G4Field
+/MagneticField/Select AtlasField
+/MagneticField/Initialize
diff --git a/Simulation/G4Utilities/G4Field/run/clid b/Simulation/G4Utilities/G4Field/run/clid
new file mode 100755
index 00000000000..88ef5dbcea4
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/run/clid
@@ -0,0 +1,33 @@
+#!/bin/csh -f 
+#
+set thisdir = ${0:gh}
+cd $thisdir 
+set thisdir = $cwd
+cd -
+#
+# define default CLIDDB if not defined by user
+#
+if( ! $?CLIDDB )then
+    setenv CLIDDB ${thisdir}/clid.db
+endif
+if( ! -f $CLIDDB )then
+    echo "You must point to a CLID database with CLIDDB."
+endif
+#
+# make sure Python is good version - try CERN default if not
+#
+set isgp = `python -c 'import sys;print (sys.hexversion >= 0x20000f0)'`
+if( 0 == ${isgp} )then
+    set path = ( /usr/local/bin $path )
+    rehash
+    set isgp = `python -c 'import sys;print (sys.hexversion >= 0x20000f0)'`
+    if( 0 == ${isgp} )then
+        echo "clid ERROR -- Cannot find good Python (2.0.0 or higher)."
+        echo "              Please change PATH and try again."
+        exit 0
+    endif
+endif
+#
+# 
+${thisdir}/clid.py $*
+#
diff --git a/Simulation/G4Utilities/G4Field/run/clid.db b/Simulation/G4Utilities/G4Field/run/clid.db
new file mode 100755
index 00000000000..9bb1c3caace
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/run/clid.db
@@ -0,0 +1,508 @@
+0 NULL
+1 DataObject
+3 Catalog
+32 H1D
+33 H1DVar
+34 ProfileH
+35 ProfileHVar
+36 H2D
+37 H2DF
+38 H2DVar
+40 StatisticsFile
+41 StatisticsDirectory
+42 RowWiseTuple
+43 ColumnWiseTuple
+50 H3D
+51 H3DF
+52 H3DVar
+190 ContainedObject
+1434 BaseClass
+2201 McEvent
+2211 ParticleContainer
+2212 VertexContainer
+2221 Gen_HEPEVT
+2301 ATLFAST_CELL
+2302 ATLFAST_CLUSTER
+2303 ATLFAST_EVENT_HEADER
+2304 ATLFAST_Jet
+2305 ATLFAST_RECONSTRUCTED_PARTICLE
+2306 ATLFAST_Track
+2307 ATLFAST_ATLFASTPROTO
+2308 ATLFAST_TWOCPTCELL
+2310 MissingMomentum
+2311 Atlfast::CellCollection
+2312 Atlfast::ClusterCollection
+2314 Atlfast::JetCollection
+2315 Atlfast::ReconstructedParticleCollection
+2316 Atlfast::TrackCollection
+2318 Atlfast::SimpleKinematicCollection
+2319 Atlfast::IKinematicCollection
+2350 DataVector<Atlfast::MyBigClass>
+2351 DataVector<Atlfast::TwoCptCell>
+2399 TestAtlfast::SimpleTestStatisticCollection
+2401 ObjectIdentifierMap
+2410 ADetDescrManager
+2411 IdDictManager
+2493 ZebraTDREvent
+2494 AsciiFileEvent
+2510 SiDetectorElementCollection
+2511 SiDetectorDesignCollection
+2512 InDet_DetDescrManager
+2516 PixelID
+2517 SCT_ID
+2518 TRT_ID
+2520 GeoSiDeltaTransform
+2530 SiTrackerHitCollection
+2531 SiTrackerDigitCollection
+2532 SiTrackerHitContainer
+2533 SiTrackerDigitContainer
+2534 InDetRawDataCollection<Pixel1RawData>
+2535 InDetRawDataCollection<SCT1_RawData>
+2536 InDetRawDataCollection<TRT_LoLumRawData>
+2537 InDetRawDataCollection<PixelRDORawData>
+2538 InDetRawDataCollection<SCT_RDORawData>
+2539 InDetRawDataCollection<TRT_RDORawData>
+2540 PixelG4HitCollection
+2541 PixelG4HitContainer
+2550 SiTrackerClusterCollection
+2551 SiTrackerSpacePointSet
+2552 SiTrackerClusterContainer
+2553 DataVector<SiTrackerSpacePoint>
+2554 InDetRecInputCollection<PixelCluster>
+2555 InDetRecInputCollection<SCT_Cluster>
+2556 InDetRecInputCollection<TRT_DriftCircle>
+2557 InDetRecInputCollection<ExtendedPixelCluster>
+2558 InDetRecInputCollection<ExtendedSCT_Cluster>
+2559 InDetRecInputCollection<ExtendedTRT_DriftCircle>
+2701 LArHitContainer
+2711 LArDigitContainer
+2714 LArFEB_DataContainer
+2721 LArRawChannelContainer
+2722 LArRawChannel
+2723 LArRawChannelCollection
+2724 LArCellCollection
+2725 LArCellIDC
+2731 LArCellContainer
+2733 LArMiniCellContainer
+2741 LArDetDescrManager
+2751 LArClusterContainer
+2781 LArTBBeamChambersCont
+2782 LArTBCalibContainer
+2783 LArTBHVDataContainer
+2784 LArTBEvent
+2785 LArTBInstrument
+2786 LArTBRun
+2787 LArTBSlowControl
+2788 LArTBPedestalCont
+2791 LArTBSignalContainer
+2792 LArTBTimingObject
+2797 LArHECTBEvent
+2802 CaloCellContainer
+2804 CaloTowerContainer
+2806 CaloClusterContainer
+2910 TileInfo
+2923 TileHitContainer
+2924 TileHitCollection
+2925 TileDigitsContainer
+2926 TileDigitsCollection
+2927 TileRawChannelContainer
+2928 TileRawChannelCollection
+2929 TileCellIDC
+2930 TileCellCollection
+2931 TileCellContainer
+2941 TileDetDescrManager
+2999 TESTATLFAST_EXAMPLECONTAINEDOBJECT
+3001 Jet
+3002 PROTOJET
+3004 ProtoJetCollection<ProtoJet>
+3005 JetCollection<Jet>
+3006 JetCollection<CombinedJet>
+3007 JetCollection<CombinedJetSums>
+3052 MissingET
+3053 MissingETCellList
+3054 MissingETCell
+3055 MissingETRegionCalib
+3101 SimpleTrack
+3127 egammaContainer
+3151 iPatTrackContainer
+3176 tauContainer
+3200 CONDITION
+3201 TRACKS
+3202 VIZITOR
+3203 ROADS
+3204 VERTICES
+3205 DETECTOR
+3226 PlottableTrackSet
+3227 SiTrackerElementSet
+3251 SimpleVertexContainer
+3252 SIMPLE_VERTEX
+3255 ConversionCollection
+3550 InDetRecInputCollection<TrigSiSpacePoint>
+4025 MUONRECDIGISTORETDS
+4026 MB_TRACKSTORETDS
+4050 MooRoadContainer
+4051 RPCHitCollection
+4052 TGCHitCollection
+4053 CSCHitCollection
+4057 std::vector<MooTrigCluster*>
+4058 std::vector<MooTrigRoad*>
+4059 std::vector<MooTrackSegment*>
+4060 MuonDetDescrManager
+4075 MuonTBEvent
+4076 MUONTBDIGIT
+4100 MDTHitCollection
+4101 ScintillatorHitCollection
+4102 StreamerHitCollection
+4103 MDTDigitCollection
+4104 ScintillatorDigitCollection
+4105 StreamerDigitCollection
+4106 MDTDigitContainer
+4107 ScintillatorDigitContainer
+4108 StreamerDigitContainer
+4109 TrackPointCollection
+4110 TrackPointContainer
+4111 TrackSegmentCollection
+4112 TrackSegmentContainer
+4113 TrackCollection
+4120 MuonCosmicTeststandNode
+4121 MuonCTDetDescrManager
+4122 MDTDetectorElement
+4123 ScintiDetectorElement
+4124 StreamerDetectorElement
+4125 MDTDescriptor
+4126 ScintiDescriptor
+4127 StreamerDescriptor
+4130 MDTIdHelper
+4131 ScintiIdHelper
+4132 StreamerIdHelper
+4140 Discriminator::Map
+4141 TriggerInfo
+4142 DriftTimeRelation
+4189 RpcPad
+4190 RpcPadContainer
+4191 MdtDigitContainer
+4192 RpcDigitContainer
+4193 TgcDigitContainer
+4194 CscDigitContainer
+4195 MdtDigitCollection
+4196 RpcDigitCollection
+4197 TgcDigitCollection
+4198 CscDigitCollection
+4339 TCell
+5000 AccbdigAcdg
+5001 AccbgeoAcca
+5002 AccbgeoAccg
+5003 AccbgeoAcco
+5004 AccbgeoAcmb
+5005 AmdbgeoAmdb
+5006 AmdbgeoBoma
+5007 AmdbgeoBomb
+5008 AmdbgeoBomc
+5009 AmdbgeoBomd
+5010 AmdbgeoBome
+5011 AmdbgeoBomf
+5012 AmdbgeoDbsc
+5013 AmdbgeowWcsc
+5014 AmdbgeowWded
+5015 AmdbgeowWhed
+5016 AmdbgeowWmax
+5017 AmdbgeowWmdt
+5018 AmdbgeowWrpc
+5019 AmdbgeowWspa
+5020 AmdbgeowWsup
+5021 AmdbgeowWtgc
+5022 AtlsgeoAtls
+5023 AxxxrecAgcc
+5024 AxxxrecAgcr
+5025 AxxxrecAgxx
+5026 AxxxrecEffb
+5027 AxxxrecEffi
+5028 AxxxrecPmod
+5029 CalounpkCcal
+5030 CalounpkCreg
+5031 CoilgeoCoic
+5032 CoilgeoCoil
+5033 CopsdigCopd
+5034 CopsgeoCoca
+5035 CopsgeoCopg
+5036 CopsgeoCpsm
+5037 CryodigCdig
+5038 CryogeoBolt
+5039 CryogeoBring
+5040 CryogeoChit
+5041 CryogeoCone
+5042 CryogeoCrak
+5043 CryogeoCram
+5044 CryogeoCrap
+5045 CryogeoCrat
+5046 CryogeoCreb
+5047 CryogeoCree
+5048 CryogeoCrek
+5049 CryogeoCrem
+5050 CryogeoCrsb
+5051 CryogeoCrse
+5052 CryogeoCrsm
+5053 CryogeoCrsn
+5054 CryogeoCryb
+5055 CryogeoCrye
+5056 CryogeoCrym
+5057 CryogeoPsam
+5058 EcalrecComb
+5059 EcalrecEmfl
+5060 EcalrecEpar
+5061 EndegeoEcdg
+5062 EndegeoEndg
+5063 EndegeoEndl
+5064 EndegeoEreg
+5065 EndegeoEsep
+5066 EndegeoEwhl
+5067 EndegeoEwop
+5068 Fwdcdig1Fwdd
+5069 Fwdcgeo1Fwdg
+5070 Fwdcgeo1Fwsi
+5071 HcalrecEpar
+5072 HenddigHdig
+5073 HendgeoHblo
+5074 HendgeoHeng
+5075 HendgeoHetr
+5076 InafgeoInag
+5077 InafgeoInel
+5078 InafgeoIpan
+5079 InafgeoPbfi
+5080 MfldgeoCfelix
+5081 MfldgeoCobmag
+5082 MfldgeoMflg
+5083 MintgeoBari
+5084 MintgeoIscd
+5085 MintgeoMint
+5086 MintgeoMmri
+5087 MuchdigBcsd
+5088 MuchdigCsdi
+5089 MuchdigCseg
+5090 MuchdigGgcd
+5091 MuchdigGgsd
+5092 MuchdigMdtd
+5093 MuchdigRpcd
+5094 MuchgeoAadt
+5095 MuchgeoBbdt
+5096 MuchgeoCcsc
+5097 MuchgeoDdsc
+5098 MuchgeoMgas
+5099 MuchgeoMgeo
+5100 MuchgeoMtub
+5101 MuchgeoNcsc
+5102 MuchgeoNmdt
+5103 MuchgeoNtgc
+5104 MuchgeoQqgc
+5105 MuchgeoRrpc
+5106 MuchgeoTtgc
+5107 MuchgeoWfxo
+5108 PipegeoPipe
+5109 PixbdigPbda
+5110 PixbdigPdbs
+5111 PixbdigPdch
+5112 PixbdigPdig
+5113 PixbdigPeff
+5114 PixbdigPets
+5115 PixbdigPlor
+5116 PixbdigPlrn
+5117 PixbdigPmod
+5118 PixbdigPtot
+5119 PixbdigPxbd
+5120 PixbgeoPbac
+5121 PixbgeoPbfi
+5122 PixbgeoPboi
+5123 PixbgeoPbrn
+5124 PixbgeoPbsv
+5125 PixbgeoPbvs
+5126 PixbgeoPonl
+5127 PixbgeoPxbg
+5128 PixbgeoPxbi
+5129 PixbgeoPxbo
+5130 PixbgeoPxbs
+5131 PixbgeoPxpa
+5132 PixedigPdes
+5133 PixedigPeda
+5134 PixedigPedc
+5135 PixedigPedi
+5136 PixedigPmod
+5137 PixedigPxed
+5138 PixegeoPeac
+5139 PixegeoPefi
+5140 PixegeoPeni
+5141 PixegeoPeoi
+5142 PixegeoPeti
+5143 PixegeoPevo
+5144 PixegeoPevs
+5145 PixegeoPezi
+5146 PixegeoPxeg
+5147 PixegeoPxei
+5148 PixegeoPxes
+5149 ScttdigSctd
+5150 ScttdigSdig
+5151 ScttdigSdrp
+5152 ScttdigSido
+5153 ScttdigStbm
+5154 ScttgeoScen
+5155 ScttgeoSctg
+5156 ScttgeoScti
+5157 ScttgeoStel
+5158 ScttgeoSths
+5159 Tiledig2Tdig
+5160 TilegeoScnt
+5161 TilegeoTicg
+5162 TilegeoTifg
+5163 TilegeoTigr
+5164 TilegeoTilb
+5165 TilegeoTile
+5166 XkalmanooInro
+5167 XtrtdigTrtd
+5168 XtrtdigTrtt
+5169 XtrtgeoTrtb
+5170 XtrtgeoTrtg
+5171 XtrtgeoTrtm
+5172 XtrtgeoTsci
+5173 ZsctdigZdig
+5174 ZsctdigZdrp
+5175 ZsctdigZido
+5176 ZsctdigZscd
+5177 ZsctdigZtbm
+5178 ZsctgeoZscg
+5179 ZsctgeoZscr
+5180 ZsctgeoZscw
+5181 ZsctgeoZtel
+5182 ZsctgeoZths
+6000 ROIB::RoIBResult
+6002 LVL1MUCTPI::Lvl1MuCTPIInput
+6010 LVL1CTP::CTPCaloConfig
+6011 LVL1CTP::CTPMuonConfig
+6012 LVL1CTP::CTPJetEnergyConfig
+6013 LVL1CTP::CTPSLink
+6020 LVL1CTP::TriggerMenu
+6040 LVL1CTP::CTPResult
+6050 LVL1CTP::TriggerThreshold
+6060 LVL1CTP::TriggerThresholdValue
+6070 LVL1::MuCTPICTP
+6102 LVL1MUONIF::Lvl1MuCTPIInput
+6103 L1MUINT::MuCTPIToRoIBSLink
+6150 std::vector<LVL1TGCTrigger::TGCASDOut>
+6200 LVL1::EmTauROI
+6201 DataVector<LVL1::EmTauROI>
+6202 LVL1::JetElement
+6203 DataVector<LVL1::JetElement>
+6204 LVL1::JetROI
+6205 DataVector<LVL1::JetROI>
+6206 LVL1::TriggerTower
+6207 DataVector<LVL1::TriggerTower>
+6250 DataVector<LVL1CTP::SlinkWord>
+6251 LVL1CTP::SlinkWord
+6252 LVL1::JetCTP
+6253 LVL1::EmTauCTP
+6254 LVL1::EnergyCTP
+6255 LVL1::EnergyRoI
+6256 DataVector<LVL1::RecEmTauRoI>
+6257 LVL1::RecEmTauRoI
+6401 TriggerElement
+6402 key2keyStore
+6510 T2EMCluster
+7000 TRT_DigitVector
+7001 ByteStream
+8000 MyDataObj
+8001 IntList
+8002 std::vector<int>
+8003 std::map<int,float>
+8004 AbstractType
+8005 WrongType
+8100 IntVector
+8101 Foo
+8102 map<int,string>
+8103 NotThere
+8104 Base
+8105 int
+8107 Bar
+8120 ILArOFC_Shape
+8122 ILArPedestal
+8123 ILArRamp
+8124 ILArAutoCorr
+8125 ILArNoise
+8127 LArNoiseSimple
+8128 LArRampSimple
+8129 LArPedestalSimple
+8130 LArOFC_ShapeSimple
+8131 LArAutoCorrSimple
+8132 LArOFC_ShapeTB
+8233 MapSF
+8670 TRUTHPROTO
+8671 COMBINEDJET
+8672 COMBINEDJETSUMS
+9102 MyContObj
+9103 MyLinkHolder
+9380 TECollection
+9802 eflowCaloObjectContainer
+9804 eflowObjectContainer
+9875 GeoModelExperiment
+9876 ToyDetectorNode
+9877 PixelDetectorNode
+9901 SGTutorial::MyDataObj
+9903 std::vector<SGTutorial::MyElement>
+9905 LArCluster
+9909 SGTutorial::LinkObj
+9937 ERmap
+9967 DataVector<MyContObj>
+9976 ZeeContainer
+9978 HLT::MenuTable*
+9979 HLT::SequenceTable*
+9980 std::vector<float>
+9981 std::list<MyContObj>
+9982 MapStringFloat
+9983 std::vector<ElementLink<MapStringFloat>>
+9984 std::list<ElementLink<std::vector<float>>>
+10000 MYCOLLECTION
+10123 std::vector<std::string>
+10124 std::vector<G4VHit*>
+10125 std::vector<G4VTrajectory*>
+11111 LArCell
+12000 ATLFastSTLObject
+12001 ATLFCellObject
+12002 ATLFClusterObject
+12003 ATLFElectronObject
+12004 ATLFMuonObject
+12005 ATLFPhotonObject
+12006 ATLFJetObject
+12007 ATLFTrackObject
+12008 ATLFTriggerObject
+12009 ATLFMiscObject
+12010 ATLFParticleObject
+12011 ATLFastFObject
+12101 ATLFCellMakerObject
+12102 ATLFClusterMakerObject
+12103 ATLFElectronMakerObject
+12104 ATLFMuonMakerObject
+12105 ATLFPhotonMakerObject
+12106 ATLFJetMakerObject
+12107 ATLFTrackMakerObject
+12108 ATLFTriggerMakerObject
+12109 ATLFMiscMakerObject
+20000 HitCollectionBase
+20001 HitFooCollection
+20012 HitContainer
+20244 FilterFlags
+22222 LArDigit
+100001 TrigTrack
+214213 MYDATAOBJ
+214215 MYCONTOBJ
+238800 MOOOBJECT
+238810 MOOTRIGCLUSTER
+238860 MOOTRIGROAD
+238870 MOOTRACKSEGMENT
+238880 MOOTRACK
+243254 SIMPLECELL
+314159 PREPROCESSEDROI
+444444 LArRawCell
+725301 point3d
+725302 point3dCollection
+7848000 RMS_Entity
+10003101 SimpleTrackCollection
+20121975 EmTauCTP
+606197801 G4VSensitiveDetector
+2002197540 DriftRadiusMap
diff --git a/Simulation/G4Utilities/G4Field/run/clid.py b/Simulation/G4Utilities/G4Field/run/clid.py
new file mode 100755
index 00000000000..c69577cae4b
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/run/clid.py
@@ -0,0 +1,244 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+exec python -tx "$0" "$@"
+
+# Copyright (c) 2002-2003, cetull@lbl.gov
+# Driver for Athena CLID Generator
+# BUGS: 
+# * None Known
+#
+import string, re
+import sys, getopt, os
+import clidGen
+
+# PROGRAM NAME
+prog = os.path.basename(sys.argv[0])
+
+# DEBUG Flag: Turns on DEBUG printout (default = false)
+debug = 0
+# MACRO Flag: Turns on macro option (default = false)
+macro = 0
+# SILENT Flag: Turns on silent option (default = false)
+silent = 0
+# CLID DataBase
+cliddb = ''
+# List of regular expressions to process
+relist = []
+# List of "CLID==NAME"
+valist = []
+
+#
+# Help Messages
+#
+def usage_message():
+    print '''usage:''',prog,'''[-hmsuv] [--db=<clid.db>] [name ...] [clid ...]'''
+#
+def usage_message_full():
+    print '''usage:''',prog,'''[-dhmsuv] [--db=<clid.db>] [name ...] [clid ...]'''
+#
+def help_message():
+    print prog,'''- Athena CLID Generator
+Usage:''',prog,'''<options> [<ClassName>] [<CLID>]
+Options and arguments:  
+-b <clid_db>: Reconcile generated CLID with CLID DataBase <clid_db>.
+-f <regex>  : Find entry whose ClassName or CLID matches <regex>.
+              (See Python re module for syntax of regex.)
+-h          : Print this help message and exit.
+-m          : Print macro call for StoreGate.
+-s          : Be more silent on output. Print _only_ result.
+              (N.B. Overrides -m option.)
+-u          : Print usage message and exit.
+-v          : Print version string and exit.
+--db=<clid_db>: Synonym for -b.
+--find=<regex>: Synonym for -f.
+--help        : Synonym for -h.
+--macro       : Synonym for -m.
+--silent      : Synonym for -s.
+--usage       : Synonym for -u.
+--version     : Synonym for -v.
+Examples: '''
+    print '    ',prog,'-h'
+    print '    ',prog,'--version'
+    print '    ',prog,'LArCell'
+    print '    ',prog,'--db=clid.db LArCell'
+    print '    ',prog,'--db=clid.db 2001'
+    print '    ',prog,'--db=clid.db -f "Cr"'
+
+#
+#
+def help_message_full():
+    print prog,'''- Athena CLID Generator
+Usage:''',prog,'''<options> [<ClassName>] [<CLID>]
+Options and arguments:  
+-b <clid_db>: Reconcile generated CLID with CLID DataBase <clid_db>.
+-d          : Print DEBUG information during execution.
+-f <regex>  : Find entry whose ClassName or CLID matches <regex>.
+              (See Python re module for syntax of regex.)
+-h          : Print this help message and exit.
+-m          : Print macro call for StoreGate.
+-s          : Be more silent on output. Print _only_ result.
+              (N.B. Overrides -m option.)
+-u          : Print usage message and exit.
+-v          : Print version string and exit.
+--db=<clid_db>: Synonym for -b.
+--debug       : Synonym for -d.
+--find=<regex>: Synonym for -f.
+--help        : Synonym for -h.
+--macro       : Synonym for -m.
+--silent      : Synonym for -s.
+--usage       : Synonym for -u.
+--version     : Synonym for -v.
+Examples: '''
+    print '    ',prog,'-h'
+    print '    ',prog,'--version'
+    print '    ',prog,'-d LArCell'
+    print '    ',prog,'--db=clid.db LArCell'
+    print '    ',prog,'--db=clid.db 2001'
+    print '    ',prog,'--db=clid.db -f "Cr"'
+
+#
+# Error Message
+#
+def err_message():
+    print prog,'''- Error:
+You tried to use an unknown option or the argument for an option that
+requires one was missing.
+Try `''',prog,''' -h\' for more information.'''
+
+#
+# Unimplemented Option Message
+#
+def unimpl_message(AAA):
+    print prog,'''- Error:''',AAA,'''
+You tried to use an unimplemented option. This feature will be
+available in a future release.
+Try `''',prog,''' -h\' for more information.'''
+
+#
+# Depricated Option Message
+#
+def depricated_message(AAA):
+    print prog,'''- Error:''',AAA,'''
+You tried to use a depricated option. This feature is no longer
+available, though the option remains for compatability.
+Try `''',prog,''' -h\' for more information.'''
+
+#
+# Parse the options and their arguments.
+#
+kflags = 'b:df:hmsuvx:'
+kargs = ['db=','debug','find=','help','macro','silent','usage','version']
+try:
+    options, xarguments = getopt.getopt(sys.argv[1:],kflags,kargs)
+except getopt.error:
+    err_message()
+    sys.exit(0)
+
+#
+# Require at least one argument.
+#
+if len(sys.argv) == 1:
+    help_message()
+    sys.exit(0)
+
+#
+# Process known options.
+#
+for a in options[:]:
+    # STANDARD UTILITY OPTIONS
+    if a[0] == '-d' or a[0] == '--debug':
+        debug = 1
+        options.remove(a)
+    if a[0] == '-h' or a[0] == '--help':
+        help_message()
+        options.remove(a)
+        sys.exit(0)
+    if a[0] == '-s' or a[0] == '--silent':
+        silent = 1
+        options.remove(a)
+    if a[0] == '-u' or a[0] == '--usage':
+        usage_message()
+        options.remove(a)
+        sys.exit(0)
+    if a[0] == '-v' or a[0] == '--version':
+        print sys.argv[0],'$Revision: 1.1.1.1 $ (08jul02-cetull@lbl.gov)'
+        options.remove(a)
+        sys.exit(0)
+    # CLID OPTIONS
+    if a[0] == '-b' or a[0] == '--db':
+        if debug: print 'CLID DB =',a[1]
+        cliddb = a[1]
+        options.remove(a)
+    if a[0] == '-f' or a[0] == '--find':
+        if debug: print 'CLID FIND =',a[1]
+        relist.append(a[1])
+        options.remove(a)
+    if a[0] == '-m' or a[0] == '--macro':
+        macro = 1
+        options.remove(a)
+    if a[0] == '-x':
+        valist.append(a[1])
+        options.remove(a)
+
+#
+# Process unknown options.
+#
+for a in options[:]:
+    unimpl_message(a)
+    options.remove(a)
+
+#
+# Initialize 
+#
+if cliddb: 
+    cgen = clidGen.clidGenerator(cliddb)
+else:
+    cgen = clidGen.clidGenerator("")
+if debug: print "repository = ",cgen._clidGenerator__clidRep
+
+#
+# Process ClassName arguments
+#
+for a in xarguments:
+    try:
+        i = int(a)
+    except:
+        n = a
+        c = cgen.genClidFromName(a)
+    else:
+        n = cgen.getNameFromClid(i)
+        c = i
+        if not n:
+            n = ">>>Not Found in CLIDDB<<<"
+    if debug: 
+        print c,n,'(',hash(n),hash(n)&cgen._clidGenerator__mask,"%8x"%c,')'
+    else:
+        if silent: print c
+        else:
+            if macro: print "CLASS_DEF(",n,",",c,", 1 )"
+            else: print c,n
+
+#
+# Process RegEx list
+#
+for p in relist:
+    print '>>> Searching CLIDDB for (',p,') <<<'
+    print cgen.findPattern(p)
+
+#
+# Process Validation list
+#
+for p in valist:
+    pp = string.split(p,'==')
+#   print 'Validating(',pp,')'
+    ppid = cgen.getClidFromName(pp[1])
+    if ppid == int(pp[0]):
+        print pp,'is a valid pair.',ppid
+    else:
+        print pp,'is not a valid pair.',ppid
+        sys.exit(1)
+#
+# Write out new repository
+#
+cgen.writedb("new.db")
+#
diff --git a/Simulation/G4Utilities/G4Field/run/clidGen.py b/Simulation/G4Utilities/G4Field/run/clidGen.py
new file mode 100755
index 00000000000..6898ad5935a
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/run/clidGen.py
@@ -0,0 +1,101 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+# Copyright (c) 2002-2003, Lawrence Berkeley National Laboratory, CETull@lbl.gov
+# Athena CLID Generator Class
+#
+import string, re, os
+
+class clidGenerator:
+    "Athena CLID Generator"
+    __clidGenerator_type = "Basic"
+    __clidGenerator_version = "$Revision: 1.1.1.1 $"
+    # CLID Mask: Determines bits used for CLID
+    __mask = 0x0FFFFFFF
+    # CLID Repositories - Dictionaries of CLID<=>Name
+    __clidRep = {} # Lookup by CLID
+    __nameRep = {} # Lookup by ClassName
+    # CLID DataBase (Default = clid.db)
+#   __cliddb = os.getenv('CLIDDB')
+    def __init__(self,db):
+        "Initializes a CLID Generator object with a CLID Database"
+        if db:
+            self.__cliddb = db
+        else:
+            # CLID DataBase (Default = clid.db)
+            self.__cliddb = os.getenv('CLIDDB')
+        self.readdb()
+#   def __init__(self):
+#       "Initializes a default CLID Generator object"
+#       self.__cliddb = os.getenv('CLIDDB')
+#       self.readdb()
+    def readdb(self):
+        "Read CLID DataBase file"
+        try:
+            if os.path.isfile(self.__cliddb):
+                input = open(self.__cliddb,'r')
+                s = input.readlines()
+                for l in s:
+                    ll = string.split(l)
+                    self.__clidRep[int(ll[0])] = ll[1]
+                    self.__nameRep[ll[1]] = int(ll[0])
+                input.close()
+        except:
+            print "No CLID DataBase file"
+    def writedb(self,db):
+        "Read CLID DataBase file"
+        output = open(db,'w')
+        for k in self.__clidRep.keys():
+            output.write("%d "%k+self.__clidRep[k]+"\n")
+        output.close()
+    def genClidFromName(self,className):
+        """Generate CLID from ClassName: A recursive hash with a bit
+        mask and validity range. Will check collisions against and
+        update CLID Repository."""
+        n = self.demangleClassName(className)
+        c = self.getClidFromName(className)
+        if c:
+            return c
+        c = hash(className) & self.__mask
+        if c < 10001 or c > self.__mask:
+            c = self.genClidFromName(className+'_')
+        if self.isCollection(className):
+            c += 0x40000000
+        if self.__clidRep.has_key(c):
+            if n != self.__clidRep[c]:
+                c = self.genClidFromName(className+'_')
+        else:
+            self.__clidRep[c] = n
+            self.__nameRep[n] = c
+        return c
+    def getClidFromName(self,className):
+        "Get the CLID in the repository of class name <className>"
+        if self.__nameRep.has_key(className):
+            return self.__nameRep[className]
+        else:
+            return None
+    def getNameFromClid(self,clid):
+        "Get the class name in the repository with CLID <clid>"
+        if self.__clidRep.has_key(clid):
+            return self.__clidRep[clid]
+        else:
+            return None
+    def demangleClassName(self,s):
+        pat = re.compile('\s*(.?)__*\s*')
+        n = pat.findall(s)
+        if n:
+            return n[0]
+        else:
+            return s
+    def isCollection(self,className):
+        collMatch = re.search(r'.*?Collection_*|.*?Container_*',className)
+        return collMatch
+    def findPattern(self,s):
+        """Find the regular expression pattern s in dictionary."""
+#        pat = re.compile('^'+s+'$')
+        pat = re.compile(s)
+        results = {}
+        for k in self.__clidRep.keys():
+            if pat.match(str(k)) or pat.match(self.__clidRep[k]):
+                results[k] = self.__clidRep[k]
+        return results
+
diff --git a/Simulation/G4Utilities/G4Field/run/jobOptions.G4Svc.txt b/Simulation/G4Utilities/G4Field/run/jobOptions.G4Svc.txt
new file mode 100755
index 00000000000..07922f47249
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/run/jobOptions.G4Svc.txt
@@ -0,0 +1,40 @@
+//==============================================================
+//
+// Job options file for G4Svc
+//
+// $Id: jobOptions.G4Svc.txt,v 1.1.1.1 2003-05-21 12:19:11 dellacqu Exp $
+// $Name: not supported by cvs2svn $
+//
+//==============================================================
+
+ApplicationMgr.DLLs   += { "G4Svc" };
+ApplicationMgr.ExtSvc += { "G4Svc" };
+
+
+//--------------------------------------------------------------
+
+
+// PhysicsList can be one of "ExN01", "ExN02", "ExN03", "ExN04"
+//                           "Geantino", "EM", "Full", "none"
+// Comment out or use "none" to ignore.
+G4Svc.PhysicsList     = "Geantino";
+
+// physics cut in mm
+G4Svc.DefaultPhysicsCut = 1.0;
+
+
+// Save things in StoreGate
+G4Svc.SaveHits        = true;
+G4Svc.SaveTracks      = false;
+
+// Visualization
+G4Svc.Visualize	      = false;	
+G4Svc.VisType         = "VRML1FILE";
+
+// geant4 verbosity
+G4Svc.RunVerbosity    = 1;
+G4Svc.EventVerbosity  = 0;
+G4Svc.TrackingVerbosity = 0;		      
+
+//--------------------------------------------------------------
+
diff --git a/Simulation/G4Utilities/G4Field/src/ConstantField.cxx b/Simulation/G4Utilities/G4Field/src/ConstantField.cxx
new file mode 100755
index 00000000000..f783a1d1b16
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/src/ConstantField.cxx
@@ -0,0 +1,67 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "G4Field/ConstantField.h"
+#include <iostream>
+#include "FadsField/MagneticFieldMapT.h"
+#include "G4Field/ConstantFieldXMLHandler.h"
+// Geant4 includes
+#include "G4ThreeVector.hh"
+
+static FADS::MagneticFieldMapT<ConstantField> id("ConstantField");
+
+ConstantField::ConstantField()
+{
+	checkXdim=checkYdim=checkZdim=false;
+	xMinField=yMinField=zMinField=-100*CLHEP::km;
+	xMaxField=yMaxField=zMaxField=100*CLHEP::km;
+	theHandler=new ConstantFieldXMLHandler(GetName(),this);
+	std::cout<<" Constant field "<<GetName()<<"being initialised "<<std::endl;
+	FieldValueX=0;
+	FieldValueY=0;
+	FieldValueZ=2.*CLHEP::tesla;
+}
+
+ConstantField::ConstantField(std::string n):FADS::MagneticFieldMap(n)
+{
+	checkXdim=checkYdim=checkZdim=false;
+	xMinField=yMinField=zMinField=-100*CLHEP::km;
+	xMaxField=yMaxField=zMaxField=100*CLHEP::km;
+	theHandler=new ConstantFieldXMLHandler(n,this);
+	std::cout<<" Constant field "<<n<<"being initialised "<<std::endl;
+	FieldValueX=0;
+	FieldValueY=0;
+	FieldValueZ=2.*CLHEP::tesla;
+}
+
+ConstantField::~ConstantField()
+{
+	delete theHandler;
+}
+
+void ConstantField::Initialize()
+{
+	std::cout<<" Constant field "<<GetName()<<"initialized. Field components: "<<
+		FieldValueX/CLHEP::tesla<<" "<<FieldValueY/CLHEP::tesla<<" "<<FieldValueZ/CLHEP::tesla<<
+		" (field components in Tesla)"<<std::endl;
+}
+
+void ConstantField::FieldValue(const double *pos, double *bfield) const
+{
+
+  // check whether we need to set the field to zero
+  bool setZero = checkXdim && (pos[0]<xMinField || pos[0]>xMaxField);
+  setZero     |= checkYdim && (pos[1]<yMinField || pos[1]>yMaxField);
+  setZero     |= checkZdim && (pos[2]<zMinField || pos[2]>zMaxField);
+
+  if (setZero) {
+    for (int i=0; i<3; i++) bfield[i] = 0.;
+  } else {
+    bfield[0] = FieldValueX;
+    bfield[1] = FieldValueY;
+    bfield[2] = FieldValueZ;
+  }
+
+	return;
+}
diff --git a/Simulation/G4Utilities/G4Field/src/ConstantFieldHandler.cxx b/Simulation/G4Utilities/G4Field/src/ConstantFieldHandler.cxx
new file mode 100755
index 00000000000..7e894a76000
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/src/ConstantFieldHandler.cxx
@@ -0,0 +1,96 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "G4Field/ConstantFieldHandler.h"
+
+#include "FadsField/FieldManager.h"
+#include "FadsField/MagneticFieldMap.h"
+#include "G4Field/ConstantField.h"
+// Geant4 includes
+#include "G4MagneticField.hh"
+#include "G4SystemOfUnits.hh"
+
+ConstantFieldHandler::ConstantFieldHandler()
+{
+  std::cout << "Creating the ConstantFieldHandler" << std::endl;
+}
+
+void ConstantFieldHandler::setFieldValues(std::string fieldName, float Bx, float By, float Bz)
+{
+    FADS::FieldManager* fm = FADS::FieldManager::GetFieldManager();
+
+    FADS::MagneticFieldMap* magField=fm->GetMagneticField("ConstantField");
+    std::cout <<"Getting the field: "<<magField->GetName()<<std::endl;
+
+    FADS::MagneticFieldMap* theMap=magField->Create(fieldName);
+    std::cout<<" Field map pointer to "<<fieldName <<" is : "<<theMap<<std::endl;
+
+    ConstantField *constantmagField=dynamic_cast<ConstantField*>(theMap);
+    if(NULL!=constantmagField)
+      {
+	constantmagField->SetXComponent(Bx*CLHEP::tesla);
+	constantmagField->SetYComponent(By*CLHEP::tesla);
+	constantmagField->SetZComponent(Bz*CLHEP::tesla);
+      }
+    else std::cout << "ERROR - failed to cast FADS::MagneticFieldMap " <<fieldName << " to ConstantField." << std::endl;
+}
+
+void ConstantFieldHandler::setXField(std::string fieldName, double xmin, double xmax)
+{
+    FADS::FieldManager *fm=FADS::FieldManager::GetFieldManager();
+
+    FADS::MagneticFieldMap *magField=fm->GetMagneticField("ConstantField");
+    std::cout <<"Getting the field: "<<magField->GetName()<<std::endl;
+
+    FADS::MagneticFieldMap* theMap=magField->Create(fieldName);
+    std::cout<<" Field map pointer to "<<fieldName <<" is : "<<theMap<<std::endl;
+
+    ConstantField *constantmagField=dynamic_cast<ConstantField*>(theMap);
+    if(NULL!=constantmagField)
+      {
+	constantmagField->SetXMinField(xmin);
+	constantmagField->SetXMaxField(xmax);
+      }
+    else std::cout << "ERROR - failed to cast FADS::MagneticFieldMap " <<fieldName << " to ConstantField." << std::endl;
+}
+
+void ConstantFieldHandler::setYField(std::string fieldName, double ymin, double ymax)
+{
+    FADS::FieldManager *fm=FADS::FieldManager::GetFieldManager();
+
+    FADS::MagneticFieldMap *magField=fm->GetMagneticField("ConstantField");
+    std::cout <<"Getting the field: "<<magField->GetName()<<std::endl;
+
+    FADS::MagneticFieldMap* theMap=magField->Create(fieldName);
+    std::cout<<" Field map pointer to "<<fieldName <<" is : "<<theMap<<std::endl;
+
+    ConstantField *constantmagField=dynamic_cast<ConstantField*>(theMap);
+    if(NULL!=constantmagField)
+      {
+	constantmagField->SetYMinField(ymin);
+	constantmagField->SetYMaxField(ymax);
+      }
+    else std::cout << "ERROR - failed to cast FADS::MagneticFieldMap " <<fieldName << " to ConstantField." << std::endl;
+}
+
+void ConstantFieldHandler::setZField(std::string fieldName, double zmin, double zmax)
+{
+    FADS::FieldManager *fm=FADS::FieldManager::GetFieldManager();
+
+    FADS::MagneticFieldMap *magField=fm->GetMagneticField("ConstantField");
+    magField->GetName();
+    std::cout <<"Getting the field: "<<magField->GetName()<<std::endl;
+
+    FADS::MagneticFieldMap* theMap=magField->Create(fieldName);
+    std::cout<<" Field map pointer to "<<fieldName <<" is : "<<theMap<<std::endl;
+
+    ConstantField *constantmagField=dynamic_cast<ConstantField*>(theMap);
+    if(NULL!=constantmagField)
+      {
+	constantmagField->SetZMinField(zmin);
+	constantmagField->SetZMaxField(zmax);
+      }
+    else std::cout << "ERROR - failed to cast FADS::MagneticFieldMap " <<fieldName << " to ConstantField." << std::endl;
+}
+
diff --git a/Simulation/G4Utilities/G4Field/src/ConstantFieldXMLHandler.cxx b/Simulation/G4Utilities/G4Field/src/ConstantFieldXMLHandler.cxx
new file mode 100755
index 00000000000..6222e9905e7
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/src/ConstantFieldXMLHandler.cxx
@@ -0,0 +1,33 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "G4Field/ConstantFieldXMLHandler.h"
+#include "G4Field/ConstantField.h"
+
+ConstantFieldXMLHandler::ConstantFieldXMLHandler(std::string s,ConstantField *c):
+						DescriptionFactory(s),theField(c)
+{
+}
+
+void ConstantFieldXMLHandler::BuildDescription()
+{
+	if (CheckAttribute("Bx")) 
+		theField->SetXComponent(GetAttributeAsDoubleAndUnit("Bx"));
+	if (CheckAttribute("By")) 
+		theField->SetYComponent(GetAttributeAsDoubleAndUnit("By"));
+	if (CheckAttribute("Bz")) 
+		theField->SetZComponent(GetAttributeAsDoubleAndUnit("Bz"));
+	if (CheckAttribute("Xmin"))
+		theField->SetXMinField(GetAttributeAsDoubleAndUnit("Xmin"));
+	if (CheckAttribute("Xmax"))
+		theField->SetXMaxField(GetAttributeAsDoubleAndUnit("Xmax"));
+	if (CheckAttribute("Ymin"))
+		theField->SetYMinField(GetAttributeAsDoubleAndUnit("Ymin"));
+	if (CheckAttribute("Ymax"))
+		theField->SetYMaxField(GetAttributeAsDoubleAndUnit("Ymax"));
+	if (CheckAttribute("Zmin"))
+		theField->SetZMinField(GetAttributeAsDoubleAndUnit("Zmin"));
+	if (CheckAttribute("Zmax"))
+		theField->SetZMaxField(GetAttributeAsDoubleAndUnit("Zmax"));
+}
diff --git a/Simulation/G4Utilities/G4Field/src/FieldMapMgr.cxx b/Simulation/G4Utilities/G4Field/src/FieldMapMgr.cxx
new file mode 100755
index 00000000000..de0a143ea81
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/src/FieldMapMgr.cxx
@@ -0,0 +1,42 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "G4Field/FieldMapMgr.h"
+#include "PathResolver/PathResolver.h"
+
+#include <iostream>
+
+std::string FieldMapMgr::fieldMapFile = "fieldmap.dat";
+
+FieldMapMgr* FieldMapMgr::thePointer = FieldMapMgr::GetFieldMapMgr();
+
+FieldMapMgr* FieldMapMgr::GetFieldMapMgr()
+{
+	if (!thePointer) thePointer=new FieldMapMgr;
+	return thePointer;
+}
+
+void FieldMapMgr::SetFieldMapFile(std::string file)
+{
+	fieldMapFile=file;
+}
+
+std::string FieldMapMgr::GetFieldMapFileName()
+{
+	return fieldMapFile;	
+}
+std::string FieldMapMgr::GetFieldMapFile()
+{
+	std::string file=PathResolver::find_file(fieldMapFile,"DATAPATH");
+	if (file.empty())
+		std::cout<<" file "<<fieldMapFile<<" not found!"<<std::endl;
+	return file;	
+}
+std::string FieldMapMgr::FindPath(std::string name_file) 
+{
+	std::string file=PathResolver::find_file(name_file,"DATAPATH");
+	if (file.empty())
+		std::cout<<" file "<<fieldMapFile<<" not found!"<<std::endl;
+	return file;	
+}
diff --git a/Simulation/G4Utilities/G4Field/src/G4AtlasFieldSvc.cxx b/Simulation/G4Utilities/G4Field/src/G4AtlasFieldSvc.cxx
new file mode 100644
index 00000000000..9bbd5957d5b
--- /dev/null
+++ b/Simulation/G4Utilities/G4Field/src/G4AtlasFieldSvc.cxx
@@ -0,0 +1,62 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "G4Field/G4AtlasFieldSvc.h"
+#include "FadsField/MagneticFieldMapT.h"
+
+// magnetic field service interface
+#include "MagFieldInterfaces/IMagFieldSvc.h"
+
+bool G4AtlasFieldSvc::fieldinitialized = false;
+
+static FADS::MagneticFieldMapT<G4AtlasFieldSvc> idCool("G4AtlasFieldSvc");
+
+G4AtlasFieldSvc::G4AtlasFieldSvc()
+  : m_magFieldSvc("MagField::AtlasFieldSvc/AtlasFieldSvc", "G4AtlasFieldSvc"),
+    m_magFieldSvcQuick(0)
+{
+}
+
+
+G4AtlasFieldSvc::G4AtlasFieldSvc(const std::string& n)
+  : FADS::MagneticFieldMap(n),
+    m_magFieldSvc("MagField::AtlasFieldSvc/AtlasFieldSvc", n),
+    m_magFieldSvcQuick(0)
+{
+}
+
+
+void G4AtlasFieldSvc::Initialize() {
+  if (!fieldinitialized) {
+    if ( m_magFieldSvc.retrieve().isFailure()) {
+      // mlog << MSG::FATAL << "Could not find MagFieldAthenaSvc" << endreq ;
+      std::cout << "Could not find MagFieldAthenaSvc" << std::endl ;
+      return;
+    }
+
+    // store a quick access pointer to remove gaudi overhead
+    m_magFieldSvcQuick = &(*m_magFieldSvc);
+
+    fieldinitialized = true;
+  }
+}
+
+void G4AtlasFieldSvc::FieldValue(const double *pos, double *bfield) const {
+  //  static AbstractMagneticField* pMagField = p_MagFieldAthenaSvc->GetUpdatedMagFieldAthena();
+  //
+  //  // mm to cm unit conversion + double->float type conversion
+  //  float f_pos_in_cm[3] = { (float)pos[0]*.1, (float)pos[1]*.1, (float)pos[2]*.1 };
+  //  // will store the BField as floats
+  //  float f_bfield[3];
+  //
+  //  // compute BField
+  //  pMagField->field_tesla_cm( f_pos_in_cm, f_bfield);
+  //
+  //  // BField unit conversion + float->double type conversion
+  //  for (int i=0; i<3; i++)
+  //    bfield[i] = (double)(f_bfield[i]*10.*CLHEP::kilogauss);
+ 
+  m_magFieldSvcQuick->getField( pos, bfield);
+  return;
+}
-- 
GitLab