diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/DecodeVersionKey.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/DecodeVersionKey.h new file mode 100755 index 0000000000000000000000000000000000000000..c9e0737190593aabc111b9118377ae6bc35d3cd4 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/DecodeVersionKey.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GEOMODELSVC_DECODEVERSIONKEY_H +#define GEOMODELSVC_DECODEVERSIONKEY_H + +#include <string> +class IGeoModelSvc; + +/// This is a helper class to query the version tags from GeoModelSvc and +/// determine the appropriate tag and node to pass to RDBAccessServer. +/// If a subsystem has an override tag then that tag is used otherwise the +/// ATLAS tag is used. + +class DecodeVersionKey +{ + + public: + /// Constructor is passed a pointer to GeoModelSvc plus the node + /// for which you want the tag. + /// Possible nodes are ATLAS, InnerDetector, Pixel, SCT, TRT, LAr, TileCal, or MuonSpectrometer. + DecodeVersionKey(const IGeoModelSvc *, const std::string & node); + + /// Return version tag + const std::string & tag() const; + + /// Return the version node. + const std::string & node() const; + + /// Return true if CUSTOM is selected. + bool custom() const; + + private: + + // utilily for dealing with CUSTOM tags. + bool getCustomTag(const std::string & inputTag, std::string & outputTag); + + std::string m_tag; + std::string m_node; + bool m_custom; + +}; + +#endif // GEOMODELSVC_DECODEVERSIONKEY_H diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoBorderSurface.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoBorderSurface.h new file mode 100644 index 0000000000000000000000000000000000000000..2140026b225514a09710b8b6cd2852fab569e783 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoBorderSurface.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoBorderSurface_h +#define GeoBorderSurface_h 1 + +#include <string> + +class GeoOpticalPhysVol; +class GeoOpticalSurface; + +class GeoBorderSurface +{ + public: + GeoBorderSurface(std::string name, + GeoOpticalPhysVol* pv1, + GeoOpticalPhysVol* pv2, + GeoOpticalSurface* opticalSurface); + GeoBorderSurface(const GeoBorderSurface &right); + ~GeoBorderSurface(); + + std::string getName() const {return m_name;} + const GeoOpticalPhysVol* getPV1() const {return m_pv1;} + const GeoOpticalPhysVol* getPV2() const {return m_pv2;} + const GeoOpticalSurface* getOptSurface() const {return m_opticalSurface;} + + private: + std::string m_name; + GeoOpticalPhysVol* m_pv1; + GeoOpticalPhysVol* m_pv2; + GeoOpticalSurface* m_opticalSurface; + +}; + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoBorderSurfaceContainer.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoBorderSurfaceContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..8b675f87b06b0e62c9a35e517126a06d198409fa --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoBorderSurfaceContainer.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoBorderSurfaceContainer_h +#define GeoBorderSurfaceContainer_h 1 + +#include "GeoModelUtilities/GeoBorderSurface.h" +#include "CLIDSvc/CLASS_DEF.h" +#include <vector> + +typedef std::vector< GeoBorderSurface > GeoBorderSurfaceContainer; + +CLASS_DEF( GeoBorderSurfaceContainer , 1325664490 , 1 ) + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoDBUtils.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoDBUtils.h new file mode 100755 index 0000000000000000000000000000000000000000..8420072fe32e989ff2d59c8bbfe9315f1f488ca6 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoDBUtils.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoDBUtils_h_ +#define GeoDBUtils_h_ +#include "RDBAccessSvc/IRDBAccessSvc.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "RDBAccessSvc/IRDBRecord.h" +#include <string> +#include "CLHEP/Geometry/Transform3D.h" + +class GeoDBUtils { + + public: + + inline static const IRDBRecord *getTransformRecord(IRDBRecordset_ptr positionRecSet, const std::string & key) { + for (unsigned int s=0;s<positionRecSet->size(); s++) { + const IRDBRecord *currentRec= (*positionRecSet)[s]; + if (key == currentRec->getString("NAME")) { + return currentRec; + } + } + return NULL; + } + + inline static HepGeom::Transform3D getTransform (const IRDBRecord *currentRec) { + double x = currentRec->getDouble("TRANSX")*CLHEP::mm; + double y = currentRec->getDouble("TRANSY")*CLHEP::mm; + double z = currentRec->getDouble("TRANSZ")*CLHEP::mm; + double theta = currentRec->getDouble("THETA")*CLHEP::rad; + double phi = currentRec->getDouble("PHI")*CLHEP::rad; + double rotationAngle = currentRec->getDouble("ROTATIONANGLE")*CLHEP::rad; + + CLHEP::Hep3Vector axis(sin(theta)*cos(phi), sin(theta)*sin(phi),cos(theta)); + return HepGeom::Translate3D(x,y,z)*HepGeom::Rotate3D(rotationAngle,axis); + } + +}; +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoExtendedMaterial.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoExtendedMaterial.h new file mode 100755 index 0000000000000000000000000000000000000000..042c7dfb4a8430339693aef47e27a2729dd505c5 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoExtendedMaterial.h @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoExtendedMaterial_h +#define GeoExtendedMaterial_h 1 + +#include "GeoModelKernel/GeoMaterial.h" +#include "CLHEP/Units/PhysicalConstants.h" + +#include "GeoModelUtilities/GeoMaterialPropertiesTable.h" + +enum GeoMaterialState { stateUndefined, stateSolid, stateLiquid, stateGas }; + +class GeoExtendedMaterial : public GeoMaterial +{ + public: + GeoExtendedMaterial(const std::string &Name, + double Density, + GeoMaterialState State = stateUndefined, + double Temperature = CLHEP::STP_Temperature, + double Pressure = CLHEP::STP_Pressure); + + virtual ~GeoExtendedMaterial(); + + const GeoMaterialState& getState() const; + const double& getTemperature() const; + const double& getPressure() const; + + void SetMaterialPropertiesTable(GeoMaterialPropertiesTable* MPT); + GeoMaterialPropertiesTable* GetMaterialPropertiesTable() const; + + private: + GeoExtendedMaterial(const GeoExtendedMaterial &right); + GeoExtendedMaterial & operator=(const GeoExtendedMaterial &right); + + GeoMaterialState state; + double temperature; + double pressure; + + GeoMaterialPropertiesTable* properties; +}; + + +inline const GeoMaterialState& GeoExtendedMaterial::getState() const +{ + return state; +} + +inline const double& GeoExtendedMaterial::getTemperature() const +{ + return temperature; +} + +inline const double& GeoExtendedMaterial::getPressure() const +{ + return pressure; +} + +inline void GeoExtendedMaterial::SetMaterialPropertiesTable(GeoMaterialPropertiesTable* MPT) +{ + properties = MPT; + properties->ref(); +} + +inline GeoMaterialPropertiesTable* GeoExtendedMaterial::GetMaterialPropertiesTable() const +{ + return properties; +} + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMPVEntry.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMPVEntry.h new file mode 100644 index 0000000000000000000000000000000000000000..dd12806a5cebafd91963e3260c0aa596ed290e62 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMPVEntry.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoMPVEntry_h +#define GeoMPVEntry_h 1 + +class GeoMPVEntry +{ + public: + bool operator <(const GeoMPVEntry &right) const; + bool operator ==(const GeoMPVEntry &right) const; + GeoMPVEntry& operator =(const GeoMPVEntry &right); + + GeoMPVEntry(double aPhotonMomentum, double aPropertyValue); + GeoMPVEntry(const GeoMPVEntry &right); + ~GeoMPVEntry(); + + double GetPhotonMomentum(); + double GetProperty(); + + void DumpEntry(); + + private: + double thePhotonMomentum; + double theProperty; +}; + +inline double GeoMPVEntry::GetPhotonMomentum() +{ + return thePhotonMomentum; +} + +inline double GeoMPVEntry::GetProperty() +{ + return theProperty; +} + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMaterialPropertiesTable.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMaterialPropertiesTable.h new file mode 100644 index 0000000000000000000000000000000000000000..e8b28acee6a75c75cf469748f5e648b45116ad77 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMaterialPropertiesTable.h @@ -0,0 +1,76 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoMaterialPropertiesTable_h +#define GeoMaterialPropertiesTable_h 1 + +#include <map> +#include <string> + +#include "GeoModelKernel/RCBase.h" +#include "GeoModelUtilities/GeoMaterialPropertyVector.h" + +class GeoMaterialPropertyVector; + +class GeoMaterialPropertiesTable : public RCBase +{ + public: + GeoMaterialPropertiesTable(); + ~GeoMaterialPropertiesTable(); + + public: + // ******** Typedefs + // Maps + typedef std::map<std::string, GeoMaterialPropertyVector*, std::less<std::string> > GeoMatPVMap; + typedef std::map< std::string, double, std::less<std::string> > GeoMatPMap; + + // Iterators + typedef GeoMatPVMap::const_iterator GeoMatPVMap_ConstIt; + typedef GeoMatPMap::const_iterator GeoMatPMap_ConstIt; + + public: + // Add a new property to the table by giving a key-name and value + void AddConstProperty(const char *key, + double PropertyValue); + + // Add a new property to the table by giving a key-name and the + // arrays x and y of size NumEntries. + void AddProperty(const char *key, + double *PhotonMomenta, + double *PropertyValues, + int NumEntries); + + // Add a new property to the table by giving a key-name and an + // already constructed GeoMaterialPropertyVector. + void AddProperty(const char *key, GeoMaterialPropertyVector *opv); + + // Remove a constant property from the table. + void RemoveConstProperty(const char *key); + + // Remove a property from the table. + void RemoveProperty(const char *key); + + // Add a new entry (pair of numbers) to the table for a given key. + void AddEntry(const char *key, double aPhotonMomentum, + double aPropertyValue); + + // Access to the contents + GeoMatPVMap_ConstIt beginPVMap() const; + GeoMatPVMap_ConstIt endPVMap() const; + + GeoMatPMap_ConstIt beginPMap() const; + GeoMatPMap_ConstIt endPMap() const; + + // Dump contents + void DumpTable() const; + + private: + GeoMatPVMap MPT; + GeoMatPMap MPTC; + + typedef GeoMatPVMap::iterator MPTiterator; + typedef GeoMatPMap::iterator MPTCiterator; +}; + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMaterialPropertyVector.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMaterialPropertyVector.h new file mode 100644 index 0000000000000000000000000000000000000000..7f4e2b1bf76297b11ba8de23d6d2bf6a539a3819 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoMaterialPropertyVector.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoMaterialPropertyVector_h +#define GeoMaterialPropertyVector_h 1 + +#include "GeoModelUtilities/GeoMPVEntry.h" +#include <vector> + +class GeoMaterialPropertyVector +{ +public: + bool operator ++(); + GeoMaterialPropertyVector& + operator =(const GeoMaterialPropertyVector &right); + + GeoMaterialPropertyVector(): MPV(0) + { + CurrentEntry = -1; + NumEntries = 0; + }; + + GeoMaterialPropertyVector(double *PhotonMomenta, + double *PropertyValues, + int NumElements); + + GeoMaterialPropertyVector(const GeoMaterialPropertyVector &right); + + ~GeoMaterialPropertyVector(); + + void ResetIterator(); + + // Add a new element (pair of numbers) to the GeoMaterialPropertyVector. + void AddElement(double aPhotonMomentum, + double aPropertyValue); + + double GetProperty() const; + double GetPhotonMomentum() const; + + // Dump contents + void DumpVector(); + +private: + GeoMPVEntry GetEntry(int i) const; + + std::vector<GeoMPVEntry*> MPV; + int NumEntries; + int CurrentEntry; +}; + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoModelExperiment.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoModelExperiment.h new file mode 100755 index 0000000000000000000000000000000000000000..74684ff7c549372499974ef0059d59e19e5936a6 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoModelExperiment.h @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//-------------------------------------------------------------------------------------------// +// // +// This class (GeoModelExperiment) is a stored manager of managers. It provides access to // +// the world physical volume and all of the managers; so, indirectly, all of the detector // +// specific top level physical volumes. // +// // +// Joe Boudreau October 2003 // +// // +//-------------------------------------------------------------------------------------------// + +#ifndef GEOMODELSVC_GEOMODELEXPERIMENT_H +#define GEOMODELSVC_GEOMODELEXPERIMENT_H +#include "GeoModelKernel/GeoVPhysVol.h" +#include "CLIDSvc/CLASS_DEF.h" +#include <set> +#include <string> +#include <vector> + +class GeoPhysVol; +class GeoVDetectorManager; + +class GeoModelExperiment { + +public: + + + //-----------------------------Internal----------------------------------------------------// + // // + typedef const GeoVDetectorManager * value_type; // + // + class NameEquals{ // + public: // + // + NameEquals(const std::string & name); // + bool operator () (const value_type & m) const; // + // + private: // + // + std::string _name; // + // + }; // + // + class LexigraphicalOrder{ // + public: // + bool operator () (const value_type & a, const value_type & b) const; // + }; // + // + typedef LexigraphicalOrder order_type; // + typedef std::set<value_type, order_type> collection_type; // + typedef collection_type::iterator iterator_type; // + typedef collection_type::const_iterator const_iterator_type; // + // + // + typedef const_iterator_type ConstIterator; // + // // + //-----------------------------------------------------------------------------------------// + + + // ---------------------------For you: ----------------------------------------------------// + // // + // Standard Constructor // + GeoModelExperiment(GeoPhysVol* physVol); // + // // + // Standard Destructor // + virtual ~GeoModelExperiment(); // + // // + // Return the World physical volume: // + GeoPhysVol *getPhysVol(); // + const GeoPhysVol *getPhysVol() const; // + // // + // Manage the managers: // + void addManager(const GeoVDetectorManager *); // + // // + // Access those managers: // + const GeoVDetectorManager *getManager(const std::string & name) const; // + ConstIterator beginManager() const; // + ConstIterator endManager() const; // + // Add temporary volumes created during Geo2G4 translation // + void addTmpVolume(GeoPhysVol* volume); // + // // + //-----------------------------------------------------------------------------------------// + + private: + + GeoPhysVol *_physVol; + collection_type _managers; + std::vector<GeoPhysVol*> _tmpVolumes; + +}; + +//using the macros below we can assign an identifier (and a version) +//This is required and checked at compile time when you try to record/retrieve +CLASS_DEF(GeoModelExperiment, 9875, 1) + +#endif // GEOMODELSVC_GEOMODELEXPERIMENT_H + + + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoModelTool.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoModelTool.h new file mode 100755 index 0000000000000000000000000000000000000000..8cb27af5c4abe2efcdc5a4bd8939031e4a557c14 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoModelTool.h @@ -0,0 +1,37 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GEOMODELSVC_GEOMODELTOOL_H +#define GEOMODELSVC_GEOMODELTOOL_H + +#include "GeoModelInterfaces/IGeoModelTool.h" +#include "AthenaBaseComps/AthAlgTool.h" + +class GeoVDetectorManager; + +class GeoModelTool : public AthAlgTool, public virtual IGeoModelTool { + +public: + + // Standard Constructor + GeoModelTool( const std::string& type, const std::string& name, const IInterface* parent ); + + // Standard Destructor + virtual ~GeoModelTool(); + + virtual GeoVDetectorManager* manager() const; + + virtual StatusCode clear(StoreGateSvc* detStore); + virtual StatusCode registerCallback( StoreGateSvc* ); + virtual StatusCode align(IOVSVC_CALLBACK_ARGS); + +protected: + + GeoVDetectorManager* m_detector; // The corresponding +}; + +#endif // GEOMODELSVC_DETDESCRTOOL_H + + + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoOpticalPhysVol.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoOpticalPhysVol.h new file mode 100644 index 0000000000000000000000000000000000000000..5773305e16ae6b61f3ee189e8925e63ac24607fc --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoOpticalPhysVol.h @@ -0,0 +1,24 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoOpticalPhysVol_h +#define GeoOpticalPhysVol_h 1 + +#include "GeoModelKernel/GeoPhysVol.h" + +class GeoOpticalPhysVol : public GeoPhysVol +{ + public: + GeoOpticalPhysVol(const GeoLogVol* LogVol); + + protected: + ~GeoOpticalPhysVol(); + + private: + GeoOpticalPhysVol(const GeoOpticalPhysVol &right); + GeoOpticalPhysVol & operator=(const GeoOpticalPhysVol &right); + +}; + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoOpticalSurface.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoOpticalSurface.h new file mode 100644 index 0000000000000000000000000000000000000000..f9f66d4caa1e8f4b72e2336b42230db427a04288 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoOpticalSurface.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GeoOpticalSurface_h +#define GeoOpticalSurface_h 1 + +#include "GeoModelKernel/RCBase.h" +#include "GeoModelUtilities/GeoMaterialPropertiesTable.h" +#include <string> + + +class GeoOpticalSurface : public RCBase +{ + public: + // Enums --------- + enum GeoSurfaceType + { + dielectric_metal, // dielectric-metal interface + dielectric_dielectric, // dielectric-dielectric interface + firsov, // for Firsov Process + x_ray // for x-ray mirror process + }; + + enum GeoOpticalSurfaceFinish + { + polished, // smooth perfectly polished surface + polishedfrontpainted, // smooth top-layer (front) paint + polishedbackpainted, // same is 'polished' but with a back-paint + ground, // rough surface + groundfrontpainted, // rough top-layer (front) paint + groundbackpainted // same as 'ground' but with a back-paint + }; + + enum GeoOpticalSurfaceModel + { + glisur, // original GEANT3 model + unified // UNIFIED model + }; + // Enums --------- + + GeoOpticalSurface(const std::string& name, + GeoOpticalSurfaceModel model = glisur, + GeoOpticalSurfaceFinish finish = polished, + GeoSurfaceType type = dielectric_dielectric, + double parameter = 1.0); + + ~GeoOpticalSurface(); + + // accessor methods + std::string GetName() const {return m_name;} + GeoSurfaceType GetType() const {return m_type;}; + GeoOpticalSurfaceFinish GetFinish() const {return m_finish;}; + GeoOpticalSurfaceModel GetModel() const {return m_model;}; + double GetParameter() const {return m_parameter;} + + void SetMaterialPropertiesTable(GeoMaterialPropertiesTable *mpt) + { m_materialPropertiesTable = mpt; if(mpt) m_materialPropertiesTable->ref(); }; + + GeoMaterialPropertiesTable* GetMaterialPropertiesTable() const + { return m_materialPropertiesTable;}; + + private: + std::string m_name; + GeoOpticalSurfaceModel m_model; + GeoOpticalSurfaceFinish m_finish; + GeoSurfaceType m_type; + double m_parameter; + GeoMaterialPropertiesTable* m_materialPropertiesTable; +}; + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/LArCustomShape.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/LArCustomShape.h new file mode 100755 index 0000000000000000000000000000000000000000..e062f908943a358e66f71d7b91c30977253d481a --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/LArCustomShape.h @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LArCustomShape_h +#define LArCustomShape_h + +#include <string> + +#include "GeoModelKernel/GeoShape.h" + +// Forward declaration +class GeoShapeAction; + +class LArCustomShape : public GeoShape +{ + public: + + // The custom shape has only one property: a string that contains + // the name of the particular shape. In the GeoModel->Geant4 + // conversion, this name will be matched against a list of custom + // classes that inherit from G4VSolid to get the correct custom + // solid. + LArCustomShape(const std::string& shapeName); + + // Returns the volume of the shape, for mass inventory + virtual double volume() const; + + // Returns the shape type, as a string. + virtual const std::string& type() const; + + // Returns the shape type, as a coded integer. + virtual ShapeType typeID() const; + + // For type identification. + static const std::string& getClassType(); + + // For type identification. + static const ShapeType getClassTypeID(); + + // Return the shape name, supplied in the constructor. + virtual const std::string& name() const; + + // Executes a GeoShapeAction + virtual void exec(GeoShapeAction* action) const; + + protected: + virtual ~LArCustomShape(); + + private: + + // Prohibited operations. + LArCustomShape(const LArCustomShape &right); + const LArCustomShape & operator=(const LArCustomShape &right); + + // General GeoModel shape attributes. + static const std::string classType; + static const ShapeType classTypeID; + + // Properties of the custom shape. + const std::string m_shapeName; +}; + +inline const std::string& LArCustomShape::getClassType() +{ + return classType; +} + +inline const ShapeType LArCustomShape::getClassTypeID() +{ + return classTypeID; +} + +#endif diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/StoredAlignX.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/StoredAlignX.h new file mode 100755 index 0000000000000000000000000000000000000000..ecb9f8dbd1bb523e1972a834201a767df6a5b41a --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/StoredAlignX.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//-------------------------------------------------------------------------------------------// +// // +// Insert a volume into the detector store: // +// // +// Joe Boudreau October 2003 // +// // +//-------------------------------------------------------------------------------------------// + +#ifndef STOREDALIGNX_H +#define STOREDALIGNX_H +#include "CLIDSvc/CLASS_DEF.h" +#include <set> +#include <string> + +class GeoAlignableTransform; +class StoredAlignX { + +public: + + + // ---------------------------For you: ----------------------------------------------------// + // // + // Standard Constructor // + StoredAlignX(GeoAlignableTransform* alignX); // + // // + // Standard Destructor // + virtual ~StoredAlignX(); // + // // + // Return the World physical volume: // + GeoAlignableTransform *getAlignX(); // + const GeoAlignableTransform *getAlignX() const; // + // // + // // + //-----------------------------------------------------------------------------------------// + + private: + + GeoAlignableTransform *_alignX; + +}; + +CLASS_DEF(StoredAlignX, 9878, 1) + +#endif + + + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/StoredPhysVol.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/StoredPhysVol.h new file mode 100755 index 0000000000000000000000000000000000000000..e2e7ce0dbc97fb44f69fc7f009c761cd9972460e --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/StoredPhysVol.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +//-------------------------------------------------------------------------------------------// +// // +// Insert a volume into the detector store: // +// // +// Joe Boudreau October 2003 // +// // +//-------------------------------------------------------------------------------------------// + +#ifndef STOREDPHYSVOL_H +#define STOREDPHYSVOL_H +#include "GeoModelKernel/GeoVPhysVol.h" +#include "CLIDSvc/CLASS_DEF.h" +#include <set> +#include <string> + +class GeoFullPhysVol; +class StoredPhysVol { + +public: + + + // ---------------------------For you: ----------------------------------------------------// + // // + // Standard Constructor // + StoredPhysVol(GeoFullPhysVol* physVol); // + // // + // Standard Destructor // + virtual ~StoredPhysVol(); // + // // + // Return the World physical volume: // + GeoFullPhysVol *getPhysVol(); // + const GeoFullPhysVol *getPhysVol() const; // + // // + // // + //-----------------------------------------------------------------------------------------// + + private: + + GeoFullPhysVol *_physVol; + +}; + +CLASS_DEF(StoredPhysVol, 9877, 1) + +#endif + + + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/cmt/requirements b/DetectorDescription/GeoModel/GeoModelUtilities/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..0dc5ee817a0b46d6a9ddd94b9a48089359b52963 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/cmt/requirements @@ -0,0 +1,19 @@ +package GeoModelUtilities + +author Vakho Tsulaia + +use AtlasPolicy AtlasPolicy-* + +use GeoModelKernel GeoModelKernel-* DetectorDescription/GeoModel +use AthenaBaseComps AthenaBaseComps-* Control +use AtlasCLHEP AtlasCLHEP-* External +use CLIDSvc CLIDSvc-* Control +use RDBAccessSvc RDBAccessSvc-* Database/AthenaPOOL + +use GeoModelInterfaces GeoModelInterfaces-* DetectorDescription/GeoModel + +library GeoModelUtilities *.cxx +apply_pattern installed_library + +private +use GaudiInterface GaudiInterface-* External diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/doc/MainPage.h b/DetectorDescription/GeoModel/GeoModelUtilities/doc/MainPage.h new file mode 100644 index 0000000000000000000000000000000000000000..22f5e0292edf2908416ee2434c3a3956fccc27de --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/doc/MainPage.h @@ -0,0 +1,21 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + + +@mainpage + +The package contains utility classes required for LUCID GeoModel description. These include: +Extended Materials (pressure, state), Material Properties Table, Optical Surfaces and Logical Borde Surfaces. + + +-------------------------------- + REQUIREMENTS +-------------------------------- + +@include requirements +@htmlinclude used_packages.html + +*/ diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/DecodeVersionKey.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/DecodeVersionKey.cxx new file mode 100755 index 0000000000000000000000000000000000000000..a0121ab23e9c08f23f34219a394f714a658ba4bd --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/DecodeVersionKey.cxx @@ -0,0 +1,111 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/DecodeVersionKey.h" +#include "GeoModelInterfaces/IGeoModelSvc.h" +#include <string> +#include <iostream> + +DecodeVersionKey::DecodeVersionKey(const IGeoModelSvc * geoModel, const std::string & node) +{ + std::string nodeOverrideTag; + std::string indetOverrideTag; // Indet has two levels. + if (node == "ATLAS") { + nodeOverrideTag = ""; + } else if (node == "InnerDetector") { + nodeOverrideTag = geoModel->inDetVersionOverride(); + } else if (node == "Pixel") { + indetOverrideTag = geoModel->inDetVersionOverride(); + nodeOverrideTag = geoModel->pixelVersionOverride(); + } else if (node == "SCT") { + indetOverrideTag = geoModel->inDetVersionOverride(); + nodeOverrideTag = geoModel->SCT_VersionOverride(); + } else if (node == "TRT") { + indetOverrideTag = geoModel->inDetVersionOverride(); + nodeOverrideTag = geoModel->TRT_VersionOverride(); + } else if (node == "LAr") { + nodeOverrideTag = geoModel->LAr_VersionOverride(); + } else if (node == "TileCal") { + nodeOverrideTag = geoModel->tileVersionOverride(); + } else if (node == "MuonSpectrometer") { + nodeOverrideTag = geoModel->muonVersionOverride(); + } else if (node == "Calorimeter") { + nodeOverrideTag = geoModel->caloVersionOverride(); + } else if (node == "ForwardDetectors") { + nodeOverrideTag = geoModel->forwardDetectorsVersionOverride(); + } else { + std::cout << "DecodeVersionKey passed an unknown node:" << node << std::endl; + nodeOverrideTag = ""; + } + + // Default to atlas version + m_tag = geoModel->atlasVersion(); + m_node = "ATLAS"; + + // If indetOverrideTag is specified (and is not just "CUSTOM") then override with the indet tag. + std::string indetTag; + if (!indetOverrideTag.empty()) { + // We dont care about the return value (custom = true/false). We only take notice of the custom + // flag if the override is at the node we have selected. Ie we only look at nodeOverrideTag + // in order to set m_custom. At any rate, we have to remove the CUSTOM string if it is present. + getCustomTag(indetOverrideTag, indetTag); + } + if (!indetTag.empty()) { + m_tag = indetTag; + m_node = "InnerDetector"; + } + + // Finally if subsystem tag is overriden then use that. + std::string outputTag; + m_custom = getCustomTag(nodeOverrideTag, outputTag); + + if (!outputTag.empty()) { + m_tag = outputTag; + m_node = node; + } +} + + +const std::string & +DecodeVersionKey::tag() const +{ + return m_tag; +} + +const std::string & +DecodeVersionKey::node() const +{ + return m_node; +} + +bool +DecodeVersionKey::custom() const +{ + return m_custom; +} + + + +bool +DecodeVersionKey::getCustomTag(const std::string & inputTag, std::string & outputTag) +{ + // + // Check if CUSTOM is specified. If it is not specified then outputTag = inputTag. + // If the tag is just "CUSTOM" then set output tag to "" so that we use the higher level tag. + // If the tag is of the form CUSTOM-XXXXX use the XXXXX as the tag + // The separating character (in this example a '-') can be any character. + // + bool custom = false; + outputTag = inputTag; + if (!inputTag.empty()) { + if (inputTag.substr(0,6) == "CUSTOM") { + custom = true; + // If its CUSTOM-something skip the next character and get the something + outputTag = inputTag.substr(6); + if (!outputTag.empty()) outputTag = outputTag.substr(1); + } + } + return custom; +} + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoBorderSurface.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoBorderSurface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..746570e8c4f29bc879a8aac821fa56bca427be44 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoBorderSurface.cxx @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoBorderSurface.h" +#include "GeoModelUtilities/GeoOpticalPhysVol.h" +#include "GeoModelUtilities/GeoOpticalSurface.h" + +#include <exception> + +GeoBorderSurface::GeoBorderSurface(std::string name, + GeoOpticalPhysVol* pv1, + GeoOpticalPhysVol* pv2, + GeoOpticalSurface* opticalSurface): + m_name(name), + m_pv1(pv1), + m_pv2(pv2), + m_opticalSurface(opticalSurface) +{ + if(pv1->isShared() || pv2->isShared()) + throw std::runtime_error("Attempt to create a surface with shared physical volumes"); + + pv1->ref(); + pv2->ref(); + opticalSurface->ref(); +} + +GeoBorderSurface::GeoBorderSurface(const GeoBorderSurface &right): + m_name(right.m_name), + m_pv1(right.m_pv1), + m_pv2(right.m_pv2), + m_opticalSurface(right.m_opticalSurface) +{ + m_pv1->ref(); + m_pv2->ref(); + m_opticalSurface->ref(); +} + +GeoBorderSurface::~GeoBorderSurface() +{ + m_pv1->unref(); + m_pv2->unref(); + m_opticalSurface->unref(); +} diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoExtendedMaterial.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoExtendedMaterial.cxx new file mode 100755 index 0000000000000000000000000000000000000000..c4d504615e4e1e31b1d4493084af37fbb5e01651 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoExtendedMaterial.cxx @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoExtendedMaterial.h" +#include "GeoModelUtilities/GeoMaterialPropertiesTable.h" + +GeoExtendedMaterial::GeoExtendedMaterial(const std::string &Name, + double Density, + GeoMaterialState State, + double Temperature, + double Pressure): + GeoMaterial(Name,Density), + state(State), + temperature(Temperature), + pressure(Pressure), + properties(0) +{ +} + +GeoExtendedMaterial::~GeoExtendedMaterial() +{ + properties->unref(); +} + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMPVEntry.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMPVEntry.cxx new file mode 100644 index 0000000000000000000000000000000000000000..91106e0f4d817f01cab5d0075492ff7be96861d4 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMPVEntry.cxx @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoMPVEntry.h" +#include <iostream> + +bool GeoMPVEntry::operator ==(const GeoMPVEntry &right) const +{ + if (thePhotonMomentum == right.thePhotonMomentum) + return true; + else + return false; +} + +bool GeoMPVEntry::operator <(const GeoMPVEntry &right) const +{ + if (thePhotonMomentum < right.thePhotonMomentum) + return true; + else + return false; +} + +GeoMPVEntry& GeoMPVEntry::operator =(const GeoMPVEntry& right) +{ + if (this == &right) return *this; + + thePhotonMomentum = right.thePhotonMomentum; + theProperty = right.theProperty; + return *this; +} + +GeoMPVEntry::GeoMPVEntry(double aPhotonMomentum, double aProperty) +{ + thePhotonMomentum = aPhotonMomentum; + theProperty = aProperty; +} + +GeoMPVEntry::GeoMPVEntry(const GeoMPVEntry &right) +{ + thePhotonMomentum = right.thePhotonMomentum; + theProperty = right.theProperty; +} + +GeoMPVEntry::~GeoMPVEntry(){} + +void GeoMPVEntry::DumpEntry() +{ + std::cout << "(" + << thePhotonMomentum + << ", " + << theProperty + << ")\n"; +} diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMaterialPropertiesTable.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMaterialPropertiesTable.cxx new file mode 100644 index 0000000000000000000000000000000000000000..53561912c6b734a8c42afbe14592ce2c9ea308e5 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMaterialPropertiesTable.cxx @@ -0,0 +1,110 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoMaterialPropertiesTable.h" +#include "GeoModelUtilities/GeoMaterialPropertyVector.h" +#include <stdexcept> +#include <iostream> + +GeoMaterialPropertiesTable::GeoMaterialPropertiesTable() +{ +} + +GeoMaterialPropertiesTable::~GeoMaterialPropertiesTable() +{ + MPTiterator i; + for(i = MPT.begin(); i!= MPT.end(); i++) + delete (*i).second; + + MPT.clear(); + MPTC.clear(); +} + + +void GeoMaterialPropertiesTable::AddConstProperty(const char *key, + double PropertyValue) +{ + MPTC [std::string(key)] = PropertyValue; +} + +void GeoMaterialPropertiesTable::AddProperty(const char *key, + double* PhotonMomenta, + double* PropertyValues, + int NumEntries) +{ + GeoMaterialPropertyVector *mpv = + new GeoMaterialPropertyVector(PhotonMomenta, + PropertyValues, + NumEntries); + MPT[std::string(key)] = mpv; +} + +void GeoMaterialPropertiesTable::AddProperty(const char *key, + GeoMaterialPropertyVector *mpv) +{ + MPT [std::string(key)] = mpv; +} + +void GeoMaterialPropertiesTable::RemoveConstProperty(const char *key) +{ + MPTC.erase(std::string(key)); +} + +void GeoMaterialPropertiesTable::RemoveProperty(const char *key) +{ + MPT.erase(std::string(key)); +} + +void GeoMaterialPropertiesTable::AddEntry(const char *key, + double aPhotonMomentum, + double aPropertyValue) +{ + GeoMaterialPropertyVector *targetVector=MPT[std::string(key)]; + if(targetVector != 0) + targetVector->AddElement(aPhotonMomentum, aPropertyValue); + else + throw std::runtime_error("GeoMaterialPropertiesTable::AddEntry ==> Material Property Vector not found."); +} + +GeoMaterialPropertiesTable::GeoMatPVMap_ConstIt GeoMaterialPropertiesTable::beginPVMap() const +{ + return MPT.begin(); +} + +GeoMaterialPropertiesTable::GeoMatPVMap_ConstIt GeoMaterialPropertiesTable::endPVMap() const +{ + return MPT.end(); +} + +GeoMaterialPropertiesTable::GeoMatPMap_ConstIt GeoMaterialPropertiesTable::beginPMap() const +{ + return MPTC.begin(); +} + +GeoMaterialPropertiesTable::GeoMatPMap_ConstIt GeoMaterialPropertiesTable::endPMap() const +{ + return MPTC.end(); +} + +void GeoMaterialPropertiesTable::DumpTable() const +{ + for(GeoMatPVMap_ConstIt i=MPT.begin(); i!=MPT.end(); i++) + { + std::cout << (*i).first << "\n"; + if((*i).second != 0) + (*i).second->DumpVector(); + else + std::cout << "NULL Material Property Vector Pointer." << "\n"; + } + + for (GeoMatPMap_ConstIt j = MPTC.begin(); j != MPTC.end(); ++j) + { + std::cout << j->first << "\n"; + if(j->second != 0) + std::cout << j->second << "\n"; + else + std::cout << "No Material Constant Property." << "\n"; + } +} + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMaterialPropertyVector.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMaterialPropertyVector.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b4776e50b453880aa49e642a0946244adf861f61 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoMaterialPropertyVector.cxx @@ -0,0 +1,121 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoMaterialPropertyVector.h" +#include <stdexcept> +#include <iostream> + +bool GeoMaterialPropertyVector::operator ++() +{ + CurrentEntry++; + if(CurrentEntry < NumEntries) + return true; + else + return false; +} + +GeoMaterialPropertyVector& GeoMaterialPropertyVector::operator =(const GeoMaterialPropertyVector& right) +{ + if (this == &right) return *this; + + for(unsigned i=0; i<MPV.size(); ++i) + delete MPV[i]; + MPV.clear(); + + NumEntries = 0; + CurrentEntry = -1; + + for(int i = 0 ; i < right.NumEntries; i++) + { + GeoMPVEntry *newElement = new GeoMPVEntry(right.GetEntry(i)); + MPV.push_back(newElement); + NumEntries++; + } + + return *this; +} + +GeoMaterialPropertyVector::GeoMaterialPropertyVector(double *PhotonMomenta, + double *PropertyValues, + int NumElements) +{ + NumEntries = 0; + CurrentEntry = -1; + + for(int i = 0; i < NumElements; i++) + AddElement(PhotonMomenta[i], PropertyValues[i]); +} + +GeoMaterialPropertyVector::GeoMaterialPropertyVector(const GeoMaterialPropertyVector &right) +{ + NumEntries = 0; + CurrentEntry = -1; + + for(int i = 0 ; i < right.NumEntries; i++) + { + GeoMPVEntry *newElement = new GeoMPVEntry(right.GetEntry(i)); + MPV.push_back(newElement); + NumEntries++; + } +} + +GeoMaterialPropertyVector::~GeoMaterialPropertyVector() +{ + for(unsigned i=0; i<MPV.size(); ++i) + delete MPV[i]; + MPV.clear(); +} + +void GeoMaterialPropertyVector::ResetIterator() +{ + CurrentEntry = -1; +} + +void GeoMaterialPropertyVector::AddElement(double aPhotonMomentum, + double aPropertyValue) +{ + GeoMPVEntry *newElement; + + newElement = new GeoMPVEntry(aPhotonMomentum, aPropertyValue); + MPV.push_back(newElement); + NumEntries++; +} + +double GeoMaterialPropertyVector::GetProperty() const +{ + if(CurrentEntry == -1 || CurrentEntry >= NumEntries) + throw std::runtime_error("GeoMaterialPropertyVector::GetProperty ==>Iterator attempted to Retrieve Property out of range"); + else + return MPV[CurrentEntry]->GetProperty(); +} + +double GeoMaterialPropertyVector::GetPhotonMomentum() const +{ + if(CurrentEntry == -1 || CurrentEntry >= NumEntries) + throw std::runtime_error("GeoMaterialPropertyVector::GetPhotonMomentum ==>Iterator attempted to Retrieve Photon Momentum out of range"); + else + return MPV[CurrentEntry]->GetPhotonMomentum(); +} + +void GeoMaterialPropertyVector::DumpVector() +{ + if (MPV.empty()) + { + std::cerr << "nothing to dump\n"; + throw std::runtime_error("GeoMaterialPropertyVector::DumpVector ==>Nothing to dump! Vector is empty"); + } + + for (int i = 0; i < NumEntries; i++) + { + std::cout << "MPV["<< i << "]: "; + MPV[i]->DumpEntry(); + } + std::cout << " Done DumpVector of " << NumEntries << " entries\n"; + +} + +GeoMPVEntry GeoMaterialPropertyVector::GetEntry(int i) const +{ + return *MPV[i]; +} diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoModelExperiment.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoModelExperiment.cxx new file mode 100755 index 0000000000000000000000000000000000000000..8a908d0d1955b3f50e28caee8ac99f678c42286c --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoModelExperiment.cxx @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoModelExperiment.h" +#include "GeoModelKernel/GeoPhysVol.h" +#include "GeoModelKernel/GeoVDetectorManager.h" +#include <algorithm> +#include <sstream> +#include <stdexcept> +/** + ** Constructor(s) + **/ +GeoModelExperiment::GeoModelExperiment( GeoPhysVol * physVol ) + : _physVol(physVol) +{ + physVol->ref(); +} + +/** + ** Destructor + **/ +GeoModelExperiment::~GeoModelExperiment() { + // Unref all temporary volumes + std::vector<GeoPhysVol*>::iterator it = _tmpVolumes.begin(); + for(; it!=_tmpVolumes.end(); it++) + (*it)->unref(); + + _physVol->unref(); +} + +GeoPhysVol * GeoModelExperiment::getPhysVol() { + return _physVol; +} + + +const GeoPhysVol *GeoModelExperiment::getPhysVol() const{ + return _physVol; +} + +GeoModelExperiment::ConstIterator GeoModelExperiment::beginManager() const { + return _managers.begin(); +} + +GeoModelExperiment::ConstIterator GeoModelExperiment::endManager() const { + return _managers.end(); +} + +void GeoModelExperiment::addManager(const GeoVDetectorManager *mgr) { + if (getManager(mgr->getName())) { + std::ostringstream errorMessage; + errorMessage + << "A detector manager named" << mgr->getName() + << " has already been declared to GeoModelExperiment"; + + throw std::runtime_error(errorMessage.str()); + } + _managers.insert(mgr); +} + +const GeoVDetectorManager *GeoModelExperiment::getManager(const std::string & name) const { + + const_iterator_type m = std::find_if(_managers.begin(),_managers.end(),NameEquals(name)); + if (m!=_managers.end()) { + return *m; + } + else { + return NULL; + } + +} + +GeoModelExperiment::NameEquals::NameEquals(const std::string & name):_name(name) { +} + +bool GeoModelExperiment::NameEquals::operator() (const value_type & m) const { + return m->getName()==_name; +} + +bool GeoModelExperiment::LexigraphicalOrder::operator () (const value_type & a, const value_type &b) const { + return a->getName()< b->getName(); +} + +void GeoModelExperiment::addTmpVolume(GeoPhysVol* volume) +{ + _tmpVolumes.push_back(volume); +} diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoModelTool.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoModelTool.cxx new file mode 100755 index 0000000000000000000000000000000000000000..0406de955e6f4258193d16f839ed535707d7404f --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoModelTool.cxx @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoModelTool.h" +#include "GeoModelKernel/GeoVDetectorManager.h" +#include "GaudiKernel/MsgStream.h" + +/** + ** Constructor(s) + **/ +GeoModelTool::GeoModelTool( const std::string& type, const std::string& name, const IInterface* parent ) + : AthAlgTool( type, name, parent ), + m_detector(0) + +{ + declareInterface<IGeoModelTool>( this ); +} + +/** + ** Destructor + **/ +GeoModelTool::~GeoModelTool() { +} + +/** + ** The Detector Node corresponding to this tool + **/ +GeoVDetectorManager* +GeoModelTool::manager() const { + return m_detector; +} + +StatusCode GeoModelTool::clear(StoreGateSvc*) +{ + return StatusCode::SUCCESS; +} + +StatusCode +GeoModelTool::align(IOVSVC_CALLBACK_ARGS) +{ + return StatusCode::SUCCESS; +} + +StatusCode +GeoModelTool::registerCallback( StoreGateSvc* ) +{ + // Return Failure since no function has been registered + return StatusCode::FAILURE; +} diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoOpticalPhysVol.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoOpticalPhysVol.cxx new file mode 100644 index 0000000000000000000000000000000000000000..71d2afe404e9678710756ed15f45a3f3f685ece1 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoOpticalPhysVol.cxx @@ -0,0 +1,14 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoOpticalPhysVol.h" + +GeoOpticalPhysVol::GeoOpticalPhysVol(const GeoLogVol* LogVol): + GeoPhysVol(LogVol) +{ +} + +GeoOpticalPhysVol::~GeoOpticalPhysVol() +{ +} diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoOpticalSurface.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoOpticalSurface.cxx new file mode 100755 index 0000000000000000000000000000000000000000..3ce27e4c1505e8db2a35f87da2baaba8f6b20ed4 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoOpticalSurface.cxx @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/GeoOpticalSurface.h" + +GeoOpticalSurface::GeoOpticalSurface(const std::string& name, + GeoOpticalSurfaceModel model, + GeoOpticalSurfaceFinish finish, + GeoSurfaceType type, + double parameter): + m_name(name), + m_model(model), + m_finish(finish), + m_type(type), + m_parameter(parameter), + m_materialPropertiesTable(0) +{ +} + +GeoOpticalSurface::~GeoOpticalSurface() +{ + if(m_materialPropertiesTable) + m_materialPropertiesTable->unref(); +} + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/StoredAlignX.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/StoredAlignX.cxx new file mode 100755 index 0000000000000000000000000000000000000000..1a2738b06d41c780f07595ef083fbea2c229b6b5 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/StoredAlignX.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/StoredAlignX.h" +#include "GeoModelKernel/GeoAlignableTransform.h" +#include <algorithm> +#include <sstream> +#include <stdexcept> +/** + ** Constructor(s) + **/ +StoredAlignX::StoredAlignX( GeoAlignableTransform * alignX ) + : _alignX(alignX) +{ + alignX->ref(); +} + +/** + ** Destructor + **/ +StoredAlignX::~StoredAlignX() { + _alignX->unref(); +} + +GeoAlignableTransform * StoredAlignX::getAlignX() { + return _alignX; +} + + +const GeoAlignableTransform *StoredAlignX::getAlignX() const{ + return _alignX; +} + diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/StoredPhysVol.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/StoredPhysVol.cxx new file mode 100755 index 0000000000000000000000000000000000000000..a6e9954b0006e1cc8e97b58e8c391b533e779600 --- /dev/null +++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/StoredPhysVol.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelUtilities/StoredPhysVol.h" +#include "GeoModelKernel/GeoFullPhysVol.h" +#include <algorithm> +#include <sstream> +#include <stdexcept> +/** + ** Constructor(s) + **/ +StoredPhysVol::StoredPhysVol( GeoFullPhysVol * physVol ) + : _physVol(physVol) +{ + physVol->ref(); +} + +/** + ** Destructor + **/ +StoredPhysVol::~StoredPhysVol() { + _physVol->unref(); +} + +GeoFullPhysVol * StoredPhysVol::getPhysVol() { + return _physVol; +} + + +const GeoFullPhysVol *StoredPhysVol::getPhysVol() const{ + return _physVol; +} +