From 2a3e38cb57e5dfaac5ea9dac5dbd48900731a230 Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Fri, 11 Apr 2014 11:41:09 +0000 Subject: [PATCH] - made ostream<< operators inline --- DDSurfaces/include/DDSurfaces/IMaterial.h | 2 +- DDSurfaces/include/DDSurfaces/ISurface.h | 11 ++++++++--- DDSurfaces/include/DDSurfaces/Vector3D.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/DDSurfaces/include/DDSurfaces/IMaterial.h b/DDSurfaces/include/DDSurfaces/IMaterial.h index dcae15e15..7bd5d47c9 100644 --- a/DDSurfaces/include/DDSurfaces/IMaterial.h +++ b/DDSurfaces/include/DDSurfaces/IMaterial.h @@ -38,7 +38,7 @@ namespace DDSurfaces { }; /// dump IMaterial operator - std::ostream& operator<<( std::ostream& os , const IMaterial& m ) { + inline std::ostream& operator<<( std::ostream& os , const IMaterial& m ) { os << " " << m.name() << ", Z: " << m.Z() << ", A: " << m.A() << ", densitiy: " << m.density() << ", radiationLength: " << m.radiationLength() << ", interactionLength: " << m.interactionLength() ; diff --git a/DDSurfaces/include/DDSurfaces/ISurface.h b/DDSurfaces/include/DDSurfaces/ISurface.h index 68f9c482f..d9193014f 100644 --- a/DDSurfaces/include/DDSurfaces/ISurface.h +++ b/DDSurfaces/include/DDSurfaces/ISurface.h @@ -11,6 +11,8 @@ namespace DDSurfaces { struct SurfaceType ; + typedef long long int long64 ; + /** Interface for tracking surfaces. * The surface provides access to vectors for u,v,n and the orgigin and * the inner and outer materials with corresponding thicknesses. @@ -28,6 +30,9 @@ namespace DDSurfaces { /// properties of the surface encoded in Type. virtual const SurfaceType& type() const =0 ; + /// The id of this surface - corresponds to DetElement id ( or'ed with the placement ids ) + virtual long64 id() const =0 ; + /// Checks if the given point lies within the surface virtual bool insideBounds(const Vector3D& point, double epsilon=1.e-4) const =0 ; @@ -178,7 +183,7 @@ namespace DDSurfaces { } ; /// dump SurfaceType operator - std::ostream& operator<<( std::ostream& os , const SurfaceType& t ) { + inline std::ostream& operator<<( std::ostream& os , const SurfaceType& t ) { os << "sensitive[" << t.isSensitive() << "] helper[" << t.isHelper() << "] plane[" << t.isPlane() << "] cylinder[" << t.isCylinder() << "] parallelToZ[" << t.isParallelToZ() << "] orthogonalToZ[" << t. isOrthogonalToZ() << "] zCylinder[" << t.isZCylinder() @@ -190,9 +195,9 @@ namespace DDSurfaces { /// dump ISurface operator - std::ostream& operator<<( std::ostream& os , const ISurface& s ) { + inline std::ostream& operator<<( std::ostream& os , const ISurface& s ) { - os << " type : " << s.type() << std::endl + os << " id: " << s.id() << " type : " << s.type() << std::endl << " u : " << s.u() << " v : " << s.v() << " normal : " << s.normal() << " origin : " << s.origin() << std::endl ; os << " inner material : " << s.innerMaterial() << std::endl << " outerMaterial : " << s.outerMaterial() << std::endl ; diff --git a/DDSurfaces/include/DDSurfaces/Vector3D.h b/DDSurfaces/include/DDSurfaces/Vector3D.h index cd4f8bf25..0e3e4ab74 100644 --- a/DDSurfaces/include/DDSurfaces/Vector3D.h +++ b/DDSurfaces/include/DDSurfaces/Vector3D.h @@ -287,7 +287,7 @@ namespace DDSurfaces { /** Output operator */ - std::ostream & operator << (std::ostream & os, const Vector3D &v) { + inline std::ostream & operator << (std::ostream & os, const Vector3D &v) { os << "( " << v[0] << ", " << v[1] << ", " << v[2] << " )" ; -- GitLab