diff --git a/DDAlign/src/DetectorAlignment.cpp b/DDAlign/src/DetectorAlignment.cpp index 1f8e3ce8d765911e8457fbe44b38e61c1c9af0f8..e0630684d98ec3fcdcad80316587e2f5004c5879 100644 --- a/DDAlign/src/DetectorAlignment.cpp +++ b/DDAlign/src/DetectorAlignment.cpp @@ -127,62 +127,63 @@ const vector<Alignment>& DetectorAlignment::volumeAlignments() const { } /// Align the PhysicalNode of the placement of the detector element (translation only) -Alignment DetectorAlignment::align(const Position& pos, bool check, double overlap) { - return align(_transform(pos),check,overlap); +Alignment DetectorAlignment::align(const Position& pos, bool chk, double overlap) { + return align(_transform(pos),chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (rotation only) -Alignment DetectorAlignment::align(const RotationZYX& rot, bool check, double overlap) { - return align(_transform(rot),check,overlap); +Alignment DetectorAlignment::align(const RotationZYX& rot, bool chk, double overlap) { + return align(_transform(rot),chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (translation + rotation) -Alignment DetectorAlignment::align(const Position& pos, const RotationZYX& rot, bool check, double overlap) { - return align(_transform(pos,rot),check,overlap); +Alignment DetectorAlignment::align(const Position& pos, const RotationZYX& rot, bool chk, double overlap) { + return align(_transform(pos,rot),chk,overlap); } /// Align the physical node according to a generic Transform3D -Alignment DetectorAlignment::align(const Transform3D& transform, bool check, double overlap) { - return align(_transform(transform),check,overlap); +Alignment DetectorAlignment::align(const Transform3D& transform, bool chk, double overlap) { + return align(_transform(transform),chk,overlap); } /// Align the physical node according to a generic TGeo matrix -Alignment DetectorAlignment::align(TGeoHMatrix* matrix, bool check, double overlap) { - return _align(_alignment(*this),matrix,check,overlap); +Alignment DetectorAlignment::align(TGeoHMatrix* matrix, bool chk, double overlap) { + return _align(_alignment(*this),matrix,chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (translation only) -Alignment DetectorAlignment::align(const string& path, const Position& pos, bool check, double overlap) { - return align(path,_transform(pos),check,overlap); +Alignment DetectorAlignment::align(const string& elt_path, const Position& pos, bool chk, double overlap) { + return align(elt_path,_transform(pos),chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (rotation only) -Alignment DetectorAlignment::align(const string& path, const RotationZYX& rot, bool check, double overlap) { - return align(path,_transform(rot),check,overlap); +Alignment DetectorAlignment::align(const string& elt_path, const RotationZYX& rot, bool chk, double overlap) { + return align(elt_path,_transform(rot),chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (translation + rotation) -Alignment DetectorAlignment::align(const string& path, const Position& pos, const RotationZYX& rot, bool check, double overlap) { - return align(path,_transform(pos,rot),check,overlap); +Alignment +DetectorAlignment::align(const string& elt_path, const Position& pos, const RotationZYX& rot, bool chk, double overlap) { + return align(elt_path,_transform(pos,rot),chk,overlap); } /// Align the physical node according to a generic Transform3D -Alignment DetectorAlignment::align(const string& path, const Transform3D& transform, bool check, double overlap) { - return align(path,_transform(transform),check,overlap); +Alignment DetectorAlignment::align(const string& elt_path, const Transform3D& transform, bool chk, double overlap) { + return align(elt_path,_transform(transform),chk,overlap); } /// Align the physical node according to a generic TGeo matrix -Alignment DetectorAlignment::align(const string& path, TGeoHMatrix* matrix, bool check, double overlap) { - if ( path.empty() ) - return _align(_alignment(*this),matrix,check,overlap); - else if ( path == placementPath() ) - return _align(_alignment(*this),matrix,check,overlap); - else if ( path[0] == '/' ) { - Alignment a(path); +Alignment DetectorAlignment::align(const string& elt_path, TGeoHMatrix* matrix, bool chk, double overlap) { + if ( elt_path.empty() ) + return _align(_alignment(*this),matrix,chk,overlap); + else if ( elt_path == placementPath() ) + return _align(_alignment(*this),matrix,chk,overlap); + else if ( elt_path[0] == '/' ) { + Alignment a(elt_path); volumeAlignments().push_back(a); - return _align(a,matrix,check,overlap); + return _align(a,matrix,chk,overlap); } - Alignment a(placementPath()+'/'+path); + Alignment a(placementPath()+'/'+elt_path); volumeAlignments().push_back(a); - return _align(a,matrix,check,overlap); + return _align(a,matrix,chk,overlap); } diff --git a/DDRec/include/DDRec/API/IDDecoder.h b/DDRec/include/DDRec/API/IDDecoder.h index 96358f5ad78cd6387f2bff8b08eeeff6e8e551e2..32184247276e37d10a8bea9f6f4e9363d4e41b05 100644 --- a/DDRec/include/DDRec/API/IDDecoder.h +++ b/DDRec/include/DDRec/API/IDDecoder.h @@ -39,8 +39,8 @@ public: EndcapNorth, n_BarrelEndcapID }; - BarrelEndcapFlag(unsigned int value) : - value(static_cast<BarrelEncapID>(value)) {} + BarrelEndcapFlag(unsigned int val) : + value(static_cast<BarrelEncapID>(val)) {} virtual ~BarrelEndcapFlag() {} diff --git a/DDRec/include/DDRec/Material.h b/DDRec/include/DDRec/Material.h index 334e41dea527991b01cef03cf03ad377af2f4a06..c97c6a40e909e63c3841b52bd765204f3ccbd70c 100644 --- a/DDRec/include/DDRec/Material.h +++ b/DDRec/include/DDRec/Material.h @@ -32,73 +32,74 @@ namespace DD4hep { /** Instantiate from Geometry::Material - default initialization if handle is not valid */ MaterialData( Geometry::Material m ) : - _name("unknown"), - _Z( -1. ), - _A( 0. ), - _rho( 0. ), - _x0( 0. ), - _lambda( 0.) { - - if( m.isValid() ) { - - _name= m.name() ; - _Z = m.Z() ; - _A = m.A() ; - _rho = m.density() ; - _x0 = m.radLength() ; - _lambda = m.intLength() ; - - } - } + _name("unknown"), + _Z( -1. ), + _A( 0. ), + _rho( 0. ), + _x0( 0. ), + _lambda( 0.) { + + if( m.isValid() ) { + + _name= m.name() ; + _Z = m.Z() ; + _A = m.A() ; + _rho = m.density() ; + _x0 = m.radLength() ; + _lambda = m.intLength() ; + + } + } /** Default c'tor .*/ MaterialData() : _name("unknown"), - _Z( -1. ), - _A( 0. ), - _rho( 0. ), - _x0( 0. ), - _lambda( 0.) {} + _Z( -1. ), + _A( 0. ), + _rho( 0. ), + _x0( 0. ), + _lambda( 0.) {} /** C'tor setting all attributes .*/ - MaterialData( const std::string& name, double Z, double A, double density, double radLength, double intLength ) : _name( name ), - _Z( Z ), - _A( A ), - _rho( density ), - _x0( radLength ), - _lambda( intLength ) {} + MaterialData( const std::string& nam, double Z_val, double A_val, double density_val, double radLength, double intLength ) + : _name( nam ), + _Z( Z_val ), + _A( A_val ), + _rho( density_val ), + _x0( radLength ), + _lambda( intLength ) {} /** Copy c'tor .*/ MaterialData( const MaterialData& m ) : _name( m.name() ), - _Z( m.Z() ), - _A( m.A() ), - _rho( m.density() ), - _x0( m.radiationLength() ), - _lambda( m.interactionLength() ) {} + _Z( m.Z() ), + _A( m.A() ), + _rho( m.density() ), + _x0( m.radiationLength() ), + _lambda( m.interactionLength() ) {} /// assignment from Geometry::Material MaterialData& operator=(const Geometry::Material& m){ - if( m.isValid() ) { - - _name = m.name() ; - _Z = m.Z() ; - _A = m.A() ; - _rho = m.density() ; - _x0 = m.radLength() ; - _lambda = m.intLength() ; - - } else { - - _name= "unknown"; - _Z = -1. ; - _A = 0. ; - _rho = 0. ; - _x0 = 0. ; - _lambda = 0. ; - } - - return *this ; + if( m.isValid() ) { + + _name = m.name() ; + _Z = m.Z() ; + _A = m.A() ; + _rho = m.density() ; + _x0 = m.radLength() ; + _lambda = m.intLength() ; + + } else { + + _name= "unknown"; + _Z = -1. ; + _A = 0. ; + _rho = 0. ; + _x0 = 0. ; + _lambda = 0. ; + } + + return *this ; } /// true if initialized diff --git a/DDRec/include/DDRec/Surface.h b/DDRec/include/DDRec/Surface.h index 166060873e0038e7a4077aac85e4181752302b06..203208a91134afb97708044a33940a4666b5a9aa 100644 --- a/DDRec/include/DDRec/Surface.h +++ b/DDRec/include/DDRec/Surface.h @@ -31,9 +31,9 @@ namespace DD4hep { struct SurfaceMaterial : public virtual Geometry::Material , public IMaterial{ /** Copy c'tor - copies handle */ - SurfaceMaterial( Geometry::Material m ) : Geometry::Material( m ) {} + SurfaceMaterial( Geometry::Material mat ) : Geometry::Material( mat ) {} - SurfaceMaterial( const SurfaceMaterial& sm ) : Geometry::Material( sm ) {} + SurfaceMaterial( const SurfaceMaterial& smat ) : Geometry::Material( smat ) {} virtual ~SurfaceMaterial() {} @@ -82,24 +82,24 @@ namespace DD4hep { /// Standard c'tor for initialization. SurfaceData( SurfaceType type, double thickness_inner ,double thickness_outer, - Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o, - Geometry::Volume vol /*= Geometry::Volume() */); + Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o, + Geometry::Volume vol /*= Geometry::Volume() */); /// Default destructor virtual ~SurfaceData() {} /// Copy the from object void copy(const SurfaceData& c) { - _type = c._type ; - _u = c._u ; - _v = c._v ; - _n = c._n ; - _o = c._o; - _th_i = c._th_i ; - _th_o = c._th_o ; - _innerMat = c._innerMat ; - _outerMat = c._innerMat ; - _vol = c._vol; + _type = c._type ; + _u = c._u ; + _v = c._v ; + _n = c._n ; + _o = c._o; + _th_i = c._th_i ; + _th_o = c._th_o ; + _innerMat = c._innerMat ; + _outerMat = c._innerMat ; + _vol = c._vol; } } ; @@ -132,21 +132,21 @@ namespace DD4hep { /// Constructor to be used with an existing object VolSurface(SurfaceData* p) - : Geometry::Handle< SurfaceData >(p) { + : Geometry::Handle< SurfaceData >(p) { } /// Constructor to be used with an existing object - VolSurface(const VolSurface& e) - : Geometry::Handle< SurfaceData >(e) { + VolSurface(const VolSurface& vsurf) + : Geometry::Handle< SurfaceData >(vsurf) { } /// Constructor to be used with an existing object template <typename Q> VolSurface(const Geometry::Handle<Q>& e) - : Geometry::Handle< SurfaceData >(e) { + : Geometry::Handle< SurfaceData >(e) { } /// Standrad c'tor for initialization. VolSurface( Geometry::Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer, - Vector3D u ,Vector3D v ,Vector3D n , Vector3D o = Vector3D(0.,0.,0.) ) ; + Vector3D u ,Vector3D v ,Vector3D n , Vector3D o = Vector3D(0.,0.,0.) ) ; /// the volume to which this surface is attached. Geometry::Volume volume() const { return ptr()->_vol; } @@ -244,16 +244,16 @@ namespace DD4hep { // required c'tor for extension mechanism VolSurfaceList(Geometry::DetElement& det){ - VolSurfaceList* sL = volSurfaceList( det ) ; + VolSurfaceList* sL = volSurfaceList( det ) ; - std::copy( this->end() , sL->begin() , sL->end() ) ; + std::copy( this->end() , sL->begin() , sL->end() ) ; } // required c'tor for extension mechanism VolSurfaceList(const VolSurfaceList& vsl, Geometry::DetElement& /*det*/ ){ - this->insert( this->end() , vsl.begin() , vsl.end() ) ; + this->insert( this->end() , vsl.begin() , vsl.end() ) ; } virtual ~VolSurfaceList() ; @@ -277,27 +277,27 @@ namespace DD4hep { /// Constructor to be used with an existing object VolPlane(SurfaceData* p) - : VolSurface(p) { + : VolSurface(p) { } /// Constructor to be used with an existing object template <typename Q> VolPlane(const Geometry::Handle<Q>& e) - : VolSurface(e) { + : VolSurface(e) { } /// copy c'tor VolPlane(const VolSurface& vs ) : VolSurface( vs ) { } /// standard c'tor with all necessary arguments - origin is (0,0,0) if not given. - VolPlane( Geometry::Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer, - Vector3D u ,Vector3D v ,Vector3D n , Vector3D o = Vector3D(0.,0.,0.) ) : + VolPlane( Geometry::Volume vol, SurfaceType typ, double thickness_inner ,double thickness_outer, + Vector3D u_val ,Vector3D v_val ,Vector3D n_val , Vector3D o_val = Vector3D(0.,0.,0.) ) : - VolSurface( vol, type, thickness_inner, thickness_outer, u,v,n,o ) { + VolSurface( vol, typ, thickness_inner, thickness_outer, u_val,v_val,n_val,o_val ) { - object<SurfaceData>()._type.setProperty( SurfaceType::Plane , true ) ; - object<SurfaceData>()._type.setProperty( SurfaceType::Cylinder , false ) ; - object<SurfaceData>()._type.checkParallelToZ( *this ) ; - object<SurfaceData>()._type.checkOrthogonalToZ( *this ) ; + object<SurfaceData>()._type.setProperty( SurfaceType::Plane , true ) ; + object<SurfaceData>()._type.setProperty( SurfaceType::Cylinder , false ) ; + object<SurfaceData>()._type.checkParallelToZ( *this ) ; + object<SurfaceData>()._type.checkOrthogonalToZ( *this ) ; } @@ -455,7 +455,7 @@ namespace DD4hep { /** Get Origin of local coordinate system of the associated volume */ virtual Vector3D volumeOrigin() const ; - /** The length of the surface along direction u at the origin. For 'regular' boundaries, like rectangles, + /** The length of the surface along direction u at the origin. For 'regular' boundaries, like rectangles, * this can be used to speed up the computation of inSideBounds. */ virtual double length_along_u() const ; @@ -544,11 +544,11 @@ namespace DD4hep { /// required c'tor for extension mechanism SurfaceList(const Geometry::DetElement& ){ - // anything to do here ? + // anything to do here ? } /// required c'tor for extension mechanism SurfaceList(const SurfaceList& ,const Geometry::DetElement& ){ - // anything to do here ? + // anything to do here ? } /// d'tor deletes all owned surfaces diff --git a/DDRec/src/IDDecoder.cpp b/DDRec/src/IDDecoder.cpp index 213eb374f502f3499fc334128a6ce7d524dbb1e2..9ef4d808f68403bd4ebe5055e6767c848ef182fd 100644 --- a/DDRec/src/IDDecoder.cpp +++ b/DDRec/src/IDDecoder.cpp @@ -42,17 +42,17 @@ IDDecoder::IDDecoder() { /** * Returns the cell ID from the local position in the given volume ID. */ -CellID IDDecoder::cellIDFromLocal(const Position& local, const VolumeID volumeID) const { +CellID IDDecoder::cellIDFromLocal(const Position& local, const VolumeID volID) const { double l[3]; double g[3]; local.GetCoordinates(l); // FIXME: direct lookup of transformations seems to be broken - //const TGeoMatrix& localToGlobal = _volumeManager.worldTransformation(volumeID); - DetElement det = this->detectorElement(volumeID); + //const TGeoMatrix& localToGlobal = _volumeManager.worldTransformation(volID); + DetElement det = this->detectorElement(volID); const TGeoMatrix& localToGlobal = det.worldTransformation(); localToGlobal.LocalToMaster(l, g); Position global(g[0], g[1], g[2]); - return this->findReadout(det).segmentation().cellID(local, global, volumeID); + return this->findReadout(det).segmentation().cellID(local, global, volID); } /** @@ -75,14 +75,14 @@ CellID IDDecoder::cellID(const Position& global) const { /** * Returns the global position from a given cell ID */ -Position IDDecoder::position(const CellID& cellID) const { +Position IDDecoder::position(const CellID& cell) const { double l[3]; double g[3]; - DetElement det = this->detectorElement(cellID); - Position local = this->findReadout(det).segmentation().position(cellID); + DetElement det = this->detectorElement(cell); + Position local = this->findReadout(det).segmentation().position(cell); local.GetCoordinates(l); // FIXME: direct lookup of transformations seems to be broken - //const TGeoMatrix& localToGlobal = _volumeManager.worldTransformation(cellID); + //const TGeoMatrix& localToGlobal = _volumeManager.worldTransformation(cell); const TGeoMatrix& localToGlobal = det.worldTransformation(); localToGlobal.LocalToMaster(l, g); return Position(g[0], g[1], g[2]); @@ -91,78 +91,78 @@ Position IDDecoder::position(const CellID& cellID) const { /* * Returns the local position from a given cell ID */ -Position IDDecoder::localPosition(const CellID& cellID) const { - DetElement det = this->detectorElement(cellID); - return this->findReadout(det).segmentation().position(cellID); +Position IDDecoder::localPosition(const CellID& cell) const { + DetElement det = this->detectorElement(cell); + return this->findReadout(det).segmentation().position(cell); } /* * Returns the volume ID of a given cell ID */ -VolumeID IDDecoder::volumeID(const CellID& cellID) const { - DetElement det = this->detectorElement(cellID); - return this->findReadout(det).segmentation()->volumeID(cellID); +VolumeID IDDecoder::volumeID(const CellID& cell) const { + DetElement det = this->detectorElement(cell); + return this->findReadout(det).segmentation()->volumeID(cell); } /* * Returns the volume ID of a given global position */ -VolumeID IDDecoder::volumeID(const Position& position) const { - DetElement det = this->detectorElement(position); +VolumeID IDDecoder::volumeID(const Position& pos) const { + DetElement det = this->detectorElement(pos); return det.volumeID(); } /* * Returns the placement for a given cell ID */ -PlacedVolume IDDecoder::placement(const CellID& cellID) const { - return _volumeManager.lookupPlacement(cellID); +PlacedVolume IDDecoder::placement(const CellID& cell) const { + return _volumeManager.lookupPlacement(cell); } /* * Returns the placement for a given global position */ -PlacedVolume IDDecoder::placement(const Position& position) const { - return placement(volumeID(position)); +PlacedVolume IDDecoder::placement(const Position& pos) const { + return placement(volumeID(pos)); } /* * Returns the subdetector for a given cell ID */ -DetElement IDDecoder::subDetector(const CellID& cellID) const { - return _volumeManager.lookupDetector(cellID); +DetElement IDDecoder::subDetector(const CellID& cell) const { + return _volumeManager.lookupDetector(cell); } /* * Returns the subdetector for a given global position */ -DetElement IDDecoder::subDetector(const Position& position) const { - return subDetector(volumeID(position)); +DetElement IDDecoder::subDetector(const Position& pos) const { + return subDetector(volumeID(pos)); } /* * Returns the closest detector element in the hierarchy for a given cell ID */ -DetElement IDDecoder::detectorElement(const CellID& cellID) const { - return _volumeManager.lookupDetElement(cellID); +DetElement IDDecoder::detectorElement(const CellID& cell) const { + return _volumeManager.lookupDetElement(cell); } /* * Returns the closest detector element in the hierarchy for a given global position */ -DetElement IDDecoder::detectorElement(const Position& position) const { +DetElement IDDecoder::detectorElement(const Position& pos) const { DetElement world = Geometry::LCDD::getInstance().world(); - DetElement det = getClosestDaughter(world, position); + DetElement det = getClosestDaughter(world, pos); if (not det.isValid()) { - throw invalid_position("DD4hep::DDRec::IDDecoder::detectorElement", position); + throw invalid_position("DD4hep::DDRec::IDDecoder::detectorElement", pos); } std::cout << det.name() << std::endl; return det; } /// Access to the Readout object for a given cell ID -Geometry::Readout IDDecoder::readout(const CellID& cellID) const { - DetElement det = this->detectorElement(cellID); +Geometry::Readout IDDecoder::readout(const CellID& cell) const { + DetElement det = this->detectorElement(cell); return this->findReadout(det); } @@ -175,37 +175,37 @@ Geometry::Readout IDDecoder::readout(const Geometry::Position& global) const { /* * Calculates the neighbours of the given cell ID and adds them to the list of neighbours */ -void IDDecoder::neighbours(const CellID& cellID, set<CellID>& neighbours) const { - DetElement det = this->detectorElement(cellID); - this->findReadout(det).segmentation()->neighbours(cellID, neighbours); +void IDDecoder::neighbours(const CellID& cell, set<CellID>& neighbour_cells) const { + DetElement det = this->detectorElement(cell); + this->findReadout(det).segmentation()->neighbours(cell, neighbour_cells); } /* * Checks if the given cell IDs are neighbours */ -bool IDDecoder::areNeighbours(const CellID& cellID, const CellID& otherCellID) const { - set<CellID> neighbours; - DetElement det = this->detectorElement(cellID); - this->findReadout(det).segmentation()->neighbours(cellID, neighbours); - return neighbours.count(otherCellID) != 0; +bool IDDecoder::areNeighbours(const CellID& cell, const CellID& otherCellID) const { + set<CellID> neighbour_cells; + DetElement det = this->detectorElement(cell); + this->findReadout(det).segmentation()->neighbours(cell, neighbour_cells); + return neighbour_cells.count(otherCellID) != 0; } /// Access to the barrel-endcap flag -IDDecoder::BarrelEndcapFlag IDDecoder::barrelEndcapFlag(const CellID& cellID) const { - Readout r = this->readout(cellID); - return BarrelEndcapFlag(r.idSpec().field(this->barrelIdentifier())->value(cellID)); +IDDecoder::BarrelEndcapFlag IDDecoder::barrelEndcapFlag(const CellID& cell) const { + Readout r = this->readout(cell); + return BarrelEndcapFlag(r.idSpec().field(this->barrelIdentifier())->value(cell)); } /// Access to the layer index -long int IDDecoder::layerIndex(const CellID& cellID) const { - Readout r = this->readout(cellID); - return r.idSpec().field(this->layerIdentifier())->value(cellID); +long int IDDecoder::layerIndex(const CellID& cell) const { + Readout r = this->readout(cell); + return r.idSpec().field(this->layerIdentifier())->value(cell); } /// Access to the system index -long int IDDecoder::systemIndex(const CellID& cellID) const { - Readout r = this->readout(cellID); - return r.idSpec().field(this->systemIdentifier())->value(cellID); +long int IDDecoder::systemIndex(const CellID& cell) const { + Readout r = this->readout(cell); + return r.idSpec().field(this->systemIdentifier())->value(cell); } // helper method to find the corresponding Readout object to a DetElement diff --git a/DDRec/src/LayeringExtensionImpl.cpp b/DDRec/src/LayeringExtensionImpl.cpp index 4e7259e2117b49634db4a26fecf38d627d9234f9..3ba1268d4fb784ffc85c66f6342e668a0c11805c 100644 --- a/DDRec/src/LayeringExtensionImpl.cpp +++ b/DDRec/src/LayeringExtensionImpl.cpp @@ -62,46 +62,46 @@ const vector<DetElement>& LayeringExtensionImpl::absorbers(int layerIndex) const /// Access the total thickness of the sub detector double LayeringExtensionImpl::totalThickness() const { map<int, LayerAttributes>::iterator it = _layerMap.begin(); - double thickness = 0.; + double thick_ness = 0.; while (it != _layerMap.end()) { LayerAttributes& attributes = it->second; if (not attributes.isCalculated) { attributes.calculate(); } - thickness += attributes.thickness; + thick_ness += attributes.thickness; ++it; } - return thickness; + return thick_ness; } /// Access the total radiation length of the sub detector double LayeringExtensionImpl::totalRadiationLength() const { map<int, LayerAttributes>::iterator it = _layerMap.begin(); - double radiationLength = 0.; + double radiation_length = 0.; while (it != _layerMap.end()) { LayerAttributes& attributes = it->second; if (not attributes.isCalculated) { attributes.calculate(); } - radiationLength += attributes.radiationLength; + radiation_length += attributes.radiationLength; ++it; } - return radiationLength; + return radiation_length; } /// Access the total nuclear interaction length of the sub detector double LayeringExtensionImpl::totalInteractionLength() const { map<int, LayerAttributes>::iterator it = _layerMap.begin(); - double interactionLength = 0.; + double interaction_length = 0.; while (it != _layerMap.end()) { LayerAttributes& attributes = it->second; if (not attributes.isCalculated) { attributes.calculate(); } - interactionLength += attributes.interactionLength; + interaction_length += attributes.interactionLength; ++it; } - return interactionLength; + return interaction_length; } /// Access the total thickness of the layer with the given index @@ -159,9 +159,9 @@ double LayeringExtensionImpl::sensorInteractionLength(int layerIndex) const { } /// Stores the layer information for the given layer index -void LayeringExtensionImpl::setLayer(int layerIndex, Geometry::DetElement layer, const Geometry::Position& normal) { +void LayeringExtensionImpl::setLayer(int layerIndex, Geometry::DetElement layer_elt, const Geometry::Position& normal) { LayerAttributes& layerAttributes = _layerMap[layerIndex]; - layerAttributes.layer = layer; + layerAttributes.layer = layer_elt; layerAttributes.normal = normal.Unit(); layerAttributes.isCalculated = false; } diff --git a/DDRec/src/SubdetectorExtensionImpl.cpp b/DDRec/src/SubdetectorExtensionImpl.cpp index 296d05ae4605f3b51df33f6b491d2de0c84299b4..5175c141b139737b4d8cc69c82bdc13aa806ca71 100644 --- a/DDRec/src/SubdetectorExtensionImpl.cpp +++ b/DDRec/src/SubdetectorExtensionImpl.cpp @@ -16,9 +16,9 @@ namespace DDRec { using Geometry::DetElement; /// Constructor using a top level DetElement -SubdetectorExtensionImpl::SubdetectorExtensionImpl(const Geometry::DetElement& det) { +SubdetectorExtensionImpl::SubdetectorExtensionImpl(const Geometry::DetElement& det_elt) { this->resetAll(); - this->det = det; + this->det = det_elt; } /// Copy constructor @@ -179,8 +179,8 @@ int SubdetectorExtensionImpl::getNSides() const { } /// Sets the top level detector element used to determine shape information -void SubdetectorExtensionImpl::setDetectorElement(const Geometry::DetElement& det) { - this->det = det; +void SubdetectorExtensionImpl::setDetectorElement(const Geometry::DetElement& det_elt) { + this->det = det_elt; } /// Sets the isBarrel flag diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp index e73253aeaf24483d4b8d4a3235f14677968181a6..4b45752f0c52cf5dc22d0c0a99664d722b05997e 100644 --- a/DDRec/src/Surface.cpp +++ b/DDRec/src/Surface.cpp @@ -35,30 +35,30 @@ namespace DD4hep { SurfaceData::SurfaceData() : _type( SurfaceType() ) , - _u( Vector3D() ) , - _v( Vector3D() ) , - _n( Vector3D() ) , - _o( Vector3D() ) , - _th_i( 0. ), - _th_o( 0. ), - _innerMat( MaterialData() ), - _outerMat( MaterialData() ), - _vol() + _u( Vector3D() ) , + _v( Vector3D() ) , + _n( Vector3D() ) , + _o( Vector3D() ) , + _th_i( 0. ), + _th_o( 0. ), + _innerMat( MaterialData() ), + _outerMat( MaterialData() ), + _vol() { } - SurfaceData::SurfaceData( SurfaceType type , double thickness_inner ,double thickness_outer, - Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o, Volume vol ) : _type(type ) , - _u( u ) , - _v( v ) , - _n( n ) , - _o( o ), - _th_i( thickness_inner ), - _th_o( thickness_outer ), - _innerMat( MaterialData() ), - _outerMat( MaterialData() ), - _vol(vol) + SurfaceData::SurfaceData( SurfaceType typ, double thickness_inner ,double thickness_outer, + Vector3D u_val ,Vector3D v_val ,Vector3D n ,Vector3D o, Volume vol ) : _type(typ ) , + _u( u_val ) , + _v( v_val ) , + _n( n ) , + _o( o ), + _th_i( thickness_inner ), + _th_o( thickness_outer ), + _innerMat( MaterialData() ), + _outerMat( MaterialData() ), + _vol(vol) { } @@ -66,15 +66,15 @@ namespace DD4hep { //====================================================================================================== - VolSurface::VolSurface( Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer, - Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o ) : + VolSurface::VolSurface( Volume vol, SurfaceType typ, double thickness_inner ,double thickness_outer, + Vector3D u_val ,Vector3D v_val ,Vector3D n ,Vector3D o ) : - Geometry::Handle< SurfaceData >( new SurfaceData(type, thickness_inner ,thickness_outer, u,v,n,o, vol) ) { + Geometry::Handle< SurfaceData >( new SurfaceData(typ, thickness_inner ,thickness_outer, u_val,v_val,n,o, vol) ) { } - void VolSurface::setU(const Vector3D& u) { object<SurfaceData>()._u = u ; } - void VolSurface::setV(const Vector3D& v) { object<SurfaceData>()._v = v ; } + void VolSurface::setU(const Vector3D& u_val) { object<SurfaceData>()._u = u_val ; } + void VolSurface::setV(const Vector3D& v_val) { object<SurfaceData>()._v = v_val ; } void VolSurface::setNormal(const Vector3D& n) { object<SurfaceData>()._n = n ; } long64 VolSurface::id() const { return 0 ; } @@ -117,26 +117,26 @@ namespace DD4hep { double VolSurface::length_along_u() const { const DDSurfaces::Vector3D& o = this->origin() ; - const DDSurfaces::Vector3D& u = this->u( o ) ; - DDSurfaces::Vector3D um = -1. * u ; + const DDSurfaces::Vector3D& u_val = this->u( o ) ; + DDSurfaces::Vector3D um = -1. * u_val ; double dist_p = volume()->GetShape()->DistFromInside( const_cast<double*> ( o.const_array() ) , - const_cast<double*> ( u.const_array() ) ) ; + const_cast<double*> ( u_val.const_array() ) ) ; double dist_m = volume()->GetShape()->DistFromInside( const_cast<double*> ( o.const_array() ) , - const_cast<double*> ( um.array() ) ) ; + const_cast<double*> ( um.array() ) ) ; return dist_p + dist_m ; } double VolSurface::length_along_v() const { const DDSurfaces::Vector3D& o = this->origin() ; - const DDSurfaces::Vector3D& v = this->v( o ) ; - DDSurfaces::Vector3D vm = -1. * v ; + const DDSurfaces::Vector3D& v_val = this->v( o ) ; + DDSurfaces::Vector3D vm = -1. * v_val ; double dist_p = volume()->GetShape()->DistFromInside( const_cast<double*> ( o.const_array() ) , - const_cast<double*> ( v.const_array() ) ) ; + const_cast<double*> ( v_val.const_array() ) ) ; double dist_m = volume()->GetShape()->DistFromInside( const_cast<double*> ( o.const_array() ) , - const_cast<double*> ( vm.array() ) ) ; + const_cast<double*> ( vm.array() ) ) ; return dist_p + dist_m ; } @@ -165,9 +165,9 @@ namespace DD4hep { bool inShape = volume()->GetShape()->Contains( point.const_array() ) ; std::cout << " ** Surface::insideBound( " << point << " ) - distance = " << dist - << " origin = " << origin() << " normal = " << normal() - << " p * n = " << point * normal() - << " isInShape : " << inShape << std::endl ; + << " origin = " << origin() << " normal = " << normal() + << " p * n = " << point * normal() + << " isInShape : " << inShape << std::endl ; return dist < epsilon && inShape ; #else @@ -181,20 +181,20 @@ namespace DD4hep { //============================================================================================================= - VolCylinder::VolCylinder( Geometry::Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer, Vector3D o ) : + VolCylinder::VolCylinder( Geometry::Volume vol, SurfaceType typ, double thickness_inner ,double thickness_outer, Vector3D o ) : - VolSurface( vol, type, thickness_inner, thickness_outer, Vector3D() , Vector3D() , Vector3D() , o ) { + VolSurface( vol, typ, thickness_inner, thickness_outer, Vector3D() , Vector3D() , Vector3D() , o ) { - Vector3D v( 0., 0., 1. ) ; + Vector3D v_val( 0., 0., 1. ) ; Vector3D o_rphi( o.x() , o.y() , 0. ) ; Vector3D n = o_rphi.unit() ; - Vector3D u = v.cross( n ) ; + Vector3D u_val = v_val.cross( n ) ; - setU( u ) ; - setV( v ) ; + setU( u_val ) ; + setV( v_val ) ; setNormal( n ) ; object<SurfaceData>()._type.setProperty( SurfaceType::Plane , false ) ; @@ -270,8 +270,8 @@ namespace DD4hep { bool inShapeT = volume()->GetShape()->Contains( const_cast<double*> ( point.const_array() ) ) ; std::cout << " ** Surface::insideBound( " << point << " ) - distance = " << distR - << " origin = " << origin() - << " isInShape : " << inShapeT << std::endl ; + << " origin = " << origin() + << " isInShape : " << inShapeT << std::endl ; return distR < epsilon && inShapeT ; #else @@ -291,7 +291,7 @@ namespace DD4hep { // delete all surfaces attached to this volume for( VolSurfaceList::iterator i=begin(), n=end() ; i !=n ; ++i ) { - i->clear() ; + i->clear() ; } } @@ -300,10 +300,10 @@ namespace DD4hep { SurfaceList::~SurfaceList(){ if( _isOwner ) { - // delete all surfaces attached to this volume - for( SurfaceList::iterator i=begin(), n=end() ; i !=n ; ++i ) { - delete (*i) ; - } + // delete all surfaces attached to this volume + for( SurfaceList::iterator i=begin(), n=end() ; i !=n ; ++i ) { + delete (*i) ; + } } } @@ -316,11 +316,11 @@ namespace DD4hep { try { - list = det.extension< VolSurfaceList >() ; + list = det.extension< VolSurfaceList >() ; } catch(const std::runtime_error& e){ - list = det.addExtension<VolSurfaceList >( new VolSurfaceList ) ; + list = det.addExtension<VolSurfaceList >( new VolSurfaceList ) ; } return list ; @@ -345,50 +345,50 @@ namespace DD4hep { if( pv.volume().ptr() == theVol.ptr() ) { - return true ; + return true ; } else { - //-------------------------------- + //-------------------------------- - const TGeoNode* node = pv.ptr(); + const TGeoNode* node = pv.ptr(); - if ( !node ) { + if ( !node ) { - // std::cout << " *** findVolume: Invalid placement: - node pointer Null for volume: " << pv.name() << std::endl ; + // std::cout << " *** findVolume: Invalid placement: - node pointer Null for volume: " << pv.name() << std::endl ; - throw std::runtime_error("*** findVolume: Invalid placement: - node pointer Null ! " + std::string( pv.name() ) ); - } - // Volume vol = pv.volume(); + throw std::runtime_error("*** findVolume: Invalid placement: - node pointer Null ! " + std::string( pv.name() ) ); + } + // Volume vol = pv.volume(); - // std::cout << " ndau = " << node->GetNdaughters() << std::endl ; + // std::cout << " ndau = " << node->GetNdaughters() << std::endl ; - for (Int_t idau = 0, ndau = node->GetNdaughters(); idau < ndau; ++idau) { + for (Int_t idau = 0, ndau = node->GetNdaughters(); idau < ndau; ++idau) { - TGeoNode* daughter = node->GetDaughter(idau); - PlacedVolume placement( daughter ); + TGeoNode* daughter = node->GetDaughter(idau); + PlacedVolume placement( daughter ); - if ( !placement.data() ) { - throw std::runtime_error("*** findVolume: Invalid not instrumented placement:"+std::string(daughter->GetName()) - +" [Internal error -- bad detector constructor]"); - } + if ( !placement.data() ) { + throw std::runtime_error("*** findVolume: Invalid not instrumented placement:"+std::string(daughter->GetName()) + +" [Internal error -- bad detector constructor]"); + } - PlacedVolume pv_dau = Ref_t(daughter); // why use a Ref_t here ??? + PlacedVolume pv_dau = Ref_t(daughter); // why use a Ref_t here ??? - if( findVolume( pv_dau , theVol , volList ) ) { + if( findVolume( pv_dau , theVol , volList ) ) { - // std::cout << " ----- found in daughter volume !!! " << std::hex << pv_dau.volume().ptr() << std::endl ; + // std::cout << " ----- found in daughter volume !!! " << std::hex << pv_dau.volume().ptr() << std::endl ; - return true ; - } - } + return true ; + } + } - // ------- not found: + // ------- not found: - volList.pop_back() ; + volList.pop_back() ; - return false ; - //-------------------------------- + return false ; + //-------------------------------- } } @@ -396,7 +396,7 @@ namespace DD4hep { //====================================================================================================================== Surface::Surface( Geometry::DetElement det, VolSurface volSurf ) : _det( det) , _volSurf( volSurf ), - _wtM(0) , _id( 0) , _type( _volSurf.type() ) { + _wtM(0) , _id( 0) , _type( _volSurf.type() ) { initialize() ; } @@ -424,22 +424,22 @@ namespace DD4hep { if( ! mat.isValid() ) { - MaterialManager matMgr ; + MaterialManager matMgr ; - Vector3D p = _o - innerThickness() * _n ; + Vector3D p = _o - innerThickness() * _n ; - const MaterialVec& materials = matMgr.materialsBetween( _o , p ) ; + const MaterialVec& materials = matMgr.materialsBetween( _o , p ) ; - // std::cout << " ####### found materials between points : " << _o << " and " << p << " : " ; - // for( unsigned i=0,n=materials.size();i<n;++i){ - // std::cout << materials[i].first.name() << "[" << materials[i].second << "], " ; - // } - // std::cout << std::endl ; - // const MaterialData& matAvg = matMgr.createAveragedMaterial( materials ) ; - // mat = matAvg ; - // std::cout << " **** Surface::innerMaterial() - assigning averaged material to surface : " << mat << std::endl ; + // std::cout << " ####### found materials between points : " << _o << " and " << p << " : " ; + // for( unsigned i=0,n=materials.size();i<n;++i){ + // std::cout << materials[i].first.name() << "[" << materials[i].second << "], " ; + // } + // std::cout << std::endl ; + // const MaterialData& matAvg = matMgr.createAveragedMaterial( materials ) ; + // mat = matAvg ; + // std::cout << " **** Surface::innerMaterial() - assigning averaged material to surface : " << mat << std::endl ; - mat = ( materials.size() > 1 ? matMgr.createAveragedMaterial( materials ) : materials[0].first ) ; + mat = ( materials.size() > 1 ? matMgr.createAveragedMaterial( materials ) : materials[0].first ) ; } return mat ; @@ -452,13 +452,13 @@ namespace DD4hep { if( ! mat.isValid() ) { - MaterialManager matMgr ; + MaterialManager matMgr ; - Vector3D p = _o + outerThickness() * _n ; + Vector3D p = _o + outerThickness() * _n ; - const MaterialVec& materials = matMgr.materialsBetween( _o , p ) ; + const MaterialVec& materials = matMgr.materialsBetween( _o , p ) ; - mat = ( materials.size() > 1 ? matMgr.createAveragedMaterial( materials ) : materials[0].first ) ; + mat = ( materials.size() > 1 ? matMgr.createAveragedMaterial( materials ) : materials[0].first ) ; } return mat ; @@ -527,9 +527,9 @@ namespace DD4hep { Volume theVol = _volSurf.volume() ; if( ! findVolume( pv, theVol , pVList ) ){ - theVol = _volSurf.volume() ; - std::stringstream sst ; sst << " ***** ERROR: Volume " << theVol.name() << " not found for DetElement " << _det.name() << " with surface " ; - throw std::runtime_error( sst.str() ) ; + theVol = _volSurf.volume() ; + std::stringstream sst ; sst << " ***** ERROR: Volume " << theVol.name() << " not found for DetElement " << _det.name() << " with surface " ; + throw std::runtime_error( sst.str() ) ; } // std::cout << " **** Surface::initialize() # placements for surface = " << pVList.size() @@ -544,10 +544,10 @@ namespace DD4hep { #if 0 // debug wm.Print() ; for( std::list<PlacedVolume>::iterator it= pVList.begin(), n = pVList.end() ; it != n ; ++it ){ - PlacedVolume pv = *it ; - TGeoMatrix* m = pv->GetMatrix(); - std::cout << " +++ matrix for placed volume : " << std::endl ; - m->Print() ; + PlacedVolume pv = *it ; + TGeoMatrix* m = pv->GetMatrix(); + std::cout << " +++ matrix for placed volume : " << std::endl ; + m->Print() ; } #endif @@ -560,11 +560,11 @@ namespace DD4hep { // DetElements world transform for( std::list<PlacedVolume>::iterator it = ++( pVList.begin() ) , n = pVList.end() ; it != n ; ++it ){ - PlacedVolume pv = *it ; - TGeoMatrix* m = pv->GetMatrix(); + PlacedVolume pvol = *it ; + TGeoMatrix* m = pvol->GetMatrix(); // std::cout << " +++ matrix for placed volume : " << std::endl ; // m->Print() ; - //wtI->MultiplyLeft( m ); + //wtI->MultiplyLeft( m ); wtI->Multiply( m ); } @@ -653,234 +653,234 @@ namespace DD4hep { if( type().isPlane() ) { - if( shape->IsA() == TGeoBBox::Class() ) { + if( shape->IsA() == TGeoBBox::Class() ) { - TGeoBBox* box = ( TGeoBBox* ) shape ; + TGeoBBox* box = ( TGeoBBox* ) shape ; - DDSurfaces::Vector3D boxDim( box->GetDX() , box->GetDY() , box->GetDZ() ) ; + DDSurfaces::Vector3D boxDim( box->GetDX() , box->GetDY() , box->GetDZ() ) ; - bool isYZ = std::fabs( ln.x() - 1.0 ) < epsilon ; // normal parallel to x - bool isXZ = std::fabs( ln.y() - 1.0 ) < epsilon ; // normal parallel to y - bool isXY = std::fabs( ln.z() - 1.0 ) < epsilon ; // normal parallel to z + bool isYZ = std::fabs( ln.x() - 1.0 ) < epsilon ; // normal parallel to x + bool isXZ = std::fabs( ln.y() - 1.0 ) < epsilon ; // normal parallel to y + bool isXY = std::fabs( ln.z() - 1.0 ) < epsilon ; // normal parallel to z - if( isYZ || isXZ || isXY ) { // plane is parallel to one of the box' sides -> need 4 vertices from box dimensions + if( isYZ || isXZ || isXY ) { // plane is parallel to one of the box' sides -> need 4 vertices from box dimensions - // if isYZ : - unsigned uidx = 1 ; - unsigned vidx = 2 ; + // if isYZ : + unsigned uidx = 1 ; + unsigned vidx = 2 ; - DDSurfaces::Vector3D ubl( 0., 1., 0. ) ; - DDSurfaces::Vector3D vbl( 0., 0., 1. ) ; + DDSurfaces::Vector3D ubl( 0., 1., 0. ) ; + DDSurfaces::Vector3D vbl( 0., 0., 1. ) ; - if( isXZ ) { + if( isXZ ) { - ubl.fill( 1., 0., 0. ) ; - vbl.fill( 0., 0., 1. ) ; - uidx = 0 ; - vidx = 2 ; + ubl.fill( 1., 0., 0. ) ; + vbl.fill( 0., 0., 1. ) ; + uidx = 0 ; + vidx = 2 ; - } else if( isXY ) { + } else if( isXY ) { - ubl.fill( 1., 0., 0. ) ; - vbl.fill( 0., 1., 0. ) ; - uidx = 0 ; - vidx = 1 ; - } + ubl.fill( 1., 0., 0. ) ; + vbl.fill( 0., 1., 0. ) ; + uidx = 0 ; + vidx = 1 ; + } - DDSurfaces::Vector3D ub ; - DDSurfaces::Vector3D vb ; - _wtM->LocalToMasterVect( ubl , ub.array() ) ; - _wtM->LocalToMasterVect( vbl , vb.array() ) ; + DDSurfaces::Vector3D ub ; + DDSurfaces::Vector3D vb ; + _wtM->LocalToMasterVect( ubl , ub.array() ) ; + _wtM->LocalToMasterVect( vbl , vb.array() ) ; - lines.reserve(4) ; + lines.reserve(4) ; - lines.push_back( std::make_pair( _o + boxDim[ uidx ] * ub + boxDim[ vidx ] * vb , _o - boxDim[ uidx ] * ub + boxDim[ vidx ] * vb ) ) ; - lines.push_back( std::make_pair( _o - boxDim[ uidx ] * ub + boxDim[ vidx ] * vb , _o - boxDim[ uidx ] * ub - boxDim[ vidx ] * vb ) ) ; - lines.push_back( std::make_pair( _o - boxDim[ uidx ] * ub - boxDim[ vidx ] * vb , _o + boxDim[ uidx ] * ub - boxDim[ vidx ] * vb ) ) ; - lines.push_back( std::make_pair( _o + boxDim[ uidx ] * ub - boxDim[ vidx ] * vb , _o + boxDim[ uidx ] * ub + boxDim[ vidx ] * vb ) ) ; + lines.push_back( std::make_pair( _o + boxDim[ uidx ] * ub + boxDim[ vidx ] * vb , _o - boxDim[ uidx ] * ub + boxDim[ vidx ] * vb ) ) ; + lines.push_back( std::make_pair( _o - boxDim[ uidx ] * ub + boxDim[ vidx ] * vb , _o - boxDim[ uidx ] * ub - boxDim[ vidx ] * vb ) ) ; + lines.push_back( std::make_pair( _o - boxDim[ uidx ] * ub - boxDim[ vidx ] * vb , _o + boxDim[ uidx ] * ub - boxDim[ vidx ] * vb ) ) ; + lines.push_back( std::make_pair( _o + boxDim[ uidx ] * ub - boxDim[ vidx ] * vb , _o + boxDim[ uidx ] * ub + boxDim[ vidx ] * vb ) ) ; - return lines ; - } + return lines ; + } - } else if( shape->IsA() == TGeoConeSeg::Class() ) { + } else if( shape->IsA() == TGeoConeSeg::Class() ) { - TGeoCone* cone = ( TGeoCone* ) shape ; + TGeoCone* cone = ( TGeoCone* ) shape ; - // can only deal with special case of z-disk and origin in center of cone - if( type().isZDisk() && lo.rho() < epsilon ) { + // can only deal with special case of z-disk and origin in center of cone + if( type().isZDisk() && lo.rho() < epsilon ) { - double zhalf = cone->GetDZ() ; - double rmax1 = cone->GetRmax1() ; - double rmax2 = cone->GetRmax2() ; - double rmin1 = cone->GetRmin1() ; - double rmin2 = cone->GetRmin2() ; + double zhalf = cone->GetDZ() ; + double rmax1 = cone->GetRmax1() ; + double rmax2 = cone->GetRmax2() ; + double rmin1 = cone->GetRmin1() ; + double rmin2 = cone->GetRmin2() ; - // two circles around origin - // get radii at position of plane - double r0 = rmin1 + ( rmin2 - rmin1 ) / ( 2. * zhalf ) * ( zhalf + lo.z() ) ; - double r1 = rmax1 + ( rmax2 - rmax1 ) / ( 2. * zhalf ) * ( zhalf + lo.z() ) ; + // two circles around origin + // get radii at position of plane + double r0 = rmin1 + ( rmin2 - rmin1 ) / ( 2. * zhalf ) * ( zhalf + lo.z() ) ; + double r1 = rmax1 + ( rmax2 - rmax1 ) / ( 2. * zhalf ) * ( zhalf + lo.z() ) ; - unsigned n = nMax / 4 ; - double dPhi = 2.* ROOT::Math::Pi() / double( n ) ; + unsigned n = nMax / 4 ; + double dPhi = 2.* ROOT::Math::Pi() / double( n ) ; - for( unsigned i = 0 ; i < n ; ++i ) { + for( unsigned i = 0 ; i < n ; ++i ) { - Vector3D rv00( r0*sin( i *dPhi ) , r0*cos( i *dPhi ) , 0. ) ; - Vector3D rv01( r0*sin( (i+1)*dPhi ) , r0*cos( (i+1)*dPhi ) , 0. ) ; + Vector3D rv00( r0*sin( i *dPhi ) , r0*cos( i *dPhi ) , 0. ) ; + Vector3D rv01( r0*sin( (i+1)*dPhi ) , r0*cos( (i+1)*dPhi ) , 0. ) ; - Vector3D rv10( r1*sin( i *dPhi ) , r1*cos( i *dPhi ) , 0. ) ; - Vector3D rv11( r1*sin( (i+1)*dPhi ) , r1*cos( (i+1)*dPhi ) , 0. ) ; + Vector3D rv10( r1*sin( i *dPhi ) , r1*cos( i *dPhi ) , 0. ) ; + Vector3D rv11( r1*sin( (i+1)*dPhi ) , r1*cos( (i+1)*dPhi ) , 0. ) ; - Vector3D pl0 = lo + rv00 ; - Vector3D pl1 = lo + rv01 ; + Vector3D pl0 = lo + rv00 ; + Vector3D pl1 = lo + rv01 ; - Vector3D pl2 = lo + rv10 ; - Vector3D pl3 = lo + rv11 ; + Vector3D pl2 = lo + rv10 ; + Vector3D pl3 = lo + rv11 ; - Vector3D pg0,pg1,pg2,pg3 ; + Vector3D pg0,pg1,pg2,pg3 ; - _wtM->LocalToMaster( pl0, pg0.array() ) ; - _wtM->LocalToMaster( pl1, pg1.array() ) ; - _wtM->LocalToMaster( pl2, pg2.array() ) ; - _wtM->LocalToMaster( pl3, pg3.array() ) ; + _wtM->LocalToMaster( pl0, pg0.array() ) ; + _wtM->LocalToMaster( pl1, pg1.array() ) ; + _wtM->LocalToMaster( pl2, pg2.array() ) ; + _wtM->LocalToMaster( pl3, pg3.array() ) ; - lines.push_back( std::make_pair( pg0, pg1 ) ) ; - lines.push_back( std::make_pair( pg2, pg3 ) ) ; - } + lines.push_back( std::make_pair( pg0, pg1 ) ) ; + lines.push_back( std::make_pair( pg2, pg3 ) ) ; + } - //add some vertical and horizontal lines so that the disc is seen in the rho-z projection + //add some vertical and horizontal lines so that the disc is seen in the rho-z projection - n = 4 ; dPhi = 2.* ROOT::Math::Pi() / double( n ) ; + n = 4 ; dPhi = 2.* ROOT::Math::Pi() / double( n ) ; - for( unsigned i = 0 ; i < n ; ++i ) { + for( unsigned i = 0 ; i < n ; ++i ) { - Vector3D rv0( r0*sin( i * dPhi ) , r0*cos( i * dPhi ) , 0. ) ; - Vector3D rv1( r1*sin( i * dPhi ) , r1*cos( i * dPhi ) , 0. ) ; + Vector3D rv0( r0*sin( i * dPhi ) , r0*cos( i * dPhi ) , 0. ) ; + Vector3D rv1( r1*sin( i * dPhi ) , r1*cos( i * dPhi ) , 0. ) ; - Vector3D pl0 = lo + rv0 ; - Vector3D pl1 = lo + rv1 ; + Vector3D pl0 = lo + rv0 ; + Vector3D pl1 = lo + rv1 ; - Vector3D pg0,pg1 ; + Vector3D pg0,pg1 ; - _wtM->LocalToMaster( pl0, pg0.array() ) ; - _wtM->LocalToMaster( pl1, pg1.array() ) ; + _wtM->LocalToMaster( pl0, pg0.array() ) ; + _wtM->LocalToMaster( pl1, pg1.array() ) ; - lines.push_back( std::make_pair( pg0, pg1 ) ) ; - } + lines.push_back( std::make_pair( pg0, pg1 ) ) ; + } - } + } - return lines ; - } - // ===== default for arbitrary planes in arbitrary shapes ================= + return lines ; + } + // ===== default for arbitrary planes in arbitrary shapes ================= - // We create nMax vertices by rotating the local u vector around the normal - // and checking the distance to the volume boundary in that direction. - // This is brute force and not very smart, as many points are created on straight - // lines and the edges are still rounded. - // The alterative would be to compute the true intersections a plane and the most - // common shapes - at least for boxes that should be not too hard. To be done... + // We create nMax vertices by rotating the local u vector around the normal + // and checking the distance to the volume boundary in that direction. + // This is brute force and not very smart, as many points are created on straight + // lines and the edges are still rounded. + // The alterative would be to compute the true intersections a plane and the most + // common shapes - at least for boxes that should be not too hard. To be done... - lines.reserve( nMax ) ; + lines.reserve( nMax ) ; - double dAlpha = 2.* ROOT::Math::Pi() / double( nMax ) ; + double dAlpha = 2.* ROOT::Math::Pi() / double( nMax ) ; - TVector3 normal( ln.x() , ln.y() , ln.z() ) ; + TVector3 norm( ln.x() , ln.y() , ln.z() ) ; - DDSurfaces::Vector3D first, previous ; + DDSurfaces::Vector3D first, previous ; - for(unsigned i=0 ; i< nMax ; ++i ){ + for(unsigned i=0 ; i< nMax ; ++i ){ - double alpha = double(i) * dAlpha ; + double alpha = double(i) * dAlpha ; - TVector3 vec( lu.x() , lu.y() , lu.z() ) ; + TVector3 vec( lu.x() , lu.y() , lu.z() ) ; - TRotation rot ; - rot.Rotate( alpha , normal ); + TRotation rot ; + rot.Rotate( alpha , norm ); - TVector3 vecR = rot * vec ; + TVector3 vecR = rot * vec ; - DDSurfaces::Vector3D luRot ; - luRot.fill( vecR ) ; + DDSurfaces::Vector3D luRot ; + luRot.fill( vecR ) ; - double dist = shape->DistFromInside( const_cast<double*> (lo.const_array()) , const_cast<double*> (luRot.const_array()) , 3, 0.1 ) ; + double dist = shape->DistFromInside( const_cast<double*> (lo.const_array()) , const_cast<double*> (luRot.const_array()) , 3, 0.1 ) ; - // local point at volume boundary - DDSurfaces::Vector3D lp = lo + dist * luRot ; + // local point at volume boundary + DDSurfaces::Vector3D lp = lo + dist * luRot ; - DDSurfaces::Vector3D gp ; + DDSurfaces::Vector3D gp ; - _wtM->LocalToMaster( lp , gp.array() ) ; - - // std::cout << " **** normal:" << ln << " lu:" << lu << " alpha:" << alpha << " luRot:" << luRot << " lp :" << lp << " gp:" << gp << " dist : " << dist - // << " is point " << gp << " inside : " << shape->Contains( gp.const_array() ) - // << " dist from outside for lo,lu " << shape->DistFromOutside( lo.const_array() , lu.const_array() , 3 ) - // << " dist from inside for lo,ln " << shape->DistFromInside( lo.const_array() , ln.const_array() , 3 ) - // << std::endl; - // shape->Dump() ; + _wtM->LocalToMaster( lp , gp.array() ) ; + + // std::cout << " **** normal:" << ln << " lu:" << lu << " alpha:" << alpha << " luRot:" << luRot << " lp :" << lp << " gp:" << gp << " dist : " << dist + // << " is point " << gp << " inside : " << shape->Contains( gp.const_array() ) + // << " dist from outside for lo,lu " << shape->DistFromOutside( lo.const_array() , lu.const_array() , 3 ) + // << " dist from inside for lo,ln " << shape->DistFromInside( lo.const_array() , ln.const_array() , 3 ) + // << std::endl; + // shape->Dump() ; - if( i > 0 ) - lines.push_back( std::make_pair( previous, gp ) ) ; - else - first = gp ; + if( i > 0 ) + lines.push_back( std::make_pair( previous, gp ) ) ; + else + first = gp ; - previous = gp ; - } - lines.push_back( std::make_pair( previous, first ) ) ; + previous = gp ; + } + lines.push_back( std::make_pair( previous, first ) ) ; } else if( type().isCylinder() ) { - // if( shape->IsA() == TGeoTube::Class() ) { - if( shape->IsA() == TGeoConeSeg::Class() ) { + // if( shape->IsA() == TGeoTube::Class() ) { + if( shape->IsA() == TGeoConeSeg::Class() ) { - lines.reserve( nMax ) ; + lines.reserve( nMax ) ; - TGeoTube* tube = ( TGeoTube* ) shape ; + TGeoTube* tube = ( TGeoTube* ) shape ; - double zHalf = tube->GetDZ() ; + double zHalf = tube->GetDZ() ; - Vector3D zv( 0. , 0. , zHalf ) ; + Vector3D zv( 0. , 0. , zHalf ) ; - double r = lo.rho() ; + double r = lo.rho() ; - unsigned n = nMax / 4 ; - double dPhi = 2.* ROOT::Math::Pi() / double( n ) ; + unsigned n = nMax / 4 ; + double dPhi = 2.* ROOT::Math::Pi() / double( n ) ; - for( unsigned i = 0 ; i < n ; ++i ) { + for( unsigned i = 0 ; i < n ; ++i ) { - Vector3D rv0( r*sin( i *dPhi ) , r*cos( i *dPhi ) , 0. ) ; - Vector3D rv1( r*sin( (i+1)*dPhi ) , r*cos( (i+1)*dPhi ) , 0. ) ; + Vector3D rv0( r*sin( i *dPhi ) , r*cos( i *dPhi ) , 0. ) ; + Vector3D rv1( r*sin( (i+1)*dPhi ) , r*cos( (i+1)*dPhi ) , 0. ) ; - // 4 points on local cylinder + // 4 points on local cylinder - Vector3D pl0 = zv + rv0 ; - Vector3D pl1 = zv + rv1 ; - Vector3D pl2 = -zv + rv1 ; - Vector3D pl3 = -zv + rv0 ; + Vector3D pl0 = zv + rv0 ; + Vector3D pl1 = zv + rv1 ; + Vector3D pl2 = -zv + rv1 ; + Vector3D pl3 = -zv + rv0 ; - Vector3D pg0,pg1,pg2,pg3 ; + Vector3D pg0,pg1,pg2,pg3 ; - _wtM->LocalToMaster( pl0, pg0.array() ) ; - _wtM->LocalToMaster( pl1, pg1.array() ) ; - _wtM->LocalToMaster( pl2, pg2.array() ) ; - _wtM->LocalToMaster( pl3, pg3.array() ) ; + _wtM->LocalToMaster( pl0, pg0.array() ) ; + _wtM->LocalToMaster( pl1, pg1.array() ) ; + _wtM->LocalToMaster( pl2, pg2.array() ) ; + _wtM->LocalToMaster( pl3, pg3.array() ) ; - lines.push_back( std::make_pair( pg0, pg1 ) ) ; - lines.push_back( std::make_pair( pg1, pg2 ) ) ; - lines.push_back( std::make_pair( pg2, pg3 ) ) ; - lines.push_back( std::make_pair( pg3, pg0 ) ) ; - } - } + lines.push_back( std::make_pair( pg0, pg1 ) ) ; + lines.push_back( std::make_pair( pg1, pg2 ) ) ; + lines.push_back( std::make_pair( pg2, pg3 ) ) ; + lines.push_back( std::make_pair( pg3, pg0 ) ) ; + } + } } return lines ; @@ -890,19 +890,19 @@ namespace DD4hep { Vector3D CylinderSurface::u( const Vector3D& point ) const { - Vector3D lp , u ; + Vector3D lp , u_val ; _wtM->MasterToLocal( point , lp.array() ) ; const DDSurfaces::Vector3D& lu = VolCylinder(_volSurf).u( lp ) ; - _wtM->LocalToMasterVect( lu , u.array() ) ; - return u ; + _wtM->LocalToMasterVect( lu , u_val.array() ) ; + return u_val ; } Vector3D CylinderSurface::v(const Vector3D& point ) const { - Vector3D lp , v ; + Vector3D lp , v_val ; _wtM->MasterToLocal( point , lp.array() ) ; const DDSurfaces::Vector3D& lv = VolCylinder(_volSurf).v( lp ) ; - _wtM->LocalToMasterVect( lv , v.array() ) ; - return v ; + _wtM->LocalToMasterVect( lv , v_val.array() ) ; + return v_val ; } Vector3D CylinderSurface::normal(const Vector3D& point ) const { @@ -915,7 +915,7 @@ namespace DD4hep { Vector2D CylinderSurface::globalToLocal( const Vector3D& point) const { - Vector3D lp , n ; + Vector3D lp; _wtM->MasterToLocal( point , lp.array() ) ; return VolCylinder(_volSurf).globalToLocal( lp ) ; diff --git a/DDSurfaces/include/DDSurfaces/Vector2D.h b/DDSurfaces/include/DDSurfaces/Vector2D.h index a233dd8cb47941d91c2ae8e0ad5b5a5bbab4037e..1965a595c15fe9f06f07c76eb811ebdc85375d7c 100644 --- a/DDSurfaces/include/DDSurfaces/Vector2D.h +++ b/DDSurfaces/include/DDSurfaces/Vector2D.h @@ -11,7 +11,7 @@ namespace DDSurfaces { { public: Vector2D() : _u(0.), _v(0.) {} - Vector2D(double u, double v) : _u(u), _v(v) {} + Vector2D(double u_val, double v_val) : _u(u_val), _v(v_val) {} double operator[](unsigned i) const { diff --git a/DDSurfaces/include/DDSurfaces/Vector3D.h b/DDSurfaces/include/DDSurfaces/Vector3D.h index 42f79b7cae331ffb778de5353bd448bb8f0830b1..819de8b8816f3e8106bce206342954af6ec56de3 100644 --- a/DDSurfaces/include/DDSurfaces/Vector3D.h +++ b/DDSurfaces/include/DDSurfaces/Vector3D.h @@ -41,10 +41,10 @@ namespace DDSurfaces { /** Default corrdinate system for initialization is cartesian */ - Vector3D( double x,double y, double z ) : - _x(x), - _y(y), - _z(z) { + Vector3D( double x_val,double y_val, double z_val ) : + _x(x_val), + _y(y_val), + _z(z_val) { } // ---- this causes all sorts of template lookup errors ... @@ -81,8 +81,8 @@ namespace DDSurfaces { } /// fill from double values - inline const Vector3D& fill( double x, double y, double z) { - _x = x ; _y = y ; _z = z ; + inline const Vector3D& fill( double x_val, double y_val, double z_val) { + _x = x_val ; _y = y_val ; _z = z_val ; return *this ; } @@ -311,20 +311,20 @@ namespace DDSurfaces { * Vector3D v( x, y, c , Vector3D::cartesian ) ; */ template <> - inline Vector3D::Vector3D( double x,double y, double z, Vector3D::Cartesian (&)() ) : - _x(x), - _y(y), - _z(z) { + inline Vector3D::Vector3D( double x_val,double y_val, double z_val, Vector3D::Cartesian (&)() ) : + _x(x_val), + _y(y_val), + _z(z_val) { } /** Cylindrical c'tor - example: <br> * Vector3D v( rho, phi, z , Vector3D::cylindrical ) ; */ template <> - inline Vector3D::Vector3D( double rho,double phi, double z, Vector3D::Cylindrical (&)() ) : _z(z) { + inline Vector3D::Vector3D( double rho_val,double phi_val, double z_val, Vector3D::Cylindrical (&)() ) : _z(z_val) { - _x = rho * cos( phi ) ; - _y = rho * sin( phi ) ; + _x = rho_val * cos( phi_val ) ; + _y = rho_val * sin( phi_val ) ; } @@ -332,11 +332,11 @@ namespace DDSurfaces { * Vector3D v( r, phi, theta , Vector3D::spherical ) ; */ template <> - inline Vector3D::Vector3D( double r,double phi, double theta, Vector3D::Spherical (&)() ) { - double rst = r * sin( theta ) ; - _x = rst * cos( phi ) ; - _y = rst * sin( phi ) ; - _z = r * cos( theta ) ; + inline Vector3D::Vector3D( double r_val,double phi_val, double theta_val, Vector3D::Spherical (&)() ) { + double rst = r_val * sin( theta_val ) ; + _x = rst * cos( phi_val ) ; + _y = rst * sin( phi_val ) ; + _z = r_val * cos( theta_val ) ; } diff --git a/DDTest/src/test_bitfield64.cc b/DDTest/src/test_bitfield64.cc index 4a8aff5d104c4c82626adab1a0c1ddc100e7cc07..70e47bb1f58c29577cfcd0468cb2a19fc5094a52 100644 --- a/DDTest/src/test_bitfield64.cc +++ b/DDTest/src/test_bitfield64.cc @@ -16,7 +16,7 @@ DDTest test = DDTest( "bitfield64" ) ; //============================================================================= -int main(int argc, char** argv ){ +int main(int /* argc */, char** /* argv */ ){ try{ diff --git a/DDTest/src/test_example.cc b/DDTest/src/test_example.cc index 80dfc1dcc5cb02e0931c5dc93f8d96ad4c670f53..f21046004e266e69237ba6d9b17e5a20284f6b71 100644 --- a/DDTest/src/test_example.cc +++ b/DDTest/src/test_example.cc @@ -12,7 +12,7 @@ DDTest test = DDTest( "example" ) ; //============================================================================= -int main(int argc, char** argv ){ +int main(int /* argc */, char** /* argv */ ){ try{ diff --git a/doc/CompileAllOptionPermutations.sh b/doc/CompileAllOptionPermutations.sh index d7a7d317ab57cbf76ef6d22de4b011d9c2c07252..095272b420e799f93ed9045952e2cc0607ca8504 100755 --- a/doc/CompileAllOptionPermutations.sh +++ b/doc/CompileAllOptionPermutations.sh @@ -2,7 +2,8 @@ dir_name=`pwd`; INSTALL_G4=/home/frankm/SW/g4_10.01.p02_dbg/lib/Geant4-10.1.2; INSTALL_LCIO=/home/frankm/SW/lcio/v02-04-03; INSTALL_XERCESC=/home/frankm/SW/xercesc; - +export ROOTSYS=/home/frankm/SW/root_v5.34.25_dbg; +. ${ROOTSYS}/bin/thisroot.sh; # # make_opt()