From f40eb9132c708bf193079f7b4160d4f57c521520 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Mon, 23 Mar 2020 17:36:35 +0100 Subject: [PATCH 01/24] First shot at DD4HEP migration for CondTools/Geometry and TrackerGeometryCompare --- .../plugins/TrackerGeometryCompare.cc | 3 ++- .../Geometry/plugins/PGeometricDetBuilder.cc | 15 ++++++++++----- .../Geometry/plugins/PGeometricDetExtraBuilder.cc | 4 ++-- .../plugins/PTrackerParametersDBBuilder.cc | 3 ++- .../bin/stubs/GeometricDetLoader.cc | 4 ++-- .../interface/GeometricDet.h | 5 +++-- .../TrackerNumberingBuilder/src/GeometricDet.cc | 8 ++++---- 7 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc index 854b4e8a3b119..03baa18190d32 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc @@ -35,6 +35,7 @@ #include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h" #include "CondFormats/Alignment/interface/DetectorGlobalPosition.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" //#include "Alignment/OfflineValidation/interface/ComparisonUtilities.h" //#include "Alignment/CommonAlignment/interface/AlignTools.h" @@ -362,7 +363,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { } //accessing the initial geometry - edm::ESTransientHandle cpv; + edm::ESTransientHandle cpv; iSetup.get().get(cpv); edm::ESHandle theGeometricDet; iSetup.get().get(theGeometricDet); diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index fdd5c2e33e69a..cdd133d6559b1 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -11,10 +11,15 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" #include "DetectorDescription/Core/interface/DDCompactView.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include +using DD3Vector = ROOT::Math::DisplacementVector3D >; +using Translation = ROOT::Math::DisplacementVector3D>; +using RotationMatrix = ROOT::Math::Rotation3D; + class PGeometricDetBuilder : public edm::one::EDAnalyzer { public: PGeometricDetBuilder(const edm::ParameterSet&) {} @@ -34,7 +39,7 @@ void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) edm::LogError("PGeometricDetBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle pDD; + edm::ESTransientHandle pDD; edm::ESHandle rDD; es.get().get(pDD); es.get().get(rDD); @@ -114,8 +119,8 @@ void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) void PGeometricDetBuilder::putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev) { PGeometricDet::Item item; - const DDTranslation& tran = gd->translation(); - const DDRotationMatrix& rot = gd->rotation(); + const Translation& tran = gd->translation(); + const RotationMatrix& rot = gd->rotation(); DD3Vector x, y, z; rot.GetComponents(x, y, z); item._name = gd->name(); @@ -137,7 +142,7 @@ void PGeometricDetBuilder::putOne(const GeometricDet* gd, PGeometricDet* pgd, in item._a33 = z.Z(); item._shape = static_cast(gd->shape()); item._type = gd->type(); - if (gd->shape() == DDSolidShape::ddbox) { + if (gd->shape() == cms::DDSolidShape::ddbox) { item._params0 = gd->params()[0]; item._params1 = gd->params()[1]; item._params2 = gd->params()[2]; @@ -149,7 +154,7 @@ void PGeometricDetBuilder::putOne(const GeometricDet* gd, PGeometricDet* pgd, in item._params8 = 0; item._params9 = 0; item._params10 = 0; - } else if (gd->shape() == DDSolidShape::ddtrap) { + } else if (gd->shape() == cms::DDSolidShape::ddtrap) { item._params0 = gd->params()[0]; item._params1 = gd->params()[1]; item._params2 = gd->params()[2]; diff --git a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc index ad1420b32427d..3c2596ca4c042 100644 --- a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc @@ -10,7 +10,7 @@ #include "CondFormats/GeometryObjects/interface/PGeometricDetExtra.h" #include "Geometry/Records/interface/PGeometricDetExtraRcd.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDetExtra.h" -#include "DetectorDescription/Core/interface/DDCompactView.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include @@ -34,7 +34,7 @@ void PGeometricDetExtraBuilder::beginRun(const edm::Run&, edm::EventSetup const& edm::LogError("PGeometricDetExtraBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle cpvH; + edm::ESTransientHandle cpvH; edm::ESHandle > gdeH; es.get().get(cpvH); es.get().get(gdeH); diff --git a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc index 288b0ab1a656e..83515212a14c5 100644 --- a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc @@ -6,6 +6,7 @@ #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/GeometryObjects/interface/PTrackerParameters.h" #include "DetectorDescription/Core/interface/DDCompactView.h" +#include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerParametersFromDD.h" @@ -25,7 +26,7 @@ void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup cons edm::LogError("PTrackerParametersDBBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle cpv; + edm::ESTransientHandle cpv; es.get().get(cpv); TrackerParametersFromDD builder; diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc index 98ee932cf3118..8e2dc4cf1b86b 100644 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc +++ b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc @@ -153,7 +153,7 @@ void GeometricDetLoader::putOne(const GeometricDet* gd, PGeometricDet* pgd, int item._a33 = z.Z(); item._shape = static_cast(gd->shape()); item._type = gd->type(); - if (gd->shape() == DDSolidShape::ddbox) { + if (gd->shape() == cms::DDSolidShape::ddbox) { item._params0 = gd->params()[0]; item._params1 = gd->params()[1]; item._params2 = gd->params()[2]; @@ -165,7 +165,7 @@ void GeometricDetLoader::putOne(const GeometricDet* gd, PGeometricDet* pgd, int item._params8 = 0; item._params9 = 0; item._params10 = 0; - } else if (gd->shape() == DDSolidShape::ddtrap) { + } else if (gd->shape() == cms::DDSolidShape::ddtrap) { item._params0 = gd->params()[0]; item._params1 = gd->params()[1]; item._params2 = gd->params()[2]; diff --git a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h index 4b1e758e3bcbf..e8f1d0c0c8a0e 100644 --- a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h +++ b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h @@ -3,6 +3,7 @@ #include "CondFormats/GeometryObjects/interface/PGeometricDet.h" #include "DetectorDescription/Core/interface/DDSolidShapes.h" +#include "DetectorDescription/DDCMS/interface/DDSolidShapes.h" #include "DataFormats/GeometrySurface/interface/Surface.h" #include "DataFormats/GeometrySurface/interface/Bounds.h" #include "DataFormats/DetId/interface/DetId.h" @@ -118,7 +119,7 @@ class GeometricDet { double phi() const { return _phi; } double rho() const { return _rho; } - DDSolidShape const& shape() const { return _shape; } + cms::DDSolidShape const& shape() const { return _shape; } GeometricEnumType type() const { return _type; } std::string const& name() const { return _ddname; } @@ -187,7 +188,7 @@ class GeometricDet { double _phi; double _rho; RotationMatrix _rot; - DDSolidShape _shape; + cms::DDSolidShape _shape; nav_type _ddd; std::string _ddname; GeometricEnumType _type; diff --git a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc index 84fa70c4ef36c..d59da54ee8108 100644 --- a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc +++ b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc @@ -73,7 +73,7 @@ GeometricDet::GeometricDet(DDFilteredView* fv, GeometricEnumType type) _phi(_trans.Phi()), _rho(_trans.Rho()), _rot(fv->rotation()), - _shape(fv->shape()), + _shape(cms::DDSolidShape(static_cast(fv->shape()))), _ddname(fv->name()), _type(type), _params(fv->parameters()), @@ -95,7 +95,7 @@ GeometricDet::GeometricDet(cms::DDFilteredView* fv, GeometricEnumType type) _phi(_trans.Phi()), _rho(_trans.Rho()), _rot(fv->rotation()), - _shape(DDSolidShape(static_cast(fv->shape()))), + _shape(fv->shape()), _ddd(fv->navPos()), _ddname(fv->name()), _type(type), @@ -124,7 +124,7 @@ GeometricDet::GeometricDet(const PGeometricDet::Item& onePGD, GeometricEnumType onePGD._a31, onePGD._a32, onePGD._a33), - _shape(static_cast(onePGD._shape)), + _shape(static_cast(onePGD._shape)), _ddd(), _ddname(onePGD._name), _type(type), @@ -243,5 +243,5 @@ GeometricDet::Rotation GeometricDet::rotationBounds() const { std::unique_ptr GeometricDet::bounds() const { const std::vector& par = _params; TrackerShapeToBounds shapeToBounds; - return std::unique_ptr(shapeToBounds.buildBounds(_shape, par)); + return std::unique_ptr(shapeToBounds.buildBounds(DDSolidShape(static_cast(_shape)), par)); } From 2518ef8d96834d8e5dbec40e5eeaef961ea5dfa2 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Wed, 13 May 2020 15:16:29 +0200 Subject: [PATCH 02/24] Migrate TrackerNumberingBuilder to DD4HEP-SolidShapes --- .../DDCMS/interface/DDSolidShapes.h | 24 +++++++++---------- .../bin/stubs/GeometricDetLoader.cc | 3 ++- .../interface/TrackerShapeToBounds.h | 4 ++-- .../src/GeometricDet.cc | 2 +- .../src/TrackerShapeToBounds.cc | 14 +++++------ 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/DetectorDescription/DDCMS/interface/DDSolidShapes.h b/DetectorDescription/DDCMS/interface/DDSolidShapes.h index 06dc5b4be33f7..23de920d7842a 100644 --- a/DetectorDescription/DDCMS/interface/DDSolidShapes.h +++ b/DetectorDescription/DDCMS/interface/DDSolidShapes.h @@ -67,18 +67,18 @@ namespace cms { ddcons = 4, ddpolycone = 5, ddpolyhedra = 6, - ddtorus = 7, - ddunion = 8, - ddsubtraction = 9, - ddintersection = 10, - ddshapeless = 11, - ddpseudotrap = 12, - ddtrunctubs = 13, - ddsphere = 14, - ddellipticaltube = 15, - ddcuttubs = 16, - ddextrudedpolygon = 17, - ddtrd1 = 18, + ddtorus = 9, + ddunion = 10, + ddsubtraction = 11, + ddintersection = 12, + ddshapeless = 13, + ddpseudotrap = 14, + ddtrunctubs = 15, + ddsphere = 16, + ddellipticaltube = 17, + ddcuttubs = 18, + ddextrudedpolygon = 19, + ddtrd1 = 20, }; const std::array, 19> DDSolidShapeMap{ diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc index 8e2dc4cf1b86b..5fe52989198cd 100644 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc +++ b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc @@ -11,6 +11,7 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" #include +#include #include #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -37,7 +38,7 @@ void GeometricDetLoader::beginRun(edm::Run const& /* iEvent */, edm::EventSetup std::cout << "PoolDBOutputService unavailable" << std::endl; return; } - edm::ESHandle pDD; + edm::ESHandle pDD; edm::ESHandle rDD; es.get().get(pDD); es.get().get(rDD); diff --git a/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h b/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h index 319f5dabf3aa8..6d5d0006ad98c 100644 --- a/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h +++ b/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h @@ -2,7 +2,7 @@ #define Geometry_TrackerNumberingBuilder_TrackerShapeToBounds_H #include "DataFormats/GeometrySurface/interface/Bounds.h" -#include "DetectorDescription/Core/interface/DDSolidShapes.h" +#include "DetectorDescription/DDCMS/interface/DDSolidShapes.h" #include #include /** @@ -13,7 +13,7 @@ class TrackerShapeToBounds { /** *buildBounds() return the Bounds. */ - Bounds* buildBounds(const DDSolidShape&, const std::vector&) const; + Bounds* buildBounds(const cms::DDSolidShape&, const std::vector&) const; private: Bounds* buildBox(const std::vector&) const; diff --git a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc index d59da54ee8108..9e8f412b43219 100644 --- a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc +++ b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc @@ -243,5 +243,5 @@ GeometricDet::Rotation GeometricDet::rotationBounds() const { std::unique_ptr GeometricDet::bounds() const { const std::vector& par = _params; TrackerShapeToBounds shapeToBounds; - return std::unique_ptr(shapeToBounds.buildBounds(DDSolidShape(static_cast(_shape)), par)); + return std::unique_ptr(shapeToBounds.buildBounds(cms::DDSolidShape(static_cast(_shape)), par)); } diff --git a/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc b/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc index 2650f05a84920..7ae9174585eee 100644 --- a/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc +++ b/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc @@ -29,25 +29,25 @@ 3. combine the global rotation from DDD with the rotation defined in 2. */ -Bounds* TrackerShapeToBounds::buildBounds(const DDSolidShape& _shape, const std::vector& _par) const { +Bounds* TrackerShapeToBounds::buildBounds(const cms::DDSolidShape& _shape, const std::vector& _par) const { switch (_shape) { - case DDSolidShape::ddbox: + case cms::DDSolidShape::ddbox: return buildBox(_par); break; - case DDSolidShape::ddtrap: + case cms::DDSolidShape::ddtrap: return buildTrap(_par); break; - case DDSolidShape::ddtubs: + case cms::DDSolidShape::ddtubs: return buildOpen(_par); break; - case DDSolidShape::ddpolycone_rrz: + case cms::DDSolidShape::ddpolycone: return buildOpen(_par); break; - case DDSolidShape::ddsubtraction: + case cms::DDSolidShape::ddsubtraction: return buildOpen(_par); break; default: - std::cout << "Wrong DDshape to build...." << DDSolidShapesName::name(_shape) << std::endl; + std::cout << "Wrong DDshape to build...." << cms::dd::name(cms::DDSolidShapeMap, _shape) << std::endl; Bounds* bounds = nullptr; return bounds; } From 20e87b62cfdd17ba53e89558ebf8eb8467c69821 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 19 May 2020 13:20:27 +0200 Subject: [PATCH 03/24] Cast to cms::DDSolidShape in MTD GeometricTimingDet --- Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc index 11a9464bf0adf..a9d3d356a3d08 100644 --- a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc +++ b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc @@ -257,5 +257,5 @@ GeometricTimingDet::Rotation GeometricTimingDet::rotationBounds() const { std::unique_ptr GeometricTimingDet::bounds() const { const std::vector& par = params_; TrackerShapeToBounds shapeToBounds; - return std::unique_ptr(shapeToBounds.buildBounds(shape_, par)); + return std::unique_ptr(shapeToBounds.buildBounds(cms::DDSolidShape(static_cast(shape_)), par)); } From 32a426c1ce594b5ca667b179f2ad0a90375db4ef Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 19 May 2020 13:36:14 +0200 Subject: [PATCH 04/24] PGeometricDetBuilder: code format --- CondTools/Geometry/plugins/PGeometricDetBuilder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index cdd133d6559b1..1f7099496935e 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -16,7 +16,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include -using DD3Vector = ROOT::Math::DisplacementVector3D >; +using DD3Vector = ROOT::Math::DisplacementVector3D>; using Translation = ROOT::Math::DisplacementVector3D>; using RotationMatrix = ROOT::Math::Rotation3D; From 9dc0976efddc90e1e92a1c3037cfb403c9d9c29d Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 19 May 2020 14:18:30 +0200 Subject: [PATCH 05/24] Removing some old DD headers --- CondTools/Geometry/plugins/PGeometricDetBuilder.cc | 1 - CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc | 1 - .../TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index 1f7099496935e..558b89c308849 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -10,7 +10,6 @@ #include "CondFormats/GeometryObjects/interface/PGeometricDet.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" -#include "DetectorDescription/Core/interface/DDCompactView.h" #include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc index 83515212a14c5..3069b9d6bc760 100644 --- a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc @@ -5,7 +5,6 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/GeometryObjects/interface/PTrackerParameters.h" -#include "DetectorDescription/Core/interface/DDCompactView.h" #include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerParametersFromDD.h" diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc index 5fe52989198cd..d9f6e2e13ad1b 100644 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc +++ b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc @@ -10,7 +10,7 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" -#include +//#include #include #include From 7b515649ab01190889ad57428af400be80e70c63 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 26 May 2020 17:06:28 +0200 Subject: [PATCH 06/24] Make Tk plugins handle both old DD and DD4hep --- .../plugins/TrackerGeometryCompare.cc | 10 ++++++-- .../plugins/TrackerGeometryCompare.h | 1 + .../python/TrackerGeometryCompare_cfi.py | 1 + .../Geometry/plugins/PGeometricDetBuilder.cc | 17 ++++++++++--- .../plugins/PGeometricDetExtraBuilder.cc | 19 ++++++++++++--- .../plugins/PTrackerParametersDBBuilder.cc | 24 +++++++++++++++---- .../bin/stubs/GeometricDetLoader.cc | 13 +++++++--- .../bin/stubs/GeometricDetLoader.h | 1 + .../interface/TrackerShapeToBounds.h | 2 +- .../src/TrackerShapeToBounds.cc | 8 ++----- 10 files changed, 74 insertions(+), 22 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc index 03baa18190d32..8958011d46f45 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc @@ -68,6 +68,7 @@ TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) theSurveyValues(nullptr), theSurveyErrors(nullptr), _levelStrings(cfg.getUntrackedParameter >("levels")), + _fromDD4hep(cfg.getUntrackedParameter("fromDD4hep")), _writeToDB(cfg.getUntrackedParameter("writeToDB")), _commonTrackerLevel(align::invalid), _moduleListFile(nullptr), @@ -363,8 +364,13 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { } //accessing the initial geometry - edm::ESTransientHandle cpv; - iSetup.get().get(cpv); + if(!_fromDD4hep){ + edm::ESTransientHandle cpv; + iSetup.get().get(cpv); + } else { + edm::ESTransientHandle cpv; + iSetup.get().get(cpv); + } edm::ESHandle theGeometricDet; iSetup.get().get(theGeometricDet); edm::ESHandle ptp; diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h index 59b94d0b1fa59..cd06e955d84c2 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h @@ -106,6 +106,7 @@ class TrackerGeometryCompare : public edm::EDAnalyzer { std::string _inputFilename2; std::string _inputTreenameAlign; std::string _inputTreenameDeform; + bool _fromDD4hep; bool _writeToDB; std::string _weightBy; std::string _setCommonTrackerSystem; diff --git a/Alignment/OfflineValidation/python/TrackerGeometryCompare_cfi.py b/Alignment/OfflineValidation/python/TrackerGeometryCompare_cfi.py index b5c30e37d048b..0539d033224f2 100644 --- a/Alignment/OfflineValidation/python/TrackerGeometryCompare_cfi.py +++ b/Alignment/OfflineValidation/python/TrackerGeometryCompare_cfi.py @@ -2,6 +2,7 @@ # Full configuration for Tracker Geometry Comparison Tool TrackerGeometryCompare = cms.EDAnalyzer("TrackerGeometryCompare", + fromDD4hep = cms.untracked.bool(False), writeToDB = cms.untracked.bool(False), outputFile = cms.untracked.string('output.root'), setCommonTrackerSystem = cms.untracked.string('NONE'), ##must be "NONE" if you don't want to use this option diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index 558b89c308849..43923f475d243 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -11,6 +11,7 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" #include "DetectorDescription/DDCMS/interface/DDCompactView.h" +#include "DetectorDescription/Core/interface/DDCompactView.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include @@ -21,7 +22,7 @@ using RotationMatrix = ROOT::Math::Rotation3D; class PGeometricDetBuilder : public edm::one::EDAnalyzer { public: - PGeometricDetBuilder(const edm::ParameterSet&) {} + PGeometricDetBuilder(const edm::ParameterSet&); void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} @@ -29,8 +30,13 @@ class PGeometricDetBuilder : public edm::one::EDAnalyzer { private: void putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev); + bool fromDD4hep; }; +PGeometricDetBuilder::PGeometricDetBuilder(const edm::ParameterSet& iConfig) { + fromDD4hep = iConfig.getUntrackedParameter("fromDD4hep", false); +} + void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { PGeometricDet* pgd = new PGeometricDet; edm::Service mydbservice; @@ -38,9 +44,14 @@ void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) edm::LogError("PGeometricDetBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle pDD; + if (!fromDD4hep) { + edm::ESTransientHandle pDD; + es.get().get(pDD); + } else { + edm::ESTransientHandle pDD; + es.get().get(pDD); + } edm::ESHandle rDD; - es.get().get(pDD); es.get().get(rDD); const GeometricDet* tracker = &(*rDD); diff --git a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc index 3c2596ca4c042..d7b7975db8e4e 100644 --- a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc @@ -11,13 +11,14 @@ #include "Geometry/Records/interface/PGeometricDetExtraRcd.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDetExtra.h" #include "DetectorDescription/DDCMS/interface/DDCompactView.h" +#include "DetectorDescription/Core/interface/DDCompactView.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include class PGeometricDetExtraBuilder : public edm::one::EDAnalyzer { public: - PGeometricDetExtraBuilder(const edm::ParameterSet&) {} + PGeometricDetExtraBuilder(const edm::ParameterSet&); void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} @@ -25,8 +26,14 @@ class PGeometricDetExtraBuilder : public edm::one::EDAnalyzer("fromDD4hep", false); +} + + void PGeometricDetExtraBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { PGeometricDetExtra* pgde = new PGeometricDetExtra; edm::Service mydbservice; @@ -34,9 +41,15 @@ void PGeometricDetExtraBuilder::beginRun(const edm::Run&, edm::EventSetup const& edm::LogError("PGeometricDetExtraBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle cpvH; + + if (!fromDD4hep) { + edm::ESTransientHandle cpvH; + es.get().get(cpvH); + } else { + edm::ESTransientHandle cpvH; + es.get().get(cpvH); + } edm::ESHandle > gdeH; - es.get().get(cpvH); es.get().get(gdeH); const std::vector& gdes = (*gdeH); diff --git a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc index 3069b9d6bc760..1304e21dbee5c 100644 --- a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc @@ -6,18 +6,27 @@ #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "CondFormats/GeometryObjects/interface/PTrackerParameters.h" #include "DetectorDescription/DDCMS/interface/DDCompactView.h" +#include "DetectorDescription/Core/interface/DDCompactView.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerParametersFromDD.h" class PTrackerParametersDBBuilder : public edm::one::EDAnalyzer { public: - PTrackerParametersDBBuilder(const edm::ParameterSet&) {} + PTrackerParametersDBBuilder(const edm::ParameterSet&); void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {} + +private: + bool fromDD4hep; }; +PTrackerParametersDBBuilder::PTrackerParametersDBBuilder(const edm::ParameterSet& iConfig) { + fromDD4hep = iConfig.getUntrackedParameter("fromDD4hep", false); +} + + void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { PTrackerParameters* ptp = new PTrackerParameters; edm::Service mydbservice; @@ -25,11 +34,18 @@ void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup cons edm::LogError("PTrackerParametersDBBuilder") << "PoolDBOutputService unavailable"; return; } - edm::ESTransientHandle cpv; - es.get().get(cpv); TrackerParametersFromDD builder; - builder.build(&(*cpv), *ptp); + + if (!fromDD4hep) { + edm::ESTransientHandle cpv; + es.get().get(cpv); + builder.build(&(*cpv), *ptp); + } else { + edm::ESTransientHandle cpv; + es.get().get(cpv); + builder.build(&(*cpv), *ptp); + } if (mydbservice->isNewTagRequest("PTrackerParametersRcd")) { mydbservice->createNewIOV( diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc index d9f6e2e13ad1b..52c3581fde172 100644 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc +++ b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc @@ -10,7 +10,7 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" -//#include +#include #include #include @@ -26,6 +26,7 @@ GeometricDetLoader::GeometricDetLoader(const edm::ParameterSet& iConfig) { std::cout << "GeometricDetLoader::GeometricDetLoader" << std::endl; + fromDD4hep = iConfig.getUntrackedParameter("fromDD4hep", false); } GeometricDetLoader::~GeometricDetLoader() { std::cout << "GeometricDetLoader::~GeometricDetLoader" << std::endl; } @@ -38,9 +39,15 @@ void GeometricDetLoader::beginRun(edm::Run const& /* iEvent */, edm::EventSetup std::cout << "PoolDBOutputService unavailable" << std::endl; return; } - edm::ESHandle pDD; + + if (!fromDD4hep) { + edm::ESHandle pDD; + es.get().get(pDD); + } else { + edm::ESHandle pDD; + es.get().get(pDD); + } edm::ESHandle rDD; - es.get().get(pDD); es.get().get(rDD); const GeometricDet* tracker = &(*rDD); diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h index dae6a0905d39f..626e5902dc925 100644 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h +++ b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h @@ -24,6 +24,7 @@ class GeometricDetLoader : public edm::one::EDAnalyzer { private: void putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev); + bool fromDD4hep; }; #endif diff --git a/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h b/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h index 6d5d0006ad98c..c1beacb8af530 100644 --- a/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h +++ b/Geometry/TrackerNumberingBuilder/interface/TrackerShapeToBounds.h @@ -18,7 +18,7 @@ class TrackerShapeToBounds { private: Bounds* buildBox(const std::vector&) const; Bounds* buildTrap(const std::vector&) const; - Bounds* buildOpen(const std::vector&) const; + Bounds* buildOpen() const; }; #endif diff --git a/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc b/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc index 7ae9174585eee..94dfd4fd38c53 100644 --- a/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc +++ b/Geometry/TrackerNumberingBuilder/src/TrackerShapeToBounds.cc @@ -38,13 +38,9 @@ Bounds* TrackerShapeToBounds::buildBounds(const cms::DDSolidShape& _shape, const return buildTrap(_par); break; case cms::DDSolidShape::ddtubs: - return buildOpen(_par); - break; case cms::DDSolidShape::ddpolycone: - return buildOpen(_par); - break; case cms::DDSolidShape::ddsubtraction: - return buildOpen(_par); + return buildOpen(); break; default: std::cout << "Wrong DDshape to build...." << cms::dd::name(cms::DDSolidShapeMap, _shape) << std::endl; @@ -106,7 +102,7 @@ Bounds* TrackerShapeToBounds::buildTrap(const std::vector& paras) const return bounds; } -Bounds* TrackerShapeToBounds::buildOpen(const std::vector& paras) const { +Bounds* TrackerShapeToBounds::buildOpen() const { OpenBounds* bounds = new OpenBounds(); return bounds; } From 98f81f10c49bc7b035caf823b00a089bc8d84bab Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 26 May 2020 17:08:54 +0200 Subject: [PATCH 07/24] Apply CodeFormat --- Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc | 2 +- CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc | 1 - CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc index 8958011d46f45..6cf1a26817ea4 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc @@ -364,7 +364,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { } //accessing the initial geometry - if(!_fromDD4hep){ + if (!_fromDD4hep) { edm::ESTransientHandle cpv; iSetup.get().get(cpv); } else { diff --git a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc index d7b7975db8e4e..93684af39827f 100644 --- a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc @@ -33,7 +33,6 @@ PGeometricDetExtraBuilder::PGeometricDetExtraBuilder(const edm::ParameterSet& iC fromDD4hep = iConfig.getUntrackedParameter("fromDD4hep", false); } - void PGeometricDetExtraBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { PGeometricDetExtra* pgde = new PGeometricDetExtra; edm::Service mydbservice; diff --git a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc index 1304e21dbee5c..8f705cc9e3883 100644 --- a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc @@ -12,7 +12,7 @@ class PTrackerParametersDBBuilder : public edm::one::EDAnalyzer { public: - PTrackerParametersDBBuilder(const edm::ParameterSet&); + PTrackerParametersDBBuilder(const edm::ParameterSet&); void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} @@ -26,7 +26,6 @@ PTrackerParametersDBBuilder::PTrackerParametersDBBuilder(const edm::ParameterSet fromDD4hep = iConfig.getUntrackedParameter("fromDD4hep", false); } - void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { PTrackerParameters* ptp = new PTrackerParameters; edm::Service mydbservice; From 31f7356e3a373b609b034330fd3c912b5eb94b0b Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 28 May 2020 11:32:10 +0200 Subject: [PATCH 08/24] Add reverse lookup for LegacySolidShape mape and define unsupported cms::DDSolidShapes --- .../DDCMS/interface/DDSolidShapes.h | 19 +++++++++++++++++-- .../src/GeometricTimingDet.cc | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/DetectorDescription/DDCMS/interface/DDSolidShapes.h b/DetectorDescription/DDCMS/interface/DDSolidShapes.h index 23de920d7842a..2651f768d412c 100644 --- a/DetectorDescription/DDCMS/interface/DDSolidShapes.h +++ b/DetectorDescription/DDCMS/interface/DDSolidShapes.h @@ -57,6 +57,17 @@ namespace cms { } return std::begin(a)->value; } + + template + typename Mapping::value_type::name_type value_reverse(Mapping a, V value) { + auto pos = std::find_if( + std::begin(a), std::end(a), [&value](const typename Mapping::value_type& t) { return (t.value == value); }); + if (pos != std::end(a)) { + return pos->name; + } + return std::begin(a)->name; + } + }; // namespace dd enum class DDSolidShape { @@ -67,6 +78,8 @@ namespace cms { ddcons = 4, ddpolycone = 5, ddpolyhedra = 6, + ddunsupported1 = 7, + ddunsupported2 = 8, ddtorus = 9, ddunion = 10, ddsubtraction = 11, @@ -81,7 +94,7 @@ namespace cms { ddtrd1 = 20, }; - const std::array, 19> DDSolidShapeMap{ + const std::array, 21> DDSolidShapeMap{ {{DDSolidShape::dd_not_init, "Solid not initialized"}, {DDSolidShape::ddbox, "Box"}, {DDSolidShape::ddtubs, "Tube"}, @@ -100,7 +113,9 @@ namespace cms { {DDSolidShape::ddellipticaltube, "EllipticalTube"}, {DDSolidShape::ddcuttubs, "CutTube"}, {DDSolidShape::ddextrudedpolygon, "ExtrudedPolygon"}, - {DDSolidShape::ddtrd1, "Trd1"}}}; + {DDSolidShape::ddtrd1, "Trd1"}, + {DDSolidShape::ddunsupported1, "Unsupported1"}, + {DDSolidShape::ddunsupported2, "Unsupported2"}}}; const std::array, 20> LegacySolidShapeMap{ {{LegacySolidShape::dd_not_init, cms::DDSolidShape::dd_not_init}, diff --git a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc index a9d3d356a3d08..fafb8d6c664cb 100644 --- a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc +++ b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc @@ -257,5 +257,6 @@ GeometricTimingDet::Rotation GeometricTimingDet::rotationBounds() const { std::unique_ptr GeometricTimingDet::bounds() const { const std::vector& par = params_; TrackerShapeToBounds shapeToBounds; - return std::unique_ptr(shapeToBounds.buildBounds(cms::DDSolidShape(static_cast(shape_)), par)); + return std::unique_ptr(shapeToBounds.buildBounds(cms::dd::value_reverse(cms::LegacySolidShapeMap,shape_), par)); + //return std::unique_ptr(shapeToBounds.buildBounds(cms::DDSolidShape(static_cast(shape_)), par)); } From 2b604b4e947031dd235f183f9afaef299d5f6481 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 28 May 2020 11:52:02 +0200 Subject: [PATCH 09/24] Apply code format --- Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc index fafb8d6c664cb..936b0d210aed2 100644 --- a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc +++ b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc @@ -257,6 +257,7 @@ GeometricTimingDet::Rotation GeometricTimingDet::rotationBounds() const { std::unique_ptr GeometricTimingDet::bounds() const { const std::vector& par = params_; TrackerShapeToBounds shapeToBounds; - return std::unique_ptr(shapeToBounds.buildBounds(cms::dd::value_reverse(cms::LegacySolidShapeMap,shape_), par)); + return std::unique_ptr( + shapeToBounds.buildBounds(cms::dd::value_reverse(cms::LegacySolidShapeMap, shape_), par)); //return std::unique_ptr(shapeToBounds.buildBounds(cms::DDSolidShape(static_cast(shape_)), par)); } From 71f85b466a1fe4d680d955a45bb3dfd9ca43f986 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 28 May 2020 11:57:11 +0200 Subject: [PATCH 10/24] Remove commented line --- Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc index 936b0d210aed2..6732150f8db1b 100644 --- a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc +++ b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc @@ -259,5 +259,4 @@ std::unique_ptr GeometricTimingDet::bounds() const { TrackerShapeToBounds shapeToBounds; return std::unique_ptr( shapeToBounds.buildBounds(cms::dd::value_reverse(cms::LegacySolidShapeMap, shape_), par)); - //return std::unique_ptr(shapeToBounds.buildBounds(cms::DDSolidShape(static_cast(shape_)), par)); } From 2213b04a8151b9de896b767fa8bfe23f81169988 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 2 Jun 2020 21:55:35 +0200 Subject: [PATCH 11/24] Make fromDD4hep a tracked parameter in GeometricDet/TrackerParameters builders --- CondTools/Geometry/plugins/PGeometricDetBuilder.cc | 6 +++--- CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc | 6 +++--- CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc | 6 +++--- CondTools/Geometry/test/geometrywriter.py | 6 +++--- CondTools/Geometry/test/trackergeometrywriter.py | 6 +++--- CondTools/Geometry/test/trackergeometrywriterRun2.py | 6 +++--- .../test/writehelpers/geometryExtended2016_writer.py | 6 +++--- .../test/writehelpers/geometryExtended2017Plan1_writer.py | 6 +++--- .../test/writehelpers/geometryExtended2017_writer.py | 6 +++--- .../test/writehelpers/geometryExtended2018_writer.py | 6 +++--- .../test/writehelpers/geometryExtended2019_writer.py | 6 +++--- .../test/writehelpers/geometryExtended2021_writer.py | 6 +++--- .../test/writehelpers/geometryExtended2026_writer.py | 6 +++--- .../Geometry/test/writehelpers/geometryrun2devwriter.py | 6 +++--- CondTools/Geometry/test/writehelpers/geometryrun2writer.py | 6 +++--- CondTools/Geometry/test/writehelpers/geometrywriter.py | 6 +++--- 16 files changed, 48 insertions(+), 48 deletions(-) diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index 43923f475d243..20c23cc0084f6 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -30,11 +30,11 @@ class PGeometricDetBuilder : public edm::one::EDAnalyzer { private: void putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev); - bool fromDD4hep; + bool fromDD4hep_; }; PGeometricDetBuilder::PGeometricDetBuilder(const edm::ParameterSet& iConfig) { - fromDD4hep = iConfig.getUntrackedParameter("fromDD4hep", false); + fromDD4hep_ = iConfig.getParameter("fromDD4hep"); } void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -44,7 +44,7 @@ void PGeometricDetBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) edm::LogError("PGeometricDetBuilder") << "PoolDBOutputService unavailable"; return; } - if (!fromDD4hep) { + if (!fromDD4hep_) { edm::ESTransientHandle pDD; es.get().get(pDD); } else { diff --git a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc index 93684af39827f..0d887b7c9f69a 100644 --- a/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetExtraBuilder.cc @@ -26,11 +26,11 @@ class PGeometricDetExtraBuilder : public edm::one::EDAnalyzer("fromDD4hep", false); + fromDD4hep_ = iConfig.getParameter("fromDD4hep"); } void PGeometricDetExtraBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -41,7 +41,7 @@ void PGeometricDetExtraBuilder::beginRun(const edm::Run&, edm::EventSetup const& return; } - if (!fromDD4hep) { + if (!fromDD4hep_) { edm::ESTransientHandle cpvH; es.get().get(cpvH); } else { diff --git a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc index 8f705cc9e3883..834408e29356c 100644 --- a/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc +++ b/CondTools/Geometry/plugins/PTrackerParametersDBBuilder.cc @@ -19,11 +19,11 @@ class PTrackerParametersDBBuilder : public edm::one::EDAnalyzer("fromDD4hep", false); + fromDD4hep_ = iConfig.getParameter("fromDD4hep"); } void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup const& es) { @@ -36,7 +36,7 @@ void PTrackerParametersDBBuilder::beginRun(const edm::Run&, edm::EventSetup cons TrackerParametersFromDD builder; - if (!fromDD4hep) { + if (!fromDD4hep_) { edm::ESTransientHandle cpv; es.get().get(cpv); builder.build(&(*cpv), *ptp); diff --git a/CondTools/Geometry/test/geometrywriter.py b/CondTools/Geometry/test/geometrywriter.py index da1ebd24e4242..222a5b143a012 100644 --- a/CondTools/Geometry/test/geometrywriter.py +++ b/CondTools/Geometry/test/geometrywriter.py @@ -21,9 +21,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool( False )) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder", fromDD4hep=cms.bool( False )) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder", fromDD4hep=cms.bool( False )) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/trackergeometrywriter.py b/CondTools/Geometry/test/trackergeometrywriter.py index 5ba6b0bbde520..fd6c6c4804efb 100644 --- a/CondTools/Geometry/test/trackergeometrywriter.py +++ b/CondTools/Geometry/test/trackergeometrywriter.py @@ -15,9 +15,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder", fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder", fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder", fromDD4hep=cms.bool(False)) process.CondDB.timetype = cms.untracked.string('runnumber') process.CondDB.connect = cms.string('sqlite_file:myfile.db') diff --git a/CondTools/Geometry/test/trackergeometrywriterRun2.py b/CondTools/Geometry/test/trackergeometrywriterRun2.py index 941a13fdcc8d7..d5b9ded7417ed 100644 --- a/CondTools/Geometry/test/trackergeometrywriterRun2.py +++ b/CondTools/Geometry/test/trackergeometrywriterRun2.py @@ -15,9 +15,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool( False )) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool( False )) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool( False )) process.CondDB.timetype = cms.untracked.string('runnumber') process.CondDB.connect = cms.string('sqlite_file:myfilerun2.db') diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2016_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2016_writer.py index fa2872c0888d7..39665b98f0c0e 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2016_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2016_writer.py @@ -31,9 +31,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2017Plan1_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2017Plan1_writer.py index 23b556b574790..2f2b71cce6e52 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2017Plan1_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2017Plan1_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2017_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2017_writer.py index ad9c539c93331..8bce521afd069 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2017_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2017_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2018_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2018_writer.py index 70bce6a2eb557..f33159cafda70 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2018_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2018_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2019_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2019_writer.py index 7ad7fef1e20e1..d0ba0193fc205 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2019_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2019_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2021_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2021_writer.py index 23d548f9208ea..5ff5cc970a3d3 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2021_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2021_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder", fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryExtended2026_writer.py b/CondTools/Geometry/test/writehelpers/geometryExtended2026_writer.py index 34783acf0aeec..f29c611058db5 100644 --- a/CondTools/Geometry/test/writehelpers/geometryExtended2026_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryExtended2026_writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ), ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder", EcalE = cms.untracked.bool(False), diff --git a/CondTools/Geometry/test/writehelpers/geometryrun2devwriter.py b/CondTools/Geometry/test/writehelpers/geometryrun2devwriter.py index 7ae130c44a7c3..dacce5040dd57 100644 --- a/CondTools/Geometry/test/writehelpers/geometryrun2devwriter.py +++ b/CondTools/Geometry/test/writehelpers/geometryrun2devwriter.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometryrun2writer.py b/CondTools/Geometry/test/writehelpers/geometryrun2writer.py index a8080a7f5df7d..f3c3058fbaea0 100644 --- a/CondTools/Geometry/test/writehelpers/geometryrun2writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryrun2writer.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") diff --git a/CondTools/Geometry/test/writehelpers/geometrywriter.py b/CondTools/Geometry/test/writehelpers/geometrywriter.py index de90460a677eb..c6b230ad8a76f 100644 --- a/CondTools/Geometry/test/writehelpers/geometrywriter.py +++ b/CondTools/Geometry/test/writehelpers/geometrywriter.py @@ -32,9 +32,9 @@ fromDDD = cms.bool( True ) ) -process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder") -process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder") -process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder") +process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(False)) +process.TrackerGeometryExtraWriter = cms.EDAnalyzer("PGeometricDetExtraBuilder",fromDD4hep=cms.bool(False)) +process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(False)) process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder") From c46fd7582b65b0a72f59ed70e870e63384bdaaf7 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 2 Jun 2020 21:56:19 +0200 Subject: [PATCH 12/24] Cleanup in TrackerGeometryCompare --- .../plugins/TrackerGeometryCompare.cc | 613 +++++++++--------- .../plugins/TrackerGeometryCompare.h | 96 +-- 2 files changed, 341 insertions(+), 368 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc index 6cf1a26817ea4..bb9862e211a38 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc @@ -37,10 +37,6 @@ #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "DetectorDescription/DDCMS/interface/DDCompactView.h" -//#include "Alignment/OfflineValidation/interface/ComparisonUtilities.h" -//#include "Alignment/CommonAlignment/interface/AlignTools.h" - -//#include "Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h" #include "TrackerGeometryCompare.h" #include "TFile.h" #include "CLHEP/Vector/ThreeVector.h" @@ -49,7 +45,6 @@ #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" -//#include "Geometry/Records/interface/PGeometricDetRcd.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" @@ -67,58 +62,58 @@ TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) theSurveyIndex(0), theSurveyValues(nullptr), theSurveyErrors(nullptr), - _levelStrings(cfg.getUntrackedParameter >("levels")), - _fromDD4hep(cfg.getUntrackedParameter("fromDD4hep")), - _writeToDB(cfg.getUntrackedParameter("writeToDB")), - _commonTrackerLevel(align::invalid), - _moduleListFile(nullptr), - _moduleList(0), - _inputRootFile1(nullptr), - _inputRootFile2(nullptr), - _inputTree01(nullptr), - _inputTree02(nullptr), - _inputTree11(nullptr), - _inputTree12(nullptr), - m_nBins(10000), - m_rangeLow(-.1), - m_rangeHigh(.1), + levelStrings_(cfg.getUntrackedParameter >("levels")), + fromDD4hep_(cfg.getUntrackedParameter("fromDD4hep")), + writeToDB_(cfg.getUntrackedParameter("writeToDB")), + commonTrackerLevel_(align::invalid), + moduleListFile_(nullptr), + moduleList_(0), + inputRootFile1_(nullptr), + inputRootFile2_(nullptr), + inputTree01_(nullptr), + inputTree02_(nullptr), + inputTree11_(nullptr), + inputTree12_(nullptr), + m_nBins_(10000), + m_rangeLow_(-.1), + m_rangeHigh_(.1), firstEvent_(true), - m_vtkmap(13) { - _moduleListName = cfg.getUntrackedParameter("moduleList"); + m_vtkmap_(13) { + moduleListName_ = cfg.getUntrackedParameter("moduleList"); //input is ROOT - _inputFilename1 = cfg.getUntrackedParameter("inputROOTFile1"); - _inputFilename2 = cfg.getUntrackedParameter("inputROOTFile2"); - _inputTreenameAlign = cfg.getUntrackedParameter("treeNameAlign"); - _inputTreenameDeform = cfg.getUntrackedParameter("treeNameDeform"); + inputFilename1_ = cfg.getUntrackedParameter("inputROOTFile1"); + inputFilename2_ = cfg.getUntrackedParameter("inputROOTFile2"); + inputTreenameAlign_ = cfg.getUntrackedParameter("treeNameAlign"); + inputTreenameDeform_ = cfg.getUntrackedParameter("treeNameDeform"); //output file - _filename = cfg.getUntrackedParameter("outputFile"); + filename_ = cfg.getUntrackedParameter("outputFile"); - _weightBy = cfg.getUntrackedParameter("weightBy"); - _setCommonTrackerSystem = cfg.getUntrackedParameter("setCommonTrackerSystem"); - _detIdFlag = cfg.getUntrackedParameter("detIdFlag"); - _detIdFlagFile = cfg.getUntrackedParameter("detIdFlagFile"); - _weightById = cfg.getUntrackedParameter("weightById"); - _weightByIdFile = cfg.getUntrackedParameter("weightByIdFile"); + weightBy_ = cfg.getUntrackedParameter("weightBy"); + setCommonTrackerSystem_ = cfg.getUntrackedParameter("setCommonTrackerSystem"); + detIdFlag_ = cfg.getUntrackedParameter("detIdFlag"); + detIdFlagFile_ = cfg.getUntrackedParameter("detIdFlagFile"); + weightById_ = cfg.getUntrackedParameter("weightById"); + weightByIdFile_ = cfg.getUntrackedParameter("weightByIdFile"); // if want to use, make id cut list - if (_detIdFlag) { + if (detIdFlag_) { std::ifstream fin; - fin.open(_detIdFlagFile.c_str()); + fin.open(detIdFlagFile_.c_str()); while (!fin.eof() && fin.good()) { uint32_t id; fin >> id; - _detIdFlagVector.push_back(id); + detIdFlagVector_.push_back(id); } fin.close(); } // turn weightByIdFile into weightByIdVector - if (_weightById) { + if (weightById_) { std::ifstream inFile; - inFile.open(_weightByIdFile.c_str()); + inFile.open(weightByIdFile_.c_str()); int ctr = 0; while (!inFile.eof()) { ctr++; @@ -126,55 +121,55 @@ TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) inFile >> listId; inFile.ignore(256, '\n'); - _weightByIdVector.push_back(listId); + weightByIdVector_.push_back(listId); } inFile.close(); } //root configuration - _theFile = new TFile(_filename.c_str(), "RECREATE"); - _alignTree = new TTree("alignTree", + theFile_ = new TFile(filename_.c_str(), "RECREATE"); + alignTree_ = new TTree("alignTree", "alignTree"); //,"id:level:mid:mlevel:sublevel:x:y:z:r:phi:a:b:c:dx:dy:dz:dr:dphi:da:db:dc"); - _alignTree->Branch("id", &_id, "id/I"); - _alignTree->Branch("badModuleQuality", &_badModuleQuality, "badModuleQuality/I"); - _alignTree->Branch("inModuleList", &_inModuleList, "inModuleList/I"); - _alignTree->Branch("level", &_level, "level/I"); - _alignTree->Branch("mid", &_mid, "mid/I"); - _alignTree->Branch("mlevel", &_mlevel, "mlevel/I"); - _alignTree->Branch("sublevel", &_sublevel, "sublevel/I"); - _alignTree->Branch("x", &_xVal, "x/F"); - _alignTree->Branch("y", &_yVal, "y/F"); - _alignTree->Branch("z", &_zVal, "z/F"); - _alignTree->Branch("r", &_rVal, "r/F"); - _alignTree->Branch("phi", &_phiVal, "phi/F"); - _alignTree->Branch("eta", &_etaVal, "eta/F"); - _alignTree->Branch("alpha", &_alphaVal, "alpha/F"); - _alignTree->Branch("beta", &_betaVal, "beta/F"); - _alignTree->Branch("gamma", &_gammaVal, "gamma/F"); - _alignTree->Branch("dx", &_dxVal, "dx/F"); - _alignTree->Branch("dy", &_dyVal, "dy/F"); - _alignTree->Branch("dz", &_dzVal, "dz/F"); - _alignTree->Branch("dr", &_drVal, "dr/F"); - _alignTree->Branch("dphi", &_dphiVal, "dphi/F"); - _alignTree->Branch("dalpha", &_dalphaVal, "dalpha/F"); - _alignTree->Branch("dbeta", &_dbetaVal, "dbeta/F"); - _alignTree->Branch("dgamma", &_dgammaVal, "dgamma/F"); - _alignTree->Branch("du", &_duVal, "du/F"); - _alignTree->Branch("dv", &_dvVal, "dv/F"); - _alignTree->Branch("dw", &_dwVal, "dw/F"); - _alignTree->Branch("da", &_daVal, "da/F"); - _alignTree->Branch("db", &_dbVal, "db/F"); - _alignTree->Branch("dg", &_dgVal, "dg/F"); - _alignTree->Branch("useDetId", &_useDetId, "useDetId/I"); - _alignTree->Branch("detDim", &_detDim, "detDim/I"); - _alignTree->Branch("surW", &_surWidth, "surW/F"); - _alignTree->Branch("surL", &_surLength, "surL/F"); - _alignTree->Branch("surRot", &_surRot, "surRot[9]/D"); - _alignTree->Branch("identifiers", &_identifiers, "identifiers[6]/I"); - _alignTree->Branch("type", &_type, "type/I"); - _alignTree->Branch("surfDeform", &_surfDeform, "surfDeform[13]/D"); - - for (std::vector::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) { + alignTree_->Branch("id", &id_, "id/I"); + alignTree_->Branch("badModuleQuality", &badModuleQuality_, "badModuleQuality/I"); + alignTree_->Branch("inModuleList", &inModuleList_, "inModuleList/I"); + alignTree_->Branch("level", &level_, "level/I"); + alignTree_->Branch("mid", &mid_, "mid/I"); + alignTree_->Branch("mlevel", &mlevel_, "mlevel/I"); + alignTree_->Branch("sublevel", &sublevel_, "sublevel/I"); + alignTree_->Branch("x", &xVal_, "x/F"); + alignTree_->Branch("y", &yVal_, "y/F"); + alignTree_->Branch("z", &zVal_, "z/F"); + alignTree_->Branch("r", &rVal_, "r/F"); + alignTree_->Branch("phi", &phiVal_, "phi/F"); + alignTree_->Branch("eta", &etaVal_, "eta/F"); + alignTree_->Branch("alpha", &alphaVal_, "alpha/F"); + alignTree_->Branch("beta", &betaVal_, "beta/F"); + alignTree_->Branch("gamma", &gammaVal_, "gamma/F"); + alignTree_->Branch("dx", &dxVal_, "dx/F"); + alignTree_->Branch("dy", &dyVal_, "dy/F"); + alignTree_->Branch("dz", &dzVal_, "dz/F"); + alignTree_->Branch("dr", &drVal_, "dr/F"); + alignTree_->Branch("dphi", &dphiVal_, "dphi/F"); + alignTree_->Branch("dalpha", &dalphaVal_, "dalpha/F"); + alignTree_->Branch("dbeta", &dbetaVal_, "dbeta/F"); + alignTree_->Branch("dgamma", &dgammaVal_, "dgamma/F"); + alignTree_->Branch("du", &duVal_, "du/F"); + alignTree_->Branch("dv", &dvVal_, "dv/F"); + alignTree_->Branch("dw", &dwVal_, "dw/F"); + alignTree_->Branch("da", &daVal_, "da/F"); + alignTree_->Branch("db", &dbVal_, "db/F"); + alignTree_->Branch("dg", &dgVal_, "dg/F"); + alignTree_->Branch("useDetId", &useDetId_, "useDetId/I"); + alignTree_->Branch("detDim", &detDim_, "detDim/I"); + alignTree_->Branch("surW", &surWidth_, "surW/F"); + alignTree_->Branch("surL", &surLength_, "surL/F"); + alignTree_->Branch("surRot", &surRot_, "surRot[9]/D"); + alignTree_->Branch("identifiers", &identifiers_, "identifiers[6]/I"); + alignTree_->Branch("type", &type_, "type/I"); + alignTree_->Branch("surfDeform", &surfDeform_, "surfDeform[13]/D"); + + for (std::vector::iterator it = m_vtkmap_.begin(); it != m_vtkmap_.end(); ++it) { it->setPalette(1); it->addPixel(true); } @@ -186,18 +181,18 @@ TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) for (int ii = 0; ii < 13; ++ii) { std::stringstream histname0; histname0 << "SurfDeform_Par_" << ii; - m_h1[histname0.str()] = - subDir_All.make((histname0.str()).c_str(), (histname0.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh); + m_h1_[histname0.str()] = + subDir_All.make((histname0.str()).c_str(), (histname0.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << ii; - m_h1[histname1.str()] = - subDir_PXB.make((histname1.str()).c_str(), (histname1.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh); + m_h1_[histname1.str()] = + subDir_PXB.make((histname1.str()).c_str(), (histname1.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << ii; - m_h1[histname2.str()] = - subDir_PXF.make((histname2.str()).c_str(), (histname2.str()).c_str(), m_nBins, m_rangeLow, m_rangeHigh); + m_h1_[histname2.str()] = + subDir_PXF.make((histname2.str()).c_str(), (histname2.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); } } @@ -205,7 +200,7 @@ void TrackerGeometryCompare::beginJob() { firstEvent_ = true; } void TrackerGeometryCompare::endJob() { int iname(0); - for (std::vector::iterator it = m_vtkmap.begin(); it != m_vtkmap.end(); ++it) { + for (std::vector::iterator it = m_vtkmap_.begin(); it != m_vtkmap_.end(); ++it) { std::stringstream mapname; mapname << "TkMap_SurfDeform" << iname << ".png"; it->save(true, 0, 0, mapname.str()); @@ -216,9 +211,9 @@ void TrackerGeometryCompare::endJob() { ++iname; } - _theFile->cd(); - _alignTree->Write(); - _theFile->Close(); + theFile_->cd(); + alignTree_->Write(); + theFile_->Close(); } void TrackerGeometryCompare::analyze(const edm::Event&, const edm::EventSetup& iSetup) { @@ -232,8 +227,8 @@ void TrackerGeometryCompare::analyze(const edm::Event&, const edm::EventSetup& i createROOTGeometry(iSetup); //setting the levels being used in the geometry comparator - edm::LogInfo("TrackerGeometryCompare") << "levels: " << _levelStrings.size(); - for (const auto& level : _levelStrings) { + edm::LogInfo("TrackerGeometryCompare") << "levels: " << levelStrings_.size(); + for (const auto& level : levelStrings_) { m_theLevels.push_back(currentTracker->objectIdProvider().stringToId(level)); edm::LogInfo("TrackerGeometryCompare") << "level: " << level; edm::LogInfo("TrackerGeometryCompare") @@ -242,18 +237,18 @@ void TrackerGeometryCompare::analyze(const edm::Event&, const edm::EventSetup& i //set common tracker system first // if setting the tracker common system - if (_setCommonTrackerSystem != "NONE") { + if (setCommonTrackerSystem_ != "NONE") { setCommonTrackerSystem(); } //compare the goemetries compareGeometries(referenceTracker, currentTracker, tTopo, iSetup); - compareSurfaceDeformations(_inputTree11, _inputTree12); + compareSurfaceDeformations(inputTree11_, inputTree12_); //write out ntuple //might be better to do within output module - if (_writeToDB) { + if (writeToDB_) { Alignments* myAlignments = currentTracker->alignments(); AlignmentErrorsExtended* myAlignmentErrorsExtended = currentTracker->alignmentErrors(); @@ -283,12 +278,12 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { const TrackerTopology* const tTopo = tTopoHandle.product(); // Fill module IDs from file into a list - _moduleListFile.open(_moduleListName); - if (_moduleListFile.is_open()) { + moduleListFile_.open(moduleListName_); + if (moduleListFile_.is_open()) { std::string line; - while (!_moduleListFile.eof()) { - std::getline(_moduleListFile, line); - _moduleList.push_back(std::atoi(line.c_str())); + while (!moduleListFile_.eof()) { + std::getline(moduleListFile_, line); + moduleList_.push_back(std::atoi(line.c_str())); } } else { edm::LogInfo("TrackerGeometryCompare") << "Error: Module list not found! Please verify that given list exists!"; @@ -297,21 +292,21 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { //declare alignments Alignments* alignments1 = new Alignments(); AlignmentErrorsExtended* alignmentErrors1 = new AlignmentErrorsExtended(); - if (_inputFilename1 != "IDEAL") { - _inputRootFile1 = new TFile(_inputFilename1.c_str()); - TTree* _inputTree01 = (TTree*)_inputRootFile1->Get(_inputTreenameAlign.c_str()); - _inputTree01->SetBranchAddress("rawid", &inputRawId1); - _inputTree01->SetBranchAddress("x", &inputX1); - _inputTree01->SetBranchAddress("y", &inputY1); - _inputTree01->SetBranchAddress("z", &inputZ1); - _inputTree01->SetBranchAddress("alpha", &inputAlpha1); - _inputTree01->SetBranchAddress("beta", &inputBeta1); - _inputTree01->SetBranchAddress("gamma", &inputGamma1); - - int nEntries1 = _inputTree01->GetEntries(); + if (inputFilename1_ != "IDEAL") { + inputRootFile1_ = new TFile(inputFilename1_.c_str()); + TTree* inputTree01_ = (TTree*)inputRootFile1_->Get(inputTreenameAlign_.c_str()); + inputTree01_->SetBranchAddress("rawid", &inputRawId1); + inputTree01_->SetBranchAddress("x", &inputX1); + inputTree01_->SetBranchAddress("y", &inputY1); + inputTree01_->SetBranchAddress("z", &inputZ1); + inputTree01_->SetBranchAddress("alpha", &inputAlpha1); + inputTree01_->SetBranchAddress("beta", &inputBeta1); + inputTree01_->SetBranchAddress("gamma", &inputGamma1); + + int nEntries1 = inputTree01_->GetEntries(); //fill alignments for (int i = 0; i < nEntries1; ++i) { - _inputTree01->GetEntry(i); + inputTree01_->GetEntry(i); CLHEP::Hep3Vector translation1(inputX1, inputY1, inputZ1); CLHEP::HepEulerAngles eulerangles1(inputAlpha1, inputBeta1, inputGamma1); uint32_t detid1 = inputRawId1; @@ -331,21 +326,21 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { //------------------ Alignments* alignments2 = new Alignments(); AlignmentErrorsExtended* alignmentErrors2 = new AlignmentErrorsExtended(); - if (_inputFilename2 != "IDEAL") { - _inputRootFile2 = new TFile(_inputFilename2.c_str()); - TTree* _inputTree02 = (TTree*)_inputRootFile2->Get(_inputTreenameAlign.c_str()); - _inputTree02->SetBranchAddress("rawid", &inputRawId2); - _inputTree02->SetBranchAddress("x", &inputX2); - _inputTree02->SetBranchAddress("y", &inputY2); - _inputTree02->SetBranchAddress("z", &inputZ2); - _inputTree02->SetBranchAddress("alpha", &inputAlpha2); - _inputTree02->SetBranchAddress("beta", &inputBeta2); - _inputTree02->SetBranchAddress("gamma", &inputGamma2); - - int nEntries2 = _inputTree02->GetEntries(); + if (inputFilename2_ != "IDEAL") { + inputRootFile2_ = new TFile(inputFilename2_.c_str()); + TTree* inputTree02_ = (TTree*)inputRootFile2_->Get(inputTreenameAlign_.c_str()); + inputTree02_->SetBranchAddress("rawid", &inputRawId2); + inputTree02_->SetBranchAddress("x", &inputX2); + inputTree02_->SetBranchAddress("y", &inputY2); + inputTree02_->SetBranchAddress("z", &inputZ2); + inputTree02_->SetBranchAddress("alpha", &inputAlpha2); + inputTree02_->SetBranchAddress("beta", &inputBeta2); + inputTree02_->SetBranchAddress("gamma", &inputGamma2); + + int nEntries2 = inputTree02_->GetEntries(); //fill alignments for (int i = 0; i < nEntries2; ++i) { - _inputTree02->GetEntry(i); + inputTree02_->GetEntry(i); CLHEP::Hep3Vector translation2(inputX2, inputY2, inputZ2); CLHEP::HepEulerAngles eulerangles2(inputAlpha2, inputBeta2, inputGamma2); uint32_t detid2 = inputRawId2; @@ -364,7 +359,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { } //accessing the initial geometry - if (!_fromDD4hep) { + if (!fromDD4hep_) { edm::ESTransientHandle cpv; iSetup.get().get(cpv); } else { @@ -379,7 +374,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { //reference tracker TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo); - if (_inputFilename1 != "IDEAL") { + if (inputFilename1_ != "IDEAL") { GeometryAligner aligner1; aligner1.applyAlignments( &(*theRefTracker), &(*alignments1), &(*alignmentErrors1), AlignTransform()); @@ -398,16 +393,16 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { const auto& comp1 = referenceTracker->deepComponents(); SurfaceDeformation* surfDef1; - if (_inputFilename1 != "IDEAL") { - TTree* _inputTree11 = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str()); - _inputTree11->SetBranchAddress("irawid", &inputRawid1); - _inputTree11->SetBranchAddress("dtype", &inputDtype1); - _inputTree11->SetBranchAddress("dpar", &p_inputDpar1); + if (inputFilename1_ != "IDEAL") { + TTree* inputTree11_ = (TTree*)inputRootFile1_->Get(inputTreenameDeform_.c_str()); + inputTree11_->SetBranchAddress("irawid", &inputRawid1); + inputTree11_->SetBranchAddress("dtype", &inputDtype1); + inputTree11_->SetBranchAddress("dpar", &p_inputDpar1); - unsigned int nEntries11 = _inputTree11->GetEntries(); + unsigned int nEntries11 = inputTree11_->GetEntries(); edm::LogInfo("TrackerGeometryCompare") << " nentries11 = " << nEntries11; for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) { - _inputTree11->GetEntry(iEntry); + inputTree11_->GetEntry(iEntry); surfDef1 = SurfaceDeformationFactory::create(inputDtype1, inputDpar1); @@ -419,7 +414,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { //currernt tracker TrackerGeometry* theCurTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo); - if (_inputFilename2 != "IDEAL") { + if (inputFilename2_ != "IDEAL") { GeometryAligner aligner2; aligner2.applyAlignments( &(*theCurTracker), &(*alignments2), &(*alignmentErrors2), AlignTransform()); @@ -429,16 +424,16 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { const auto& comp2 = currentTracker->deepComponents(); SurfaceDeformation* surfDef2; - if (_inputFilename2 != "IDEAL") { - TTree* _inputTree12 = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str()); - _inputTree12->SetBranchAddress("irawid", &inputRawid2); - _inputTree12->SetBranchAddress("dtype", &inputDtype2); - _inputTree12->SetBranchAddress("dpar", &p_inputDpar2); + if (inputFilename2_ != "IDEAL") { + TTree* inputTree12_ = (TTree*)inputRootFile2_->Get(inputTreenameDeform_.c_str()); + inputTree12_->SetBranchAddress("irawid", &inputRawid2); + inputTree12_->SetBranchAddress("dtype", &inputDtype2); + inputTree12_->SetBranchAddress("dpar", &p_inputDpar2); - unsigned int nEntries12 = _inputTree12->GetEntries(); + unsigned int nEntries12 = inputTree12_->GetEntries(); edm::LogInfo("TrackerGeometryCompare") << " nentries12 = " << nEntries12; for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) { - _inputTree12->GetEntry(iEntry); + inputTree12_->GetEntry(iEntry); surfDef2 = SurfaceDeformationFactory::create(inputDtype2, inputDpar2); @@ -455,7 +450,7 @@ void TrackerGeometryCompare::createROOTGeometry(const edm::EventSetup& iSetup) { } void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* curTree) { - if (_inputFilename1 != "IDEAL" && _inputFilename2 != "IDEAL") { + if (inputFilename1_ != "IDEAL" && inputFilename2_ != "IDEAL") { int inputRawid1; int inputRawid2; int inputSubdetid1, inputSubdetid2; @@ -465,13 +460,13 @@ void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* c std::vector* p_inputDpar1 = &inputDpar1; std::vector* p_inputDpar2 = &inputDpar2; - TTree* refTree = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str()); + TTree* refTree = (TTree*)inputRootFile1_->Get(inputTreenameDeform_.c_str()); refTree->SetBranchAddress("irawid", &inputRawid1); refTree->SetBranchAddress("subdetid", &inputSubdetid1); refTree->SetBranchAddress("dtype", &inputDtype1); refTree->SetBranchAddress("dpar", &p_inputDpar1); - TTree* curTree = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str()); + TTree* curTree = (TTree*)inputRootFile2_->Get(inputTreenameDeform_.c_str()); curTree->SetBranchAddress("irawid", &inputRawid2); curTree->SetBranchAddress("subdetid", &inputSubdetid2); curTree->SetBranchAddress("dtype", &inputDtype2); @@ -489,40 +484,40 @@ void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* c refTree->GetEntry(iEntry); curTree->GetEntry(iEntry); for (int ii = 0; ii < 13; ++ii) { - _surfDeform[ii] = -1.0; + surfDeform_[ii] = -1.0; } for (int npar = 0; npar < int(inputDpar2.size()); ++npar) { if (inputRawid1 == inputRawid2) { - _surfDeform[npar] = inputDpar2.at(npar) - inputDpar1.at(npar); + surfDeform_[npar] = inputDpar2.at(npar) - inputDpar1.at(npar); std::stringstream histname0; histname0 << "SurfDeform_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname0.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname0.str()]->Fill(surfDeform_[npar]); if (inputSubdetid1 == 1 && inputSubdetid2 == 1) { std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname1.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname1.str()]->Fill(surfDeform_[npar]); } if (inputSubdetid1 == 2 && inputSubdetid2 == 2) { std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname2.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname2.str()]->Fill(surfDeform_[npar]); } - (m_vtkmap.at(npar)).fill_current_val(inputRawid1, _surfDeform[npar]); + (m_vtkmap_.at(npar)).fill_current_val(inputRawid1, surfDeform_[npar]); } } } - } else if (_inputFilename1 == "IDEAL" && _inputFilename2 != "IDEAL") { + } else if (inputFilename1_ == "IDEAL" && inputFilename2_ != "IDEAL") { int inputRawid2; int inputSubdetid2; int inputDtype2; std::vector inputDpar2; std::vector* p_inputDpar2 = &inputDpar2; - TTree* curTree = (TTree*)_inputRootFile2->Get(_inputTreenameDeform.c_str()); + TTree* curTree = (TTree*)inputRootFile2_->Get(inputTreenameDeform_.c_str()); curTree->SetBranchAddress("irawid", &inputRawid2); curTree->SetBranchAddress("subdetid", &inputSubdetid2); curTree->SetBranchAddress("dtype", &inputDtype2); @@ -533,38 +528,38 @@ void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* c for (unsigned int iEntry = 0; iEntry < nEntries12; ++iEntry) { curTree->GetEntry(iEntry); for (int ii = 0; ii < 12; ++ii) { - _surfDeform[ii] = -1.0; + surfDeform_[ii] = -1.0; } for (int npar = 0; npar < int(inputDpar2.size()); ++npar) { - _surfDeform[npar] = inputDpar2.at(npar); + surfDeform_[npar] = inputDpar2.at(npar); std::stringstream histname0; histname0 << "SurfDeform_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname0.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname0.str()]->Fill(surfDeform_[npar]); if (inputSubdetid2 == 1) { std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname1.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname1.str()]->Fill(surfDeform_[npar]); } if (inputSubdetid2 == 2) { std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname2.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname2.str()]->Fill(surfDeform_[npar]); } - (m_vtkmap.at(npar)).fill_current_val(inputRawid2, _surfDeform[npar]); + (m_vtkmap_.at(npar)).fill_current_val(inputRawid2, surfDeform_[npar]); } } - } else if (_inputFilename1 != "IDEAL" && _inputFilename2 == "IDEAL") { + } else if (inputFilename1_ != "IDEAL" && inputFilename2_ == "IDEAL") { int inputRawid1; int inputSubdetid1; int inputDtype1; std::vector inputDpar1; std::vector* p_inputDpar1 = &inputDpar1; - TTree* refTree = (TTree*)_inputRootFile1->Get(_inputTreenameDeform.c_str()); + TTree* refTree = (TTree*)inputRootFile1_->Get(inputTreenameDeform_.c_str()); refTree->SetBranchAddress("irawid", &inputRawid1); refTree->SetBranchAddress("subdetid", &inputSubdetid1); refTree->SetBranchAddress("dtype", &inputDtype1); @@ -575,31 +570,31 @@ void TrackerGeometryCompare::compareSurfaceDeformations(TTree* refTree, TTree* c for (unsigned int iEntry = 0; iEntry < nEntries11; ++iEntry) { refTree->GetEntry(iEntry); for (int ii = 0; ii < 12; ++ii) { - _surfDeform[ii] = -1.0; + surfDeform_[ii] = -1.0; } for (int npar = 0; npar < int(inputDpar1.size()); ++npar) { - _surfDeform[npar] = -inputDpar1.at(npar); + surfDeform_[npar] = -inputDpar1.at(npar); std::stringstream histname0; histname0 << "SurfDeform_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname0.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname0.str()]->Fill(surfDeform_[npar]); if (inputSubdetid1 == 1) { std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname1.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname1.str()]->Fill(surfDeform_[npar]); } if (inputSubdetid1 == 2) { std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << npar; - if (TMath::Abs(_surfDeform[npar]) > (m_rangeHigh - m_rangeLow) / (10. * m_nBins)) - m_h1[histname2.str()]->Fill(_surfDeform[npar]); + if (TMath::Abs(surfDeform_[npar]) > (m_rangeHigh_ - m_rangeLow_) / (10. * m_nBins_)) + m_h1_[histname2.str()]->Fill(surfDeform_[npar]); } - (m_vtkmap.at(npar)).fill_current_val(inputRawid1, _surfDeform[npar]); + (m_vtkmap_.at(npar)).fill_current_val(inputRawid1, surfDeform_[npar]); } } - } else if (_inputFilename1 == "IDEAL" && _inputFilename2 == "IDEAL") { + } else if (inputFilename1_ == "IDEAL" && inputFilename2_ == "IDEAL") { edm::LogInfo("TrackerGeometryCompare") << ">>>> Comparing IDEAL with IDEAL: nothing to do! <<<<\n"; } @@ -643,7 +638,7 @@ void TrackerGeometryCompare::compareGeometries(Alignable* refAli, for (int i = 0; i < 100; i++) { // Get differences between alignments for rotations and translations // both local and global - diff = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); + diff = align::diffAlignables(refAli, curAli, weightBy_, weightById_, weightByIdVector_); // 'diffAlignables' returns 'refAli - curAli' for translations and 'curAli - refAli' for rotations. // The plan is to unify this at some point, but a simple change of the sign for one of them was postponed @@ -676,7 +671,7 @@ void TrackerGeometryCompare::compareGeometries(Alignable* refAli, // if true, break the loop align::moveAlignable(curAli, diff); float tolerance = 1e-7; - check = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); + check = align::diffAlignables(refAli, curAli, weightBy_, weightById_, weightByIdVector_); align::GlobalVector checkR(check[0], check[1], check[2]); align::GlobalVector checkW(check[3], check[4], check[5]); if ((checkR.mag() < tolerance) && (checkW.mag() < tolerance)) { @@ -723,25 +718,25 @@ void TrackerGeometryCompare::setCommonTrackerSystem() { // DM_534??AlignableObjectId dummy; // DM_534??_commonTrackerLevel = dummy.nameToType(_setCommonTrackerSystem); - _commonTrackerLevel = currentTracker->objectIdProvider().stringToId(_setCommonTrackerSystem); + commonTrackerLevel_ = currentTracker->objectIdProvider().stringToId(setCommonTrackerSystem_); diffCommonTrackerSystem(referenceTracker, currentTracker); align::EulerAngles dOmega(3); - dOmega[0] = _TrackerCommonR.x(); - dOmega[1] = _TrackerCommonR.y(); - dOmega[2] = _TrackerCommonR.z(); + dOmega[0] = TrackerCommonR_.x(); + dOmega[1] = TrackerCommonR_.y(); + dOmega[2] = TrackerCommonR_.z(); align::RotationType rot = align::toMatrix(dOmega); - align::GlobalVector theR = _TrackerCommonT; + align::GlobalVector theR = TrackerCommonT_; edm::LogInfo("TrackerGeometryCompare") << "what we get from overlaying the pixels..." << theR << ", " << rot; //transform to the Tracker System align::PositionType trackerCM = currentTracker->globalPosition(); align::GlobalVector cmDiff( - trackerCM.x() - _TrackerCommonCM.x(), trackerCM.y() - _TrackerCommonCM.y(), trackerCM.z() - _TrackerCommonCM.z()); + trackerCM.x() - TrackerCommonCM_.x(), trackerCM.y() - TrackerCommonCM_.y(), trackerCM.z() - TrackerCommonCM_.z()); - edm::LogInfo("TrackerGeometryCompare") << "Pixel CM: " << _TrackerCommonCM << ", tracker CM: " << trackerCM; + edm::LogInfo("TrackerGeometryCompare") << "Pixel CM: " << TrackerCommonCM_ << ", tracker CM: " << trackerCM; //adjust translational difference factoring in different rotational CM //needed because rotateInGlobalFrame is about CM of alignable, not Tracker @@ -753,9 +748,9 @@ void TrackerGeometryCompare::setCommonTrackerSystem() { TrackerCommonTR(1) = theRprime.x(); TrackerCommonTR(2) = theRprime.y(); TrackerCommonTR(3) = theRprime.z(); - TrackerCommonTR(4) = _TrackerCommonR.x(); - TrackerCommonTR(5) = _TrackerCommonR.y(); - TrackerCommonTR(6) = _TrackerCommonR.z(); + TrackerCommonTR(4) = TrackerCommonR_.x(); + TrackerCommonTR(5) = TrackerCommonR_.y(); + TrackerCommonTR(6) = TrackerCommonR_.z(); edm::LogInfo("TrackerGeometryCompare") << "and after the transformation: " << TrackerCommonTR; @@ -769,7 +764,7 @@ void TrackerGeometryCompare::diffCommonTrackerSystem(Alignable* refAli, Alignabl unsigned int nComp = refComp.size(); //only perform for designate levels bool useLevel = false; - if (refAli->alignableObjectId() == _commonTrackerLevel) + if (refAli->alignableObjectId() == commonTrackerLevel_) useLevel = true; //useLevel = false; @@ -778,7 +773,7 @@ void TrackerGeometryCompare::diffCommonTrackerSystem(Alignable* refAli, Alignabl Rtotal.set(0., 0., 0.); Wtotal.set(0., 0., 0.); - AlgebraicVector diff = align::diffAlignables(refAli, curAli, _weightBy, _weightById, _weightByIdVector); + AlgebraicVector diff = align::diffAlignables(refAli, curAli, weightBy_, weightById_, weightByIdVector_); CLHEP::Hep3Vector dR(diff[0], diff[1], diff[2]); Rtotal += dR; CLHEP::Hep3Vector dW(diff[3], diff[4], diff[5]); @@ -786,32 +781,10 @@ void TrackerGeometryCompare::diffCommonTrackerSystem(Alignable* refAli, Alignabl CLHEP::HepRotation drot(dW.unit(), dW.mag()); rot *= drot; Wtotal.set(rot.axis().x() * rot.delta(), rot.axis().y() * rot.delta(), rot.axis().z() * rot.delta()); - /* - //std::cout << "a"; - //if (refAli->alignableObjectId() == 1) std::cout << "DIFF: " << diff << std::endl; - align::moveAlignable(curAli, diff); - float tolerance = 1e-7; - AlgebraicVector check = align::diffAlignables(refAli,curAli, _weightBy, _weightById, _weightByIdVector); - align::GlobalVector checkR(check[0],check[1],check[2]); - align::GlobalVector checkW(check[3],check[4],check[5]); - DetId detid(refAli->id()); - if ((checkR.mag() > tolerance)||(checkW.mag() > tolerance)){ - edm::LogInfo("TrackerGeometryCompare") << "Tolerance Exceeded!(alObjId: " << refAli->alignableObjectId() - << ", rawId: " << refAli->geomDetId().rawId() - << ", subdetId: "<< detid.subdetId() << "): " << diff; - } - else{ - break; - } - } - */ - - //_TrackerCommonT.set(Rtotal.x(), Rtotal.y(), Rtotal.z()); - _TrackerCommonT = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z()); - _TrackerCommonR = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z()); - _TrackerCommonCM = curAli->globalPosition(); - //_TrackerCommonTR(1) = Rtotal.x(); _TrackerCommonTR(2) = Rtotal.y(); _TrackerCommonTR(3) = Rtotal.z(); - //_TrackerCommonTR(4) = Wtotal.x(); _TrackerCommonTR(5) = Wtotal.y(); _TrackerCommonTR(6) = Wtotal.z(); + + TrackerCommonT_ = align::GlobalVector(Rtotal.x(), Rtotal.y(), Rtotal.z()); + TrackerCommonR_ = align::GlobalVector(Wtotal.x(), Wtotal.y(), Wtotal.z()); + TrackerCommonCM_ = curAli->globalPosition(); } else { for (unsigned int i = 0; i < nComp; ++i) @@ -829,108 +802,108 @@ void TrackerGeometryCompare::fillTree(Alignable* refAli, edm::ESHandle SiStripModules; iSetup.get().get(SiStripModules); - _id = refAli->id(); + id_ = refAli->id(); - _badModuleQuality = 0; + badModuleQuality_ = 0; //check if module has a bad quality tag - if (SiPixelModules->IsModuleBad(_id)) { - _badModuleQuality = 1; + if (SiPixelModules->IsModuleBad(id_)) { + badModuleQuality_ = 1; } - if (SiStripModules->IsModuleBad(_id)) { - _badModuleQuality = 1; + if (SiStripModules->IsModuleBad(id_)) { + badModuleQuality_ = 1; } //check if module is in a given list of bad/untouched etc. modules - _inModuleList = 0; - for (unsigned int i = 0; i < _moduleList.size(); i++) { - if (_moduleList[i] == _id) { - _inModuleList = 1; + inModuleList_ = 0; + for (unsigned int i = 0; i < moduleList_.size(); i++) { + if (moduleList_[i] == id_) { + inModuleList_ = 1; break; } } - _level = refAli->alignableObjectId(); + level_ = refAli->alignableObjectId(); //need if ali has no mother if (refAli->mother()) { - _mid = refAli->mother()->geomDetId().rawId(); - _mlevel = refAli->mother()->alignableObjectId(); + mid_ = refAli->mother()->geomDetId().rawId(); + mlevel_ = refAli->mother()->alignableObjectId(); } else { - _mid = -1; - _mlevel = -1; + mid_ = -1; + mlevel_ = -1; } - DetId detid(_id); - _sublevel = detid.subdetId(); - fillIdentifiers(_sublevel, _id, tTopo); - _xVal = refAli->globalPosition().x(); - _yVal = refAli->globalPosition().y(); - _zVal = refAli->globalPosition().z(); - align::GlobalVector vec(_xVal, _yVal, _zVal); - _rVal = vec.perp(); - _phiVal = vec.phi(); - _etaVal = vec.eta(); + DetId detid(id_); + sublevel_ = detid.subdetId(); + fillIdentifiers(sublevel_, id_, tTopo); + xVal_ = refAli->globalPosition().x(); + yVal_ = refAli->globalPosition().y(); + zVal_ = refAli->globalPosition().z(); + align::GlobalVector vec(xVal_, yVal_, zVal_); + rVal_ = vec.perp(); + phiVal_ = vec.phi(); + etaVal_ = vec.eta(); align::RotationType rot = refAli->globalRotation(); align::EulerAngles eulerAngles = align::toAngles(rot); - _alphaVal = eulerAngles[0]; - _betaVal = eulerAngles[1]; - _gammaVal = eulerAngles[2]; + alphaVal_ = eulerAngles[0]; + betaVal_ = eulerAngles[1]; + gammaVal_ = eulerAngles[2]; // global - _dxVal = diff[0]; - _dyVal = diff[1]; - _dzVal = diff[2]; + dxVal_ = diff[0]; + dyVal_ = diff[1]; + dzVal_ = diff[2]; // local - _duVal = diff[6]; - _dvVal = diff[7]; - _dwVal = diff[8]; + duVal_ = diff[6]; + dvVal_ = diff[7]; + dwVal_ = diff[8]; //...TODO... - align::GlobalVector g(_dxVal, _dyVal, _dzVal); + align::GlobalVector g(dxVal_, dyVal_, dzVal_); //getting dR and dPhi - align::GlobalVector vRef(_xVal, _yVal, _zVal); - align::GlobalVector vCur(_xVal + _dxVal, _yVal + _dyVal, _zVal + _dzVal); - _drVal = vCur.perp() - vRef.perp(); - _dphiVal = vCur.phi() - vRef.phi(); + align::GlobalVector vRef(xVal_, yVal_, zVal_); + align::GlobalVector vCur(xVal_ + dxVal_, yVal_ + dyVal_, zVal_ + dzVal_); + drVal_ = vCur.perp() - vRef.perp(); + dphiVal_ = vCur.phi() - vRef.phi(); // global - _dalphaVal = diff[3]; - _dbetaVal = diff[4]; - _dgammaVal = diff[5]; + dalphaVal_ = diff[3]; + dbetaVal_ = diff[4]; + dgammaVal_ = diff[5]; // local - _daVal = diff[9]; - _dbVal = diff[10]; - _dgVal = diff[11]; + daVal_ = diff[9]; + dbVal_ = diff[10]; + dgVal_ = diff[11]; //detIdFlag if (refAli->alignableObjectId() == align::AlignableDetUnit) { - if (_detIdFlag) { + if (detIdFlag_) { if ((passIdCut(refAli->id())) || (passIdCut(refAli->mother()->id()))) { - _useDetId = 1; + useDetId_ = 1; } else { - _useDetId = 0; + useDetId_ = 0; } } } // det module dimension if (refAli->alignableObjectId() == align::AlignableDetUnit) { if (refAli->mother()->alignableObjectId() != align::AlignableDet) - _detDim = 1; + detDim_ = 1; else if (refAli->mother()->alignableObjectId() == align::AlignableDet) - _detDim = 2; + detDim_ = 2; } else - _detDim = 0; + detDim_ = 0; - _surWidth = refAli->surface().width(); - _surLength = refAli->surface().length(); + surWidth_ = refAli->surface().width(); + surLength_ = refAli->surface().length(); align::RotationType rt = refAli->globalRotation(); - _surRot[0] = rt.xx(); - _surRot[1] = rt.xy(); - _surRot[2] = rt.xz(); - _surRot[3] = rt.yx(); - _surRot[4] = rt.yy(); - _surRot[5] = rt.yz(); - _surRot[6] = rt.zx(); - _surRot[7] = rt.zy(); - _surRot[8] = rt.zz(); + surRot_[0] = rt.xx(); + surRot_[1] = rt.xy(); + surRot_[2] = rt.xz(); + surRot_[3] = rt.yx(); + surRot_[4] = rt.yy(); + surRot_[5] = rt.yz(); + surRot_[6] = rt.zx(); + surRot_[7] = rt.zy(); + surRot_[8] = rt.zz(); //Fill - _alignTree->Fill(); + alignTree_->Fill(); } void TrackerGeometryCompare::surveyToTracker(AlignableTracker* ali, @@ -1014,10 +987,10 @@ void TrackerGeometryCompare::addSurveyInfo(Alignable* ali) { bool TrackerGeometryCompare::passIdCut(uint32_t id) { bool pass = false; - int nEntries = _detIdFlagVector.size(); + int nEntries = detIdFlagVector_.size(); for (int i = 0; i < nEntries; i++) { - if (_detIdFlagVector[i] == id) + if (detIdFlagVector_[i] == id) pass = true; } @@ -1027,57 +1000,57 @@ bool TrackerGeometryCompare::passIdCut(uint32_t id) { void TrackerGeometryCompare::fillIdentifiers(int subdetlevel, int rawid, const TrackerTopology* tTopo) { switch (subdetlevel) { case 1: { - _identifiers[0] = tTopo->pxbModule(rawid); - _identifiers[1] = tTopo->pxbLadder(rawid); - _identifiers[2] = tTopo->pxbLayer(rawid); - _identifiers[3] = 999; - _identifiers[4] = 999; - _identifiers[5] = 999; + identifiers_[0] = tTopo->pxbModule(rawid); + identifiers_[1] = tTopo->pxbLadder(rawid); + identifiers_[2] = tTopo->pxbLayer(rawid); + identifiers_[3] = 999; + identifiers_[4] = 999; + identifiers_[5] = 999; break; } case 2: { - _identifiers[0] = tTopo->pxfModule(rawid); - _identifiers[1] = tTopo->pxfPanel(rawid); - _identifiers[2] = tTopo->pxfBlade(rawid); - _identifiers[3] = tTopo->pxfDisk(rawid); - _identifiers[4] = tTopo->pxfSide(rawid); - _identifiers[5] = 999; + identifiers_[0] = tTopo->pxfModule(rawid); + identifiers_[1] = tTopo->pxfPanel(rawid); + identifiers_[2] = tTopo->pxfBlade(rawid); + identifiers_[3] = tTopo->pxfDisk(rawid); + identifiers_[4] = tTopo->pxfSide(rawid); + identifiers_[5] = 999; break; } case 3: { - _identifiers[0] = tTopo->tibModule(rawid); - _identifiers[1] = tTopo->tibStringInfo(rawid)[0]; - _identifiers[2] = tTopo->tibStringInfo(rawid)[1]; - _identifiers[3] = tTopo->tibStringInfo(rawid)[2]; - _identifiers[4] = tTopo->tibLayer(rawid); - _identifiers[5] = 999; + identifiers_[0] = tTopo->tibModule(rawid); + identifiers_[1] = tTopo->tibStringInfo(rawid)[0]; + identifiers_[2] = tTopo->tibStringInfo(rawid)[1]; + identifiers_[3] = tTopo->tibStringInfo(rawid)[2]; + identifiers_[4] = tTopo->tibLayer(rawid); + identifiers_[5] = 999; break; } case 4: { - _identifiers[0] = tTopo->tidModuleInfo(rawid)[0]; - _identifiers[1] = tTopo->tidModuleInfo(rawid)[1]; - _identifiers[2] = tTopo->tidRing(rawid); - _identifiers[3] = tTopo->tidWheel(rawid); - _identifiers[4] = tTopo->tidSide(rawid); - _identifiers[5] = 999; + identifiers_[0] = tTopo->tidModuleInfo(rawid)[0]; + identifiers_[1] = tTopo->tidModuleInfo(rawid)[1]; + identifiers_[2] = tTopo->tidRing(rawid); + identifiers_[3] = tTopo->tidWheel(rawid); + identifiers_[4] = tTopo->tidSide(rawid); + identifiers_[5] = 999; break; } case 5: { - _identifiers[0] = tTopo->tobModule(rawid); - _identifiers[1] = tTopo->tobRodInfo(rawid)[0]; - _identifiers[2] = tTopo->tobRodInfo(rawid)[1]; - _identifiers[3] = tTopo->tobLayer(rawid); - _identifiers[4] = 999; - _identifiers[5] = 999; + identifiers_[0] = tTopo->tobModule(rawid); + identifiers_[1] = tTopo->tobRodInfo(rawid)[0]; + identifiers_[2] = tTopo->tobRodInfo(rawid)[1]; + identifiers_[3] = tTopo->tobLayer(rawid); + identifiers_[4] = 999; + identifiers_[5] = 999; break; } case 6: { - _identifiers[0] = tTopo->tecModule(rawid); - _identifiers[1] = tTopo->tecRing(rawid); - _identifiers[2] = tTopo->tecPetalInfo(rawid)[0]; - _identifiers[3] = tTopo->tecPetalInfo(rawid)[1]; - _identifiers[4] = tTopo->tecWheel(rawid); - _identifiers[5] = tTopo->tecSide(rawid); + identifiers_[0] = tTopo->tecModule(rawid); + identifiers_[1] = tTopo->tecRing(rawid); + identifiers_[2] = tTopo->tecPetalInfo(rawid)[0]; + identifiers_[3] = tTopo->tecPetalInfo(rawid)[1]; + identifiers_[4] = tTopo->tecWheel(rawid); + identifiers_[5] = tTopo->tecSide(rawid); break; } default: { diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h index cd06e955d84c2..14433e85b902f 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.h @@ -100,65 +100,65 @@ class TrackerGeometryCompare : public edm::EDAnalyzer { const SurveyErrors* theSurveyErrors; // configurables - const std::vector _levelStrings; - std::string _moduleListName; - std::string _inputFilename1; - std::string _inputFilename2; - std::string _inputTreenameAlign; - std::string _inputTreenameDeform; - bool _fromDD4hep; - bool _writeToDB; - std::string _weightBy; - std::string _setCommonTrackerSystem; - bool _detIdFlag; - std::string _detIdFlagFile; - bool _weightById; - std::string _weightByIdFile; - std::vector _weightByIdVector; - - std::vector _detIdFlagVector; - align::StructureType _commonTrackerLevel; - align::GlobalVector _TrackerCommonT; - align::GlobalVector _TrackerCommonR; - align::PositionType _TrackerCommonCM; - - std::ifstream _moduleListFile; - std::vector _moduleList; - int _moduleInList; + const std::vector levelStrings_; + std::string moduleListName_; + std::string inputFilename1_; + std::string inputFilename2_; + std::string inputTreenameAlign_; + std::string inputTreenameDeform_; + bool fromDD4hep_; + bool writeToDB_; + std::string weightBy_; + std::string setCommonTrackerSystem_; + bool detIdFlag_; + std::string detIdFlagFile_; + bool weightById_; + std::string weightByIdFile_; + std::vector weightByIdVector_; + + std::vector detIdFlagVector_; + align::StructureType commonTrackerLevel_; + align::GlobalVector TrackerCommonT_; + align::GlobalVector TrackerCommonR_; + align::PositionType TrackerCommonCM_; + + std::ifstream moduleListFile_; + std::vector moduleList_; + int moduleInList_; //root configuration - std::string _filename; - TFile* _theFile; - TTree* _alignTree; - TFile* _inputRootFile1; - TFile* _inputRootFile2; - TTree* _inputTree01; - TTree* _inputTree02; - TTree* _inputTree11; - TTree* _inputTree12; + std::string filename_; + TFile* theFile_; + TTree* alignTree_; + TFile* inputRootFile1_; + TFile* inputRootFile2_; + TTree* inputTree01_; + TTree* inputTree02_; + TTree* inputTree11_; + TTree* inputTree12_; /**\ Tree variables */ - int _id, _badModuleQuality, _inModuleList, _level, _mid, _mlevel, _sublevel, _useDetId, _detDim; - float _xVal, _yVal, _zVal, _rVal, _etaVal, _phiVal, _alphaVal, _betaVal, _gammaVal; + int id_, badModuleQuality_, inModuleList_, level_, mid_, mlevel_, sublevel_, useDetId_, detDim_; + float xVal_, yVal_, zVal_, rVal_, etaVal_, phiVal_, alphaVal_, betaVal_, gammaVal_; // changes in global variables - float _dxVal, _dyVal, _dzVal, _drVal, _dphiVal, _dalphaVal, _dbetaVal, _dgammaVal; + float dxVal_, dyVal_, dzVal_, drVal_, dphiVal_, dalphaVal_, dbetaVal_, dgammaVal_; // changes local variables: u, v, w, alpha, beta, gamma - float _duVal, _dvVal, _dwVal, _daVal, _dbVal, _dgVal; - float _surWidth, _surLength; - uint32_t _identifiers[6]; - double _surRot[9]; - int _type; - double _surfDeform[13]; + float duVal_, dvVal_, dwVal_, daVal_, dbVal_, dgVal_; + float surWidth_, surLength_; + uint32_t identifiers_[6]; + double surRot_[9]; + int type_; + double surfDeform_[13]; - int m_nBins; - double m_rangeLow; - double m_rangeHigh; + int m_nBins_; + double m_rangeLow_; + double m_rangeHigh_; bool firstEvent_; - std::vector m_vtkmap; + std::vector m_vtkmap_; - std::map m_h1; + std::map m_h1_; }; #endif From dec61a74f6bb6a56ccb314914a38cf31872c15ce Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 2 Jun 2020 21:59:56 +0200 Subject: [PATCH 13/24] SolidShapes enum back to original --- .../DDCMS/interface/DDSolidShapes.h | 34 ++++++++----------- .../src/GeometricTimingDet.cc | 2 +- .../src/GeometricDet.cc | 4 +-- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/DetectorDescription/DDCMS/interface/DDSolidShapes.h b/DetectorDescription/DDCMS/interface/DDSolidShapes.h index 2651f768d412c..f531f2688556c 100644 --- a/DetectorDescription/DDCMS/interface/DDSolidShapes.h +++ b/DetectorDescription/DDCMS/interface/DDSolidShapes.h @@ -59,7 +59,7 @@ namespace cms { } template - typename Mapping::value_type::name_type value_reverse(Mapping a, V value) { + typename Mapping::value_type::name_type name_from_value(Mapping a, V value) { auto pos = std::find_if( std::begin(a), std::end(a), [&value](const typename Mapping::value_type& t) { return (t.value == value); }); if (pos != std::end(a)) { @@ -78,23 +78,21 @@ namespace cms { ddcons = 4, ddpolycone = 5, ddpolyhedra = 6, - ddunsupported1 = 7, - ddunsupported2 = 8, - ddtorus = 9, - ddunion = 10, - ddsubtraction = 11, - ddintersection = 12, - ddshapeless = 13, - ddpseudotrap = 14, - ddtrunctubs = 15, - ddsphere = 16, - ddellipticaltube = 17, - ddcuttubs = 18, - ddextrudedpolygon = 19, - ddtrd1 = 20, + ddtorus = 7, + ddunion = 8, + ddsubtraction = 9, + ddintersection = 10, + ddshapeless = 11, + ddpseudotrap = 12, + ddtrunctubs = 13, + ddsphere = 14, + ddellipticaltube = 15, + ddcuttubs = 16, + ddextrudedpolygon = 17, + ddtrd1 = 18, }; - const std::array, 21> DDSolidShapeMap{ + const std::array, 19> DDSolidShapeMap{ {{DDSolidShape::dd_not_init, "Solid not initialized"}, {DDSolidShape::ddbox, "Box"}, {DDSolidShape::ddtubs, "Tube"}, @@ -113,9 +111,7 @@ namespace cms { {DDSolidShape::ddellipticaltube, "EllipticalTube"}, {DDSolidShape::ddcuttubs, "CutTube"}, {DDSolidShape::ddextrudedpolygon, "ExtrudedPolygon"}, - {DDSolidShape::ddtrd1, "Trd1"}, - {DDSolidShape::ddunsupported1, "Unsupported1"}, - {DDSolidShape::ddunsupported2, "Unsupported2"}}}; + {DDSolidShape::ddtrd1, "Trd1"}}}; const std::array, 20> LegacySolidShapeMap{ {{LegacySolidShape::dd_not_init, cms::DDSolidShape::dd_not_init}, diff --git a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc index 6732150f8db1b..1f10b358d647a 100644 --- a/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc +++ b/Geometry/MTDNumberingBuilder/src/GeometricTimingDet.cc @@ -258,5 +258,5 @@ std::unique_ptr GeometricTimingDet::bounds() const { const std::vector& par = params_; TrackerShapeToBounds shapeToBounds; return std::unique_ptr( - shapeToBounds.buildBounds(cms::dd::value_reverse(cms::LegacySolidShapeMap, shape_), par)); + shapeToBounds.buildBounds(cms::dd::name_from_value(cms::LegacySolidShapeMap, shape_), par)); } diff --git a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc index 9e8f412b43219..f3f88b50f7931 100644 --- a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc +++ b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc @@ -73,7 +73,7 @@ GeometricDet::GeometricDet(DDFilteredView* fv, GeometricEnumType type) _phi(_trans.Phi()), _rho(_trans.Rho()), _rot(fv->rotation()), - _shape(cms::DDSolidShape(static_cast(fv->shape()))), + _shape(cms::dd::name_from_value(cms::LegacySolidShapeMap,fv->shape())), _ddname(fv->name()), _type(type), _params(fv->parameters()), @@ -243,5 +243,5 @@ GeometricDet::Rotation GeometricDet::rotationBounds() const { std::unique_ptr GeometricDet::bounds() const { const std::vector& par = _params; TrackerShapeToBounds shapeToBounds; - return std::unique_ptr(shapeToBounds.buildBounds(cms::DDSolidShape(static_cast(_shape)), par)); + return std::unique_ptr(shapeToBounds.buildBounds(_shape, par)); } From 059a14307f00becead267e5cce5792c7ec580d92 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 2 Jun 2020 22:04:36 +0200 Subject: [PATCH 14/24] Code checks --- .../plugins/TrackerGeometryCompare.cc | 12 ++++++------ Geometry/TrackerNumberingBuilder/src/GeometricDet.cc | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc index bb9862e211a38..4dcea2fdb13e9 100644 --- a/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc +++ b/Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc @@ -181,18 +181,18 @@ TrackerGeometryCompare::TrackerGeometryCompare(const edm::ParameterSet& cfg) for (int ii = 0; ii < 13; ++ii) { std::stringstream histname0; histname0 << "SurfDeform_Par_" << ii; - m_h1_[histname0.str()] = - subDir_All.make((histname0.str()).c_str(), (histname0.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); + m_h1_[histname0.str()] = subDir_All.make( + (histname0.str()).c_str(), (histname0.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); std::stringstream histname1; histname1 << "SurfDeform_PixelBarrel_Par_" << ii; - m_h1_[histname1.str()] = - subDir_PXB.make((histname1.str()).c_str(), (histname1.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); + m_h1_[histname1.str()] = subDir_PXB.make( + (histname1.str()).c_str(), (histname1.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); std::stringstream histname2; histname2 << "SurfDeform_PixelEndcap_Par_" << ii; - m_h1_[histname2.str()] = - subDir_PXF.make((histname2.str()).c_str(), (histname2.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); + m_h1_[histname2.str()] = subDir_PXF.make( + (histname2.str()).c_str(), (histname2.str()).c_str(), m_nBins_, m_rangeLow_, m_rangeHigh_); } } diff --git a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc index f3f88b50f7931..f000645c16102 100644 --- a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc +++ b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc @@ -73,7 +73,7 @@ GeometricDet::GeometricDet(DDFilteredView* fv, GeometricEnumType type) _phi(_trans.Phi()), _rho(_trans.Rho()), _rot(fv->rotation()), - _shape(cms::dd::name_from_value(cms::LegacySolidShapeMap,fv->shape())), + _shape(cms::dd::name_from_value(cms::LegacySolidShapeMap, fv->shape())), _ddname(fv->name()), _type(type), _params(fv->parameters()), From 8801ff3cd73eeb914cae4ba638d7fa23e4ac8848 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Tue, 2 Jun 2020 22:08:50 +0200 Subject: [PATCH 15/24] Removing TrackerNumberingBuilder/bin/stubs/GeometricDetLoader --- .../TrackerNumberingBuilder/bin/BuildFile.xml | 11 - .../bin/stubs/GeometricDetLoader.cc | 220 ------------------ .../bin/stubs/GeometricDetLoader.h | 30 --- 3 files changed, 261 deletions(-) delete mode 100644 Geometry/TrackerNumberingBuilder/bin/BuildFile.xml delete mode 100644 Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc delete mode 100644 Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h diff --git a/Geometry/TrackerNumberingBuilder/bin/BuildFile.xml b/Geometry/TrackerNumberingBuilder/bin/BuildFile.xml deleted file mode 100644 index 94bb6b2091378..0000000000000 --- a/Geometry/TrackerNumberingBuilder/bin/BuildFile.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc deleted file mode 100644 index 52c3581fde172..0000000000000 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.cc +++ /dev/null @@ -1,220 +0,0 @@ -#include "GeometricDetLoader.h" - -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/Event.h" -#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "CondFormats/GeometryObjects/interface/PGeometricDet.h" - -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" -#include -#include -#include - -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" - -#include -#include -#include - -// just a reminder to self... beware errors caused by levels. Look -// at how tracker is built and how GeometricSearchTracker.h is built -// up from the hierarchy. - -GeometricDetLoader::GeometricDetLoader(const edm::ParameterSet& iConfig) { - std::cout << "GeometricDetLoader::GeometricDetLoader" << std::endl; - fromDD4hep = iConfig.getUntrackedParameter("fromDD4hep", false); -} - -GeometricDetLoader::~GeometricDetLoader() { std::cout << "GeometricDetLoader::~GeometricDetLoader" << std::endl; } - -void GeometricDetLoader::beginRun(edm::Run const& /* iEvent */, edm::EventSetup const& es) { - std::cout << "GeometricDetLoader::beginJob" << std::endl; - PGeometricDet* pgd = new PGeometricDet; - edm::Service mydbservice; - if (!mydbservice.isAvailable()) { - std::cout << "PoolDBOutputService unavailable" << std::endl; - return; - } - - if (!fromDD4hep) { - edm::ESHandle pDD; - es.get().get(pDD); - } else { - edm::ESHandle pDD; - es.get().get(pDD); - } - edm::ESHandle rDD; - es.get().get(rDD); - const GeometricDet* tracker = &(*rDD); - - // so now I have the tracker itself. loop over all its components to store them. - putOne(tracker, pgd, 0); - std::vector tc = tracker->components(); - std::cout << "Tracker has " << tc.size() << " components." << std::endl; //, lets go through them." << std::endl; - std::vector::const_iterator git = tc.begin(); - std::vector::const_iterator egit = tc.end(); - int count = 0; - int lev = 1; - for (; git != egit; ++git) { // one level below "tracker" - putOne(*git, pgd, lev); - std::vector inone = (*git)->components(); - // << ctste.name((*git)->type()) - // std::cout << lev << " type " << (*git)->type() << " " << int((*git)->geographicalId()) << std::endl; // << " has " << inone.size() << " components." << std::endl; - if (inone.empty()) - ++count; - std::vector::const_iterator git2 = inone.begin(); - std::vector::const_iterator egit2 = inone.end(); - ++lev; - for (; git2 != egit2; ++git2) { // level 2 - putOne(*git2, pgd, lev); - std::vector intwo = (*git2)->components(); - // std::cout << lev << "\ttype " << (*git2)->type() << " " << int((*git2)->geographicalId()) << std::endl; // << " has " << intwo.size() << " components." << std::endl; - if (intwo.empty()) - ++count; - std::vector::const_iterator git3 = intwo.begin(); - std::vector::const_iterator egit3 = intwo.end(); - ++lev; - for (; git3 != egit3; ++git3) { // level 3 - putOne(*git3, pgd, lev); - std::vector inthree = (*git3)->components(); - // std::cout << lev << "\t\ttype " << (*git3)->type() << " " << int((*git3)->geographicalId()) << std::endl; // << " has " << inthree.size() << " components." << std::endl; - if (inthree.empty()) - ++count; - std::vector::const_iterator git4 = inthree.begin(); - std::vector::const_iterator egit4 = inthree.end(); - ++lev; - for (; git4 != egit4; ++git4) { //level 4 - putOne(*git4, pgd, lev); - std::vector infour = (*git4)->components(); - // std::cout << lev << "\t\t\ttype " << (*git4)->type() << " " << int((*git4)->geographicalId()) << std::endl; // << " has " << infour.size() << " components." << std::endl; - if (infour.empty()) - ++count; - std::vector::const_iterator git5 = infour.begin(); - std::vector::const_iterator egit5 = infour.end(); - ++lev; - for (; git5 != egit5; ++git5) { // level 5 - putOne(*git5, pgd, lev); - std::vector infive = (*git5)->components(); - // std::cout << lev << "\t\t\t\ttype " << (*git5)->type() << " " << int((*git5)->geographicalId()) << std::endl; // << " has " << infive.size() << " components." << std::endl; - if (infive.empty()) - ++count; - std::vector::const_iterator git6 = infive.begin(); - std::vector::const_iterator egit6 = infive.end(); - ++lev; - for (; git6 != egit6; ++git6) { //level 6 - putOne(*git6, pgd, lev); - std::vector insix = (*git6)->components(); - // std::cout << lev << "\t\t\t\t\ttype " << (*git6)->type() << " " << int((*git6)->geographicalId()) << std::endl; // << " has " << insix.size() << " components." << std::endl; - if (insix.empty()) - ++count; - } // level 6 - --lev; - } // level 5 - --lev; - } // level 4 - --lev; - } //level 3 - --lev; - } // level 2 - --lev; - } - std::vector modules = tracker->deepComponents(); - std::cout << " No. of Tracker components \"deepComponents\" = " << modules.size() << std::endl; - std::cout << " Counted # of lowest \"leaves\" = " << count << std::endl; - if (mydbservice->isNewTagRequest("PGeometricDetRcd")) { - mydbservice->createNewIOV( - pgd, mydbservice->beginOfTime(), mydbservice->endOfTime(), "PGeometricDetRcd"); - } else { - std::cout << "PGeometricDetRcd Tag is already present." << std::endl; - } -} - -void GeometricDetLoader::putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev) { - // std::cout << "putting name: " << gd->name().name(); - // std::cout << " gid: " << gd->geographicalID(); - // std::cout << " type: " << gd->type() << std::endl; - // std::cout << "shape = " << gd->shape()<<"; name = "<name().name()<<"; parameter number = "<params().size()<translation(); - const DDRotationMatrix& rot = gd->rotation(); - DD3Vector x, y, z; - rot.GetComponents(x, y, z); - item._name = gd->name(); - item._level = lev; - item._x = tran.X(); - item._y = tran.Y(); - item._z = tran.Z(); - item._phi = gd->phi(); - item._rho = gd->rho(); - item._a11 = x.X(); - item._a12 = y.X(); - item._a13 = z.X(); - item._a21 = x.Y(); - item._a22 = y.Y(); - item._a23 = z.Y(); - item._a31 = x.Z(); - item._a32 = y.Z(); - item._a33 = z.Z(); - item._shape = static_cast(gd->shape()); - item._type = gd->type(); - if (gd->shape() == cms::DDSolidShape::ddbox) { - item._params0 = gd->params()[0]; - item._params1 = gd->params()[1]; - item._params2 = gd->params()[2]; - item._params3 = 0; - item._params4 = 0; - item._params5 = 0; - item._params6 = 0; - item._params7 = 0; - item._params8 = 0; - item._params9 = 0; - item._params10 = 0; - } else if (gd->shape() == cms::DDSolidShape::ddtrap) { - item._params0 = gd->params()[0]; - item._params1 = gd->params()[1]; - item._params2 = gd->params()[2]; - item._params3 = gd->params()[3]; - item._params4 = gd->params()[4]; - item._params5 = gd->params()[5]; - item._params6 = gd->params()[6]; - item._params7 = gd->params()[7]; - item._params8 = gd->params()[8]; - item._params9 = gd->params()[9]; - item._params10 = gd->params()[10]; - } else { - item._params0 = 0; - item._params1 = 0; - item._params2 = 0; - item._params3 = 0; - item._params4 = 0; - item._params5 = 0; - item._params6 = 0; - item._params7 = 0; - item._params8 = 0; - item._params9 = 0; - item._params10 = 0; - } - item._geographicalID = gd->geographicalID(); - // FIXME: These are moved to PGeometricDetExtra: - //item._volume = gd->volume(); - //item._density = gd->density(); - //item._weight = gd->weight(); - //item._copy = gd->copyno(); - //item._material = gd->material(); - item._radLength = gd->radLength(); - item._xi = gd->xi(); - item._pixROCRows = gd->pixROCRows(); - item._pixROCCols = gd->pixROCCols(); - item._pixROCx = gd->pixROCx(); - item._pixROCy = gd->pixROCy(); - item._stereo = gd->stereo(); - item._siliconAPVNum = gd->siliconAPVNum(); - pgd->pgeomdets_.push_back(item); -} - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(GeometricDetLoader); diff --git a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h b/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h deleted file mode 100644 index 626e5902dc925..0000000000000 --- a/Geometry/TrackerNumberingBuilder/bin/stubs/GeometricDetLoader.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef TrackerNumberingBuilder_GeometricDetLoader_h -#define TrackerNumberingBuilder_GeometricDetLoader_h - -#include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include - -class GeometricDet; -class PGeometricDet; - -class GeometricDetLoader : public edm::one::EDAnalyzer { -public: - explicit GeometricDetLoader(const edm::ParameterSet& iConfig); - ~GeometricDetLoader() override; - - void beginJob() override {} - void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override; - void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {} - void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {} - void endJob() override {} - -private: - void putOne(const GeometricDet* gd, PGeometricDet* pgd, int lev); - bool fromDD4hep; -}; - -#endif From 66451901c4fd7414b545a9afc1182213da3e9cea Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 4 Jun 2020 11:31:35 +0200 Subject: [PATCH 16/24] Reduce DDExpandedView use in GeometricDet and add shape_dd4hep --- CondTools/Geometry/plugins/PGeometricDetBuilder.cc | 6 +++--- Geometry/TrackerNumberingBuilder/interface/GeometricDet.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc index 20c23cc0084f6..fe69f91a369be 100644 --- a/CondTools/Geometry/plugins/PGeometricDetBuilder.cc +++ b/CondTools/Geometry/plugins/PGeometricDetBuilder.cc @@ -150,9 +150,9 @@ void PGeometricDetBuilder::putOne(const GeometricDet* gd, PGeometricDet* pgd, in item._a31 = x.Z(); item._a32 = y.Z(); item._a33 = z.Z(); - item._shape = static_cast(gd->shape()); + item._shape = static_cast(gd->shape_dd4hep()); item._type = gd->type(); - if (gd->shape() == cms::DDSolidShape::ddbox) { + if (gd->shape_dd4hep() == cms::DDSolidShape::ddbox) { item._params0 = gd->params()[0]; item._params1 = gd->params()[1]; item._params2 = gd->params()[2]; @@ -164,7 +164,7 @@ void PGeometricDetBuilder::putOne(const GeometricDet* gd, PGeometricDet* pgd, in item._params8 = 0; item._params9 = 0; item._params10 = 0; - } else if (gd->shape() == cms::DDSolidShape::ddtrap) { + } else if (gd->shape_dd4hep() == cms::DDSolidShape::ddtrap) { item._params0 = gd->params()[0]; item._params1 = gd->params()[1]; item._params2 = gd->params()[2]; diff --git a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h index e8f1d0c0c8a0e..798b93018f0b5 100644 --- a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h +++ b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h @@ -3,7 +3,6 @@ #include "CondFormats/GeometryObjects/interface/PGeometricDet.h" #include "DetectorDescription/Core/interface/DDSolidShapes.h" -#include "DetectorDescription/DDCMS/interface/DDSolidShapes.h" #include "DataFormats/GeometrySurface/interface/Surface.h" #include "DataFormats/GeometrySurface/interface/Bounds.h" #include "DataFormats/DetId/interface/DetId.h" @@ -119,7 +118,8 @@ class GeometricDet { double phi() const { return _phi; } double rho() const { return _rho; } - cms::DDSolidShape const& shape() const { return _shape; } + LegacySolidShape shape() const { return cms::dd::value(cms::LegacySolidShapeMap,_shape); } + cms::DDSolidShape const& shape_dd4hep() const { return _shape; } GeometricEnumType type() const { return _type; } std::string const& name() const { return _ddname; } From 8a2e9810805d11d127a796ca792c5f9fdae8ab67 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 4 Jun 2020 11:57:45 +0200 Subject: [PATCH 17/24] Code format --- Geometry/TrackerNumberingBuilder/interface/GeometricDet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h index 798b93018f0b5..500e044df3bcc 100644 --- a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h +++ b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h @@ -118,7 +118,7 @@ class GeometricDet { double phi() const { return _phi; } double rho() const { return _rho; } - LegacySolidShape shape() const { return cms::dd::value(cms::LegacySolidShapeMap,_shape); } + LegacySolidShape shape() const { return cms::dd::value(cms::LegacySolidShapeMap, _shape); } cms::DDSolidShape const& shape_dd4hep() const { return _shape; } GeometricEnumType type() const { return _type; } std::string const& name() const { return _ddname; } From ed8b7515a249cb4426052c3d666bd530ece0ea3c Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 18 Jun 2020 10:05:08 +0200 Subject: [PATCH 18/24] Match enums for Legacy and DD4hep SolidShapes --- .../DDCMS/interface/DDSolidShapes.h | 26 ++++++++++--------- .../src/GeometricDet.cc | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/DetectorDescription/DDCMS/interface/DDSolidShapes.h b/DetectorDescription/DDCMS/interface/DDSolidShapes.h index f531f2688556c..b101c795e7ab4 100644 --- a/DetectorDescription/DDCMS/interface/DDSolidShapes.h +++ b/DetectorDescription/DDCMS/interface/DDSolidShapes.h @@ -78,18 +78,20 @@ namespace cms { ddcons = 4, ddpolycone = 5, ddpolyhedra = 6, - ddtorus = 7, - ddunion = 8, - ddsubtraction = 9, - ddintersection = 10, - ddshapeless = 11, - ddpseudotrap = 12, - ddtrunctubs = 13, - ddsphere = 14, - ddellipticaltube = 15, - ddcuttubs = 16, - ddextrudedpolygon = 17, - ddtrd1 = 18, + ddunsupported1 = 7, + ddunsupported2 = 8, + ddtorus = 9, + ddunion = 10, + ddsubtraction = 11, + ddintersection = 12, + ddshapeless = 13, + ddpseudotrap = 14, + ddtrunctubs = 15, + ddsphere = 16, + ddellipticaltube = 17, + ddcuttubs = 18, + ddextrudedpolygon = 19, + ddtrd1 = 20, }; const std::array, 19> DDSolidShapeMap{ diff --git a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc index f000645c16102..0c0c337d397af 100644 --- a/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc +++ b/Geometry/TrackerNumberingBuilder/src/GeometricDet.cc @@ -124,7 +124,7 @@ GeometricDet::GeometricDet(const PGeometricDet::Item& onePGD, GeometricEnumType onePGD._a31, onePGD._a32, onePGD._a33), - _shape(static_cast(onePGD._shape)), + _shape(cms::dd::name_from_value(cms::LegacySolidShapeMap, static_cast(onePGD._shape))), _ddd(), _ddname(onePGD._name), _type(type), From dcff11492ac2ed6b2fdc3e984b7543aba886b062 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 18 Jun 2020 16:10:01 +0200 Subject: [PATCH 19/24] Update DDSolidLegacyShapes unit test --- DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc index 01b059d6c882c..652de16947c3d 100644 --- a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc +++ b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc @@ -96,8 +96,8 @@ void testDDSolidLegacyShapes::checkDDSolidLegacyShapes() { cms::dd::value(cms::LegacySolidShapeMap, cms::DDSolidShape::ddextrudedpolygon); CPPUNIT_ASSERT(legacyExtrudedpolygon == LegacySolidShape::ddextrudedpolygon); - int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 7, - 10, 8, 11, 9, 12, 10, 13, 11, 14, 12, 15, 13, 16, 14, 17, 15, 18, 16, 19, 17}; + int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 9, + 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19}; int i = 0; for (const auto it : LegacySolidShapeMap) { CPPUNIT_ASSERT(static_cast(it.value) == ids[i++]); From af5c93611c8b07a2e83e98e13771739960160e47 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 18 Jun 2020 16:11:24 +0200 Subject: [PATCH 20/24] Apply code format --- DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc index 652de16947c3d..636f8e462d39b 100644 --- a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc +++ b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc @@ -96,7 +96,7 @@ void testDDSolidLegacyShapes::checkDDSolidLegacyShapes() { cms::dd::value(cms::LegacySolidShapeMap, cms::DDSolidShape::ddextrudedpolygon); CPPUNIT_ASSERT(legacyExtrudedpolygon == LegacySolidShape::ddextrudedpolygon); - int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 9, + int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19}; int i = 0; for (const auto it : LegacySolidShapeMap) { From fbe5d2a9b0a8759dc7cec7fa1f1e89ff2cd1cee8 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 18 Jun 2020 16:53:37 +0200 Subject: [PATCH 21/24] DDSolidLegacyShapes conflict fix attempt --- DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc index 636f8e462d39b..652de16947c3d 100644 --- a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc +++ b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc @@ -96,7 +96,7 @@ void testDDSolidLegacyShapes::checkDDSolidLegacyShapes() { cms::dd::value(cms::LegacySolidShapeMap, cms::DDSolidShape::ddextrudedpolygon); CPPUNIT_ASSERT(legacyExtrudedpolygon == LegacySolidShape::ddextrudedpolygon); - int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 9, + int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19}; int i = 0; for (const auto it : LegacySolidShapeMap) { From 285678b05ca159e8eade0a5b0173a7f11297f341 Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Thu, 18 Jun 2020 19:42:06 +0200 Subject: [PATCH 22/24] GeometricDet: have shape_dd4hep return by value --- Geometry/TrackerNumberingBuilder/interface/GeometricDet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h index 500e044df3bcc..86a0d032b1ef5 100644 --- a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h +++ b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h @@ -119,7 +119,7 @@ class GeometricDet { double rho() const { return _rho; } LegacySolidShape shape() const { return cms::dd::value(cms::LegacySolidShapeMap, _shape); } - cms::DDSolidShape const& shape_dd4hep() const { return _shape; } + cms::DDSolidShape shape_dd4hep() const { return _shape; } GeometricEnumType type() const { return _type; } std::string const& name() const { return _ddname; } From 823074dd35e0803af884b17b31641a906a7a43cd Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Fri, 26 Jun 2020 16:50:46 +0200 Subject: [PATCH 23/24] GeometricDet: fix include --- Geometry/TrackerNumberingBuilder/interface/GeometricDet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h index 86a0d032b1ef5..7f0a15d7bdb58 100644 --- a/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h +++ b/Geometry/TrackerNumberingBuilder/interface/GeometricDet.h @@ -2,7 +2,7 @@ #define Geometry_TrackerNumberingBuilder_GeometricDet_H #include "CondFormats/GeometryObjects/interface/PGeometricDet.h" -#include "DetectorDescription/Core/interface/DDSolidShapes.h" +#include "DetectorDescription/DDCMS/interface/DDSolidShapes.h" #include "DataFormats/GeometrySurface/interface/Surface.h" #include "DataFormats/GeometrySurface/interface/Bounds.h" #include "DataFormats/DetId/interface/DetId.h" From 637ae06766a88306837a129105d02405fc5f313b Mon Sep 17 00:00:00 2001 From: Adinda de Wit Date: Fri, 26 Jun 2020 17:50:18 +0200 Subject: [PATCH 24/24] Code format --- DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc index 652de16947c3d..636f8e462d39b 100644 --- a/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc +++ b/DetectorDescription/DDCMS/test/DDSolidLegacyShapes.cppunit.cc @@ -96,7 +96,7 @@ void testDDSolidLegacyShapes::checkDDSolidLegacyShapes() { cms::dd::value(cms::LegacySolidShapeMap, cms::DDSolidShape::ddextrudedpolygon); CPPUNIT_ASSERT(legacyExtrudedpolygon == LegacySolidShape::ddextrudedpolygon); - int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 9, + int ids[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 7, 5, 6, 6, 8, 6, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19}; int i = 0; for (const auto it : LegacySolidShapeMap) {