Skip to content

Commit

Permalink
Merge pull request #31454 from ianna/dd4hep-core-cleanup-v1
Browse files Browse the repository at this point in the history
[DD4hep] Start Core Code Cleanup
  • Loading branch information
cmsbuild authored Sep 16, 2020
2 parents 916cb3d + 66e770f commit e0739f9
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 417 deletions.
14 changes: 7 additions & 7 deletions DetectorDescription/DDCMS/interface/DDAlgoArguments.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
#ifndef DETECTOR_DESCRIPTION_DD_ALGO_ARGUMENTS_H
#define DETECTOR_DESCRIPTION_DD_ALGO_ARGUMENTS_H
#ifndef DetectorDescription_DDCMS_DDAlgoArguments_h
#define DetectorDescription_DDCMS_DDAlgoArguments_h

#include "XML/XML.h"
#include "DD4hep/DetElement.h"
#include "DetectorDescription/DDCMS/interface/DDXMLTags.h"
#include "DetectorDescription/DDCMS/interface/DDNamespace.h"
#include "DetectorDescription/DDCMS/interface/DDParsingContext.h"
#include "DetectorDescription/DDCMS/interface/DDRotationMatrix.h"
#include "DetectorDescription/DDCMS/interface/DDTranslation.h"

#include <map>
#include <sstream>

namespace cms {
using DD3Vector = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>>;

static constexpr long s_executed = 1l;

constexpr unsigned int hash(const char* str, int h = 0) { return !str[h] ? 5381 : (hash(str, h + 1) * 33) ^ str[h]; }

inline unsigned int hash(const std::string& str) { return hash(str.c_str()); }

dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ);
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ);

dd4hep::Rotation3D makeRotReflect(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ);
DDRotationMatrix makeRotReflect(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ);

dd4hep::Rotation3D makeRotation3D(dd4hep::Rotation3D rotation, const std::string& axis, double angle);
DDRotationMatrix makeRotation3D(DDRotationMatrix rotation, const std::string& axis, double angle);

class DDAlgoArguments {
public:
Expand Down
4 changes: 2 additions & 2 deletions DetectorDescription/DDCMS/interface/DDCompactView.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DETECTOR_DESCRIPTION_DD_COMPACT_VIEW_H
#define DETECTOR_DESCRIPTION_DD_COMPACT_VIEW_H
#ifndef DetectorDescription_DDCMS_DDCompactView_h
#define DetectorDescription_DDCMS_DDCompactView_h

// -*- C++ -*-
//
Expand Down
10 changes: 2 additions & 8 deletions DetectorDescription/DDCMS/interface/DDDetector.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DETECTOR_DESCRIPTION_DD_DETECTOR_H
#define DETECTOR_DESCRIPTION_DD_DETECTOR_H
#ifndef DetectorDescription_DDCMS_DDDetector_h
#define DetectorDescription_DDCMS_DDDetector_h

#include <DD4hep/Detector.h>
#include <DD4hep/SpecParRegistry.h>
Expand All @@ -22,15 +22,9 @@ namespace cms {
//! Handle to the world volume containing everything
dd4hep::Volume worldVolume() const;

//! Access to the physical volume of the world detector element
dd4hep::PlacedVolume worldPlacement() const;

//! Reference to the top-most (world) detector element
dd4hep::DetElement world() const;

//! The map of sub-detectors
const dd4hep::Detector::HandleMap& detectors() const;

//! The geometry manager of this instance
TGeoManager& manager() const;

Expand Down
40 changes: 0 additions & 40 deletions DetectorDescription/DDCMS/interface/DDExpandedView.h

This file was deleted.

5 changes: 2 additions & 3 deletions DetectorDescription/DDCMS/interface/DDFilteredView.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DETECTOR_DESCRIPTION_DD_FILTERED_VIEW_H
#define DETECTOR_DESCRIPTION_DD_FILTERED_VIEW_H
#ifndef DetectorDescription_DDCMS_DDFilteredView_h
#define DetectorDescription_DDCMS_DDFilteredView_h

// -*- C++ -*-
//
Expand Down Expand Up @@ -215,7 +215,6 @@ namespace cms {
int nodeCopyNo(const std::string_view) const;
std::vector<std::pair<std::string_view, int>> toNodeNames(const std::string&);
bool match(const std::string&, const std::vector<std::pair<std::string_view, int>>&) const;
const TClass* getShape() const;

//! set the current node to the first sibling
bool firstSibling();
Expand Down
5 changes: 3 additions & 2 deletions DetectorDescription/DDCMS/interface/DDTranslation.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef DetectorDescription_DDCMS_DDTranslation_h
#define DetectorDescription_DDCMS_DDTranslation_h

#include <Math/Vector3D.h>

//! A DD Translation is currently implemented with Root Vector3D
typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> > DD3Vector;
typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> > DDTranslation;
using DD3Vector = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>>;
using DDTranslation = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>>;

#endif
88 changes: 0 additions & 88 deletions DetectorDescription/DDCMS/interface/DDVolumeProcessor.h

This file was deleted.

2 changes: 1 addition & 1 deletion DetectorDescription/DDCMS/plugins/DDCMSDetector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void DDCMSDetector::analyze(const Event&, const EventSetup& iEventSetup) {

LogVerbatim("Geometry") << "Iterate over the detectors:\n";
LogVerbatim("Geometry").log([&](auto& log) {
for (auto const& it : det->detectors()) {
for (auto const& it : det->description()->detectors()) {
dd4hep::DetElement det(it.second);
log << it.first << ": " << det.path();
}
Expand Down
91 changes: 0 additions & 91 deletions DetectorDescription/DDCMS/plugins/test/DDTestNavigateGeometry.cc

This file was deleted.

7 changes: 0 additions & 7 deletions DetectorDescription/DDCMS/src/DDDetector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,11 @@ namespace cms {
return m_description->worldVolume();
}

dd4hep::PlacedVolume DDDetector::worldPlacement() const { return world().placement(); }

dd4hep::DetElement DDDetector::world() const {
assert(m_description);
return m_description->world();
}

const dd4hep::Detector::HandleMap& DDDetector::detectors() const {
assert(m_description);
return m_description->detectors();
}

TGeoManager& DDDetector::manager() const {
assert(m_description);
return m_description->manager();
Expand Down
6 changes: 0 additions & 6 deletions DetectorDescription/DDCMS/src/DDFilteredView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,6 @@ const ExpandedNodes& DDFilteredView::history() {
return nodes_;
}

const TClass* DDFilteredView::getShape() const {
assert(node_);
Volume currVol = node_->GetVolume();
return (currVol->GetShape()->IsA());
}

std::string_view DDFilteredView::name() const { return (volume().volume().name()); }

dd4hep::Solid DDFilteredView::solid() const { return (volume().volume().solid()); }
Expand Down
5 changes: 0 additions & 5 deletions DetectorDescription/DDCMS/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
<use name="dd4hep"/>
</bin>

<bin name="testDD4hepExpandedView" file="DDExpandedView.cppunit.cc,testRunner.cpp">
<use name="DetectorDescription/DDCMS"/>
<use name="dd4hep"/>
</bin>

<bin name="testDD4hepCompactView" file="DDCompactView.cppunit.cc,testRunner.cpp">
<use name="DetectorDescription/DDCMS"/>
<use name="dd4hep"/>
Expand Down
Loading

0 comments on commit e0739f9

Please sign in to comment.