From 62469e55ab5c255bbe00b5561176238e10d13dd2 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Sat, 17 Jun 2017 01:40:38 +0200 Subject: [PATCH] Namespace re-organisation --- CMakeLists.txt | 6 +- CTestConfig.cmake | 4 +- DDAlign/CMakeLists.txt | 2 +- DDAlign/include/DDAlign/AlignmentTags.h | 8 +- DDAlign/include/DDAlign/AlignmentsCalib.h | 42 +- .../include/DDAlign/GlobalAlignmentCache.h | 26 +- .../DDAlign/GlobalAlignmentOperators.h | 12 +- .../include/DDAlign/GlobalAlignmentStack.h | 12 +- .../include/DDAlign/GlobalAlignmentWriter.h | 28 +- .../include/DDAlign/GlobalDetectorAlignment.h | 14 +- DDAlign/src/AlignmentTags.cpp | 4 +- DDAlign/src/AlignmentsCalib.cpp | 38 +- DDAlign/src/GlobalAlignmentCache.cpp | 46 +- DDAlign/src/GlobalAlignmentOperators.cpp | 8 +- DDAlign/src/GlobalAlignmentStack.cpp | 10 +- DDAlign/src/GlobalAlignmentWriter.cpp | 55 +- DDAlign/src/GlobalDetectorAlignment.cpp | 51 +- DDAlign/src/plugins/AlignmentsPlugins.cpp | 21 +- DDAlign/src/plugins/GlobalAlignmentParser.cpp | 60 +- DDCond/CMakeLists.txt | 2 +- DDCond/NamingConventions.txt | 4 +- DDCond/include/DDCond/ConditionsContent.h | 23 +- DDCond/include/DDCond/ConditionsDataLoader.h | 27 +- .../DDCond/ConditionsDependencyHandler.h | 18 +- DDCond/include/DDCond/ConditionsEntry.h | 18 +- DDCond/include/DDCond/ConditionsIOVPool.h | 24 +- DDCond/include/DDCond/ConditionsManager.h | 14 +- .../include/DDCond/ConditionsManagerObject.h | 23 +- DDCond/include/DDCond/ConditionsOperators.h | 24 +- DDCond/include/DDCond/ConditionsPool.h | 62 +- DDCond/include/DDCond/ConditionsRepository.h | 12 +- DDCond/include/DDCond/ConditionsSelectors.h | 12 +- DDCond/include/DDCond/ConditionsSlice.h | 28 +- DDCond/include/DDCond/ConditionsTags.h | 14 +- .../include/DDCond/ConditionsTextRepository.h | 12 +- DDCond/include/DDCond/Type1/Manager_Type1.h | 34 +- DDCond/src/ConditionsContent.cpp | 20 +- DDCond/src/ConditionsDataLoader.cpp | 8 +- DDCond/src/ConditionsDependencyHandler.cpp | 16 +- DDCond/src/ConditionsEntry.cpp | 6 +- DDCond/src/ConditionsIOVPool.cpp | 74 +- DDCond/src/ConditionsManager.cpp | 26 +- DDCond/src/ConditionsOperators.cpp | 57 +- DDCond/src/ConditionsPool.cpp | 6 +- DDCond/src/ConditionsRepository.cpp | 54 +- DDCond/src/ConditionsSlice.cpp | 54 +- DDCond/src/ConditionsTags.cpp | 4 +- DDCond/src/ConditionsTextRepository.cpp | 63 +- DDCond/src/Type1/Manager_Type1.cpp | 76 +- DDCond/src/plugins/ConditionsLinearPool.cpp | 54 +- DDCond/src/plugins/ConditionsMappedPool.cpp | 42 +- DDCond/src/plugins/ConditionsMultiLoader.cpp | 48 +- DDCond/src/plugins/ConditionsParser.cpp | 50 +- DDCond/src/plugins/ConditionsPlugins.cpp | 215 ++- .../plugins/ConditionsRepositoryParser.cpp | 106 +- .../plugins/ConditionsRepositoryWriter.cpp | 168 +- DDCond/src/plugins/ConditionsUserPool.cpp | 141 +- DDCond/src/plugins/ConditionsXmlLoader.cpp | 52 +- DDCore/CMakeLists.txt | 6 +- DDCore/include/DD4hep/AlignmentData.h | 492 ++---- DDCore/include/DD4hep/AlignmentTools.h | 10 +- DDCore/include/DD4hep/Alignments.h | 314 ++-- DDCore/include/DD4hep/AlignmentsCalculator.h | 14 +- DDCore/include/DD4hep/AlignmentsNominalMap.h | 133 +- DDCore/include/DD4hep/AlignmentsPrinter.h | 12 +- DDCore/include/DD4hep/AlignmentsProcessor.h | 11 +- DDCore/include/DD4hep/BasicGrammar.h | 6 +- DDCore/include/DD4hep/BitField64.h | 12 +- DDCore/include/DD4hep/BuildType.h | 14 +- DDCore/include/DD4hep/Callback.h | 6 +- DDCore/include/DD4hep/CartesianGridXY.h | 165 +- DDCore/include/DD4hep/CartesianGridXYZ.h | 189 ++- DDCore/include/DD4hep/CartesianGridXZ.h | 167 +- DDCore/include/DD4hep/CartesianGridYZ.h | 169 +- DDCore/include/DD4hep/ComponentProperties.h | 6 +- DDCore/include/DD4hep/ConditionDerived.h | 50 +- DDCore/include/DD4hep/ConditionTypes.h | 4 +- DDCore/include/DD4hep/Conditions.h | 731 ++++----- DDCore/include/DD4hep/ConditionsData.h | 12 +- DDCore/include/DD4hep/ConditionsListener.h | 12 +- DDCore/include/DD4hep/ConditionsMap.h | 273 ++-- DDCore/include/DD4hep/ConditionsPrinter.h | 14 +- DDCore/include/DD4hep/ConditionsProcessor.h | 12 +- DDCore/include/DD4hep/DD4hepRootPersistency.h | 12 +- DDCore/include/DD4hep/DD4hepUI.h | 92 +- DDCore/include/DD4hep/DD4hepUnits.h | 725 ++++----- DDCore/include/DD4hep/DetElement.h | 378 +++++ DDCore/include/DD4hep/DetFactoryHelper.h | 8 +- DDCore/include/DD4hep/DetType.h | 6 +- DDCore/include/DD4hep/Detector.h | 689 ++++---- DDCore/include/DD4hep/DetectorData.h | 141 ++ DDCore/include/DD4hep/DetectorHelper.h | 56 + .../DD4hep/{LCDDLoad.h => DetectorLoad.h} | 46 +- DDCore/include/DD4hep/DetectorProcessor.h | 279 ++-- DDCore/include/DD4hep/DetectorSelector.h | 112 +- DDCore/include/DD4hep/DetectorTools.h | 26 +- DDCore/include/DD4hep/Dictionary.h | 469 +++--- DDCore/include/DD4hep/Errors.h | 6 +- DDCore/include/DD4hep/Exceptions.h | 6 +- DDCore/include/DD4hep/Factories.h | 190 ++- DDCore/include/DD4hep/FieldTypes.h | 282 ++-- DDCore/include/DD4hep/Fields.h | 395 +++-- DDCore/include/DD4hep/GeoHandler.h | 78 +- DDCore/include/DD4hep/GlobalAlignment.h | 27 +- DDCore/include/DD4hep/GridPhiEta.h | 214 +-- DDCore/include/DD4hep/GridRPhiEta.h | 252 +-- DDCore/include/DD4hep/Handle.h | 153 +- DDCore/include/DD4hep/IDDescriptor.h | 113 +- DDCore/include/DD4hep/IOV.h | 6 +- DDCore/include/DD4hep/InstanceCount.h | 8 +- DDCore/include/DD4hep/LCDD.h | 373 ----- DDCore/include/DD4hep/LCDDData.h | 146 -- DDCore/include/DD4hep/LCDDHelper.h | 61 - DDCore/include/DD4hep/MatrixHelpers.h | 61 +- DDCore/include/DD4hep/Memory.h | 4 +- DDCore/include/DD4hep/MultiSegmentation.h | 141 +- DDCore/include/DD4hep/Mutex.h | 4 +- DDCore/include/DD4hep/NamedObject.h | 6 +- DDCore/include/DD4hep/NoSegmentation.h | 65 +- DDCore/include/DD4hep/ObjectExtensions.h | 35 +- DDCore/include/DD4hep/Objects.h | 865 +++++----- DDCore/include/DD4hep/OpaqueData.h | 8 +- DDCore/include/DD4hep/OpaqueDataBinder.h | 146 +- DDCore/include/DD4hep/Operators.h | 6 +- DDCore/include/DD4hep/Parsers.h | 140 +- DDCore/include/DD4hep/Path.h | 42 +- DDCore/include/DD4hep/PluginCreators.h | 56 +- DDCore/include/DD4hep/PluginTester.h | 6 +- DDCore/include/DD4hep/Plugins.h | 78 +- DDCore/include/DD4hep/PolarGridRPhi.h | 165 +- DDCore/include/DD4hep/PolarGridRPhi2.h | 193 ++- DDCore/include/DD4hep/Primitives.h | 907 ++++++----- DDCore/include/DD4hep/Printout.h | 36 +- DDCore/include/DD4hep/Readout.h | 110 +- DDCore/include/DD4hep/Segmentations.h | 145 +- DDCore/include/DD4hep/Shapes.h | 1424 ++++++++--------- DDCore/include/DD4hep/SurfaceInstaller.h | 77 +- DDCore/include/DD4hep/TGeoUnits.h | 2 +- DDCore/include/DD4hep/ToStream.h | 20 +- DDCore/include/DD4hep/VolumeManager.h | 308 ++-- DDCore/include/DD4hep/Volumes.h | 623 ++++---- DDCore/include/DD4hep/WaferGridXY.h | 157 +- DDCore/include/DD4hep/World.h | 82 +- DDCore/include/DD4hep/config.h | 12 +- .../include/DD4hep/detail/AlignmentsInterna.h | 82 +- .../include/DD4hep/detail/BasicGrammar_inl.h | 94 +- .../DD4hep/detail/ComponentProperties_inl.h | 28 +- .../include/DD4hep/detail/ConditionsInterna.h | 233 ++- .../include/DD4hep/detail/ContainerHelpers.h | 6 +- .../include/DD4hep/detail/DetectorInterna.h | 347 ++-- DDCore/include/DD4hep/detail/Handle.inl | 16 +- DDCore/include/DD4hep/detail/ObjectsInterna.h | 355 ++-- DDCore/include/DD4hep/detail/OpaqueData_inl.h | 8 +- DDCore/include/DD4hep/detail/Plugins.inl | 12 +- .../DD4hep/detail/SegmentationsInterna.h | 188 ++- .../DD4hep/detail/VolumeManagerInterna.h | 95 +- DDCore/include/JSON/ChildValue.h | 4 +- DDCore/include/JSON/ChildValue.inl | 4 +- DDCore/include/JSON/Conversions.h | 4 +- DDCore/include/JSON/Detector.h | 4 +- DDCore/include/JSON/Dimension.h | 4 +- DDCore/include/JSON/Dimension.inl | 4 +- DDCore/include/JSON/DocumentHandler.h | 10 +- DDCore/include/JSON/Elements.h | 12 +- DDCore/include/JSON/Evaluator.h | 4 +- DDCore/include/JSON/Helper.h | 39 +- DDCore/include/JSON/Printout.h | 4 +- DDCore/include/JSON/Tags.h | 4 +- DDCore/include/JSON/config.h | 10 +- DDCore/include/ROOT/LinkDef.h | 2 +- DDCore/include/XML/Conversions.h | 4 +- DDCore/include/XML/DocumentHandler.h | 10 +- DDCore/include/XML/Evaluator.h | 2 +- DDCore/include/XML/Helper.h | 36 +- DDCore/include/XML/Layering.h | 73 +- DDCore/include/XML/Printout.h | 4 +- DDCore/include/XML/UnicodeValues.h | 4 +- DDCore/include/XML/UriReader.h | 10 +- DDCore/include/XML/Utilities.h | 26 +- DDCore/include/XML/XML.h | 29 +- DDCore/include/XML/XMLChildValue.h | 4 +- DDCore/include/XML/XMLChildValue.inl | 4 +- DDCore/include/XML/XMLDetector.h | 4 +- DDCore/include/XML/XMLDimension.h | 4 +- DDCore/include/XML/XMLDimension.inl | 4 +- DDCore/include/XML/XMLElements.h | 12 +- DDCore/include/XML/XMLParsers.h | 32 +- DDCore/include/XML/XMLTags.h | 14 +- DDCore/include/XML/config.h | 6 +- DDCore/include/XML/detail/ChildValue.h | 10 +- DDCore/include/XML/detail/ChildValue.imp | 2 +- DDCore/include/XML/detail/ChildValue.inl | 12 +- DDCore/include/XML/detail/Conversions.h | 18 +- DDCore/include/XML/detail/Detector.h | 14 +- DDCore/include/XML/detail/Detector.imp | 16 +- DDCore/include/XML/detail/Dimension.h | 10 +- DDCore/include/XML/detail/Dimension.imp | 22 +- DDCore/include/XML/detail/Dimension.inl | 26 +- DDCore/include/XML/tinyxml.h | 54 +- DDCore/python/lcdd.py | 160 +- DDCore/src/AlignmentData.cpp | 5 +- DDCore/src/AlignmentNominalMap.cpp | 33 +- DDCore/src/AlignmentTools.cpp | 39 +- DDCore/src/Alignments.cpp | 22 +- DDCore/src/AlignmentsCalculator.cpp | 41 +- DDCore/src/AlignmentsInterna.cpp | 12 +- DDCore/src/AlignmentsPrinter.cpp | 22 +- DDCore/src/AlignmentsProcessor.cpp | 29 +- DDCore/src/BasicGrammar.cpp | 10 +- DDCore/src/BasicGrammarTypes.cpp | 2 +- DDCore/src/BuildType.cpp | 6 +- DDCore/src/Callback.cpp | 4 +- DDCore/src/CartesianGridXY.cpp | 6 +- DDCore/src/CartesianGridXYZ.cpp | 6 +- DDCore/src/CartesianGridXZ.cpp | 6 +- DDCore/src/CartesianGridYZ.cpp | 6 +- DDCore/src/ComponentProperties.cpp | 8 +- DDCore/src/ConditionDerived.cpp | 18 +- DDCore/src/Conditions.cpp | 36 +- DDCore/src/ConditionsData.cpp | 8 +- DDCore/src/ConditionsInterna.cpp | 29 +- DDCore/src/ConditionsListener.cpp | 4 +- DDCore/src/ConditionsMap.cpp | 112 +- DDCore/src/ConditionsPrinter.cpp | 18 +- DDCore/src/ConditionsProcessor.cpp | 14 +- DDCore/src/ConditonsTypes.cpp | 2 +- DDCore/src/DD4hepRootPersistency.cpp | 21 +- DDCore/src/DD4hepUI.cpp | 50 +- DDCore/src/{Detector.cpp => DetElement.cpp} | 65 +- DDCore/src/{LCDDData.cpp => DetectorData.cpp} | 25 +- .../{LCDDHelper.cpp => DetectorHelper.cpp} | 24 +- DDCore/src/{LCDDImp.cpp => DetectorImp.cpp} | 188 ++- DDCore/src/DetectorImp.h | 355 ++++ DDCore/src/DetectorInterna.cpp | 105 +- DDCore/src/{LCDDLoad.cpp => DetectorLoad.cpp} | 70 +- DDCore/src/DetectorProcessor.cpp | 5 +- DDCore/src/DetectorSelector.cpp | 14 +- DDCore/src/DetectorTools.cpp | 97 +- DDCore/src/Errors.cpp | 4 +- DDCore/src/Evaluator/ExpressionEvaluator.cpp | 22 +- DDCore/src/Evaluator/setStdMath.cpp | 15 +- DDCore/src/Exceptions.cpp | 4 +- DDCore/src/FieldTypes.cpp | 10 +- DDCore/src/Fields.cpp | 4 +- DDCore/src/GeoHandler.cpp | 25 +- DDCore/src/GeometryTreeDump.cpp | 40 +- DDCore/src/GeometryTreeDump.h | 32 +- DDCore/src/GlobalAlignment.cpp | 60 +- DDCore/src/GridPhiEta.cpp | 4 +- DDCore/src/GridRPhiEta.cpp | 4 +- DDCore/src/Handle.cpp | 82 +- DDCore/src/IDDescriptor.cpp | 35 +- DDCore/src/IOV.cpp | 4 +- DDCore/src/InstanceCount.cpp | 4 +- DDCore/src/JSON/DocumentHandler.cpp | 4 +- DDCore/src/JSON/Elements.cpp | 84 +- DDCore/src/JSON/Helpers.cpp | 8 +- DDCore/src/LCDDImp.h | 376 ----- DDCore/src/MatrixHelpers.cpp | 50 +- DDCore/src/MultiSegmentation.cpp | 6 +- DDCore/src/NamedObject.cpp | 6 +- DDCore/src/NoSegmentation.cpp | 6 +- DDCore/src/ObjectExtensions.cpp | 71 +- DDCore/src/ObjectPrintout.cpp | 29 +- DDCore/src/Objects.cpp | 73 +- DDCore/src/ObjectsInterna.cpp | 6 +- DDCore/src/OpaqueData.cpp | 4 +- DDCore/src/OpaqueDataBinder.cpp | 614 +++---- DDCore/src/Path.cpp | 4 +- DDCore/src/PluginCreators.cpp | 32 +- DDCore/src/PluginTester.cpp | 12 +- DDCore/src/Plugins.cpp | 26 +- DDCore/src/PolarGridRPhi.cpp | 6 +- DDCore/src/PolarGridRPhi2.cpp | 6 +- DDCore/src/Primitives.cpp | 136 +- DDCore/src/Printout.cpp | 124 +- DDCore/src/Readout.cpp | 18 +- DDCore/src/Segmentations.cpp | 14 +- DDCore/src/SegmentationsInterna.cpp | 20 +- DDCore/src/Shapes.cpp | 201 +-- DDCore/src/SimpleGDMLWriter.cpp | 43 +- DDCore/src/SimpleGDMLWriter.h | 26 +- DDCore/src/SurfaceInstaller.cpp | 20 +- DDCore/src/ToStream.cpp | 12 +- DDCore/src/VolumeManager.cpp | 395 ++--- DDCore/src/VolumeManagerInterna.cpp | 41 +- DDCore/src/Volumes.cpp | 72 +- DDCore/src/WaferGridXY.cpp | 6 +- DDCore/src/World.cpp | 9 +- DDCore/src/XML/DocumentHandler.cpp | 50 +- DDCore/src/XML/Layering.cpp | 51 +- DDCore/src/XML/UriReader.cpp | 22 +- DDCore/src/XML/Utilities.cpp | 36 +- DDCore/src/XML/XMLElements.cpp | 144 +- DDCore/src/XML/XMLHelpers.cpp | 8 +- DDCore/src/XML/XMLParsers.cpp | 53 +- DDCore/src/XML/XMLTags.cpp | 16 +- DDCore/src/XML/tinyxml_inl.h | 50 +- DDCore/src/XML/tinyxmlparser_inl.h | 2 +- DDCore/src/parsers/Evaluators.cpp | 16 +- DDCore/src/parsers/GrammarsV2.h | 10 +- .../ParserStandardList_Mapint_bool.cpp | 4 +- .../ParserStandardList_Mapint_double.cpp | 4 +- .../ParserStandardList_Mapint_float.cpp | 4 +- .../parsers/ParserStandardList_Mapint_int.cpp | 4 +- .../ParserStandardList_Mapint_long.cpp | 4 +- .../ParserStandardList_Mapint_string.cpp | 4 +- .../ParserStandardList_Mapped_bool.cpp | 4 +- .../ParserStandardList_Mapped_double.cpp | 4 +- .../ParserStandardList_Mapped_float.cpp | 4 +- .../parsers/ParserStandardList_Mapped_int.cpp | 4 +- .../ParserStandardList_Mapped_long.cpp | 4 +- .../ParserStandardList_Mapped_string.cpp | 4 +- .../ParserStandardList_Mapstring_bool.cpp | 4 +- .../ParserStandardList_Mapstring_double.cpp | 4 +- .../ParserStandardList_Mapstring_float.cpp | 4 +- .../ParserStandardList_Mapstring_int.cpp | 4 +- .../ParserStandardList_Mapstring_long.cpp | 4 +- .../ParserStandardList_Mapstring_string.cpp | 4 +- .../parsers/ParserStandardList_list_bool.cpp | 4 +- .../ParserStandardList_list_double.cpp | 4 +- .../parsers/ParserStandardList_list_float.cpp | 4 +- .../parsers/ParserStandardList_list_int.cpp | 4 +- .../parsers/ParserStandardList_list_long.cpp | 4 +- .../ParserStandardList_list_string.cpp | 4 +- .../parsers/ParserStandardList_set_bool.cpp | 4 +- .../parsers/ParserStandardList_set_double.cpp | 4 +- .../parsers/ParserStandardList_set_float.cpp | 4 +- .../parsers/ParserStandardList_set_int.cpp | 4 +- .../parsers/ParserStandardList_set_long.cpp | 4 +- .../parsers/ParserStandardList_set_string.cpp | 4 +- .../ParserStandardList_vector_bool.cpp | 4 +- .../ParserStandardList_vector_double.cpp | 4 +- .../ParserStandardList_vector_float.cpp | 4 +- .../parsers/ParserStandardList_vector_int.cpp | 4 +- .../ParserStandardList_vector_long.cpp | 4 +- .../ParserStandardList_vector_string.cpp | 4 +- DDCore/src/parsers/ParsersFactory.h | 12 +- .../parsers/ParsersObjects_PxPyPzEVector.cpp | 4 +- .../src/parsers/ParsersObjects_XYZPoint.cpp | 4 +- .../src/parsers/ParsersObjects_XYZVector.cpp | 4 +- .../src/parsers/ParsersStandardListCommon.h | 6 +- DDCore/src/parsers/ParsersStandardMisc1.cpp | 18 +- DDCore/src/parsers/ParsersStandardMisc2.cpp | 6 +- DDCore/src/parsers/ParsersStandardMisc3.cpp | 6 +- DDCore/src/parsers/ParsersStandardMisc4.cpp | 10 +- DDCore/src/parsers/ParsersStandardMisc5.cpp | 12 +- .../src/parsers/ParsersStandardMiscCommon.h | 2 +- DDCore/src/parsers/ParsersStandardSingle.cpp | 2 +- DDCore/src/parsers/UsedParser.h | 6 +- DDCore/src/plugins/Compact2Objects.cpp | 370 ++--- DDCore/src/plugins/DetectorFields.cpp | 78 + ...DHelperTest.cpp => DetectorHelperTest.cpp} | 48 +- DDCore/src/plugins/Geant4XML.cpp | 37 +- DDCore/src/plugins/GeometryWalk.cpp | 55 +- DDCore/src/plugins/JsonProcessor.cpp | 36 +- DDCore/src/plugins/LCDD2Output.cpp | 12 +- DDCore/src/plugins/LCDDConverter.cpp | 386 ++--- DDCore/src/plugins/LCDDConverter.h | 70 +- DDCore/src/plugins/LCDDFields.cpp | 79 - DDCore/src/plugins/PandoraConverter.cpp | 42 +- DDCore/src/plugins/PluginInvoker.cpp | 30 +- ...entations.cpp => ReadoutSegmentations.cpp} | 40 +- DDCore/src/plugins/ShapePlugins.cpp | 42 +- DDCore/src/plugins/StandardPlugins.cpp | 364 +++-- DDCore/src/plugins/VolumeMgrTest.cpp | 77 +- DDDB/CMakeLists.txt | 2 +- DDDB/include/DDDB/DDDBConditionsLoader.h | 35 +- DDDB/include/DDDB/DDDBConversion.h | 292 ++-- DDDB/include/DDDB/DDDBDimension.h | 14 +- DDDB/include/DDDB/DDDBHelper.h | 30 +- DDDB/include/DDDB/DDDBReader.h | 10 +- DDDB/include/DDDB/DDDBReaderContext.h | 10 +- DDDB/include/DDDB/DDDBTags.h | 10 +- DDDB/src/DDDBConditionsLoader.cpp | 87 +- DDDB/src/DDDBConversion.cpp | 139 +- DDDB/src/DDDBDimension.cpp | 96 +- DDDB/src/DDDBHelper.cpp | 30 +- DDDB/src/DDDBReader.cpp | 20 +- DDDB/src/DDDBTags.cpp | 4 +- DDDB/src/plugins/CondDB2DDDB.cpp | 831 +++++----- DDDB/src/plugins/DDDB2Objects.cpp | 425 +++-- DDDB/src/plugins/DDDBAlignmentTest.cpp | 52 +- DDDB/src/plugins/DDDBDerivedCondTest.cpp | 86 +- DDDB/src/plugins/DDDBDetectorDumps.cpp | 58 +- DDDB/src/plugins/DDDBExecutor.cpp | 46 +- DDDB/src/plugins/DDDBFileReader.cpp | 20 +- DDDB/src/plugins/DDDBLogVolumeDump.cpp | 12 +- DDDB/src/plugins/DDDBPlugins.cpp | 27 +- DDDB/src/plugins/DDDBvis.cpp | 49 +- DDDetectors/CMakeLists.txt | 2 +- DDDetectors/compact/SiD/SiD_Beamcal.xml | 2 +- DDDetectors/compact/SiD/SiD_Beampipe.xml | 26 +- DDDetectors/compact/SiD/SiD_EcalBarrel.xml | 2 +- DDDetectors/compact/SiD/SiD_EcalEndcap.xml | 2 +- DDDetectors/compact/SiD/SiD_HcalBarrel.xml | 2 +- DDDetectors/compact/SiD/SiD_HcalEndcap.xml | 2 +- DDDetectors/compact/SiD/SiD_HcalPlug.xml | 2 +- DDDetectors/compact/SiD/SiD_Lumical.xml | 6 +- DDDetectors/compact/SiD/SiD_MuonBarrel.xml | 2 +- DDDetectors/compact/SiD/SiD_MuonEndcap.xml | 2 +- DDDetectors/compact/SiD/SiD_Shields.xml | 18 +- DDDetectors/compact/SiD/SiD_Solenoid.xml | 8 +- DDDetectors/compact/SiD/SiD_TrackerBarrel.xml | 2 +- DDDetectors/compact/SiD/SiD_TrackerEndcap.xml | 2 +- .../compact/SiD/SiD_TrackerForward.xml | 2 +- .../compact/SiD/SiD_TrackerSupport.xml | 52 +- DDDetectors/compact/SiD/SiD_VertexBarrel.xml | 2 +- DDDetectors/compact/SiD/SiD_VertexEndcap.xml | 2 +- DDDetectors/compact/SiD/SiD_VertexSupport.xml | 22 +- DDDetectors/compact/SiD_Markus.xml | 4 +- DDDetectors/doc/README.ExtensionPlugins | 20 +- DDDetectors/doc/README.SiD | 56 +- .../DDDetectors/OtherDetectorHelpers.h | 6 +- DDDetectors/src/Beampipe_o1_v01_geo.cpp | 122 +- DDDetectors/src/BoxSegment_geo.cpp | 20 +- DDDetectors/src/CaloFaceBarrel_surfaces.cpp | 24 +- DDDetectors/src/CaloFaceEndcap_surfaces.cpp | 24 +- DDDetectors/src/CylinderShell_geo.cpp | 16 +- .../src/CylindricalBarrelCalorimeter_geo.cpp | 22 +- .../src/CylindricalEndcapCalorimeter_geo.cpp | 22 +- DDDetectors/src/DiskTracker_geo.cpp | 20 +- DDDetectors/src/EcalBarrel_geo.cpp | 26 +- DDDetectors/src/ForwardDetector_geo.cpp | 22 +- DDDetectors/src/GenericSurfaceInstaller.cpp | 28 +- DDDetectors/src/LayeringExtensionPlugin.cpp | 6 +- DDDetectors/src/Mask_o1_v01_geo.cpp | 75 +- DDDetectors/src/MultiLayerTracker_geo.cpp | 20 +- DDDetectors/src/PolyconeSupport_geo.cpp | 20 +- .../src/PolyhedraBarrelCalorimeter2_geo.cpp | 26 +- .../src/PolyhedraEndcapCalorimeter2_geo.cpp | 24 +- .../PolyhedraEndcapCalorimeter2_surfaces.cpp | 14 +- DDDetectors/src/SiTrackerBarrel_geo.cpp | 30 +- DDDetectors/src/SiTrackerBarrel_surfaces.cpp | 19 +- DDDetectors/src/SiTrackerEndcap2_geo.cpp | 22 +- DDDetectors/src/SiTrackerEndcap_surfaces.cpp | 13 +- DDDetectors/src/Solenoid_o1_v01_gep.cpp | 33 +- DDDetectors/src/SubdetectorAssembly_geo.cpp | 22 +- .../src/SubdetectorExtensionPlugin.cpp | 7 +- DDDetectors/src/SurfaceExamplePlugin.cpp | 9 +- DDDetectors/src/TubeSegment_geo.cpp | 20 +- DDEve/CMakeLists.txt | 2 +- DDEve/DDEve/DDEve.C | 10 +- DDEve/DDEve/DDG4IO.C | 12 +- DDEve/DDEve/IO.cpp | 2 +- DDEve/include/DDEve/Annotation.h | 6 +- DDEve/include/DDEve/Calo2DProjection.h | 6 +- DDEve/include/DDEve/Calo3DProjection.h | 6 +- DDEve/include/DDEve/CaloLego.h | 6 +- DDEve/include/DDEve/ContextMenu.h | 8 +- DDEve/include/DDEve/DD4hepMenu.h | 16 +- DDEve/include/DDEve/DDEveEventData.h | 6 +- DDEve/include/DDEve/DDG4EventHandler.h | 8 +- DDEve/include/DDEve/Dictionary.h | 76 +- DDEve/include/DDEve/Display.h | 16 +- DDEve/include/DDEve/DisplayConfiguration.h | 6 +- DDEve/include/DDEve/ElementList.h | 6 +- .../DDEve/EvePgonSetProjectedContextMenu.h | 6 +- DDEve/include/DDEve/EveShapeContextMenu.h | 6 +- DDEve/include/DDEve/EveUserContextMenu.h | 6 +- DDEve/include/DDEve/EventControl.h | 6 +- DDEve/include/DDEve/EventHandler.h | 8 +- DDEve/include/DDEve/Factories.h | 6 +- DDEve/include/DDEve/FrameControl.h | 6 +- DDEve/include/DDEve/GenericEventHandler.h | 6 +- DDEve/include/DDEve/HitActors.h | 6 +- DDEve/include/DDEve/MultiView.h | 6 +- DDEve/include/DDEve/ParticleActors.h | 6 +- DDEve/include/DDEve/PopupMenu.h | 6 +- DDEve/include/DDEve/Projection.h | 6 +- DDEve/include/DDEve/RhoPhiProjection.h | 6 +- DDEve/include/DDEve/RhoZProjection.h | 6 +- DDEve/include/DDEve/Utilities.h | 10 +- DDEve/include/DDEve/View.h | 11 +- DDEve/include/DDEve/View3D.h | 6 +- DDEve/include/DDEve/ViewMenu.h | 6 +- DDEve/lcio/LCIOEventHandler.cpp | 6 +- DDEve/lcio/LCIOEventHandler.h | 8 +- DDEve/src/Annotation.cpp | 4 +- DDEve/src/Calo2DProjection.cpp | 4 +- DDEve/src/Calo3DProjection.cpp | 4 +- DDEve/src/CaloLego.cpp | 4 +- DDEve/src/ContextMenu.cpp | 4 +- DDEve/src/DD4hepMenu.cpp | 47 +- DDEve/src/DDEveEventData.cpp | 4 +- DDEve/src/DDEvePlugins.cpp | 4 +- DDEve/src/DDG4EventHandler.cpp | 18 +- DDEve/src/Display.cpp | 42 +- DDEve/src/DisplayConfiguration.cpp | 4 +- DDEve/src/DisplayConfigurationParser.cpp | 42 +- DDEve/src/ElementList.cpp | 4 +- DDEve/src/EvePgonSetProjectedContextMenu.cpp | 4 +- DDEve/src/EveShapeContextMenu.cpp | 4 +- DDEve/src/EveUserContextMenu.cpp | 4 +- DDEve/src/EventControl.cpp | 12 +- DDEve/src/EventHandler.cpp | 4 +- DDEve/src/FrameControl.cpp | 4 +- DDEve/src/GenericEventHandler.cpp | 10 +- DDEve/src/HitActors.cpp | 6 +- DDEve/src/MultiView.cpp | 12 +- DDEve/src/ParticleActors.cpp | 4 +- DDEve/src/PopupMenu.cpp | 6 +- DDEve/src/Projection.cpp | 4 +- DDEve/src/RhoPhiProjection.cpp | 4 +- DDEve/src/RhoZProjection.cpp | 4 +- DDEve/src/Utilities.cpp | 10 +- DDEve/src/View.cpp | 16 +- DDEve/src/View3D.cpp | 4 +- DDEve/src/ViewMenu.cpp | 20 +- DDG4/CMakeLists.txt | 6 +- DDG4/ddsim.cpp | 8 +- DDG4/examples/CLICSidSimuLCIO.py | 2 +- DDG4/examples/CLICSidSimuMarkus.py | 10 +- DDG4/examples/SiDSim.py | 6 +- DDG4/examples/SiDSim_MT.py | 6 +- DDG4/examples/SiD_Markus.py | 6 +- DDG4/examples/TEve.C | 10 +- DDG4/examples/initAClick.C | 2 +- DDG4/examples/readHEPMC.py | 6 +- DDG4/examples/run.C | 2 +- DDG4/g4FromXML.cpp | 8 +- DDG4/g4gdmlDisplay.cpp | 4 +- DDG4/include/DDG4/ComponentUtils.h | 6 +- DDG4/include/DDG4/DDG4Dict.h | 70 +- DDG4/include/DDG4/Defs.h | 20 +- DDG4/include/DDG4/Factories.h | 67 +- DDG4/include/DDG4/Geant4Action.h | 10 +- DDG4/include/DDG4/Geant4ActionContainer.h | 10 +- DDG4/include/DDG4/Geant4ActionPhase.h | 10 +- DDG4/include/DDG4/Geant4AssemblyVolume.h | 6 +- DDG4/include/DDG4/Geant4Call.h | 10 +- DDG4/include/DDG4/Geant4Callback.h | 4 +- DDG4/include/DDG4/Geant4Config.h | 12 +- DDG4/include/DDG4/Geant4Context.h | 32 +- DDG4/include/DDG4/Geant4Converter.h | 20 +- DDG4/include/DDG4/Geant4Data.h | 10 +- DDG4/include/DDG4/Geant4DataConversion.h | 33 +- DDG4/include/DDG4/Geant4DataDump.h | 10 +- .../include/DDG4/Geant4DetectorConstruction.h | 40 +- DDG4/include/DDG4/Geant4EventAction.h | 11 +- DDG4/include/DDG4/Geant4EventSeed.h | 11 +- DDG4/include/DDG4/Geant4Field.h | 24 +- DDG4/include/DDG4/Geant4GDMLDetector.h | 6 +- DDG4/include/DDG4/Geant4GeneratorAction.h | 10 +- DDG4/include/DDG4/Geant4GeneratorActionInit.h | 10 +- DDG4/include/DDG4/Geant4GeneratorWrapper.h | 10 +- DDG4/include/DDG4/Geant4GeometryInfo.h | 86 +- DDG4/include/DDG4/Geant4Handle.h | 39 +- DDG4/include/DDG4/Geant4HierarchyDump.h | 17 +- DDG4/include/DDG4/Geant4HitCollection.h | 10 +- DDG4/include/DDG4/Geant4Hits.h | 10 +- DDG4/include/DDG4/Geant4InputAction.h | 12 +- DDG4/include/DDG4/Geant4InputHandling.h | 10 +- DDG4/include/DDG4/Geant4InteractionMerger.h | 10 +- .../DDG4/Geant4InteractionVertexBoost.h | 10 +- .../DDG4/Geant4InteractionVertexSmear.h | 10 +- DDG4/include/DDG4/Geant4IsotropeGenerator.h | 10 +- DDG4/include/DDG4/Geant4Kernel.h | 27 +- DDG4/include/DDG4/Geant4Mapping.h | 41 +- DDG4/include/DDG4/Geant4MonteCarloTruth.h | 10 +- DDG4/include/DDG4/Geant4Output2ROOT.h | 10 +- DDG4/include/DDG4/Geant4OutputAction.h | 10 +- DDG4/include/DDG4/Geant4Particle.h | 10 +- DDG4/include/DDG4/Geant4ParticleGenerator.h | 10 +- DDG4/include/DDG4/Geant4ParticleGun.h | 10 +- DDG4/include/DDG4/Geant4ParticleHandler.h | 10 +- DDG4/include/DDG4/Geant4ParticlePrint.h | 10 +- DDG4/include/DDG4/Geant4PhysicsConstructor.h | 10 +- DDG4/include/DDG4/Geant4PhysicsList.h | 10 +- DDG4/include/DDG4/Geant4Primary.h | 10 +- DDG4/include/DDG4/Geant4PrimaryHandler.h | 10 +- DDG4/include/DDG4/Geant4Primitives.h | 10 +- DDG4/include/DDG4/Geant4Random.h | 10 +- DDG4/include/DDG4/Geant4ReadoutVolumeFilter.h | 25 +- DDG4/include/DDG4/Geant4RunAction.h | 10 +- DDG4/include/DDG4/Geant4SensDetAction.h | 57 +- DDG4/include/DDG4/Geant4SensDetAction.inl | 23 +- DDG4/include/DDG4/Geant4SensitiveDetector.h | 19 +- .../DDG4/Geant4SensitiveDetector_inline.h | 18 +- DDG4/include/DDG4/Geant4StackingAction.h | 10 +- DDG4/include/DDG4/Geant4StepHandler.h | 10 +- DDG4/include/DDG4/Geant4SteppingAction.h | 10 +- DDG4/include/DDG4/Geant4TestActions.h | 12 +- DDG4/include/DDG4/Geant4TouchableHandler.h | 10 +- DDG4/include/DDG4/Geant4TrackHandler.h | 10 +- DDG4/include/DDG4/Geant4TrackInformation.h | 10 +- DDG4/include/DDG4/Geant4TrackingAction.h | 10 +- DDG4/include/DDG4/Geant4TrackingPostAction.h | 10 +- DDG4/include/DDG4/Geant4TrackingPreAction.h | 10 +- DDG4/include/DDG4/Geant4UIManager.h | 10 +- DDG4/include/DDG4/Geant4UIMessenger.h | 10 +- DDG4/include/DDG4/Geant4UserInitialization.h | 10 +- DDG4/include/DDG4/Geant4UserParticleHandler.h | 10 +- DDG4/include/DDG4/Geant4Vertex.h | 10 +- DDG4/include/DDG4/Geant4VolumeManager.h | 65 +- DDG4/include/DDG4/IoStreams.h | 10 +- DDG4/include/DDG4/Python/DDPython.h | 4 +- DDG4/include/DDG4/Python/Geant4PythonAction.h | 10 +- DDG4/include/DDG4/Python/Geant4PythonCall.h | 10 +- .../Python/Geant4PythonDetectorConstruction.h | 10 +- .../DDG4/Python/Geant4PythonInitialization.h | 10 +- DDG4/include/DDG4/Python/PyDDG4.h | 12 +- DDG4/lcio/Geant4Output2LCIO.cpp | 29 +- DDG4/lcio/LCIOConversions.cpp | 18 +- DDG4/lcio/LCIOEventReader.cpp | 10 +- DDG4/lcio/LCIOEventReader.h | 10 +- DDG4/lcio/LCIOFileReader.cpp | 21 +- DDG4/lcio/LCIOSDTestActions.cpp | 13 +- DDG4/lcio/LCIOStdHepReader.cpp | 17 +- DDG4/legacy/Geant4CalorimeterSD.cpp | 24 +- DDG4/legacy/Geant4TrackerCombineSD.cpp | 10 +- DDG4/legacy/Geant4TrackerSD.cpp | 10 +- DDG4/plugins/Geant4.10.PhysicsConstructors.h | 2 +- DDG4/plugins/Geant4.9.PhysicsConstructors.h | 2 +- DDG4/plugins/Geant4DefaultRangeCut.cpp | 8 +- .../Geant4DetectorGeometryConstruction.cpp | 24 +- .../Geant4DetectorSensitivesConstruction.cpp | 36 +- DDG4/plugins/Geant4EscapeCounter.cpp | 28 +- DDG4/plugins/Geant4EventReaderGuineaPig.cpp | 54 +- DDG4/plugins/Geant4EventReaderHepEvt.cpp | 20 +- DDG4/plugins/Geant4EventReaderHepMC.cpp | 36 +- DDG4/plugins/Geant4EventSeed.cpp | 10 +- DDG4/plugins/Geant4ExtraParticles.cpp | 8 +- DDG4/plugins/Geant4ExtraParticles.h | 4 +- DDG4/plugins/Geant4Factories.cpp | 8 +- DDG4/plugins/Geant4FieldTrackingSetup.cpp | 42 +- DDG4/plugins/Geant4HitDumpAction.cpp | 16 +- DDG4/plugins/Geant4HitExtractor.cpp | 14 +- DDG4/plugins/Geant4HitTruthHandler.cpp | 16 +- DDG4/plugins/Geant4MaterialScanner.cpp | 16 +- DDG4/plugins/Geant4ParticleDumpAction.cpp | 16 +- DDG4/plugins/Geant4Particles.cpp | 2 +- DDG4/plugins/Geant4PhysicsConstructors.cpp | 2 +- DDG4/plugins/Geant4PrimaryGenerators.cpp | 2 +- DDG4/plugins/Geant4Processes.cpp | 2 +- DDG4/plugins/Geant4ROOTDump.cpp | 17 +- DDG4/plugins/Geant4SDActions.cpp | 23 +- DDG4/plugins/Geant4SensDet.cpp | 30 +- DDG4/plugins/Geant4SensDetFilters.cpp | 10 +- DDG4/plugins/Geant4Steppers.cpp | 2 +- DDG4/plugins/Geant4TCUserParticleHandler.cpp | 18 +- DDG4/plugins/Geant4TrackerWeightedSD.cpp | 10 +- .../Geant4UserActionInitialization.cpp | 14 +- DDG4/plugins/Geant4XMLSetup.cpp | 128 +- DDG4/pyddg4.cpp | 10 +- DDG4/python/DD4hep.py | 226 --- DDG4/python/DDG4.py | 40 +- DDG4/python/DDG4Dict.C | 18 +- DDG4/python/checkGeometry.py | 16 +- DDG4/python/checkOverlaps.py | 16 +- DDG4/python/g4MaterialScan.py | 8 +- DDG4/reco/Geant4SurfaceTest.cpp | 22 +- DDG4/scripts/dumpDDG4.C | 52 +- DDG4/src/Geant4Action.cpp | 34 +- DDG4/src/Geant4ActionContainer.cpp | 25 +- DDG4/src/Geant4ActionPhase.cpp | 10 +- DDG4/src/Geant4Call.cpp | 4 +- DDG4/src/Geant4Context.cpp | 14 +- DDG4/src/Geant4Converter.cpp | 79 +- DDG4/src/Geant4Converter.cpp.save | 40 +- DDG4/src/Geant4Data.cpp | 6 +- DDG4/src/Geant4DataConversion.cpp | 19 +- DDG4/src/Geant4DataDump.cpp | 8 +- DDG4/src/Geant4DetectorConstruction.cpp | 18 +- DDG4/src/Geant4EventAction.cpp | 7 +- DDG4/src/Geant4Exec.cpp | 31 +- DDG4/src/Geant4Field.cpp | 10 +- DDG4/src/Geant4GDMLDetector.cpp | 8 +- DDG4/src/Geant4GeneratorAction.cpp | 7 +- DDG4/src/Geant4GeneratorActionInit.cpp | 4 +- DDG4/src/Geant4GeneratorWrapper.cpp | 6 +- DDG4/src/Geant4GeometryInfo.cpp | 6 +- DDG4/src/Geant4Handle.cpp | 48 +- DDG4/src/Geant4HierarchyDump.cpp | 13 +- DDG4/src/Geant4HitCollection.cpp | 6 +- DDG4/src/Geant4Hits.cpp | 4 +- DDG4/src/Geant4InputAction.cpp | 8 +- DDG4/src/Geant4InputHandling.cpp | 24 +- DDG4/src/Geant4InteractionMerger.cpp | 4 +- DDG4/src/Geant4InteractionVertexBoost.cpp | 4 +- DDG4/src/Geant4InteractionVertexSmear.cpp | 4 +- DDG4/src/Geant4IsotropeGenerator.cpp | 4 +- DDG4/src/Geant4Kernel.cpp | 70 +- DDG4/src/Geant4Mapping.cpp | 18 +- DDG4/src/Geant4MonteCarloTruth.cpp | 4 +- DDG4/src/Geant4Output2ROOT.cpp | 12 +- DDG4/src/Geant4OutputAction.cpp | 6 +- DDG4/src/Geant4Particle.cpp | 24 +- DDG4/src/Geant4ParticleGenerator.cpp | 4 +- DDG4/src/Geant4ParticleGun.cpp | 4 +- DDG4/src/Geant4ParticleHandler.cpp | 12 +- DDG4/src/Geant4ParticlePrint.cpp | 8 +- DDG4/src/Geant4PhysicsConstructor.cpp | 4 +- DDG4/src/Geant4PhysicsList.cpp | 6 +- DDG4/src/Geant4Plugins.cpp | 16 +- DDG4/src/Geant4Primary.cpp | 14 +- DDG4/src/Geant4PrimaryHandler.cpp | 4 +- DDG4/src/Geant4Random.cpp | 6 +- DDG4/src/Geant4ReadoutVolumeFilter.cpp | 7 +- DDG4/src/Geant4RunAction.cpp | 6 +- DDG4/src/Geant4SensDetAction.cpp | 18 +- DDG4/src/Geant4SensitiveDetector.cpp | 42 +- DDG4/src/Geant4StackingAction.cpp | 7 +- DDG4/src/Geant4StepHandler.cpp | 8 +- DDG4/src/Geant4SteppingAction.cpp | 7 +- DDG4/src/Geant4TestActions.cpp | 11 +- DDG4/src/Geant4TouchableHandler.cpp | 6 +- DDG4/src/Geant4TrackInformation.cpp | 6 +- DDG4/src/Geant4TrackingAction.cpp | 9 +- DDG4/src/Geant4TrackingPostAction.cpp | 4 +- DDG4/src/Geant4TrackingPreAction.cpp | 4 +- DDG4/src/Geant4UIManager.cpp | 9 +- DDG4/src/Geant4UIMessenger.cpp | 11 +- DDG4/src/Geant4UserInitialization.cpp | 4 +- DDG4/src/Geant4UserParticleHandler.cpp | 4 +- DDG4/src/Geant4Vertex.cpp | 6 +- DDG4/src/Geant4VolumeManager.cpp | 86 +- DDG4/src/IoStreams.cpp | 6 +- DDG4/src/python/DDG4Python.C | 14 +- DDG4/src/python/Geant4PythonAction.cpp | 6 +- DDG4/src/python/Geant4PythonCall.cpp | 8 +- .../Geant4PythonDetectorConstruction.cpp | 4 +- .../Geant4PythonDetectorConstructionLast.cpp | 12 +- .../src/python/Geant4PythonInitialization.cpp | 4 +- DDG4/src/python/PyDDG4.cpp | 14 +- DDG4/tpython/DDPython.C | 12 +- DDG4/tpython/DDPython.cpp | 10 +- DDRec/CMakeLists.txt | 2 +- DDRec/include/DDRec/API/Calorimeter.h | 20 +- DDRec/include/DDRec/API/Exceptions.h | 30 +- DDRec/include/DDRec/API/IDDecoder.h | 47 +- DDRec/include/DDRec/API/LayeredSubdetector.h | 30 +- DDRec/include/DDRec/API/Subdetector.h | 18 +- DDRec/include/DDRec/API/Tracker.h | 22 +- DDRec/include/DDRec/CellIDPositionConverter.h | 21 +- DDRec/include/DDRec/DDGear.h | 8 +- DDRec/include/DDRec/DetectorData.h | 18 +- DDRec/include/DDRec/DetectorSurfaces.h | 7 +- DDRec/include/DDRec/Exceptions.h | 4 +- .../DDRec/Extensions/CalorimeterExtension.h | 16 +- .../DDRec/Extensions/LayeringExtension.h | 25 +- .../DDRec/Extensions/LayeringExtensionImpl.h | 43 +- .../DDRec/Extensions/SubdetectorExtension.h | 19 +- .../Extensions/SubdetectorExtensionImpl.h | 26 +- .../DDRec/Extensions/TrackerExtension.h | 16 +- DDRec/include/DDRec/Material.h | 9 +- DDRec/include/DDRec/MaterialManager.h | 7 +- DDRec/include/DDRec/Surface.h | 6 +- DDRec/include/DDRec/SurfaceHelper.h | 8 +- DDRec/include/DDRec/SurfaceManager.h | 10 +- DDRec/include/DDRec/tempdefs.h | 19 + DDRec/src/CellIDPositionConverter.cpp | 18 +- DDRec/src/DetectorSurfaces.cpp | 2 +- DDRec/src/IDDecoder.cpp | 36 +- DDRec/src/LayeringExtensionImpl.cpp | 22 +- DDRec/src/MaterialManager.cpp | 8 +- DDRec/src/SubdetectorExtensionImpl.cpp | 43 +- DDRec/src/Surface.cpp | 12 +- DDRec/src/SurfaceHelper.cpp | 16 +- DDRec/src/SurfaceManager.cpp | 14 +- DDRec/src/convertToGear.cc | 13 +- DDRec/src/gear/DDGear.cpp | 16 +- DDRec/src/gear/createGearForCLIC.cpp | 50 +- DDRec/src/gear/createGearForILD.cpp | 58 +- DDRec/src/plugins/createSurfaceManager.cpp | 14 +- DDSegmentation/CMakeLists.txt | 2 +- .../cmake/DDSegmentationConfig.cmake.in | 2 +- .../include/DDSegmentation/BitField64.h | 2 +- .../include/DDSegmentation/CartesianGrid.h | 4 +- .../include/DDSegmentation/CartesianGridXY.h | 4 +- .../include/DDSegmentation/CartesianGridXYZ.h | 4 +- .../include/DDSegmentation/CartesianGridXZ.h | 4 +- .../include/DDSegmentation/CartesianGridYZ.h | 4 +- .../DDSegmentation/CylindricalSegmentation.h | 4 +- .../include/DDSegmentation/GridPhiEta.h | 2 +- .../include/DDSegmentation/GridRPhiEta.h | 2 +- .../DDSegmentation/MegatileLayerGridXY.h | 4 +- .../DDSegmentation/MultiSegmentation.h | 6 +- .../include/DDSegmentation/NoSegmentation.h | 4 +- .../include/DDSegmentation/PolarGrid.h | 4 +- .../include/DDSegmentation/PolarGridRPhi.h | 4 +- .../include/DDSegmentation/PolarGridRPhi2.h | 4 +- .../DDSegmentation/ProjectiveCylinder.h | 4 +- .../include/DDSegmentation/Segmentation.h | 4 +- .../DDSegmentation/SegmentationFactory.h | 4 +- .../DDSegmentation/SegmentationParameter.h | 4 +- .../include/DDSegmentation/SegmentationUtil.h | 4 +- .../include/DDSegmentation/TiledLayerGridXY.h | 4 +- .../DDSegmentation/TiledLayerSegmentation.h | 4 +- .../include/DDSegmentation/WaferGridXY.h | 4 +- DDSegmentation/src/BitField64.cpp | 2 +- DDSegmentation/src/CartesianGrid.cpp | 4 +- DDSegmentation/src/CartesianGridXY.cpp | 4 +- DDSegmentation/src/CartesianGridXYZ.cpp | 4 +- DDSegmentation/src/CartesianGridXZ.cpp | 4 +- DDSegmentation/src/CartesianGridYZ.cpp | 4 +- .../src/CylindricalSegmentation.cpp | 4 +- DDSegmentation/src/GridPhiEta.cpp | 2 +- DDSegmentation/src/GridRPhiEta.cpp | 2 +- DDSegmentation/src/MegatileLayerGridXY.cpp | 4 +- DDSegmentation/src/MultiSegmentation.cpp | 4 +- DDSegmentation/src/NoSegmentation.cpp | 4 +- DDSegmentation/src/PolarGrid.cpp | 4 +- DDSegmentation/src/PolarGridRPhi.cpp | 4 +- DDSegmentation/src/PolarGridRPhi2.cpp | 4 +- DDSegmentation/src/ProjectiveCylinder.cpp | 4 +- DDSegmentation/src/Segmentation.cpp | 4 +- DDSegmentation/src/SegmentationFactory.cpp | 4 +- DDSegmentation/src/TiledLayerGridXY.cpp | 8 +- DDSegmentation/src/TiledLayerSegmentation.cpp | 4 +- DDSegmentation/src/WaferGridXY.cpp | 4 +- DDSurfaces/CMakeLists.txt | 2 +- DDTest/CMakeLists.txt | 4 +- DDTest/README | 2 +- DDTest/elements.xml | 2 +- DDTest/include/DD4hep/DDTest.h | 2 +- DDTest/src/STR.h | 2 +- DDTest/src/test_DetType.cc | 2 +- DDTest/src/test_EventReaders.cc | 20 +- DDTest/src/test_PolarGridRPhi2.cc | 18 +- DDTest/src/test_bitfield64.cc | 2 +- DDTest/src/test_cellDimensions.cc | 18 +- DDTest/src/test_cellDimensionsRPhi2.cc | 16 +- DDTest/src/test_example.cc | 2 +- DDTest/src/test_segmentationHandles.cc | 12 +- DDTest/src/test_surface.cc | 14 +- DDTest/src/test_units.cc | 26 +- .../Gaudi/Details/PluginServiceDetails.h | 2 +- GaudiPluginService/interface/DD4hep.cpp | 2 +- README.md | 20 +- UtilityApps/CMakeLists.txt | 4 +- UtilityApps/src/EvNavHandler.h | 2 +- UtilityApps/src/LinkDef.h | 2 +- UtilityApps/src/MultiView.h | 2 +- UtilityApps/src/converter.cpp | 34 +- UtilityApps/src/display.cpp | 4 +- UtilityApps/src/dumpBfield.cpp | 14 +- UtilityApps/src/dumpdetector.cpp | 27 +- UtilityApps/src/graphicalMaterialScan.cpp | 12 +- UtilityApps/src/main.h | 2 +- UtilityApps/src/materialScan.cpp | 10 +- UtilityApps/src/next_event_dummy.cpp | 2 +- UtilityApps/src/next_event_lcio.cpp | 2 +- UtilityApps/src/plugin_runner.cpp | 12 +- UtilityApps/src/print_materials.cpp | 13 +- UtilityApps/src/run_plugin.h | 80 +- .../src/test_cellid_position_converter.cpp | 26 +- UtilityApps/src/test_surfaces.cpp | 21 +- UtilityApps/src/teve_display.cpp | 26 +- bootstrap.sh | 2 +- cmake/DD4hep.cmake | 3 +- cmake/DD4hepBuild.cmake | 2 +- cmake/DD4hepConfig.cmake.in | 2 +- cmake/Doxyfile.in | 2 +- cmake/Version.h.in | 2 +- doc/CHEP2013/DD4hep.tex | 54 +- doc/CREDITS | 6 +- doc/CreateParsers.py | 8 +- doc/DD4hepStartersGuide.html | 124 +- doc/DDAlignManual.pdf | Bin 814481 -> 814481 bytes doc/DDEveManual.pdf | Bin 1447510 -> 1447514 bytes ...Detector_constructor_naming_convention.txt | 6 +- doc/LaTex/AIDA2020-LaTex-template.tar | Bin 409600 -> 409597 bytes doc/LaTex/DD4hep-Overview.tex | 38 +- doc/LaTex/DD4hep-bibliography.tex | 12 +- doc/LaTex/DD4hep-setup.tex | 6 +- doc/LaTex/DD4hepManual.tex | 136 +- doc/LaTex/DD4hepPaper.tex | 8 +- doc/LaTex/DDAlignDesign.tex | 28 +- doc/LaTex/DDAlignManual.V2.tex | 50 +- doc/LaTex/DDAlignManual.tex | 44 +- doc/LaTex/DDConditionsManual.tex | 10 +- doc/LaTex/DDEveManual.tex | 10 +- doc/LaTex/DDG4Manual-Introduction.tex | 2 +- doc/LaTex/DDG4Manual-MT.tex | 8 +- doc/LaTex/DDG4Manual-Setup.tex | 22 +- doc/LaTex/DDG4Manual.tex | 6 +- doc/LaTex/DDRecManual.tex | 98 +- doc/LaTex/LaTex-template/AIDA2020-example.tex | 2 +- doc/LaTex/LaTex-template/setup/lineno.sty | 2 +- doc/LaTex/lineno.sty | 2 +- doc/ReleaseNotes.md | 174 +- doc/build.sh | 2 +- doc/build_doc.sh | 2 +- doc/cmake.cmds | 10 +- doc/doxygen/DD4hepFigures.dox | 10 +- doc/doxygen/DD4hepGroups.h | 30 +- doc/doxygen/DD4hepMainpage.dox | 38 +- doc/external_build.txt | 2 +- doc/externalize/ExpressionEvaluator.cpp | 4 +- doc/externalize/ExtraParsers.cpp | 2 +- doc/externalize/ExtraProperties.cpp | 2 +- doc/externalize/PluginManager.cpp | 2 +- doc/externalize/Printout.cpp | 40 +- doc/externalize/Printout.h | 4 +- doc/externalize/README.txt | 4 +- doc/externalize/externalize_properties.sh | 6 +- doc/externalize/externalize_xml.sh | 6 +- doc/gdml_root.C | 4 +- doc/prepare_a_release.howto | 2 +- doc/web/DD4hepStartersGuide.markup | 124 +- examples/AlignDet/CMakeLists.txt | 28 +- .../AlignDet/compact/AlephTPC_alignment.xml | 2 +- examples/AlignDet/compact/AlephTPC_reset.xml | 2 +- .../AlignDet/compact/AlephTPC_reset_all.xml | 2 +- examples/AlignDet/compact/Telescope.xml | 2 +- examples/AlignDet/drivers/BoxSegment.py | 12 +- examples/AlignDet/drivers/Shelf.py | 22 +- examples/AlignDet/src/AlephTPC_geo.cpp | 56 +- .../AlignDet/src/AlignmentExampleObjects.cpp | 24 +- .../AlignDet/src/AlignmentExampleObjects.h | 45 +- .../src/AlignmentExample_align_telescope.cpp | 32 +- .../AlignDet/src/AlignmentExample_nominal.cpp | 28 +- .../src/AlignmentExample_populate.cpp | 26 +- .../src/AlignmentExample_read_xml.cpp | 28 +- .../AlignDet/src/AlignmentExample_stress.cpp | 22 +- .../AlignDet/src/Alignment_to_Condition.cpp | 17 +- examples/AlignDet/src/BoxDetector_geo.cpp | 14 +- examples/AlignDet/src/Telescope_geo.cpp | 24 +- examples/CLICSiD/CMakeLists.txt | 24 +- examples/CLICSiD/compact/compact.xml | 158 +- examples/CLICSiD/eve/CLICSiD_Events.root | Bin 1278911 -> 1278911 bytes examples/CLICSiD/scripts/CLICSiDAClick.C | 14 +- examples/CLICSiD/scripts/CLICSiDXML.C | 4 +- examples/CLICSiD/scripts/CLICSid.py | 2 +- examples/CLICSiD/scripts/CLIC_G4Gun.py | 2 +- examples/CLICSiD/scripts/testDDPython.py | 2 +- examples/CMakeLists.txt | 11 +- examples/ClientTests/CMakeLists.txt | 26 +- .../compact/Bitfield_SidesTest.xml | 2 +- .../compact/Bitfield_SidesTest2.xml | 2 +- .../ClientTests/compact/DuplicateSysID.xml | 4 +- .../ClientTests/compact/InhibitConstants.xml | 2 +- examples/ClientTests/compact/IronCylinder.xml | 2 +- .../ClientTests/compact/MultiCollections.xml | 2 +- .../compact/MultiSegmentCollections.xml | 2 +- .../compact/MultiSegmentations.xml | 2 +- .../ClientTests/compact/NestedDetectors.xml | 2 +- examples/ClientTests/compact/NestedSimple.xml | 2 +- .../ClientTests/compact/NestedSolenoid.xml | 2 +- .../SiBarrelMultiSensitiveDetector.xml | 2 +- .../SiBarrelMultiSensitiveLongVolID.xml | 2 +- .../ClientTests/compact/SiliconBlock.lcdd | 10 +- examples/ClientTests/compact/SiliconBlock.xml | 4 +- examples/ClientTests/scripts/Assemblies.py | 2 +- examples/ClientTests/scripts/BoxTrafos.C | 10 +- examples/ClientTests/scripts/FCC_Hcal.C | 8 +- examples/ClientTests/scripts/FCC_Hcal.py | 2 +- examples/ClientTests/scripts/LheD_tracker.py | 6 +- examples/ClientTests/scripts/MiniTel.py | 2 +- .../ClientTests/scripts/MultiCollections.py | 2 +- .../scripts/MultiSegmentCollections.py | 2 +- .../ClientTests/scripts/NestedDetectors.py | 2 +- examples/ClientTests/scripts/SiliconBlock.py | 4 +- .../ClientTests/src/Assemblies_VXD_geo.cpp | 28 +- .../ClientTests/src/FCC_HcalBarrel2_geo.cpp | 34 +- .../ClientTests/src/FCC_HcalBarrel_geo.cpp | 32 +- examples/ClientTests/src/IronCylinder_geo.cpp | 18 +- .../src/LheD_tracker_BeamPipe_geo.cpp | 14 +- .../src/LheD_tracker_SiVertexBarrel_geo.cpp | 26 +- .../ClientTests/src/MaterialTester_geo.cpp | 12 +- examples/ClientTests/src/MiniTel.cpp | 19 +- .../ClientTests/src/ORG_HcalBarrel_geo.cpp | 34 +- .../ClientTests/src/SectorBarrelCalorimeter.h | 8 +- .../src/SectorBarrelCalorimeter_geo.cpp | 24 +- .../SiBarrelMultiSensitiveDetector_geo.cpp | 30 +- examples/ClientTests/src_boost/JsonDumper.cpp | 12 +- .../ClientTests/src_boost/MiniTel_json.cpp | 20 +- examples/Conditions/CMakeLists.txt | 10 +- examples/Conditions/data/manager.xml | 6 +- .../src/ConditionExampleObjects.cpp | 35 +- .../Conditions/src/ConditionExampleObjects.h | 46 +- .../Conditions/src/ConditionExample_MT.cpp | 20 +- .../src/ConditionExample_populate.cpp | 20 +- .../src/ConditionExample_stress.cpp | 18 +- .../src/ConditionExample_stress2.cpp | 18 +- examples/Conditions/src/ConditionsExample.cpp | 37 +- examples/Conditions/src/ConditionsTest.cpp | 66 +- examples/Conditions/src/ConditionsTest.h | 14 +- examples/Conditions/xml/Sequence_1.xml | 16 +- examples/Conditions/xml/Sequence_2.xml | 10 +- examples/Conditions/xml/TPC_alignment.xml | 2 +- examples/Conditions/xml/plugins.xml | 18 +- examples/DDDB/CMakeLists.txt | 26 +- examples/DDDB/scripts/extract_dddb.sh | 2 +- examples/DDDB/scripts/run_dddb.sh | 2 +- examples/DDG4/CMakeLists.txt | 2 +- examples/Segmentation/CMakeLists.txt | 10 +- examples/Segmentation/SegmentationTest.cpp | 6 +- examples/SimpleDetector/CMakeLists.txt | 5 +- .../examples/gear_Simple_CLIC.xml | 2 +- .../examples/run_sitracking_SimpleCLIC.xml | 12 +- examples/SimpleDetector/src/AirTube_geo.cpp | 12 +- .../SimpleDetector/src/ZPlanarTracker_geo.cpp | 28 +- 994 files changed, 17650 insertions(+), 19280 deletions(-) create mode 100644 DDCore/include/DD4hep/DetElement.h create mode 100644 DDCore/include/DD4hep/DetectorData.h create mode 100644 DDCore/include/DD4hep/DetectorHelper.h rename DDCore/include/DD4hep/{LCDDLoad.h => DetectorLoad.h} (55%) delete mode 100644 DDCore/include/DD4hep/LCDD.h delete mode 100644 DDCore/include/DD4hep/LCDDData.h delete mode 100644 DDCore/include/DD4hep/LCDDHelper.h rename DDCore/src/{Detector.cpp => DetElement.cpp} (84%) rename DDCore/src/{LCDDData.cpp => DetectorData.cpp} (85%) rename DDCore/src/{LCDDHelper.cpp => DetectorHelper.cpp} (64%) rename DDCore/src/{LCDDImp.cpp => DetectorImp.cpp} (72%) create mode 100644 DDCore/src/DetectorImp.h rename DDCore/src/{LCDDLoad.cpp => DetectorLoad.cpp} (53%) delete mode 100644 DDCore/src/LCDDImp.h create mode 100644 DDCore/src/plugins/DetectorFields.cpp rename DDCore/src/plugins/{LCDDHelperTest.cpp => DetectorHelperTest.cpp} (59%) delete mode 100644 DDCore/src/plugins/LCDDFields.cpp rename DDCore/src/plugins/{LCDDSegmentations.cpp => ReadoutSegmentations.cpp} (58%) delete mode 100644 DDG4/python/DD4hep.py create mode 100644 DDRec/include/DDRec/tempdefs.h diff --git a/CMakeLists.txt b/CMakeLists.txt index bd13f58b4..278e710e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ option(DD4HEP_USE_GEANT4 "Enable the simulation part based on Geant4" OFF) option(DD4HEP_USE_GEAR "Build gear wrapper for backward compatibility" OFF) option(DD4HEP_USE_LCIO "Build lcio extensions" OFF) option(BUILD_TESTING "Enable and build tests" ON) -option(DD4HEP_USE_CXX14 "Build DD4hep using c++14" OFF) +option(DD4HEP_USE_CXX14 "Build dd4hep using c++14" OFF) option(CMAKE_MACOSX_RPATH "Build with rpath on macos" ON) # #----------------------------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ message ( STATUS "ROOT_VERSION: ${ROOT_VERSION}" ) dd4hep_set_compiler_flags() add_subdirectory ( GaudiPluginService) -#---DD4hep functions and macros ------------------------------------------------------- +#---dd4hep functions and macros ------------------------------------------------------- include(DD4hep) include(DD4hepMacros) @@ -138,7 +138,7 @@ OPTION( INSTALL_DOC "Set to OFF to skip build/install Documentation" OFF ) IF( INSTALL_DOC ) INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_BUILD_TOOL} doc)" ) include ( GlobalSVNRevision ) - include ( DD4hepDoxygen ) + include ( dd4hepDoxygen ) ENDIF() #---Configuration------------------------------------------------------------------- diff --git a/CTestConfig.cmake b/CTestConfig.cmake index d69479965..ba0548265 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -4,10 +4,10 @@ ## # The following are required to uses Dart and the Cdash dashboard ## ENABLE_TESTING() ## INCLUDE(CTest) -set(CTEST_PROJECT_NAME "DD4hep") +set(CTEST_PROJECT_NAME "dd4hep") set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "aidasoft.desy.de") -set(CTEST_DROP_LOCATION "/CDash/submit.php?project=DD4hep") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=dd4hep") set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/DDAlign/CMakeLists.txt b/DDAlign/CMakeLists.txt index 9b3259152..8d4a0ad77 100644 --- a/DDAlign/CMakeLists.txt +++ b/DDAlign/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/DDAlign/include/DDAlign/AlignmentTags.h b/DDAlign/include/DDAlign/AlignmentTags.h index ca6fccc6c..d2c2fe56b 100644 --- a/DDAlign/include/DDAlign/AlignmentTags.h +++ b/DDAlign/include/DDAlign/AlignmentTags.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,11 +17,11 @@ // Framework include files #include "XML/XMLElements.h" #ifndef UNICODE -#define UNICODE(x) extern const ::DD4hep::XML::Tag_t Unicode_##x +#define UNICODE(x) extern const ::dd4hep::xml::Tag_t Unicode_##x #endif // Unicode tags known to the alignment section -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities namespace DDAlign { @@ -48,6 +48,6 @@ namespace DD4hep { #undef UNICODE // Do not miss this one! #include "XML/XMLTags.h" -#define _ALU(a) ::DD4hep::DDAlign::Unicode_##a +#define _ALU(a) ::dd4hep::DDAlign::Unicode_##a #endif /* DD4HEP_ALIGNMENT_ALIGNMENT_TAGS_H */ diff --git a/DDAlign/include/DDAlign/AlignmentsCalib.h b/DDAlign/include/DDAlign/AlignmentsCalib.h index f080f78d5..dc91aee90 100644 --- a/DDAlign/include/DDAlign/AlignmentsCalib.h +++ b/DDAlign/include/DDAlign/AlignmentsCalib.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_DDALIGN_ALIGNMENTCALIB_H // Framework includes -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Alignments.h" #include "DD4hep/AlignmentData.h" #include "DD4hep/ConditionsMap.h" @@ -25,10 +25,10 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Alignments { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace align { /// Calib alignment dependencies from conditions /** @@ -42,39 +42,33 @@ namespace DD4hep { public: class Entry; /// Shortcut definitions - typedef Conditions::Condition Condition; - typedef Conditions::ConditionKey ConditionKey; - typedef Conditions::ConditionsMap ConditionsMap; - typedef Condition::key_type key_type; - typedef std::map<key_type,Entry*> UsedConditions; + typedef std::map<Condition::key_type,Entry*> UsedConditions; public: /// Reference to the detector description object - LCDD& lcdd; + Detector& description; /// Reference to the alignment manager object - ConditionsMap& slice; - /// Internal work stack of cached deltas - UsedConditions used; + ConditionsMap& slice; + /// detaill work stack of cached deltas + UsedConditions used; protected: /// Implementation: Add a new entry to the transaction stack. - std::pair<key_type,Entry*> _set(DetElement det, const Delta& delta); + std::pair<Condition::key_type,Entry*> _set(DetElement det, const Delta& delta); public: /// No default constructor AlignmentsCalib() = delete; - /// No copy constructor AlignmentsCalib(const AlignmentsCalib& copy) = delete; - /// Initializing constructor - AlignmentsCalib(LCDD& lcdd, ConditionsMap& mapping); - + AlignmentsCalib(Detector& description, ConditionsMap& mapping); /// Default destructor virtual ~AlignmentsCalib(); - /// No assignment operator AlignmentsCalib& operator=(const AlignmentsCalib& copy) = delete; + /// No move assignment operator + AlignmentsCalib& operator=(AlignmentsCalib&& copy) = delete; /// (1) Add a new entry to an existing DetElement structure. /** @@ -97,7 +91,7 @@ namespace DD4hep { * * The resulting alignment key is returned to the client. If NULL: Failure */ - key_type set(DetElement det, const Delta& delta); + Condition::key_type set(DetElement det, const Delta& delta); /// (2) Add a new entry to an existing DetElement structure. /** @@ -108,7 +102,7 @@ namespace DD4hep { * * The alignment key is returned to the client. If NULL: Failure */ - key_type set(const std::string& path, const Delta& delta); + Condition::key_type set(const std::string& path, const Delta& delta); /// Clear all delta data in the caches transaction stack. void clearDeltas(); @@ -122,6 +116,6 @@ namespace DD4hep { /// Commit all pending transactions. Returns number of altered entries AlignmentsCalculator::Result commit(); }; - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDALIGN_ALIGNMENTCALIB_H */ diff --git a/DDAlign/include/DDAlign/GlobalAlignmentCache.h b/DDAlign/include/DDAlign/GlobalAlignmentCache.h index 344c9b9af..c7565bd72 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentCache.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentCache.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,19 +18,19 @@ #include "DDAlign/GlobalAlignmentStack.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Alignments { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace align { /// Forward declarations class GlobalAlignmentOperator; class GlobalAlignmentCache; class GlobalAlignmentStack; - /// Class caching all known alignment operations for one LCDD instance. + /// Class caching all known alignment operations for one Detector instance. /** - * Internally the instances are fragmented to subdetectors defined + * detaillly the instances are fragmented to subdetectors defined * by the next-to-top level detector elements. * * \author M.Frank @@ -38,7 +38,7 @@ namespace DD4hep { * \ingroup DD4HEP_ALIGN */ class GlobalAlignmentCache { - friend class LCDD; + friend class dd4hep::Detector; friend class GlobalAlignmentOperator; public: @@ -48,7 +48,7 @@ namespace DD4hep { typedef std::map<std::string,GlobalAlignmentCache*> SubdetectorAlignments; protected: - LCDD& m_lcdd; + Detector& m_detDesc; /// Cache of subdetectors SubdetectorAlignments m_detectors; /// The subdetector specific map of alignments caches @@ -65,7 +65,7 @@ namespace DD4hep { protected: /// Default constructor initializing variables - GlobalAlignmentCache(LCDD& lcdd, const std::string& sdPath, bool top); + GlobalAlignmentCache(Detector& description, const std::string& sdPath, bool top); /// Default destructor virtual ~GlobalAlignmentCache(); @@ -81,9 +81,9 @@ namespace DD4hep { public: /// Create and install a new instance tree - static GlobalAlignmentCache* install(LCDD& lcdd); + static GlobalAlignmentCache* install(Detector& description); /// Unregister and delete a tree instance - static void uninstall(LCDD& lcdd); + static void uninstall(Detector& description); /// Add reference count int addRef(); /// Release object. If reference count goes to NULL, automatic deletion is triggered. @@ -100,6 +100,6 @@ namespace DD4hep { std::vector<GlobalAlignment> matches(const std::string& path_match, bool exclude_exact=false) const; }; - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGNMENT_GLOBALALIGNMENTCACHE_H */ diff --git a/DDAlign/include/DDAlign/GlobalAlignmentOperators.h b/DDAlign/include/DDAlign/GlobalAlignmentOperators.h index a2b0a60bc..9964cb91f 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentOperators.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentOperators.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DDAlign/GlobalAlignmentCache.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Alignments { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace align { /// Base class for alignment functors /** @@ -104,6 +104,6 @@ namespace DD4hep { template <> void GlobalAlignmentActor<DDAlign_standard_operations::node_delete>::operator()(Nodes::value_type& n) const; template <> void GlobalAlignmentActor<DDAlign_standard_operations::node_reset>::operator() (Nodes::value_type& n) const; template <> void GlobalAlignmentActor<DDAlign_standard_operations::node_align>::operator() (Nodes::value_type& n) const; - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGNMENT_GLOBALALIGNMENTOPERATORS_H */ diff --git a/DDAlign/include/DDAlign/GlobalAlignmentStack.h b/DDAlign/include/DDAlign/GlobalAlignmentStack.h index 85bb9ffc1..e6a4373eb 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentStack.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentStack.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +21,10 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Alignments { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace align { /// Alignment Stack object definition /** @@ -146,6 +146,6 @@ namespace DD4hep { std::vector<const StackEntry*> entries() const; }; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } /* End namespace detail */ +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGNMENT_GLOBALALIGNMENTSTACK_H */ diff --git a/DDAlign/include/DDAlign/GlobalAlignmentWriter.h b/DDAlign/include/DDAlign/GlobalAlignmentWriter.h index fc84731d5..e06261392 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentWriter.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentWriter.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,14 +15,14 @@ // Framework include files #include "XML/XMLElements.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/GlobalAlignment.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Alignments { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace align { // Forward declarations class GlobalAlignmentCache; @@ -36,29 +36,29 @@ namespace DD4hep { class GlobalAlignmentWriter { protected: /// Reference to detector description - LCDD& m_lcdd; + Detector& m_detDesc; /// Reference to the alignment cache GlobalAlignmentCache* m_cache; /// Add single alignment node to the XML document - void addNode(XML::Element elt, GlobalAlignment a) const; + void addNode(xml::Element elt, GlobalAlignment a) const; public: /// Initializing Constructor - GlobalAlignmentWriter(LCDD& lcdd); + GlobalAlignmentWriter(Detector& description); /// Standard destructor virtual ~GlobalAlignmentWriter(); /// Dump one full DetElement subtree into a newly created document - XML::Document dump(DetElement element, bool enable_transactions=false) const; + xml::Document dump(DetElement element, bool enable_transactions=false) const; /// Scan one DetElement structure and return an XML element containing the alignment in this subtree. - XML::Element scan(XML::Document doc, DetElement element) const; + xml::Element scan(xml::Document doc, DetElement element) const; /// Create the element corresponding to one single detector element without children - XML::Element createElement(XML::Document doc, DetElement element) const; + xml::Element createElement(xml::Document doc, DetElement element) const; /// Write the XML document structure to a file. - long write(XML::Document doc, const std::string& output) const; + long write(xml::Document doc, const std::string& output) const; }; - } // End namespace XML -} // End namespace DD4hep + } // End namespace xml +} // End namespace dd4hep #endif // DD4HEP_DDALIGN_GLOBALALIGNMENTWRITER_H diff --git a/DDAlign/include/DDAlign/GlobalDetectorAlignment.h b/DDAlign/include/DDAlign/GlobalDetectorAlignment.h index 6bba746ef..8bca8316d 100644 --- a/DDAlign/include/DDAlign/GlobalDetectorAlignment.h +++ b/DDAlign/include/DDAlign/GlobalDetectorAlignment.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,17 +14,17 @@ #define DD4HEP_GEOMETRY_GLOBALDETECTORALIGNMENT_H // Framework include files -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/GlobalAlignment.h" // Forward declarations class TGeoHMatrix; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Alignments { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace align { /// GlobalDetectorAlignment. DetElement Handle supporting alignment operations. /** @@ -75,6 +75,6 @@ namespace DD4hep { GlobalAlignment align(const std::string& volume_path, TGeoHMatrix* matrix, bool check = false, double overlap = 0.001); }; - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_GLOBALDETECTORALIGNMENT_H */ diff --git a/DDAlign/src/AlignmentTags.cpp b/DDAlign/src/AlignmentTags.cpp index 53f1f0bcc..a9c137199 100644 --- a/DDAlign/src/AlignmentTags.cpp +++ b/DDAlign/src/AlignmentTags.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,6 +16,6 @@ // Define unicode tags #ifndef UNICODE -#define UNICODE(x) extern const ::DD4hep::XML::Tag_t Unicode_##x ( #x ) +#define UNICODE(x) extern const ::dd4hep::xml::Tag_t Unicode_##x ( #x ) #endif #include "DDAlign/AlignmentTags.h" diff --git a/DDAlign/src/AlignmentsCalib.cpp b/DDAlign/src/AlignmentsCalib.cpp index 8963cff0c..0b5e69562 100644 --- a/DDAlign/src/AlignmentsCalib.cpp +++ b/DDAlign/src/AlignmentsCalib.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,9 +20,9 @@ #include "DD4hep/detail/AlignmentsInterna.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; -typedef Conditions::Condition::key_type key_type; +using namespace dd4hep; +using namespace dd4hep::align; +typedef Condition::key_type key_type; /** Implementation details: Alignment context entry * @@ -33,19 +33,19 @@ typedef Conditions::Condition::key_type key_type; */ class AlignmentsCalib::Entry { public: - Delta delta; - Delta original; - Condition source; - DetElement detector; - key_type target = 0; - int dirty = 0; + Delta delta; + Delta original; + Condition source; + DetElement detector; + Condition::key_type target = 0; + int dirty = 0; Entry() = default; Entry(const Entry& c) = delete; Entry& operator=(const Entry& c) = delete; }; /// Initializing constructor -AlignmentsCalib::AlignmentsCalib(LCDD& l, ConditionsMap& m) : lcdd(l), slice(m) +AlignmentsCalib::AlignmentsCalib(Detector& l, ConditionsMap& m) : description(l), slice(m) { } @@ -56,7 +56,7 @@ AlignmentsCalib::~AlignmentsCalib() { /// Convenience only: Access detector element by path DetElement AlignmentsCalib::detector(const string& path) const { - DetElement det(Geometry::DetectorTools::findElement(lcdd,path)); + DetElement det(detail::tools::findElement(description,path)); return det; } @@ -80,7 +80,7 @@ AlignmentsCalib::_set(DetElement detector, const Delta& delta) { src_cond->setFlag(Condition::ALIGNMENT_DELTA); src_cond->hash = key.hash; if ( !slice.insert(detector, Keys::deltaKey, src_cond) ) { - destroyHandle(src_cond); + detail::destroyHandle(src_cond); } /// Now check again if we succeeded. if ( !src_cond.isValid() ) { @@ -101,12 +101,14 @@ AlignmentsCalib::_set(DetElement detector, const Delta& delta) { } /// (1) Add a new entry to an existing DetElement structure. -key_type AlignmentsCalib::set(DetElement det, const Delta& delta) { +Condition::key_type +AlignmentsCalib::set(DetElement det, const Delta& delta) { return _set(det.access(), delta).first; } /// (2) Add a new entry to an existing DetElement structure. -key_type AlignmentsCalib::set(const string& path, const Delta& delta) { +Condition::key_type +AlignmentsCalib::set(const string& path, const Delta& delta) { return _set(detector(path).access(), delta).first; } @@ -124,15 +126,15 @@ void AlignmentsCalib::clearDeltas() { void AlignmentsCalib::clear() { for(auto& e : used) { e.second->source.get<Delta>() = e.second->delta; - delete e.second; + detail::deletePtr(e.second); } used.clear(); } /// Commit all pending transactions. Returns number of altered entries AlignmentsCalculator::Result AlignmentsCalib::commit() { - AlignmentsCalculator::Deltas deltas; - AlignmentsCalculator calculator; + std::map<DetElement, Delta> deltas; + AlignmentsCalculator calculator; /// Propagate the Delta values to the source conditions for ( auto& entry : used ) { diff --git a/DDAlign/src/GlobalAlignmentCache.cpp b/DDAlign/src/GlobalAlignmentCache.cpp index f55ffcc85..9e4061f42 100644 --- a/DDAlign/src/GlobalAlignmentCache.cpp +++ b/DDAlign/src/GlobalAlignmentCache.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DDAlign/GlobalAlignmentCache.h" #include "DDAlign/GlobalAlignmentOperators.h" @@ -22,9 +22,9 @@ #include "TGeoManager.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; -using namespace DD4hep::Alignments::DDAlign_standard_operations; +using namespace dd4hep; +using namespace dd4hep::align; +using namespace dd4hep::align::DDAlign_standard_operations; typedef GlobalAlignmentStack::StackEntry Entry; DetElement _detector(DetElement child) { @@ -36,12 +36,12 @@ DetElement _detector(DetElement child) { return child; return _detector(p); } - throw runtime_error("DD4hep: DetElement cannot determine detector parent [Invalid handle]"); + throw runtime_error("dd4hep: DetElement cannot determine detector parent [Invalid handle]"); } /// Default constructor -GlobalAlignmentCache::GlobalAlignmentCache(LCDD& lcdd, const string& sdPath, bool top) - : m_lcdd(lcdd), m_sdPath(sdPath), m_sdPathLen(sdPath.length()), m_refCount(1), m_top(top) +GlobalAlignmentCache::GlobalAlignmentCache(Detector& description, const string& sdPath, bool top) + : m_detDesc(description), m_sdPath(sdPath), m_sdPathLen(sdPath.length()), m_refCount(1), m_top(top) { } @@ -49,7 +49,7 @@ GlobalAlignmentCache::GlobalAlignmentCache(LCDD& lcdd, const string& sdPath, boo GlobalAlignmentCache::~GlobalAlignmentCache() { int nentries = (int)m_cache.size(); int nsect = (int)m_detectors.size(); - releaseObjects(m_detectors); + detail::releaseObjects(m_detectors); m_cache.clear(); printout(INFO,"GlobalAlignmentCache", "Destroy cache for subdetector %s [%d section(s), %d entrie(s)]", @@ -71,26 +71,26 @@ int GlobalAlignmentCache::release() { } /// Create and install a new instance tree -GlobalAlignmentCache* GlobalAlignmentCache::install(LCDD& lcdd) { - GlobalAlignmentCache* cache = lcdd.extension<GlobalAlignmentCache>(false); +GlobalAlignmentCache* GlobalAlignmentCache::install(Detector& description) { + GlobalAlignmentCache* cache = description.extension<GlobalAlignmentCache>(false); if ( !cache ) { - cache = new GlobalAlignmentCache(lcdd,"world",true); - lcdd.addExtension<GlobalAlignmentCache>(cache); + cache = new GlobalAlignmentCache(description,"world",true); + description.addExtension<GlobalAlignmentCache>(cache); } return cache; } /// Unregister and delete a tree instance -void GlobalAlignmentCache::uninstall(LCDD& lcdd) { - if ( lcdd.extension<GlobalAlignmentCache>(false) ) { - lcdd.removeExtension<GlobalAlignmentCache>(true); +void GlobalAlignmentCache::uninstall(Detector& description) { + if ( description.extension<GlobalAlignmentCache>(false) ) { + description.removeExtension<GlobalAlignmentCache>(true); } } /// Add a new entry to the cache. The key is the placement path bool GlobalAlignmentCache::insert(GlobalAlignment alignment) { TGeoPhysicalNode* pn = alignment.ptr(); - unsigned int index = hash32(pn->GetName()+m_sdPathLen); + unsigned int index = detail::hash32(pn->GetName()+m_sdPathLen); Cache::const_iterator i = m_cache.find(index); printout(ALWAYS,"GlobalAlignmentCache","Section: %s adding entry: %s", name().c_str(),alignment->GetName()); @@ -105,7 +105,7 @@ bool GlobalAlignmentCache::insert(GlobalAlignment alignment) { GlobalAlignmentCache* GlobalAlignmentCache::section(const string& path_name) const { size_t idx, idq; if ( path_name[0] != '/' ) { - return section(m_lcdd.world().placementPath()+'/'+path_name); + return section(m_detDesc.world().placementPath()+'/'+path_name); } else if ( (idx=path_name.find('/',1)) == string::npos ) { return (m_sdPath == path_name.c_str()+1) ? (GlobalAlignmentCache*)this : 0; @@ -122,7 +122,7 @@ GlobalAlignmentCache* GlobalAlignmentCache::section(const string& path_name) con /// Retrieve an alignment entry by its placement path GlobalAlignment GlobalAlignmentCache::get(const string& path_name) const { size_t idx, idq; - unsigned int index = hash32(path_name.c_str()+m_sdPathLen); + unsigned int index = detail::hash32(path_name.c_str()+m_sdPathLen); Cache::const_iterator i = m_cache.find(index); if ( i != m_cache.end() ) { return GlobalAlignment((*i).second); @@ -131,7 +131,7 @@ GlobalAlignment GlobalAlignmentCache::get(const string& path_name) const { return GlobalAlignment(0); } else if ( path_name[0] != '/' ) { - return get(m_lcdd.world().placementPath()+'/'+path_name); + return get(m_detDesc.world().placementPath()+'/'+path_name); } else if ( (idx=path_name.find('/',1)) == string::npos ) { // Escape: World volume and not found in cache --> not present @@ -165,7 +165,7 @@ vector<GlobalAlignment> GlobalAlignmentCache::matches(const string& match, bool /// Close existing transaction stack and apply all alignments void GlobalAlignmentCache::commit(GlobalAlignmentStack& stack) { - TGeoManager& mgr = m_lcdd.manager(); + TGeoManager& mgr = m_detDesc.manager(); mgr.UnlockGeometry(); apply(stack); mgr.LockGeometry(); @@ -175,7 +175,7 @@ void GlobalAlignmentCache::commit(GlobalAlignmentStack& stack) { GlobalAlignmentCache* GlobalAlignmentCache::subdetectorAlignments(const string& nam) { SubdetectorAlignments::const_iterator i = m_detectors.find(nam); if ( i == m_detectors.end() ) { - GlobalAlignmentCache* ptr = new GlobalAlignmentCache(m_lcdd,nam,false); + GlobalAlignmentCache* ptr = new GlobalAlignmentCache(m_detDesc,nam,false); m_detectors.insert(make_pair(nam,ptr)); return ptr; } @@ -186,7 +186,7 @@ GlobalAlignmentCache* GlobalAlignmentCache::subdetectorAlignments(const string& void GlobalAlignmentCache::apply(GlobalAlignmentStack& stack) { typedef map<string,DetElement> DetElementUpdates; typedef map<DetElement,vector<Entry*> > sd_entries_t; - TGeoManager& mgr = m_lcdd.manager(); + TGeoManager& mgr = m_detDesc.manager(); DetElementUpdates detelt_updates; sd_entries_t all; diff --git a/DDAlign/src/GlobalAlignmentOperators.cpp b/DDAlign/src/GlobalAlignmentOperators.cpp index 35aad4c83..5d3fff15a 100644 --- a/DDAlign/src/GlobalAlignmentOperators.cpp +++ b/DDAlign/src/GlobalAlignmentOperators.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/detail/DetectorInterna.h" #include "DDAlign/GlobalAlignmentOperators.h" @@ -22,8 +22,8 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; +using namespace dd4hep::align; void GlobalAlignmentOperator::insert(GlobalAlignment alignment) const { if ( !cache.insert(alignment) ) { diff --git a/DDAlign/src/GlobalAlignmentStack.cpp b/DDAlign/src/GlobalAlignmentStack.cpp index c80755f8d..789918cee 100644 --- a/DDAlign/src/GlobalAlignmentStack.cpp +++ b/DDAlign/src/GlobalAlignmentStack.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,15 +12,15 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Objects.h" #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" #include "DDAlign/GlobalAlignmentStack.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; +using namespace dd4hep::align; static dd4hep_ptr<GlobalAlignmentStack>& _stack() { static dd4hep_ptr<GlobalAlignmentStack> s; @@ -89,7 +89,7 @@ GlobalAlignmentStack::GlobalAlignmentStack() /// Default destructor GlobalAlignmentStack::~GlobalAlignmentStack() { - destroyObjects(m_stack); + detail::destroyObjects(m_stack); InstanceCount::decrement(this); } diff --git a/DDAlign/src/GlobalAlignmentWriter.cpp b/DDAlign/src/GlobalAlignmentWriter.cpp index d4e840dec..8f68b1b72 100644 --- a/DDAlign/src/GlobalAlignmentWriter.cpp +++ b/DDAlign/src/GlobalAlignmentWriter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDAlign/GlobalDetectorAlignment.h" #include "DDAlign/AlignmentTags.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/MatrixHelpers.h" #include "DD4hep/detail/DetectorInterna.h" @@ -28,17 +28,14 @@ // C/C++ include files #include <stdexcept> -using DD4hep::Geometry::Position; -using DD4hep::Geometry::Translation3D; -using namespace DD4hep::Alignments; -using namespace DD4hep; +using namespace dd4hep::align; +using namespace dd4hep; using namespace std; /// Initializing Constructor -GlobalAlignmentWriter::GlobalAlignmentWriter(LCDD& lcdd) - : m_lcdd(lcdd) +GlobalAlignmentWriter::GlobalAlignmentWriter(Detector& description) : m_detDesc(description) { - m_cache = lcdd.extension<Alignments::GlobalAlignmentCache>(); + m_cache = description.extension<align::GlobalAlignmentCache>(); if ( m_cache ) m_cache->addRef(); } @@ -48,8 +45,8 @@ GlobalAlignmentWriter::~GlobalAlignmentWriter() { } /// Create the element corresponding to one single detector element without children -XML::Element GlobalAlignmentWriter::createElement(XML::Document doc, DetElement element) const { - XML::Element e(0), placement(0), elt = XML::Element(doc,_ALU(detelement)); +xml::Element GlobalAlignmentWriter::createElement(xml::Document doc, DetElement element) const { + xml::Element e(0), placement(0), elt = xml::Element(doc,_ALU(detelement)); string path = element.placementPath(); GlobalAlignment a = element->global_alignment; GlobalDetectorAlignment det(element); @@ -60,7 +57,7 @@ XML::Element GlobalAlignmentWriter::createElement(XML::Document doc, DetElement addNode(elt,a); } for(vector<GlobalAlignment>::const_iterator i=va.begin(); i!=va.end();++i) { - e = XML::Element(doc,_U(volume)); + e = xml::Element(doc,_U(volume)); e.setAttr(_ALU(path),(*i)->GetName()); addNode(e,*i); elt.append(e); @@ -69,12 +66,12 @@ XML::Element GlobalAlignmentWriter::createElement(XML::Document doc, DetElement } /// Add single alignment node to the XML document -void GlobalAlignmentWriter::addNode(XML::Element elt, GlobalAlignment a) const { +void GlobalAlignmentWriter::addNode(xml::Element elt, GlobalAlignment a) const { TGeoNode* n = a->GetNode(); TGeoHMatrix mat(a->GetOriginalMatrix()->Inverse()); mat.Multiply(n->GetMatrix()); const Double_t* t = mat.GetTranslation(); - XML::Element placement = XML::Element(elt.document(),_U(comment)); + xml::Element placement = xml::Element(elt.document(),_U(comment)); placement.setAttr(_ALU(placement),a->GetName()); elt.append(placement); @@ -83,19 +80,19 @@ void GlobalAlignmentWriter::addNode(XML::Element elt, GlobalAlignment a) const if ( fabs(t[0]) > numeric_limits<double>::epsilon() || fabs(t[1]) > numeric_limits<double>::epsilon() || fabs(t[2]) > numeric_limits<double>::epsilon() ) { - XML::Element e = XML::Element(elt.document(),_U(position)); + xml::Element e = xml::Element(elt.document(),_U(position)); e.setAttr(_U(x),t[0]); e.setAttr(_U(y),t[1]); e.setAttr(_U(z),t[2]); elt.append(e); } if ( mat.IsRotation() ) { - Geometry::XYZAngles rot = Geometry::_XYZangles(&mat); + XYZAngles rot = Matrices::_xyzAngles(&mat); if ( fabs(rot.X()) > numeric_limits<double>::epsilon() || fabs(rot.Y()) > numeric_limits<double>::epsilon() || fabs(rot.Z()) > numeric_limits<double>::epsilon() ) { - XML::Element e = XML::Element(elt.document(),_U(rotation)); + xml::Element e = xml::Element(elt.document(),_U(rotation)); // Don't know why the angles have the wrong sign.... rot *= -1; e.setAttr(_U(x),rot.X()); @@ -107,14 +104,14 @@ void GlobalAlignmentWriter::addNode(XML::Element elt, GlobalAlignment a) const } /// Scan a DetElement subtree and add on the fly the XML entries -XML::Element GlobalAlignmentWriter::scan(XML::Document doc, DetElement element) const { - XML::Element elt(0); +xml::Element GlobalAlignmentWriter::scan(xml::Document doc, DetElement element) const { + xml::Element elt(0); if ( element.isValid() ) { const DetElement::Children& c = element.children(); GlobalAlignment alignment = element->global_alignment; if ( alignment.isValid() ) elt = createElement(doc,element); for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) { - XML::Element daughter = scan(doc, (*i).second); + xml::Element daughter = scan(doc, (*i).second); if ( daughter ) { (elt ? (elt) : (elt=createElement(doc,element))).append(daughter); } @@ -124,19 +121,19 @@ XML::Element GlobalAlignmentWriter::scan(XML::Document doc, DetElement element) } /// Dump the tree content into a XML document structure -XML::Document GlobalAlignmentWriter::dump(DetElement top, bool enable_transactions) const { - XML::DocumentHandler docH; - XML::Document doc = docH.create("alignment", docH.defaultComment()); - XML::Element elt(0), elements(0), root = doc.root(); - root.append(elements = XML::Element(doc, _ALU(detelements))); - if ( enable_transactions ) root.append(XML::Element(doc,_ALU(open_transaction))); +xml::Document GlobalAlignmentWriter::dump(DetElement top, bool enable_transactions) const { + xml::DocumentHandler docH; + xml::Document doc = docH.create("alignment", docH.defaultComment()); + xml::Element elt(0), elements(0), root = doc.root(); + root.append(elements = xml::Element(doc, _ALU(detelements))); + if ( enable_transactions ) root.append(xml::Element(doc,_ALU(open_transaction))); if ( (elt=scan(doc,top)) ) elements.append(elt); - if ( enable_transactions ) root.append(XML::Element(doc,_ALU(close_transaction))); + if ( enable_transactions ) root.append(xml::Element(doc,_ALU(close_transaction))); return doc; } /// Write the XML document structure to a file. -long GlobalAlignmentWriter::write(XML::Document doc, const string& output) const { - XML::DocumentHandler docH; +long GlobalAlignmentWriter::write(xml::Document doc, const string& output) const { + xml::DocumentHandler docH; return docH.output(doc, output); } diff --git a/DDAlign/src/GlobalDetectorAlignment.cpp b/DDAlign/src/GlobalDetectorAlignment.cpp index 656dd879a..c9b1b1590 100644 --- a/DDAlign/src/GlobalDetectorAlignment.cpp +++ b/DDAlign/src/GlobalDetectorAlignment.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -30,10 +30,10 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the alignment part of the AIDA detector description toolkit - namespace Alignments { + namespace align { class GlobalAlignmentData : public NamedObject { public: @@ -44,17 +44,16 @@ namespace DD4hep { global = GlobalAlignment(path); } virtual ~GlobalAlignmentData() { - destroyHandle (global); + detail::destroyHandle (global); } }; } /* End namespace Aligments */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; +using namespace dd4hep::align; -namespace DetectorTools = DD4hep::Geometry::DetectorTools; typedef vector<pair<int,DetElement> > LevelElements; DD4HEP_INSTANTIATE_HANDLE_NAMED(GlobalAlignmentData); @@ -95,31 +94,31 @@ namespace { */ return GlobalAlignment(n); } - throw runtime_error("DD4hep: Cannot align non existing physical node. [Invalid Handle]"); + throw runtime_error("dd4hep: Cannot align non existing physical node. [Invalid Handle]"); } GlobalAlignment _alignment(const GlobalDetectorAlignment& det) { DetElement::Object& e = det._data(); if ( !e.global_alignment.isValid() ) { - string path = DetectorTools::placementPath(det); + string path = detail::tools::placementPath(det); e.global_alignment = Ref_t(new GlobalAlignmentData(path)); } Handle<GlobalAlignmentData> h(e.global_alignment); if ( h.isValid() && h->global.isValid() ) { return h->global; } - throw runtime_error("DD4hep: Cannot access global alignment data. [Invalid Handle]"); + throw runtime_error("dd4hep: Cannot access global alignment data. [Invalid Handle]"); } void _dumpParentElements(GlobalDetectorAlignment& det, LevelElements& elements) { int level = 0; - DetectorTools::PlacementPath nodes; - DetectorTools::ElementPath det_nodes; - DetectorTools::placementPath(det,nodes); - DetectorTools::elementPath(det,det_nodes); + detail::tools::PlacementPath nodes; + detail::tools::ElementPath det_nodes; + detail::tools::placementPath(det,nodes); + detail::tools::elementPath(det,det_nodes); /// cout << "Placement path:"; - DetectorTools::PlacementPath::const_reverse_iterator j=nodes.rbegin(); - DetectorTools::ElementPath::const_reverse_iterator k=det_nodes.rbegin(); + detail::tools::PlacementPath::const_reverse_iterator j=nodes.rbegin(); + detail::tools::ElementPath::const_reverse_iterator k=det_nodes.rbegin(); for(; j!=nodes.rend(); ++j, ++level) { //cout << "(" << level << ") " << (void*)((*j).ptr()) // << " " << string((*j)->GetName()) << " "; @@ -157,7 +156,7 @@ bool GlobalDetectorAlignment::debug(bool value) { /// Collect all placements from the detector element up to the world volume void GlobalDetectorAlignment::collectNodes(vector<PlacedVolume>& nodes) { - DetectorTools::placementPath(*this,nodes); + detail::tools::placementPath(*this,nodes); } /// Access to the alignment block @@ -179,22 +178,22 @@ const vector<GlobalAlignment>& GlobalDetectorAlignment::volumeAlignments() const /// Align the PhysicalNode of the placement of the detector element (translation only) GlobalAlignment GlobalDetectorAlignment::align(const Position& pos, bool chk, double overlap) { - return align(Geometry::_transform(pos),chk,overlap); + return align(Matrices::_transform(pos),chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (rotation only) GlobalAlignment GlobalDetectorAlignment::align(const RotationZYX& rot, bool chk, double overlap) { - return align(Geometry::_transform(rot),chk,overlap); + return align(Matrices::_transform(rot),chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (translation + rotation) GlobalAlignment GlobalDetectorAlignment::align(const Position& pos, const RotationZYX& rot, bool chk, double overlap) { - return align(Geometry::_transform(pos,rot),chk,overlap); + return align(Matrices::_transform(pos,rot),chk,overlap); } /// Align the physical node according to a generic Transform3D GlobalAlignment GlobalDetectorAlignment::align(const Transform3D& transform, bool chk, double overlap) { - return align(Geometry::_transform(transform),chk,overlap); + return align(Matrices::_transform(transform),chk,overlap); } /// Align the physical node according to a generic TGeo matrix @@ -204,23 +203,23 @@ GlobalAlignment GlobalDetectorAlignment::align(TGeoHMatrix* matrix, bool chk, do /// Align the PhysicalNode of the placement of the detector element (translation only) GlobalAlignment GlobalDetectorAlignment::align(const string& elt_path, const Position& pos, bool chk, double overlap) { - return align(elt_path,Geometry::_transform(pos),chk,overlap); + return align(elt_path,Matrices::_transform(pos),chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (rotation only) GlobalAlignment GlobalDetectorAlignment::align(const string& elt_path, const RotationZYX& rot, bool chk, double overlap) { - return align(elt_path,Geometry::_transform(rot),chk,overlap); + return align(elt_path,Matrices::_transform(rot),chk,overlap); } /// Align the PhysicalNode of the placement of the detector element (translation + rotation) GlobalAlignment GlobalDetectorAlignment::align(const string& elt_path, const Position& pos, const RotationZYX& rot, bool chk, double overlap) { - return align(elt_path,Geometry::_transform(pos,rot),chk,overlap); + return align(elt_path,Matrices::_transform(pos,rot),chk,overlap); } /// Align the physical node according to a generic Transform3D GlobalAlignment GlobalDetectorAlignment::align(const string& elt_path, const Transform3D& transform, bool chk, double overlap) { - return align(elt_path,Geometry::_transform(transform),chk,overlap); + return align(elt_path,Matrices::_transform(transform),chk,overlap); } /// Align the physical node according to a generic TGeo matrix diff --git a/DDAlign/src/plugins/AlignmentsPlugins.cpp b/DDAlign/src/plugins/AlignmentsPlugins.cpp index 05f9b1005..af7026c63 100644 --- a/DDAlign/src/plugins/AlignmentsPlugins.cpp +++ b/DDAlign/src/plugins/AlignmentsPlugins.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,14 +17,13 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; +using namespace dd4hep::align; // ====================================================================================== #include "DDAlign/GlobalAlignmentWriter.h" -long create_global_alignment_xml_file(Geometry::LCDD& lcdd, int argc, char** argv) { - namespace DetectorTools = DD4hep::Geometry::DetectorTools; - Geometry::DetElement top; +long create_global_alignment_xml_file(Detector& description, int argc, char** argv) { + DetElement top; string output, path = "/world"; bool enable_transactions = false, arg_error = false; for(int i=1; i<argc;++i) { @@ -45,7 +44,7 @@ long create_global_alignment_xml_file(Geometry::LCDD& lcdd, int argc, char** arg /// Help printout describing the basic command line interface cout << "Usage: -plugin <name> -arg [-arg] \n" - " name: factory nameDD4hep_GlobalAlignmentWriter \n\n" + " name: factory namedd4hep_GlobalAlignmentWriter \n\n" " -output <string> Path to the output file generated. \n" " -path <string> Path to the detector element for which \n" " the alignment file should be written. \n" @@ -55,14 +54,14 @@ long create_global_alignment_xml_file(Geometry::LCDD& lcdd, int argc, char** arg } printout(ALWAYS,"AlignmentXmlWriter", - "++ Writing DD4hep alignment constants of the \"%s\" DetElement tree to file \"%s\"", + "++ Writing dd4hep alignment constants of the \"%s\" DetElement tree to file \"%s\"", path.c_str(), output.c_str()); - top = DetectorTools::findDaughterElement(lcdd.world(),path); + top = detail::tools::findDaughterElement(description.world(),path); if ( top.isValid() ) { - GlobalAlignmentWriter wr(lcdd); + GlobalAlignmentWriter wr(description); return wr.write(wr.dump(top,enable_transactions), output); } except("AlignmentXmlWriter","++ Invalid top level detector element name: %s",path.c_str()); return 1; } -DECLARE_APPLY(DD4hep_GlobalAlignmentXmlWriter, create_global_alignment_xml_file) +DECLARE_APPLY(dd4hep_GlobalAlignmentXmlWriter, create_global_alignment_xml_file) diff --git a/DDAlign/src/plugins/GlobalAlignmentParser.cpp b/DDAlign/src/plugins/GlobalAlignmentParser.cpp index 8758c0c7f..af315fb89 100644 --- a/DDAlign/src/plugins/GlobalAlignmentParser.cpp +++ b/DDAlign/src/plugins/GlobalAlignmentParser.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Path.h" #include "DD4hep/Mutex.h" #include "DD4hep/Printout.h" @@ -30,7 +30,7 @@ // C/C++ include files #include <stdexcept> -namespace DD4hep { +namespace dd4hep { namespace { @@ -55,8 +55,8 @@ namespace DD4hep { } using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; +using namespace dd4hep::align; /** Convert to enable/disable debugging. * @@ -103,7 +103,7 @@ template <> void Converter<volume>::operator()(xml_h e) const { printout(INFO,"Alignment<vol>"," path:%s placement:%s reset:%s children:%s", subpath.c_str(), placement.c_str(), yes_no(reset), yes_no(reset_dau)); - XML::parse(e,val); + xml::parse(e,val); if ( val.flags ) val.flags |= GlobalAlignmentStack::MATRIX_DEFINED; if ( overlap ) val.flags |= GlobalAlignmentStack::OVERLAP_DEFINED; if ( reset ) val.flags |= GlobalAlignmentStack::RESET_VALUE; @@ -114,7 +114,7 @@ template <> void Converter<volume>::operator()(xml_h e) const { dd4hep_ptr<StackEntry> entry(new StackEntry(elt->first,placement,val,ovl)); stack->insert(entry); pair<DetElement,string> vol_param(elt->first,subpath); - xml_coll_t(e,_U(volume)).for_each(Converter<volume>(lcdd,&vol_param)); + xml_coll_t(e,_U(volume)).for_each(Converter<volume>(description,&vol_param)); } /** Convert detelement objects @@ -143,16 +143,16 @@ template <> void Converter<detelement>::operator()(xml_h e) const { bool reset_dau = e.hasAttr(_ALU(reset_children)) ? e.attr<bool>(_ALU(reset_children)) : false; bool overlap = e.hasAttr(_ALU(overlap)); double ovl = overlap ? e.attr<double>(_ALU(overlap)) : 0.001; - DetElement elt = Geometry::DetectorTools::findDaughterElement(det,path); + DetElement elt = detail::tools::findDaughterElement(det,path); string placement = elt.isValid() ? elt.placementPath() : string("-----"); if ( !elt.isValid() ) { - string err = "DD4hep: DetElement "+det.path()+" has no child:"+path+" [No such child]"; + string err = "dd4hep: DetElement "+det.path()+" has no child:"+path+" [No such child]"; throw runtime_error(err); } Delta delta; - XML::parse(e, delta); + xml::parse(e, delta); if ( delta.flags ) { delta.flags |= GlobalAlignmentStack::MATRIX_DEFINED; reset = reset_dau = true; @@ -174,9 +174,9 @@ template <> void Converter<detelement>::operator()(xml_h e) const { stack->insert(entry); pair<DetElement,string> vol_param(elt,""); - xml_coll_t(e,_U(volume)).for_each(Converter<volume>(lcdd,&vol_param,optional)); - xml_coll_t(e,_ALU(detelement)).for_each(Converter<detelement>(lcdd,elt.ptr(),optional)); - xml_coll_t(e,_U(include)).for_each(Converter<include_file>(lcdd,elt.ptr(),optional)); + xml_coll_t(e,_U(volume)).for_each(Converter<volume>(description,&vol_param,optional)); + xml_coll_t(e,_ALU(detelement)).for_each(Converter<detelement>(description,elt.ptr(),optional)); + xml_coll_t(e,_U(include)).for_each(Converter<include_file>(description,elt.ptr(),optional)); } /** Convert detelement_include objects @@ -191,15 +191,15 @@ template <> void Converter<detelement>::operator()(xml_h e) const { * @date 01/04/2014 */ template <> void Converter<include_file>::operator()(xml_h element) const { - XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); + xml::DocumentHolder doc(xml::DocumentHandler().load(element, element.attr_value(_U(ref)))); xml_h node = doc.root(); string tag = node.tag(); if ( tag == "alignment" ) - Converter<alignment>(lcdd,param,optional)(node); + Converter<alignment>(description,param,optional)(node); else if ( tag == "detelement" ) - Converter<detelement>(lcdd,param,optional)(node); + Converter<detelement>(description,param,optional)(node); else if ( tag == "subdetectors" || tag == "detelements" ) - xml_coll_t(node,_ALU(detelements)).for_each(Converter<detelement>(lcdd,param,optional)); + xml_coll_t(node,_ALU(detelements)).for_each(Converter<detelement>(description,param,optional)); else throw runtime_error("Undefined tag name in XML structure:"+tag+" XML parsing abandoned."); } @@ -219,11 +219,11 @@ template <> void Converter<include_file>::operator()(xml_h element) const { template <> void Converter<alignment>::operator()(xml_h e) const { /// Now we process all allowed elements within the alignment tag: /// <detelement/>, <detelements/>, <subdetectors/> and <include/> - xml_coll_t(e,_ALU(debug)).for_each(Converter<debug>(lcdd,param,optional)); - xml_coll_t(e,_ALU(detelement)).for_each(Converter<detelement>(lcdd,param,optional)); - xml_coll_t(e,_ALU(detelements)).for_each(_ALU(detelement),Converter<detelement>(lcdd,param,optional)); - xml_coll_t(e,_ALU(subdetectors)).for_each(_ALU(detelement),Converter<detelement>(lcdd,param,optional)); - xml_coll_t(e,_U(include)).for_each(Converter<include_file>(lcdd,param,optional)); + xml_coll_t(e,_ALU(debug)).for_each(Converter<debug>(description,param,optional)); + xml_coll_t(e,_ALU(detelement)).for_each(Converter<detelement>(description,param,optional)); + xml_coll_t(e,_ALU(detelements)).for_each(_ALU(detelement),Converter<detelement>(description,param,optional)); + xml_coll_t(e,_ALU(subdetectors)).for_each(_ALU(detelement),Converter<detelement>(description,param,optional)); + xml_coll_t(e,_U(include)).for_each(Converter<include_file>(description,param,optional)); } /** Basic entry point to read alignment files @@ -232,13 +232,13 @@ template <> void Converter<alignment>::operator()(xml_h e) const { * @version 1.0 * @date 01/04/2014 */ -static long setup_Alignment(lcdd_t& lcdd, const xml_h& e) { +static long setup_Alignment(Detector& description, const xml_h& e) { static dd4hep_mutex_t s_mutex; dd4hep_lock_t lock(s_mutex); bool open_trans = e.hasChild(_ALU(open_transaction)); bool close_trans = e.hasChild(_ALU(close_transaction)); - GlobalAlignmentCache* cache = GlobalAlignmentCache::install(lcdd); + GlobalAlignmentCache* cache = GlobalAlignmentCache::install(description); /// Check if transaction already present. If not, open, else issue an error if ( open_trans ) { if ( GlobalAlignmentStack::exists() ) { @@ -248,11 +248,11 @@ static long setup_Alignment(lcdd_t& lcdd, const xml_h& e) { } if ( !GlobalAlignmentStack::exists() ) { printout(ERROR,"GlobalAlignment","Request process global alignments without cache."); - printout(ERROR,"GlobalAlignment","Call plugin DD4hep_GlobalAlignmentInstall first OR add XML tag <open_transaction/>"); + printout(ERROR,"GlobalAlignment","Call plugin dd4hep_GlobalAlignmentInstall first OR add XML tag <open_transaction/>"); except("GlobalAlignment","Request process global alignments without cache."); } GlobalAlignmentStack& stack = GlobalAlignmentStack::get(); - (DD4hep::Converter<DD4hep::alignment>(lcdd,lcdd.world().ptr(),&stack))(e); + (dd4hep::Converter<dd4hep::alignment>(description,description.world().ptr(),&stack))(e); if ( close_trans ) { cache->commit(stack); GlobalAlignmentStack::get().release(); @@ -267,14 +267,14 @@ static long setup_Alignment(lcdd_t& lcdd, const xml_h& e) { } DECLARE_XML_DOC_READER(global_alignment,setup_Alignment) -/** Basic entry point to install the alignment cache in a LCDD instance +/** Basic entry point to install the alignment cache in a Detector instance * * @author M.Frank * @version 1.0 * @date 01/04/2014 */ -static long install_Alignment(lcdd_t& lcdd, int, char**) { - GlobalAlignmentCache::install(lcdd); +static long install_Alignment(Detector& description, int, char**) { + GlobalAlignmentCache::install(description); return 1; } -DECLARE_APPLY(DD4hep_GlobalAlignmentInstall,install_Alignment) +DECLARE_APPLY(dd4hep_GlobalAlignmentInstall,install_Alignment) diff --git a/DDCond/CMakeLists.txt b/DDCond/CMakeLists.txt index 258972d05..ad62c1702 100644 --- a/DDCond/CMakeLists.txt +++ b/DDCond/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/DDCond/NamingConventions.txt b/DDCond/NamingConventions.txt index e26e2c54a..34dce0a6f 100644 --- a/DDCond/NamingConventions.txt +++ b/DDCond/NamingConventions.txt @@ -1,5 +1,5 @@ -Access mechaisms of DD4hep conditions for utilities +Access mechaisms of dd4hep conditions for utilities =================================================== Access to conditions is solely supported using the interface class DDCore/ConditionsMap. @@ -34,7 +34,7 @@ Naming conventions for detector conditions -- Alignment conditions naming conventions: --> Alignment-delta conditions are called "alignment_delta". --> Fully qualified alignment conditions are called "alignment". - DD4hep provided alignment utilities rely on this convention. + dd4hep provided alignment utilities rely on this convention. -- Other conditions can be named freely. diff --git a/DDCond/include/DDCond/ConditionsContent.h b/DDCond/include/DDCond/ConditionsContent.h index 0c4a214f3..f4114d28b 100644 --- a/DDCond/include/DDCond/ConditionsContent.h +++ b/DDCond/include/DDCond/ConditionsContent.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DD4hep/ConditionDerived.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Base class for data loading information. /** @@ -78,9 +78,8 @@ namespace DD4hep { virtual const void* ptr() const { return &info; } }; - typedef Condition::key_type key_type; - typedef std::map<key_type,ConditionDependency* > Dependencies; - typedef std::map<key_type,ConditionsLoadInfo* > Conditions; + typedef std::map<Condition::key_type,ConditionDependency* > Dependencies; + typedef std::map<Condition::key_type,ConditionsLoadInfo* > Conditions; protected: /// Container of conditions required by this content @@ -106,13 +105,13 @@ namespace DD4hep { /// Clear the conditions content definitions void clear(); /// Remove a condition from the content - bool remove(key_type condition); + bool remove(Condition::key_type condition); /// Add a new conditions key representing a real (not derived) condition - bool insertKey(key_type hash) { + bool insertKey(Condition::key_type hash) { return m_conditions.insert(std::make_pair(hash,(ConditionsLoadInfo*)0)).second; } /// Add a new conditions key. T must inherit from class ConditionsContent::Info - template <typename T> bool insertKey(key_type hash, const T& info) { + template <typename T> bool insertKey(Condition::key_type hash, const T& info) { ConditionsLoadInfo* i = new LoadInfo<T>(info); bool ret = m_conditions.insert(std::make_pair(hash,i)).second; if ( !ret ) delete i; @@ -127,6 +126,6 @@ namespace DD4hep { /// Create load-info object template <typename T> static LoadInfo<T> loadInfo(const T& t) { return LoadInfo<T>(t); } }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCOND_CONDITIONSCONTENT_H */ diff --git a/DDCond/include/DDCond/ConditionsDataLoader.h b/DDCond/include/DDCond/ConditionsDataLoader.h index 2231e4148..506a9aa4f 100644 --- a/DDCond/include/DDCond/ConditionsDataLoader.h +++ b/DDCond/include/DDCond/ConditionsDataLoader.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,10 +25,10 @@ #include <set> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class Entry; @@ -48,7 +48,6 @@ namespace DD4hep { typedef std::pair<std::string, IOV> Source; typedef std::vector<Source> Sources; typedef ConditionsDataLoader base_t; - typedef Condition::iov_type iov_type; typedef Condition::key_type key_type; typedef std::map<key_type,Condition> LoadedItems; @@ -56,7 +55,7 @@ namespace DD4hep { protected: /// Reference to main detector description object - LCDD& m_lcdd; + Detector& m_detDesc; /// Reference to conditions manager used to queue update requests ConditionsManager m_mgr; /// Property: input data source definitions @@ -70,24 +69,24 @@ namespace DD4hep { public: /// Default constructor - ConditionsDataLoader(LCDD& lcdd, ConditionsManager mgr, const std::string nam); + ConditionsDataLoader(Detector& description, ConditionsManager mgr, const std::string nam); /// Default destructor virtual ~ConditionsDataLoader(); /// Add data source definition to loader - void addSource(const std::string& source, const iov_type& iov); + void addSource(const std::string& source, const IOV& iov); /// Load a condition set given the conditions key according to their validity virtual size_t load_single(key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) = 0; /// Load a condition set given a Detector Element and the conditions name according to their validity virtual size_t load_range( key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) = 0; - virtual size_t load_many( const iov_type& req_validity, + virtual size_t load_many( const IOV& req_validity, RequiredItems& work, LoadedItems& loaded, - iov_type& combined_validity) = 0; + IOV& combined_validity) = 0; }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSDATALOADER_H */ diff --git a/DDCond/include/DDCond/ConditionsDependencyHandler.h b/DDCond/include/DDCond/ConditionsDependencyHandler.h index f7b3fbd94..4f1bae60f 100644 --- a/DDCond/include/DDCond/ConditionsDependencyHandler.h +++ b/DDCond/include/DDCond/ConditionsDependencyHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,16 +14,16 @@ #define DDCOND_CONDITIONSDEPENDENCYHANDLER_H // Framework include files -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/ConditionDerived.h" #include "DDCond/ConditionsPool.h" #include "DDCond/ConditionsManager.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class UserPool; @@ -57,7 +57,7 @@ namespace DD4hep { mutable size_t num_callback; protected: - /// Internal call to trigger update callback + /// detaill call to trigger update callback Condition::Object* do_callback(const ConditionDependency& dep) const; public: @@ -69,7 +69,7 @@ namespace DD4hep { /// Default destructor ~ConditionsDependencyHandler(); /// ConditionResolver implementation: Access to the detector description instance - LCDD& lcdd() const; + Detector& detectorDescription() const; /// ConditionResolver implementation: Access to the conditions manager virtual Ref_t manager() const { return m_manager; } /// Access to pool IOV @@ -82,7 +82,7 @@ namespace DD4hep { Condition::Object* operator()(const ConditionDependency* dep) const; }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSDEPENDENCYHANDLER_H */ diff --git a/DDCond/include/DDCond/ConditionsEntry.h b/DDCond/include/DDCond/ConditionsEntry.h index 753308f34..d9956e7ef 100644 --- a/DDCond/include/DDCond/ConditionsEntry.h +++ b/DDCond/include/DDCond/ConditionsEntry.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,13 +15,13 @@ // Framework include files #include "DD4hep/NamedObject.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class Entry; @@ -36,7 +36,7 @@ namespace DD4hep { class Entry : public NamedObject { public: /// Reference to the detector element - Geometry::DetElement detector; + DetElement detector; /// The actual conditions data std::string value; /// The validity string to be interpreted by the updating engine @@ -46,7 +46,7 @@ namespace DD4hep { /// Default constructor Entry(); /// Initializing constructor - Entry(const Geometry::DetElement& det, const std::string& nam, const std::string& typ, const std::string& valid, int hash); + Entry(const DetElement& det, const std::string& nam, const std::string& typ, const std::string& valid, int hash); /// Copy constructor Entry(const Entry& c); /// Default destructor @@ -56,7 +56,7 @@ namespace DD4hep { }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSENTRY_H */ diff --git a/DDCond/include/DDCond/ConditionsIOVPool.h b/DDCond/include/DDCond/ConditionsIOVPool.h index b392375b0..992bb70ac 100644 --- a/DDCond/include/DDCond/ConditionsIOVPool.h +++ b/DDCond/include/DDCond/ConditionsIOVPool.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,16 +18,14 @@ // C/C++ include files #include <map> +#include <memory> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { - /// Forward declarations - class ConditionsDataLoader; - /// Pool of conditions satisfying one IOV type (epoch, run, fill, etc) /** * Purely internal class to the conditions manager implementation. @@ -39,8 +37,8 @@ namespace DD4hep { */ class ConditionsIOVPool { public: - typedef ConditionsPool* Element; - typedef std::map<IOV::Key, Element > Elements; + typedef std::shared_ptr<ConditionsPool> Element; + typedef std::map<IOV::Key, Element > Elements; /// Container of IOV dependent conditions pools Elements elements; @@ -52,9 +50,9 @@ namespace DD4hep { /// Default destructor virtual ~ConditionsIOVPool(); /// Retrieve a condition set given the key according to their validity - size_t select(Condition::key_type key, const Condition::iov_type& req_validity, RangeConditions& result); + size_t select(Condition::key_type key, const IOV& req_validity, RangeConditions& result); /// Retrieve a condition set given the key according to their validity - size_t selectRange(Condition::key_type key, const Condition::iov_type& req_validity, RangeConditions& result); + size_t selectRange(Condition::key_type key, const IOV& req_validity, RangeConditions& result); /// Select all ACTIVE conditions, which do match the IOV requirement size_t select(const IOV& req_validity, RangeConditions& valid, IOV& cond_validity); /// Select all ACTIVE conditions, which do match the IOV requirement @@ -67,7 +65,7 @@ namespace DD4hep { int clean(int max_age); }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSIOVPOOL_H */ diff --git a/DDCond/include/DDCond/ConditionsManager.h b/DDCond/include/DDCond/ConditionsManager.h index f16a3347a..3dfb77fe2 100644 --- a/DDCond/include/DDCond/ConditionsManager.h +++ b/DDCond/include/DDCond/ConditionsManager.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,10 +22,10 @@ #include <memory> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class UserPool; @@ -84,7 +84,7 @@ namespace DD4hep { template <typename T> static ConditionsManager from(T& host); /// Initializing constructor - ConditionsManager(LCDD& lcdd); + ConditionsManager(Detector& description); /// Default constructor ConditionsManager() = default; @@ -184,6 +184,6 @@ namespace DD4hep { missing -= result.missing; return *this; } - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSMANAGER_H */ diff --git a/DDCond/include/DDCond/ConditionsManagerObject.h b/DDCond/include/DDCond/ConditionsManagerObject.h index b04911e62..33f3e7bd5 100644 --- a/DDCond/include/DDCond/ConditionsManagerObject.h +++ b/DDCond/include/DDCond/ConditionsManagerObject.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,13 +26,13 @@ #include <set> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class IOVType; - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class ConditionsIOVPool; @@ -55,7 +55,6 @@ namespace DD4hep { public: typedef std::vector<IOVType> IOVTypes; typedef Condition::key_type key_type; - typedef Condition::iov_type iov_type; typedef std::pair<ConditionsListener*,void*> Listener; typedef std::set<Listener> Listeners; typedef std::unique_ptr<ConditionsDataLoader> Loader; @@ -63,7 +62,7 @@ namespace DD4hep { protected: /// Reference to main detector description object - LCDD& m_lcdd; + Detector& m_detDesc; /// Conditions listeners on registration of new conditions Listeners m_onRegister; /// Conditions listeners on de-registration of new conditions @@ -81,13 +80,13 @@ namespace DD4hep { public: /// Default constructor - ConditionsManagerObject(LCDD& lcdd); + ConditionsManagerObject(Detector& description); /// Default destructor virtual ~ConditionsManagerObject(); /// Access to the detector description instance - LCDD& lcdd() const { return m_lcdd; } + Detector& detectorDescription() const { return m_detDesc; } /// Access to the data loader ConditionsDataLoader* loader() const { return m_loader.get(); } @@ -145,10 +144,10 @@ namespace DD4hep { virtual ConditionsIOVPool* iovPool(const IOVType& type) const = 0; /// Retrieve a condition set given a Detector Element and the conditions name according to their validity - virtual Condition get(key_type key, const iov_type& req_validity) = 0; + virtual Condition get(key_type key, const IOV& req_validity) = 0; /// Retrieve a condition given a Detector Element and the conditions name - virtual RangeConditions getRange(key_type key, const iov_type& req_validity) = 0; + virtual RangeConditions getRange(key_type key, const IOV& req_validity) = 0; /// Push all pending updates to the conditions store. /** Note: @@ -174,6 +173,6 @@ namespace DD4hep { virtual std::pair<int,int> clear() = 0; }; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } /* End namespace detail */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONS_CONDITIONSMANAGEROBJECT_H */ diff --git a/DDCond/include/DDCond/ConditionsOperators.h b/DDCond/include/DDCond/ConditionsOperators.h index b96acb096..e9ccc3a4b 100644 --- a/DDCond/include/DDCond/ConditionsOperators.h +++ b/DDCond/include/DDCond/ConditionsOperators.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class ConditionsManagerObject; @@ -30,16 +30,16 @@ namespace DD4hep { /// Helper class for common stuff used frequently class Operators { public: - /// Select all condition from the conditions manager registered at the LCDD object - static size_t collectAllConditions(Geometry::LCDD& lcdd, RangeConditions& conditions); - /// Select all condition from the conditions manager registered at the LCDD object + /// Select all condition from the conditions manager registered at the Detector object + static size_t collectAllConditions(Detector& description, RangeConditions& conditions); + /// Select all condition from the conditions manager registered at the Detector object static size_t collectAllConditions(ConditionsManager mgr, RangeConditions& conditions); - /// Select all condition from the conditions manager registered at the LCDD object - static size_t collectAllConditions(Geometry::LCDD& lcdd, std::map<int,Condition>& conditions); - /// Select all condition from the conditions manager registered at the LCDD object + /// Select all condition from the conditions manager registered at the Detector object + static size_t collectAllConditions(Detector& description, std::map<int,Condition>& conditions); + /// Select all condition from the conditions manager registered at the Detector object static size_t collectAllConditions(ConditionsManager mgr, std::map<int,Condition>& conditions); }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_CONDITIONSOPERATORS_H */ diff --git a/DDCond/include/DDCond/ConditionsPool.h b/DDCond/include/DDCond/ConditionsPool.h index 1fcd190c4..adc52186e 100644 --- a/DDCond/include/DDCond/ConditionsPool.h +++ b/DDCond/include/DDCond/ConditionsPool.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +21,10 @@ // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class ConditionsSlice; @@ -57,17 +57,14 @@ namespace DD4hep { ConditionsManager m_manager; public: - /// Forward definition of the key type - typedef Condition::key_type key_type; - enum { AGE_NONE = 0, AGE_ANY = 9999999, AGE_EXPIRED = 12345678 }; /// The IOV of the conditions hosted - IOV* iov; + IOV* iov; /// Aging value - int age_value; + int age_value; public: /// Listener invocation when a condition is registered to the cache @@ -125,7 +122,7 @@ namespace DD4hep { virtual size_t popEntries(UpdateEntries& entries) = 0; /// Select the conditions matching the key virtual void select_range(Condition::key_type key, - const Condition::iov_type& req_validity, + const IOV& req_validity, RangeConditions& result) = 0; }; @@ -137,11 +134,7 @@ namespace DD4hep { class UserPool : public ConditionsMap { public: /// Forward definition of the key type - //typedef Condition::key_type key_type; - typedef Condition::itemkey_type itemkey_type; - typedef ConditionDependency Dependency; - typedef std::map<key_type,const Dependency*> Dependencies; - typedef ConditionsManager::Result Result; + typedef std::map<Condition::key_type,const ConditionDependency*> Dependencies; protected: /// The pool's interval of validity @@ -178,49 +171,52 @@ namespace DD4hep { /// Full cleanup of all managed conditions. virtual void clear() = 0; /// Check a condition for existence - virtual bool exists(key_type key) const = 0; + virtual bool exists(Condition::key_type key) const = 0; /// Check a condition for existence virtual bool exists(const ConditionKey& key) const = 0; /// Check if a condition exists in the pool and return it to the caller - virtual Condition get(key_type key) const = 0; + virtual Condition get(Condition::key_type key) const = 0; /// Check if a condition exists in the pool and return it to the caller virtual Condition get(const ConditionKey& key) const = 0; /// Remove condition by key from pool. - virtual bool remove(key_type hash_key) = 0; + virtual bool remove(Condition::key_type hash_key) = 0; /// Remove condition by key from pool. virtual bool remove(const ConditionKey& key) = 0; /// ConditionsMap overload: Add a condition directly to the slice - virtual bool insert(DetElement detector, unsigned int key, Condition condition) = 0; + virtual bool insert(DetElement detector, Condition::itemkey_type key, Condition condition) = 0; /// ConditionsMap overload: Access a single condition - virtual Condition get(DetElement detector, unsigned int key) const = 0; + virtual Condition get(DetElement detector, Condition::itemkey_type key) const = 0; /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] - virtual std::vector<Condition> get(key_type lower, key_type upper) const = 0; + virtual std::vector<Condition> get(Condition::key_type lower, + Condition::key_type upper) const = 0; /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] virtual std::vector<Condition> get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const = 0; + Condition::itemkey_type lower, + Condition::itemkey_type upper) const = 0; /// ConditionsMap overload: Interface to scan data content of the conditions mapping - virtual void scan(const Processor& processor) const = 0; + virtual void scan(const Condition::Processor& processor) const = 0; /// No ConditionsMap overload: Interface to scan data content of the conditions mapping - virtual void scan(key_type lower, key_type upper, const Processor& processor) const = 0; + virtual void scan(Condition::key_type lower, + Condition::key_type upper, + const Condition::Processor& processor) const = 0; /// No ConditionsMap overload: Interface to scan data content of the conditions mapping virtual void scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const = 0; + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const = 0; /// Prepare user pool for usage (load, fill etc.) according to required IOV - virtual Result prepare(const IOV& required, - ConditionsSlice& slice, - void* user_param = 0) = 0; + virtual ConditionsManager::Result prepare(const IOV& required, + ConditionsSlice& slice, + void* user_param = 0) = 0; /// Evaluate and register all derived conditions from the dependency list virtual size_t compute(const Dependencies& dependencies, void* user_param, bool force) = 0; }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSPOOL_H */ diff --git a/DDCond/include/DDCond/ConditionsRepository.h b/DDCond/include/DDCond/ConditionsRepository.h index 48a9ea47d..d6dc4972b 100644 --- a/DDCond/include/DDCond/ConditionsRepository.h +++ b/DDCond/include/DDCond/ConditionsRepository.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,14 +19,14 @@ // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Forward declarations class IOV; class IOVType; - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Base class to be implemented by objects to listen on condition callbacks /** @@ -63,7 +63,7 @@ namespace DD4hep { int load(const std::string& input, Data& data) const; }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_CONDITIONSREPOSITORY_H */ diff --git a/DDCond/include/DDCond/ConditionsSelectors.h b/DDCond/include/DDCond/ConditionsSelectors.h index e4ebbebe0..b434d30b5 100644 --- a/DDCond/include/DDCond/ConditionsSelectors.h +++ b/DDCond/include/DDCond/ConditionsSelectors.h @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DD4hep/detail/ConditionsInterna.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Namespace for condition operators to avoid clashes namespace Operators { @@ -241,6 +241,6 @@ namespace DD4hep { { return ConditionsOperation<KeyFind>(KeyFind(key)); } } /* End namespace Operators */ - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSSELECTORS_H */ diff --git a/DDCond/include/DDCond/ConditionsSlice.h b/DDCond/include/DDCond/ConditionsSlice.h index f5da5e83e..943ad7083 100644 --- a/DDCond/include/DDCond/ConditionsSlice.h +++ b/DDCond/include/DDCond/ConditionsSlice.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,10 +26,10 @@ #include <memory> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class UserPool; @@ -160,25 +160,25 @@ namespace DD4hep { /** ConditionsMap interface implementation: */ /// ConditionsMap overload: Add a condition directly to the slice - virtual bool insert(DetElement detector, unsigned int key, Condition condition) override; + virtual bool insert(DetElement detector, Condition::itemkey_type key, Condition condition) override; /// ConditionsMap overload: Access a condition - virtual Condition get(DetElement detector, unsigned int key) const override; + virtual Condition get(DetElement detector, Condition::itemkey_type key) const override; /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] virtual std::vector<Condition> get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const override; + Condition::itemkey_type lower, + Condition::itemkey_type upper) const override; /// ConditionsMap overload: Interface to scan data content of the conditions mapping - virtual void scan(const Processor& processor) const override; + virtual void scan(const Condition::Processor& processor) const override; /// ConditionsMap overload: Interface to partially scan data content of the conditions mapping virtual void scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const override; + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const override; }; /// Populate the conditions slice from the conditions manager (convenience) void fill_content(ConditionsManager mgr, ConditionsContent& content, const IOVType& typ); - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCOND_CONDITIONSSLICE_H */ diff --git a/DDCond/include/DDCond/ConditionsTags.h b/DDCond/include/DDCond/ConditionsTags.h index ab2eaeadc..ea28bc34e 100644 --- a/DDCond/include/DDCond/ConditionsTags.h +++ b/DDCond/include/DDCond/ConditionsTags.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,17 +17,17 @@ #include "XML/XMLElements.h" #ifndef UNICODE -#define UNICODE(x) extern const ::DD4hep::XML::Tag_t Unicode_##x +#define UNICODE(x) extern const ::dd4hep::xml::Tag_t Unicode_##x #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { /// Namespace of conditions unicode tags - namespace Conditions { + namespace cond { UNICODE(address); UNICODE(condition); @@ -53,12 +53,12 @@ namespace DD4hep { UNICODE(repository); } // User must ensure there are no clashes. If yes, then the clashing entry is unnecessary. - //using namespace ::DD4hep::XML::Conditions; + //using namespace ::dd4hep::xml::Conditions; } } #undef UNICODE // Do not miss this one! #include "XML/XMLTags.h" -#define _UC(x) ::DD4hep::XML::Conditions::Unicode_##x +#define _UC(x) ::dd4hep::xml::cond::Unicode_##x #endif /* DD4HEP_CONDITIONS_CONDITIONSTAGS_H */ diff --git a/DDCond/include/DDCond/ConditionsTextRepository.h b/DDCond/include/DDCond/ConditionsTextRepository.h index c56bf4860..d89e2de7a 100644 --- a/DDCond/include/DDCond/ConditionsTextRepository.h +++ b/DDCond/include/DDCond/ConditionsTextRepository.h @@ -1,6 +1,6 @@ // $Id: ConditionsTextrepository.h 2336 2016-09-07 17:27:40Z markus.frank@cern.ch $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights For. @@ -20,14 +20,14 @@ // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Forward declarations class IOV; class IOVType; - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Forward declarations @@ -63,7 +63,7 @@ namespace DD4hep { int load(const std::string& input, Data& data) const; }; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } /* End namespace detail */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_CONDITIONSTEXTREPOSITORY_H */ diff --git a/DDCond/include/DDCond/Type1/Manager_Type1.h b/DDCond/include/DDCond/Type1/Manager_Type1.h index b4093e220..26029245b 100644 --- a/DDCond/include/DDCond/Type1/Manager_Type1.h +++ b/DDCond/include/DDCond/Type1/Manager_Type1.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,10 +22,10 @@ #include <memory> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { class Entry; class ConditionsPool; @@ -56,11 +56,11 @@ namespace DD4hep { int m_maxIOVTypes; /// Property: ConditionsPool constructor type (default: empty. MUST BE SET!) std::string m_poolType; - /// Property: UpdatePool constructor type (default: DD4hep_ConditionsLinearUpdatePool) + /// Property: UpdatePool constructor type (default: dd4hep_ConditionsLinearUpdatePool) std::string m_updateType; - /// Property: UserPool constructor type (default: DD4hep_ConditionsLinearUserPool) + /// Property: UserPool constructor type (default: dd4hep_ConditionsLinearUserPool) std::string m_userType; - /// Property: Conditions loader type (default: "multi" -> DD4hep_Conditions_multi_Loader) + /// Property: Conditions loader type (default: "multi" -> dd4hep_Conditions_multi_Loader) std::string m_loaderType; /// Collection of IOV types managed @@ -82,10 +82,10 @@ namespace DD4hep { protected: /// Retrieve a condition set given a Detector Element and the conditions name according to their validity - bool select(key_type key, const iov_type& req_validity, RangeConditions& conditions); + bool select(key_type key, const IOV& req_validity, RangeConditions& conditions); /// Retrieve a condition set given a Detector Element and the conditions name according to their validity - bool select_range(key_type key, const iov_type& req_validity, RangeConditions& conditions); + bool select_range(key_type key, const IOV& req_validity, RangeConditions& conditions); /// Register a set of new managed condition for an IOV range. Called by __load_immediate // void __register_immediate(RangeConditions& c); @@ -98,11 +98,11 @@ namespace DD4hep { /// Set a single conditions value to be managed. /// Requires EXTERNALLY held lock on update pool! - Condition __queue_update(Conditions::Entry* data); + Condition __queue_update(cond::Entry* data); public: /// Standard constructor - Manager_Type1(LCDD& lcdd); + Manager_Type1(Detector& description); /// Default destructor virtual ~Manager_Type1(); @@ -117,13 +117,13 @@ namespace DD4hep { /** Returns (false,pointer) if IOV existed and * (true,pointer) if new IOV was registered to the manager. */ - virtual std::pair<bool, const IOVType*> registerIOVType(size_t iov_type, const std::string& iov_name) final; + virtual std::pair<bool, const IOVType*> registerIOVType(size_t iov_index, const std::string& iov_name) final; /// Access IOV by its type virtual const IOVTypes& iovTypes () const final { return m_iovTypes; } /// Access IOV by its type - virtual const IOVType* iovType (size_t iov_type) const final; + virtual const IOVType* iovType (size_t iov_index) const final; /// Access IOV by its name virtual const IOVType* iovType (const std::string& iov_name) const final; @@ -152,10 +152,10 @@ namespace DD4hep { virtual void pushUpdates() final; /// Retrieve a condition set given a Detector Element and the conditions name according to their validity (deprecated) - virtual Condition get(key_type key, const iov_type& req_validity) final; + virtual Condition get(key_type key, const IOV& req_validity) final; /// Retrieve a condition given a Detector Element and the conditions name (deprecated) - virtual RangeConditions getRange(key_type key, const iov_type& req_validity) final; + virtual RangeConditions getRange(key_type key, const IOV& req_validity) final; /// Create empty user pool object virtual std::unique_ptr<UserPool> createUserPool(const IOVType* iovT) const; @@ -170,6 +170,6 @@ namespace DD4hep { Result prepare(const IOV& req_iov, ConditionsSlice& slice) final; }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSMANAGEROBJECT_TYPE1_H */ diff --git a/DDCond/src/ConditionsContent.cpp b/DDCond/src/ConditionsContent.cpp index 86c511a43..03e8ec84e 100644 --- a/DDCond/src/ConditionsContent.cpp +++ b/DDCond/src/ConditionsContent.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +15,7 @@ #include "DDCond/ConditionsContent.h" #include "DD4hep/InstanceCount.h" -using namespace DD4hep::Conditions; +using namespace dd4hep::cond; /// Default destructor. ConditionsLoadInfo::~ConditionsLoadInfo() { @@ -29,28 +29,28 @@ ConditionsContent::ConditionsContent() /// Default destructor. ConditionsContent::~ConditionsContent() { - releaseObjects(m_derived); - destroyObjects(m_conditions); + detail::releaseObjects(m_derived); + detail::destroyObjects(m_conditions); InstanceCount::decrement(this); } /// Clear the container. Destroys the contained stuff void ConditionsContent::clear() { - releaseObjects(m_derived); - destroyObjects(m_conditions); + detail::releaseObjects(m_derived); + detail::destroyObjects(m_conditions); } /// Remove a new shared condition bool ConditionsContent::remove(Condition::key_type hash) { - Conditions::iterator i = m_conditions.find(hash); + auto i = m_conditions.find(hash); if ( i != m_conditions.end() ) { - deleteObject((*i).second); + detail::deleteObject((*i).second); m_conditions.erase(i); return true; } - Dependencies::iterator j = m_derived.find(hash); + auto j = m_derived.find(hash); if ( j != m_derived.end() ) { - releasePtr((*j).second); + detail::releasePtr((*j).second); m_derived.erase(j); return true; } diff --git a/DDCond/src/ConditionsDataLoader.cpp b/DDCond/src/ConditionsDataLoader.cpp index fb0baa88a..3b7e43ee9 100644 --- a/DDCond/src/ConditionsDataLoader.cpp +++ b/DDCond/src/ConditionsDataLoader.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,13 +18,13 @@ #include "DD4hep/Printout.h" using std::string; -using namespace DD4hep::Conditions; +using namespace dd4hep::cond; DD4HEP_INSTANTIATE_HANDLE_NAMED(ConditionsDataLoader); /// Default constructor -ConditionsDataLoader::ConditionsDataLoader(LCDD& lcdd, ConditionsManager mgr, const string nam) - : NamedObject(nam,"ConditionsDataLoader"), m_lcdd(lcdd), m_mgr(mgr) +ConditionsDataLoader::ConditionsDataLoader(Detector& description, ConditionsManager mgr, const string nam) + : NamedObject(nam,"ConditionsDataLoader"), m_detDesc(description), m_mgr(mgr) { if ( m_mgr.isValid() ) return; except("ConditionsDataLoader","+++ Cannot create loader without a valid conditions manager handle!"); diff --git a/DDCond/src/ConditionsDependencyHandler.cpp b/DDCond/src/ConditionsDependencyHandler.cpp index de6d018a2..ff2d9127f 100644 --- a/DDCond/src/ConditionsDependencyHandler.cpp +++ b/DDCond/src/ConditionsDependencyHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,8 +16,8 @@ #include "DDCond/ConditionsManagerObject.h" #include "DD4hep/Printout.h" -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; /// Default constructor ConditionsDependencyHandler::ConditionsDependencyHandler(ConditionsManager mgr, @@ -36,8 +36,8 @@ ConditionsDependencyHandler::~ConditionsDependencyHandler() { } /// ConditionResolver implementation: Access to the detector description instance -LCDD& ConditionsDependencyHandler::lcdd() const { - return m_manager->lcdd(); +Detector& ConditionsDependencyHandler::detectorDescription() const { + return m_manager->detectorDescription(); } /// ConditionResolver implementation: Interface to access conditions @@ -65,12 +65,12 @@ Condition ConditionsDependencyHandler::get(Condition::key_type key) const { } -/// Internal call to trigger update callback +/// detaill call to trigger update callback Condition::Object* ConditionsDependencyHandler::do_callback(const ConditionDependency& dep) const { try { - Condition::iov_type iov(m_pool.validity().iovType); - ConditionUpdateCall::Context ctxt(*this, dep, m_userParam, iov.reset().invert()); + IOV iov(m_pool.validity().iovType); + ConditionUpdateContext ctxt(*this, dep, m_userParam, iov.reset().invert()); Condition cond = (*dep.callback)(dep.target, ctxt); Condition::Object* obj = cond.ptr(); if ( obj ) { diff --git a/DDCond/src/ConditionsEntry.cpp b/DDCond/src/ConditionsEntry.cpp index b42b3a80c..6afb65101 100644 --- a/DDCond/src/ConditionsEntry.cpp +++ b/DDCond/src/ConditionsEntry.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ #include "DDCond/ConditionsEntry.h" using std::string; -using namespace DD4hep::Conditions; +using namespace dd4hep::cond; /// Default constructor Entry::Entry() @@ -26,7 +26,7 @@ Entry::Entry() } /// Initializing constructor -Entry::Entry(const DD4hep::Geometry::DetElement& det, const string& nam, const string& typ, const string& valid, int h) +Entry::Entry(const DetElement& det, const string& nam, const string& typ, const string& valid, int h) : NamedObject(nam,typ), detector(det), value(), validity(valid), hash(h) { InstanceCount::increment(this); diff --git a/DDCond/src/ConditionsIOVPool.cpp b/DDCond/src/ConditionsIOVPool.cpp index 01364edaa..890a57eae 100644 --- a/DDCond/src/ConditionsIOVPool.cpp +++ b/DDCond/src/ConditionsIOVPool.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,8 +18,8 @@ #include "DD4hep/detail/ConditionsInterna.h" #include "DDCond/ConditionsDataLoader.h" -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; /// Default constructor ConditionsIOVPool::ConditionsIOVPool(const IOVType* typ) : type(typ) { @@ -32,14 +32,14 @@ ConditionsIOVPool::~ConditionsIOVPool() { InstanceCount::decrement(this); } -size_t ConditionsIOVPool::select(Condition::key_type key, const Condition::iov_type& req_validity, RangeConditions& result) +size_t ConditionsIOVPool::select(Condition::key_type key, const IOV& req_validity, RangeConditions& result) { if ( !elements.empty() ) { size_t len = result.size(); const IOV::Key req_key = req_validity.key(); // 16 bytes => better copy! - for(Elements::const_iterator i=elements.begin(); i!=elements.end(); ++i) { - if ( IOV::key_contains_range((*i).first, req_key) ) { - (*i).second->select(key, result); + for( const auto& e : elements ) { + if ( IOV::key_contains_range(e.first, req_key) ) { + e.second->select(key, result); } } return result.size() - len; @@ -47,21 +47,21 @@ size_t ConditionsIOVPool::select(Condition::key_type key, const Condition::iov_t return 0; } -size_t ConditionsIOVPool::selectRange(Condition::key_type key, const Condition::iov_type& req_validity, RangeConditions& result) +size_t ConditionsIOVPool::selectRange(Condition::key_type key, const IOV& req_validity, RangeConditions& result) { size_t len = result.size(); const IOV::Key range = req_validity.key(); - for(Elements::const_iterator i=elements.begin(); i!=elements.end(); ++i) { - const IOV::Key& k = (*i).first; + for( const auto& e : elements ) { + const IOV::Key& k = e.first; if ( IOV::key_is_contained(k,range) ) // IOV test contained in key. Take it! - (*i).second->select(key, result); + e.second->select(key, result); else if ( IOV::key_overlaps_lower_end(k,range) ) // IOV overlap on test on the lower end of key - (*i).second->select(key, result); + e.second->select(key, result); else if ( IOV::key_overlaps_higher_end(k,range) ) // IOV overlap of test on the higher end of key - (*i).second->select(key, result); + e.second->select(key, result); } return result.size() - len; } @@ -70,17 +70,16 @@ size_t ConditionsIOVPool::selectRange(Condition::key_type key, const Condition:: int ConditionsIOVPool::clean(int max_age) { Elements rest; int count = 0; - for(Elements::const_iterator i=elements.begin(); i!=elements.end(); ++i) { - ConditionsPool* pool = (*i).second; - if ( pool->age_value >= max_age ) { - count += pool->size(); - pool->print("Remove"); - delete pool; + for( const auto& e : elements ) { + if ( e.second->age_value >= max_age ) { + count += e.second->size(); + e.second->print("Remove"); + } + else { + rest.insert(e); } - else - rest.insert(make_pair(pool->iov->keyData,pool)); } - elements = rest; + elements = std::move(rest); return count; } @@ -92,15 +91,14 @@ size_t ConditionsIOVPool::select(const IOV& req_validity, size_t num_selected = 0; if ( !elements.empty() ) { const IOV::Key req_key = req_validity.key(); // 16 bytes => better copy! - for(Elements::const_iterator i=elements.begin(); i!=elements.end(); ++i) { - ConditionsPool* pool = (*i).second; - if ( !IOV::key_contains_range((*i).first, req_key) ) { - ++pool->age_value; + for( const auto& i : elements ) { + if ( !IOV::key_contains_range(i.first, req_key) ) { + ++i.second->age_value; continue; } - cond_validity.iov_intersection((*i).first); - num_selected += pool->select_all(valid); - pool->age_value = 0; + cond_validity.iov_intersection(i.first); + num_selected += i.second->select_all(valid); + i.second->age_value = 0; } } return num_selected; @@ -114,15 +112,14 @@ size_t ConditionsIOVPool::select(const IOV& req_validity, size_t num_selected = 0; if ( !elements.empty() ) { const IOV::Key req_key = req_validity.key(); // 16 bytes => better copy! - for(const auto& i : elements ) { - ConditionsPool* pool = i.second; + for( const auto& i : elements ) { if ( !IOV::key_contains_range(i.first, req_key) ) { - ++pool->age_value; + ++i.second->age_value; continue; } cond_validity.iov_intersection(i.first); - num_selected += pool->select_all(predicate_processor); - pool->age_value = 0; + num_selected += i.second->select_all(predicate_processor); + i.second->age_value = 0; } } return num_selected; @@ -136,15 +133,14 @@ size_t ConditionsIOVPool::select(const IOV& req_validity, size_t num_selected = 0; if ( !elements.empty() ) { const IOV::Key req_key = req_validity.key(); // 16 bytes => better copy! - for(const auto& i : elements ) { - ConditionsPool* pool = i.second; + for( const auto& i : elements ) { if ( !IOV::key_contains_range(i.first, req_key) ) { - ++pool->age_value; + ++i.second->age_value; continue; } cond_validity.iov_intersection(i.first); - valid[i.first] = pool; - pool->age_value = 0; + valid[i.first] = i.second; + i.second->age_value = 0; ++num_selected; } } diff --git a/DDCond/src/ConditionsManager.cpp b/DDCond/src/ConditionsManager.cpp index f5d5424e6..68d7d579b 100644 --- a/DDCond/src/ConditionsManager.cpp +++ b/DDCond/src/ConditionsManager.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Errors.h" #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" @@ -23,31 +23,31 @@ #include "DDCond/ConditionsManagerObject.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; DD4HEP_INSTANTIATE_HANDLE_NAMED(ConditionsManagerObject); /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Access specialization - template <> ConditionsManager ConditionsManager::from<LCDD>(LCDD& host) { + template <> ConditionsManager ConditionsManager::from<Detector>(Detector& host) { Object* obj = host.extension<Object>(); if ( obj ) return ConditionsManager(obj); - except("ConditionsManager","+++ Failed to access installed manager from LCDD."); + except("ConditionsManager","+++ Failed to access installed manager from Detector."); return ConditionsManager(); } } } /// Default constructor -ConditionsManagerObject::ConditionsManagerObject(LCDD& ref_lcdd) - : NamedObject(), m_lcdd(ref_lcdd) +ConditionsManagerObject::ConditionsManagerObject(Detector& ref_description) + : NamedObject(), m_detDesc(ref_description) { InstanceCount::increment(this); declareProperty("LoadConditions", m_doLoad); @@ -147,8 +147,8 @@ ConditionsPool* ConditionsManagerObject::registerIOV(const string& data) { } /// Default constructor -ConditionsManager::ConditionsManager(LCDD& lcdd) { - assign(ConditionsManager::from(lcdd).ptr(), "ConditionsManager",""); +ConditionsManager::ConditionsManager(Detector& description) { + assign(ConditionsManager::from(description).ptr(), "ConditionsManager",""); } ConditionsManager& ConditionsManager::initialize() { diff --git a/DDCond/src/ConditionsOperators.cpp b/DDCond/src/ConditionsOperators.cpp index 34ba3f519..97afbc2d4 100644 --- a/DDCond/src/ConditionsOperators.cpp +++ b/DDCond/src/ConditionsOperators.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,34 +23,28 @@ #include <cstring> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; -using DD4hep::Geometry::LCDD; +using namespace dd4hep; +using namespace dd4hep::cond; -/// Select all condition from the conditions manager registered at the LCDD object -size_t Operators::collectAllConditions(LCDD& lcdd, RangeConditions& conditions) { - ConditionsManager manager = ConditionsManager::from(lcdd); +/// Select all condition from the conditions manager registered at the Detector object +size_t Operators::collectAllConditions(Detector& description, RangeConditions& conditions) { + ConditionsManager manager = ConditionsManager::from(description); return collectAllConditions(manager, conditions); } -/// Select all condition from the conditions manager registered at the LCDD object +/// Select all condition from the conditions manager registered at the Detector object size_t Operators::collectAllConditions(ConditionsManager manager, RangeConditions& conditions) { - typedef vector<const IOVType*> _T; - typedef ConditionsIOVPool::Elements _E; - const _T types = manager.iovTypesUsed(); + const auto types = manager.iovTypesUsed(); size_t num_conditions = 0; - for( _T::const_iterator i = types.begin(); i != types.end(); ++i ) { - const IOVType* type = *i; + for( auto type : types ) { if ( type ) { ConditionsIOVPool* pool = manager.iovPool(*type); if ( pool ) { - const _E& e = pool->elements; - for (_E::const_iterator j=e.begin(); j != e.end(); ++j) { - ConditionsPool* cp = (*j).second; + for( auto& cp : pool->elements ) { RangeConditions rc; - cp->select_all(rc); - for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic) - conditions.push_back(*ic); + cp.second->select_all(rc); + for( auto c : rc ) + conditions.push_back(c); num_conditions += rc.size(); } } @@ -59,30 +53,25 @@ size_t Operators::collectAllConditions(ConditionsManager manager, RangeCondition return num_conditions; } -/// Select all condition from the conditions manager registered at the LCDD object -size_t Operators::collectAllConditions(LCDD& lcdd, std::map<int,Condition>& conditions) { - ConditionsManager manager = ConditionsManager::from(lcdd); +/// Select all condition from the conditions manager registered at the Detector object +size_t Operators::collectAllConditions(Detector& description, std::map<int,Condition>& conditions) { + ConditionsManager manager = ConditionsManager::from(description); return collectAllConditions(manager, conditions); } -/// Select all condition from the conditions manager registered at the LCDD object +/// Select all condition from the conditions manager registered at the Detector object size_t Operators::collectAllConditions(ConditionsManager manager, std::map<int,Condition>& conditions) { - typedef vector<const IOVType*> _T; - typedef ConditionsIOVPool::Elements _E; - const _T types = manager.iovTypesUsed(); + const auto types = manager.iovTypesUsed(); size_t num_conditions = 0; - for( _T::const_iterator i = types.begin(); i != types.end(); ++i ) { - const IOVType* type = *i; + for( auto type : types ) { if ( type ) { ConditionsIOVPool* pool = manager.iovPool(*type); if ( pool ) { - const _E& e = pool->elements; - for (_E::const_iterator j=e.begin(); j != e.end(); ++j) { - ConditionsPool* cp = (*j).second; + for( auto& cp : pool->elements ) { RangeConditions rc; - cp->select_all(rc); - for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic) - conditions.insert(make_pair((*ic)->hash,*ic)); + cp.second->select_all(rc); + for( auto c : rc ) + conditions.insert(make_pair(c->hash,c)); num_conditions += rc.size(); } } diff --git a/DDCond/src/ConditionsPool.cpp b/DDCond/src/ConditionsPool.cpp index 93dea0aeb..f35f3d0b3 100644 --- a/DDCond/src/ConditionsPool.cpp +++ b/DDCond/src/ConditionsPool.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,8 +20,8 @@ #include "DD4hep/detail/ConditionsInterna.h" using std::string; -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; DD4HEP_INSTANTIATE_HANDLE_NAMED(UpdatePool); DD4HEP_INSTANTIATE_HANDLE_NAMED(ConditionsPool); diff --git a/DDCond/src/ConditionsRepository.cpp b/DDCond/src/ConditionsRepository.cpp index 9385beeb8..4a17f22b2 100644 --- a/DDCond/src/ConditionsRepository.cpp +++ b/DDCond/src/ConditionsRepository.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -29,12 +29,12 @@ #include <map> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; -typedef XML::Handle_t xml_h; -typedef XML::Element xml_elt_t; -typedef XML::Document xml_doc_t; -typedef XML::Collection_t xml_coll_t; +using namespace dd4hep; +using namespace dd4hep::cond; +typedef xml::Handle_t xml_h; +typedef xml::Element xml_elt_t; +typedef xml::Document xml_doc_t; +typedef xml::Collection_t xml_coll_t; typedef map<Condition::key_type,Condition> AllConditions; @@ -51,18 +51,18 @@ namespace { int createXML(const string& output, const AllConditions& all) { const char comment[] = "\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - " ++++ Linear collider detector description LCDD in C++ ++++\n" - " ++++ DD4hep Detector description generator. ++++\n" + " ++++ Linear collider detector description Detector in C++ ++++\n" + " ++++ dd4hep Detector description generator. ++++\n" " ++++ ++++\n" " ++++ ++++\n" " ++++ M.Frank CERN/LHCb ++++\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n "; - DD4hep::XML::DocumentHandler docH; + dd4hep::xml::DocumentHandler docH; xml_doc_t doc = docH.create("collection", comment); xml_elt_t root = doc.root(), cond(0); - for(AllConditions::const_iterator i=all.begin(); i!=all.end(); ++i) { + for( const auto& i : all ) { char text[32]; - Condition c = (*i).second; + Condition c = i.second; ::snprintf(text,sizeof(text),"0x%16llX",c.key()); root.append(cond = xml_elt_t(doc, _U(ref))); cond.setAttr(_U(key), text); @@ -95,7 +95,7 @@ namespace { data.push_back(e); } }; - XML::DocumentHolder doc(XML::DocumentHandler().load(input)); + xml::DocumentHolder doc(xml::DocumentHandler().load(input)); xml_h root = doc.root(); xml_coll_t(root, _U(ref)).for_each(Conv(data)); return 1; @@ -114,8 +114,8 @@ namespace { ::snprintf(fmt,sizeof(fmt),"%%16llX%c%%s%c%%s%c",sep,sep,sep); } else { - for(AllConditions::const_iterator i=all.begin(); i!=all.end(); ++i) { - Condition::Object* c = (*i).second.ptr(); + for( const auto& i : all ) { + Condition::Object* c = i.second.ptr(); size_t siz_n = c->name.length(); size_t siz_a = c->address.length(); if ( siz_nam < siz_n ) siz_nam = siz_n; @@ -129,8 +129,8 @@ namespace { << "." << long(siz_nam) << "." << long(siz_add) << "." << long(siz_tot) << endl; - for(AllConditions::const_iterator i=all.begin(); i!=all.end(); ++i) { - Condition c = (*i).second; + for( const auto& i : all ) { + Condition c = i.second; ::snprintf(text, sizeof(text), fmt, c.key(), c.name(), c.address().c_str()); out << text << endl; } @@ -188,23 +188,17 @@ namespace { /// Save the repository to file int ConditionsRepository::save(ConditionsManager manager, const string& output) const { - typedef vector<const IOVType*> _T; - typedef ConditionsIOVPool::Elements _E; - typedef RangeConditions _R; AllConditions all; - const _T types = manager.iovTypesUsed(); - for( _T::const_iterator i = types.begin(); i != types.end(); ++i ) { - const IOVType* type = *i; + const auto types = manager.iovTypesUsed(); + for( const IOVType* type : types ) { if ( type ) { ConditionsIOVPool* pool = manager.iovPool(*type); if ( pool ) { - const _E& e = pool->elements; - for (_E::const_iterator j=e.begin(); j != e.end(); ++j) { - ConditionsPool* cp = (*j).second; - _R rc; - cp->select_all(rc); - for(_R::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic) - all[(*ic).key()] = *ic; + for( const auto& cp : pool->elements ) { + RangeConditions rc; + cp.second->select_all(rc); + for( const auto cond : rc ) + all[cond.key()] = cond; } } } diff --git a/DDCond/src/ConditionsSlice.cpp b/DDCond/src/ConditionsSlice.cpp index 4427db301..fbf390a64 100644 --- a/DDCond/src/ConditionsSlice.cpp +++ b/DDCond/src/ConditionsSlice.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,9 @@ #include "DD4hep/InstanceCount.h" #include "DD4hep/Printout.h" -using namespace DD4hep::Conditions; +using namespace std; +using namespace dd4hep; +using namespace dd4hep::cond; /// Initializing constructor ConditionsSlice::ConditionsSlice(ConditionsManager m) : manager(m) @@ -26,7 +28,7 @@ ConditionsSlice::ConditionsSlice(ConditionsManager m) : manager(m) } /// Initializing constructor -ConditionsSlice::ConditionsSlice(ConditionsManager m, const std::shared_ptr<ConditionsContent>& c) +ConditionsSlice::ConditionsSlice(ConditionsManager m, const shared_ptr<ConditionsContent>& c) : manager(m), content(c) { InstanceCount::increment(this); @@ -55,13 +57,13 @@ bool ConditionsSlice::manage(ConditionsPool* p, Condition condition, ManageFlag bool ret = false; if ( flg®ISTER_MANAGER ) { if ( !p ) { - DD4hep::except("ConditionsSlice", + dd4hep::except("ConditionsSlice", "manage_condition: Cannot access conditions pool according to IOV:%s.", pool->validity().str().c_str()); } ret = manager.registerUnlocked(*p,condition); if ( !ret ) { - DD4hep::except("ConditionsSlice", + dd4hep::except("ConditionsSlice", "manage_condition: Failed to register condition %016llx according to IOV:%s.", condition->hash, pool->validity().str().c_str()); } @@ -69,14 +71,14 @@ bool ConditionsSlice::manage(ConditionsPool* p, Condition condition, ManageFlag if ( flg®ISTER_POOL ) { ret = pool->insert(condition); if ( !ret ) { - DD4hep::except("ConditionsSlice", + dd4hep::except("ConditionsSlice", "manage_condition: Failed to register condition %016llx to user pool with IOV:%s.", condition->hash, pool->validity().str().c_str()); } } return ret; } - DD4hep::except("ConditionsSlice", + dd4hep::except("ConditionsSlice", "manage_condition: Cannot manage invalid condition!"); return false; } @@ -88,54 +90,54 @@ bool ConditionsSlice::manage(Condition condition, ManageFlag flg) { } /// Access all conditions from a given detector element -std::vector<Condition> ConditionsSlice::get(DetElement detector) const { +vector<Condition> ConditionsSlice::get(DetElement detector) const { return pool->get(detector,FIRST_ITEM,LAST_ITEM); } /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] -std::vector<Condition> ConditionsSlice::get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const { +vector<Condition> ConditionsSlice::get(DetElement detector, + Condition::itemkey_type lower, + Condition::itemkey_type upper) const { return pool->get(detector, lower, upper); } /// ConditionsMap overload: Add a condition directly to the slice -bool ConditionsSlice::insert(DetElement detector, unsigned int key, Condition condition) { +bool ConditionsSlice::insert(DetElement detector, Condition::itemkey_type key, Condition condition) { if ( condition.isValid() ) { ConditionsPool* p = manager.registerIOV(pool->validity()); if ( !p ) { - DD4hep::except("ConditionsSlice", + dd4hep::except("ConditionsSlice", "manage_condition: Cannot access conditions pool according to IOV:%s.", pool->validity().str().c_str()); } bool ret = manager.registerUnlocked(*p,condition); if ( !ret ) { - DD4hep::except("ConditionsSlice", + dd4hep::except("ConditionsSlice", "manage_condition: Failed to register condition %016llx according to IOV:%s.", condition->hash, pool->validity().str().c_str()); } return pool->insert(detector, key, condition); } - DD4hep::except("ConditionsSlice", + dd4hep::except("ConditionsSlice", "insert_condition: Cannot insert invalid condition to the user pool!"); return false; } /// ConditionsMap overload: Access a condition -Condition ConditionsSlice::get(DetElement detector, unsigned int key) const { +Condition ConditionsSlice::get(DetElement detector, Condition::itemkey_type key) const { return pool->get(detector, key); } /// ConditionsMap overload: Interface to scan data content of the conditions mapping -void ConditionsSlice::scan(const Processor& processor) const { +void ConditionsSlice::scan(const Condition::Processor& processor) const { pool->scan(processor); } /// ConditionsMap overload: Interface to partially scan data content of the conditions mapping void ConditionsSlice::scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const { + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const { pool->scan(detector, lower, upper, processor); } @@ -156,7 +158,7 @@ namespace { // test load info access const ConditionsContent::Conditions& cc=content.conditions(); auto i = cc.find(c->hash); - std::string* address = (*i).second->data<std::string>(); + string* address = (*i).second->data<string>(); if ( address ) {} #endif return true; @@ -167,12 +169,12 @@ namespace { } /// Populate the conditions slice from the conditions manager (convenience) -void DD4hep::Conditions::fill_content(ConditionsManager mgr, - ConditionsContent& content, - const IOVType& typ) +void dd4hep::cond::fill_content(ConditionsManager mgr, + ConditionsContent& content, + const IOVType& typ) { - Conditions::ConditionsIOVPool* iovPool = mgr.iovPool(typ); - Conditions::ConditionsIOVPool::Elements& pools = iovPool->elements; + ConditionsIOVPool* iovPool = mgr.iovPool(typ); + ConditionsIOVPool::Elements& pools = iovPool->elements; for_each(begin(pools),end(pools),SliceOper(content)); } diff --git a/DDCond/src/ConditionsTags.cpp b/DDCond/src/ConditionsTags.cpp index f34205ff6..2f6be665b 100644 --- a/DDCond/src/ConditionsTags.cpp +++ b/DDCond/src/ConditionsTags.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,5 +16,5 @@ #include "XML/XMLElements.h" // Define unicode tags -#define UNICODE(x) extern const ::DD4hep::XML::Tag_t Unicode_##x ( #x ) +#define UNICODE(x) extern const ::dd4hep::xml::Tag_t Unicode_##x ( #x ) #include "DDCond/ConditionsTags.h" diff --git a/DDCond/src/ConditionsTextRepository.cpp b/DDCond/src/ConditionsTextRepository.cpp index 4e6b04ac3..299dcc662 100644 --- a/DDCond/src/ConditionsTextRepository.cpp +++ b/DDCond/src/ConditionsTextRepository.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,12 +28,12 @@ #include <map> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; -typedef XML::Handle_t xml_h; -typedef XML::Element xml_elt_t; -typedef XML::Document xml_doc_t; -typedef XML::Collection_t xml_coll_t; +using namespace dd4hep; +using namespace dd4hep::cond; +typedef xml::Handle_t xml_h; +typedef xml::Element xml_elt_t; +typedef xml::Document xml_doc_t; +typedef xml::Collection_t xml_coll_t; typedef map<Condition::key_type,Condition> AllConditions; @@ -48,25 +48,24 @@ ConditionsTextRepository::~ConditionsTextRepository() { namespace { int createXML(const string& output, const AllConditions& all) { + char text[32]; const char comment[] = "\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - " ++++ Linear collider detector description LCDD in C++ ++++\n" - " ++++ DD4hep Detector description generator. ++++\n" + " ++++ Linear collider detector description Detector in C++ ++++\n" + " ++++ dd4hep Detector description generator. ++++\n" " ++++ ++++\n" " ++++ ++++\n" " ++++ M.Frank CERN/LHCb ++++\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n "; - DD4hep::XML::DocumentHandler docH; + dd4hep::xml::DocumentHandler docH; xml_doc_t doc = docH.create("collection", comment); xml_elt_t root = doc.root(), cond(0); - for(AllConditions::const_iterator i=all.begin(); i!=all.end(); ++i) { - char text[32]; - Condition c = (*i).second; - ::snprintf(text,sizeof(text),"0x%16llX",c.key()); + for( const auto& c : all ) { + ::snprintf(text,sizeof(text),"0x%16llX",c.second.key()); root.append(cond = xml_elt_t(doc, _U(ref))); - cond.setAttr(_U(key), text); - cond.setAttr(_U(name), c.name()); - cond.setAttr(_U(ref), c.address()); + cond.setAttr(_U(key), text); + cond.setAttr(_U(name), c.second.name()); + cond.setAttr(_U(ref), c.second.address()); } printout(ALWAYS,"ConditionsRepository","++ Handled %ld conditions.",all.size()); if ( !output.empty() ) { @@ -94,7 +93,7 @@ namespace { data.push_back(e); } }; - XML::DocumentHolder doc(XML::DocumentHandler().load(input)); + xml::DocumentHolder doc(xml::DocumentHandler().load(input)); xml_h root = doc.root(); xml_coll_t(root, _U(ref)).for_each(Conv(data)); return 1; @@ -113,8 +112,8 @@ namespace { ::snprintf(fmt,sizeof(fmt),"%%16llX%c%%s%c%%s%c",sep,sep,sep); } else { - for(AllConditions::const_iterator i=all.begin(); i!=all.end(); ++i) { - Condition::Object* c = (*i).second.ptr(); + for( const auto& i : all ) { + Condition::Object* c = i.second.ptr(); size_t siz_n = c->name.length(); size_t siz_a = c->address.length(); if ( siz_nam < siz_n ) siz_nam = siz_n; @@ -128,8 +127,8 @@ namespace { << "." << long(siz_nam) << "." << long(siz_add) << "." << long(siz_tot) << endl; - for(AllConditions::const_iterator i=all.begin(); i!=all.end(); ++i) { - Condition c = (*i).second; + for( const auto& i : all ) { + Condition c = i.second; ::snprintf(text, sizeof(text), fmt, c.key(), c.name(), c.address().c_str()); out << text << endl; } @@ -195,23 +194,17 @@ namespace { /// Save the repository to file int ConditionsTextRepository::save(ConditionsManager manager, const string& output) const { - typedef vector<const IOVType*> _T; - typedef ConditionsIOVPool::Elements _E; - typedef RangeConditions _R; AllConditions all; - const _T types = manager.iovTypesUsed(); - for( _T::const_iterator i = types.begin(); i != types.end(); ++i ) { - const IOVType* type = *i; + const auto types = manager.iovTypesUsed(); + for( const IOVType* type : types ) { if ( type ) { ConditionsIOVPool* pool = manager.iovPool(*type); if ( pool ) { - const _E& e = pool->elements; - for (_E::const_iterator j=e.begin(); j != e.end(); ++j) { - ConditionsPool* cp = (*j).second; - _R rc; - cp->select_all(rc); - for(_R::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic) - all[(*ic).key()] = *ic; + for ( const auto& cp : pool->elements ) { + RangeConditions rc; + cp.second->select_all(rc); + for(auto c : rc ) + all[c.key()] = c; } } } diff --git a/DDCond/src/Type1/Manager_Type1.cpp b/DDCond/src/Type1/Manager_Type1.cpp index 4ec3c3f01..5659452b7 100644 --- a/DDCond/src/Type1/Manager_Type1.cpp +++ b/DDCond/src/Type1/Manager_Type1.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ // Framework include files #include "DDCond/Type1/Manager_Type1.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/World.h" #include "DD4hep/Errors.h" #include "DD4hep/Plugins.h" @@ -34,18 +34,18 @@ #include "DDCond/ConditionsDataLoader.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; typedef UpdatePool::UpdateEntries Updates; typedef RangeConditions RC; DD4HEP_INSTANTIATE_HANDLE_NAMED(Manager_Type1); -static void* ddcond_create_manager_instance(LCDD& lcdd, int, char**) { - return (ConditionsManagerObject*)new Manager_Type1(lcdd); +static void* ddcond_create_manager_instance(Detector& description, int, char**) { + return (ConditionsManagerObject*)new Manager_Type1(description); } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsManager_Type1,ddcond_create_manager_instance) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsManager_Type1,ddcond_create_manager_instance) #define NO_AGE 0 @@ -133,15 +133,15 @@ namespace { } /// Standard constructor -Manager_Type1::Manager_Type1(LCDD& lcdd_instance) - : ConditionsManagerObject(lcdd_instance), ObjectExtensions(typeid(Manager_Type1)), +Manager_Type1::Manager_Type1(Detector& description_instance) + : ConditionsManagerObject(description_instance), ObjectExtensions(typeid(Manager_Type1)), m_updateLock(), m_poolLock(), m_updatePool(), m_rawPool(), m_locked(0) { InstanceCount::increment(this); declareProperty("MaxIOVTypes", m_maxIOVTypes=32); declareProperty("PoolType", m_poolType = ""); - declareProperty("UpdatePoolType", m_updateType = "DD4hep_ConditionsLinearUpdatePool"); - declareProperty("UserPoolType", m_userType = "DD4hep_ConditionsMapUserPool"); + declareProperty("UpdatePoolType", m_updateType = "dd4hep_ConditionsLinearUpdatePool"); + declareProperty("UserPoolType", m_userType = "dd4hep_ConditionsMapUserPool"); declareProperty("LoaderType", m_loaderType = "multi"); m_iovTypes.resize(m_maxIOVTypes,IOVType()); m_rawPool.resize(m_maxIOVTypes,0); @@ -149,17 +149,17 @@ Manager_Type1::Manager_Type1(LCDD& lcdd_instance) /// Default destructor Manager_Type1::~Manager_Type1() { - for_each(m_rawPool.begin(), m_rawPool.end(), DestroyObject<ConditionsIOVPool*>()); + for_each(m_rawPool.begin(), m_rawPool.end(), detail::DestroyObject<ConditionsIOVPool*>()); InstanceCount::decrement(this); } void Manager_Type1::initialize() { if ( !m_updatePool.get() ) { - string typ = "DD4hep_Conditions_"+m_loaderType+"_Loader"; + string typ = "dd4hep_Conditions_"+m_loaderType+"_Loader"; const void* argv_loader[] = {"ConditionsDataLoader", this, 0}; const void* argv_pool[] = {this, 0}; - m_loader.reset(createPlugin<ConditionsDataLoader>(typ,m_lcdd,2,argv_loader)); - m_updatePool.reset(createPlugin<UpdatePool>(m_updateType,m_lcdd,1,argv_pool)); + m_loader.reset(createPlugin<ConditionsDataLoader>(typ,m_detDesc,2,argv_loader)); + m_updatePool.reset(createPlugin<UpdatePool>(m_updateType,m_detDesc,1,argv_pool)); if ( !m_updatePool.get() ) { except("ConditionsManager","+++ The update pool of type %s cannot be created. [%s]", m_updateType.c_str(),Errors::noSys().c_str()); @@ -171,35 +171,35 @@ void Manager_Type1::initialize() { } /// Register new IOV type if it does not (yet) exist. -pair<bool, const IOVType*> Manager_Type1::registerIOVType(size_t iov_type, const string& iov_name) { - if ( iov_type<m_iovTypes.size() ) { - IOVType& typ = m_iovTypes[iov_type]; - bool eq_type = typ.type == iov_type; +pair<bool, const IOVType*> Manager_Type1::registerIOVType(size_t iov_index, const string& iov_name) { + if ( iov_index<m_iovTypes.size() ) { + IOVType& typ = m_iovTypes[iov_index]; + bool eq_type = typ.type == iov_index; bool eq_name = typ.name == iov_name; if ( eq_type && eq_name ) { return make_pair(false,&typ); } else if ( typ.type != 0 && eq_type && !eq_name ) { except("ConditionsManager","Cannot register IOV %s. Type %d already in use!", - iov_name.c_str(), iov_type); + iov_name.c_str(), iov_index); } typ.name = iov_name; - typ.type = iov_type; + typ.type = iov_index; m_rawPool[typ.type] = new ConditionsIOVPool(&typ); return make_pair(true,&typ); } except("ConditionsManager","Cannot register IOV section %d of type %d. Value out of bounds: [%d,%d]", - iov_name.c_str(), iov_type, 0, int(m_iovTypes.size())); + iov_name.c_str(), iov_index, 0, int(m_iovTypes.size())); return make_pair(false,(IOVType*)0); } /// Access IOV by its type -const IOVType* Manager_Type1::iovType (size_t iov_type) const { - if ( iov_type<m_iovTypes.size() ) { - const IOVType& typ = m_iovTypes[iov_type]; - if ( typ.type == iov_type ) return &typ; +const IOVType* Manager_Type1::iovType (size_t iov_index) const { + if ( iov_index<m_iovTypes.size() ) { + const IOVType& typ = m_iovTypes[iov_index]; + if ( typ.type == iov_index ) return &typ; } - except("ConditionsManager","Request to access an unregistered IOV type: %d.", iov_type); + except("ConditionsManager","Request to access an unregistered IOV type: %d.", iov_index); return 0; } @@ -221,16 +221,16 @@ ConditionsPool* Manager_Type1::registerIOV(const IOVType& typ, IOV::Key key) { } ConditionsIOVPool::Elements::const_iterator i = pool->elements.find(key); if ( i != pool->elements.end() ) { - return (*i).second; + return (*i).second.get(); } const void* argv_pool[] = {this, 0}; - ConditionsPool* cond_pool = createPlugin<ConditionsPool>(m_poolType,m_lcdd,1,argv_pool); + shared_ptr<ConditionsPool> cond_pool(createPlugin<ConditionsPool>(m_poolType,m_detDesc,1,argv_pool)); IOV* iov = new IOV(&typ); iov->type = typ.type; iov->keyData = key; cond_pool->iov = iov; pool->elements.insert(make_pair(key,cond_pool)); - return cond_pool; + return cond_pool.get(); } /// Access conditions multi IOV pool by iov type @@ -255,13 +255,11 @@ bool Manager_Type1::registerUnlocked(ConditionsPool& pool, Condition cond) { /// Set a single conditions value to be managed. /// Requires external lock on update pool! -Condition Manager_Type1::__queue_update(Conditions::Entry* e) { +Condition Manager_Type1::__queue_update(cond::Entry* e) { if ( e ) { ConditionsPool* p = this->ConditionsManagerObject::registerIOV(e->validity); Condition condition(e->name,e->type); Condition::Object* c = condition.ptr(); - //c->name = e->name; - // c->type = e->type; c->value = e->value; c->comment = "----"; c->address = "----"; @@ -287,7 +285,7 @@ void Manager_Type1::__get_checked_pool(const IOV& req_iov, ConditionsIOVPool* pool = m_rawPool[typ->type]; if ( 0 == up.get() ) { const void* argv[] = {this, pool, 0}; - UserPool* p = createPlugin<UserPool>(m_userType,m_lcdd,2,argv); + UserPool* p = createPlugin<UserPool>(m_userType,m_detDesc,2,argv); up.reset(p); } return; @@ -345,7 +343,7 @@ void Manager_Type1::pushUpdates() { /// Retrieve a condition set given a Detector Element and the conditions name according to their validity bool Manager_Type1::select(Condition::key_type key, - const Condition::iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) { { ConditionsIOVPool* p = 0; @@ -362,7 +360,7 @@ bool Manager_Type1::select(Condition::key_type key, /// Retrieve a condition set given a Detector Element and the conditions name according to their validity bool Manager_Type1::select_range(Condition::key_type key, - const Condition::iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) { { @@ -380,7 +378,7 @@ bool Manager_Type1::select_range(Condition::key_type key, /// Retrieve a condition given a Detector Element and the conditions name Condition -Manager_Type1::get(Condition::key_type key, const Condition::iov_type& iov) +Manager_Type1::get(Condition::key_type key, const IOV& iov) { RC conditions; __check_values__<Discrete>(this, key, &iov); @@ -415,7 +413,7 @@ Manager_Type1::get(Condition::key_type key, const Condition::iov_type& iov) /// Retrieve a condition given a Detector Element and the conditions name RangeConditions -Manager_Type1::getRange(Condition::key_type key, const Condition::iov_type& iov) +Manager_Type1::getRange(Condition::key_type key, const IOV& iov) { RC conditions; __check_values__<Range>(this, key, &iov); @@ -456,7 +454,7 @@ std::unique_ptr<UserPool> Manager_Type1::createUserPool(const IOVType* iovT) co if ( iovT ) { ConditionsIOVPool* p = m_rawPool[iovT->type]; const void* argv[] = {this, p, 0}; - std::unique_ptr<UserPool> pool(createPlugin<UserPool>(m_userType,m_lcdd,2,argv)); + std::unique_ptr<UserPool> pool(createPlugin<UserPool>(m_userType,m_detDesc,2,argv)); return pool; } // Invalid IOV type. Throw exception diff --git a/DDCond/src/plugins/ConditionsLinearPool.cpp b/DDCond/src/plugins/ConditionsLinearPool.cpp index 9df3a4c90..3562ece26 100644 --- a/DDCond/src/plugins/ConditionsLinearPool.cpp +++ b/DDCond/src/plugins/ConditionsLinearPool.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,10 +24,10 @@ #include <list> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Class implementing the conditions collection for a given IOV type /** @@ -44,10 +44,7 @@ namespace DD4hep { template<typename MAPPING, typename BASE> class ConditionsLinearPool : public BASE { protected: - typedef BASE Base; - typedef MAPPING Mapping; - typedef typename BASE::key_type key_type; - Mapping m_entries; + MAPPING m_entries; /// Helper function to loop over the conditions container and apply a functor template <typename R,typename T> size_t loop(R& result, T functor) { @@ -114,7 +111,6 @@ namespace DD4hep { template<typename MAPPING, typename BASE> class ConditionsLinearUpdatePool : public ConditionsLinearPool<MAPPING,BASE> { - typedef typename ConditionsLinearPool<MAPPING,BASE>::key_type key_type; public: /// Default constructor ConditionsLinearUpdatePool(ConditionsManager mgr) @@ -141,7 +137,7 @@ namespace DD4hep { /// Select the conditions matching the DetElement and the conditions name virtual void select_range(Condition::key_type key, - const Condition::iov_type& req, + const IOV& req, RangeConditions& result) final { MAPPING& m = this->ConditionsLinearPool<MAPPING,BASE>::m_entries; @@ -171,13 +167,13 @@ namespace DD4hep { }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif // DDCOND_CONDITIONSLINEARPOOL_H // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -193,8 +189,8 @@ namespace DD4hep { //#include "DDCond/ConditionsLinearPool.h" #include "DD4hep/InstanceCount.h" -using DD4hep::Handle; -using namespace DD4hep::Conditions; +using dd4hep::Handle; +using namespace dd4hep::cond; /// Default constructor template<typename MAPPING, typename BASE> @@ -210,26 +206,28 @@ ConditionsLinearPool<MAPPING,BASE>::~ConditionsLinearPool() { } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #include "DD4hep/Factories.h" namespace { + using namespace dd4hep; + ConditionsManager _mgr(int argc, char** argv) { if ( argc > 0 ) { ConditionsManager::Object* m = (ConditionsManager::Object*)argv[0]; return m; } - DD4hep::except("ConditionsLinearPool","++ Insufficient arguments: arg[0] = ConditionManager!"); + dd4hep::except("ConditionsLinearPool","++ Insufficient arguments: arg[0] = ConditionManager!"); return ConditionsManager(0); } -#define _CR(fun,x,b,y) void* fun(DD4hep::Geometry::LCDD&, int argc, char** argv) \ +#define _CR(fun,x,b,y) void* fun(dd4hep::Detector&, int argc, char** argv) \ { return new b<x<Condition::Object*>,y>(_mgr(argc,argv)); } /// Create a conditions pool based on STL vectors _CR(create_vector_pool,std::vector,ConditionsLinearPool,ConditionsPool) @@ -241,10 +239,10 @@ namespace { _CR(create_list_update_pool,std::list,ConditionsLinearUpdatePool,UpdatePool) } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsLinearPool, create_vector_pool) -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsLinearVectorPool, create_vector_pool) -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsLinearUpdatePool, create_vector_update_pool) -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsLinearVectorUpdatePool,create_vector_update_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsLinearPool, create_vector_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsLinearVectorPool, create_vector_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsLinearUpdatePool, create_vector_update_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsLinearVectorUpdatePool,create_vector_update_pool) -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsLinearListPool, create_list_pool) -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsLinearListUpdatePool, create_list_update_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsLinearListPool, create_list_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsLinearListUpdatePool, create_list_update_pool) diff --git a/DDCond/src/plugins/ConditionsMappedPool.cpp b/DDCond/src/plugins/ConditionsMappedPool.cpp index 158e5384a..4335cd594 100644 --- a/DDCond/src/plugins/ConditionsMappedPool.cpp +++ b/DDCond/src/plugins/ConditionsMappedPool.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,10 +25,10 @@ #include <unordered_map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Class implementing the conditions collection for a given IOV type /** @@ -49,7 +49,6 @@ namespace DD4hep { typedef BASE Base; typedef MAPPING Mapping; typedef ConditionsMappedPool<Mapping,Base> Self; - typedef typename BASE::key_type key_type; protected: Mapping m_entries; @@ -135,7 +134,6 @@ namespace DD4hep { { public: typedef ConditionsMappedPool<MAPPING,BASE> Self; - typedef typename ConditionsMappedPool<MAPPING,BASE>::key_type key_type; public: /// Default constructor ConditionsMappedUpdatePool(ConditionsManager mgr) @@ -146,14 +144,14 @@ namespace DD4hep { /// Adopt all entries sorted by IOV. Entries will be removed from the pool virtual size_t popEntries(UpdatePool::UpdateEntries& entries) final { - ClearOnReturn<MAPPING> clr(this->Self::m_entries); - return this->Self::loop(entries, [&entries](const std::pair<key_type,Condition::Object*>& o) { + detail::ClearOnReturn<MAPPING> clr(this->Self::m_entries); + return this->Self::loop(entries, [&entries](const std::pair<Condition::key_type,Condition::Object*>& o) { entries[o.second->iov].push_back(Condition(o.second));}); } /// Select the conditions matching the DetElement and the conditions name virtual void select_range(Condition::key_type key, - const Condition::iov_type& req, + const IOV& req, RangeConditions& result) final { //return this->Self::loop(entries, [&entries](const std::pair<key_type,Condition::Object*>& o) { @@ -183,12 +181,12 @@ namespace DD4hep { } } }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSMAPPEDPOOL_H */ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -204,8 +202,8 @@ namespace DD4hep { //#include "DDCond/ConditionsMappedPool.h" #include "DD4hep/InstanceCount.h" -using DD4hep::Handle; -using namespace DD4hep::Conditions; +using dd4hep::Handle; +using namespace dd4hep::cond; /// Default constructor template<typename MAPPING, typename BASE> @@ -222,17 +220,17 @@ ConditionsMappedPool<MAPPING,BASE>::~ConditionsMappedPool() { #include "DD4hep/Factories.h" namespace { - typedef Condition::key_type key_type; + using namespace dd4hep; ConditionsManager _mgr(int argc, char** argv) { if ( argc > 0 ) { ConditionsManagerObject* m = (ConditionsManagerObject*)argv[0]; return m; } - DD4hep::except("ConditionsMappedPool","++ Insufficient arguments: arg[0] = ConditionManager!"); + dd4hep::except("ConditionsMappedPool","++ Insufficient arguments: arg[0] = ConditionManager!"); return ConditionsManager(0); } -#define _CR(fun,x,b,y) void* fun(DD4hep::Geometry::LCDD&, int argc, char** argv) \ - { return new b<x<key_type,Condition::Object*>,y>(_mgr(argc,argv)); } +#define _CR(fun,x,b,y) void* fun(dd4hep::Detector&, int argc, char** argv) \ + { return new b<x<Condition::key_type,Condition::Object*>,y>(_mgr(argc,argv)); } /// Create a conditions pool based on STL maps _CR(create_map_pool,std::map,ConditionsMappedPool,ConditionsPool) @@ -243,7 +241,7 @@ namespace { /// Create a conditions update pool based on STL hash-maps (unordered_map) _CR(create_unordered_map_update_pool,std::unordered_map,ConditionsMappedUpdatePool,UpdatePool) } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsMappedPool, create_map_pool) -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsHashedPool, create_unordered_map_pool) -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsMappedUpdatePool, create_map_update_pool) -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsHashedUpdatePool, create_unordered_map_update_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsMappedPool, create_map_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsHashedPool, create_unordered_map_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsMappedUpdatePool, create_map_update_pool) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsHashedUpdatePool, create_unordered_map_update_pool) diff --git a/DDCond/src/plugins/ConditionsMultiLoader.cpp b/DDCond/src/plugins/ConditionsMultiLoader.cpp index 48fc55081..43f4eb5ac 100644 --- a/DDCond/src/plugins/ConditionsMultiLoader.cpp +++ b/DDCond/src/plugins/ConditionsMultiLoader.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ #include "DD4hep/Printout.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class ConditionsHandler; @@ -40,36 +40,36 @@ namespace DD4hep { Loaders m_loaders; OpenSources m_openSources; - ConditionsDataLoader* load_source(const std::string& nam,const iov_type& req_validity); + ConditionsDataLoader* load_source(const std::string& nam,const IOV& req_validity); public: /// Default constructor - ConditionsMultiLoader(LCDD& lcdd, ConditionsManager mgr, const std::string& nam); + ConditionsMultiLoader(Detector& description, ConditionsManager mgr, const std::string& nam); /// Default destructor virtual ~ConditionsMultiLoader(); /// Load a condition set given a Detector Element and the conditions name according to their validity virtual size_t load_single(key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions); /// Load a condition set given a Detector Element and the conditions name according to their validity virtual size_t load_range( key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions); /// Optimized update using conditions slice data - virtual size_t load_many( const iov_type& /* req_validity */, + virtual size_t load_many( const IOV& /* req_validity */, RequiredItems& /* work */, LoadedItems& /* loaded */, - iov_type& /* conditions_validity */) + IOV& /* conditions_validity */) { except("ConditionsLoader","+++ update: Invalid call!"); return 0; } }; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } /* End namespace detail */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_MULTICONDITONSLOADER_H */ -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -92,20 +92,20 @@ namespace DD4hep { // Forward declartions using std::string; -using namespace DD4hep::Conditions; +using namespace dd4hep::cond; namespace { - void* create_loader(DD4hep::Geometry::LCDD& lcdd, int argc, char** argv) { + void* create_loader(dd4hep::Detector& description, int argc, char** argv) { const char* name = argc>0 ? argv[0] : "MULTILoader"; ConditionsManager::Object* mgr = (ConditionsManager::Object*)(argc>0 ? argv[1] : 0); - return new ConditionsMultiLoader(lcdd,ConditionsManager(mgr),name); + return new ConditionsMultiLoader(description,ConditionsManager(mgr),name); } } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_Conditions_multi_Loader,create_loader) +DECLARE_Detector_CONSTRUCTOR(dd4hep_Conditions_multi_Loader,create_loader) /// Standard constructor, initializes variables -ConditionsMultiLoader::ConditionsMultiLoader(LCDD& lcdd, ConditionsManager mgr, const string& nam) -: ConditionsDataLoader(lcdd, mgr, nam) +ConditionsMultiLoader::ConditionsMultiLoader(Detector& description, ConditionsManager mgr, const string& nam) +: ConditionsDataLoader(description, mgr, nam) { } @@ -115,7 +115,7 @@ ConditionsMultiLoader::~ConditionsMultiLoader() { ConditionsDataLoader* ConditionsMultiLoader::load_source(const std::string& nam, - const iov_type& req_validity) + const IOV& req_validity) { OpenSources::iterator iop = m_openSources.find(nam); if ( iop == m_openSources.end() ) { @@ -127,10 +127,10 @@ ConditionsMultiLoader::load_source(const std::string& nam, Loaders::iterator ild = m_loaders.find(ident); ConditionsDataLoader* loader = 0; if ( ild == m_loaders.end() ) { - string typ = "DD4hep_Conditions_"+ident+"_Loader"; + string typ = "dd4hep_Conditions_"+ident+"_Loader"; string fac = ident+"_ConditionsDataLoader"; const void* argv[] = {fac.c_str(), m_mgr.ptr(), 0}; - loader = createPlugin<ConditionsDataLoader>(typ,m_lcdd,2,argv); + loader = createPlugin<ConditionsDataLoader>(typ,m_detDesc,2,argv); if ( !loader ) { except("ConditionsMultiLoader", "Failed to create conditions loader of type: "+typ+" to read:"+nam); @@ -149,7 +149,7 @@ ConditionsMultiLoader::load_source(const std::string& nam, /// Load a condition set given a Detector Element and the conditions name according to their validity size_t ConditionsMultiLoader::load_range(key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) { size_t len = conditions.size(); @@ -169,7 +169,7 @@ size_t ConditionsMultiLoader::load_range(key_type key, size_t ConditionsMultiLoader::load_single(key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) { size_t len = conditions.size(); diff --git a/DDCond/src/plugins/ConditionsParser.cpp b/DDCond/src/plugins/ConditionsParser.cpp index a347e70e2..9995d2343 100644 --- a/DDCond/src/plugins/ConditionsParser.cpp +++ b/DDCond/src/plugins/ConditionsParser.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "XML/Conversions.h" #include "XML/XMLElements.h" #include "XML/DocumentHandler.h" @@ -26,9 +26,9 @@ #include "DDCond/ConditionsDataLoader.h" /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { namespace { /// Some utility class to specialize the converters: @@ -58,18 +58,16 @@ namespace DD4hep { } using std::string; -using namespace DD4hep; -using namespace DD4hep::Conditions; -using Geometry::DetElement; +using namespace dd4hep; +using namespace dd4hep::cond; - -namespace DD4hep { +namespace dd4hep { struct ConversionArg { DetElement detector; ConditionsStack* stack; - ConversionArg(DetElement det, ConditionsStack* s) - : detector(det), stack(s) + ConversionArg(DetElement det, ConditionsStack* stk) + : detector(det), stack(stk) { } }; @@ -88,7 +86,7 @@ namespace DD4hep { ConversionArg* arg = static_cast<ConversionArg*>(param); DetElement detector = arg ? arg->detector : DetElement(); string subpath = e.hasAttr(_U(path)) ? e.attr<string>(_U(path)) : string(); - return subpath.empty() ? detector : Geometry::DetectorTools::findDaughterElement(detector,subpath); + return subpath.empty() ? detector : detail::tools::findDaughterElement(detector,subpath); } /// Helper: Extract the string value from the xml element @@ -96,7 +94,7 @@ namespace DD4hep { xml_comp_t e(element); DetElement elt = _getDetector(param, element); string name = e.hasAttr(_U(name)) ? e.nameStr() : e.tag(); - return new Entry(elt,name,e.tag(),_getValidity(element),hash32(name)); + return new Entry(elt,name,e.tag(),_getValidity(element),detail::hash32(name)); } @@ -138,19 +136,19 @@ namespace DD4hep { if ( !arg ) except("ConditionsParser","++ Invalid parser argument [Internal Error]"); else if ( tag == "conditions" ) - Converter<conditions>(lcdd,param,optional)(e); + Converter<conditions>(description,param,optional)(e); else if ( arg->stack && tag == "detelement" ) - Converter<conditions>(lcdd,param,optional)(e); + Converter<conditions>(description,param,optional)(e); else if ( tag == "open_transaction" ) return; else if ( tag == "close_transaction" ) return; else if ( tag == "include" ) - Converter<include>(lcdd,param,optional)(e); + Converter<include>(description,param,optional)(e); else if ( tag == "detelements" ) - xml_coll_t(e,_U(star)).for_each(Converter<conditions>(lcdd,param,optional)); + xml_coll_t(e,_U(star)).for_each(Converter<conditions>(description,param,optional)); else if ( tag == "subdetectors" ) - xml_coll_t(e,_U(star)).for_each(Converter<conditions>(lcdd,param,optional)); + xml_coll_t(e,_U(star)).for_each(Converter<conditions>(description,param,optional)); else if ( tag == "alignment" ) { dd4hep_ptr<Entry> val(_createStackEntry(param,e)); val->value = elt.attr<string>(_U(ref)); @@ -176,8 +174,8 @@ namespace DD4hep { * @date 01/04/2014 */ template <> void Converter<include>::operator()(xml_h element) const { - XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); - xml_coll_t(doc.root(),_U(star)).for_each(Converter<arbitrary>(lcdd,param,optional)); + xml::DocumentHolder doc(xml::DocumentHandler().load(element, element.attr_value(_U(ref)))); + xml_coll_t(doc.root(),_U(star)).for_each(Converter<arbitrary>(description,param,optional)); } /** Convert objects containing standard conditions tags @@ -199,7 +197,7 @@ namespace DD4hep { ConversionArg* arg = _param<ConversionArg>(); DetElement elt = arg->detector; arg->detector = _getDetector(param,e); - xml_coll_t(e,_U(star)).for_each(Converter<arbitrary>(lcdd,param,optional)); + xml_coll_t(e,_U(star)).for_each(Converter<arbitrary>(description,param,optional)); arg->detector = elt; } } @@ -210,15 +208,15 @@ namespace DD4hep { * @version 1.0 * @date 01/04/2014 */ -static void* setup_global_Conditions(lcdd_t& lcdd, int argc, char** argv) { +static void* setup_global_Conditions(Detector& description, int argc, char** argv) { if ( argc == 2 ) { xml_h e = xml_h::Elt_t(argv[0]); ConditionsStack* stack = (ConditionsStack*)argv[1]; - ConversionArg args(lcdd.world(), stack); - (DD4hep::Converter<conditions>(lcdd,&args))(e); - return &lcdd; + ConversionArg args(description.world(), stack); + (dd4hep::Converter<conditions>(description,&args))(e); + return &description; } except("XML_DOC_READER","Invalid number of arguments to interprete conditions: %d != %d.",argc,2); return 0; } -DECLARE_LCDD_CONSTRUCTOR(XMLConditionsParser,setup_global_Conditions) +DECLARE_Detector_CONSTRUCTOR(XMLConditionsParser,setup_global_Conditions) diff --git a/DDCond/src/plugins/ConditionsPlugins.cpp b/DDCond/src/plugins/ConditionsPlugins.cpp index 80a1617a9..c075eb8fb 100644 --- a/DDCond/src/plugins/ConditionsPlugins.cpp +++ b/DDCond/src/plugins/ConditionsPlugins.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" #include "DD4hep/Conditions.h" @@ -31,28 +31,24 @@ #include <memory> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; -using Geometry::DetElement; -using Geometry::PlacedVolume; -using Geometry::DetectorProcessor; -using Geometry::DetectorProcessorShared; +using namespace dd4hep; +using namespace dd4hep::cond; -/// Plugin function: Install the alignment manager as an extension to the central LCDD object +/// Plugin function: Install the alignment manager as an extension to the central Detector object /** - * Factory: DD4hep_ConditionsManagerInstaller + * Factory: dd4hep_ConditionsManagerInstaller * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static int ddcond_install_cond_mgr (LCDD& lcdd, int argc, char** argv) { +static int ddcond_install_cond_mgr (Detector& description, int argc, char** argv) { Handle<NamedObject>* h = 0; - Handle<ConditionsManagerObject> mgr(lcdd.extension<ConditionsManagerObject>(false)); + Handle<ConditionsManagerObject> mgr(description.extension<ConditionsManagerObject>(false)); if ( !mgr.isValid() ) { bool arg_error = false; - string factory = "DD4hep_ConditionsManager_Type1"; - for(int i=0; i<argc && argv[i]; ++i) { + string factory = "dd4hep_ConditionsManager_Type1"; + for(int i = 0; i < argc && argv[i]; ++i) { if ( 0 == ::strncmp("-type",argv[i],4) ) factory = argv[++i]; else if ( 0 == ::strncmp("-handle",argv[i],5) ) @@ -64,7 +60,7 @@ static int ddcond_install_cond_mgr (LCDD& lcdd, int argc, char** argv) { /// Help printout describing the basic command line interface cout << "Usage: -plugin <name> -arg [-arg] \n" - " name: factory name DD4hep_ConditionsManagerInstaller \n" + " name: factory name dd4hep_ConditionsManagerInstaller \n" " -type <string> Manager type. \n" " Default: ConditionsManagerObject_Type1_t \n" " -handle <pointer> Pointer to Handle<NamedObject> to pass pointer \n" @@ -72,14 +68,14 @@ static int ddcond_install_cond_mgr (LCDD& lcdd, int argc, char** argv) { "\tArguments given: " << arguments(argc,argv) << endl << flush; ::exit(EINVAL); } - ConditionsManagerObject* obj = createPlugin<ConditionsManagerObject>(factory,lcdd); + ConditionsManagerObject* obj = createPlugin<ConditionsManagerObject>(factory,description); if ( !obj ) { except("ConditionsManagerInstaller","Failed to create manager object of type %s", factory.c_str()); } - lcdd.addExtension<ConditionsManagerObject>(obj); + description.addExtension<ConditionsManagerObject>(obj); printout(INFO,"DDCond", - "+++ Successfully installed conditions manager instance '%s' to LCDD.", + "+++ Successfully installed conditions manager instance '%s' to Detector.", factory.c_str()); mgr = obj; } @@ -94,7 +90,7 @@ static int ddcond_install_cond_mgr (LCDD& lcdd, int argc, char** argv) { if ( h ) *h = mgr; return 1; } -DECLARE_APPLY(DD4hep_ConditionsManagerInstaller,ddcond_install_cond_mgr) +DECLARE_APPLY(dd4hep_ConditionsManagerInstaller,ddcond_install_cond_mgr) /** * Prepare the conditions manager for execution @@ -103,12 +99,12 @@ DECLARE_APPLY(DD4hep_ConditionsManagerInstaller,ddcond_install_cond_mgr) * \version 1.0 * \date 01/04/2016 */ -static ConditionsSlice* ddcond_prepare(lcdd_t& lcdd, const string& iov_typ, long iov_val, int argc, char** argv) { +static ConditionsSlice* ddcond_prepare(Detector& description, const string& iov_typ, long iov_val, int argc, char** argv) { const IOVType* iovtype = 0; long iovvalue = iov_val; - ConditionsManager manager = ConditionsManager::from(lcdd); + ConditionsManager manager = ConditionsManager::from(description); - for(int i=0; i<argc; ++i) { + for(int i = 0; i < argc; ++i) { if ( ::strncmp(argv[i],"-iov_type",7) == 0 ) iovtype = manager.iovType(argv[++i]); else if ( ::strncmp(argv[i],"-iov_value",7) == 0 ) @@ -125,7 +121,7 @@ static ConditionsSlice* ddcond_prepare(lcdd_t& lcdd, const string& iov_typ, long IOV iov(iovtype,iovvalue); shared_ptr<ConditionsContent> content(new ConditionsContent()); unique_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Conditions::fill_content(manager,*content,*iovtype); + cond::fill_content(manager,*content,*iovtype); manager.prepare(iov, *slice); printout(INFO,"Conditions", "+++ ConditionsUpdate: Collected %ld conditions of type %s [iov-value:%ld].", @@ -136,19 +132,16 @@ static ConditionsSlice* ddcond_prepare(lcdd_t& lcdd, const string& iov_typ, long // ====================================================================================== /// Plugin function: Dump of all Conditions pool with or without conditions /** - * Factory: DD4hep_ConditionsPoolProcessor + * Factory: dd4hep_ConditionsPoolProcessor * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static int ddcond_conditions_pool_processor(lcdd_t& lcdd, bool process_pool, bool process_conditions, int argc, char** argv) { - typedef std::vector<const IOVType*> _T; - typedef ConditionsIOVPool::Elements _E; - typedef RangeConditions _R; - unique_ptr<Condition::Processor> proc(createProcessor<Condition::Processor>(lcdd,argc,argv)); - ConditionsManager manager = ConditionsManager::from(lcdd); - const _T types = manager.iovTypesUsed(); +static int ddcond_conditions_pool_processor(Detector& description, bool process_pool, bool process_conditions, int argc, char** argv) { + unique_ptr<Condition::Processor> proc(createProcessor<Condition::Processor>(description,argc,argv)); + ConditionsManager manager = ConditionsManager::from(description); + const auto types = manager.iovTypesUsed(); if ( !proc.get() ) { printout(WARNING,"Conditions","+++ Conditions processor of type %s is invalid!",argv[0]); @@ -156,26 +149,24 @@ static int ddcond_conditions_pool_processor(lcdd_t& lcdd, bool process_pool, boo if ( process_conditions && !proc.get() ) { except("Conditions","+++ Conditions processor of type %s is invalid!",argv[0]); } - for( _T::const_iterator i = types.begin(); i != types.end(); ++i ) { - const IOVType* type = *i; + for( const IOVType* type : types ) { if ( type ) { ConditionsIOVPool* pool = manager.iovPool(*type); if ( pool ) { - const _E& e = pool->elements; + const ConditionsIOVPool::Elements& e = pool->elements; if ( process_pool ) { printout(INFO,"CondPoolProcessor","+++ ConditionsIOVPool for type %s [%d IOV element%s]", type->str().c_str(), int(e.size()),e.size()==1 ? "" : "s"); } - for (_E::const_iterator j=e.begin(); j != e.end(); ++j) { - ConditionsPool* cp = (*j).second; + for ( const auto& cp : e ) { if ( process_pool ) { - cp->print(""); + cp.second->print(""); } if ( process_conditions ) { - _R rc; - cp->select_all(rc); - for(_R::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic) { - if ( proc.get() ) { (*proc)(*ic); } + RangeConditions rc; + cp.second->select_all(rc); + for( auto c : rc ) { + if ( proc.get() ) { (*proc)(c); } } } } @@ -184,66 +175,66 @@ static int ddcond_conditions_pool_processor(lcdd_t& lcdd, bool process_pool, boo } return 1; } -static int ddcond_conditions_pool_process(LCDD& lcdd, int argc, char** argv) { - return ddcond_conditions_pool_processor(lcdd, false, true, argc, argv); +static int ddcond_conditions_pool_process(Detector& description, int argc, char** argv) { + return ddcond_conditions_pool_processor(description, false, true, argc, argv); } -DECLARE_APPLY(DD4hep_ConditionsPoolProcessor,ddcond_conditions_pool_process) +DECLARE_APPLY(dd4hep_ConditionsPoolProcessor,ddcond_conditions_pool_process) // ====================================================================================== /// Plugin function: Dump of all Conditions pool with or without conditions /** - * Factory: DD4hep_ConditionsPoolDump: Dump pools only - * Factory: DD4hep_ConditionsDump: Dump pools and conditions + * Factory: dd4hep_ConditionsPoolDump: Dump pools only + * Factory: dd4hep_ConditionsDump: Dump pools and conditions * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static int ddcond_conditions_pool_print(lcdd_t& lcdd, bool print_conditions, int argc, char** argv) { +static int ddcond_conditions_pool_print(Detector& description, bool print_conditions, int argc, char** argv) { if ( argc > 0 ) { - for(int i=0; i<argc; ++i) { + for(int i = 0; i < argc; ++i) { if ( argv[i] && 0 == ::strncmp(argv[i],"-processor",3) ) { vector<char*> args; for(int j=i; j<argc && argv[j] && 0 != ::strncmp(argv[i],"-end-processor",8); ++j) args.push_back(argv[j]); args.push_back(0); - return ddcond_conditions_pool_processor(lcdd,true,print_conditions,int(args.size()-1),&args[0]); + return ddcond_conditions_pool_processor(description,true,print_conditions,int(args.size()-1),&args[0]); } } printout(WARNING,"DDCondProcessor","++ Found arguments in plugin call, " "but could not make any sense of them...."); } - const void* args[] = { "-processor", "DD4hep_ConditionsPrinter", 0}; - return ddcond_conditions_pool_processor(lcdd,true,print_conditions,2,(char**)args); + const void* args[] = { "-processor", "dd4hep_ConditionsPrinter", 0}; + return ddcond_conditions_pool_processor(description,true,print_conditions,2,(char**)args); } -static int ddcond_dump_pools(LCDD& lcdd, int argc, char** argv) { - return ddcond_conditions_pool_print(lcdd, false, argc, argv); +static int ddcond_dump_pools(Detector& description, int argc, char** argv) { + return ddcond_conditions_pool_print(description, false, argc, argv); } -static int ddcond_dump_conditions(LCDD& lcdd, int argc, char** argv) { - return ddcond_conditions_pool_print(lcdd, true, argc, argv); +static int ddcond_dump_conditions(Detector& description, int argc, char** argv) { + return ddcond_conditions_pool_print(description, true, argc, argv); } -DECLARE_APPLY(DD4hep_ConditionsPoolDump,ddcond_dump_pools) -DECLARE_APPLY(DD4hep_ConditionsDump,ddcond_dump_conditions) +DECLARE_APPLY(dd4hep_ConditionsPoolDump,ddcond_dump_pools) +DECLARE_APPLY(dd4hep_ConditionsDump,ddcond_dump_conditions) // ====================================================================================== /// Plugin function: Dump of all Conditions associated to the detector elements /** - * Factory: DD4hep_DetElementConditionsDump + * Factory: dd4hep_DetElementConditionsDump * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static int ddcond_detelement_dump(LCDD& lcdd, int argc, char** argv) { +static int ddcond_detelement_dump(Detector& description, int argc, char** argv) { - /// Internal class to perform recursive printout + /// detaill class to perform recursive printout /* * \author M.Frank * \version 1.0 * \date 01/12/2016 */ - struct Actor : public Geometry::DetectorProcessor { + struct Actor : public DetectorProcessor { ConditionsPrinter& printer; /// Standard constructor Actor(ConditionsPrinter& p) : printer(p) { } @@ -264,51 +255,51 @@ static int ddcond_detelement_dump(LCDD& lcdd, int argc, char** argv) { return 1; } }; - dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(lcdd,"run",1500,argc,argv)); + dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(description,"run",1500,argc,argv)); ConditionsPrinter printer(slice.get(),""); UserPool* pool = slice->pool.get(); pool->print("User pool"); Actor actor(printer); - int ret = actor.process(lcdd.world(),0,true); + int ret = actor.process(description.world(),0,true); slice->manager.clean(pool->validity().iovType, 20); return ret; } -DECLARE_APPLY(DD4hep_DetElementConditionsDump,ddcond_detelement_dump) +DECLARE_APPLY(dd4hep_DetElementConditionsDump,ddcond_detelement_dump) // ====================================================================================== /// Plugin function: Dump of all Conditions associated to the detector elements /** - * Factory: DD4hep_DetElementConditionsDump + * Factory: dd4hep_DetElementConditionsDump * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static void* ddcond_prepare_plugin(LCDD& lcdd, int argc, char** argv) { - dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(lcdd,"",-1,argc,argv)); +static void* ddcond_prepare_plugin(Detector& description, int argc, char** argv) { + dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(description,"",-1,argc,argv)); UserPool* p = slice->pool.get(); return p && p->size() > 0 ? slice.release() : 0; } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsPrepare,ddcond_prepare_plugin) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsPrepare,ddcond_prepare_plugin) #if 0 // ====================================================================================== /// Plugin function: Dump of all Conditions associated to the detector elements /** - * Factory: DD4hep_DetElementConditionsDump + * Factory: dd4hep_DetElementConditionsDump * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static int ddcond_detelement_processor(LCDD& lcdd, int argc, char** argv) { +static int ddcond_detelement_processor(Detector& description, int argc, char** argv) { - /// Internal class to perform recursive printout + /// detaill class to perform recursive printout /* * \author M.Frank * \version 1.0 * \date 01/12/2016 */ - struct Actor : public Geometry::DetElementProcessor<ConditionsProcessor> { + struct Actor : public DetElementProcessor<ConditionsProcessor> { /// Standard constructor Actor(ConditionsProcessor* p) : DetElementProcessor<ConditionsProcessor>(p){} @@ -320,37 +311,37 @@ static int ddcond_detelement_processor(LCDD& lcdd, int argc, char** argv) { }; ConditionsProcessor* processor = 0; if ( argc > 0 ) { - processor = createProcessor<ConditionsProcessor>(lcdd, argc, argv); + processor = createProcessor<ConditionsProcessor>(description, argc, argv); } else { - const void* args[] = { "-processor", "DD4hepConditionsPrinter", 0}; - processor = createProcessor<ConditionsProcessor>(lcdd, 2, (char**)args); + const void* args[] = { "-processor", "dd4hepConditionsPrinter", 0}; + processor = createProcessor<ConditionsProcessor>(description, 2, (char**)args); } - dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(lcdd,"run",1500,argc,argv)); + dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(description,"run",1500,argc,argv)); UserPool* pool = slice->pool.get(); Actor actor(processor); pool->print("User pool"); processor->setPool(pool); - int ret = Actor(processor).process(lcdd.world(),0,true); + int ret = Actor(processor).process(description.world(),0,true); slice->manager.clean(pool->validity().iovType, 20); return ret; } -DECLARE_APPLY(DD4hep_DetElementConditionsProcessor,ddcond_detelement_processor) +DECLARE_APPLY(dd4hep_DetElementConditionsProcessor,ddcond_detelement_processor) #endif // ====================================================================================== /// Plugin entry point: Synchronize conditions according to new IOV value /** - * Factory: DD4hep_ConditionsSynchronize + * Factory: dd4hep_ConditionsSynchronize * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static long ddcond_synchronize_conditions(lcdd_t& lcdd, int argc, char** argv) { +static long ddcond_synchronize_conditions(Detector& description, int argc, char** argv) { if ( argc >= 2 ) { string iov_typ = argv[0]; IOV::Key::first_type iov_key = *(IOV::Key::first_type*)argv[1]; - dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(lcdd,iov_typ,iov_key,argc,argv)); + dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(description,iov_typ,iov_key,argc,argv)); UserPool* pool = slice->pool.get(); pool->print("User pool"); slice->manager.clean(pool->validity().iovType, 20); @@ -361,25 +352,25 @@ static long ddcond_synchronize_conditions(lcdd_t& lcdd, int argc, char** argv) { arguments(argc,argv).c_str()); return 0; } -DECLARE_APPLY(DD4hep_ConditionsSynchronize,ddcond_synchronize_conditions) +DECLARE_APPLY(dd4hep_ConditionsSynchronize,ddcond_synchronize_conditions) // ====================================================================================== /// Plugin entry point: Clean conditions reposiory according to maximum age /** - * Factory: DD4hep_ConditionsClean + * Factory: dd4hep_ConditionsClean * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static long ddcond_clean_conditions(lcdd_t& lcdd, int argc, char** argv) { +static long ddcond_clean_conditions(Detector& description, int argc, char** argv) { if ( argc > 0 ) { string iov_type = argv[0]; int max_age = *(int*)argv[1]; printout(INFO,"Conditions", "+++ ConditionsUpdate: Cleaning conditions... type:%s max age:%d", iov_type.c_str(), max_age); - ConditionsManager manager = ConditionsManager::from(lcdd); + ConditionsManager manager = ConditionsManager::from(description); const IOVType* iov_typ = manager.iovType(iov_type); manager.clean(iov_typ, max_age); return 1; @@ -387,12 +378,12 @@ static long ddcond_clean_conditions(lcdd_t& lcdd, int argc, char** argv) { except("Conditions","+++ Failed cleaning conditions. Insufficient arguments!"); return 0; } -DECLARE_APPLY(DD4hep_ConditionsClean,ddcond_clean_conditions) +DECLARE_APPLY(dd4hep_ConditionsClean,ddcond_clean_conditions) // ====================================================================================== -/// Basic entry point to instantiate the basic DD4hep conditions/alignmants printer +/// Basic entry point to instantiate the basic dd4hep conditions/alignmants printer /** - * Factory: DD4hepConditionsPrinter, DD4hepAlignmentsPrinter + * Factory: dd4hepConditionsPrinter, dd4hepAlignmentsPrinter * * \author M.Frank * \version 1.0 @@ -400,7 +391,7 @@ DECLARE_APPLY(DD4hep_ConditionsClean,ddcond_clean_conditions) */ #include "DD4hep/PluginTester.h" template <typename WRAPPER,typename PRINTER> -static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) { +static void* create_printer(Detector& description, int argc,char** argv) { PrintLevel print_level = INFO; string prefix = "", name = ""; int flags = 0, have_pool = 0, arg_error = false; @@ -414,7 +405,7 @@ static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) { else if ( 0 == ::strncmp("-pool",argv[i],5) ) have_pool = 1; else if ( 0 == ::strncmp("-print",argv[i],5) ) - print_level = DD4hep::printLevel(argv[++i]); + print_level = dd4hep::printLevel(argv[++i]); else arg_error = true; } @@ -422,9 +413,9 @@ static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) { /// Help printout describing the basic command line interface cout << "Usage: -plugin <name> -arg [-arg] \n" - " name: factory name(s) DD4hep_ConditionsPrinter, \n" - " DD4hep_AlignmentsPrinter \n" - " DD4hep_AlignedVolumePrinter \n" + " name: factory name(s) dd4hep_ConditionsPrinter, \n" + " dd4hep_AlignmentsPrinter \n" + " dd4hep_AlignedVolumePrinter \n" " -prefix <string> Printout prefix for user customized output. \n" " -flags <number> Printout processing flags. \n" " -pool Attach conditions user pool from \n" @@ -433,11 +424,11 @@ static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) { "\tArguments given: " << arguments(argc,argv) << endl << flush; ::exit(EINVAL); } - DetElement world = lcdd.world(); + DetElement world = description.world(); printout(INFO,"Printer","World=%s [%p]",world.path().c_str(),world.ptr()); ConditionsSlice* slice = 0; if ( have_pool ) { - PluginTester* test = lcdd.extension<PluginTester>(); + PluginTester* test = description.extension<PluginTester>(); slice = test->extension<ConditionsSlice>("ConditionsTestSlice"); } PRINTER* p = (flags) ? new PRINTER(slice, prefix, flags) : new PRINTER(slice, prefix); @@ -447,23 +438,23 @@ static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) { } #include "DD4hep/ConditionsPrinter.h" #include "DD4hep/AlignmentsPrinter.h" -static void* create_cond_printer(Geometry::LCDD& lcdd, int argc,char** argv) -{ return create_printer<Condition::Processor,ConditionsPrinter>(lcdd,argc,argv); } +static void* create_cond_printer(Detector& description, int argc,char** argv) +{ return create_printer<Condition::Processor,ConditionsPrinter>(description,argc,argv); } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsPrinter,create_cond_printer) -//DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignmentsPrinter,create_printer<Alignments::AlignmentsPrinter>) -//DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignedVolumePrinter,create_printer<Alignments::AlignedVolumePrinter>) +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsPrinter,create_cond_printer) +//DECLARE_Detector_CONSTRUCTOR(dd4hep_AlignmentsPrinter,create_printer<AlignmentsPrinter>) +//DECLARE_Detector_CONSTRUCTOR(dd4hep_AlignedVolumePrinter,create_printer<AlignedVolumePrinter>) // ====================================================================================== /// Plugin entry point: Create repository csv file from loaded conditions /** - * Factory: DD4hep_ConditionsCreateRepository + * Factory: dd4hep_ConditionsCreateRepository * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static long ddcond_create_repository(lcdd_t& lcdd, int argc, char** argv) { +static long ddcond_create_repository(Detector& description, int argc, char** argv) { bool arg_error = false; string output = ""; for(int i=0; i<argc && argv[i]; ++i) { @@ -476,29 +467,29 @@ static long ddcond_create_repository(lcdd_t& lcdd, int argc, char** argv) { /// Help printout describing the basic command line interface cout << "Usage: -plugin <name> -arg [-arg] \n" - " name: factory name DD4hep_ConditionsCreateRepository \n\n" + " name: factory name dd4hep_ConditionsCreateRepository \n\n" " -output <string> Output file name. \n\n" "\tArguments given: " << arguments(argc,argv) << endl << flush; ::exit(EINVAL); } printout(INFO,"Conditions", "+++ ConditionsRepository: Creating %s",output.c_str()); - ConditionsManager manager = ConditionsManager::from(lcdd); + ConditionsManager manager = ConditionsManager::from(description); ConditionsRepository().save(manager,output); return 1; } -DECLARE_APPLY(DD4hep_ConditionsCreateRepository,ddcond_create_repository) +DECLARE_APPLY(dd4hep_ConditionsCreateRepository,ddcond_create_repository) // ====================================================================================== /// Plugin entry point: Dump conditions repository csv file /** - * Factory: DD4hep_ConditionsDumpRepository + * Factory: dd4hep_ConditionsDumpRepository * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ -static long ddcond_dump_repository(lcdd_t& /* lcdd */, int argc, char** argv) { +static long ddcond_dump_repository(Detector& /* description */, int argc, char** argv) { typedef ConditionsRepository::Data Data; bool arg_error = false; string input = ""; @@ -513,7 +504,7 @@ static long ddcond_dump_repository(lcdd_t& /* lcdd */, int argc, char** argv) /// Help printout describing the basic command line interface cout << "Usage: -plugin <name> -arg [-arg] \n" - " name: factory name DD4hep_ConditionsDumpRepository \n\n" + " name: factory name dd4hep_ConditionsDumpRepository \n\n" " -input <string> Input file name. \n\n" "\tArguments given: " << arguments(argc,argv) << endl << flush; ::exit(EINVAL); @@ -531,12 +522,12 @@ static long ddcond_dump_repository(lcdd_t& /* lcdd */, int argc, char** argv) } return 1; } -DECLARE_APPLY(DD4hep_ConditionsDumpRepository,ddcond_dump_repository) +DECLARE_APPLY(dd4hep_ConditionsDumpRepository,ddcond_dump_repository) // ====================================================================================== /// Plugin entry point: Load conditions repository csv file into conditions manager /** - * Factory: DD4hep_ConditionsDumpRepository + * Factory: dd4hep_ConditionsDumpRepository * TO BE DONE!!! @@ -545,7 +536,7 @@ TO BE DONE!!! * \version 1.0 * \date 01/04/2016 */ -static long ddcond_load_repository(lcdd_t& /* lcdd */, int argc, char** argv) { +static long ddcond_load_repository(Detector& /* description */, int argc, char** argv) { if ( argc > 0 ) { string input = argv[0]; printout(INFO,"Conditions","+++ ConditionsRepository: Loading %s",input.c_str()); @@ -556,5 +547,5 @@ static long ddcond_load_repository(lcdd_t& /* lcdd */, int argc, char** argv) { except("Conditions","+++ Failed loading conditions repository. Insufficient arguments!"); return 0; } -DECLARE_APPLY(DD4hep_ConditionsLoadRepository,ddcond_load_repository) +DECLARE_APPLY(dd4hep_ConditionsLoadRepository,ddcond_load_repository) // ====================================================================================== diff --git a/DDCond/src/plugins/ConditionsRepositoryParser.cpp b/DDCond/src/plugins/ConditionsRepositoryParser.cpp index 0b0385e73..b8866b041 100644 --- a/DDCond/src/plugins/ConditionsRepositoryParser.cpp +++ b/DDCond/src/plugins/ConditionsRepositoryParser.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "XML/Conversions.h" #include "XML/XMLParsers.h" #include "XML/DocumentHandler.h" @@ -21,7 +21,6 @@ #include "DD4hep/DetectorTools.h" #include "DD4hep/AlignmentData.h" #include "DD4hep/OpaqueDataBinder.h" -//#include "DD4hep/ConditionsKeyAssign.h" #include "DD4hep/DetFactoryHelper.h" #include "DD4hep/detail/ConditionsInterna.h" @@ -32,8 +31,8 @@ #include <stdexcept> #include <climits> -/// DD4hep namespace declaration -namespace DD4hep { +/// dd4hep namespace declaration +namespace dd4hep { /// Ananymous local stuff only used in this module namespace { @@ -70,13 +69,8 @@ namespace DD4hep { } using std::string; -using namespace DD4hep; -using namespace DD4hep::Conditions; -using Geometry::RotationZYX; -using Geometry::Transform3D; -using Geometry::Translation3D; -using Geometry::Position; -using Geometry::DetElement; +using namespace dd4hep; +using namespace dd4hep::cond; /// Anonymous local stuff only used in this module namespace { @@ -118,7 +112,7 @@ namespace { } void set(const string& path) { if ( !path.empty() ) { - arg->detector = Geometry::DetectorTools::findDaughterElement(detector,path); + arg->detector = detail::tools::findDaughterElement(detector,path); } } }; @@ -153,7 +147,7 @@ namespace { string tag = elt.tag(); string typ = elt.hasAttr(_U(type)) ? elt.typeStr() : tag; string nam = elt.hasAttr(_U(name)) ? elt.nameStr() : tag; - string add = XML::DocumentHandler::system_path(e); + string add = xml::DocumentHandler::system_path(e); Condition cond(det.path()+"#"+nam, typ); printout(s_parseLevel,"XMLConditions","++ Processing condition tag:%s name:%s type:%s [%s]", @@ -162,7 +156,7 @@ namespace { cond->address = add; cond->value = ""; cond->validity = ""; - cond->hash = Conditions::ConditionKey::hashCode(det,cond->name); + cond->hash = ConditionKey::hashCode(det,cond->name); if ( elt.hasAttr(_U(comment)) ) { cond->comment = elt.attr<string>(_U(comment)); } @@ -188,13 +182,13 @@ namespace { string unit = elt.hasAttr(_U(unit)) ? elt.attr<string>(_U(unit)) : string(""); if ( !unit.empty() ) val += "*"+unit; con->value = val; - OpaqueDataBinder::bind(bnd, con, typ, val); + detail::OpaqueDataBinder::bind(bnd, con, typ, val); return con; } } -/// DD4hep namespace declaration -namespace DD4hep { +/// dd4hep namespace declaration +namespace dd4hep { /// Convert iov_type repository objects /** @@ -230,11 +224,11 @@ namespace DD4hep { if ( e.hasAttr(_U(ref)) ) { string ref = e.attr<string>(_U(ref)); printout(s_parseLevel,"XMLConditions","++ Reading IOV file: %s -> %s",val.c_str(),ref.c_str()); - XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); - Converter<conditions>(lcdd,param,optional)(doc.root()); + xml::DocumentHolder doc(xml::DocumentHandler().load(element, element.attr_value(_U(ref)))); + Converter<conditions>(description,param,optional)(doc.root()); return; } - xml_coll_t(e,_UC(detelement)).for_each(Converter<arbitrary>(lcdd,param,optional)); + xml_coll_t(e,_UC(detelement)).for_each(Converter<arbitrary>(description,param,optional)); } /// Convert manager repository objects @@ -246,8 +240,8 @@ namespace DD4hep { template <> void Converter<manager>::operator()(xml_h element) const { ConversionArg* arg = _param<ConversionArg>(); if ( element.hasAttr(_U(ref)) ) { - XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); - Converter<arbitrary>(lcdd,param,optional)(doc.root()); + xml::DocumentHolder doc(xml::DocumentHandler().load(element, element.attr_value(_U(ref)))); + Converter<arbitrary>(description,param,optional)(doc.root()); } for( xml_coll_t c(element,_UC(property)); c; ++c) { xml_dim_t d = c; @@ -275,7 +269,7 @@ namespace DD4hep { */ template <> void Converter<value>::operator()(xml_h e) const { ConversionArg* arg = _param<ConversionArg>(); - Condition con = bind_condition(ValueBinder(), arg->detector, e); + Condition con = bind_condition(detail::ValueBinder(), arg->detector, e); arg->manager.registerUnlocked(*arg->pool, con); } @@ -289,7 +283,7 @@ namespace DD4hep { */ template <> void Converter<pressure>::operator()(xml_h e) const { ConversionArg* arg = _param<ConversionArg>(); - Condition con = bind_condition(ValueBinder(), arg->detector, e, "double"); + Condition con = bind_condition(detail::ValueBinder(), arg->detector, e, "double"); con->setFlag(Condition::PRESSURE); arg->manager.registerUnlocked(*arg->pool, con); } @@ -304,7 +298,7 @@ namespace DD4hep { */ template <> void Converter<temperature>::operator()(xml_h e) const { ConversionArg* arg = _param<ConversionArg>(); - Condition con = bind_condition(ValueBinder(), arg->detector, e, "double"); + Condition con = bind_condition(detail::ValueBinder(), arg->detector, e, "double"); con->setFlag(Condition::TEMPERATURE); arg->manager.registerUnlocked(*arg->pool, con); } @@ -318,7 +312,7 @@ namespace DD4hep { template <> void Converter<sequence>::operator()(xml_h e) const { ConversionArg* arg = _param<ConversionArg>(); Condition con = create_condition(arg->detector, e); - XML::parse_sequence(e, con->data); + xml::parse_sequence(e, con->data); arg->manager.registerUnlocked(*arg->pool, con); } @@ -331,7 +325,7 @@ namespace DD4hep { template <> void Converter<mapping>::operator()(xml_h e) const { ConversionArg* arg = _param<ConversionArg>(); Condition con = create_condition(arg->detector, e); - XML::parse_mapping(e, con->data); + xml::parse_mapping(e, con->data); arg->manager.registerUnlocked(*arg->pool, con); } @@ -345,8 +339,8 @@ namespace DD4hep { xml_h child_rot, child_pos, child_piv; ConversionArg* arg = _param<ConversionArg>(); Condition con = create_condition(arg->detector, e); - //Alignments::Delta& del = con.bind<Alignments::Delta>(); - XML::parse_delta(e, con->data); + //Delta& del = con.bind<Delta>(); + xml::parse_delta(e, con->data); con->setFlag(Condition::ALIGNMENT_DELTA); arg->manager.registerUnlocked(*arg->pool, con); } @@ -367,16 +361,16 @@ namespace DD4hep { arg->detector.path().c_str()); } if ( elt.hasAttr(_U(ref)) ) { - XML::DocumentHolder doc(XML::DocumentHandler().load(e, e.attr_value(_U(ref)))); + xml::DocumentHolder doc(xml::DocumentHandler().load(e, e.attr_value(_U(ref)))); (*this)(doc.root()); } - xml_coll_t(e,_U(value)).for_each(Converter<value>(lcdd,param,optional)); - xml_coll_t(e,_UC(mapping)).for_each(Converter<mapping>(lcdd,param,optional)); - xml_coll_t(e,_UC(sequence)).for_each(Converter<sequence>(lcdd,param,optional)); - xml_coll_t(e,_UC(pressure)).for_each(Converter<pressure>(lcdd,param,optional)); - xml_coll_t(e,_UC(alignment)).for_each(Converter<alignment>(lcdd,param,optional)); - xml_coll_t(e,_UC(temperature)).for_each(Converter<temperature>(lcdd,param,optional)); - xml_coll_t(e,_UC(detelement)).for_each(Converter<detelement>(lcdd,param,optional)); + xml_coll_t(e,_U(value)).for_each(Converter<value>(description,param,optional)); + xml_coll_t(e,_UC(mapping)).for_each(Converter<mapping>(description,param,optional)); + xml_coll_t(e,_UC(sequence)).for_each(Converter<sequence>(description,param,optional)); + xml_coll_t(e,_UC(pressure)).for_each(Converter<pressure>(description,param,optional)); + xml_coll_t(e,_UC(alignment)).for_each(Converter<alignment>(description,param,optional)); + xml_coll_t(e,_UC(temperature)).for_each(Converter<temperature>(description,param,optional)); + xml_coll_t(e,_UC(detelement)).for_each(Converter<detelement>(description,param,optional)); } /// Convert repository objects @@ -386,9 +380,9 @@ namespace DD4hep { * \date 01/04/2014 */ template <> void Converter<repository>::operator()(xml_h element) const { - xml_coll_t(element,_UC(manager)).for_each(Converter<manager>(lcdd,param,optional)); - xml_coll_t(element,_UC(iov_type)).for_each(Converter<iov_type>(lcdd,param,optional)); - xml_coll_t(element,_UC(iov)).for_each(Converter<iov>(lcdd,param,optional)); + xml_coll_t(element,_UC(manager)).for_each(Converter<manager>(description,param,optional)); + xml_coll_t(element,_UC(iov_type)).for_each(Converter<iov_type>(description,param,optional)); + xml_coll_t(element,_UC(iov)).for_each(Converter<iov>(description,param,optional)); } /// Convert any top level tag in the XML file @@ -401,17 +395,17 @@ namespace DD4hep { xml_comp_t elt(e); string tag = elt.tag(); if ( tag == "repository" ) - Converter<repository>(lcdd,param,optional)(e); + Converter<repository>(description,param,optional)(e); else if ( tag == "manager" ) - Converter<manager>(lcdd,param,optional)(e); + Converter<manager>(description,param,optional)(e); else if ( tag == "conditions" ) - Converter<conditions>(lcdd,param,optional)(e); + Converter<conditions>(description,param,optional)(e); else if ( tag == "detelement" ) - Converter<detelement>(lcdd,param,optional)(e); + Converter<detelement>(description,param,optional)(e); else if ( tag == "iov_type" ) - Converter<iov_type>(lcdd,param,optional)(e); + Converter<iov_type>(description,param,optional)(e); else if ( tag == "iov" ) // Processing repository file - Converter<iov>(lcdd,param,optional)(e); + Converter<iov>(description,param,optional)(e); else except("XMLConditions", "++ Failed to handle unknown tag: %s",tag.c_str()); @@ -424,7 +418,7 @@ namespace DD4hep { * \date 01/04/2014 */ template <> void Converter<conditions>::operator()(xml_h e) const { - xml_coll_t(e,_U(star)).for_each(Converter<arbitrary>(lcdd,param,optional)); + xml_coll_t(e,_U(star)).for_each(Converter<arbitrary>(description,param,optional)); } } @@ -434,7 +428,7 @@ namespace DD4hep { * \version 1.0 * \date 01/04/2014 */ -static long setup_repository_loglevel(lcdd_t& /* lcdd */, int argc, char** argv) { +static long setup_repository_loglevel(Detector& /* description */, int argc, char** argv) { if ( argc == 1 ) { s_parseLevel = printLevel(argv[1]); return 1; @@ -443,7 +437,7 @@ static long setup_repository_loglevel(lcdd_t& /* lcdd */, int argc, char** argv) arguments(argc,argv).c_str()); return 0; } -DECLARE_APPLY(DD4hep_ConditionsXMLRepositoryPrintLevel,setup_repository_loglevel) +DECLARE_APPLY(dd4hep_ConditionsXMLRepositoryPrintLevel,setup_repository_loglevel) #include "DD4hep/DD4hepUI.h" @@ -453,17 +447,17 @@ DECLARE_APPLY(DD4hep_ConditionsXMLRepositoryPrintLevel,setup_repository_loglevel * \version 1.0 * \date 01/04/2014 */ -static long setup_repository_Conditions(lcdd_t& lcdd, int argc, char** argv) { +static long setup_repository_Conditions(Detector& description, int argc, char** argv) { if ( argc == 1 ) { - DD4hepUI ui(lcdd); + detail::DD4hepUI ui(description); string fname(argv[0]); ConditionsManager mgr(ui.conditionsMgr()); - ConversionArg arg(lcdd.world(), mgr); - XML::DocumentHolder doc(XML::DocumentHandler().load(fname)); - (DD4hep::Converter<conditions>(lcdd,&arg))(doc.root()); + ConversionArg arg(description.world(), mgr); + xml::DocumentHolder doc(xml::DocumentHandler().load(fname)); + (dd4hep::Converter<conditions>(description,&arg))(doc.root()); return 1; } except("XML_DOC_READER","Invalid number of arguments to interprete conditions: %d != %d.",argc,1); return 0; } -DECLARE_APPLY(DD4hep_ConditionsXMLRepositoryParser,setup_repository_Conditions) +DECLARE_APPLY(dd4hep_ConditionsXMLRepositoryParser,setup_repository_Conditions) diff --git a/DDCond/src/plugins/ConditionsRepositoryWriter.cpp b/DDCond/src/plugins/ConditionsRepositoryWriter.cpp index e6d1245e1..0ac294056 100644 --- a/DDCond/src/plugins/ConditionsRepositoryWriter.cpp +++ b/DDCond/src/plugins/ConditionsRepositoryWriter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,17 +14,17 @@ #define DD4HEP_DDCOND_CONDITIONSREPOSITORYWRITER_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "XML/XMLElements.h" #include "DDCond/ConditionsManager.h" // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { // Forward declarations class ConditionsSlice; @@ -58,26 +58,26 @@ namespace DD4hep { virtual ~ConditionsXMLRepositoryWriter(); /// Dump the tree content into a XML document structure - XML::Document dump(ConditionsSlice& slice); + xml::Document dump(ConditionsSlice& slice); /// Dump the ConditionsManager configuration properties into a XML document structure - XML::Document dump(ConditionsManager manager); + xml::Document dump(ConditionsManager manager); /// Dump the tree content into an existing XML document structure - size_t collect(XML::Element root,ConditionsSlice& slice,DetElement detector); + size_t collect(xml::Element root,ConditionsSlice& slice,DetElement detector); /// Dump the ConditionsManager configuration properties into an existing XML document structure - size_t collect(XML::Element root, ConditionsManager manager); + size_t collect(xml::Element root, ConditionsManager manager); /// Dump the conditions tree content into a XML document structure - size_t collect(XML::Element root, ConditionsSlice& slice); + size_t collect(xml::Element root, ConditionsSlice& slice); /// Write the XML document structure to a file. - long write(XML::Document doc, const std::string& output) const; + long write(xml::Document doc, const std::string& output) const; }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCOND_CONDITIONSREPOSITORYWRITER_H */ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -115,17 +115,9 @@ namespace DD4hep { using std::string; using std::shared_ptr; using std::stringstream; -using namespace DD4hep; -using namespace DD4hep::Conditions; - -using Geometry::RotationZYX; -using Geometry::Transform3D; -using Geometry::Translation3D; -using Geometry::Position; - -using Alignments::Delta; -using Alignments::Alignment; -using Alignments::AlignmentCondition; +using namespace dd4hep; +using namespace dd4hep::cond; +namespace units = dd4hep; /// Anonymous local stuff only used in this module namespace { @@ -139,11 +131,11 @@ namespace { class sequence; class PropertyDumper { - XML::Element root; + xml::Element root; public: - PropertyDumper(XML::Element p) : root(p) {} + PropertyDumper(xml::Element p) : root(p) {} void operator()(const std::pair<string,Property>& p) const { - XML::Element e = XML::Element(root.document(),_UC(property)); + xml::Element e = xml::Element(root.document(),_UC(property)); string val = p.second.str(); if ( val[0] == '\'' ) val = p.second.str().c_str()+1; if ( !val.empty() && val[val.length()-1] == '\'' ) val[val.length()-1] = 0; @@ -153,9 +145,9 @@ namespace { } }; - template <typename T> XML::Element _convert(XML::Element par, Condition c); + template <typename T> xml::Element _convert(xml::Element par, Condition c); - XML::Element make(XML::Element e, Condition c) { + xml::Element make(xml::Element e, Condition c) { char hash[64]; std::string nam = c.name(); std::string cn = nam.substr(nam.find('#')+1); @@ -164,23 +156,23 @@ namespace { e.setAttr(_U(key),hash); return e; } - XML::Element _convert(XML::Element par, const Translation3D& tr) { - XML::Element e = XML::Element(par.document(),_U(pivot)); + xml::Element _convert(xml::Element par, const Translation3D& tr) { + xml::Element e = xml::Element(par.document(),_U(pivot)); const Translation3D::Vector& v = tr.Vect(); e.setAttr(_U(x),v.X()); e.setAttr(_U(y),v.Y()); e.setAttr(_U(z),v.Z()); return e; } - XML::Element _convert(XML::Element par, const Position& pos) { - XML::Element e = XML::Element(par.document(),_U(position)); + xml::Element _convert(xml::Element par, const Position& pos) { + xml::Element e = xml::Element(par.document(),_U(position)); e.setAttr(_U(x),pos.X()); e.setAttr(_U(y),pos.Y()); e.setAttr(_U(z),pos.Z()); return e; } - XML::Element _convert(XML::Element par, const RotationZYX& rot) { - XML::Element e = XML::Element(par.document(),_U(rotation)); + xml::Element _convert(xml::Element par, const RotationZYX& rot) { + xml::Element e = xml::Element(par.document(),_U(rotation)); double z, y, x; rot.GetComponents(z,y,x); e.setAttr(_U(x),x); @@ -188,27 +180,27 @@ namespace { e.setAttr(_U(z),z); return e; } - template <> XML::Element _convert<value>(XML::Element par, Condition c) { - XML::Element v = make(XML::Element(par.document(),_U(value)),c); + template <> xml::Element _convert<value>(xml::Element par, Condition c) { + xml::Element v = make(xml::Element(par.document(),_U(value)),c); OpaqueData& data = c.data(); v.setAttr(_U(type),data.dataType()); v.setAttr(_U(value),data.str()); return v; } - template <> XML::Element _convert<pressure>(XML::Element par, Condition c) { - XML::Element press = make(XML::Element(par.document(),_UC(pressure)),c); - press.setAttr(_U(value),c.get<double>()/(100e0*dd4hep::pascal)); + template <> xml::Element _convert<pressure>(xml::Element par, Condition c) { + xml::Element press = make(xml::Element(par.document(),_UC(pressure)),c); + press.setAttr(_U(value),c.get<double>()/(100e0*units::pascal)); press.setAttr(_U(unit),"hPa"); return press; } - template <> XML::Element _convert<temperature>(XML::Element par, Condition c) { - XML::Element temp = make(XML::Element(par.document(),_UC(temperature)),c); - temp.setAttr(_U(value),c.get<double>()/dd4hep::kelvin); + template <> xml::Element _convert<temperature>(xml::Element par, Condition c) { + xml::Element temp = make(xml::Element(par.document(),_UC(temperature)),c); + temp.setAttr(_U(value),c.get<double>()/units::kelvin); temp.setAttr(_U(unit),"kelvin"); return temp; } - template <> XML::Element _convert<Delta>(XML::Element par, Condition c) { - XML::Element align = make(XML::Element(par.document(),_UC(alignment)),c); + template <> xml::Element _convert<Delta>(xml::Element par, Condition c) { + xml::Element align = make(xml::Element(par.document(),_UC(alignment)),c); const Delta& delta = c.get<Delta>(); if ( delta.flags&Delta::HAVE_TRANSLATION ) align.append(_convert(align,delta.translation)); @@ -218,8 +210,8 @@ namespace { align.append(_convert(align,delta.pivot)); return align; } - template <> XML::Element _convert<Alignment>(XML::Element par, Condition c) { - XML::Element align = make(XML::Element(par.document(),_UC(alignment)),c); + template <> xml::Element _convert<Alignment>(xml::Element par, Condition c) { + xml::Element align = make(xml::Element(par.document(),_UC(alignment)),c); AlignmentCondition acond = c; const Delta& delta = acond.data().delta; if ( delta.flags&Delta::HAVE_TRANSLATION ) @@ -230,7 +222,7 @@ namespace { align.append(_convert(align,delta.pivot)); return align; } - XML::Element _seq(XML::Element v, Condition c, const char* tag, const char* match) { + xml::Element _seq(xml::Element v, Condition c, const char* tag, const char* match) { OpaqueData& data = c.data(); string typ = data.dataType(); size_t len = ::strlen(match); @@ -240,22 +232,22 @@ namespace { string subtyp = tag; subtyp += "["+typ.substr(idx+len,idq-idx-len)+"]"; v.setAttr(_U(type),subtyp); - XML::Handle_t(v.ptr()).setText(data.str()); + xml::Handle_t(v.ptr()).setText(data.str()); return v; } except("Writer","++ Unknwon XML conversion to type: %s",typ.c_str()); return v; } - template <> XML::Element _convert<std::vector<void*> >(XML::Element par, Condition c) { - XML::Element v = make(XML::Element(par.document(),_UC(sequence)),c); + template <> xml::Element _convert<std::vector<void*> >(xml::Element par, Condition c) { + xml::Element v = make(xml::Element(par.document(),_UC(sequence)),c); return _seq(v,c,"vector","::vector<"); } - template <> XML::Element _convert<std::list<void*> >(XML::Element par, Condition c) { - XML::Element v = make(XML::Element(par.document(),_UC(sequence)),c); + template <> xml::Element _convert<std::list<void*> >(xml::Element par, Condition c) { + xml::Element v = make(xml::Element(par.document(),_UC(sequence)),c); return _seq(v,c,"list","::list<"); } - template <> XML::Element _convert<std::set<void*> >(XML::Element par, Condition c) { - XML::Element v = make(XML::Element(par.document(),_UC(sequence)),c); + template <> xml::Element _convert<std::set<void*> >(xml::Element par, Condition c) { + xml::Element v = make(xml::Element(par.document(),_UC(sequence)),c); return _seq(v,c,"set","::set<"); } } @@ -267,26 +259,26 @@ ConditionsXMLRepositoryWriter::~ConditionsXMLRepositoryWriter() { } /// Dump the tree content into a XML document structure -XML::Document ConditionsXMLRepositoryWriter::dump(ConditionsSlice& slice) { - XML::DocumentHandler docH; - XML::Document doc = docH.create("conditions", docH.defaultComment()); +xml::Document ConditionsXMLRepositoryWriter::dump(ConditionsSlice& slice) { + xml::DocumentHandler docH; + xml::Document doc = docH.create("conditions", docH.defaultComment()); collect(doc.root(),slice); return doc; } /// Dump the ConditionsManager configuration properties into a XML document structure -XML::Document ConditionsXMLRepositoryWriter::dump(ConditionsManager manager) { - XML::DocumentHandler docH; - XML::Document doc = docH.create("conditions", docH.defaultComment()); - XML::Element root = doc.root(); +xml::Document ConditionsXMLRepositoryWriter::dump(ConditionsManager manager) { + xml::DocumentHandler docH; + xml::Document doc = docH.create("conditions", docH.defaultComment()); + xml::Element root = doc.root(); collect(root,manager); return doc; } /// Dump the conditions tree content into a XML document structure -size_t ConditionsXMLRepositoryWriter::collect(XML::Element root, ConditionsSlice& slice) { - XML::Element repo(root.document(),_UC(repository)); - XML::Element iov (repo.document(),_UC(iov)); +size_t ConditionsXMLRepositoryWriter::collect(xml::Element root, ConditionsSlice& slice) { + xml::Element repo(root.document(),_UC(repository)); + xml::Element iov (repo.document(),_UC(iov)); const IOV& validity = slice.pool->validity(); char text[128]; @@ -296,26 +288,26 @@ size_t ConditionsXMLRepositoryWriter::collect(XML::Element root, ConditionsSlice validity.keyData.first,validity.keyData.second, validity.iovType->name.c_str()); iov.setAttr(_UC(validity),text); - return collect(iov,slice,slice.manager->lcdd().world()); + return collect(iov,slice,slice.manager->detectorDescription().world()); } /// Dump the ConditionsManager configuration properties into an existing XML document structure -size_t ConditionsXMLRepositoryWriter::collect(XML::Element root, +size_t ConditionsXMLRepositoryWriter::collect(xml::Element root, ConditionsManager manager) { size_t count = 0; if ( manager.isValid() ) { /// Access to the property manager PropertyManager& prp = manager.properties(); - XML::Element rep(root.document(),_UC(repository)); - XML::Element mgr(rep.document(),_UC(manager)); + xml::Element rep(root.document(),_UC(repository)); + xml::Element mgr(rep.document(),_UC(manager)); const auto iovs = manager.iovTypesUsed(); prp.for_each(PropertyDumper(mgr)); rep.append(mgr); count += prp.size(); for ( const auto t : iovs ) { - XML::Element iov_typ(rep.document(),_UC(iov_type)); + xml::Element iov_typ(rep.document(),_UC(iov_type)); iov_typ.setAttr(_U(name),t->name); iov_typ.setAttr(_U(id),int(t->type)); rep.append(iov_typ); @@ -326,18 +318,18 @@ size_t ConditionsXMLRepositoryWriter::collect(XML::Element root, } /// Dump the conditions tree content into a XML document structure -size_t ConditionsXMLRepositoryWriter::collect(XML::Element root, +size_t ConditionsXMLRepositoryWriter::collect(xml::Element root, ConditionsSlice& slice, DetElement detector) { size_t count = 0; if ( detector.isValid() ) { - std::vector<Conditions::Condition> conds; + std::vector<Condition> conds; conditionsCollector(slice,conds)(detector); if ( !conds.empty() ) { stringstream comment; Condition cond_align, cond_delta; - XML::Element conditions = XML::Element(root.document(),_UC(detelement)); + xml::Element conditions = xml::Element(root.document(),_UC(detelement)); conditions.setAttr(_U(path),detector.path()); printout(s_printLevel,"Writer","++ Conditions of DE %s [%d entries]", detector.path().c_str(), int(conds.size())); @@ -348,7 +340,7 @@ size_t ConditionsXMLRepositoryWriter::collect(XML::Element root, for(const auto& c : conds ) { std::string nam = c.name(); std::string cn = nam.substr(nam.find('#')+1); - ReferenceBitMask<Condition::mask_type> msk(c->flags); + detail::ReferenceBitMask<Condition::mask_type> msk(c->flags); printout(s_printLevel,"Writer","++ Condition %s [%16llX] -> %s", cn.c_str(), c.key(), c.name()); @@ -429,8 +421,8 @@ size_t ConditionsXMLRepositoryWriter::collect(XML::Element root, // ====================================================================================== /// Write the XML document structure to a file. -long ConditionsXMLRepositoryWriter::write(XML::Document doc, const string& output) const { - XML::DocumentHandler docH; +long ConditionsXMLRepositoryWriter::write(xml::Document doc, const string& output) const { + xml::DocumentHandler docH; long ret = docH.output(doc, output); if ( !output.empty() ) { printout(INFO,"Writer","++ Successfully wrote %ld conditions (%ld unconverted) to file: %s", @@ -445,8 +437,8 @@ long ConditionsXMLRepositoryWriter::write(XML::Document doc, const string& outpu * \version 1.0 * \date 01/04/2014 */ -static long write_repository_conditions(lcdd_t& lcdd, int argc, char** argv) { - ConditionsManager manager = ConditionsManager::from(lcdd); +static long write_repository_conditions(Detector& description, int argc, char** argv) { + ConditionsManager manager = ConditionsManager::from(description); const IOVType* iovtype = 0; long iovvalue = -1; long mgr_prop = 0; @@ -462,7 +454,7 @@ static long write_repository_conditions(lcdd_t& lcdd, int argc, char** argv) { else if ( ::strncmp(argv[i],"-manager",4) == 0 ) mgr_prop = 1; else if ( ::strncmp(argv[i],"-help",2) == 0 ) { - printout(ALWAYS,"Plugin-Help","Usage: DD4hep_XMLConditionsRepositoryWriter --opt [--opt] "); + printout(ALWAYS,"Plugin-Help","Usage: dd4hep_XMLConditionsRepositoryWriter --opt [--opt] "); printout(ALWAYS,"Plugin-Help"," -output <string> Output file name. Default: stdout "); printout(ALWAYS,"Plugin-Help"," -manager <string> Add manager properties to the output. "); printout(ALWAYS,"Plugin-Help"," -iov_type <string> IOV type to be selected. "); @@ -479,7 +471,7 @@ static long write_repository_conditions(lcdd_t& lcdd, int argc, char** argv) { IOV iov(iovtype,iovvalue); shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Conditions::fill_content(manager,*content,*iovtype); + cond::fill_content(manager,*content,*iovtype); ConditionsManager::Result cres = manager.prepare(iov, *slice); printout(INFO,"Conditions", "++ Selected conditions: %7ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) for IOV:%-12s", @@ -487,7 +479,7 @@ static long write_repository_conditions(lcdd_t& lcdd, int argc, char** argv) { iovtype ? iov.str().c_str() : "???"); ConditionsXMLRepositoryWriter writer; - XML::Document doc(0); + xml::Document doc(0); if ( mgr_prop ) { doc = writer.dump(manager); writer.collect(doc.root(), *slice); @@ -498,7 +490,7 @@ static long write_repository_conditions(lcdd_t& lcdd, int argc, char** argv) { writer.write(doc, output); return 1; } -DECLARE_APPLY(DD4hep_ConditionsXMLRepositoryWriter,write_repository_conditions) +DECLARE_APPLY(dd4hep_ConditionsXMLRepositoryWriter,write_repository_conditions) // ====================================================================================== @@ -508,23 +500,23 @@ DECLARE_APPLY(DD4hep_ConditionsXMLRepositoryWriter,write_repository_conditions) * \version 1.0 * \date 01/04/2014 */ -static long write_repository_manager(lcdd_t& lcdd, int argc, char** argv) { - ConditionsManager manager = ConditionsManager::from(lcdd); +static long write_repository_manager(Detector& description, int argc, char** argv) { + ConditionsManager manager = ConditionsManager::from(description); string output; for(int i=0; i<argc; ++i) { if ( ::strncmp(argv[i],"-output",4) == 0 && argc>i+1) output = argv[++i]; else if ( ::strncmp(argv[i],"-help",2) == 0 ) { - printout(ALWAYS,"Plugin-Help","Usage: DD4hep_XMLConditionsManagerWriter --opt [--opt] "); + printout(ALWAYS,"Plugin-Help","Usage: dd4hep_XMLConditionsManagerWriter --opt [--opt] "); printout(ALWAYS,"Plugin-Help"," -output <string> Output file name. Default: stdout "); ::exit(EINVAL); } } ConditionsXMLRepositoryWriter writer; - XML::Document doc = writer.dump(manager); + xml::Document doc = writer.dump(manager); writer.write(doc, output); return 1; } -DECLARE_APPLY(DD4hep_ConditionsXMLManagerWriter,write_repository_manager) +DECLARE_APPLY(dd4hep_ConditionsXMLManagerWriter,write_repository_manager) // ====================================================================================== diff --git a/DDCond/src/plugins/ConditionsUserPool.cpp b/DDCond/src/plugins/ConditionsUserPool.cpp index 2878bbc8f..770be4519 100644 --- a/DDCond/src/plugins/ConditionsUserPool.cpp +++ b/DDCond/src/plugins/ConditionsUserPool.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,10 +22,10 @@ #include <unordered_map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Forward declarations class ConditionsDataLoader; @@ -52,10 +52,10 @@ namespace DD4hep { /// The loader to access non-existing conditions ConditionsDataLoader* m_loader = 0; - /// Internal helper to find conditions - Condition::Object* i_findCondition(key_type key) const; + /// detaill helper to find conditions + Condition::Object* i_findCondition(Condition::key_type key) const; - /// Internal insertion helper + /// detaill insertion helper bool i_insert(Condition::Object* o); public: @@ -70,44 +70,47 @@ namespace DD4hep { /// Full cleanup of all managed conditions. virtual void clear() override; /// Check a condition for existence - virtual bool exists(key_type hash) const override; + virtual bool exists(Condition::key_type hash) const override; /// Check a condition for existence virtual bool exists(const ConditionKey& key) const override; /// Check if a condition exists in the pool and return it to the caller - virtual Condition get(key_type hash) const override; + virtual Condition get(Condition::key_type hash) const override; /// Check if a condition exists in the pool and return it to the caller virtual Condition get(const ConditionKey& key) const override; /// Remove condition by key from pool. - virtual bool remove(key_type hash_key) override; + virtual bool remove(Condition::key_type hash_key) override; /// Remove condition by key from pool. virtual bool remove(const ConditionKey& key) override; /// Register a new condition to this pool virtual bool insert(Condition cond) override; /// ConditionsMap overload: Add a condition directly to the slice - virtual bool insert(DetElement detector, itemkey_type key, Condition condition) override; + virtual bool insert(DetElement detector, Condition::itemkey_type key, Condition condition) override; /// ConditionsMap overload: Access a condition - virtual Condition get(DetElement detector, itemkey_type key) const override; + virtual Condition get(DetElement detector, Condition::itemkey_type key) const override; /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] virtual std::vector<Condition> get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const override; + Condition::itemkey_type lower, + Condition::itemkey_type upper) const override; /// Access all conditions within the key range of a detector element - virtual std::vector<Condition> get(key_type lower, key_type upper) const override; + virtual std::vector<Condition> get(Condition::key_type lower, + Condition::key_type upper) const override; /// ConditionsMap overload: Interface to scan data content of the conditions mapping - virtual void scan(const Processor& processor) const override; + virtual void scan(const Condition::Processor& processor) const override; /// ConditionsMap overload: Interface to scan data content of the conditions mapping - virtual void scan(key_type lower, key_type upper, const Processor& processor) const override; + virtual void scan(Condition::key_type lower, + Condition::key_type upper, + const Condition::Processor& processor) const override; /// ConditionsMap overload: Interface to scan data content of the conditions mapping virtual void scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const override; + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const override; /// Prepare user pool for usage (load, fill etc.) according to required IOV - virtual Result prepare(const IOV& required, + virtual ConditionsManager::Result prepare(const IOV& required, ConditionsSlice& slice, void* user_param) override; @@ -117,20 +120,20 @@ namespace DD4hep { bool force) override; /// Prepare user pool for usage (load, fill etc.) according to required IOV - virtual Result load (const IOV& required, + virtual ConditionsManager::Result load (const IOV& required, ConditionsSlice& slice); /// Prepare user pool for usage (load, fill etc.) according to required IOV - virtual Result compute(const IOV& required, + virtual ConditionsManager::Result compute(const IOV& required, ConditionsSlice& slice, void* user_param); }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DDCOND_CONDITIONSMAPPEDUSERPOOL_H */ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -157,8 +160,8 @@ namespace DD4hep { #include <mutex> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; namespace { @@ -222,7 +225,7 @@ ConditionsMappedUserPool<MAPPING>::~ConditionsMappedUserPool() { } template<typename MAPPING> inline Condition::Object* -ConditionsMappedUserPool<MAPPING>::i_findCondition(key_type key) const { +ConditionsMappedUserPool<MAPPING>::i_findCondition(Condition::key_type key) const { typename MAPPING::const_iterator i=m_conditions.find(key); #if 0 if ( i == m_conditions.end() ) { @@ -273,7 +276,7 @@ void ConditionsMappedUserPool<MAPPING>::clear() { /// Check a condition for existence template<typename MAPPING> -bool ConditionsMappedUserPool<MAPPING>::exists(key_type hash) const { +bool ConditionsMappedUserPool<MAPPING>::exists(Condition::key_type hash) const { return i_findCondition(hash) != 0; } @@ -285,7 +288,7 @@ bool ConditionsMappedUserPool<MAPPING>::exists(const ConditionKey& key) const /// Check if a condition exists in the pool and return it to the caller template<typename MAPPING> -Condition ConditionsMappedUserPool<MAPPING>::get(key_type hash) const { +Condition ConditionsMappedUserPool<MAPPING>::get(Condition::key_type hash) const { return i_findCondition(hash); } @@ -324,16 +327,16 @@ Condition ConditionsMappedUserPool<MAPPING>::get(DetElement detector, unsigned i /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] template<typename MAPPING> std::vector<Condition> ConditionsMappedUserPool<MAPPING>::get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const { - ConditionKey::detkey_type det_key = detector.key(); + Condition::itemkey_type lower, + Condition::itemkey_type upper) const { + Condition::detkey_type det_key = detector.key(); return this->get(ConditionKey::KeyMaker(det_key,lower).hash, ConditionKey::KeyMaker(det_key,upper).hash); } /// Specialization for std::map: Access all conditions within a given key range template<typename MAPPING> std::vector<Condition> -ConditionsMappedUserPool<MAPPING>::get(key_type lower, key_type upper) const { +ConditionsMappedUserPool<MAPPING>::get(Condition::key_type lower, Condition::key_type upper) const { vector<Condition> result; typename MAPPING::const_iterator first = m_conditions.lower_bound(lower); for(; first != m_conditions.end() && (*first).first <= upper; ++first ) @@ -343,7 +346,7 @@ ConditionsMappedUserPool<MAPPING>::get(key_type lower, key_type upper) const /// ConditionsMap overload: Interface to scan data content of the conditions mapping template<typename MAPPING> -void ConditionsMappedUserPool<MAPPING>::scan(const Processor& processor) const { +void ConditionsMappedUserPool<MAPPING>::scan(const Condition::Processor& processor) const { for( const auto& i : m_conditions ) processor(i.second); } @@ -351,11 +354,11 @@ void ConditionsMappedUserPool<MAPPING>::scan(const Processor& processor) const /// ConditionsMap overload: Interface to scan data content of the conditions mapping template<typename MAPPING> void ConditionsMappedUserPool<MAPPING>::scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const { - ConditionKey::detkey_type det_key = detector.key(); + Condition::detkey_type det_key = detector.key(); scan(ConditionKey::KeyMaker(det_key,lower).hash, ConditionKey::KeyMaker(det_key,upper).hash, processor); @@ -363,9 +366,9 @@ void ConditionsMappedUserPool<MAPPING>::scan(DetElement detector, /// ConditionsMap overload: Interface to scan data content of the conditions mapping template<typename MAPPING> -void ConditionsMappedUserPool<MAPPING>::scan(key_type lower, - key_type upper, - const Processor& processor) const +void ConditionsMappedUserPool<MAPPING>::scan(Condition::key_type lower, + Condition::key_type upper, + const Condition::Processor& processor) const { typename MAPPING::const_iterator first = m_conditions.lower_bound(lower); for(; first != m_conditions.end() && (*first).first <= upper; ++first ) @@ -380,7 +383,7 @@ bool ConditionsMappedUserPool<MAPPING>::remove(const ConditionKey& key) { /// Remove condition by key from pool. template<typename MAPPING> -bool ConditionsMappedUserPool<MAPPING>::remove(key_type hash_key) { +bool ConditionsMappedUserPool<MAPPING>::remove(Condition::key_type hash_key) { typename MAPPING::iterator i = m_conditions.find(hash_key); if ( i != m_conditions.end() ) { m_conditions.erase(i); @@ -435,7 +438,7 @@ size_t ConditionsMappedUserPool<MAPPING>::compute(const Dependencies& deps, namespace { struct COMP { typedef pair<Condition::key_type,const ConditionDependency*> Dep; - typedef pair<const Condition::key_type,Interna::ConditionObject*> Cond; + typedef pair<const Condition::key_type,detail::ConditionObject*> Cond; typedef pair<const Condition::key_type,ConditionsLoadInfo* > Info; typedef pair<const Condition::key_type,Condition> Cond2; @@ -450,7 +453,7 @@ namespace { }; } -template<typename MAPPING> UserPool::Result +template<typename MAPPING> ConditionsManager::Result ConditionsMappedUserPool<MAPPING>::prepare(const IOV& required, ConditionsSlice& slice, void* user_param) @@ -464,7 +467,7 @@ ConditionsMappedUserPool<MAPPING>::prepare(const IOV& required, bool do_load = m_manager->doLoadConditions(); bool do_output_miss = m_manager->doOutputUnloaded(); IOV pool_iov(required.iovType); - Result result; + ConditionsManager::Result result; // This is a critical operation, because we have to ensure the // IOV pools are ONLY manipulated by the current thread. @@ -540,7 +543,7 @@ ConditionsMappedUserPool<MAPPING>::prepare(const IOV& required, // if ( num_calc_miss > 0 ) { if ( do_load ) { - map<key_type,const ConditionDependency*> deps(calc_missing.begin(),last_calc); + map<Condition::key_type,const ConditionDependency*> deps(calc_missing.begin(),last_calc); ConditionsDependencyHandler handler(m_manager, *this, deps, user_param); for( const auto& i : deps ) { const ConditionDependency* d = i.second; @@ -571,7 +574,7 @@ ConditionsMappedUserPool<MAPPING>::prepare(const IOV& required, return result; } -template<typename MAPPING> UserPool::Result +template<typename MAPPING> ConditionsManager::Result ConditionsMappedUserPool<MAPPING>::load(const IOV& required, ConditionsSlice& slice) { @@ -581,7 +584,7 @@ ConditionsMappedUserPool<MAPPING>::load(const IOV& required, bool do_load = m_manager->doLoadConditions(); bool do_output_miss = m_manager->doOutputUnloaded(); IOV pool_iov(required.iovType); - Result result; + ConditionsManager::Result result; // This is a critical operation, because we have to ensure the // IOV pools are ONLY manipulated by the current thread. @@ -642,7 +645,7 @@ ConditionsMappedUserPool<MAPPING>::load(const IOV& required, return result; } -template<typename MAPPING> UserPool::Result +template<typename MAPPING> ConditionsManager::Result ConditionsMappedUserPool<MAPPING>::compute(const IOV& required, ConditionsSlice& slice, void* user_param) @@ -653,7 +656,7 @@ ConditionsMappedUserPool<MAPPING>::compute(const IOV& required, bool do_load = m_manager->doLoadConditions(); bool do_output = m_manager->doOutputUnloaded(); IOV pool_iov(required.iovType); - Result result; + ConditionsManager::Result result; // This is a critical operation, because we have to ensure the // IOV pools are ONLY manipulated by the current thread. @@ -680,7 +683,7 @@ ConditionsMappedUserPool<MAPPING>::compute(const IOV& required, // if ( num_calc_miss > 0 ) { if ( do_load ) { - map<key_type,const ConditionDependency*> deps(calc_missing.begin(),last_calc); + map<Condition::key_type,const ConditionDependency*> deps(calc_missing.begin(),last_calc); ConditionsDependencyHandler handler(m_manager, *this, deps, user_param); for( const auto& i : deps ) { const ConditionDependency* d = i.second; @@ -712,10 +715,10 @@ ConditionsMappedUserPool<MAPPING>::compute(const IOV& required, /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { typedef unordered_map<Condition::key_type,Condition::Object*> umap_t; @@ -723,9 +726,9 @@ namespace DD4hep { /** Specialization necessary, since unordered maps have no lower bound. */ template<> void - ConditionsMappedUserPool<umap_t>::scan(key_type lower, - key_type upper, - const Processor& processor) const { + ConditionsMappedUserPool<umap_t>::scan(Condition::key_type lower, + Condition::key_type upper, + const Condition::Processor& processor) const { for( const auto& e : m_conditions ) if ( e.second->hash >= lower && e.second->hash <= upper ) processor(e.second); @@ -734,7 +737,7 @@ namespace DD4hep { /** Specialization necessary, since unordered maps have no lower bound. */ template<> std::vector<Condition> - ConditionsMappedUserPool<umap_t>::get(key_type lower, key_type upper) const { + ConditionsMappedUserPool<umap_t>::get(Condition::key_type lower, Condition::key_type upper) const { vector<Condition> result; for( const auto& e : m_conditions ) { if ( e.second->hash >= lower && e.second->hash <= upper ) @@ -742,12 +745,12 @@ namespace DD4hep { } return result; } - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ namespace { template <typename MAPPING> - void* create_pool(Geometry::LCDD&, int argc, char** argv) { + void* create_pool(Detector&, int argc, char** argv) { if ( argc > 1 ) { ConditionsManagerObject* m = (ConditionsManagerObject*)argv[0]; ConditionsIOVPool* p = (ConditionsIOVPool*)argv[1]; @@ -760,11 +763,11 @@ namespace { } // Factory for the user pool using a binary tree map -void* create_map_user_pool(Geometry::LCDD& lcdd, int argc, char** argv) -{ return create_pool<map<Condition::key_type,Condition::Object*> >(lcdd, argc, argv); } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsMapUserPool, create_map_user_pool) +void* create_map_user_pool(Detector& description, int argc, char** argv) +{ return create_pool<map<Condition::key_type,Condition::Object*> >(description, argc, argv); } +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsMapUserPool, create_map_user_pool) // Factory for the user pool using a binary tree map -void* create_unordered_map_user_pool(Geometry::LCDD& lcdd, int argc, char** argv) -{ return create_pool<unordered_map<Condition::key_type,Condition::Object*> >(lcdd, argc, argv); } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsUnorderedMapUserPool, create_map_user_pool) +void* create_unordered_map_user_pool(Detector& description, int argc, char** argv) +{ return create_pool<unordered_map<Condition::key_type,Condition::Object*> >(description, argc, argv); } +DECLARE_Detector_CONSTRUCTOR(dd4hep_ConditionsUnorderedMapUserPool, create_map_user_pool) diff --git a/DDCond/src/plugins/ConditionsXmlLoader.cpp b/DDCond/src/plugins/ConditionsXmlLoader.cpp index aafe8c640..1fb2daebb 100644 --- a/DDCond/src/plugins/ConditionsXmlLoader.cpp +++ b/DDCond/src/plugins/ConditionsXmlLoader.cpp @@ -1,4 +1,4 @@ -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DD4hep/Printout.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Implementation of a stack of conditions assembled before application /** @@ -36,33 +36,33 @@ namespace DD4hep { size_t load_source (const std::string& nam, key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions); public: /// Default constructor - ConditionsXmlLoader(LCDD& lcdd, ConditionsManager mgr, const std::string& nam); + ConditionsXmlLoader(Detector& description, ConditionsManager mgr, const std::string& nam); /// Default destructor virtual ~ConditionsXmlLoader(); /// Load a condition set given a Detector Element and the conditions name according to their validity virtual size_t load_single(key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions); /// Load a condition set given a Detector Element and the conditions name according to their validity virtual size_t load_range( key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions); /// Optimized update using conditions slice data - virtual size_t load_many( const iov_type& /* req_validity */, + virtual size_t load_many( const IOV& /* req_validity */, RequiredItems& /* work */, LoadedItems& /* loaded */, - iov_type& /* conditions_validity */) + IOV& /* conditions_validity */) { except("ConditionsLoader","+++ update: Invalid call!"); return 0; } }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_XMLCONDITONSLOADER_H */ //#include "ConditionsXmlLoader.h" @@ -80,21 +80,21 @@ namespace DD4hep { // Forward declartions using std::string; -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; namespace { - void* create_loader(DD4hep::Geometry::LCDD& lcdd, int argc, char** argv) { + void* create_loader(Detector& description, int argc, char** argv) { const char* name = argc>0 ? argv[0] : "XMLLoader"; ConditionsManagerObject* mgr = (ConditionsManagerObject*)(argc>0 ? argv[1] : 0); - return new ConditionsXmlLoader(lcdd,ConditionsManager(mgr),name); + return new ConditionsXmlLoader(description,ConditionsManager(mgr),name); } } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_Conditions_xml_Loader,create_loader) +DECLARE_Detector_CONSTRUCTOR(dd4hep_Conditions_xml_Loader,create_loader) /// Standard constructor, initializes variables -ConditionsXmlLoader::ConditionsXmlLoader(LCDD& lcdd, ConditionsManager mgr, const std::string& nam) -: ConditionsDataLoader(lcdd, mgr, nam) +ConditionsXmlLoader::ConditionsXmlLoader(Detector& description, ConditionsManager mgr, const std::string& nam) +: ConditionsDataLoader(description, mgr, nam) { } @@ -104,17 +104,17 @@ ConditionsXmlLoader::~ConditionsXmlLoader() { size_t ConditionsXmlLoader::load_source(const std::string& nam, key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) { size_t len = conditions.size(); string fac = "XMLConditionsParser"; - XML::DocumentHolder doc(XML::DocumentHandler().load(nam)); - XML::Handle_t handle = doc.root(); + xml::DocumentHolder doc(xml::DocumentHandler().load(nam)); + xml::Handle_t handle = doc.root(); ConditionsStack stack; char* argv[] = { (char*)handle.ptr(), (char*)&stack, 0}; - void* result = DD4hep::createPlugin(fac, m_lcdd, 2, argv, 0); - if ( result == &m_lcdd ) { // All OK. + void* result = dd4hep::createPlugin(fac, m_detDesc, 2, argv, 0); + if ( result == &m_detDesc ) { // All OK. for (ConditionsStack::iterator c=stack.begin(); c!=stack.end(); ++c) { Entry* e = (*c); Condition condition;/// = queueUpdate(e); @@ -137,7 +137,7 @@ size_t ConditionsXmlLoader::load_source(const std::string& nam, } size_t ConditionsXmlLoader::load_single(key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) { size_t len = conditions.size(); @@ -159,7 +159,7 @@ size_t ConditionsXmlLoader::load_single(key_type key, } size_t ConditionsXmlLoader::load_range(key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions) { size_t len = conditions.size(); diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index 3538cc169..81d0a6218 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -1,6 +1,6 @@ #================================================================================= # -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #--------------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -17,7 +17,7 @@ dd4hep_package( DDCore INSTALL_INCLUDES include/DD4hep include/XML include/JSON) #---Generate ROOT dictionary------------------------------------------------------ -dd4hep_add_dictionary( G__DD4hep +dd4hep_add_dictionary( G__dd4hep SOURCES include/DD4hep/*.h include/DD4hep/detail/*.h include/XML/*.h @@ -44,7 +44,7 @@ dd4hep_add_package_library ( DDParsers dd4hep_add_package_library ( DDCore SOURCES src/*.cpp src/XML/*.cpp OPTIONAL [BOOST SOURCES src/JSON/*.cpp] - GENERATED G__DD4hep.cxx + GENERATED G__dd4hep.cxx INCLUDE_DIRS ${GaudiPluginService_INCLUDE_DIRS} LINK_LIBRARIES DDParsers ${GaudiPluginService_LIBRARIES} ) diff --git a/DDCore/include/DD4hep/AlignmentData.h b/DDCore/include/DD4hep/AlignmentData.h index f6ead3988..6b83e0906 100644 --- a/DDCore/include/DD4hep/AlignmentData.h +++ b/DDCore/include/DD4hep/AlignmentData.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,341 +15,185 @@ // Framework include files #include "DD4hep/NamedObject.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Volumes.h" // ROOT include files #include "TGeoMatrix.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the alignment part of the AIDA detector description toolkit - namespace Alignments { - - // The DetElement is a central object. We alias it here. - using Geometry::DetElement; - using Geometry::RotationZYX; - using Geometry::Transform3D; - using Geometry::Translation3D; - using Geometry::Position; - using Geometry::LCDD; - - // Forward declarations - class Alignment; - class AlignmentCondition; + // Forward declarations + class Alignment; + class AlignmentCondition; - /// Class describing an condition to re-adjust an alignment - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class Delta { - public: - typedef Translation3D Pivot; - Position translation; - Pivot pivot; - RotationZYX rotation; - unsigned int flags = 0; - - enum AlignmentFlags { - HAVE_NONE = 0, - HAVE_TRANSLATION = 1<<2, - HAVE_ROTATION = 1<<3, - HAVE_PIVOT = 1<<4, - }; - - /// Default constructor - Delta() = default; - /// Initializing constructor - Delta(const Position& tr) - : translation(tr), flags(HAVE_TRANSLATION) {} - /// Initializing constructor - Delta(const RotationZYX& rot) - : translation(), rotation(rot), flags(HAVE_ROTATION) {} - /// Initializing constructor - Delta(const Position& tr, const RotationZYX& rot) - : translation(tr), rotation(rot), flags(HAVE_ROTATION|HAVE_TRANSLATION) {} - /// Initializing constructor - Delta(const Translation3D& piv, const RotationZYX& rot) - : pivot(piv), rotation(rot), flags(HAVE_ROTATION|HAVE_PIVOT) {} - /// Initializing constructor - Delta(const Position& tr, const Translation3D& piv, const RotationZYX& rot) - : translation(tr), pivot(piv), rotation(rot), flags(HAVE_ROTATION|HAVE_PIVOT|HAVE_TRANSLATION) {} - /// Copy constructor - Delta(const Delta& c); - /// Default destructor - ~Delta(); - /// Assignment operator - Delta& operator=(const Delta& c); - /// Reset information to identity - void clear(); - /// Check a given flag - bool checkFlag(unsigned int mask) const { return (flags&mask) == mask; } - /// Check a given flag - void setFlag(unsigned int mask) { flags |= mask; } - /// Access flags: Check if the delta operation contains a translation - bool hasTranslation() const { return checkFlag(HAVE_TRANSLATION); } - /// Access flags: Check if the delta operation contains a rotation - bool hasRotation() const { return checkFlag(HAVE_ROTATION); } - /// Access flags: Check if the delta operation contains a pivot - bool hasPivot() const { return checkFlag(HAVE_PIVOT); } + /// Class describing an condition to re-adjust an alignment + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + class Delta { + public: + typedef Translation3D Pivot; + Position translation; + Pivot pivot; + RotationZYX rotation; + unsigned int flags = 0; + + enum AlignmentFlags { + HAVE_NONE = 0, + HAVE_TRANSLATION = 1<<2, + HAVE_ROTATION = 1<<3, + HAVE_PIVOT = 1<<4, }; - /// Derived condition data-object definition - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class AlignmentData { - public: - /// Forward definition of the geometry placement - typedef Geometry::PlacedVolume PlacedVolume; - /// Forward definition of the nodelist leading to the world - typedef std::vector<PlacedVolume> NodeList; - /// Forward definition of the alignment delta data - typedef Alignments::Delta Delta; - /// Forward declaration of the utility bit mask - typedef unsigned int BitMask; - /// Forward declaration of the utility mask manipulator - typedef ReferenceBitMask<BitMask> MaskManipulator; - - enum AlignmentFlags { - HAVE_NONE = 0, - HAVE_WORLD_TRAFO = 1<<0, - HAVE_PARENT_TRAFO = 1<<1, - HAVE_OTHER = 1<<31 - }; - enum DataType { - IDEAL = 1<<10, - SURVEY = 1<<11, - TIME_STAMPED = 1<<12 - }; - - /// Alignment changes - Delta delta; - /// Intermediate buffer to store the transformation to the world coordination system - mutable TGeoHMatrix worldTrafo; - /// Delta transformation to the world coordination system - mutable TGeoHMatrix worldDelta; - /// Intermediate buffer to store the transformation to the parent detector element - mutable TGeoHMatrix detectorTrafo; - /// The list of TGeoNodes (physical placements) - NodeList nodes; - /// Transformation from volume to the world - Transform3D trToWorld; - /// Reference to the next hosting detector element - DetElement detector; - /// The subdetector placement corresponding to the actual detector element's volume - PlacedVolume placement; - /// Flag to remember internally calculated quatities - mutable BitMask flag; - /// Magic word to verify object if necessary - unsigned int magic; - - public: - /// Standard constructor - AlignmentData(); - /// Copy constructor - AlignmentData(const AlignmentData& copy); - /// Default destructor - virtual ~AlignmentData(); - /// Assignment operator necessary due to copy constructor - AlignmentData& operator=(const AlignmentData& copy); - /// Data accessor for decorator - inline AlignmentData& data() { return *this; } - /// Access the ideal/nominal alignment/placement matrix - Alignment nominal() const; - /// Create cached matrix to transform to world coordinates - const TGeoHMatrix& worldTransformation() const { return worldTrafo; } - /// Access the alignment/placement matrix with respect to the world - const TGeoHMatrix& detectorTransformation() const { return detectorTrafo; } - /// Access the currently applied alignment/placement matrix - const Transform3D& localToWorld() const { return trToWorld; } - - /** Aliases for the transformation from local coordinates to the world system */ - /// Transformation from local coordinates of the placed volume to the world system - void localToWorld(const Position& local, Position& global) const; - /// Transformation from local coordinates of the placed volume to the world system - void localToWorld(const Double_t local[3], Double_t global[3]) const; - /// Transformation from local coordinates of the placed volume to the world system - Position localToWorld(const Position& local) const; - /// Transformation from local coordinates of the placed volume to the world system - Position localToWorld(const Double_t local[3]) const - { return localToWorld(Position(local[0],local[1],local[2])); } - - /** Aliases for the transformation from world coordinates to the local volume */ - /// Transformation from world coordinates of the local placed volume coordinates - void worldToLocal(const Position& global, Position& local) const; - /// Transformation from world coordinates of the local placed volume coordinates - void worldToLocal(const Double_t global[3], Double_t local[3]) const; - /// Transformation from local coordinates of the placed volume to the world system - Position worldToLocal(const Position& global) const; - /// Transformation from local coordinates of the placed volume to the world system - Position worldToLocal(const Double_t global[3]) const - { return worldToLocal(Position(global[0],global[1],global[2])); } - - /** Aliases for the transformation from local coordinates to the next DetElement system */ - /// Transformation from local coordinates of the placed volume to the detector system - void localToDetector(const Position& local, Position& detector) const; - /// Transformation from local coordinates of the placed volume to the detector system - void localToDetector(const Double_t local[3], Double_t detector[3]) const; - /// Transformation from local coordinates of the placed volume to the world system - Position localToDetector(const Position& local) const; - /// Transformation from local coordinates of the placed volume to the world system - Position localToDetector(const Double_t local[3]) const - { return localToDetector(Position(local[0],local[1],local[2])); } - - /** Aliases for the transformation from the next DetElement to local coordinates */ - /// Transformation from detector element coordinates to the local placed volume coordinates - void detectorToLocal(const Position& detector, Position& local) const; - /// Transformation from detector element coordinates to the local placed volume coordinates - void detectorToLocal(const Double_t detector[3], Double_t local[3]) const; - /// Transformation from detector element coordinates to the local placed volume coordinates - Position detectorToLocal(const Position& detector) const; - /// Transformation from detector element coordinates to the local placed volume coordinates - Position detectorToLocal(const Double_t det[3]) const - { return detectorToLocal(Position(det[0],det[1],det[2])); } + /// Default constructor + Delta() = default; + /// Initializing constructor + Delta(const Position& tr) + : translation(tr), flags(HAVE_TRANSLATION) {} + /// Initializing constructor + Delta(const RotationZYX& rot) + : translation(), rotation(rot), flags(HAVE_ROTATION) {} + /// Initializing constructor + Delta(const Position& tr, const RotationZYX& rot) + : translation(tr), rotation(rot), flags(HAVE_ROTATION|HAVE_TRANSLATION) {} + /// Initializing constructor + Delta(const Translation3D& piv, const RotationZYX& rot) + : pivot(piv), rotation(rot), flags(HAVE_ROTATION|HAVE_PIVOT) {} + /// Initializing constructor + Delta(const Position& tr, const Translation3D& piv, const RotationZYX& rot) + : translation(tr), pivot(piv), rotation(rot), flags(HAVE_ROTATION|HAVE_PIVOT|HAVE_TRANSLATION) {} + /// Copy constructor + Delta(const Delta& c); + /// Default destructor + ~Delta(); + /// Assignment operator + Delta& operator=(const Delta& c); + /// Reset information to identity + void clear(); + /// Check a given flag + bool checkFlag(unsigned int mask) const { return (flags&mask) == mask; } + /// Check a given flag + void setFlag(unsigned int mask) { flags |= mask; } + /// Access flags: Check if the delta operation contains a translation + bool hasTranslation() const { return checkFlag(HAVE_TRANSLATION); } + /// Access flags: Check if the delta operation contains a rotation + bool hasRotation() const { return checkFlag(HAVE_ROTATION); } + /// Access flags: Check if the delta operation contains a pivot + bool hasPivot() const { return checkFlag(HAVE_PIVOT); } + }; + + /// Derived condition data-object definition + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + class AlignmentData { + public: + /// Forward declaration of the utility bit mask + typedef unsigned int BitMask; + + enum AlignmentFlags { + HAVE_NONE = 0, + HAVE_WORLD_TRAFO = 1<<0, + HAVE_PARENT_TRAFO = 1<<1, + HAVE_OTHER = 1<<31 }; - - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - template <typename T> class AlignmentDecorator : public T { - public: - /// Forward definition of the geometry placement - typedef AlignmentData::PlacedVolume PlacedVolume; - /// Forward definition of the nodelist leading to the world - typedef AlignmentData::NodeList NodeList; - /// Forward definition of the alignment delta data - typedef AlignmentData::Delta Delta; - - /// Default constructor - AlignmentDecorator(); - /// Copy constructor - AlignmentDecorator(const AlignmentDecorator& c); - /// Special constructors - template <typename Q> AlignmentDecorator(Q q) : T(q) {} - /// Default destructor - ~AlignmentDecorator() { } - - /// Data accessor - const AlignmentData& data() const { return T::data(); } - /// Access to the DetElement node - DetElement detector() const - { return data().detector; } - /// Access the placement of this node - PlacedVolume placement() const - { return data().placement; } - /// Access the placement of the DetElement node - PlacedVolume detectorPlacement() const - { return data().detector.placement(); } - - /// Access the alignment/placement matrix with respect to the world - const Transform3D& localToWorld() const - { return data().trToWorld; } - /// Create cached matrix to transform to world coordinates - const TGeoHMatrix& worldTransformation() const - { return data().worldTransformation(); } - /// Create cached matrix to transform to detector coordinates - const TGeoHMatrix& detectorTransformation() const - { return data().detectorTransformation(); } - - /// Transformation from local coordinates of the placed volume to the world system - void localToWorld(const Position& local, Position& global) const - { return data().localToWorld(local, global); } - /// Transformation from local coordinates of the placed volume to the world system - void localToWorld(const Double_t local[3], Double_t global[3]) const - { return data().localToWorld(local, global); } - - /// Transformation from local coordinates of the placed volume to the detector system - void localToDetector(const Position& local, Position& det) const - { return data().localToDetector(local, det); } - /// Transformation from local coordinates of the placed volume to the detector system - void localToDetector(const Double_t local[3], Double_t det[3]) const - { return data().localToDetector(local, det); } - - /// Transformation from world coordinates of the local placed volume coordinates - void worldToLocal(const Position& global, Position& local) const - { return data().worldToLocal(global, local); } - /// Transformation from world coordinates of the local placed volume coordinates - void worldToLocal(const Double_t global[3], Double_t local[3]) const - { return data().worldToLocal(global, local); } - - /// Transformation from world coordinates of the local placed volume coordinates - void detectorToLocal(const Position& det, Position& local) const - { return data().detectorToLocal(det, local); } - /// Transformation from world coordinates of the local placed volume coordinates - void detectorToLocal(const Double_t det[3], Double_t local[3]) const - { return data().detectorToLocal(det, local); } - - /// Access the currently applied alignment/placement matrix (mother to daughter) - const Alignment& nominal() const - { return data().detector.ideal(); } - /// Access the currently applied correction matrix (delta) (mother to daughter) - const Delta& delta() const - { return data().delta; } - - /// Set the delta alignment information - void setDelta(const Delta& del) { - AlignmentData& d = data(); - d.delta = del; - } - /// Set the delta alignment if only a single translation - void setDelta(const Position& translation) { - AlignmentData& d = data(); - d.delta.translation = translation; - d.delta.flags |= Delta::HAVE_TRANSLATION; - } - /// Set the delta alignment if only a single rotation - void setDelta(const RotationZYX& rotation) { - AlignmentData& d = data(); - d.delta.rotation = rotation; - d.delta.flags |= Delta::HAVE_ROTATION; - } - /// Set the delta alignment as a composite of a translation and a rotation - void setDelta(const Position& translation, RotationZYX& rotation) { - AlignmentData& d = data(); - d.delta.rotation = rotation; - d.delta.translation = translation; - d.delta.flags |= Delta::HAVE_ROTATION; - d.delta.flags |= Delta::HAVE_TRANSLATION; - } - /// Set the delta alignment if only a single rotation around a pivot point - void setDeltaPivot(const Translation3D& pivot, const RotationZYX& rotation) { - AlignmentData& d = data(); - d.delta.pivot = pivot; - d.delta.rotation = rotation; - d.delta.flags |= Delta::HAVE_PIVOT; - d.delta.flags |= Delta::HAVE_ROTATION; - } - /// Set the delta alignment if a translation and a rotation around pivot - void setDeltaPivot(const Position& translation, const Translation3D& pivot, const RotationZYX& rotation) { - AlignmentData& d = data(); - d.delta.pivot = pivot; - d.delta.rotation = rotation; - d.delta.translation = translation; - d.delta.flags |= Delta::HAVE_PIVOT; - d.delta.flags |= Delta::HAVE_ROTATION; - d.delta.flags |= Delta::HAVE_TRANSLATION; - } + enum DataType { + IDEAL = 1<<10, + SURVEY = 1<<11, + TIME_STAMPED = 1<<12 }; - /// Default constructor - template <typename T> inline - AlignmentDecorator<T>::AlignmentDecorator() : T() {} - + /// Alignment changes + Delta delta; + /// Intermediate buffer to store the transformation to the world coordination system + mutable TGeoHMatrix worldTrafo; + /// Delta transformation to the world coordination system + mutable TGeoHMatrix worldDelta; + /// Intermediate buffer to store the transformation to the parent detector element + mutable TGeoHMatrix detectorTrafo; + /// The list of TGeoNodes (physical placements) + std::vector<PlacedVolume> nodes; + /// Transformation from volume to the world + Transform3D trToWorld; + /// Reference to the next hosting detector element + DetElement detector; + /// The subdetector placement corresponding to the actual detector element's volume + PlacedVolume placement; + /// Flag to remember internally calculated quatities + mutable BitMask flag; + /// Magic word to verify object if necessary + unsigned int magic; + + public: + /// Standard constructor + AlignmentData(); /// Copy constructor - template <typename T> inline - AlignmentDecorator<T>::AlignmentDecorator(const AlignmentDecorator& c) : T(c) {} - - - } /* End namespace Aligments */ -} /* End namespace DD4hep */ + AlignmentData(const AlignmentData& copy); + /// Default destructor + virtual ~AlignmentData(); + /// Assignment operator necessary due to copy constructor + AlignmentData& operator=(const AlignmentData& copy); + /// Data accessor for decorator + inline AlignmentData& data() { return *this; } + /// Access the ideal/nominal alignment/placement matrix + Alignment nominal() const; + /// Create cached matrix to transform to world coordinates + const TGeoHMatrix& worldTransformation() const { return worldTrafo; } + /// Access the alignment/placement matrix with respect to the world + const TGeoHMatrix& detectorTransformation() const { return detectorTrafo; } + /// Access the currently applied alignment/placement matrix + const Transform3D& localToWorld() const { return trToWorld; } + + /** Aliases for the transformation from local coordinates to the world system */ + /// Transformation from local coordinates of the placed volume to the world system + void localToWorld(const Position& local, Position& global) const; + /// Transformation from local coordinates of the placed volume to the world system + void localToWorld(const Double_t local[3], Double_t global[3]) const; + /// Transformation from local coordinates of the placed volume to the world system + Position localToWorld(const Position& local) const; + /// Transformation from local coordinates of the placed volume to the world system + Position localToWorld(const Double_t local[3]) const + { return localToWorld(Position(local[0],local[1],local[2])); } + + /** Aliases for the transformation from world coordinates to the local volume */ + /// Transformation from world coordinates of the local placed volume coordinates + void worldToLocal(const Position& global, Position& local) const; + /// Transformation from world coordinates of the local placed volume coordinates + void worldToLocal(const Double_t global[3], Double_t local[3]) const; + /// Transformation from local coordinates of the placed volume to the world system + Position worldToLocal(const Position& global) const; + /// Transformation from local coordinates of the placed volume to the world system + Position worldToLocal(const Double_t global[3]) const + { return worldToLocal(Position(global[0],global[1],global[2])); } + + /** Aliases for the transformation from local coordinates to the next DetElement system */ + /// Transformation from local coordinates of the placed volume to the detector system + void localToDetector(const Position& local, Position& detector) const; + /// Transformation from local coordinates of the placed volume to the detector system + void localToDetector(const Double_t local[3], Double_t detector[3]) const; + /// Transformation from local coordinates of the placed volume to the world system + Position localToDetector(const Position& local) const; + /// Transformation from local coordinates of the placed volume to the world system + Position localToDetector(const Double_t local[3]) const + { return localToDetector(Position(local[0],local[1],local[2])); } + + /** Aliases for the transformation from the next DetElement to local coordinates */ + /// Transformation from detector element coordinates to the local placed volume coordinates + void detectorToLocal(const Position& detector, Position& local) const; + /// Transformation from detector element coordinates to the local placed volume coordinates + void detectorToLocal(const Double_t detector[3], Double_t local[3]) const; + /// Transformation from detector element coordinates to the local placed volume coordinates + Position detectorToLocal(const Position& detector) const; + /// Transformation from detector element coordinates to the local placed volume coordinates + Position detectorToLocal(const Double_t det[3]) const + { return detectorToLocal(Position(det[0],det[1],det[2])); } + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGMENTS_ALIGNMENTDATA_H */ diff --git a/DDCore/include/DD4hep/AlignmentTools.h b/DDCore/include/DD4hep/AlignmentTools.h index c979f3b4e..42e36d816 100644 --- a/DDCore/include/DD4hep/AlignmentTools.h +++ b/DDCore/include/DD4hep/AlignmentTools.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,12 +17,12 @@ #include "DD4hep/Alignments.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the alignment part of the AIDA detector description toolkit - namespace Alignments { + namespace detail { - namespace AlignmentTools { + namespace tools { /// Copy alignment object from source object void copy(Alignment from, Alignment to); @@ -52,5 +52,5 @@ namespace DD4hep { } } /* End namespace Aligments */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGMENTS_ALIGNMENTTOOLS_H */ diff --git a/DDCore/include/DD4hep/Alignments.h b/DDCore/include/DD4hep/Alignments.h index 3ecd7b7ff..76d3217df 100644 --- a/DDCore/include/DD4hep/Alignments.h +++ b/DDCore/include/DD4hep/Alignments.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,41 +19,24 @@ #include "DD4hep/Conditions.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Forward declarations class IOV; + class AlignmentData; + class Alignment; + class Delta; + class ConditionsMap; - /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { - + /// DD4hep internal namespace + namespace detail { /// Forward declarations - class ConditionsMap; - - /// Conditions internal namespace - namespace Interna { - class ConditionObject; - } + class ConditionObject; + class AlignmentObject; } - - /// Namespace for the alignment part of the AIDA detector description toolkit - namespace Alignments { - - using Geometry::LCDD; - using Geometry::Position; - using Geometry::DetElement; - using Geometry::PlacedVolume; - using Conditions::ConditionsMap; - - /// Alignments internal namespace - namespace Interna { - /// Forward declarations - class AlignmentObject; - } - class AlignmentData; - class Alignment; - class Delta; + /// Namespace for the AIDA detector description toolkit supporting XML utilities + namespace align { /// Alignment and Delta item key /** * @@ -66,164 +49,151 @@ namespace DD4hep { /// Key name of a delta condition "alignment_delta". static const std::string deltaName; /// Key value of a delta condition "alignment_delta". - static const Conditions::Condition::itemkey_type deltaKey; + static const Condition::itemkey_type deltaKey; /// Key name of an alignment condition object "alignment". static const std::string alignmentName; /// Key value of an alignment condition object "alignment". - static const Conditions::Condition::itemkey_type alignmentKey; + static const Condition::itemkey_type alignmentKey; }; - - /// Main handle class to hold an alignment conditions object - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_ALIGN - */ - class AlignmentCondition : public Handle<Interna::AlignmentObject> { - public: - /// Forward definition of the geometry placement - typedef Geometry::PlacedVolume PlacedVolume; - /// Forward definition of the nodelist leading to the world - typedef std::vector<PlacedVolume> NodeList; - /// Forward definition of the key type - typedef unsigned long long int key_type; - /// Forward definition of the iov type - typedef IOV iov_type; + } + + /// Main handle class to hold an alignment conditions object + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_ALIGN + */ + class AlignmentCondition : public Handle<detail::AlignmentObject> { + public: + /// Forward definition of the key type + typedef unsigned long long int key_type; - public: - /// Default constructor - AlignmentCondition() : Handle<Object>() {} - /// Default constructor - AlignmentCondition(Object* p) : Handle<Object>(p) {} - /// Assignment constructor from condition object - AlignmentCondition(Conditions::Interna::ConditionObject* p) : Handle<Object>(p) {} - /// Constructor to be used when reading the already parsed object - template <typename Q> AlignmentCondition(const Handle<Q>& e) : Handle<Object>(e) {} - /// Object constructor for pure alignment objects - AlignmentCondition(const std::string& name); - /** Interval of validity */ - /// Access the IOV type - const IOVType& iovType() const; - /// Access the IOV block - const iov_type& iov() const; - /// Access the hash identifier - key_type key() const; + public: + /// Default constructor + AlignmentCondition() : Handle<Object>() {} + /// Default constructor + AlignmentCondition(Object* p) : Handle<Object>(p) {} + /// Assignment constructor from condition object + AlignmentCondition(detail::ConditionObject* p) : Handle<Object>(p) {} + /// Constructor to be used when reading the already parsed object + template <typename Q> AlignmentCondition(const Handle<Q>& e) : Handle<Object>(e) {} + /// Object constructor for pure alignment objects + AlignmentCondition(const std::string& name); + /** Interval of validity */ + /// Access the IOV type + const IOVType& iovType() const; + /// Access the IOV block + const IOV& iov() const; + /// Access the hash identifier + key_type key() const; - /** Data block (bound type) */ - /// Data accessor for the use of decorators - AlignmentData& data(); - /// Data accessor for the use of decorators - const AlignmentData& data() const; - /// Access the delta value of the object - const Delta& delta() const; - /// Create cached matrix to transform to world coordinates - const TGeoHMatrix& worldTransformation() const; - /// Access the alignment/placement matrix with respect to the world - const TGeoHMatrix& detectorTransformation() const; - /// Check if object is already bound.... - bool is_bound() const; - }; + /** Data block (bound type) */ + /// Data accessor for the use of decorators + AlignmentData& data(); + /// Data accessor for the use of decorators + const AlignmentData& data() const; + /// Access the delta value of the object + const Delta& delta() const; + /// Create cached matrix to transform to world coordinates + const TGeoHMatrix& worldTransformation() const; + /// Access the alignment/placement matrix with respect to the world + const TGeoHMatrix& detectorTransformation() const; + /// Check if object is already bound.... + bool is_bound() const; + }; - /// Main handle class to hold an alignment object + /// Main handle class to hold an alignment object + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + * \ingroup DD4HEP_ALIGN + */ + class Alignment : public Handle<detail::AlignmentObject> { + public: + /// Abstract base for processing callbacks to container objects /** - * * \author M.Frank * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - * \ingroup DD4HEP_ALIGN + * \ingroup DD4HEP_CONDITIONS */ - class Alignment : public Handle<Interna::AlignmentObject> { - public: - /// Abstract base for processing callbacks to container objects - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class Processor { - public: - /// Default constructor - Processor(); - /// Default destructor - virtual ~Processor() = default; - /// Container callback for object processing - virtual int operator()(Alignment alignment) const = 0; - }; - - /// Forward definition of the geometry placement - typedef Geometry::PlacedVolume PlacedVolume; - /// Forward definition of the nodelist leading to the world - typedef std::vector<PlacedVolume> NodeList; - /// Forward definition of the alignment delta data - typedef Alignments::Delta Delta; - + class Processor { public: /// Default constructor - Alignment() = default; - /// Default constructor - Alignment(Object* p) : Handle<Object>(p) {} - /// Constructor to be used when reading the already parsed object - template <typename Q> Alignment(const Handle<Q>& e) : Handle<Object>(e) {} - /// Object constructor for pure alignment objects - Alignment(const std::string& name) ; - /// Data accessor for the use of decorators - AlignmentData& data(); - /// Data accessor for the use of decorators - const AlignmentData& data() const; - /// Access the delta value of the object - const Delta& delta() const; - /// Create cached matrix to transform to world coordinates - const TGeoHMatrix& worldTransformation() const; - /// Access the alignment/placement matrix with respect to the world - const TGeoHMatrix& detectorTransformation() const; - /// Access to the node list - const NodeList& nodes() const; + Processor(); + /// Default destructor + virtual ~Processor() = default; + /// Container callback for object processing + virtual int operator()(Alignment alignment) const = 0; + }; + + public: + /// Default constructor + Alignment() = default; + /// Default constructor + Alignment(Object* p) : Handle<Object>(p) {} + /// Constructor to be used when reading the already parsed object + template <typename Q> Alignment(const Handle<Q>& e) : Handle<Object>(e) {} + /// Object constructor for pure alignment objects + Alignment(const std::string& name) ; + /// Data accessor for the use of decorators + AlignmentData& data(); + /// Data accessor for the use of decorators + const AlignmentData& data() const; + /// Access the delta value of the object + const Delta& delta() const; + /// Create cached matrix to transform to world coordinates + const TGeoHMatrix& worldTransformation() const; + /// Access the alignment/placement matrix with respect to the world + const TGeoHMatrix& detectorTransformation() const; + /// Access to the node list + const std::vector<PlacedVolume>& nodes() const; - /** Aliases for the transformation from local coordinates to the world system */ - /// Transformation from local coordinates of the placed volume to the world system - void localToWorld(const Position& local, Position& global) const; - /// Transformation from local coordinates of the placed volume to the world system - void localToWorld(const Double_t local[3], Double_t global[3]) const; - /// Transformation from local coordinates of the placed volume to the world system - Position localToWorld(const Position& local) const; - /// Transformation from local coordinates of the placed volume to the world system - Position localToWorld(const Double_t local[3]) const - { return localToWorld(Position(local[0],local[1],local[2])); } + /** Aliases for the transformation from local coordinates to the world system */ + /// Transformation from local coordinates of the placed volume to the world system + void localToWorld(const Position& local, Position& global) const; + /// Transformation from local coordinates of the placed volume to the world system + void localToWorld(const Double_t local[3], Double_t global[3]) const; + /// Transformation from local coordinates of the placed volume to the world system + Position localToWorld(const Position& local) const; + /// Transformation from local coordinates of the placed volume to the world system + Position localToWorld(const Double_t local[3]) const + { return localToWorld(Position(local[0],local[1],local[2])); } - /** Aliases for the transformation from world coordinates to the local volume */ - /// Transformation from world coordinates of the local placed volume coordinates - void worldToLocal(const Position& global, Position& local) const; - /// Transformation from world coordinates of the local placed volume coordinates - void worldToLocal(const Double_t global[3], Double_t local[3]) const; - /// Transformation from local coordinates of the placed volume to the world system - Position worldToLocal(const Position& global) const; - /// Transformation from local coordinates of the placed volume to the world system - Position worldToLocal(const Double_t global[3]) const - { return worldToLocal(Position(global[0],global[1],global[2])); } + /** Aliases for the transformation from world coordinates to the local volume */ + /// Transformation from world coordinates of the local placed volume coordinates + void worldToLocal(const Position& global, Position& local) const; + /// Transformation from world coordinates of the local placed volume coordinates + void worldToLocal(const Double_t global[3], Double_t local[3]) const; + /// Transformation from local coordinates of the placed volume to the world system + Position worldToLocal(const Position& global) const; + /// Transformation from local coordinates of the placed volume to the world system + Position worldToLocal(const Double_t global[3]) const + { return worldToLocal(Position(global[0],global[1],global[2])); } - /** Aliases for the transformation from local coordinates to the next DetElement system */ - /// Transformation from local coordinates of the placed volume to the detector system - void localToDetector(const Position& local, Position& detector) const; - /// Transformation from local coordinates of the placed volume to the detector system - void localToDetector(const Double_t local[3], Double_t detector[3]) const; - /// Transformation from local coordinates of the placed volume to the world system - Position localToDetector(const Position& local) const; - /// Transformation from local coordinates of the placed volume to the world system - Position localToDetector(const Double_t local[3]) const - { return localToDetector(Position(local[0],local[1],local[2])); } + /** Aliases for the transformation from local coordinates to the next DetElement system */ + /// Transformation from local coordinates of the placed volume to the detector system + void localToDetector(const Position& local, Position& detector) const; + /// Transformation from local coordinates of the placed volume to the detector system + void localToDetector(const Double_t local[3], Double_t detector[3]) const; + /// Transformation from local coordinates of the placed volume to the world system + Position localToDetector(const Position& local) const; + /// Transformation from local coordinates of the placed volume to the world system + Position localToDetector(const Double_t local[3]) const + { return localToDetector(Position(local[0],local[1],local[2])); } - /** Aliases for the transformation from the next DetElement to local coordinates */ - /// Transformation from detector element coordinates to the local placed volume coordinates - void detectorToLocal(const Position& detector, Position& local) const; - /// Transformation from detector element coordinates to the local placed volume coordinates - void detectorToLocal(const Double_t detector[3], Double_t local[3]) const; - /// Transformation from detector element coordinates to the local placed volume coordinates - Position detectorToLocal(const Position& detector) const; - /// Transformation from detector element coordinates to the local placed volume coordinates - Position detectorToLocal(const Double_t det[3]) const - { return detectorToLocal(Position(det[0],det[1],det[2])); } - }; - } /* End namespace Aligments */ -} /* End namespace DD4hep */ + /** Aliases for the transformation from the next DetElement to local coordinates */ + /// Transformation from detector element coordinates to the local placed volume coordinates + void detectorToLocal(const Position& detector, Position& local) const; + /// Transformation from detector element coordinates to the local placed volume coordinates + void detectorToLocal(const Double_t detector[3], Double_t local[3]) const; + /// Transformation from detector element coordinates to the local placed volume coordinates + Position detectorToLocal(const Position& detector) const; + /// Transformation from detector element coordinates to the local placed volume coordinates + Position detectorToLocal(const Double_t det[3]) const + { return detectorToLocal(Position(det[0],det[1],det[2])); } + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGMENTS_ALIGNMENTS_H */ diff --git a/DDCore/include/DD4hep/AlignmentsCalculator.h b/DDCore/include/DD4hep/AlignmentsCalculator.h index 1f0093c3e..408726487 100644 --- a/DDCore/include/DD4hep/AlignmentsCalculator.h +++ b/DDCore/include/DD4hep/AlignmentsCalculator.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DD4hep/ConditionsMap.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the alignment part of the AIDA detector description toolkit - namespace Alignments { + namespace align { /// Alignment calculator instance to handle alignment dependencies /** @@ -32,8 +32,6 @@ namespace DD4hep { */ class AlignmentsCalculator { public: - typedef std::map<DetElement, Delta> Deltas; - typedef Conditions::ConditionsMap Alignments; /// Object encapsulating the result of a computation call to the alignments calculator /** @@ -67,7 +65,7 @@ namespace DD4hep { /// Assignment operator AlignmentsCalculator& operator=(const AlignmentsCalculator& mgr) = delete; /// Compute all alignment conditions of the internal dependency list - Result compute(const Deltas& deltas, Alignments& alignments) const; + Result compute(const std::map<DetElement, Delta>& deltas, ConditionsMap& alignments) const; }; /// Add results @@ -85,6 +83,6 @@ namespace DD4hep { return *this; } - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDALIGN_ALIGNMENTCALCULATOR_H */ diff --git a/DDCore/include/DD4hep/AlignmentsNominalMap.h b/DDCore/include/DD4hep/AlignmentsNominalMap.h index 057e32f8a..436b14d93 100644 --- a/DDCore/include/DD4hep/AlignmentsNominalMap.h +++ b/DDCore/include/DD4hep/AlignmentsNominalMap.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,76 +19,71 @@ // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { + /// An implementation of the ConditionsMap interface to fall back to nominal alignment. + /** + * The AlignmentsNominalMap is not a conditions cache per se. This implementation + * behaves like a conditionsmap, but it shall not return real conditions to the user, + * but rather return the default alignment objects (which at the basis are conditions + * as well) to the user. These alignments are taken from the DetElement in question + * Alignment DetElement::nominal(). + * + * The basic idea is to enable users to write code "as if" there would be conditions + * present. This is important to ease in the lifetime of the experiment the step from + * the design phase (where obviously no conditions are taken into account) to a more + * mature phase, where alignment studies etc. actually are part of the + * "bread and butter work". + * + * See dd4hep/ConditionsMap.h for further information. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + class AlignmentsNominalMap : public ConditionsMap { + public: + /// Reference to the top detector element + DetElement world; + public: + /// Standard constructor + AlignmentsNominalMap(DetElement wrld); + /// Standard destructor + virtual ~AlignmentsNominalMap() = default; + /// Insert a new entry to the map. The detector element key and the item key make a unique global alignments key + virtual bool insert(DetElement detector, Condition::itemkey_type key, Condition condition) override; + /// Interface to access alignments by hash value. The detector element key and the item key make a unique global alignments key + virtual Condition get(DetElement detector, Condition::itemkey_type key) const override; + /// Interface to scan data content of the alignments mapping + virtual void scan(const Condition::Processor& processor) const override; - /// An implementation of the ConditionsMap interface to fall back to nominal alignment. - /** - * The AlignmentsNominalMap is not a conditions cache per se. This implementation - * behaves like a conditionsmap, but it shall not return real conditions to the user, - * but rather return the default alignment objects (which at the basis are conditions - * as well) to the user. These alignments are taken from the DetElement in question - * Alignment DetElement::nominal(). - * - * The basic idea is to enable users to write code "as if" there would be conditions - * present. This is important to ease in the lifetime of the experiment the step from - * the design phase (where obviously no conditions are taken into account) to a more - * mature phase, where alignment studies etc. actually are part of the - * "bread and butter work". - * - * See DD4hep/ConditionsMap.h for further information. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class AlignmentsNominalMap : public ConditionsMap { - public: - /// Reference to the top detector element - DetElement world; - public: - /// Standard constructor - AlignmentsNominalMap(DetElement wrld); - /// Standard destructor - virtual ~AlignmentsNominalMap() = default; - /// Insert a new entry to the map. The detector element key and the item key make a unique global alignments key - virtual bool insert(DetElement detector, itemkey_type key, Condition condition) override; - /// Interface to access alignments by hash value. The detector element key and the item key make a unique global alignments key - virtual Condition get(DetElement detector, itemkey_type key) const override; - /// Interface to scan data content of the alignments mapping - virtual void scan(const Processor& processor) const override; - - /** Partial implementations for utilities accessing DetElement alignments */ + /** Partial implementations for utilities accessing DetElement alignments */ - /// No AlignmentsMap overload: Access all alignments within a key range in the interval [lower,upper] - /** Note: This default implementation uses - * std::vector<Condition> get(DetElement detector, - * itemkey_type lower, - * itemkey_type upper) - * The performance depends on the concrete implementation of the scan method! - */ - virtual std::vector<Condition> get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const override - { return this->ConditionsMap::get(detector, lower, upper); } + /// No AlignmentsMap overload: Access all alignments within a key range in the interval [lower,upper] + /** Note: This default implementation uses + * std::vector<Condition> get(DetElement detector, + * itemkey_type lower, + * itemkey_type upper) + * The performance depends on the concrete implementation of the scan method! + */ + virtual std::vector<Condition> get(DetElement detector, + Condition::itemkey_type lower, + Condition::itemkey_type upper) const override + { return this->ConditionsMap::get(detector, lower, upper); } - /// Interface to partially scan data content of the alignments mapping - /** Note: This default implementation assumes unordered containers and hence is - * not the most efficient implementation! - * Internally it uses "scan(Processor& processor)" - * the subselection hence is linearly depending of the number of elements. - * - * Using ordered maps with "lower_bound(key)" this can be greatly improved. - * See the concrete implementations below. - */ - virtual void scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const override; - }; - - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + /// Interface to partially scan data content of the alignments mapping + /** Note: This default implementation assumes unordered containers and hence is + * not the most efficient implementation! + * detaillly it uses "scan(Processor& processor)" + * the subselection hence is linearly depending of the number of elements. + * + * Using ordered maps with "lower_bound(key)" this can be greatly improved. + * See the concrete implementations below. + */ + virtual void scan(DetElement detector, + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const override; + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_ALIGNMENTSNOMINALMAP_H */ diff --git a/DDCore/include/DD4hep/AlignmentsPrinter.h b/DDCore/include/DD4hep/AlignmentsPrinter.h index 49a6e578d..c52566730 100644 --- a/DDCore/include/DD4hep/AlignmentsPrinter.h +++ b/DDCore/include/DD4hep/AlignmentsPrinter.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,14 +15,14 @@ // Framework includes #include "DD4hep/Printout.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Alignments.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace Alignments { + namespace align { /// Generic Alignments data dumper. /** @@ -105,6 +105,6 @@ namespace DD4hep { /// PrintElement placement with/without alignment applied void printElementPlacement(PrintLevel prt_level, const std::string& prefix, DetElement detector, ConditionsMap& pool); - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_ALIGNMENTSPRINTER_H */ diff --git a/DDCore/include/DD4hep/AlignmentsProcessor.h b/DDCore/include/DD4hep/AlignmentsProcessor.h index e14c347ae..8f1c2ee05 100644 --- a/DDCore/include/DD4hep/AlignmentsProcessor.h +++ b/DDCore/include/DD4hep/AlignmentsProcessor.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,13 +19,14 @@ #include "DD4hep/Alignments.h" #include "DD4hep/Printout.h" +// C/C++ include files #include <memory> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace Alignments { + namespace align { /// Generic alignment processor facade for the Conditons::Processor object /** @@ -192,6 +193,6 @@ namespace DD4hep { AlignmentsCollector<typename std::remove_reference<T>::type> alignmentsCollector(ConditionsMap& m, T&& alignments) { return AlignmentsCollector<typename std::remove_reference<T>::type>(m, alignments); } - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDALIGN_ALIGNMENTSPROCESSOR_H */ diff --git a/DDCore/include/DD4hep/BasicGrammar.h b/DDCore/include/DD4hep/BasicGrammar.h index 5bb5ce101..635cbddbf 100644 --- a/DDCore/include/DD4hep/BasicGrammar.h +++ b/DDCore/include/DD4hep/BasicGrammar.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include <typeinfo> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Base class describing string evaluation to C++ objects using boost::spirit /** @@ -58,6 +58,6 @@ namespace DD4hep { /// Set value from serialized string. On successful data conversion TRUE is returned. virtual bool fromString(void* ptr, const std::string& value) const = 0; }; -} // End namespace DD4hep +} // End namespace dd4hep #endif /* DD4HEP_DDG4_BASICGRAMMAR_H */ diff --git a/DDCore/include/DD4hep/BitField64.h b/DDCore/include/DD4hep/BitField64.h index dafaa83bf..844bcdc61 100644 --- a/DDCore/include/DD4hep/BitField64.h +++ b/DDCore/include/DD4hep/BitField64.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,14 +17,14 @@ #include "DDSegmentation/BitField64.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { using DDSegmentation::BitField64; using DDSegmentation::BitFieldValue; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } /* End namespace detail */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_BITFIELD64_H */ diff --git a/DDCore/include/DD4hep/BuildType.h b/DDCore/include/DD4hep/BuildType.h index d3bffb03c..f9035db18 100644 --- a/DDCore/include/DD4hep/BuildType.h +++ b/DDCore/include/DD4hep/BuildType.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,15 +20,15 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Detector description build types. - /** enum LCDDBuildType LCDD.h DD4hep/LCDD.h + /** enum DetectorBuildType Detector.h dd4hep/Detector.h * The corresponding flag is ONLY valid while parsing the * compact description. If no eometry, ie. at all other times * the accessor to the flag returns BUILD_NONE. */ - enum LCDDBuildType { + enum DetectorBuildType { BUILD_NONE = 0, BUILD_DEFAULT = 1, BUILD_SIMU = BUILD_DEFAULT, @@ -38,10 +38,10 @@ namespace DD4hep { }; /// Translate string representation of the geometry build type to value - LCDDBuildType buildType(const char* value); + DetectorBuildType buildType(const char* value); /// Translate string representation of the geometry build type to value - LCDDBuildType buildType(const std::string& value); + DetectorBuildType buildType(const std::string& value); -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif // DD4HEP_BUILDTYPES_H diff --git a/DDCore/include/DD4hep/Callback.h b/DDCore/include/DD4hep/Callback.h index 299c3f572..fd51481d2 100644 --- a/DDCore/include/DD4hep/Callback.h +++ b/DDCore/include/DD4hep/Callback.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include <vector> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Definition of the generic callback structure for member functions @@ -492,5 +492,5 @@ namespace DD4hep { } } -} // End namespace DD4hep +} // End namespace dd4hep #endif // DD4HEP_DDCORE_CALLBACK_H diff --git a/DDCore/include/DD4hep/CartesianGridXY.h b/DDCore/include/DD4hep/CartesianGridXY.h index 067eec6de..04b52f3bf 100644 --- a/DDCore/include/DD4hep/CartesianGridXY.h +++ b/DDCore/include/DD4hep/CartesianGridXY.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,98 +19,89 @@ #include "DD4hep/Segmentations.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class CartesianGridXY; } - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridXY> > CartesianGridXYHandle; - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridXY> > CartesianGridXYHandle; + /// Implementation class for the grid XY segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class CartesianGridXY : public CartesianGridXYHandle { + public: + /// Default constructor + CartesianGridXY() = default; + /// Copy constructor + CartesianGridXY(const CartesianGridXY& e) = default; + /// Copy Constructor from segmentation base object + CartesianGridXY(const Segmentation& e) : Handle<Object>(e) { } + /// Copy constructor from handle + CartesianGridXY(const Handle<Object>& e) : Handle<Object>(e) { } + /// Copy constructor from other equivalent handle + template <typename Q> CartesianGridXY(const Handle<Q>& e) : Handle<Object>(e) { } + /// Assignment operator + CartesianGridXY& operator=(const CartesianGridXY& seg) = default; + /// Equality operator + bool operator==(const CartesianGridXY& seg) const { + return m_element == seg.m_element; + } - /// Implementation class for the grid XY segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class CartesianGridXY : public CartesianGridXYHandle { - public: - /// Default constructor - CartesianGridXY() = default; - /// Copy constructor - CartesianGridXY(const CartesianGridXY& e) = default; - /// Copy Constructor from segmentation base object - CartesianGridXY(const Segmentation& e) : Handle<Object>(e) { } - /// Copy constructor from handle - CartesianGridXY(const Handle<Object>& e) : Handle<Object>(e) { } - /// Copy constructor from other equivalent handle - template <typename Q> - CartesianGridXY(const Handle<Q>& e) : Handle<Object>(e) { } - /// Assignment operator - CartesianGridXY& operator=(const CartesianGridXY& seg) = default; - /// Equality operator - bool operator==(const CartesianGridXY& seg) const { - return m_element == seg.m_element; - } + /// determine the position based on the cell ID + Position position(const CellID& cellID) const; + /// determine the cell ID based on the position + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + /// access the grid size in X + double gridSizeX() const; + /// access the grid size in Y + double gridSizeY() const; + /// set the grid size in X + void setGridSizeX(double cellSize) const; + /// set the grid size in Y + void setGridSizeY(double cellSize) const; + /// access the coordinate offset in X + double offsetX() const; + /// access the coordinate offset in Y + double offsetY() const; + /// set the coordinate offset in X + void setOffsetX(double offset) const; + /// set the coordinate offset in Y + void setOffsetY(double offset) const; + /// access the field name used for X + const std::string& fieldNameX() const; + /// access the field name used for Y + const std::string& fieldNameY() const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - /// access the grid size in X - double gridSizeX() const; - /// access the grid size in Y - double gridSizeY() const; - /// set the grid size in X - void setGridSizeX(double cellSize) const; - /// set the grid size in Y - void setGridSizeY(double cellSize) const; - /// access the coordinate offset in X - double offsetX() const; - /// access the coordinate offset in Y - double offsetY() const; - /// set the coordinate offset in X - void setOffsetX(double offset) const; - /// set the coordinate offset in Y - void setOffsetY(double offset) const; - /// access the field name used for X - const std::string& fieldNameX() const; - /// access the field name used for Y - const std::string& fieldNameY() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi + Returns a vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 2: + -# size in x + -# size in y + */ + std::vector<double> cellDimensions(const CellID& cellID) const; + }; - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in x - -# size in y - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_CARTESIANGRIDXY_H diff --git a/DDCore/include/DD4hep/CartesianGridXYZ.h b/DDCore/include/DD4hep/CartesianGridXYZ.h index 5e59d64fe..210e32c92 100644 --- a/DDCore/include/DD4hep/CartesianGridXYZ.h +++ b/DDCore/include/DD4hep/CartesianGridXYZ.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,107 +19,98 @@ #include "DD4hep/Segmentations.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class CartesianGridXYZ; } - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridXYZ> > CartesianGridXYZHandle; + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridXYZ> > CartesianGridXYZHandle; - /// Implementation class for the grid XYZ segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class CartesianGridXYZ : public CartesianGridXYZHandle { - public: - /// Default constructor - CartesianGridXYZ() = default; - /// Copy constructor - CartesianGridXYZ(const CartesianGridXYZ& e) = default; - /// Copy Constructor from segmentation base object - CartesianGridXYZ(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - CartesianGridXYZ(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> - CartesianGridXYZ(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - CartesianGridXYZ& operator=(const CartesianGridXYZ& seg) = default; - /// Equality operator - bool operator==(const CartesianGridXYZ& seg) const - { return m_element == seg.m_element; } - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - /// access the grid size in X - double gridSizeX() const; - /// access the grid size in Y - double gridSizeY() const; - /// access the grid size in Z - double gridSizeZ() const; - /// set the grid size in X - void setGridSizeX(double cellSize) const; - /// set the grid size in Y - void setGridSizeY(double cellSize) const; - /// set the grid size in Z - void setGridSizeZ(double cellSize) const; - /// access the coordinate offset in X - double offsetX() const; - /// access the coordinate offset in Y - double offsetY() const; - /// access the coordinate offset in Z - double offsetZ() const; - /// set the coordinate offset in X - void setOffsetX(double offset) const; - /// set the coordinate offset in Y - void setOffsetY(double offset) const; - /// set the coordinate offset in Z - void setOffsetZ(double offset) const; - /// access the field name used for X - const std::string& fieldNameX() const; - /// access the field name used for Y - const std::string& fieldNameY() const; - /// access the field name used for Z - const std::string& fieldNameZ() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in x - -# size in y - -# size in z - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; + /// Implementation class for the grid XYZ segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class CartesianGridXYZ : public CartesianGridXYZHandle { + public: + /// Default constructor + CartesianGridXYZ() = default; + /// Copy constructor + CartesianGridXYZ(const CartesianGridXYZ& e) = default; + /// Copy Constructor from segmentation base object + CartesianGridXYZ(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + CartesianGridXYZ(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> + CartesianGridXYZ(const Handle<Q>& e) : Handle<Object>(e) {} + /// Assignment operator + CartesianGridXYZ& operator=(const CartesianGridXYZ& seg) = default; + /// Equality operator + bool operator==(const CartesianGridXYZ& seg) const + { return m_element == seg.m_element; } + /// determine the position based on the cell ID + Position position(const CellID& cellID) const; + /// determine the cell ID based on the position + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + /// access the grid size in X + double gridSizeX() const; + /// access the grid size in Y + double gridSizeY() const; + /// access the grid size in Z + double gridSizeZ() const; + /// set the grid size in X + void setGridSizeX(double cellSize) const; + /// set the grid size in Y + void setGridSizeY(double cellSize) const; + /// set the grid size in Z + void setGridSizeZ(double cellSize) const; + /// access the coordinate offset in X + double offsetX() const; + /// access the coordinate offset in Y + double offsetY() const; + /// access the coordinate offset in Z + double offsetZ() const; + /// set the coordinate offset in X + void setOffsetX(double offset) const; + /// set the coordinate offset in Y + void setOffsetY(double offset) const; + /// set the coordinate offset in Z + void setOffsetZ(double offset) const; + /// access the field name used for X + const std::string& fieldNameX() const; + /// access the field name used for Y + const std::string& fieldNameY() const; + /// access the field name used for Z + const std::string& fieldNameZ() const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif // DD4HEP_DDCORE_CARTESIANGRIDXYZ_H + Returns a vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 2: + -# size in x + -# size in y + -# size in z + */ + std::vector<double> cellDimensions(const CellID& cellID) const; + }; +} /* End namespace dd4hep */ +#endif /* DD4HEP_DDCORE_CARTESIANGRIDXYZ_H */ diff --git a/DDCore/include/DD4hep/CartesianGridXZ.h b/DDCore/include/DD4hep/CartesianGridXZ.h index c9f0e7c57..9200f7e30 100644 --- a/DDCore/include/DD4hep/CartesianGridXZ.h +++ b/DDCore/include/DD4hep/CartesianGridXZ.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,97 +19,88 @@ #include "DD4hep/Segmentations.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class CartesianGridXZ; } - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridXZ> > CartesianGridXZHandle; + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridXZ> > CartesianGridXZHandle; - /// Implementation class for the grid XZ segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class CartesianGridXZ : public CartesianGridXZHandle { - public: - /// Default constructor - CartesianGridXZ() = default; - /// Copy constructor - CartesianGridXZ(const CartesianGridXZ& e) = default; - /// Copy Constructor from segmentation base object - CartesianGridXZ(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - CartesianGridXZ(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> - CartesianGridXZ(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - CartesianGridXZ& operator=(const CartesianGridXZ& seg) = default; - /// Equality operator - bool operator==(const CartesianGridXZ& seg) const - { return m_element == seg.m_element; } - - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - /// access the grid size in X - double gridSizeX() const; - /// access the grid size in Z - double gridSizeZ() const; - /// set the grid size in X - void setGridSizeX(double cellSize) const; - /// set the grid size in Z - void setGridSizeZ(double cellSize) const; - /// access the coordinate offset in X - double offsetX() const; - /// access the coordinate offset in Z - double offsetZ() const; - /// set the coordinate offset in X - void setOffsetX(double offset) const; - /// set the coordinate offset in Z - void setOffsetZ(double offset) const; - /// access the field name used for X - const std::string& fieldNameX() const; - /// access the field name used for Z - const std::string& fieldNameZ() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi + /// Implementation class for the grid XZ segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class CartesianGridXZ : public CartesianGridXZHandle { + public: + /// Default constructor + CartesianGridXZ() = default; + /// Copy constructor + CartesianGridXZ(const CartesianGridXZ& e) = default; + /// Copy Constructor from segmentation base object + CartesianGridXZ(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + CartesianGridXZ(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> + CartesianGridXZ(const Handle<Q>& e) : Handle<Object>(e) {} + /// Assignment operator + CartesianGridXZ& operator=(const CartesianGridXZ& seg) = default; + /// Equality operator + bool operator==(const CartesianGridXZ& seg) const + { return m_element == seg.m_element; } - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in x - -# size in z - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; + /// determine the position based on the cell ID + Position position(const CellID& cellID) const; + /// determine the cell ID based on the position + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + /// access the grid size in X + double gridSizeX() const; + /// access the grid size in Z + double gridSizeZ() const; + /// set the grid size in X + void setGridSizeX(double cellSize) const; + /// set the grid size in Z + void setGridSizeZ(double cellSize) const; + /// access the coordinate offset in X + double offsetX() const; + /// access the coordinate offset in Z + double offsetZ() const; + /// set the coordinate offset in X + void setOffsetX(double offset) const; + /// set the coordinate offset in Z + void setOffsetZ(double offset) const; + /// access the field name used for X + const std::string& fieldNameX() const; + /// access the field name used for Z + const std::string& fieldNameZ() const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif // DD4HEP_DDCORE_CARTESIANGRIDXZ_H + Returns a vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 2: + -# size in x + -# size in z + */ + std::vector<double> cellDimensions(const CellID& cellID) const; + }; +} /* End namespace dd4hep */ +#endif /* DD4HEP_DDCORE_CARTESIANGRIDXZ_H */ diff --git a/DDCore/include/DD4hep/CartesianGridYZ.h b/DDCore/include/DD4hep/CartesianGridYZ.h index a51b21481..fde92ca30 100644 --- a/DDCore/include/DD4hep/CartesianGridYZ.h +++ b/DDCore/include/DD4hep/CartesianGridYZ.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,98 +19,89 @@ #include "DD4hep/Segmentations.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class CartesianGridYZ; } - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridYZ> > CartesianGridYZHandle; + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::CartesianGridYZ> > CartesianGridYZHandle; - /// Implementation class for the grid YZ segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... + /// Implementation class for the grid YZ segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class CartesianGridYZ : public CartesianGridYZHandle { + public: + /// Default constructor + CartesianGridYZ() = default; + /// Copy constructor + CartesianGridYZ(const CartesianGridYZ& e) = default; + /// Copy Constructor from segmentation base object + CartesianGridYZ(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + CartesianGridYZ(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> + CartesianGridYZ(const Handle<Q>& e) : Handle<Object>(e) { } + /// Assignment operator + CartesianGridYZ& operator=(const CartesianGridYZ& seg) = default; + /// Equality operator + bool operator==(const CartesianGridYZ& seg) const + { return m_element == seg.m_element; } + /// determine the position based on the cell ID + Position position(const CellID& cellID) const; + /// determine the cell ID based on the position + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + /// access the grid size in Y + double gridSizeY() const; + /// access the grid size in Z + double gridSizeZ() const; + /// set the grid size in Y + void setGridSizeY(double cellSize) const; + /// set the grid size in Z + void setGridSizeZ(double cellSize) const; + /// access the coordinate offset in Y + double offsetY() const; + /// access the coordinate offset in Z + double offsetZ() const; + /// set the coordinate offset in Y + void setOffsetY(double offset) const; + /// set the coordinate offset in Z + void setOffsetZ(double offset) const; + /// access the field name used for X + const std::string& fieldNameX() const; + /// access the field name used for Y + const std::string& fieldNameY() const; + /// access the field name used for Z + const std::string& fieldNameZ() const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + * in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY + * Returns a vector of the cellDimensions of the given cell ID + * \param cellID is ignored as all cells have the same dimension + * \return std::vector<double> size 2: + * -# size in y + * -# size in z */ - class CartesianGridYZ : public CartesianGridYZHandle { - public: - /// Default constructor - CartesianGridYZ() = default; - /// Copy constructor - CartesianGridYZ(const CartesianGridYZ& e) = default; - /// Copy Constructor from segmentation base object - CartesianGridYZ(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - CartesianGridYZ(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> - CartesianGridYZ(const Handle<Q>& e) : Handle<Object>(e) { } - /// Assignment operator - CartesianGridYZ& operator=(const CartesianGridYZ& seg) = default; - /// Equality operator - bool operator==(const CartesianGridYZ& seg) const - { return m_element == seg.m_element; } - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - /// access the grid size in Y - double gridSizeY() const; - /// access the grid size in Z - double gridSizeZ() const; - /// set the grid size in Y - void setGridSizeY(double cellSize) const; - /// set the grid size in Z - void setGridSizeZ(double cellSize) const; - /// access the coordinate offset in Y - double offsetY() const; - /// access the coordinate offset in Z - double offsetZ() const; - /// set the coordinate offset in Y - void setOffsetY(double offset) const; - /// set the coordinate offset in Z - void setOffsetZ(double offset) const; - /// access the field name used for X - const std::string& fieldNameX() const; - /// access the field name used for Y - const std::string& fieldNameY() const; - /// access the field name used for Z - const std::string& fieldNameZ() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - * in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - * - * Returns a vector of the cellDimensions of the given cell ID - * \param cellID is ignored as all cells have the same dimension - * \return std::vector<double> size 2: - * -# size in y - * -# size in z - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif // DD4HEP_DDCORE_CARTESIANGRIDYZ_H + std::vector<double> cellDimensions(const CellID& cellID) const; + }; +} /* End namespace dd4hep */ +#endif /* DD4HEP_DDCORE_CARTESIANGRIDYZ_H */ diff --git a/DDCore/include/DD4hep/ComponentProperties.h b/DDCore/include/DD4hep/ComponentProperties.h index ef9d151a3..50ea5cdb0 100644 --- a/DDCore/include/DD4hep/ComponentProperties.h +++ b/DDCore/include/DD4hep/ComponentProperties.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { class Property; class BasicGrammar; @@ -269,5 +269,5 @@ namespace DD4hep { m_properties.add(nam, val); } -} // End namespace DD4hep +} // End namespace dd4hep #endif // DD4HEP_DDG4_COMPONENTPROPERTIES_H diff --git a/DDCore/include/DD4hep/ConditionDerived.h b/DDCore/include/DD4hep/ConditionDerived.h index 0ddc6652c..95e02d7c7 100644 --- a/DDCore/include/DD4hep/ConditionDerived.h +++ b/DDCore/include/DD4hep/ConditionDerived.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,13 +19,13 @@ #include "DD4hep/detail/ConditionsInterna.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Grammar definition for type binding class BasicGrammar; /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { + namespace cond { /// Forward declarations class ConditionResolver; @@ -47,9 +47,9 @@ namespace DD4hep { /// Interface to access conditions by hash value virtual Condition get(Condition::key_type key) const = 0; /// Access to the conditions manager - virtual Ref_t manager() const = 0; + virtual Handle<NamedObject> manager() const = 0; /// Access to the detector description instance - virtual Geometry::LCDD& lcdd() const = 0; + virtual Detector& detectorDescription() const = 0; /// Required IOV value for update cycle virtual const IOV& requiredValidity() const = 0; }; @@ -64,13 +64,13 @@ namespace DD4hep { public: const ConditionResolver& resolver; const ConditionDependency& dependency; - Condition::iov_type* iov; + IOV* iov; void* parameter; /// Initializing constructor ConditionUpdateContext(const ConditionResolver& r, const ConditionDependency& d, void* parameter, - Condition::iov_type& iov); + IOV& iov); /// Access to dependency keys const ConditionKey& key(size_t which) const; /// Access to condition object by dependency index @@ -122,8 +122,6 @@ namespace DD4hep { * \ingroup DD4HEP_CONDITIONS */ class ConditionUpdateCall { - public: - typedef ConditionUpdateContext Context; protected: /// Reference count int m_refCount; @@ -147,7 +145,8 @@ namespace DD4hep { delete this; } /// Interface to client Callback in order to update the condition - virtual Condition operator()(const ConditionKey& target, const Context& ctxt) = 0; + virtual Condition operator()(const ConditionKey& target, + const ConditionUpdateContext& ctxt) = 0; }; /// Condition dependency definition @@ -162,20 +161,13 @@ namespace DD4hep { protected: /// Reference count int m_refCount; - public: - typedef Geometry::DetElement DetElement; - /// Defintion of the depencency container - typedef std::vector<ConditionKey> Dependencies; - /// Forward definition of the key type - typedef Condition::key_type key_type; - /// Reference to the target's detector element DetElement detector; /// Key to the condition to be updated ConditionKey target; /// Dependency keys this condition depends on - Dependencies dependencies; + std::vector<ConditionKey> dependencies; /// Reference to the update callback. No auto pointer. callback may be shared ConditionUpdateCall* callback; @@ -189,19 +181,19 @@ namespace DD4hep { public: /// Initializing constructor used by builder - ConditionDependency(Geometry::DetElement de, unsigned int item_key, ConditionUpdateCall* call); + ConditionDependency(DetElement de, Condition::itemkey_type item_key, ConditionUpdateCall* call); /// Initializing constructor used by builder - ConditionDependency(Geometry::DetElement de, const std::string& item, ConditionUpdateCall* call); + ConditionDependency(DetElement de, const std::string& item, ConditionUpdateCall* call); /// Default constructor ConditionDependency(); /// Access the dependency key - key_type key() const { return target.hash; } + Condition::key_type key() const { return target.hash; } /// Access the dependency key - const char* name() const { return target.name.c_str(); } + const char* name() const { return target.name.c_str(); } /// Add use count to the object - ConditionDependency* addRef() { ++m_refCount; return this; } + ConditionDependency* addRef() { ++m_refCount; return this; } /// Release object. May not be used any longer - void release() { if ( --m_refCount <= 0 ) delete this; } + void release() { if ( --m_refCount <= 0 ) delete this; } }; /// Condition dependency builder @@ -216,9 +208,9 @@ namespace DD4hep { ConditionDependency* m_dependency; public: /// Initializing constructor - DependencyBuilder(Geometry::DetElement de, unsigned int item_key, ConditionUpdateCall* call); + DependencyBuilder(DetElement de, Condition::itemkey_type item_key, ConditionUpdateCall* call); /// Initializing constructor - DependencyBuilder(Geometry::DetElement de, const std::string& item, ConditionUpdateCall* call); + DependencyBuilder(DetElement de, const std::string& item, ConditionUpdateCall* call); /// Default destructor virtual ~DependencyBuilder(); /// Access underlying object directly @@ -233,7 +225,7 @@ namespace DD4hep { inline ConditionUpdateContext::ConditionUpdateContext(const ConditionResolver& resolv, const ConditionDependency& dep, void* user_param, - Condition::iov_type& iov_ref) + IOV& iov_ref) : resolver(resolv), dependency(dep), iov(&iov_ref), parameter(user_param) { } @@ -256,6 +248,6 @@ namespace DD4hep { return this->condition(key_value); } - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_CONDITIONDERIVED_H */ diff --git a/DDCore/include/DD4hep/ConditionTypes.h b/DDCore/include/DD4hep/ConditionTypes.h index 22118b2f0..1f4147a7a 100644 --- a/DDCore/include/DD4hep/ConditionTypes.h +++ b/DDCore/include/DD4hep/ConditionTypes.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,4 +12,4 @@ //========================================================================== #define DD4HEP_INSTANTIATE_GRAMMAR_TYPE(x) \ -namespace DD4hep {template<> const BasicGrammar& BasicGrammar::instance<x>() { static Grammar<x> s; return s;}} +namespace dd4hep {template<> const BasicGrammar& BasicGrammar::instance<x>() { static Grammar<x> s; return s;}} diff --git a/DDCore/include/DD4hep/Conditions.h b/DDCore/include/DD4hep/Conditions.h index c4c0d2706..ed0743f19 100644 --- a/DDCore/include/DD4hep/Conditions.h +++ b/DDCore/include/DD4hep/Conditions.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,412 +24,391 @@ #define DD4HEP_CONDITIONKEY_HAVE_NAME 1 /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Grammar definition for type binding + // Forward declarations class BasicGrammar; + class DetElement; + class Detector; - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - // Forward declarations - class DetElement; - class LCDD; + /// Conditions internal namespace + namespace detail { + class ConditionObject; } - /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { - - // LCDD and DetElement are central objects. We alias it here. - using Geometry::LCDD; - using Geometry::DetElement; - - /// Conditions internal namespace - namespace Interna { - class ConditionObject; - } + /// Main condition object handle. + /** + * This objects allows access to the data block and + * the interval of validity for a single condition. + * + * Note: + * Conditions may be shared between several DetElement objects. + * Hence, the back-link to the DetElement structure cannot be + * set - it would be ambiguous. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + class Condition: public Handle<detail::ConditionObject> { + public: + /// Forward definition of the key type + typedef unsigned long long int key_type; + /// High part of the key identifies the detector element + typedef unsigned int detkey_type; + /// Low part of the key identifies the item identifier + typedef unsigned int itemkey_type; + /// Forward definition of the object properties + typedef unsigned int mask_type; + + public: + enum StringFlags { + WITH_IOV = 1<<0, + WITH_ADDRESS = 1<<1, + WITH_TYPE = 1<<2, + WITH_COMMENT = 1<<4, + WITH_DATATYPE = 1<<5, + WITH_DATA = 1<<6, + NO_NAME = 1<<20, + NONE + }; + enum ConditionState { + INACTIVE = 0, + ACTIVE = 1<<0, + CHECKED = 1<<2, + DERIVED = 1<<3, + ONSTACK = 1<<4, + // Flags for specific conditions + TEMPERATURE = 1<<5, + TEMPERATURE_DERIVED = TEMPERATURE|DERIVED, + PRESSURE = 1<<6, + PRESSURE_DERIVED = PRESSURE|DERIVED, + ALIGNMENT_DELTA = 1<<7, + ALIGNMENT_DERIVED = ALIGNMENT_DELTA|DERIVED, + // Keep bit 8-15 for other generic types + // Bit 16-31 is reserved for user classifications + USER_FLAGS_FIRST = 1<<16, + USER_FLAGS_LAST = 1<<31 + }; - /// Main condition object handle. + /// Abstract base for processing callbacks to conditions objects /** - * This objects allows access to the data block and - * the interval of validity for a single condition. - * - * Note: - * Conditions may be shared between several DetElement objects. - * Hence, the back-link to the DetElement structure cannot be - * set - it would be ambiguous. - * * \author M.Frank * \version 1.0 * \ingroup DD4HEP_CONDITIONS */ - class Condition: public Handle<Interna::ConditionObject> { + class Processor { public: - /// Forward definition of the key type - typedef unsigned long long int key_type; - /// High part of the key identifies the detector element - typedef unsigned int detkey_type; - /// Low part of the key identifies the item identifier - typedef unsigned int itemkey_type; - /// Forward definition of the iov type - typedef IOV iov_type; - /// Forward definition of the object properties - typedef unsigned int mask_type; - - public: - enum StringFlags { - WITH_IOV = 1<<0, - WITH_ADDRESS = 1<<1, - WITH_TYPE = 1<<2, - WITH_COMMENT = 1<<4, - WITH_DATATYPE = 1<<5, - WITH_DATA = 1<<6, - NO_NAME = 1<<20, - NONE - }; - enum ConditionState { - INACTIVE = 0, - ACTIVE = 1<<0, - CHECKED = 1<<2, - DERIVED = 1<<3, - ONSTACK = 1<<4, - // Flags for specific conditions - TEMPERATURE = 1<<5, - TEMPERATURE_DERIVED = TEMPERATURE|DERIVED, - PRESSURE = 1<<6, - PRESSURE_DERIVED = PRESSURE|DERIVED, - ALIGNMENT_DELTA = 1<<7, - ALIGNMENT_DERIVED = ALIGNMENT_DELTA|DERIVED, - // Keep bit 8-15 for other generic types - // Bit 16-31 is reserved for user classifications - USER_FLAGS_FIRST = 1<<16, - USER_FLAGS_LAST = 1<<31 - }; - - /// Abstract base for processing callbacks to conditions objects - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class Processor { - public: - /// Default constructor - Processor(); - /// Default destructor - virtual ~Processor() = default; - /// Processing callback - virtual int process(Condition c) const = 0; - /// Conditions callback for object processing - virtual int operator()(Condition c) const - { return this->process(c); } - /// Conditions callback for object processing in maps - virtual int operator()(const std::pair<Condition::key_type,Condition>& e) const - { return this->process(e.second); } - }; - /// Default constructor - Condition() = default; - /// Copy constructor - Condition(const Condition& c) = default; - /// Initializing constructor - Condition(Object* p); - /// Constructor to be used when reading the already parsed object - template <typename Q> Condition(const Handle<Q>& e); - /// Initializing constructor for a pure, undecorated conditions object - Condition(const std::string& name, const std::string& type); - /// Initializing constructor for a pure, undecorated conditions object with payload buffer - Condition(const std::string& name, const std::string& type, size_t memory); - /// Assignment operator - Condition& operator=(const Condition& c) = default; - - /// Output method - std::string str(int with_data=WITH_IOV|WITH_ADDRESS|WITH_DATATYPE) const; - - /** Data block (bound type) */ - /// Access the data type - int dataType() const; - /// Access the IOV block - OpaqueData& data() const; - - /** Interval of validity */ - /// Access the IOV type - const IOVType& iovType() const; - /// Access the IOV block - const iov_type& iov() const; - - /** Direct data items in string form */ - /// Access the type field of the condition - const std::string& type() const; - /// Access the comment field of the condition - const std::string& comment() const; - /// Access the value field of the condition as a string - const std::string& value() const; - /// Access the address string [e.g. database identifier] - const std::string& address() const; - - /// Flag operations: Set a conditons flag - void setFlag(mask_type option); - /// Flag operations: UN-Set a conditons flag - void unFlag(mask_type option); - /// Flag operations: Test for a given a conditons flag - bool testFlag(mask_type option) const; - - /** Conditions meta-data */ - /// Access to the type information - const std::type_info& typeInfo() const; - /// Access to the grammar type - const BasicGrammar& descriptor() const; - /// Hash identifier - key_type key() const; - /// DetElement part of the identifier - detkey_type detector_key() const; - /// Item part of the identifier - itemkey_type item_key() const; - - /** Conditions handling */ - /// Re-evaluate the conditions data according to the previous bound type definition - Condition& rebind(); - - /** Bind the data of the conditions object to a given format. - * - * Note: The type definition is possible exactly once. - * Any further rebindings MUST match the identical type. - */ - template <typename T> T& bind(); - /** Set and bind the data of the conditions object to a given format. - * - * Note: The type definition is possible exactly once. - * Any further rebindings MUST match the identical type. - */ - template <typename T> T& bind(const std::string& val); - /// Generic getter. Specify the exact type, not a polymorph type - template <typename T> T& get(); - /// Generic getter (const version). Specify the exact type, not a polymorph type - template <typename T> const T& get() const; - /// Check if object is already bound.... - bool is_bound() const { return isValid() ? data().is_bound() : false; } + Processor(); + /// Default destructor + virtual ~Processor() = default; + /// Processing callback + virtual int process(Condition c) const = 0; + /// Conditions callback for object processing + virtual int operator()(Condition c) const + { return this->process(c); } + /// Conditions callback for object processing in maps + virtual int operator()(const std::pair<Condition::key_type,Condition>& e) const + { return this->process(e.second); } }; + /// Default constructor + Condition() = default; + /// Copy constructor + Condition(const Condition& c) = default; /// Initializing constructor - inline Condition::Condition(Condition::Object* p) - : Handle<Condition::Object>(p) {} - + Condition(Object* p); /// Constructor to be used when reading the already parsed object - template <typename Q> inline Condition::Condition(const Handle<Q>& e) - : Handle<Condition::Object>(e) {} + template <typename Q> Condition(const Handle<Q>& e); + /// Initializing constructor for a pure, undecorated conditions object + Condition(const std::string& name, const std::string& type); + /// Initializing constructor for a pure, undecorated conditions object with payload buffer + Condition(const std::string& name, const std::string& type, size_t memory); + /// Assignment operator + Condition& operator=(const Condition& c) = default; + + /// Output method + std::string str(int with_data=WITH_IOV|WITH_ADDRESS|WITH_DATATYPE) const; + + /** Data block (bound type) */ + /// Access the data type + int dataType() const; + /// Access the IOV block + OpaqueData& data() const; + + /** Interval of validity */ + /// Access the IOV type + const IOVType& iovType() const; + /// Access the IOV block + const IOV& iov() const; + + /** Direct data items in string form */ + /// Access the type field of the condition + const std::string& type() const; + /// Access the comment field of the condition + const std::string& comment() const; + /// Access the value field of the condition as a string + const std::string& value() const; + /// Access the address string [e.g. database identifier] + const std::string& address() const; + + /// Flag operations: Set a conditons flag + void setFlag(mask_type option); + /// Flag operations: UN-Set a conditons flag + void unFlag(mask_type option); + /// Flag operations: Test for a given a conditons flag + bool testFlag(mask_type option) const; + + /** Conditions meta-data */ + /// Access to the type information + const std::type_info& typeInfo() const; + /// Access to the grammar type + const BasicGrammar& descriptor() const; + /// Hash identifier + key_type key() const; + /// DetElement part of the identifier + detkey_type detector_key() const; + /// Item part of the identifier + itemkey_type item_key() const; + + /** Conditions handling */ + /// Re-evaluate the conditions data according to the previous bound type definition + Condition& rebind(); - - /// Key definition to optimize ans simplyfy the access to conditions entities - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS + /** Bind the data of the conditions object to a given format. + * + * Note: The type definition is possible exactly once. + * Any further rebindings MUST match the identical type. */ - class ConditionKey { - public: - /// Forward definition of the key type - typedef Condition::key_type key_type; - typedef Condition::detkey_type detkey_type; - typedef Condition::itemkey_type itemkey_type; + template <typename T> T& bind(); + /** Set and bind the data of the conditions object to a given format. + * + * Note: The type definition is possible exactly once. + * Any further rebindings MUST match the identical type. + */ + template <typename T> T& bind(const std::string& val); + /// Generic getter. Specify the exact type, not a polymorph type + template <typename T> T& get(); + /// Generic getter (const version). Specify the exact type, not a polymorph type + template <typename T> const T& get() const; + /// Check if object is already bound.... + bool is_bound() const { return isValid() ? data().is_bound() : false; } + }; + + /// Initializing constructor + inline Condition::Condition(Condition::Object* p) + : Handle<Condition::Object>(p) {} + + /// Constructor to be used when reading the already parsed object + template <typename Q> inline Condition::Condition(const Handle<Q>& e) + : Handle<Condition::Object>(e) {} + + + /// Key definition to optimize ans simplyfy the access to conditions entities + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + class ConditionKey { + public: #ifdef DD4HEP_CONDITIONKEY_HAVE_NAME - /// Optional string identifier. Helps debugging a lot! - std::string name; + /// Optional string identifier. Helps debugging a lot! + std::string name; #endif - /// Hashed key representation - key_type hash = 0; - - union KeyMaker { - key_type hash; - /** Note: The memory layout is important here to have properly - * ordered maps. The detector key MUST be on the high end - * of the resulting int64 'hash'. - */ - struct { - itemkey_type item_key; - detkey_type det_key; - } values; - KeyMaker() { - this->hash = 0; - } - KeyMaker(key_type k) { - this->hash = k; - } - KeyMaker(detkey_type det, itemkey_type item) { - this->values.det_key = det; - this->values.item_key = item; - } - }; - /// Compare keys by the hash value - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS + /// Hashed key representation + Condition::key_type hash = 0; + + union KeyMaker { + Condition::key_type hash; + /** Note: The memory layout is important here to have properly + * ordered maps. The detector key MUST be on the high end + * of the resulting int64 'hash'. */ - struct HashCompare { - Condition::key_type key; - HashCompare(Condition::key_type k) : key(k) {} - bool operator==(const ConditionKey& k) const { return key==k.hash; } - }; - public: - /// Default constructor - ConditionKey() = default; - /// Constructor from fully qualified key - ConditionKey(key_type key) : hash(key) {} - /// Constructor from string - ConditionKey(DetElement detector, const std::string& identifier); - /// Constructor from detector element key and item sub-key - ConditionKey(detkey_type det_key, const std::string& identifier); - /// Constructor from detector element and item sub-key - ConditionKey(DetElement detector, itemkey_type item_key); - /// Constructor from detector element key and item sub-key - ConditionKey(detkey_type det_key, itemkey_type item_key); - /// Copy constructor - ConditionKey(const ConditionKey& c) = default; - - /// Access the detector element part of the key - detkey_type detector_key() const { - return KeyMaker(hash).values.det_key; + struct { + Condition::itemkey_type item_key; + Condition::detkey_type det_key; + } values; + KeyMaker() { + this->hash = 0; } - /// Access the detector element part of the key - itemkey_type item_key() const { - return KeyMaker(hash).values.item_key; + KeyMaker(Condition::key_type k) { + this->hash = k; + } + KeyMaker(Condition::detkey_type det, Condition::itemkey_type item) { + this->values.det_key = det; + this->values.item_key = item; } - /// Hash code generation from input string - static key_type hashCode(DetElement detector, const char* value); - /// Hash code generation from input string - static key_type hashCode(DetElement detector, const std::string& value); - /// 32 bit hashcode of the item - static itemkey_type itemCode(const char* value); - /// 32 bit hashcode of the item - static itemkey_type itemCode(const std::string& value); - - /// Assignment operator from object copy - ConditionKey& operator=(const ConditionKey& key) = default; - /// Equality operator using key object - bool operator==(const ConditionKey& compare) const; - /// Equality operator using hash value - bool operator==(const key_type compare) const; - /// Equality operator using the string representation - //bool operator==(const std::string& compare) const; - - /// Operator less (for map insertions) using key object - bool operator<(const ConditionKey& compare) const; - /// Operator less (for map insertions) using hash value - bool operator<(const key_type compare) const; - /// Automatic conversion to the hashed representation of the key object - operator key_type () const { return hash; } - }; - - /// Constructor from detector element key and item sub-key - inline ConditionKey::ConditionKey(detkey_type det_key, itemkey_type item_key) { - hash = KeyMaker(det_key,item_key).hash; - } - - /// Equality operator using key object - inline bool ConditionKey::operator==(const ConditionKey& compare) const - { return hash == compare.hash; } - - /// Equality operator using hash value - inline bool ConditionKey::operator==(const key_type compare) const - { return hash == compare; } - - /// Operator less (for map insertions) using key object - inline bool ConditionKey::operator<(const ConditionKey& compare) const - { return hash < compare.hash; } - - /// Operator less (for map insertions) using hash value - inline bool ConditionKey::operator<(const key_type compare) const - { return hash < compare; } - - - /// Conditions selector functor. Default implementation selects everything evaluated. - /** - * Please note: - * This class should never be directly instantiated by the user. - * A typical use-case is to do so in a wrapper class, which contains a refernce - * to a counter object, which in turn allows to deduce information from the - * processed objects. - * - * See class ConditionsSelectWrapper below - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class ConditionsSelect { - protected: - /// Default constructor - ConditionsSelect() = default; - /// Copy constructor - ConditionsSelect(const ConditionsSelect& copy) = default; - /// Default destructor. - virtual ~ConditionsSelect(); - /// Default assignment operator - ConditionsSelect& operator=(const ConditionsSelect& copy) = default; - - public: - /// Selection callback: return true if the condition should be selected - bool operator()(Condition cond) const { return (*this)(cond.ptr()); } - /// Selection callback: return true if the condition should be selected - bool operator()(std::pair<Condition::key_type,Condition::Object*> cond) const - /** Arg is 2 longwords. No need to pass by reference. */ - { return (*this)(cond.second); } - /// Selection callback: return true if the condition should be selected - /** Arg is 2 longwords. No need to pass by reference. */ - bool operator()(std::pair<Condition::key_type,Condition> cond) const - { return (*this)(cond.second.ptr()); } - - /// Overloadable entry: Return number of conditions selected. Default does nothing.... - virtual size_t size() const { return 0; } - /// Overloadable entry: Selection callback: return true if the condition should be selected - virtual bool operator()(Condition::Object* cond) const = 0; }; - - /// Conditions selector functor. Wraps a user defined object by reference + /// Compare keys by the hash value /** - * Example usage for the slow ones: - * - * class MyCounter : public ConditionsSelectWrapper<long> { - * MyCounter(long& cnt) : ConditionsSelectWrapper<long>(cnt) {} - * virtual bool operator()(Condition::Object* cond) const { if ( cond != 0 ) ++object; } - * // Optionally overload: virtual size_t size() const { return object; } - * }; - * - * long counter = 0; - * for_each(std::begin(conditons), std::end(conditions), MyCounter(counter)); - * * \author M.Frank * \version 1.0 * \ingroup DD4HEP_CONDITIONS */ - template <typename OBJECT> class ConditionsSelectWrapper : public ConditionsSelect { - private: - /// Default constructor - ConditionsSelectWrapper() = delete; - /// Default assignment operator - bool operator==(const ConditionsSelectWrapper& compare) = delete; - - public: - /// Information collector type - typedef OBJECT object_t; - /// Reference to the infomation collector - object_t& object; - - public: - /// Default constructor - ConditionsSelectWrapper(object_t& o) : ConditionsSelect(), object(o) {} - /// Copy constructor - ConditionsSelectWrapper(const ConditionsSelectWrapper& copy) = default; - /// Default destructor. - virtual ~ConditionsSelectWrapper() = default; - /// Default assignment operator - ConditionsSelectWrapper& operator=(const ConditionsSelectWrapper& copy) = default; + struct HashCompare { + Condition::key_type key; + HashCompare(Condition::key_type k) : key(k) {} + bool operator==(const ConditionKey& k) const { return key==k.hash; } }; + public: + /// Default constructor + ConditionKey() = default; + /// Constructor from fully qualified key + ConditionKey(Condition::key_type key) : hash(key) {} + /// Constructor from string + ConditionKey(DetElement detector, const std::string& identifier); + /// Constructor from detector element key and item sub-key + ConditionKey(Condition::detkey_type det_key, const std::string& identifier); + /// Constructor from detector element and item sub-key + ConditionKey(DetElement detector, Condition::itemkey_type item_key); + /// Constructor from detector element key and item sub-key + ConditionKey(Condition::detkey_type det_key, Condition::itemkey_type item_key); + /// Copy constructor + ConditionKey(const ConditionKey& c) = default; - // Utility type definitions - typedef std::vector<Condition> RangeConditions; - typedef std::pair<RangeConditions,bool> RangeStatus; + /// Access the detector element part of the key + Condition::detkey_type detector_key() const { + return KeyMaker(hash).values.det_key; + } + /// Access the detector element part of the key + Condition::itemkey_type item_key() const { + return KeyMaker(hash).values.item_key; + } + /// Hash code generation from input string + static Condition::key_type hashCode(DetElement detector, const char* value); + /// Hash code generation from input string + static Condition::key_type hashCode(DetElement detector, const std::string& value); + /// 32 bit hashcode of the item + static Condition::itemkey_type itemCode(const char* value); + /// 32 bit hashcode of the item + static Condition::itemkey_type itemCode(const std::string& value); + + /// Assignment operator from object copy + ConditionKey& operator=(const ConditionKey& key) = default; + /// Equality operator using key object + bool operator==(const ConditionKey& compare) const; + /// Equality operator using hash value + bool operator==(const Condition::key_type compare) const; + /// Equality operator using the string representation + //bool operator==(const std::string& compare) const; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + /// Operator less (for map insertions) using key object + bool operator<(const ConditionKey& compare) const; + /// Operator less (for map insertions) using hash value + bool operator<(const Condition::key_type compare) const; + /// Automatic conversion to the hashed representation of the key object + operator Condition::key_type () const { return hash; } + }; + + /// Constructor from detector element key and item sub-key + inline ConditionKey::ConditionKey(Condition::detkey_type det_key, Condition::itemkey_type item_key) { + hash = KeyMaker(det_key,item_key).hash; + } + + /// Equality operator using key object + inline bool ConditionKey::operator==(const ConditionKey& compare) const + { return hash == compare.hash; } + + /// Equality operator using hash value + inline bool ConditionKey::operator==(const Condition::key_type compare) const + { return hash == compare; } + + /// Operator less (for map insertions) using key object + inline bool ConditionKey::operator<(const ConditionKey& compare) const + { return hash < compare.hash; } + + /// Operator less (for map insertions) using hash value + inline bool ConditionKey::operator<(const Condition::key_type compare) const + { return hash < compare; } + + + /// Conditions selector functor. Default implementation selects everything evaluated. + /** + * Please note: + * This class should never be directly instantiated by the user. + * A typical use-case is to do so in a wrapper class, which contains a refernce + * to a counter object, which in turn allows to deduce information from the + * processed objects. + * + * See class ConditionsSelectWrapper below + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + class ConditionsSelect { + protected: + /// Default constructor + ConditionsSelect() = default; + /// Copy constructor + ConditionsSelect(const ConditionsSelect& copy) = default; + /// Default destructor. + virtual ~ConditionsSelect(); + /// Default assignment operator + ConditionsSelect& operator=(const ConditionsSelect& copy) = default; + + public: + /// Selection callback: return true if the condition should be selected + bool operator()(Condition cond) const { return (*this)(cond.ptr()); } + /// Selection callback: return true if the condition should be selected + bool operator()(std::pair<Condition::key_type,Condition::Object*> cond) const + /** Arg is 2 longwords. No need to pass by reference. */ + { return (*this)(cond.second); } + /// Selection callback: return true if the condition should be selected + /** Arg is 2 longwords. No need to pass by reference. */ + bool operator()(std::pair<Condition::key_type,Condition> cond) const + { return (*this)(cond.second.ptr()); } + + /// Overloadable entry: Return number of conditions selected. Default does nothing.... + virtual size_t size() const { return 0; } + /// Overloadable entry: Selection callback: return true if the condition should be selected + virtual bool operator()(Condition::Object* cond) const = 0; + }; + + /// Conditions selector functor. Wraps a user defined object by reference + /** + * Example usage for the slow ones: + * + * class MyCounter : public ConditionsSelectWrapper<long> { + * MyCounter(long& cnt) : ConditionsSelectWrapper<long>(cnt) {} + * virtual bool operator()(Condition::Object* cond) const { if ( cond != 0 ) ++object; } + * // Optionally overload: virtual size_t size() const { return object; } + * }; + * + * long counter = 0; + * for_each(std::begin(conditons), std::end(conditions), MyCounter(counter)); + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + template <typename OBJECT> class ConditionsSelectWrapper : public ConditionsSelect { + private: + /// Default constructor + ConditionsSelectWrapper() = delete; + /// Default assignment operator + bool operator==(const ConditionsSelectWrapper& compare) = delete; + + public: + /// Reference to the infomation collector + OBJECT& object; + + public: + /// Default constructor + ConditionsSelectWrapper(OBJECT& o) : ConditionsSelect(), object(o) {} + /// Copy constructor + ConditionsSelectWrapper(const ConditionsSelectWrapper& copy) = default; + /// Default destructor. + virtual ~ConditionsSelectWrapper() = default; + /// Default assignment operator + ConditionsSelectWrapper& operator=(const ConditionsSelectWrapper& copy) = default; + }; + + // Utility type definitions + typedef std::vector<Condition> RangeConditions; + typedef std::pair<RangeConditions,bool> RangeStatus; + +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_CONDITIONS_H */ diff --git a/DDCore/include/DD4hep/ConditionsData.h b/DDCore/include/DD4hep/ConditionsData.h index 38659a2b0..31ba72dac 100644 --- a/DDCore/include/DD4hep/ConditionsData.h +++ b/DDCore/include/DD4hep/ConditionsData.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,10 +23,10 @@ #include <stdexcept> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { + namespace cond { /// Client data addition /** @@ -40,7 +40,7 @@ namespace DD4hep { virtual void release() = 0; }; - /// Conditions data block. Internally maps other objects to abstract data blocks + /// Conditions data block. detaillly maps other objects to abstract data blocks /** * \author M.Frank * \version 1.0 @@ -112,6 +112,6 @@ namespace DD4hep { } }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_CONDITIONSDATA_H */ diff --git a/DDCore/include/DD4hep/ConditionsListener.h b/DDCore/include/DD4hep/ConditionsListener.h index e439415a3..3a12918df 100644 --- a/DDCore/include/DD4hep/ConditionsListener.h +++ b/DDCore/include/DD4hep/ConditionsListener.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,14 +19,14 @@ // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Forward declarations class IOV; class IOVType; - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Conditions { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace cond { /// Forward declarations class ConditionsPool; @@ -57,7 +57,7 @@ namespace DD4hep { virtual void onRemovePool(ConditionsPool* /* pool */, void* /* param */) { } }; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } /* End namespace detail */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_CONDITIONSLISTENER_H */ diff --git a/DDCore/include/DD4hep/ConditionsMap.h b/DDCore/include/DD4hep/ConditionsMap.h index cf2a1a701..d9ac55337 100644 --- a/DDCore/include/DD4hep/ConditionsMap.h +++ b/DDCore/include/DD4hep/ConditionsMap.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,155 +15,150 @@ // Framework include files #include "DD4hep/Conditions.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" // C/C++ include files #include <map> #include <unordered_map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { - - /// ConditionsMap class. - /** - * Access mechanisms of DD4hep conditions for utilities - * =================================================== - * - * The conditions map class is the basic interface to manage/access conditions - * in DD4hep. It's main use is to provide a common interface to utilities using - * DD4hep conditions, such as scanners, selectors, printers etc. - * Such utilities often require access to conditions sets based on individual - * DetElement instances. - * - * Access to conditions is solely supported using this interface - * -- All utilities must use this interface. - * -- Any concrete implementation using conditions/alignment utilities - * must implement this interface - * -- Basic implmentation using STL map, multimap and unordered_map are provided. - * -- A special no-op implementation of this interface shall be provided to access - * "default" alignment conditions. - * This implementation shall fall-back internally to the DetElement::nominal() alignment. - * Known clients: VolumeManager (hence: DDG4, DDRec, etc.) - * - * Though this sounds like a trivial change, the consequences concern the entire conditions - * and alignment handling. This interface decouples entirely the core part of DD4hep - * from the conditons cache handling and the alignment handling. - * - * Based on this interface most utilities used to handle conditions, detectors scans - * to visit DetElement related condition sets, alignment and conditions printers etc. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class ConditionsMap { - public: - typedef Condition::key_type key_type; - typedef Condition::detkey_type detkey_type; - typedef Condition::itemkey_type itemkey_type; - typedef Condition::Processor Processor; - enum { - FIRST_ITEM = 0x0, - LAST_ITEM = ~0x0 - }; - enum { - FIRST_KEY = 0x0ULL, - LAST_KEY = ~0x0ULL - }; + /// ConditionsMap class. + /** + * Access mechanisms of dd4hep conditions for utilities + * =================================================== + * + * The conditions map class is the basic interface to manage/access conditions + * in dd4hep. It's main use is to provide a common interface to utilities using + * dd4hep conditions, such as scanners, selectors, printers etc. + * Such utilities often require access to conditions sets based on individual + * DetElement instances. + * + * Access to conditions is solely supported using this interface + * -- All utilities must use this interface. + * -- Any concrete implementation using conditions/alignment utilities + * must implement this interface + * -- Basic implmentation using STL map, multimap and unordered_map are provided. + * -- A special no-op implementation of this interface shall be provided to access + * "default" alignment conditions. + * This implementation shall fall-back internally to the DetElement::nominal() alignment. + * Known clients: VolumeManager (hence: DDG4, DDRec, etc.) + * + * Though this sounds like a trivial change, the consequences concern the entire conditions + * and alignment handling. This interface decouples entirely the core part of dd4hep + * from the conditons cache handling and the alignment handling. + * + * Based on this interface most utilities used to handle conditions, detectors scans + * to visit DetElement related condition sets, alignment and conditions printers etc. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + class ConditionsMap { + public: + enum { + FIRST_ITEM = 0x0, + LAST_ITEM = ~0x0 + }; + enum { + FIRST_KEY = 0x0ULL, + LAST_KEY = ~0x0ULL + }; - public: - /// Standard destructor - virtual ~ConditionsMap() = default; - /// Insert a new entry to the map. The detector element key and the item key make a unique global conditions key - virtual bool insert(DetElement detector, itemkey_type key, Condition condition) = 0; - /// Interface to access conditions by hash value. The detector element key and the item key make a unique global conditions key - virtual Condition get(DetElement detector, itemkey_type key) const = 0; - /// Interface to scan data content of the conditions mapping - virtual void scan(const Processor& processor) const = 0; + public: + /// Standard destructor + virtual ~ConditionsMap() = default; + /// Insert a new entry to the map. The detector element key and the item key make a unique global conditions key + virtual bool insert(DetElement detector, + Condition::itemkey_type key, + Condition condition) = 0; + /// Interface to access conditions by hash value. The detector element key and the item key make a unique global conditions key + virtual Condition get(DetElement detector, + Condition::itemkey_type key) const = 0; + /// Interface to scan data content of the conditions mapping + virtual void scan(const Condition::Processor& processor) const = 0; - /** Partial implementations for utilities accessing DetElement conditions */ + /** Partial implementations for utilities accessing DetElement conditions */ - /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] - /** Note: This default implementation uses - * void scan(DetElement detector, - * itemkey_type lower, - * itemkey_type upper, - * const Processor& collector) - * The performance depends on the concrete implementation of the scan method! - */ - virtual std::vector<Condition> get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const; + /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] + /** Note: This default implementation uses + * void scan(DetElement detector, + * itemkey_type lower, + * itemkey_type upper, + * const Processor& collector) + * The performance depends on the concrete implementation of the scan method! + */ + virtual std::vector<Condition> get(DetElement detector, + Condition::itemkey_type lower, + Condition::itemkey_type upper) const; - /// Interface to partially scan data content of the conditions mapping - /** Note: This default implementation assumes unordered containers and hence is - * not the most efficient implementation! - * Internally it uses "scan(Processor& processor)" - * the subselection hence is linearly depending of the number of elements. - * - * This default implementation uses - * std::vector<Condition> get(DetElement detector, - * itemkey_type lower, - * itemkey_type upper) - * The performance depends on the concrete implementation of the scan method! - * - * Using ordered maps with "lower_bound(key)" this can be greatly improved. - * See the concrete implementations below. - */ - virtual void scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const; - }; - - /// Concrete ConditionsMap implementation class using externally defined containers - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS + /// Interface to partially scan data content of the conditions mapping + /** Note: This default implementation assumes unordered containers and hence is + * not the most efficient implementation! + * detaillly it uses "scan(Processor& processor)" + * the subselection hence is linearly depending of the number of elements. + * + * This default implementation uses + * std::vector<Condition> get(DetElement detector, + * itemkey_type lower, + * itemkey_type upper) + * The performance depends on the concrete implementation of the scan method! + * + * Using ordered maps with "lower_bound(key)" this can be greatly improved. + * See the concrete implementations below. */ - template <typename T> - class ConditionsMapping : virtual public ConditionsMap { - public: - /// The actual data container - T data; - public: - /// Standard constructor to construct an empty object - ConditionsMapping() = default; - /// Standard destructor - virtual ~ConditionsMapping() = default; - /// No copy constructor - ConditionsMapping(const ConditionsMapping& copy) = delete; - /// No assignment - ConditionsMapping& operator=(const ConditionsMapping& copy) = delete; - /// Insert a new entry to the map - virtual bool insert(DetElement detector, itemkey_type key, Condition condition) override; - /// Interface to access conditions by hash value - virtual Condition get(DetElement detector, itemkey_type key) const override; - /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] - virtual std::vector<Condition> get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const override { - return this->ConditionsMap::get(detector,lower,upper); - } - /// Interface to scan data content of the conditions mapping - virtual void scan(const Processor& processor) const override; - /// Interface to partially scan data content of the conditions mapping - virtual void scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const override; - }; - /// Concrete implementation of the conditions map using a left-right map - typedef ConditionsMapping<std::map<Condition::key_type,Condition> > ConditionsTreeMap; - /// Concrete implementation of the conditions map using a multimap - typedef ConditionsMapping<std::multimap<Condition::key_type,Condition> > ConditionsMultiMap; - /// Concrete implementation of the conditions map using a hashmap - typedef ConditionsMapping<std::unordered_map<Condition::key_type,Condition> > ConditionsHashMap; + virtual void scan(DetElement detector, + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const; + }; + + /// Concrete ConditionsMap implementation class using externally defined containers + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + template <typename T> + class ConditionsMapping : virtual public ConditionsMap { + public: + /// The actual data container + T data; + public: + /// Standard constructor to construct an empty object + ConditionsMapping() = default; + /// Standard destructor + virtual ~ConditionsMapping() = default; + /// No copy constructor + ConditionsMapping(const ConditionsMapping& copy) = delete; + /// No assignment + ConditionsMapping& operator=(const ConditionsMapping& copy) = delete; + /// Insert a new entry to the map + virtual bool insert(DetElement detector, Condition::itemkey_type key, Condition condition) override; + /// Interface to access conditions by hash value + virtual Condition get(DetElement detector, Condition::itemkey_type key) const override; + /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] + virtual std::vector<Condition> get(DetElement detector, + Condition::itemkey_type lower, + Condition::itemkey_type upper) const override { + return this->ConditionsMap::get(detector,lower,upper); + } + /// Interface to scan data content of the conditions mapping + virtual void scan(const Condition::Processor& processor) const override; + /// Interface to partially scan data content of the conditions mapping + virtual void scan(DetElement detector, + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const override; + }; + /// Concrete implementation of the conditions map using a left-right map + typedef ConditionsMapping<std::map<Condition::key_type,Condition> > ConditionsTreeMap; + /// Concrete implementation of the conditions map using a multimap + typedef ConditionsMapping<std::multimap<Condition::key_type,Condition> > ConditionsMultiMap; + /// Concrete implementation of the conditions map using a hashmap + typedef ConditionsMapping<std::unordered_map<Condition::key_type,Condition> > ConditionsHashMap; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_CONDITIONSMAP_H */ diff --git a/DDCore/include/DD4hep/ConditionsPrinter.h b/DDCore/include/DD4hep/ConditionsPrinter.h index fa7362ad7..0c625fcfc 100644 --- a/DDCore/include/DD4hep/ConditionsPrinter.h +++ b/DDCore/include/DD4hep/ConditionsPrinter.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,14 +15,14 @@ // Framework includes #include "DD4hep/Printout.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Conditions.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace Conditions { + namespace cond { /// Generic Conditions data dumper. /** @@ -37,7 +37,7 @@ namespace DD4hep { */ class ConditionsPrinter { protected: - /// Internal param printer class + /// detaill param printer class class ParamPrinter; friend class ParamPrinter; @@ -83,6 +83,6 @@ namespace DD4hep { /// Callback to output conditions information virtual int operator()(Condition condition) const; }; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_CONDITIONSPRINTER_H */ diff --git a/DDCore/include/DD4hep/ConditionsProcessor.h b/DDCore/include/DD4hep/ConditionsProcessor.h index 2e31c6668..52564e677 100644 --- a/DDCore/include/DD4hep/ConditionsProcessor.h +++ b/DDCore/include/DD4hep/ConditionsProcessor.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_GEOMETRY_CONDITIONSPROCESSOR_H // Framework include files -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Conditions.h" #include "DD4hep/ConditionsMap.h" @@ -22,10 +22,10 @@ #include <memory> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { + namespace cond { /// Generic condition processor facade for the Conditons::Processor object @@ -150,6 +150,6 @@ namespace DD4hep { ConditionsCollector<typename std::remove_reference<T>::type> conditionsCollector(ConditionsMap& m, T&& conditions) { return ConditionsCollector<typename std::remove_reference<T>::type>(m, conditions); } - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_CONDITIONSPROCESSOR_H */ diff --git a/DDCore/include/DD4hep/DD4hepRootPersistency.h b/DDCore/include/DD4hep/DD4hepRootPersistency.h index a0907e3fc..bfeee23a7 100644 --- a/DDCore/include/DD4hep/DD4hepRootPersistency.h +++ b/DDCore/include/DD4hep/DD4hepRootPersistency.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,18 +14,18 @@ #define DD4HEP_DD4HEPROOTPERSISTENCY_H // Framework include files -#include "DD4hep/LCDDData.h" +#include "DD4hep/DetectorData.h" -/// Helper class to support ROOT persistency of LCDD objects -class DD4hepRootPersistency : public TNamed, public DD4hep::Geometry::LCDDData { +/// Helper class to support ROOT persistency of Detector objects +class DD4hepRootPersistency : public TNamed, public dd4hep::DetectorData { public: /// Default constructor DD4hepRootPersistency() : TNamed() {} /// Default destructor virtual ~DD4hepRootPersistency() {} - static int save(DD4hep::Geometry::LCDD& lcdd, const char* fname, const char* instance = "Geometry"); - static int load(DD4hep::Geometry::LCDD& lcdd, const char* fname, const char* instance = "Geometry"); + static int save(dd4hep::Detector& description, const char* fname, const char* instance = "Geometry"); + static int load(dd4hep::Detector& description, const char* fname, const char* instance = "Geometry"); /// ROOT implementation macro ClassDef(DD4hepRootPersistency,1); diff --git a/DDCore/include/DD4hep/DD4hepUI.h b/DDCore/include/DD4hep/DD4hepUI.h index 76fe9e855..b03a39274 100644 --- a/DDCore/include/DD4hep/DD4hepUI.h +++ b/DDCore/include/DD4hep/DD4hepUI.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,54 +14,58 @@ #define DD4HEP_DDCORE_DD4HEPUI_H // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// ROOT interactive UI for DD4hep applications - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP - */ - class DD4hepUI { - protected: - /// Reference to the LCDD instance object - Geometry::LCDD& m_lcdd; - Handle<NamedObject> m_condMgr; - Handle<NamedObject> m_alignMgr; + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { + + /// ROOT interactive UI for dd4hep applications + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP + */ + class DD4hepUI { + protected: + /// Reference to the Detector instance object + Detector& m_detDesc; + Handle<NamedObject> m_condMgr; + Handle<NamedObject> m_alignMgr; - public: - /// Default constructor - DD4hepUI(Geometry::LCDD& instance); - /// Default destructor - virtual ~DD4hepUI(); - /// Access to the LCDD instance - Geometry::LCDD* instance() const; - /// Access to the LCDD instance - Geometry::LCDD* lcdd() const; + public: + /// Default constructor + DD4hepUI(Detector& instance); + /// Default destructor + virtual ~DD4hepUI(); + /// Access to the Detector instance + Detector* instance() const; + /// Access to the Detector instance + Detector* detectorDescription() const; - /// Install the DD4hep conditions manager object - Handle<NamedObject> conditionsMgr() const; - /// Load conditions from file - long loadConditions(const std::string& fname) const; + /// Install the dd4hep conditions manager object + Handle<NamedObject> conditionsMgr() const; + /// Load conditions from file + long loadConditions(const std::string& fname) const; - /// Install the DD4hep alignment manager object - Handle<NamedObject> alignmentMgr() const; + /// Install the dd4hep alignment manager object + Handle<NamedObject> alignmentMgr() const; - /// LCDD interface: Manipulate geometry using factory converter - virtual long apply(const char* factory, int argc, char** argv) const; - /// LCDD interface: Read any geometry description or alignment file - virtual void fromXML(const std::string& fname, LCDDBuildType type = BUILD_DEFAULT) const; - /// LCDD interface: Re-draw the entire scene - virtual void redraw() const; - /// Dump the volume tree - virtual long dumpVols(int argc=0, char** argv=0) const; - /// Dump the DetElement tree - virtual long dumpDet() const; - }; - -} /* End namespace DD4hep */ + /// Detector interface: Manipulate geometry using factory converter + virtual long apply(const char* factory, int argc, char** argv) const; + /// Detector interface: Read any geometry description or alignment file + virtual void fromXML(const std::string& fname, DetectorBuildType type = BUILD_DEFAULT) const; + /// Detector interface: Re-draw the entire scene + virtual void redraw() const; + /// Dump the volume tree + virtual long dumpVols(int argc=0, char** argv=0) const; + /// Dump the DetElement tree + virtual long dumpDet() const; + }; + + } +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_DD4HEPUI_H diff --git a/DDCore/include/DD4hep/DD4hepUnits.h b/DDCore/include/DD4hep/DD4hepUnits.h index 6bdc5042c..1406846f7 100644 --- a/DDCore/include/DD4hep/DD4hepUnits.h +++ b/DDCore/include/DD4hep/DD4hepUnits.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,11 +12,11 @@ //========================================================================== // -// System of Units for DD4hep - similar to Geant3 and TGeo/ROOT +// System of Units for dd4hep - similar to Geant3 and TGeo/ROOT // // Taken from CLHEP with the following basic translations: // -// Geant4 DD4hep +// Geant4 dd4hep // ---------------------------------------------------------------- // millimeter mm=1,cm=10 centimeter mm=0.1,cm=1 // nanosecond s=1e9 second ns=1e-9,s=1 @@ -30,365 +30,366 @@ /// Utility namespace to support TGeo units. namespace dd4hep { - // - // Length [L] - // - static const double millimeter = 0.1; - static const double millimeter2 = millimeter * millimeter; - static const double millimeter3 = millimeter * millimeter * millimeter; - - static const double centimeter = 10. * millimeter; - static const double centimeter2 = centimeter * centimeter; - static const double centimeter3 = centimeter * centimeter * centimeter; - - static const double meter = 1000. * millimeter; - static const double meter2 = meter * meter; - static const double meter3 = meter * meter * meter; - - static const double kilometer = 1000. * meter; - static const double kilometer2 = kilometer * kilometer; - static const double kilometer3 = kilometer * kilometer * kilometer; - - static const double parsec = 3.0856775807e+16 * meter; - - static const double micrometer = 1.e-6 * meter; - static const double nanometer = 1.e-9 * meter; - static const double angstrom = 1.e-10 * meter; - static const double fermi = 1.e-15 * meter; - - static const double barn = 1.e-28 * meter2; - static const double millibarn = 1.e-3 * barn; - static const double microbarn = 1.e-6 * barn; - static const double nanobarn = 1.e-9 * barn; - static const double picobarn = 1.e-12 * barn; - - // symbols - static const double nm = nanometer; - static const double um = micrometer; - - static const double mm = millimeter; - static const double mm2 = millimeter2; - static const double mm3 = millimeter3; - - static const double cm = centimeter; - static const double cm2 = centimeter2; - static const double cm3 = centimeter3; - - static const double m = meter; - static const double m2 = meter2; - static const double m3 = meter3; - - static const double km = kilometer; - static const double km2 = kilometer2; - static const double km3 = kilometer3; - - static const double pc = parsec; - - // - // Angle - // - // static const double radian = 180. / 3.14159265358979323846; // => degree=1 - // static const double milliradian = 1.e-3 * radian; - // static const double degree = 1.; //= (3.14159265358979323846/180.0)*radian; - - //fg: use radians as default unit as this is needed for all math functions - // and everywhere else, except in TGeo shapes -> this is taken care of in shape Handles .... - static const double radian = 1. ; - static const double milliradian = 1.e-3 * radian; - static const double degree = (3.14159265358979323846/180.0)*radian; - - static const double steradian = 1.; - - // symbols - static const double rad = radian; - static const double mrad = milliradian; - static const double sr = steradian; - static const double deg = degree; - - // - // Time [T] - // - static const double nanosecond = 1.e-9; - static const double second = 1.e+9 * nanosecond; - static const double millisecond = 1.e-3 * second; - static const double microsecond = 1.e-6 * second; - static const double picosecond = 1.e-12 * second; - - static const double hertz = 1. / second; - static const double kilohertz = 1.e+3 * hertz; - static const double megahertz = 1.e+6 * hertz; - - // symbols - static const double ns = nanosecond; - static const double s = second; - static const double ms = millisecond; - - // - // Electric charge [Q] - // - static const double eplus = 1.; // positron charge - static const double e_SI = 1.602176487e-19; // positron charge in coulomb - static const double coulomb = eplus / e_SI; // coulomb = 6.24150 e+18 * eplus - - // - // Energy [E] - // - static const double megaelectronvolt = 1.e-3; - static const double electronvolt = 1.e-6 * megaelectronvolt; - static const double kiloelectronvolt = 1.e-3 * megaelectronvolt; - static const double gigaelectronvolt = 1.e+3 * megaelectronvolt; - static const double teraelectronvolt = 1.e+6 * megaelectronvolt; - static const double petaelectronvolt = 1.e+9 * megaelectronvolt; - - static const double joule = electronvolt / e_SI; // joule = 6.24150 e+12 * MeV - - // symbols - static const double MeV = megaelectronvolt; - static const double eV = electronvolt; - static const double keV = kiloelectronvolt; - static const double GeV = gigaelectronvolt; - static const double TeV = teraelectronvolt; - static const double PeV = petaelectronvolt; - - // - // Mass [E][T^2][L^-2] - // - static const double kilogram = joule * second * second / (meter * meter); - static const double gram = 1.e-3 * kilogram; - static const double milligram = 1.e-3 * gram; - - // symbols - static const double kg = kilogram; - static const double g = gram; - static const double mg = milligram; - - // - // Power [E][T^-1] - // - static const double watt = joule / second; // watt = 6.24150 e+3 * MeV/ns - - // - // Force [E][L^-1] - // - static const double newton = joule / meter; // newton = 6.24150 e+9 * MeV/mm - - // - // Pressure [E][L^-3] - // + //namespace units { + // + // Length [L] + // + static const double millimeter = 0.1; + static const double millimeter2 = millimeter * millimeter; + static const double millimeter3 = millimeter * millimeter * millimeter; + + static const double centimeter = 10. * millimeter; + static const double centimeter2 = centimeter * centimeter; + static const double centimeter3 = centimeter * centimeter * centimeter; + + static const double meter = 1000. * millimeter; + static const double meter2 = meter * meter; + static const double meter3 = meter * meter * meter; + + static const double kilometer = 1000. * meter; + static const double kilometer2 = kilometer * kilometer; + static const double kilometer3 = kilometer * kilometer * kilometer; + + static const double parsec = 3.0856775807e+16 * meter; + + static const double micrometer = 1.e-6 * meter; + static const double nanometer = 1.e-9 * meter; + static const double angstrom = 1.e-10 * meter; + static const double fermi = 1.e-15 * meter; + + static const double barn = 1.e-28 * meter2; + static const double millibarn = 1.e-3 * barn; + static const double microbarn = 1.e-6 * barn; + static const double nanobarn = 1.e-9 * barn; + static const double picobarn = 1.e-12 * barn; + + // symbols + static const double nm = nanometer; + static const double um = micrometer; + + static const double mm = millimeter; + static const double mm2 = millimeter2; + static const double mm3 = millimeter3; + + static const double cm = centimeter; + static const double cm2 = centimeter2; + static const double cm3 = centimeter3; + + static const double m = meter; + static const double m2 = meter2; + static const double m3 = meter3; + + static const double km = kilometer; + static const double km2 = kilometer2; + static const double km3 = kilometer3; + + static const double pc = parsec; + + // + // Angle + // + // static const double radian = 180. / 3.14159265358979323846; // => degree=1 + // static const double milliradian = 1.e-3 * radian; + // static const double degree = 1.; //= (3.14159265358979323846/180.0)*radian; + + //fg: use radians as default unit as this is needed for all math functions + // and everywhere else, except in TGeo shapes -> this is taken care of in shape Handles .... + static const double radian = 1. ; + static const double milliradian = 1.e-3 * radian; + static const double degree = (3.14159265358979323846/180.0)*radian; + + static const double steradian = 1.; + + // symbols + static const double rad = radian; + static const double mrad = milliradian; + static const double sr = steradian; + static const double deg = degree; + + // + // Time [T] + // + static const double nanosecond = 1.e-9; + static const double second = 1.e+9 * nanosecond; + static const double millisecond = 1.e-3 * second; + static const double microsecond = 1.e-6 * second; + static const double picosecond = 1.e-12 * second; + + static const double hertz = 1. / second; + static const double kilohertz = 1.e+3 * hertz; + static const double megahertz = 1.e+6 * hertz; + + // symbols + static const double ns = nanosecond; + static const double s = second; + static const double ms = millisecond; + + // + // Electric charge [Q] + // + static const double eplus = 1.; // positron charge + static const double e_SI = 1.602176487e-19; // positron charge in coulomb + static const double coulomb = eplus / e_SI; // coulomb = 6.24150 e+18 * eplus + + // + // Energy [E] + // + static const double megaelectronvolt = 1.e-3; + static const double electronvolt = 1.e-6 * megaelectronvolt; + static const double kiloelectronvolt = 1.e-3 * megaelectronvolt; + static const double gigaelectronvolt = 1.e+3 * megaelectronvolt; + static const double teraelectronvolt = 1.e+6 * megaelectronvolt; + static const double petaelectronvolt = 1.e+9 * megaelectronvolt; + + static const double joule = electronvolt / e_SI; // joule = 6.24150 e+12 * MeV + + // symbols + static const double MeV = megaelectronvolt; + static const double eV = electronvolt; + static const double keV = kiloelectronvolt; + static const double GeV = gigaelectronvolt; + static const double TeV = teraelectronvolt; + static const double PeV = petaelectronvolt; + + // + // Mass [E][T^2][L^-2] + // + static const double kilogram = joule * second * second / (meter * meter); + static const double gram = 1.e-3 * kilogram; + static const double milligram = 1.e-3 * gram; + + // symbols + static const double kg = kilogram; + static const double g = gram; + static const double mg = milligram; + + // + // Power [E][T^-1] + // + static const double watt = joule / second; // watt = 6.24150 e+3 * MeV/ns + + // + // Force [E][L^-1] + // + static const double newton = joule / meter; // newton = 6.24150 e+9 * MeV/mm + + // + // Pressure [E][L^-3] + // #define pascal hep_pascal // a trick to avoid warnings - static const double hep_pascal = newton / m2; // pascal = 6.24150 e+3 * MeV/mm3 - static const double bar = 100000 * pascal; // bar = 6.24150 e+8 * MeV/mm3 - static const double atmosphere = 101325 * pascal; // atm = 6.32420 e+8 * MeV/mm3 - - // - // Electric current [Q][T^-1] - // - static const double ampere = coulomb / second; // ampere = 6.24150 e+9 * eplus/ns - static const double milliampere = 1.e-3 * ampere; - static const double microampere = 1.e-6 * ampere; - static const double nanoampere = 1.e-9 * ampere; - - // - // Electric potential [E][Q^-1] - // - static const double megavolt = megaelectronvolt / eplus; - static const double kilovolt = 1.e-3 * megavolt; - static const double volt = 1.e-6 * megavolt; - - // - // Electric resistance [E][T][Q^-2] - // - static const double ohm = volt / ampere; // ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns) - - // - // Electric capacitance [Q^2][E^-1] - // - static const double farad = coulomb / volt; // farad = 6.24150e+24 * eplus/Megavolt - static const double millifarad = 1.e-3 * farad; - static const double microfarad = 1.e-6 * farad; - static const double nanofarad = 1.e-9 * farad; - static const double picofarad = 1.e-12 * farad; - - // - // Magnetic Flux [T][E][Q^-1] - // - static const double weber = volt * second; // weber = 1000*megavolt*ns - - // - // Magnetic Field [T][E][Q^-1][L^-2] - // - static const double tesla = volt * second / meter2; // tesla =0.001*megavolt*ns/mm2 - - static const double gauss = 1.e-4 * tesla; - static const double kilogauss = 1.e-1 * tesla; - - // - // Inductance [T^2][E][Q^-2] - // - static const double henry = weber / ampere; // henry = 1.60217e-7*MeV*(ns/eplus)**2 - - // - // Temperature - // - static const double kelvin = 1.; - - // - // Amount of substance - // - static const double mole = 1.; - - // - // Activity [T^-1] - // - static const double becquerel = 1. / second; - static const double curie = 3.7e+10 * becquerel; - - // - // Absorbed dose [L^2][T^-2] - // - static const double gray = joule / kilogram; - static const double kilogray = 1.e+3 * gray; - static const double milligray = 1.e-3 * gray; - static const double microgray = 1.e-6 * gray; - - // - // Luminous intensity [I] - // - static const double candela = 1.; - - // - // Luminous flux [I] - // - static const double lumen = candela * steradian; - - // - // Illuminance [I][L^-2] - // - static const double lux = lumen / meter2; - - // - // Miscellaneous - // - static const double perCent = 0.01; - static const double perThousand = 0.001; - static const double perMillion = 0.000001; - - // -*- C++ -*- - // ---------------------------------------------------------------------- - // HEP coherent Physical Constants - // - // This file has been provided by Geant4 (simulation toolkit for HEP). - // - // The basic units are : - // millimeter - // nanosecond - // Mega electron Volt - // positon charge - // degree Kelvin - // amount of substance (mole) - // luminous intensity (candela) - // radian - // steradian - // - // Below is a non exhaustive list of Physical CONSTANTS, - // computed in the Internal HEP System Of Units. - // - // Most of them are extracted from the Particle Data Book : - // Phys. Rev. D volume 50 3-1 (1994) page 1233 - // - // ...with a meaningful (?) name ... - // - // You can add your own constants. - // - // Author: M.Maire - // - // History: - // - // 23.02.96 Created - // 26.03.96 Added constants for standard conditions of temperature - // and pressure; also added Gas threshold. - // 29.04.08 use PDG 2006 values - // 03.11.08 use PDG 2008 values - - static const double pi = 3.14159265358979323846; - static const double twopi = 2 * pi; - static const double halfpi = pi / 2; - static const double pi2 = pi * pi; - - // - // - // - static const double Avogadro = 6.02214179e+23 / mole; - - // - // c = 299.792458 mm/ns - // c^2 = 898.7404 (mm/ns)^2 - // - static const double c_light = 2.99792458e+8 * m / s; - static const double c_squared = c_light * c_light; - - // - // h = 4.13566e-12 MeV*ns - // hbar = 6.58212e-13 MeV*ns - // hbarc = 197.32705e-12 MeV*mm - // - static const double h_Planck = 6.62606896e-34 * joule * s; - static const double hbar_Planck = h_Planck / twopi; - static const double hbarc = hbar_Planck * c_light; - static const double hbarc_squared = hbarc * hbarc; - - // - // - // - static const double electron_charge = -eplus; // see SystemOfUnits.h - static const double e_squared = eplus * eplus; - - // - // amu_c2 - atomic equivalent mass unit - // - AKA, unified atomic mass unit (u) - // amu - atomic mass unit - // - static const double electron_mass_c2 = 0.510998910 * MeV; - static const double proton_mass_c2 = 938.272013 * MeV; - static const double neutron_mass_c2 = 939.56536 * MeV; - static const double amu_c2 = 931.494028 * MeV; - static const double amu = amu_c2 / c_squared; - - // - // permeability of free space mu0 = 2.01334e-16 Mev*(ns*eplus)^2/mm - // permittivity of free space epsil0 = 5.52636e+10 eplus^2/(MeV*mm) - // - static const double mu0 = 4 * pi * 1.e-7 * henry / m; - static const double epsilon0 = 1. / (c_squared * mu0); - - // - // electromagnetic coupling = 1.43996e-12 MeV*mm/(eplus^2) - // - static const double elm_coupling = e_squared / (4 * pi * epsilon0); - static const double fine_structure_const = elm_coupling / hbarc; - static const double classic_electr_radius = elm_coupling / electron_mass_c2; - static const double electron_Compton_length = hbarc / electron_mass_c2; - static const double Bohr_radius = electron_Compton_length / fine_structure_const; - - static const double alpha_rcl2 = fine_structure_const * classic_electr_radius * classic_electr_radius; - - static const double twopi_mc2_rcl2 = twopi * electron_mass_c2 * classic_electr_radius * classic_electr_radius; - // - // - // - static const double k_Boltzmann = 8.617343e-11 * MeV / kelvin; - - // - // - // - static const double STP_Temperature = 273.15 * kelvin; - static const double STP_Pressure = 1. * atmosphere; - static const double kGasThreshold = 10. * mg / cm3; - - // - // - // - static const double universe_mean_density = 1.e-25 * g / cm3; - + static const double hep_pascal = newton / m2; // pascal = 6.24150 e+3 * MeV/mm3 + static const double bar = 100000 * pascal; // bar = 6.24150 e+8 * MeV/mm3 + static const double atmosphere = 101325 * pascal; // atm = 6.32420 e+8 * MeV/mm3 + + // + // Electric current [Q][T^-1] + // + static const double ampere = coulomb / second; // ampere = 6.24150 e+9 * eplus/ns + static const double milliampere = 1.e-3 * ampere; + static const double microampere = 1.e-6 * ampere; + static const double nanoampere = 1.e-9 * ampere; + + // + // Electric potential [E][Q^-1] + // + static const double megavolt = megaelectronvolt / eplus; + static const double kilovolt = 1.e-3 * megavolt; + static const double volt = 1.e-6 * megavolt; + + // + // Electric resistance [E][T][Q^-2] + // + static const double ohm = volt / ampere; // ohm = 1.60217e-16*(MeV/eplus)/(eplus/ns) + + // + // Electric capacitance [Q^2][E^-1] + // + static const double farad = coulomb / volt; // farad = 6.24150e+24 * eplus/Megavolt + static const double millifarad = 1.e-3 * farad; + static const double microfarad = 1.e-6 * farad; + static const double nanofarad = 1.e-9 * farad; + static const double picofarad = 1.e-12 * farad; + + // + // Magnetic Flux [T][E][Q^-1] + // + static const double weber = volt * second; // weber = 1000*megavolt*ns + + // + // Magnetic Field [T][E][Q^-1][L^-2] + // + static const double tesla = volt * second / meter2; // tesla =0.001*megavolt*ns/mm2 + + static const double gauss = 1.e-4 * tesla; + static const double kilogauss = 1.e-1 * tesla; + + // + // Inductance [T^2][E][Q^-2] + // + static const double henry = weber / ampere; // henry = 1.60217e-7*MeV*(ns/eplus)**2 + + // + // Temperature + // + static const double kelvin = 1.; + + // + // Amount of substance + // + static const double mole = 1.; + + // + // Activity [T^-1] + // + static const double becquerel = 1. / second; + static const double curie = 3.7e+10 * becquerel; + + // + // Absorbed dose [L^2][T^-2] + // + static const double gray = joule / kilogram; + static const double kilogray = 1.e+3 * gray; + static const double milligray = 1.e-3 * gray; + static const double microgray = 1.e-6 * gray; + + // + // Luminous intensity [I] + // + static const double candela = 1.; + + // + // Luminous flux [I] + // + static const double lumen = candela * steradian; + + // + // Illuminance [I][L^-2] + // + static const double lux = lumen / meter2; + + // + // Miscellaneous + // + static const double perCent = 0.01; + static const double perThousand = 0.001; + static const double perMillion = 0.000001; + + // -*- C++ -*- + // ---------------------------------------------------------------------- + // HEP coherent Physical Constants + // + // This file has been provided by Geant4 (simulation toolkit for HEP). + // + // The basic units are : + // millimeter + // nanosecond + // Mega electron Volt + // positon charge + // degree Kelvin + // amount of substance (mole) + // luminous intensity (candela) + // radian + // steradian + // + // Below is a non exhaustive list of Physical CONSTANTS, + // computed in the detaill HEP System Of Units. + // + // Most of them are extracted from the Particle Data Book : + // Phys. Rev. D volume 50 3-1 (1994) page 1233 + // + // ...with a meaningful (?) name ... + // + // You can add your own constants. + // + // Author: M.Maire + // + // History: + // + // 23.02.96 Created + // 26.03.96 Added constants for standard conditions of temperature + // and pressure; also added Gas threshold. + // 29.04.08 use PDG 2006 values + // 03.11.08 use PDG 2008 values + + static const double pi = 3.14159265358979323846; + static const double twopi = 2 * pi; + static const double halfpi = pi / 2; + static const double pi2 = pi * pi; + + // + // + // + static const double Avogadro = 6.02214179e+23 / mole; + + // + // c = 299.792458 mm/ns + // c^2 = 898.7404 (mm/ns)^2 + // + static const double c_light = 2.99792458e+8 * m / s; + static const double c_squared = c_light * c_light; + + // + // h = 4.13566e-12 MeV*ns + // hbar = 6.58212e-13 MeV*ns + // hbarc = 197.32705e-12 MeV*mm + // + static const double h_Planck = 6.62606896e-34 * joule * s; + static const double hbar_Planck = h_Planck / twopi; + static const double hbarc = hbar_Planck * c_light; + static const double hbarc_squared = hbarc * hbarc; + + // + // + // + static const double electron_charge = -eplus; // see SystemOfUnits.h + static const double e_squared = eplus * eplus; + + // + // amu_c2 - atomic equivalent mass unit + // - AKA, unified atomic mass unit (u) + // amu - atomic mass unit + // + static const double electron_mass_c2 = 0.510998910 * MeV; + static const double proton_mass_c2 = 938.272013 * MeV; + static const double neutron_mass_c2 = 939.56536 * MeV; + static const double amu_c2 = 931.494028 * MeV; + static const double amu = amu_c2 / c_squared; + + // + // permeability of free space mu0 = 2.01334e-16 Mev*(ns*eplus)^2/mm + // permittivity of free space epsil0 = 5.52636e+10 eplus^2/(MeV*mm) + // + static const double mu0 = 4 * pi * 1.e-7 * henry / m; + static const double epsilon0 = 1. / (c_squared * mu0); + + // + // electromagnetic coupling = 1.43996e-12 MeV*mm/(eplus^2) + // + static const double elm_coupling = e_squared / (4 * pi * epsilon0); + static const double fine_structure_const = elm_coupling / hbarc; + static const double classic_electr_radius = elm_coupling / electron_mass_c2; + static const double electron_Compton_length = hbarc / electron_mass_c2; + static const double Bohr_radius = electron_Compton_length / fine_structure_const; + + static const double alpha_rcl2 = fine_structure_const * classic_electr_radius * classic_electr_radius; + + static const double twopi_mc2_rcl2 = twopi * electron_mass_c2 * classic_electr_radius * classic_electr_radius; + // + // + // + static const double k_Boltzmann = 8.617343e-11 * MeV / kelvin; + + // + // + // + static const double STP_Temperature = 273.15 * kelvin; + static const double STP_Pressure = 1. * atmosphere; + static const double kGasThreshold = 10. * mg / cm3; + + // + // + // + static const double universe_mean_density = 1.e-25 * g / cm3; + //} } #endif /* DD4HEP_TGEOUNITS_H */ diff --git a/DDCore/include/DD4hep/DetElement.h b/DDCore/include/DD4hep/DetElement.h new file mode 100644 index 000000000..32d5408b3 --- /dev/null +++ b/DDCore/include/DD4hep/DetElement.h @@ -0,0 +1,378 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== +#ifndef DD4HEP_DETECTOR_H +#define DD4HEP_DETECTOR_H + +// Framework include files +#include "DD4hep/Handle.h" +#include "DD4hep/Callback.h" +#include "DD4hep/Objects.h" +#include "DD4hep/Volumes.h" +#include "DD4hep/Readout.h" +#include "DD4hep/Alignments.h" +#include "DD4hep/Segmentations.h" + +// C/C++ include files +#include <map> +#include <typeinfo> + +/// Namespace for the AIDA detector description toolkit +namespace dd4hep { + + // Forward declarations + class Detector; + class DetElementObject; + class SensitiveDetectorObject; + + /// Handle class to hold the information of a sensitive detector. + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class SensitiveDetector: public Handle<SensitiveDetectorObject> { + protected: + + /// Templated destructor function + template <typename T> static void _delete(void* ptr) { + delete (T*) (ptr); + } + + /// Add an extension object to the detector element + void* i_addExtension(void* ptr, const std::type_info& info, void (*destruct)(void*)); + + /// Access an existing extension object from the detector element + void* i_extension(const std::type_info& info) const; + + public: + + /// Default constructor + SensitiveDetector() : Handle<SensitiveDetectorObject>() { } + + /// Constructor to copy handled object + SensitiveDetector(Object* obj_pointer) + : Handle<SensitiveDetectorObject>(obj_pointer) { } + + /// Copy from named handle + SensitiveDetector(const Handle<SensitiveDetectorObject>& sd) + : Handle<SensitiveDetectorObject>(sd) { } + + /// Copy from handle + SensitiveDetector(const SensitiveDetector& sd) = default; + + /// Templated constructor for handle conversions + template <typename Q> SensitiveDetector(const Handle<Q>& e) + : Handle<SensitiveDetectorObject>(e) { } + + /// Constructor for a new sensitive detector element + SensitiveDetector(const std::string& name, const std::string& type = "sensitive"); + + /// Assignment operator + SensitiveDetector& operator=(const SensitiveDetector& sd) = default; + + /// Access the type of the sensitive detector + std::string type() const; + + /// Set detector type (structure, tracker, calorimeter, etc.). + SensitiveDetector& setType(const std::string& typ); + + /// Set flag to handle hits collection + SensitiveDetector& setVerbose(bool value); + + /// Access flag to combine hist + bool verbose() const; + + /// Set flag to handle hits collection + SensitiveDetector& setCombineHits(bool value); + + /// Access flag to combine hist + bool combineHits() const; + + /// Assign the name of the hits collection + SensitiveDetector& setHitsCollection(const std::string& spec); + + /// Access the hits collection name + const std::string& hitsCollection() const; + + /// Assign the IDDescriptor reference + SensitiveDetector& setReadout(Readout readout); + + /// Access readout structure of the sensitive detector + Readout readout() const; + + /// Set energy cut off + SensitiveDetector& setEnergyCutoff(double value); + + /// Access energy cut off + double energyCutoff() const; + + /// Set the regional attributes to the sensitive detector + SensitiveDetector& setRegion(Region reg); + + /// Access to the region setting of the sensitive detector (not mandatory) + Region region() const; + + /// Set the limits to the sensitive detector + SensitiveDetector& setLimitSet(LimitSet limits); + + /// Access to the limit set of the sensitive detector (not mandatory). + LimitSet limits() const; + + /// Extend the sensitive detector element with an arbitrary structure accessible by the type + template <typename IFACE, typename CONCRETE> IFACE* addExtension(CONCRETE* c) { + return (IFACE*) i_addExtension(dynamic_cast<IFACE*>(c), typeid(IFACE), _delete<IFACE>); + } + + /// Access extension element by the type + template <typename IFACE> IFACE* extension() const { + return (IFACE*) i_extension(typeid(IFACE)); + } + }; + + /// Handle class describing a detector element + /** + * Detector elements (class DetElement are entities which represent + * subdetectors or sizable parts of a subdetector. + * A DetElement instance has the means to provide to clients information about + * + * - the detector hierarchy by exposing its children. + * - its placement within the overall experiment if it represents an + * entire subdetector or its placement with respect to its parent + * if the \em DetElement represents a part of a subdetector. + * - information about the \em Readout structure if the object is + * instrumented and read-out. Otherwise this link is empty. + * - information about the environmental conditions etc. \em conditons. + * The access to conditions is exposed via the DetConditions interface. + * See dd4hep/DetConditions.h for further details. + * - alignment information. + * . + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class DetElement: public Handle<DetElementObject> { + public: + /// Abstract base for processing callbacks to DetElement objects + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Processor { + public: + /// Default constructor + Processor(); + /// Default destructor + virtual ~Processor(); + /// Container callback for object processing + virtual int processElement(DetElement detector) = 0; + }; + + typedef std::map<std::string, DetElement> Children; + + enum CopyParameters { + COPY_NONE = 0, COPY_PLACEMENT = 1 << 0, COPY_PARENT = 1 << 1, COPY_ALIGNMENT = 1 << 2, LAST + }; + + enum UpdateParam { + CONDITIONS_CHANGED = 1<<0, + PLACEMENT_CHANGED = 1<<1, + SOMETHING_CHANGED = 1<<2, + PLACEMENT_ELEMENT = 1<<20, + PLACEMENT_HIGHEST = 1<<21, + PLACEMENT_DETECTOR = 1<<22, + PLACEMENT_NONE + }; + + /// detaill assert function to check conditions + void check(bool condition, const std::string& msg) const; + + protected: + + /// Templated destructor function + template <typename T> static void _delete(void* ptr) { + delete (T*) (ptr); + } + /// Templated copy constructor + template <typename T> static void* _copy(const void* ptr, DetElement elt) { + return new T(*(dynamic_cast<const T*>((T*) ptr)), elt); + } + + /// Add an extension object to the detector element + void* i_addExtension(void* ptr, const std::type_info& info, + void* (*copy)(const void*, DetElement), + void (*destruct)(void*)) const; + /// Access an existing extension object from the detector element + void* i_extension(const std::type_info& info) const; + /// detaill call to extend the detector element with an arbitrary structure accessible by the type + void i_addUpdateCall(unsigned int callback_type, const Callback& callback) const; + + public: + + /// Default constructor + DetElement() = default; + + /// Constructor to copy handle + DetElement(const DetElement& e) = default; + + /// Constructor to hold handled object + DetElement(Object* object_ptr) : Handle<DetElementObject>(object_ptr) { } + + /// Clone constructor + DetElement(Object* data, const std::string& name, const std::string& type); + + /// Templated constructor for handle conversions + template <typename Q> DetElement(const Handle<Q>& e) : Handle<DetElementObject>(e) {} + +#ifdef __MAKECINT__ + /// Constructor to copy handle + DetElement(const Ref_t& e) : Handle<DetElementObject>(e) { } +#endif + /// Constructor for a new subdetector element + DetElement(const std::string& name, const std::string& type, int id); + + /// Constructor for a new subdetector element + DetElement(const std::string& name, int id); + + /// Constructor for a new subdetector element + DetElement(DetElement parent, const std::string& name, int id); + + /// Additional data accessor + Object& _data() const { + return object<Object>(); + } + + /// Operator less to insert into a map + bool operator <(const DetElement e) const { + return ptr() < e.ptr(); + } + + /// Equality operator + bool operator ==(const DetElement e) const { + return ptr() == e.ptr(); + } + + /// Assignment operator + DetElement& operator=(const DetElement& e) = default; + + /// Clone (Deep copy) the DetElement structure with a new name + DetElement clone(const std::string& new_name) const; + + /// Clone (Deep copy) the DetElement structure with a new name and new identifier + DetElement clone(const std::string& new_name, int new_id) const; + + /// Extend the detector element with an arbitrary structure accessible by the type + template <typename IFACE, typename CONCRETE> IFACE* addExtension(CONCRETE* c) const { + CallbackSequence::checkTypes(typeid(IFACE), typeid(CONCRETE), dynamic_cast<IFACE*>(c)); + return (IFACE*) i_addExtension(dynamic_cast<IFACE*>(c), typeid(IFACE), _copy<CONCRETE>, _delete<IFACE>); + } + /// Access extension element by the type + template <typename IFACE> IFACE* extension() const { + return (IFACE*) i_extension(typeid(IFACE)); + } + /// Extend the detector element with an arbitrary callback + template <typename Q, typename T> + void callAtUpdate(unsigned int typ, Q* pointer, + void (T::*pmf)(unsigned long typ, DetElement& det, void* opt_par)) const + { + CallbackSequence::checkTypes(typeid(T), typeid(Q), dynamic_cast<T*>(pointer)); + i_addUpdateCall(typ, Callback(pointer).make(pmf)); + } + /// Remove callback from object + void removeAtUpdate(unsigned int type, void* pointer) const; + + /// Get the detector identifier + int id() const; + /// Setter: Combine hits attribute + DetElement& setCombineHits(bool value, SensitiveDetector& sens); + /// Getter: Combine hits attribute + bool combineHits() const; + + /** Access detector type (structure, tracker, calorimeter, etc.). + * Required for determination of G4 sensitive detector. + */ + std::string type() const; + /// Set detector type (structure, tracker, calorimeter, etc.). + DetElement& setType(const std::string& typ); + + // Return flag word encoding detector types ( ideally use dd4hep::DetType for decoding ) + unsigned int typeFlag() const; + + /// Set the flag word encoding detector types ( ideally use dd4hep::DetType for encoding ) + DetElement& setTypeFlag(unsigned int types); + + /// Access hash key of this detector element (Only valid once geometry is closed!) + unsigned int key() const; + /// Access the hierarchical level of the detector element (Only valid once geometry is closed!) + int level() const; + /// Path of the detector element (not necessarily identical to placement path!) + const std::string& path() const; + /// Access to the full path to the placed object + const std::string& placementPath() const; + + /// Set all attributes in one go + DetElement& setAttributes(const Detector& description, + const Volume& volume, + const std::string& region, + const std::string& limits, + const std::string& vis); + + /// Set Visualization attributes to the detector element + DetElement& setVisAttributes(const Detector& description, const std::string& name, const Volume& volume); + /// Set the regional attributes to the detector element + DetElement& setRegion(const Detector& description, const std::string& name, const Volume& volume); + /// Set the limits to the detector element + DetElement& setLimitSet(const Detector& description, const std::string& name, const Volume& volume); + + /// Access to the logical volume of the detector element's placement + Volume volume() const; + + /// Access to the physical volume of this detector element + /** This is the current placement value of the detector eleemnt. + * A possible global re-alignment may alter the value. + * Hence, it should hence not be cached. + */ + PlacedVolume placement() const; + /// Access to the ideal physical volume of this detector element + /** This is the original placement set in the detector constructor. + * A possible global re-alignment make this value different + * from the regular placement() call. + */ + PlacedVolume idealPlacement() const; + /// Set the physical volumes of the detector element + DetElement& setPlacement(const PlacedVolume& volume); + /// The cached VolumeID of this subdetector element + VolumeID volumeID() const; + + /// Add new child to the detector structure + DetElement& add(DetElement sub_element); + /// Access to the list of children + const Children& children() const; + /// Access to individual children by name + DetElement child(const std::string& name) const; + /// Access to the detector elements's parent + DetElement parent() const; + /// Access to the world object. Only possible once the geometry is closed. + DetElement world() const; + + /// Access to the constant ideal (nominal) alignment information + Alignment nominal() const; + /// Access to the constant survey alignment information + Alignment survey() const; + }; +} /* End namespace dd4hep */ + +#include "DD4hep/AlignmentData.h" + +#endif /* DD4HEP_DETECTOR_H */ diff --git a/DDCore/include/DD4hep/DetFactoryHelper.h b/DDCore/include/DD4hep/DetFactoryHelper.h index 06e3ffb37..9bce6d0e8 100644 --- a/DDCore/include/DD4hep/DetFactoryHelper.h +++ b/DDCore/include/DD4hep/DetFactoryHelper.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,11 +10,11 @@ // Author : M.Frank // //========================================================================== -#ifndef DD4hep_DETECTOR_DETFACTORYHELPER_H -#define DD4hep_DETECTOR_DETFACTORYHELPER_H +#ifndef dd4hep_DETECTOR_DETFACTORYHELPER_H +#define dd4hep_DETECTOR_DETFACTORYHELPER_H /** Obsolete header. Better use XML/Helper.h instead ! */ #include "XML/Helper.h" -#endif // DD4hep_DETECTOR_DETFACTORYHELPER_H +#endif // dd4hep_DETECTOR_DETFACTORYHELPER_H diff --git a/DDCore/include/DD4hep/DetType.h b/DDCore/include/DD4hep/DetType.h index f5a36398c..1bcec9b58 100644 --- a/DDCore/include/DD4hep/DetType.h +++ b/DDCore/include/DD4hep/DetType.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +15,7 @@ #define DD4HEP_DetType_H /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /** Helper class for encoding sub detector types in a flag word. * Example:<br> @@ -120,6 +120,6 @@ namespace DD4hep { } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DETECTOR_H */ diff --git a/DDCore/include/DD4hep/Detector.h b/DDCore/include/DD4hep/Detector.h index 4a99ae4fa..7e7f5818d 100644 --- a/DDCore/include/DD4hep/Detector.h +++ b/DDCore/include/DD4hep/Detector.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,386 +10,343 @@ // Author : M.Frank // //========================================================================== -#ifndef DD4HEP_DETECTOR_H -#define DD4HEP_DETECTOR_H +#ifndef DD4HEP_Detector_Detector_H +#define DD4HEP_Detector_Detector_H -// Framework include files +#include "DD4hep/Version.h" + +// Framework includes #include "DD4hep/Handle.h" -#include "DD4hep/Callback.h" +#include "DD4hep/Fields.h" #include "DD4hep/Objects.h" +#include "DD4hep/Shapes.h" #include "DD4hep/Volumes.h" #include "DD4hep/Readout.h" -#include "DD4hep/Alignments.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Segmentations.h" +#include "DD4hep/VolumeManager.h" +#include "DD4hep/NamedObject.h" +#include "DD4hep/BuildType.h" // C/C++ include files #include <map> -#include <typeinfo> - -/// Namespace for the AIDA detector description toolkit -namespace DD4hep { +#include <vector> +#include <string> +#include <cstdio> - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { +// Forward declarations +class TGeoManager; - // Forward declarations - class LCDD; - class DetElementObject; - class SensitiveDetectorObject; - - /// Handle class to hold the information of a sensitive detector. +/// Namespace for the AIDA detector description toolkit +namespace dd4hep { + + /// return a string with the current dd4hep version in the form vXX-YY. + std::string versionString(); + + // Foward declarations + class NamedObject; + + /// Namespace for the AIDA detector description toolkit supporting XML utilities + namespace xml { + class UriReader; + } + + /// The main interface to the dd4hep detector description package + /** + * Note: The usage of the factory method: + * + * static Detector& getInstance(void); + * + * is DEPRECATED! + * + * You should rather use the plugin mechanism to create a new instance. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Detector { + public: + /// Type definition of a map of named handles + typedef std::map<std::string, Handle<NamedObject> > HandleMap; + typedef std::map<std::string, std::string> PropertyValues; + typedef std::map<std::string, PropertyValues> Properties; + + /// Destructor + virtual ~Detector() = default; + + /// Access flag to steer the detail of building of the geometry/detector description + virtual DetectorBuildType buildType() const = 0; + /// Initialize geometry + virtual void init() = 0; + /// Finalize the geometry + virtual void endDocument() = 0; + + /// Access the geometry manager of this instance + virtual TGeoManager& manager() const = 0; + /// Access to properties map + virtual Properties& properties() const = 0; + /// Return handle to material describing air + virtual Material air() const = 0; + /// Return handle to material describing vacuum + virtual Material vacuum() const = 0; + /// Return handle to "invisible" visualization attributes + virtual VisAttr invisible() const = 0; + + /// Return reference to the top-most (world) detector element + virtual DetElement world() const = 0; + /// Return reference to detector element with all tracker devices. + virtual DetElement trackers() const = 0; + + /// Return handle to the world volume containing everything + virtual Volume worldVolume() const = 0; + /// Return handle to the volume containing the tracking devices + virtual Volume trackingVolume() const = 0; + + /// Return handle to the VolumeManager + virtual VolumeManager volumeManager() const = 0; + + /// Accessor to the map of header entries + virtual Header header() const = 0; + /// Accessor to the header entry + virtual void setHeader(Header h) = 0; + + /// Return handle to the combined electromagentic field description. + virtual OverlayedField field() const = 0; + + /// Accessor to the map of constants + virtual const HandleMap& constants() const = 0; + /// Accessor to the map of region settings + virtual const HandleMap& regions() const = 0; + /// Accessor to the map of sub-detectors + virtual const HandleMap& detectors() const = 0; + /// Accessor to the map of sub-detectors + virtual const HandleMap& sensitiveDetectors() const = 0; + /// Accessor to the map of readout structures + virtual const HandleMap& readouts() const = 0; + /// Accessor to the map of visualisation attributes + virtual const HandleMap& visAttributes() const = 0; + /// Accessor to the map of limit settings + virtual const HandleMap& limitsets() const = 0; + /// Accessor to the map of field entries, which together form the global field + virtual const HandleMap& fields() const = 0; + /// Accessor to the map of ID specifications + virtual const HandleMap& idSpecifications() const = 0; + +#ifndef __MAKECINT__ + /** Access to predefined caches of subdetectors according to the sensitive type */ + /// Access a set of subdetectors according to the sensitive type. /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY + Please note: + - The sensitive type of a detector is set in the 'detector constructor'. + - Not sensitive detector structures have the name 'passive' + - Compounds (ie. nested detectors) are of type 'compound' + - If throw_exc is set to true, an exception is thrown if the type + is not present. Otherwise an empty detector container is returned. + */ + virtual const std::vector<DetElement>& detectors(const std::string& type, + bool throw_exc=false) = 0; + + /// Access a set of subdetectors according to several sensitive types. + virtual std::vector<DetElement> detectors(const std::string& type1, + const std::string& type2, + const std::string& type3="", + const std::string& type4="", + const std::string& type5="" ) = 0; + + /// Access the availible detector types + virtual std::vector<std::string> detectorTypes() const = 0; + + + /** return a vector with all detectors that have all the type properties in + * includeFlag set but none of the properties given in excludeFlag */ - class SensitiveDetector: public Handle<SensitiveDetectorObject> { - public: - /// Extensions destructor type - typedef void (*destruct_t)(void*); - /// Internal object type - typedef SensitiveDetectorObject Object; - /// Definition of the base handle type - typedef Handle<SensitiveDetectorObject> RefObject; - protected: - - /// Templated destructor function - template <typename T> static void _delete(void* ptr) { - delete (T*) (ptr); - } - - /// Add an extension object to the detector element - void* i_addExtension(void* ptr, const std::type_info& info, void (*destruct)(void*)); - - /// Access an existing extension object from the detector element - void* i_extension(const std::type_info& info) const; - - public: - - /// Default constructor - SensitiveDetector() : RefObject() { } - - /// Constructor to copy handled object - SensitiveDetector(Object* obj_pointer) : RefObject(obj_pointer) { } - - /// Copy from named handle - SensitiveDetector(const RefObject& sd) : RefObject(sd) { } - - /// Copy from handle - SensitiveDetector(const SensitiveDetector& sd) = default; - - /// Templated constructor for handle conversions - template <typename Q> SensitiveDetector(const Handle<Q>& e) : RefObject(e) { } - - /// Constructor for a new sensitive detector element - SensitiveDetector(const std::string& name, const std::string& type = "sensitive"); - - /// Assignment operator - SensitiveDetector& operator=(const SensitiveDetector& sd) = default; - - /// Access the type of the sensitive detector - std::string type() const; - - /// Set detector type (structure, tracker, calorimeter, etc.). - SensitiveDetector& setType(const std::string& typ); - - /// Set flag to handle hits collection - SensitiveDetector& setVerbose(bool value); - - /// Access flag to combine hist - bool verbose() const; - - /// Set flag to handle hits collection - SensitiveDetector& setCombineHits(bool value); - - /// Access flag to combine hist - bool combineHits() const; - - /// Assign the name of the hits collection - SensitiveDetector& setHitsCollection(const std::string& spec); - - /// Access the hits collection name - const std::string& hitsCollection() const; - - /// Assign the IDDescriptor reference - SensitiveDetector& setReadout(Readout readout); - - /// Access readout structure of the sensitive detector - Readout readout() const; - - /// Set energy cut off - SensitiveDetector& setEnergyCutoff(double value); - - /// Access energy cut off - double energyCutoff() const; - - /// Set the regional attributes to the sensitive detector - SensitiveDetector& setRegion(Region reg); - - /// Access to the region setting of the sensitive detector (not mandatory) - Region region() const; - - /// Set the limits to the sensitive detector - SensitiveDetector& setLimitSet(LimitSet limits); - - /// Access to the limit set of the sensitive detector (not mandatory). - LimitSet limits() const; + virtual std::vector<DetElement> detectors(unsigned int includeFlag, + unsigned int excludeFlag=0 ) const = 0 ; +#endif - /// Extend the sensitive detector element with an arbitrary structure accessible by the type - template <typename IFACE, typename CONCRETE> IFACE* addExtension(CONCRETE* c) { - return (IFACE*) i_addExtension(dynamic_cast<IFACE*>(c), typeid(IFACE), _delete<IFACE>); - } + /** Miscaneleous accessors to the detexctor description */ - /// Access extension element by the type - template <typename IFACE> IFACE* extension() const { - return (IFACE*) i_extension(typeid(IFACE)); - } - }; + /// Register new mother volume using the detector name. + /** Volumes must be registered/declared PRIOR to be picked up! + * The method throws an exception if another volume was already declared for this subdetector + * The method throws an exception if the volume to be registered is invalid. + */ + virtual void declareMotherVolume(const std::string& detector_name, const Volume& vol) = 0; - /// Handle class describing a detector element - /** - * Detector elements (class DetElement are entities which represent - * subdetectors or sizable parts of a subdetector. - * A DetElement instance has the means to provide to clients information about - * - * - the detector hierarchy by exposing its children. - * - its placement within the overall experiment if it represents an - * entire subdetector or its placement with respect to its parent - * if the \em DetElement represents a part of a subdetector. - * - information about the \em Readout structure if the object is - * instrumented and read-out. Otherwise this link is empty. - * - information about the environmental conditions etc. \em conditons. - * The access to conditions is exposed via the DetConditions interface. - * See DD4hep/DetConditions.h for further details. - * - alignment information. - * . - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY + /// Access mother volume by detector element + /** The method uses the detector element's name for volume identification. + * Unregistered detectors are hosted by the world volume. */ - class DetElement: public Handle<DetElementObject> { - public: - /// Abstract base for processing callbacks to DetElement objects - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Processor { - public: - /// Default constructor - Processor(); - /// Default destructor - virtual ~Processor(); - /// Container callback for object processing - virtual int processElement(DetElement detector) = 0; - }; - - /// Definition of the base handle type - typedef Handle<DetElementObject> RefObject; - typedef DetElement Parent; - typedef Alignments::Alignment Alignment; - - /// Extensions copy constructor type - typedef void* (*copy_t)(const void*, DetElement); - /// Extensions destructor type - typedef void (*destruct_t)(void*); - - typedef std::map<std::string, DetElement> Children; - typedef std::map<const std::type_info*, void*> Extensions; - - enum CopyParameters { - COPY_NONE = 0, COPY_PLACEMENT = 1 << 0, COPY_PARENT = 1 << 1, COPY_ALIGNMENT = 1 << 2, LAST - }; - - enum UpdateParam { - CONDITIONS_CHANGED = 1<<0, - PLACEMENT_CHANGED = 1<<1, - SOMETHING_CHANGED = 1<<2, - PLACEMENT_ELEMENT = 1<<20, - PLACEMENT_HIGHEST = 1<<21, - PLACEMENT_DETECTOR = 1<<22, - PLACEMENT_NONE - }; - - /// Internal assert function to check conditions - void check(bool condition, const std::string& msg) const; - - protected: - - /// Templated destructor function - template <typename T> static void _delete(void* ptr) { - delete (T*) (ptr); - } - /// Templated copy constructor - template <typename T> static void* _copy(const void* ptr, DetElement elt) { - return new T(*(dynamic_cast<const T*>((T*) ptr)), elt); - } - - /// Add an extension object to the detector element - void* i_addExtension(void* ptr, const std::type_info& info, copy_t ctor, destruct_t dtor) const; - /// Access an existing extension object from the detector element - void* i_extension(const std::type_info& info) const; - /// Internal call to extend the detector element with an arbitrary structure accessible by the type - void i_addUpdateCall(unsigned int callback_type, const Callback& callback) const; - - public: - - /// Default constructor - DetElement() : RefObject() { } - - /// Constructor to hold handled object - DetElement(Object* object_ptr) : RefObject(object_ptr) { } - - /// Clone constructor - DetElement(Object* data, const std::string& name, const std::string& type); - - /// Templated constructor for handle conversions - template <typename Q> DetElement(const Handle<Q>& e) : RefObject(e) {} - - /// Constructor to copy handle - DetElement(const DetElement& e) = default; - -#ifdef __MAKECINT__ - /// Constructor to copy handle - DetElement(const Ref_t& e) - : RefObject(e) { - } + virtual Volume pickMotherVolume(const DetElement& sd) const = 0; + + /// Typed access to constants: access string values + virtual std::string constantAsString(const std::string& name) const = 0; + /// Typed access to constants: long values + virtual long constantAsLong(const std::string& name) const = 0; + /// Typed access to constants: double values + virtual double constantAsDouble(const std::string& name) const = 0; + + /// Retrieve a constant by it's name from the detector description + virtual Constant constant(const std::string& name) const = 0; + /// Typed access to constants: access any type values + template <class T> T constant(const std::string& name) const; + + /// Retrieve a matrial by it's name from the detector description + virtual Material material(const std::string& name) const = 0; + /// Retrieve a id descriptor by it's name from the detector description + virtual IDDescriptor idSpecification(const std::string& name) const = 0; + /// Retrieve a region object by it's name from the detector description + virtual Region region(const std::string& name) const = 0; + /// Retrieve a visualization attribute by it's name from the detector description + virtual VisAttr visAttributes(const std::string& name) const = 0; + /// Retrieve a limitset by it's name from the detector description + virtual LimitSet limitSet(const std::string& name) const = 0; + /// Retrieve a readout object by it's name from the detector description + virtual Readout readout(const std::string& name) const = 0; + /// Retrieve a sensitive detector by it's name from the detector description + virtual SensitiveDetector sensitiveDetector(const std::string& name) const = 0; + /// Retrieve a subdetector element by it's name from the detector description + virtual CartesianField field(const std::string& name) const = 0; + /// Retrieve a field component by it's name from the detector description + virtual DetElement detector(const std::string& name) const = 0; + + /// Add a new constant to the detector description + virtual Detector& add(Constant constant) = 0; + /// Add a new visualisation attribute to the detector description + virtual Detector& add(VisAttr attr) = 0; + /// Add a new limit set to the detector description + virtual Detector& add(LimitSet limitset) = 0; + /// Add a new detector region to the detector description + virtual Detector& add(Region region) = 0; + /// Add a new id descriptor to the detector description + virtual Detector& add(IDDescriptor spec) = 0; + /// Add a new detector readout to the detector description + virtual Detector& add(Readout readout) = 0; + /// Add a new sensitive detector to the detector description + virtual Detector& add(SensitiveDetector entry) = 0; + /// Add a new subdetector to the detector description + virtual Detector& add(DetElement detector) = 0; + /// Add a field component to the detector description + virtual Detector& add(CartesianField entry) = 0; + + /// Add a new constant by named reference to the detector description + virtual Detector& addConstant(const Ref_t& element) = 0; + /// Add a new visualisation attribute by named reference to the detector description + virtual Detector& addVisAttribute(const Ref_t& element) = 0; + /// Add a new limit set by named reference to the detector description + virtual Detector& addLimitSet(const Ref_t& limset) = 0; + /// Add a new id descriptor by named reference to the detector description + virtual Detector& addIDSpecification(const Ref_t& element) = 0; + /// Add a new detector region by named reference to the detector description + virtual Detector& addRegion(const Ref_t& region) = 0; + /// Add a new detector readout by named reference to the detector description + virtual Detector& addReadout(const Ref_t& readout) = 0; + /// Add a new sensitive detector by named reference to the detector description + virtual Detector& addSensitiveDetector(const Ref_t& element) = 0; + /// Add a new subdetector by named reference to the detector description + virtual Detector& addDetector(const Ref_t& detector) = 0; + /// Add a field component by named reference to the detector description + virtual Detector& addField(const Ref_t& field) = 0; + + /// Deprecated call (use fromXML): Read compact geometry description or alignment file + virtual void fromCompact(const std::string& fname, DetectorBuildType type = BUILD_DEFAULT) = 0; + /// Read any geometry description or alignment file + virtual void fromXML(const std::string& fname, DetectorBuildType type = BUILD_DEFAULT) = 0; + /// Read any geometry description or alignment file with external XML entity resolution + virtual void fromXML(const std::string& fname, + xml::UriReader* entity_resolver, + DetectorBuildType type = BUILD_DEFAULT) = 0; + + /// Stupid legacy method + virtual void dump() const = 0; + /// Manipulate geometry using factory converter + virtual long apply(const char* factory, int argc, char** argv) = 0; + + /// Extend the sensitive detector element with an arbitrary structure accessible by the type + template <typename IFACE, typename CONCRETE> IFACE* addExtension(CONCRETE* c) { + return (IFACE*) addUserExtension(dynamic_cast<IFACE*>(c), typeid(IFACE), _delete<IFACE>); + } + + /// Remove an existing extension object from the Detector instance. If not destroyed, the instance is returned + template <class T> T* removeExtension(bool destroy=true) { + return (T*) removeUserExtension(typeid(T),destroy); + } + + /// Access extension element by the type + template <class T> T* extension(bool alert=true) const { + return (T*) userExtension(typeid(T),alert); + } + + ///---Factory method------- + static Detector& getInstance(void); + /// Destroy the instance + static void destroyInstance(); + + protected: + /// Templated destructor function + template <typename T> static void _delete(void* ptr) { + delete (T*) (ptr); + } + /// Add an extension object to the detector element + virtual void* addUserExtension(void* ptr, const std::type_info& info, void (*destruct)(void*)) = 0; + /// Remove an existing extension object from the Detector instance. If not destroyed, the instance is returned + virtual void* removeUserExtension(const std::type_info& info, bool destroy) = 0; + /// Access an existing extension object from the detector element + virtual void* userExtension(const std::type_info& info, bool alert=true) const = 0; + + }; + + /* + * The following are convenience implementations to access constants by type. + * I do not think this violates the interface approach, but it is so much + * more intuitiv to say constant<int>(name) than constantAsInt(name). + */ +#ifndef __CINT__ + /// Typed access to constants: short values + template <> inline short Detector::constant<short>(const std::string& name) const { + return (short) constantAsLong(name); + } + + /// Typed access to constants: unsigned short values + template <> inline unsigned short Detector::constant<unsigned short>(const std::string& name) const { + return (unsigned short) constantAsLong(name); + } + + /// Typed access to constants: integer values + template <> inline int Detector::constant<int>(const std::string& name) const { + return (int) constantAsLong(name); + } + + /// Typed access to constants: unsigned integer values + template <> inline unsigned int Detector::constant<unsigned int>(const std::string& name) const { + return (unsigned int) constantAsLong(name); + } + + /// Typed access to constants: long values + template <> inline long Detector::constant<long>(const std::string& name) const { + return constantAsLong(name); + } + + /// Typed access to constants: unsigned long values + template <> inline unsigned long Detector::constant<unsigned long>(const std::string& name) const { + return (unsigned long) constantAsLong(name); + } + + /// Typed access to constants: float values + template <> inline float Detector::constant<float>(const std::string& name) const { + return (float) constantAsDouble(name); + } + + /// Typed access to constants: double values + template <> inline double Detector::constant<double>(const std::string& name) const { + return constantAsDouble(name); + } + + /// Typed access to constants: string values + template <> inline std::string Detector::constant<std::string>(const std::string& name) const { + return constantAsString(name); + } #endif - /// Constructor for a new subdetector element - DetElement(const std::string& name, const std::string& type, int id); - - /// Constructor for a new subdetector element - DetElement(const std::string& name, int id); - - /// Constructor for a new subdetector element - DetElement(DetElement parent, const std::string& name, int id); - - /// Additional data accessor - Object& _data() const { - return object<Object>(); - } - - /// Operator less to insert into a map - bool operator <(const DetElement e) const { - return ptr() < e.ptr(); - } - - /// Equality operator - bool operator ==(const DetElement e) const { - return ptr() == e.ptr(); - } - - /// Assignment operator - DetElement& operator=(const DetElement& e) = default; - - /// Clone (Deep copy) the DetElement structure with a new name - DetElement clone(const std::string& new_name) const; - - /// Clone (Deep copy) the DetElement structure with a new name and new identifier - DetElement clone(const std::string& new_name, int new_id) const; - - /// Extend the detector element with an arbitrary structure accessible by the type - template <typename IFACE, typename CONCRETE> IFACE* addExtension(CONCRETE* c) const { - CallbackSequence::checkTypes(typeid(IFACE), typeid(CONCRETE), dynamic_cast<IFACE*>(c)); - return (IFACE*) i_addExtension(dynamic_cast<IFACE*>(c), typeid(IFACE), _copy<CONCRETE>, _delete<IFACE>); - } - /// Access extension element by the type - template <typename IFACE> IFACE* extension() const { - return (IFACE*) i_extension(typeid(IFACE)); - } - /// Extend the detector element with an arbitrary callback - template <typename Q, typename T> - void callAtUpdate(unsigned int typ, Q* pointer, - void (T::*pmf)(unsigned long typ, DetElement& det, void* opt_par)) const - { - CallbackSequence::checkTypes(typeid(T), typeid(Q), dynamic_cast<T*>(pointer)); - i_addUpdateCall(typ, Callback(pointer).make(pmf)); - } - /// Remove callback from object - void removeAtUpdate(unsigned int type, void* pointer) const; - - /// Get the detector identifier - int id() const; - /// Setter: Combine hits attribute - DetElement& setCombineHits(bool value, SensitiveDetector& sens); - /// Getter: Combine hits attribute - bool combineHits() const; - - /** Access detector type (structure, tracker, calorimeter, etc.). - * Required for determination of G4 sensitive detector. - */ - std::string type() const; - /// Set detector type (structure, tracker, calorimeter, etc.). - DetElement& setType(const std::string& typ); - - // Return flag word encoding detector types ( ideally use DD4hep::DetType for decoding ) - unsigned int typeFlag() const; - - /// Set the flag word encoding detector types ( ideally use DD4hep::DetType for encoding ) - DetElement& setTypeFlag(unsigned int types); - - /// Access hash key of this detector element (Only valid once geometry is closed!) - unsigned int key() const; - /// Access the hierarchical level of the detector element (Only valid once geometry is closed!) - int level() const; - /// Path of the detector element (not necessarily identical to placement path!) - const std::string& path() const; - /// Access to the full path to the placed object - const std::string& placementPath() const; - - /// Set all attributes in one go - DetElement& setAttributes(const LCDD& lcdd, const Volume& volume, const std::string& region, const std::string& limits, - const std::string& vis); - - /// Set Visualization attributes to the detector element - DetElement& setVisAttributes(const LCDD& lcdd, const std::string& name, const Volume& volume); - /// Set the regional attributes to the detector element - DetElement& setRegion(const LCDD& lcdd, const std::string& name, const Volume& volume); - /// Set the limits to the detector element - DetElement& setLimitSet(const LCDD& lcdd, const std::string& name, const Volume& volume); - - /// Access to the logical volume of the detector element's placement - Volume volume() const; - - /// Access to the physical volume of this detector element - /** This is the current placement value of the detector eleemnt. - * A possible global re-alignment may alter the value. - * Hence, it should hence not be cached. - */ - PlacedVolume placement() const; - /// Access to the ideal physical volume of this detector element - /** This is the original placement set in the detector constructor. - * A possible global re-alignment make this value different - * from the regular placement() call. - */ - PlacedVolume idealPlacement() const; - /// Set the physical volumes of the detector element - DetElement& setPlacement(const PlacedVolume& volume); - /// The cached VolumeID of this subdetector element - VolumeID volumeID() const; - - /// Add new child to the detector structure - DetElement& add(DetElement sub_element); - /// Access to the list of children - const Children& children() const; - /// Access to individual children by name - DetElement child(const std::string& name) const; - /// Access to the detector elements's parent - DetElement parent() const; - /// Access to the world object. Only possible once the geometry is closed. - DetElement world() const; - - /// Access to the constant ideal (nominal) alignment information - Alignment nominal() const; - /// Access to the constant survey alignment information - Alignment survey() const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ - -#include "DD4hep/AlignmentData.h" - -#endif /* DD4HEP_DETECTOR_H */ +} /* End namespace dd4hep */ +#endif /* DD4HEP_Detector_Detector_H */ diff --git a/DDCore/include/DD4hep/DetectorData.h b/DDCore/include/DD4hep/DetectorData.h new file mode 100644 index 000000000..e8cd8d95d --- /dev/null +++ b/DDCore/include/DD4hep/DetectorData.h @@ -0,0 +1,141 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +#ifndef DD4HEP_DDCORE_DetectorDATA_H +#define DD4HEP_DDCORE_DetectorDATA_H + +// Framework includes +#include "DD4hep/Detector.h" +#include "DD4hep/ObjectExtensions.h" +#include "DD4hep/detail/VolumeManagerInterna.h" + +// C/C++ include files +#include <stdexcept> + +/// Namespace for the AIDA detector description toolkit +namespace dd4hep { + + // Foward declarations + class NamedObject; + + /// Data implementation class of the Detector interface + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class DetectorData { + + public: + /// Specialized exception class + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + struct InvalidObjectError: public std::runtime_error { + InvalidObjectError(const std::string& msg) + : std::runtime_error("dd4hep: " + msg) { + } + }; + + /// Implementation of a map of named dd4hep Handles + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class ObjectHandleMap: public Detector::HandleMap { + public: + /// Default constructor + ObjectHandleMap() { + } + void append(const Ref_t& e, bool throw_on_doubles = true) { + if (e.isValid()) { + std::string n = e.name(); + std::pair<iterator, bool> r = this->insert(std::make_pair(n, e.ptr())); + if (!throw_on_doubles || r.second) + return; + throw InvalidObjectError("Attempt to add an already existing object:" + std::string(e.name()) + "."); + } + throw InvalidObjectError("Attempt to add an invalid object."); + } + + template <typename T> void append(const Ref_t& e, bool throw_on_doubles = true) { + T* obj = dynamic_cast<T*>(e.ptr()); + if (obj) { + this->append(e, throw_on_doubles); + return; + } + throw InvalidObjectError("Attempt to add an object, which is of the wrong type."); + } + }; + + protected: + TGeoManager* m_manager; + ObjectHandleMap m_readouts; + ObjectHandleMap m_idDict; + ObjectHandleMap m_limits; + ObjectHandleMap m_regions; + ObjectHandleMap m_detectors; + + ObjectHandleMap m_sensitive; + ObjectHandleMap m_display; + ObjectHandleMap m_fields; + + ObjectHandleMap m_motherVolumes; + + // GDML fields + ObjectHandleMap m_define; + + DetElement m_world; + DetElement m_trackers; + Volume m_worldVol; + Volume m_trackingVol; + + Material m_materialAir; + Material m_materialVacuum; + VisAttr m_invisibleVis; + OverlayedField m_field; + Header m_header; + Detector::Properties m_properties; + DetectorBuildType m_buildType; + + /// Definition of the extension type + ObjectExtensions m_extensions; + /// Volume manager reference + VolumeManager m_volManager; + + /// Flag to inhibit the access to global constants. Value set by constants section 'Detector_InhibitConstants' + bool m_inhibitConstants; + + protected: + /// Default constructor + DetectorData(); + /// Default destructor + virtual ~DetectorData(); + /// Copy constructor + DetectorData(const DetectorData& copy) = delete; + /// Assignment operator + //DetectorData& operator=(const DetectorData& copy) = delete; + public: + /// Clear data content: releases all allocated resources + void destroyData(bool destroy_mgr=true); + /// Clear data content: DOES NOT RELEASEW ALLOCATED RESOURCES! + void clearData(); + /// Adopt all data from source structure. + void adoptData(DetectorData& source); + }; + +} /* End namespace dd4hep */ +#endif /* DD4HEP_DDCORE_DetectorDATA_H */ diff --git a/DDCore/include/DD4hep/DetectorHelper.h b/DDCore/include/DD4hep/DetectorHelper.h new file mode 100644 index 000000000..f4983843f --- /dev/null +++ b/DDCore/include/DD4hep/DetectorHelper.h @@ -0,0 +1,56 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +#ifndef DD4HEP_DetectorHELPER_H +#define DD4HEP_DetectorHELPER_H +#include "DD4hep/Detector.h" + +/// Namespace for the AIDA detector description toolkit +namespace dd4hep { + + /// DetectorHelper: class to shortcut certain questions to the dd4hep detector description interface + /** + * + * Note: This class may be extended with additional useful (generic) functionality, + * which requires the use of the main Detector object. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class DetectorHelper : public Handle<Detector> { + public: + /// Default constructor + DetectorHelper() = default; + /// Copy constructor + DetectorHelper(const DetectorHelper& h) = default; + /// Initializing constructor from pointer + DetectorHelper(Detector* description_ptr) : Handle<Detector>(description_ptr) {} + /// Initializing constructor from pointer + DetectorHelper(Detector& description_ref) : Handle<Detector>(&description_ref) {} + /// Copy constructor + DetectorHelper(const Handle<Detector>& h) : Handle<Detector>(h) {} + /// Default destructor + ~DetectorHelper() = default; + /// Assignment operator + DetectorHelper& operator=(const DetectorHelper& c) = default; + /// Access the sensitive detector of a given subdetector (if the sub-detector is sensitive!) + SensitiveDetector sensitiveDetector(const std::string& detector) const; + /// Given a detector element, access it's sensitive detector (if the sub-detector is sensitive!) + SensitiveDetector sensitiveDetector(DetElement detector) const; + /// Find a detector element by it's system ID + DetElement detectorByID(int id) const; + }; + +} /* End namespace dd4hep */ +#endif /* DD4HEP_DetectorHELPER_H */ diff --git a/DDCore/include/DD4hep/LCDDLoad.h b/DDCore/include/DD4hep/DetectorLoad.h similarity index 55% rename from DDCore/include/DD4hep/LCDDLoad.h rename to DDCore/include/DD4hep/DetectorLoad.h index 56faed602..daf83357a 100644 --- a/DDCore/include/DD4hep/LCDDLoad.h +++ b/DDCore/include/DD4hep/DetectorLoad.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,58 +10,54 @@ // Author : M.Frank // //========================================================================== -#ifndef DD4HEP_DDCORE_LCDDLOAD_H -#define DD4HEP_DDCORE_LCDDLOAD_H +#ifndef DD4HEP_DDCORE_DetectorLOAD_H +#define DD4HEP_DDCORE_DetectorLOAD_H // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // C/C++ include files #include <stdexcept> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { class Handle_t; class UriReader; } - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - class LCDD; - } + class Detector; - /// Data implementation class of the LCDD interface - /** @class LCDDLoad LCDDLoad.h DD4hep/LCDDLoad.h + /// Data implementation class of the Detector interface + /** @class DetectorLoad DetectorLoad.h dd4hep/DetectorLoad.h * * @author M.Frank * @version 1.0 */ - class LCDDLoad { + class DetectorLoad { public: - friend class Geometry::LCDD; + friend class Detector; protected: - /// Reference to the LCDD instance - Geometry::LCDD* m_lcdd; + /// Reference to the Detector instance + Detector* m_detDesc; /// Default constructor - LCDDLoad(Geometry::LCDD* lcdd); + DetectorLoad(Detector* description); /// Default destructor - virtual ~LCDDLoad(); + virtual ~DetectorLoad(); public: /// Process XML unit and adopt all data from source structure. - virtual void processXML(const std::string& fname, XML::UriReader* entity_resolver=0); + virtual void processXML(const std::string& fname, xml::UriReader* entity_resolver=0); /// Process XML unit and adopt all data from source structure. - virtual void processXML(const XML::Handle_t& base, const std::string& fname, XML::UriReader* entity_resolver=0); + virtual void processXML(const xml::Handle_t& base, const std::string& fname, xml::UriReader* entity_resolver=0); /// Process a given DOM (sub-) tree - virtual void processXMLElement(const std::string& msg_source, const XML::Handle_t& root); + virtual void processXMLElement(const std::string& msg_source, const xml::Handle_t& root); /// Process a given DOM (sub-) tree - virtual void processXMLElement(const XML::Handle_t& root, LCDDBuildType type); - + virtual void processXMLElement(const xml::Handle_t& root, DetectorBuildType type); }; -} /* End namespace DD4hep */ -#endif /* DD4HEP_DDCORE_LCDDLOAD_H */ +} /* End namespace dd4hep */ +#endif /* DD4HEP_DDCORE_DetectorLOAD_H */ diff --git a/DDCore/include/DD4hep/DetectorProcessor.h b/DDCore/include/DD4hep/DetectorProcessor.h index 7712d2eac..f842623b6 100644 --- a/DDCore/include/DD4hep/DetectorProcessor.h +++ b/DDCore/include/DD4hep/DetectorProcessor.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,159 +14,154 @@ #define DD4HEP_DDCORE_DETECTORPROCESSOR_H // Framework includes -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" // C/C++ include files #include <memory> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace Geometry { + /// Generic Detector processor + /** + * Please note that the principle of locality applies: + * The object is designed for stack allocation and configuration. + * It may NOT be shared across threads! + * + * \author M.Frank + * \version 1.0 + * \date 31/05/2017 + * \ingroup DD4HEP_GEOMETRY + */ + class DetectorProcessor { + public: + /// Initializing constructor + DetectorProcessor() = default; + /// R-value copy from a temporary (Since processor is reference) + DetectorProcessor(DetectorProcessor&& copy) = default; + /// Default copy constructor + DetectorProcessor(const DetectorProcessor& copy) = default; + /// Default destructor + virtual ~DetectorProcessor(); + /// Default assignment + DetectorProcessor& operator=(const DetectorProcessor& copy) = default; + /// Callback to output detector information of an single DetElement + virtual int operator()(DetElement de, int level) const = 0; + /// Callback to output detector information of an entire DetElement + virtual int process(DetElement de, int level, bool recursive) const; + }; - /// Generic Detector processor - /** - * Please note that the principle of locality applies: - * The object is designed for stack allocation and configuration. - * It may NOT be shared across threads! - * - * \author M.Frank - * \version 1.0 - * \date 31/05/2017 - * \ingroup DD4HEP_GEOMETRY - */ - class DetectorProcessor { - public: - /// Initializing constructor - DetectorProcessor() = default; - /// R-value copy from a temporary (Since processor is reference) - DetectorProcessor(DetectorProcessor&& copy) = default; - /// Default copy constructor - DetectorProcessor(const DetectorProcessor& copy) = default; - /// Default destructor - virtual ~DetectorProcessor(); - /// Default assignment - DetectorProcessor& operator=(const DetectorProcessor& copy) = default; - /// Callback to output detector information of an single DetElement - virtual int operator()(DetElement de, int level) const = 0; - /// Callback to output detector information of an entire DetElement - virtual int process(DetElement de, int level, bool recursive) const; - }; + /// Detector scanner using a Processor object + /** + * Please see the documentation of the + * DetectorProcessor base class for further information. + * + * \author M.Frank + * \version 1.0 + * \date 31/05/2017 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class DetElementProcessor : virtual public DetectorProcessor { + public: + /// Reference to execution object implementing operator()(DetElement de, int level) + T& processor; + public: + /// Default constructor + DetElementProcessor() = delete; + /// Default constructor + DetElementProcessor(T& p) : processor(p) {} + /// Default move constructor is disabled + DetElementProcessor(T&& p) = delete; + /// R-value copy from a temporary (Since processor is reference) + DetElementProcessor(DetElementProcessor&& copy) = default; + /// Default copy constructor + DetElementProcessor(const DetElementProcessor& copy) = default; + /// Default destructor + virtual ~DetElementProcessor() = default; + /// Default assignment + DetElementProcessor& operator=(const DetElementProcessor& copy) = default; + /// Callback to output detector information of an single DetElement + virtual int operator()(DetElement de, int level) const final + { return (processor)(de, level); } + }; - /// Detector scanner using a Processor object - /** - * Please see the documentation of the - * DetectorProcessor base class for further information. - * - * \author M.Frank - * \version 1.0 - * \date 31/05/2017 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class DetElementProcessor : virtual public DetectorProcessor { - public: - /// Reference to execution object implementing operator()(DetElement de, int level) - T& processor; - public: - /// Default constructor - DetElementProcessor() = delete; - /// Default constructor - DetElementProcessor(T& p) : processor(p) {} - /// Default move constructor is disabled - DetElementProcessor(T&& p) = delete; - /// R-value copy from a temporary (Since processor is reference) - DetElementProcessor(DetElementProcessor&& copy) = default; - /// Default copy constructor - DetElementProcessor(const DetElementProcessor& copy) = default; - /// Default destructor - virtual ~DetElementProcessor() = default; - /// Default assignment - DetElementProcessor& operator=(const DetElementProcessor& copy) = default; - /// Callback to output detector information of an single DetElement - virtual int operator()(DetElement de, int level) const final - { return (processor)(de, level); } - }; + /// Instantiation helper + template <typename T> inline + DetElementProcessor<typename std::remove_reference<T>::type> detectorProcessor(T&& proc) + { return DetElementProcessor<typename std::remove_reference<T>::type>(std::forward<T>(proc)); } - /// Instantiation helper - template <typename T> inline - DetElementProcessor<typename std::remove_reference<T>::type> detectorProcessor(T&& proc) - { return DetElementProcessor<typename std::remove_reference<T>::type>(std::forward<T>(proc)); } + /// Wrapper to call objects in the form of a detector element processor. + /** + * \author M.Frank + * \version 1.0 + * \date 31/05/2017 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class DetectorProcessorShared : public DetectorProcessor { + public: + /// Reference to execution object implementing operator()(DetElement de, int level) + std::shared_ptr<T> processor; + public: + /// Default constructor + DetectorProcessorShared() = delete; + /// Default constructor + DetectorProcessorShared(std::shared_ptr<T>& p) : processor(p) {} + /// Default copy constructor + DetectorProcessorShared(const DetectorProcessorShared& copy) = default; + /// Default destructor + virtual ~DetectorProcessorShared() = default; + /// Default assignment + DetectorProcessorShared& operator=(const DetectorProcessorShared& copy) = default; + /// Callback to output detector information of an single DetElement + virtual int operator()(DetElement de, int level) const final + { return (*processor)(de, level); } + }; - /// Wrapper to call objects in the form of a detector element processor. - /** - * \author M.Frank - * \version 1.0 - * \date 31/05/2017 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class DetectorProcessorShared : public DetectorProcessor { - public: - /// Reference to execution object implementing operator()(DetElement de, int level) - std::shared_ptr<T> processor; - public: - /// Default constructor - DetectorProcessorShared() = delete; - /// Default constructor - DetectorProcessorShared(std::shared_ptr<T>& p) : processor(p) {} - /// Default copy constructor - DetectorProcessorShared(const DetectorProcessorShared& copy) = default; - /// Default destructor - virtual ~DetectorProcessorShared() = default; - /// Default assignment - DetectorProcessorShared& operator=(const DetectorProcessorShared& copy) = default; - /// Callback to output detector information of an single DetElement - virtual int operator()(DetElement de, int level) const final - { return (*processor)(de, level); } - }; + /// Helper to run DetElement scans + /** + * This wrapper converts any object, which has the signature + * int operator()(DetElement de, int level) const + * The object is automatically wrapped to a DetectorProcessor + * and the detector tree is scanned depending on the scanning + * arguments. + * + * \author M.Frank + * \version 1.0 + * \date 01/04/2016 + * \ingroup DD4HEP_GEOMETRY + */ + class DetectorScanner { + public: + /// Default constructor + DetectorScanner() = default; + /// Copy constructor + DetectorScanner(const DetectorScanner& copy) = default; + /// Assignment operator + DetectorScanner& operator=(const DetectorScanner& copy) = default; - /// Helper to run DetElement scans - /** - * This wrapper converts any object, which has the signature - * int operator()(DetElement de, int level) const - * The object is automatically wrapped to a DetectorProcessor - * and the detector tree is scanned depending on the scanning - * arguments. - * - * \author M.Frank - * \version 1.0 - * \date 01/04/2016 - * \ingroup DD4HEP_GEOMETRY - */ - class DetectorScanner { - public: - /// Default constructor - DetectorScanner() = default; - /// Copy constructor - DetectorScanner(const DetectorScanner& copy) = default; - /// Assignment operator - DetectorScanner& operator=(const DetectorScanner& copy) = default; + /// Constructor performing the scan internally + template <typename Q> + DetectorScanner(Q& proc, DetElement start, int level=0, bool recursive=true) + { scan(proc, start, level, recursive); } - /// Constructor performing the scan internally - template <typename Q> - DetectorScanner(Q& proc, DetElement start, int level=0, bool recursive=true) - { scan(proc, start, level, recursive); } + /// Constructor performing the scan internally + template <typename Q> + DetectorScanner(const Q& proc, DetElement start, int level=0, bool recursive=true) + { scan(proc, start, level, recursive); } - /// Constructor performing the scan internally - template <typename Q> - DetectorScanner(const Q& proc, DetElement start, int level=0, bool recursive=true) - { scan(proc, start, level, recursive); } + /// Detector element tree scanner using wrapped DetectorProcessor objects + template <typename Q> + int scan(Q& p, DetElement start, int level=0, bool recursive=true) const { + auto proc = detectorProcessor(p); + return proc.process(start, level, recursive); + } - /// Detector element tree scanner using wrapped DetectorProcessor objects - template <typename Q> - int scan(Q& p, DetElement start, int level=0, bool recursive=true) const { - auto proc = detectorProcessor(p); - return proc.process(start, level, recursive); - } - - /// Detector element tree scanner using wrapped DetectorProcessor objects - template <typename Q> - int scan(const Q& p, DetElement start, int level=0, bool recursive=true) const { - auto proc = detectorProcessor(p); - return proc.process(start, level, recursive); - } - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + /// Detector element tree scanner using wrapped DetectorProcessor objects + template <typename Q> + int scan(const Q& p, DetElement start, int level=0, bool recursive=true) const { + auto proc = detectorProcessor(p); + return proc.process(start, level, recursive); + } + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_DETECTORPROCESSOR_H */ diff --git a/DDCore/include/DD4hep/DetectorSelector.h b/DDCore/include/DD4hep/DetectorSelector.h index 221838f04..c89c59905 100644 --- a/DDCore/include/DD4hep/DetectorSelector.h +++ b/DDCore/include/DD4hep/DetectorSelector.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,74 +15,68 @@ #define DD4HEP_DETECTORSELECTOR_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - - /// View on LCDD to select detectors according to certain criteria - /** - * Usage: - * - * LCDD& lcd = ....; - * DetectorSelector selector(lcdd); - * DetectorSelector::Result r = selector.detectors("tracker"); - * - * or multiple types: - * r = selector.detectors("tracker", "calorimeter"); - * - * or selections using DetType flags, e.g: - * select all barrel trackers but not the Vertex detector - * r = selector.detectors( DetType::TRACKER | DetType::BARREL , DetType::VERTEX ) ; - * - * \author M.Frank - * \version 1.0 - */ - class DetectorSelector { - public: - /// Result set definition - typedef std::vector<DetElement> Result; + /// View on Detector to select detectors according to certain criteria + /** + * Usage: + * + * Detector& lcd = ....; + * DetectorSelector selector(description); + * DetectorSelector::Result r = selector.detectors("tracker"); + * + * or multiple types: + * r = selector.detectors("tracker", "calorimeter"); + * + * or selections using DetType flags, e.g: + * select all barrel trackers but not the Vertex detector + * r = selector.detectors( DetType::TRACKER | DetType::BARREL , DetType::VERTEX ) ; + * + * \author M.Frank + * \version 1.0 + */ + class DetectorSelector { + public: + /// Result set definition + typedef std::vector<DetElement> Result; #ifndef __CINT__ - /// Reference to main detector description object - LCDD& lcdd; + /// Reference to main detector description object + Detector& description; #endif - public: + public: #ifndef __CINT__ - /// Default constructor - DetectorSelector(LCDD& _lcdd) : lcdd(_lcdd) {} + /// Default constructor + DetectorSelector(Detector& _description) : description(_description) {} #endif - /// Default destructor - ~DetectorSelector() {} + /// Default destructor + ~DetectorSelector() {} - /// Access a set of subdetectors according to the sensitive type. - /** - Please note: - - The sensitive type of a detector is set in the 'detector constructor'. - - Not sensitive detector structures have the name 'passive' - - Compounds (ie. nested detectors) are of type 'compound' - */ - const Result& detectors(const std::string& type); + /// Access a set of subdetectors according to the sensitive type. + /** + Please note: + - The sensitive type of a detector is set in the 'detector constructor'. + - Not sensitive detector structures have the name 'passive' + - Compounds (ie. nested detectors) are of type 'compound' + */ + const Result& detectors(const std::string& type); - /// Access a set of subdetectors according to several sensitive types. - Result detectors(const std::string& type1, - const std::string& type2, - const std::string& type3="", - const std::string& type4="", - const std::string& type5="" ); + /// Access a set of subdetectors according to several sensitive types. + Result detectors(const std::string& type1, + const std::string& type2, + const std::string& type3="", + const std::string& type4="", + const std::string& type5="" ); - /** return a vector with all detectors that have all the type properties in - * includeFlag set but none of the properties given in excludeFlag - */ - Result detectors(unsigned int includeFlag, - unsigned int excludeFlag=0 ) const ; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + /** return a vector with all detectors that have all the type properties in + * includeFlag set but none of the properties given in excludeFlag + */ + Result detectors(unsigned int includeFlag, + unsigned int excludeFlag=0 ) const ; + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_DETECTORSELECTOR_H */ diff --git a/DDCore/include/DD4hep/DetectorTools.h b/DDCore/include/DD4hep/DetectorTools.h index dedc87ffb..1a1a74100 100644 --- a/DDCore/include/DD4hep/DetectorTools.h +++ b/DDCore/include/DD4hep/DetectorTools.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,25 +10,23 @@ // Author : M.Frank // //========================================================================== - #ifndef DD4HEP_GEOMETRY_DETECTORTOOLS_H #define DD4HEP_GEOMETRY_DETECTORTOOLS_H // Framework include files -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" // Forward declarations class TGeoHMatrix; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { +namespace dd4hep { - // Forward declarations - class LCDD; + // Forward declarations + class Detector; + namespace detail { + /// Helper namespace used to answer detector element specific questons /** * @@ -36,7 +34,7 @@ namespace DD4hep { * \version 1.0 * \ingroup DD4HEP_GEOMETRY */ - namespace DetectorTools { + namespace tools { typedef std::vector<DetElement> ElementPath; typedef std::vector<PlacedVolume> PlacementPath; @@ -51,7 +49,7 @@ namespace DD4hep { /// Collect detector elements to the top detector element (world) void elementPath(DetElement elt, ElementPath& detectors); /// Find DetElement as child of the top level volume by it's absolute path - DetElement findElement(LCDD& lcdd, const std::string& path); + DetElement findElement(Detector& description, const std::string& path); /// Find DetElement as child of a parent by it's relative or absolute path DetElement findDaughterElement(DetElement parent, const std::string& subpath); /// Find path between the child element and the parent element @@ -81,9 +79,7 @@ namespace DD4hep { std::string toString(const PlacedVolume::VolIDs& ids); /// Convert VolumeID to string std::string toString(const IDDescriptor& dsc, const PlacedVolume::VolIDs& ids, VolumeID code); - } - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_DETECTORTOOLS_H */ diff --git a/DDCore/include/DD4hep/Dictionary.h b/DDCore/include/DD4hep/Dictionary.h index 4f3f08110..10e2c28d1 100644 --- a/DDCore/include/DD4hep/Dictionary.h +++ b/DDCore/include/DD4hep/Dictionary.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -37,7 +37,7 @@ #include "DD4hep/World.h" #include "DD4hep/DD4hepUI.h" #include "DD4hep/Callback.h" -#include "DD4hep/LCDDData.h" +#include "DD4hep/DetectorData.h" #include "DD4hep/Conditions.h" #include "DD4hep/FieldTypes.h" @@ -46,10 +46,13 @@ #include <map> #include <string> -typedef DD4hep::Geometry::PlacedVolumeExtension::VolID VolID; +typedef dd4hep::PlacedVolumeExtension::VolID VolID; #include "TRint.h" -namespace DD4hep { +namespace dd4hep { + namespace cond {} + namespace align {} + namespace detail {} void run_interpreter(const std::string& name) { pair<int, char**> a(0,0); TRint app(name.c_str(), &a.first, a.second); @@ -60,7 +63,7 @@ namespace DD4hep { } // ------------------------------------------------------------------------- -// Regular DD4hep dictionaries +// Regular dd4hep dictionaries // ------------------------------------------------------------------------- #if defined(__CINT__) || defined(__MAKECINT__) || defined(__CLING__) || defined(__ROOTCLING__) #pragma link off all globals; @@ -71,269 +74,269 @@ using namespace std; #pragma link C++ namespace XmlTools; #pragma link C++ class XmlTools::Evaluator; -#pragma link C++ function DD4hep::evaluator; -#pragma link C++ function DD4hep::g4Evaluator; +#pragma link C++ function dd4hep::evaluator; +#pragma link C++ function dd4hep::g4Evaluator; -#pragma link C++ namespace DD4hep; -#pragma link C++ namespace DD4hep::Geometry; -#pragma link C++ namespace DD4hep::Conditions; -#pragma link C++ namespace DD4hep::DDSegmentation; +#pragma link C++ namespace dd4hep; +#pragma link C++ namespace dd4hep::detail; +#pragma link C++ namespace dd4hep::cond; +#pragma link C++ namespace dd4hep::align; +#pragma link C++ namespace dd4hep::DDSegmentation; #ifndef __ROOTCLING__ template pair<unsigned int, string>; -template class DD4hep::Handle<DD4hep::NamedObject>; -template class pair< string, DD4hep::Handle<DD4hep::NamedObject> >; -template class map< string, DD4hep::Handle<DD4hep::NamedObject> >; -template class pair<DD4hep::Callback,unsigned long>; +template class dd4hep::Handle<dd4hep::NamedObject>; +template class pair< string, dd4hep::Handle<dd4hep::NamedObject> >; +template class map< string, dd4hep::Handle<dd4hep::NamedObject> >; +template class pair<dd4hep::Callback,unsigned long>; #endif #pragma link C++ class pair<unsigned int,string>+; -//#pragma link C++ class DD4hep::Callback+; -#pragma link C++ class pair<DD4hep::Callback,unsigned long>+; -#pragma link C++ class DD4hep::NamedObject+; -#pragma link C++ class DD4hep::Geometry::Ref_t+; -#pragma link C++ class DD4hep::Handle<DD4hep::NamedObject>+; -#pragma link C++ class pair<string, DD4hep::Handle<DD4hep::NamedObject> >+; -#pragma link C++ class map<string, DD4hep::Handle<DD4hep::NamedObject> >+; -#pragma link C++ class map<string, DD4hep::Handle<DD4hep::NamedObject> >::iterator; -#pragma link C++ class map<string, DD4hep::Handle<DD4hep::NamedObject> >::const_iterator; -#pragma link C++ class DD4hep::DD4hepUI; +//#pragma link C++ class dd4hep::Callback+; +#pragma link C++ class pair<dd4hep::Callback,unsigned long>+; +#pragma link C++ class dd4hep::NamedObject+; +#pragma link C++ class dd4hep::Ref_t+; +#pragma link C++ class dd4hep::Handle<dd4hep::NamedObject>+; +#pragma link C++ class pair<string, dd4hep::Handle<dd4hep::NamedObject> >+; +#pragma link C++ class map<string, dd4hep::Handle<dd4hep::NamedObject> >+; +#pragma link C++ class map<string, dd4hep::Handle<dd4hep::NamedObject> >::iterator; +#pragma link C++ class map<string, dd4hep::Handle<dd4hep::NamedObject> >::const_iterator; +#pragma link C++ class dd4hep::dd4hepUI; #ifdef R__MACOSX // We only need these declarations for the clang compiler -#pragma link C++ function operator==( const map<string, DD4hep::Handle<DD4hep::NamedObject> >::iterator&,const map<string, DD4hep::Handle<DD4hep::NamedObject> >::iterator& ); -#pragma link C++ function operator!=( const map<string, DD4hep::Handle<DD4hep::NamedObject> >::iterator&,const map<string, DD4hep::Handle<DD4hep::NamedObject> >::iterator& ); +#pragma link C++ function operator==( const map<string, dd4hep::Handle<dd4hep::NamedObject> >::iterator&,const map<string, dd4hep::Handle<dd4hep::NamedObject> >::iterator& ); +#pragma link C++ function operator!=( const map<string, dd4hep::Handle<dd4hep::NamedObject> >::iterator&,const map<string, dd4hep::Handle<dd4hep::NamedObject> >::iterator& ); #endif -#pragma link C++ class DD4hep::ObjectExtensions+; -template class DD4hep::Handle<TNamed>; -#pragma link C++ class DD4hep::Handle<TNamed>+; +#pragma link C++ class dd4hep::ObjectExtensions+; +template class dd4hep::Handle<TNamed>; +#pragma link C++ class dd4hep::Handle<TNamed>+; -#pragma link C++ class DD4hep::IOV+; -#pragma link C++ class DD4hep::IOVType+; -#pragma link C++ class DD4hep::OpaqueData+; -#pragma link C++ class DD4hep::OpaqueDataBlock+; +#pragma link C++ class dd4hep::IOV+; +#pragma link C++ class dd4hep::IOVType+; +#pragma link C++ class dd4hep::OpaqueData+; +#pragma link C++ class dd4hep::OpaqueDataBlock+; -#pragma link C++ class DD4hep::Geometry::LCDD+; -#pragma link C++ class DD4hep::Geometry::LCDDData+; -#pragma link C++ class DD4hep::Geometry::LCDDData::ObjectHandleMap+; -#pragma link C++ class DD4hep::Geometry::LCDD::PropertyValues+; -#pragma link C++ class DD4hep::Geometry::LCDD::Properties+; +#pragma link C++ class dd4hep::Detector+; +#pragma link C++ class dd4hep::DetectorData+; +#pragma link C++ class dd4hep::DetectorData::ObjectHandleMap+; +#pragma link C++ class dd4hep::Detector::PropertyValues+; +#pragma link C++ class dd4hep::Detector::Properties+; #pragma link C++ class DD4hepRootPersistency+; // These below are the Namedobject instances to be generated .... -//#pragma link C++ class DD4hep::Geometry::LCDD::HandleMap+; -//#pragma link C++ class DD4hep::Geometry::LCDD::HandleMap::iterator; -//#pragma link C++ class DD4hep::Geometry::LCDD::HandleMap::const_iterator; -//#pragma link C++ class DD4hep::Geometry::LCDD::HandleMap::key_type; // == string -//#pragma link C++ class DD4hep::Geometry::LCDD::HandleMap::value_type+; - -#pragma link C++ class DD4hep::Geometry::VolumeManager+; -#pragma link C++ class DD4hep::Geometry::VolumeManagerObject+; -#pragma link C++ class DD4hep::Geometry::VolumeManagerContext+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::VolumeManagerObject>+; - -#pragma link C++ class DD4hep::Geometry::CartesianField+; -#pragma link C++ class DD4hep::Geometry::CartesianField::Object+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::CartesianField::Object>+; -#pragma link C++ class DD4hep::Geometry::OverlayedField+; -#pragma link C++ class DD4hep::Geometry::OverlayedField::Object+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::OverlayedField::Object>+; +//#pragma link C++ class dd4hep::Detector::HandleMap+; +//#pragma link C++ class dd4hep::Detector::HandleMap::iterator; +//#pragma link C++ class dd4hep::Detector::HandleMap::const_iterator; +//#pragma link C++ class dd4hep::Detector::HandleMap::key_type; // == string +//#pragma link C++ class dd4hep::Detector::HandleMap::value_type+; + +#pragma link C++ class dd4hep::VolumeManager+; +#pragma link C++ class dd4hep::VolumeManagerObject+; +#pragma link C++ class dd4hep::VolumeManagerContext+; +#pragma link C++ class dd4hep::Handle<dd4hep::VolumeManagerObject>+; + +#pragma link C++ class dd4hep::CartesianField+; +#pragma link C++ class dd4hep::CartesianField::Object+; +#pragma link C++ class dd4hep::Handle<dd4hep::CartesianField::Object>+; +#pragma link C++ class dd4hep::OverlayedField+; +#pragma link C++ class dd4hep::OverlayedField::Object+; +#pragma link C++ class dd4hep::Handle<dd4hep::OverlayedField::Object>+; // FieldTypes.h -#pragma link C++ class DD4hep::Geometry::ConstantField+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::ConstantField>+; -#pragma link C++ class DD4hep::Geometry::SolenoidField+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::SolenoidField>+; -#pragma link C++ class DD4hep::Geometry::DipoleField+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::DipoleField>+; +#pragma link C++ class dd4hep::ConstantField+; +#pragma link C++ class dd4hep::Handle<dd4hep::ConstantField>+; +#pragma link C++ class dd4hep::SolenoidField+; +#pragma link C++ class dd4hep::Handle<dd4hep::SolenoidField>+; +#pragma link C++ class dd4hep::DipoleField+; +#pragma link C++ class dd4hep::Handle<dd4hep::DipoleField>+; -#pragma link C++ class DD4hep::Geometry::IDDescriptor+; -#pragma link C++ class DD4hep::Geometry::IDDescriptorObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::IDDescriptorObject>+; +#pragma link C++ class dd4hep::IDDescriptor+; +#pragma link C++ class dd4hep::IDDescriptorObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::IDDescriptorObject>+; // Objects.h -#pragma link C++ class DD4hep::Geometry::Author+; -#pragma link C++ class vector<DD4hep::Geometry::Author>+; - -#pragma link C++ class DD4hep::Geometry::Header+; -#pragma link C++ class DD4hep::Geometry::HeaderObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::HeaderObject>+; - -#pragma link C++ class DD4hep::Geometry::Constant+; -#pragma link C++ class DD4hep::Geometry::ConstantObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::ConstantObject>+; -#pragma link C++ class vector<DD4hep::Geometry::Constant>+; - -#pragma link C++ class DD4hep::Geometry::Atom+; -#pragma link C++ class vector<DD4hep::Geometry::Atom>+; -#pragma link C++ class DD4hep::Handle<TGeoElement>+; - -#pragma link C++ class DD4hep::Geometry::Material+; -#pragma link C++ class vector<DD4hep::Geometry::Material>+; -#pragma link C++ class DD4hep::Handle<TGeoMedium>+; - -#pragma link C++ class DD4hep::Geometry::VisAttr+; -#pragma link C++ class vector<DD4hep::Geometry::VisAttr>+; -#pragma link C++ class DD4hep::Geometry::VisAttrObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::VisAttrObject>+; - -#pragma link C++ class DD4hep::Geometry::AlignmentEntry+; -#pragma link C++ class DD4hep::Geometry::Limit+; -#pragma link C++ class set<DD4hep::Geometry::Limit>+; -#pragma link C++ class vector<DD4hep::Geometry::Limit>+; -#pragma link C++ class DD4hep::Geometry::LimitSet+; -#pragma link C++ class vector<DD4hep::Geometry::LimitSet>+; -#pragma link C++ class DD4hep::Geometry::LimitSetObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::LimitSetObject>+; -#pragma link C++ class DD4hep::Geometry::Region+; -#pragma link C++ class DD4hep::Geometry::RegionObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::RegionObject>+; -#pragma link C++ class vector<DD4hep::Geometry::Region>+; +#pragma link C++ class dd4hep::Author+; +#pragma link C++ class vector<dd4hep::Author>+; + +#pragma link C++ class dd4hep::Header+; +#pragma link C++ class dd4hep::HeaderObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::HeaderObject>+; + +#pragma link C++ class dd4hep::Constant+; +#pragma link C++ class dd4hep::ConstantObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::ConstantObject>+; +#pragma link C++ class vector<dd4hep::Constant>+; + +#pragma link C++ class dd4hep::Atom+; +#pragma link C++ class vector<dd4hep::Atom>+; +#pragma link C++ class dd4hep::Handle<TGeoElement>+; + +#pragma link C++ class dd4hep::Material+; +#pragma link C++ class vector<dd4hep::Material>+; +#pragma link C++ class dd4hep::Handle<TGeoMedium>+; + +#pragma link C++ class dd4hep::VisAttr+; +#pragma link C++ class vector<dd4hep::VisAttr>+; +#pragma link C++ class dd4hep::VisAttrObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::VisAttrObject>+; + +#pragma link C++ class dd4hep::Limit+; +#pragma link C++ class set<dd4hep::Limit>+; +#pragma link C++ class vector<dd4hep::Limit>+; +#pragma link C++ class dd4hep::LimitSet+; +#pragma link C++ class vector<dd4hep::LimitSet>+; +#pragma link C++ class dd4hep::LimitSetObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::LimitSetObject>+; +#pragma link C++ class dd4hep::Region+; +#pragma link C++ class dd4hep::RegionObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::RegionObject>+; +#pragma link C++ class vector<dd4hep::Region>+; // Readout.h #pragma link C++ class vector<pair<size_t,string> >+; -#pragma link C++ class DD4hep::Geometry::Segmentation+; -#pragma link C++ class DD4hep::Geometry::SegmentationObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::SegmentationObject>+; -#pragma link C++ class DD4hep::Geometry::HitCollection+; -#pragma link C++ class DD4hep::Geometry::Readout+; -#pragma link C++ class DD4hep::Geometry::HitCollection+; -#pragma link C++ class DD4hep::Geometry::ReadoutObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::ReadoutObject>+; -#pragma link C++ class vector<DD4hep::Geometry::HitCollection>+; -#pragma link C++ class vector<DD4hep::Geometry::Readout>+; -#pragma link C++ class vector<DD4hep::Geometry::HitCollection*>+; -#pragma link C++ class vector<const DD4hep::Geometry::HitCollection*>+; -#pragma link C++ class vector<DD4hep::Geometry::IDDescriptor>+; +#pragma link C++ class dd4hep::Segmentation+; +#pragma link C++ class dd4hep::SegmentationObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::SegmentationObject>+; +#pragma link C++ class dd4hep::HitCollection+; +#pragma link C++ class dd4hep::Readout+; +#pragma link C++ class dd4hep::HitCollection+; +#pragma link C++ class dd4hep::ReadoutObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::ReadoutObject>+; +#pragma link C++ class vector<dd4hep::HitCollection>+; +#pragma link C++ class vector<dd4hep::Readout>+; +#pragma link C++ class vector<dd4hep::HitCollection*>+; +#pragma link C++ class vector<const dd4hep::HitCollection*>+; +#pragma link C++ class vector<dd4hep::IDDescriptor>+; // Alignment stuff -#pragma link C++ class DD4hep::Alignments::Delta+; -#pragma link C++ class DD4hep::Alignments::Alignment+; -#pragma link C++ class DD4hep::Alignments::AlignmentData+; +#pragma link C++ class dd4hep::Delta+; +#pragma link C++ class dd4hep::Alignment+; +#pragma link C++ class dd4hep::AlignmentData+; -#pragma link C++ class DD4hep::Alignments::Interna::AlignmentConditionObject+; -#pragma link C++ class DD4hep::Alignments::GlobalAlignment+; -#pragma link C++ class DD4hep::Alignments::AlignmentDecorator<AlignmentData>+; -#pragma link C++ class DD4hep::Handle<DD4hep::Alignments::AlignmentData>+; -#pragma link C++ class DD4hep::Handle<TGeoPhysicalNode>+; +#pragma link C++ class dd4hep::detail::AlignmentConditionObject+; +#pragma link C++ class dd4hep::align::GlobalAlignment+; +#pragma link C++ class dd4hep::AlignmentDecorator<AlignmentData>+; +#pragma link C++ class dd4hep::Handle<dd4hep::AlignmentData>+; +#pragma link C++ class dd4hep::Handle<TGeoPhysicalNode>+; -#pragma link C++ class DD4hep::Conditions::Condition+; -#pragma link C++ class vector<DD4hep::Conditions::Condition>+; -#pragma link C++ class DD4hep::Conditions::ConditionKey+; -#pragma link C++ class vector<DD4hep::Conditions::ConditionKey>+; -#pragma link C++ class DD4hep::Conditions::Interna::ConditionObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Conditions::Interna::ConditionObject>+; +#pragma link C++ class dd4hep::Condition+; +#pragma link C++ class vector<dd4hep::Condition>+; +#pragma link C++ class dd4hep::ConditionKey+; +#pragma link C++ class vector<dd4hep::ConditionKey>+; +#pragma link C++ class dd4hep::detail::ConditionObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::detail::ConditionObject>+; // DetElement.h -#pragma link C++ class DD4hep::Geometry::World+; -#pragma link C++ class DD4hep::Geometry::WorldObject+; -#pragma link C++ class DD4hep::Geometry::DetElement+; -#pragma link C++ class DD4hep::Geometry::DetElementObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::DetElementObject>+; -#pragma link C++ class vector<DD4hep::Geometry::DetElement>+; -#pragma link C++ class pair<string,DD4hep::Geometry::DetElement>+; -#pragma link C++ class map<string,DD4hep::Geometry::DetElement>+; -#pragma link C++ class map<string,DD4hep::Geometry::DetElement>::iterator; -#pragma link C++ class map<string,DD4hep::Geometry::DetElement>::const_iterator; +#pragma link C++ class dd4hep::World+; +#pragma link C++ class dd4hep::WorldObject+; +#pragma link C++ class dd4hep::DetElement+; +#pragma link C++ class dd4hep::DetElementObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::DetElementObject>+; +#pragma link C++ class vector<dd4hep::DetElement>+; +#pragma link C++ class pair<string,dd4hep::DetElement>+; +#pragma link C++ class map<string,dd4hep::DetElement>+; +#pragma link C++ class map<string,dd4hep::DetElement>::iterator; +#pragma link C++ class map<string,dd4hep::DetElement>::const_iterator; #ifdef R__MACOSX // We only need these declarations for the clang compiler -#pragma link C++ function operator==( const map<string, DD4hep::Geometry::DetElement >::iterator&,const map<string, DD4hep::Geometry::DetElement >::iterator& ); -#pragma link C++ function operator!=( const map<string, DD4hep::Geometry::DetElement >::iterator&,const map<string, DD4hep::Geometry::DetElement >::iterator& ); +#pragma link C++ function operator==( const map<string, dd4hep::DetElement >::iterator&,const map<string, dd4hep::DetElement >::iterator& ); +#pragma link C++ function operator!=( const map<string, dd4hep::DetElement >::iterator&,const map<string, dd4hep::DetElement >::iterator& ); #endif -#pragma link C++ class DD4hep::Geometry::SensitiveDetector+; -#pragma link C++ class DD4hep::Geometry::SensitiveDetectorObject+; -#pragma link C++ class DD4hep::Handle<DD4hep::Geometry::SensitiveDetectorObject>+; -#pragma link C++ class vector<DD4hep::Geometry::SensitiveDetector>+; +#pragma link C++ class dd4hep::SensitiveDetector+; +#pragma link C++ class dd4hep::SensitiveDetectorObject+; +#pragma link C++ class dd4hep::Handle<dd4hep::SensitiveDetectorObject>+; +#pragma link C++ class vector<dd4hep::SensitiveDetector>+; // Volume.h -#pragma link C++ class DD4hep::Geometry::Volume+; -#pragma link C++ class DD4hep::Geometry::VolumeExtension+; -#pragma link C++ class vector<DD4hep::Geometry::Volume>+; -#pragma link C++ class DD4hep::Handle<TGeoVolume>+; +#pragma link C++ class dd4hep::Volume+; +#pragma link C++ class dd4hep::VolumeExtension+; +#pragma link C++ class vector<dd4hep::Volume>+; +#pragma link C++ class dd4hep::Handle<TGeoVolume>+; -#pragma link C++ class DD4hep::Geometry::PlacedVolume+; +#pragma link C++ class dd4hep::PlacedVolume+; #ifndef __ROOTCLING__ template vector<pair<string, int> >; template vector<pair<string, int> >::iterator; #endif #pragma link C++ class vector<pair<string, int> >+; #pragma link C++ class vector<pair<string, int> >::iterator; -#pragma link C++ class DD4hep::Geometry::PlacedVolumeExtension::VolIDs+; -#pragma link C++ class DD4hep::Geometry::PlacedVolumeExtension+; -#pragma link C++ class vector<DD4hep::Geometry::PlacedVolume>+; -#pragma link C++ class DD4hep::Handle<TGeoNode>+; +#pragma link C++ class dd4hep::PlacedVolumeExtension::VolIDs+; +#pragma link C++ class dd4hep::PlacedVolumeExtension+; +#pragma link C++ class vector<dd4hep::PlacedVolume>+; +#pragma link C++ class dd4hep::Handle<TGeoNode>+; #pragma link C++ class vector<TGeoNode*>+; #pragma link C++ class vector<TGeoVolume*>+; // Shapes.h -#pragma link C++ class DD4hep::Handle<TGeoShape>+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoShape>+; +#pragma link C++ class dd4hep::Handle<TGeoShape>+; +#pragma link C++ class dd4hep::Solid_type<TGeoShape>+; -#pragma link C++ class DD4hep::Geometry::Polycone+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoPcon>+; -#pragma link C++ class DD4hep::Handle<TGeoPcon>+; +#pragma link C++ class dd4hep::Polycone+; +#pragma link C++ class dd4hep::Solid_type<TGeoPcon>+; +#pragma link C++ class dd4hep::Handle<TGeoPcon>+; -#pragma link C++ class DD4hep::Geometry::ConeSegment+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoConeSeg>+; -#pragma link C++ class DD4hep::Handle<TGeoConeSeg>+; +#pragma link C++ class dd4hep::ConeSegment+; +#pragma link C++ class dd4hep::Solid_type<TGeoConeSeg>+; +#pragma link C++ class dd4hep::Handle<TGeoConeSeg>+; -#pragma link C++ class DD4hep::Geometry::Box+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoBBox>+; -#pragma link C++ class DD4hep::Handle<TGeoBBox>+; +#pragma link C++ class dd4hep::Box+; +#pragma link C++ class dd4hep::Solid_type<TGeoBBox>+; +#pragma link C++ class dd4hep::Handle<TGeoBBox>+; -#pragma link C++ class DD4hep::Geometry::Torus+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoTorus>+; -#pragma link C++ class DD4hep::Handle<TGeoTorus>+; +#pragma link C++ class dd4hep::Torus+; +#pragma link C++ class dd4hep::Solid_type<TGeoTorus>+; +#pragma link C++ class dd4hep::Handle<TGeoTorus>+; -#pragma link C++ class DD4hep::Geometry::Cone+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoCone>+; -#pragma link C++ class DD4hep::Handle<TGeoCone>+; +#pragma link C++ class dd4hep::Cone+; +#pragma link C++ class dd4hep::Solid_type<TGeoCone>+; +#pragma link C++ class dd4hep::Handle<TGeoCone>+; -#pragma link C++ class DD4hep::Geometry::Tube+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoTubeSeg>+; -#pragma link C++ class DD4hep::Handle<TGeoTubeSeg>+; +#pragma link C++ class dd4hep::Tube+; +#pragma link C++ class dd4hep::Solid_type<TGeoTubeSeg>+; +#pragma link C++ class dd4hep::Handle<TGeoTubeSeg>+; -#pragma link C++ class DD4hep::Geometry::EllipticalTube+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoEltu>+; -#pragma link C++ class DD4hep::Handle<TGeoEltu>+; +#pragma link C++ class dd4hep::EllipticalTube+; +#pragma link C++ class dd4hep::Solid_type<TGeoEltu>+; +#pragma link C++ class dd4hep::Handle<TGeoEltu>+; -#pragma link C++ class DD4hep::Geometry::Trap+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoTrap>+; -#pragma link C++ class DD4hep::Handle<TGeoTrap>+; +#pragma link C++ class dd4hep::Trap+; +#pragma link C++ class dd4hep::Solid_type<TGeoTrap>+; +#pragma link C++ class dd4hep::Handle<TGeoTrap>+; -#pragma link C++ class DD4hep::Geometry::Trapezoid+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoTrd2>+; -#pragma link C++ class DD4hep::Handle<TGeoTrd2>+; +#pragma link C++ class dd4hep::Trapezoid+; +#pragma link C++ class dd4hep::Solid_type<TGeoTrd2>+; +#pragma link C++ class dd4hep::Handle<TGeoTrd2>+; -#pragma link C++ class DD4hep::Geometry::Sphere+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoSphere>+; -#pragma link C++ class DD4hep::Handle<TGeoSphere>+; +#pragma link C++ class dd4hep::Sphere+; +#pragma link C++ class dd4hep::Solid_type<TGeoSphere>+; +#pragma link C++ class dd4hep::Handle<TGeoSphere>+; -#pragma link C++ class DD4hep::Geometry::Paraboloid+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoParaboloid>+; -#pragma link C++ class DD4hep::Handle<TGeoParaboloid>+; +#pragma link C++ class dd4hep::Paraboloid+; +#pragma link C++ class dd4hep::Solid_type<TGeoParaboloid>+; +#pragma link C++ class dd4hep::Handle<TGeoParaboloid>+; -#pragma link C++ class DD4hep::Geometry::Hyperboloid+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoHype>+; -#pragma link C++ class DD4hep::Handle<TGeoHype>+; +#pragma link C++ class dd4hep::Hyperboloid+; +#pragma link C++ class dd4hep::Solid_type<TGeoHype>+; +#pragma link C++ class dd4hep::Handle<TGeoHype>+; -#pragma link C++ class DD4hep::Geometry::PolyhedraRegular+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoPgon>+; -#pragma link C++ class DD4hep::Handle<TGeoPgon>+; +#pragma link C++ class dd4hep::PolyhedraRegular+; +#pragma link C++ class dd4hep::Solid_type<TGeoPgon>+; +#pragma link C++ class dd4hep::Handle<TGeoPgon>+; -#pragma link C++ class DD4hep::Geometry::BooleanSolid+; -#pragma link C++ class DD4hep::Geometry::Solid_type<TGeoCompositeShape>+; -#pragma link C++ class DD4hep::Handle<TGeoCompositeShape>+; +#pragma link C++ class dd4hep::BooleanSolid+; +#pragma link C++ class dd4hep::Solid_type<TGeoCompositeShape>+; +#pragma link C++ class dd4hep::Handle<TGeoCompositeShape>+; -#pragma link C++ class DD4hep::Geometry::SubtractionSolid+; -#pragma link C++ class DD4hep::Geometry::UnionSolid+; -#pragma link C++ class DD4hep::Geometry::IntersectionSolid+; +#pragma link C++ class dd4hep::SubtractionSolid+; +#pragma link C++ class dd4hep::UnionSolid+; +#pragma link C++ class dd4hep::IntersectionSolid+; #pragma link C++ class pair<string, string>+; #pragma link C++ class map<string, string>+; @@ -357,10 +360,16 @@ template vector<pair<string, int> >::iterator; #pragma link C++ function operator!=( const map<string, map<string,string>>::iterator&, const map<string, map<string,string>>::iterator& ); #endif -#pragma link C++ class DD4hep::Geometry::LCDD+; +#pragma link C++ class dd4hep::Detector+; + +#pragma link C++ function dd4hep::run_interpreter(const string& name); +#pragma link C++ function dd4hep::_toDictionary(const string&, const string&); + +#include "DD4hep/ConditionsData.h" +#pragma link C++ class dd4hep::cond::ClientData+; +#pragma link C++ class dd4hep::cond::AbstractMap+; +#pragma link C++ class dd4hep::cond::AbstractMap::Params+; -#pragma link C++ function DD4hep::run_interpreter(const string& name); -#pragma link C++ function DD4hep::Geometry::_toDictionary(const string&, const string&); #endif // __CINT__ @@ -382,39 +391,39 @@ template vector<pair<string, int> >::iterator; #include "DDSegmentation/ProjectiveCylinder.h" #include "DDSegmentation/SegmentationParameter.h" #include "DDSegmentation/TiledLayerSegmentation.h" -typedef DD4hep::DDSegmentation::VolumeID VolumeID; -typedef DD4hep::DDSegmentation::CellID CellID; +typedef dd4hep::DDSegmentation::VolumeID VolumeID; +typedef dd4hep::DDSegmentation::CellID CellID; #if defined(__CINT__) || defined(__MAKECINT__) || defined(__CLANG__) || defined(__ROOTCLING__) -#pragma link C++ class DD4hep::DDSegmentation::SegmentationParameter+; -#pragma link C++ class DD4hep::DDSegmentation::TypedSegmentationParameter<int>+; +#pragma link C++ class dd4hep::DDSegmentation::SegmentationParameter+; +#pragma link C++ class dd4hep::DDSegmentation::TypedSegmentationParameter<int>+; -#pragma link C++ class DD4hep::DDSegmentation::TypedSegmentationParameter<float>+; -#pragma link C++ class DD4hep::DDSegmentation::TypedSegmentationParameter<double>+; -#pragma link C++ class DD4hep::DDSegmentation::TypedSegmentationParameter<string>+; +#pragma link C++ class dd4hep::DDSegmentation::TypedSegmentationParameter<float>+; +#pragma link C++ class dd4hep::DDSegmentation::TypedSegmentationParameter<double>+; +#pragma link C++ class dd4hep::DDSegmentation::TypedSegmentationParameter<string>+; #if 0 /// Severe problem due to template specialization! -#pragma link C++ class DD4hep::DDSegmentation::TypedSegmentationParameter<vector<int> >+; -#pragma link C++ class DD4hep::DDSegmentation::TypedSegmentationParameter<vector<float> >+; -#pragma link C++ class DD4hep::DDSegmentation::TypedSegmentationParameter<vector<double> >+; -#pragma link C++ class DD4hep::DDSegmentation::TypedSegmentationParameter<vector<string> >+; +#pragma link C++ class dd4hep::DDSegmentation::TypedSegmentationParameter<vector<int> >+; +#pragma link C++ class dd4hep::DDSegmentation::TypedSegmentationParameter<vector<float> >+; +#pragma link C++ class dd4hep::DDSegmentation::TypedSegmentationParameter<vector<double> >+; +#pragma link C++ class dd4hep::DDSegmentation::TypedSegmentationParameter<vector<string> >+; #endif -#pragma link C++ class DD4hep::DDSegmentation::Segmentation+; -#pragma link C++ class DD4hep::DDSegmentation::NoSegmentation+; -#pragma link C++ class DD4hep::DDSegmentation::GridPhiEta+; -#pragma link C++ class DD4hep::DDSegmentation::GridRPhiEta+; -#pragma link C++ class DD4hep::DDSegmentation::CartesianGrid+; -#pragma link C++ class DD4hep::DDSegmentation::CartesianGridXY+; -#pragma link C++ class DD4hep::DDSegmentation::CartesianGridXYZ+; -#pragma link C++ class DD4hep::DDSegmentation::CartesianGridXZ+; -#pragma link C++ class DD4hep::DDSegmentation::CartesianGridYZ+; -#pragma link C++ class DD4hep::DDSegmentation::CylindricalSegmentation+; -#pragma link C++ class DD4hep::DDSegmentation::ProjectiveCylinder+; -#pragma link C++ class DD4hep::DDSegmentation::TiledLayerSegmentation+; - -#pragma link C++ class DD4hep::DDSegmentation::BitFieldValue+; -#pragma link C++ class DD4hep::DDSegmentation::BitField64+; +#pragma link C++ class dd4hep::DDSegmentation::Segmentation+; +#pragma link C++ class dd4hep::DDSegmentation::NoSegmentation+; +#pragma link C++ class dd4hep::DDSegmentation::GridPhiEta+; +#pragma link C++ class dd4hep::DDSegmentation::GridRPhiEta+; +#pragma link C++ class dd4hep::DDSegmentation::CartesianGrid+; +#pragma link C++ class dd4hep::DDSegmentation::CartesianGridXY+; +#pragma link C++ class dd4hep::DDSegmentation::CartesianGridXYZ+; +#pragma link C++ class dd4hep::DDSegmentation::CartesianGridXZ+; +#pragma link C++ class dd4hep::DDSegmentation::CartesianGridYZ+; +#pragma link C++ class dd4hep::DDSegmentation::CylindricalSegmentation+; +#pragma link C++ class dd4hep::DDSegmentation::ProjectiveCylinder+; +#pragma link C++ class dd4hep::DDSegmentation::TiledLayerSegmentation+; + +#pragma link C++ class dd4hep::DDSegmentation::BitFieldValue+; +#pragma link C++ class dd4hep::DDSegmentation::BitField64+; #endif // __CINT__ #endif // __HAVE_DDSEGMENTATION__ diff --git a/DDCore/include/DD4hep/Errors.h b/DDCore/include/DD4hep/Errors.h index 13db5aac9..c6a11d7c4 100644 --- a/DDCore/include/DD4hep/Errors.h +++ b/DDCore/include/DD4hep/Errors.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Utility namespace: Errors namespace Errors { @@ -51,5 +51,5 @@ namespace DD4hep { } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif // DD4HEP_ERRORS_H diff --git a/DDCore/include/DD4hep/Exceptions.h b/DDCore/include/DD4hep/Exceptions.h index 3911efad4..50f11ba92 100644 --- a/DDCore/include/DD4hep/Exceptions.h +++ b/DDCore/include/DD4hep/Exceptions.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #include <stdexcept> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Exception class to signal operations on unrelated classes /** @@ -48,6 +48,6 @@ namespace DD4hep { } }; -} // End namespace DD4hep +} // End namespace dd4hep #endif /* DD4HEP_DDCORE_EXCEPTIONS_H */ diff --git a/DDCore/include/DD4hep/Factories.h b/DDCore/include/DD4hep/Factories.h index 15a15e893..7c6bde6ca 100644 --- a/DDCore/include/DD4hep/Factories.h +++ b/DDCore/include/DD4hep/Factories.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,40 +15,37 @@ // Framework include files #include "DD4hep/Plugins.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/NamedObject.h" // C/C++ include files #include <cstdarg> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { + + // Forward declarations + class Detector; + class NamedObject; + class SensitiveDetector; + class SegmentationObject; + class DetElement; /// Namespace for the AIDA detector description toolkit supporting JSON utilities - namespace JSON { + namespace json { class Handle_t; } /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { class Handle_t; class RefElement; } - class NamedObject; /// Namespace describing generic detector segmentations namespace DDSegmentation { class BitField64; } - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class LCDD; - class SensitiveDetector; - class SegmentationObject; - class DetElement; - } /// Template class with a generic constructor signature /** @@ -61,19 +58,19 @@ namespace DD4hep { public: static void* create(const char* arg); }; - template <typename T> class LCDDConstructionFactory : public PluginFactoryBase { + template <typename T> class DetectorConstructionFactory : public PluginFactoryBase { public: - static void* create(Geometry::LCDD& lcdd, int argc, char** argv); + static void* create(Detector& description, int argc, char** argv); }; template <typename T> class SegmentationFactory : public PluginFactoryBase { public: - static Geometry::SegmentationObject* create(DDSegmentation::BitField64* decoder); + static SegmentationObject* create(DDSegmentation::BitField64* decoder); }; - /// Template class with a generic signature to apply LCDD plugins + /// Template class with a generic signature to apply Detector plugins /** - * Specialized factory to translate objects, which can be retrieved from LCDD - * Example: Translate DD4hep geometry to Geant4 + * Specialized factory to translate objects, which can be retrieved from Detector + * Example: Translate dd4hep geometry to Geant4 * * \author M.Frank * \version 1.0 @@ -82,12 +79,12 @@ namespace DD4hep { */ template <typename T> class ApplyFactory : public PluginFactoryBase { public: - static long create(Geometry::LCDD& lcdd, int argc, char** argv); + static long create(Detector& description, int argc, char** argv); }; - /// Specialized factory to translate objects, which can be retrieved from LCDD + /// Specialized factory to translate objects, which can be retrieved from Detector /** - * Example: Translate DD4hep geometry to Geant4 + * Example: Translate dd4hep geometry to Geant4 * * \author M.Frank * \version 1.0 @@ -96,7 +93,7 @@ namespace DD4hep { */ template <typename T> class TranslationFactory : public PluginFactoryBase { public: - static ref_t create(Geometry::LCDD& lcdd); + static Handle<NamedObject> create(Detector& description); }; /// Create an arbitrary object from it's XML representation. @@ -109,7 +106,7 @@ namespace DD4hep { */ template <typename T> class XMLElementFactory : public PluginFactoryBase { public: - static ref_t create(Geometry::LCDD& lcdd, XML::Handle_t e); + static Handle<NamedObject> create(Detector& description, xml::Handle_t e); }; /// Read an arbitrary XML document and analyze it's content @@ -122,7 +119,7 @@ namespace DD4hep { */ template <typename T> class XMLDocumentReaderFactory : public PluginFactoryBase { public: - static long create(Geometry::LCDD& lcdd, XML::Handle_t e); + static long create(Detector& description, xml::Handle_t e); }; /// Read an arbitrary XML document and analyze it's content @@ -135,7 +132,7 @@ namespace DD4hep { */ template <typename T> class XMLConversionFactory : public PluginFactoryBase { public: - static long create(Geometry::LCDD& lcdd, XML::RefElement& handle, XML::Handle_t element); + static long create(Detector& description, xml::RefElement& handle, xml::Handle_t element); }; /// Standard factory to create Detector elements from the compact XML representation. @@ -148,7 +145,7 @@ namespace DD4hep { */ template <typename T> class XmlDetElementFactory : public PluginFactoryBase { public: - static Geometry::Ref_t create(Geometry::LCDD& lcdd, XML::Handle_t e, Geometry::Ref_t sens); + static Handle<NamedObject> create(Detector& description, xml::Handle_t e, Handle<NamedObject> sens); }; /// Standard factory to create Detector elements from the compact XML representation. @@ -161,7 +158,7 @@ namespace DD4hep { */ template <typename T> class JsonDetElementFactory : public PluginFactoryBase { public: - static Geometry::Ref_t create(Geometry::LCDD& lcdd, JSON::Handle_t e, Geometry::Ref_t sens); + static Handle<NamedObject> create(Detector& description, json::Handle_t e, Handle<NamedObject> sens); }; } @@ -171,104 +168,103 @@ namespace { template <typename P, typename S> class Factory; struct ns { - typedef DD4hep::NamedObject Named; - typedef DD4hep::Geometry::LCDD LCDD; - typedef DD4hep::XML::Handle_t xml_h; - typedef DD4hep::JSON::Handle_t json_h; - typedef DD4hep::Geometry::Ref_t ref_t; - typedef DD4hep::Geometry::SegmentationObject SegmentationObject; - typedef DD4hep::DDSegmentation::BitField64 BitField64; + typedef dd4hep::NamedObject Named; + typedef dd4hep::xml::Handle_t xml_h; + typedef dd4hep::json::Handle_t json_h; + typedef dd4hep::Handle<Named> ref_t; + typedef dd4hep::SegmentationObject SegmentationObject; + typedef dd4hep::DDSegmentation::BitField64 BitField64; }; DD4HEP_PLUGIN_FACTORY_ARGS_1(void*,const char*) - { return DD4hep::ConstructionFactory<P>::create(a0); } + { return dd4hep::ConstructionFactory<P>::create(a0); } - DD4HEP_PLUGIN_FACTORY_ARGS_1(ns::Named*,ns::LCDD*) - { return DD4hep::TranslationFactory<P>::create(*a0).ptr(); } + DD4HEP_PLUGIN_FACTORY_ARGS_1(ns::Named*,dd4hep::Detector*) + { return dd4hep::TranslationFactory<P>::create(*a0).ptr(); } DD4HEP_PLUGIN_FACTORY_ARGS_1(ns::SegmentationObject*,ns::BitField64*) - { return DD4hep::SegmentationFactory<P>::create(a0); } + { return dd4hep::SegmentationFactory<P>::create(a0); } - DD4HEP_PLUGIN_FACTORY_ARGS_3(void*,ns::LCDD*,int,char**) - { return DD4hep::LCDDConstructionFactory<P>::create(*a0,a1,a2); } + DD4HEP_PLUGIN_FACTORY_ARGS_3(void*,dd4hep::Detector*,int,char**) + { return dd4hep::DetectorConstructionFactory<P>::create(*a0,a1,a2); } - DD4HEP_PLUGIN_FACTORY_ARGS_3(long,ns::LCDD*,int,char**) - { return make_return<long>(DD4hep::ApplyFactory<P>::create(*a0,a1,a2)); } + DD4HEP_PLUGIN_FACTORY_ARGS_3(long,dd4hep::Detector*,int,char**) + { return make_return<long>(dd4hep::ApplyFactory<P>::create(*a0,a1,a2)); } - DD4HEP_PLUGIN_FACTORY_ARGS_2(ns::Named*,ns::LCDD*,ns::xml_h*) - { return DD4hep::XMLElementFactory<P>::create(*a0,*a1).ptr(); } + DD4HEP_PLUGIN_FACTORY_ARGS_2(ns::Named*,dd4hep::Detector*,ns::xml_h*) + { return dd4hep::XMLElementFactory<P>::create(*a0,*a1).ptr(); } - DD4HEP_PLUGIN_FACTORY_ARGS_2(long,ns::LCDD*,ns::xml_h*) - { return make_return<long>(DD4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1)); } + DD4HEP_PLUGIN_FACTORY_ARGS_2(long,dd4hep::Detector*,ns::xml_h*) + { return make_return<long>(dd4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1)); } - DD4HEP_PLUGIN_FACTORY_ARGS_3(ns::Named*,ns::LCDD*,ns::xml_h*,ns::ref_t*) - { return DD4hep::XmlDetElementFactory<P>::create(*a0,*a1,*a2).ptr(); } + DD4HEP_PLUGIN_FACTORY_ARGS_3(ns::Named*,dd4hep::Detector*,ns::xml_h*,ns::ref_t*) + { return dd4hep::XmlDetElementFactory<P>::create(*a0,*a1,*a2).ptr(); } - DD4HEP_PLUGIN_FACTORY_ARGS_3(ns::Named*,ns::LCDD*,ns::json_h*,ns::ref_t*) - { return DD4hep::JsonDetElementFactory<P>::create(*a0,*a1,*a2).ptr(); } + DD4HEP_PLUGIN_FACTORY_ARGS_3(ns::Named*,dd4hep::Detector*,ns::json_h*,ns::ref_t*) + { return dd4hep::JsonDetElementFactory<P>::create(*a0,*a1,*a2).ptr(); } } -#define DECLARE_DETELEMENT_FACTORY(x) namespace DD4hep \ - { DD4HEP_PLUGINSVC_FACTORY(x,x,DD4hep::NamedObject*(ns::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) } -#define DECLARE_NAMESPACE_DETELEMENT_FACTORY(n,x) namespace DD4hep \ - { DD4HEP_PLUGINSVC_FACTORY(n::x,x,NamedObject*(ns::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) } -#define DECLARE_NAMED_APPLY_FACTORY(n,x) namespace DD4hep \ - { DD4HEP_PLUGINSVC_FACTORY(n::x,x,long(ns::LCDD*,int, char**),__LINE__) } -#define DECLARE_NAMED_TRANSLATION_FACTORY(n,x) namespace DD4hep \ - { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(ns::LCDD*),__LINE__) } -#define DECLARE_NAMED_XMLELEMENT_FACTORY(n,x) namespace DD4hep \ - { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(ns::LCDD*,XML::Handle_t*),__LINE__) } -#define DECLARE_NAMED_DETELEMENT_FACTORY(n,x) namespace DD4hep \ - { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::*(),__LINE__) } - -// Call function of the type [Geometry::SegmentationObject (*func)(ns::LCDD*,DDSegmentation::BitField64*)] -#define DECLARE_SEGMENTATION(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ - template <> Geometry::SegmentationObject* \ +#define DECLARE_DETELEMENT_FACTORY(x) namespace dd4hep \ + { DD4HEP_PLUGINSVC_FACTORY(x,x,dd4hep::NamedObject*(dd4hep::Detector*,xml::Handle_t*,Ref_t*),__LINE__) } +#define DECLARE_NAMESPACE_DETELEMENT_FACTORY(n,x) namespace dd4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,NamedObject*(dd4hep::Detector*,xml::Handle_t*,Ref_t*),__LINE__) } +#define DECLARE_NAMED_APPLY_FACTORY(n,x) namespace dd4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,long(dd4hep::Detector*,int, char**),__LINE__) } +#define DECLARE_NAMED_TRANSLATION_FACTORY(n,x) namespace dd4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,dd4hep::NamedObject*(dd4hep::Detector*),__LINE__) } +#define DECLARE_NAMED_XMLELEMENT_FACTORY(n,x) namespace dd4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,dd4hep::NamedObject*(dd4hep::Detector*,xml::Handle_t*),__LINE__) } +#define DECLARE_NAMED_DETELEMENT_FACTORY(n,x) namespace dd4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,dd4hep::*(),__LINE__) } + +// Call function of the type [SegmentationObject (*func)(dd4hep::Detector*,DDSegmentation::BitField64*)] +#define DECLARE_SEGMENTATION(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,name) { \ + template <> SegmentationObject* \ SegmentationFactory<name>::create(DDSegmentation::BitField64* d) { return func(d); } \ DD4HEP_PLUGINSVC_FACTORY(name,segmentation_constructor__##name, \ - Geometry::SegmentationObject*(DDSegmentation::BitField64*),__LINE__)} + SegmentationObject*(DDSegmentation::BitField64*),__LINE__)} // Call function of the type [long (*func)(const char* arg)] -#define DECLARE_APPLY(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ - template <> long ApplyFactory<name>::create(ns::LCDD& l,int n,char** a) {return func(l,n,a);} \ - DD4HEP_PLUGINSVC_FACTORY(name,name,long(ns::LCDD*,int,char**),__LINE__)} +#define DECLARE_APPLY(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,name) { \ + template <> long ApplyFactory<name>::create(dd4hep::Detector& l,int n,char** a) {return func(l,n,a);} \ + DD4HEP_PLUGINSVC_FACTORY(name,name,long(dd4hep::Detector*,int,char**),__LINE__)} // Call function of the type [void* (*func)(const char* arg)] -#define DECLARE_CONSTRUCTOR(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ +#define DECLARE_CONSTRUCTOR(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,name) { \ template <> void* ConstructionFactory<name>::create(const char* n) { return func(n);} \ DD4HEP_PLUGINSVC_FACTORY(name,name,void*(const char*),__LINE__) } -// Call function of the type [void* (*func)(ns::LCDD& lcdd, int argc,char** argv)] -#define DECLARE_LCDD_CONSTRUCTOR(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ - template <> void* LCDDConstructionFactory<name>::create(ns::LCDD& l, int n,char** a) { return func(l,n,a);} \ - DD4HEP_PLUGINSVC_FACTORY(name,name,void*(ns::LCDD*,int,char**),__LINE__) } +// Call function of the type [void* (*func)(dd4hep::Detector& description, int argc,char** argv)] +#define DECLARE_Detector_CONSTRUCTOR(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,name) { \ + template <> void* DetectorConstructionFactory<name>::create(dd4hep::Detector& l, int n,char** a) { return func(l,n,a);} \ + DD4HEP_PLUGINSVC_FACTORY(name,name,void*(dd4hep::Detector*,int,char**),__LINE__) } -// Call function of the type [void* (*func)(ns::LCDD& lcdd)] -#define DECLARE_TRANSLATION(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ - template <> Geometry::Ref_t TranslationFactory<name>::create(ns::LCDD& l) {return func(l);} \ +// Call function of the type [void* (*func)(dd4hep::Detector& description)] +#define DECLARE_TRANSLATION(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,name) { \ + template <> Ref_t TranslationFactory<name>::create(dd4hep::Detector& l) {return func(l);} \ DECLARE_NAMED_TRANSLATION_FACTORY(Geometry,name) } -// Call function of the type [void* (*func)(ns::LCDD& lcdd, xml_h handle)] -#define DECLARE_XMLELEMENT(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,xml_element_##name) {\ - template <> Geometry::Ref_t XMLElementFactory<xml_element_##name>::create(ns::LCDD& l,ns::xml_h e) {return func(l,e);} \ - DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,NamedObject*(ns::LCDD*,ns::xml_h*),__LINE__) } +// Call function of the type [void* (*func)(dd4hep::Detector& description, xml_h handle)] +#define DECLARE_XMLELEMENT(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,xml_element_##name) {\ + template <> Ref_t XMLElementFactory<xml_element_##name>::create(dd4hep::Detector& l,ns::xml_h e) {return func(l,e);} \ + DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,NamedObject*(dd4hep::Detector*,ns::xml_h*),__LINE__) } -// Call function of the type [long (*func)(ns::LCDD& lcdd, xml_h handle)] -#define DECLARE_XML_DOC_READER(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,xml_document_##name) { \ - template <> long XMLDocumentReaderFactory<xml_document_##name>::create(ns::LCDD& l,ns::xml_h e) {return func(l,e);} \ - DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name##_XML_reader,long(ns::LCDD*,ns::xml_h*),__LINE__) } +// Call function of the type [long (*func)(dd4hep::Detector& description, xml_h handle)] +#define DECLARE_XML_DOC_READER(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,xml_document_##name) { \ + template <> long XMLDocumentReaderFactory<xml_document_##name>::create(dd4hep::Detector& l,ns::xml_h e) {return func(l,e);} \ + DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name##_XML_reader,long(dd4hep::Detector*,ns::xml_h*),__LINE__) } -// Call function of the type [NamedObject* (*func)(ns::LCDD& lcdd, xml_h handle, ref_t reference)] -#define DECLARE_XML_PROCESSOR_BASIC(name,func,deprecated) DD4HEP_OPEN_PLUGIN(DD4hep,det_element_##name) {\ - template <> Geometry::Ref_t XmlDetElementFactory< det_element_##name >::create(ns::LCDD& l,ns::xml_h e,ns::ref_t h) \ +// Call function of the type [NamedObject* (*func)(dd4hep::Detector& description, xml_h handle, ref_t reference)] +#define DECLARE_XML_PROCESSOR_BASIC(name,func,deprecated) DD4HEP_OPEN_PLUGIN(dd4hep,det_element_##name) {\ + template <> Ref_t XmlDetElementFactory< det_element_##name >::create(dd4hep::Detector& l,ns::xml_h e,ns::ref_t h) \ { if (deprecated) warning_deprecated_xml_factory(#name); return func(l,e,h);} \ - DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(ns::LCDD*,ns::xml_h*,Geometry::Ref_t*),__LINE__) } + DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(dd4hep::Detector*,ns::xml_h*,Ref_t*),__LINE__) } -// Call function of the type [NamedObject* (*func)(ns::LCDD& lcdd, json_h handle, ref_t reference)] -#define DECLARE_JSON_PROCESSOR_BASIC(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,det_element_##name) { \ - template <> Geometry::Ref_t JsonDetElementFactory< det_element_##name >::create(ns::LCDD& l,ns::json_h e,ns::ref_t h) \ +// Call function of the type [NamedObject* (*func)(dd4hep::Detector& description, json_h handle, ref_t reference)] +#define DECLARE_JSON_PROCESSOR_BASIC(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,det_element_##name) { \ + template <> Ref_t JsonDetElementFactory< det_element_##name >::create(dd4hep::Detector& l,ns::json_h e,ns::ref_t h) \ { return func(l,e,h);} \ - DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(ns::LCDD*,ns::json_h*,ns::ref_t*),__LINE__) } + DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(dd4hep::Detector*,ns::json_h*,ns::ref_t*),__LINE__) } #define DECLARE_XML_PROCESSOR(name,func) DECLARE_XML_PROCESSOR_BASIC(name,func,0) #define DECLARE_SUBDETECTOR(name,func) DECLARE_XML_PROCESSOR_BASIC(name,func,0) diff --git a/DDCore/include/DD4hep/FieldTypes.h b/DDCore/include/DD4hep/FieldTypes.h index 1b822c339..33c14da95 100644 --- a/DDCore/include/DD4hep/FieldTypes.h +++ b/DDCore/include/DD4hep/FieldTypes.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,154 +19,148 @@ #include <vector> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Implementation object of a field with constant strength + /** + * Generic constant uniform field + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class ConstantField : public CartesianField::Object { + public: + /// Field direction + Direction direction; + public: + /// Initializing constructor + ConstantField() = default; + /// Call to access the field components at a given location + virtual void fieldComponents(const double* /* pos */, double* field); + }; - /// Implementation object of a field with constant strength - /** - * Generic constant uniform field - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class ConstantField: public CartesianField::Object { - public: - /// Field direction - Direction direction; - public: - /// Initializing constructor - ConstantField() : direction() { } - /// Call to access the field components at a given location - virtual void fieldComponents(const double* /* pos */, double* field); - }; + /// Implementation object of a solenoidal magnetic field. + /** + * Generic solonoid magnetic field + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class SolenoidField : public CartesianField::Object { + public: + double innerField; + double outerField; + double minZ; + double maxZ; + double innerRadius; + double outerRadius; - /// Implementation object of a solenoidal magnetic field. - /** - * Generic solonoid magnetic field - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class SolenoidField: public CartesianField::Object { - public: - double innerField; - double outerField; - double minZ; - double maxZ; - double innerRadius; - double outerRadius; + public: + /// Initializing constructor + SolenoidField(); + /// Call to access the field components at a given location + virtual void fieldComponents(const double* pos, double* field); + }; - public: - /// Initializing constructor - SolenoidField(); - /// Call to access the field components at a given location - virtual void fieldComponents(const double* pos, double* field); - }; + /// Implementation object of a dipole magnetic field. + /** + * Generic dipole magnetic field + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class DipoleField : public CartesianField::Object { + public: + double zmax; + double zmin; + double rmax; + Coefficents coefficents; + public: + /// Initializing constructor + DipoleField(); + /// Call to access the field components at a given location + virtual void fieldComponents(const double* pos, double* field); + }; - /// Implementation object of a dipole magnetic field. - /** - * Generic dipole magnetic field - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class DipoleField: public CartesianField::Object { - public: - typedef std::vector<double> Coefficents; - double zmax; - double zmin; - double rmax; - Coefficents coefficents; - public: - /// Initializing constructor - DipoleField(); - /// Call to access the field components at a given location - virtual void fieldComponents(const double* pos, double* field); - }; + /// Implementation object of a Multipole magnetic field. + /** + * Generic multipole magnetic field using the + * Multipole approach. The dipole is assumed to be horizontal + * as it is used for bending beams in large colliders + * ie. the dipole field lines are vertical. + * + * The different momenta are given by: + * + * \f{eqnarray*}{ + * B_y + i*B_x &=& C_n * (x + iy)^{n-1} \\ + * B_sum = B_y + i B_x &=& Sum_{n=1..4} (b_n + ia_n) (x + iy)^{n-1} \\ + * \f} + * With C_n being the complex multipole coefficients and + * b_n the "normal multipole coefficients" and a_n the "skew multipole coefficients". + * + * The maximal momentum used is the octopole momentum. + * + * The lower momenta are: + * + * \li Dipole (n=1): + * \f{eqnarray*}{ + * B_y &=& b_1 \\ + * B_x &=& a_1 \\ + * B_z &=& constant \\ + * \f} + * + * \li Quadrupole (n=2): + * + * \f{eqnarray*}{ + * B_y &=& b_2 x - a_2 y \\ + * B_x &=& b_2 y + a_2 x \\ + * \f} + * + * \li Sextupole (n=3): + * + * \f{eqnarray*}{ + * B_y + i B_x &=& (b_3 +ia_3) (x^2 + 2ixy - y^2) \\ + * B_y &=& b_3 x^2 - b_3 y^2 - 2 a_3 xy \\ + * B_x &=& a_3 x^2 - a_3 y^2 + 2 b_3 xy \\ + * \f} + * + * \li Octopole (n=4): + * + * \f{eqnarray*}{ + * B_y + i B_x &=& (b_4 +ia_4) (x^3 + 3ix^2y - 3xy^2 -iy^3) \\ + * B_y &=& b_4 x^3 - 3 b_4 x y^2 - 3 a_4 x^2 y + a_4 y^3 \\ + * B_x &=& 3 b_4 x^2 y + b_4 y^3 + a_4 x^3 - 3 a_4 x y^2 \\ + * \f} + * + * The defined field components only apply within the shape 'volume'. + * If 'volume' is an invalid shape (ie. not defined), then the field + * components are valied throughout the 'universe'. + * + * \see http://cas.web.cern.ch/cas/Belgium-2009/Lectures/PDFs/Wolski-1.pdf + * \see http://cas.web.cern.ch/cas/Bulgaria-2010/Talks-web/Brandt-1-web.pdf + * \see https://en.wikipedia.org/wiki/Multipole_magnet + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class MultipoleField : public CartesianField::Object { + public: + Coefficents coefficents; + Coefficents skews; + Solid volume; + Transform3D transform; + double B_z; - /// Implementation object of a Multipole magnetic field. - /** - * Generic multipole magnetic field using the - * Multipole approach. The dipole is assumed to be horizontal - * as it is used for bending beams in large colliders - * ie. the dipole field lines are vertical. - * - * The different momenta are given by: - * - * \f{eqnarray*}{ - * B_y + i*B_x &=& C_n * (x + iy)^{n-1} \\ - * B_sum = B_y + i B_x &=& Sum_{n=1..4} (b_n + ia_n) (x + iy)^{n-1} \\ - * \f} - * With C_n being the complex multipole coefficients and - * b_n the "normal multipole coefficients" and a_n the "skew multipole coefficients". - * - * The maximal momentum used is the octopole momentum. - * - * The lower momenta are: - * - * \li Dipole (n=1): - * \f{eqnarray*}{ - * B_y &=& b_1 \\ - * B_x &=& a_1 \\ - * B_z &=& constant \\ - * \f} - * - * \li Quadrupole (n=2): - * - * \f{eqnarray*}{ - * B_y &=& b_2 x - a_2 y \\ - * B_x &=& b_2 y + a_2 x \\ - * \f} - * - * \li Sextupole (n=3): - * - * \f{eqnarray*}{ - * B_y + i B_x &=& (b_3 +ia_3) (x^2 + 2ixy - y^2) \\ - * B_y &=& b_3 x^2 - b_3 y^2 - 2 a_3 xy \\ - * B_x &=& a_3 x^2 - a_3 y^2 + 2 b_3 xy \\ - * \f} - * - * \li Octopole (n=4): - * - * \f{eqnarray*}{ - * B_y + i B_x &=& (b_4 +ia_4) (x^3 + 3ix^2y - 3xy^2 -iy^3) \\ - * B_y &=& b_4 x^3 - 3 b_4 x y^2 - 3 a_4 x^2 y + a_4 y^3 \\ - * B_x &=& 3 b_4 x^2 y + b_4 y^3 + a_4 x^3 - 3 a_4 x y^2 \\ - * \f} - * - * The defined field components only apply within the shape 'volume'. - * If 'volume' is an invalid shape (ie. not defined), then the field - * components are valied throughout the 'universe'. - * - * \see http://cas.web.cern.ch/cas/Belgium-2009/Lectures/PDFs/Wolski-1.pdf - * \see http://cas.web.cern.ch/cas/Bulgaria-2010/Talks-web/Brandt-1-web.pdf - * \see https://en.wikipedia.org/wiki/Multipole_magnet - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class MultipoleField: public CartesianField::Object { - public: - typedef std::vector<double> Coefficents; - Coefficents coefficents; - Coefficents skews; - Solid volume; - Transform3D transform; - double B_z; + public: + /// Initializing constructor + MultipoleField(); + /// Call to access the field components at a given location + virtual void fieldComponents(const double* pos, double* field); + }; - public: - /// Initializing constructor - MultipoleField(); - /// Call to access the field components at a given location - virtual void fieldComponents(const double* pos, double* field); - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_FIELDTYPES_H */ diff --git a/DDCore/include/DD4hep/Fields.h b/DDCore/include/DD4hep/Fields.h index cb39eb5cc..8f74338b5 100644 --- a/DDCore/include/DD4hep/Fields.h +++ b/DDCore/include/DD4hep/Fields.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,225 +22,216 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - typedef Position Direction; +namespace dd4hep { + + // Forward declarations + typedef Position Direction; + + /// Base class describing any field with 3D cartesian vectors for the field strength. + /** Abstract base class describing any field (electric or magnetic) with 3D cartesian vectors + * for the field strength and positions. + * Implementation classes need to overwrite void fieldComponents(const double* pos, double* field). + * The actual behaviour is solely implemented in the underlying object class. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class CartesianField: public Handle<NamedObject> { + public: + enum FieldType { + UNKNOWN = 0, ELECTRIC = 0x1, MAGNETIC = 0x2 + }; + typedef std::map<std::string, std::map<std::string, std::string> > Properties; - /// Base class describing any field with 3D cartesian vectors for the field strength. - /** Abstract base class describing any field (electric or magnetic) with 3D cartesian vectors - * for the field strength and positions. - * Implementation classes need to overwrite void fieldComponents(const double* pos, double* field). - * The actual behaviour is solely implemented in the underlying object class. - * + /// detaill data class shared by all handles of a given type + /** * \author M.Frank * \version 1.0 * \ingroup DD4HEP_GEOMETRY */ - class CartesianField: public Ref_t { + class Object: public NamedObject { public: - enum FieldType { - UNKNOWN = 0, ELECTRIC = 0x1, MAGNETIC = 0x2 - }; - typedef std::map<std::string, std::string> PropertyValues; - typedef std::map<std::string, PropertyValues> Properties; - - /// Internal data class shared by all handles of a given type - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Object: public NamedObject { - public: - /// Field type - int type; - /// Field extensions - Properties properties; - /// Default constructor - Object(); - /// Default destructor - virtual ~Object(); - - /** Overwrite to compute the field components at a given location - - * NB: The field components have to be added to the provided - * field vector in order to allow for superposition of the fields. - */ - virtual void fieldComponents(const double* pos, double* field) = 0; - }; - + /// Utility definition for concrete implementations + typedef std::vector<double> Coefficents; + /// Field type + int type; + /// Field extensions + Properties properties; /// Default constructor - CartesianField() = default; - - /// Constructor to be used when reading the already parsed DOM tree - CartesianField(const CartesianField& e) = default; - - /// Constructor to be used when reading the already parsed DOM tree - template <typename Q> CartesianField(const Handle<Q>& e) : Ref_t(e) { - } - - /// Assignment operator - CartesianField& operator=(const CartesianField& f) = default; - - /// Access the field type - int fieldType() const { - return data<Object>()->type; - } + Object(); + /// Default destructor + virtual ~Object(); - /// Access the field type (string) - const char* type() const; - - /// Does the field change the energy of charged particles? - bool changesEnergy() const; - - /// Returns the 3 field components (x, y, z). - void value(const Position& pos, Direction& field) const; // { value(pos,&field.x); } - - /// Returns the 3 field components (x, y, z). - void value(const Position& pos, double* val) const; // { value(&pos.x,val); } - - /// Returns the 3 field components (x, y, z). - void value(const double* pos, double* val) const; - - /// Access to properties container - Properties& properties() const; + /** Overwrite to compute the field components at a given location - + * NB: The field components have to be added to the provided + * field vector in order to allow for superposition of the fields. + */ + virtual void fieldComponents(const double* pos, double* field) = 0; }; - typedef CartesianField ElectricField; - typedef CartesianField MagneticField; + /// Default constructor + CartesianField() = default; + + /// Constructor to be used when reading the already parsed DOM tree + CartesianField(const CartesianField& e) = default; + + /// Constructor to be used when reading the already parsed DOM tree + template <typename Q> CartesianField(const Handle<Q>& e) : Ref_t(e) { + } + + /// Assignment operator + CartesianField& operator=(const CartesianField& f) = default; + + /// Access the field type + int fieldType() const { + return data<Object>()->type; + } + + /// Access the field type (string) + const char* type() const; + + /// Does the field change the energy of charged particles? + bool changesEnergy() const; + + /// Returns the 3 field components (x, y, z). + void value(const Position& pos, Direction& field) const; // { value(pos,&field.x); } + + /// Returns the 3 field components (x, y, z). + void value(const Position& pos, double* val) const; // { value(&pos.x,val); } + + /// Returns the 3 field components (x, y, z). + void value(const double* pos, double* val) const; + + /// Access to properties container + Properties& properties() const; + }; + + /// Class describing a field overlay with several sources + /** + * Generic structure describing any field type (electric or magnetic) + * with field components in Cartesian coordinates. + * + * The actual behaviour is solely implemented in the underlying object + * classes. The overlay field is the sum of several magnetic of electric + * field components. + * + * The resulting field vectors are computed by the vector addition + * of the individual components. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class OverlayedField: public Handle<NamedObject> { + public: + enum FieldType { + ELECTRIC = 0x1, MAGNETIC = 0x2 + }; + typedef std::map<std::string, std::string> PropertyValues; + typedef std::map<std::string, PropertyValues> Properties; - /// Class describing a field overlay with several sources + /// detaill data class shared by all handles /** - * Generic structure describing any field type (electric or magnetic) - * with field components in Cartesian coordinates. - * - * The actual behaviour is solely implemented in the underlying object - * classes. The overlay field is the sum of several magnetic of electric - * field components. - * - * The resulting field vectors are computed by the vector addition - * of the individual components. - * * \author M.Frank * \version 1.0 * \ingroup DD4HEP_GEOMETRY */ - class OverlayedField: public Ref_t { + class Object: public NamedObject { public: - enum FieldType { - ELECTRIC = 0x1, MAGNETIC = 0x2 - }; - typedef std::map<std::string, std::string> PropertyValues; - typedef std::map<std::string, PropertyValues> Properties; - - /// Internal data class shared by all handles - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Object: public NamedObject { - public: - int type; - DD4hep::Geometry::CartesianField electric; - DD4hep::Geometry::CartesianField magnetic; - std::vector<DD4hep::Geometry::CartesianField> electric_components; - std::vector<DD4hep::Geometry::CartesianField> magnetic_components; - /// Field extensions - Properties properties; - /// Default constructor - Object(); - /// Default destructor - virtual ~Object(); - }; - + int type; + CartesianField electric; + CartesianField magnetic; + std::vector<CartesianField> electric_components; + std::vector<CartesianField> magnetic_components; + /// Field extensions + Properties properties; /// Default constructor - OverlayedField() = default; - - /// Constructor to be used when reading the already parsed DOM tree - template <typename Q> OverlayedField(const Handle<Q>& e) : Ref_t(e) { } - - /// Object constructor - OverlayedField(const std::string& name); - - /// Access the field type - int type() const { - return data<Object>()->type; - } - - /// Does the field change the energy of charged particles? - bool changesEnergy() const; - - /// Add a new field component - void add(CartesianField field); - - /// Returns the 3 electric field components (x, y, z) if many components are present - void combinedElectric(const Position& pos, double* field) const { - combinedElectric((const double*) &pos, field); - } - - /// Returns the 3 electric field components (x, y, z) if many components are present - void combinedElectric(const double* pos, double* field) const; - - /// Returns the 3 magnetic field components (x, y, z) if many components are present - void combinedMagnetic(const Position& pos, double* field) const { - combinedMagnetic((const double*) &pos, field); - } - - /// Returns the 3 magnetic field components (x, y, z) if many components are present - void combinedMagnetic(const double* pos, double* field) const; - - /// Returns the 3 electric field components (x, y, z). - void electricField(const Position& pos, Direction& field) const { - electricField((const double*) &pos, (double*) &field); - } - - /// Returns the 3 electric field components (x, y, z). - void electricField(const Position& pos, double* field) const { - electricField((double*) &pos, field); - } - - /// Returns the 3 electric field components (x, y, z). - void electricField(const double* pos, double* field) const { - field[0] = field[1] = field[2] = 0.0; - CartesianField f = data<Object>()->electric; - f.isValid() ? f.value(pos, field) : combinedElectric(pos, field); - } - - /// Returns the 3 magnetic field components (x, y, z). - void magneticField(const Position& pos, Direction& field) const { - magneticField((double*) &pos, (double*) &field); - } - - /// Returns the 3 magnetic field components (x, y, z). - void magneticField(const Position& pos, double* field) const { - magneticField((double*) &pos, field); - } - - /// Returns the 3 magnetic field components (x, y, z). - void magneticField(const double* pos, double* field) const { - field[0] = field[1] = field[2] = 0.0; - CartesianField f = data<Object>()->magnetic; - f.isValid() ? f.value(pos, field) : combinedMagnetic(pos, field); - } - - /// Returns the 3 electric (val[0]-val[2]) and magnetic field components (val[3]-val[5]). - void electromagneticField(const Position& pos, double* val) const { - electromagneticField((double*) &pos, val); - } - - /// Returns the 3 electric (val[0]-val[2]) and magnetic field components (val[3]-val[5]). - void electromagneticField(const double* pos, double* val) const; - - /// Access to properties container - Properties& properties() const; + Object(); + /// Default destructor + virtual ~Object(); }; - typedef OverlayedField ElectroMagneticField; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + /// Default constructor + OverlayedField() = default; + + /// Constructor to be used when reading the already parsed DOM tree + template <typename Q> OverlayedField(const Handle<Q>& e) : Ref_t(e) { } + + /// Object constructor + OverlayedField(const std::string& name); + + /// Access the field type + int type() const { + return data<Object>()->type; + } + + /// Does the field change the energy of charged particles? + bool changesEnergy() const; + + /// Add a new field component + void add(CartesianField field); + + /// Returns the 3 electric field components (x, y, z) if many components are present + void combinedElectric(const Position& pos, double* field) const { + combinedElectric((const double*) &pos, field); + } + + /// Returns the 3 electric field components (x, y, z) if many components are present + void combinedElectric(const double* pos, double* field) const; + + /// Returns the 3 magnetic field components (x, y, z) if many components are present + void combinedMagnetic(const Position& pos, double* field) const { + combinedMagnetic((const double*) &pos, field); + } + + /// Returns the 3 magnetic field components (x, y, z) if many components are present + void combinedMagnetic(const double* pos, double* field) const; + + /// Returns the 3 electric field components (x, y, z). + void electricField(const Position& pos, Direction& field) const { + electricField((const double*) &pos, (double*) &field); + } + + /// Returns the 3 electric field components (x, y, z). + void electricField(const Position& pos, double* field) const { + electricField((double*) &pos, field); + } + + /// Returns the 3 electric field components (x, y, z). + void electricField(const double* pos, double* field) const { + field[0] = field[1] = field[2] = 0.0; + CartesianField f = data<Object>()->electric; + f.isValid() ? f.value(pos, field) : combinedElectric(pos, field); + } + + /// Returns the 3 magnetic field components (x, y, z). + void magneticField(const Position& pos, Direction& field) const { + magneticField((double*) &pos, (double*) &field); + } + + /// Returns the 3 magnetic field components (x, y, z). + void magneticField(const Position& pos, double* field) const { + magneticField((double*) &pos, field); + } + + /// Returns the 3 magnetic field components (x, y, z). + void magneticField(const double* pos, double* field) const { + field[0] = field[1] = field[2] = 0.0; + CartesianField f = data<Object>()->magnetic; + f.isValid() ? f.value(pos, field) : combinedMagnetic(pos, field); + } + + /// Returns the 3 electric (val[0]-val[2]) and magnetic field components (val[3]-val[5]). + void electromagneticField(const Position& pos, double* val) const { + electromagneticField((double*) &pos, val); + } + + /// Returns the 3 electric (val[0]-val[2]) and magnetic field components (val[3]-val[5]). + void electromagneticField(const double* pos, double* val) const; + + /// Access to properties container + Properties& properties() const; + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_FIELDS_H */ diff --git a/DDCore/include/DD4hep/GeoHandler.h b/DDCore/include/DD4hep/GeoHandler.h index e9223297b..893ab558b 100644 --- a/DDCore/include/DD4hep/GeoHandler.h +++ b/DDCore/include/DD4hep/GeoHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ #ifndef DD4HEP_GEOHANDLER_H #define DD4HEP_GEOHANDLER_H -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include <set> #include <map> #include <vector> @@ -26,20 +26,19 @@ class TGeoShape; class TGeoNode; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations + class Detector; class NamedObject; + class DetElement; + class SensitiveDetector; + class VisAttrObject; + class Volume; + class PlacedVolume; - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - class LCDD; - class Volume; - class PlacedVolume; - class DetElement; - class SensitiveDetector; - class VisAttrObject; + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { /// Defintion of the object types used by generic geometry handlers /** @@ -49,24 +48,17 @@ namespace DD4hep { */ class GeoHandlerTypes { public: - typedef std::set<Volume> VolumeSet; - typedef std::vector<Volume> VolumeVector; +#if 0 typedef std::set<const TGeoVolume*> ConstVolumeSet; - typedef std::vector<std::pair<std::string, TGeoMatrix*> > TransformSet; - typedef std::set<TGeoShape*> SolidSet; - typedef std::set<Material> MaterialSet; typedef std::map<SensitiveDetector, ConstVolumeSet> SensitiveVolumes; - typedef std::map<Region, ConstVolumeSet> RegionVolumes; - typedef std::map<LimitSet, ConstVolumeSet> LimitVolumes; - typedef std::map<int, std::set<const TGeoNode*> > Data; - typedef std::set<VisAttr> VisRefs; - typedef std::set<SensitiveDetector> SensitiveDetectorSet; - typedef std::set<Region> RegionSet; - typedef std::set<LimitSet> LimitSetSet; - typedef std::set<Ref_t> Fields; - typedef std::set<TNamed*> ObjectSet; - typedef LCDD::HandleMap DefinitionSet; - + typedef std::map<Region, ConstVolumeSet> RegionVolumes; + typedef std::map<LimitSet, ConstVolumeSet> LimitVolumes; + typedef std::map<int, std::set<const TGeoNode*> > Data; + typedef std::set<SensitiveDetector> SensitiveDetectorSet; + typedef std::set<Region> RegionSet; + typedef std::set<LimitSet> LimitSetSet; + typedef std::set<TNamed*> ObjectSet; +#endif /// Data container /** * \author M.Frank @@ -75,19 +67,19 @@ namespace DD4hep { */ class GeometryInfo { public: - SolidSet solids; - VolumeSet volumeSet; - VolumeVector volumes; - TransformSet trafos; - VisRefs vis; - Fields fields; - MaterialSet materials; + std::set<TGeoShape*> solids; + std::set<Volume> volumeSet; + std::vector<Volume> volumes; + std::vector<std::pair<std::string, TGeoMatrix*> > trafos; + std::set<VisAttr> vis; + std::set<Ref_t> fields; + std::set<Material> materials; std::set<TGeoMedium*> media; std::set<TGeoElement*> elements; }; }; - /// The base class for all DD4hep geometry crawlers + /// The base class for all dd4hep geometry crawlers /** * Geometry crawlers are used for multiple purposes, whenever entire * geometries must be traversed like e.g. to create a new geometry @@ -103,9 +95,9 @@ namespace DD4hep { protected: bool m_propagateRegions; - Data* m_data; + std::map<int, std::set<const TGeoNode*> >* m_data; - /// Internal helper to collect geometry information from traversal + /// detaill helper to collect geometry information from traversal GeoHandler& i_collect(const TGeoNode* node, int level, Region rg, LimitSet ls); private: @@ -121,7 +113,7 @@ namespace DD4hep { /// Default constructor GeoHandler(); /// Initializing constructor - GeoHandler(Data* ptr); + GeoHandler(std::map<int, std::set<const TGeoNode*> >* ptr); /// Default destructor virtual ~GeoHandler(); /// Propagate regions. Returns the previous value @@ -131,7 +123,7 @@ namespace DD4hep { /// Collect geometry information from traversal with aggregated information GeoHandler& collect(DetElement top, GeometryInfo& info); /// Access to collected node list - Data* release(); + std::map<int, std::set<const TGeoNode*> >* release(); }; /// Geometry scanner (handle object) @@ -143,7 +135,7 @@ namespace DD4hep { class GeoScan { protected: /// Data holder - GeoHandler::Data* m_data; + std::map<int, std::set<const TGeoNode*> >* m_data; public: /// Initializing constructor GeoScan(DetElement e); @@ -154,7 +146,7 @@ namespace DD4hep { /// Work callback virtual GeoScan& operator()(); }; - } // End namespace Geometry -} // End namespace DD4hep + } // End namespace detail +} // End namespace dd4hep #endif // DD4HEP_GEOHANDLER_H diff --git a/DDCore/include/DD4hep/GlobalAlignment.h b/DDCore/include/DD4hep/GlobalAlignment.h index 59d51ade5..96cd07c44 100644 --- a/DDCore/include/DD4hep/GlobalAlignment.h +++ b/DDCore/include/DD4hep/GlobalAlignment.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ #include "TGeoPhysicalNode.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Alignments { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace align { /// Main handle class to hold a TGeo alignment object of type TGeoPhysicalNode /** @@ -36,20 +36,13 @@ namespace DD4hep { * \ingroup DD4HEP_ALIGN */ class GlobalAlignment : public Handle<TGeoPhysicalNode> { - - typedef Geometry::RotationZYX RotationZYX; - typedef Geometry::Transform3D Transform3D; - typedef Geometry::Position Position; - public: /// Default constructor - GlobalAlignment(); + GlobalAlignment() = default; /// Default constructor - GlobalAlignment(TGeoPhysicalNode* p) - : Handle<TGeoPhysicalNode>(p) { - } + GlobalAlignment(TGeoPhysicalNode* p) : Handle<TGeoPhysicalNode>(p) {} /// Copy constructor - GlobalAlignment(const GlobalAlignment& c); + GlobalAlignment(const GlobalAlignment& c) = default; /// Constructor to be used when reading the already parsed object template <typename Q> GlobalAlignment(const Handle<Q>& e) : Handle<TGeoPhysicalNode>(e) { @@ -57,7 +50,7 @@ namespace DD4hep { /// Initializing constructor GlobalAlignment(const std::string& path); /// Assignment operator - GlobalAlignment& operator=(const GlobalAlignment& c); + GlobalAlignment& operator=(const GlobalAlignment& c) = default; /// Number of nodes in this branch (=depth of the placement hierarchy from the top level volume) int numNodes() const; /// Access the placement of this node @@ -89,7 +82,7 @@ namespace DD4hep { Transform3D invDelta() const; }; - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGNMENT_GLOBALALIGNMENT_H */ diff --git a/DDCore/include/DD4hep/GridPhiEta.h b/DDCore/include/DD4hep/GridPhiEta.h index 4b06a5a32..9c998af02 100644 --- a/DDCore/include/DD4hep/GridPhiEta.h +++ b/DDCore/include/DD4hep/GridPhiEta.h @@ -1,3 +1,17 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// \author A. Zaborowska +// \date 2016-10-18 +// \version 1.0 +// +//========================================================================== #ifndef DD4HEP_DDCORE_GRIDPHIETA_H #define DD4HEP_DDCORE_GRIDPHIETA_H 1 @@ -7,110 +21,98 @@ #include "DD4hep/detail/SegmentationsInterna.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - -/// Namespace for base segmentations - -/// Namespace for the geometry part of the AIDA detector description toolkit -namespace Geometry { - -// Forward declarations -class Segmentation; -template <typename T> -class SegmentationWrapper; - -/// We need some abbreviation to make the code more readable. -typedef Handle<SegmentationWrapper<DDSegmentation::GridPhiEta>> GridPhiEtaHandle; - -/// Implementation class for the grid phi-eta segmentation. -/** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author A. Zaborowska - * \version 1.0 - */ -class GridPhiEta : public GridPhiEtaHandle { -public: - /// Default constructor - GridPhiEta() = default; - /// Copy constructor - GridPhiEta(const GridPhiEta& e) = default; - /// Copy Constructor from segmentation base object - GridPhiEta(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - GridPhiEta(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> - GridPhiEta(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - GridPhiEta& operator=(const GridPhiEta& seg) = default; - /// Equality operator - bool operator==(const GridPhiEta& seg) const { return m_element == seg.m_element; } - /// determine the position based on the cell ID - inline Position position(const CellID& id) const { return Position(access()->implementation->position(id)); } - - /// determine the cell ID based on the position - inline DD4hep::CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const { - return access()->implementation->cellID(local, global, volID); - } - - /// access the grid size in Eta - inline double gridSizeEta() const { return access()->implementation->gridSizeEta(); } - - /// access the grid size in Phi - inline int phiBins() const { return access()->implementation->phiBins(); } - - /// access the coordinate offset in Eta - inline double offsetEta() const { return access()->implementation->offsetEta(); } - - /// access the coordinate offset in Phi - inline double offsetPhi() const { return access()->implementation->offsetPhi(); } - - /// set the coordinate offset in Eta - inline void setOffsetEta(double offset) const { access()->implementation->setOffsetEta(offset); } - - /// set the coordinate offset in Phi - inline void setOffsetPhi(double offset) const { access()->implementation->setOffsetPhi(offset); } - - /// set the grid size in Eta - inline void setGridSizeEta(double cellSize) const { access()->implementation->setGridSizeEta(cellSize); } - - /// set the grid size in Phi - inline void setPhiBins(int cellSize) const { access()->implementation->setPhiBins(cellSize); } - - /// access the field name used for Eta - inline const std::string& fieldNameEta() const { return access()->implementation->fieldNameEta(); } - - /// access the field name used for Phi - inline const std::string& fieldNamePhi() const { return access()->implementation->fieldNamePhi(); } - - /** \brief Returns a std::vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions (dPhi, dEta) - - Returns a std::vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in phi - -# size in eta - */ - inline std::vector<double> cellDimensions(const CellID& /*id*/) const { - return {access()->implementation->gridSizePhi(), access()->implementation->gridSizeEta()}; - } -}; - -} /* End namespace Geometry */ -} /* End namespace DD4hep */ +namespace dd4hep { + + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::GridPhiEta>> GridPhiEtaHandle; + + /// Implementation class for the grid phi-eta segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author A. Zaborowska + * \version 1.0 + */ + class GridPhiEta : public GridPhiEtaHandle { + public: + /// Default constructor + GridPhiEta() = default; + /// Copy constructor + GridPhiEta(const GridPhiEta& e) = default; + /// Copy Constructor from segmentation base object + GridPhiEta(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + GridPhiEta(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> + GridPhiEta(const Handle<Q>& e) : Handle<Object>(e) {} + /// Assignment operator + GridPhiEta& operator=(const GridPhiEta& seg) = default; + /// Equality operator + bool operator==(const GridPhiEta& seg) const { return m_element == seg.m_element; } + /// determine the position based on the cell ID + inline Position position(const CellID& id) const { return Position(access()->implementation->position(id)); } + + /// determine the cell ID based on the position + inline dd4hep::CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const { + return access()->implementation->cellID(local, global, volID); + } + + /// access the grid size in Eta + inline double gridSizeEta() const { return access()->implementation->gridSizeEta(); } + + /// access the grid size in Phi + inline int phiBins() const { return access()->implementation->phiBins(); } + + /// access the coordinate offset in Eta + inline double offsetEta() const { return access()->implementation->offsetEta(); } + + /// access the coordinate offset in Phi + inline double offsetPhi() const { return access()->implementation->offsetPhi(); } + + /// set the coordinate offset in Eta + inline void setOffsetEta(double offset) const { access()->implementation->setOffsetEta(offset); } + + /// set the coordinate offset in Phi + inline void setOffsetPhi(double offset) const { access()->implementation->setOffsetPhi(offset); } + + /// set the grid size in Eta + inline void setGridSizeEta(double cellSize) const { access()->implementation->setGridSizeEta(cellSize); } + + /// set the grid size in Phi + inline void setPhiBins(int cellSize) const { access()->implementation->setPhiBins(cellSize); } + + /// access the field name used for Eta + inline const std::string& fieldNameEta() const { return access()->implementation->fieldNameEta(); } + + /// access the field name used for Phi + inline const std::string& fieldNamePhi() const { return access()->implementation->fieldNamePhi(); } + + /** \brief Returns a std::vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions (dPhi, dEta) + + Returns a std::vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 2: + -# size in phi + -# size in eta + */ + inline std::vector<double> cellDimensions(const CellID& /*id*/) const { + return {access()->implementation->gridSizePhi(), access()->implementation->gridSizeEta()}; + } + }; +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_POLARGRIDRPHI_H diff --git a/DDCore/include/DD4hep/GridRPhiEta.h b/DDCore/include/DD4hep/GridRPhiEta.h index 50825258b..bbe30fdf6 100644 --- a/DDCore/include/DD4hep/GridRPhiEta.h +++ b/DDCore/include/DD4hep/GridRPhiEta.h @@ -1,134 +1,136 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// \author A. Zaborowska +// \date 2016-10-18 +// \version 1.0 +// +//========================================================================== #ifndef DD4HEP_DDCORE_GRIDRPHIETA_H #define DD4HEP_DDCORE_GRIDRPHIETA_H 1 // Framework includes -#include "DDSegmentation/GridRPhiEta.h" #include "DD4hep/Segmentations.h" +#include "DDSegmentation/GridRPhiEta.h" #include "DD4hep/detail/SegmentationsInterna.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - -/// Namespace for base segmentations - -/// Namespace for the geometry part of the AIDA detector description toolkit -namespace Geometry { - -// Forward declarations -class Segmentation; -template <typename T> -class SegmentationWrapper; - -/// We need some abbreviation to make the code more readable. -typedef Handle<SegmentationWrapper<DDSegmentation::GridRPhiEta>> GridRPhiEtaHandle; - -/// Implementation class for the grid phi-eta segmentation. -/** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author A. Zaborowska - * \version 1.0 - */ -class GridRPhiEta : public GridRPhiEtaHandle { -public: - /// Default constructor - GridRPhiEta() = default; - /// Copy constructor - GridRPhiEta(const GridRPhiEta& e) = default; - /// Copy Constructor from segmentation base object - GridRPhiEta(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - GridRPhiEta(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> - GridRPhiEta(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - GridRPhiEta& operator=(const GridRPhiEta& seg) = default; - /// Equality operator - bool operator==(const GridRPhiEta& seg) const { return m_element == seg.m_element; } - /// determine the position based on the cell ID - inline Position position(const CellID& id) const { return Position(access()->implementation->position(id)); } - - /// determine the cell ID based on the position - inline DD4hep::CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const { - return access()->implementation->cellID(local, global, volID); - } - - /// access the grid size in Eta - inline double gridSizeEta() const { return access()->implementation->gridSizeEta(); } - - /// access the grid size in Phi - inline int phiBins() const { return access()->implementation->phiBins(); } - - /// access the grid size in Phi - inline double gridSizeR() const { return access()->implementation->gridSizeR(); } - - /// access the coordinate offset in R - inline double offsetR() const { return access()->implementation->offsetR(); } - - /// access the coordinate offset in Eta - inline double offsetEta() const { return access()->implementation->offsetEta(); } - - /// access the coordinate offset in Phi - inline double offsetPhi() const { return access()->implementation->offsetPhi(); } - - /// set the coordinate offset in R - inline void setOffsetEta(double offset) const { access()->implementation->setOffsetEta(offset); } - - /// set the coordinate offset in Phi - inline void setOffsetR(double offset) const { access()->implementation->setOffsetR(offset); } - - /// set the coordinate offset in Phi - inline void setOffsetPhi(double offset) const { access()->implementation->setOffsetPhi(offset); } - - /// set the grid size in Eta - inline void setGridSizeEta(double cellSize) const { access()->implementation->setGridSizeEta(cellSize); } - - /// set the grid size in R - inline void setGridSizeR(double cellSize) const { access()->implementation->setGridSizeR(cellSize); } - - /// set the grid size in Phi - inline void setPhiBins(int cellSize) const { access()->implementation->setPhiBins(cellSize); } - - /// access the field name used for R - inline const std::string& fieldNameR() const { return access()->implementation->fieldNameR(); } - - /// access the field name used for Eta - inline const std::string& fieldNameEta() const { return access()->implementation->fieldNameEta(); } - - /// access the field name used for Phi - inline const std::string& fieldNamePhi() const { return access()->implementation->fieldNamePhi(); } - - /** \brief Returns a std::vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions (dR, dPhi, dEta) - - Returns a std::vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 3: - -# size in r - -# size in phi - -# size in eta - */ - inline std::vector<double> cellDimensions(const CellID& /*id*/) const { - return {access()->implementation->gridSizeR(), - access()->implementation->gridSizePhi(), - access()->implementation->gridSizeEta()}; - } -}; - -} /* End namespace Geometry */ -} /* End namespace DD4hep */ +namespace dd4hep { + + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::GridRPhiEta>> GridRPhiEtaHandle; + + /// Implementation class for the grid phi-eta segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author A. Zaborowska + * \version 1.0 + */ + class GridRPhiEta : public GridRPhiEtaHandle { + public: + /// Default constructor + GridRPhiEta() = default; + /// Copy constructor + GridRPhiEta(const GridRPhiEta& e) = default; + /// Copy Constructor from segmentation base object + GridRPhiEta(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + GridRPhiEta(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> + GridRPhiEta(const Handle<Q>& e) : Handle<Object>(e) {} + /// Assignment operator + GridRPhiEta& operator=(const GridRPhiEta& seg) = default; + /// Equality operator + bool operator==(const GridRPhiEta& seg) const { return m_element == seg.m_element; } + /// determine the position based on the cell ID + inline Position position(const CellID& id) const { return Position(access()->implementation->position(id)); } + + /// determine the cell ID based on the position + inline dd4hep::CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const { + return access()->implementation->cellID(local, global, volID); + } + + /// access the grid size in Eta + inline double gridSizeEta() const { return access()->implementation->gridSizeEta(); } + + /// access the grid size in Phi + inline int phiBins() const { return access()->implementation->phiBins(); } + + /// access the grid size in Phi + inline double gridSizeR() const { return access()->implementation->gridSizeR(); } + + /// access the coordinate offset in R + inline double offsetR() const { return access()->implementation->offsetR(); } + + /// access the coordinate offset in Eta + inline double offsetEta() const { return access()->implementation->offsetEta(); } + + /// access the coordinate offset in Phi + inline double offsetPhi() const { return access()->implementation->offsetPhi(); } + + /// set the coordinate offset in R + inline void setOffsetEta(double offset) const { access()->implementation->setOffsetEta(offset); } + + /// set the coordinate offset in Phi + inline void setOffsetR(double offset) const { access()->implementation->setOffsetR(offset); } + + /// set the coordinate offset in Phi + inline void setOffsetPhi(double offset) const { access()->implementation->setOffsetPhi(offset); } + + /// set the grid size in Eta + inline void setGridSizeEta(double cellSize) const { access()->implementation->setGridSizeEta(cellSize); } + + /// set the grid size in R + inline void setGridSizeR(double cellSize) const { access()->implementation->setGridSizeR(cellSize); } + + /// set the grid size in Phi + inline void setPhiBins(int cellSize) const { access()->implementation->setPhiBins(cellSize); } + + /// access the field name used for R + inline const std::string& fieldNameR() const { return access()->implementation->fieldNameR(); } + + /// access the field name used for Eta + inline const std::string& fieldNameEta() const { return access()->implementation->fieldNameEta(); } + + /// access the field name used for Phi + inline const std::string& fieldNamePhi() const { return access()->implementation->fieldNamePhi(); } + + /** \brief Returns a std::vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions (dR, dPhi, dEta) + + Returns a std::vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 3: + -# size in r + -# size in phi + -# size in eta + */ + inline std::vector<double> cellDimensions(const CellID& /*id*/) const { + return {access()->implementation->gridSizeR(), + access()->implementation->gridSizePhi(), + access()->implementation->gridSizeEta()}; + } + }; +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_GRIDRPHIETA_H diff --git a/DDCore/include/DD4hep/Handle.h b/DDCore/include/DD4hep/Handle.h index 000c73ddf..f3d651b23 100644 --- a/DDCore/include/DD4hep/Handle.h +++ b/DDCore/include/DD4hep/Handle.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -40,7 +40,7 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class NamedObject; @@ -59,7 +59,7 @@ namespace DD4hep { /// Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects. /** - * The Handle is the base class to access all objects in DD4hep. + * The Handle is the base class to access all objects in dd4hep. * Objects, which consist ONLY of data are NEVER passed directly. * They are ALWAYS passed using handles. Such handles are 'handy' ;-). * Assignment is to and from different handles is possible using concrete @@ -89,36 +89,34 @@ namespace DD4hep { /** Type definitions and class specific abbreviations and forward declarations */ /// Extern accessible definition of the contained element type typedef T Object; - /// Declaration of 'self' - typedef Handle<Object> handle_t; /// Single and only data member: Reference to the actual element. T* m_element = 0; /// Defaulot constructor Handle() = default; /// Copy constructor - Handle(const Handle<T>& e) = default; + Handle(const Handle<T>& element) = default; /// Initializing constructor from pointer - Handle(T* e) : m_element(e) { } + Handle(T* element) : m_element(element) { } /// Initializing constructor from unrelated pointer with type checking - template <typename Q> Handle(Q* e) : m_element((T*)e) + template <typename Q> Handle(Q* element) : m_element((T*)element) { verifyObject(); } /// Initializing constructor from unrelated handle with type checking - template <typename Q> Handle(const Handle<Q>& e) : m_element((T*)e.m_element) + template <typename Q> Handle(const Handle<Q>& element) : m_element((T*)element.m_element) { verifyObject(); } /// Assignment operator - Handle<T>& operator=(const Handle<T>& e) = default; + Handle<T>& operator=(const Handle<T>& element) = default; /// Boolean operator == used for RB tree insertions - bool operator==(const Handle<T>& e) const { - return m_element == e.m_element; + bool operator==(const Handle<T>& element) const { + return m_element == element.m_element; } /// Boolean operator < used for RB tree insertions - bool operator<(const Handle<T>& e) const { - return m_element < e.m_element; + bool operator<(const Handle<T>& element) const { + return m_element < element.m_element; } /// Boolean operator > used for RB tree insertions - bool operator>(const Handle<T>& e) const { - return m_element > e.m_element; + bool operator>(const Handle<T>& element) const { + return m_element > element.m_element; } /// Check the validity of the object held by the handle bool isValid() const { @@ -176,59 +174,60 @@ namespace DD4hep { }; /// Default Ref_t definition describing named objects \ingroup DD4HEP_GEOMETRY typedef Handle<NamedObject> Ref_t; + namespace detail { + /// Helper to delete objects from heap and reset the handle \ingroup DD4HEP_GEOMETRY + template <typename T> inline void destroyHandle(T& handle) { + deletePtr(handle.m_element); + } + /// Functor to destroy handles and delete the cached object \ingroup DD4HEP_GEOMETRY + template <typename T> class DestroyHandle { + public: + void operator()(T ptr) const { destroyHandle(ptr); } + }; + /// map Functor to destroy handles and delete the cached object \ingroup DD4HEP_GEOMETRY + template <typename M> class DestroyHandles { + public: + /// Container reference + M& object; + /// Initializing constructor + DestroyHandles(M& obj) : object(obj) { } + /// Action operator + void operator()(const std::pair<typename M::key_type, typename M::mapped_type>& arg) const + { DestroyHandle<typename M::mapped_type>()(arg.second); } + }; + /// Functional created of map destruction functors + template <typename M> void destroyHandles(M& arg) { + for_each(arg.begin(), arg.end(), DestroyHandles<M>(arg)); + arg.clear(); + } - /// Helper to delete objects from heap and reset the handle \ingroup DD4HEP_GEOMETRY - template <typename T> inline void destroyHandle(T& h) { - deletePtr(h.m_element); - } - /// Functor to destroy handles and delete the cached object \ingroup DD4HEP_GEOMETRY - template <typename T> class DestroyHandle { - public: - void operator()(T p) const { destroyHandle(p); } - }; - /// map Functor to destroy handles and delete the cached object \ingroup DD4HEP_GEOMETRY - template <typename M> class DestroyHandles { - public: - /// Container reference - M& object; - /// Initializing constructor - DestroyHandles(M& m) : object(m) { } - /// Action operator - void operator()(const std::pair<typename M::key_type, typename M::mapped_type>& p) const - { DestroyHandle<typename M::mapped_type>()(p.second); } - }; - /// Functional created of map destruction functors - template <typename M> void destroyHandles(M& m) { - for_each(m.begin(), m.end(), DestroyHandles<M>(m)); - m.clear(); - } - - /// Helper to delete objects from heap and reset the handle \ingroup DD4HEP_GEOMETRY - template <typename T> inline void releaseHandle(T& h) { - releasePtr(h.m_element); - } - /// Functor to destroy handles and delete the cached object \ingroup DD4HEP_GEOMETRY - template <typename T> class ReleaseHandle { - public: - void operator()(T p) const { releaseHandle(p); } - }; - /// map Functor to release handles \ingroup DD4HEP_GEOMETRY - template <typename M> class ReleaseHandles { - public: - /// Container reference - M& object; - /// Initializing constructor - ReleaseHandles(M& m) : object(m) { } - /// Action operator - void operator()(const std::pair<typename M::key_type, typename M::mapped_type>& p) const - { ReleaseHandle<typename M::mapped_type>()(p.second); } - }; - /// Functional created of map destruction functors - template <typename M> void releaseHandles(M& m) { - for_each(m.begin(), m.end(), ReleaseHandles<M>(m)); - m.clear(); + /// Helper to delete objects from heap and reset the handle \ingroup DD4HEP_GEOMETRY + template <typename T> inline void releaseHandle(T& handle) { + releasePtr(handle.m_element); + } + /// Functor to destroy handles and delete the cached object \ingroup DD4HEP_GEOMETRY + template <typename T> class ReleaseHandle { + public: + void operator()(T handle) const { releaseHandle(handle); } + }; + /// map Functor to release handles \ingroup DD4HEP_GEOMETRY + template <typename M> class ReleaseHandles { + public: + /// Container reference + M& object; + /// Initializing constructor + ReleaseHandles(M& obj) : object(obj) { } + /// Action operator + void operator()(const std::pair<typename M::key_type, typename M::mapped_type>& arg) const + { ReleaseHandle<typename M::mapped_type>()(arg.second); } + }; + /// Functional created of map destruction functors + template <typename M> void releaseHandles(M& arg) { + for_each(arg.begin(), arg.end(), ReleaseHandles<M>(arg)); + arg.clear(); + } } - + /// String conversions: boolean value to string \ingroup DD4HEP_GEOMETRY std::string _toString(bool value); /// String conversions: integer value to string \ingroup DD4HEP_GEOMETRY @@ -426,14 +425,14 @@ namespace DD4hep { /// Enter name value pair to the dictionary. \ingroup DD4HEP_GEOMETRY void _toDictionary(const std::string& name, const std::string& value, const std::string& typ); - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - using DD4hep::Handle; - using DD4hep::Ref_t; - - // Forward declarations - class LCDD; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4HEP_HANDLE_H */ + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { + using dd4hep::Handle; + using dd4hep::Ref_t; + } /* End namespace detail */ + + // Forward declarations + class Detector; +} /* End namespace dd4hep */ +#endif /* DD4HEP_HANDLE_H */ diff --git a/DDCore/include/DD4hep/IDDescriptor.h b/DDCore/include/DD4hep/IDDescriptor.h index bbe6d9019..c82709423 100644 --- a/DDCore/include/DD4hep/IDDescriptor.h +++ b/DDCore/include/DD4hep/IDDescriptor.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,8 +10,8 @@ // Author : M.Frank // //========================================================================== -#ifndef DD4hep_IDDESCRIPTOR_H -#define DD4hep_IDDESCRIPTOR_H +#ifndef DD4HEP_DDCORE_IDDESCRIPTOR_H +#define DD4HEP_DDCORE_IDDESCRIPTOR_H // Framework include files #include "DD4hep/Handle.h" @@ -23,66 +23,57 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + class IDDescriptorObject; - class IDDescriptorObject; + /// Class implementing the ID encoding of the detector response + /** @class IDDescriptor IDDescriptor.h DDCore/IDDescriptor.h + * + * @author M.Frank + * @version 1.0 + * @date 2012/07/31 + */ + class IDDescriptor: public Handle<IDDescriptorObject> { + public: + typedef std::vector<std::pair<std::string, BitFieldValue*> > FieldMap; + typedef std::vector<std::pair<size_t, std::string> > FieldIDs; - /// Class implementing the ID encoding of the detector response - /** @class IDDescriptor IDDescriptor.h DDCore/IDDescriptor.h - * - * @author M.Frank - * @version 1.0 - * @date 2012/07/31 - */ - class IDDescriptor: public Handle<IDDescriptorObject> { - public: - typedef IDDescriptorObject Object; - typedef BitFieldValue* Field; - typedef std::vector<std::pair<std::string, Field> > FieldMap; - typedef std::vector<std::pair<size_t, std::string> > FieldIDs; - typedef std::pair<Field, VolumeID> VolIDField; - typedef std::vector<VolIDField> VolIDFields; - - public: - /// Default constructor - IDDescriptor() = default; - /// Constructor to be used when reading the already parsed object - template <typename Q> IDDescriptor(const Handle<Q>& e) : Handle<Object>(e) { } - /// Initializing constructor - IDDescriptor(const std::string& description); - // the string description of all fields - std::string fieldDescription() const; - /// The total number of encoding bits for this descriptor - unsigned maxBit() const; - /// Access the field-id container - const FieldIDs& ids() const; - /// Access the fieldmap container - const FieldMap& fields() const; - /// Get the field descriptor of one field by name - Field field(const std::string& field_name) const; - /// Get the field identifier of one field by name - size_t fieldID(const std::string& field_name) const; - /// Get the field descriptor of one field by its identifier - Field field(size_t identifier) const; + public: + /// Default constructor + IDDescriptor() = default; + /// Constructor to be used when reading the already parsed object + template <typename Q> IDDescriptor(const Handle<Q>& e) : Handle<Object>(e) { } + /// Initializing constructor + IDDescriptor(const std::string& description); + // the string description of all fields + std::string fieldDescription() const; + /// The total number of encoding bits for this descriptor + unsigned maxBit() const; + /// Access the field-id container + const FieldIDs& ids() const; + /// Access the fieldmap container + const FieldMap& fields() const; + /// Get the field descriptor of one field by name + const BitFieldValue* field(const std::string& field_name) const; + /// Get the field identifier of one field by name + size_t fieldID(const std::string& field_name) const; + /// Get the field descriptor of one field by its identifier + const BitFieldValue* field(size_t identifier) const; #ifndef __MAKECINT__ - /// Encode a set of volume identifiers (corresponding to this description of course!) to a volumeID. - typedef std::pair<std::string, int> VolID; - VolumeID encode(const std::vector<VolID>& ids) const; + /// Encode a set of volume identifiers (corresponding to this description of course!) to a volumeID. + VolumeID encode(const std::vector<std::pair<std::string, int> >& ids) const; #endif - /// Decode volume IDs and return filled descriptor with all fields - void decodeFields(VolumeID vid, VolIDFields& fields) const; - /// Decode volume IDs and return string reprensentation for debugging purposes - std::string str(VolumeID vid) const; - /// Decode volume IDs and return string reprensentation for debugging purposes - std::string str(VolumeID vid, VolumeID mask) const; - /// Access string representation - std::string toString() const; - /// Access the BitField64 object - BitField64* decoder(); - }; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4hep_IDDESCRIPTOR_H */ + /// Decode volume IDs and return filled descriptor with all fields + void decodeFields(VolumeID vid, std::vector<std::pair<const BitFieldValue*, VolumeID> >& fields) const; + /// Decode volume IDs and return string reprensentation for debugging purposes + std::string str(VolumeID vid) const; + /// Decode volume IDs and return string reprensentation for debugging purposes + std::string str(VolumeID vid, VolumeID mask) const; + /// Access string representation + std::string toString() const; + /// Access the BitField64 object + BitField64* decoder(); + }; +} /* End namespace dd4hep */ +#endif /* DD4HEP_DDCORE_IDDESCRIPTOR_H */ diff --git a/DDCore/include/DD4hep/IOV.h b/DDCore/include/DD4hep/IOV.h index 4a65ac322..6a72cc158 100644 --- a/DDCore/include/DD4hep/IOV.h +++ b/DDCore/include/DD4hep/IOV.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include <algorithm> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class IOVType; @@ -162,5 +162,5 @@ namespace DD4hep { { return same_type(iov,test) && key_partially_contained(iov.keyData,test.keyData); } }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_IOV_H */ diff --git a/DDCore/include/DD4hep/InstanceCount.h b/DDCore/include/DD4hep/InstanceCount.h index 723811f27..5a7cdccf3 100644 --- a/DDCore/include/DD4hep/InstanceCount.h +++ b/DDCore/include/DD4hep/InstanceCount.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Helper to support object counting when debugging memory leaks /** @@ -39,7 +39,7 @@ namespace DD4hep { ALL = STRING | TYPEINFO }; - /// Internal class to could object constructions and destructions + /// detaill class to could object constructions and destructions /** * Small class to enable object construction/destruction tracing. * @@ -146,5 +146,5 @@ namespace DD4hep { ~Increment() { --counter(); } }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_INSTANCECOUNT_H */ diff --git a/DDCore/include/DD4hep/LCDD.h b/DDCore/include/DD4hep/LCDD.h deleted file mode 100644 index a43903ed2..000000000 --- a/DDCore/include/DD4hep/LCDD.h +++ /dev/null @@ -1,373 +0,0 @@ -//========================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see $DD4hepINSTALL/LICENSE. -// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -// -// Author : M.Frank -// -//========================================================================== -#ifndef DD4HEP_LCDD_LCDD_H -#define DD4HEP_LCDD_LCDD_H - -#include "DD4hep/Version.h" - -// Framework includes -#include "DD4hep/Handle.h" -#include "DD4hep/Fields.h" -#include "DD4hep/Objects.h" -#include "DD4hep/Shapes.h" -#include "DD4hep/Volumes.h" -#include "DD4hep/Readout.h" -#include "DD4hep/Detector.h" -#include "DD4hep/Segmentations.h" -#include "DD4hep/VolumeManager.h" -#include "DD4hep/NamedObject.h" -#include "DD4hep/BuildType.h" - -// C/C++ include files -#include <map> -#include <vector> -#include <string> -#include <cstdio> - -// Forward declarations -class TGeoManager; - - -//fg: for the transition period we define the old namespaces also in the new ones: -namespace dd4hep { - using namespace DD4hep ; - using namespace DD4hep::Geometry ; -} - - -/// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// return a string with the current DD4hep version in the form vXX-YY. - std::string versionString(); - - // Foward declarations - class NamedObject; - - /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { - class UriReader; - } - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - /// The main interface to the DD4hep detector description package - /** - * Note: The usage of the factory method: - * - * static LCDD& getInstance(void); - * - * is DEPRECATED! - * - * You should rather use the plugin mechanism to create a new instance. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class LCDD { - public: - /// Type definition of a map of named handles - typedef XML::UriReader UriReader; - typedef Handle<NamedObject> NamedHandle; - typedef std::map<std::string, NamedHandle > HandleMap; - typedef std::map<std::string, std::string> PropertyValues; - typedef std::map<std::string, PropertyValues> Properties; - - /// Destructor - virtual ~LCDD() = default; - - /// Access flag to steer the detail of building of the geometry/detector description - virtual LCDDBuildType buildType() const = 0; - /// Initialize geometry - virtual void init() = 0; - /// Finalize the geometry - virtual void endDocument() = 0; - - /// Access the geometry manager of this instance - virtual TGeoManager& manager() const = 0; - /// Access to properties map - virtual Properties& properties() const = 0; - /// Return handle to material describing air - virtual Material air() const = 0; - /// Return handle to material describing vacuum - virtual Material vacuum() const = 0; - /// Return handle to "invisible" visualization attributes - virtual VisAttr invisible() const = 0; - - /// Return reference to the top-most (world) detector element - virtual DetElement world() const = 0; - /// Return reference to detector element with all tracker devices. - virtual DetElement trackers() const = 0; - - /// Return handle to the world volume containing everything - virtual Volume worldVolume() const = 0; - /// Return handle to the volume containing the tracking devices - virtual Volume trackingVolume() const = 0; - - /// Return handle to the VolumeManager - virtual VolumeManager volumeManager() const = 0; - - /// Accessor to the map of header entries - virtual Header header() const = 0; - /// Accessor to the header entry - virtual void setHeader(Header h) = 0; - - /// Return handle to the combined electromagentic field description. - virtual OverlayedField field() const = 0; - - /// Accessor to the map of constants - virtual const HandleMap& constants() const = 0; - /// Accessor to the map of region settings - virtual const HandleMap& regions() const = 0; - /// Accessor to the map of sub-detectors - virtual const HandleMap& detectors() const = 0; - /// Accessor to the map of sub-detectors - virtual const HandleMap& sensitiveDetectors() const = 0; - /// Accessor to the map of readout structures - virtual const HandleMap& readouts() const = 0; - /// Accessor to the map of visualisation attributes - virtual const HandleMap& visAttributes() const = 0; - /// Accessor to the map of limit settings - virtual const HandleMap& limitsets() const = 0; - /// Accessor to the map of aligment entries - virtual const HandleMap& alignments() const = 0; - /// Accessor to the map of field entries, which together form the global field - virtual const HandleMap& fields() const = 0; - /// Accessor to the map of ID specifications - virtual const HandleMap& idSpecifications() const = 0; - -#ifndef __MAKECINT__ - /** Access to predefined caches of subdetectors according to the sensitive type */ - /// Access a set of subdetectors according to the sensitive type. - /** - Please note: - - The sensitive type of a detector is set in the 'detector constructor'. - - Not sensitive detector structures have the name 'passive' - - Compounds (ie. nested detectors) are of type 'compound' - - If throw_exc is set to true, an exception is thrown if the type - is not present. Otherwise an empty detector container is returned. - */ - virtual const std::vector<DetElement>& detectors(const std::string& type, - bool throw_exc=false) = 0; - - /// Access a set of subdetectors according to several sensitive types. - virtual std::vector<DetElement> detectors(const std::string& type1, - const std::string& type2, - const std::string& type3="", - const std::string& type4="", - const std::string& type5="" ) = 0; - - /// Access the availible detector types - virtual std::vector<std::string> detectorTypes() const = 0; - - - /** return a vector with all detectors that have all the type properties in - * includeFlag set but none of the properties given in excludeFlag - */ - virtual std::vector<DetElement> detectors(unsigned int includeFlag, - unsigned int excludeFlag=0 ) const = 0 ; -#endif - - /** Miscaneleous accessors to the detexctor description */ - - /// Register new mother volume using the detector name. - /** Volumes must be registered/declared PRIOR to be picked up! - * The method throws an exception if another volume was already declared for this subdetector - * The method throws an exception if the volume to be registered is invalid. - */ - virtual void declareMotherVolume(const std::string& detector_name, const Volume& vol) = 0; - /// Access mother volume by detector element - /** The method uses the detector element's name for volume identification. - * Unregistered detectors are hosted by the world volume. - */ - virtual Volume pickMotherVolume(const DetElement& sd) const = 0; - - /// Typed access to constants: access string values - virtual std::string constantAsString(const std::string& name) const = 0; - /// Typed access to constants: long values - virtual long constantAsLong(const std::string& name) const = 0; - /// Typed access to constants: double values - virtual double constantAsDouble(const std::string& name) const = 0; - - /// Retrieve a constant by it's name from the detector description - virtual Constant constant(const std::string& name) const = 0; - /// Typed access to constants: access any type values - template <class T> T constant(const std::string& name) const; - - /// Retrieve a matrial by it's name from the detector description - virtual Material material(const std::string& name) const = 0; - /// Retrieve a id descriptor by it's name from the detector description - virtual IDDescriptor idSpecification(const std::string& name) const = 0; - /// Retrieve a region object by it's name from the detector description - virtual Region region(const std::string& name) const = 0; - /// Retrieve a visualization attribute by it's name from the detector description - virtual VisAttr visAttributes(const std::string& name) const = 0; - /// Retrieve a limitset by it's name from the detector description - virtual LimitSet limitSet(const std::string& name) const = 0; - /// Retrieve a readout object by it's name from the detector description - virtual Readout readout(const std::string& name) const = 0; - /// Retrieve an alignment entry by it's name from the detector description - virtual AlignmentEntry alignment(const std::string& path) const = 0; - /// Retrieve a sensitive detector by it's name from the detector description - virtual SensitiveDetector sensitiveDetector(const std::string& name) const = 0; - /// Retrieve a subdetector element by it's name from the detector description - virtual CartesianField field(const std::string& name) const = 0; - /// Retrieve a field component by it's name from the detector description - virtual DetElement detector(const std::string& name) const = 0; - - /// Add a new constant to the detector description - virtual LCDD& add(Constant constant) = 0; - /// Add a new visualisation attribute to the detector description - virtual LCDD& add(VisAttr attr) = 0; - /// Add a new limit set to the detector description - virtual LCDD& add(LimitSet limitset) = 0; - /// Add a new detector region to the detector description - virtual LCDD& add(Region region) = 0; - /// Add a new id descriptor to the detector description - virtual LCDD& add(IDDescriptor spec) = 0; - /// Add a new detector readout to the detector description - virtual LCDD& add(Readout readout) = 0; - /// Add a new sensitive detector to the detector description - virtual LCDD& add(SensitiveDetector entry) = 0; - /// Add a new subdetector to the detector description - virtual LCDD& add(DetElement detector) = 0; - /// Add alignment entry to the detector description - virtual LCDD& add(AlignmentEntry entry) = 0; - /// Add a field component to the detector description - virtual LCDD& add(CartesianField entry) = 0; - - /// Add a new constant by named reference to the detector description - virtual LCDD& addConstant(const Ref_t& element) = 0; - /// Add a new visualisation attribute by named reference to the detector description - virtual LCDD& addVisAttribute(const Ref_t& element) = 0; - /// Add a new limit set by named reference to the detector description - virtual LCDD& addLimitSet(const Ref_t& limset) = 0; - /// Add a new id descriptor by named reference to the detector description - virtual LCDD& addIDSpecification(const Ref_t& element) = 0; - /// Add a new detector region by named reference to the detector description - virtual LCDD& addRegion(const Ref_t& region) = 0; - /// Add a new detector readout by named reference to the detector description - virtual LCDD& addReadout(const Ref_t& readout) = 0; - /// Add a new sensitive detector by named reference to the detector description - virtual LCDD& addSensitiveDetector(const Ref_t& element) = 0; - /// Add a new subdetector by named reference to the detector description - virtual LCDD& addDetector(const Ref_t& detector) = 0; - /// Add alignment entry by named reference to the detector description - virtual LCDD& addAlignment(const Ref_t& alignment) = 0; - /// Add a field component by named reference to the detector description - virtual LCDD& addField(const Ref_t& field) = 0; - - /// Deprecated call (use fromXML): Read compact geometry description or alignment file - virtual void fromCompact(const std::string& fname, LCDDBuildType type = BUILD_DEFAULT) = 0; - /// Read any geometry description or alignment file - virtual void fromXML(const std::string& fname, LCDDBuildType type = BUILD_DEFAULT) = 0; - /// Read any geometry description or alignment file with external XML entity resolution - virtual void fromXML(const std::string& fname, - UriReader* entity_resolver, - LCDDBuildType type = BUILD_DEFAULT) = 0; - - /// Stupid legacy method - virtual void dump() const = 0; - /// Manipulate geometry using factory converter - virtual long apply(const char* factory, int argc, char** argv) = 0; - - /// Extend the sensitive detector element with an arbitrary structure accessible by the type - template <typename IFACE, typename CONCRETE> IFACE* addExtension(CONCRETE* c) { - return (IFACE*) addUserExtension(dynamic_cast<IFACE*>(c), typeid(IFACE), _delete<IFACE>); - } - - /// Remove an existing extension object from the LCDD instance. If not destroyed, the instance is returned - template <class T> T* removeExtension(bool destroy=true) { - return (T*) removeUserExtension(typeid(T),destroy); - } - - /// Access extension element by the type - template <class T> T* extension(bool alert=true) const { - return (T*) userExtension(typeid(T),alert); - } - - ///---Factory method------- - static LCDD& getInstance(void); - /// Destroy the instance - static void destroyInstance(); - - protected: - /// Templated destructor function - template <typename T> static void _delete(void* ptr) { - delete (T*) (ptr); - } - /// Add an extension object to the detector element - virtual void* addUserExtension(void* ptr, const std::type_info& info, void (*destruct)(void*)) = 0; - /// Remove an existing extension object from the LCDD instance. If not destroyed, the instance is returned - virtual void* removeUserExtension(const std::type_info& info, bool destroy) = 0; - /// Access an existing extension object from the detector element - virtual void* userExtension(const std::type_info& info, bool alert=true) const = 0; - - }; - - /* - * The following are convenience implementations to access constants by type. - * I do not think this violates the interface approach, but it is so much - * more intuitiv to say constant<int>(name) than constantAsInt(name). - */ -#ifndef __CINT__ - /// Typed access to constants: short values - template <> inline short LCDD::constant<short>(const std::string& name) const { - return (short) constantAsLong(name); - } - - /// Typed access to constants: unsigned short values - template <> inline unsigned short LCDD::constant<unsigned short>(const std::string& name) const { - return (unsigned short) constantAsLong(name); - } - - /// Typed access to constants: integer values - template <> inline int LCDD::constant<int>(const std::string& name) const { - return (int) constantAsLong(name); - } - - /// Typed access to constants: unsigned integer values - template <> inline unsigned int LCDD::constant<unsigned int>(const std::string& name) const { - return (unsigned int) constantAsLong(name); - } - - /// Typed access to constants: long values - template <> inline long LCDD::constant<long>(const std::string& name) const { - return constantAsLong(name); - } - - /// Typed access to constants: unsigned long values - template <> inline unsigned long LCDD::constant<unsigned long>(const std::string& name) const { - return (unsigned long) constantAsLong(name); - } - - /// Typed access to constants: float values - template <> inline float LCDD::constant<float>(const std::string& name) const { - return (float) constantAsDouble(name); - } - - /// Typed access to constants: double values - template <> inline double LCDD::constant<double>(const std::string& name) const { - return constantAsDouble(name); - } - - /// Typed access to constants: string values - template <> inline std::string LCDD::constant<std::string>(const std::string& name) const { - return constantAsString(name); - } -#endif - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4HEP_LCDD_LCDD_H */ diff --git a/DDCore/include/DD4hep/LCDDData.h b/DDCore/include/DD4hep/LCDDData.h deleted file mode 100644 index f85c95d90..000000000 --- a/DDCore/include/DD4hep/LCDDData.h +++ /dev/null @@ -1,146 +0,0 @@ -//========================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see $DD4hepINSTALL/LICENSE. -// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -// -// Author : M.Frank -// -//========================================================================== - -#ifndef DD4HEP_DDCORE_LCDDDATA_H -#define DD4HEP_DDCORE_LCDDDATA_H - -// Framework includes -#include "DD4hep/LCDD.h" -#include "DD4hep/ObjectExtensions.h" -#include "DD4hep/detail/VolumeManagerInterna.h" - -// C/C++ include files -#include <stdexcept> - -/// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - // Foward declarations - class NamedObject; - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - /// Data implementation class of the LCDD interface - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class LCDDData { - - public: - /// Specialized exception class - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - struct InvalidObjectError: public std::runtime_error { - InvalidObjectError(const std::string& msg) - : std::runtime_error("DD4hep: " + msg) { - } - }; - - /// Implementation of a map of named DD4hep Handles - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class ObjectHandleMap: public LCDD::HandleMap { - public: - /// Default constructor - ObjectHandleMap() { - } - void append(const Ref_t& e, bool throw_on_doubles = true) { - if (e.isValid()) { - std::string n = e.name(); - std::pair<iterator, bool> r = this->insert(std::make_pair(n, e.ptr())); - if (!throw_on_doubles || r.second) - return; - throw InvalidObjectError("Attempt to add an already existing object:" + std::string(e.name()) + "."); - } - throw InvalidObjectError("Attempt to add an invalid object."); - } - - template <typename T> void append(const Ref_t& e, bool throw_on_doubles = true) { - T* obj = dynamic_cast<T*>(e.ptr()); - if (obj) { - this->append(e, throw_on_doubles); - return; - } - throw InvalidObjectError("Attempt to add an object, which is of the wrong type."); - } - }; - - protected: - TGeoManager* m_manager; - ObjectHandleMap m_readouts; - ObjectHandleMap m_idDict; - ObjectHandleMap m_limits; - ObjectHandleMap m_regions; - ObjectHandleMap m_detectors; - ObjectHandleMap m_alignments; - - ObjectHandleMap m_sensitive; - ObjectHandleMap m_display; - ObjectHandleMap m_fields; - - ObjectHandleMap m_motherVolumes; - - // GDML fields - ObjectHandleMap m_define; - - DetElement m_world; - DetElement m_trackers; - Volume m_worldVol; - Volume m_trackingVol; - - Material m_materialAir; - Material m_materialVacuum; - VisAttr m_invisibleVis; - OverlayedField m_field; - Header m_header; - LCDD::Properties m_properties; - LCDDBuildType m_buildType; - - /// Definition of the extension type - ObjectExtensions m_extensions; - /// Volume manager reference - VolumeManager m_volManager; - - /// Flag to inhibit the access to global constants. Value set by constants section 'LCDD_InhibitConstants' - bool m_inhibitConstants; - - protected: - /// Default constructor - LCDDData(); - /// Default destructor - virtual ~LCDDData(); - /// Copy constructor - LCDDData(const LCDDData& copy) = delete; - /// Assignment operator - //LCDDData& operator=(const LCDDData& copy) = delete; - public: - /// Clear data content: releases all allocated resources - void destroyData(bool destroy_mgr=true); - /// Clear data content: DOES NOT RELEASEW ALLOCATED RESOURCES! - void clearData(); - /// Adopt all data from source structure. - void adoptData(LCDDData& source); - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4HEP_DDCORE_LCDDDATA_H */ diff --git a/DDCore/include/DD4hep/LCDDHelper.h b/DDCore/include/DD4hep/LCDDHelper.h deleted file mode 100644 index 2558dc382..000000000 --- a/DDCore/include/DD4hep/LCDDHelper.h +++ /dev/null @@ -1,61 +0,0 @@ -//========================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see $DD4hepINSTALL/LICENSE. -// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -// -// Author : M.Frank -// -//========================================================================== - -#ifndef DD4HEP_LCDDHELPER_H -#define DD4HEP_LCDDHELPER_H -#include "DD4hep/LCDD.h" - -/// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - /// LCDDHelper: class to shortcut certain questions to the DD4hep detector description interface - /** - * - * Note: This class may be extended with additional useful (generic) functionality, - * which requires the use of the main LCDD object. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class LCDDHelper : public Handle<LCDD> { - public: - /// Default constructor - LCDDHelper() = default; - /// Copy constructor - LCDDHelper(const LCDDHelper& h) = default; - /// Initializing constructor from pointer - LCDDHelper(LCDD* lcdd_ptr) : handle_t(lcdd_ptr) {} - /// Initializing constructor from pointer - LCDDHelper(LCDD& lcdd_ref) : handle_t(&lcdd_ref) {} - /// Copy constructor - LCDDHelper(const handle_t& h) : handle_t(h) {} - /// Default destructor - ~LCDDHelper() = default; - /// Assignment operator - LCDDHelper& operator=(const LCDDHelper& c) = default; - /// Access the sensitive detector of a given subdetector (if the sub-detector is sensitive!) - SensitiveDetector sensitiveDetector(const std::string& detector) const; - /// Given a detector element, access it's sensitive detector (if the sub-detector is sensitive!) - SensitiveDetector sensitiveDetector(DetElement detector) const; - /// Find a detector element by it's system ID - DetElement detectorByID(int id) const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ - -#endif /* DD4HEP_LCDDHELPER_H */ diff --git a/DDCore/include/DD4hep/MatrixHelpers.h b/DDCore/include/DD4hep/MatrixHelpers.h index 99e9dd1e4..4fbebe25e 100644 --- a/DDCore/include/DD4hep/MatrixHelpers.h +++ b/DDCore/include/DD4hep/MatrixHelpers.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,7 +10,6 @@ // Author : M.Frank // //========================================================================== - #ifndef DD4HEP_IMP_MATRIXHELPERS_H #define DD4HEP_IMP_MATRIXHELPERS_H @@ -24,58 +23,57 @@ class TGeoHMatrix; class TGeoMatrix; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { +namespace dd4hep { + + /// Namespace for the AIDA detector description matrix helpers + namespace Matrices { - typedef Position XYZAngles; - /// Access the TGeo identity transformation \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoIdentity* identityTransform(); + TGeoIdentity* _identity(); /// Convert a Position object to a TGeoTranslation \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoTranslation* _translation(const Geometry::Position& pos); + TGeoTranslation* _translation(const Position& pos); /// Convert a RotationZYX object to a TGeoRotation \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoRotation* _rotationZYX(const Geometry::RotationZYX& rot); + TGeoRotation* _rotationZYX(const RotationZYX& rot); /// Convert a Rotation3D object to a TGeoRotation \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoRotation* _rotation3D(const Geometry::Rotation3D& rot); + TGeoRotation* _rotation3D(const Rotation3D& rot); /// Convert a Transform3D object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix* _transform(const Geometry::Transform3D& trans); + TGeoHMatrix* _transform(const Transform3D& trans); /// Convert a Position object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix* _transform(const Geometry::Position& pos); + TGeoHMatrix* _transform(const Position& pos); /// Convert a RotationZYX object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix* _transform(const Geometry::RotationZYX& rot); + TGeoHMatrix* _transform(const RotationZYX& rot); /// Convert a Rotation3D object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix* _transform(const Geometry::Rotation3D& rot3D); + TGeoHMatrix* _transform(const Rotation3D& rot3D); /// Convert a Position followed by a RotationZYX to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix* _transform(const Geometry::Position& pos, const Geometry::RotationZYX& rot); + TGeoHMatrix* _transform(const Position& pos, const RotationZYX& rot); /// Set a Transform3D object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix& _transform(TGeoHMatrix& mat, const Geometry::Transform3D& trans); + TGeoHMatrix& _transform(TGeoHMatrix& mat, const Transform3D& trans); /// Set a Position object (translation) to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix& _transform(TGeoHMatrix& mat, const Geometry::Position& pos); + TGeoHMatrix& _transform(TGeoHMatrix& mat, const Position& pos); /// Set a RotationZYX object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix& _transform(TGeoHMatrix& mat, const Geometry::RotationZYX& rot); + TGeoHMatrix& _transform(TGeoHMatrix& mat, const RotationZYX& rot); /// Set a Rotation3D object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix& _transform(TGeoHMatrix& mat, const Geometry::Rotation3D& rot3D); + TGeoHMatrix& _transform(TGeoHMatrix& mat, const Rotation3D& rot3D); /// Set a Position followed by a RotationZYX to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - TGeoHMatrix& _transform(TGeoHMatrix& mat, const Geometry::Position& pos, const Geometry::RotationZYX& rot); + TGeoHMatrix& _transform(TGeoHMatrix& mat, const Position& pos, const RotationZYX& rot); /// Convert a TGeoMatrix object to a generic Transform3D \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - Geometry::Transform3D _transform(const TGeoMatrix* matrix); + Transform3D _transform(const TGeoMatrix* matrix); /// Decompose a generic Transform3D into a translation (Position) and a RotationZYX \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - void _decompose(const Geometry::Transform3D& trafo, Geometry::Position& pos, Geometry::RotationZYX& rot); - /// Decompose a generic Transform3D into a translation (Geometry::Position) and XYZAngles \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - void _decompose(const Geometry::Transform3D& trafo, Geometry::Position& pos, XYZAngles& rot); + void _decompose(const Transform3D& trafo, Position& pos, RotationZYX& rot); + /// Decompose a generic Transform3D into a translation (Position) and XYZAngles \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY + void _decompose(const Transform3D& trafo, Position& pos, XYZAngles& rot); /// Decompose a generic Transform3D into a translation (Translation3D) and a RotationZYX \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - void _decompose(const Geometry::Transform3D& trafo, Geometry::Translation3D& pos, Geometry::RotationZYX& rot); + void _decompose(const Transform3D& trafo, Translation3D& pos, RotationZYX& rot); /// Decompose a generic Transform3D into a translation (Translation3D) and XYZAngles \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - void _decompose(const Geometry::Transform3D& trafo, Geometry::Translation3D& pos, XYZAngles& rot); + void _decompose(const Transform3D& trafo, Translation3D& pos, XYZAngles& rot); /// Convert a 3x3 rotation matrix to XYZAngles \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - XYZAngles _XYZangles(const double* matrix); + XYZAngles _xyzAngles(const double* matrix); /// Convert a the rotation part of a TGeoMatrix to XYZAngles \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY - XYZAngles _XYZangles(const TGeoMatrix* matrix); + XYZAngles _xyzAngles(const TGeoMatrix* matrix); enum MatrixEqualityCode { MATRICES_EQUAL = 1, @@ -90,8 +88,7 @@ namespace DD4hep { * or combination: MATRICES_DIFFER_TRANSLATION|MATRICES_DIFFER_ROTATION */ int _matrixEqual(const TGeoMatrix& left, const TGeoMatrix& right); - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } +} /* End namespace dd4hep */ #endif // DD4HEP_IMP_MATRIXHELPERS_H diff --git a/DDCore/include/DD4hep/Memory.h b/DDCore/include/DD4hep/Memory.h index b9a3b293e..e05bb982d 100644 --- a/DDCore/include/DD4hep/Memory.h +++ b/DDCore/include/DD4hep/Memory.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -29,7 +29,7 @@ #define DD4HEP_DD4HEP_PTR_AUTO /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Out version of the std auto_ptr implementation base either on auto_ptr or unique_ptr. /** diff --git a/DDCore/include/DD4hep/MultiSegmentation.h b/DDCore/include/DD4hep/MultiSegmentation.h index 04bdcf8e3..86a4ac71a 100644 --- a/DDCore/include/DD4hep/MultiSegmentation.h +++ b/DDCore/include/DD4hep/MultiSegmentation.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,85 +20,76 @@ #include "DDSegmentation/MultiSegmentation.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class MultiSegmentation; } - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::MultiSegmentation> > MultiSegmentationHandle; - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::MultiSegmentation> > MultiSegmentationHandle; + /// Implementation class for the grid XZ segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class MultiSegmentation : public MultiSegmentationHandle { + public: + typedef DDSegmentation::MultiSegmentation::Segmentations Segmentations; - /// Implementation class for the grid XZ segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class MultiSegmentation : public MultiSegmentationHandle { - public: - typedef DDSegmentation::MultiSegmentation::Segmentations Segmentations; + public: + /// Default constructor + MultiSegmentation() = default; + /// Copy constructor + MultiSegmentation(const MultiSegmentation& e) = default; + /// Copy Constructor from segmentation base object + MultiSegmentation(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + MultiSegmentation(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> MultiSegmentation(const Handle<Q>& e) : Handle<Object>(e) {} + /// Assignment operator + MultiSegmentation& operator=(const MultiSegmentation& seg) = default; + /// Equality operator + bool operator==(const MultiSegmentation& seg) const + { return m_element == seg.m_element; } + /// access the field name used to discriminate sub-segmentations + const std::string& discriminatorName() const; + /// Discriminating bitfield entry + BitFieldValue* discriminator() const; + /// The underlying sub-segementations + const Segmentations& subSegmentations() const; + /// determine the position based on the cell ID + Position position(const CellID& cellID) const; + /// determine the cell ID based on the position + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + const std::string& fieldNameY() const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - public: - /// Default constructor - MultiSegmentation() = default; - /// Copy constructor - MultiSegmentation(const MultiSegmentation& e) = default; - /// Copy Constructor from segmentation base object - MultiSegmentation(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - MultiSegmentation(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> MultiSegmentation(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - MultiSegmentation& operator=(const MultiSegmentation& seg) = default; - /// Equality operator - bool operator==(const MultiSegmentation& seg) const - { return m_element == seg.m_element; } - /// access the field name used to discriminate sub-segmentations - const std::string& discriminatorName() const; - /// Discriminating bitfield entry - BitFieldValue* discriminator() const; - /// The underlying sub-segementations - const Segmentations& subSegmentations() const; - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - const std::string& fieldNameY() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in x - -# size in z - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + Returns a vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 2: + -# size in x + -# size in z + */ + std::vector<double> cellDimensions(const CellID& cellID) const; + }; +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_MULTISEGMENTATION_H diff --git a/DDCore/include/DD4hep/Mutex.h b/DDCore/include/DD4hep/Mutex.h index 366d8b0e8..694d46857 100644 --- a/DDCore/include/DD4hep/Mutex.h +++ b/DDCore/include/DD4hep/Mutex.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { #if __cplusplus >= 201103L typedef std::recursive_mutex dd4hep_mutex_t; typedef std::lock_guard<dd4hep_mutex_t> dd4hep_lock_t; diff --git a/DDCore/include/DD4hep/NamedObject.h b/DDCore/include/DD4hep/NamedObject.h index 86d669dbf..e9426a96d 100644 --- a/DDCore/include/DD4hep/NamedObject.h +++ b/DDCore/include/DD4hep/NamedObject.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Implementation of a named object /** @@ -69,5 +69,5 @@ namespace DD4hep { } }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_INTERNAL_NAMEDOBJECT_H */ diff --git a/DDCore/include/DD4hep/NoSegmentation.h b/DDCore/include/DD4hep/NoSegmentation.h index e0968b5c4..8b6505671 100644 --- a/DDCore/include/DD4hep/NoSegmentation.h +++ b/DDCore/include/DD4hep/NoSegmentation.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,45 +19,36 @@ #include "DD4hep/Segmentations.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class NoSegmentation; } - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::NoSegmentation> > NoSegmentationHandle; - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::NoSegmentation> > NoSegmentationHandle; + /// Implementation class for the grid XY segmentation. + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class NoSegmentation : public NoSegmentationHandle { + public: + NoSegmentation() = default; + NoSegmentation(const NoSegmentation& e) = default; + NoSegmentation(const Segmentation& e) : Handle<Object>(e) { } + NoSegmentation(const Handle<Object>& e) : Handle<Object>(e) { } + template <typename Q> + NoSegmentation(const Handle<Q>& e) : Handle<Object>(e) { } + NoSegmentation& operator=(const NoSegmentation& seg) = default; + bool operator==(const NoSegmentation& seg) const { + return m_element == seg.m_element; + } - /// Implementation class for the grid XY segmentation. - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class NoSegmentation : public NoSegmentationHandle { - public: - NoSegmentation() = default; - NoSegmentation(const NoSegmentation& e) = default; - NoSegmentation(const Segmentation& e) : Handle<Object>(e) { } - NoSegmentation(const Handle<Object>& e) : Handle<Object>(e) { } - template <typename Q> - NoSegmentation(const Handle<Q>& e) : Handle<Object>(e) { } - NoSegmentation& operator=(const NoSegmentation& seg) = default; - bool operator==(const NoSegmentation& seg) const { - return m_element == seg.m_element; - } - - Position position(const CellID& cellID) const; - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif // DD4HEP_DDCORE_NoSegmentation_H + Position position(const CellID& cellID) const; + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + }; +} /* End namespace dd4hep */ +#endif // DD4HEP_DDCORE_NoSegmentation_H diff --git a/DDCore/include/DD4hep/ObjectExtensions.h b/DDCore/include/DD4hep/ObjectExtensions.h index 25786beb9..dd0d6405c 100644 --- a/DDCore/include/DD4hep/ObjectExtensions.h +++ b/DDCore/include/DD4hep/ObjectExtensions.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Implementation of an object supporting arbitrary user extensions /** @@ -30,32 +30,21 @@ namespace DD4hep { */ class ObjectExtensions { public: - /// Definition of the extension type - typedef std::map<const std::type_info*, void*> Extensions; - /// Extensions copy constructor type - typedef void* (*copy_t)(const void*, void* arg); - /// Extensions destructor type - typedef void (*destruct_t)(void*); /// Defintiion of the extension entry struct Entry { - copy_t copy; - destruct_t destruct; + void* (*copy)(const void*, void*); + void (*destruct)(void*); int id; }; - typedef std::map<const std::type_info*, Entry> ExtensionMap; - /// The extensions object - Extensions extensions; //! + std::map<const std::type_info*, void*> extensions; //! /// Pointer to the extension map - ExtensionMap* extensionMap; //! + std::map<const std::type_info*, Entry>* extensionMap; //! /// Function to be passed as dtor if object should NOT be deleted! static void _noDelete(void*) {} - /// Templated destructor function - template <typename T> static void _delete(void* ptr) { - delete (T*) (ptr); - } + template <typename T> static void _delete(void* ptr) { delete (T*) (ptr); } public: /// Default constructor @@ -71,11 +60,13 @@ namespace DD4hep { /// Clear all extensions void clear(bool destroy=true); /// Copy object extensions from another object. Hosting type must be identical! - void copyFrom(const Extensions& ext, void* arg); + void copyFrom(const std::map<const std::type_info*, void*>& ext, void* arg); /// Add an extension object to the detector element - void* addExtension(void* ptr, const std::type_info& info, copy_t ctor, destruct_t dtor); + void* addExtension(void* ptr, const std::type_info& info, + void* (*ctor)(const void*, void* arg), + void (*dtor)(void*)); /// Add an extension object to the detector element - void* addExtension(void* ptr, const std::type_info& info, destruct_t dtor); + void* addExtension(void* ptr, const std::type_info& info, void (*dtor)(void*)); /// Remove an existing extension object from the instance void* removeExtension(const std::type_info& info, bool destroy); /// Access an existing extension object from the detector element @@ -84,5 +75,5 @@ namespace DD4hep { void* extension(const std::type_info& info) const; }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_OBJECTEXTENSIONS_H */ diff --git a/DDCore/include/DD4hep/Objects.h b/DDCore/include/DD4hep/Objects.h index af8eb68c9..d1cde3504 100644 --- a/DDCore/include/DD4hep/Objects.h +++ b/DDCore/include/DD4hep/Objects.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -60,527 +60,398 @@ class TGeoIdentity; #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class LCDD; - class IDDescriptor; - class VisAttrObject; - class HeaderObject; - class ConstantObject; - class RegionObject; - class LimitSetObject; - - typedef ROOT::Math::XYZVector Position; - template <class V> V RotateX(const V& v, double a) { - return ROOT::Math::VectorUtil::RotateX(v, a); - } - template <class V> V RotateY(const V& v, double a) { - return ROOT::Math::VectorUtil::RotateY(v, a); - } - template <class V> V RotateZ(const V& v, double a) { - return ROOT::Math::VectorUtil::RotateZ(v, a); - } - - /** Rotation class with the (3D) rotation represented by - * angles describing first a rotation of - * an angle phi (yaw) about the Z axis, - * followed by a rotation of an angle theta (pitch) about the new Y' axis, - * followed by a third rotation of an angle psi (roll) about the final X'' axis. - * This is sometimes referred to as the Euler 321 sequence. - * It has not to be confused with the typical Goldstein definition of the Euler Angles - * (Z-X-Z or 313 sequence) which is used by the ROOT::Math::EulerAngles class. - * \see http://root.cern.ch/root/html/ROOT__Math__RotationZYX.html - */ - typedef ROOT::Math::RotationZYX RotationZYX; - /** \see http://root.cern.ch/root/html/ROOT__Math__RotationZ.html */ - typedef ROOT::Math::RotationZ RotationZ; - /** \see http://root.cern.ch/root/html/ROOT__Math__RotationY.html */ - typedef ROOT::Math::RotationY RotationY; - /** \see http://root.cern.ch/root/html/ROOT__Math__RotationX.html */ - typedef ROOT::Math::RotationX RotationX; - /** \see http://root.cern.ch/root/html/ROOT__Math__Rotation3D.html */ - typedef ROOT::Math::Rotation3D Rotation3D; - /** \see http://root.cern.ch/root/html/ROOT__Math__EulerAngels.html */ - typedef ROOT::Math::EulerAngles EulerAngles; - /** \see http://root.cern.ch/root/html/ROOT__Math__Transform3D.html */ - typedef ROOT::Math::Transform3D Transform3D; - /** \see http://root.cern.ch/root/html/ROOT__Math__Translations3D.html */ - typedef ROOT::Math::Translation3D Translation3D; - - /** Access to identity transformation */ - TGeoIdentity* identityTransform(); - - - /// Handle class describing an author entity - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Author: public Ref_t { - public: - /// Definition of the implementation type - typedef NamedObject Object; - /// Default constructor - Author() - : Ref_t() { - } - /// Constructorto be used for assignment from a handle - Author(const Author& e) - : Ref_t(e) { - } - /// Constructor to be used when assigning already valid handle - template <typename Q> - Author(const Handle<Q>& e) - : Ref_t(e) { - } - /// Constructor to be used when creating a new object - Author(LCDD& doc); - /// Assignment operator - Author& operator=(const Author& e) { - if ( this != & e ) { - m_element = e.m_element; - } - return *this; - } - /// Access the auhor's name - std::string authorName() const; - /// Set the author's name - void setAuthorName(const std::string& nam); - /// Access the auhor's email address - std::string authorEmail() const; - /// Set the author's email address - void setAuthorEmail(const std::string& addr); - }; - - /// Handle class describing the basic information about geometry objects as it is defined in LCDD - /** - * Description of the geometry header. Containes useful auxiliary information. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Header: public Handle<HeaderObject> { - public: - typedef HeaderObject Object; - /// Default constructor - Header() - : Handle<HeaderObject>() { - } - /// Constructorto be used for assignment from a handle - Header(const Header& e) - : Handle<HeaderObject>(e) { - } - /// Constructor to be used when reading the already parsed DOM tree - template <typename Q> Header(const Handle<Q>& e) - : Handle<HeaderObject>(e) { - } - /// Constructor to be used when creating a new DOM tree - Header(const std::string& author, const std::string& url); - /// Assignment operator - Header& operator=(const Header& e) { - if ( this != & e ) { - m_element = e.m_element; - } - return *this; - } - /// Accessor to object name - const std::string name() const; - /// Accessor: set object name - void setName(const std::string& new_name); - /// Accessor to object title - const std::string title() const; - /// Accessor: set object title - void setTitle(const std::string& new_title); - /// Accessor to object author - const std::string& author() const; - /// Accessor: set object author - void setAuthor(const std::string& new_author); - /// Accessor to object url - const std::string& url() const; - /// Accessor: set object url - void setUrl(const std::string& new_url); - /// Accessor to object status - const std::string& status() const; - /// Accessor: set object status - void setStatus(const std::string& new_status); - /// Accessor to object version - const std::string& version() const; - /// Accessor: set object version - void setVersion(const std::string& new_version); - /// Accessor to object comment - const std::string& comment() const; - /// Accessor: set object comment - void setComment(const std::string& new_comment); - }; - - /// Handle class describing a constant (define) object in lcdd - /** - * Constant objects are parsed by the expression evaluator and - * are subsequently available for expression evaluation. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Constant: public Handle<ConstantObject> { - public: - /// Definition of the implementation type - typedef ConstantObject Object; - /// Default constructor - Constant() - : Handle<ConstantObject> () { - } - /// Constructorto be used for assignment from a handle - Constant(const Constant& e) - : Handle<ConstantObject> (e) { - } - /// Constructor to be used when reading the already parsed DOM tree - template <typename Q> - Constant(const Handle<Q>& e) - : Handle<ConstantObject> (e) { - } - /// Constructor to be used when creating a new DOM tree - Constant(const std::string& name); - /// Constructor to be used when creating a new DOM tree - Constant(const std::string& name, const std::string& val, const std::string& typ="number"); - /// Access the constant - std::string dataType() const; - /// String representation of this object - std::string toString() const; - }; +namespace dd4hep { + + // Forward declarations + class Detector; + class IDDescriptor; + class VisAttrObject; + class HeaderObject; + class ConstantObject; + class RegionObject; + class LimitSetObject; + + typedef ROOT::Math::XYZVector Position; + typedef ROOT::Math::XYZVector XYZAngles; + + template <class V> V RotateX(const V& v, double a) { + return ROOT::Math::VectorUtil::RotateX(v, a); + } + template <class V> V RotateY(const V& v, double a) { + return ROOT::Math::VectorUtil::RotateY(v, a); + } + template <class V> V RotateZ(const V& v, double a) { + return ROOT::Math::VectorUtil::RotateZ(v, a); + } - /// Handle class describing an element in the periodic table - /** - * For details please see the ROOT TGeo information: - * \see http://root.cern.ch/root/html/TGeoElement.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Atom: public Handle<TGeoElement> { - public: - /// Definition of the implementation type - typedef TGeoElement Object; - /// Default constructor - Atom() - : Handle<Object>() { - } + /** Rotation class with the (3D) rotation represented by + * angles describing first a rotation of + * an angle phi (yaw) about the Z axis, + * followed by a rotation of an angle theta (pitch) about the new Y' axis, + * followed by a third rotation of an angle psi (roll) about the final X'' axis. + * This is sometimes referred to as the Euler 321 sequence. + * It has not to be confused with the typical Goldstein definition of the Euler Angles + * (Z-X-Z or 313 sequence) which is used by the ROOT::Math::EulerAngles class. + * \see http://root.cern.ch/root/html/ROOT__Math__RotationZYX.html + */ + typedef ROOT::Math::RotationZYX RotationZYX; + /** \see http://root.cern.ch/root/html/ROOT__Math__RotationZ.html */ + typedef ROOT::Math::RotationZ RotationZ; + /** \see http://root.cern.ch/root/html/ROOT__Math__RotationY.html */ + typedef ROOT::Math::RotationY RotationY; + /** \see http://root.cern.ch/root/html/ROOT__Math__RotationX.html */ + typedef ROOT::Math::RotationX RotationX; + /** \see http://root.cern.ch/root/html/ROOT__Math__Rotation3D.html */ + typedef ROOT::Math::Rotation3D Rotation3D; + /** \see http://root.cern.ch/root/html/ROOT__Math__EulerAngels.html */ + typedef ROOT::Math::EulerAngles EulerAngles; + /** \see http://root.cern.ch/root/html/ROOT__Math__Transform3D.html */ + typedef ROOT::Math::Transform3D Transform3D; + /** \see http://root.cern.ch/root/html/ROOT__Math__Translations3D.html */ + typedef ROOT::Math::Translation3D Translation3D; + + + /// Handle class describing an author entity + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Author: public Ref_t { + public: + /// Default constructor + Author() = default; + /// Constructorto be used for assignment from a handle + Author(const Author& e) = default; + /// Constructor to be used when assigning already valid handle + template <typename Q> Author(const Handle<Q>& e) : Ref_t(e) { } + /// Constructor to be used when creating a new object + Author(Detector& doc); + /// Assignment operator + Author& operator=(const Author& e) = default; + /// Access the auhor's name + std::string authorName() const; + /// Set the author's name + void setAuthorName(const std::string& nam); + /// Access the auhor's email address + std::string authorEmail() const; + /// Set the author's email address + void setAuthorEmail(const std::string& addr); + }; + + /// Handle class describing the basic information about geometry objects as it is defined in Detector + /** + * Description of the geometry header. Containes useful auxiliary information. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Header: public Handle<HeaderObject> { + public: + /// Default constructor + Header() = default; + /// Constructorto be used for assignment from a handle + Header(const Header& e) = default; + /// Constructor to be used when reading the already parsed DOM tree + template <typename Q> Header(const Handle<Q>& e) : Handle<HeaderObject>(e) { } + /// Constructor to be used when creating a new DOM tree + Header(const std::string& author, const std::string& url); + /// Assignment operator + Header& operator=(const Header& e) = default; + /// Accessor to object name + const std::string name() const; + /// Accessor: set object name + void setName(const std::string& new_name); + /// Accessor to object title + const std::string title() const; + /// Accessor: set object title + void setTitle(const std::string& new_title); + /// Accessor to object author + const std::string& author() const; + /// Accessor: set object author + void setAuthor(const std::string& new_author); + /// Accessor to object url + const std::string& url() const; + /// Accessor: set object url + void setUrl(const std::string& new_url); + /// Accessor to object status + const std::string& status() const; + /// Accessor: set object status + void setStatus(const std::string& new_status); + /// Accessor to object version + const std::string& version() const; + /// Accessor: set object version + void setVersion(const std::string& new_version); + /// Accessor to object comment + const std::string& comment() const; + /// Accessor: set object comment + void setComment(const std::string& new_comment); + }; + + /// Handle class describing a constant (define) object in description + /** + * Constant objects are parsed by the expression evaluator and + * are subsequently available for expression evaluation. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Constant: public Handle<ConstantObject> { + public: + /// Default constructor + Constant() = default; + /// Constructorto be used for assignment from a handle + Constant(const Constant& e) = default; + /// Constructor to be used when reading the already parsed DOM tree + template <typename Q> Constant(const Handle<Q>& e) : Handle<ConstantObject> (e) { } + /// Constructor to be used when creating a new DOM tree + Constant(const std::string& name); + /// Constructor to be used when creating a new DOM tree + Constant(const std::string& name, const std::string& val, const std::string& typ="number"); + /// Access the constant + std::string dataType() const; + /// String representation of this object + std::string toString() const; + }; + + /// Handle class describing an element in the periodic table + /** + * For details please see the ROOT TGeo information: + * \see http://root.cern.ch/root/html/TGeoElement.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Atom: public Handle<TGeoElement> { + public: + /// Default constructor + Atom() = default; #ifndef __CINT__ - /// Constructorto be used for assignment from a handle - Atom(const Handle<Object>& e) - : Handle<Object>(e) { - } + /// Constructorto be used for assignment from a handle + Atom(const Handle<Object>& e) : Handle<Object>(e) { } #endif - /// Constructor to be used when creating from a object handle - template <typename Q> - Atom(const Handle<Q>& e) - : Handle<Object>(e) { - } - /// Constructor to be used when reading the already parsed DOM tree - Atom(const std::string& name, const std::string& formula, int Z, int N, double density); - }; - - /// Handle class describing a material - /** @class Material Objects.h - * - * For details please see the ROOT TGeo information: - * \see http://root.cern.ch/root/html/TGeoMedium.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Material: public Handle<TGeoMedium> { - public: - /// Definition of the implementation type - typedef TGeoMedium Object; - - /// Default constructor - Material() - : Handle<Object>() { - } + /// Constructor to be used when creating from a object handle + template <typename Q> Atom(const Handle<Q>& e) : Handle<Object>(e) { } + /// Constructor to be used when reading the already parsed DOM tree + Atom(const std::string& name, const std::string& formula, int Z, int N, double density); + }; + + /// Handle class describing a material + /** @class Material Objects.h + * + * For details please see the ROOT TGeo information: + * \see http://root.cern.ch/root/html/TGeoMedium.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Material: public Handle<TGeoMedium> { + public: + /// Default constructor + Material() = default; #ifndef __CINT__ - /// Constructorto be used for assignment from material handle - Material(const Handle<Object>& e) - : Handle<Object>(e) { - } + /// Constructorto be used for assignment from material handle + Material(const Handle<Object>& e) : Handle<Object>(e) { } #endif - /// Constructorto be used for assignment from object handle - template <typename Q> - Material(const Handle<Q>& e) - : Handle<Object>(e) { - } - /// proton number of the underlying material - double Z() const ; - /// atomic number of the underlying material - double A() const ; - /// density of the underlying material - double density() const ; - /// String representation of this object - std::string toString() const; - /// Access the radiation length of the underlying material - double radLength() const; - /// Access the interaction length of the underlying material - double intLength() const; + /// Constructorto be used for assignment from object handle + template <typename Q> Material(const Handle<Q>& e) : Handle<Object>(e) { } + /// proton number of the underlying material + double Z() const ; + /// atomic number of the underlying material + double A() const ; + /// density of the underlying material + double density() const ; + /// String representation of this object + std::string toString() const; + /// Access the radiation length of the underlying material + double radLength() const; + /// Access the interaction length of the underlying material + double intLength() const; + }; + + /// Handle class describing visualization attributes + /** @class VisAttr Objects.h + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class VisAttr: public Handle<VisAttrObject> { + public: + enum Style { + SOLID = 0x1, WIREFRAME = 0x2, DASHED = 0x2, LAST_STYLE }; - - /// Handle class describing visualization attributes - /** @class VisAttr Objects.h - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class VisAttr: public Handle<VisAttrObject> { - public: - enum Style { - SOLID = 0x1, WIREFRAME = 0x2, DASHED = 0x2, LAST_STYLE - }; - typedef VisAttrObject Object; - /// Default constructor - VisAttr() - : Handle<Object>() { - } - /// Copy constructor for handle - VisAttr(const VisAttr& e) - : Handle<Object>(e) { - } + /// Default constructor + VisAttr() = default; + /// Copy constructor for handle + VisAttr(const VisAttr& e) = default; #ifndef __CINT__ - /// Copy constructor for handle - VisAttr(const Handle<Object>& e) - : Handle<Object>(e) { - } + /// Copy constructor for handle + VisAttr(const Handle<Object>& e) : Handle<Object>(e) { } #endif - /// Constructor to be used for assignment from object handle - template <typename Q> - VisAttr(const Handle<Q>& e) - : Handle<Object>(e) { - } - /// Constructor to be used when creating a new registered visualization object - VisAttr(const std::string& name); - /// Constructor to be used when creating a new registered visualization object - VisAttr(const char* name); - /// Assignment operator - VisAttr& operator=(const VisAttr& attr) { - m_element = attr.m_element; - return *this; - } - - /// Get Flag to show/hide daughter elements - bool showDaughters() const; - /// Set Flag to show/hide daughter elements - void setShowDaughters(bool value); - - /// Get visibility flag - bool visible() const; - /// Set visibility flag - void setVisible(bool value); - - /// Get line style - int lineStyle() const; - /// Set line style - void setLineStyle(int style); - - /// Get drawing style - int drawingStyle() const; - /// Set drawing style - void setDrawingStyle(int style); - - /// Get alpha value - float alpha() const; - /// Set alpha value - void setAlpha(float value); - - /// Get object color - int color() const; - /// Set object color - void setColor(float red, float green, float blue); - - /// Get RGB values of the color (if valid) - bool rgb(float& red, float& green, float& blue) const; - - /// String representation of this object - std::string toString() const; - }; - - /// Deprecated: Handle class describing an alignment entry - /** - * \deprecated{Class representing an alignment entry} - * - * @author M.Frank - * @version 1.0 - */ - class AlignmentEntry: public Handle<TGeoPhysicalNode> { - public: - typedef Handle<TGeoPhysicalNode> Base; - /// Constructor to be used when reading the already parsed DOM tree - template <typename Q> - AlignmentEntry(const Handle<Q>& h) - : Base(h) { - } - /// Constructor to be used when creating a new aligment entry - AlignmentEntry(const std::string& path); - /// Align the PhysicalNode (translation only) - int align(const Position& pos, bool check = false, double overlap = 0.001); - /// Align the PhysicalNode (rotation only) - int align(const RotationZYX& rot, bool check = false, double overlap = 0.001); - /// Align the PhysicalNode (translation + rotation) - int align(const Position& pos, const RotationZYX& rot, bool check = false, double overlap = 0.001); - }; - - /// Small object describing a limit structure acting on a particle type - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Limit { - public: - std::string particles; - std::string name; - std::string unit; - std::string content; - double value; - /// Default constructor - Limit() - : particles(), name(), unit(), content(), value(0.0) { - } - /// Copy constructor - Limit(const Limit& c) - : particles(c.particles), name(c.name), unit(c.unit), content(c.content), value(c.value) { - } - /// Assignment operator - Limit& operator=(const Limit& c); - /// Equality operator - bool operator==(const Limit& c) const; - /// operator less - bool operator<(const Limit& c) const; - /// Conversion to a string representation - std::string toString() const; - }; - - /// Handle class describing a set of limits as they are used for simulation - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class LimitSet: public Handle<LimitSetObject> { - public: - typedef LimitSetObject Object; - /// Constructor to be used when reading the already parsed DOM tree - LimitSet() - : Handle<LimitSetObject>() { - } - /// Copy constructor for handle - LimitSet(const LimitSet& e) - : Handle<LimitSetObject>(e) { - } + /// Constructor to be used for assignment from object handle + template <typename Q> VisAttr(const Handle<Q>& e) : Handle<Object>(e) { } + /// Constructor to be used when creating a new registered visualization object + VisAttr(const std::string& name); + /// Constructor to be used when creating a new registered visualization object + VisAttr(const char* name); + /// Assignment operator + VisAttr& operator=(const VisAttr& attr) = default; + + /// Get Flag to show/hide daughter elements + bool showDaughters() const; + /// Set Flag to show/hide daughter elements + void setShowDaughters(bool value); + + /// Get visibility flag + bool visible() const; + /// Set visibility flag + void setVisible(bool value); + + /// Get line style + int lineStyle() const; + /// Set line style + void setLineStyle(int style); + + /// Get drawing style + int drawingStyle() const; + /// Set drawing style + void setDrawingStyle(int style); + + /// Get alpha value + float alpha() const; + /// Set alpha value + void setAlpha(float value); + + /// Get object color + int color() const; + /// Set object color + void setColor(float red, float green, float blue); + + /// Get RGB values of the color (if valid) + bool rgb(float& red, float& green, float& blue) const; + + /// String representation of this object + std::string toString() const; + }; + + /// Small object describing a limit structure acting on a particle type + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Limit { + public: + std::string particles; + std::string name; + std::string unit; + std::string content; + double value = 0.0; + /// Default constructor + Limit() = default; + /// Copy constructor + Limit(const Limit& c) = default; + /// Assignment operator + Limit& operator=(const Limit& c) = default; + /// Equality operator + bool operator==(const Limit& c) const; + /// operator less + bool operator<(const Limit& c) const; + /// Conversion to a string representation + std::string toString() const; + }; + + /// Handle class describing a set of limits as they are used for simulation + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class LimitSet: public Handle<LimitSetObject> { + public: + /// Constructor to be used when reading the already parsed DOM tree + LimitSet() = default; + /// Copy constructor for handle + LimitSet(const LimitSet& e) = default; #ifndef __CINT__ - /// Copy constructor for handle - LimitSet(const Handle<LimitSetObject>& e) - : Handle<LimitSetObject>(e) { - } + /// Copy constructor for handles + LimitSet(const Handle<LimitSetObject>& e) : Handle<LimitSetObject>(e) { } #endif - /// Constructor to be used when reading the already parsed DOM tree - template <typename Q> - LimitSet(const Handle<Q>& e) - : Handle<LimitSetObject>(e) { - } - /// Assignment operator - LimitSet& operator=(const LimitSet& c) { - m_element = c.m_element; - return *this; - } - /// Constructor to be used when creating a new object - LimitSet(const std::string& name); - /// Add new limit. Returns true if the new limit was added, false if it already existed. - bool addLimit(const DD4hep::Geometry::Limit& limit); - /// Accessor to limits container - const std::set<DD4hep::Geometry::Limit>& limits() const; - }; - - /// Handle class describing a region as used in simulation - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Region: public Handle<RegionObject> { - public: - /// Implemeting class - typedef RegionObject Object; - /// Default constructor - Region() - : Handle<Object>() { - } - /// Copy Constructor - Region(const Region& e) - : Handle<Object>(e) { - } + /// Constructor to be used when reading the already parsed DOM tree + template <typename Q> LimitSet(const Handle<Q>& e) : Handle<LimitSetObject>(e) { } + /// Assignment operator + LimitSet& operator=(const LimitSet& c) = default; + /// Constructor to be used when creating a new object + LimitSet(const std::string& name); + /// Add new limit. Returns true if the new limit was added, false if it already existed. + bool addLimit(const Limit& limit); + /// Accessor to limits container + const std::set<Limit>& limits() const; + }; + + /// Handle class describing a region as used in simulation + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Region: public Handle<RegionObject> { + public: + /// Default constructor + Region() = default; + /// Copy Constructor + Region(const Region& e) = default; #ifndef __CINT__ - /// Copy Constructor - Region(const Handle<RegionObject>& e) - : Handle<Object>(e) { - } + /// Copy Constructor + Region(const Handle<RegionObject>& e) : Handle<Object>(e) { } #endif - /// Constructor to be used when assigning handle - template <typename Q> - Region(const Handle<Q>& e) - : Handle<Object>(e) { - } - /// Constructor to be used when creating a new object - Region(const std::string& name); - /// Assignment operator - Region& operator=(const Region& c) { - m_element = c.m_element; - return *this; - } - - Region& setStoreSecondaries(bool value); - Region& setThreshold(double value); - Region& setCut(double value); - /// Access references to user limits - std::vector<std::string>& limits() const; - - /// Access cut value - double cut() const; - /// Access production threshold - double threshold() const; - /// Access secondaries flag - bool storeSecondaries() const; - /// Access use_default_cut flag - bool useDefaultCut() const; - /// Access was_threshold_set flag - bool wasThresholdSet() const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + /// Constructor to be used when assigning handle + template <typename Q> Region(const Handle<Q>& e) : Handle<Object>(e) { } + /// Constructor to be used when creating a new object + Region(const std::string& name); + /// Assignment operator + Region& operator=(const Region& c) = default; + + Region& setStoreSecondaries(bool value); + Region& setThreshold(double value); + Region& setCut(double value); + /// Access references to user limits + std::vector<std::string>& limits() const; + + /// Access cut value + double cut() const; + /// Access production threshold + double threshold() const; + /// Access secondaries flag + bool storeSecondaries() const; + /// Access use_default_cut flag + bool useDefaultCut() const; + /// Access was_threshold_set flag + bool wasThresholdSet() const; + }; + +} /* End namespace dd4hep */ #include "Math/Vector4D.h" #include "Math/Point3D.h" namespace ROOT { namespace Math { - typedef DD4hep::Geometry::Position Position; /// Dot product of 3-vectors. - inline double operator *(const Position& l, const Position& r) { + inline double operator *(const dd4hep::Position& l, const dd4hep::Position& r) { return std::sqrt(l.X() * r.X() + l.Y() * r.Y() + l.Z() * r.Z()); } /// Calculate the mean length of two vectors - inline double mean_length(const Position& p1, const Position& p2) { + inline double mean_length(const dd4hep::Position& p1, const dd4hep::Position& p2) { return 0.5 * (p1.R() + p2.R()) / 2.0; } /// Calculate the mean direction of two vectors - inline Position mean_direction(const Position& p1, const Position& p2) { + inline dd4hep::Position mean_direction(const dd4hep::Position& p1, const dd4hep::Position& p2) { return 0.5 * (p1 + p2); } diff --git a/DDCore/include/DD4hep/OpaqueData.h b/DDCore/include/DD4hep/OpaqueData.h index 0a5cb851c..28dfe2e25 100644 --- a/DDCore/include/DD4hep/OpaqueData.h +++ b/DDCore/include/DD4hep/OpaqueData.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class BasicGrammar; @@ -90,7 +90,7 @@ namespace DD4hep { BOUND_DATA = 1<<3 }; /// Data buffer: plain data are allocated directly on this buffer - /** Internal data buffer is sufficient to store any vector */ + /** detaill data buffer is sufficient to store any vector */ unsigned char data[sizeof(std::vector<void*>)]; /// Destructor function -- only set if the object is valid void (*destruct)(void*); @@ -131,5 +131,5 @@ namespace DD4hep { void assign(const void* ptr,const std::type_info& typ); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_OPAQUEDATA_H */ diff --git a/DDCore/include/DD4hep/OpaqueDataBinder.h b/DDCore/include/DD4hep/OpaqueDataBinder.h index 006410e7c..8a647ead6 100644 --- a/DDCore/include/DD4hep/OpaqueDataBinder.h +++ b/DDCore/include/DD4hep/OpaqueDataBinder.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,84 +20,88 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Helper class to bind string values to C++ data objects (primitive or complex) - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP - */ - struct ValueBinder { }; + /// DD4hep internal namespace declaration for utilities and implementation details + namespace detail { - /// Helper class to bind string values to a STL vector of data objects (primitive or complex) - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP - */ - struct VectorBinder { }; + /// Helper class to bind string values to C++ data objects (primitive or complex) + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP + */ + struct ValueBinder { }; - /// Helper class to bind string values to a STL list of data objects (primitive or complex) - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP - */ - struct ListBinder { }; + /// Helper class to bind string values to a STL vector of data objects (primitive or complex) + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP + */ + struct VectorBinder { }; - /// Helper class to bind string values to a STL set of data objects (primitive or complex) - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP - */ - struct SetBinder { }; + /// Helper class to bind string values to a STL list of data objects (primitive or complex) + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP + */ + struct ListBinder { }; - /// Helper class to bind STL map objects - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP - */ - struct MapBinder { }; + /// Helper class to bind string values to a STL set of data objects (primitive or complex) + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP + */ + struct SetBinder { }; - /// Helper class to bind string values to C++ data items - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP - */ - class OpaqueDataBinder { - public: - /// Default constructor - OpaqueDataBinder() = default; - /// Default destructor - ~OpaqueDataBinder() = default; + /// Helper class to bind STL map objects + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP + */ + struct MapBinder { }; - /// Binding function for scalar items. See the implementation function for the concrete instantiations - template <typename BINDER, typename OBJECT> static - bool bind(const BINDER& b, OBJECT& object, const std::string& typ, const std::string& val); + /// Helper class to bind string values to C++ data items + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP + */ + class OpaqueDataBinder { + public: + /// Default constructor + OpaqueDataBinder() = default; + /// Default destructor + ~OpaqueDataBinder() = default; - /// Binding function for sequences (unmapped STL containers) - template <typename OBJECT> static - bool bind_sequence(OBJECT& object, const std::string& typ, const std::string& val); + /// Binding function for scalar items. See the implementation function for the concrete instantiations + template <typename BINDER, typename OBJECT> static + bool bind(const BINDER& b, OBJECT& object, const std::string& typ, const std::string& val); - /// Binding function for STL maps. Does not fill data! - template <typename BINDER, typename OBJECT> static - bool bind_map(const BINDER& b, OBJECT& o, const std::string& key_type, const std::string& val_type); + /// Binding function for sequences (unmapped STL containers) + template <typename OBJECT> static + bool bind_sequence(OBJECT& object, const std::string& typ, const std::string& val); - /// Filling function for STL maps. - template <typename BINDER, typename OBJECT> static - bool insert_map(const BINDER& b, OBJECT& o, - const std::string& key_type, const std::string& key, - const std::string& val_type, const std::string& val); - /// Filling function for STL maps. - template <typename BINDER, typename OBJECT> static - bool insert_map(const BINDER& b, OBJECT& o, - const std::string& key_type, const std::string& val_type, - const std::string& pair_data); - }; -} /* End namespace DD4hep */ + /// Binding function for STL maps. Does not fill data! + template <typename BINDER, typename OBJECT> static + bool bind_map(const BINDER& b, OBJECT& o, const std::string& key_type, const std::string& val_type); + + /// Filling function for STL maps. + template <typename BINDER, typename OBJECT> static + bool insert_map(const BINDER& b, OBJECT& o, + const std::string& key_type, const std::string& key, + const std::string& val_type, const std::string& val); + /// Filling function for STL maps. + template <typename BINDER, typename OBJECT> static + bool insert_map(const BINDER& b, OBJECT& o, + const std::string& key_type, const std::string& val_type, + const std::string& pair_data); + }; + } +} /* End namespace dd4hep */ #endif /* DD4HEP_OPAQUEDATABINDER_H */ diff --git a/DDCore/include/DD4hep/Operators.h b/DDCore/include/DD4hep/Operators.h index 94357a7c1..a482782bf 100644 --- a/DDCore/include/DD4hep/Operators.h +++ b/DDCore/include/DD4hep/Operators.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Helper functor to select elements by name (using name() member method) template <typename T> class ByName { @@ -63,5 +63,5 @@ namespace DD4hep { template <typename T> ByNameAttr<T> byNameAttr(const T* o) { return ByNameAttr<T>(o->name); } template <typename T> ByNameAttr<T> byNameAttr(const T& o) { return ByNameAttr<T>(o.name); } -} // End namespace DD4hep +} // End namespace dd4hep #endif // DD4HEP_DD4HEP_OPERATORS_H diff --git a/DDCore/include/DD4hep/Parsers.h b/DDCore/include/DD4hep/Parsers.h index 4ff7529ce..59df94581 100644 --- a/DDCore/include/DD4hep/Parsers.h +++ b/DDCore/include/DD4hep/Parsers.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,23 +26,23 @@ // ============================================================================ #define PARSERS_DECL_FOR_SINGLE(Type) \ - namespace DD4hep { namespace Parsers { \ + namespace dd4hep { namespace Parsers { \ int parse(Type& result, const std::string& input); \ }} #define DD4HEP_DEFINE_PARSER_DUMMY(Type) \ PARSERS_DECL_FOR_SINGLE(Type) \ - namespace DD4hep { namespace Parsers { \ + namespace dd4hep { namespace Parsers { \ int parse(Type&, const std::string&) { return 1; } \ }} #define PARSERS_DECL_FOR_PAIR(FirstType, SecondType) \ - namespace DD4hep { namespace Parsers { \ + namespace dd4hep { namespace Parsers { \ int parse(std::pair<FirstType, SecondType >& result,const std::string& input); }} #if defined(DD4HEP_HAVE_ALL_PARSERS) #define PARSERS_DECL_FOR_LIST(InnerType) \ - namespace DD4hep { namespace Parsers { \ + namespace dd4hep { namespace Parsers { \ int parse(std::vector<InnerType >& result,const std::string& input); \ int parse(std::list<InnerType >& result,const std::string& input); \ int parse(std::set<InnerType >& result,const std::string& input); \ @@ -57,7 +57,7 @@ #else #define PARSERS_DECL_FOR_LIST(InnerType) \ - namespace DD4hep { namespace Parsers { \ + namespace dd4hep { namespace Parsers { \ int parse(std::vector<InnerType >& result,const std::string& input); \ int parse(std::list<InnerType >& result,const std::string& input); \ int parse(std::set<InnerType >& result,const std::string& input); \ @@ -94,7 +94,7 @@ * * @endcode * - * @see DD4hep::Parsers::parse + * @see dd4hep::Parsers::parse * @see Property * * @author Alexander MAZUROV Alexander.Mazurov@gmail.com @@ -105,7 +105,7 @@ // ======================================================================== /// parse the <c>bool</c> value -/** @see DD4hep::Parsers::BoolGrammar +/** @see dd4hep::Parsers::BoolGrammar * @param result (output) boolean result * @param input (input) the string to be parsed * @return status code @@ -118,7 +118,7 @@ PARSERS_DECL_FOR_SINGLE(bool) // ======================================================================== /// parse the <c>char</c> value /** - * @see DD4hep::Parsers::CharGrammar + * @see dd4hep::Parsers::CharGrammar * @param result (output) boolean result * @param input (input) the string to be parsed * @return status code @@ -129,15 +129,15 @@ PARSERS_DECL_FOR_SINGLE(bool) */ #if defined(DD4HEP_HAVE_ALL_PARSERS) PARSERS_DECL_FOR_SINGLE(char) -/// @see DD4hep::Parsers::parser(char&,std::string&) +/// @see dd4hep::Parsers::parser(char&,std::string&) PARSERS_DECL_FOR_SINGLE(unsigned char) -/// @see DD4hep::Parsers::parser(char&,std::string&) +/// @see dd4hep::Parsers::parser(char&,std::string&) PARSERS_DECL_FOR_SINGLE(signed char) #endif // ======================================================================== /// parse the <c>int</c> value /** - * @see DD4hep::Parsers::IntGrammar + * @see dd4hep::Parsers::IntGrammar * @param result (output) integer result * @param input (input) the string to be parsed * @return status code @@ -146,27 +146,27 @@ PARSERS_DECL_FOR_SINGLE(signed char) * @author Vanya BELYAEV ibelyaev@physics.syr.edu * @date 2006-05-14 */ -/// @see DD4hep::Parsers::parser( int&, const std::string& ) +/// @see dd4hep::Parsers::parser( int&, const std::string& ) PARSERS_DECL_FOR_SINGLE(int) PARSERS_DECL_FOR_SINGLE(long) #if defined(DD4HEP_HAVE_ALL_PARSERS) -/// @see DD4hep::Parsers::parser( int&, const std::string& ) +/// @see dd4hep::Parsers::parser( int&, const std::string& ) PARSERS_DECL_FOR_SINGLE(short) -/// @see DD4hep::Parsers::parser( int&, const std::string& ) +/// @see dd4hep::Parsers::parser( int&, const std::string& ) PARSERS_DECL_FOR_SINGLE(unsigned short) -/// @see DD4hep::Parsers::parser( int&, const std::string& ) +/// @see dd4hep::Parsers::parser( int&, const std::string& ) PARSERS_DECL_FOR_SINGLE(unsigned int) -/// @see DD4hep::Parsers::parser( int&, const std::string& ) +/// @see dd4hep::Parsers::parser( int&, const std::string& ) PARSERS_DECL_FOR_SINGLE(unsigned long) -/// @see DD4hep::Parsers::parser( int&, const std::string& ) +/// @see dd4hep::Parsers::parser( int&, const std::string& ) PARSERS_DECL_FOR_SINGLE(long long) -/// @see DD4hep::Parsers::parser( int&, const std::string& ) +/// @see dd4hep::Parsers::parser( int&, const std::string& ) PARSERS_DECL_FOR_SINGLE(unsigned long long) #endif // ======================================================================== /// parse the <c>double</c> value /** - * @see DD4hep::Parsers::RealGrammar + * @see dd4hep::Parsers::RealGrammar * @param result (output) double result * @param input (input) the string to be parsed * @return status code @@ -176,16 +176,16 @@ PARSERS_DECL_FOR_SINGLE(long long) * @date 2006-05-14 */ PARSERS_DECL_FOR_SINGLE(double) -/// @see DD4hep::Parsers::parser( double&, const std::string& ) +/// @see dd4hep::Parsers::parser( double&, const std::string& ) PARSERS_DECL_FOR_SINGLE(float) #if defined(DD4HEP_HAVE_ALL_PARSERS) -/// @see DD4hep::Parsers::parser( double&, const std::string& ) +/// @see dd4hep::Parsers::parser( double&, const std::string& ) PARSERS_DECL_FOR_SINGLE(long double) #endif // ======================================================================== /** parse the <c>std::string</c> value * - * @see DD4hep::Parsers::StringGrammar + * @see dd4hep::Parsers::StringGrammar * @param result (output) string result * @param input (input) the string to be parsed * @return status code @@ -222,8 +222,8 @@ PARSERS_DECL_FOR_LIST(long double) // ======================================================================== /// parse the <c>std::pair\<double,double\></c> value /** - * @see DD4hep::Parsers::PairGrammar - * @see DD4hep::Parsers::RealGrammar + * @see dd4hep::Parsers::PairGrammar + * @see dd4hep::Parsers::RealGrammar * @param result (output) pair of doubles * @param input (input) the string to be parsed * @return status code @@ -236,8 +236,8 @@ PARSERS_DECL_FOR_PAIR(double, double) // ======================================================================== /** parse the <c>std::pair\<int,int\></c> value * - * @see DD4hep::Parsers::PairGrammar - * @see DD4hep::Parsers::IntGrammar + * @see dd4hep::Parsers::PairGrammar + * @see dd4hep::Parsers::IntGrammar * @param result (output) pair of integers * @param input (input) the string to be parsed * @return status code @@ -250,15 +250,15 @@ PARSERS_DECL_FOR_PAIR(int, int) // ======================================================================== /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector for utilities using boost::spirit parsers namespace Parsers { /// parse the <c>std::vector\<std::pair\<double,double\> \></c> value /** - * @see DD4hep::Parsers::VectorGrammar - * @see DD4hep::Parsers::PairGrammar - * @see DD4hep::Parsers::RealGrammar + * @see dd4hep::Parsers::VectorGrammar + * @see dd4hep::Parsers::PairGrammar + * @see dd4hep::Parsers::RealGrammar * @param result (output) vector with pairs of doubles * @param input (input) the string to be parsed * @return status code @@ -271,9 +271,9 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::vector\<std::pair\<int,int\> \></c> value /** - * @see DD4hep::Parsers::VectorGrammar - * @see DD4hep::Parsers::PairGrammar - * @see DD4hep::Parsers::IntGrammar + * @see dd4hep::Parsers::VectorGrammar + * @see dd4hep::Parsers::PairGrammar + * @see dd4hep::Parsers::IntGrammar * @param result (output) vector with pairs of int * @param input (input) the string to be parsed * @return status code @@ -288,8 +288,8 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::vector\<std::vector\<std::string\> \></c> value /** - * @see DD4hep::Parsers::VectorGrammar - * @see DD4hep::Parsers::StringGrammar + * @see dd4hep::Parsers::VectorGrammar + * @see dd4hep::Parsers::StringGrammar * @param result (output) vector with vectors of strings * @param input (input) the string to be parsed * @return status code @@ -302,8 +302,8 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::vector\<std::vector\<double\> \></c> value /** - * @see DD4hep::Parsers::VectorGrammar - * @see DD4hep::Parsers::RealGrammar + * @see dd4hep::Parsers::VectorGrammar + * @see dd4hep::Parsers::RealGrammar * @param result (output) vector with vectors of doubles * @param input (input) the string to be parsed * @return status code @@ -318,8 +318,8 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<int , int\></c> value /** - * @see DD4hep::Parsers::MapGrammar - * @see DD4hep::Parsers::IntGrammar + * @see dd4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::IntGrammar * @param result (output) map with integer key and double value * @param input (input) the string to be parsed * @return status code @@ -332,9 +332,9 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<int , double\></c> value /** - * @see DD4hep::Parsers::MapGrammar - * @see DD4hep::Parsers::IntGrammar - * @see DD4hep::Parsers::RealGrammar + * @see dd4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::IntGrammar + * @see dd4hep::Parsers::RealGrammar * @param result (output) map with integer key and double value * @param input (input) the string to be parsed * @return status code @@ -347,8 +347,8 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<std::string , std::string\></c> value /** - * @see DD4hep::Parsers::MapGrammar - * @see DD4hep::Parsers::StringGrammar + * @see dd4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::StringGrammar * @param result (output) map with string key and value * @param input (input) the string to be parsed * @return status code @@ -361,9 +361,9 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<std::string , int\></c> value /** - * @see DD4hep::Parsers::MapGrammar - * @see DD4hep::Parsers::StringGrammar - * @see DD4hep::Parsers::IntGrammar + * @see dd4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::StringGrammar + * @see dd4hep::Parsers::IntGrammar * @param result (output) map with string key and integer value * @param input (input) the string to be parsed * @return status code @@ -376,9 +376,9 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<std::string , double\></c> value /** - * @see DD4hep::Parsers::MapGrammar - * @see DD4hep::Parsers::StringGrammar - * @see DD4hep::Parsers::RealGrammar + * @see dd4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::StringGrammar + * @see dd4hep::Parsers::RealGrammar * @param result (output) map with string key and integer value * @param input (input) the string to be parsed * @return status code @@ -391,9 +391,9 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<std::string , std::vector\<std::string\> \></c> value /** - * @see DD4hep::Parsers::MapGrammar - * @see DD4hep::Parsers::StringGrammar - * @see DD4hep::Parsers::VectorGrammar + * @see dd4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::StringGrammar + * @see dd4hep::Parsers::VectorGrammar * @param result (output) map with string value and * vector of strings as value * @param input (input) the string to be parsed @@ -407,10 +407,10 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<std::string , std::vector\<int\> \></c> value /** - * @see DD4hep::Parsers::MapGrammar - * @see DD4hep::Parsers::StringGrammar - * @see DD4hep::Parsers::VectorGrammar - * @see DD4hep::Parsers::IntGrammar + * @see dd4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::StringGrammar + * @see dd4hep::Parsers::VectorGrammar + * @see dd4hep::Parsers::IntGrammar * @param result (output) map with string value and * vector of integers as value * @param input (input) the string to be parsed @@ -424,10 +424,10 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<std::string , std::vector\<double\> \></c> value /** - * @see DD4hep::Parsers::MapGrammar - * @see DD4hep::Parsers::StringGrammar - * @see DD4hep::Parsers::VectorGrammar - * @see DD4hep::Parsers::RealGrammar + * @see dd4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::StringGrammar + * @see dd4hep::Parsers::VectorGrammar + * @see dd4hep::Parsers::RealGrammar * @param result (output) map with string value and * vector of doubles as value * @param input (input) the string to be parsed @@ -441,7 +441,7 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<int,std::string\> \></c> objects /** - * @see DD4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::MapGrammar * @author Vanya BELYAEV ibelyaev@physics.syr.edu * @author Alexander MAZUROV Alexander.Mazurov@gmail.com * @date 2007-12-06 @@ -451,7 +451,7 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<unsigned int,std::string\> \></c> objects /** - * @see DD4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::MapGrammar * @author Vanya BELYAEV ibelyaev@physics.syr.edu * @author Alexander MAZUROV Alexander.Mazurov@gmail.com * @date 2007-12-06 @@ -462,7 +462,7 @@ namespace DD4hep { // ======================================================================== /// parse the <c>std::map\<unsigned int,std::string\> \></c> objects /** - * @see DD4hep::Parsers::MapGrammar + * @see dd4hep::Parsers::MapGrammar */ int parse(std::map<std::string, unsigned int>& result, const std::string& input); #endif @@ -472,10 +472,10 @@ namespace DD4hep { /** * @code * - * const std::string input = "'PackageName':DD4hepKernel" ; + * const std::string input = "'PackageName':dd4hepKernel" ; * std::string name ; * std::string value ; - * int sc = DD4hep::Parsers::parse ( name , value , input ) ; + * int sc = dd4hep::Parsers::parse ( name , value , input ) ; * if ( sc.isFailure() ) { ... } * std::cout << "\tParsed name is " << name * << "\tParsed value is " << value << std::endl @@ -566,7 +566,7 @@ namespace DD4hep { return 1; // RETURN } } // end of namespace Parsers -} // end of namespace DD4hep +} // end of namespace dd4hep #ifndef DD4HEP_PARSERS_NO_ROOT @@ -586,7 +586,7 @@ namespace ROOT { } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector for utilities using boost::spirit parsers namespace Parsers { @@ -737,7 +737,7 @@ namespace DD4hep { */ int parse(ROOT::Math::PxPyPzEVector& result, const std::string& input); } // end of namespace Parsers -} // end of namespace DD4hep +} // end of namespace dd4hep // ======================================================================== diff --git a/DDCore/include/DD4hep/Path.h b/DDCore/include/DD4hep/Path.h index ffd096785..bb71bd757 100644 --- a/DDCore/include/DD4hep/Path.h +++ b/DDCore/include/DD4hep/Path.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +23,7 @@ // Forward declartions /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Path handling class. @@ -45,48 +45,48 @@ namespace DD4hep { class Path : public std::string { public: /// Default constructor - Path() : std::string() { } + Path() : std::string() { } /// Initializing constructor - Path(const std::string& c) : std::string(c) { } + Path(const std::string& copy) : std::string(copy) { } /// Copy constructor - Path(const Path& c) : std::string(c) { } + Path(const Path& copy) : std::string(copy) { } /// Move constructor - Path(Path&& c) : std::string(c) { } + Path(Path&& copy) : std::string(copy) { } /// Assigning constructor - template <class Iter> Path(Iter _begin,Iter _end) { + template <class Iter> Path(Iter _begin,Iter _end) { if ( _begin != _end ) { - std::string s(_begin, _end); - this->std::string::operator=(s); + std::string str(_begin, _end); + this->std::string::operator=(str); } } /// Default destructor ~Path() {} /// Assignment operator from Path object - Path& operator=(const Path& c) { - this->std::string::operator=(c); + Path& operator=(const Path& copy) { + this->std::string::operator=(copy); return *this; } /// Assignment operator from string object - Path& operator=(const std::string& c) { - this->std::string::operator=(c); + Path& operator=(const std::string& copy) { + this->std::string::operator=(copy); return *this; } /// Move assignment operator from Path object - Path& operator=(Path&& c) { - this->std::string::operator=(c); + Path& operator=(Path&& copy) { + this->std::string::operator=(copy); return *this; } /// Assignment operator from string object - Path& operator=(std::string&& c) { - this->std::string::operator=(c); + Path& operator=(std::string&& copy) { + this->std::string::operator=(copy); return *this; } /// Append operation - Path& append(const std::string& c); + Path& append(const std::string& copy); /// Append operation - Path& operator/=(const Path& c) { return append(c); } + Path& operator/=(const Path& copy) { return append(copy); } /// Append operation - Path& operator/=(const std::string& c) { return append(c); } + Path& operator/=(const std::string& copy) { return append(copy); } /// Normalize path name Path normalize() const; /// Parent's path @@ -113,5 +113,5 @@ namespace DD4hep { static const Path& dot_dot_path(); }; }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_PATH_H */ diff --git a/DDCore/include/DD4hep/PluginCreators.h b/DDCore/include/DD4hep/PluginCreators.h index dcb5fced9..f18783ae4 100644 --- a/DDCore/include/DD4hep/PluginCreators.h +++ b/DDCore/include/DD4hep/PluginCreators.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,13 +22,10 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - // Forward declarations - class LCDD; - } + // Forward declarations + class Detector; /// Handler for factories of type: ConstructionFactory /** Signature: void* create(const char* arg); @@ -36,44 +33,39 @@ namespace DD4hep { * An exception is thrown in the event the object cannot be created. * The object is properly casted before given to the caller. */ - void* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, void* (*cast)(void*)); - void* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, const std::string& arg, void* (*cast)(void*)); - void* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, int argc, char** argv, void* (*cast)(void*)); - void* createProcessor(Geometry::LCDD& lcdd, int argc, char** argv, void* (*cast)(void*)); + void* createPlugin(const std::string& factory, Detector& description, void* (*cast)(void*)); + void* createPlugin(const std::string& factory, Detector& description, const std::string& arg, void* (*cast)(void*)); + void* createPlugin(const std::string& factory, Detector& description, int argc, char** argv, void* (*cast)(void*)); + void* createProcessor(Detector& description, int argc, char** argv, void* (*cast)(void*)); /// Handler for factories of type: ConstructionFactory with casted return type - template <typename T> T* createPlugin(const std::string& factory, Geometry::LCDD& lcdd) { - typedef T plugin_t; - struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } }; - return (plugin_t*)createPlugin(factory, lcdd, __cast::cast); + template <typename T> T* createPlugin(const std::string& factory, Detector& description) { + struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } }; + return (T*)createPlugin(factory, description, __cast::cast); } /// Handler for factories of type: ConstructionFactory with casted return type - template <typename T> T* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, const std::string& arg) { - typedef T plugin_t; - struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } }; - return (plugin_t*)createPlugin(factory, lcdd, arg, __cast::cast); + template <typename T> T* createPlugin(const std::string& factory, Detector& description, const std::string& arg) { + struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } }; + return (T*)createPlugin(factory, description, arg, __cast::cast); } /// Handler for factories of type: ConstructionFactory with casted return type - template <typename T> T* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, int argc, const void** argv) { - typedef T plugin_t; - struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } }; - return (plugin_t*)createPlugin(factory, lcdd, argc, (char**)argv, __cast::cast); + template <typename T> T* createPlugin(const std::string& factory, Detector& description, int argc, const void** argv) { + struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } }; + return (T*)createPlugin(factory, description, argc, (char**)argv, __cast::cast); } /// Handler for factories of type: ConstructionFactory with casted return type - template <typename T> T* createProcessor(Geometry::LCDD& lcdd, int argc, char** argv) { - typedef T plugin_t; - struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } }; - return (plugin_t*)createProcessor(lcdd, argc, argv, __cast::cast); + template <typename T> T* createProcessor(Detector& description, int argc, char** argv) { + struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } }; + return (T*)createProcessor(description, argc, argv, __cast::cast); } /// Handler for factories of type: ConstructionFactory with casted return type - template <typename T> T* createProcessor(Geometry::LCDD& lcdd, int argc, const void** argv) { - typedef T plugin_t; - struct __cast{ static void* cast(void* p) { return &dynamic_cast<plugin_t&>(*(plugin_t*)p); } }; - return (plugin_t*)createProcessor(lcdd, argc, (char**)argv, __cast::cast); + template <typename T> T* createProcessor(Detector& description, int argc, const void** argv) { + struct __cast{ static void* cast(void* p) { return &dynamic_cast<T&>(*(T*)p); } }; + return (T*)createProcessor(description, argc, (char**)argv, __cast::cast); } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif // DD4HEP_PLUGINCREATORS_H diff --git a/DDCore/include/DD4hep/PluginTester.h b/DDCore/include/DD4hep/PluginTester.h index 34ed9d37b..6bb661f5a 100644 --- a/DDCore/include/DD4hep/PluginTester.h +++ b/DDCore/include/DD4hep/PluginTester.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { class PluginTester { public: /// Definition of the extension type @@ -81,5 +81,5 @@ namespace DD4hep { } }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif // DD4HEP_PLUGINTESTER_H diff --git a/DDCore/include/DD4hep/Plugins.h b/DDCore/include/DD4hep/Plugins.h index 588dad6da..6ee358076 100644 --- a/DDCore/include/DD4hep/Plugins.h +++ b/DDCore/include/DD4hep/Plugins.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,42 +27,37 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { + class Detector; class NamedObject; template <typename T> class Handle; - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - class LCDD; - } /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { - class Handle_t; - class Collection_t; - class Document; - class Element; + namespace xml { + //class Handle; + //class Collection_t; + //class Document; + //class Element; } /// Factory base class implementing some utilities struct PluginFactoryBase { - typedef Geometry::LCDD lcdd_t; - typedef Handle<NamedObject> ref_t; - typedef XML::Handle_t xml_h; - typedef XML::Element xml_e; + //typedef xml::Handle_t xml_h; + //typedef xml::Element xml_e; typedef std::string str_t; - template <typename T> static T* ptr(const T* p) { return (T*)p; } - template <typename T> static T& ref(const T* p) { return *(T*)p; } - template <typename T> static T val(const T* p) { return T(*p); } - template <typename T> static T value(const void* p) { return (T)p; } - static const char* value(const void* p) { return (const char*)(p); } - template <typename T> static T make_return(const T& p) { return p; } + template <typename T> static T* ptr(const T* _p) { return (T*)_p; } + template <typename T> static T& ref(const T* _p) { return *(T*)_p; } + template <typename T> static T val(const T* _p) { return T(*_p); } + template <typename T> static T value(const void* _p) { return (T)_p; } + static const char* value(const void* _p) { return (const char*)(_p); } + template <typename T> static T make_return(const T& _p) { return _p; } }; - template <> inline int PluginFactoryBase::value<int>(const void* p) { return *(int*)(p); } - template <> inline long PluginFactoryBase::value<long>(const void* p) { return *(long*)(p); } - template <> inline std::string PluginFactoryBase::value<std::string>(const void* p) { return *(std::string*)(p); } - template <> inline const std::string& PluginFactoryBase::value<const std::string&>(const void* p) { return *(std::string*)(p); } + template <> inline int PluginFactoryBase::value<int>(const void* _p) { return *(int*)(_p); } + template <> inline long PluginFactoryBase::value<long>(const void* _p) { return *(long*)(_p); } + template <> inline std::string PluginFactoryBase::value<std::string>(const void* _p) { return *(std::string*)(_p); } + template <> inline const std::string& PluginFactoryBase::value<const std::string&>(const void* _p) { return *(std::string*)(_p); } /// Helper to debug plugin manager calls /** @@ -93,13 +88,13 @@ namespace DD4hep { template <typename FUNCTION> struct FuncPointer { union { void* ptr; FUNCTION fcn; } fptr; FuncPointer() { fptr.ptr = 0; } - FuncPointer(const FuncPointer& c) { fptr.ptr = c.fptr.ptr; } + FuncPointer(const FuncPointer& _c) { fptr.ptr = _c.fptr.ptr; } FuncPointer(FUNCTION func) { fptr.fcn = func; } - FuncPointer(void* p) { fptr.ptr = p; } + FuncPointer(void* _p) { fptr.ptr = _p; } void* ptr() const { return fptr.ptr; } FUNCTION function() const { return fptr.func; } - FuncPointer& operator=(const FuncPointer& c) { - fptr.ptr = c.fptr.ptr; return *this; + FuncPointer& operator=(const FuncPointer& copy) { + fptr.ptr = copy.fptr.ptr; return *this; } }; template <typename FUNCTION> static FuncPointer<FUNCTION> function(FUNCTION func) { @@ -156,7 +151,7 @@ namespace DD4hep { } #endif }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ namespace { /// Base factory template @@ -164,16 +159,17 @@ namespace { } #if defined(DD4HEP_ROOT_VERSION_5) -#define DD4HEP_FACTORY_CALL(type,name,signature) DD4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::wrapper); +#define DD4HEP_FACTORY_CALL(type,name,signature) dd4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::wrapper); #else -namespace DD4hep { - template <> inline long PluginFactoryBase::make_return(const long& p) { static long s=p; return (long)&s; } +namespace dd4hep { + template <> inline long PluginFactoryBase::make_return(const long& value) + { static long stored=value; return (long)&stored; } } -#define DD4HEP_FACTORY_CALL(type,name,signature) DD4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::call) +#define DD4HEP_FACTORY_CALL(type,name,signature) dd4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::call) #define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(X,Y) #endif -#define DD4HEP_OPEN_PLUGIN(ns,name) namespace ns { namespace { struct name {}; } } namespace DD4hep +#define DD4HEP_OPEN_PLUGIN(ns,name) namespace ns { namespace { struct name {}; } } namespace dd4hep #define DD4HEP_PLUGINSVC_CNAME(name, serial) name##_dict_##serial #define DD4HEP_PLUGINSVC_FACTORY(type,name,signature,serial) \ namespace { \ @@ -185,7 +181,7 @@ namespace DD4hep { #define DD4HEP_PLUGIN_FACTORY_ARGS_0(R) \ template <typename P> class Factory<P, R()> \ - : public DD4hep::PluginFactoryBase { \ + : public dd4hep::PluginFactoryBase { \ public: \ static void wrapper(void *ret,void*,const std::vector<void*>& ,void*) { \ *(void**)ret = (void*)call(); \ @@ -196,7 +192,7 @@ namespace DD4hep { #define DD4HEP_PLUGIN_FACTORY_ARGS_1(R,A0) \ template <typename P> class Factory<P, R(A0)> \ - : public DD4hep::PluginFactoryBase { \ + : public dd4hep::PluginFactoryBase { \ public: \ static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ *(void**)ret = (void*)call(value<A0>(a[0])); \ @@ -207,7 +203,7 @@ namespace DD4hep { #define DD4HEP_PLUGIN_FACTORY_ARGS_2(R,A0,A1) \ template <typename P> class Factory<P, R(A0,A1)> \ - : public DD4hep::PluginFactoryBase { \ + : public dd4hep::PluginFactoryBase { \ public: \ static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ *(void**)ret = (void*)call(value<A0>(a[0]),value<A1>(a[1])); \ @@ -218,7 +214,7 @@ namespace DD4hep { #define DD4HEP_PLUGIN_FACTORY_ARGS_3(R,A0,A1,A2) \ template <typename P> class Factory<P, R(A0,A1,A2)> \ - : public DD4hep::PluginFactoryBase { \ + : public dd4hep::PluginFactoryBase { \ public: \ static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ *(void**)ret = (void*)call(value<A0>(a[0]),value<A1>(a[1]),value<A2>(a[2])); \ @@ -229,7 +225,7 @@ namespace DD4hep { #define DD4HEP_PLUGIN_FACTORY_ARGS_4(R,A0,A1,A2,A3) \ template <typename P> class Factory<P, R(A0,A1,A2,A3)> \ - : public DD4hep::PluginFactoryBase { \ + : public dd4hep::PluginFactoryBase { \ public: \ static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ *(void**)ret = (void*)call(value<A0>(a[0]),value<A1>(a[1]),value<A2>(a[2]),value<A3>(a[3])); \ @@ -240,7 +236,7 @@ namespace DD4hep { #define DD4HEP_PLUGIN_FACTORY_ARGS_5(R,A0,A1,A2,A3,A4) \ template <typename P> class Factory<P, R(A0,A1,A2,A3,A4)> \ - : public DD4hep::PluginFactoryBase { \ + : public dd4hep::PluginFactoryBase { \ public: \ static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ *(void**)ret = (void*)call(value<A0>(a[0]),value<A1>(a[1]),value<A2>(a[2]),value<A3>(a[3]),value<A4>(a[4])); \ diff --git a/DDCore/include/DD4hep/PolarGridRPhi.h b/DDCore/include/DD4hep/PolarGridRPhi.h index 978d4c027..8a22a56d7 100644 --- a/DDCore/include/DD4hep/PolarGridRPhi.h +++ b/DDCore/include/DD4hep/PolarGridRPhi.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,95 +19,86 @@ #include "DD4hep/Segmentations.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class PolarGridRPhi; } - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::PolarGridRPhi> > PolarGridRPhiHandle; - - /// Implementation class for the grid XZ segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class PolarGridRPhi : public PolarGridRPhiHandle { - public: - /// Default constructor - PolarGridRPhi() = default; - /// Copy constructor - PolarGridRPhi(const PolarGridRPhi& e) = default; - /// Copy Constructor from segmentation base object - PolarGridRPhi(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - PolarGridRPhi(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> PolarGridRPhi(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - PolarGridRPhi& operator=(const PolarGridRPhi& seg) = default; - /// Equality operator - bool operator==(const PolarGridRPhi& seg) const - { return m_element == seg.m_element; } - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - /// access the grid size in R - double gridSizeR() const; - /// access the grid size in Phi - double gridSizePhi() const; - /// set the grid size in R - void setGridSizeR(double cellSize) const; - /// set the grid size in Phi - void setGridSizePhi(double cellSize) const; - /// access the coordinate offset in R - double offsetR() const; - /// access the coordinate offset in Phi - double offsetPhi() const; - /// set the coordinate offset in R - void setOffsetR(double offset) const; - /// set the coordinate offset in Phi - void setOffsetPhi(double offset) const; - /// access the field name used for R - const std::string& fieldNameR() const; - /// access the field name used for Phi - const std::string& fieldNamePhi() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::PolarGridRPhi> > PolarGridRPhiHandle; - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in x - -# size in z - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; + /// Implementation class for the grid XZ segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class PolarGridRPhi : public PolarGridRPhiHandle { + public: + /// Default constructor + PolarGridRPhi() = default; + /// Copy constructor + PolarGridRPhi(const PolarGridRPhi& e) = default; + /// Copy Constructor from segmentation base object + PolarGridRPhi(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + PolarGridRPhi(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> PolarGridRPhi(const Handle<Q>& e) : Handle<Object>(e) {} + /// Assignment operator + PolarGridRPhi& operator=(const PolarGridRPhi& seg) = default; + /// Equality operator + bool operator==(const PolarGridRPhi& seg) const + { return m_element == seg.m_element; } + /// determine the position based on the cell ID + Position position(const CellID& cellID) const; + /// determine the cell ID based on the position + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + /// access the grid size in R + double gridSizeR() const; + /// access the grid size in Phi + double gridSizePhi() const; + /// set the grid size in R + void setGridSizeR(double cellSize) const; + /// set the grid size in Phi + void setGridSizePhi(double cellSize) const; + /// access the coordinate offset in R + double offsetR() const; + /// access the coordinate offset in Phi + double offsetPhi() const; + /// set the coordinate offset in R + void setOffsetR(double offset) const; + /// set the coordinate offset in Phi + void setOffsetPhi(double offset) const; + /// access the field name used for R + const std::string& fieldNameR() const; + /// access the field name used for Phi + const std::string& fieldNamePhi() const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif // DD4HEP_DDCORE_POLARGRIDRPHI_H + Returns a vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 2: + -# size in x + -# size in z + */ + std::vector<double> cellDimensions(const CellID& cellID) const; + }; +} /* End namespace dd4hep */ +#endif // DD4HEP_DDCORE_POLARGRIDRPHI_H diff --git a/DDCore/include/DD4hep/PolarGridRPhi2.h b/DDCore/include/DD4hep/PolarGridRPhi2.h index 84fe1a5f9..70d23c35d 100644 --- a/DDCore/include/DD4hep/PolarGridRPhi2.h +++ b/DDCore/include/DD4hep/PolarGridRPhi2.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,112 +19,103 @@ #include "DD4hep/Segmentations.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class PolarGridRPhi2; } - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::PolarGridRPhi2> > PolarGridRPhi2Handle; - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::PolarGridRPhi2> > PolarGridRPhi2Handle; - - /// Implementation class for the grid XZ segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY + /// Implementation class for the grid XZ segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class PolarGridRPhi2 : public PolarGridRPhi2Handle { + public: + /// Default constructor + PolarGridRPhi2() = default; + /// Copy constructor + PolarGridRPhi2(const PolarGridRPhi2& e) = default; + /// Copy Constructor from segmentation base object + PolarGridRPhi2(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + PolarGridRPhi2(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> PolarGridRPhi2(const Handle<Q>& e) : Handle<Object>(e) {} + /// Assignment operator + PolarGridRPhi2& operator=(const PolarGridRPhi2& seg) = default; + /// Equality operator + bool operator==(const PolarGridRPhi2& seg) const + { return m_element == seg.m_element; } + /// determine the position based on the cell ID + Position position(const CellID& cellID) const; + /// determine the cell ID based on the position + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + /// access the grid size in R + double gridSizeR() const; + /// access the grid size in Phi + double gridSizePhi() const; + /// access the coordinate offset in R + double offsetR() const; + /// access the coordinate offset in Phi + double offsetPhi() const; + /// set the coordinate offset in R + void setOffsetR(double offset) const; + /// set the coordinate offset in Phi + void setOffsetPhi(double offset) const; + /// access the grid size in R + std::vector<double> gridRValues() const; + /// access the grid size in Phi + std::vector<double> gridPhiValues() const; + /// set the grid Boundaries in R + void setGridSizeR(double cellSize, int rID) const; + /// set the grid size in Phi + void setGridSizePhi(double cellSize, int phiID) const; + /// set the grid boundaries for R + /** @param rValues The boundaries of the segments in radius, + * the first value is the lower boundary of the first bin, + * the highest value is the upper boundary of the last bin */ - class PolarGridRPhi2 : public PolarGridRPhi2Handle { - public: - /// Default constructor - PolarGridRPhi2() = default; - /// Copy constructor - PolarGridRPhi2(const PolarGridRPhi2& e) = default; - /// Copy Constructor from segmentation base object - PolarGridRPhi2(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - PolarGridRPhi2(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> PolarGridRPhi2(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - PolarGridRPhi2& operator=(const PolarGridRPhi2& seg) = default; - /// Equality operator - bool operator==(const PolarGridRPhi2& seg) const - { return m_element == seg.m_element; } - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - /// access the grid size in R - double gridSizeR() const; - /// access the grid size in Phi - double gridSizePhi() const; - /// access the coordinate offset in R - double offsetR() const; - /// access the coordinate offset in Phi - double offsetPhi() const; - /// set the coordinate offset in R - void setOffsetR(double offset) const; - /// set the coordinate offset in Phi - void setOffsetPhi(double offset) const; - /// access the grid size in R - std::vector<double> gridRValues() const; - /// access the grid size in Phi - std::vector<double> gridPhiValues() const; - /// set the grid Boundaries in R - void setGridSizeR(double cellSize, int rID) const; - /// set the grid size in Phi - void setGridSizePhi(double cellSize, int phiID) const; - /// set the grid boundaries for R - /** @param rValues The boundaries of the segments in radius, - * the first value is the lower boundary of the first bin, - * the highest value is the upper boundary of the last bin - */ - void setGridRValues(std::vector<double> const& rValues) const; - /// set the grid size in Phi for each bin in R - /** @param phiValues The size in phi for each bin in R, - * this vector is one smaller than the vector - * for PolarGridRPhi2::setGridRValues - */ - void setGridPhiValues(std::vector<double> const& phiValues) const; - - /// access the field name used for R - const std::string& fieldNameR() const; - /// access the field name used for Phi - const std::string& fieldNamePhi() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi + void setGridRValues(std::vector<double> const& rValues) const; + /// set the grid size in Phi for each bin in R + /** @param phiValues The size in phi for each bin in R, + * this vector is one smaller than the vector + * for PolarGridRPhi2::setGridRValues + */ + void setGridPhiValues(std::vector<double> const& phiValues) const; - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in x - -# size in z - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; + /// access the field name used for R + const std::string& fieldNameR() const; + /// access the field name used for Phi + const std::string& fieldNamePhi() const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + Returns a vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 2: + -# size in x + -# size in z + */ + std::vector<double> cellDimensions(const CellID& cellID) const; + }; +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_POLARGRIDRPHI2_H diff --git a/DDCore/include/DD4hep/Primitives.h b/DDCore/include/DD4hep/Primitives.h index e68ae0185..ddb2ec2f3 100644 --- a/DDCore/include/DD4hep/Primitives.h +++ b/DDCore/include/DD4hep/Primitives.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,7 +25,7 @@ #include <stdexcept> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace describing generic detector segmentations namespace DDSegmentation { @@ -35,35 +35,21 @@ namespace DD4hep { typedef long long int CellID; typedef long long int VolumeID; } - - /// We need it so often: one-at-time 64 bit hash function - unsigned long long int hash64(const char* key); - unsigned long long int hash64(const std::string& key); - - /// We need it so often: one-at-time 32 bit hash function - inline unsigned int hash32(const char* key) { - unsigned int hash = 0; - const char* k = key; - for (; *k; k++) { - hash += *k; - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); hash += (hash << 15); - return hash; - } - inline unsigned int hash32(const std::string& key) { - return hash32(key.c_str()); - } - /// Convert date into epoch time (seconds since 1970) - long int makeTime(int year, int month, int day, - int hour=0, int minutes=0, int seconds=0); - - /// Convert date into epoch time (seconds since 1970) - long int makeTime(const std::string& date, const char* fmt="%d-%m-%Y %H:%M:%S"); - + + // Put here global basic type definitions derived from primitive types of the dd4hep namespace +#ifdef __CINT__ + typedef DDSegmentation::CellID CellID; + typedef DDSegmentation::VolumeID VolumeID; + typedef DDSegmentation::BitField64 BitField64; + typedef DDSegmentation::BitFieldValue BitFieldValue; +#else + using DDSegmentation::CellID; + using DDSegmentation::VolumeID; + using DDSegmentation::BitField64; + using DDSegmentation::BitFieldValue; +#endif + /// Specialized exception to be thrown if invalid handles are accessed class invalid_handle_exception : public std::runtime_error { public: @@ -80,12 +66,12 @@ namespace DD4hep { }; /// Macro for deprecated functions. Prints once only. useage: deprecatedCall(__PRETTY_FUNCTION__); -#define DD4HEP_DEPRECATED_CALL(tag,replacement,func) \ - { static bool __dd4hep_first=true; \ - if ( __dd4hep_first ) { __dd4hep_first=false; \ - DD4hep::printout(DD4hep::WARNING,tag, \ - "Deprecated function: '%s' use '%s' instead.", \ - func,replacement); \ +#define DD4HEP_DEPRECATED_CALL(tag,replacement,func) \ + { static bool __dd4hep_first=true; \ + if ( __dd4hep_first ) { __dd4hep_first=false; \ + dd4hep::printout(dd4hep::WARNING,tag, \ + "Deprecated function: '%s' use '%s' instead.", \ + func,replacement); \ }} /// ABI information about type names @@ -105,74 +91,8 @@ namespace DD4hep { /// Throw exception when handles are check for validity void notImplemented(const std::string& msg); - - /// A bit of support for printing primitives - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP - */ - template<typename T> struct Primitive { - public: - /// Type decribed by th class - typedef T value_t; - /// Definition of the vector type - typedef std::vector<value_t> vector_t; - - /// Definition of the short integer mapped type - typedef std::pair<short,value_t> short_pair_t; - /// Definition of the unsigned short integer mapped type - typedef std::pair<unsigned short,value_t> ushort_pair_t; - /// Definition of the integer mapped type - typedef std::pair<int,value_t> int_pair_t; - /// Definition of the unsigned integer mapped type - typedef std::pair<unsigned int,value_t> uint_pair_t; - /// Definition of the long integer mapped type - typedef std::pair<long,value_t> long_pair_t; - /// Definition of the unsigned long integer mapped type - typedef std::pair<unsigned long,value_t> ulong_pair_t; - /// Definition of the size_t mapped type - typedef std::pair<size_t,value_t> size_pair_t; - /// Definition of the string mapped type - typedef std::pair<std::string,value_t> string_pair_t; - - /// Definition of the short integer mapped type - typedef std::map<short,value_t> short_map_t; - /// Definition of the unsigned short integer mapped type - typedef std::map<unsigned short,value_t> ushort_map_t; - /// Definition of the integer mapped type - typedef std::map<int,value_t> int_map_t; - /// Definition of the unsigned integer mapped type - typedef std::map<unsigned int,value_t> uint_map_t; - /// Definition of the long integer mapped type - typedef std::map<long,value_t> long_map_t; - /// Definition of the unsigned long integer mapped type - typedef std::map<unsigned long,value_t> ulong_map_t; - /// Definition of the size_t mapped type - typedef std::map<size_t,value_t> size_map_t; - /// Definition of the string mapped type - typedef std::map<std::string,value_t> string_map_t; - /// Definition of the limits - typedef std::numeric_limits<value_t> limits; - - /// Access to default printf format - static const char* default_format(); - /// Access to the specific printf format. May be overloaded by users - static const char* format() { return default_format(); } - /// Access to the RTTI data type - static const std::type_info& type() { return typeid(value_t); } - /// Access to the RTTI data type - static std::string type_name() { return typeName(type()); } - /// Auto conversion to string using the default format - static std::string toString(T value); - /// Get typed null pointer (for template selctions) - static const value_t* null_pointer() { return (value_t*)0; } - }; - - /// Class to perform dynamic casts using unknown pointers. - /** @class ComponentCast Primitives.h DD4hep/Primitives.h + /** @class ComponentCast Primitives.h dd4hep/Primitives.h * * It is mandatory that the pointers referred do actually * support the asked functionalty. @@ -201,14 +121,14 @@ namespace DD4hep { virtual ~ComponentCast(); public: - template <typename TYPE> static void _destroy(void* p) { - TYPE* q = (TYPE*)p; - if (q) delete q; + template <typename TYPE> static void _destroy(void* arg) { + TYPE* ptr = (TYPE*)arg; + if (ptr) delete ptr; } - template <typename TYPE> static void* _cast(const void* p) { - TYPE* q = (TYPE*)p; - q = dynamic_cast<TYPE*>(q); - return (void*)q; + template <typename TYPE> static void* _cast(const void* arg) { + TYPE* ptr = (TYPE*)arg; + ptr = dynamic_cast<TYPE*>(ptr); + return (void*)ptr; } template <typename TYPE> static ComponentCast& instance() { static ComponentCast c(typeid(TYPE),_destroy<TYPE>,_cast<TYPE>); @@ -223,373 +143,448 @@ namespace DD4hep { void* apply_downCast(const ComponentCast& to, const void* ptr) const; }; - - // Put here global basic type definitions derived from primitive types of the DD4hep namespace -#ifdef __CINT__ - typedef DDSegmentation::CellID CellID; - typedef DDSegmentation::VolumeID VolumeID; - typedef DDSegmentation::BitField64 BitField64; - typedef DDSegmentation::BitFieldValue BitFieldValue; -#else - using DDSegmentation::CellID; - using DDSegmentation::VolumeID; - using DDSegmentation::BitField64; - using DDSegmentation::BitFieldValue; -#endif - /// Convert volumeID to string format (016X) std::string volumeID(VolumeID vid); - template<typename C> struct ClearOnReturn { - C& container; - ClearOnReturn(C& c) : container(c) { } - ~ClearOnReturn() { container.clear(); } - }; - - /// Helper to copy objects. - template <typename T> inline void copyObject(void* target,const void* source) { - const T* s = (const T*)source; - ::new(target) T(*s); - } - /// Helper to destruct objects. Note: The memory is NOT released! - template <typename T> inline void destructObject(T* p) { - p->~T(); - } - /// Helper to delete objects from heap and reset the pointer. Saves many many lines of code - template <typename T> inline void deletePtr(T*& p) { - if (0 != p) - delete p; - p = 0; - } - /// Helper to delete objects from heap and reset the pointer. Saves many many lines of code - template <typename T> inline void deleteObject(T* p) { - if (0 != p) - delete p; - } - /// Helper to delete objects from heap and reset the pointer - template <typename T> inline void destroyObject(T*& p) { - deletePtr(p); - } - /// Functor to delete objects from heap and reset the pointer - template <typename T> class DestroyObject { - public: - void operator()(T& p) const { - destroyObject(p); + /// DD4hep internal namespace declaration for utilities and implementation details + namespace detail { + + /// We need it so often: one-at-time 64 bit hash function + unsigned long long int hash64(const char* key); + unsigned long long int hash64(const std::string& key); + + /// We need it so often: one-at-time 32 bit hash function + inline unsigned int hash32(const char* key) { + unsigned int hash = 0; + const char* k = key; + for (; *k; k++) { + hash += *k; + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); hash += (hash << 15); + return hash; + } + inline unsigned int hash32(const std::string& key) { + return hash32(key.c_str()); } - }; - - /// Operator to select second element of a pair - template <typename T> class Select2nd { - public: - typedef T arg_t; - typedef typename T::second_type result_t; - /// Operator function - const result_t& operator()(const arg_t &p) const { return p.second; } - }; - /// Generator to create Operator to select value elements of a map - template <typename T> Select2nd<typename T::value_type> select2nd(const T&) - { return Select2nd<typename T::value_type>(); } - - /// Operator to select the first element of a pair - template <typename T> class Select1st { - public: - typedef T arg_t; - typedef typename T::first_type result_t; - /// Operator function - const result_t& operator()(const arg_t &p) const { return p.first; } - }; - /// Generator to create Operator to select key values of a map - template <typename T> Select1st<typename T::value_type> select1st(const T&) - { return Select1st<typename T::value_type>(); } + /// Convert date into epoch time (seconds since 1970) + long int makeTime(int year, int month, int day, + int hour=0, int minutes=0, int seconds=0); + + /// Convert date into epoch time (seconds since 1970) + long int makeTime(const std::string& date, const char* fmt="%d-%m-%Y %H:%M:%S"); + - /// map Functor to delete objects from heap - template <typename M> class DestroyObjects { - public: - M& object; - DestroyObjects(M& m) : object(m) { } - void operator()(std::pair<typename M::key_type, typename M::mapped_type> p) const - { DestroyObject<typename M::mapped_type>()(p.second); } - void operator()() const { - if ( !object.empty() ) for_each(object.begin(),object.end(),(*this)); - object.clear(); + /// A bit of support for handling and printing primitives + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP + */ + template<typename T> struct Primitive { + public: + /// Type decribed by th class + typedef T value_t; + /// Definition of the vector type + typedef std::vector<value_t> vector_t; + + /// Definition of the short integer mapped type + typedef std::pair<short,value_t> short_pair_t; + /// Definition of the unsigned short integer mapped type + typedef std::pair<unsigned short,value_t> ushort_pair_t; + /// Definition of the integer mapped type + typedef std::pair<int,value_t> int_pair_t; + /// Definition of the unsigned integer mapped type + typedef std::pair<unsigned int,value_t> uint_pair_t; + /// Definition of the long integer mapped type + typedef std::pair<long,value_t> long_pair_t; + /// Definition of the unsigned long integer mapped type + typedef std::pair<unsigned long,value_t> ulong_pair_t; + /// Definition of the size_t mapped type + typedef std::pair<size_t,value_t> size_pair_t; + /// Definition of the string mapped type + typedef std::pair<std::string,value_t> string_pair_t; + + /// Definition of the short integer mapped type + typedef std::map<short,value_t> short_map_t; + /// Definition of the unsigned short integer mapped type + typedef std::map<unsigned short,value_t> ushort_map_t; + /// Definition of the integer mapped type + typedef std::map<int,value_t> int_map_t; + /// Definition of the unsigned integer mapped type + typedef std::map<unsigned int,value_t> uint_map_t; + /// Definition of the long integer mapped type + typedef std::map<long,value_t> long_map_t; + /// Definition of the unsigned long integer mapped type + typedef std::map<unsigned long,value_t> ulong_map_t; + /// Definition of the size_t mapped type + typedef std::map<size_t,value_t> size_map_t; + /// Definition of the string mapped type + typedef std::map<std::string,value_t> string_map_t; + /// Definition of the limits + typedef std::numeric_limits<value_t> limits; + + /// Access to default printf format + static const char* default_format(); + /// Access to the specific printf format. May be overloaded by users + static const char* format() { return default_format(); } + /// Access to the RTTI data type + static const std::type_info& type() { return typeid(value_t); } + /// Access to the RTTI data type + static std::string type_name() { return typeName(type()); } + /// Auto conversion to string using the default format + static std::string toString(T value); + /// Get typed null pointer (for template selctions) + static const value_t* null_pointer() { return (value_t*)0; } + }; + + template<typename C> struct ClearOnReturn { + C& container; + ClearOnReturn(C& c) : container(c) { } + ~ClearOnReturn() { container.clear(); } + }; + + /// Helper to copy objects. + template <typename T> inline void copyObject(void* target,const void* source) { + const T* src = (const T*)source; + ::new(target) T(*src); } - }; - template <typename M> void destroyObjects(M& m) - { DestroyObjects<M> del(m); del(); } - template <typename M> DestroyObjects<M> destroy2nd(M& m) - { DestroyObjects<M> del(m); del(); } - - /// map Functor to delete objects from heap - template <typename M> class DestroyFirst { - public: - M& object; - DestroyFirst(M& m) : object(m) { } - void operator()(std::pair<typename M::key_type, typename M::mapped_type> p) const - { DestroyObject<typename M::key_type>()(p.first); } - void operator()() const { - if ( !object.empty() ) for_each(object.begin(),object.end(),(*this)); - object.clear(); + /// Helper to destruct objects. Note: The memory is NOT released! + template <typename T> inline void destructObject(T* ptr) { + ptr->~T(); } - }; - template <typename M> void destroyFirst(M& m) - { DestroyFirst<M> del(m); del(); } - template <typename M> void destroy1st(M& m) - { DestroyFirst<M> del(m); del(); } - - /// Helper to delete objects from heap and reset the pointer. Saves many many lines of code - template <typename T> inline void releasePtr(T& p) { - if (0 != p) - p->release(); - p = 0; - } - - /// Functor to release objects from heap and reset the pointer - template <typename T> class ReleaseObject { - public: - void operator()(T& p) const { - releasePtr(p); + /// Helper to delete objects from heap and reset the pointer. Saves many many lines of code + template <typename T> inline void deletePtr(T*& ptr) { + if (0 != ptr) + delete ptr; + ptr = 0; } - }; - /// Map Functor to release objects from heap - template <typename M> class ReleaseObjects { - public: - M& object; - ReleaseObjects(M& m) : object(m) { } - void operator()(std::pair<typename M::key_type, typename M::mapped_type> p) const - { ReleaseObject<typename M::mapped_type>()(p.second); } - void operator()() const { - if ( !object.empty() ) for_each(object.begin(),object.end(),(*this)); - object.clear(); + /// Helper to delete objects from heap and reset the pointer. Saves many many lines of code + template <typename T> inline void deleteObject(T* ptr) { + if (0 != ptr) + delete ptr; } - }; - template <typename M> ReleaseObject<typename M::value_type> releaseObject(M&) { - return ReleaseObject<typename M::value_type>(); - } - template <typename M> void releaseObjects(M& m) { - ReleaseObjects<M> rel(m); rel(); - } - template <typename M> void release2nd(M& m) { - ReleaseObjects<M> rel(m); rel(); - } - - /// Functor to delete objects from heap and reset the pointer - template <typename T> class ReferenceObject { - public: - typedef T arg_t; - T operator()(T p) const { - if ( p ) p->addRef(); - return p; + /// Helper to delete objects from heap and reset the pointer + template <typename T> inline void destroyObject(T*& ptr) { + deletePtr(ptr); } - }; - /// Functor to delete objects from heap and reset the pointer - template <typename M> class ReferenceObjects { - public: - typedef typename M::second_type result_t; - result_t operator()(const M& p) const { - return ReferenceObject<result_t>()(p.second); + /// Functor to delete objects from heap and reset the pointer + template <typename T> class DestroyObject { + public: + void operator()(T& ptr) const { + destroyObject(ptr); + } + }; + + /// Operator to select second element of a pair + template <typename T> class Select2nd { + public: + typedef T arg_t; + typedef typename T::second_type result_t; + /// Operator function + const result_t& operator()(const arg_t &arg) const { return arg.second; } + }; + /// Generator to create Operator to select value elements of a map + template <typename T> Select2nd<typename T::value_type> select2nd(const T&) + { return Select2nd<typename T::value_type>(); } + + /// Operator to select the first element of a pair + template <typename T> class Select1st { + public: + typedef T arg_t; + typedef typename T::first_type result_t; + /// Operator function + const result_t& operator()(const arg_t &arg) const { return arg.first; } + }; + /// Generator to create Operator to select key values of a map + template <typename T> Select1st<typename T::value_type> select1st(const T&) + { return Select1st<typename T::value_type>(); } + + + /// map Functor to delete objects from heap + template <typename M> class DestroyObjects { + public: + M& object; + DestroyObjects(M& obj) : object(obj) { } + void operator()(std::pair<typename M::key_type, typename M::mapped_type> arg) const + { DestroyObject<typename M::mapped_type>()(arg.second); } + void operator()() const { + if ( !object.empty() ) for_each(object.begin(),object.end(),(*this)); + object.clear(); + } + }; + template <typename M> void destroyObjects(M& obj) + { DestroyObjects<M> del(obj); del(); } + template <typename M> DestroyObjects<M> destroy2nd(M& obj) + { DestroyObjects<M> del(obj); del(); } + + /// map Functor to delete objects from heap + template <typename M> class DestroyFirst { + public: + M& object; + DestroyFirst(M& obj) : object(obj) { } + void operator()(std::pair<typename M::key_type, typename M::mapped_type> arg) const + { DestroyObject<typename M::key_type>()(arg.first); } + void operator()() const { + if ( !object.empty() ) for_each(object.begin(),object.end(),(*this)); + object.clear(); + } + }; + template <typename M> void destroyFirst(M& arg) + { DestroyFirst<M> del(arg); del(); } + template <typename M> void destroy1st(M& arg) + { DestroyFirst<M> del(arg); del(); } + + /// Helper to delete objects from heap and reset the pointer. Saves many many lines of code + template <typename T> inline void releasePtr(T& arg) { + if (0 != arg) + arg->release(); + arg = 0; } - }; - template <typename M> ReferenceObject<M> referenceObject(M&) { - return ReferenceObject<typename M::value_type>(); - } - template <typename M> ReferenceObjects<typename M::value_type> reference2nd(M&) { - return ReferenceObjects<typename M::value_type>(); - } - - /// Member function call-functor with no arguments - template <typename R, typename T> struct ApplyMemFunc { - typedef R (T::*memfunc_t)(); - memfunc_t func; - ApplyMemFunc(memfunc_t f) : func(f) {} - void operator()(T* p) const { if (p) { (p->*func)(); } } - }; - - /// Member function call-functor with 1 argument - template <typename R, typename T, typename A1> struct ApplyMemFunc1 { - typedef R (T::*memfunc_t)(A1 a1); - memfunc_t func; - A1& arg1; - ApplyMemFunc1(memfunc_t f, A1& a1) : func(f), arg1(a1) {} - void operator()(T* p) const { if ( p ) { (p->*func)(arg1); } } - }; - - /// Member function call-functor with 2 arguments - template <typename R, typename T, typename A1, typename A2> struct ApplyMemFunc2 { - typedef R (T::*memfunc_t)(A1 a1, A2 a2); - memfunc_t func; - A1& arg1; - A2& arg2; - ApplyMemFunc2(memfunc_t f, A1& a1, A2& a2) : func(f), arg1(a1), arg2(a2) {} - void operator()( T* p) const { if ( p ) { (p->*func)(arg1, arg2); } } - }; - - /// Member function call-functor with no arguments (const version) - template <typename R, typename T> struct ApplyMemFuncConst { - typedef R (T::*memfunc_t)() const; - memfunc_t func; - ApplyMemFuncConst(memfunc_t f) : func(f) {} - void operator()(const T* p) const { if ( p ) { (p->*func)(); } } - }; - - /// Member function call-functor with 1 argument (const version) - template <typename R, typename T, typename A1> struct ApplyMemFuncConst1 { - typedef R (T::*memfunc_t)(A1 a1) const; - memfunc_t func; - A1& arg1; - ApplyMemFuncConst1(memfunc_t f, A1& a1) : func(f), arg1(a1) {} - void operator()(const T* p) const { if ( p ) { (p->*func)(arg1); } } - }; - - /// Member function call-functor with 2 arguments (const version) - template <typename R, typename T, typename A1, typename A2> struct ApplyMemFuncConst2 { - typedef R (T::*memfunc_t)(A1 a1, A2 a2) const; - memfunc_t func; - A1& arg1; - A2& arg2; - ApplyMemFuncConst2(memfunc_t f, A1& a1, A2& a2) : func(f), arg1(a1), arg2(a2) {} - void operator()(const T* p) const { if ( p ) { (p->*func)(arg1, arg2); } } - }; - template <typename C, typename R, typename T> - void call_member_func(C& object, R (T::*pmf)()) - { std::for_each(object.begin(),object.end(),ApplyMemFunc<R,T>(pmf)); } + /// Functor to release objects from heap and reset the pointer + template <typename T> class ReleaseObject { + public: + void operator()(T& arg) const { + releasePtr(arg); + } + }; + /// Map Functor to release objects from heap + template <typename M> class ReleaseObjects { + public: + M& object; + ReleaseObjects(M& arg) : object(arg) { } + void operator()(std::pair<typename M::key_type, typename M::mapped_type> arg) const + { ReleaseObject<typename M::mapped_type>()(arg.second); } + void operator()() const { + if ( !object.empty() ) for_each(object.begin(),object.end(),(*this)); + object.clear(); + } + }; + template <typename M> ReleaseObject<typename M::value_type> releaseObject(M&) { + return ReleaseObject<typename M::value_type>(); + } + template <typename M> void releaseObjects(M& arg) { + ReleaseObjects<M> rel(arg); rel(); + } + template <typename M> void release2nd(M& arg) { + ReleaseObjects<M> rel(arg); rel(); + } - template <typename C, typename R, typename T> - void call_member_func(C& object, R (T::*pmf)() const) - { std::for_each(object.begin(),object.end(),ApplyMemFuncConst<R,T>(pmf)); } + /// Functor to delete objects from heap and reset the pointer + template <typename T> class ReferenceObject { + public: + typedef T arg_t; + T operator()(T arg) const { + if ( arg ) arg->addRef(); + return arg; + } + }; + /// Functor to delete objects from heap and reset the pointer + template <typename M> class ReferenceObjects { + public: + typedef typename M::second_type result_t; + result_t operator()(const M& arg) const { + return ReferenceObject<result_t>()(arg.second); + } + }; + template <typename M> ReferenceObject<M> referenceObject(M&) { + return ReferenceObject<typename M::value_type>(); + } + template <typename M> ReferenceObjects<typename M::value_type> reference2nd(M&) { + return ReferenceObjects<typename M::value_type>(); + } - template <typename C, typename R, typename T, typename A1> - void call_member_func(C& object, R (T::*pmf)(A1 a1), A1 a1) - { std::for_each(object.begin(),object.end(),ApplyMemFunc1<R,T,A1>(pmf,a1)); } + /// Member function call-functor with no arguments + template <typename R, typename T> struct ApplyMemFunc { + typedef R (T::*memfunc_t)(); + memfunc_t func; + ApplyMemFunc(memfunc_t f) : func(f) {} + void operator()(T* arg) const { if (arg) { (arg->*func)(); } } + }; + + /// Member function call-functor with 1 argument + template <typename R, typename T, typename A1> struct ApplyMemFunc1 { + typedef R (T::*memfunc_t)(A1 a1); + memfunc_t func; + A1& arg1; + ApplyMemFunc1(memfunc_t f, A1& a1) : func(f), arg1(a1) {} + void operator()(T* arg) const { if ( arg ) { (arg->*func)(arg1); } } + }; + + /// Member function call-functor with 2 arguments + template <typename R, typename T, typename A1, typename A2> struct ApplyMemFunc2 { + typedef R (T::*memfunc_t)(A1 a1, A2 a2); + memfunc_t func; + A1& arg1; + A2& arg2; + ApplyMemFunc2(memfunc_t f, A1& a1, A2& a2) : func(f), arg1(a1), arg2(a2) {} + void operator()( T* arg) const { if ( arg ) { (arg->*func)(arg1, arg2); } } + }; + + /// Member function call-functor with no arguments (const version) + template <typename R, typename T> struct ApplyMemFuncConst { + typedef R (T::*memfunc_t)() const; + memfunc_t func; + ApplyMemFuncConst(memfunc_t f) : func(f) {} + void operator()(const T* arg) const { if ( arg ) { (arg->*func)(); } } + }; + + /// Member function call-functor with 1 argument (const version) + template <typename R, typename T, typename A1> struct ApplyMemFuncConst1 { + typedef R (T::*memfunc_t)(A1 a1) const; + memfunc_t func; + A1& arg1; + ApplyMemFuncConst1(memfunc_t f, A1& a1) : func(f), arg1(a1) {} + void operator()(const T* arg) const { if ( arg ) { (arg->*func)(arg1); } } + }; + + /// Member function call-functor with 2 arguments (const version) + template <typename R, typename T, typename A1, typename A2> struct ApplyMemFuncConst2 { + typedef R (T::*memfunc_t)(A1 a1, A2 a2) const; + memfunc_t func; + A1& arg1; + A2& arg2; + ApplyMemFuncConst2(memfunc_t f, A1& a1, A2& a2) : func(f), arg1(a1), arg2(a2) {} + void operator()(const T* arg) const { if ( arg ) { (arg->*func)(arg1, arg2); } } + }; + + template <typename C, typename R, typename T> + void call_member_func(C& object, R (T::*pmf)()) + { std::for_each(object.begin(),object.end(),ApplyMemFunc<R,T>(pmf)); } + + template <typename C, typename R, typename T> + void call_member_func(C& object, R (T::*pmf)() const) + { std::for_each(object.begin(),object.end(),ApplyMemFuncConst<R,T>(pmf)); } + + template <typename C, typename R, typename T, typename A1> + void call_member_func(C& object, R (T::*pmf)(A1 a1), A1 a1) + { std::for_each(object.begin(),object.end(),ApplyMemFunc1<R,T,A1>(pmf,a1)); } - template <typename C, typename R, typename T, typename A1> - void call_member_func(C& object, R (T::*pmf)(A1 a1) const, A1 a1) - { std::for_each(object.begin(),object.end(),ApplyMemFuncConst1<R,T,A1>(pmf,a1)); } + template <typename C, typename R, typename T, typename A1> + void call_member_func(C& object, R (T::*pmf)(A1 a1) const, A1 a1) + { std::for_each(object.begin(),object.end(),ApplyMemFuncConst1<R,T,A1>(pmf,a1)); } - template <typename C, typename R, typename T, typename A1, typename A2> - void call_member_func(C& object, R (T::*pmf)(A1 a1,A2 a2), A1 a1, A2 a2) - { std::for_each(object.begin(),object.end(),ApplyMemFunc2<R,T,A1,A2>(pmf,a1,a2)); } + template <typename C, typename R, typename T, typename A1, typename A2> + void call_member_func(C& object, R (T::*pmf)(A1 a1,A2 a2), A1 a1, A2 a2) + { std::for_each(object.begin(),object.end(),ApplyMemFunc2<R,T,A1,A2>(pmf,a1,a2)); } - template <typename C, typename R, typename T, typename A1, typename A2> - void call_member_func(C& object, R (T::*pmf)(A1 a1,A2 a2) const, A1 a1, A2 a2) - { std::for_each(object.begin(),object.end(),ApplyMemFuncConst2<R,T,A1,A2>(pmf,a1,a2)); } + template <typename C, typename R, typename T, typename A1, typename A2> + void call_member_func(C& object, R (T::*pmf)(A1 a1,A2 a2) const, A1 a1, A2 a2) + { std::for_each(object.begin(),object.end(),ApplyMemFuncConst2<R,T,A1,A2>(pmf,a1,a2)); } - /// Generic map Functor to act on first element (key) - template <typename M, typename FCN> class Apply1rst { - public: - const FCN& func; - Apply1rst(const FCN& f) : func(f) { } - void operator()(std::pair<typename M::key_type const, typename M::mapped_type>& p) const - { (func)(p.first); } - void operator()(const std::pair<typename M::key_type const, typename M::mapped_type>& p) const - { (func)(p.first); } - }; - - template <typename C, typename FCN> Apply1rst<C,FCN> apply__1rst_value(C&,const FCN& func) - { return Apply1rst<C,FCN>(func); } - - template <typename C, typename FCN> void apply1rst(C& object,const FCN& func) - { std::for_each(object.begin(),object.end(),apply__1rst_value(object,func)); } - - template <typename C, typename R, typename T> - void apply1rst(C& object, R (T::*pmf)()) - { std::for_each(object.begin(),object.end(),apply__1rst_value(object,ApplyMemFunc<R,T>(pmf))); } - - template <typename C, typename R, typename T, typename A1> - void apply1rst(C object, R (T::*pmf)(A1 a1), A1 a1) - { std::for_each(object.begin(),object.end(),apply__1rst_value(object,ApplyMemFunc1<R,T,A1>(pmf,a1))); } - - template <typename C, typename R, typename T> - void apply1rst(C& object, R (T::*pmf)() const) - { std::for_each(object.begin(),object.end(),apply__1rst_value(object,ApplyMemFuncConst<R,T>(pmf))); } - - template <typename C, typename R, typename T, typename A1> - void apply1rst(C object, R (T::*pmf)(A1 a1) const, A1 a1) - { std::for_each(object.begin(),object.end(),apply__1rst_value(object,ApplyMemFuncConst1<R,T,A1>(pmf,a1))); } - - /// Generic map Functor to act on second element (mapped type) - template <typename M, typename FCN> class Apply2nd { - public: - const FCN& func; - Apply2nd(const FCN& f) : func(f) { } - void operator()(std::pair<typename M::key_type const, typename M::mapped_type>& p) const - { (func)(p.second); } - void operator()(const std::pair<typename M::key_type const, typename M::mapped_type>& p) const - { (func)(p.second); } - }; - - template <typename C, typename FCN> Apply2nd<C,FCN> apply__2nd_value(C&,const FCN& func) - { return Apply2nd<C,FCN>(func); } - - template <typename C, typename FCN> void apply2nd(C& object,const FCN& func) - { std::for_each(object.begin(),object.end(),apply__2nd_value(object,func)); } - - template <typename C, typename R, typename T> - void apply2nd(C& object, R (T::*pmf)()) - { std::for_each(object.begin(),object.end(),apply__2nd_value(object,ApplyMemFunc<R,T>(pmf))); } - - template <typename C, typename R, typename T, typename A1> - void apply2nd(C object, R (T::*pmf)(A1 a1), A1 a1) - { std::for_each(object.begin(),object.end(),apply__2nd_value(object,ApplyMemFunc1<R,T,A1>(pmf,a1))); } - - template <typename C, typename R, typename T> - void apply2nd(C& object, R (T::*pmf)() const) - { std::for_each(object.begin(),object.end(),apply__2nd_value(object,ApplyMemFuncConst<R,T>(pmf))); } - - template <typename C, typename R, typename T, typename A1> - void apply2nd(C object, R (T::*pmf)(A1 a1) const, A1 a1) - { std::for_each(object.begin(),object.end(),apply__2nd_value(object,ApplyMemFuncConst1<R,T,A1>(pmf,a1))); } - - /// Data structure to manipulate a bitmask held by reference and represented by an integer - /** - * @author M.Frank - * @version 1.0 - */ - template <typename T> class ReferenceBitMask { - public: - /// Reference to the data - T& mask; + /// Generic map Functor to act on first element (key) + template <typename M, typename FCN> class Apply1rst { + public: + const FCN& func; + Apply1rst(const FCN& f) : func(f) { } + void operator()(std::pair<typename M::key_type const, typename M::mapped_type>& arg) const + { (func)(arg.first); } + void operator()(const std::pair<typename M::key_type const, typename M::mapped_type>& arg) const + { (func)(arg.first); } + }; + + template <typename C, typename FCN> Apply1rst<C,FCN> apply__1rst_value(C&,const FCN& func) + { return Apply1rst<C,FCN>(func); } + + template <typename C, typename FCN> void apply1rst(C& object,const FCN& func) + { std::for_each(object.begin(),object.end(),apply__1rst_value(object,func)); } + + template <typename C, typename R, typename T> + void apply1rst(C& object, R (T::*pmf)()) + { std::for_each(object.begin(),object.end(),apply__1rst_value(object,ApplyMemFunc<R,T>(pmf))); } + + template <typename C, typename R, typename T, typename A1> + void apply1rst(C object, R (T::*pmf)(A1 a1), A1 a1) + { std::for_each(object.begin(),object.end(),apply__1rst_value(object,ApplyMemFunc1<R,T,A1>(pmf,a1))); } + + template <typename C, typename R, typename T> + void apply1rst(C& object, R (T::*pmf)() const) + { std::for_each(object.begin(),object.end(),apply__1rst_value(object,ApplyMemFuncConst<R,T>(pmf))); } + + template <typename C, typename R, typename T, typename A1> + void apply1rst(C object, R (T::*pmf)(A1 a1) const, A1 a1) + { std::for_each(object.begin(),object.end(),apply__1rst_value(object,ApplyMemFuncConst1<R,T,A1>(pmf,a1))); } + + /// Generic map Functor to act on second element (mapped type) + template <typename M, typename FCN> class Apply2nd { + public: + const FCN& func; + Apply2nd(const FCN& f) : func(f) { } + void operator()(std::pair<typename M::key_type const, typename M::mapped_type>& arg) const + { (func)(arg.second); } + void operator()(const std::pair<typename M::key_type const, typename M::mapped_type>& arg) const + { (func)(arg.second); } + }; + + template <typename C, typename FCN> Apply2nd<C,FCN> apply__2nd_value(C&,const FCN& func) + { return Apply2nd<C,FCN>(func); } + + template <typename C, typename FCN> void apply2nd(C& object,const FCN& func) + { std::for_each(object.begin(),object.end(),apply__2nd_value(object,func)); } + + template <typename C, typename R, typename T> + void apply2nd(C& object, R (T::*pmf)()) + { std::for_each(object.begin(),object.end(),apply__2nd_value(object,ApplyMemFunc<R,T>(pmf))); } + + template <typename C, typename R, typename T, typename A1> + void apply2nd(C object, R (T::*pmf)(A1 a1), A1 a1) + { std::for_each(object.begin(),object.end(),apply__2nd_value(object,ApplyMemFunc1<R,T,A1>(pmf,a1))); } + + template <typename C, typename R, typename T> + void apply2nd(C& object, R (T::*pmf)() const) + { std::for_each(object.begin(),object.end(),apply__2nd_value(object,ApplyMemFuncConst<R,T>(pmf))); } + + template <typename C, typename R, typename T, typename A1> + void apply2nd(C object, R (T::*pmf)(A1 a1) const, A1 a1) + { std::for_each(object.begin(),object.end(),apply__2nd_value(object,ApplyMemFuncConst1<R,T,A1>(pmf,a1))); } + + /// Data structure to manipulate a bitmask held by reference and represented by an integer + /** + * @author M.Frank + * @version 1.0 + */ + template <typename T> class ReferenceBitMask { + public: + /// Reference to the data + T& mask; + /// Standard constructor + ReferenceBitMask(T& arg); + T value() const { + return mask; + } + void set(const T& arg) { + mask |= arg; + } + void clear(const T& arg) { + mask &= ~arg; + } + void clear() { + mask = 0; + } + bool isSet(const T& arg) const { + return (mask&arg) == arg; + } + bool anySet(const T& arg) const { + return (mask&arg) != 0; + } + bool testBit(int bit) const { + T arg = T(1)<<bit; + return isSet(arg); + } + bool isNull() const { + return mask == 0; + } + }; /// Standard constructor - ReferenceBitMask(T& m); - T value() const { - return mask; - } - void set(const T& m) { - mask |= m; - } - void clear(const T& m) { - mask &= ~m; - } - void clear() { - mask = 0; - } - bool isSet(const T& m) const { - return (mask&m) == m; - } - bool anySet(const T& m) const { - return (mask&m) != 0; - } - bool testBit(int bit) const { - T m = T(1)<<bit; - return isSet(m); - } - bool isNull() const { - return mask == 0; - } - }; - /// Standard constructor - template <typename T> ReferenceBitMask<T>::ReferenceBitMask(T& m) : mask(m) {} - - /* - * Geometry namespace declaration - */ - namespace Geometry { - - // Put here global basic type defintiions derived from primitive types of the Geometry namespace + template <typename T> ReferenceBitMask<T>::ReferenceBitMask(T& arg) : mask(arg) {} - }// End namespace Geometry -} // End namespace DD4hep + } // End namespace detail +} // End namespace dd4hep #endif // DD4HEP_DD4HEP_PRIMITIVES_H diff --git a/DDCore/include/DD4hep/Printout.h b/DDCore/include/DD4hep/Printout.h index 4820af4aa..6daa21d6b 100644 --- a/DDCore/include/DD4hep/Printout.h +++ b/DDCore/include/DD4hep/Printout.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,22 +27,12 @@ class TNamed; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations + class Detector; class NamedObject; template <typename T> class Handle; - typedef Handle<NamedObject> Ref_t; - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class LCDD; - class VisAttr; - class DetElement; - class PlacedVolume; - } enum PrintLevel { NOLOG = 0, @@ -238,7 +228,7 @@ namespace DD4hep { bool isActivePrintLevel(int severity); /// Helper class template to implement ASCII object dumps - /** @class Printer Conversions.h DD4hep/compact/Conversions.h + /** @class Printer Conversions.h dd4hep/compact/Conversions.h * * Small helper class to print objects * @@ -247,14 +237,14 @@ namespace DD4hep { */ template <typename T> struct Printer { /// Reference to the detector description object - const Geometry::LCDD* lcdd; + const Detector* description; /// Reference to the output stream object, the Printer object should write std::ostream& os; /// Optional text prefix when formatting the output std::string prefix; /// Initializing constructor of the functor - Printer(const Geometry::LCDD* l, std::ostream& stream, const std::string& p = "") - : lcdd(l), os(stream), prefix(p) { + Printer(const Detector* l, std::ostream& stream, const std::string& p = "") + : description(l), os(stream), prefix(p) { } /// Callback operator to be specialized depending on the element type void operator()(const T& value) const; @@ -267,7 +257,7 @@ namespace DD4hep { } /// Helper class template to implement ASCII dumps of named objects maps - /** @class PrintMap Conversions.h DD4hep/compact/Conversions.h + /** @class PrintMap Conversions.h dd4hep/compact/Conversions.h * * Small helper class to print maps of objects * @@ -276,10 +266,10 @@ namespace DD4hep { */ template <typename T> struct PrintMap { typedef T item_type; - typedef const std::map<std::string, Ref_t> cont_type; + typedef const std::map<std::string, Handle<NamedObject> > cont_type; /// Reference to the detector description object - const Geometry::LCDD* lcdd; + const Detector* description; /// Reference to the output stream object, the Printer object should write std::ostream& os; /// Optional text prefix when formatting the output @@ -287,8 +277,8 @@ namespace DD4hep { /// Reference to the container data of the map. cont_type& cont; /// Initializing constructor of the functor - PrintMap(const Geometry::LCDD* l, std::ostream& stream, cont_type& c, const std::string& t = "") - : lcdd(l), os(stream), text(t), cont(c) { + PrintMap(const Detector* l, std::ostream& stream, cont_type& c, const std::string& t = "") + : description(l), os(stream), text(t), cont(c) { } /// Callback operator to be specialized depending on the element type void operator()() const; @@ -303,5 +293,5 @@ namespace DD4hep { return value ? "true " : "false"; } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_PRINTOUT_H */ diff --git a/DDCore/include/DD4hep/Readout.h b/DDCore/include/DD4hep/Readout.h index 9d18ab142..e33784642 100644 --- a/DDCore/include/DD4hep/Readout.h +++ b/DDCore/include/DD4hep/Readout.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,77 +10,63 @@ // Author : M.Frank // //========================================================================== - -#ifndef DD4hep_GEOMETRY_READOUT_H -#define DD4hep_GEOMETRY_READOUT_H +#ifndef dd4hep_GEOMETRY_READOUT_H +#define dd4hep_GEOMETRY_READOUT_H // Framework include files #include "DD4hep/Handle.h" -#include "DD4hep/Volumes.h" #include "DD4hep/IDDescriptor.h" #include "DD4hep/Segmentations.h" -// C/C++ include files -#include <map> - /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + // Forward declarations + class ReadoutObject; + class HitCollection; - // Forward declarations - class ReadoutObject; - class HitCollection; - - /// Handle to the implementation of the readout structure of a subdetector - /** - * If there is no explicit hit collection defined, by default one single - * hit collection is defined by the name of the readout itself. - * If hit collections are defined, ALL must be defined. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Readout: public Handle<ReadoutObject> { - public: - /// Implementation type - typedef ReadoutObject Object; - typedef HitCollection Collection; - public: - /// Default constructor - Readout() = default; - /// Copy Constructor from object - Readout(const Readout& e) = default; + /// Handle to the implementation of the readout structure of a subdetector + /** + * If there is no explicit hit collection defined, by default one single + * hit collection is defined by the name of the readout itself. + * If hit collections are defined, ALL must be defined. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Readout: public Handle<ReadoutObject> { + public: + /// Default constructor + Readout() = default; + /// Copy Constructor from object + Readout(const Readout& e) = default; #ifndef __CINT__ - /// Copy Constructor from handle - Readout(const Handle<ReadoutObject>& e) : Handle<Object>(e) { } + /// Copy Constructor from handle + Readout(const Handle<ReadoutObject>& e) : Handle<Object>(e) { } #endif - /// Constructor to be used when reading the already parsed object - template <typename Q> Readout(const Handle<Q>& e) : Handle<Object>(e) { } - /// Initializing constructor - Readout(const std::string& name); - /// Assignment operator - Readout& operator=(const Readout& ro) = default; - /// Access explicit names of hit collections if present - std::vector<std::string> collectionNames() const; + /// Constructor to be used when reading the already parsed object + template <typename Q> Readout(const Handle<Q>& e) : Handle<Object>(e) { } + /// Initializing constructor + Readout(const std::string& name); + /// Assignment operator + Readout& operator=(const Readout& ro) = default; + /// Access explicit names of hit collections if present + std::vector<std::string> collectionNames() const; #ifndef __CINT__ - /// Access hit collections if present - std::vector<const Collection*> collections() const; + /// Access hit collections if present + std::vector<const HitCollection*> collections() const; #endif - /// Access number of hit collections - size_t numCollections() const; - /// Assign IDDescription to readout structure - void setIDDescriptor(const Ref_t& spec) const; - /// Access IDDescription structure - IDDescriptor idSpec() const; - /// Assign segmentation structure to readout - void setSegmentation(const Segmentation& segment) const; - /// Access segmentation structure - Segmentation segmentation() const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4hep_GEOMETRY_READOUT_H */ + /// Access number of hit collections + size_t numCollections() const; + /// Assign IDDescription to readout structure + void setIDDescriptor(const Ref_t& spec) const; + /// Access IDDescription structure + IDDescriptor idSpec() const; + /// Assign segmentation structure to readout + void setSegmentation(const Segmentation& segment) const; + /// Access segmentation structure + Segmentation segmentation() const; + }; +} /* End namespace dd4hep */ +#endif /* dd4hep_GEOMETRY_READOUT_H */ diff --git a/DDCore/include/DD4hep/Segmentations.h b/DDCore/include/DD4hep/Segmentations.h index 1157f63d9..afa9130bf 100644 --- a/DDCore/include/DD4hep/Segmentations.h +++ b/DDCore/include/DD4hep/Segmentations.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,88 +19,75 @@ #include "DD4hep/BitField64.h" #include "DDSegmentation/Segmentation.h" -// C/C++ include files - - /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - /// Forward declarations - class DetElementObject; - class SegmentationObject; - class SensitiveDetectorObject; - - /// Handle class supporting generic Segmentations of sensitive detectors - /** - * This basic segmentation implementation supports "generic" access - * to specific segmentations exporting the common abstract interface. - * Mostly used in simulation. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Segmentation: public Handle<SegmentationObject> { - public: - typedef DDSegmentation::Segmentation BaseSegmentation; - typedef DDSegmentation::Parameter Parameter; - typedef DDSegmentation::Parameters Parameters; + /// Forward declarations + class DetElementObject; + class SegmentationObject; + class SensitiveDetectorObject; + template <typename T> class SegmentationWrapper; - public: - /// Initializing constructor creating a new object of the given DDSegmentation type - Segmentation(const std::string& type, const std::string& name, BitField64* decoder); - /// Default constructor - Segmentation() = default; - /// Copy Constructor from object - Segmentation(const Segmentation& e) : Handle<Object>(e) { } + /// Handle class supporting generic Segmentations of sensitive detectors + /** + * This basic segmentation implementation supports "generic" access + * to specific segmentations exporting the common abstract interface. + * Mostly used in simulation. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Segmentation : public Handle<SegmentationObject> { + public: + /// Initializing constructor creating a new object of the given DDSegmentation type + Segmentation(const std::string& type, const std::string& name, BitField64* decoder); + /// Default constructor + Segmentation() = default; + /// Copy Constructor from object + Segmentation(const Segmentation& e) = default; #ifndef __CINT__ - /// Copy Constructor from handle - Segmentation(const Handle<Object>& e) : Handle<Object>(e) { } + /// Copy Constructor from handle + Segmentation(const Handle<Object>& e) : Handle<Object>(e) { } #endif - /// Constructor to be used when reading the already parsed object - template <typename Q> - Segmentation(const Handle<Q>& e) : Handle<Object>(e) { } - /// Assignment operator - Segmentation& operator=(const Segmentation& seg) = default; - /// Access flag for hit positioning - bool useForHitPosition() const; - /// Accessor: Segmentation type - std::string type() const; - /// Access to the parameters - Parameters parameters() const; - /// Access to parameter by name - Parameter parameter(const std::string& parameterName) const; - /// Access the main detector element using this segmetnation object - Handle<DetElementObject> detector() const; - /// Access the sensitive detector using this segmetnation object - Handle<SensitiveDetectorObject> sensitive() const; - /// Access the underlying decoder - BitField64* decoder() const; - /// Set the underlying decoder - void setDecoder(BitField64* decoder) const; - /// determine the local position based on the cell ID - Position position(const long64& cellID) const; - /// determine the cell ID based on the local position - long64 cellID(const Position& localPosition, const Position& globalPosition, const long64& volumeID) const; - /// Determine the volume ID from the full cell ID by removing all local fields - VolumeID volumeID(const CellID& cellID) const; - /// Calculates the neighbours of the given cell ID and adds them to the list of neighbours - void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - * in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - * - * \param cellID cellID of the cell for which parameters are returned - * \return vector<double> in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - */ - std::vector<double> cellDimensions(const CellID& cellID) const; + /// Constructor to be used when reading the already parsed object + template <typename Q> Segmentation(const Handle<Q>& e) : Handle<Object>(e) { } + /// Assignment operator + Segmentation& operator=(const Segmentation& seg) = default; + /// Access flag for hit positioning + bool useForHitPosition() const; + /// Accessor: Segmentation type + std::string type() const; + /// Access to the parameters + DDSegmentation::Parameters parameters() const; + /// Access to parameter by name + DDSegmentation::Parameter parameter(const std::string& parameterName) const; + /// Access the main detector element using this segmetnation object + Handle<DetElementObject> detector() const; + /// Access the sensitive detector using this segmetnation object + Handle<SensitiveDetectorObject> sensitive() const; + /// Access the underlying decoder + const BitField64* decoder() const; + /// Set the underlying decoder + void setDecoder(BitField64* decoder) const; + /// determine the local position based on the cell ID + Position position(const long64& cellID) const; + /// determine the cell ID based on the local position + long64 cellID(const Position& localPosition, const Position& globalPosition, const long64& volumeID) const; + /// Determine the volume ID from the full cell ID by removing all local fields + VolumeID volumeID(const CellID& cellID) const; + /// Calculates the neighbours of the given cell ID and adds them to the list of neighbours + void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + * in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi + * + * \param cellID cellID of the cell for which parameters are returned + * \return vector<double> in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi + */ + std::vector<double> cellDimensions(const CellID& cellID) const; - /// Access to the base DDSegmentation object. WARNING: Deprecated call! - BaseSegmentation* segmentation() const; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + /// Access to the base DDSegmentation object. WARNING: Deprecated call! + DDSegmentation::Segmentation* segmentation() const; + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_SEGMENTATIONS_H */ diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h index b8ebf233f..d442e2899 100644 --- a/DDCore/include/DD4hep/Shapes.h +++ b/DDCore/include/DD4hep/Shapes.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -45,719 +45,713 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - - /// Pretty print of solid attributes - std::string toStringSolid(const TGeoShape* shape, int precision=2); - - /// Base class for Solid (shape) objects - /** - * Generic handle holding an object of base TGeoShape. - * - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoShape.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class Solid_type: public Handle<T> { - protected: - void _setDimensions(double* param); - /// Assign pointrs and register solid to geometry - void _assign(T* n, const std::string& nam, const std::string& tit, bool cbbox); - - public: - - /// Default constructor for uninitialized object - Solid_type() = default; - /// Constructor to be used when passing an already created object - Solid_type(const Solid_type& e) = default; - /// Direct assignment using the implementation pointer - Solid_type(T* p) : Handle<T>(p) { } - /// Constructor to be used when passing an already created object - Solid_type(const Handle<T>& e) : Handle<T>(e) { } - /// Constructor to be used when passing an already created object: need to check pointers - template <typename Q> Solid_type(const Handle<Q>& e) : Handle<T>(e) { } - /// Assignment operator - Solid_type& operator=(const Solid_type& copy) = default; - - /// Access to shape name - const char* name() const; - /// Access to shape type (The TClass name of the ROOT implementation) - const char* type() const; - /// Auto conversion to underlying ROOT object - operator T*() const { - return this->m_element; - } - /// Overloaded operator -> to access underlying object - T* operator->() const { - return this->m_element; - } - /// Conversion to string for pretty print - std::string toString(int precision=2) const { - return toStringSolid(this->m_element,precision); - } - }; - typedef Solid_type<TGeoShape> Solid; - - /// Class describing a box shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoBBox.html - * - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Box: public Solid_type<TGeoBBox> { - protected: - /// Internal helper method to support object construction - void make(double x_val, double y_val, double z_val); - - public: - /// Default constructor - Box() = default; - /// Constructor to be used when passing an already created object - Box(const Box& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Box(const Q* p) : Solid_type<TGeoBBox>(p) { } - /// Constructor to be used with an existing object - template <typename Q> Box(const Handle<Q>& e) : Solid_type<TGeoBBox>(e) { } - /// Constructor to create an anonymous new box object (retrieves name from volume) - Box(double x_val, double y_val, double z_val) { make(x_val, y_val, z_val); } - /// Constructor to create an anonymous new box object (retrieves name from volume) - template <typename X, typename Y, typename Z> - Box(const X& x_val, const Y& y_val, const Z& z_val) { - make(_toDouble(x_val), _toDouble(y_val), _toDouble(z_val)); - } - /// Assignment operator - Box& operator=(const Box& copy) = default; - /// Set the box dimensions - Box& setDimensions(double x_val, double y_val, double z_val); - /// Access half "length" of the box - double x() const; - /// Access half "width" of the box - double y() const; - /// Access half "depth" of the box - double z() const; - }; - - /// Class describing half-space - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoHalfSpace.html - * - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class HalfSpace: public Solid_type<TGeoHalfSpace> { - protected: - /// Internal helper method to support object construction - void make(const double* const point, const double* const normal); - - public: - /// Default constructor - HalfSpace() = default; - /// Constructor to be used when passing an already created object - HalfSpace(const HalfSpace& e) = default; - /// Constructor to be used with an existing object - template <typename Q> HalfSpace(const Q* p) : Solid_type<TGeoHalfSpace>(p) { } - /// Constructor to be used with an existing object - template <typename Q> HalfSpace(const Handle<Q>& e) : Solid_type<TGeoHalfSpace>(e) { } - /// Constructor to create an new halfspace object from a point on a plane and the plane normal - HalfSpace(const double* const point, const double* const normal) { make(point,normal); } - /// Assignment operator - HalfSpace& operator=(const HalfSpace& copy) = default; - }; - - /// Class describing a Polycone shape - /** - * Polycone. It has at least 9 parameters : - * - the lower phi limit; - * - the range in phi; - * - the number of z planes (at least two) where the inner/outer - * radii are changing; - * - z coordinate, inner and outer radius for each z plane - * - * - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoPcon.html - * - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Polycone: public Solid_type<TGeoPcon> { - public: - /// Default constructor - Polycone() = default; - /// Constructor to be used when passing an already created object - Polycone(const Polycone& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Polycone(const Q* p) : Solid_type<TGeoPcon>(p) { } - /// Constructor to be used when reading the already parsed polycone object - template <typename Q> Polycone(const Handle<Q>& e) : Solid_type<TGeoPcon>(e) { } - /// Constructor to create a new polycone object - Polycone(double start, double delta); - - /// Constructor to create a new polycone object. Add at the same time all Z planes - Polycone(double start, double delta, const std::vector<double>& rmin, const std::vector<double>& rmax, - const std::vector<double>& z); - /// Assignment operator - Polycone& operator=(const Polycone& copy) = default; - - /// Add Z-planes to the Polycone - void addZPlanes(const std::vector<double>& rmin, const std::vector<double>& rmax, const std::vector<double>& z); - }; - - /// Class describing a cone segment shape - /** - * A ConeSegment is, in the general case, a Phi segment of a cone, with - * half-length dz, inner and outer radii specified at -dz and +dz. - * - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoConeSeg.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class ConeSegment: public Solid_type<TGeoConeSeg> { - public: - /// Default constructor - ConeSegment() = default; - /// Constructor to be used when passing an already created object - ConeSegment(const ConeSegment& e) = default; - /// Constructor to be used with an existing object - template <typename Q> ConeSegment(const Q* p) : Solid_type<TGeoConeSeg>(p) { } - /// Constructor to be used when reading the already parsed ConeSegment object - template <typename Q> ConeSegment(const Handle<Q>& e) : Solid_type<TGeoConeSeg>(e) { } - /// Constructor to create a new ConeSegment object - ConeSegment(double dz, double rmin1, double rmax1, double rmin2, double rmax2, double phi1 = 0.0, double phi2 = 2.0 * M_PI); - /// Assignment operator - ConeSegment& operator=(const ConeSegment& copy) = default; - - /// Set the cone segment dimensions - ConeSegment& setDimensions(double dz, double rmin1, double rmax1, - double rmin2, double rmax2, double phi1 = 0.0, double phi2 = 2.0 * M_PI); - }; - - /// Intermediate class to overcome drawing probles with the TGeoTubeSeg - class MyConeSeg: public TGeoConeSeg { - public: - MyConeSeg() : TGeoConeSeg() { } - virtual ~MyConeSeg() { } - double GetRmin() const { return GetRmin1(); } - double GetRmax() const { return GetRmax1(); } - }; - - /// Class describing a tube shape of a section of a tube - /** - * TGeoTube - cylindrical tube class. It takes 3 parameters : - * inner radius, outer radius and half-length dz. - * - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoConeSeg.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Tube: public Solid_type< /*TGeoTubeSeg */MyConeSeg> { - protected: - /// Internal helper method to support object construction - void make(const std::string& nam, double rmin, double rmax, double z, double startPhi, double deltaPhi); - - public: - /// Default constructor - Tube() = default; - /// Constructor to be used when passing an already created object - Tube(const Tube& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Tube(const Q* p) : Solid_type<MyConeSeg>(p) { } - /// Constructor to assign an object - template <typename Q> Tube(const Handle<Q>& e) : Solid_type<MyConeSeg>(e) { } - /// Constructor to create a new anonymous tube object with attribute initialization - Tube(double rmin, double rmax, double z) - { make("", rmin, rmax, z, 0, 2*M_PI); } - /// Constructor to create a new anonymous tube object with attribute initialization - Tube(double rmin, double rmax, double z, double deltaPhi) - { make("", rmin, rmax, z, 0, deltaPhi); } - /// Constructor to create a new anonymous tube object with attribute initialization - Tube(double rmin, double rmax, double z, double startPhi, double deltaPhi) - { make("", rmin, rmax, z, startPhi, deltaPhi); } - /// Legacy: Constructor to create a new identifiable tube object with attribute initialization - Tube(const std::string& nam, double rmin, double rmax, double z) - { make(nam, rmin, rmax, z, 0, 2*M_PI); } - /// Legacy: Constructor to create a new identifiable tube object with attribute initialization - Tube(const std::string& nam, double rmin, double rmax, double z, double deltaPhi) - { make(nam, rmin, rmax, z, 0, deltaPhi); } - /// Constructor to create a new anonymous tube object with attribute initialization - template <typename RMIN, typename RMAX, typename Z, typename DELTAPHI> - Tube(const RMIN& rmin, const RMAX& rmax, const Z& z, const DELTAPHI& deltaPhi) - { make("", _toDouble(rmin), _toDouble(rmax), _toDouble(z), 0, _toDouble(deltaPhi)); } - /// Assignment operator - Tube& operator=(const Tube& copy) = default; - /// Set the tube dimensions - Tube& setDimensions(double rmin, double rmax, double z, double startPhi=0.0, double deltaPhi=2*M_PI); - }; - - /// Class describing a elliptical tube shape of a section of a tube - /** - * TGeoEltu - cylindrical tube class. It takes 3 parameters : - * Semi axis of ellipsis in x and y and half-length dz. - * - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoElTu.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class EllipticalTube: public Solid_type<TGeoEltu> { - protected: - /// Internal helper method to support object construction - void make(double a, double b, double dz); - - public: - /// Default constructor - EllipticalTube() = default; - /// Constructor to be used when passing an already created object - EllipticalTube(const EllipticalTube& e) = default; - /// Constructor to be used with an existing object - template <typename Q> EllipticalTube(const Q* p) : Solid_type<TGeoEltu>(p) { } - /// Constructor to assign an object - template <typename Q> EllipticalTube(const Handle<Q>& e) : Solid_type<TGeoEltu>(e) { } - /// Constructor to create a new anonymous tube object with attribute initialization - EllipticalTube(double a, double b, double dz) { make(a, b, dz); } - /// Constructor to create a new anonymous tube object with attribute initialization - template <typename A, typename B, typename DZ> - EllipticalTube(const A& a, const B& b, const DZ& dz) - { make(_toDouble(a), _toDouble(b), _toDouble(dz)); } - /// Assignment operator - EllipticalTube& operator=(const EllipticalTube& copy) = default; - /// Set the tube dimensions - EllipticalTube& setDimensions(double a, double b, double dz); - }; - - /// Class describing a cone shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoCone.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Cone: public Solid_type<TGeoCone> { - protected: - /// Internal helper method to support object construction - void make(double z, double rmin1, double rmax1, double rmin2, double rmax2); - public: - /// Default constructor - Cone() = default; - /// Constructor to be used when passing an already created object - Cone(const Cone& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Cone(const Q* p) : Solid_type<TGeoCone>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> Cone(const Handle<Q>& e) : Solid_type<TGeoCone>(e) { } - /// Constructor to create a new anonymous object with attribute initialization - Cone(double z, double rmin1, double rmax1, double rmin2, double rmax2) - { make(z, rmin1, rmax1, rmin2, rmax2); } - template <typename Z, typename RMIN1, typename RMAX1, typename RMIN2, typename RMAX2> - Cone(const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2) - { make(_toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); } - /// Assignment operator - Cone& operator=(const Cone& copy) = default; - /// Set the box dimensions - Cone& setDimensions(double z, double rmin1, double rmax1, double rmin2, double rmax2); - }; - - /// Class describing a trap shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoTrap.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Trap: public Solid_type<TGeoTrap> { - private: - /// Internal helper method to support object construction - void make(double pz, double py, double px, double pLTX); - public: - /// Default constructor - Trap() = default; - /// Constructor to be used when passing an already created object - Trap(const Trap& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Trap(const Q* p) : Solid_type<TGeoTrap>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> Trap(const Handle<Q>& e) : Solid_type<TGeoTrap>(e) { } - /// Constructor to create a new anonymous object with attribute initialization - Trap(double z, double theta, double phi, - double y1, double x1, double x2, double alpha1, - double y2, double x3, double x4, double alpha2); - /// Constructor to create a new anonymous object for right angular wedge from STEP (Se G4 manual for details) - Trap(double pz, double py, double px, double pLTX) { make(pz,py,px,pLTX); } - /// Constructor to create a new anonymous object with attribute initialization - template <typename PZ,typename PY,typename PX,typename PLTX> Trap(PZ pz, PY py, PX px, PLTX pLTX) - { make(_toDouble(pz),_toDouble(py),_toDouble(px),_toDouble(pLTX)); } - /// Assignment operator - Trap& operator=(const Trap& copy) = default; - /// Set the trap dimensions - Trap& setDimensions(double z, double theta, double phi, - double y1, double x1, double x2, double alpha1, - double y2, double x3, double x4, double alpha2); - }; - - /// Class describing a Trapezoid shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoTrd2.html - * - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Trapezoid: public Solid_type<TGeoTrd2> { - private: - /// Internal helper method to support object construction - void make(double x1, double x2, double y1, double y2, double z); - - public: - /// Default constructor - Trapezoid() = default; - /// Constructor to be used when passing an already created object - Trapezoid(const Trapezoid& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Trapezoid(const Q* p) : Solid_type<TGeoTrd2>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> Trapezoid(const Handle<Q>& e) : Solid_type<TGeoTrd2>(e) { } - /// Constructor to create a new anonymous object with attribute initialization - Trapezoid(double x1, double x2, double y1, double y2, double z); - /// Constructor to create a new anonymous object with attribute initialization - template <typename X1,typename X2,typename Y1,typename Y2,typename Z> - Trapezoid(X1 x1, X2 x2, Y1 y1, Y2 y2, Z z) - { make(_toDouble(x1),_toDouble(x2),_toDouble(y1),_toDouble(y2),_toDouble(z)); } - /// Assignment operator - Trapezoid& operator=(const Trapezoid& copy) = default; - /// Set the Trapezoid dimensions - Trapezoid& setDimensions(double x1, double x2, double y1, double y2, double z); - }; - - /// Class describing a Torus shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoTorus.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Torus: public Solid_type<TGeoTorus> { - private: - /// Internal helper method to support object construction - void make(double r, double rmin, double rmax, double phi, double delta_phi); - public: - /// Default constructor - Torus() = default; - /// Constructor to be used when passing an already created object - Torus(const Torus& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Torus(const Q* p) : Solid_type<TGeoTorus>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> Torus(const Handle<Q>& e) : Solid_type<TGeoTorus>(e) { } - /// Constructor to create a new anonymous object with attribute initialization - template<typename R, typename RMIN, typename RMAX, typename PHI, typename DELTA_PHI> - Torus(R r, RMIN rmin, RMAX rmax, PHI phi=M_PI, DELTA_PHI delta_phi = 2.*M_PI) - { make(_toDouble(r),_toDouble(rmin),_toDouble(rmax),_toDouble(phi),_toDouble(delta_phi)); } - /// Constructor to create a new anonymous object with attribute initialization - Torus(double r, double rmin, double rmax, double phi=M_PI, double delta_phi = 2.*M_PI) - { make(r,rmin,rmax,phi,delta_phi); } - /// Assignment operator - Torus& operator=(const Torus& copy) = default; - /// Set the Torus dimensions - Torus& setDimensions(double r, double rmin, double rmax, double phi, double delta_phi); - }; - - /// Class describing a sphere shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoSphere.html - * - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Sphere: public Solid_type<TGeoSphere> { - public: - /// Default constructor - Sphere() = default; - /// Constructor to be used when passing an already created object - Sphere(const Sphere& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Sphere(const Q* p) : Solid_type<TGeoSphere>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> Sphere(const Handle<Q>& e) : Solid_type<TGeoSphere>(e) { } - /// Constructor to create a new anonymous object with attribute initialization - Sphere(double rmin, double rmax, double theta = 0., double delta_theta = M_PI, double phi = 0.0, double delta_phi = 2. * M_PI); - /// Assignment operator - Sphere& operator=(const Sphere& copy) = default; - /// Set the Sphere dimensions - Sphere& setDimensions(double rmin, double rmax, double theta, double delta_theta, double phi, double delta_phi); - }; - - /// Class describing a Paraboloid shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoParaboloid.html - * - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Paraboloid: public Solid_type<TGeoParaboloid> { - public: - /// Default constructor - Paraboloid() = default; - /// Constructor to be used when passing an already created object - Paraboloid(const Paraboloid& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Paraboloid(const Q* p) : Solid_type<TGeoParaboloid>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> Paraboloid(const Handle<Q>& e) : Solid_type<TGeoParaboloid>(e) { } - /// Constructor to create a new anonymous object with attribute initialization - Paraboloid(double r_low, double r_high, double delta_z); - /// Assignment operator - Paraboloid& operator=(const Paraboloid& copy) = default; - /// Set the Paraboloid dimensions - Paraboloid& setDimensions(double r_low, double r_high, double delta_z); - }; - - /// Class describing a Hyperboloid shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoHype.html - * - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Hyperboloid: public Solid_type<TGeoHype> { - public: - /// Default constructor - Hyperboloid() = default; - /// Constructor to be used when passing an already created object - Hyperboloid(const Hyperboloid& e) = default; - /// Constructor to be used with an existing object - template <typename Q> Hyperboloid(const Q* p) : Solid_type<TGeoHype>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> Hyperboloid(const Handle<Q>& e) : Solid_type<TGeoHype>(e) { } - /// Constructor to create a new anonymous object with attribute initialization - Hyperboloid(double rin, double stin, double rout, double stout, double dz); - /// Assignment operator - Hyperboloid& operator=(const Hyperboloid& copy) = default; - /// Set the Hyperboloid dimensions - Hyperboloid& setDimensions(double rin, double stin, double rout, double stout, double dz); - }; - - /// Class describing a regular polyhedron shape - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoPgon.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class PolyhedraRegular: public Solid_type<TGeoPgon> { - protected: - /// Helper function to create the polyhedron - void _create(int nsides, double rmin, double rmax, double zpos, double zneg, double start, double delta); - public: - /// Default constructor - PolyhedraRegular() = default; - /// Constructor to be used when passing an already created object - PolyhedraRegular(const PolyhedraRegular& e) = default; - /// Constructor to be used with an existing object - template <typename Q> PolyhedraRegular(const Q* p) : Solid_type<TGeoPgon>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> PolyhedraRegular(const Handle<Q>& e) : Solid_type<TGeoPgon>(e) { } - /// Constructor to create a new object. Phi(start)=0, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2 - PolyhedraRegular(int nsides, double rmin, double rmax, double zlen); - /// Constructor to create a new object. Phi(start)=0, deltaPhi=2PI, Z-planes a zplanes[0] and zplanes[1] - PolyhedraRegular(int nsides, double rmin, double rmax, double zplanes[2]); - /// Constructor to create a new object with phi_start, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2 - PolyhedraRegular(int nsides, double phi_start, double rmin, double rmax, double zlen); - /// Assignment operator - PolyhedraRegular& operator=(const PolyhedraRegular& copy) = default; - }; - - /// Class describing an arbitray solid defined by 8 vertices. - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoArb8.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class EightPointSolid: public Solid_type<TGeoArb8> { - private: - /// Internal helper method to support object construction - void make(double dz, const double* vtx); - public: - /// Default constructor - EightPointSolid() = default; - /// Constructor to be used when passing an already created object - EightPointSolid(const EightPointSolid& e) = default; - /// Constructor to be used with an existing object - template <typename Q> EightPointSolid(const Q* p) : Solid_type<TGeoArb8>(p) { } - /// Constructor to be used when passing an already created object - template <typename Q> EightPointSolid(const Handle<Q>& e) : Solid_type<TGeoArb8>(e) {} - /// Constructor to create a new anonymous object with attribute initialization - EightPointSolid(double dz, const double* vertices) { make(dz,vertices); } - /// Assignment operator - EightPointSolid& operator=(const EightPointSolid& copy) = default; - }; - - /// Base class describing boolean (=union,intersection,subtraction) solids - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoCompositeShape.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class BooleanSolid: public Solid_type<TGeoCompositeShape> { - protected: - /// Default constructor - BooleanSolid() = default; - /// Constructor to be used when passing an already created object - BooleanSolid(const BooleanSolid& b) = default; +namespace dd4hep { + + /// Pretty print of solid attributes + std::string toStringSolid(const TGeoShape* shape, int precision=2); + + /// Base class for Solid (shape) objects + /** + * Generic handle holding an object of base TGeoShape. + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoShape.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class Solid_type: public Handle<T> { + protected: + void _setDimensions(double* param); + /// Assign pointrs and register solid to geometry + void _assign(T* n, const std::string& nam, const std::string& tit, bool cbbox); + + public: + + /// Default constructor for uninitialized object + Solid_type() = default; + /// Constructor to be used when passing an already created object + Solid_type(const Solid_type& e) = default; + /// Direct assignment using the implementation pointer + Solid_type(T* p) : Handle<T>(p) { } + /// Constructor to be used when passing an already created object + Solid_type(const Handle<T>& e) : Handle<T>(e) { } + /// Constructor to be used when passing an already created object: need to check pointers + template <typename Q> Solid_type(const Handle<Q>& e) : Handle<T>(e) { } + /// Assignment operator + Solid_type& operator=(const Solid_type& copy) = default; + + /// Access to shape name + const char* name() const; + /// Access to shape type (The TClass name of the ROOT implementation) + const char* type() const; + /// Auto conversion to underlying ROOT object + operator T*() const { + return this->m_element; + } + /// Overloaded operator -> to access underlying object + T* operator->() const { + return this->m_element; + } + /// Conversion to string for pretty print + std::string toString(int precision=2) const { + return toStringSolid(this->m_element,precision); + } + }; + typedef Solid_type<TGeoShape> Solid; + + /// Class describing a box shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoBBox.html + * + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Box: public Solid_type<TGeoBBox> { + protected: + /// detaill helper method to support object construction + void make(double x_val, double y_val, double z_val); + + public: + /// Default constructor + Box() = default; + /// Constructor to be used when passing an already created object + Box(const Box& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Box(const Q* p) : Solid_type<TGeoBBox>(p) { } + /// Constructor to be used with an existing object + template <typename Q> Box(const Handle<Q>& e) : Solid_type<TGeoBBox>(e) { } + /// Constructor to create an anonymous new box object (retrieves name from volume) + Box(double x_val, double y_val, double z_val) { make(x_val, y_val, z_val); } + /// Constructor to create an anonymous new box object (retrieves name from volume) + template <typename X, typename Y, typename Z> + Box(const X& x_val, const Y& y_val, const Z& z_val) { + make(_toDouble(x_val), _toDouble(y_val), _toDouble(z_val)); + } + /// Assignment operator + Box& operator=(const Box& copy) = default; + /// Set the box dimensions + Box& setDimensions(double x_val, double y_val, double z_val); + /// Access half "length" of the box + double x() const; + /// Access half "width" of the box + double y() const; + /// Access half "depth" of the box + double z() const; + }; + + /// Class describing half-space + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoHalfSpace.html + * + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class HalfSpace: public Solid_type<TGeoHalfSpace> { + protected: + /// detaill helper method to support object construction + void make(const double* const point, const double* const normal); + + public: + /// Default constructor + HalfSpace() = default; + /// Constructor to be used when passing an already created object + HalfSpace(const HalfSpace& e) = default; + /// Constructor to be used with an existing object + template <typename Q> HalfSpace(const Q* p) : Solid_type<TGeoHalfSpace>(p) { } + /// Constructor to be used with an existing object + template <typename Q> HalfSpace(const Handle<Q>& e) : Solid_type<TGeoHalfSpace>(e) { } + /// Constructor to create an new halfspace object from a point on a plane and the plane normal + HalfSpace(const double* const point, const double* const normal) { make(point,normal); } + /// Assignment operator + HalfSpace& operator=(const HalfSpace& copy) = default; + }; + + /// Class describing a Polycone shape + /** + * Polycone. It has at least 9 parameters : + * - the lower phi limit; + * - the range in phi; + * - the number of z planes (at least two) where the inner/outer + * radii are changing; + * - z coordinate, inner and outer radius for each z plane + * + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoPcon.html + * + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Polycone: public Solid_type<TGeoPcon> { + public: + /// Default constructor + Polycone() = default; + /// Constructor to be used when passing an already created object + Polycone(const Polycone& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Polycone(const Q* p) : Solid_type<TGeoPcon>(p) { } + /// Constructor to be used when reading the already parsed polycone object + template <typename Q> Polycone(const Handle<Q>& e) : Solid_type<TGeoPcon>(e) { } + /// Constructor to create a new polycone object + Polycone(double start, double delta); + + /// Constructor to create a new polycone object. Add at the same time all Z planes + Polycone(double start, double delta, const std::vector<double>& rmin, const std::vector<double>& rmax, + const std::vector<double>& z); + /// Assignment operator + Polycone& operator=(const Polycone& copy) = default; + + /// Add Z-planes to the Polycone + void addZPlanes(const std::vector<double>& rmin, const std::vector<double>& rmax, const std::vector<double>& z); + }; + + /// Class describing a cone segment shape + /** + * A ConeSegment is, in the general case, a Phi segment of a cone, with + * half-length dz, inner and outer radii specified at -dz and +dz. + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoConeSeg.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class ConeSegment: public Solid_type<TGeoConeSeg> { + public: + /// Default constructor + ConeSegment() = default; + /// Constructor to be used when passing an already created object + ConeSegment(const ConeSegment& e) = default; + /// Constructor to be used with an existing object + template <typename Q> ConeSegment(const Q* p) : Solid_type<TGeoConeSeg>(p) { } + /// Constructor to be used when reading the already parsed ConeSegment object + template <typename Q> ConeSegment(const Handle<Q>& e) : Solid_type<TGeoConeSeg>(e) { } + /// Constructor to create a new ConeSegment object + ConeSegment(double dz, double rmin1, double rmax1, double rmin2, double rmax2, double phi1 = 0.0, double phi2 = 2.0 * M_PI); + /// Assignment operator + ConeSegment& operator=(const ConeSegment& copy) = default; + + /// Set the cone segment dimensions + ConeSegment& setDimensions(double dz, double rmin1, double rmax1, + double rmin2, double rmax2, double phi1 = 0.0, double phi2 = 2.0 * M_PI); + }; + + /// Intermediate class to overcome drawing probles with the TGeoTubeSeg + class MyConeSeg: public TGeoConeSeg { + public: + MyConeSeg() : TGeoConeSeg() { } + virtual ~MyConeSeg() { } + double GetRmin() const { return GetRmin1(); } + double GetRmax() const { return GetRmax1(); } + }; + + /// Class describing a tube shape of a section of a tube + /** + * TGeoTube - cylindrical tube class. It takes 3 parameters : + * inner radius, outer radius and half-length dz. + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoConeSeg.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Tube: public Solid_type< /*TGeoTubeSeg */MyConeSeg> { + protected: + /// detaill helper method to support object construction + void make(const std::string& nam, double rmin, double rmax, double z, double startPhi, double deltaPhi); + + public: + /// Default constructor + Tube() = default; + /// Constructor to be used when passing an already created object + Tube(const Tube& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Tube(const Q* p) : Solid_type<MyConeSeg>(p) { } + /// Constructor to assign an object + template <typename Q> Tube(const Handle<Q>& e) : Solid_type<MyConeSeg>(e) { } + /// Constructor to create a new anonymous tube object with attribute initialization + Tube(double rmin, double rmax, double z) + { make("", rmin, rmax, z, 0, 2*M_PI); } + /// Constructor to create a new anonymous tube object with attribute initialization + Tube(double rmin, double rmax, double z, double deltaPhi) + { make("", rmin, rmax, z, 0, deltaPhi); } + /// Constructor to create a new anonymous tube object with attribute initialization + Tube(double rmin, double rmax, double z, double startPhi, double deltaPhi) + { make("", rmin, rmax, z, startPhi, deltaPhi); } + /// Legacy: Constructor to create a new identifiable tube object with attribute initialization + Tube(const std::string& nam, double rmin, double rmax, double z) + { make(nam, rmin, rmax, z, 0, 2*M_PI); } + /// Legacy: Constructor to create a new identifiable tube object with attribute initialization + Tube(const std::string& nam, double rmin, double rmax, double z, double deltaPhi) + { make(nam, rmin, rmax, z, 0, deltaPhi); } + /// Constructor to create a new anonymous tube object with attribute initialization + template <typename RMIN, typename RMAX, typename Z, typename DELTAPHI> + Tube(const RMIN& rmin, const RMAX& rmax, const Z& z, const DELTAPHI& deltaPhi) + { make("", _toDouble(rmin), _toDouble(rmax), _toDouble(z), 0, _toDouble(deltaPhi)); } + /// Assignment operator + Tube& operator=(const Tube& copy) = default; + /// Set the tube dimensions + Tube& setDimensions(double rmin, double rmax, double z, double startPhi=0.0, double deltaPhi=2*M_PI); + }; + + /// Class describing a elliptical tube shape of a section of a tube + /** + * TGeoEltu - cylindrical tube class. It takes 3 parameters : + * Semi axis of ellipsis in x and y and half-length dz. + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoElTu.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class EllipticalTube: public Solid_type<TGeoEltu> { + protected: + /// detaill helper method to support object construction + void make(double a, double b, double dz); + + public: + /// Default constructor + EllipticalTube() = default; + /// Constructor to be used when passing an already created object + EllipticalTube(const EllipticalTube& e) = default; + /// Constructor to be used with an existing object + template <typename Q> EllipticalTube(const Q* p) : Solid_type<TGeoEltu>(p) { } + /// Constructor to assign an object + template <typename Q> EllipticalTube(const Handle<Q>& e) : Solid_type<TGeoEltu>(e) { } + /// Constructor to create a new anonymous tube object with attribute initialization + EllipticalTube(double a, double b, double dz) { make(a, b, dz); } + /// Constructor to create a new anonymous tube object with attribute initialization + template <typename A, typename B, typename DZ> + EllipticalTube(const A& a, const B& b, const DZ& dz) + { make(_toDouble(a), _toDouble(b), _toDouble(dz)); } + /// Assignment operator + EllipticalTube& operator=(const EllipticalTube& copy) = default; + /// Set the tube dimensions + EllipticalTube& setDimensions(double a, double b, double dz); + }; + + /// Class describing a cone shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoCone.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Cone: public Solid_type<TGeoCone> { + protected: + /// detaill helper method to support object construction + void make(double z, double rmin1, double rmax1, double rmin2, double rmax2); + public: + /// Default constructor + Cone() = default; + /// Constructor to be used when passing an already created object + Cone(const Cone& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Cone(const Q* p) : Solid_type<TGeoCone>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> Cone(const Handle<Q>& e) : Solid_type<TGeoCone>(e) { } + /// Constructor to create a new anonymous object with attribute initialization + Cone(double z, double rmin1, double rmax1, double rmin2, double rmax2) + { make(z, rmin1, rmax1, rmin2, rmax2); } + template <typename Z, typename RMIN1, typename RMAX1, typename RMIN2, typename RMAX2> + Cone(const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2) + { make(_toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); } + /// Assignment operator + Cone& operator=(const Cone& copy) = default; + /// Set the box dimensions + Cone& setDimensions(double z, double rmin1, double rmax1, double rmin2, double rmax2); + }; + + /// Class describing a trap shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoTrap.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Trap: public Solid_type<TGeoTrap> { + private: + /// detaill helper method to support object construction + void make(double pz, double py, double px, double pLTX); + public: + /// Default constructor + Trap() = default; + /// Constructor to be used when passing an already created object + Trap(const Trap& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Trap(const Q* p) : Solid_type<TGeoTrap>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> Trap(const Handle<Q>& e) : Solid_type<TGeoTrap>(e) { } + /// Constructor to create a new anonymous object with attribute initialization + Trap(double z, double theta, double phi, + double y1, double x1, double x2, double alpha1, + double y2, double x3, double x4, double alpha2); + /// Constructor to create a new anonymous object for right angular wedge from STEP (Se G4 manual for details) + Trap(double pz, double py, double px, double pLTX) { make(pz,py,px,pLTX); } + /// Constructor to create a new anonymous object with attribute initialization + template <typename PZ,typename PY,typename PX,typename PLTX> Trap(PZ pz, PY py, PX px, PLTX pLTX) + { make(_toDouble(pz),_toDouble(py),_toDouble(px),_toDouble(pLTX)); } + /// Assignment operator + Trap& operator=(const Trap& copy) = default; + /// Set the trap dimensions + Trap& setDimensions(double z, double theta, double phi, + double y1, double x1, double x2, double alpha1, + double y2, double x3, double x4, double alpha2); + }; + + /// Class describing a Trapezoid shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoTrd2.html + * + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Trapezoid: public Solid_type<TGeoTrd2> { + private: + /// detaill helper method to support object construction + void make(double x1, double x2, double y1, double y2, double z); + + public: + /// Default constructor + Trapezoid() = default; + /// Constructor to be used when passing an already created object + Trapezoid(const Trapezoid& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Trapezoid(const Q* p) : Solid_type<TGeoTrd2>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> Trapezoid(const Handle<Q>& e) : Solid_type<TGeoTrd2>(e) { } + /// Constructor to create a new anonymous object with attribute initialization + Trapezoid(double x1, double x2, double y1, double y2, double z); + /// Constructor to create a new anonymous object with attribute initialization + template <typename X1,typename X2,typename Y1,typename Y2,typename Z> + Trapezoid(X1 x1, X2 x2, Y1 y1, Y2 y2, Z z) + { make(_toDouble(x1),_toDouble(x2),_toDouble(y1),_toDouble(y2),_toDouble(z)); } + /// Assignment operator + Trapezoid& operator=(const Trapezoid& copy) = default; + /// Set the Trapezoid dimensions + Trapezoid& setDimensions(double x1, double x2, double y1, double y2, double z); + }; + + /// Class describing a Torus shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoTorus.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Torus: public Solid_type<TGeoTorus> { + private: + /// detaill helper method to support object construction + void make(double r, double rmin, double rmax, double phi, double delta_phi); + public: + /// Default constructor + Torus() = default; + /// Constructor to be used when passing an already created object + Torus(const Torus& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Torus(const Q* p) : Solid_type<TGeoTorus>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> Torus(const Handle<Q>& e) : Solid_type<TGeoTorus>(e) { } + /// Constructor to create a new anonymous object with attribute initialization + template<typename R, typename RMIN, typename RMAX, typename PHI, typename DELTA_PHI> + Torus(R r, RMIN rmin, RMAX rmax, PHI phi=M_PI, DELTA_PHI delta_phi = 2.*M_PI) + { make(_toDouble(r),_toDouble(rmin),_toDouble(rmax),_toDouble(phi),_toDouble(delta_phi)); } + /// Constructor to create a new anonymous object with attribute initialization + Torus(double r, double rmin, double rmax, double phi=M_PI, double delta_phi = 2.*M_PI) + { make(r,rmin,rmax,phi,delta_phi); } + /// Assignment operator + Torus& operator=(const Torus& copy) = default; + /// Set the Torus dimensions + Torus& setDimensions(double r, double rmin, double rmax, double phi, double delta_phi); + }; + + /// Class describing a sphere shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoSphere.html + * + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Sphere: public Solid_type<TGeoSphere> { + public: + /// Default constructor + Sphere() = default; + /// Constructor to be used when passing an already created object + Sphere(const Sphere& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Sphere(const Q* p) : Solid_type<TGeoSphere>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> Sphere(const Handle<Q>& e) : Solid_type<TGeoSphere>(e) { } + /// Constructor to create a new anonymous object with attribute initialization + Sphere(double rmin, double rmax, double theta = 0., double delta_theta = M_PI, double phi = 0.0, double delta_phi = 2. * M_PI); + /// Assignment operator + Sphere& operator=(const Sphere& copy) = default; + /// Set the Sphere dimensions + Sphere& setDimensions(double rmin, double rmax, double theta, double delta_theta, double phi, double delta_phi); + }; + + /// Class describing a Paraboloid shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoParaboloid.html + * + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Paraboloid: public Solid_type<TGeoParaboloid> { + public: + /// Default constructor + Paraboloid() = default; + /// Constructor to be used when passing an already created object + Paraboloid(const Paraboloid& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Paraboloid(const Q* p) : Solid_type<TGeoParaboloid>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> Paraboloid(const Handle<Q>& e) : Solid_type<TGeoParaboloid>(e) { } + /// Constructor to create a new anonymous object with attribute initialization + Paraboloid(double r_low, double r_high, double delta_z); + /// Assignment operator + Paraboloid& operator=(const Paraboloid& copy) = default; + /// Set the Paraboloid dimensions + Paraboloid& setDimensions(double r_low, double r_high, double delta_z); + }; + + /// Class describing a Hyperboloid shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoHype.html + * + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Hyperboloid: public Solid_type<TGeoHype> { + public: + /// Default constructor + Hyperboloid() = default; + /// Constructor to be used when passing an already created object + Hyperboloid(const Hyperboloid& e) = default; + /// Constructor to be used with an existing object + template <typename Q> Hyperboloid(const Q* p) : Solid_type<TGeoHype>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> Hyperboloid(const Handle<Q>& e) : Solid_type<TGeoHype>(e) { } + /// Constructor to create a new anonymous object with attribute initialization + Hyperboloid(double rin, double stin, double rout, double stout, double dz); + /// Assignment operator + Hyperboloid& operator=(const Hyperboloid& copy) = default; + /// Set the Hyperboloid dimensions + Hyperboloid& setDimensions(double rin, double stin, double rout, double stout, double dz); + }; + + /// Class describing a regular polyhedron shape + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoPgon.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class PolyhedraRegular: public Solid_type<TGeoPgon> { + protected: + /// Helper function to create the polyhedron + void _create(int nsides, double rmin, double rmax, double zpos, double zneg, double start, double delta); + public: + /// Default constructor + PolyhedraRegular() = default; + /// Constructor to be used when passing an already created object + PolyhedraRegular(const PolyhedraRegular& e) = default; + /// Constructor to be used with an existing object + template <typename Q> PolyhedraRegular(const Q* p) : Solid_type<TGeoPgon>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> PolyhedraRegular(const Handle<Q>& e) : Solid_type<TGeoPgon>(e) { } + /// Constructor to create a new object. Phi(start)=0, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2 + PolyhedraRegular(int nsides, double rmin, double rmax, double zlen); + /// Constructor to create a new object. Phi(start)=0, deltaPhi=2PI, Z-planes a zplanes[0] and zplanes[1] + PolyhedraRegular(int nsides, double rmin, double rmax, double zplanes[2]); + /// Constructor to create a new object with phi_start, deltaPhi=2PI, Z-planes at -zlen/2 and +zlen/2 + PolyhedraRegular(int nsides, double phi_start, double rmin, double rmax, double zlen); + /// Assignment operator + PolyhedraRegular& operator=(const PolyhedraRegular& copy) = default; + }; + + /// Class describing an arbitray solid defined by 8 vertices. + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoArb8.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class EightPointSolid: public Solid_type<TGeoArb8> { + private: + /// detaill helper method to support object construction + void make(double dz, const double* vtx); + public: + /// Default constructor + EightPointSolid() = default; + /// Constructor to be used when passing an already created object + EightPointSolid(const EightPointSolid& e) = default; + /// Constructor to be used with an existing object + template <typename Q> EightPointSolid(const Q* p) : Solid_type<TGeoArb8>(p) { } + /// Constructor to be used when passing an already created object + template <typename Q> EightPointSolid(const Handle<Q>& e) : Solid_type<TGeoArb8>(e) {} + /// Constructor to create a new anonymous object with attribute initialization + EightPointSolid(double dz, const double* vertices) { make(dz,vertices); } + /// Assignment operator + EightPointSolid& operator=(const EightPointSolid& copy) = default; + }; + + /// Base class describing boolean (=union,intersection,subtraction) solids + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoCompositeShape.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class BooleanSolid: public Solid_type<TGeoCompositeShape> { + protected: + /// Default constructor + BooleanSolid() = default; + /// Constructor to be used when passing an already created object + BooleanSolid(const BooleanSolid& b) = default; - public: - /// Constructor to be used when passing an already created object - template <typename Q> - BooleanSolid(const Handle<Q>& e) : Solid_type<TGeoCompositeShape>(e) { } - /// Assignment operator - BooleanSolid& operator=(const BooleanSolid& copy) = default; - }; - - /// Class describing boolean subtraction solid - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoCompositeShape.html - * \see http://root.cern.ch/root/html/TGeoSubtraction.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class SubtractionSolid: public BooleanSolid { - public: - /// Default constructor - SubtractionSolid() = default; - /// Constructor to be used when passing an already created object - SubtractionSolid(const SubtractionSolid& e) = default; - /// Constructor to be used when passing an already created object - template <typename Q> SubtractionSolid(const Handle<Q>& e) : BooleanSolid(e) { } - /// Constructor to create a new object. Position is identity, Rotation is identity-rotation! - SubtractionSolid(const Solid& shape1, const Solid& shape2); - /// Constructor to create a new object. Placement by position, Rotation is identity-rotation! - SubtractionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); - /// Constructor to create a new object. Placement by a RotationZYX within the mother - SubtractionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot); - /// Constructor to create a new object. Placement by a generic rotoation within the mother - SubtractionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); - /// Constructor to create a new object. Placement by a generic transformation within the mother - SubtractionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos); - /// Assignment operator - SubtractionSolid& operator=(const SubtractionSolid& copy) = default; - }; - - /// Class describing boolean union solid - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoCompositeShape.html - * \see http://root.cern.ch/root/html/TGeoUnion.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class UnionSolid: public BooleanSolid { - public: - /// Default constructor - UnionSolid() = default; - /// Constructor to be used when passing an already created object - UnionSolid(const UnionSolid& e) = default; - /// Constructor to be used when passing an already created object - template <typename Q> UnionSolid(const Handle<Q>& e) : BooleanSolid(e) { } - /// Constructor to create a new object. Position is identity, Rotation is identity-rotation! - UnionSolid(const Solid& shape1, const Solid& shape2); - /// Constructor to create a new object. Placement by position, Rotation is identity-rotation! - UnionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); - /// Constructor to create a new object. Placement by a RotationZYX within the mother - UnionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot); - /// Constructor to create a new object. Placement by a generic rotoation within the mother - UnionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); - /// Constructor to create a new object. Placement by a generic transformation within the mother - UnionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos); - /// Assignment operator - UnionSolid& operator=(const UnionSolid& copy) = default; - }; - - /// Class describing boolean intersection solid - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoCompositeShape.html - * \see http://root.cern.ch/root/html/TGeoIntersection.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class IntersectionSolid: public BooleanSolid { - public: - /// Default constructor - IntersectionSolid() = default; - /// Constructor to be used when passing an already created object - IntersectionSolid(const IntersectionSolid& e) = default; - /// Constructor to be used when passing an already created object - template <typename Q> IntersectionSolid(const Handle<Q>& e) : BooleanSolid(e) { } - /// Constructor to create a new object. Position is identity, Rotation is identity-rotation! - IntersectionSolid(const Solid& shape1, const Solid& shape2); - /// Constructor to create a new object. Placement by position, Rotation is identity-rotation! - IntersectionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); - /// Constructor to create a new object. Placement by a RotationZYX within the mother - IntersectionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot); - /// Constructor to create a new object. Placement by a generic rotoation within the mother - IntersectionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); - /// Constructor to create a new object. Placement by a generic transformation within the mother - IntersectionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos); - /// Assignment operator - IntersectionSolid& operator=(const IntersectionSolid& copy) = default; - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + public: + /// Constructor to be used when passing an already created object + template <typename Q> + BooleanSolid(const Handle<Q>& e) : Solid_type<TGeoCompositeShape>(e) { } + /// Assignment operator + BooleanSolid& operator=(const BooleanSolid& copy) = default; + }; + + /// Class describing boolean subtraction solid + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoCompositeShape.html + * \see http://root.cern.ch/root/html/TGeoSubtraction.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class SubtractionSolid: public BooleanSolid { + public: + /// Default constructor + SubtractionSolid() = default; + /// Constructor to be used when passing an already created object + SubtractionSolid(const SubtractionSolid& e) = default; + /// Constructor to be used when passing an already created object + template <typename Q> SubtractionSolid(const Handle<Q>& e) : BooleanSolid(e) { } + /// Constructor to create a new object. Position is identity, Rotation is identity-rotation! + SubtractionSolid(const Solid& shape1, const Solid& shape2); + /// Constructor to create a new object. Placement by position, Rotation is identity-rotation! + SubtractionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); + /// Constructor to create a new object. Placement by a RotationZYX within the mother + SubtractionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot); + /// Constructor to create a new object. Placement by a generic rotoation within the mother + SubtractionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); + /// Constructor to create a new object. Placement by a generic transformation within the mother + SubtractionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos); + /// Assignment operator + SubtractionSolid& operator=(const SubtractionSolid& copy) = default; + }; + + /// Class describing boolean union solid + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoCompositeShape.html + * \see http://root.cern.ch/root/html/TGeoUnion.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class UnionSolid: public BooleanSolid { + public: + /// Default constructor + UnionSolid() = default; + /// Constructor to be used when passing an already created object + UnionSolid(const UnionSolid& e) = default; + /// Constructor to be used when passing an already created object + template <typename Q> UnionSolid(const Handle<Q>& e) : BooleanSolid(e) { } + /// Constructor to create a new object. Position is identity, Rotation is identity-rotation! + UnionSolid(const Solid& shape1, const Solid& shape2); + /// Constructor to create a new object. Placement by position, Rotation is identity-rotation! + UnionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); + /// Constructor to create a new object. Placement by a RotationZYX within the mother + UnionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot); + /// Constructor to create a new object. Placement by a generic rotoation within the mother + UnionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); + /// Constructor to create a new object. Placement by a generic transformation within the mother + UnionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos); + /// Assignment operator + UnionSolid& operator=(const UnionSolid& copy) = default; + }; + + /// Class describing boolean intersection solid + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoCompositeShape.html + * \see http://root.cern.ch/root/html/TGeoIntersection.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class IntersectionSolid: public BooleanSolid { + public: + /// Default constructor + IntersectionSolid() = default; + /// Constructor to be used when passing an already created object + IntersectionSolid(const IntersectionSolid& e) = default; + /// Constructor to be used when passing an already created object + template <typename Q> IntersectionSolid(const Handle<Q>& e) : BooleanSolid(e) { } + /// Constructor to create a new object. Position is identity, Rotation is identity-rotation! + IntersectionSolid(const Solid& shape1, const Solid& shape2); + /// Constructor to create a new object. Placement by position, Rotation is identity-rotation! + IntersectionSolid(const Solid& shape1, const Solid& shape2, const Position& pos); + /// Constructor to create a new object. Placement by a RotationZYX within the mother + IntersectionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot); + /// Constructor to create a new object. Placement by a generic rotoation within the mother + IntersectionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot); + /// Constructor to create a new object. Placement by a generic transformation within the mother + IntersectionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& pos); + /// Assignment operator + IntersectionSolid& operator=(const IntersectionSolid& copy) = default; + }; + +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_SOLIDS_H */ diff --git a/DDCore/include/DD4hep/SurfaceInstaller.h b/DDCore/include/DD4hep/SurfaceInstaller.h index cba6ad4db..28739868a 100644 --- a/DDCore/include/DD4hep/SurfaceInstaller.h +++ b/DDCore/include/DD4hep/SurfaceInstaller.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_DDREC_SURFACEINSTALLER_H 1 // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DetectorTools.h" #include "DD4hep/DetFactoryHelper.h" @@ -33,7 +33,14 @@ namespace dd4hep{ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { + + /// Namespace for the reconstruction part of the AIDA detector description toolkit + namespace rec { + /// Class describing surface data + // class SurfaceData; + class VolSurfaceBase; + } /** Base class to implement surface installers for known detector patterns * @@ -47,18 +54,14 @@ namespace DD4hep { */ class SurfaceInstaller { protected: - typedef Geometry::LCDD LCDD; - typedef Geometry::DetElement DetElement; - typedef Geometry::Volume Volume; - typedef Geometry::PlacedVolume PlacedVolume; - typedef Geometry::DetectorTools::ElementPath ElementPath; - typedef Geometry::DetectorTools::PlacementPath PlacementPath; - typedef dd4hep::rec::VolSurfaceBase SurfaceData; - typedef dd4hep::rec::SurfaceType SurfaceType; - + typedef detail::tools::ElementPath ElementPath; + typedef detail::tools::PlacementPath PlacementPath; + typedef rec::VolSurfaceBase SurfaceData; + typedef rec::SurfaceType SurfaceType; typedef std::map<TGeoVolume*, SurfaceData* > Surfaces; - /// Reference to the LCDD instance - LCDD& m_lcdd; + + /// Reference to the Detector instance + Detector& m_detDesc; /// Reference to the detector element of the subdetector DetElement m_det; /// Map of surface instances keyed by the logical volume @@ -74,7 +77,7 @@ namespace DD4hep { /// No copy constructor SurfaceInstaller(const SurfaceInstaller& copy) = delete; /// Initializing constructor - SurfaceInstaller(LCDD& lcdd, int argc, char** argv); + SurfaceInstaller(Detector& description, int argc, char** argv); /// Default destructor virtual ~SurfaceInstaller() = default; /// No assignment @@ -92,23 +95,23 @@ namespace DD4hep { /// Install volume information. Default implementation only prints! virtual void install(DetElement e, PlacedVolume pv); /// Executor - template <typename T> static long run(LCDD& lcdd,int argc,char** argv); + template <typename T> static long run(Detector& description,int argc,char** argv); }; /// Action routine to execute the test - template <typename T> inline long SurfaceInstaller::run(Geometry::LCDD& lcdd,int argc,char** argv) { - T installer(lcdd, argc, argv); + template <typename T> inline long SurfaceInstaller::run(Detector& description,int argc,char** argv) { + T installer(description, argc, argv); installer.scan(); return 1; } #define DECLARE_SURFACE_INSTALLER(name,class) \ - namespace DD4hep { \ - template long SurfaceInstaller::run< class >(Geometry::LCDD& lcdd,int argc,char** argv); \ + namespace dd4hep { \ + template long SurfaceInstaller::run< class >(Detector& description,int argc,char** argv); \ } \ DECLARE_APPLY(name,SurfaceInstaller::run< class >) -} // End namespace DD4hep +} // End namespace dd4hep #if defined(DD4HEP_USE_SURFACEINSTALL_HELPER) @@ -140,12 +143,12 @@ namespace { * \version 1.0 * \ingroup DD4HEP */ - template <typename UserData> class Installer : public DD4hep::SurfaceInstaller { + template <typename UserData> class Installer : public dd4hep::SurfaceInstaller { public: - typedef DD4hep::DDRec::Vector3D Vector3D; - typedef DD4hep::DDRec::VolSurface VolSurface; - typedef DD4hep::DDRec::VolPlane VolPlane; - typedef SurfaceType Type; + typedef dd4hep::rec::Vector3D Vector3D; + typedef dd4hep::rec::VolSurface VolSurface; + typedef dd4hep::rec::VolPlane VolPlane; + typedef dd4hep::rec::SurfaceType Type; UserData data; /// Default (empty argument handler @@ -156,39 +159,39 @@ namespace { /// No copy constructor Installer(const Installer& copy) = delete; /// Initializing constructor - Installer(LCDD& lcdd, int argc, char** argv); + Installer(dd4hep::Detector& description, int argc, char** argv); /// Default destructor virtual ~Installer() = default; /// No assignment Installer& operator=(const Installer& copy) = delete; /// Install volume information. Default implementation only prints! - virtual void install(DetElement component, PlacedVolume pv); + virtual void install(dd4hep::DetElement component, dd4hep::PlacedVolume pv); /// Try to handle surface using the surface cache - bool handleUsingCache(DetElement comp, Volume vol) const; + bool handleUsingCache(dd4hep::DetElement comp, dd4hep::Volume vol) const; /// Add a new surface to the surface manager and the local cache - void addSurface(DetElement component, const DD4hep::DDRec::VolSurface& surf); + void addSurface(dd4hep::DetElement component, const dd4hep::rec::VolSurface& surf); template <typename T> bool checkShape(const T& shape) const { if ( shape.isValid() ) return true; - invalidInstaller("Shape is not of the required type:"+DD4hep::typeName(typeid(T))); + invalidInstaller("Shape is not of the required type:"+dd4hep::typeName(typeid(T))); return false; } }; /// Initializing constructor template <typename UserData> - Installer<UserData>::Installer(LCDD& lcdd, int argc, char** argv) - : DD4hep::SurfaceInstaller(lcdd, argc, argv), data() + Installer<UserData>::Installer(dd4hep::Detector& description, int argc, char** argv) + : dd4hep::SurfaceInstaller(description, argc, argv), data() { handle_arguments(argc, argv); } /// Handle surface installation using cached surfaces. template <typename UserData> - bool Installer<UserData>::handleUsingCache(DetElement comp, Volume vol) const { + bool Installer<UserData>::handleUsingCache(dd4hep::DetElement comp, dd4hep::Volume vol) const { Surfaces::const_iterator is = m_surfaces.find(vol.ptr()); if ( is != m_surfaces.end() ) { VolSurface surf((*is).second); - DD4hep::DDRec::volSurfaceList(comp)->push_back(surf); + dd4hep::rec::volSurfaceList(comp)->push_back(surf); return true; } return false; @@ -196,9 +199,9 @@ namespace { /// Add a new surface to the surface manager and the local cache template <typename UserData> - void Installer<UserData>::addSurface(DetElement component, const DD4hep::DDRec::VolSurface& surf) { + void Installer<UserData>::addSurface(dd4hep::DetElement component, const dd4hep::rec::VolSurface& surf) { m_surfaces.insert(std::make_pair(surf.volume().ptr(),surf.ptr())); - DD4hep::DDRec::volSurfaceList(component)->push_back(surf); + dd4hep::rec::volSurfaceList(component)->push_back(surf); } /// Default (empty argument handler diff --git a/DDCore/include/DD4hep/TGeoUnits.h b/DDCore/include/DD4hep/TGeoUnits.h index 9719be82c..0b4895d70 100644 --- a/DDCore/include/DD4hep/TGeoUnits.h +++ b/DDCore/include/DD4hep/TGeoUnits.h @@ -1,5 +1,5 @@ // OSOLETE -// use DD4hepUnits and dd4hep:: instead +// use dd4hepUnits and dd4hep:: instead #ifndef DD4HEP_TGEOUNITS_H #define DD4HEP_TGEOUNITS_H diff --git a/DDCore/include/DD4hep/ToStream.h b/DDCore/include/DD4hep/ToStream.h index 46d52d4c0..bb71c2803 100644 --- a/DDCore/include/DD4hep/ToStream.h +++ b/DDCore/include/DD4hep/ToStream.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,10 +28,10 @@ #include <sstream> // ============================================================================ -/** @file DD4hep/ToStream.h +/** @file dd4hep/ToStream.h * implemenattiono fvarioud functions for streaming. * this functionality is essenital for usag eof varuodu types as property for - * the various DD4hep components + * the various dd4hep components * @attention the implemenation of the specific specializations must be done * before the inclusion of this file * @todo ToStream.h : reimplement in terms of functors, to allow @@ -40,7 +40,7 @@ // ============================================================================ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // ========================================================================== /// Utility namespace to support boost::spirit namespace Utils { @@ -290,7 +290,7 @@ namespace DD4hep { * @author Alexander MAZUROV Alexander.Mazurov@gmail.com * @author Vanya BELYAEV ibelyaev@physics.syr.edu * @date 2006-05-12 - * @see DD4hep::Utils::toStream + * @see dd4hep::Utils::toStream * @todo need to be compared with boost::lexical_cast */ template <class TYPE> @@ -303,16 +303,16 @@ namespace DD4hep { return s.str(); } // ======================================================================== - }// end of namespace DD4hep::Utils + }// end of namespace dd4hep::Utils // ========================================================================== -}// end of namespace DD4hep +}// end of namespace dd4hep #ifndef DD4HEP_PARSERS_NO_ROOT #include "Math/Point3D.h" #include "Math/Vector3D.h" #include "Math/Vector4D.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // ========================================================================== /// Utility namespace to support boost::spirit namespace Utils { @@ -324,9 +324,9 @@ namespace DD4hep { /// print Lorentz vector std::ostream& toStream(const ROOT::Math::PxPyPzEVector& obj, std::ostream& s); // ======================================================================== - }// end of namespace DD4hep::Utils + }// end of namespace dd4hep::Utils // ========================================================================== -}// end of namespace DD4hep +}// end of namespace dd4hep #endif // ============================================================================ // The END diff --git a/DDCore/include/DD4hep/VolumeManager.h b/DDCore/include/DD4hep/VolumeManager.h index 2600627b3..3c3d71b8e 100644 --- a/DDCore/include/DD4hep/VolumeManager.h +++ b/DDCore/include/DD4hep/VolumeManager.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,160 +11,186 @@ // //========================================================================== -#ifndef DD4hep_GEOMETRY_VOLUMEMANAGER_H -#define DD4hep_GEOMETRY_VOLUMEMANAGER_H +#ifndef dd4hep_GEOMETRY_VOLUMEMANAGER_H +#define dd4hep_GEOMETRY_VOLUMEMANAGER_H // Framework include files #include "DD4hep/Volumes.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/NamedObject.h" #include "DD4hep/IDDescriptor.h" +#include "DD4hep/ConditionsMap.h" // ROOT include files #include "TGeoMatrix.h" - /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { +namespace dd4hep { - // Forward declarations - class LCDD; - class VolumeManagerContext; + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { class VolumeManagerObject; + } + + /// This structure describes the cached data for one placement held by the volume manager + /** + * This structure is slightly optimized, since there are soooo many instances: + * If the sensitive volume is associated as a placement to the DetElement, then + * -- placement() returns element.placement() + * -- toElement() returns an identity matrix + * + * If the sensitive volume is NOT the element's placement, + * then the calls are forwarded to an appended invisible structure at the end + * of the memory. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class VolumeManagerContext { + public: + /// Handle to the closest Detector element + DetElement element{0}; + /// Placement identifier + VolumeID identifier = 0; + /// Ignore mask of the placement identifier + VolumeID mask = ~0x0ULL; + /// Flag to indicate optional information + long flag = 0; + public: + /// Default constructor + VolumeManagerContext() = default; + /// Inhibit copy constructor + VolumeManagerContext(const VolumeManagerContext& copy) = delete; + /// Inhibit move constructor + VolumeManagerContext(VolumeManagerContext&& copy) = delete; + /// Inhibit assignment + VolumeManagerContext& operator=(const VolumeManagerContext& copy) = delete; + /// Inhibit move assignment + VolumeManagerContext& operator=(VolumeManagerContext&& copy) = delete; + /// Default destructor + virtual ~VolumeManagerContext(); + /// Acces the sensitive volume placement + PlacedVolume placement() const; + /// Access the transformation to the closest detector element + const TGeoHMatrix& toElement() const; + }; + + /// Class to support the retrieval of detector elements and volumes given a valid identifier + /** + * + * The VolumeManager manages the repository of sensitive physical + * volumes (placements). These volumes can then be accessed together with + * basic other elements, such as the top level Detector element of the + * subdetector or the coordinate trasformation to world coordinates. + * The basic key to access this information is the 'VolumeID', a 64 bit + * number, which uniquely identifies a placement. + * + * There are 2 working modes: + * + * 1) Starting from the top level element, the next level is addressed + * separately and the volumes are stored in a 2-level 'tree'. Placements + * this way are partitioned e.g. 'by subdetector'. This tries to keep + * the number of mapped elements at a reasonable level. + * + * 2) All placements are mapped to the top-level element. Good for small + * setups. Note, that the system field of all IDDescriptors of the + * subdetectors must have the same length to ensure the uniqueness of the + * placement keys. + * + * By default the volume manager in TREE mode (-> 1)) is attached to the + * Detector instance and also managed by this instance. + * If you wish to create instances yourself, you must ensure that the + * handle is destroyed once no other references are present. + * [call DestroyHandle(VolumeManager)] + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class VolumeManager: public Handle<detail::VolumeManagerObject> { + public: + // Creation flags + enum PopulateFlags { + NONE = 0, + TREE = 1 << 1, // Build 1 level DetElement hierarchy while populating + ONE = 1 << 2, // Populate all daughter volumes into one big lookup-container + // This flag may be in parallel with 'TREE' + LAST + }; - /// Class to support the retrieval of detector elements and volumes given a valid identifier - /** - * - * The VolumeManager manages the repository of sensitive physical - * volumes (placements). These volumes can then be accessed together with - * basic other elements, such as the top level Detector element of the - * subdetector or the coordinate trasformation to world coordinates. - * The basic key to access this information is the 'VolumeID', a 64 bit - * number, which uniquely identifies a placement. - * - * There are 2 working modes: - * - * 1) Starting from the top level element, the next level is addressed - * separately and the volumes are stored in a 2-level 'tree'. Placements - * this way are partitioned e.g. 'by subdetector'. This tries to keep - * the number of mapped elements at a reasonable level. - * - * 2) All placements are mapped to the top-level element. Good for small - * setups. Note, that the system field of all IDDescriptors of the - * subdetectors must have the same length to ensure the uniqueness of the - * placement keys. - * - * By default the volume manager in TREE mode (-> 1)) is attached to the - * LCDD instance and also managed by this instance. - * If you wish to create instances yourself, you must ensure that the - * handle is destroyed once no other references are present. - * [call DestroyHandle(VolumeManager)] - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class VolumeManager: public Handle<VolumeManagerObject> { - public: - typedef DD4hep::VolumeID VolumeID; - typedef VolumeID VolIdentifier; - // Creation flags - enum PopulateFlags { - NONE = 0, - TREE = 1 << 1, // Build 1 level DetElement hierarchy while populating - ONE = 1 << 2, // Populate all daughter volumes into one big lookup-container - // This flag may be in parallel with 'TREE' - LAST - }; - - /// Some useful Container abbreviations used by the VolumeManager - typedef VolumeManagerObject Object; - typedef VolumeManagerContext Context; - typedef std::map<VolumeID, VolumeManager> Managers; - typedef std::map<DetElement, VolumeManager> Detectors; - typedef std::map<VolumeID, VolumeManagerContext*> Volumes; - typedef PlacedVolume::VolIDs VolIDs; - typedef std::map<TGeoNode*, Context*> PhysVolumes; + protected: + /// Additional data accessor + Object& _data() const { + return *(Object*) ptr(); + } - protected: - /// Additional data accessor - Object& _data() const { - return *(Object*) ptr(); - } + public: + /// Default constructor + VolumeManager() = default; - public: - /// Default constructor - VolumeManager() - : Handle<VolumeManagerObject>() { - } - /// Constructor to be used when reading the already parsed object - VolumeManager(const VolumeManager& e) - : Handle<VolumeManagerObject>(e) { - } + /// Constructor to be used when reading the already parsed object + VolumeManager(const VolumeManager& e) = default; #ifndef __CINT__ - /// Constructor to be used when reading the already parsed object - VolumeManager(const Handle<VolumeManagerObject>& e) - : Handle<VolumeManagerObject>(e) { - } + /// Constructor to be used when reading the already parsed object + VolumeManager(const Handle<detail::VolumeManagerObject>& e) + : Handle<detail::VolumeManagerObject>(e) { + } #endif - /// Constructor to be used when reading the already parsed object - template <typename Q> VolumeManager(const Handle<Q>& e) - : Handle<VolumeManagerObject>(e) { - } - /** Initializing constructor. The tree will automatically be built if the detelement is valid - * Please see enum PopulateFlags for further info. - * No action whatsoever is performed here, if the detector element is not valid. - */ - VolumeManager(LCDD& lcdd, const std::string& name, DetElement world = DetElement(), Readout ro = Readout(), int flags = - NONE); - /// Initializing constructor for subdetector volume managers. - VolumeManager(DetElement subdetector, Readout ro); - - /// static accessor calling DD4hepVolumeManagerPlugin if necessary - static VolumeManager getVolumeManager(LCDD& lcdd); - - /// Assignment operator - VolumeManager& operator=(const VolumeManager& m) { - if ( this != &m ) m_element = m.m_element; - return *this; - } - /// Add a new Volume manager section according to a new subdetector - VolumeManager addSubdetector(DetElement detector, Readout ro); - /// Access the volume manager by cell id - VolumeManager subdetector(VolumeID id) const; - - /// Access the top level detector element - DetElement detector() const; - /// Access IDDescription structure - IDDescriptor idSpec() const; - - /// Register physical volume with the manager (normally: section manager) - bool adoptPlacement(Context* context); - /// Register physical volume with the manager and pre-computed volume id - bool adoptPlacement(VolumeID volume_id, Context* context); - - /** This set of functions is required when reading/analyzing - * already created hits which have a VolumeID attached. - */ - /// Lookup the context, which belongs to a registered physical volume. - Context* lookupContext(VolumeID volume_id) const; - /// Lookup a physical (placed) volume identified by its 64 bit hit ID - PlacedVolume lookupPlacement(VolumeID volume_id) const; - /// Lookup a top level subdetector detector element according to a contained 64 bit hit ID - DetElement lookupDetector(VolumeID volume_id) const; - /// Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID - DetElement lookupDetElement(VolumeID volume_id) const; - /// Access the transformation of a physical volume to the world coordinate system - [[gnu::deprecated("This function might be buggy and will be removed")]] - const TGeoMatrix& worldTransformation(VolumeID volume_id) const; - }; - - /// Enable printouts for debugging - std::ostream& operator<<(std::ostream& os, const VolumeManager& m); - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4hep_GEOMETRY_READOUT_H */ + /// Constructor to be used when reading the already parsed object + template <typename Q> + VolumeManager(const Handle<Q>& e) : Handle<detail::VolumeManagerObject>(e) { } + /** Initializing constructor. The tree will automatically be built if the detelement is valid + * Please see enum PopulateFlags for further info. + * No action whatsoever is performed here, if the detector element is not valid. + */ + VolumeManager(Detector& description, + const std::string& name, + DetElement world = DetElement(), + Readout ro = Readout(), + int flags = + NONE); + /// Initializing constructor for subdetector volume managers. + VolumeManager(DetElement subdetector, Readout ro); + + /// static accessor calling dd4hepVolumeManagerPlugin if necessary + static VolumeManager getVolumeManager(Detector& description); + + /// Assignment operator + VolumeManager& operator=(const VolumeManager& m) = default; + + /// Add a new Volume manager section according to a new subdetector + VolumeManager addSubdetector(DetElement detector, Readout ro); + /// Access the volume manager by cell id + VolumeManager subdetector(VolumeID id) const; + + /// Access the top level detector element + DetElement detector() const; + /// Access IDDescription structure + IDDescriptor idSpec() const; + + /// Register physical volume with the manager (normally: section manager) + bool adoptPlacement(VolumeManagerContext* context); + /// Register physical volume with the manager and pre-computed volume id + bool adoptPlacement(VolumeID volume_id, VolumeManagerContext* context); + + /** This set of functions is required when reading/analyzing + * already created hits which have a VolumeID attached. + */ + /// Lookup the context, which belongs to a registered physical volume. + VolumeManagerContext* lookupContext(VolumeID volume_id) const; + /// Lookup a physical (placed) volume identified by its 64 bit hit ID + PlacedVolume lookupPlacement(VolumeID volume_id) const; + /// Convenience routine: Lookup a top level subdetector detector element according to a contained 64 bit hit ID + DetElement lookupDetector(VolumeID volume_id) const; + /// Convenience routine: Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID + DetElement lookupDetElement(VolumeID volume_id) const; + /// Convenience routine: Access the transformation of a physical volume to the world coordinate system + const TGeoMatrix& worldTransformation(const ConditionsMap& map, + VolumeID volume_id) const; + }; + + /// Enable printouts for debugging + std::ostream& operator<<(std::ostream& os, const VolumeManager& m); +} /* End namespace dd4hep */ +#endif /* dd4hep_GEOMETRY_READOUT_H */ diff --git a/DDCore/include/DD4hep/Volumes.h b/DDCore/include/DD4hep/Volumes.h index 6d72ade60..5d4b46767 100644 --- a/DDCore/include/DD4hep/Volumes.h +++ b/DDCore/include/DD4hep/Volumes.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,9 +10,8 @@ // Author : M.Frank // //========================================================================== - -#ifndef DD4HEP_GEOMETRY_VOLUMES_H -#define DD4HEP_GEOMETRY_VOLUMES_H +#ifndef DD4HEP_DDCORE_VOLUMES_H +#define DD4HEP_DDCORE_VOLUMES_H // Framework include files #include "DD4hep/Handle.h" @@ -44,344 +43,296 @@ public: #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class LCDD; - class Region; - class LimitSet; - class Material; - class VisAttr; - class Volume; - class DetElement; - class PlacedVolume; - class SensitiveDetector; - - /// Implementation class extending the ROOT placed volume +namespace dd4hep { + + class Detector; + class Region; + class LimitSet; + class Material; + class VisAttr; + class DetElement; + class SensitiveDetector; + + // Forward declarations + class Volume; + class PlacedVolume; + + /// Implementation class extending the ROOT placed volume + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoExtension.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class PlacedVolumeExtension : public TGeoExtension { + public: + typedef std::pair<std::string, int> VolID; + /// Volume ID container /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoExtension.html - * * \author M.Frank * \version 1.0 * \ingroup DD4HEP_GEOMETRY */ - class PlacedVolumeExtension : public TGeoExtension { + class VolIDs: public std::vector<VolID> { public: - typedef std::pair<std::string, int> VolID; - /// Volume ID container - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class VolIDs: public std::vector<VolID> { - public: - typedef std::vector<VolID> Base; - /// Default constructor - VolIDs() : std::vector<VolID>() {} - /// Copy constructor - VolIDs(const VolIDs& c) : std::vector<VolID>(c) {} - /// Destructor - ~VolIDs() {} - /// Assignment operator - VolIDs& operator=(const VolIDs& c) { - if ( &c != this ) this->std::vector<VolID>::operator=(c); - return *this; - } - /// Find entry - std::vector<VolID>::const_iterator find(const std::string& name) const; - /// Insert new entry - std::pair<std::vector<VolID>::iterator, bool> insert(const std::string& name, int value); - /// Insert bunch of entries - template< class InputIt> - iterator insert(InputIt first, InputIt last) - { return this->Base::insert(this->Base::end(), first, last); } - /// Insert bunch of entries - template< class InputIt> - iterator insert(std::vector<VolID>::const_iterator pos, InputIt first, InputIt last) - { return this->Base::insert(pos, first, last); } - /// String representation for debugging - std::string str() const; - }; - /// Magic word to detect memory corruptions - unsigned long magic; - /// Reference count on object (used to implement Grab/Release) - long refCount; - /// ID container - VolIDs volIDs; + typedef std::vector<VolID> Base; /// Default constructor - PlacedVolumeExtension(); + VolIDs() = default; /// Copy constructor - PlacedVolumeExtension(const PlacedVolumeExtension& c); - /// Default destructor - virtual ~PlacedVolumeExtension(); - /// Assignment operator - PlacedVolumeExtension& operator=(const PlacedVolumeExtension& c) { - magic = c.magic; - volIDs = c.volIDs; - return *this; - } - /// TGeoExtension overload: Method called whenever requiring a pointer to the extension - virtual TGeoExtension *Grab() override; - /// TGeoExtension overload: Method called always when the pointer to the extension is not needed anymore - virtual void Release() const override; - /// Enable ROOT persistency - ClassDefOverride(PlacedVolumeExtension,1); + VolIDs(const VolIDs& c) = default; + /// Destructor + ~VolIDs() {} + /// Assignment operator + VolIDs& operator=(const VolIDs& c) = default; + /// Find entry + std::vector<VolID>::const_iterator find(const std::string& name) const; + /// Insert new entry + std::pair<std::vector<VolID>::iterator, bool> insert(const std::string& name, int value); + /// Insert bunch of entries + template< class InputIt> + iterator insert(InputIt first, InputIt last) + { return this->Base::insert(this->Base::end(), first, last); } + /// Insert bunch of entries + template< class InputIt> + iterator insert(std::vector<VolID>::const_iterator pos, InputIt first, InputIt last) + { return this->Base::insert(pos, first, last); } + /// String representation for debugging + std::string str() const; }; - - /// Handle class holding a placed volume (also called physical volume) - /** - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoNode.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class PlacedVolume : public Handle<TGeoNode> { - public: - typedef PlacedVolumeExtension Object; - typedef Object::VolIDs VolIDs; - typedef Object::VolID VolID; - - /// Constructor to be used when reading the already parsed DOM tree - PlacedVolume(const TGeoNode* e) - : Handle<TGeoNode>(e) { - } - /// Default constructor - PlacedVolume() - : Handle<TGeoNode>() { - } - /// Copy assignment - PlacedVolume(const PlacedVolume& e) - : Handle<TGeoNode>(e) { - } - /// Copy assignment from other handle type - template <typename T> PlacedVolume(const Handle<T>& e) - : Handle<TGeoNode>(e) { - } - /// Assignment operator (must match copy constructor) - PlacedVolume& operator=(const PlacedVolume& v) { - m_element = v.m_element; - return *this; - } - /// Check if placement is properly instrumented - Object* data() const; - /// Add identifier - PlacedVolume& addPhysVolID(const std::string& name, int value); - /// Volume material - Material material() const; - /// Logical volume of this placement - Volume volume() const; - /// Parent volume (envelope) - Volume motherVol() const; - /// Access to the volume IDs - const VolIDs& volIDs() const; - /// String dump - std::string toString() const; - }; - - /// Implementation class extending the ROOT volume (TGeoVolume) - /** - * Internal data structure optional to TGeo data. - * - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoExtension.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class VolumeExtension : public TGeoExtension { - public: - /// Magic word to detect memory corruptions - unsigned long magic; - /// Reference count on object (used to implement Grab/Release) - long refCount; - /// Region reference - Region region; - /// Limit sets used for simulation - LimitSet limits; - /// Reference to visualization attributes - VisAttr vis; - /// Reference to the sensitive detector - Ref_t sens_det; - - int referenced; - /// Default constructor - VolumeExtension(); - /// Default destructor - virtual ~VolumeExtension(); - /// Copy the object - void copy(const VolumeExtension& c) { - magic = c.magic; - region = c.region; - limits = c.limits; - vis = c.vis; - sens_det = c.sens_det; - referenced = c.referenced; - } - /// TGeoExtension overload: Method called whenever requiring a pointer to the extension - virtual TGeoExtension *Grab() override; - /// TGeoExtension overload: Method called always when the pointer to the extension is not needed anymore - virtual void Release() const override; - /// Enable ROOT persistency - ClassDefOverride(VolumeExtension,1); - }; - - /// Handle class holding a placed volume (also called physical volume) - /** - * Handle describing a Volume - * - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoVolume.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Volume: public Handle<TGeoVolume> { - - public: - typedef Handle<TGeoVolume> Base; - typedef VolumeExtension Object; - - public: - /// Default constructor - Volume() - : Base(0) { - } - - /// Copy from handle - Volume(const TGeoVolume* v) - : Base(v) { - } - - /// Copy from handle - Volume(const Volume& v) - : Base(v) { - } - - /// Copy from arbitrary Element - template <typename T> Volume(const Handle<T>& v) - : Base(v) { - } - - /// Constructor to be used when creating a new geometry tree. - Volume(const std::string& name); - - /// Constructor to be used when creating a new geometry tree. Also sets materuial and solid attributes - Volume(const std::string& name, const Solid& s, const Material& m); - - /// Assignment operator (must match copy constructor) - Volume& operator=(const Volume& a) { - m_element = a.m_element; - return *this; - } - - /// Check if placement is properly instrumented - Object* data() const; - /// Place daughter volume. The position and rotation are the identity - PlacedVolume placeVolume(const Volume& vol) const; - /// Place daughter volume according to a generic Transform3D - PlacedVolume placeVolume(const Volume& volume, const Transform3D& tr) const; - /// Place un-rotated daughter volume at the given position. - PlacedVolume placeVolume(const Volume& vol, const Position& pos) const; - /// Place rotated daughter volume. The position is automatically the identity position - PlacedVolume placeVolume(const Volume& vol, const RotationZYX& rot) const; - /// Place rotated daughter volume. The position is automatically the identity position - PlacedVolume placeVolume(const Volume& vol, const Rotation3D& rot) const; - - /// Attach attributes to the volume - const Volume& setAttributes(const LCDD& lcdd, const std::string& region, const std::string& limits, - const std::string& vis) const; - - /// Set the regional attributes to the volume. Note: If the name string is empty, the action is ignored. - const Volume& setRegion(const LCDD& lcdd, const std::string& name) const; - /// Set the regional attributes to the volume - const Volume& setRegion(const Region& obj) const; - /// Access to the handle to the region structure - Region region() const; - - /// Set the limits to the volume. Note: If the name string is empty, the action is ignored. - const Volume& setLimitSet(const LCDD& lcdd, const std::string& name) const; - /// Set the limits to the volume - const Volume& setLimitSet(const LimitSet& obj) const; - /// Access to the limit set - LimitSet limitSet() const; - - /// Set Visualization attributes to the volume - const Volume& setVisAttributes(const VisAttr& obj) const; - /// Set Visualization attributes to the volume. Note: If the name string is empty, the action is ignored. - const Volume& setVisAttributes(const LCDD& lcdd, const std::string& name) const; - /// Access the visualisation attributes - VisAttr visAttributes() const; - - /// Assign the sensitive detector structure - const Volume& setSensitiveDetector(const SensitiveDetector& obj) const; - /// Access to the handle to the sensitive detector - Ref_t sensitiveDetector() const; - /// Accessor if volume is sensitive (ie. is attached to a sensitive detector) - bool isSensitive() const; - - /// Set the volume's solid shape - const Volume& setSolid(const Solid& s) const; - /// Access to Solid (Shape) - Solid solid() const; - - /// Set the volume's material - const Volume& setMaterial(const Material& m) const; - /// Access to the Volume material - Material material() const; - - /// Auto conversion to underlying ROOT object - operator TGeoVolume*() const { - return m_element; - } - }; - - /// Implementation class extending the ROOT assembly volumes (TGeoVolumeAsembly) - /** - * Handle describing a volume assembly. - * - * For any further documentation please see the following ROOT documentation: - * \see http://root.cern.ch/root/html/TGeoVolumeAssembly.html - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class Assembly: public Volume { - public: - /// Default constructor - Assembly() - : Volume() { - } - - /// Copy from handle - Assembly(const Assembly& v) - : Volume(v) { - } - - /// Copy from arbitrary Element - template <typename T> Assembly(const Handle<T>& v) - : Volume(v) { - } - - /// Constructor to be used when creating a new geometry tree. - Assembly(const std::string& name); - - /// Assignment operator (must match copy constructor) - Assembly& operator=(const Assembly& a) { - m_element = a.m_element; - return *this; - } - }; - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4HEP_GEOMETRY_VOLUMES_H */ + /// Magic word to detect memory corruptions + unsigned long magic; + /// Reference count on object (used to implement Grab/Release) + long refCount; + /// ID container + VolIDs volIDs; + /// Default constructor + PlacedVolumeExtension(); + /// Copy constructor + PlacedVolumeExtension(const PlacedVolumeExtension& c); + /// Default destructor + virtual ~PlacedVolumeExtension(); + /// Assignment operator + PlacedVolumeExtension& operator=(const PlacedVolumeExtension& c) { + magic = c.magic; + volIDs = c.volIDs; + return *this; + } + /// TGeoExtension overload: Method called whenever requiring a pointer to the extension + virtual TGeoExtension *Grab() override; + /// TGeoExtension overload: Method called always when the pointer to the extension is not needed anymore + virtual void Release() const override; + /// Enable ROOT persistency + ClassDefOverride(PlacedVolumeExtension,1); + }; + + /// Handle class holding a placed volume (also called physical volume) + /** + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoNode.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class PlacedVolume : public Handle<TGeoNode> { + public: + typedef PlacedVolumeExtension Object; + typedef PlacedVolumeExtension::VolIDs VolIDs; + + /// Default constructor + PlacedVolume() = default; + /// Copy assignment + PlacedVolume(const PlacedVolume& e) = default; + /// Copy assignment from other handle type + template <typename T> PlacedVolume(const Handle<T>& e) : Handle<TGeoNode>(e) { } + /// Constructor to be used when reading the already parsed DOM tree + PlacedVolume(const TGeoNode* e) : Handle<TGeoNode>(e) { } + /// Assignment operator (must match copy constructor) + PlacedVolume& operator=(const PlacedVolume& v) = default; + /// Check if placement is properly instrumented + Object* data() const; + /// Add identifier + PlacedVolume& addPhysVolID(const std::string& name, int value); + /// Volume material + Material material() const; + /// Logical volume of this placement + Volume volume() const; + /// Parent volume (envelope) + Volume motherVol() const; + /// Access to the volume IDs + const PlacedVolumeExtension::VolIDs& volIDs() const; + /// String dump + std::string toString() const; + }; + + /// Implementation class extending the ROOT volume (TGeoVolume) + /** + * detaill data structure optional to TGeo data. + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoExtension.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class VolumeExtension : public TGeoExtension { + public: + /// Magic word to detect memory corruptions + unsigned long magic; + /// Reference count on object (used to implement Grab/Release) + long refCount; + /// Region reference + Region region; + /// Limit sets used for simulation + LimitSet limits; + /// Reference to visualization attributes + VisAttr vis; + /// Reference to the sensitive detector + Handle<NamedObject> sens_det; + + int referenced; + /// Default constructor + VolumeExtension(); + /// Default destructor + virtual ~VolumeExtension(); + /// Copy the object + void copy(const VolumeExtension& c) { + magic = c.magic; + region = c.region; + limits = c.limits; + vis = c.vis; + sens_det = c.sens_det; + referenced = c.referenced; + } + /// TGeoExtension overload: Method called whenever requiring a pointer to the extension + virtual TGeoExtension *Grab() override; + /// TGeoExtension overload: Method called always when the pointer to the extension is not needed anymore + virtual void Release() const override; + /// Enable ROOT persistency + ClassDefOverride(VolumeExtension,1); + }; + + /// Handle class holding a placed volume (also called physical volume) + /** + * Handle describing a Volume + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoVolume.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Volume: public Handle<TGeoVolume> { + public: + typedef VolumeExtension Object; + + public: + /// Default constructor + Volume() = default; + /// Copy from handle + Volume(const Volume& v) = default; + /// Copy from handle + Volume(const TGeoVolume* v) : Handle<TGeoVolume>(v) { } + /// Copy from arbitrary Element + template <typename T> Volume(const Handle<T>& v) : Handle<TGeoVolume>(v) { } + + /// Constructor to be used when creating a new geometry tree. + Volume(const std::string& name); + + /// Constructor to be used when creating a new geometry tree. Also sets materuial and solid attributes + Volume(const std::string& name, const Solid& s, const Material& m); + + /// Assignment operator (must match copy constructor) + Volume& operator=(const Volume& a) = default; + + /// Check if placement is properly instrumented + Object* data() const; + /// Place daughter volume. The position and rotation are the identity + PlacedVolume placeVolume(const Volume& vol) const; + /// Place daughter volume according to a generic Transform3D + PlacedVolume placeVolume(const Volume& volume, const Transform3D& tr) const; + /// Place un-rotated daughter volume at the given position. + PlacedVolume placeVolume(const Volume& vol, const Position& pos) const; + /// Place rotated daughter volume. The position is automatically the identity position + PlacedVolume placeVolume(const Volume& vol, const RotationZYX& rot) const; + /// Place rotated daughter volume. The position is automatically the identity position + PlacedVolume placeVolume(const Volume& vol, const Rotation3D& rot) const; + + /// Attach attributes to the volume + const Volume& setAttributes(const Detector& description, const std::string& region, const std::string& limits, + const std::string& vis) const; + + /// Set the regional attributes to the volume. Note: If the name string is empty, the action is ignored. + const Volume& setRegion(const Detector& description, const std::string& name) const; + /// Set the regional attributes to the volume + const Volume& setRegion(const Region& obj) const; + /// Access to the handle to the region structure + Region region() const; + + /// Set the limits to the volume. Note: If the name string is empty, the action is ignored. + const Volume& setLimitSet(const Detector& description, const std::string& name) const; + /// Set the limits to the volume + const Volume& setLimitSet(const LimitSet& obj) const; + /// Access to the limit set + LimitSet limitSet() const; + + /// Set Visualization attributes to the volume + const Volume& setVisAttributes(const VisAttr& obj) const; + /// Set Visualization attributes to the volume. Note: If the name string is empty, the action is ignored. + const Volume& setVisAttributes(const Detector& description, const std::string& name) const; + /// Access the visualisation attributes + VisAttr visAttributes() const; + + /// Assign the sensitive detector structure + const Volume& setSensitiveDetector(const SensitiveDetector& obj) const; + /// Access to the handle to the sensitive detector + Handle<NamedObject> sensitiveDetector() const; + /// Accessor if volume is sensitive (ie. is attached to a sensitive detector) + bool isSensitive() const; + + /// Set the volume's solid shape + const Volume& setSolid(const Solid& s) const; + /// Access to Solid (Shape) + Solid solid() const; + + /// Set the volume's material + const Volume& setMaterial(const Material& m) const; + /// Access to the Volume material + Material material() const; + + /// Auto conversion to underlying ROOT object + operator TGeoVolume*() const { + return m_element; + } + }; + + /// Implementation class extending the ROOT assembly volumes (TGeoVolumeAsembly) + /** + * Handle describing a volume assembly. + * + * For any further documentation please see the following ROOT documentation: + * \see http://root.cern.ch/root/html/TGeoVolumeAssembly.html + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class Assembly: public Volume { + public: + /// Default constructor + Assembly() = default; + /// Copy from handle + Assembly(const Assembly& v) = default; + /// Copy from arbitrary Element + template <typename T> Assembly(const Handle<T>& v) : Volume(v) { } + /// Constructor to be used when creating a new geometry tree. + Assembly(const std::string& name); + /// Assignment operator (must match copy constructor) + Assembly& operator=(const Assembly& a) = default; + }; +} /* End namespace dd4hep */ +#endif /* DD4HEP_DDCORE_VOLUMES_H */ diff --git a/DDCore/include/DD4hep/WaferGridXY.h b/DDCore/include/DD4hep/WaferGridXY.h index cc84cf09c..2da63cbfb 100644 --- a/DDCore/include/DD4hep/WaferGridXY.h +++ b/DDCore/include/DD4hep/WaferGridXY.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,91 +19,82 @@ #include "DD4hep/Segmentations.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations namespace DDSegmentation { class WaferGridXY; } - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class Segmentation; - template <typename T> class SegmentationWrapper; - /// We need some abbreviation to make the code more readable. - typedef Handle<SegmentationWrapper<DDSegmentation::WaferGridXY> > WaferGridXYHandle; - - /// Implementation class for the grid XZ segmentation. - /** - * Concrete user handle to serve specific needs of client code - * which requires access to the base functionality not served - * by the super-class Segmentation. - * - * Note: - * We only check the validity of the underlying handle. - * If for whatever reason the implementation object is not valid - * This is not checked. - * In principle this CANNOT happen unless some brain-dead has - * fiddled with the handled object directly..... - * - * Note: - * The handle base corrsponding to this object in for - * conveniance reasons instantiated in DD4hep/src/Segmentations.cpp. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class WaferGridXY : public WaferGridXYHandle { - public: - /// Default constructor - WaferGridXY() = default; - /// Copy constructor - WaferGridXY(const WaferGridXY& e) = default; - /// Copy Constructor from segmentation base object - WaferGridXY(const Segmentation& e) : Handle<Object>(e) {} - /// Copy constructor from handle - WaferGridXY(const Handle<Object>& e) : Handle<Object>(e) {} - /// Copy constructor from other polymorph/equivalent handle - template <typename Q> WaferGridXY(const Handle<Q>& e) : Handle<Object>(e) {} - /// Assignment operator - WaferGridXY& operator=(const WaferGridXY& seg) = default; - /// Equality operator - bool operator==(const WaferGridXY& seg) const - { return m_element == seg.m_element; } - /// determine the position based on the cell ID - Position position(const CellID& cellID) const; - /// determine the cell ID based on the position - CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; - /// access the grid size in X - double gridSizeX() const; - /// access the grid size in Y - double gridSizeY() const; - /// access the coordinate offset in X - double offsetX() const; - /// access the coordinate offset in Y - double offsetY() const; - /// access the coordinate waferOffset for inGroup in X - double waferOffsetX(int inGroup, int inWafer) const; - /// access the coordinate waferOffset for inGroup in Y - double waferOffsetY(int inGroup, int inWafer) const; - /// access the field name used for X - const std::string& fieldNameX() const; - /// access the field name used for Y - const std::string& fieldNameY() const; - /** \brief Returns a vector<double> of the cellDimensions of the given cell ID - in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi + /// We need some abbreviation to make the code more readable. + typedef Handle<SegmentationWrapper<DDSegmentation::WaferGridXY> > WaferGridXYHandle; - Returns a vector of the cellDimensions of the given cell ID - \param cellID is ignored as all cells have the same dimension - \return std::vector<double> size 2: - -# size in x - -# size in z - */ - std::vector<double> cellDimensions(const CellID& cellID) const; - }; + /// Implementation class for the grid XZ segmentation. + /** + * Concrete user handle to serve specific needs of client code + * which requires access to the base functionality not served + * by the super-class Segmentation. + * + * Note: + * We only check the validity of the underlying handle. + * If for whatever reason the implementation object is not valid + * This is not checked. + * In principle this CANNOT happen unless some brain-dead has + * fiddled with the handled object directly..... + * + * Note: + * The handle base corrsponding to this object in for + * conveniance reasons instantiated in dd4hep/src/Segmentations.cpp. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class WaferGridXY : public WaferGridXYHandle { + public: + /// Default constructor + WaferGridXY() = default; + /// Copy constructor + WaferGridXY(const WaferGridXY& e) = default; + /// Copy Constructor from segmentation base object + WaferGridXY(const Segmentation& e) : Handle<Object>(e) {} + /// Copy constructor from handle + WaferGridXY(const Handle<Object>& e) : Handle<Object>(e) {} + /// Copy constructor from other polymorph/equivalent handle + template <typename Q> WaferGridXY(const Handle<Q>& e) : Handle<Object>(e) {} + /// Assignment operator + WaferGridXY& operator=(const WaferGridXY& seg) = default; + /// Equality operator + bool operator==(const WaferGridXY& seg) const + { return m_element == seg.m_element; } + /// determine the position based on the cell ID + Position position(const CellID& cellID) const; + /// determine the cell ID based on the position + CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const; + /// access the grid size in X + double gridSizeX() const; + /// access the grid size in Y + double gridSizeY() const; + /// access the coordinate offset in X + double offsetX() const; + /// access the coordinate offset in Y + double offsetY() const; + /// access the coordinate waferOffset for inGroup in X + double waferOffsetX(int inGroup, int inWafer) const; + /// access the coordinate waferOffset for inGroup in Y + double waferOffsetY(int inGroup, int inWafer) const; + /// access the field name used for X + const std::string& fieldNameX() const; + /// access the field name used for Y + const std::string& fieldNameY() const; + /** \brief Returns a vector<double> of the cellDimensions of the given cell ID + in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif // DD4HEP_DDCORE_WAFERGRIDZY_H + Returns a vector of the cellDimensions of the given cell ID + \param cellID is ignored as all cells have the same dimension + \return std::vector<double> size 2: + -# size in x + -# size in z + */ + std::vector<double> cellDimensions(const CellID& cellID) const; + }; +} /* End namespace dd4hep */ +#endif // DD4HEP_DDCORE_WAFERGRIDZY_H diff --git a/DDCore/include/DD4hep/World.h b/DDCore/include/DD4hep/World.h index 01c0584e9..1b93c5154 100644 --- a/DDCore/include/DD4hep/World.h +++ b/DDCore/include/DD4hep/World.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,58 +14,38 @@ #define DD4HEP_WORLD_H // Framework include files -#include "DD4hep/Conditions.h" -#include "DD4hep/Alignments.h" +#include "DD4hep/DetElement.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - // Forward declarations - class WorldObject; - - /// Handle class to hold the information of the top DetElement object 'world' - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class World : public Handle<WorldObject> { - public: - /// Internal object type - typedef WorldObject Object; - /// Definition of the base handle type - typedef Handle<Object> RefObject; - - public: - /// Default constructor - World() : RefObject() { } - - /// Copy from named handle - World(const RefObject& o) : RefObject(o) {} - - /// Copy from handle - World(const World& w) : RefObject(w) {} - - /// Copy from pointer - World(Object* p) : RefObject(p) {} - - /// Templated constructor for handle conversions - template <typename Q> World(const Handle<Q>& e) : RefObject(e) {} - - /// Assignment operator - World& operator=(const World& sd) { - m_element = sd.m_element; - return *this; - } +namespace dd4hep { + + // Forward declarations + class WorldObject; + + /// Handle class to hold the information of the top DetElement object 'world' + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class World : public Handle<WorldObject> { + public: + /// Default constructor + World() = default; + /// Copy from handle + World(const World& w) = default; + /// Copy from named handle + World(const Handle<WorldObject>& o) : Handle<WorldObject>(o) {} + /// Copy from pointer + World(Object* p) : Handle<WorldObject>(p) {} + /// Templated constructor for handle conversions + template <typename Q> World(const Handle<Q>& e) : Handle<WorldObject>(e) {} + + /// Assignment operator + World& operator=(const World& sd) = default; #ifndef __CINT__ - LCDD& lcdd() const; + Detector& detectorDescription() const; #endif - }; - - } /* End namespace Conditions */ -} /* End namespace DD4hep */ - + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_WORLD_H */ diff --git a/DDCore/include/DD4hep/config.h b/DDCore/include/DD4hep/config.h index 8355de9fd..c3594389b 100644 --- a/DDCore/include/DD4hep/config.h +++ b/DDCore/include/DD4hep/config.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,11 +23,11 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } /* End namespace detail */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONFIG_H */ diff --git a/DDCore/include/DD4hep/detail/AlignmentsInterna.h b/DDCore/include/DD4hep/detail/AlignmentsInterna.h index 36f4b36e4..b230c6819 100644 --- a/DDCore/include/DD4hep/detail/AlignmentsInterna.h +++ b/DDCore/include/DD4hep/detail/AlignmentsInterna.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -30,56 +30,50 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the alignments part of the AIDA detector description toolkit - namespace Alignments { + // Forward declarations + class Alignment; - // Forward declarations - class Alignment; + /// Alignments internal namespace declaration + /** detaillly defined datastructures are not presented to the + * user directly, but are used by dedicated views. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_ALIGNMENTS + */ + namespace detail { - /// Alignments internal namespace declaration - /** Internally defined datastructures are not presented to the - * user directly, but are used by dedicated views. + /// The data class behind an alignments handle. + /** + * See AlignmentsInterna.cpp for the implementation. * * \author M.Frank * \version 1.0 * \ingroup DD4HEP_ALIGNMENTS */ - namespace Interna { + class AlignmentObject : public detail::ConditionObject { + public: + /// Cached pointer to the bound conditions data, since these may be accessed very frequently + AlignmentData* alignment_data = 0; - /// The data class behind an alignments handle. - /** - * See AlignmentsInterna.cpp for the implementation. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_ALIGNMENTS - */ - class AlignmentObject : public Conditions::Interna::ConditionObject { - public: - /// Cached pointer to the bound conditions data, since these may be accessed very frequently - AlignmentData* alignment_data = 0; - /// Reference to the source conditions object - //key_type source_key = 0; - - public: - /// Default constructor. Alignment data wuill be bound to the heap. - AlignmentObject(); - /// Copy constructor - AlignmentObject(const AlignmentObject& copy) = delete; - /// Standard constructor with user provided payload pointer to bind alignment data - AlignmentObject(const std::string& nam,const std::string& tit,void* payload,size_t len); - /// Standard Destructor - virtual ~AlignmentObject(); - /// Assignment operator - AlignmentObject& operator=(const AlignmentObject& copy) = delete; - /// Clear data - void clear(); - /// Accessor to the alignment data. Cannot be NULL. Initialized in the constructor(s) - AlignmentData& values() { return *alignment_data; } - }; - } /* End namespace Interna */ - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + public: + /// Default constructor. Alignment data wuill be bound to the heap. + AlignmentObject(); + /// Copy constructor + AlignmentObject(const AlignmentObject& copy) = delete; + /// Standard constructor with user provided payload pointer to bind alignment data + AlignmentObject(const std::string& nam,const std::string& tit,void* payload,size_t len); + /// Standard Destructor + virtual ~AlignmentObject(); + /// Assignment operator + AlignmentObject& operator=(const AlignmentObject& copy) = delete; + /// Clear data + void clear(); + /// Accessor to the alignment data. Cannot be NULL. Initialized in the constructor(s) + AlignmentData& values() { return *alignment_data; } + }; + } /* End namespace detail */ +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGNMENTS_ALIGNMENTSINTERNA_H */ diff --git a/DDCore/include/DD4hep/detail/BasicGrammar_inl.h b/DDCore/include/DD4hep/detail/BasicGrammar_inl.h index 89e8bb6a1..c72528036 100644 --- a/DDCore/include/DD4hep/detail/BasicGrammar_inl.h +++ b/DDCore/include/DD4hep/detail/BasicGrammar_inl.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -30,7 +30,7 @@ #define DD4HEP_NEED_EVALUATOR // This is the case, if the parsers are externalized -// and the DD4hep namespace is renamed! +// and the dd4hep namespace is renamed! #include DD4HEP_PARSER_HEADER #else @@ -38,10 +38,10 @@ #include "XML/Evaluator.h" #include "DD4hep/Parsers.h" #include "DD4hep/ToStream.h" -namespace DD4hep { XmlTools::Evaluator& g4Evaluator(); } +namespace dd4hep { XmlTools::Evaluator& g4Evaluator(); } #endif #endif -namespace { static XmlTools::Evaluator& s__eval(DD4hep::g4Evaluator()); } +namespace { static XmlTools::Evaluator& s__eval(dd4hep::g4Evaluator()); } // C/C++ include files #include <string> @@ -52,7 +52,7 @@ namespace { static XmlTools::Evaluator& s__eval(DD4hep::g4Evaluator()); } #include <deque> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Concrete type dependent grammar definition /** @@ -116,7 +116,7 @@ namespace DD4hep { int sc = 0; TYPE temp; #ifdef DD4HEP_USE_BOOST - sc = ::DD4hep::Parsers::parse(temp,string_val); + sc = ::dd4hep::Parsers::parse(temp,string_val); #endif if ( !sc ) sc = evaluate(&temp,string_val); #if 0 @@ -184,9 +184,9 @@ namespace DD4hep { /// Insertion function for std vectors template <typename TYPE> static int fill_data(std::vector<TYPE>* p,const std::vector<std::string>& temp) { TYPE val; - const BasicGrammar& g = BasicGrammar::instance<TYPE>(); + const BasicGrammar& grammar = BasicGrammar::instance<TYPE>(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !g.fromString(&val,*i) ) + if ( !grammar.fromString(&val,*i) ) return 0; p->push_back(val); } @@ -196,9 +196,9 @@ namespace DD4hep { /// Insertion function for std lists template <typename TYPE> static int fill_data(std::list<TYPE>* p,const std::vector<std::string>& temp) { TYPE val; - const BasicGrammar& g = BasicGrammar::instance<TYPE>(); + const BasicGrammar& grammar = BasicGrammar::instance<TYPE>(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !g.fromString(&val,*i) ) + if ( !grammar.fromString(&val,*i) ) return 0; p->push_back(val); } @@ -208,9 +208,9 @@ namespace DD4hep { /// Insertion function for std sets template <typename TYPE> static int fill_data(std::set<TYPE>* p,const std::vector<std::string>& temp) { TYPE val; - const BasicGrammar& g = BasicGrammar::instance<TYPE>(); + const BasicGrammar& grammar = BasicGrammar::instance<TYPE>(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !g.fromString(&val,*i) ) + if ( !grammar.fromString(&val,*i) ) return 0; p->insert(val); } @@ -220,9 +220,9 @@ namespace DD4hep { /// Insertion function for std sets template <typename TYPE> static int fill_data(std::deque<TYPE>* p,const std::vector<std::string>& temp) { TYPE val; - const BasicGrammar& g = BasicGrammar::instance<TYPE>(); + const BasicGrammar& grammar = BasicGrammar::instance<TYPE>(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !g.fromString(&val,*i) ) + if ( !grammar.fromString(&val,*i) ) return 0; p->push_back(val); } @@ -232,9 +232,9 @@ namespace DD4hep { /// Insertion function for std sets template <typename KEY, typename TYPE> static int fill_data(std::map<KEY,TYPE>* p,const std::vector<std::string>& temp) { std::pair<KEY,TYPE> val; - const BasicGrammar& g = BasicGrammar::instance<std::pair<KEY,TYPE> >(); + const BasicGrammar& grammar = BasicGrammar::instance<std::pair<KEY,TYPE> >(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !g.fromString(&val,*i) ) + if ( !grammar.fromString(&val,*i) ) return 0; p->insert(val); } @@ -252,7 +252,7 @@ namespace DD4hep { else { TYPE temp; std::string temp_str = pre_parse_obj(str); - sc = ::DD4hep::Parsers::parse(temp,temp_str); + sc = ::dd4hep::Parsers::parse(temp,temp_str); if ( sc ) { *p = temp; return 1; @@ -270,18 +270,18 @@ namespace DD4hep { } /// Item evaluator - template <typename T> inline int eval_item(T* p, std::string s) { - size_t idx = s.find("(int)"); + template <typename T> inline int eval_item(T* ptr, std::string val) { + size_t idx = val.find("(int)"); if (idx != std::string::npos) - s.erase(idx, 5); - while (s[0] == ' ') - s.erase(0, 1); + val.erase(idx, 5); + while (val[0] == ' ') + val.erase(0, 1); #ifdef DD4HEP_USE_BOOST - double result = s__eval.evaluate(s.c_str()); + double result = s__eval.evaluate(val.c_str()); if (s__eval.status() != XmlTools::Evaluator::OK) { return 0; } - *p = (T)result; + *ptr = (T)result; return 1; #else return 0; @@ -289,21 +289,21 @@ namespace DD4hep { } /// String evaluator - template <> inline int eval_item<std::string>(std::string* p, std::string s) { - *p = s; + template <> inline int eval_item<std::string>(std::string* ptr, std::string val) { + *ptr = val; return 1; } /// Item evaluator - template <typename T,typename Q> inline int eval_pair(std::pair<T,Q>* p, std::string s) { - const BasicGrammar& g = BasicGrammar::instance<std::pair<T,Q> >(); - if ( !g.fromString(p,s) ) return 0; + template <typename T,typename Q> inline int eval_pair(std::pair<T,Q>* ptr, std::string str) { + const BasicGrammar& grammar = BasicGrammar::instance<std::pair<T,Q> >(); + if ( !grammar.fromString(ptr,str) ) return 0; return 1; } /// Object evaluator - template<typename T> inline int eval_obj(T* p, const std::string& str) { - return BasicGrammar::instance<T>().fromString(p,pre_parse_obj(str)); + template<typename T> inline int eval_obj(T* ptr, const std::string& str) { + return BasicGrammar::instance<T>().fromString(ptr,pre_parse_obj(str)); } /// User object evaluator @@ -317,15 +317,15 @@ namespace DD4hep { // Containers of objects are not handled! -} // End namespace DD4hep +} // End namespace dd4hep #define DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(x) \ - namespace DD4hep { \ - template<> const BasicGrammar& BasicGrammar::instance<x>() { static Grammar<x> s; return s;}} + namespace dd4hep { \ + template<> const BasicGrammar& BasicGrammar::instance<x>() { static Grammar<x> gr; return gr;}} #define DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(x,func) \ - namespace DD4hep { \ - template<> int Grammar<x >::evaluate(void* p, const std::string& v) const { return func ((x*)p,v); }} + namespace dd4hep { \ + template<> int Grammar<x >::evaluate(void* ptr, const std::string& val) const { return func ((x*)ptr,val); }} #define DD4HEP_DEFINE_PARSER_GRAMMAR(x,func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(x) \ @@ -335,7 +335,7 @@ namespace DD4hep { PARSERS_DECL_FOR_SINGLE(x) \ DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(x) \ DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(x,func) \ - namespace DD4hep { namespace Parsers { \ + namespace dd4hep { namespace Parsers { \ int parse(x&, const std::string&) { return 1; } \ }} @@ -346,12 +346,12 @@ namespace DD4hep { DD4HEP_DEFINE_PARSER_GRAMMAR(std::list<x>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR(std::set<x>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR(std::deque<x>, eval_container) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::int_map_t, eval_container) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::ulong_map_t, eval_container) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::string_map_t, eval_container) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::int_pair_t, eval_pair) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::ulong_pair_t, eval_pair) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::string_pair_t, eval_pair) + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::int_map_t, eval_container) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::ulong_map_t, eval_container) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::string_map_t, eval_container) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::int_pair_t, eval_pair) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::ulong_pair_t, eval_pair) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::string_pair_t, eval_pair) #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL(x,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR(x,eval_func) \ @@ -369,10 +369,10 @@ namespace DD4hep { DD4HEP_DEFINE_PARSER_GRAMMAR(std::vector<x>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR(std::list<x>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR(std::set<x>, eval_container) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::int_map_t, eval_container) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::string_map_t, eval_container) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::int_pair_t, eval_pair) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(DD4hep::Primitive<x>::string_pair_t, eval_pair) + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::int_map_t, eval_container) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::string_map_t, eval_container) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::int_pair_t, eval_pair) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(dd4hep::detail::Primitive<x>::string_pair_t, eval_pair) #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL(x,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR(x,eval_func) \ diff --git a/DDCore/include/DD4hep/detail/ComponentProperties_inl.h b/DDCore/include/DD4hep/detail/ComponentProperties_inl.h index bef8c8604..7ae5bfb21 100644 --- a/DDCore/include/DD4hep/detail/ComponentProperties_inl.h +++ b/DDCore/include/DD4hep/detail/ComponentProperties_inl.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,23 +25,23 @@ #include <set> #include <stdexcept> -/// DD4hep namespace declaration -namespace DD4hep { +/// dd4hep namespace declaration +namespace dd4hep { /// Setup property template <typename TYPE> void Property::make(TYPE& val) { - static PropertyGrammar g(BasicGrammar::instance<TYPE>()); - m_hdl = &g; + static PropertyGrammar grammar(BasicGrammar::instance<TYPE>()); + m_hdl = &grammar; m_par = &val; } /// Set value of this property template <typename TYPE> void Property::set(const TYPE& val) { - const PropertyGrammar& g = grammar(); - if (g.type() == typeid(TYPE)) + const PropertyGrammar& grm = grammar(); + if (grm.type() == typeid(TYPE)) *(TYPE*) m_par = val; - else if (!g.fromString(m_par, BasicGrammar::instance< TYPE >().str(&val))) - PropertyGrammar::invalidConversion(typeid(TYPE), g.type()); + else if (!grm.fromString(m_par, BasicGrammar::instance< TYPE >().str(&val))) + PropertyGrammar::invalidConversion(typeid(TYPE), grm.type()); } /// Assignment operator / set new balue @@ -52,11 +52,11 @@ namespace DD4hep { /// Retrieve value from stack (large values e.g. vectors etc.) template <typename TYPE> void Property::value(TYPE& val) const { - const PropertyGrammar& g = grammar(); - if (g.type() == typeid(TYPE)) + const PropertyGrammar& grm = grammar(); + if (grm.type() == typeid(TYPE)) val = *(TYPE*) m_par; else if (!BasicGrammar::instance< TYPE >().fromString(&val, this->str())) - PropertyGrammar::invalidConversion(g.type(), typeid(TYPE)); + PropertyGrammar::invalidConversion(grm.type(), typeid(TYPE)); } /// Retrieve value @@ -66,10 +66,10 @@ namespace DD4hep { return temp; } -} // End namespace DD4hep +} // End namespace dd4hep // Instantiate single property -#define DD4HEP_DEFINE_PROPERTY_TYPE(x) namespace DD4hep { \ +#define DD4HEP_DEFINE_PROPERTY_TYPE(x) namespace dd4hep { \ template x Property::value() const; \ template void Property::value(x& value) const; \ template void Property::set(const x& value); \ diff --git a/DDCore/include/DD4hep/detail/ConditionsInterna.h b/DDCore/include/DD4hep/detail/ConditionsInterna.h index 4134b1989..7b57fdb73 100644 --- a/DDCore/include/DD4hep/detail/ConditionsInterna.h +++ b/DDCore/include/DD4hep/detail/ConditionsInterna.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ #define DD4HEP_CONDITIONS_CONDITIONINTERNA_H // Framework include files -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Conditions.h" #include "DD4hep/BasicGrammar.h" #include "DD4hep/NamedObject.h" @@ -32,145 +32,130 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class IOVType; - /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { - - /// Conditions internal namespace declaration - /** Internally defined datastructures are not presented to the - * user directly, but are used by dedicated views. + /// DD4hep internal namespace declaration for utilities and implementation details + /** detaillly defined datastructures are not presented to the + * user directly, but are used by dedicated views. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_CONDITIONS + */ + namespace detail { + + /// The data class behind a conditions handle. + /** + * See ConditionsInterna.cpp for the implementation. * * \author M.Frank * \version 1.0 * \ingroup DD4HEP_CONDITIONS */ - namespace Interna { - - /// The data class behind a conditions handle. - /** - * See ConditionsInterna.cpp for the implementation. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class ConditionObject : public NamedObject { - public: - /// Forward definition of the key type - typedef Condition::key_type key_type; - /// Forward definition of the iov type - typedef Condition::iov_type iov_type; - /// Forward definition of the object properties - typedef Condition::mask_type mask_type; - /// Forward definition of the object mask manipulator - typedef ReferenceBitMask<mask_type> MaskManip; - - /// Condition value (in string form) - std::string value; - /// Condition validity (in string form) - std::string validity; - /// Condition address - std::string address; - /// Comment string - std::string comment; - /// Data block - OpaqueDataBlock data; - /// Interval of validity - const iov_type* iov = 0; - /// Hash value of the name - key_type hash = 0; - /// Flags - mask_type flags = 0; - /// Reference count - int refCount = 0; - /// Default constructor - ConditionObject(); - /// Standard constructor - ConditionObject(const std::string& nam,const std::string& tit=""); - /// Standard Destructor - virtual ~ConditionObject(); - /// Data offset from the opaque data block pointer to the condition - static size_t offset(); - /// Move data content: 'from' will be reset to NULL - ConditionObject& move(ConditionObject& from); - /// Access safely the IOV - const iov_type* iovData() const; - /// Access safely the IOV-type - const IOVType* iovType() const; - /// Access the bound data payload. Exception id object is unbound - void* payload() const; - /// Check if object is already bound.... - bool is_bound() const { return data.is_bound(); } - bool is_traced() const { return true; } - /// Flag operations: Set a conditons flag - void setFlag(mask_type option) { flags |= option; } - /// Flag operations: UN-Set a conditons flag - void unFlag(mask_type option) { flags &= ~option; } - /// Flag operations: Test for a given a conditons flag - bool testFlag(mask_type option) const { return option == (flags&option);} - }; - - } /* End namespace Interna */ + class ConditionObject : public NamedObject { + public: + /// Condition value (in string form) + std::string value; + /// Condition validity (in string form) + std::string validity; + /// Condition address + std::string address; + /// Comment string + std::string comment; + /// Data block + OpaqueDataBlock data; + /// Interval of validity + const IOV* iov = 0; + /// Hash value of the name + Condition::key_type hash = 0; + /// Flags + Condition::mask_type flags = 0; + /// Reference count + int refCount = 0; + /// Default constructor + ConditionObject(); + /// Standard constructor + ConditionObject(const std::string& nam,const std::string& tit=""); + /// Standard Destructor + virtual ~ConditionObject(); + /// Data offset from the opaque data block pointer to the condition + static size_t offset(); + /// Move data content: 'from' will be reset to NULL + ConditionObject& move(ConditionObject& from); + /// Access safely the IOV + const IOV* iovData() const; + /// Access safely the IOV-type + const IOVType* iovType() const; + /// Access the bound data payload. Exception id object is unbound + void* payload() const; + /// Check if object is already bound.... + bool is_bound() const { return data.is_bound(); } + bool is_traced() const { return true; } + /// Flag operations: Set a conditons flag + void setFlag(Condition::mask_type option) { flags |= option; } + /// Flag operations: UN-Set a conditons flag + void unFlag(Condition::mask_type option) { flags &= ~option; } + /// Flag operations: Test for a given a conditons flag + bool testFlag(Condition::mask_type option) const { return option == (flags&option);} + }; + + } /* End namespace detail */ /// Bind the data of the conditions object to a given format. - template <typename T> T& Condition::bind() { - Object* o = access(); - return o->data.bind<T>(o->value); - } - /// Bind the data of the conditions object to a given format. - template <typename T> T& Condition::bind(const std::string& val) { - Object* o = access(); - return o->data.bind<T>(val); - } - /// Generic getter. Specify the exact type, not a polymorph type - template <typename T> T& Condition::get() { - return access()->data.get<T>(); - } - /// Generic getter (const version). Specify the exact type, not a polymorph type - template <typename T> const T& Condition::get() const { - return access()->data.get<T>(); - } + template <typename T> T& Condition::bind() { + Object* o = access(); + return o->data.bind<T>(o->value); + } + /// Bind the data of the conditions object to a given format. + template <typename T> T& Condition::bind(const std::string& val) { + Object* o = access(); + return o->data.bind<T>(val); + } + /// Generic getter. Specify the exact type, not a polymorph type + template <typename T> T& Condition::get() { + return access()->data.get<T>(); + } + /// Generic getter (const version). Specify the exact type, not a polymorph type + template <typename T> const T& Condition::get() const { + return access()->data.get<T>(); + } + +} /* End namespace dd4hep */ - } /* End namespace Conditions */ -} /* End namespace DD4hep */ - -#define DD4HEP_DEFINE_CONDITIONS_TYPE(x) \ - DD4HEP_DEFINE_OPAQUEDATA_TYPE(x) \ - namespace DD4hep { \ - namespace Conditions { \ - template x& Condition::bind<x>(const std::string& val); \ - template x& Condition::bind<x>(); \ - template x& Condition::get<x>(); \ - template const x& Condition::get<x>() const; \ - } \ +#define DD4HEP_DEFINE_CONDITIONS_TYPE(x) \ + DD4HEP_DEFINE_OPAQUEDATA_TYPE(x) \ + namespace dd4hep { \ + template x& Condition::bind<x>(const std::string& val); \ + template x& Condition::bind<x>(); \ + template x& Condition::get<x>(); \ + template const x& Condition::get<x>() const; \ } #define DD4HEP_DEFINE_CONDITIONS_TYPE_DUMMY(x) \ - namespace DD4hep{namespace Parsers{int parse(x&, const std::string&){return 1;}}} \ + namespace dd4hep{namespace Parsers{int parse(x&, const std::string&){return 1;}}} \ DD4HEP_DEFINE_CONDITIONS_TYPE(x) #define DD4HEP_DEFINE_EXTERNAL_CONDITIONS_TYPE(x) \ - namespace DD4hep { namespace Conditions { \ + namespace dd4hep { \ template <> x& Condition::bind<x>(const std::string& val); \ template <> x& Condition::bind<x>(); \ template <> x& Condition::get<x>(); \ template <> const x& Condition::get<x>() const; \ - }} + } #if defined(DD4HEP_HAVE_ALL_PARSERS) -#define DD4HEP_DEFINE_CONDITIONS_CONT(x) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(x) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(std::vector<x>) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(std::list<x>) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(std::set<x>) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(std::deque<x>) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(DD4hep::Primitive<x>::int_map_t) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(DD4hep::Primitive<x>::ulong_map_t) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(DD4hep::Primitive<x>::string_map_t) +#define DD4HEP_DEFINE_CONDITIONS_CONT(x) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(x) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(std::vector<x>) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(std::list<x>) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(std::set<x>) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(std::deque<x>) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(dd4hep::detail::Primitive<x>::int_map_t) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(dd4hep::detail::Primitive<x>::ulong_map_t) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(dd4hep::detail::Primitive<x>::string_map_t) #define DD4HEP_DEFINE_CONDITIONS_U_CONT(x) \ DD4HEP_DEFINE_CONDITIONS_CONT(x) \ @@ -178,13 +163,13 @@ namespace DD4hep { #else -#define DD4HEP_DEFINE_CONDITIONS_CONT(x) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(x) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(std::vector<x>) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(std::list<x>) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(std::set<x>) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(DD4hep::Primitive<x>::int_map_t) \ - DD4HEP_DEFINE_CONDITIONS_TYPE(DD4hep::Primitive<x>::string_map_t) +#define DD4HEP_DEFINE_CONDITIONS_CONT(x) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(x) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(std::vector<x>) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(std::list<x>) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(std::set<x>) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(dd4hep::detail::Primitive<x>::int_map_t) \ + DD4HEP_DEFINE_CONDITIONS_TYPE(dd4hep::detail::Primitive<x>::string_map_t) #define DD4HEP_DEFINE_CONDITIONS_U_CONT(x) DD4HEP_DEFINE_CONDITIONS_CONT(x) diff --git a/DDCore/include/DD4hep/detail/ContainerHelpers.h b/DDCore/include/DD4hep/detail/ContainerHelpers.h index ce79ceccd..1bd3491df 100644 --- a/DDCore/include/DD4hep/detail/ContainerHelpers.h +++ b/DDCore/include/DD4hep/detail/ContainerHelpers.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +23,7 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { template <typename Q, typename T> void insert_item(std::vector<T>& c, Q, const T& d) { @@ -58,5 +58,5 @@ namespace DD4hep { void insert_item(std::multimap<std::string,T>& c, Q de, const T& d) { c.insert(std::make_pair(de.path(),d)); } -} // End namespace DD4hep +} // End namespace dd4hep #endif // DD4HEP_DD4HEP_CONTAINERHELPERS_H diff --git a/DDCore/include/DD4hep/detail/DetectorInterna.h b/DDCore/include/DD4hep/detail/DetectorInterna.h index 99260a035..6813b2697 100644 --- a/DDCore/include/DD4hep/detail/DetectorInterna.h +++ b/DDCore/include/DD4hep/detail/DetectorInterna.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,7 +26,7 @@ #include "DD4hep/NamedObject.h" #include "DD4hep/World.h" #include "DD4hep/Objects.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Alignments.h" #include "DD4hep/Conditions.h" #include "DD4hep/Segmentations.h" @@ -36,201 +36,178 @@ #include "TGeoMatrix.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - class LCDD; - class WorldObject; - class DetElementObject; - class SensitiveDetectorObject; - class VolumeManager_Populator; + class WorldObject; + class DetElementObject; + class SensitiveDetectorObject; + class VolumeManager_Populator; - /// Data class with properties of sensitive detectors - /** - * - * \author M.Frank - * \version 1.0 - * - * \ingroup DD4HEP DD4HEP_GEOMETRY - */ - class SensitiveDetectorObject: public NamedObject, public ObjectExtensions { - public: - unsigned int magic; - int verbose; - int combineHits; - double ecut; - Readout readout; - Region region; - LimitSet limits; - std::string hitsCollection; - - /// Default constructor - SensitiveDetectorObject(); - /// Initializing constructor - SensitiveDetectorObject(const std::string& nam); - /// Internal object destructor: release extension object(s) - virtual ~SensitiveDetectorObject(); + /// Data class with properties of sensitive detectors + /** + * + * \author M.Frank + * \version 1.0 + * + * \ingroup DD4HEP DD4HEP_GEOMETRY + */ + class SensitiveDetectorObject: public NamedObject, public ObjectExtensions { + public: + unsigned int magic; + int verbose; + int combineHits; + double ecut; + Readout readout; + Region region; + LimitSet limits; + std::string hitsCollection; + + /// Default constructor + SensitiveDetectorObject(); + /// Initializing constructor + SensitiveDetectorObject(const std::string& nam); + /// detaill object destructor: release extension object(s) + virtual ~SensitiveDetectorObject(); + }; + + /// Data class with properties of a detector element + /** + * + * \author M.Frank + * \version 1.0 + * + * \ingroup DD4HEP DD4HEP_GEOMETRY + */ + class DetElementObject : public NamedObject, public ObjectExtensions { + public: + // Type definitions. + // The full namespace declaration is required by cint.... + typedef std::pair<Callback,unsigned long> UpdateCall; + typedef std::vector<UpdateCall> UpdateCallbacks; + + enum DetFlags { + HAVE_WORLD_TRAFO = 1<<0, + HAVE_PARENT_TRAFO = 1<<1, + HAVE_REFERENCE_TRAFO = 1<<2, + HAVE_SENSITIVE_DETECTOR = 1<<29, + IS_TOP_LEVEL_DETECTOR = 1<<30, + HAVE_OTHER = 1<<31 }; - /// Data class with properties of a detector element - /** - * - * \author M.Frank - * \version 1.0 - * - * \ingroup DD4HEP DD4HEP_GEOMETRY + /// Magic number to ensure data integrity + unsigned int magic; + /// Flag to remember internally calculated quatities + unsigned int flag; + /// Unique integer identifier of the detector instance + int id; + /// Flag to process hits + int combineHits; + /// Flag to encode detector types + unsigned int typeFlag; + /// Hierarchical level within the detector description + int level; + /// Access hash key of this detector element (Only valid once geometry is closed!) + unsigned int key; + /// Full path to this detector element. May be invalid + std::string path; + /// The path to the placement of the detector element (if placed) + std::string placementPath; + + /// The subdetector placement corresponding to the ideal detector element's volume + PlacedVolume idealPlace; + /// The subdetector placement corresponding to the actual detector element's volume + PlacedVolume placement; + /// The cached VolumeID of this subdetector element + /** Please note: + * These values are set when populating the volume manager. + * There are restrictions: e.g. only sensitive subdetectors are present. */ - class DetElementObject: public NamedObject, public ObjectExtensions { - public: - // Type definitions. - // The full namespace declaration is required by cint.... - typedef /* DD4hep::Geometry:: */ DetElement::destruct_t destruct_t; - typedef /* DD4hep::Geometry:: */ DetElement::copy_t copy_t; - - typedef /* DD4hep::Geometry:: */ DetElement::Children Children; - typedef /* DD4hep::Geometry:: */ DetElement::Extensions Extensions; - typedef std::pair<Callback,unsigned long> UpdateCall; - typedef std::vector<UpdateCall> UpdateCallbacks; - typedef Conditions::Condition Condition; - typedef Alignments::AlignmentCondition AlignmentCondition; - - enum DetFlags { - HAVE_WORLD_TRAFO = 1<<0, - HAVE_PARENT_TRAFO = 1<<1, - HAVE_REFERENCE_TRAFO = 1<<2, - HAVE_SENSITIVE_DETECTOR = 1<<29, - IS_TOP_LEVEL_DETECTOR = 1<<30, - HAVE_OTHER = 1<<31 - }; - - /// Magic number to ensure data integrity - unsigned int magic; - /// Flag to remember internally calculated quatities - unsigned int flag; - /// Unique integer identifier of the detector instance - int id; - /// Flag to process hits - int combineHits; - /// Flag to encode detector types - unsigned int typeFlag; - /// Hierarchical level within the detector description - int level; - /// Access hash key of this detector element (Only valid once geometry is closed!) - unsigned int key; - /// Full path to this detector element. May be invalid - std::string path; - /// The path to the placement of the detector element (if placed) - std::string placementPath; - - /// The subdetector placement corresponding to the ideal detector element's volume - PlacedVolume idealPlace; - /// The subdetector placement corresponding to the actual detector element's volume - PlacedVolume placement; - /// The cached VolumeID of this subdetector element - /** Please note: - * These values are set when populating the volume manager. - * There are restrictions: e.g. only sensitive subdetectors are present. - */ - VolumeID volumeID; - /// Reference to the parent element - World privateWorld; - /// Reference to the parent element - DetElement parent; - /// The array of children - Children children; - /// Placeholder for structure with update callbacks - UpdateCallbacks updateCalls; - - //@{ Additional information set externally to facilitate the processing of event data */ - /// Basic ideal/nominal detector element alignment entry - AlignmentCondition nominal; - /// Basic detector element alignment entry containing the survey data - AlignmentCondition survey; - - /// Global alignment data - Ref_t global_alignment; - //@} + VolumeID volumeID; + /// Reference to the parent element + World privateWorld; + /// Reference to the parent element + DetElement parent; + /// The array of children + DetElement::Children children; + /// Placeholder for structure with update callbacks + UpdateCallbacks updateCalls; + + //@{ Additional information set externally to facilitate the processing of event data */ + /// Basic ideal/nominal detector element alignment entry + AlignmentCondition nominal; + /// Basic detector element alignment entry containing the survey data + AlignmentCondition survey; + + /// Global alignment data + Ref_t global_alignment; + //@} #if 0 - // To be removed! - /// Alignment entries for lower level volumes, which are NOT attached to daughter DetElements - std::vector<Alignment> volume_alignments; - /// Alignment entries for lower level volumes, which are NOT attached to daughter DetElements - std::vector<Alignment> volume_surveys; + // To be removed! + /// Alignment entries for lower level volumes, which are NOT attached to daughter DetElements + std::vector<Alignment> volume_alignments; + /// Alignment entries for lower level volumes, which are NOT attached to daughter DetElements + std::vector<Alignment> volume_surveys; #endif - //@{ Cached information of the detector element. - /// The usage is deprecated and only present for backwards compatibility - private: - friend class VolumeManager_Populator; - /// Intermediate buffer to store the transformation to the world coordination system - TGeoHMatrix worldTrafo; - /// Intermediate buffer to store the transformation to the parent detector element - TGeoHMatrix parentTrafo; - /// Create cached matrix to transform to parent coordinates - const TGeoHMatrix& __parentTransformation(); - /// Create cached matrix to transform to world coordinates - const TGeoHMatrix& __worldTransformation(); - //@} - - private: - //@{ Private methods used internally by the object itself. */ - /// Resolve the world object. Internal use ONLY. - World i_access_world(); - - public: - //@{ Public methods to ease the usage of the data. */ - /// Initializing constructor - DetElementObject(const std::string& nam, int ident); - /// Default constructor - DetElementObject(); - /// Internal object destructor: release extension object(s) - virtual ~DetElementObject(); - /// Deep object copy to replicate DetElement trees e.g. for reflection - virtual DetElementObject* clone(int new_id, int flag) const; - /// Access to the world object. Only possible once the geometry is closed. - World world() - { return privateWorld.isValid() ? privateWorld : i_access_world(); } - //@} - /// Remove callback from object - void removeAtUpdate(unsigned int type, void* pointer); - /// Trigger update callbacks - void update(unsigned int tags, void* param); - /// Revalidate the caches - void revalidate(TGeoHMatrix* parent_world_trafo); - }; + private: + friend class VolumeManager_Populator; - /// Data class with properties of a detector element - /** - * - * \author M.Frank - * \version 1.0 - * - * \ingroup DD4HEP DD4HEP_GEOMETRY - */ - class WorldObject: public DetElementObject { - public: - /// Reference to the LCDD instance object - LCDD* lcdd; - - public: - //@{ Public methods to ease the usage of the data. */ - /// Default constructor - WorldObject(); + private: + //@{ Private methods used internally by the object itself. */ + /// Resolve the world object. detaill use ONLY. + World i_access_world(); + + public: + //@{ Public methods to ease the usage of the data. */ + /// Initializing constructor + DetElementObject(const std::string& nam, int ident); + /// Default constructor + DetElementObject(); + /// detaill object destructor: release extension object(s) + virtual ~DetElementObject(); + /// Deep object copy to replicate DetElement trees e.g. for reflection + virtual DetElementObject* clone(int new_id, int flag) const; + /// Access to the world object. Only possible once the geometry is closed. + World world() + { return privateWorld.isValid() ? privateWorld : i_access_world(); } + //@} + /// Remove callback from object + void removeAtUpdate(unsigned int type, void* pointer); + /// Trigger update callbacks + void update(unsigned int tags, void* param); + /// Revalidate the caches + void revalidate(); + }; + + /// Data class with properties of a detector element + /** + * + * \author M.Frank + * \version 1.0 + * + * \ingroup DD4HEP DD4HEP_GEOMETRY + */ + class WorldObject: public DetElementObject { + public: + /// Reference to the Detector instance object + Detector* description; + + public: + //@{ Public methods to ease the usage of the data. */ + /// Default constructor + WorldObject(); #ifndef __CINT__ - /// Initializing constructor - WorldObject(LCDD& lcdd, const std::string& nam); + /// Initializing constructor + WorldObject(Detector& description, const std::string& nam); #endif - /// Internal object destructor: release extension object(s) - virtual ~WorldObject(); - }; + /// detaill object destructor: release extension object(s) + virtual ~WorldObject(); + }; - /// Default constructor - inline WorldObject::WorldObject() : DetElementObject(), lcdd(0) { - } + /// Default constructor + inline WorldObject::WorldObject() : DetElementObject(), description(0) { + } - } /* End namespace Geometry */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_DETECTORINTERNA_H */ diff --git a/DDCore/include/DD4hep/detail/Handle.inl b/DDCore/include/DD4hep/detail/Handle.inl index fffbb3f00..3a01f0b2b 100644 --- a/DDCore/include/DD4hep/detail/Handle.inl +++ b/DDCore/include/DD4hep/detail/Handle.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +15,7 @@ #include "DD4hep/Handle.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Helper routine called when unrelated types are assigned. template <typename T> void Handle<T>::bad_assignment(const std::type_info& from, const std::type_info& to) @@ -46,7 +46,7 @@ namespace DD4hep { return 0; // We have thrown an exception before - does not harm! } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #if 0 #include <iostream> @@ -62,17 +62,17 @@ namespace DD4hep { #endif #define DD4HEP_INSTANTIATE_HANDLE(X) \ - namespace DD4hep { \ + namespace dd4hep { \ template <> void Handle<X>::verifyObject() const { \ increment_object_validations(); \ if (m_element && dynamic_cast<X*>(m_element) == 0) { \ bad_assignment(typeid(*m_element), typeid(X)); \ } \ }} \ - template class DD4hep::Handle<X> + template class dd4hep::Handle<X> #define DD4HEP_INSTANTIATE_HANDLE_NAMED(X) \ - namespace DD4hep { \ + namespace dd4hep { \ template <> const char* Handle<X>::name() const \ { return this->m_element ? this->m_element->name.c_str() : ""; } \ template <> void \ @@ -87,10 +87,10 @@ namespace DD4hep { bad_assignment(typeid(*m_element), typeid(X)); \ } \ }} \ - template class DD4hep::Handle<X> + template class dd4hep::Handle<X> #define DD4HEP_INSTANTIATE_HANDLE_UNNAMED(X) \ - namespace DD4hep { \ + namespace dd4hep { \ template <> void \ Handle<X>::assign(X* n, const std::string&, const std::string&) \ { this->m_element = n;} \ diff --git a/DDCore/include/DD4hep/detail/ObjectsInterna.h b/DDCore/include/DD4hep/detail/ObjectsInterna.h index a8f5e5b44..19036a445 100644 --- a/DDCore/include/DD4hep/detail/ObjectsInterna.h +++ b/DDCore/include/DD4hep/detail/ObjectsInterna.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,195 +27,186 @@ class TColor; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Concrete object implementation for the Header handle + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class HeaderObject: public NamedObject { + public: + std::string url; + std::string author; + std::string status; + std::string version; + std::string comment; + /// Standard constructor + HeaderObject(); + /// Default destructor + virtual ~HeaderObject(); + private: + /// Private copy constructor + HeaderObject(const HeaderObject&) : NamedObject() {} + /// Private assignment operator + HeaderObject& operator=(const HeaderObject&) { return *this; } + }; - /// Concrete object implementation for the Header handle - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class HeaderObject: public NamedObject { - public: - std::string url; - std::string author; - std::string status; - std::string version; - std::string comment; - /// Standard constructor - HeaderObject(); - /// Default destructor - virtual ~HeaderObject(); - private: - /// Private copy constructor - HeaderObject(const HeaderObject&) : NamedObject() {} - /// Private assignment operator - HeaderObject& operator=(const HeaderObject&) { return *this; } - }; + /// Concrete object implementation for the Constant handle + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class ConstantObject: public NamedObject { + public: + /// Constant type + std::string dataType; + /// Standard constructor + ConstantObject(const std::string& nam, const std::string& val, const std::string& typ); + /// Default destructor + virtual ~ConstantObject(); + private: + /// Private copy constructor + ConstantObject(const ConstantObject&) : NamedObject() {} + /// Private assignment operator + ConstantObject& operator=(const ConstantObject&) { return *this; } + }; - /// Concrete object implementation for the Constant handle - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class ConstantObject: public NamedObject { - public: - /// Constant type - std::string dataType; - /// Standard constructor - ConstantObject(const std::string& nam, const std::string& val, const std::string& typ); - /// Default destructor - virtual ~ConstantObject(); - private: - /// Private copy constructor - ConstantObject(const ConstantObject&) : NamedObject() {} - /// Private assignment operator - ConstantObject& operator=(const ConstantObject&) { return *this; } - }; + /// Concrete object implementation of the VisAttr Handle + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class VisAttrObject: public NamedObject { + public: + unsigned long magic; + TColor* col; + int color; + float alpha; + unsigned char drawingStyle, lineStyle, showDaughters, visible; + /// Standard constructor + VisAttrObject(); + /// Default destructor + virtual ~VisAttrObject(); + }; - /// Concrete object implementation of the VisAttr Handle - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class VisAttrObject: public NamedObject { - public: - unsigned long magic; - TColor* col; - int color; - float alpha; - unsigned char drawingStyle, lineStyle, showDaughters, visible; - /// Standard constructor - VisAttrObject(); - /// Default destructor - virtual ~VisAttrObject(); - }; + /// Concrete object implementation of the Region Handle + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class RegionObject: public NamedObject { + public: + unsigned long magic; + double threshold; + double cut; + bool store_secondaries; + bool use_default_cut; + bool was_threshold_set; + std::vector<std::string> user_limits; + /// Standard constructor + RegionObject(); + /// Default destructor + virtual ~RegionObject(); + }; - /// Concrete object implementation of the Region Handle - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class RegionObject: public NamedObject { - public: - unsigned long magic; - double threshold; - double cut; - bool store_secondaries; - bool use_default_cut; - bool was_threshold_set; - std::vector<std::string> user_limits; - /// Standard constructor - RegionObject(); - /// Default destructor - virtual ~RegionObject(); - }; + /// Concrete object implementation of the LimitSet Handle + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class LimitSetObject: public NamedObject, public std::set<Limit> { + public: + /// Standard constructor + LimitSetObject(); + /// Default destructor + virtual ~LimitSetObject(); + }; - /// Concrete object implementation of the LimitSet Handle - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class LimitSetObject: public NamedObject, public std::set<Limit> { - public: - /// Standard constructor - LimitSetObject(); - /// Default destructor - virtual ~LimitSetObject(); - }; + /// Definition of the HitCollection parameters used by the Readout + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class HitCollection { + public: + /// Hit collection name + std::string name; + /// Discriminator key name from the <id/> string + std::string key; + /// Range values of the key is not empty. + long key_min, key_max; + /// Default constructor + HitCollection() : key_min(~0x0), key_max(~0x0) {} + /// Copy constructor + HitCollection(const HitCollection& c); + /// Initializing constructor + HitCollection(const std::string& name, const std::string& key="",long k_min=~0x0, long kmax=~0x0); + /// Assignment operator + HitCollection& operator=(const HitCollection& c); + }; - /// Definition of the HitCollection parameters used by the Readout - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class HitCollection { - public: - /// Hit collection name - std::string name; - /// Discriminator key name from the <id/> string - std::string key; - /// Range values of the key is not empty. - long key_min, key_max; - /// Default constructor - HitCollection() : key_min(~0x0), key_max(~0x0) {} - /// Copy constructor - HitCollection(const HitCollection& c); - /// Initializing constructor - HitCollection(const std::string& name, const std::string& key="",long k_min=~0x0, long kmax=~0x0); - /// Assignment operator - HitCollection& operator=(const HitCollection& c); - }; + /// Concrete object implementation of the Readout Handle + /** + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class ReadoutObject: public NamedObject { + public: + /// Handle to the readout segmentation + Segmentation segmentation; + /// Handle to the volume + Volume readoutWorld; + /// Handle to the field descriptor + IDDescriptor id; + /// Hit collection container (if defined) + std::vector<HitCollection> hits; + /// Standard constructor + ReadoutObject(); + /// Default destructor + virtual ~ReadoutObject(); + }; - /// Concrete object implementation of the Readout Handle - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class ReadoutObject: public NamedObject { - public: - typedef HitCollection Collection; - typedef std::vector<HitCollection> Collections; - /// Handle to the readout segmentation - Segmentation segmentation; - /// Handle to the volume - Volume readoutWorld; - /// Handle to the field descriptor - IDDescriptor id; - /// Hit collection container (if defined) - Collections hits; - /// Standard constructor - ReadoutObject(); - /// Default destructor - virtual ~ReadoutObject(); - }; - - /// Concrete object implementation of the IDDescriptorObject Handle - /** - * - * \author M.Frank - * \version 1.0 - * \date 2012/07/31 - * \ingroup DD4HEP_GEOMETRY - */ - class IDDescriptorObject: public NamedObject, public BitField64 { - public: - typedef BitFieldValue* Field; - typedef std::vector<std::pair<std::string, Field> > FieldMap; - typedef std::vector<std::pair<size_t, std::string> > FieldIDs; - FieldMap fieldMap; //! not ROOT-persistent - FieldIDs fieldIDs; //! not ROOT-persistent - std::string description; - /// Default constructor - IDDescriptorObject(); - /// Standard constructor - IDDescriptorObject(const std::string& initString); - /// Default destructor - virtual ~IDDescriptorObject(); + /// Concrete object implementation of the IDDescriptorObject Handle + /** + * + * \author M.Frank + * \version 1.0 + * \date 2012/07/31 + * \ingroup DD4HEP_GEOMETRY + */ + class IDDescriptorObject: public NamedObject, public BitField64 { + public: + typedef std::vector<std::pair<std::string, BitFieldValue*> > FieldMap; + typedef std::vector<std::pair<size_t, std::string> > FieldIDs; + FieldMap fieldMap; //! not ROOT-persistent + FieldIDs fieldIDs; //! not ROOT-persistent + std::string description; + /// Default constructor + IDDescriptorObject(); + /// Standard constructor + IDDescriptorObject(const std::string& initString); + /// Default destructor + virtual ~IDDescriptorObject(); #ifndef __CINT__ - /// Access to the field container of the BitField64 - const std::vector<BitFieldValue*> fields() const { - return _fields; - } + /// Access to the field container of the BitField64 + const std::vector<BitFieldValue*> fields() const { + return _fields; + } #endif - }; - - - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + }; +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_OBJECTSINTERNA_H */ diff --git a/DDCore/include/DD4hep/detail/OpaqueData_inl.h b/DDCore/include/DD4hep/detail/OpaqueData_inl.h index f1647eac8..79bffd96d 100644 --- a/DDCore/include/DD4hep/detail/OpaqueData_inl.h +++ b/DDCore/include/DD4hep/detail/OpaqueData_inl.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,7 +27,7 @@ #include "DD4hep/BasicGrammar.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { namespace { template <typename T> static void opaqueCopyObject(void* t, const void* s) { @@ -83,10 +83,10 @@ namespace DD4hep { return ret; } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #define DD4HEP_DEFINE_OPAQUEDATA_TYPE(x) \ - namespace DD4hep { \ + namespace dd4hep { \ template x& OpaqueDataBlock::bind<x>(); \ template x& OpaqueDataBlock::bind<x>(const std::string& val); \ } diff --git a/DDCore/include/DD4hep/detail/Plugins.inl b/DDCore/include/DD4hep/detail/Plugins.inl index f23e8a3c5..b381fc207 100644 --- a/DDCore/include/DD4hep/detail/Plugins.inl +++ b/DDCore/include/DD4hep/detail/Plugins.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -31,8 +31,8 @@ #include "Reflex/Reflex.h" #include "Reflex/Builder/ReflexBuilder.h" -/// The DD4hep namespace declaration -namespace DD4hep { +/// The dd4hep namespace declaration +namespace dd4hep { /** Declaration and implementation of all templated Create methods. * Concrete instances must be created using the instantiators below. @@ -67,7 +67,7 @@ namespace DD4hep { { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4, a5); } - /** Internal namespace -- should under no circumstances be used directly. + /** detaill namespace -- should under no circumstances be used directly. * The named namespace is necessary to trick the linker. Entries in an anonymous * namespace would be oiptimized away..... * @@ -126,7 +126,7 @@ namespace DD4hep { { return __func(PluginService::Create<R,A0,A1,A2,A3,A4,A5>).ptr; } namespace { - template <typename SIGNATURE> static void reflex_plugin(const std::string& name, typename DD4hep::PluginRegistry<SIGNATURE>::stub_t stub) { + template <typename SIGNATURE> static void reflex_plugin(const std::string& name, typename dd4hep::PluginRegistry<SIGNATURE>::stub_t stub) { ROOT::Reflex::Type typ = ROOT::Reflex::TypeBuilder(name.c_str(),ROOT::Reflex::PUBLIC); ROOT::Reflex::Type sig = ROOT::Reflex::FunctionDistiller < SIGNATURE > ::Get(); std::string fname = (std::string(PLUGINSVC_FACTORY_NS "::") + ROOT::Reflex::PluginService::FactoryName(name)); @@ -142,7 +142,7 @@ namespace DD4hep { } } -#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(R, ARGS) namespace DD4hep { \ +#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(R, ARGS) namespace dd4hep { \ template <> void PluginRegistry< R ARGS >::add(const char* n, stub_t f) \ { plugin_signatures_namespace::reflex_plugin< R ARGS >(n,f); } \ namespace plugin_signatures_namespace { template void* instantiate_creator<R> ARGS ; }} diff --git a/DDCore/include/DD4hep/detail/SegmentationsInterna.h b/DDCore/include/DD4hep/detail/SegmentationsInterna.h index 4f78a962f..a5cc3a42c 100644 --- a/DDCore/include/DD4hep/detail/SegmentationsInterna.h +++ b/DDCore/include/DD4hep/detail/SegmentationsInterna.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,114 +16,106 @@ // Framework include files #include "DD4hep/Handle.h" #include "DD4hep/Objects.h" +#include "DD4hep/BitField64.h" #include "DDSegmentation/Segmentation.h" // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + // Forward declarations + class DetElementObject; + class SegmentationObject; + class SensitiveDetectorObject; - // Forward declarations - class DetElementObject; - class SegmentationObject; - class SensitiveDetectorObject; - - /// Implementation class supporting generic Segmentation of sensitive detectors - /** - * The SegmentationObject wraps the functionality of the DDSegmentation base class. - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class SegmentationObject { - public: - typedef DDSegmentation::Segmentation BaseSegmentation; - typedef DDSegmentation::Parameters Parameters; - typedef DDSegmentation::Parameter Parameter; - - public: - /// Standard constructor - SegmentationObject(BaseSegmentation* s = 0); - /// Default destructor - virtual ~SegmentationObject(); - /// Access the encoding string - std::string fieldDescription() const; - /// Access the segmentation name - const std::string& name() const; - /// Set the segmentation name - void setName(const std::string& value); - - /// Access the segmentation type - const std::string& type() const; - /// Access the description of the segmentation - const std::string& description() const; - /// Access the underlying decoder - BitField64* decoder() const; - /// Set the underlying decoder - void setDecoder(BitField64* decoder) const; - /// Access to parameter by name - Parameter parameter(const std::string& parameterName) const; - /// Access to all parameters - Parameters parameters() const; - /// Set all parameters from an existing set of parameters - void setParameters(const Parameters& parameters); + /// Implementation class supporting generic Segmentation of sensitive detectors + /** + * The SegmentationObject wraps the functionality of the DDSegmentation base class. + * + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + class SegmentationObject { + public: + /// Standard constructor + SegmentationObject(DDSegmentation::Segmentation* s = 0); + /// Default destructor + virtual ~SegmentationObject(); + /// Access the encoding string + std::string fieldDescription() const; + /// Access the segmentation name + const std::string& name() const; + /// Set the segmentation name + void setName(const std::string& value); - /** Segmentation interface */ - /// Determine the local position based on the cell ID - Position position(const CellID& cellID) const; - /// Determine the cell ID based on the position - CellID cellID(const Position& localPosition, - const Position& globalPosition, - const VolumeID& volumeID) const; - /// Determine the volume ID from the full cell ID by removing all local fields - VolumeID volumeID(const CellID& cellID) const; - /// Calculates the neighbours of the given cell ID and adds them to the list of neighbours - void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const; + /// Access the segmentation type + const std::string& type() const; + /// Access the description of the segmentation + const std::string& description() const; + /// Access the underlying decoder + const BitField64* decoder() const; + /// Set the underlying decoder + void setDecoder(BitField64* decoder) const; + /// Access to parameter by name + DDSegmentation::Parameter parameter(const std::string& parameterName) const; + /// Access to all parameters + DDSegmentation::Parameters parameters() const; + /// Set all parameters from an existing set of parameters + void setParameters(const DDSegmentation::Parameters& parameters); - /** Data members. */ - /// Magic word to check object integrity - unsigned long magic; - /// Flag to use segmentation for hit positioning - unsigned char useForHitPosition; - /// Reference to hosting top level DetElement structure - Handle<DetElementObject> detector; - /// Reference to hosting top level sensitve detector structure - Handle<SensitiveDetectorObject> sensitive; - /// Reference to base segmentation - BaseSegmentation* segmentation; - }; + /** Segmentation interface */ + /// Determine the local position based on the cell ID + Position position(const CellID& cellID) const; + /// Determine the cell ID based on the position + CellID cellID(const Position& localPosition, + const Position& globalPosition, + const VolumeID& volumeID) const; + /// Determine the volume ID from the full cell ID by removing all local fields + VolumeID volumeID(const CellID& cellID) const; + /// Calculates the neighbours of the given cell ID and adds them to the list of neighbours + void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const; - /// Concrete wrapper class for segmentation implementation based on DDSegmentation objects - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename IMP> class SegmentationWrapper : public SegmentationObject { - public: - /// DDSegmentation aggregate - IMP* implementation; - public: - /// Standard constructor - SegmentationWrapper(DDSegmentation::BitField64* decoder); - /// Default destructor - virtual ~SegmentationWrapper(); - }; + /** Data members. */ + /// Magic word to check object integrity + unsigned long magic; + /// Flag to use segmentation for hit positioning + unsigned char useForHitPosition; + /// Reference to hosting top level DetElement structure + Handle<DetElementObject> detector; + /// Reference to hosting top level sensitve detector structure + Handle<SensitiveDetectorObject> sensitive; + /// Reference to base segmentation + DDSegmentation::Segmentation* segmentation; + }; + /// Concrete wrapper class for segmentation implementation based on DDSegmentation objects + /** + * \author M.Frank + * \version 1.0 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename IMP> class SegmentationWrapper : public SegmentationObject { + public: + /// DDSegmentation aggregate + IMP* implementation; + public: /// Standard constructor - template <typename IMP> inline - SegmentationWrapper<IMP>::SegmentationWrapper(DDSegmentation::BitField64* decode) - : SegmentationObject(implementation=new IMP(decode)) - { - } - + SegmentationWrapper(BitField64* decoder); /// Default destructor - template <typename IMP> inline SegmentationWrapper<IMP>::~SegmentationWrapper() { - } - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + virtual ~SegmentationWrapper(); + }; + + /// Standard constructor + template <typename IMP> inline + SegmentationWrapper<IMP>::SegmentationWrapper(BitField64* decode) + : SegmentationObject(implementation=new IMP(decode)) + { + } + + /// Default destructor + template <typename IMP> inline SegmentationWrapper<IMP>::~SegmentationWrapper() { + } +} /* End namespace dd4hep */ #endif /* DD4HEP_GEOMETRY_SEGMENTATIONSINTERNA_H */ diff --git a/DDCore/include/DD4hep/detail/VolumeManagerInterna.h b/DDCore/include/DD4hep/detail/VolumeManagerInterna.h index 32ba3f8d4..c1bc8439b 100644 --- a/DDCore/include/DD4hep/detail/VolumeManagerInterna.h +++ b/DDCore/include/DD4hep/detail/VolumeManagerInterna.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,13 +18,12 @@ // sufficient for all practical purposes. // //========================================================================== - #ifndef DD4HEP_GEOMETRY_VOLUMEMANAGERINTERNA_H #define DD4HEP_GEOMETRY_VOLUMEMANAGERINTERNA_H // Framework include files #include "DD4hep/Volumes.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/IDDescriptor.h" #include "DD4hep/VolumeManager.h" @@ -32,51 +31,10 @@ #include "TGeoMatrix.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { +namespace dd4hep { - // Forward declarations - class LCDD; - class VolumeManagerContext; - class VolumeManagerObject; - - /// This structure describes the cached data for one placement held by the volume manager - /** - * - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_GEOMETRY - */ - class VolumeManagerContext { - public: - /// Placement identifier - VolumeID identifier; - /// Ignore mask of the placement identifier - //[[gnu::deprecated("This member variable might get axed if it is not used, please tell us if you do")]] - VolumeID mask; - /// The placement - [[gnu::deprecated("This member variable might get axed if it is not used, please tell us if you do")]] - PlacedVolume placement; - /// Handle to the subdetector element handle - [[gnu::deprecated("This member variable might get axed if it is not used, please tell us if you do")]] - DetElement detector; - /// Handle to the closest Detector element - DetElement element; - /// The transformation of space-points to the world corrdinate system - TGeoHMatrix toWorld; - /// The transformation of space-points to the coordinate system of the detector element - [[gnu::deprecated("This member variable might get axed if it is not used, please tell us if you do")]] - TGeoHMatrix toDetector; - /// The transformation of space-points to the coordinate system of the closests detector element - TGeoHMatrix toElement; - public: - /// Default constructor - VolumeManagerContext(); - /// Default destructor - virtual ~VolumeManagerContext(); - }; + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { /// This structure describes the internal data of the volume manager object /** @@ -86,45 +44,46 @@ namespace DD4hep { * \ingroup DD4HEP_GEOMETRY */ class VolumeManagerObject: public NamedObject { - public: - typedef IDDescriptor::Field Field; - typedef VolumeManager::Managers Managers; - typedef VolumeManager::Detectors Detectors; - typedef VolumeManager::Volumes Volumes; - typedef VolumeManager::Context Context; - public: /// The container of subdetector elements - Detectors subdetectors; + std::map<DetElement, VolumeManager> subdetectors; /// The volume managers for the individual subdetector elements - Managers managers; + std::map<VolumeID, VolumeManager> managers; /// The container of placements managed by this instance - Volumes volumes; + std::map<VolumeID, VolumeManagerContext*> volumes; /// The Detector element handle managed by this instance - DetElement detector; + DetElement detector{0}; /// The ID descriptor object IDDescriptor id; /// The reference to the TOP level VolumeManager - VolumeManagerObject* top; + VolumeManagerObject* top = 0; /// The system field descriptor - Field system; + const BitFieldValue* system; /// System identifier - VolumeID sysID; + VolumeID sysID = 0; /// Sub-detector mask - VolumeID detMask; + VolumeID detMask = ~0x0ULL; /// Population flags - int flags; + int flags = VolumeManager::NONE; public: /// Default constructor - VolumeManagerObject(); + VolumeManagerObject() = default; + /// No move constructor + VolumeManagerObject(VolumeManagerObject&& copy) = delete; + /// No copy constructor + VolumeManagerObject(const VolumeManagerObject& copy) = delete; /// Default destructor virtual ~VolumeManagerObject(); + /// No move assignment + VolumeManagerObject& operator=(VolumeManagerObject&& copy) = delete; + /// No copy assignment + VolumeManagerObject& operator=(const VolumeManagerObject& copy) = delete; /// Search the locally cached volumes for a matching ID - Context* search(const VolumeID& id) const; + VolumeManagerContext* search(const VolumeID& id) const; /// Update callback when alignment has changed (called only for subdetectors....) void update(unsigned long tags, DetElement& det, void* param); }; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4hep_GEOMETRY_VOLUMEMANAGERINTERNA_H */ + } /* End namespace detail */ +} /* End namespace dd4hep */ +#endif /* dd4hep_GEOMETRY_VOLUMEMANAGERINTERNA_H */ diff --git a/DDCore/include/JSON/ChildValue.h b/DDCore/include/JSON/ChildValue.h index 6300377d8..80919af73 100644 --- a/DDCore/include/JSON/ChildValue.h +++ b/DDCore/include/JSON/ChildValue.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ // Framework include files #include "JSON/Dimension.h" -#define DD4HEP_DIMENSION_NS JSON +#define DD4HEP_DIMENSION_NS json #include "XML/detail/ChildValue.h" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/JSON/ChildValue.inl b/DDCore/include/JSON/ChildValue.inl index 744eeff89..7dee274ae 100644 --- a/DDCore/include/JSON/ChildValue.inl +++ b/DDCore/include/JSON/ChildValue.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ // Framework include files #include "JSON/ChildValue.h" -#define DD4HEP_DIMENSION_NS JSON +#define DD4HEP_DIMENSION_NS json #include "XML/detail/ChildValue.inl" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/JSON/Conversions.h b/DDCore/include/JSON/Conversions.h index 37627560d..c108665d4 100644 --- a/DDCore/include/JSON/Conversions.h +++ b/DDCore/include/JSON/Conversions.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ #ifndef DD4HEP_JSON_CONVERSIONS_H #define DD4HEP_JSON_CONVERSIONS_H -#define DD4HEP_CONVERSION_NS JSON +#define DD4HEP_CONVERSION_NS json #include "XML/detail/Conversions.h" #undef DD4HEP_CONVERSION_NS diff --git a/DDCore/include/JSON/Detector.h b/DDCore/include/JSON/Detector.h index c0fced1da..662196e30 100644 --- a/DDCore/include/JSON/Detector.h +++ b/DDCore/include/JSON/Detector.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "JSON/Dimension.h" /// Include the implementation in the proper namespace -#define DD4HEP_DIMENSION_NS JSON +#define DD4HEP_DIMENSION_NS json #include "XML/detail/Detector.h" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/JSON/Dimension.h b/DDCore/include/JSON/Dimension.h index 20281d041..e92caee8b 100644 --- a/DDCore/include/JSON/Dimension.h +++ b/DDCore/include/JSON/Dimension.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "JSON/Elements.h" #include "JSON/Tags.h" -#define DD4HEP_DIMENSION_NS JSON +#define DD4HEP_DIMENSION_NS json #include "XML/detail/Dimension.h" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/JSON/Dimension.inl b/DDCore/include/JSON/Dimension.inl index 514a0d58c..602b86658 100644 --- a/DDCore/include/JSON/Dimension.inl +++ b/DDCore/include/JSON/Dimension.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ // Framework include files #include "JSON/Dimension.h" -#define DD4HEP_DIMENSION_NS JSON +#define DD4HEP_DIMENSION_NS json #include "XML/detail/Dimension.inl" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/JSON/DocumentHandler.h b/DDCore/include/JSON/DocumentHandler.h index a60c3f7b0..f1247b195 100644 --- a/DDCore/include/JSON/DocumentHandler.h +++ b/DDCore/include/JSON/DocumentHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,10 +17,10 @@ #include "JSON/Elements.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting JSON utilities - namespace JSON { + namespace json { /// Class supporting to read and parse XML documents. /** @@ -42,6 +42,6 @@ namespace DD4hep { virtual Document parse(const char* doc_string, size_t length) const; }; - } /* End namespace JSON */ -} /* End namespace DD4hep */ + } /* End namespace json */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_JSON_DOCUMENTHANDLER_H */ diff --git a/DDCore/include/JSON/Elements.h b/DDCore/include/JSON/Elements.h index 1734f2b96..c79870ad4 100644 --- a/DDCore/include/JSON/Elements.h +++ b/DDCore/include/JSON/Elements.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -30,10 +30,10 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting JSON utilities - namespace JSON { + namespace json { typedef const JsonAttr* Attribute; @@ -346,7 +346,7 @@ namespace DD4hep { /// User abstraction class to manipulate JSON elements within a document /** * User class encapsulating a DOM element - * using the Handle helper. + * using the Handle_t helper. * This is the main class we interact with when * analysing the json documents for constructing * sub-detectors etc. @@ -429,6 +429,6 @@ namespace DD4hep { void dumpTree(Element elt); void dumpTree(const JsonElement* elt); - } /* End namespace JSON */ -} /* End namespace DD4hep */ + } /* End namespace json */ +} /* End namespace dd4hep */ #endif /* DDCORE_DD4HEP_JSON_ELEMENTS_H */ diff --git a/DDCore/include/JSON/Evaluator.h b/DDCore/include/JSON/Evaluator.h index 665691919..c601fb9b3 100644 --- a/DDCore/include/JSON/Evaluator.h +++ b/DDCore/include/JSON/Evaluator.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ #ifndef DD4HEP_DDCORE_JSON_EVALUATOR_H #define DD4HEP_DDCORE_JSON_EVALUATOR_H -// Forwarding printout functionality to DD4hep +// Forwarding printout functionality to dd4hep /** Note: This is necessary to use the JSON functionality as a standalone * utility without the need to externalize the world. * diff --git a/DDCore/include/JSON/Helper.h b/DDCore/include/JSON/Helper.h index 78a329845..0fc925d6c 100644 --- a/DDCore/include/JSON/Helper.h +++ b/DDCore/include/JSON/Helper.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,39 +16,38 @@ // Framework include files #include "JSON/Detector.h" #include "JSON/ChildValue.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Factories.h" #include "DD4hep/DD4hepUnits.h" // Shortcuts to elements of the JSON namespace -typedef DD4hep::JSON::Attribute json_attr_t; -typedef DD4hep::JSON::Collection_t json_coll_t; -typedef DD4hep::JSON::Handle_t json_h; -typedef DD4hep::JSON::Element json_elt_t; -typedef DD4hep::JSON::Element json_ref_t; -typedef DD4hep::JSON::DetElement json_det_t; -typedef DD4hep::JSON::Component json_comp_t; -typedef DD4hep::JSON::Dimension json_dim_t; -typedef DD4hep::JSON::ChildValue json_val_t; -typedef DD4hep::JSON::Document json_doc_t; -typedef DD4hep::JSON::DocumentHolder json_doc_holder_t; -typedef DD4hep::JSON::DocumentHandler json_handler_t; -typedef DD4hep::Geometry::LCDD lcdd_t; +typedef dd4hep::json::Attribute json_attr_t; +typedef dd4hep::json::Collection_t json_coll_t; +typedef dd4hep::json::Handle_t json_h; +typedef dd4hep::json::Element json_elt_t; +typedef dd4hep::json::Element json_ref_t; +typedef dd4hep::json::DetElement json_det_t; +typedef dd4hep::json::Component json_comp_t; +typedef dd4hep::json::Dimension json_dim_t; +typedef dd4hep::json::ChildValue json_val_t; +typedef dd4hep::json::Document json_doc_t; +typedef dd4hep::json::DocumentHolder json_doc_holder_t; +typedef dd4hep::json::DocumentHandler json_handler_t; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { /// std::string conversion of JSON strings (e.g. Unicode for Xerces-C) static inline std::string _toString(const char* value) { - return JSON::_toString(value); + return json::_toString(value); } /// std::string conversion of arbitrary entities including user defined formatting. template <typename T> inline std::string _toString(T value, const char* fmt) { - return JSON::_toString(value, fmt); + return json::_toString(value, fmt); } } } diff --git a/DDCore/include/JSON/Printout.h b/DDCore/include/JSON/Printout.h index 08dd2294e..30a81ddd1 100644 --- a/DDCore/include/JSON/Printout.h +++ b/DDCore/include/JSON/Printout.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ #ifndef DD4HEP_DDCORE_JSON_PRINTOUT_H #define DD4HEP_DDCORE_JSON_PRINTOUT_H -// Forwarding printout functionality to DD4hep +// Forwarding printout functionality to dd4hep /** Note: This is necessary to use the JSON functionality as a standalone * utility without the need to externalize the world. * diff --git a/DDCore/include/JSON/Tags.h b/DDCore/include/JSON/Tags.h index 307e1331b..c70c776a5 100644 --- a/DDCore/include/JSON/Tags.h +++ b/DDCore/include/JSON/Tags.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include "JSON/Elements.h" // Helpers to access tags and attributes quickly without specifying explicitly namespaces -#define _DD4hep_Unicode_Item(a) #a +#define _dd4hep_Unicode_Item(a) #a #define _U(a) #a #define _Unicode(a) #a diff --git a/DDCore/include/JSON/config.h b/DDCore/include/JSON/config.h index 22d69b61d..c9d657da1 100644 --- a/DDCore/include/JSON/config.h +++ b/DDCore/include/JSON/config.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "boost/property_tree/ptree.hpp" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting JSON utilities - namespace JSON { + namespace json { typedef char XmlChar; typedef boost::property_tree::ptree ptree; @@ -29,6 +29,6 @@ namespace DD4hep { typedef boost::property_tree::ptree::value_type JsonAttr; typedef boost::property_tree::ptree::value_type JsonElement; - } /* End namespace JSON */ -} /* End namespace DD4hep */ + } /* End namespace json */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_JSON_CONFIG_H */ diff --git a/DDCore/include/ROOT/LinkDef.h b/DDCore/include/ROOT/LinkDef.h index 6ed673c06..0343ac1c4 100644 --- a/DDCore/include/ROOT/LinkDef.h +++ b/DDCore/include/ROOT/LinkDef.h @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDCore/include/XML/Conversions.h b/DDCore/include/XML/Conversions.h index 2a4e0cfe1..f89015093 100644 --- a/DDCore/include/XML/Conversions.h +++ b/DDCore/include/XML/Conversions.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ #ifndef DD4HEP_COMPACT_CONVERSION_H #define DD4HEP_COMPACT_CONVERSION_H -#define DD4HEP_CONVERSION_NS XML +#define DD4HEP_CONVERSION_NS xml #include "XML/detail/Conversions.h" #undef DD4HEP_CONVERSION_NS diff --git a/DDCore/include/XML/DocumentHandler.h b/DDCore/include/XML/DocumentHandler.h index b8d09e762..ecc5a209c 100644 --- a/DDCore/include/XML/DocumentHandler.h +++ b/DDCore/include/XML/DocumentHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,13 +18,13 @@ #include "XML/XMLElements.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace containing utilities to parse XML files using XercesC or TinyXML - namespace XML { + namespace xml { // Forward declarations - class DocumentErrorHandler; + class DocumentErrorHandle_tr; class UriReader; /// Class supporting to read and parse XML documents. @@ -76,5 +76,5 @@ namespace DD4hep { }; } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_XML_DOCUMENTHANDLER_H */ diff --git a/DDCore/include/XML/Evaluator.h b/DDCore/include/XML/Evaluator.h index 77883f2bb..10f9fdb93 100644 --- a/DDCore/include/XML/Evaluator.h +++ b/DDCore/include/XML/Evaluator.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDCore/include/XML/Helper.h b/DDCore/include/XML/Helper.h index 52994a63c..69841fdfd 100644 --- a/DDCore/include/XML/Helper.h +++ b/DDCore/include/XML/Helper.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,43 +14,25 @@ #define DD4HEP_XML_HELPER_H // Framework include files -#include "XML/XMLDetector.h" -#include "XML/XMLChildValue.h" -#include "DD4hep/LCDD.h" +#include "XML/XML.h" +#include "DD4hep/Detector.h" #include "DD4hep/Factories.h" #include "DD4hep/DD4hepUnits.h" -// Shortcuts to elements of the XML namespace -typedef DD4hep::XML::Tag_t xml_tag_t; -typedef DD4hep::XML::Attribute xml_attr_t; -typedef DD4hep::XML::Collection_t xml_coll_t; -typedef DD4hep::XML::Handle_t xml_h; -typedef DD4hep::XML::Element xml_elt_t; -typedef DD4hep::XML::RefElement xml_ref_t; -typedef DD4hep::XML::DetElement xml_det_t; -typedef DD4hep::XML::Component xml_comp_t; -typedef DD4hep::XML::Dimension xml_dim_t; -typedef DD4hep::XML::ChildValue xml_val_t; -typedef DD4hep::XML::Document xml_doc_t; -typedef DD4hep::XML::DocumentHolder xml_doc_holder_t; -typedef DD4hep::XML::DocumentHandler xml_handler_t; -typedef DD4hep::XML::Strng_t Unicode; -typedef DD4hep::Geometry::LCDD lcdd_t; - /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { /// std::string conversion of XML strings (e.g. Unicode for Xerces-C) - static inline std::string _toString(const DD4hep::XML::XmlChar* value) { - return XML::_toString(value); + static inline std::string _toString(const dd4hep::xml::XmlChar* value) { + return xml::_toString(value); } /// std::string conversion of arbitrary entities including user defined formatting. template <typename T> inline std::string _toString(T value, const char* fmt) { - return XML::_toString(value, fmt); + return xml::_toString(value, fmt); } } } diff --git a/DDCore/include/XML/Layering.h b/DDCore/include/XML/Layering.h index 50597abcb..2e3ec7075 100644 --- a/DDCore/include/XML/Layering.h +++ b/DDCore/include/XML/Layering.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ #include <vector> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Class to describe the slice of one layer in a layering stack /** @@ -35,20 +35,16 @@ namespace DD4hep { double _thickness; std::string _material; /// Initializing constructor - LayerSlice(bool s, double t, const std::string& m); + LayerSlice(bool sens, double thick, const std::string& mat); /// Copy constructor - LayerSlice(const LayerSlice& c); + LayerSlice(const LayerSlice& copy) = default; /// Assignment operator - LayerSlice& operator=(const LayerSlice& c); + LayerSlice& operator=(const LayerSlice& copy) = default; }; /// Initializing constructor - inline LayerSlice::LayerSlice(bool s, double t, const std::string& m) - : _sensitive(s), _thickness(t), _material(m) { - } - /// Copy constructor - inline LayerSlice::LayerSlice(const LayerSlice& c) - : _sensitive(c._sensitive), _thickness(c._thickness), _material(c._material) { + inline LayerSlice::LayerSlice(bool sens, double thick, const std::string& mat) + : _sensitive(sens), _thickness(thick), _material(mat) { } /// Class to describe one layer in a layering stack @@ -59,16 +55,16 @@ namespace DD4hep { */ class Layer { public: - double _thickness; - double _preOffset; + double _thickness = 0.0; + double _preOffset = 0.0; std::vector<LayerSlice> _slices; /// Default constructor - Layer(); + Layer() = default; /// Copy constructor - Layer(const Layer& c); + Layer(const Layer& copy) = default; /// Assignment operator - Layer& operator=(const Layer& c); + Layer& operator=(const Layer& copy) = default; void compute(); double thickness() const { @@ -77,16 +73,11 @@ namespace DD4hep { double thicknessWithPreOffset() const { return _thickness + _preOffset; } - void add(const LayerSlice& s) { - _slices.push_back(s); + void add(const LayerSlice& slice) { + _slices.push_back(slice); } }; - /// Default constructor - inline Layer::Layer() : _thickness(0.), _preOffset(0.) { - } - - /// Class to describe a layering stack /** * \author M.Frank @@ -97,17 +88,13 @@ namespace DD4hep { public: std::vector<Layer*> _layers; /// Default constructor - LayerStack(); + LayerStack() = default; /// Copy constructor - LayerStack(const LayerStack& c); + LayerStack(const LayerStack& copy) = default; /// Default destructor - ~LayerStack() { - } + ~LayerStack() = default; /// Assignment operator - LayerStack& operator=(const LayerStack& c) { - if ( &c != this ) _layers = c._layers; - return *this; - } + LayerStack& operator=(const LayerStack& copy) = default; std::vector<Layer*>& layers() { return _layers; } @@ -120,14 +107,6 @@ namespace DD4hep { } }; - /// Default constructor - inline LayerStack::LayerStack() { - } - /// Copy constructor - inline LayerStack::LayerStack(const LayerStack& c) - : _layers(c._layers) { - } - /// Class to convert a layering object from the compact notation /** * \author M.Frank @@ -138,11 +117,11 @@ namespace DD4hep { public: LayerStack _stack; /// Default constructor - Layering(); + Layering() = default; /// Initializing constructor - Layering(XML::Element e); + Layering(xml::Element element); /// Default destructor - virtual ~Layering(); + ~Layering() = default; std::vector<Layer*>& layers() { return _stack.layers(); @@ -152,14 +131,14 @@ namespace DD4hep { double totalThickness() const { return _stack.totalThickness(); } - double singleLayerThickness(XML::Element e) const; - double absorberThicknessInLayer(XML::Element e) const; - void sensitivePositionsInLayer(XML::Element e,std::vector<double>& sens_pos) const; + double singleLayerThickness(xml::Element e) const; + double absorberThicknessInLayer(xml::Element e) const; + void sensitivePositionsInLayer(xml::Element e,std::vector<double>& sens_pos) const; }; /// Namespace containing utilities to parse XML files using XercesC or TinyXML - namespace XML { + namespace xml { /// XML converter for layering objects /** @@ -180,5 +159,5 @@ namespace DD4hep { : Element(e) { } } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_LAYERING_H */ diff --git a/DDCore/include/XML/Printout.h b/DDCore/include/XML/Printout.h index 01c169943..f09259dbb 100644 --- a/DDCore/include/XML/Printout.h +++ b/DDCore/include/XML/Printout.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ #ifndef DD4HEP_DDCORE_XML_PRINTOUT_H #define DD4HEP_DDCORE_XML_PRINTOUT_H -// Forwarding printout functionality to DD4hep +// Forwarding printout functionality to dd4hep /** Note: This is necessary to use the XML functionality as a standalone * utility without the need to externalize the world. * diff --git a/DDCore/include/XML/UnicodeValues.h b/DDCore/include/XML/UnicodeValues.h index f9b926ccd..f997ca172 100644 --- a/DDCore/include/XML/UnicodeValues.h +++ b/DDCore/include/XML/UnicodeValues.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -218,7 +218,7 @@ UNICODE (label); UNICODE (ladder); UNICODE (layer); UNICODE (layers); -UNICODE (lcdd); +UNICODE (description); UNICODE (lccdd); UNICODE (length); UNICODE (limit); diff --git a/DDCore/include/XML/UriReader.h b/DDCore/include/XML/UriReader.h index 11d828a49..b2f54a0e4 100644 --- a/DDCore/include/XML/UriReader.h +++ b/DDCore/include/XML/UriReader.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,10 +17,10 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace containing utilities to parse XML files using XercesC or TinyXML - namespace XML { + namespace xml { /// Class supporting to read data given a URI /** @@ -92,6 +92,6 @@ namespace DD4hep { virtual void parserLoaded(const std::string& system_id, UserContext* ctxt) override; }; - } /* End namespace XML */ -} /* End namespace DD4hep */ + } /* End namespace xml */ +} /* End namespace dd4hep */ #endif /* DD4HEP_XML_URIREADER_H */ diff --git a/DDCore/include/XML/Utilities.h b/DDCore/include/XML/Utilities.h index dae9a38c4..42bbe65eb 100644 --- a/DDCore/include/XML/Utilities.h +++ b/DDCore/include/XML/Utilities.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,22 +11,22 @@ // //========================================================================== -#ifndef DD4hep_XML_XMLUTILITIES_H -#define DD4hep_XML_XMLUTILITIES_H +#ifndef dd4hep_XML_XMLUTILITIES_H +#define dd4hep_XML_XMLUTILITIES_H // Framework include files #include "XML/Conversions.h" #include "XML/XMLElements.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { /// Create a solid shape using the plugin mechanism from the attributes of the XML element - Geometry::Solid createShape(Geometry::LCDD& lcdd, const std::string& shape_type, XML::Element element); + Solid createShape(Detector& description, const std::string& shape_type, xml::Element element); /** Create an envelope volume that is placed into the world volume (the parent volume of sdet) from an xml @@ -42,8 +42,8 @@ namespace DD4hep { @endverbatim * @author S.Lu DESY, F. Gaede CERN/DESY */ - Geometry::Volume createPlacedEnvelope( DD4hep::Geometry::LCDD& lcdd, DD4hep::XML::Handle_t e , - DD4hep::Geometry::DetElement sdet ) ; + Volume createPlacedEnvelope( dd4hep::Detector& description, dd4hep::xml::Handle_t e , + dd4hep::DetElement sdet ) ; @@ -54,8 +54,8 @@ namespace DD4hep { @endverbatim * @author F.Gaede, DESY */ - void setDetectorTypeFlag( DD4hep::XML::Handle_t e, DD4hep::Geometry::DetElement sdet ) ; + void setDetectorTypeFlag( dd4hep::xml::Handle_t e, dd4hep::DetElement sdet ) ; - } /* End namespace XML */ -} /* End namespace DD4hep */ -#endif /* DD4hep_XML_XMLUTILITIES_H */ + } /* End namespace xml */ +} /* End namespace dd4hep */ +#endif /* dd4hep_XML_XMLUTILITIES_H */ diff --git a/DDCore/include/XML/XML.h b/DDCore/include/XML/XML.h index 89ebc5bec..64cba6293 100644 --- a/DDCore/include/XML/XML.h +++ b/DDCore/include/XML/XML.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,16 +16,25 @@ #include "XML/XMLTags.h" #include "XML/XMLDimension.h" +#include "XML/XMLDetector.h" +#include "XML/XMLChildValue.h" #include "XML/DocumentHandler.h" -typedef DD4hep::XML::Handle_t xml_h; -typedef DD4hep::XML::Tag_t xml_tag_t; -typedef DD4hep::XML::Attribute xml_attr_t; -typedef DD4hep::XML::Collection_t xml_coll_t; -typedef DD4hep::XML::Element xml_elt_t; -typedef DD4hep::XML::RefElement xml_ref_t; -typedef DD4hep::XML::Dimension xml_dim_t; -typedef DD4hep::XML::Document xml_doc_t; -typedef DD4hep::XML::Strng_t Unicode; +// Useful shortcuts to process XML structures. +typedef dd4hep::xml::Strng_t Unicode; +typedef dd4hep::xml::Handle_t xml_h; +typedef dd4hep::xml::Tag_t xml_tag_t; +typedef dd4hep::xml::Attribute xml_attr_t; +typedef dd4hep::xml::Collection_t xml_coll_t; +typedef dd4hep::xml::Element xml_elt_t; +typedef dd4hep::xml::RefElement xml_ref_t; +typedef dd4hep::xml::Dimension xml_dim_t; +typedef dd4hep::xml::DetElement xml_det_t; +typedef dd4hep::xml::Component xml_comp_t; +typedef dd4hep::xml::ChildValue xml_val_t; +typedef dd4hep::xml::Document xml_doc_t; +typedef dd4hep::xml::Document xml_doc_t; +typedef dd4hep::xml::DocumentHolder xml_doc_holder_t; +typedef dd4hep::xml::DocumentHandler xml_handler_t; #endif // DD4HEP_DDCORE_XML_XML_H diff --git a/DDCore/include/XML/XMLChildValue.h b/DDCore/include/XML/XMLChildValue.h index 62ee0e688..0013fd183 100644 --- a/DDCore/include/XML/XMLChildValue.h +++ b/DDCore/include/XML/XMLChildValue.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ // Framework include files #include "XML/XMLTags.h" -#define DD4HEP_DIMENSION_NS XML +#define DD4HEP_DIMENSION_NS xml #include "XML/detail/ChildValue.h" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/XML/XMLChildValue.inl b/DDCore/include/XML/XMLChildValue.inl index 2e9d54180..346e197ab 100644 --- a/DDCore/include/XML/XMLChildValue.inl +++ b/DDCore/include/XML/XMLChildValue.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ // Framework include files #include "XML/XMLChildValue.h" -#define DD4HEP_DIMENSION_NS XML +#define DD4HEP_DIMENSION_NS xml #include "XML/detail/ChildValue.inl" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/XML/XMLDetector.h b/DDCore/include/XML/XMLDetector.h index 164cefdb7..6f0b63fae 100644 --- a/DDCore/include/XML/XMLDetector.h +++ b/DDCore/include/XML/XMLDetector.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ // Framework include files #include "XML/XMLDimension.h" -#define DD4HEP_DIMENSION_NS XML +#define DD4HEP_DIMENSION_NS xml #include "XML/detail/Detector.h" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/XML/XMLDimension.h b/DDCore/include/XML/XMLDimension.h index 7af7c2452..9cdc52b5a 100644 --- a/DDCore/include/XML/XMLDimension.h +++ b/DDCore/include/XML/XMLDimension.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "XML/XMLElements.h" #include "XML/XMLTags.h" -#define DD4HEP_DIMENSION_NS XML +#define DD4HEP_DIMENSION_NS xml #include "XML/detail/Dimension.h" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/XML/XMLDimension.inl b/DDCore/include/XML/XMLDimension.inl index cda64b76c..a9af04f48 100644 --- a/DDCore/include/XML/XMLDimension.inl +++ b/DDCore/include/XML/XMLDimension.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ #include "XML/XMLDimension.h" -#define DD4HEP_DIMENSION_NS XML +#define DD4HEP_DIMENSION_NS xml #include "XML/detail/Dimension.inl" #undef DD4HEP_DIMENSION_NS diff --git a/DDCore/include/XML/XMLElements.h b/DDCore/include/XML/XMLElements.h index f2922d666..be63afeb1 100644 --- a/DDCore/include/XML/XMLElements.h +++ b/DDCore/include/XML/XMLElements.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -31,10 +31,10 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { typedef const XmlAttr* Attribute; @@ -234,7 +234,7 @@ namespace DD4hep { * -- unicode * -- std::string * -- const char*. - * Internally a copy representation as an std::string is kept. + * detaillly a copy representation as an std::string is kept. * * \author M.Frank * \version 1.0 @@ -682,7 +682,7 @@ namespace DD4hep { /// User abstraction class to manipulate XML elements within a document /** * User class encapsulating a DOM element - * using the Handle helper. + * using the Handle_t helper. * This is the main class we interact with when * analysing the xml documents for constructing * sub-detectors etc. @@ -898,5 +898,5 @@ namespace DD4hep { void dump_tree(Document doc, std::ostream& os); } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_XMLELEMENTS_H */ diff --git a/DDCore/include/XML/XMLParsers.h b/DDCore/include/XML/XMLParsers.h index 8eca92361..95a3a1875 100644 --- a/DDCore/include/XML/XMLParsers.h +++ b/DDCore/include/XML/XMLParsers.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,37 +23,37 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class OpaqueDataBlock; /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { /// Set debug print level for this module. Default is OFF bool setXMLParserDebug(bool new_value); - /// Convert rotation XML objects to DD4hep::Geometry::RotationZYX - /** <rotation x="0.5" y="0" z="0"/> => DD4hep::Geometry::RotationZYX + /// Convert rotation XML objects to dd4hep::RotationZYX + /** <rotation x="0.5" y="0" z="0"/> => dd4hep::RotationZYX * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ - void parse(Handle_t e, Geometry::RotationZYX& rot); + void parse(Handle_t e, RotationZYX& rot); - /// Convert XML position objects to DD4hep::Geometry::Position + /// Convert XML position objects to dd4hep::Position /** - * <position x="0.5" y="0" z="0"/> => DD4hep::Geometry::Position + * <position x="0.5" y="0" z="0"/> => dd4hep::Position * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ - void parse(Handle_t e, Geometry::Position& pos); + void parse(Handle_t e, Position& pos); - /// Convert XML pivot objects to DD4hep::Geometry::Translation3D objects + /// Convert XML pivot objects to dd4hep::Translation3D objects /** * <pivot x="0.5" y="0" z="0"/> * @@ -61,9 +61,9 @@ namespace DD4hep { * \version 1.0 * \date 01/04/2014 */ - void parse(Handle_t e, Geometry::Translation3D& tr); + void parse(Handle_t e, Translation3D& tr); - /// Convert alignment delta objects to Alignments::Delta + /// Convert alignment delta objects to Delta /** * A generic alignment transformation is defined by * - a translation in 3D space identified in XML as a @@ -86,11 +86,11 @@ namespace DD4hep { * \version 1.0 * \date 01/04/2014 */ - void parse(Handle_t e, Alignments::Delta& delta); + void parse(Handle_t e, Delta& delta); /// Parse delta into an opaque data block /** - * See void parse(Handle_t e, Alignments::Delta& delta) for details. + * See void parse(Handle_t e, Delta& delta) for details. * * \author M.Frank * \version 1.0 @@ -124,6 +124,6 @@ namespace DD4hep { void parse_sequence(Handle_t e, OpaqueDataBlock& block); - } /* End namespace XML */ -} /* End namespace DD4hep */ + } /* End namespace xml */ +} /* End namespace dd4hep */ #endif /* End DDCORE_XML_XMLPARSERS_H */ diff --git a/DDCore/include/XML/XMLTags.h b/DDCore/include/XML/XMLTags.h index 6e563219b..810c404a5 100644 --- a/DDCore/include/XML/XMLTags.h +++ b/DDCore/include/XML/XMLTags.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,17 +14,17 @@ #ifndef DD4HEP_XML_TAGS_H #define DD4HEP_XML_TAGS_H -#define DECLARE_UNICODE_TAG(x) namespace DD4hep { namespace XML { extern const Tag_t Unicode_##x (#x); }} +#define DECLARE_UNICODE_TAG(x) namespace dd4hep { namespace xml { extern const Tag_t Unicode_##x (#x); }} // Framework include files #include "XML/XMLElements.h" #define UNICODE(x) extern const Tag_t Unicode_##x /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { #include "XML/UnicodeValues.h" } } @@ -32,8 +32,8 @@ namespace DD4hep { #undef UNICODE // Helpers to access tags and attributes quickly without specifying explicitly namespaces -#define _DD4hep_Unicode_Item(a) Unicode_##a -#define _U(a) ::DD4hep::XML::Unicode_##a -#define _Unicode(a) ::DD4hep::XML::Strng_t(#a) +#define _dd4hep_Unicode_Item(a) Unicode_##a +#define _U(a) ::dd4hep::xml::Unicode_##a +#define _Unicode(a) ::dd4hep::xml::Strng_t(#a) #endif // DD4HEP_XML_TAGS_H diff --git a/DDCore/include/XML/config.h b/DDCore/include/XML/config.h index 4d88bfb67..b742ea7a0 100644 --- a/DDCore/include/XML/config.h +++ b/DDCore/include/XML/config.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,10 +26,10 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { class XmlElement; class XmlDocument; class XmlNodeList; diff --git a/DDCore/include/XML/detail/ChildValue.h b/DDCore/include/XML/detail/ChildValue.h index 99d12a144..339b1e5b4 100644 --- a/DDCore/include/XML/detail/ChildValue.h +++ b/DDCore/include/XML/detail/ChildValue.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class NamedObject; @@ -28,7 +28,7 @@ namespace DD4hep { /// Namespace for the AIDA detector description toolkit supporting JSON utilities namespace DD4HEP_DIMENSION_NS { - /// XML Handle to xml elements with predefined child access + /// XML Handle_t to xml elements with predefined child access /** * Helper class to access any field in a xml tag in a * very easy way. @@ -66,7 +66,7 @@ namespace DD4hep { ChildValue() : Element(Handle_t(0)) { } - /// Constructor from Handle + /// Constructor from Handle_t ChildValue(Handle_t e) : Element(e) { } @@ -374,4 +374,4 @@ namespace DD4hep { }; } /* End namespace DD4HEP_DIMENSION_NS */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ diff --git a/DDCore/include/XML/detail/ChildValue.imp b/DDCore/include/XML/detail/ChildValue.imp index d482a5880..160836212 100644 --- a/DDCore/include/XML/detail/ChildValue.imp +++ b/DDCore/include/XML/detail/ChildValue.imp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDCore/include/XML/detail/ChildValue.inl b/DDCore/include/XML/detail/ChildValue.inl index d7da2ac24..50a3d67eb 100644 --- a/DDCore/include/XML/detail/ChildValue.inl +++ b/DDCore/include/XML/detail/ChildValue.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,11 +21,11 @@ #define XML_CHILDVALUE_childValue(name,type) \ - m_element.child(_DD4hep_Unicode_Item(name)).attr<type>(_DD4hep_Unicode_Item(value)) + m_element.child(_dd4hep_Unicode_Item(name)).attr<type>(_dd4hep_Unicode_Item(value)) #define XML_CHILDVALUE_childValueDefault(name,type,def) \ - Handle_t __h = m_element.child(_DD4hep_Unicode_Item(name),false); \ - if ( __h.ptr() && __h.hasAttr(_DD4hep_Unicode_Item(value)) ) return __h.attr < type > (_DD4hep_Unicode_Item(value)); \ + Handle_t __h = m_element.child(_dd4hep_Unicode_Item(name),false); \ + if ( __h.ptr() && __h.hasAttr(_dd4hep_Unicode_Item(value)) ) return __h.attr < type > (_dd4hep_Unicode_Item(value)); \ return def; #define XML_CHILDVALUE_ACCESSOR(type,name) \ @@ -33,9 +33,9 @@ #define XML_CHILDVALUE_ACCESSOR_DEFAULT(name,type,dressing) \ type ChildValue::name(type default_val) const { \ - Handle_t __h = m_element.child(_DD4hep_Unicode_Item(name),false); \ + Handle_t __h = m_element.child(_dd4hep_Unicode_Item(name),false); \ if ( __h.ptr() ) { \ - const XmlChar* val = __h.attr_value_nothrow(_DD4hep_Unicode_Item(value)); \ + const XmlChar* val = __h.attr_value_nothrow(_dd4hep_Unicode_Item(value)); \ return val ? dressing(val) : default_val; } \ return default_val; } diff --git a/DDCore/include/XML/detail/Conversions.h b/DDCore/include/XML/detail/Conversions.h index 53bbe761e..7da6ba1ff 100644 --- a/DDCore/include/XML/detail/Conversions.h +++ b/DDCore/include/XML/detail/Conversions.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,17 +24,17 @@ #include <iostream> // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities namespace DD4HEP_CONVERSION_NS { class Handle_t; } - /// Basic conversion objects for handling DD4hep XML files. + /// Basic conversion objects for handling dd4hep XML files. /** * \author M.Frank * \version 1.0 @@ -44,16 +44,16 @@ namespace DD4hep { typedef T to_type; typedef void* user_param; /// Reference to the detector description object - Geometry::LCDD& lcdd; + Detector& description; /// Reference to optional user defined parameter user_param param; user_param optional; /// Initializing constructor of the functor - Converter(Geometry::LCDD& l) : lcdd(l), param(0), optional(0) { } + Converter(Detector& l) : description(l), param(0), optional(0) { } /// Initializing constructor of the functor with initialization of the user parameter - Converter(Geometry::LCDD& l, user_param p) : lcdd(l), param(p), optional(0) { } + Converter(Detector& l, user_param p) : description(l), param(p), optional(0) { } /// Initializing constructor of the functor with initialization of the user parameter - Converter(Geometry::LCDD& l, user_param p, user_param o) : lcdd(l), param(p), optional(o) { } + Converter(Detector& l, user_param p, user_param o) : description(l), param(p), optional(o) { } /// Callback operator to be specialized depending on the element type void operator()(ARG handle) const; /// Typed access to the 1rst. user parameter (unchecked) @@ -63,4 +63,4 @@ namespace DD4hep { /// Typed access to the 2nd. user parameter (unchecked) template <typename TYPE> TYPE* _option() const { return (TYPE*) optional; } }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ diff --git a/DDCore/include/XML/detail/Detector.h b/DDCore/include/XML/detail/Detector.h index ff6a86331..4e093a93c 100644 --- a/DDCore/include/XML/detail/Detector.h +++ b/DDCore/include/XML/detail/Detector.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class NamedObject; @@ -28,7 +28,7 @@ namespace DD4hep { /// Namespace for the AIDA detector description toolkit supporting JSON utilities namespace DD4HEP_DIMENSION_NS { - /// Generic Handle class extending the generic handle Dimension + /// Generic Handle_t class extending the generic handle Dimension /** * Helper class to access any field in a xml tag. * Specialized for attributes of a detector sub-element. @@ -38,7 +38,7 @@ namespace DD4hep { * \ingroup DD4HEP_XML */ struct Component: public Dimension { - /// Constructor from Handle + /// Constructor from Handle_t Component(Handle_t e) : Dimension(e) { } @@ -58,7 +58,7 @@ namespace DD4hep { NamedObject* createShape() const; }; - /// XML Handle class extending the XML handle Dimension + /// XML Handle_t class extending the XML handle Dimension /** * Helper class to access any field in a xml tag. * Specialized for some of the attributes of a detector element. @@ -68,7 +68,7 @@ namespace DD4hep { * \ingroup DD4HEP_XML */ struct DetElement: public Dimension { - /// Constructor from Handle + /// Constructor from Handle_t DetElement(Handle_t e) : Dimension(e) { } @@ -98,4 +98,4 @@ namespace DD4hep { }; } /* End namespace DD4HEP_DIMENSION_NS */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ diff --git a/DDCore/include/XML/detail/Detector.imp b/DDCore/include/XML/detail/Detector.imp index 524aba7fb..d08bda102 100644 --- a/DDCore/include/XML/detail/Detector.imp +++ b/DDCore/include/XML/detail/Detector.imp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,11 +22,11 @@ // Framework include files #include "DD4hep/Plugins.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" using namespace std; -namespace Geometry { class LCDD; } +namespace detail { class Detector; } string Component::materialStr() const { return m_element.attr < string > (_U(material)); @@ -44,17 +44,17 @@ bool Component::isRadiator() const { return val == 'T' || val == 'Y'; } -DD4hep::NamedObject* Component::createShape() const { - using namespace DD4hep::Geometry; +dd4hep::NamedObject* Component::createShape() const { + using namespace dd4hep::detail; Dimension child_dim(m_element); string typ = child_dim.typeStr(); string fac = typ + "__shape_constructor"; Handle_t solid_elt = m_element; - LCDD* lcdd = 0; - NamedObject* solid = PluginService::Create<NamedObject*>(fac, lcdd, &solid_elt); + Detector* description = 0; + NamedObject* solid = PluginService::Create<NamedObject*>(fac, description, &solid_elt); if ( !solid ) { PluginDebug dbg; - PluginService::Create<NamedObject*>(typ, lcdd, &solid_elt); + PluginService::Create<NamedObject*>(typ, description, &solid_elt); throw runtime_error("Failed to create solid of type " + typ + ". " + dbg.missingFactory(typ)); } return solid; diff --git a/DDCore/include/XML/detail/Dimension.h b/DDCore/include/XML/detail/Dimension.h index 7256c29d4..92149348f 100644 --- a/DDCore/include/XML/detail/Dimension.h +++ b/DDCore/include/XML/detail/Dimension.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,12 +20,12 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting JSON utilities namespace DD4HEP_DIMENSION_NS { - /// XML Handle to xml elements with predefined attribute access + /// XML Handle_t to xml elements with predefined attribute access /** * Helper class to access any field in a xml tag in a * very easy way. @@ -55,7 +55,7 @@ namespace DD4hep { Dimension() : Element(Handle_t(0)) { } - /// Constructor from Handle + /// Constructor from Handle_t Dimension(Handle_t e) : Element(e) { } @@ -571,4 +571,4 @@ namespace DD4hep { }; } /* End namespace DD4HEP_DIMENSION_NS */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ diff --git a/DDCore/include/XML/detail/Dimension.imp b/DDCore/include/XML/detail/Dimension.imp index 0a26b9415..7674636ff 100644 --- a/DDCore/include/XML/detail/Dimension.imp +++ b/DDCore/include/XML/detail/Dimension.imp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -185,43 +185,43 @@ XML_CHILD_ACCESSOR_XML_DIM(tubs) XML_CHILD_ACCESSOR_XML_DIM(staves) XML_CHILD_ACCESSOR_XML_DIM(beampipe) -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::padType() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::padType() const { return m_element.attr < std::string > (_U(pads)); } -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::nameStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::nameStr() const { return m_element.attr < std::string > (_U(name)); } -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::refStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::refStr() const { return m_element.attr < std::string > (_U(ref)); } -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::typeStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::typeStr() const { return m_element.attr < std::string > (_U(type)); } /// Access "value" attribute as STL std::string -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::valueStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::valueStr() const { return m_element.attr < std::string > (_U(value)); } -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::regionStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::regionStr() const { return m_element.hasAttr(_U(region)) ? m_element.attr < std::string > (_U(region)) : std::string(); } -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::limitsStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::limitsStr() const { return m_element.hasAttr(_U(limits)) ? m_element.attr < std::string > (_U(limits)) : std::string(); } -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::visStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::visStr() const { return m_element.hasAttr(_U(vis)) ? m_element.attr < std::string > (_U(vis)) : std::string(); } -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::readoutStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::readoutStr() const { return m_element.hasAttr(_U(readout)) ? m_element.attr < std::string > (_U(readout)) : std::string(); } -std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::moduleStr() const { +std::string dd4hep::DD4HEP_DIMENSION_NS::Dimension::moduleStr() const { return m_element.hasAttr(_U(module)) ? m_element.attr < std::string > (_U(module)) : std::string(); } diff --git a/DDCore/include/XML/detail/Dimension.inl b/DDCore/include/XML/detail/Dimension.inl index 9c2f5de0d..f7c954d9c 100644 --- a/DDCore/include/XML/detail/Dimension.inl +++ b/DDCore/include/XML/detail/Dimension.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,33 +19,33 @@ */ -#define XML_ATTR_NS_ACCESSOR(type,ns,name) type ns::name() const { return m_element.attr<type>(_DD4hep_Unicode_Item(name)); } +#define XML_ATTR_NS_ACCESSOR(type,ns,name) type ns::name() const { return m_element.attr<type>(_dd4hep_Unicode_Item(name)); } #define XML_ATTR_NS_ACCESSOR_DEFAULT(type,ns,name,dressing) \ type ns::name(type default_val) const { \ - const XmlChar* val = m_element.attr_value_nothrow(_DD4hep_Unicode_Item(name)); \ + const XmlChar* val = m_element.attr_value_nothrow(_dd4hep_Unicode_Item(name)); \ return val ? dressing(val) : default_val; } #define XML_ATTR_NS_ACCESSOR_DOUBLE(ns,name) \ XML_ATTR_NS_ACCESSOR(double,ns,name) \ - XML_ATTR_NS_ACCESSOR_DEFAULT(double,ns,name,DD4hep:: DD4HEP_DIMENSION_NS ::_toDouble) + XML_ATTR_NS_ACCESSOR_DEFAULT(double,ns,name,dd4hep:: DD4HEP_DIMENSION_NS ::_toDouble) #define XML_ATTR_NS_ACCESSOR_INT(ns,name) \ XML_ATTR_NS_ACCESSOR(int,ns,name) \ - XML_ATTR_NS_ACCESSOR_DEFAULT(int,ns,name,DD4hep:: DD4HEP_DIMENSION_NS ::_toInt) + XML_ATTR_NS_ACCESSOR_DEFAULT(int,ns,name,dd4hep:: DD4HEP_DIMENSION_NS ::_toInt) #define XML_ATTR_NS_ACCESSOR_STRING(ns,name) \ XML_ATTR_NS_ACCESSOR(std::string,ns,name) \ - XML_ATTR_NS_ACCESSOR_DEFAULT(std::string,ns,name,DD4hep:: DD4HEP_DIMENSION_NS ::_toString) + XML_ATTR_NS_ACCESSOR_DEFAULT(std::string,ns,name,dd4hep:: DD4HEP_DIMENSION_NS ::_toString) -#define XML_ATTR_ACCESSOR(type,name) XML_ATTR_NS_ACCESSOR(type,DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name) -#define XML_ATTR_ACCESSOR_DEFAULT(name,type,dressing) XML_ATTR_NS_ACCESSOR_DEFAULT(type,DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,dressing) -#define XML_ATTR_ACCESSOR_DOUBLE(name) XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name) +#define XML_ATTR_ACCESSOR(type,name) XML_ATTR_NS_ACCESSOR(type,dd4hep:: DD4HEP_DIMENSION_NS ::Dimension,name) +#define XML_ATTR_ACCESSOR_DEFAULT(name,type,dressing) XML_ATTR_NS_ACCESSOR_DEFAULT(type,dd4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,dressing) +#define XML_ATTR_ACCESSOR_DOUBLE(name) XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep:: DD4HEP_DIMENSION_NS ::Dimension,name) -#define XML_ATTR_ACCESSOR_INT(name) XML_ATTR_NS_ACCESSOR_DEFAULT(int,DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,_toInt) -#define XML_ATTR_ACCESSOR_BOOL(name) XML_ATTR_NS_ACCESSOR_DEFAULT(bool,DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,_toBool) +#define XML_ATTR_ACCESSOR_INT(name) XML_ATTR_NS_ACCESSOR_DEFAULT(int,dd4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,_toInt) +#define XML_ATTR_ACCESSOR_BOOL(name) XML_ATTR_NS_ACCESSOR_DEFAULT(bool,dd4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,_toBool) #define XML_CHILD_ACCESSOR_XML_DIM(name) \ - DD4hep:: DD4HEP_DIMENSION_NS ::Dimension DD4hep:: DD4HEP_DIMENSION_NS ::Dimension::name(bool throw_if_not_present) const { \ - return m_element.child(_DD4hep_Unicode_Item(name),throw_if_not_present); } + dd4hep:: DD4HEP_DIMENSION_NS ::Dimension dd4hep:: DD4HEP_DIMENSION_NS ::Dimension::name(bool throw_if_not_present) const { \ + return m_element.child(_dd4hep_Unicode_Item(name),throw_if_not_present); } diff --git a/DDCore/include/XML/tinyxml.h b/DDCore/include/XML/tinyxml.h index c893d4085..95660eac5 100644 --- a/DDCore/include/XML/tinyxml.h +++ b/DDCore/include/XML/tinyxml.h @@ -96,7 +96,7 @@ const int TIXML_MAJOR_VERSION = 2; const int TIXML_MINOR_VERSION = 5; const int TIXML_PATCH_VERSION = 2; -/* Internal structure for tracking location of items +/* detaill structure for tracking location of items in the XML file. */ struct TiXmlCursor { @@ -1229,7 +1229,7 @@ public: GetText() will return "This is ". WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are + similarly named TiXmlHandle_t::Text() and TiXmlNode::ToText() which are safe type casts on the referenced node. */ const char* GetText() const; @@ -1733,8 +1733,8 @@ private: }; /** - A TiXmlHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml + A TiXmlHandle_t is a class that wraps a node pointer with null checks; this is + an incredibly useful thing. Note that TiXmlHandle_t is not part of the TinyXml DOM structure. It is a separate utility class. Take an example: @@ -1766,13 +1766,13 @@ private: // Finally do something useful. @endverbatim - And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe + And that doesn't even cover "else" cases. TiXmlHandle_t addresses the verbosity + of such code. A TiXmlHandle_t checks for null pointers so it is perfectly safe and correct to use: @verbatim - TiXmlHandle docHandle( &document ); - TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); + TiXmlHandle_t docHandle_t( &document ); + TiXmlElement* child2 = docHandle_t.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); if ( child2 ) { // do something useful @@ -1782,7 +1782,7 @@ private: It is also safe to copy handles - internally they are nothing more than node pointers. @verbatim - TiXmlHandle handleCopy = handle; + TiXmlHandle_t handleCopy = handle; @endverbatim What they should not be used for is iteration: @@ -1791,7 +1791,7 @@ private: int i=0; while ( true ) { - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); + TiXmlElement* child = docHandle_t.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); if ( !child ) break; // do something @@ -1804,7 +1804,7 @@ private: to. Instead, prefer: @verbatim - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); + TiXmlElement* child = docHandle_t.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); for( child; child; child=child->NextSiblingElement() ) { @@ -1812,61 +1812,61 @@ private: } @endverbatim */ -class TiXmlHandle { +class TiXmlHandle_t { public: /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle(TiXmlNode* _node) { + TiXmlHandle_t(TiXmlNode* _node) { this->node = _node; } /// Copy constructor - TiXmlHandle(const TiXmlHandle& ref) { + TiXmlHandle_t(const TiXmlHandle_t& ref) { this->node = ref.node; } - TiXmlHandle operator=(const TiXmlHandle& ref) { + TiXmlHandle_t operator=(const TiXmlHandle_t& ref) { this->node = ref.node; return *this; } /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; + TiXmlHandle_t FirstChild() const; /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild(const char * value) const; + TiXmlHandle_t FirstChild(const char * value) const; /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; + TiXmlHandle_t FirstChildElement() const; /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement(const char * value) const; + TiXmlHandle_t FirstChildElement(const char * value) const; /** Return a handle to the "index" child with the given name. The first child is 0, the second 1, etc. */ - TiXmlHandle Child(const char* value, int index) const; + TiXmlHandle_t Child(const char* value, int index) const; /** Return a handle to the "index" child. The first child is 0, the second 1, etc. */ - TiXmlHandle Child(int index) const; + TiXmlHandle_t Child(int index) const; /** Return a handle to the "index" child element with the given name. The first child element is 0, the second 1, etc. Note that only TiXmlElements are indexed: other types are not counted. */ - TiXmlHandle ChildElement(const char* value, int index) const; + TiXmlHandle_t ChildElement(const char* value, int index) const; /** Return a handle to the "index" child element. The first child element is 0, the second 1, etc. Note that only TiXmlElements are indexed: other types are not counted. */ - TiXmlHandle ChildElement(int index) const; + TiXmlHandle_t ChildElement(int index) const; #ifdef TIXML_USE_STL - TiXmlHandle FirstChild(const std::string& _value) const { + TiXmlHandle_t FirstChild(const std::string& _value) const { return FirstChild(_value.c_str()); } - TiXmlHandle FirstChildElement(const std::string& _value) const { + TiXmlHandle_t FirstChildElement(const std::string& _value) const { return FirstChildElement(_value.c_str()); } - TiXmlHandle Child(const std::string& _value, int index) const { + TiXmlHandle_t Child(const std::string& _value, int index) const { return Child(_value.c_str(), index); } - TiXmlHandle ChildElement(const std::string& _value, int index) const { + TiXmlHandle_t ChildElement(const std::string& _value, int index) const { return ChildElement(_value.c_str(), index); } #endif diff --git a/DDCore/python/lcdd.py b/DDCore/python/lcdd.py index 3dca749e8..74282ca69 100644 --- a/DDCore/python/lcdd.py +++ b/DDCore/python/lcdd.py @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -14,36 +14,36 @@ from os import path, listdir from functools import partial import SystemOfUnits import math -from ROOT import SetOwnership, DD4hep, TGeoMixture, TGeoMedium, gGeoManager, TNamed - -LCDD = DD4hep.Geometry.LCDD -Constant = DD4hep.Geometry.Constant -Material = DD4hep.Geometry.Material -VisAttr = DD4hep.Geometry.VisAttr -AlignmentEntry = DD4hep.Geometry.AlignmentEntry -Limit = DD4hep.Geometry.Limit -DetElement = DD4hep.Geometry.DetElement -Box = DD4hep.Geometry.Box -Tube = DD4hep.Geometry.Tube -Trapezoid = DD4hep.Geometry.Trapezoid -Volume = DD4hep.Geometry.Volume -PlacedVolume = DD4hep.Geometry.PlacedVolume -Position = DD4hep.Geometry.Position -Rotation = DD4hep.Geometry.Rotation -Handle = DD4hep.Geometry.Handle -Readout = DD4hep.Geometry.Readout -GridXYZ = DD4hep.Geometry.GridXYZ -GlobalGridXY = DD4hep.Geometry.GlobalGridXY -CartesianGridXY = DD4hep.Geometry.CartesianGridXY -NoSegmentation = DD4hep.Geometry.NoSegmentation -GridPhiEta = DD4hep.Geometry.GridPhiEta -GridRPhiEta = DD4hep.Geometry.GridRPhiEta -ProjectiveCylinder = DD4hep.Geometry.ProjectiveCylinder -NonProjectiveCylinder = DD4hep.Geometry.NonProjectiveCylinder -ProjectiveZPlane = DD4hep.Geometry.ProjectiveZPlane -IDDescriptor = DD4hep.Geometry.IDDescriptor - -_toDictionary = DD4hep.Geometry._toDictionary +from ROOT import SetOwnership, dd4hep, TGeoMixture, TGeoMedium, gGeoManager, TNamed + +Detector = dd4hep.Geometry.Detector +Constant = dd4hep.Geometry.Constant +Material = dd4hep.Geometry.Material +VisAttr = dd4hep.Geometry.VisAttr +AlignmentEntry = dd4hep.Geometry.AlignmentEntry +Limit = dd4hep.Geometry.Limit +DetElement = dd4hep.Geometry.DetElement +Box = dd4hep.Geometry.Box +Tube = dd4hep.Geometry.Tube +Trapezoid = dd4hep.Geometry.Trapezoid +Volume = dd4hep.Geometry.Volume +PlacedVolume = dd4hep.Geometry.PlacedVolume +Position = dd4hep.Geometry.Position +Rotation = dd4hep.Geometry.Rotation +Handle = dd4hep.Geometry.Handle +Readout = dd4hep.Geometry.Readout +GridXYZ = dd4hep.Geometry.GridXYZ +GlobalGridXY = dd4hep.Geometry.GlobalGridXY +CartesianGridXY = dd4hep.Geometry.CartesianGridXY +NoSegmentation = dd4hep.Geometry.NoSegmentation +GridPhiEta = dd4hep.Geometry.GridPhiEta +GridRPhiEta = dd4hep.Geometry.GridRPhiEta +ProjectiveCylinder = dd4hep.Geometry.ProjectiveCylinder +NonProjectiveCylinder = dd4hep.Geometry.NonProjectiveCylinder +ProjectiveZPlane = dd4hep.Geometry.ProjectiveZPlane +IDDescriptor = dd4hep.Geometry.IDDescriptor + +_toDictionary = dd4hep.Geometry._toDictionary import xml.etree.ElementTree as xml unique_mat_id = 0x7FFEFEED @@ -55,7 +55,7 @@ constants.update(SystemOfUnits.__dict__) constants.update(math.__dict__) drivers = {} drivers.update(math.__dict__) -drivers.update(DD4hep.Geometry.__dict__) +drivers.update(dd4hep.Geometry.__dict__) #---Enhancing the Element class with dedicated accessors-------------------------- @@ -133,7 +133,7 @@ def load_drivers(*args): #--------------------------------------------------------------------------------- -def process_xmlfile(lcdd, file): +def process_xmlfile(description, file): global current_xmlfile file = file.replace('file:','') root = xml.parse(file).getroot() @@ -141,39 +141,39 @@ def process_xmlfile(lcdd, file): tags = ('includes', 'define', 'materials', 'properties', 'limits', 'display', 'readouts', 'detectors', 'alignments', 'fields', 'sensitive_detectors') if root.tag in tags : - process_tag(lcdd, root) + process_tag(description, root) else : for tag in tags: for e in root.findall(tag): - process_tag(lcdd, e) + process_tag(description, e) current_xmlfile = last_xmlfile -def process_tag(lcdd, elem): +def process_tag(description, elem): if elem.tag == 'detectors' : - lcdd.init() # call init before processing 'detectors' (need world volume) + description.init() # call init before processing 'detectors' (need world volume) procs = globals().get('process_%s'% elem.tag, None) if not procs : procs = drivers.get('process_%s'% elem.tag, None) if procs : - apply(procs,(lcdd, elem)) + apply(procs,(description, elem)) else : print 'XML tag %s not processed!!! No function found.' % elem.tag #-------------------------------------------------------------------------------- def fromXML(xmlfile): print 'Converting Compact file: ', xmlfile - lcdd = LCDD.getInstance() - #lcdd.create() - process_xmlfile(lcdd, xmlfile) - return lcdd + description = Detector.getInstance() + #description.create() + process_xmlfile(description, xmlfile) + return description #--------------------------------------------------------------------------------- -def process_includes(lcdd, elem): +def process_includes(description, elem): for c in elem.findall('gdmlFile'): print 'Adding Gdml file ...', c.get('ref') fname = c.get('ref').replace('file:','') if not path.isabs(fname): fname = path.join(path.dirname(current_xmlfile),fname) - process_xmlfile(lcdd, fname) + process_xmlfile(description, fname) for c in elem.findall('pyBuilder'): print 'Adding PyBuilder ...', c.get('ref') fname = c.get('ref') @@ -183,22 +183,22 @@ def process_includes(lcdd, elem): print 'Adding Alignment file ...', c.get('ref') fname = c.get('ref').replace('file:','') if not path.isabs(fname): fname = path.join(path.dirname(current_xmlfile),fname) - process_xmlfile(lcdd, fname) + process_xmlfile(description, fname) #--------------------------------------------------------------------------------- -def process_info(lcdd, elem): +def process_info(description, elem): pass #--------------------------------------------------------------------------------- -def process_define(lcdd, elem): +def process_define(description, elem): for c in elem.findall('constant'): #print 'Adding constant ...', c.get('name') - lcdd.addConstant(Constant(c.get('name'),c.get('value'))) + description.addConstant(Constant(c.get('name'),c.get('value'))) _toDictionary(c.get('name'),c.get('value')) #-- Make it known to the evaluator constants[c.get('name')] = c.getF('value') #--------------------------------------------------------------------------------- -def process_element(lcdd, elem): +def process_element(description, elem): #print 'Adding element ...', elem.get('name') ename = elem.get('name') tab = gGeoManager.GetElementTable() @@ -208,9 +208,9 @@ def process_element(lcdd, elem): tab.AddElement(atom.get('name'), atom.get('formula'), atom.getI('Z'), atom.getI('value')) #--------------------------------------------------------------------------------- -def process_materials(lcdd, elem): +def process_materials(description, elem): for m in elem.findall('material'): - process_material(lcdd, m) + process_material(description, m) #--------------------------------------------------------------------------------- # <material formula="Ac" name="Actinium" state="solid" > @@ -227,7 +227,7 @@ def process_materials(lcdd, elem): #</material> -def process_material(lcdd, m): +def process_material(description, m): #print 'Adding material ...', m.get('name') density = m.find('D') radlen = m.find('RL') @@ -261,11 +261,11 @@ def process_material(lcdd, m): SetOwnership(medium, False) medium.SetTitle('material') medium.SetUniqueID(unique_mat_id) - lcdd.addMaterial(Handle(medium)) + description.addMaterial(Handle(medium)) #---------------------------------------------------------------------------------- -def process_display(lcdd, elem): +def process_display(description, elem): for v in elem.findall('vis'): #print 'Adding vis ...', v.name visattr = VisAttr(v.name) @@ -287,35 +287,35 @@ def process_display(lcdd, elem): ds = v.get('drawingStyle') if ds == 'wireframe' : visattr.setDrawingStyle(VisAttr.WIREFRAME) #print visattr.toString() - lcdd.addVisAttribute(visattr) + description.addVisAttribute(visattr) -def process_limits(lcdd, elem): +def process_limits(description, elem): # <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> for l in elem.findall('limit'): - limit = Limit(lcdd.document(), l.get('name')) + limit = Limit(description.document(), l.get('name')) limit.setParticles(l.get('particles')) limit.setValue(l.getF('value')) limit.setUnit(l.get('unit')) - lcdd.addLimit(limit) + description.addLimit(limit) #----------------------------------------------------------------------------------- -def process_detectors(lcdd, elem): +def process_detectors(description, elem): for d in elem.findall('detector'): procs = drivers.get('detector_%s'% d.get('type'), None) if procs : - detector = apply(procs,(lcdd, d)) - lcdd.addDetector(detector) + detector = apply(procs,(description, d)) + description.addDetector(detector) else : print 'Detector type %s not found' % d.get('type') #----------------------------------------------------------------------------------- -def process_alignments(lcdd, elem): +def process_alignments(description, elem): for a in elem.findall('alignment'): - process_alignment(lcdd, a) + process_alignment(description, a) #----------------------------------------------------------------------------------- -def process_alignment(lcdd, elem): - alignment = AlignmentEntry(lcdd, elem.name) +def process_alignment(description, elem): + alignment = AlignmentEntry(description, elem.name) pos = getPosition(elem.find('position')) rot = getRotation(elem.find('rotation')) print pos.isNull(), rot.isNull() @@ -323,12 +323,12 @@ def process_alignment(lcdd, elem): return alignment #----------------------------------------------------------------------------------- -def process_readouts(lcdd, elem): +def process_readouts(description, elem): for a in elem.findall('readout'): - process_readout(lcdd, a) + process_readout(description, a) #----------------------------------------------------------------------------------- -def process_readout(lcdd, elem): +def process_readout(description, elem): readout = Readout(elem.name) seg = elem.find('segmentation') if seg is not None: @@ -336,7 +336,7 @@ def process_readout(lcdd, elem): if not procs : procs = drivers.get('create_%s'% seg.get('type'), None) if procs : - segment = apply(procs,(lcdd, seg)) + segment = apply(procs,(description, seg)) readout.setSegmentation(segment) else : print 'Segmentation type %s not found' % seg.get('type') @@ -345,58 +345,58 @@ def process_readout(lcdd, elem): idSpec = IDDescriptor(id.text) idSpec.SetName(elem.name) readout.setIDDescriptor(idSpec) - lcdd.addIDSpecification(idSpec) - lcdd.addReadout(readout) + description.addIDSpecification(idSpec) + description.addReadout(readout) #---Segmentations-------------------------------------------------------------------- -def create_GridXYZ(lcdd, elem) : +def create_GridXYZ(description, elem) : obj = GridXYZ() if 'gridSizeX' in elem.keys() : obj.setGridSizeX(elem.getF('gridSizeX')) if 'gridSizeY' in elem.keys() : obj.setGridSizeY(elem.getF('gridSizeY')) if 'gridSizeZ' in elem.keys() : obj.setGridSizeZ(elem.getF('gridSizeZ')) return obj -def create_GlobalGridXY(lcdd, elem) : +def create_GlobalGridXY(description, elem) : obj = GlobalGridXY() if 'gridSizeX' in elem.keys() : obj.setGridSizeX(elem.getF('gridSizeX')) if 'gridSizeY' in elem.keys() : obj.setGridSizeY(elem.getF('gridSizeY')) return obj -def create_CartesianGridXY(lcdd, elem) : +def create_CartesianGridXY(description, elem) : obj = CartesianGridXY() if 'gridSizeX' in elem.keys() : obj.setGridSizeX(elem.getF('gridSizeX')) if 'gridSizeY' in elem.keys() : obj.setGridSizeY(elem.getF('gridSizeY')) return obj -def create_NoSegmentation(lcdd, elem) : +def create_NoSegmentation(description, elem) : obj = NoSegmentation() return obj -def create_ProjectiveCylinder(lcdd, elem) : +def create_ProjectiveCylinder(description, elem) : obj = ProjectiveCylinder() if 'phiBins' in elem.keys() : obj.setPhiBins(elem.getI('phiBins')) if 'thetaBins' in elem.keys() : obj.setThetaBins(elem.getI('thetaBins')) return obj -def create_NonProjectiveCylinder(lcdd, elem) : +def create_NonProjectiveCylinder(description, elem) : obj = NonProjectiveCylinder() if 'gridSizePhi' in elem.keys() : obj.setThetaBinSize(elem.getF('gridSizePhi')) if 'gridSizeZ' in elem.keys() : obj.setPhiBinSize(elem.getI('gridSizeZ')) return obj -def create_ProjectiveZPlane(lcdd, elem) : +def create_ProjectiveZPlane(description, elem) : obj = ProjectiveZPlaner() if 'phiBins' in elem.keys() : obj.setPhiBins(elem.getI('phiBins')) if 'thetaBins' in elem.keys() : obj.setThetaBins(elem.getI('thetaBins')) return obj -def create_GridPhiEta(lcdd, elem) : +def create_GridPhiEta(description, elem) : obj = GridPhiEta() if 'phiBins' in elem.keys() : obj.setPhiBins(elem.getI('phiBins')) if 'gridSizeEta' in elem.keys() : obj.setGridSizeEta(elem.getI('gridSizeEta')) return obj -def create_GridRPhiEta(lcdd, elem) : +def create_GridRPhiEta(description, elem) : obj = GridRPhiEta() if 'phiBins' in elem.keys() : obj.setPhiBins(elem.getI('gridSizeR')) if 'gridSizeEta' in elem.keys() : obj.setGridSizeEta(elem.getI('gridSizeEta')) diff --git a/DDCore/src/AlignmentData.cpp b/DDCore/src/AlignmentData.cpp index e36b341a3..7fa9552a9 100644 --- a/DDCore/src/AlignmentData.cpp +++ b/DDCore/src/AlignmentData.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,8 +23,7 @@ #include <sstream> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; /// Copy constructor Delta::Delta(const Delta& c) diff --git a/DDCore/src/AlignmentNominalMap.cpp b/DDCore/src/AlignmentNominalMap.cpp index 73c8fe7fe..092a7f2f9 100644 --- a/DDCore/src/AlignmentNominalMap.cpp +++ b/DDCore/src/AlignmentNominalMap.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,23 +18,22 @@ #include "DD4hep/detail/AlignmentsInterna.h" #include "DD4hep/detail/ConditionsInterna.h" -using namespace DD4hep; -using namespace Conditions; -using Alignments::Keys; +using namespace dd4hep; +using align::Keys; /// Standard constructor AlignmentsNominalMap::AlignmentsNominalMap(DetElement wrld) : world(wrld) { } /// Insert a new entry to the map -bool AlignmentsNominalMap::insert(DetElement /* detector */, - unsigned int /* key */, - Condition /* condition */) { +bool AlignmentsNominalMap::insert(DetElement /* detector */, + Condition::itemkey_type /* key */, + Condition /* condition */) { return false; } /// Interface to access conditions by hash value -Condition AlignmentsNominalMap::get(DetElement detector, unsigned int key) const { +Condition AlignmentsNominalMap::get(DetElement detector, Condition::itemkey_type key) const { if ( key == Keys::alignmentKey ) { return Condition(detector.nominal().ptr()); } @@ -42,12 +41,12 @@ Condition AlignmentsNominalMap::get(DetElement detector, unsigned int key) const } /// Interface to scan data content of the conditions mapping -void AlignmentsNominalMap::scan(const Processor& processor) const { +void AlignmentsNominalMap::scan(const Condition::Processor& processor) const { /// Heklper to implement partial scans. struct Scanner { - const Processor& proc; + const Condition::Processor& proc; /// Constructor - Scanner(const Processor& p) : proc(p){} + Scanner(const Condition::Processor& p) : proc(p){} /// Conditions callback for object processing int operator()(DetElement de, int /* level */) const { Condition c = de.nominal(); @@ -56,18 +55,18 @@ void AlignmentsNominalMap::scan(const Processor& processor) const { } scanner(processor); // We emulate here a full detector scan, access the nominal alignments and process them by the processor. if ( world.isValid() ) { - Geometry::DetectorScanner().scan(scanner,world,0,true); + DetectorScanner().scan(scanner,world,0,true); return; } - DD4hep::except("AlignmentsNominalMap", + dd4hep::except("AlignmentsNominalMap", "Cannot scan conditions map for conditions of an invalid top level detector element!"); } /// Interface to partially scan data content of the conditions mapping void AlignmentsNominalMap::scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const { + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const { if ( detector.isValid() ) { if ( lower <= Keys::alignmentKey && upper >= Keys::alignmentKey ) { Condition c(detector.nominal().ptr()); @@ -75,6 +74,6 @@ void AlignmentsNominalMap::scan(DetElement detector, } return; } - DD4hep::except("AlignmentsNominalMap", + dd4hep::except("AlignmentsNominalMap", "Cannot scan conditions map for conditions of an invalid detector element!"); } diff --git a/DDCore/src/AlignmentTools.cpp b/DDCore/src/AlignmentTools.cpp index 92a08e52c..e8d297609 100644 --- a/DDCore/src/AlignmentTools.cpp +++ b/DDCore/src/AlignmentTools.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,12 +23,9 @@ // ROOT include files #include "TGeoMatrix.h" -using DD4hep::Geometry::DetElement; -using DD4hep::Geometry::PlacedVolume; -using DD4hep::Alignments::Alignment; -using DD4hep::Alignments::AlignmentData; -namespace DetectorTools = DD4hep::Geometry::DetectorTools; -typedef AlignmentData::MaskManipulator MaskManipulator; +using dd4hep::PlacedVolume; +using dd4hep::Alignment; +using dd4hep::AlignmentData; namespace { void reset_matrix(TGeoHMatrix* m) { @@ -43,7 +40,7 @@ namespace { } /// Copy alignment object from source object -void DD4hep::Alignments::AlignmentTools::copy(Alignment from, Alignment to) { +void dd4hep::detail::tools::copy(Alignment from, Alignment to) { const AlignmentData& f = from.ptr()->values(); AlignmentData& t = to.ptr()->values(); if ( &t != &f ) { @@ -60,14 +57,14 @@ void DD4hep::Alignments::AlignmentTools::copy(Alignment from, Alignment to) { } /// Compute the ideal/nominal to-world transformation from the detector element placement -void DD4hep::Alignments::AlignmentTools::computeIdeal(Alignment alignment) { +void dd4hep::detail::tools::computeIdeal(Alignment alignment) { AlignmentData& a = alignment->values(); - MaskManipulator mask(a.flag); + ReferenceBitMask<AlignmentData::BitMask> mask(a.flag); DetElement parent = a.detector.parent(); reset_matrix(&a.detectorTrafo); if ( parent.isValid() ) { - DetectorTools::PlacementPath path; - DetectorTools::placementPath(parent, a.detector, path); + detail::tools::PlacementPath path; + detail::tools::placementPath(parent, a.detector, path); for (size_t i = 0, n=path.size(); n>0 && i < n-1; ++i) { const PlacedVolume& p = path[i]; @@ -78,7 +75,7 @@ void DD4hep::Alignments::AlignmentTools::computeIdeal(Alignment alignment) { //a.worldTrafo.MultiplyLeft(&a.detectorTrafo); a.worldTrafo = a.detectorTrafo; a.worldTrafo.MultiplyLeft(&parent.nominal().worldTransformation()); - a.trToWorld = Geometry::_transform(&a.worldTrafo); + a.trToWorld = Matrices::_transform(&a.worldTrafo); a.placement = a.detector.placement(); mask.clear(); mask.set(AlignmentData::HAVE_PARENT_TRAFO); @@ -91,11 +88,11 @@ void DD4hep::Alignments::AlignmentTools::computeIdeal(Alignment alignment) { } #if 0 /// Compute the ideal/nominal to-world transformation from the detector element placement -void DD4hep::Alignments::AlignmentTools::computeIdeal(Alignment alignment, +void dd4hep::detail::tools::computeIdeal(Alignment alignment, const Alignment::NodeList& node_list) { AlignmentData& a = alignment->values(); - MaskManipulator mask(a.flag); + ReferenceBitMask<AlignmentData::BitMask> mask(a.flag); a.nodes = node_list; for (size_t i = a.nodes.size(); i > 1; --i) { // Omit the placement of the parent DetElement TGeoMatrix* m = a.nodes[i - 1]->GetMatrix(); @@ -111,21 +108,21 @@ void DD4hep::Alignments::AlignmentTools::computeIdeal(Alignment alignment, a.placement = det->placement; } a.worldTrafo.MultiplyLeft(&(a.detector.nominal().worldTransformation())); - a.trToWorld = Geometry::_transform(&a.worldTrafo); + a.trToWorld = Matrices::_transform(&a.worldTrafo); mask.set(AlignmentData::IDEAL); } #endif /// Compute the survey to-world transformation from the detector element placement with respect to the survey constants -void DD4hep::Alignments::AlignmentTools::computeSurvey(Alignment alignment) +void dd4hep::detail::tools::computeSurvey(Alignment alignment) { AlignmentData& a = alignment->values(); DetElement parent = a.detector.parent(); - MaskManipulator mask(a.flag); + ReferenceBitMask<AlignmentData::BitMask> mask(a.flag); if ( parent.isValid() ) { - DetectorTools::PlacementPath path; - DetectorTools::placementPath(parent, a.detector, path); + detail::tools::PlacementPath path; + detail::tools::placementPath(parent, a.detector, path); // TODO: need to take survey corrections into account! @@ -135,7 +132,7 @@ void DD4hep::Alignments::AlignmentTools::computeSurvey(Alignment alignment) } a.worldTrafo = parent.survey().worldTransformation(); a.worldTrafo.MultiplyLeft(&a.detectorTrafo); - a.trToWorld = Geometry::_transform(&a.worldTrafo); + a.trToWorld = Matrices::_transform(&a.worldTrafo); a.placement = a.detector.placement(); } mask.set(AlignmentData::SURVEY); diff --git a/DDCore/src/Alignments.cpp b/DDCore/src/Alignments.cpp index 63df2378a..d34c0c93d 100644 --- a/DDCore/src/Alignments.cpp +++ b/DDCore/src/Alignments.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,15 +21,15 @@ using namespace std; -using namespace DD4hep::Alignments; +using namespace dd4hep; -const std::string DD4hep::Alignments::Keys::deltaName("alignment_delta"); -const DD4hep::Conditions::Condition::itemkey_type DD4hep::Alignments::Keys::deltaKey = - DD4hep::Conditions::ConditionKey::itemCode("alignment_delta"); +const std::string dd4hep::align::Keys::deltaName("alignment_delta"); +const dd4hep::Condition::itemkey_type dd4hep::align::Keys::deltaKey = + dd4hep::ConditionKey::itemCode("alignment_delta"); -const std::string DD4hep::Alignments::Keys::alignmentName("alignment"); -const DD4hep::Conditions::Condition::itemkey_type DD4hep::Alignments::Keys::alignmentKey = - DD4hep::Conditions::ConditionKey::itemCode("alignment"); +const std::string dd4hep::align::Keys::alignmentName("alignment"); +const dd4hep::Condition::itemkey_type dd4hep::align::Keys::alignmentKey = + dd4hep::ConditionKey::itemCode("alignment"); /// Default constructor Alignment::Processor::Processor() { @@ -77,7 +77,7 @@ const TGeoHMatrix& Alignment::detectorTransformation() const { } /// Access to the node list -const Alignment::NodeList& Alignment::nodes() const { +const std::vector<PlacedVolume>& Alignment::nodes() const { return access()->values().nodes; } @@ -141,12 +141,12 @@ Position Alignment::detectorToLocal(const Position& detector) const { } /// Access the IOV type -const DD4hep::IOVType& AlignmentCondition::iovType() const { +const dd4hep::IOVType& AlignmentCondition::iovType() const { return *(access()->iovType()); } /// Access the IOV block -const DD4hep::IOV& AlignmentCondition::iov() const { +const dd4hep::IOV& AlignmentCondition::iov() const { return *(access()->iovData()); } diff --git a/DDCore/src/AlignmentsCalculator.cpp b/DDCore/src/AlignmentsCalculator.cpp index 3cda4f94b..80245f665 100644 --- a/DDCore/src/AlignmentsCalculator.cpp +++ b/DDCore/src/AlignmentsCalculator.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,16 +20,15 @@ #include "DD4hep/MatrixHelpers.h" #include "DD4hep/detail/AlignmentsInterna.h" -using namespace DD4hep; -using namespace DD4hep::Alignments; -using Conditions::ConditionKey; +using namespace dd4hep; +using namespace dd4hep::align; typedef AlignmentsCalculator::Result Result; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the alignment part of the AIDA detector description toolkit - namespace Alignments { + namespace align { /// Anonymous implementation classes namespace { @@ -78,7 +77,6 @@ namespace DD4hep { bool operator()(const DetElement& a, const DetElement& b) const { return a.path() < b.path(); } }; - typedef Conditions::ConditionsMap ConditionsMap; typedef std::map<DetElement,size_t,PathOrdering> DetectorMap; typedef std::map<unsigned int,size_t> Keys; typedef std::vector<Entry> Entries; @@ -105,8 +103,8 @@ namespace DD4hep { } }; } - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ static PrintLevel s_PRINT = WARNING; //static PrintLevel s_PRINT = INFO; @@ -186,19 +184,19 @@ void Calculator::computeDelta(const Delta& delta, switch(delta.flags) { case Delta::HAVE_TRANSLATION+Delta::HAVE_ROTATION+Delta::HAVE_PIVOT: - Geometry::_transform(tr_delta, Transform3D(Translation3D(pos)*piv*rot*(piv.Inverse()))); + Matrices::_transform(tr_delta, Transform3D(Translation3D(pos)*piv*rot*(piv.Inverse()))); break; case Delta::HAVE_TRANSLATION+Delta::HAVE_ROTATION: - Geometry::_transform(tr_delta, Transform3D(rot,pos)); + Matrices::_transform(tr_delta, Transform3D(rot,pos)); break; case Delta::HAVE_ROTATION+Delta::HAVE_PIVOT: - Geometry::_transform(tr_delta, Transform3D(piv*rot*(piv.Inverse()))); + Matrices::_transform(tr_delta, Transform3D(piv*rot*(piv.Inverse()))); break; case Delta::HAVE_ROTATION: - Geometry::_transform(tr_delta, rot); + Matrices::_transform(tr_delta, rot); break; case Delta::HAVE_TRANSLATION: - Geometry::_transform(tr_delta, pos); + Matrices::_transform(tr_delta, pos); break; default: break; @@ -230,7 +228,7 @@ Result Calculator::compute(Context& context, Entry& e) const { result += to_world(context, det, align.worldDelta); align.worldTrafo = det.nominal().worldTransformation()*align.worldDelta; align.detectorTrafo = det.nominal().detectorTransformation()*tr_delta; - align.trToWorld = Geometry::_transform(&align.worldDelta); + align.trToWorld = Matrices::_transform(&align.worldDelta); // Update mapping if the condition is freshly created if ( !c.isValid() ) { e.created = 1; @@ -263,7 +261,9 @@ void Calculator::resolve(Context& context, DetElement detector) const { } /// Compute all alignment conditions of the internal dependency list -Result AlignmentsCalculator::compute(const Deltas& deltas, Alignments& alignments) const { +Result AlignmentsCalculator::compute(const std::map<DetElement, Delta>& deltas, + ConditionsMap& alignments) const +{ Result result; Calculator obj; Calculator::Context context(alignments); @@ -273,14 +273,5 @@ Result AlignmentsCalculator::compute(const Deltas& deltas, Alignments& alignment obj.resolve(context,i.first); for( auto& i : context.entries ) result += obj.compute(context, i); -#if 0 - for( auto& i : context.entries ) { - if ( i.created ) { - Conditions::Condition c(i.cond); - Conditions::ConditionKey::KeyMaker m(c.key()); - alignments.insert(DetElement(i.det), m.values.item_key, c); - } - } -#endif return result; } diff --git a/DDCore/src/AlignmentsInterna.cpp b/DDCore/src/AlignmentsInterna.cpp index f5cef0c98..c38804070 100644 --- a/DDCore/src/AlignmentsInterna.cpp +++ b/DDCore/src/AlignmentsInterna.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,8 +21,8 @@ #include "DD4hep/detail/AlignmentsInterna.h" using namespace std; -using namespace DD4hep::Alignments; -using namespace DD4hep::Alignments::Interna; +using namespace dd4hep; +using namespace dd4hep::detail; DD4HEP_INSTANTIATE_HANDLE_NAMED(AlignmentObject); DD4HEP_INSTANTIATE_HANDLE_UNNAMED(AlignmentData); @@ -32,7 +32,7 @@ AlignmentObject::AlignmentObject() : ConditionObject(), alignment_data(0)//, source_key(0) { InstanceCount::increment(this); - flags = Conditions::Condition::ALIGNMENT_DERIVED; + flags = Condition::ALIGNMENT_DERIVED; AlignmentData& d = data.bind<AlignmentData>(); alignment_data = &d; } @@ -42,7 +42,7 @@ AlignmentObject::AlignmentObject(const string& nam, const string& tit, void* p, : ConditionObject(nam, tit), alignment_data(0)//, source_key(0) { InstanceCount::increment(this); - flags = Conditions::Condition::ALIGNMENT_DERIVED|Conditions::Condition::ONSTACK; + flags = Condition::ALIGNMENT_DERIVED|Condition::ONSTACK; AlignmentData& d = data.bind<AlignmentData>(p,len); alignment_data = &d; } @@ -60,5 +60,5 @@ void AlignmentObject::clear() { d.detectorTrafo.Clear(); d.worldTrafo.Clear(); d.nodes.clear(); - flags = Conditions::Condition::ALIGNMENT_DERIVED; + flags = Condition::ALIGNMENT_DERIVED; } diff --git a/DDCore/src/AlignmentsPrinter.cpp b/DDCore/src/AlignmentsPrinter.cpp index df409382c..b48a05a73 100644 --- a/DDCore/src/AlignmentsPrinter.cpp +++ b/DDCore/src/AlignmentsPrinter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,8 +23,8 @@ #include "DD4hep/ToStream.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; +using namespace dd4hep::align; /// Initializing constructor AlignmentsPrinter::AlignmentsPrinter(ConditionsMap* m, const string& pref, int flg) @@ -68,7 +68,7 @@ int AlignedVolumePrinter::operator()(Alignment a) const { } /// Default printout of an alignment entry -void DD4hep::Alignments::printAlignment(PrintLevel lvl, const string& prefix, Alignment a) { +void dd4hep::align::printAlignment(PrintLevel lvl, const string& prefix, Alignment a) { if ( a.isValid() ) { Alignment::Object* ptr = a.ptr(); const AlignmentData& data = a.data(); @@ -113,13 +113,12 @@ static string _transformPoint2Detector(const AlignmentData& data, const Position return text; } -void DD4hep::Alignments::printAlignment(PrintLevel lvl, const string& prefix, +void dd4hep::align::printAlignment(PrintLevel lvl, const string& prefix, const string& opt, DetElement de, Alignment alignment) { - using Geometry::Box; const string& tag = prefix; const AlignmentData& align_data = alignment.data(); - Conditions::Condition align_cond;// = align_data.condition; + Condition align_cond;// = align_data.condition; const Delta& align_delta = align_data.delta; string par = de.parent().isValid() ? de.parent().path() : string(); Box bbox = de.placement().volume().solid(); @@ -192,7 +191,7 @@ void DD4hep::Alignments::printAlignment(PrintLevel lvl, const string& prefix, } /// Default printout of a detector element entry -void DD4hep::Alignments::printElement(PrintLevel prt_level, const string& prefix, DetElement de, ConditionsMap& pool) { +void dd4hep::align::printElement(PrintLevel prt_level, const string& prefix, DetElement de, ConditionsMap& pool) { string tag = prefix+"Element"; if ( de.isValid() ) { vector<Alignment> alignments; @@ -207,12 +206,7 @@ void DD4hep::Alignments::printElement(PrintLevel prt_level, const string& prefix } /// PrintElement placement with/without alignment applied -void DD4hep::Alignments::printElementPlacement(PrintLevel lvl, const string& prefix, DetElement de, ConditionsMap& pool) -{ - using Geometry::Box; - using Geometry::Solid; - using Geometry::Volume; - using Geometry::PlacedVolume; +void dd4hep::align::printElementPlacement(PrintLevel lvl, const string& prefix, DetElement de, ConditionsMap& pool) { string tag = prefix+"Element"; if ( de.isValid() ) { char text[132]; diff --git a/DDCore/src/AlignmentsProcessor.cpp b/DDCore/src/AlignmentsProcessor.cpp index 51b80f8b5..1659a1acb 100644 --- a/DDCore/src/AlignmentsProcessor.cpp +++ b/DDCore/src/AlignmentsProcessor.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,17 +19,18 @@ #include "DD4hep/detail/ConditionsInterna.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; +using namespace dd4hep::align; /// Callback to output alignments information -template <typename T> int DeltaCollector<T>::operator()(DetElement de, int level) const { +template <typename T> +int DeltaCollector<T>::operator()(DetElement de, int level) const { if ( de.isValid() ) { int count = 0; - vector<Conditions::Condition> conditions; - conditionsCollector(mapping,conditions)(de,level); + vector<Condition> conditions; + cond::conditionsCollector(mapping,conditions)(de,level); for( auto cond : conditions ) { - if ( cond->testFlag(Conditions::Condition::ALIGNMENT_DELTA) ) { + if ( cond->testFlag(Condition::ALIGNMENT_DELTA) ) { insert_item(deltas, de, cond.get<Delta>()); ++count; } @@ -45,10 +46,10 @@ template <typename T> int AlignmentsCollector<T>::operator()(DetElement de, int level) const { if ( de.isValid() ) { int count = 0; - vector<Conditions::Condition> conditions; - conditionsCollector(mapping,conditions)(de,level); + vector<Condition> conditions; + cond::conditionsCollector(mapping,conditions)(de,level); for( auto cond : conditions ) { - if ( cond->testFlag(Conditions::Condition::ALIGNMENT_DERIVED) ) { + if ( cond->testFlag(Condition::ALIGNMENT_DERIVED) ) { Alignment align = cond; insert_item(alignments, de, align); ++count; @@ -62,10 +63,10 @@ int AlignmentsCollector<T>::operator()(DetElement de, int level) const { /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace Alignments { + namespace align { template class DeltaCollector<list<Delta> >; template class DeltaCollector<vector<Delta> >; @@ -88,5 +89,5 @@ namespace DD4hep { template class AlignmentsCollector<map<string,Alignment> >; template class AlignmentsCollector<multimap<string,Alignment> >; - } /* End namespace Alignments */ -} /* End namespace DD4hep */ + } /* End namespace align */ +} /* End namespace dd4hep */ diff --git a/DDCore/src/BasicGrammar.cpp b/DDCore/src/BasicGrammar.cpp index 65c454446..16be7ecc9 100644 --- a/DDCore/src/BasicGrammar.cpp +++ b/DDCore/src/BasicGrammar.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,15 +20,15 @@ #include <stdexcept> /// Default constructor -DD4hep::BasicGrammar::BasicGrammar() { +dd4hep::BasicGrammar::BasicGrammar() { } /// Default destructor -DD4hep::BasicGrammar::~BasicGrammar() { +dd4hep::BasicGrammar::~BasicGrammar() { } /// Error callback on invalid conversion -void DD4hep::BasicGrammar::invalidConversion(const std::string& value, const std::type_info& to) { +void dd4hep::BasicGrammar::invalidConversion(const std::string& value, const std::type_info& to) { std::string to_name = typeName(to); throw unrelated_value_error(to, "Data conversion of " + value + " to type '" + @@ -36,7 +36,7 @@ void DD4hep::BasicGrammar::invalidConversion(const std::string& value, const std } /// Error callback on invalid conversion -void DD4hep::BasicGrammar::invalidConversion(const std::type_info& from, const std::type_info& to) { +void dd4hep::BasicGrammar::invalidConversion(const std::type_info& from, const std::type_info& to) { std::string to_name = typeName(to); std::string from_name = typeName(from); throw unrelated_type_error(from, to, diff --git a/DDCore/src/BasicGrammarTypes.cpp b/DDCore/src/BasicGrammarTypes.cpp index 63cb1863d..079fef922 100644 --- a/DDCore/src/BasicGrammarTypes.cpp +++ b/DDCore/src/BasicGrammarTypes.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDCore/src/BuildType.cpp b/DDCore/src/BuildType.cpp index d18d3866c..c7b40bb64 100644 --- a/DDCore/src/BuildType.cpp +++ b/DDCore/src/BuildType.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #include <string> /// Translate string representation of the geometry build type to value -DD4hep::LCDDBuildType DD4hep::buildType(const char* value) { +dd4hep::DetectorBuildType dd4hep::buildType(const char* value) { if ( !value ) return BUILD_DEFAULT; else if ( strncmp(value,"BUILD_DEFAULT",9)==0 ) @@ -45,6 +45,6 @@ DD4hep::LCDDBuildType DD4hep::buildType(const char* value) { } /// Translate string representation of the geometry build type to value -DD4hep::LCDDBuildType DD4hep::buildType(const std::string& value) { +dd4hep::DetectorBuildType dd4hep::buildType(const std::string& value) { return buildType(value.c_str()); } diff --git a/DDCore/src/Callback.cpp b/DDCore/src/Callback.cpp index 1447425b0..c28ded38d 100644 --- a/DDCore/src/Callback.cpp +++ b/DDCore/src/Callback.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +15,7 @@ #include "DD4hep/Callback.h" #include "DD4hep/Exceptions.h" -using namespace DD4hep; +using namespace dd4hep; /// Check the compatibility of two typed objects. The test is the result of a dynamic_cast void CallbackSequence::checkTypes(const std::type_info& typ1, const std::type_info& typ2, void* test) { diff --git a/DDCore/src/CartesianGridXY.cpp b/DDCore/src/CartesianGridXY.cpp index 5112bec18..d0f7b72b6 100644 --- a/DDCore/src/CartesianGridXY.cpp +++ b/DDCore/src/CartesianGridXY.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// determine the position based on the cell ID Position CartesianGridXY::position(const CellID& id) const { @@ -27,7 +27,7 @@ Position CartesianGridXY::position(const CellID& id) const { } /// determine the cell ID based on the position -DD4hep::CellID CartesianGridXY::cellID(const Position& local, +dd4hep::CellID CartesianGridXY::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/CartesianGridXYZ.cpp b/DDCore/src/CartesianGridXYZ.cpp index 674d080b6..88c706a6f 100644 --- a/DDCore/src/CartesianGridXYZ.cpp +++ b/DDCore/src/CartesianGridXYZ.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// determine the position based on the cell ID Position CartesianGridXYZ::position(const CellID& id) const { @@ -27,7 +27,7 @@ Position CartesianGridXYZ::position(const CellID& id) const { } /// determine the cell ID based on the position -DD4hep::CellID CartesianGridXYZ::cellID(const Position& local, +dd4hep::CellID CartesianGridXYZ::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/CartesianGridXZ.cpp b/DDCore/src/CartesianGridXZ.cpp index 90fbcbc0d..431b06c4f 100644 --- a/DDCore/src/CartesianGridXZ.cpp +++ b/DDCore/src/CartesianGridXZ.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// determine the position based on the cell ID Position CartesianGridXZ::position(const CellID& id) const { @@ -27,7 +27,7 @@ Position CartesianGridXZ::position(const CellID& id) const { } /// determine the cell ID based on the position -DD4hep::CellID CartesianGridXZ::cellID(const Position& local, +dd4hep::CellID CartesianGridXZ::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/CartesianGridYZ.cpp b/DDCore/src/CartesianGridYZ.cpp index 31f9df763..ed045595c 100644 --- a/DDCore/src/CartesianGridYZ.cpp +++ b/DDCore/src/CartesianGridYZ.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// determine the position based on the cell ID Position CartesianGridYZ::position(const CellID& id) const { @@ -27,7 +27,7 @@ Position CartesianGridYZ::position(const CellID& id) const { } /// determine the cell ID based on the position -DD4hep::CellID CartesianGridYZ::cellID(const Position& local, +dd4hep::CellID CartesianGridYZ::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/ComponentProperties.cpp b/DDCore/src/ComponentProperties.cpp index e32faae74..6befee4c0 100644 --- a/DDCore/src/ComponentProperties.cpp +++ b/DDCore/src/ComponentProperties.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ #include <cstring> using namespace std; -using namespace DD4hep; +using namespace dd4hep; /// Default destructor PropertyConfigurator::~PropertyConfigurator() { @@ -235,7 +235,7 @@ Property& PropertyConfigurable::property(const string& nam) { return properties()[nam]; } -namespace DD4hep { +namespace dd4hep { namespace Parsers { int parse(Property& result, const std::string& input) { result.str(input); @@ -258,7 +258,7 @@ namespace DD4hep { #include "DD4hep/detail/ComponentProperties_inl.h" DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(Property) -namespace DD4hep { +namespace dd4hep { template Property Property::value() const; template void Property::value(Property& value) const; diff --git a/DDCore/src/ConditionDerived.cpp b/DDCore/src/ConditionDerived.cpp index 76d43d8ad..e662ae3ba 100644 --- a/DDCore/src/ConditionDerived.cpp +++ b/DDCore/src/ConditionDerived.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,8 +18,8 @@ // C/C++ include files -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; /// Standard destructor ConditionUpdateCall::ConditionUpdateCall() : m_refCount(1) { @@ -36,7 +36,7 @@ ConditionResolver::~ConditionResolver() { } /// Initializing constructor -ConditionDependency::ConditionDependency(Geometry::DetElement de, +ConditionDependency::ConditionDependency(DetElement de, unsigned int item_key, ConditionUpdateCall* call) : m_refCount(0), detector(de), target(de, item_key), callback(call) @@ -45,7 +45,7 @@ ConditionDependency::ConditionDependency(Geometry::DetElement de, } /// Initializing constructor -ConditionDependency::ConditionDependency(Geometry::DetElement de, +ConditionDependency::ConditionDependency(DetElement de, const std::string& item, ConditionUpdateCall* call) : m_refCount(0), detector(de), target(de, item), callback(call) @@ -63,11 +63,11 @@ ConditionDependency::ConditionDependency() /// Default destructor ConditionDependency::~ConditionDependency() { InstanceCount::decrement(this); - releasePtr(callback); + detail::releasePtr(callback); } /// Initializing constructor -DependencyBuilder::DependencyBuilder(Geometry::DetElement de, +DependencyBuilder::DependencyBuilder(DetElement de, unsigned int item_key, ConditionUpdateCall* call) : m_dependency(new ConditionDependency(de,item_key,call)) @@ -75,7 +75,7 @@ DependencyBuilder::DependencyBuilder(Geometry::DetElement de, } /// Initializing constructor -DependencyBuilder::DependencyBuilder(Geometry::DetElement de, +DependencyBuilder::DependencyBuilder(DetElement de, const std::string& item, ConditionUpdateCall* call) : m_dependency(new ConditionDependency(de,item,call)) @@ -84,7 +84,7 @@ DependencyBuilder::DependencyBuilder(Geometry::DetElement de, /// Default destructor DependencyBuilder::~DependencyBuilder() { - releasePtr(m_dependency); + detail::releasePtr(m_dependency); } /// Add a new dependency diff --git a/DDCore/src/Conditions.cpp b/DDCore/src/Conditions.cpp index 9f1bd1129..59317706d 100644 --- a/DDCore/src/Conditions.cpp +++ b/DDCore/src/Conditions.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ #include <cstdio> using namespace std; -using namespace DD4hep::Conditions; +using namespace dd4hep; /// Default constructor Condition::Processor::Processor() { @@ -73,17 +73,17 @@ int Condition::dataType() const { } /// Access the IOV block -DD4hep::OpaqueData& Condition::data() const { +dd4hep::OpaqueData& Condition::data() const { return access()->data; } /// Access the IOV type -const DD4hep::IOVType& Condition::iovType() const { +const dd4hep::IOVType& Condition::iovType() const { return *(access()->iovType()); } /// Access the IOV block -const DD4hep::IOV& Condition::iov() const { +const dd4hep::IOV& Condition::iov() const { return *(access()->iovData()); } @@ -143,7 +143,7 @@ bool Condition::testFlag(mask_type option) const { } /// Access to the grammar type -const DD4hep::BasicGrammar& Condition::descriptor() const { +const dd4hep::BasicGrammar& Condition::descriptor() const { const BasicGrammar* g = access()->data.grammar; if ( !g ) { invalidHandleError<Condition>(); @@ -178,7 +178,7 @@ ConditionsSelect::~ConditionsSelect() { /// Constructor from string ConditionKey::ConditionKey(DetElement detector, const string& value) { - KeyMaker m(detector.key(), hash32(value)); + KeyMaker m(detector.key(), detail::hash32(value)); hash = m.hash; #ifdef DD4HEP_CONDITIONKEY_HAVE_NAME name = detector.path()+"#"+value; @@ -186,8 +186,8 @@ ConditionKey::ConditionKey(DetElement detector, const string& value) { } /// Constructor from detector element key and item sub-key -ConditionKey::ConditionKey(detkey_type det_key, const string& value) { - KeyMaker m(det_key, hash32(value)); +ConditionKey::ConditionKey(Condition::detkey_type det_key, const string& value) { + KeyMaker m(det_key, detail::hash32(value)); hash = m.hash; #ifdef DD4HEP_CONDITIONKEY_HAVE_NAME char text[32]; @@ -197,7 +197,7 @@ ConditionKey::ConditionKey(detkey_type det_key, const string& value) { } /// Constructor from detector element key and item sub-key -ConditionKey::ConditionKey(DetElement detector, itemkey_type item_key) { +ConditionKey::ConditionKey(DetElement detector, Condition::itemkey_type item_key) { hash = KeyMaker(detector.key(),item_key).hash; #ifdef DD4HEP_CONDITIONKEY_HAVE_NAME char text[32]; @@ -207,21 +207,21 @@ ConditionKey::ConditionKey(DetElement detector, itemkey_type item_key) { } /// Hash code generation from input string -ConditionKey::key_type ConditionKey::hashCode(DetElement detector, const char* value) { - return KeyMaker(detector.key(), hash32(value)).hash; +Condition::key_type ConditionKey::hashCode(DetElement detector, const char* value) { + return KeyMaker(detector.key(), detail::hash32(value)).hash; } /// Hash code generation from input string -ConditionKey::key_type ConditionKey::hashCode(DetElement detector, const string& value) { - return KeyMaker(detector.key(), hash32(value)).hash; +Condition::key_type ConditionKey::hashCode(DetElement detector, const string& value) { + return KeyMaker(detector.key(), detail::hash32(value)).hash; } /// 32 bit hashcode of the item -unsigned int ConditionKey::itemCode(const char* value) { - return hash32(value); +Condition::itemkey_type ConditionKey::itemCode(const char* value) { + return detail::hash32(value); } /// 32 bit hashcode of the item -unsigned int ConditionKey::itemCode(const std::string& value) { - return hash32(value); +Condition::itemkey_type ConditionKey::itemCode(const std::string& value) { + return detail::hash32(value); } diff --git a/DDCore/src/ConditionsData.cpp b/DDCore/src/ConditionsData.cpp index a35bbfacb..6d67e4b11 100644 --- a/DDCore/src/ConditionsData.cpp +++ b/DDCore/src/ConditionsData.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DD4hep/ConditionsData.h" #include <sstream> -using namespace DD4hep::Conditions; +using namespace dd4hep::cond; /// print Conditions object std::ostream& operator << (std::ostream& s, const AbstractMap& data) { @@ -25,13 +25,13 @@ std::ostream& operator << (std::ostream& s, const AbstractMap& data) { void operator()(const AbstractMap::Params::value_type& obj) const { if ( obj.second.typeInfo() == typeid(AbstractMap) ) { const AbstractMap& d= obj.second.get<AbstractMap>(); - DD4hep::printout(DD4hep::INFO,"Condition","++ %-16s [%d] %-8s -> %s", + dd4hep::printout(dd4hep::INFO,"Condition","++ %-16s [%d] %-8s -> %s", obj.first.c_str(), d.classID, obj.second.dataType().c_str(), obj.second.str().c_str()); } else { - DD4hep::printout(DD4hep::INFO,"Condition","++ %-16s %-8s -> %s", + dd4hep::printout(dd4hep::INFO,"Condition","++ %-16s %-8s -> %s", obj.first.c_str(), obj.second.dataType().c_str(), obj.second.str().c_str()); diff --git a/DDCore/src/ConditionsInterna.cpp b/DDCore/src/ConditionsInterna.cpp index 14f05a6c7..d1e1730e5 100644 --- a/DDCore/src/ConditionsInterna.cpp +++ b/DDCore/src/ConditionsInterna.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,17 +13,14 @@ // Framework includes #include "DD4hep/IOV.h" -#include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" -#include "DD4hep/ConditionsListener.h" #include "DD4hep/detail/Handle.inl" -#include "DD4hep/detail/DetectorInterna.h" #include "DD4hep/detail/ConditionsInterna.h" using namespace std; -using namespace DD4hep::Conditions; +using namespace dd4hep; -DD4HEP_INSTANTIATE_HANDLE_NAMED(Interna::ConditionObject); +DD4HEP_INSTANTIATE_HANDLE_NAMED(detail::ConditionObject); namespace { /// Simple cast union to perform pointer arithmetic on raw byte based memory @@ -31,56 +28,56 @@ namespace { const char* character; const void* p_void; void** pp_void; - const Interna::ConditionObject* o; + const detail::ConditionObject* o; _P(const void* val) { p_void = val; } }; } /// Default constructor -Interna::ConditionObject::ConditionObject() +detail::ConditionObject::ConditionObject() : NamedObject(), value(), validity(), address(), comment(), data() { InstanceCount::increment(this); } /// Standard constructor -Interna::ConditionObject::ConditionObject(const string& nam,const string& tit) +detail::ConditionObject::ConditionObject(const string& nam,const string& tit) : NamedObject(nam, tit), value(), validity(), address(), comment(), data() { InstanceCount::increment(this); } /// Standard Destructor -Interna::ConditionObject::~ConditionObject() { +detail::ConditionObject::~ConditionObject() { InstanceCount::decrement(this); } /// Data offset from the opaque data block pointer to the condition -size_t Interna::ConditionObject::offset() { +size_t detail::ConditionObject::offset() { static _P p((void*)0x1000); - static size_t off = _P(&p.o->data.grammar).character - p.character + sizeof(p.o->data.grammar); + static size_t off = _P(&p.o->data.grammar).character - p.character + sizeof(OpaqueData::grammar); return off; } /// Access the bound data payload. Exception id object is unbound -void* Interna::ConditionObject::payload() const { +void* detail::ConditionObject::payload() const { return *(_P(_P(this).character+offset()).pp_void); } /// Move data content: 'from' will be reset to NULL -Interna::ConditionObject& Interna::ConditionObject::move(ConditionObject& /* from */) { +detail::ConditionObject& detail::ConditionObject::move(ConditionObject& /* from */) { return *this; } /// Access safely the IOV -const Condition::iov_type* Interna::ConditionObject::iovData() const { +const dd4hep::IOV* detail::ConditionObject::iovData() const { if ( iov ) return iov; invalidHandleError<IOV>(); return 0; } /// Access safely the IOV-type -const DD4hep::IOVType* Interna::ConditionObject::iovType() const { +const dd4hep::IOVType* detail::ConditionObject::iovType() const { if ( iov && iov->iovType ) return iov->iovType; invalidHandleError<IOVType>(); return 0; diff --git a/DDCore/src/ConditionsListener.cpp b/DDCore/src/ConditionsListener.cpp index cb1710787..3e43d6ccf 100644 --- a/DDCore/src/ConditionsListener.cpp +++ b/DDCore/src/ConditionsListener.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ // Framework include files #include "DD4hep/ConditionsListener.h" -using namespace DD4hep::Conditions; +using namespace dd4hep::cond; /// Default constructor ConditionsListener::ConditionsListener() { diff --git a/DDCore/src/ConditionsMap.cpp b/DDCore/src/ConditionsMap.cpp index 17c43ee22..ee8ee7253 100644 --- a/DDCore/src/ConditionsMap.cpp +++ b/DDCore/src/ConditionsMap.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,52 +16,53 @@ #include "DD4hep/ConditionsMap.h" #include "DD4hep/detail/ConditionsInterna.h" -using namespace DD4hep::Conditions; +using namespace dd4hep; /// Interface to partially scan data content of the conditions mapping void ConditionsMap::scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const { /// Heklper to implement partial scans. - struct Scanner : public Processor { - key_type lower, upper; - const Processor& processor; + struct Scanner : public Condition::Processor { + Condition::key_type lower, upper; + const Condition::Processor& processor; /// Constructor - Scanner(key_type low, key_type up, const Processor& p) : lower(low), upper(up), processor(p) {} + Scanner(Condition::key_type low, Condition::key_type up, const Condition::Processor& p) + : lower(low), upper(up), processor(p) {} /// Conditions callback for object processing virtual int process(Condition c) const override { - key_type h = c->hash; + Condition::key_type h = c->hash; if ( h >= lower && h <= upper ) return processor(c); return 0; } }; if ( detector.isValid() ) { - ConditionKey::detkey_type det_key = detector.key(); - key_type low = ConditionKey::KeyMaker(det_key,lower).hash; - key_type up = ConditionKey::KeyMaker(det_key,upper).hash; + Condition::detkey_type det_key = detector.key(); + Condition::key_type low = ConditionKey::KeyMaker(det_key,lower).hash; + Condition::key_type up = ConditionKey::KeyMaker(det_key,upper).hash; Scanner scn(low,up,processor); this->scan(scn); return; } - DD4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!"); + dd4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!"); } /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] std::vector<Condition> ConditionsMap::get(DetElement detector, - itemkey_type lower, - itemkey_type upper) const { + Condition::itemkey_type lower, + Condition::itemkey_type upper) const { /// Heklper to implement partial scans. - struct Scanner : public Processor { - key_type lower, upper; + struct Scanner : public Condition::Processor { + Condition::key_type lower, upper; std::vector<Condition>& result; /// Constructor - Scanner(key_type low, key_type up, std::vector<Condition>& r) : lower(low), upper(up), result(r) {} + Scanner(Condition::key_type low, Condition::key_type up, std::vector<Condition>& r) : lower(low), upper(up), result(r) {} /// Conditions callback for object processing virtual int process(Condition c) const override { - key_type h = c->hash; + Condition::key_type h = c->hash; if ( h >= lower && h <= upper ) { result.push_back(c); return 1; @@ -71,34 +72,34 @@ std::vector<Condition> ConditionsMap::get(DetElement detector, }; std::vector<Condition> result; if ( detector.isValid() ) { - ConditionKey::detkey_type det_key = detector.key(); - key_type low = ConditionKey::KeyMaker(det_key,lower).hash; - key_type up = ConditionKey::KeyMaker(det_key,upper).hash; + Condition::detkey_type det_key = detector.key(); + Condition::key_type low = ConditionKey::KeyMaker(det_key,lower).hash; + Condition::key_type up = ConditionKey::KeyMaker(det_key,upper).hash; Scanner scn(low,up,result); this->scan(scn); return result; } - DD4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!"); + dd4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!"); return result; } /// Insert a new entry to the map template <typename T> -bool ConditionsMapping<T>::insert(DetElement detector, unsigned int key, Condition condition) { +bool ConditionsMapping<T>::insert(DetElement detector, Condition::itemkey_type key, Condition condition) { auto res = data.insert(std::make_pair(ConditionKey(detector,key).hash,condition)); return res.second; } /// Interface to access conditions by hash value template <typename T> -Condition ConditionsMapping<T>::get(DetElement detector, unsigned int key) const { +Condition ConditionsMapping<T>::get(DetElement detector, Condition::itemkey_type key) const { auto res = data.find(ConditionKey(detector,key).hash); return (res == data.end()) ? Condition() : res->second; } /// Interface to scan data content of the conditions mapping template <typename T> -void ConditionsMapping<T>::scan(const Processor& processor) const { +void ConditionsMapping<T>::scan(const Condition::Processor& processor) const { for( const auto& i : data ) processor(i); } @@ -106,46 +107,45 @@ void ConditionsMapping<T>::scan(const Processor& processor) const { /// Interface to partially scan data content of the conditions mapping template <typename T> void ConditionsMapping<T>::scan(DetElement detector, - itemkey_type lower, - itemkey_type upper, - const Processor& processor) const { + Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& processor) const { if ( detector.isValid() ) { - ConditionKey::detkey_type det_key = detector.key(); - key_type low = ConditionKey::KeyMaker(det_key,lower).hash; - key_type up = ConditionKey::KeyMaker(det_key,upper).hash; + Condition::detkey_type det_key = detector.key(); + Condition::key_type low = ConditionKey::KeyMaker(det_key,lower).hash; + Condition::key_type up = ConditionKey::KeyMaker(det_key,upper).hash; typename T::const_iterator first = data.lower_bound(low); for(; first != data.end() && (*first).first <= up; ++first ) processor((*first).second); return; } - DD4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!"); + dd4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!"); } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { +namespace dd4hep { - /// Specialization: Insert a new entry to the map - template <> - bool ConditionsMapping<std::multimap<Condition::key_type,Condition> > - ::insert(DetElement detector, unsigned int key, Condition condition) { - data.insert(std::make_pair(ConditionKey(detector,key).hash,condition)); - return true; - } - - /// Specialization: Interface to partially scan data content of the conditions mapping - template <> - void ConditionsMapping<std::unordered_map<Condition::key_type,Condition> > - ::scan(DetElement detector, itemkey_type lower, itemkey_type upper, const Processor& proc) const { - this->ConditionsMap::scan(detector, lower, upper, proc); - } + /// Specialization: Insert a new entry to the map + template <> + bool ConditionsMapping<std::multimap<Condition::key_type,Condition> > + ::insert(DetElement detector, Condition::itemkey_type key, Condition condition) { + data.insert(std::make_pair(ConditionKey(detector,key).hash,condition)); + return true; + } + /// Specialization: Interface to partially scan data content of the conditions mapping + template <> + void ConditionsMapping<std::unordered_map<Condition::key_type,Condition> > + ::scan(DetElement detector, Condition::itemkey_type lower, + Condition::itemkey_type upper, + const Condition::Processor& proc) const + { + this->ConditionsMap::scan(detector, lower, upper, proc); + } - template class ConditionsMapping<std::map<Condition::key_type,Condition> >; - template class ConditionsMapping<std::multimap<Condition::key_type,Condition> >; - template class ConditionsMapping<std::unordered_map<Condition::key_type,Condition> >; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + template class ConditionsMapping<std::map<Condition::key_type,Condition> >; + template class ConditionsMapping<std::multimap<Condition::key_type,Condition> >; + template class ConditionsMapping<std::unordered_map<Condition::key_type,Condition> >; +} /* End namespace dd4hep */ diff --git a/DDCore/src/ConditionsPrinter.cpp b/DDCore/src/ConditionsPrinter.cpp index 97fc05881..aac0c2eb0 100644 --- a/DDCore/src/ConditionsPrinter.cpp +++ b/DDCore/src/ConditionsPrinter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,8 +22,8 @@ #include <sstream> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; namespace { /// C++ version: replace all occurrences of a string @@ -60,7 +60,7 @@ public: /// Assignment operator ParamPrinter& operator=(const ParamPrinter& copy) = default; /// Callback to output conditions information - virtual void operator()(const Conditions::AbstractMap::Params::value_type& obj) const; + virtual void operator()(const cond::AbstractMap::Params::value_type& obj) const; }; @@ -123,7 +123,7 @@ ConditionsPrinter::~ConditionsPrinter() { prefix.c_str(), numCondition, numEmptyCondition); printout(INFO,name,"++ %s Total Number of parameters: %8ld [%7.3f Parameters/Condition]", prefix.c_str(), numParam, double(numParam)/std::max(double(numCondition),1e0)); - deletePtr(m_print); + detail::deletePtr(m_print); } /// Actual print method @@ -163,10 +163,10 @@ int ConditionsPrinter::operator()(Condition cond) const { ++numEmptyCondition; } } - else if ( type == typeid(Alignments::Delta) ) { + else if ( type == typeid(Delta) ) { string piv; stringstream str_tr, str_rot, str_piv; - const Alignments::Delta& D = cond.get<Alignments::Delta>(); + const Delta& D = cond.get<Delta>(); if ( D.hasTranslation() ) Utils::toStream(D.translation, str_tr); if ( D.hasRotation() ) Utils::toStream(D.rotation, str_rot); if ( D.hasPivot() ) { @@ -187,10 +187,10 @@ int ConditionsPrinter::operator()(Condition cond) const { piv.c_str() ); } - else if ( type == typeid(Alignments::AlignmentData) ) { + else if ( type == typeid(AlignmentData) ) { string piv; stringstream str_tr, str_rot, str_piv; - const Alignments::Delta& D = cond.get<Alignments::AlignmentData>().delta; + const Delta& D = cond.get<AlignmentData>().delta; if ( D.hasTranslation() ) Utils::toStream(D.translation, str_tr); if ( D.hasRotation() ) Utils::toStream(D.rotation, str_rot); if ( D.hasPivot() ) { diff --git a/DDCore/src/ConditionsProcessor.cpp b/DDCore/src/ConditionsProcessor.cpp index 6f0df7703..208efc0a5 100644 --- a/DDCore/src/ConditionsProcessor.cpp +++ b/DDCore/src/ConditionsProcessor.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,8 +17,8 @@ #include "DD4hep/detail/ContainerHelpers.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; /// Callback to output conditions information template <typename T> @@ -41,10 +41,10 @@ int ConditionsCollector<T>::operator()(DetElement de, int) const { /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the conditions part of the AIDA detector description toolkit - namespace Conditions { + namespace cond { //template class ConditionsCollector<ConditionsMap>; template class ConditionsCollector<list<Condition> >; @@ -56,5 +56,5 @@ namespace DD4hep { template class ConditionsCollector<multimap<DetElement,Condition> >; template class ConditionsCollector<map<string,Condition> >; template class ConditionsCollector<multimap<string,Condition> >; - } /* End namespace Conditions */ -} /* End namespace DD4hep */ + } /* End namespace cond */ +} /* End namespace dd4hep */ diff --git a/DDCore/src/ConditonsTypes.cpp b/DDCore/src/ConditonsTypes.cpp index 7a0d1af5f..9187fe96e 100644 --- a/DDCore/src/ConditonsTypes.cpp +++ b/DDCore/src/ConditonsTypes.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDCore/src/DD4hepRootPersistency.cpp b/DDCore/src/DD4hepRootPersistency.cpp index 272253a07..69077c50d 100644 --- a/DDCore/src/DD4hepRootPersistency.cpp +++ b/DDCore/src/DD4hepRootPersistency.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,45 +20,42 @@ ClassImp(DD4hepRootPersistency) -typedef DD4hep::Geometry::LCDD LCDD; -typedef DD4hep::Geometry::LCDDData LCDDData; - -int DD4hepRootPersistency::save(DD4hep::Geometry::LCDD& lcdd, const char* fname, const char* instance) { +int DD4hepRootPersistency::save(dd4hep::Detector& description, const char* fname, const char* instance) { TFile* f = TFile::Open(fname,"RECREATE"); if ( f && !f->IsZombie()) { DD4hepRootPersistency* persist = new DD4hepRootPersistency(); - persist->adoptData(dynamic_cast<LCDDData&>(lcdd)); + persist->adoptData(dynamic_cast<DetectorData&>(description)); int nBytes = persist->Write(instance); f->Close(); - DD4hep::printout(DD4hep::ALWAYS,"DD4hepRootPersistency", + dd4hep::printout(dd4hep::ALWAYS,"DD4hepRootPersistency", "+++ Wrote %d Bytes of geometry data '%s' to '%s'.", nBytes, instance, fname); delete f; delete persist; return nBytes; } - DD4hep::printout(DD4hep::ERROR,"DD4hepRootPersistency","+++ Cannot open file '%s'.",fname); + dd4hep::printout(dd4hep::ERROR,"DD4hepRootPersistency","+++ Cannot open file '%s'.",fname); return 0; } -int DD4hepRootPersistency::load(DD4hep::Geometry::LCDD& lcdd, const char* fname, const char* instance) { +int DD4hepRootPersistency::load(dd4hep::Detector& description, const char* fname, const char* instance) { TFile* f = TFile::Open(fname); if ( f && !f->IsZombie()) { DD4hepRootPersistency* persist = (DD4hepRootPersistency*)f->Get(instance); if ( persist ) { - LCDDData& data = dynamic_cast<LCDDData&>(lcdd); + DetectorData& data = dynamic_cast<DetectorData&>(description); data.adoptData(*persist); persist->clearData(); delete persist; return 1; } - DD4hep::printout(DD4hep::ERROR,"DD4hepRootPersistency", + dd4hep::printout(dd4hep::ERROR,"DD4hepRootPersistency", "+++ Cannot Cannot load instance '%s' from file '%s'.", instance, fname); f->ls(); delete f; return 0; } - DD4hep::printout(DD4hep::ERROR,"DD4hepRootPersistency","+++ Cannot open file '%s'.",fname); + dd4hep::printout(dd4hep::ERROR,"DD4hepRootPersistency","+++ Cannot open file '%s'.",fname); return 0; } diff --git a/DDCore/src/DD4hepUI.cpp b/DDCore/src/DD4hepUI.cpp index fc45a17eb..6c2dc79d3 100644 --- a/DDCore/src/DD4hepUI.cpp +++ b/DDCore/src/DD4hepUI.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,32 +16,32 @@ #include "DD4hep/Printout.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; /// Default constructor -DD4hepUI::DD4hepUI(LCDD& instance) : m_lcdd(instance) { +DD4hepUI::DD4hepUI(Detector& instance) : m_detDesc(instance) { } /// Default destructor DD4hepUI::~DD4hepUI() { } -/// Access to the LCDD instance -LCDD* DD4hepUI::instance() const { - return &m_lcdd; +/// Access to the Detector instance +Detector* DD4hepUI::instance() const { + return &m_detDesc; } -/// Access to the LCDD instance -LCDD* DD4hepUI::lcdd() const { - return &m_lcdd; +/// Access to the Detector instance +Detector* DD4hepUI::detectorDescription() const { + return &m_detDesc; } -/// Install the DD4hep conditions manager object +/// Install the dd4hep conditions manager object Handle<NamedObject> DD4hepUI::conditionsMgr() const { if ( !m_condMgr.isValid() ) { const void* argv[] = {"-handle",&m_condMgr,0}; - if ( 1 != apply("DD4hep_ConditionsManagerInstaller",2,(char**)argv) ) { + if ( 1 != apply("dd4hep_ConditionsManagerInstaller",2,(char**)argv) ) { except("DD4hepUI","Failed to install the conditions manager object."); } if ( !m_condMgr.isValid() ) { @@ -55,17 +55,17 @@ Handle<NamedObject> DD4hepUI::conditionsMgr() const { long DD4hepUI::loadConditions(const std::string& fname) const { Handle<NamedObject> h = conditionsMgr(); if ( h.isValid() ) { - m_lcdd.fromXML(fname, BUILD_DEFAULT); + m_detDesc.fromXML(fname, BUILD_DEFAULT); return 1; } return 0; } -/// Install the DD4hep alignment manager object +/// Install the dd4hep alignment manager object Handle<NamedObject> DD4hepUI::alignmentMgr() const { if ( !m_alignMgr.isValid() ) { const void* argv[] = {"-handle",&m_alignMgr,0}; - if ( 1 != apply("DD4hep_AlignmentsManagerInstaller",2,(char**)argv) ) { + if ( 1 != apply("dd4hep_AlignmentsManagerInstaller",2,(char**)argv) ) { except("DD4hepUI","Failed to install the alignment manager object."); } if ( !m_alignMgr.isValid() ) { @@ -75,31 +75,31 @@ Handle<NamedObject> DD4hepUI::alignmentMgr() const { return m_alignMgr; } -/// LCDD interface: Manipulate geometry using facroy converter +/// Detector interface: Manipulate geometry using facroy converter long DD4hepUI::apply(const char* factory, int argc, char** argv) const { - return m_lcdd.apply(factory,argc,argv); + return m_detDesc.apply(factory,argc,argv); } -/// LCDD interface: Read any geometry description or alignment file -void DD4hepUI::fromXML(const std::string& fname, LCDDBuildType type) const { - return m_lcdd.fromXML(fname, type); +/// Detector interface: Read any geometry description or alignment file +void DD4hepUI::fromXML(const std::string& fname, DetectorBuildType type) const { + return m_detDesc.fromXML(fname, type); } -/// LCDD interface: Re-draw the entire scene +/// Detector interface: Re-draw the entire scene void DD4hepUI::redraw() const { - m_lcdd.worldVolume()->Draw("oglsame"); + m_detDesc.worldVolume()->Draw("oglsame"); } /// Dump the volume tree long DD4hepUI::dumpVols(int argc, char** argv) const { if ( argc==0 ) { const void* av[] = {"-positions","-pointers",0}; - return m_lcdd.apply("DD4hepVolumeDump",2,(char**)av); + return m_detDesc.apply("dd4hepVolumeDump",2,(char**)av); } - return m_lcdd.apply("DD4hepVolumeDump",argc,argv); + return m_detDesc.apply("dd4hepVolumeDump",argc,argv); } /// Dump the DetElement tree long DD4hepUI::dumpDet() const { - return m_lcdd.apply("DD4hepDetectorVolumeDump",0,0); + return m_detDesc.apply("dd4hepDetectorVolumeDump",0,0); } diff --git a/DDCore/src/Detector.cpp b/DDCore/src/DetElement.cpp similarity index 84% rename from DDCore/src/Detector.cpp rename to DDCore/src/DetElement.cpp index b6d7c7d82..7c75ff3e5 100644 --- a/DDCore/src/Detector.cpp +++ b/DDCore/src/DetElement.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,11 +19,11 @@ #include "DD4hep/DetectorTools.h" #include "DD4hep/Printout.h" #include "DD4hep/World.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" using namespace std; -using namespace DD4hep::Geometry; -using DD4hep::Alignments::Alignment; +using namespace dd4hep; +using dd4hep::Alignment; namespace { static string s_empty_string; @@ -39,7 +39,7 @@ DetElement::Processor::~Processor() { /// Clone constructor DetElement::DetElement(Object* det_data, const string& det_name, const string& det_type) - : RefObject(det_data) + : Handle<DetElementObject>(det_data) { this->assign(det_data, det_name, det_type); } @@ -64,8 +64,11 @@ DetElement::DetElement(DetElement det_parent, const string& det_name, int det_id } /// Add an extension object to the detector element -void* DetElement::i_addExtension(void* ext_ptr, const type_info& info, copy_t ctor, destruct_t dtor) const { - return access()->addExtension(ext_ptr, info, ObjectExtensions::copy_t(ctor), dtor); +void* DetElement::i_addExtension(void* ext_ptr, const type_info& info, + void* (*ctor)(const void*, DetElement), + void (*dtor)(void*) ) const +{ + return access()->addExtension(ext_ptr, info, (void* (*)(const void*, void*))(ctor), dtor); } /// Access an existing extension object from the detector element @@ -73,7 +76,7 @@ void* DetElement::i_extension(const type_info& info) const { return access()->extension(info); } -/// Internal call to extend the detector element with an arbitrary structure accessible by the type +/// detaill call to extend the detector element with an arbitrary structure accessible by the type void DetElement::i_addUpdateCall(unsigned int callback_type, const Callback& callback) const { access()->updateCalls.push_back(make_pair(callback,callback_type)); } @@ -88,7 +91,7 @@ const string& DetElement::placementPath() const { Object* o = ptr(); if ( o ) { if (o->placementPath.empty()) { - o->placementPath = DetectorTools::placementPath(*this); + o->placementPath = detail::tools::placementPath(*this); } return o->placementPath; } @@ -127,7 +130,7 @@ namespace { o->path = "/" + o->name; o->level = 0; } - o->key = DD4hep::hash32(o->path); + o->key = dd4hep::detail::hash32(o->path); } } @@ -186,11 +189,11 @@ DetElement& DetElement::setCombineHits(bool value, SensitiveDetector& sens) { Alignment DetElement::nominal() const { Object* o = access(); if ( !o->nominal.isValid() ) { - o->nominal = Alignments::AlignmentCondition("nominal"); + o->nominal = AlignmentCondition("nominal"); o->nominal->values().detector = *this; //o->flag |= Object::HAVE_WORLD_TRAFO; //o->flag |= Object::HAVE_PARENT_TRAFO; - DD4hep::Alignments::AlignmentTools::computeIdeal(o->nominal); + dd4hep::detail::tools::computeIdeal(o->nominal); } return o->nominal; } @@ -199,8 +202,8 @@ Alignment DetElement::nominal() const { Alignment DetElement::survey() const { Object* o = access(); if ( !o->survey.isValid() ) { - o->survey = Alignments::AlignmentCondition("survey"); - DD4hep::Alignments::AlignmentTools::copy(nominal(), o->survey); + o->survey = AlignmentCondition("survey"); + dd4hep::detail::tools::copy(nominal(), o->survey); } return o->survey; } @@ -233,7 +236,7 @@ DetElement DetElement::world() const { void DetElement::check(bool cond, const string& msg) const { if (cond) { - throw runtime_error("DD4hep: " + msg); + throw runtime_error("dd4hep: " + msg); } } @@ -244,10 +247,10 @@ DetElement& DetElement::add(DetElement sdet) { sdet.access()->parent = *this; return *this; } - throw runtime_error("DD4hep: DetElement::add: Element " + string(sdet.name()) + + throw runtime_error("dd4hep: DetElement::add: Element " + string(sdet.name()) + " is already present in path " + path() + " [Double-Insert]"); } - throw runtime_error("DD4hep: DetElement::add: Self is not defined [Invalid Handle]"); + throw runtime_error("dd4hep: DetElement::add: Self is not defined [Invalid Handle]"); } DetElement DetElement::clone(const string& new_name) const { @@ -288,11 +291,11 @@ DetElement& DetElement::setPlacement(const PlacedVolume& pv) { } return *this; } - throw runtime_error("DD4hep: DetElement::setPlacement: Placement is not defined [Invalid Handle]"); + throw runtime_error("dd4hep: DetElement::setPlacement: Placement is not defined [Invalid Handle]"); } /// The cached VolumeID of this subdetector element -DD4hep::VolumeID DetElement::volumeID() const { +dd4hep::VolumeID DetElement::volumeID() const { if (isValid()) { return object<Object>().volumeID; } @@ -304,31 +307,32 @@ Volume DetElement::volume() const { return access()->placement.volume(); } -DetElement& DetElement::setVisAttributes(const LCDD& lcdd, const string& nam, const Volume& vol) { - vol.setVisAttributes(lcdd, nam); +DetElement& DetElement::setVisAttributes(const Detector& description, const string& nam, const Volume& vol) { + vol.setVisAttributes(description, nam); return *this; } -DetElement& DetElement::setRegion(const LCDD& lcdd, const string& nam, const Volume& vol) { +DetElement& DetElement::setRegion(const Detector& description, const string& nam, const Volume& vol) { if (!nam.empty()) { - vol.setRegion(lcdd.region(nam)); + vol.setRegion(description.region(nam)); } return *this; } -DetElement& DetElement::setLimitSet(const LCDD& lcdd, const string& nam, const Volume& vol) { +DetElement& DetElement::setLimitSet(const Detector& description, const string& nam, const Volume& vol) { if (!nam.empty()) { - vol.setLimitSet(lcdd.limitSet(nam)); + vol.setLimitSet(description.limitSet(nam)); } return *this; } -DetElement& DetElement::setAttributes(const LCDD& lcdd, +DetElement& DetElement::setAttributes(const Detector& description, const Volume& vol, const string& region, const string& limits, - const string& vis) { - return setRegion(lcdd, region, vol).setLimitSet(lcdd, limits, vol).setVisAttributes(lcdd, vis, vol); + const string& vis) +{ + return setRegion(description, region, vol).setLimitSet(description, limits, vol).setVisAttributes(description, vis, vol); } /// Constructor @@ -435,7 +439,10 @@ LimitSet SensitiveDetector::limits() const { } /// Add an extension object to the detector element -void* SensitiveDetector::i_addExtension(void* ext_ptr, const type_info& info, destruct_t dtor) { +void* SensitiveDetector::i_addExtension(void* ext_ptr, + const type_info& info, + void (*dtor)(void*)) +{ return access()->addExtension(ext_ptr, info, dtor); } diff --git a/DDCore/src/LCDDData.cpp b/DDCore/src/DetectorData.cpp similarity index 85% rename from DDCore/src/LCDDData.cpp rename to DDCore/src/DetectorData.cpp index 80e4a73be..1f86f20ed 100644 --- a/DDCore/src/LCDDData.cpp +++ b/DDCore/src/DetectorData.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDDData.h" +#include "DD4hep/DetectorData.h" #include "DD4hep/InstanceCount.h" #include "DD4hep/detail/ObjectsInterna.h" #include "DD4hep/detail/DetectorInterna.h" @@ -20,29 +20,29 @@ // ROOT include files #include "TGeoManager.h" -namespace DD4hep { namespace Geometry { class LCDDImp; }} +namespace dd4hep { namespace detail { class DetectorImp; }} -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::detail; +using namespace dd4hep; /// Default constructor -LCDDData::LCDDData() +DetectorData::DetectorData() : m_manager(0), m_world(), m_trackers(), m_worldVol(), m_trackingVol(), m_field("global"), - m_buildType(BUILD_DEFAULT), m_extensions(typeid(LCDDData)), m_volManager(), + m_buildType(BUILD_DEFAULT), m_extensions(typeid(DetectorData)), m_volManager(), m_inhibitConstants(false) { InstanceCount::increment(this); } /// Standard destructor -LCDDData::~LCDDData() { +DetectorData::~DetectorData() { clearData(); InstanceCount::decrement(this); } /// Clear data content: releases all allocated resources -void LCDDData::destroyData(bool destroy_mgr) { +void DetectorData::destroyData(bool destroy_mgr) { m_extensions.clear(); m_motherVolumes.clear(); @@ -53,7 +53,6 @@ void LCDDData::destroyData(bool destroy_mgr) { destroyHandles(m_idDict); destroyHandles(m_limits); destroyHandles(m_regions); - destroyHandles(m_alignments); destroyHandles(m_sensitive); destroyHandles(m_display); destroyHandles(m_fields); @@ -78,7 +77,7 @@ void LCDDData::destroyData(bool destroy_mgr) { /// Clear data content: releases all allocated resources -void LCDDData::clearData() { +void DetectorData::clearData() { m_extensions.clear(false); m_motherVolumes.clear(); m_world.clear(); @@ -89,7 +88,6 @@ void LCDDData::clearData() { m_idDict.clear(); m_limits.clear(); m_regions.clear(); - m_alignments.clear(); m_sensitive.clear(); m_display.clear(); m_fields.clear(); @@ -106,7 +104,7 @@ void LCDDData::clearData() { } /// Adopt all data from source structure -void LCDDData::adoptData(LCDDData& source) { +void DetectorData::adoptData(DetectorData& source) { m_inhibitConstants = source.m_inhibitConstants; m_extensions.move(source.m_extensions); m_motherVolumes = source.m_motherVolumes; @@ -118,7 +116,6 @@ void LCDDData::adoptData(LCDDData& source) { m_idDict = source.m_idDict; m_limits = source.m_limits; m_regions = source.m_regions; - m_alignments = source.m_alignments; m_sensitive = source.m_sensitive; m_display = source.m_display; m_fields = source.m_fields; diff --git a/DDCore/src/LCDDHelper.cpp b/DDCore/src/DetectorHelper.cpp similarity index 64% rename from DDCore/src/LCDDHelper.cpp rename to DDCore/src/DetectorHelper.cpp index a391a8bc0..bd91eee26 100644 --- a/DDCore/src/LCDDHelper.cpp +++ b/DDCore/src/DetectorHelper.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,27 +11,27 @@ // //========================================================================== -#include "DD4hep/LCDDHelper.h" +#include "DD4hep/DetectorHelper.h" using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// Access the sensitive detector of a given subdetector (if the sub-detector is sensitive!) -SensitiveDetector LCDDHelper::sensitiveDetector(const std::string& detector) const { +SensitiveDetector DetectorHelper::sensitiveDetector(const std::string& detector) const { const string& det_name = detector; SensitiveDetector sensitive = ptr()->sensitiveDetector(det_name); return sensitive; } /// Given a detector element, access it's sensitive detector (if the sub-detector is sensitive!) -SensitiveDetector LCDDHelper::sensitiveDetector(DetElement detector) const { +SensitiveDetector DetectorHelper::sensitiveDetector(DetElement detector) const { for(DetElement par = detector; par.isValid(); par = par.parent()) { if ( par.ptr() != ptr()->world().ptr() ) { PlacedVolume pv = par.placement(); if ( pv.isValid() ) { - const PlacedVolume::VolIDs& ids = pv.volIDs(); - for(PlacedVolume::VolIDs::const_iterator i=ids.begin(); i!=ids.end();++i) { - if ( (*i).first == "system" ) { + const auto& ids = pv.volIDs(); + for(const auto& i : ids ) { + if ( i.first == "system" ) { return sensitiveDetector(par.name()); } } @@ -42,10 +42,10 @@ SensitiveDetector LCDDHelper::sensitiveDetector(DetElement detector) const { } /// Find a detector element by it's system ID -DetElement LCDDHelper::detectorByID(int id) const { - const LCDD::HandleMap& dets = ptr()->detectors(); - for(LCDD::HandleMap::const_iterator i=dets.begin(); i!=dets.end(); ++i) { - DetElement de = (*i).second; +DetElement DetectorHelper::detectorByID(int id) const { + const Detector::HandleMap& dets = ptr()->detectors(); + for(const auto& i : dets ) { + DetElement de(i.second); if ( de.id() == id ) return de; } return DetElement(0); diff --git a/DDCore/src/LCDDImp.cpp b/DDCore/src/DetectorImp.cpp similarity index 72% rename from DDCore/src/LCDDImp.cpp rename to DDCore/src/DetectorImp.cpp index 2251ddb18..99e00bc59 100644 --- a/DDCore/src/LCDDImp.cpp +++ b/DDCore/src/DetectorImp.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,11 +15,11 @@ #include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" #include "DD4hep/GeoHandler.h" -#include "DD4hep/LCDDHelper.h" +#include "DD4hep/DetectorHelper.h" #include "DD4hep/InstanceCount.h" #include "DD4hep/detail/VolumeManagerInterna.h" #include "DD4hep/detail/DetectorInterna.h" -#include "LCDDImp.h" +#include "DetectorImp.h" // C/C++ include files #include <iostream> @@ -41,29 +41,28 @@ #endif #ifndef __TIXML__ #include "xercesc/dom/DOMException.hpp" -namespace DD4hep { - namespace XML { +namespace dd4hep { + namespace xml { typedef xercesc::DOMException XmlException; } } #endif -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep; using namespace std; namespace { struct TypePreserve { - LCDDBuildType& m_t; - TypePreserve(LCDDBuildType& t) + DetectorBuildType& m_t; + TypePreserve(DetectorBuildType& t) : m_t(t) { } ~TypePreserve() { m_t = BUILD_NONE; } }; - static LCDD* s_lcdd = 0; + static Detector* s_description = 0; - void lcdd_unexpected() { + void description_unexpected() { try { throw; } catch( exception& e ) { @@ -83,35 +82,35 @@ namespace { } } -string DD4hep::versionString(){ +string dd4hep::versionString(){ string vs("vXX-YY") ; sprintf( &vs[0] , "v%2.2d-%2.2d", DD4HEP_MAJOR_VERSION, DD4HEP_MINOR_VERSION ) ; return vs; } -LCDD& LCDD::getInstance() { - if (!s_lcdd) - s_lcdd = new LCDDImp(); - return *s_lcdd; +Detector& Detector::getInstance() { + if (!s_description) + s_description = new DetectorImp(); + return *s_description; } /// Destroy the instance -void LCDD::destroyInstance() { - if (s_lcdd) - delete s_lcdd; - s_lcdd = 0; +void Detector::destroyInstance() { + if (s_description) + delete s_description; + s_description = 0; } /// Default constructor -LCDDImp::LCDDImp() : LCDDData(), LCDDLoad(this), m_buildType(BUILD_NONE) +DetectorImp::DetectorImp() : DetectorData(), DetectorLoad(this), m_buildType(BUILD_NONE) { - set_unexpected( lcdd_unexpected ) ; - set_terminate( lcdd_unexpected ) ; + set_unexpected( description_unexpected ) ; + set_terminate( description_unexpected ) ; InstanceCount::increment(this); if (0 == gGeoManager) { - gGeoManager = new TGeoManager("world", "LCDD Geometry"); + gGeoManager = new TGeoManager("world", "Detector Geometry"); } { m_manager = gGeoManager; @@ -140,7 +139,7 @@ LCDDImp::LCDDImp() : LCDDData(), LCDDLoad(this), m_buildType(BUILD_NONE) } /// Standard destructor -LCDDImp::~LCDDImp() { +DetectorImp::~DetectorImp() { if ( m_manager == gGeoManager ) gGeoManager = 0; destroyData(false); m_extensions.clear(); @@ -149,28 +148,28 @@ LCDDImp::~LCDDImp() { // Load volume manager -void LCDDImp::imp_loadVolumeManager() { - destroyHandle(m_volManager); +void DetectorImp::imp_loadVolumeManager() { + detail::destroyHandle(m_volManager); m_volManager = VolumeManager(*this, "World", world(), Readout(), VolumeManager::TREE); } -/// Add an extension object to the LCDD instance -void* LCDDImp::addUserExtension(void* ptr, const type_info& info, void (*destruct)(void*)) { +/// Add an extension object to the Detector instance +void* DetectorImp::addUserExtension(void* ptr, const type_info& info, void (*destruct)(void*)) { return m_extensions.addExtension(ptr,info,destruct); } -/// Remove an existing extension object from the LCDD instance -void* LCDDImp::removeUserExtension(const type_info& info, bool destroy) { +/// Remove an existing extension object from the Detector instance +void* DetectorImp::removeUserExtension(const type_info& info, bool destroy) { return m_extensions.removeExtension(info,destroy); } -/// Access an existing extension object from the LCDD instance -void* LCDDImp::userExtension(const type_info& info, bool alert) const { +/// Access an existing extension object from the Detector instance +void* DetectorImp::userExtension(const type_info& info, bool alert) const { return m_extensions.extension(info,alert); } /// Register new mother volume using the detector name. -void LCDDImp::declareMotherVolume(const string& detector_name, const Volume& vol) { +void DetectorImp::declareMotherVolume(const string& detector_name, const Volume& vol) { if ( !detector_name.empty() ) { if ( vol.isValid() ) { HandleMap::const_iterator i = m_motherVolumes.find(detector_name); @@ -178,15 +177,15 @@ void LCDDImp::declareMotherVolume(const string& detector_name, const Volume& vol m_motherVolumes.insert(make_pair(detector_name,vol)); return; } - throw runtime_error("LCDD: A mother volume to the detector "+detector_name+" was already registered."); + throw runtime_error("Detector: A mother volume to the detector "+detector_name+" was already registered."); } - throw runtime_error("LCDD: Attempt to register invalid mother volume for detector:"+detector_name+" [Invalid-Handle]."); + throw runtime_error("Detector: Attempt to register invalid mother volume for detector:"+detector_name+" [Invalid-Handle]."); } - throw runtime_error("LCDD: Attempt to register mother volume to invalid detector [Invalid-detector-name]."); + throw runtime_error("Detector: Attempt to register mother volume to invalid detector [Invalid-detector-name]."); } /// Access mother volume by detector element -Volume LCDDImp::pickMotherVolume(const DetElement& de) const { +Volume DetectorImp::pickMotherVolume(const DetElement& de) const { if ( de.isValid() ) { string de_name = de.name(); HandleMap::const_iterator i = m_motherVolumes.find(de_name); @@ -195,21 +194,21 @@ Volume LCDDImp::pickMotherVolume(const DetElement& de) const { } return (*i).second; } - throw runtime_error("LCDD: Attempt access mother volume of invalid detector [Invalid-handle]"); + throw runtime_error("Detector: Attempt access mother volume of invalid detector [Invalid-handle]"); } -LCDD& LCDDImp::addDetector(const Ref_t& ref_det) { +Detector& DetectorImp::addDetector(const Ref_t& ref_det) { DetElement det_element(ref_det); - LCDDHelper helper(this); + DetectorHelper helper(this); DetElement existing_det = helper.detectorByID(det_element.id()); if ( existing_det.isValid() ) { SensitiveDetector sd = helper.sensitiveDetector(existing_det); if ( sd.isValid() ) { stringstream str; - str << "LCDD: The sensitive sub-detectors " << det_element.name() << " and " + str << "Detector: The sensitive sub-detectors " << det_element.name() << " and " << existing_det.name() << " have the identical ID:" << det_element.id() << "."; - printout(ERROR,"LCDD",str.str()); + printout(ERROR,"Detector",str.str()); throw runtime_error(str.str()); } } @@ -217,7 +216,7 @@ LCDD& LCDDImp::addDetector(const Ref_t& ref_det) { det_element->flag |= DetElement::Object::IS_TOP_LEVEL_DETECTOR; Volume volume = det_element.placement()->GetMotherVolume(); if ( volume == m_worldVol ) { - printout(DEBUG,"LCDD","Added detector %s to the world instance.",det_element.name()); + printout(DEBUG,"Detector","Added detector %s to the world instance.",det_element.name()); m_world.add(det_element); return *this; } @@ -226,17 +225,17 @@ LCDD& LCDDImp::addDetector(const Ref_t& ref_det) { DetElement parent((*i).second); Volume vol = parent.placement().volume(); if ( vol == volume ) { - printout(INFO,"LCDD","Added detector %s to the parent:%s.",det_element.name(),parent.name()); + printout(INFO,"Detector","Added detector %s to the parent:%s.",det_element.name(),parent.name()); parent.add(det_element); return *this; } } - throw runtime_error("LCDD: The detector " + string(det_element.name()) + " has no known parent."); + throw runtime_error("Detector: The detector " + string(det_element.name()) + " has no known parent."); } /// Add a new constant by named reference to the detector description -LCDD& LCDDImp::addConstant(const Ref_t& x) { - if ( strcmp(x.name(),"LCDD_InhibitConstants") == 0 ) { +Detector& DetectorImp::addConstant(const Ref_t& x) { + if ( strcmp(x.name(),"Detector_InhibitConstants") == 0 ) { const char* title = x->GetTitle(); char c = ::toupper(title[0]); m_inhibitConstants = (c=='Y' || c=='T' || c=='1'); @@ -246,49 +245,49 @@ LCDD& LCDDImp::addConstant(const Ref_t& x) { } /// Retrieve a constant by it's name from the detector description -Constant LCDDImp::constant(const string& name) const { +Constant DetectorImp::constant(const string& name) const { if ( !m_inhibitConstants ) { return getRefChild(m_define, name); } - throw runtime_error("LCDD:constant("+name+"): Access to global constants is inhibited."); + throw runtime_error("Detector:constant("+name+"): Access to global constants is inhibited."); } /// Typed access to constants: access string values -string LCDDImp::constantAsString(const string& name) const { +string DetectorImp::constantAsString(const string& name) const { if ( !m_inhibitConstants ) { Ref_t c = constant(name); if (c.isValid()) return c->GetTitle(); - throw runtime_error("LCDD:constantAsString: The constant " + name + " is not known to the system."); + throw runtime_error("Detector:constantAsString: The constant " + name + " is not known to the system."); } - throw runtime_error("LCDD:constantAsString("+name+"):: Access to global constants is inhibited."); + throw runtime_error("Detector:constantAsString("+name+"):: Access to global constants is inhibited."); } /// Typed access to constants: long values -long LCDDImp::constantAsLong(const string& name) const { +long DetectorImp::constantAsLong(const string& name) const { if ( !m_inhibitConstants ) { return _toLong(constantAsString(name)); } - throw runtime_error("LCDD:constantAsLong("+name+"): Access to global constants is inhibited."); + throw runtime_error("Detector:constantAsLong("+name+"): Access to global constants is inhibited."); } /// Typed access to constants: double values -double LCDDImp::constantAsDouble(const string& name) const { +double DetectorImp::constantAsDouble(const string& name) const { if ( !m_inhibitConstants ) { return _toDouble(constantAsString(name)); } - throw runtime_error("LCDD:constantAsDouble("+name+"): Access to global constants is inhibited."); + throw runtime_error("Detector:constantAsDouble("+name+"): Access to global constants is inhibited."); } /// Add a field component by named reference to the detector description -LCDD& LCDDImp::addField(const Ref_t& x) { +Detector& DetectorImp::addField(const Ref_t& x) { m_field.add(x); m_fields.append(x); return *this; } /// Retrieve a matrial by it's name from the detector description -Material LCDDImp::material(const string& name) const { +Material DetectorImp::material(const string& name) const { TGeoMedium* mat = m_manager->GetMedium(name.c_str()); if (mat) { return Material(Ref_t(mat)); @@ -296,10 +295,10 @@ Material LCDDImp::material(const string& name) const { throw runtime_error("Cannot find a material referenced by name:" + name); } -/// Internal helper to map detector types once the geometry is closed -void LCDDImp::mapDetectorTypes() { - for(HandleMap::const_iterator i=m_detectors.begin(); i!=m_detectors.end(); ++i) { - DetElement det((*i).second); +/// detaill helper to map detector types once the geometry is closed +void DetectorImp::mapDetectorTypes() { + for( const auto& i : m_detectors ) { + DetElement det(i.second); if ( det.parent().isValid() ) { // Exclude 'world' HandleMap::const_iterator j=m_sensitive.find(det.name()); if ( j != m_sensitive.end() ) { @@ -317,7 +316,7 @@ void LCDDImp::mapDetectorTypes() { } /// Access the availible detector types -vector<string> LCDDImp::detectorTypes() const { +vector<string> DetectorImp::detectorTypes() const { if ( m_manager->IsClosed() ) { vector<string> v; for(DetectorTypeMap::const_iterator i=m_detectorTypes.begin(); i!=m_detectorTypes.end(); ++i) @@ -328,7 +327,7 @@ vector<string> LCDDImp::detectorTypes() const { } /// Access a set of subdetectors according to the sensitive type. -const vector<DetElement>& LCDDImp::detectors(const string& type, bool throw_exc) { +const vector<DetElement>& DetectorImp::detectors(const string& type, bool throw_exc) { if ( m_manager->IsClosed() ) { if ( throw_exc ) { DetectorTypeMap::const_iterator i=m_detectorTypes.find(type); @@ -341,7 +340,7 @@ const vector<DetElement>& LCDDImp::detectors(const string& type, bool throw_exc) throw runtime_error("detectors("+type+"): Detectors can only selected by type once the geometry is closed!"); } -vector<DetElement> LCDDImp::detectors(unsigned int includeFlag, unsigned int excludeFlag ) const { +vector<DetElement> DetectorImp::detectors(unsigned int includeFlag, unsigned int excludeFlag ) const { if( ! m_manager->IsClosed() ) { throw runtime_error("detectors(typeFlag): Detectors can only selected by typeFlag once the geometry is closed!"); } @@ -364,7 +363,7 @@ vector<DetElement> LCDDImp::detectors(unsigned int includeFlag, unsigned int exc } /// Access a set of subdetectors according to several sensitive types. -vector<DetElement> LCDDImp::detectors(const string& type1, +vector<DetElement> DetectorImp::detectors(const string& type1, const string& type2, const string& type3, const string& type4, @@ -387,7 +386,7 @@ vector<DetElement> LCDDImp::detectors(const string& type1, throw runtime_error("detectors("+type1+","+type2+",...): Detectors can only selected by type once the geometry is closed!"); } -Handle<TObject> LCDDImp::getRefChild(const HandleMap& e, const string& name, bool do_throw) const { +Handle<TObject> DetectorImp::getRefChild(const HandleMap& e, const string& name, bool do_throw) const { HandleMap::const_iterator i = e.find(name); if (i != e.end()) { return (*i).second; @@ -404,21 +403,19 @@ Handle<TObject> LCDDImp::getRefChild(const HandleMap& e, const string& name, boo } namespace { - struct ShapePatcher: public GeoScan { + struct ShapePatcher: public detail::GeoScan { VolumeManager m_volManager; DetElement m_world; ShapePatcher(VolumeManager m, DetElement e) - : GeoScan(e), m_volManager(m), m_world(e) { + : detail::GeoScan(e), m_volManager(m), m_world(e) { } void patchShapes() { - GeoHandler::Data& data = *m_data; - char text[32]; + auto& data = *m_data; + char text[32]; string nam; - printout(INFO,"LCDD","+++ Patching names of anonymous shapes...."); - for (GeoHandler::Data::const_reverse_iterator i = data.rbegin(); i != data.rend(); ++i) { - const GeoHandler::Data::mapped_type& v = (*i).second; - for (GeoHandler::Data::mapped_type::const_iterator j = v.begin(); j != v.end(); ++j) { - const TGeoNode* n = *j; + printout(INFO,"Detector","+++ Patching names of anonymous shapes...."); + for (auto i = data.rbegin(); i != data.rend(); ++i) { + for( const TGeoNode* n : (*i).second ) { TGeoVolume* vol = n->GetVolume(); TGeoShape* s = vol->GetShape(); const char* sn = s->GetName(); @@ -466,7 +463,7 @@ namespace { } -void LCDDImp::endDocument() { +void DetectorImp::endDocument() { TGeoManager* mgr = m_manager; if (!mgr->IsClosed()) { #if 0 @@ -490,11 +487,11 @@ void LCDDImp::endDocument() { } } -void LCDDImp::init() { +void DetectorImp::init() { if (!m_world.isValid()) { TGeoManager* mgr = m_manager; Box worldSolid("world_x", "world_y", "world_z"); - printout(INFO,"LCDD"," *********** created World volume with size : %7.0f %7.0f %7.0f", + printout(INFO,"Detector"," *********** created World volume with size : %7.0f %7.0f %7.0f", worldSolid->GetDX(), worldSolid->GetDY(), worldSolid->GetDZ()); m_materialAir = material("Air"); @@ -522,23 +519,22 @@ void LCDDImp::init() { Volume tracking("tracking_volume",trackingSolid, m_materialAir); m_trackers = TopDetElement("tracking"); m_trackingVol = tracking; - PlacedVolume pv = m_worldVol.placeVolume(tracking); - m_trackers.setPlacement(pv); + m_trackers.setPlacement(m_worldVol.placeVolume(tracking)); m_world.add(m_trackers); #endif m_detectors.append(m_world); m_manager->SetTopVolume(m_worldVol.ptr()); - m_world.setPlacement(PlacedVolume(mgr->GetTopNode())); + m_world.setPlacement(mgr->GetTopNode()); } } /// Read any geometry description or alignment file -void LCDDImp::fromXML(const string& xmlfile, LCDDBuildType build_type) { +void DetectorImp::fromXML(const string& xmlfile, DetectorBuildType build_type) { TypePreserve build_type_preserve(m_buildType = build_type); #if DD4HEP_USE_PYROOT string cmd; - TPython::Exec("import lcdd"); - cmd = "lcdd.fromXML('" + xmlfile + "')"; + TPython::Exec("import description"); + cmd = "description.fromXML('" + xmlfile + "')"; TPython::Exec(cmd.c_str()); #else processXML(xmlfile,0); @@ -546,12 +542,12 @@ void LCDDImp::fromXML(const string& xmlfile, LCDDBuildType build_type) { } /// Read any geometry description or alignment file with external XML entity resolution -void LCDDImp::fromXML(const string& fname, UriReader* entity_resolver, LCDDBuildType build_type) { +void DetectorImp::fromXML(const string& fname, xml::UriReader* entity_resolver, DetectorBuildType build_type) { TypePreserve build_type_preserve(m_buildType = build_type); processXML(fname,entity_resolver); } -void LCDDImp::dump() const { +void DetectorImp::dump() const { TGeoManager* mgr = m_manager; mgr->SetVisLevel(4); mgr->SetVisOption(1); @@ -559,29 +555,29 @@ void LCDDImp::dump() const { } /// Manipulate geometry using facroy converter -long LCDDImp::apply(const char* factory_type, int argc, char** argv) { +long DetectorImp::apply(const char* factory_type, int argc, char** argv) { string fac = factory_type; try { - long result = PluginService::Create<long>(fac, (LCDD*) this, argc, argv); + long result = PluginService::Create<long>(fac, (Detector*) this, argc, argv); if (0 == result) { PluginDebug dbg; - result = PluginService::Create<long>(fac, (LCDD*) this, argc, argv); + result = PluginService::Create<long>(fac, (Detector*) this, argc, argv); if ( 0 == result ) { - throw runtime_error("DD4hep: apply-plugin: Failed to locate plugin " + + throw runtime_error("dd4hep: apply-plugin: Failed to locate plugin " + fac + ". " + dbg.missingFactory(fac)); } } result = *(long*) result; if (result != 1) { - throw runtime_error("DD4hep: apply-plugin: Failed to execute plugin " + fac); + throw runtime_error("dd4hep: apply-plugin: Failed to execute plugin " + fac); } return result; } - catch (const XML::XmlException& e) { - throw runtime_error(XML::_toString(e.msg) + "\nDD4hep: XML-DOM Exception with plugin:" + fac); + catch (const xml::XmlException& e) { + throw runtime_error(xml::_toString(e.msg) + "\ndd4hep: XML-DOM Exception with plugin:" + fac); } catch (const exception& e) { - throw runtime_error(string(e.what()) + "\nDD4hep: with plugin:" + fac); + throw runtime_error(string(e.what()) + "\ndd4hep: with plugin:" + fac); } catch (...) { throw runtime_error("UNKNOWN exception from plugin:" + fac); diff --git a/DDCore/src/DetectorImp.h b/DDCore/src/DetectorImp.h new file mode 100644 index 000000000..4a54d80c2 --- /dev/null +++ b/DDCore/src/DetectorImp.h @@ -0,0 +1,355 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +#ifndef dd4hep_DetectorGEOIMP_H +#define dd4hep_DetectorGEOIMP_H + +// Framework include files +#include "DD4hep/DetectorData.h" +#include "DD4hep/DetectorLoad.h" + +// Forward declarations +class TGeoManager; + +// C/C++ include files +#include <map> + +/// Namespace for the AIDA detector description toolkit +namespace dd4hep { + + /// Concrete implementation class of the Detector interface + /** @class DetectorImp DetectorImp.h src/DetectorImp.h + * + * @author M.Frank + * @version 1.0 + */ + class DetectorImp: public Detector, public DetectorData, public DetectorLoad { + protected: + /// Cached map with detector types: + typedef std::map<std::string, std::vector<DetElement> > DetectorTypeMap; + + /// Inventory of detector types + DetectorTypeMap m_detectorTypes; + + /// VolumeManager m_volManager; + DetectorBuildType m_buildType; + + private: + /// Disable copy constructor + DetectorImp(const DetectorImp& copy) = delete; + + /// Disable assignment operator + DetectorImp& operator=(const DetectorImp& copy) = delete; + + /// detaill helper to map detector types once the geometry is closed + void mapDetectorTypes(); + public: + + /// Local method (no interface): Load volume manager. + void imp_loadVolumeManager(); + + /// Default constructor + DetectorImp(); + + /// Standard destructor + virtual ~DetectorImp(); + + /// Access flag to steer the detail of building of the geometry/detector description + virtual DetectorBuildType buildType() const { + return m_buildType; + } + + /// Read compact geometry description or alignment file + virtual void fromCompact(const std::string& fname, DetectorBuildType type = BUILD_DEFAULT) { + fromXML(fname, type); + } + + /// Read any XML file + virtual void fromXML(const std::string& fname, DetectorBuildType type = BUILD_DEFAULT); + + /// Read any geometry description or alignment file with external XML entity resolution + virtual void fromXML(const std::string& fname, + xml::UriReader* entity_resolver, + DetectorBuildType type = BUILD_DEFAULT); + + virtual void dump() const; + + /// Manipulate geometry using facroy converter + virtual long apply(const char* factory, int argc, char** argv); + + virtual void init(); + virtual void endDocument(); + + /// Add an extension object to the Detector instance + virtual void* addUserExtension(void* ptr, const std::type_info& info, void (*destruct)(void*)); + + /// Remove an existing extension object from the Detector instance. If not destroyed, the instance is returned + virtual void* removeUserExtension(const std::type_info& info, bool destroy=true); + + /// Access an existing extension object from the Detector instance + virtual void* userExtension(const std::type_info& info, bool alert=true) const; + + virtual Handle<TObject> getRefChild(const HandleMap& e, const std::string& name, bool throw_if_not = true) const; + + /// Register new mother volume using the detector name. + virtual void declareMotherVolume(const std::string& detector_name, const Volume& vol); + + /// Access mother volume by detector element + virtual Volume pickMotherVolume(const DetElement& sd) const; + + /// Access the geometry manager of this instance + virtual TGeoManager& manager() const { + return *m_manager; + } + /// Access to properties + Properties& properties() const { + return *(Properties*)&m_properties; + } + /// Return handle to material describing air + virtual Material air() const { + return m_materialAir; + } + /// Return handle to material describing vacuum + virtual Material vacuum() const { + return m_materialVacuum; + } + /// Return handle to "invisible" visualization attributes + virtual VisAttr invisible() const { + return m_invisibleVis; + } + /// Return reference to the top-most (world) detector element + virtual DetElement world() const { + return m_world; + } + /// Return reference to detector element with all tracker devices. + virtual DetElement trackers() const { + return m_trackers; + } + /// Return handle to the world volume containing everything + virtual Volume worldVolume() const { + return m_worldVol; + } + /// Return handle to the world volume containing the volume with the tracking devices + virtual Volume trackingVolume() const { + return m_trackingVol; + } + /// Return handle to the VolumeManager + virtual VolumeManager volumeManager() const { + return m_volManager; + } + /// Return handle to the combined electromagentic field description. + virtual OverlayedField field() const { + return m_field; + } + /// Accessor to the header entry + virtual Header header() const { + return m_header; + } + /// Accessor to the header entry + virtual void setHeader(Header h) { + m_header = h; + } + + /// Typed access to constants: access string values + virtual std::string constantAsString(const std::string& name) const; + + /// Typed access to constants: long values + virtual long constantAsLong(const std::string& name) const; + + /// Typed access to constants: double values + virtual double constantAsDouble(const std::string& name) const; + + /// Retrieve a constant by it's name from the detector description + virtual Constant constant(const std::string& name) const; + + /// Retrieve a limitset by it's name from the detector description + virtual LimitSet limitSet(const std::string& name) const { + return getRefChild(m_limits, name); + } + /// Retrieve a visualization attribute by it's name from the detector description + virtual VisAttr visAttributes(const std::string& name) const { + return getRefChild(m_display, name, false); + } + /// Retrieve a matrial by it's name from the detector description + virtual Material material(const std::string& name) const; + + /// Retrieve a region object by it's name from the detector description + virtual Region region(const std::string& name) const { + return getRefChild(m_regions, name); + } + /// Retrieve a id descriptor by it's name from the detector description + virtual IDDescriptor idSpecification(const std::string& name) const { + return getRefChild(m_idDict, name); + } + /// Retrieve a readout object by it's name from the detector description + virtual Readout readout(const std::string& name) const { + return getRefChild(m_readouts, name); + } + /// Retrieve a subdetector element by it's name from the detector description + virtual DetElement detector(const std::string& name) const { + return getRefChild(m_detectors, name); + } + /// Retrieve a sensitive detector by it's name from the detector description + virtual SensitiveDetector sensitiveDetector(const std::string& name) const { + return getRefChild(m_sensitive, name, false); + } + /// Retrieve a subdetector element by it's name from the detector description + virtual CartesianField field(const std::string& name) const { + return getRefChild(m_fields, name, false); + } + + /// Accessor to the map of constants + virtual const HandleMap& constants() const { + return m_define; + } + /// Accessor to the map of visualisation attributes + virtual const HandleMap& visAttributes() const { + return m_display; + } + /// Accessor to the map of limit settings + virtual const HandleMap& limitsets() const { + return m_limits; + } + /// Accessor to the map of region settings + virtual const HandleMap& regions() const { + return m_regions; + } + /// Accessor to the map of readout structures + virtual const HandleMap& readouts() const { + return m_readouts; + } + /// Accessor to the map of sub-detectors + virtual const HandleMap& detectors() const { + return m_detectors; + } + /// Retrieve a sensitive detector by it's name from the detector description + virtual const HandleMap& sensitiveDetectors() const { + return m_sensitive; + } + /// Accessor to the map of field entries, which together form the global field + virtual const HandleMap& fields() const { + return m_fields; + } + /// Accessor to the map of ID specifications + virtual const HandleMap& idSpecifications() const { + return m_idDict; + } + + /// Access a set of subdetectors according to the sensitive type. + /** + Please note: + - The sensitive type of a detector is set in the 'detector constructor'. + - Not sensitive detector structures have the name 'passive' + - Compounds (ie. nested detectors) are of type 'compound' + - If throw_exc is set to true, an exception is thrown if the type + is not present. Otherwise an empty detector container is returned. + */ + virtual const std::vector<DetElement>& detectors(const std::string& type, bool throw_exc); + + /// Access a set of subdetectors according to several sensitive types. + virtual std::vector<DetElement> detectors(const std::string& type1, + const std::string& type2, + const std::string& type3="", + const std::string& type4="", + const std::string& type5="" ); + + /// Access the availible detector types + virtual std::vector<std::string> detectorTypes() const; + + /** return a vector with all detectors that have all the type properties in + * includeFlag set but none of the properties given in excludeFlag + */ + virtual std::vector<DetElement> detectors(unsigned int includeFlag, + unsigned int excludeFlag=0 ) const ; + + +#define __R return *this + /// Add a new constant to the detector description + virtual Detector& add(Constant x) { + return addConstant(x); + } + /// Add a new limit set to the detector description + virtual Detector& add(LimitSet x) { + return addLimitSet(x); + } + /// Add a new detector region to the detector description + virtual Detector& add(Region x) { + return addRegion(x); + } + /// Add a new visualisation attribute to the detector description + virtual Detector& add(VisAttr x) { + return addVisAttribute(x); + } + /// Add a new id descriptor to the detector description + virtual Detector& add(IDDescriptor x) { + return addIDSpecification(x); + } + /// Add a new detector readout to the detector description + virtual Detector& add(Readout x) { + return addReadout(x); + } + /// Add a new sensitive detector to the detector description + virtual Detector& add(SensitiveDetector x) { + return addSensitiveDetector(x); + } + /// Add a new subdetector to the detector description + virtual Detector& add(DetElement x) { + return addDetector(x); + } + /// Add a field component to the detector description + virtual Detector& add(CartesianField x) { + return addField(x); + } + + /// Add a new constant by named reference to the detector description + virtual Detector& addConstant(const Ref_t& x); + + /// Add a new limit set by named reference to the detector description + virtual Detector& addLimitSet(const Ref_t& x) { + m_limits.append(x); + __R; + } + /// Add a new detector region by named reference to the detector description + virtual Detector& addRegion(const Ref_t& x) { + m_regions.append(x); + __R; + } + /// Add a new id descriptor by named reference to the detector description + virtual Detector& addIDSpecification(const Ref_t& x) { + m_idDict.append(x); + __R; + } + /// Add a new detector readout by named reference to the detector description + virtual Detector& addReadout(const Ref_t& x) { + m_readouts.append(x); + __R; + } + /// Add a new visualisation attribute by named reference to the detector description + virtual Detector& addVisAttribute(const Ref_t& x) { + m_display.append(x); + __R; + } + /// Add a new sensitive detector by named reference to the detector description + virtual Detector& addSensitiveDetector(const Ref_t& x) { + m_sensitive.append(x); + __R; + } + /// Add a new subdetector by named reference to the detector description + virtual Detector& addDetector(const Ref_t& x); + /// Add a field component by named reference to the detector description + virtual Detector& addField(const Ref_t& x); +#undef __R + + }; +} /* End namespace dd4hep */ +#endif /* dd4hep_DetectorGEOIMP_H */ diff --git a/DDCore/src/DetectorInterna.cpp b/DDCore/src/DetectorInterna.cpp index 176e343b8..7aa22b294 100644 --- a/DDCore/src/DetectorInterna.cpp +++ b/DDCore/src/DetectorInterna.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,10 +24,10 @@ #include "TGeoManager.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; -typedef DetectorTools::PlacementPath PlacementPath; -typedef DetectorTools::ElementPath ElementPath; +using namespace dd4hep; +using namespace dd4hep::detail; +typedef detail::tools::PlacementPath PlacementPath; +typedef detail::tools::ElementPath ElementPath; DD4HEP_INSTANTIATE_HANDLE_NAMED(WorldObject); DD4HEP_INSTANTIATE_HANDLE_NAMED(DetElementObject); @@ -50,7 +50,7 @@ SensitiveDetectorObject::SensitiveDetectorObject(const std::string& nam) InstanceCount::increment(this); } -/// Internal object destructor: release extension object(s) +/// detaill object destructor: release extension object(s) SensitiveDetectorObject::~SensitiveDetectorObject() { readout.clear(); region.clear(); @@ -64,7 +64,7 @@ DetElementObject::DetElementObject() : NamedObject(), ObjectExtensions(typeid(DetElementObject)), magic(magic_word()), flag(0), id(0), combineHits(0), typeFlag(0), level(-1), key(0), path(), placementPath(), idealPlace(), placement(), volumeID(0), parent(), children(), - nominal(), survey(), worldTrafo() + nominal(), survey() { printout(VERBOSE,"DetElementObject","+++ Created new anonymous DetElementObject()"); InstanceCount::increment(this); @@ -75,14 +75,14 @@ DetElementObject::DetElementObject(const std::string& nam, int ident) : NamedObject(), ObjectExtensions(typeid(DetElementObject)), magic(magic_word()), flag(0), id(ident), combineHits(0), typeFlag(0), level(-1), key(0), path(), placementPath(), idealPlace(), placement(), volumeID(0), parent(), children(), - nominal(), survey(), worldTrafo() + nominal(), survey() { SetName(nam.c_str()); printout(VERBOSE,"DetElementObject","+++ Created new DetElementObject('%s', %d)",nam.c_str(),id); InstanceCount::increment(this); } -/// Internal object destructor: release extension object(s) +/// detaill object destructor: release extension object(s) DetElementObject::~DetElementObject() { destroyHandles(children); destroyHandle (nominal); @@ -120,12 +120,12 @@ DetElementObject* DetElementObject::clone(int new_id, int flg) const { const NamedObject* pc = i.second.ptr(); const DetElementObject& d = i.second._data(); DetElement child(d.clone(d.id, DetElement::COPY_PLACEMENT), pc->GetName(), pc->GetTitle()); - pair<Children::iterator, bool> r = obj->children.insert(make_pair(child.name(), child)); + pair<DetElement::Children::iterator, bool> r = obj->children.insert(make_pair(child.name(), child)); if (r.second) { child._data().parent = obj; } else { - throw runtime_error("DD4hep: DetElement::copy: Element " + string(child.name()) + + throw runtime_error("dd4hep: DetElement::copy: Element " + string(child.name()) + " is already present [Double-Insert]"); } } @@ -145,52 +145,22 @@ World DetElementObject::i_access_world() { return privateWorld; } -/// Create cached matrix to transform to world coordinates -const TGeoHMatrix& DetElementObject::__worldTransformation() { - //DD4HEP_DEPRECATED_CALL("DetElementObject","DetElement::nominal()",__PRETTY_FUNCTION__); - if ( (flag&HAVE_WORLD_TRAFO) == 0 ) { - PlacementPath nodes; - flag |= HAVE_WORLD_TRAFO; - DetectorTools::placementPath(this, nodes); - DetectorTools::placementTrafo(nodes,false,worldTrafo); - } - return worldTrafo; -} - -/// Create cached matrix to transform to parent coordinates -const TGeoHMatrix& DetElementObject::__parentTransformation() { - //DD4HEP_DEPRECATED_CALL("DetElementObject","DetElement::nominal()",__PRETTY_FUNCTION__); - if ( (flag&HAVE_PARENT_TRAFO) == 0 ) { - PlacementPath nodes; - flag |= HAVE_PARENT_TRAFO; - DetectorTools::placementPath(DetElement(parent), this, nodes); - DetectorTools::placementTrafo(nodes,false,parentTrafo); - } - return parentTrafo; -#if 0 - return DetElement(this).nominal().detectorTransformation(); -#endif -} - /// Revalidate the caches -void DetElementObject::revalidate(TGeoHMatrix* parent_world_trafo) { +void DetElementObject::revalidate() { PlacementPath par_path; DetElement det(this); DetElement par(det.parent()); DetElement wrld = world(); - bool print = (DEBUG > printLevel()); string place = det.placementPath(); - bool have_trafo = (flag&HAVE_WORLD_TRAFO); - DetectorTools::placementPath(par, this, par_path); - PlacedVolume node = DetectorTools::findNode(wrld.placement(),place); + detail::tools::placementPath(par, this, par_path); + PlacedVolume node = detail::tools::findNode(wrld.placement(),place); if ( !node.isValid() ) { - throw runtime_error("DD4hep: DetElement: The placement " + place + " is not part of the hierarchy."); + except("DetElement","The placement %s is not part of the hierarchy.",place.c_str()); } - //print = (idealPlace.ptr() != node.ptr()); printout((idealPlace.ptr() != node.ptr()) ? INFO : DEBUG, "DetElement","+++ Invalidate chache of %s -> %s Placement:%p --> %p %s", - det.path().c_str(), DetectorTools::placementPath(par_path).c_str(), + det.path().c_str(), detail::tools::placementPath(par_path).c_str(), placement.ptr(), node.ptr(), (placement.ptr() == node.ptr()) ? "" : "[UPDATE]"); if ( idealPlace.ptr() != node.ptr() && 0 == node->GetUserExtension() ) { auto ext = idealPlace->GetUserExtension(); @@ -204,34 +174,9 @@ void DetElementObject::revalidate(TGeoHMatrix* parent_world_trafo) { } // Now we can assign the new placement to the object placement = node; - - Alignments::AlignmentData& data = det.nominal().data(); - if ( have_trafo && print ) data.worldTransformation().Print(); - - if ( (flag&HAVE_PARENT_TRAFO) ) { - DetectorTools::placementTrafo(par_path,false,data.detectorTrafo); - } - - /// Compute world transformations - if ( parent_world_trafo ) { - // If possible use the pre-computed values from the parent - worldTrafo = *parent_world_trafo; - worldTrafo.Multiply(&data.detectorTransformation()); - flag |= HAVE_WORLD_TRAFO; - } - else if ( have_trafo ) { - // Else re-compute the transformation to the world. - PlacementPath world_nodes; - DetectorTools::placementPath(this, world_nodes); - DetectorTools::placementTrafo(world_nodes,false,data.worldTrafo); - flag |= HAVE_WORLD_TRAFO; - } - - if ( (flag&HAVE_PARENT_TRAFO) && print ) data.worldTrafo.Print(); - /// Now iterate down the children.... for(const auto& i : children ) - i.second->revalidate(&data.worldTrafo); + i.second->revalidate(); } /// Remove callback from object @@ -250,14 +195,10 @@ void DetElementObject::update(unsigned int tags, void* param) { const void* args[3] = { (void*)((unsigned long)tags), this, param }; if ( (tags&DetElement::PLACEMENT_CHANGED)==DetElement::PLACEMENT_CHANGED && (tags&DetElement::PLACEMENT_HIGHEST)==DetElement::PLACEMENT_HIGHEST ) { - printout(INFO,"DetElement","+++ Need to update chaches and child caches of %s", + printout(INFO,"DetElement", + "++ Need to update local and child caches of %s", det.path().c_str()); - DetElement par = det.parent(); - TGeoHMatrix* parent_world_trafo = 0; - if ( par.isValid() && (par->flag&HAVE_PARENT_TRAFO) ) { - parent_world_trafo = &par->worldTrafo; - } - revalidate(parent_world_trafo); + revalidate(); } for ( const auto& i : updateCalls ) { if ( (tags&i.second) ) @@ -266,11 +207,11 @@ void DetElementObject::update(unsigned int tags, void* param) { } /// Initializing constructor -WorldObject::WorldObject(LCDD& _lcdd, const string& nam) - : DetElementObject(nam,0), lcdd(&_lcdd) +WorldObject::WorldObject(Detector& _description, const string& nam) + : DetElementObject(nam,0), description(&_description) { } -/// Internal object destructor: release extension object(s) +/// detaill object destructor: release extension object(s) WorldObject::~WorldObject() { } diff --git a/DDCore/src/LCDDLoad.cpp b/DDCore/src/DetectorLoad.cpp similarity index 53% rename from DDCore/src/LCDDLoad.cpp rename to DDCore/src/DetectorLoad.cpp index 182d1bc80..dc0665f02 100644 --- a/DDCore/src/LCDDLoad.cpp +++ b/DDCore/src/DetectorLoad.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,8 +12,8 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDDLoad.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/DetectorLoad.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/Plugins.h" #include "XML/XMLElements.h" @@ -24,100 +24,100 @@ #ifndef __TIXML__ #include "xercesc/dom/DOMException.hpp" -namespace DD4hep { - namespace XML { +namespace dd4hep { + namespace xml { typedef xercesc::DOMException XmlException; } } #endif -using namespace DD4hep; +using namespace dd4hep; using namespace std; /// Default constructor -LCDDLoad::LCDDLoad(Geometry::LCDD* lcdd) : m_lcdd(lcdd) { +DetectorLoad::DetectorLoad(Detector* description) : m_detDesc(description) { } /// Standard destructor -LCDDLoad::~LCDDLoad() { +DetectorLoad::~DetectorLoad() { } /// Process XML unit and adopt all data from source structure. -void LCDDLoad::processXML(const string& xmlfile, XML::UriReader* entity_resolver) { +void DetectorLoad::processXML(const string& xmlfile, xml::UriReader* entity_resolver) { try { - XML::DocumentHolder doc(XML::DocumentHandler().load(xmlfile,entity_resolver)); - XML::Handle_t handle = doc.root(); + xml::DocumentHolder doc(xml::DocumentHandler().load(xmlfile,entity_resolver)); + xml::Handle_t handle = doc.root(); processXMLElement(xmlfile,handle); } - catch (const XML::XmlException& e) { - throw runtime_error(XML::_toString(e.msg) + "\nDD4hep: XML-DOM Exception while parsing " + xmlfile); + catch (const xml::XmlException& e) { + throw runtime_error(xml::_toString(e.msg) + "\ndd4hep: XML-DOM Exception while parsing " + xmlfile); } catch (const exception& e) { - throw runtime_error(string(e.what()) + "\nDD4hep: while parsing " + xmlfile); + throw runtime_error(string(e.what()) + "\ndd4hep: while parsing " + xmlfile); } catch (...) { - throw runtime_error("DD4hep: UNKNOWN exception while parsing " + xmlfile); + throw runtime_error("dd4hep: UNKNOWN exception while parsing " + xmlfile); } } /// Process XML unit and adopt all data from source structure. -void LCDDLoad::processXML(const XML::Handle_t& base, const string& xmlfile, XML::UriReader* entity_resolver) { +void DetectorLoad::processXML(const xml::Handle_t& base, const string& xmlfile, xml::UriReader* entity_resolver) { try { - XML::Strng_t xml(xmlfile); - XML::DocumentHolder doc(XML::DocumentHandler().load(base,xml,entity_resolver)); - XML::Handle_t handle = doc.root(); + xml::Strng_t xml(xmlfile); + xml::DocumentHolder doc(xml::DocumentHandler().load(base,xml,entity_resolver)); + xml::Handle_t handle = doc.root(); processXMLElement(xmlfile,handle); } - catch (const XML::XmlException& e) { - throw runtime_error(XML::_toString(e.msg) + "\nDD4hep: XML-DOM Exception while parsing " + xmlfile); + catch (const xml::XmlException& e) { + throw runtime_error(xml::_toString(e.msg) + "\ndd4hep: XML-DOM Exception while parsing " + xmlfile); } catch (const exception& e) { - throw runtime_error(string(e.what()) + "\nDD4hep: while parsing " + xmlfile); + throw runtime_error(string(e.what()) + "\ndd4hep: while parsing " + xmlfile); } catch (...) { - throw runtime_error("DD4hep: UNKNOWN exception while parsing " + xmlfile); + throw runtime_error("dd4hep: UNKNOWN exception while parsing " + xmlfile); } } /// Process a given DOM (sub-) tree -void LCDDLoad::processXMLElement(const std::string& xmlfile, const XML::Handle_t& xml_root) { +void DetectorLoad::processXMLElement(const std::string& xmlfile, const xml::Handle_t& xml_root) { string tag = xml_root.tag(); string type = tag + "_XML_reader"; - XML::Handle_t handle = xml_root; - long result = PluginService::Create<long>(type, m_lcdd, &handle); + xml::Handle_t handle = xml_root; + long result = PluginService::Create<long>(type, m_detDesc, &handle); if (0 == result) { PluginDebug dbg; - result = PluginService::Create<long>(type, m_lcdd, &handle); + result = PluginService::Create<long>(type, m_detDesc, &handle); if ( 0 == result ) { - throw runtime_error("DD4hep: Failed to locate plugin to interprete files of type" + throw runtime_error("dd4hep: Failed to locate plugin to interprete files of type" " \"" + tag + "\" - no factory:" + type + ". " + dbg.missingFactory(type)); } } result = *(long*) result; if (result != 1) { - throw runtime_error("DD4hep: Failed to parse the XML file " + xmlfile + " with the plugin " + type); + throw runtime_error("dd4hep: Failed to parse the XML file " + xmlfile + " with the plugin " + type); } } /// Process a given DOM (sub-) tree -void LCDDLoad::processXMLElement(const XML::Handle_t& xml_root, LCDDBuildType /* type */) { +void DetectorLoad::processXMLElement(const xml::Handle_t& xml_root, DetectorBuildType /* type */) { string tag = xml_root.tag(); string type = tag + "_XML_reader"; - XML::Handle_t handle = xml_root; - long result = PluginService::Create<long>(type, m_lcdd, &handle); + xml::Handle_t handle = xml_root; + long result = PluginService::Create<long>(type, m_detDesc, &handle); if (0 == result) { PluginDebug dbg; - result = PluginService::Create<long>(type, m_lcdd, &handle); + result = PluginService::Create<long>(type, m_detDesc, &handle); if ( 0 == result ) { - throw runtime_error("DD4hep: Failed to locate plugin to interprete files of type" + throw runtime_error("dd4hep: Failed to locate plugin to interprete files of type" " \"" + tag + "\" - no factory:" + type + ". " + dbg.missingFactory(type)); } } result = *(long*) result; if (result != 1) { - throw runtime_error("DD4hep: Failed to parse the XML element with tag " + throw runtime_error("dd4hep: Failed to parse the XML element with tag " + tag + " with the plugin " + type); } } diff --git a/DDCore/src/DetectorProcessor.cpp b/DDCore/src/DetectorProcessor.cpp index a701f7627..7189dfbf9 100644 --- a/DDCore/src/DetectorProcessor.cpp +++ b/DDCore/src/DetectorProcessor.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,8 +15,7 @@ #include "DD4hep/Printout.h" #include "DD4hep/DetectorProcessor.h" -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// Default destructor DetectorProcessor::~DetectorProcessor() { diff --git a/DDCore/src/DetectorSelector.cpp b/DDCore/src/DetectorSelector.cpp index c693e128d..3b57c84ec 100644 --- a/DDCore/src/DetectorSelector.cpp +++ b/DDCore/src/DetectorSelector.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,16 +13,16 @@ // Framework include files #include "DD4hep/DetectorSelector.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// Access a set of subdetectors according to the sensitive type. const DetectorSelector::Result& DetectorSelector::detectors(const string& type) { - return lcdd.detectors(type); + return description.detectors(type); } /// Access a set of subdetectors according to several sensitive types. @@ -37,7 +37,7 @@ DetectorSelector::detectors(const string& type1, for(size_t i=0; i<sizeof(types)/sizeof(types[0]); ++i) { try { if ( !types[i]->empty() ) { - const vector<DetElement>& v = lcdd.detectors(*(types[i])); + const vector<DetElement>& v = description.detectors(*(types[i])); result.insert(end(result),begin(v),end(v)); } } @@ -52,9 +52,9 @@ DetectorSelector::detectors(const string& type1, DetectorSelector::Result DetectorSelector::detectors(unsigned int includeFlag, unsigned int excludeFlag ) const { Result result; - const LCDD::HandleMap& entries = lcdd.detectors(); + const Detector::HandleMap& entries = description.detectors(); result.reserve( entries.size() ) ; - lcdd.detectors(""); // Just to ensure the geometry is closed.... + description.detectors(""); // Just to ensure the geometry is closed.... for(const auto& i : entries ) { DetElement det(i.second); if ( det.parent().isValid() ) { // Exclude 'world' diff --git a/DDCore/src/DetectorTools.cpp b/DDCore/src/DetectorTools.cpp index 8544eb747..6118d66d3 100644 --- a/DDCore/src/DetectorTools.cpp +++ b/DDCore/src/DetectorTools.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +15,7 @@ #define DETECTORTOOLS_CPP #include "DD4hep/DetectorTools.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/detail/DetectorInterna.h" // C/C++ include files @@ -26,17 +26,14 @@ #include "TGeoMatrix.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - /// Helper namespace used to answer detector element specific questons - /** - * @author M.Frank - * @version 1.0 - */ - namespace DetectorTools { +namespace dd4hep { + + /// Helper namespace used to answer detector element specific questons + /** + * @author M.Frank + * @version 1.0 + */ + namespace detail { namespace tools { /// Assemble the path of the PlacedVolume selection std::string elementPath(const PlacementPath& nodes, bool reverse); /// Collect detector elements to any parent detector element @@ -49,18 +46,16 @@ namespace DD4hep { bool findChild(PlacedVolume parent, PlacedVolume child, PlacementPath& path); - // Internal helper + // detaill helper static void makePlacementPath(PlacementPath det_nodes, PlacementPath& all_nodes); - } - } + }} } using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// Find path between the child element and the parent element -bool DetectorTools::isParentElement(DetElement parent, DetElement child) { +bool detail::tools::isParentElement(DetElement parent, DetElement child) { if ( parent.isValid() && child.isValid() ) { if ( parent.ptr() == child.ptr() ) return true; for(DetElement par=child; par.isValid(); par=par.parent()) { @@ -71,7 +66,7 @@ bool DetectorTools::isParentElement(DetElement parent, DetElement child) { } /// Find Child of PlacedVolume and assemble on the fly the path of PlacedVolumes -bool DetectorTools::findChild(PlacedVolume parent, PlacedVolume child, PlacementPath& path) { +bool detail::tools::findChild(PlacedVolume parent, PlacedVolume child, PlacementPath& path) { if ( parent.isValid() && child.isValid() ) { // Check self if ( parent.ptr() == child.ptr() ) { @@ -102,7 +97,7 @@ bool DetectorTools::findChild(PlacedVolume parent, PlacedVolume child, Placement } /// Find Child of PlacedVolume and assemble on the fly the path of PlacedVolumes -static bool findChildByName(PlacedVolume parent, PlacedVolume child, DetectorTools::PlacementPath& path) { +static bool findChildByName(PlacedVolume parent, PlacedVolume child, detail::tools::PlacementPath& path) { if ( parent.isValid() && child.isValid() ) { // Check self if ( 0 == ::strcmp(parent.ptr()->GetName(),child.ptr()->GetName()) ) { @@ -120,7 +115,7 @@ static bool findChildByName(PlacedVolume parent, PlacedVolume child, DetectorToo next.Reset(); // Finally crawl down the tree for (TGeoNode *daughter = (TGeoNode*) next(); daughter; daughter = (TGeoNode*) next()) { - DetectorTools::PlacementPath sub_path; + detail::tools::PlacementPath sub_path; bool res = findChildByName(daughter, child, sub_path); if (res) { path.insert(path.end(), sub_path.begin(), sub_path.end()); @@ -133,13 +128,13 @@ static bool findChildByName(PlacedVolume parent, PlacedVolume child, DetectorToo } /// Collect detector elements to the top detector element (world) -void DetectorTools::elementPath(DetElement element, ElementPath& detectors) { +void detail::tools::elementPath(DetElement element, ElementPath& detectors) { for(DetElement par = element; par.isValid(); par = par.parent()) detectors.push_back(par); } /// Collect detector elements to any parent detector element -void DetectorTools::elementPath(DetElement parent, DetElement child, ElementPath& detectors) { +void detail::tools::elementPath(DetElement parent, DetElement child, ElementPath& detectors) { detectors.clear(); if ( parent.isValid() && child.isValid() ) { if ( parent.ptr() == child.ptr() ) { @@ -160,7 +155,7 @@ void DetectorTools::elementPath(DetElement parent, DetElement child, ElementPath } /// Collect detector elements placements to the top detector element (world) [fast, but may have holes!] -void DetectorTools::elementPath(DetElement parent, DetElement element, PlacementPath& det_nodes) { +void detail::tools::elementPath(DetElement parent, DetElement element, PlacementPath& det_nodes) { for(DetElement par = element; par.isValid(); par = par.parent()) { PlacedVolume pv = par.placement(); if ( pv.isValid() ) { @@ -172,7 +167,7 @@ void DetectorTools::elementPath(DetElement parent, DetElement element, Placement } /// Collect detector elements placements to the top detector element (world) [fast, but may have holes!] -void DetectorTools::elementPath(DetElement element, PlacementPath& det_nodes) { +void detail::tools::elementPath(DetElement element, PlacementPath& det_nodes) { for(DetElement par = element; par.isValid(); par = par.parent()) { PlacedVolume pv = par.placement(); if ( pv.isValid() ) { @@ -182,7 +177,7 @@ void DetectorTools::elementPath(DetElement element, PlacementPath& det_nodes) { } /// Assemble the path of the PlacedVolume selection -std::string DetectorTools::elementPath(const PlacementPath& nodes, bool reverse) { +std::string detail::tools::elementPath(const PlacementPath& nodes, bool reverse) { string s = ""; if ( reverse ) { for(auto i=nodes.rbegin(); i != nodes.rend(); ++i) @@ -196,7 +191,7 @@ std::string DetectorTools::elementPath(const PlacementPath& nodes, bool reverse) } /// Assemble the path of the PlacedVolume selection -std::string DetectorTools::elementPath(const ElementPath& nodes, bool reverse) { +std::string detail::tools::elementPath(const ElementPath& nodes, bool reverse) { string s = ""; if ( reverse ) { for(ElementPath::const_reverse_iterator i=nodes.rbegin();i!=nodes.rend();++i) @@ -210,19 +205,19 @@ std::string DetectorTools::elementPath(const ElementPath& nodes, bool reverse) } /// Assemble the path of a particular detector element -std::string DetectorTools::elementPath(DetElement element) { +std::string detail::tools::elementPath(DetElement element) { ElementPath nodes; elementPath(element,nodes); return elementPath(nodes); } /// Find DetElement as child of the top level volume by it's absolute path -DetElement DetectorTools::findElement(LCDD& lcdd, const std::string& path) { - return findDaughterElement(lcdd.world(),path); +DetElement detail::tools::findElement(Detector& description, const std::string& path) { + return findDaughterElement(description.world(),path); } /// Find DetElement as child of a parent by it's relative or absolute path -DetElement DetectorTools::findDaughterElement(DetElement parent, const std::string& subpath) { +DetElement detail::tools::findDaughterElement(DetElement parent, const std::string& subpath) { if ( parent.isValid() ) { size_t idx = subpath.find('/',1); if ( subpath[0] == '/' ) { @@ -237,25 +232,25 @@ DetElement DetectorTools::findDaughterElement(DetElement parent, const std::stri if ( node.isValid() ) { return findDaughterElement(node,subpath.substr(idx+1)); } - throw runtime_error("DD4hep: DetElement "+parent.path()+" has no child named:"+name+" [No such child]"); + throw runtime_error("dd4hep: DetElement "+parent.path()+" has no child named:"+name+" [No such child]"); } - throw runtime_error("DD4hep: Cannot determine child with path "+subpath+" from invalid parent [invalid handle]"); + throw runtime_error("dd4hep: Cannot determine child with path "+subpath+" from invalid parent [invalid handle]"); } /// Determine top level element (=world) for any element walking up the detector element tree -DetElement DetectorTools::topElement(DetElement child) { +DetElement detail::tools::topElement(DetElement child) { if ( child.isValid() ) { if ( child.parent().isValid() ) return topElement(child.parent()); return child; } - throw runtime_error("DD4hep: DetElement cannot determine top parent (world) [invalid handle]"); + throw runtime_error("dd4hep: DetElement cannot determine top parent (world) [invalid handle]"); } -static void DetectorTools::makePlacementPath(PlacementPath det_nodes, PlacementPath& all_nodes) { +static void detail::tools::makePlacementPath(PlacementPath det_nodes, PlacementPath& all_nodes) { for (size_t i = 0, n = det_nodes.size(); n > 0 && i < n-1; ++i) { if (!findChildByName(det_nodes[i + 1], det_nodes[i], all_nodes)) { - throw runtime_error("DD4hep: DetElement cannot determine placement path of " + throw runtime_error("dd4hep: DetElement cannot determine placement path of " + string(det_nodes[i].name()) + " [internal error]"); } } @@ -265,28 +260,28 @@ static void DetectorTools::makePlacementPath(PlacementPath det_nodes, PlacementP } /// Collect detector elements placements to the top detector element (world) [no holes!] -void DetectorTools::placementPath(DetElement element, PlacementPath& all_nodes) { +void detail::tools::placementPath(DetElement element, PlacementPath& all_nodes) { PlacementPath det_nodes; elementPath(element,det_nodes); makePlacementPath(det_nodes, all_nodes); } /// Collect detector elements placements to the parent detector element [no holes!] -void DetectorTools::placementPath(DetElement parent, DetElement element, PlacementPath& all_nodes) { +void detail::tools::placementPath(DetElement parent, DetElement element, PlacementPath& all_nodes) { PlacementPath det_nodes; elementPath(parent,element,det_nodes); makePlacementPath(det_nodes, all_nodes); } /// Assemble the path of the PlacedVolume selection -std::string DetectorTools::placementPath(DetElement element) { +std::string detail::tools::placementPath(DetElement element) { PlacementPath path; placementPath(element,path); return placementPath(path); } /// Assemble the path of the PlacedVolume selection -std::string DetectorTools::placementPath(const PlacementPath& nodes, bool reverse) { +std::string detail::tools::placementPath(const PlacementPath& nodes, bool reverse) { string s=""; if ( reverse ) { for(PlacementPath::const_reverse_iterator i=nodes.rbegin();i!=nodes.rend();++i) @@ -300,7 +295,7 @@ std::string DetectorTools::placementPath(const PlacementPath& nodes, bool revers } /// Assemble the path of the PlacedVolume selection -std::string DetectorTools::placementPath(const std::vector<const TGeoNode*>& nodes, bool reverse) { +std::string detail::tools::placementPath(const std::vector<const TGeoNode*>& nodes, bool reverse) { string s=""; if ( reverse ) { for(std::vector<const TGeoNode*>::const_reverse_iterator i=nodes.rbegin();i!=nodes.rend();++i) @@ -314,13 +309,13 @@ std::string DetectorTools::placementPath(const std::vector<const TGeoNode*>& nod } /// Update cached matrix to transform to positions to an upper level Placement -void DetectorTools::placementTrafo(const PlacementPath& nodes, bool inverse, TGeoHMatrix*& mat) { +void detail::tools::placementTrafo(const PlacementPath& nodes, bool inverse, TGeoHMatrix*& mat) { if ( !mat ) mat = new TGeoHMatrix(*gGeoIdentity); placementTrafo(nodes,inverse,*mat); } /// Update cached matrix to transform to positions to an upper level Placement -void DetectorTools::placementTrafo(const PlacementPath& nodes, bool inverse, TGeoHMatrix& mat) { +void detail::tools::placementTrafo(const PlacementPath& nodes, bool inverse, TGeoHMatrix& mat) { mat = *gGeoIdentity; if (nodes.size() > 0) { for (size_t i = 0, n=nodes.size(); n>0 && i < n-1; ++i) { @@ -332,7 +327,7 @@ void DetectorTools::placementTrafo(const PlacementPath& nodes, bool inverse, TGe } /// Find a given node in the hierarchy starting from the top node (absolute placement!) -PlacedVolume DetectorTools::findNode(PlacedVolume top_place, const std::string& place) { +PlacedVolume detail::tools::findNode(PlacedVolume top_place, const std::string& place) { TGeoNode* top = top_place.ptr(); const char* path = place.c_str(); // Check if a geometry path is valid without changing the state of the navigator. @@ -382,18 +377,18 @@ PlacedVolume DetectorTools::findNode(PlacedVolume top_place, const std::string& } /// Convert VolumeID to string -std::string DetectorTools::toString(const PlacedVolume::VolIDs& ids) { +std::string detail::tools::toString(const PlacedVolume::VolIDs& ids) { stringstream log; - for( const PlacedVolume::VolID& v : ids ) + for( const auto& v : ids ) log << v.first << "=" << v.second << "; "; return log.str(); } /// Convert VolumeID to string -std::string DetectorTools::toString(const IDDescriptor& dsc, const PlacedVolume::VolIDs& ids, VolumeID code) { +std::string detail::tools::toString(const IDDescriptor& dsc, const PlacedVolume::VolIDs& ids, VolumeID code) { stringstream log; - for( const PlacedVolume::VolID& id : ids ) { - IDDescriptor::Field f = dsc.field(id.first); + for( const auto& id : ids ) { + const BitFieldValue* f = dsc.field(id.first); VolumeID value = f->value(code); log << id.first << "=" << id.second << "," << value << " [" << f->offset() << "," << f->width() << "] "; } diff --git a/DDCore/src/Errors.cpp b/DDCore/src/Errors.cpp index 3ed958777..f23b4d4e1 100644 --- a/DDCore/src/Errors.cpp +++ b/DDCore/src/Errors.cpp @@ -1,4 +1,4 @@ -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ #define IMPLEMENT(x,y) std::string x () { return ::strerror( errno = y ); } -namespace DD4hep { namespace Errors { +namespace dd4hep { namespace Errors { IMPLEMENT(noPermission,EPERM) // 1 IMPLEMENT(noEntry,ENOENT) // 2 IMPLEMENT(ioError,EIO) // 5 diff --git a/DDCore/src/Evaluator/ExpressionEvaluator.cpp b/DDCore/src/Evaluator/ExpressionEvaluator.cpp index e00e73dcb..392f42f18 100644 --- a/DDCore/src/Evaluator/ExpressionEvaluator.cpp +++ b/DDCore/src/Evaluator/ExpressionEvaluator.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ #include "XML/Evaluator.h" #include "DD4hep/DD4hepUnits.h" - +namespace units = dd4hep; namespace { void _init(XmlTools::Evaluator& e) { @@ -35,14 +35,14 @@ namespace { // e.setSystemOfUnits(1.e+2, 1./1.60217733e-6, 1.0, 1./1.60217733e-19, 1.0, 1.0, 1.0); // use the units as defined in DD4hepUnits.h: - e.setSystemOfUnits( dd4hep::meter, - dd4hep::kilogram, - dd4hep::second, - dd4hep::ampere, - dd4hep::kelvin, - dd4hep::mole, - dd4hep::candela, - dd4hep::rad ); + e.setSystemOfUnits( units::meter, + units::kilogram, + units::second, + units::ampere, + units::kelvin, + units::mole, + units::candela, + units::rad ); } void _g4Units(XmlTools::Evaluator& e) { // =================================================================================== @@ -52,7 +52,7 @@ namespace { } } -namespace DD4hep { +namespace dd4hep { XmlTools::Evaluator& evaluator() { static XmlTools::Evaluator* e = 0; if ( !e ) { diff --git a/DDCore/src/Evaluator/setStdMath.cpp b/DDCore/src/Evaluator/setStdMath.cpp index 9daab49df..674f2a414 100644 --- a/DDCore/src/Evaluator/setStdMath.cpp +++ b/DDCore/src/Evaluator/setStdMath.cpp @@ -6,12 +6,15 @@ #ifdef DD4HEP_NONE /// Utility namespace to support TGeo units. namespace dd4hep { - static const double radian = 1. ; - static const double degree = (3.14159265358979323846/180.0)*radian; + //namespace units { + static const double radian = 1. ; + static const double degree = (3.14159265358979323846/180.0)*radian; + //} } #else #include "DD4hep/DD4hepUnits.h" #endif +namespace units = dd4hep; #include <cmath> // for sqrt and pow #include <math.h> @@ -74,10 +77,10 @@ namespace XmlTools { // setVariable("rad", 1.0); // setVariable("degree", 3.14159265358979323846/180.); // setVariable("deg", 3.14159265358979323846/180.); - setVariable("radian", dd4hep::radian ); - setVariable("rad", dd4hep::radian ); - setVariable("degree", dd4hep::degree ); - setVariable("deg", dd4hep::degree ); + setVariable("radian", units::radian ); + setVariable("rad", units::radian ); + setVariable("degree", units::degree ); + setVariable("deg", units::degree ); // S E T S T A N D A R D F U N C T I O N S diff --git a/DDCore/src/Exceptions.cpp b/DDCore/src/Exceptions.cpp index ad2b25356..9237eed19 100644 --- a/DDCore/src/Exceptions.cpp +++ b/DDCore/src/Exceptions.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ #include "DD4hep/Primitives.h" using namespace std; -using namespace DD4hep; +using namespace dd4hep; string unrelated_type_error::msg(const type_info& typ1, const type_info& typ2, const string& text) { string m = "The types " + typeName(typ1) + " and " + typeName(typ2) + " are not related. " + text; diff --git a/DDCore/src/FieldTypes.cpp b/DDCore/src/FieldTypes.cpp index af3f6b136..d5aa0b2da 100644 --- a/DDCore/src/FieldTypes.cpp +++ b/DDCore/src/FieldTypes.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ #include <cmath> using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; #ifndef INFINITY #define INFINITY (numeric_limits<double>::max()) @@ -36,7 +36,8 @@ void ConstantField::fieldComponents(const double* /* pos */, double* field) { /// Initializing constructor SolenoidField::SolenoidField() - : innerField(0), outerField(0), minZ(-INFINITY), maxZ(INFINITY), innerRadius(0), outerRadius(INFINITY) { + : innerField(0), outerField(0), minZ(-INFINITY), maxZ(INFINITY), innerRadius(0), outerRadius(INFINITY) +{ type = CartesianField::MAGNETIC; } @@ -54,8 +55,7 @@ void SolenoidField::fieldComponents(const double* pos, double* field) { } /// Initializing constructor -DipoleField::DipoleField() - : zmax(INFINITY), zmin(-INFINITY), rmax(INFINITY) { +DipoleField::DipoleField() : zmax(INFINITY), zmin(-INFINITY), rmax(INFINITY) { type = CartesianField::MAGNETIC; } diff --git a/DDCore/src/Fields.cpp b/DDCore/src/Fields.cpp index acd740309..fb079957d 100644 --- a/DDCore/src/Fields.cpp +++ b/DDCore/src/Fields.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ #include "DD4hep/detail/Handle.inl" using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; typedef CartesianField::Object CartesianFieldObject; DD4HEP_INSTANTIATE_HANDLE(CartesianFieldObject); diff --git a/DDCore/src/GeoHandler.cpp b/DDCore/src/GeoHandler.cpp index ef03eb8fe..7f63f9cc2 100644 --- a/DDCore/src/GeoHandler.cpp +++ b/DDCore/src/GeoHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/GeoHandler.h" #include "DD4hep/detail/ObjectsInterna.h" @@ -25,8 +25,8 @@ // C/C++ include files #include <iostream> -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::detail; +using namespace dd4hep; using namespace std; namespace { @@ -48,11 +48,11 @@ namespace { /// Default constructor GeoHandler::GeoHandler() : m_propagateRegions(false) { - m_data = new Data(); + m_data = new map<int,set<const TGeoNode*> >(); } /// Initializing constructor -GeoHandler::GeoHandler(Data* ptr) +GeoHandler::GeoHandler(map<int,set<const TGeoNode*> >* ptr) : m_propagateRegions(false), m_data(ptr) { } @@ -63,8 +63,8 @@ GeoHandler::~GeoHandler() { m_data = 0; } -GeoHandler::Data* GeoHandler::release() { - Data* d = m_data; +map<int,set<const TGeoNode*> >* GeoHandler::release() { + map<int,set<const TGeoNode*> >* d = m_data; m_data = 0; return d; } @@ -84,14 +84,13 @@ GeoHandler& GeoHandler::collect(DetElement element) { GeoHandler& GeoHandler::collect(DetElement element, GeometryInfo& info) { m_data->clear(); i_collect(element.placement().ptr(), 0, Region(), LimitSet()); - for (Data::const_reverse_iterator i = m_data->rbegin(); i != m_data->rend(); ++i) { - const Data::mapped_type& mapped = (*i).second; - for (Data::mapped_type::const_iterator j = mapped.begin(); j != mapped.end(); ++j) { - const TGeoNode* n = *j; + for (auto i = m_data->rbegin(); i != m_data->rend(); ++i) { + const auto& mapped = (*i).second; + for (const TGeoNode* n : mapped ) { TGeoVolume* v = n->GetVolume(); if (v) { Material m(v->GetMedium()); - Volume vol = Ref_t(v); + Volume vol(v); // Note : assemblies and the world do not have a real volume nor a material if (info.volumeSet.find(vol) == info.volumeSet.end()) { info.volumeSet.insert(vol); diff --git a/DDCore/src/GeometryTreeDump.cpp b/DDCore/src/GeometryTreeDump.cpp index 1b355af38..89e387d8c 100644 --- a/DDCore/src/GeometryTreeDump.cpp +++ b/DDCore/src/GeometryTreeDump.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "GeometryTreeDump.h" // ROOT includes #include "TROOT.h" @@ -36,8 +36,8 @@ #include "TMath.h" #include <iostream> -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::detail; +using namespace dd4hep; using namespace std; namespace { @@ -189,10 +189,10 @@ void* GeometryTreeDump::handleSolid(const string& name, const TGeoShape* shape) } /// Dump structure information in GDML format to output stream -void GeometryTreeDump::handleStructure(const VolumeSet& volset) const { +void GeometryTreeDump::handleStructure(const std::set<Volume>& volset) const { m_output << "\t<structure>" << endl; - for (VolumeSet::const_iterator i = volset.begin(); i != volset.end(); ++i) - handleVolume((*i)->GetName(), *i); + for (const auto v : volset) + handleVolume(v->GetName(), v); m_output << "\t</structure>" << endl; } @@ -220,32 +220,32 @@ void* GeometryTreeDump::handleTransformation(const string& name, const TGeoMatri } /// Dump Transformations in GDML format to output stream -void GeometryTreeDump::handleTransformations(const TransformSet& trafos) const { +void GeometryTreeDump::handleTransformations(const std::vector<std::pair<std::string, TGeoMatrix*> >& trafos) const { m_output << "\t<define>" << endl; - for (TransformSet::const_iterator i = trafos.begin(); i != trafos.end(); ++i) - handleTransformation((*i).first, (*i).second); + for (const auto& t : trafos ) + handleTransformation(t.first, t.second); m_output << "\t</define>" << endl; } /// Dump all solids in GDML format to output stream -void GeometryTreeDump::handleSolids(const SolidSet& solids) const { +void GeometryTreeDump::handleSolids(const std::set<TGeoShape*>& solids) const { m_output << "\t<solids>" << endl; - for (SolidSet::const_iterator i = solids.begin(); i != solids.end(); ++i) - handleSolid((*i)->GetName(), *i); + for (const auto s : solids ) + handleSolid(s->GetName(), s); m_output << "\t</solids>" << endl; } /// Dump all constants in GDML format to output stream -void GeometryTreeDump::handleDefines(const LCDD::HandleMap& defs) const { +void GeometryTreeDump::handleDefines(const Detector::HandleMap& defs) const { m_output << "\t<define>" << endl; - for (LCDD::HandleMap::const_iterator i = defs.begin(); i != defs.end(); ++i) - m_output << "\t\t<constant name=\"" << (*i).second->name << "\" value=\"" << (*i).second->type << "\" />" + for (const auto& d : defs ) + m_output << "\t\t<constant name=\"" << d.second->name << "\" value=\"" << d.second->type << "\" />" << endl; m_output << "\t</define>" << endl; } -/// Dump all visualisation specs in LCDD format to output stream -void GeometryTreeDump::handleVisualisation(const LCDD::HandleMap&) const { +/// Dump all visualisation specs in Detector format to output stream +void GeometryTreeDump::handleVisualisation(const Detector::HandleMap&) const { } static string _path = ""; @@ -297,8 +297,8 @@ void GeometryTreeDump::create(DetElement top) { dumpStructure(top.placement(), 0); //GeometryInfo geo; //collect(top,geo); - //handleSetup(LCDD::getInstance().header()); - //handleDefines(LCDD::getInstance().constants()); + //handleSetup(Detector::getInstance().header()); + //handleDefines(Detector::getInstance().constants()); //handleVisualisation(geo.vis); //handleTransformations(geo.trafos); //handleSolids(geo.solids); diff --git a/DDCore/src/GeometryTreeDump.h b/DDCore/src/GeometryTreeDump.h index 91a60d794..ba429383f 100644 --- a/DDCore/src/GeometryTreeDump.h +++ b/DDCore/src/GeometryTreeDump.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #ifndef DD4HEP_GEOMETRYTREEDUMP_H #define DD4HEP_GEOMETRYTREEDUMP_H -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/GeoHandler.h" #include <set> #include <map> @@ -23,10 +23,10 @@ class TGeoVolume; class TGeoNode; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { /// Geometry to screen dump action /** @@ -36,11 +36,9 @@ namespace DD4hep { */ class GeometryTreeDump: public GeoHandler { public: - GeometryTreeDump() { - } + GeometryTreeDump() = default; /// Standard destructor - virtual ~GeometryTreeDump() { - } + virtual ~GeometryTreeDump() = default; /// Main entry point: create required object(s) void create(DetElement top); @@ -52,17 +50,17 @@ namespace DD4hep { virtual void* handleSolid(const std::string& name, const TGeoShape* volume) const; /// Dump all constants in GDML format to output stream - virtual void handleDefines(const LCDD::HandleMap& defs) const; - /// Dump all visualisation specs in LCDD format to output stream - void handleVisualisation(const LCDD::HandleMap& vis) const; + virtual void handleDefines(const Detector::HandleMap& defs) const; + /// Dump all visualisation specs in Detector format to output stream + void handleVisualisation(const Detector::HandleMap& vis) const; /// Dump all solids in GDML format to output stream - virtual void handleSolids(const SolidSet& solids) const; + virtual void handleSolids(const std::set<TGeoShape*>& solids) const; /// Dump Transformations in GDML format to output stream - virtual void handleTransformations(const TransformSet& trafos) const; + virtual void handleTransformations(const std::vector<std::pair<std::string, TGeoMatrix*> >& trafos) const; /// Dump structure information in GDML format to output stream - virtual void handleStructure(const VolumeSet& volset) const; + virtual void handleStructure(const std::set<Volume>& volset) const; }; - } // End namespace Geometry -} // End namespace DD4hep + } // End namespace detail +} // End namespace dd4hep #endif // DD4HEP_GEOMETRYTREEDUMP_H diff --git a/DDCore/src/GlobalAlignment.cpp b/DDCore/src/GlobalAlignment.cpp index 86816ded9..c6a1583e6 100644 --- a/DDCore/src/GlobalAlignment.cpp +++ b/DDCore/src/GlobalAlignment.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,27 +23,19 @@ using namespace std; -using namespace DD4hep; -using namespace DD4hep::Alignments; +using namespace dd4hep; +using namespace dd4hep::align; namespace { struct CheckHandle { CheckHandle(const GlobalAlignment& a) { if ( a.isValid() ) return; - throw runtime_error("DD4hep: Attempt to access invalid alignment object. [Invalid Handle]"); + throw runtime_error("dd4hep: Attempt to access invalid alignment object. [Invalid Handle]"); } ~CheckHandle() {} }; } -/// Default constructor -GlobalAlignment::GlobalAlignment() : Handle<TGeoPhysicalNode>() { -} - -/// Copy constructor -GlobalAlignment::GlobalAlignment(const GlobalAlignment& c) : Handle<TGeoPhysicalNode>(c) { -} - /// Initializing constructor to create a new object GlobalAlignment::GlobalAlignment(const string& path) { //cout << "GlobalAlignment: path=" << path << endl; @@ -51,14 +43,6 @@ GlobalAlignment::GlobalAlignment(const string& path) { m_element = new TGeoPhysicalNode(path.c_str()); } -/// Assignment operator -GlobalAlignment& GlobalAlignment::operator=(const GlobalAlignment& c) { - if ( &c != this ) { - m_element = c.ptr(); - } - return *this; -} - /// Number of nodes in this branch int GlobalAlignment::numNodes() const { CheckHandle verify_handle(*this); @@ -68,15 +52,15 @@ int GlobalAlignment::numNodes() const { /// Access the placement of this node PlacedVolume GlobalAlignment::placement() const { CheckHandle verify_handle(*this); - return PlacedVolume(ptr()->GetNode(0)); + return ptr()->GetNode(0); } /// Access the placement of a node in the chain of placements for this branch PlacedVolume GlobalAlignment::nodePlacement(int level) const { CheckHandle verify_handle(*this); - PlacedVolume pv = PlacedVolume(ptr()->GetNode(level)); - if ( pv.isValid() ) return pv; - throw runtime_error("DD4hep: The object chain of "+string(placement().name())+ + TGeoNode* n = ptr()->GetNode(level); + if ( n ) return n; + throw runtime_error("dd4hep: The object chain of "+string(placement().name())+ " is too short. [Invalid index]"); } @@ -85,19 +69,19 @@ PlacedVolume GlobalAlignment::motherPlacement(int level_up) const { CheckHandle verify_handle(*this); Int_t ind = ptr()->GetLevel()-level_up; if ( ind >= 0 ) { - return PlacedVolume(ptr()->GetMother(level_up)); + return ptr()->GetMother(level_up); } - throw runtime_error("DD4hep: This object "+string(placement().name())+" has not enough mothers. [Invalid index]"); + throw runtime_error("dd4hep: This object "+string(placement().name())+" has not enough mothers. [Invalid index]"); } /// Access the currently applied alignment/placement matrix -GlobalAlignment::Transform3D GlobalAlignment::toGlobal(int level) const { +Transform3D GlobalAlignment::toGlobal(int level) const { CheckHandle verify_handle(*this); - return Geometry::_transform(ptr()->GetMatrix(level)); + return Matrices::_transform(ptr()->GetMatrix(level)); } /// Transform a point from local coordinates of a given level to global coordinates -GlobalAlignment::Position GlobalAlignment::toGlobal(const Position& localPoint, int level) const { +Position GlobalAlignment::toGlobal(const Position& localPoint, int level) const { CheckHandle verify_handle(*this); Position result; TGeoHMatrix* m = ptr()->GetMatrix(level); @@ -106,7 +90,7 @@ GlobalAlignment::Position GlobalAlignment::toGlobal(const Position& localPoint, } /// Transform a point from local coordinates of a given level to global coordinates -GlobalAlignment::Position GlobalAlignment::globalToLocal(const Position& globalPoint, int level) const { +Position GlobalAlignment::globalToLocal(const Position& globalPoint, int level) const { CheckHandle verify_handle(*this); Position result; TGeoHMatrix* m = ptr()->GetMatrix(level); @@ -115,35 +99,35 @@ GlobalAlignment::Position GlobalAlignment::globalToLocal(const Position& globalP } /// Access the currently applied alignment/placement matrix -GlobalAlignment::Transform3D GlobalAlignment::toMother(int level) const { +Transform3D GlobalAlignment::toMother(int level) const { CheckHandle verify_handle(*this); - return Geometry::_transform(ptr()->GetNode(level)->GetMatrix()); + return Matrices::_transform(ptr()->GetNode(level)->GetMatrix()); } /// Access the currently applied alignment/placement matrix -GlobalAlignment::Transform3D GlobalAlignment::nominal() const { +Transform3D GlobalAlignment::nominal() const { CheckHandle verify_handle(*this); - return Geometry::_transform(ptr()->GetOriginalMatrix()); + return Matrices::_transform(ptr()->GetOriginalMatrix()); } /// Access the currently applied correction matrix (delta) -GlobalAlignment::Transform3D GlobalAlignment::delta() const { +Transform3D GlobalAlignment::delta() const { // It may be useful at some point to cache some of these matrices.... CheckHandle verify_handle(*this); TGeoPhysicalNode* n = ptr(); // T = T_0 * Delta -> Delta = T_0^-1 * T TGeoHMatrix mat(n->GetOriginalMatrix()->Inverse()); mat.Multiply(n->GetNode()->GetMatrix()); - return Geometry::_transform(&mat); + return Matrices::_transform(&mat); } /// Access the inverse of the currently applied correction matrix (delta) (mother to daughter) -GlobalAlignment::Transform3D GlobalAlignment::invDelta() const { +Transform3D GlobalAlignment::invDelta() const { // It may be useful at some point to cache some of these matrices.... CheckHandle verify_handle(*this); TGeoPhysicalNode* n = ptr(); // T = T_0 * Delta -> Delta^-1 = T^-1 * T_0 TGeoHMatrix mat(n->GetNode()->GetMatrix()->Inverse()); mat.Multiply(n->GetOriginalMatrix()); - return Geometry::_transform(&mat); + return Matrices::_transform(&mat); } diff --git a/DDCore/src/GridPhiEta.cpp b/DDCore/src/GridPhiEta.cpp index 51901f9cb..f75fc3d23 100644 --- a/DDCore/src/GridPhiEta.cpp +++ b/DDCore/src/GridPhiEta.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,4 +14,4 @@ #include "DD4hep/GridPhiEta.h" #include "DD4hep/detail/Handle.inl" -DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DD4hep::DDSegmentation::GridPhiEta); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(dd4hep::DDSegmentation::GridPhiEta); diff --git a/DDCore/src/GridRPhiEta.cpp b/DDCore/src/GridRPhiEta.cpp index cb900893f..dbfe02fd5 100644 --- a/DDCore/src/GridRPhiEta.cpp +++ b/DDCore/src/GridRPhiEta.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,4 +14,4 @@ #include "DD4hep/GridRPhiEta.h" #include "DD4hep/detail/Handle.inl" -DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DD4hep::DDSegmentation::GridRPhiEta); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(dd4hep::DDSegmentation::GridRPhiEta); diff --git a/DDCore/src/Handle.cpp b/DDCore/src/Handle.cpp index 9c676e394..05b2a1371 100644 --- a/DDCore/src/Handle.cpp +++ b/DDCore/src/Handle.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,19 +25,19 @@ #include "cxxabi.h" #endif -namespace DD4hep { +namespace dd4hep { XmlTools::Evaluator& evaluator(); } namespace { - XmlTools::Evaluator& eval(DD4hep::evaluator()); + XmlTools::Evaluator& eval(dd4hep::evaluator()); } using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -short DD4hep::_toShort(const string& value) { +short dd4hep::_toShort(const string& value) { string s(value); size_t idx = s.find("(int)"); if (idx != string::npos) @@ -48,12 +48,12 @@ short DD4hep::_toShort(const string& value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << value << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + value); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + value); } return (short) result; } -int DD4hep::_toInt(const string& value) { +int dd4hep::_toInt(const string& value) { string s(value); size_t idx = s.find("(int)"); if (idx != string::npos) @@ -64,12 +64,12 @@ int DD4hep::_toInt(const string& value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << value << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + value); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + value); } return (int) result; } -long DD4hep::_toLong(const string& value) { +long dd4hep::_toLong(const string& value) { string s(value); size_t idx = s.find("(int)"); if (idx != string::npos) @@ -80,36 +80,36 @@ long DD4hep::_toLong(const string& value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << value << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + value); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + value); } return (long) result; } -bool DD4hep::_toBool(const string& value) { +bool dd4hep::_toBool(const string& value) { return value == "true" || value == "yes"; } -float DD4hep::_toFloat(const string& value) { +float dd4hep::_toFloat(const string& value) { double result = eval.evaluate(value.c_str()); if (eval.status() != XmlTools::Evaluator::OK) { cerr << value << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + value); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + value); } return (float) result; } -double DD4hep::_toDouble(const string& value) { +double dd4hep::_toDouble(const string& value) { double result = eval.evaluate(value.c_str()); if (eval.status() != XmlTools::Evaluator::OK) { cerr << value << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + value); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + value); } return result; } -template <> char DD4hep::_multiply<char>(const string& left, const string& right) { +template <> char dd4hep::_multiply<char>(const string& left, const string& right) { double val = _toDouble(left + "*" + right); if ( val >= double(SCHAR_MIN) && val <= double(SCHAR_MAX) ) return (char) (int)val; @@ -119,7 +119,7 @@ template <> char DD4hep::_multiply<char>(const string& left, const string& right return 0; } -template <> unsigned char DD4hep::_multiply<unsigned char>(const string& left, const string& right) { +template <> unsigned char dd4hep::_multiply<unsigned char>(const string& left, const string& right) { double val = _toDouble(left + "*" + right); if ( val >= 0 && val <= double(UCHAR_MAX) ) return (unsigned char) (int)val; @@ -129,7 +129,7 @@ template <> unsigned char DD4hep::_multiply<unsigned char>(const string& left, c return 0; } -template <> short DD4hep::_multiply<short>(const string& left, const string& right) { +template <> short dd4hep::_multiply<short>(const string& left, const string& right) { double val = _toDouble(left + "*" + right); if ( val >= double(SHRT_MIN) && val <= double(SHRT_MAX) ) return (short) val; @@ -139,7 +139,7 @@ template <> short DD4hep::_multiply<short>(const string& left, const string& rig return 0; } -template <> unsigned short DD4hep::_multiply<unsigned short>(const string& left, const string& right) { +template <> unsigned short dd4hep::_multiply<unsigned short>(const string& left, const string& right) { double val = _toDouble(left + "*" + right); if ( val >= 0 && val <= double(USHRT_MAX) ) return (unsigned short)val; @@ -149,36 +149,36 @@ template <> unsigned short DD4hep::_multiply<unsigned short>(const string& left, return 0; } -template <> int DD4hep::_multiply<int>(const string& left, const string& right) { +template <> int dd4hep::_multiply<int>(const string& left, const string& right) { return (int) _toDouble(left + "*" + right); } -template <> unsigned int DD4hep::_multiply<unsigned int>(const string& left, const string& right) { +template <> unsigned int dd4hep::_multiply<unsigned int>(const string& left, const string& right) { return (unsigned int) _toDouble(left + "*" + right); } -template <> long DD4hep::_multiply<long>(const string& left, const string& right) { +template <> long dd4hep::_multiply<long>(const string& left, const string& right) { return (long) _toDouble(left + "*" + right); } -template <> unsigned long DD4hep::_multiply<unsigned long>(const string& left, const string& right) { +template <> unsigned long dd4hep::_multiply<unsigned long>(const string& left, const string& right) { return (unsigned long) _toDouble(left + "*" + right); } -template <> float DD4hep::_multiply<float>(const string& left, const string& right) { +template <> float dd4hep::_multiply<float>(const string& left, const string& right) { return _toFloat(left + "*" + right); } -template <> double DD4hep::_multiply<double>(const string& left, const string& right) { +template <> double dd4hep::_multiply<double>(const string& left, const string& right) { return _toDouble(left + "*" + right); } -void DD4hep::_toDictionary(const string& name, const string& value) { +void dd4hep::_toDictionary(const string& name, const string& value) { _toDictionary(name, value, "number"); } /// Enter name value pair to the dictionary. \ingroup DD4HEP_GEOMETRY -void DD4hep::_toDictionary(const std::string& name, const std::string& value, const std::string& typ) { +void dd4hep::_toDictionary(const std::string& name, const std::string& value, const std::string& typ) { if ( typ == "string" ) { eval.setEnviron(name.c_str(),value.c_str()); return; @@ -197,7 +197,7 @@ void DD4hep::_toDictionary(const std::string& name, const std::string& value, co if (eval.status() != XmlTools::Evaluator::OK) { cerr << value << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation " + name + "=" + value); + throw runtime_error("dd4hep: Severe error during expression evaluation " + name + "=" + value); } eval.setVariable(n.c_str(), result); } @@ -209,31 +209,31 @@ template <typename T> static inline string __to_string(T value, const char* fmt) return text; } -string DD4hep::_toString(bool value) { +string dd4hep::_toString(bool value) { return value ? "true" : "false"; } -string DD4hep::_toString(short value, const char* fmt) { +string dd4hep::_toString(short value, const char* fmt) { return __to_string((int)value, fmt); } -string DD4hep::_toString(int value, const char* fmt) { +string dd4hep::_toString(int value, const char* fmt) { return __to_string(value, fmt); } -string DD4hep::_toString(float value, const char* fmt) { +string dd4hep::_toString(float value, const char* fmt) { return __to_string(value, fmt); } -string DD4hep::_toString(double value, const char* fmt) { +string dd4hep::_toString(double value, const char* fmt) { return __to_string(value, fmt); } -string DD4hep::_ptrToString(const void* value, const char* fmt) { +string dd4hep::_ptrToString(const void* value, const char* fmt) { return __to_string(value, fmt); } -namespace DD4hep { +namespace dd4hep { static long s_numVerifies = 0; long num_object_validations() { @@ -248,7 +248,7 @@ namespace DD4hep { cerr << edge << edge << edge << endl; cerr << "++ The usage of the factory: \"" << name << "\" is DEPRECATED due to naming conventions." << setw(53-len) << right << "++" << endl; - cerr << "++ Please use \"DD4hep_" << name << "\" instead." << setw(93-len) << right << "++" << endl; + cerr << "++ Please use \"dd4hep_" << name << "\" instead." << setw(93-len) << right << "++" << endl; cerr << edge << edge << edge << endl; } } @@ -256,7 +256,7 @@ namespace DD4hep { #include "DDSegmentation/Segmentation.h" typedef DDSegmentation::Segmentation _Segmentation; //INSTANTIATE_UNNAMED(_Segmentation); -namespace DD4hep { +namespace dd4hep { template <> void Handle<_Segmentation>::assign(_Segmentation* s, const std::string& n, const std::string&) { this->m_element = s; s->setName(n); @@ -264,14 +264,14 @@ namespace DD4hep { template <> const char* Handle<_Segmentation>::name() const { return this->m_element ? this->m_element->name().c_str() : ""; } - template class DD4hep::Handle<_Segmentation>; + template class dd4hep::Handle<_Segmentation>; } -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "TMap.h" #include "TColor.h" -DD4HEP_INSTANTIATE_HANDLE_UNNAMED(LCDD); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(Detector); DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TObject); DD4HEP_INSTANTIATE_HANDLE(TNamed); diff --git a/DDCore/src/IDDescriptor.cpp b/DDCore/src/IDDescriptor.cpp index fa500c3b8..380d9d06c 100644 --- a/DDCore/src/IDDescriptor.cpp +++ b/DDCore/src/IDDescriptor.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,8 +21,8 @@ #include <cstdlib> #include <cmath> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; namespace { void _construct(IDDescriptor::Object* o, const string& dsc) { @@ -31,7 +31,7 @@ namespace { o->fieldMap.clear(); o->description = dsc; for (size_t i = 0; i < bf.size(); ++i) { - IDDescriptor::Field f = &bf[i]; + BitFieldValue* f = &bf[i]; o->fieldIDs.push_back(make_pair(i, f->name())); o->fieldMap.push_back(make_pair(f->name(), f)); } @@ -68,7 +68,7 @@ const IDDescriptor::FieldIDs& IDDescriptor::ids() const { if ( isValid() ) { return data<Object>()->fieldIDs; } - throw runtime_error("DD4hep: Attempt to access an invalid IDDescriptor object."); + throw runtime_error("dd4hep: Attempt to access an invalid IDDescriptor object."); } /// Access the fieldmap container @@ -76,22 +76,22 @@ const IDDescriptor::FieldMap& IDDescriptor::fields() const { if ( isValid() ) { return data<Object>()->fieldMap; } - throw runtime_error("DD4hep: Attempt to access an invalid IDDescriptor object."); + throw runtime_error("dd4hep: Attempt to access an invalid IDDescriptor object."); } /// Get the field descriptor of one field by name -IDDescriptor::Field IDDescriptor::field(const string& field_name) const { +const BitFieldValue* IDDescriptor::field(const string& field_name) const { const FieldMap& m = fields(); // This already checks the object validity for (const auto& i : m ) if (i.first == field_name) return i.second; - except("IDDescriptor","DD4hep: %s: This ID descriptor has no field with the name: %s", + except("IDDescriptor","dd4hep: %s: This ID descriptor has no field with the name: %s", name(),field_name.c_str()); - throw runtime_error("DD4hep"); // Never called. Simply make the compiler happy! + throw runtime_error("dd4hep"); // Never called. Simply make the compiler happy! } /// Get the field descriptor of one field by its identifier -IDDescriptor::Field IDDescriptor::field(size_t identifier) const { +const BitFieldValue* IDDescriptor::field(size_t identifier) const { const FieldMap& m = fields(); // This already checks the object validity return m[identifier].second; } @@ -102,18 +102,19 @@ size_t IDDescriptor::fieldID(const string& field_name) const { for (const auto& i : m ) if (i.second == field_name) return i.first; - except("IDDescriptor","DD4hep: %s: This ID descriptor has no field with the name: %s", + except("IDDescriptor","dd4hep: %s: This ID descriptor has no field with the name: %s", name(),field_name.c_str()); - throw runtime_error("DD4hep"); // Never called. Simply make the compiler happy! + throw runtime_error("dd4hep"); // Never called. Simply make the compiler happy! } /// Encode a set of volume identifiers (corresponding to this description of course!) to a volumeID. -VolumeID IDDescriptor::encode(const std::vector<VolID>& id_vector) const { +VolumeID IDDescriptor::encode(const std::vector<std::pair<std::string, int> >& id_vector) const +{ VolumeID id = 0; //const PlacedVolume::VolIDs* ids = (const PlacedVolume::VolIDs*)&id_vector; //printout(INFO,"IDDescriptor","VolIDs: %s",ids->str().c_str()); for (const auto& i : id_vector ) { - Field fld = field(i.first); + const BitFieldValue* fld = field(i.first); int off = fld->offset(); VolumeID val = i.second; id |= ((fld->value(val<<off) << off)&fld->mask()); @@ -122,11 +123,13 @@ VolumeID IDDescriptor::encode(const std::vector<VolID>& id_vector) const { } /// Decode volume IDs and return filled descriptor with all fields -void IDDescriptor::decodeFields(VolumeID vid, VolIDFields& flds) const { +void IDDescriptor::decodeFields(VolumeID vid, + vector<pair<const BitFieldValue*, VolumeID> >& flds) const +{ const vector<BitFieldValue*>& v = access()->fields(); flds.clear(); for (auto f : v ) - flds.push_back(VolIDField(f, f->value(vid))); + flds.push_back(make_pair(f, f->value(vid))); } /// Decode volume IDs and return string reprensentation for debugging purposes diff --git a/DDCore/src/IOV.cpp b/DDCore/src/IOV.cpp index 5d6d5358d..e5be1dd33 100644 --- a/DDCore/src/IOV.cpp +++ b/DDCore/src/IOV.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #include <cstring> using namespace std; -using namespace DD4hep; +using namespace dd4hep; #if 0 /// Assignment operator diff --git a/DDCore/src/InstanceCount.cpp b/DDCore/src/InstanceCount.cpp index 4c53afb8d..f4632ee54 100644 --- a/DDCore/src/InstanceCount.cpp +++ b/DDCore/src/InstanceCount.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include <map> using namespace std; -using namespace DD4hep; +using namespace dd4hep; /// Do not clutter global namespace namespace { diff --git a/DDCore/src/JSON/DocumentHandler.cpp b/DDCore/src/JSON/DocumentHandler.cpp index 1dffafcb6..95f21c542 100644 --- a/DDCore/src/JSON/DocumentHandler.cpp +++ b/DDCore/src/JSON/DocumentHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::JSON; +using namespace dd4hep::json; /// Default constructor DocumentHandler::DocumentHandler() { diff --git a/DDCore/src/JSON/Elements.cpp b/DDCore/src/JSON/Elements.cpp index 80e24ef2d..165dbae07 100644 --- a/DDCore/src/JSON/Elements.cpp +++ b/DDCore/src/JSON/Elements.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,16 +24,16 @@ #include <map> using namespace std; -using namespace DD4hep::JSON; +using namespace dd4hep::json; static const size_t INVALID_NODE = ~0U; // Forward declarations -namespace DD4hep { +namespace dd4hep { XmlTools::Evaluator& evaluator(); } // Static storage namespace { - XmlTools::Evaluator& eval(DD4hep::evaluator()); + XmlTools::Evaluator& eval(dd4hep::evaluator()); string _checkEnviron(const string& env) { string r = getEnviron(env); return r.empty() ? env : r; @@ -78,7 +78,7 @@ namespace { } } -string DD4hep::JSON::_toString(Attribute attr) { +string dd4hep::json::_toString(Attribute attr) { if (attr) return _toString(attribute_value(attr)); return ""; @@ -91,55 +91,55 @@ template <typename T> static inline string __to_string(T value, const char* fmt) } /// Do-nothing version. Present for completeness and argument interchangeability -string DD4hep::JSON::_toString(const char* s) { +string dd4hep::json::_toString(const char* s) { if ( !s || *s == 0 ) return ""; else if ( !(*s == '$' && *(s+1) == '{') ) return s; return _checkEnviron(s); } /// Do-nothing version. Present for completeness and argument interchangeability -string DD4hep::JSON::_toString(const string& s) { +string dd4hep::json::_toString(const string& s) { if ( s.length() < 3 || s[0] != '$' ) return s; else if ( !(s[0] == '$' && s[1] == '{') ) return s; return _checkEnviron(s); } /// Format unsigned long integer to string with arbitrary format -string DD4hep::JSON::_toString(unsigned long v, const char* fmt) { +string dd4hep::json::_toString(unsigned long v, const char* fmt) { return __to_string(v, fmt); } /// Format unsigned integer (32 bits) to string with arbitrary format -string DD4hep::JSON::_toString(unsigned int v, const char* fmt) { +string dd4hep::json::_toString(unsigned int v, const char* fmt) { return __to_string(v, fmt); } /// Format signed integer (32 bits) to string with arbitrary format -string DD4hep::JSON::_toString(int v, const char* fmt) { +string dd4hep::json::_toString(int v, const char* fmt) { return __to_string(v, fmt); } /// Format signed long integer to string with arbitrary format -string DD4hep::JSON::_toString(long v, const char* fmt) { +string dd4hep::json::_toString(long v, const char* fmt) { return __to_string(v, fmt); } /// Format single procision float number (32 bits) to string with arbitrary format -string DD4hep::JSON::_toString(float v, const char* fmt) { +string dd4hep::json::_toString(float v, const char* fmt) { return __to_string(v, fmt); } /// Format double procision float number (64 bits) to string with arbitrary format -string DD4hep::JSON::_toString(double v, const char* fmt) { +string dd4hep::json::_toString(double v, const char* fmt) { return __to_string(v, fmt); } /// Format pointer to string with arbitrary format -string DD4hep::JSON::_ptrToString(const void* v, const char* fmt) { +string dd4hep::json::_ptrToString(const void* v, const char* fmt) { return __to_string(v, fmt); } -long DD4hep::JSON::_toLong(const char* value) { +long dd4hep::json::_toLong(const char* value) { if (value) { string s = _toString(value); size_t idx = s.find("(int)"); @@ -154,14 +154,14 @@ long DD4hep::JSON::_toLong(const char* value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << s << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + s); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + s); } return (long) result; } return -1; } -int DD4hep::JSON::_toInt(const char* value) { +int dd4hep::json::_toInt(const char* value) { if (value) { string s = _toString(value); size_t idx = s.find("(int)"); @@ -173,14 +173,14 @@ int DD4hep::JSON::_toInt(const char* value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << s << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + s); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + s); } return (int) result; } return -1; } -bool DD4hep::JSON::_toBool(const char* value) { +bool dd4hep::json::_toBool(const char* value) { if (value) { string s = _toString(value); return s == "true"; @@ -188,7 +188,7 @@ bool DD4hep::JSON::_toBool(const char* value) { return false; } -float DD4hep::JSON::_toFloat(const char* value) { +float dd4hep::json::_toFloat(const char* value) { if (value) { string s = _toString(value); double result = eval.evaluate(s.c_str()); @@ -196,28 +196,28 @@ float DD4hep::JSON::_toFloat(const char* value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << s << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + s); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + s); } return (float) result; } return 0.0; } -double DD4hep::JSON::_toDouble(const char* value) { +double dd4hep::json::_toDouble(const char* value) { if (value) { string s = _toString(value); double result = eval.evaluate(s.c_str()); if (eval.status() != XmlTools::Evaluator::OK) { cerr << s << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + s); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + s); } return result; } return 0.0; } -void DD4hep::JSON::_toDictionary(const char* name, const char* value) { +void dd4hep::json::_toDictionary(const char* name, const char* value) { string n = _toString(name).c_str(), v = _toString(value); size_t idx = v.find("(int)"); if (idx != string::npos) @@ -228,29 +228,29 @@ void DD4hep::JSON::_toDictionary(const char* name, const char* value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << v << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + v); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + v); } eval.setVariable(n.c_str(), result); } template <typename T> -void DD4hep::JSON::_toDictionary(const char* name, T value) { +void dd4hep::json::_toDictionary(const char* name, T value) { string item = _toString(value); _toDictionary(name, item.c_str()); } -template void DD4hep::JSON::_toDictionary(const char* name, const string& value); -template void DD4hep::JSON::_toDictionary(const char* name, unsigned long value); -template void DD4hep::JSON::_toDictionary(const char* name, unsigned int value); -template void DD4hep::JSON::_toDictionary(const char* name, unsigned short value); -template void DD4hep::JSON::_toDictionary(const char* name, int value); -template void DD4hep::JSON::_toDictionary(const char* name, long value); -template void DD4hep::JSON::_toDictionary(const char* name, short value); -template void DD4hep::JSON::_toDictionary(const char* name, float value); -template void DD4hep::JSON::_toDictionary(const char* name, double value); +template void dd4hep::json::_toDictionary(const char* name, const string& value); +template void dd4hep::json::_toDictionary(const char* name, unsigned long value); +template void dd4hep::json::_toDictionary(const char* name, unsigned int value); +template void dd4hep::json::_toDictionary(const char* name, unsigned short value); +template void dd4hep::json::_toDictionary(const char* name, int value); +template void dd4hep::json::_toDictionary(const char* name, long value); +template void dd4hep::json::_toDictionary(const char* name, short value); +template void dd4hep::json::_toDictionary(const char* name, float value); +template void dd4hep::json::_toDictionary(const char* name, double value); /// Evaluate string constant using environment stored in the evaluator -string DD4hep::JSON::getEnviron(const string& env) { +string dd4hep::json::getEnviron(const string& env) { size_t id1 = env.find("${"); size_t id2 = env.rfind("}"); if ( id1 == string::npos || id2 == string::npos ) { @@ -262,7 +262,7 @@ string DD4hep::JSON::getEnviron(const string& env) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << env << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during environment lookup of " + env); + throw runtime_error("dd4hep: Severe error during environment lookup of " + env); } v = env.substr(0,id1); v += ret; @@ -490,9 +490,9 @@ size_t Collection_t::size() const { /// Helper function to throw an exception void Collection_t::throw_loop_exception(const exception& e) const { if (m_node) { - throw runtime_error(string(e.what()) + "\n" + "DD4hep: Error interpreting XML nodes of type <" + tag() + "/>"); + throw runtime_error(string(e.what()) + "\n" + "dd4hep: Error interpreting XML nodes of type <" + tag() + "/>"); } - throw runtime_error(string(e.what()) + "\n" + "DD4hep: Error interpreting collections XML nodes."); + throw runtime_error(string(e.what()) + "\n" + "dd4hep: Error interpreting collections XML nodes."); } void Collection_t::operator++() const { @@ -519,15 +519,15 @@ void Collection_t::operator--(int) const { --(*this); } -void DD4hep::JSON::dumpTree(Handle_t elt) { +void dd4hep::json::dumpTree(Handle_t elt) { dumpTree(elt.ptr()); } -void DD4hep::JSON::dumpTree(Element elt) { +void dd4hep::json::dumpTree(Element elt) { dumpTree(elt.ptr()); } -void DD4hep::JSON::dumpTree(const JsonElement* elt) { +void dd4hep::json::dumpTree(const JsonElement* elt) { struct Dump { void operator()(const JsonElement* e, const string& tag) const { string t = tag+" "; diff --git a/DDCore/src/JSON/Helpers.cpp b/DDCore/src/JSON/Helpers.cpp index 2c61740f1..fe2d8e665 100644 --- a/DDCore/src/JSON/Helpers.cpp +++ b/DDCore/src/JSON/Helpers.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,10 +16,10 @@ #include "JSON/Dimension.inl" #include "JSON/ChildValue.inl" -using namespace DD4hep::JSON; - // Instantiate here the concrete implementations -#define DD4HEP_DIMENSION_NS JSON +#define DD4HEP_DIMENSION_NS json +using namespace dd4hep::DD4HEP_DIMENSION_NS; + #include "XML/detail/Detector.imp" #include "XML/detail/Dimension.imp" #include "XML/detail/ChildValue.imp" diff --git a/DDCore/src/LCDDImp.h b/DDCore/src/LCDDImp.h deleted file mode 100644 index 6f4373170..000000000 --- a/DDCore/src/LCDDImp.h +++ /dev/null @@ -1,376 +0,0 @@ -//========================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see $DD4hepINSTALL/LICENSE. -// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -// -// Author : M.Frank -// -//========================================================================== - -#ifndef DD4hep_LCDDGEOIMP_H -#define DD4hep_LCDDGEOIMP_H - -// Framework include files -#include "DD4hep/LCDDData.h" -#include "DD4hep/LCDDLoad.h" - -// Forward declarations -class TGeoManager; - -// C/C++ include files -#include <map> - -/// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { - - /// Concrete implementation class of the LCDD interface - /** @class LCDDImp LCDDImp.h src/LCDDImp.h - * - * @author M.Frank - * @version 1.0 - */ - class LCDDImp: public LCDD, public LCDDData, public LCDDLoad { - protected: - /// Cached map with detector types: - typedef std::map<std::string, std::vector<DetElement> > DetectorTypeMap; - - /// Inventory of detector types - DetectorTypeMap m_detectorTypes; - - /// VolumeManager m_volManager; - LCDDBuildType m_buildType; - - private: - /// Disable copy constructor - LCDDImp(const LCDDImp& copy) = delete; - - /// Disable assignment operator - LCDDImp& operator=(const LCDDImp& copy) = delete; - - /// Internal helper to map detector types once the geometry is closed - void mapDetectorTypes(); - public: - - /// Local method (no interface): Load volume manager. - void imp_loadVolumeManager(); - - /// Default constructor - LCDDImp(); - - /// Standard destructor - virtual ~LCDDImp(); - - /// Access flag to steer the detail of building of the geometry/detector description - virtual LCDDBuildType buildType() const { - return m_buildType; - } - - /// Read compact geometry description or alignment file - virtual void fromCompact(const std::string& fname, LCDDBuildType type = BUILD_DEFAULT) { - fromXML(fname, type); - } - - /// Read any XML file - virtual void fromXML(const std::string& fname, LCDDBuildType type = BUILD_DEFAULT); - - /// Read any geometry description or alignment file with external XML entity resolution - virtual void fromXML(const std::string& fname, - UriReader* entity_resolver, - LCDDBuildType type = BUILD_DEFAULT); - - virtual void dump() const; - - /// Manipulate geometry using facroy converter - virtual long apply(const char* factory, int argc, char** argv); - - virtual void init(); - virtual void endDocument(); - - /// Add an extension object to the LCDD instance - virtual void* addUserExtension(void* ptr, const std::type_info& info, void (*destruct)(void*)); - - /// Remove an existing extension object from the LCDD instance. If not destroyed, the instance is returned - virtual void* removeUserExtension(const std::type_info& info, bool destroy=true); - - /// Access an existing extension object from the LCDD instance - virtual void* userExtension(const std::type_info& info, bool alert=true) const; - - virtual Handle<TObject> getRefChild(const HandleMap& e, const std::string& name, bool throw_if_not = true) const; - - /// Register new mother volume using the detector name. - virtual void declareMotherVolume(const std::string& detector_name, const Volume& vol); - - /// Access mother volume by detector element - virtual Volume pickMotherVolume(const DetElement& sd) const; - - /// Access the geometry manager of this instance - virtual TGeoManager& manager() const { - return *m_manager; - } - /// Access to properties - Properties& properties() const { - return *(Properties*)&m_properties; - } - /// Return handle to material describing air - virtual Material air() const { - return m_materialAir; - } - /// Return handle to material describing vacuum - virtual Material vacuum() const { - return m_materialVacuum; - } - /// Return handle to "invisible" visualization attributes - virtual VisAttr invisible() const { - return m_invisibleVis; - } - /// Return reference to the top-most (world) detector element - virtual DetElement world() const { - return m_world; - } - /// Return reference to detector element with all tracker devices. - virtual DetElement trackers() const { - return m_trackers; - } - /// Return handle to the world volume containing everything - virtual Volume worldVolume() const { - return m_worldVol; - } - /// Return handle to the world volume containing the volume with the tracking devices - virtual Volume trackingVolume() const { - return m_trackingVol; - } - /// Return handle to the VolumeManager - virtual VolumeManager volumeManager() const { - return m_volManager; - } - /// Return handle to the combined electromagentic field description. - virtual OverlayedField field() const { - return m_field; - } - /// Accessor to the header entry - virtual Header header() const { - return m_header; - } - /// Accessor to the header entry - virtual void setHeader(Header h) { - m_header = h; - } - - /// Typed access to constants: access string values - virtual std::string constantAsString(const std::string& name) const; - - /// Typed access to constants: long values - virtual long constantAsLong(const std::string& name) const; - - /// Typed access to constants: double values - virtual double constantAsDouble(const std::string& name) const; - - /// Retrieve a constant by it's name from the detector description - virtual Constant constant(const std::string& name) const; - - /// Retrieve a limitset by it's name from the detector description - virtual LimitSet limitSet(const std::string& name) const { - return getRefChild(m_limits, name); - } - /// Retrieve a visualization attribute by it's name from the detector description - virtual VisAttr visAttributes(const std::string& name) const { - return getRefChild(m_display, name, false); - } - /// Retrieve a matrial by it's name from the detector description - virtual Material material(const std::string& name) const; - - /// Retrieve a region object by it's name from the detector description - virtual Region region(const std::string& name) const { - return getRefChild(m_regions, name); - } - /// Retrieve a id descriptor by it's name from the detector description - virtual IDDescriptor idSpecification(const std::string& name) const { - return getRefChild(m_idDict, name); - } - /// Retrieve a readout object by it's name from the detector description - virtual Readout readout(const std::string& name) const { - return getRefChild(m_readouts, name); - } - /// Retrieve an alignment entry by it's name from the detector description - virtual AlignmentEntry alignment(const std::string& path) const { - return getRefChild(alignments(), path); - } - /// Retrieve a subdetector element by it's name from the detector description - virtual DetElement detector(const std::string& name) const { - return getRefChild(m_detectors, name); - } - /// Retrieve a sensitive detector by it's name from the detector description - virtual SensitiveDetector sensitiveDetector(const std::string& name) const { - return getRefChild(m_sensitive, name, false); - } - /// Retrieve a subdetector element by it's name from the detector description - virtual CartesianField field(const std::string& name) const { - return getRefChild(m_fields, name, false); - } - - /// Accessor to the map of constants - virtual const HandleMap& constants() const { - return m_define; - } - /// Accessor to the map of visualisation attributes - virtual const HandleMap& visAttributes() const { - return m_display; - } - /// Accessor to the map of limit settings - virtual const HandleMap& limitsets() const { - return m_limits; - } - /// Accessor to the map of region settings - virtual const HandleMap& regions() const { - return m_regions; - } - /// Accessor to the map of readout structures - virtual const HandleMap& readouts() const { - return m_readouts; - } - /// Accessor to the map of sub-detectors - virtual const HandleMap& detectors() const { - return m_detectors; - } - /// Retrieve a sensitive detector by it's name from the detector description - virtual const HandleMap& sensitiveDetectors() const { - return m_sensitive; - } - /// Accessor to the map of aligment entries - virtual const HandleMap& alignments() const { - return m_alignments; - } - /// Accessor to the map of field entries, which together form the global field - virtual const HandleMap& fields() const { - return m_fields; - } - /// Accessor to the map of ID specifications - virtual const HandleMap& idSpecifications() const { - return m_idDict; - } - - /// Access a set of subdetectors according to the sensitive type. - /** - Please note: - - The sensitive type of a detector is set in the 'detector constructor'. - - Not sensitive detector structures have the name 'passive' - - Compounds (ie. nested detectors) are of type 'compound' - - If throw_exc is set to true, an exception is thrown if the type - is not present. Otherwise an empty detector container is returned. - */ - virtual const std::vector<DetElement>& detectors(const std::string& type, bool throw_exc); - - /// Access a set of subdetectors according to several sensitive types. - virtual std::vector<DetElement> detectors(const std::string& type1, - const std::string& type2, - const std::string& type3="", - const std::string& type4="", - const std::string& type5="" ); - - /// Access the availible detector types - virtual std::vector<std::string> detectorTypes() const; - - /** return a vector with all detectors that have all the type properties in - * includeFlag set but none of the properties given in excludeFlag - */ - virtual std::vector<DetElement> detectors(unsigned int includeFlag, - unsigned int excludeFlag=0 ) const ; - - -#define __R return *this - /// Add a new constant to the detector description - virtual LCDD& add(Constant x) { - return addConstant(x); - } - /// Add a new limit set to the detector description - virtual LCDD& add(LimitSet x) { - return addLimitSet(x); - } - /// Add a new detector region to the detector description - virtual LCDD& add(Region x) { - return addRegion(x); - } - /// Add a new visualisation attribute to the detector description - virtual LCDD& add(VisAttr x) { - return addVisAttribute(x); - } - /// Add a new id descriptor to the detector description - virtual LCDD& add(IDDescriptor x) { - return addIDSpecification(x); - } - /// Add alignment entry to the detector description - virtual LCDD& add(AlignmentEntry x) { - return addAlignment(x); - } - /// Add a new detector readout to the detector description - virtual LCDD& add(Readout x) { - return addReadout(x); - } - /// Add a new sensitive detector to the detector description - virtual LCDD& add(SensitiveDetector x) { - return addSensitiveDetector(x); - } - /// Add a new subdetector to the detector description - virtual LCDD& add(DetElement x) { - return addDetector(x); - } - /// Add a field component to the detector description - virtual LCDD& add(CartesianField x) { - return addField(x); - } - - /// Add a new constant by named reference to the detector description - virtual LCDD& addConstant(const Ref_t& x); - - /// Add a new limit set by named reference to the detector description - virtual LCDD& addLimitSet(const Ref_t& x) { - m_limits.append(x); - __R; - } - /// Add a new detector region by named reference to the detector description - virtual LCDD& addRegion(const Ref_t& x) { - m_regions.append(x); - __R; - } - /// Add a new id descriptor by named reference to the detector description - virtual LCDD& addIDSpecification(const Ref_t& x) { - m_idDict.append(x); - __R; - } - /// Add a new detector readout by named reference to the detector description - virtual LCDD& addReadout(const Ref_t& x) { - m_readouts.append(x); - __R; - } - /// Add a new visualisation attribute by named reference to the detector description - virtual LCDD& addVisAttribute(const Ref_t& x) { - m_display.append(x); - __R; - } - /// Add a new sensitive detector by named reference to the detector description - virtual LCDD& addSensitiveDetector(const Ref_t& x) { - m_sensitive.append(x); - __R; - } - /// Add a new subdetector by named reference to the detector description - virtual LCDD& addDetector(const Ref_t& x); - /// Add a new alignment entry by named reference to the detector description - virtual LCDD& addAlignment(const Ref_t& x) { - m_alignments.append(x); - __R; - } - /// Add a field component by named reference to the detector description - virtual LCDD& addField(const Ref_t& x); -#undef __R - - }; - } -} /* End namespace DD4hep */ -#endif /* DD4hep_LCDDGEOIMP_H */ diff --git a/DDCore/src/MatrixHelpers.cpp b/DDCore/src/MatrixHelpers.cpp index 19a5422a4..312257d64 100644 --- a/DDCore/src/MatrixHelpers.cpp +++ b/DDCore/src/MatrixHelpers.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,27 +17,27 @@ // ROOT includes #include "TGeoMatrix.h" -using namespace DD4hep::Geometry; +using namespace dd4hep; -TGeoIdentity* DD4hep::Geometry::identityTransform() { +TGeoIdentity* dd4hep::Matrices::_identity() { return gGeoIdentity; } -TGeoTranslation* DD4hep::Geometry::_translation(const Position& pos) { +TGeoTranslation* dd4hep::Matrices::_translation(const Position& pos) { return new TGeoTranslation("", pos.X(), pos.Y(), pos.Z()); } -TGeoRotation* DD4hep::Geometry::_rotationZYX(const RotationZYX& rot) { +TGeoRotation* dd4hep::Matrices::_rotationZYX(const RotationZYX& rot) { return new TGeoRotation("", rot.Phi() * RAD_2_DEGREE, rot.Theta() * RAD_2_DEGREE, rot.Psi() * RAD_2_DEGREE); } -TGeoRotation* DD4hep::Geometry::_rotation3D(const Rotation3D& rot3D) { +TGeoRotation* dd4hep::Matrices::_rotation3D(const Rotation3D& rot3D) { EulerAngles rot(rot3D); return new TGeoRotation("", rot.Phi() * RAD_2_DEGREE, rot.Theta() * RAD_2_DEGREE, rot.Psi() * RAD_2_DEGREE); } /// Set a RotationZYX object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix& DD4hep::Geometry::_transform(TGeoHMatrix& tr, const RotationZYX& rot) { +TGeoHMatrix& dd4hep::Matrices::_transform(TGeoHMatrix& tr, const RotationZYX& rot) { tr.RotateZ(rot.Phi() * RAD_2_DEGREE); tr.RotateY(rot.Theta() * RAD_2_DEGREE); tr.RotateX(rot.Psi() * RAD_2_DEGREE); @@ -45,7 +45,7 @@ TGeoHMatrix& DD4hep::Geometry::_transform(TGeoHMatrix& tr, const RotationZYX& ro } /// Set a Position object (translation) to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix& DD4hep::Geometry::_transform(TGeoHMatrix& tr, const Position& pos) { +TGeoHMatrix& dd4hep::Matrices::_transform(TGeoHMatrix& tr, const Position& pos) { double t[3]; pos.GetCoordinates(t); tr.SetDx(t[0]); @@ -55,14 +55,14 @@ TGeoHMatrix& DD4hep::Geometry::_transform(TGeoHMatrix& tr, const Position& pos) } /// Set a Rotation3D object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix& DD4hep::Geometry::_transform(TGeoHMatrix& tr, const Rotation3D& rot) { +TGeoHMatrix& dd4hep::Matrices::_transform(TGeoHMatrix& tr, const Rotation3D& rot) { Double_t* r = tr.GetRotationMatrix(); rot.GetComponents(r); return tr; } /// Set a Transform3D object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix& DD4hep::Geometry::_transform(TGeoHMatrix& tr, const Transform3D& trans) { +TGeoHMatrix& dd4hep::Matrices::_transform(TGeoHMatrix& tr, const Transform3D& trans) { Position pos; RotationZYX rot; trans.GetDecomposition(rot, pos); @@ -70,37 +70,37 @@ TGeoHMatrix& DD4hep::Geometry::_transform(TGeoHMatrix& tr, const Transform3D& tr } /// Set a Position followed by a RotationZYX to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix& DD4hep::Geometry::_transform(TGeoHMatrix& tr, const Position& pos, const RotationZYX& rot) { +TGeoHMatrix& dd4hep::Matrices::_transform(TGeoHMatrix& tr, const Position& pos, const RotationZYX& rot) { return _transform(_transform(tr, rot), pos); } /// Convert a Position object to a TGeoTranslation \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix* DD4hep::Geometry::_transform(const Position& pos) { +TGeoHMatrix* dd4hep::Matrices::_transform(const Position& pos) { return &_transform(*(new TGeoHMatrix()), pos); } /// Convert a RotationZYX object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix* DD4hep::Geometry::_transform(const RotationZYX& rot) { +TGeoHMatrix* dd4hep::Matrices::_transform(const RotationZYX& rot) { return &_transform(*(new TGeoHMatrix()), rot); } /// Convert a Rotation3D object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix* DD4hep::Geometry::_transform(const Rotation3D& rot) { +TGeoHMatrix* dd4hep::Matrices::_transform(const Rotation3D& rot) { return &_transform(*(new TGeoHMatrix()), rot); } /// Convert a Transform3D object to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix* DD4hep::Geometry::_transform(const Transform3D& trans) { +TGeoHMatrix* dd4hep::Matrices::_transform(const Transform3D& trans) { return &_transform(*(new TGeoHMatrix()), trans); } /// Convert a Position followed by a RotationZYX to a TGeoHMatrix \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -TGeoHMatrix* DD4hep::Geometry::_transform(const Position& pos, const RotationZYX& rot) { +TGeoHMatrix* dd4hep::Matrices::_transform(const Position& pos, const RotationZYX& rot) { return &_transform(*(new TGeoHMatrix()), pos, rot); } /// Convert a TGeoMatrix object to a generic Transform3D \ingroup DD4HEP \ingroup DD4HEP_GEOMETRY -Transform3D DD4hep::Geometry::_transform(const TGeoMatrix* matrix) { +Transform3D dd4hep::Matrices::_transform(const TGeoMatrix* matrix) { const Double_t* t = matrix->GetTranslation(); if ( matrix->IsRotation() ) { const Double_t* r = matrix->GetRotationMatrix(); @@ -113,11 +113,11 @@ Transform3D DD4hep::Geometry::_transform(const TGeoMatrix* matrix) { 0e0,0e0,0e0,t[2]*MM_2_CM); } -DD4hep::Geometry::XYZAngles DD4hep::Geometry::_XYZangles(const TGeoMatrix* m) { - return m->IsRotation() ? _XYZangles(m->GetRotationMatrix()) : XYZAngles(0,0,0); +dd4hep::XYZAngles dd4hep::Matrices::_xyzAngles(const TGeoMatrix* m) { + return m->IsRotation() ? _xyzAngles(m->GetRotationMatrix()) : XYZAngles(0,0,0); } -DD4hep::Geometry::XYZAngles DD4hep::Geometry::_XYZangles(const double* r) { +dd4hep::XYZAngles dd4hep::Matrices::_xyzAngles(const double* r) { Double_t cosb = std::sqrt(r[0]*r[0] + r[1]*r[1]); if (cosb > 0.00001) { return XYZAngles(atan2(r[5], r[8]), atan2(-r[2], cosb), atan2(r[1], r[0])); @@ -125,28 +125,28 @@ DD4hep::Geometry::XYZAngles DD4hep::Geometry::_XYZangles(const double* r) { return XYZAngles(atan2(-r[7], r[4]),atan2(-r[2], cosb),0); } -void DD4hep::Geometry::_decompose(const Transform3D& trafo, Translation3D& pos, RotationZYX& rot) { +void dd4hep::Matrices::_decompose(const Transform3D& trafo, Translation3D& pos, RotationZYX& rot) { trafo.GetDecomposition(rot,pos); } -void DD4hep::Geometry::_decompose(const Transform3D& trafo, Translation3D& pos, XYZAngles& rot) { +void dd4hep::Matrices::_decompose(const Transform3D& trafo, Translation3D& pos, XYZAngles& rot) { EulerAngles r; trafo.GetDecomposition(r,pos); rot.SetXYZ(r.Psi(),r.Theta(),r.Phi()); } -void DD4hep::Geometry::_decompose(const Transform3D& trafo, Position& pos, RotationZYX& rot) { +void dd4hep::Matrices::_decompose(const Transform3D& trafo, Position& pos, RotationZYX& rot) { trafo.GetDecomposition(rot,pos); } -void DD4hep::Geometry::_decompose(const Transform3D& trafo, Position& pos, XYZAngles& rot) { +void dd4hep::Matrices::_decompose(const Transform3D& trafo, Position& pos, XYZAngles& rot) { EulerAngles r; trafo.GetDecomposition(r,pos); rot.SetXYZ(r.Psi(),r.Theta(),r.Phi()); } /// Check matrices for equality -int DD4hep::Geometry::_matrixEqual(const TGeoMatrix& left, const TGeoMatrix& right) { +int dd4hep::Matrices::_matrixEqual(const TGeoMatrix& left, const TGeoMatrix& right) { double epsilon = 1e-12; int result = MATRICES_EQUAL; const Double_t* t1 = left.GetTranslation(); diff --git a/DDCore/src/MultiSegmentation.cpp b/DDCore/src/MultiSegmentation.cpp index ae1c1a5f7..2834fc35d 100644 --- a/DDCore/src/MultiSegmentation.cpp +++ b/DDCore/src/MultiSegmentation.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// access the field name used to discriminate sub-segmentations const std::string& MultiSegmentation::discriminatorName() const { @@ -43,7 +43,7 @@ Position MultiSegmentation::position(const CellID& id) const { } /// determine the cell ID based on the position -DD4hep::CellID MultiSegmentation::cellID(const Position& local, +dd4hep::CellID MultiSegmentation::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/NamedObject.cpp b/DDCore/src/NamedObject.cpp index 7cbe162b0..d4790882c 100644 --- a/DDCore/src/NamedObject.cpp +++ b/DDCore/src/NamedObject.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,8 +17,8 @@ #include "TObject.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; DD4HEP_INSTANTIATE_HANDLE_NAMED(NamedObject); diff --git a/DDCore/src/NoSegmentation.cpp b/DDCore/src/NoSegmentation.cpp index 42af6dc9b..f48afa0c0 100644 --- a/DDCore/src/NoSegmentation.cpp +++ b/DDCore/src/NoSegmentation.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,14 +19,14 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; Position NoSegmentation::position(const CellID& id) const { return Position(access()->implementation->position(id)); } /// determine the cell ID based on the position -DD4hep::CellID NoSegmentation::cellID(const Position& local, +dd4hep::CellID NoSegmentation::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/ObjectExtensions.cpp b/DDCore/src/ObjectExtensions.cpp index d1c9b825d..98252671e 100644 --- a/DDCore/src/ObjectExtensions.cpp +++ b/DDCore/src/ObjectExtensions.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,18 +19,20 @@ // C/C++ include files #include <stdexcept> -using namespace DD4hep; +using namespace std; +using namespace dd4hep; namespace { static int s_extensionID = 0; - ObjectExtensions::ExtensionMap* extensionContainer(const std::type_info& typ) { - static std::map<const std::type_info*, ObjectExtensions::ExtensionMap> s_map; + map<const type_info*, ObjectExtensions::Entry>* + extensionContainer(const type_info& typ) { + static map<const type_info*,map<const type_info*,ObjectExtensions::Entry> > s_map; return &s_map[&typ]; } } /// Default constructor -ObjectExtensions::ObjectExtensions(const std::type_info& parent_type) { +ObjectExtensions::ObjectExtensions(const type_info& parent_type) { extensionMap = extensionContainer(parent_type); InstanceCount::increment(this); } @@ -47,16 +49,15 @@ void ObjectExtensions::move(ObjectExtensions& source) { source.extensions.clear(); } -/// Internal object destructor: release extension object(s) +/// detaill object destructor: release extension object(s) void ObjectExtensions::clear(bool destroy) { - for (Extensions::iterator i = extensions.begin(); i != extensions.end(); ++i) { - void* ptr = (*i).second; - if (ptr) { - ExtensionMap::iterator j = extensionMap->find((*i).first); + for( const auto& i : extensions ) { + if ( i.second ) { + auto j = extensionMap->find(i.first); if (j != extensionMap->end()) { Entry& e = (*j).second; if (destroy && e.destruct) - (*(e.destruct))(ptr); + ( *(e.destruct) ) ( i.second ); } } } @@ -64,47 +65,49 @@ void ObjectExtensions::clear(bool destroy) { } /// Copy object extensions from another object -void ObjectExtensions::copyFrom(const Extensions& ext, void* arg) { - for (Extensions::const_iterator i = ext.begin(); i != ext.end(); ++i) { - const std::type_info* info = (*i).first; - ExtensionMap::const_iterator j = extensionMap->find(info); +void ObjectExtensions::copyFrom(const map<const type_info*, void*>& ext, void* arg) { + for( const auto& i : ext ) { + const auto j = extensionMap->find(i.first); const Entry& e = (*j).second; - extensions[info] = (*(e.copy))((*i).second, arg); + extensions[i.first] = ( *(e.copy) )(i.second, arg); } } /// Add an extension object to the detector element -void* ObjectExtensions::addExtension(void* ptr, const std::type_info& info, destruct_t dtor) { +void* ObjectExtensions::addExtension(void* ptr, const type_info& info, void (*dtor)(void*)) { return addExtension(ptr, info, 0, dtor); } /// Add an extension object to the detector element -void* ObjectExtensions::addExtension(void* ptr, const std::type_info& info, copy_t ctor, destruct_t dtor) { - Extensions::iterator j = extensions.find(&info); +void* ObjectExtensions::addExtension(void* ptr, const type_info& info, + void* (*ctor)(const void*, void* arg), + void (*dtor)(void*)) +{ + auto j = extensions.find(&info); if (j == extensions.end()) { - ExtensionMap::iterator i = extensionMap->find(&info); + auto i = extensionMap->find(&info); if (i == extensionMap->end()) { Entry entry; entry.destruct = dtor; - entry.copy = ctor; - entry.id = ++s_extensionID; + entry.copy = ctor; + entry.id = ++s_extensionID; extensionMap->insert(make_pair(&info, entry)); i = extensionMap->find(&info); } return extensions[&info] = ptr; } - throw std::runtime_error("DD4hep: addExtension: Object already has an extension of type:" + typeName(info) + "."); + throw runtime_error("dd4hep: addExtension: Object already has an extension of type:" + typeName(info) + "."); } /// Remove an existing extension object from the instance -void* ObjectExtensions::removeExtension(const std::type_info& info, bool destroy) { - Extensions::iterator j = extensions.find(&info); +void* ObjectExtensions::removeExtension(const type_info& info, bool destroy) { + auto j = extensions.find(&info); if (j != extensions.end()) { void *ptr = (*j).second; if ( destroy ) { - ExtensionMap::iterator i = extensionMap->find(&info); + const auto i = extensionMap->find(&info); if (i != extensionMap->end()) { - Entry& e = (*i).second; + const Entry& e = (*i).second; (*e.destruct)((*j).second); ptr = 0; } @@ -112,26 +115,26 @@ void* ObjectExtensions::removeExtension(const std::type_info& info, bool destroy extensions.erase(j); return ptr; } - throw std::runtime_error("DD4hep: removeExtension: The object of type " + typeName(info) + " is not present."); + throw runtime_error("dd4hep: removeExtension: The object of type " + typeName(info) + " is not present."); } /// Access an existing extension object from the detector element -void* ObjectExtensions::extension(const std::type_info& info) const { - Extensions::const_iterator j = extensions.find(&info); +void* ObjectExtensions::extension(const type_info& info) const { + const auto j = extensions.find(&info); if (j != extensions.end()) { return (*j).second; } - throw std::runtime_error("DD4hep: extension: Object has no extension of type:" + typeName(info) + "."); + throw runtime_error("dd4hep: extension: Object has no extension of type:" + typeName(info) + "."); } /// Access an existing extension object from the detector element -void* ObjectExtensions::extension(const std::type_info& info, bool alert) const { - Extensions::const_iterator j = extensions.find(&info); +void* ObjectExtensions::extension(const type_info& info, bool alert) const { + const auto j = extensions.find(&info); if (j != extensions.end()) { return (*j).second; } else if ( !alert ) return 0; - throw std::runtime_error("DD4hep: extension: Object has no extension of type:" + typeName(info) + "."); + throw runtime_error("dd4hep: extension: Object has no extension of type:" + typeName(info) + "."); } diff --git a/DDCore/src/ObjectPrintout.cpp b/DDCore/src/ObjectPrintout.cpp index b9024b430..5c28f778c 100644 --- a/DDCore/src/ObjectPrintout.cpp +++ b/DDCore/src/ObjectPrintout.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Objects.h" #include "DD4hep/Conditions.h" #include "DD4hep/detail/ObjectsInterna.h" @@ -28,14 +28,13 @@ using namespace std; #include "TROOT.h" #include "TColor.h" using namespace std; -namespace DD4hep { - using namespace Geometry; - using Conditions::Condition; +namespace dd4hep { + using namespace detail; template <typename T> void PrintMap<T>::operator()() const { - Printer < T > p(lcdd, os); + Printer < T > p(description, os); os << "++" << endl << "++ " << text << endl << "++" << endl; - for (LCDD::HandleMap::const_iterator i = cont.begin(); i != cont.end(); ++i) + for (Detector::HandleMap::const_iterator i = cont.begin(); i != cont.end(); ++i) p((*i).second); } @@ -125,17 +124,17 @@ namespace DD4hep { } const DetElement::Children& ch = sd.children(); for (DetElement::Children::const_iterator i = ch.begin(); i != ch.end(); ++i) - Printer < DetElement > (lcdd, os, prefix + "| ")((*i).second); + Printer < DetElement > (description, os, prefix + "| ")((*i).second); return; } } #endif - template <> void Printer<const LCDD*>::operator()(const LCDD* const &) const { - //Header(lcdd.header()).fromCompact(doc,compact.child(Tag_info),Strng_t("In memory")); - PrintMap < Constant > (lcdd, os, lcdd->constants(), "List of Constants")(); - //PrintMap < VisAttr > (lcdd, os, lcdd->visAttributes(), "List of Visualization attributes")(); - //PrintMap < LimitSet > (lcdd, os, lcdd->readouts(), "List of Readouts")(); - //PrintMap < Region > (lcdd, os, lcdd->regions(), "List of Regions")(); - //PrintMap < DetElement > (lcdd, os, lcdd->detectors(), "List of DetElements")(); + template <> void Printer<const Detector*>::operator()(const Detector* const &) const { + //Header(description.header()).fromCompact(doc,compact.child(Tag_info),Strng_t("In memory")); + PrintMap < Constant > (description, os, description->constants(), "List of Constants")(); + //PrintMap < VisAttr > (description, os, description->visAttributes(), "List of Visualization attributes")(); + //PrintMap < LimitSet > (description, os, description->readouts(), "List of Readouts")(); + //PrintMap < Region > (description, os, description->regions(), "List of Regions")(); + //PrintMap < DetElement > (description, os, description->detectors(), "List of DetElements")(); } } diff --git a/DDCore/src/Objects.cpp b/DDCore/src/Objects.cpp index d0accf251..203979897 100644 --- a/DDCore/src/Objects.cpp +++ b/DDCore/src/Objects.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/IDDescriptor.h" #include "DD4hep/InstanceCount.h" @@ -32,10 +32,10 @@ #include <iomanip> using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// Constructor to be used when creating a new DOM tree -Author::Author(LCDD& /* lcdd */) { +Author::Author(Detector& /* description */) { m_element = new NamedObject("", "author"); } @@ -150,7 +150,7 @@ string Constant::dataType() const { if ( isValid() ) { return m_element->dataType; } - throw runtime_error("DD4hep: Attempt to access internals from invalid Constant handle!"); + throw runtime_error("dd4hep: Attempt to access internals from invalid Constant handle!"); } /// String representation of this object @@ -180,9 +180,9 @@ double Material::Z() const { TGeoMaterial* m = val->GetMaterial(); if (m) return m->GetZ(); - throw runtime_error("DD4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); + throw runtime_error("dd4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); } - throw runtime_error("DD4hep: Attempt to access proton number from invalid material handle!"); + throw runtime_error("dd4hep: Attempt to access proton number from invalid material handle!"); } /// atomic number of the underlying material double Material::A() const { @@ -191,9 +191,9 @@ double Material::A() const { TGeoMaterial* m = val->GetMaterial(); if (m) return m->GetA(); - throw runtime_error("DD4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); + throw runtime_error("dd4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); } - throw runtime_error("DD4hep: Attempt to access atomic number from invalid material handle!"); + throw runtime_error("dd4hep: Attempt to access atomic number from invalid material handle!"); } /// density of the underlying material @@ -203,9 +203,9 @@ double Material::density() const { TGeoMaterial* m = val->GetMaterial(); if (m) return m->GetDensity(); - throw runtime_error("DD4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); + throw runtime_error("dd4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); } - throw runtime_error("DD4hep: Attempt to access density from invalid material handle!"); + throw runtime_error("dd4hep: Attempt to access density from invalid material handle!"); } /// Access the radiation length of the underlying material @@ -215,9 +215,9 @@ double Material::radLength() const { TGeoMaterial* m = val->GetMaterial(); if (m) return m->GetRadLen(); - throw runtime_error("DD4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); + throw runtime_error("dd4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); } - throw runtime_error("DD4hep: Attempt to access radiation length from invalid material handle!"); + throw runtime_error("dd4hep: Attempt to access radiation length from invalid material handle!"); } /// Access the radiation length of the underlying material @@ -350,49 +350,6 @@ string VisAttr::toString() const { return text; } -/// Constructor to be used when creating a new aligment entry -AlignmentEntry::AlignmentEntry(const string& path) { - TGeoPhysicalNode* obj = new TGeoPhysicalNode(path.c_str()); - assign(obj, path, "*"); -} - -/// Align the PhysicalNode (translation only) -int AlignmentEntry::align(const Position& pos, bool check, double overlap) { - return align(pos, RotationZYX(), check, overlap); -} - -/// Align the PhysicalNode (rotation only) -int AlignmentEntry::align(const RotationZYX& rot, bool check, double overlap) { - return align(Position(), rot, check, overlap); -} - -/// Align the PhysicalNode (translation + rotation) -int AlignmentEntry::align(const Position& pos, const RotationZYX& rot, bool check, double overlap) { - - if (isValid()) { - TGeoHMatrix* new_matrix = dynamic_cast<TGeoHMatrix*>(m_element->GetOriginalMatrix()->MakeClone()); - TGeoRotation rotation("", rot.Phi() * RAD_2_DEGREE, rot.Theta() * RAD_2_DEGREE, rot.Psi() * RAD_2_DEGREE); - TGeoCombiTrans m(pos.X(), pos.Y(), pos.Z(), 0); - m.SetRotation(rotation); - new_matrix->Multiply(&m); - m_element->Align(new_matrix, 0, check, overlap); - return 1; - } - throw runtime_error("DD4hep: Cannot align non existing physical node."); -} - -/// Assignment operator -Limit& Limit::operator=(const Limit& c) { - if (this != &c) { - particles = c.particles; - name = c.name; - unit = c.unit; - value = c.value; - content = c.content; - } - return *this; -} - /// Equality operator bool Limit::operator==(const Limit& c) const { return value == c.value && name == c.name && particles == c.particles; @@ -506,11 +463,11 @@ struct IDSpec : public Ref_t { template <typename Q> IDSpec(const Handle<Q>& e) : Ref_t(e) {} /// Constructor to be used when creating a new DOM tree - IDSpec(LCDD& doc, const std::string& name, const IDDescriptor& dsc); + IDSpec(Detector& doc, const std::string& name, const IDDescriptor& dsc); void addField(const std::string& name, const std::pair<int,int>& field); }; -IDSpec::IDSpec(LCDD& lcdd, const string& name, const IDDescriptor& dsc) +IDSpec::IDSpec(Detector& description, const string& name, const IDDescriptor& dsc) : RefElement(doc,Tag_idspec,name) { const IDDescriptor::FieldIDs& f = dsc.ids(); diff --git a/DDCore/src/ObjectsInterna.cpp b/DDCore/src/ObjectsInterna.cpp index b3dc81737..724fdf700 100644 --- a/DDCore/src/ObjectsInterna.cpp +++ b/DDCore/src/ObjectsInterna.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,8 +18,8 @@ #include "DD4hep/detail/SegmentationsInterna.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; DD4HEP_INSTANTIATE_HANDLE_NAMED(VisAttrObject); diff --git a/DDCore/src/OpaqueData.cpp b/DDCore/src/OpaqueData.cpp index 4070f86b6..bef75a5a1 100644 --- a/DDCore/src/OpaqueData.cpp +++ b/DDCore/src/OpaqueData.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ #include <cstring> using namespace std; -using namespace DD4hep; +using namespace dd4hep; /// Create data block from string representation bool OpaqueData::fromString(const string& rep) { diff --git a/DDCore/src/OpaqueDataBinder.cpp b/DDCore/src/OpaqueDataBinder.cpp index ee1335a07..554e1a230 100644 --- a/DDCore/src/OpaqueDataBinder.cpp +++ b/DDCore/src/OpaqueDataBinder.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,7 +26,7 @@ using namespace std; namespace { - using namespace DD4hep; + using namespace dd4hep::detail; /// Helper class to bind string values to C++ data objects (primitive or complex) template <typename T, typename Q> bool __bind__(const ValueBinder&, T& object, const string& val, const Q*) @@ -51,343 +51,347 @@ namespace { } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Binding function for scalar items. See the implementation function for the concrete instantiations - template <typename BINDER, typename T> - bool OpaqueDataBinder::bind(const BINDER& b, T& object, const string& typ, const string& val) { + /// DD4hep internal namespace declaration for utilities and implementation details + namespace detail { + + /// Binding function for scalar items. See the implementation function for the concrete instantiations + template <typename BINDER, typename T> + bool OpaqueDataBinder::bind(const BINDER& b, T& object, const string& typ, const string& val) { #if defined(DD4HEP_HAVE_ALL_PARSERS) - if ( typ.substr(0,4) == "char" ) - return __bind__(b,object,val,Primitive<char>::null_pointer()); - else if ( typ.substr(0,13) == "unsigned char" ) - return __bind__(b,object,val,Primitive<unsigned char>::null_pointer()); - else if ( typ.substr(0,5) == "short" ) - return __bind__(b,object,val,Primitive<short>::null_pointer()); - else if ( typ.substr(0,14) == "unsigned short" ) - return __bind__(b,object,val,Primitive<unsigned short>::null_pointer()); - else if ( typ.substr(0,12) == "unsigned int" ) - return __bind__(b,object,val,Primitive<unsigned int>::null_pointer()); - else if ( typ.substr(0,13) == "unsigned long" ) - return __bind__(b,object,val,Primitive<unsigned long>::null_pointer()); + if ( typ.substr(0,4) == "char" ) + return __bind__(b,object,val,Primitive<char>::null_pointer()); + else if ( typ.substr(0,13) == "unsigned char" ) + return __bind__(b,object,val,Primitive<unsigned char>::null_pointer()); + else if ( typ.substr(0,5) == "short" ) + return __bind__(b,object,val,Primitive<short>::null_pointer()); + else if ( typ.substr(0,14) == "unsigned short" ) + return __bind__(b,object,val,Primitive<unsigned short>::null_pointer()); + else if ( typ.substr(0,12) == "unsigned int" ) + return __bind__(b,object,val,Primitive<unsigned int>::null_pointer()); + else if ( typ.substr(0,13) == "unsigned long" ) + return __bind__(b,object,val,Primitive<unsigned long>::null_pointer()); #else - // Short and char is not part of the standard dictionaries. Fall back to 'int'. - if ( typ.substr(0,4) == "char" ) - return __bind__(b,object,val,Primitive<int>::null_pointer()); - else if ( typ.substr(0,5) == "short" ) - return __bind__(b,object,val,Primitive<int>::null_pointer()); + // Short and char is not part of the standard dictionaries. Fall back to 'int'. + if ( typ.substr(0,4) == "char" ) + return __bind__(b,object,val,Primitive<int>::null_pointer()); + else if ( typ.substr(0,5) == "short" ) + return __bind__(b,object,val,Primitive<int>::null_pointer()); #endif - else if ( typ.substr(0,3) == "int" ) - return __bind__(b,object,val,Primitive<int>::null_pointer()); - else if ( typ.substr(0,4) == "long" ) - return __bind__(b,object,val,Primitive<long>::null_pointer()); - else if ( typ.substr(0,5) == "float" ) - return __bind__(b,object,val,Primitive<float>::null_pointer()); - else if ( typ.substr(0,6) == "double" ) - return __bind__(b,object,val,Primitive<double>::null_pointer()); - else if ( typ.substr(0,6) == "string" ) - return __bind__(b,object,val,Primitive<string>::null_pointer()); - else if ( typ == "std::string" ) - return __bind__(b,object,val,Primitive<string>::null_pointer()); - else if ( typ == "Histo1D" ) + else if ( typ.substr(0,3) == "int" ) + return __bind__(b,object,val,Primitive<int>::null_pointer()); + else if ( typ.substr(0,4) == "long" ) + return __bind__(b,object,val,Primitive<long>::null_pointer()); + else if ( typ.substr(0,5) == "float" ) + return __bind__(b,object,val,Primitive<float>::null_pointer()); + else if ( typ.substr(0,6) == "double" ) + return __bind__(b,object,val,Primitive<double>::null_pointer()); + else if ( typ.substr(0,6) == "string" ) + return __bind__(b,object,val,Primitive<string>::null_pointer()); + else if ( typ == "std::string" ) + return __bind__(b,object,val,Primitive<string>::null_pointer()); + else if ( typ == "Histo1D" ) + return __bind__(b,object,val,Primitive<string>::null_pointer()); + else if ( typ == "Histo2D" ) + return __bind__(b,object,val,Primitive<string>::null_pointer()); + else + printout(INFO,"OpaqueDataBinder","++ Unknown conditions parameter type:%s val:%s",typ.c_str(),val.c_str()); return __bind__(b,object,val,Primitive<string>::null_pointer()); - else if ( typ == "Histo2D" ) - return __bind__(b,object,val,Primitive<string>::null_pointer()); - else - printout(INFO,"OpaqueDataBinder","++ Unknown conditions parameter type:%s val:%s",typ.c_str(),val.c_str()); - return __bind__(b,object,val,Primitive<string>::null_pointer()); - } - template bool OpaqueDataBinder::bind<ValueBinder,OpaqueDataBlock>( const ValueBinder& b, OpaqueDataBlock& object, - const string& typ, const string& val); - template bool OpaqueDataBinder::bind<VectorBinder,OpaqueDataBlock>( const VectorBinder& b, OpaqueDataBlock& object, - const string& typ, const string& val); - template bool OpaqueDataBinder::bind<ListBinder,OpaqueDataBlock>( const ListBinder& b, OpaqueDataBlock& object, - const string& typ, const string& val); - template bool OpaqueDataBinder::bind<SetBinder,OpaqueDataBlock>( const SetBinder& b, OpaqueDataBlock& object, - const string& typ, const string& val); + } + template bool OpaqueDataBinder::bind<ValueBinder,OpaqueDataBlock>( const ValueBinder& b, OpaqueDataBlock& object, + const string& typ, const string& val); + template bool OpaqueDataBinder::bind<VectorBinder,OpaqueDataBlock>( const VectorBinder& b, OpaqueDataBlock& object, + const string& typ, const string& val); + template bool OpaqueDataBinder::bind<ListBinder,OpaqueDataBlock>( const ListBinder& b, OpaqueDataBlock& object, + const string& typ, const string& val); + template bool OpaqueDataBinder::bind<SetBinder,OpaqueDataBlock>( const SetBinder& b, OpaqueDataBlock& object, + const string& typ, const string& val); - template bool OpaqueDataBinder::bind<ValueBinder,Conditions::Condition>( const ValueBinder& b, Conditions::Condition& object, - const string& typ, const string& val); - template bool OpaqueDataBinder::bind<VectorBinder,Conditions::Condition>( const VectorBinder& b, Conditions::Condition& object, - const string& typ, const string& val); - template bool OpaqueDataBinder::bind<ListBinder,Conditions::Condition>( const ListBinder& b, Conditions::Condition& object, - const string& typ, const string& val); - template bool OpaqueDataBinder::bind<SetBinder,Conditions::Condition>( const SetBinder& b, Conditions::Condition& object, - const string& typ, const string& val); + template bool OpaqueDataBinder::bind<ValueBinder,Condition>( const ValueBinder& b, Condition& object, + const string& typ, const string& val); + template bool OpaqueDataBinder::bind<VectorBinder,Condition>( const VectorBinder& b, Condition& object, + const string& typ, const string& val); + template bool OpaqueDataBinder::bind<ListBinder,Condition>( const ListBinder& b, Condition& object, + const string& typ, const string& val); + template bool OpaqueDataBinder::bind<SetBinder,Condition>( const SetBinder& b, Condition& object, + const string& typ, const string& val); - /// Binding function for sequences (unmapped STL containers) - template <typename T> - bool OpaqueDataBinder::bind_sequence(T& object, const string& typ, const string& val) - { - size_t idx = typ.find('['); - size_t idq = typ.find(']'); - string value_type = typ.substr(idx+1,idq-idx-1); - if ( typ.substr(0,6) == "vector" ) - return bind(VectorBinder(), object, value_type, val); - else if ( typ.substr(0,4) == "list" ) - return bind(ListBinder(), object, value_type, val); - else if ( typ.substr(0,3) == "set" ) - return bind(SetBinder(), object, value_type, val); - else if ( idx == string::npos && idq == string::npos ) - return bind(ValueBinder(), object, value_type, val); - return false; - } + /// Binding function for sequences (unmapped STL containers) + template <typename T> + bool OpaqueDataBinder::bind_sequence(T& object, const string& typ, const string& val) + { + size_t idx = typ.find('['); + size_t idq = typ.find(']'); + string value_type = typ.substr(idx+1,idq-idx-1); + if ( typ.substr(0,6) == "vector" ) + return bind(VectorBinder(), object, value_type, val); + else if ( typ.substr(0,4) == "list" ) + return bind(ListBinder(), object, value_type, val); + else if ( typ.substr(0,3) == "set" ) + return bind(SetBinder(), object, value_type, val); + else if ( idx == string::npos && idq == string::npos ) + return bind(ValueBinder(), object, value_type, val); + return false; + } - template<typename BINDER, typename OBJECT, typename KEY, typename VAL> - static void insert_map_item(const BINDER&, - OBJECT& object, - const KEY& k, - const string& val, - const VAL*) - { - typedef map<KEY,VAL> map_t; - map_t& m = object.template get<map_t>(); - VAL v; - if ( !BasicGrammar::instance<VAL>().fromString(&v, val) ) { - except("OpaqueDataBinder","++ Failed to convert conditions map entry."); + template<typename BINDER, typename OBJECT, typename KEY, typename VAL> + static void insert_map_item(const BINDER&, + OBJECT& object, + const KEY& k, + const string& val, + const VAL*) + { + typedef map<KEY,VAL> map_t; + map_t& m = object.template get<map_t>(); + VAL v; + if ( !BasicGrammar::instance<VAL>().fromString(&v, val) ) { + except("OpaqueDataBinder","++ Failed to convert conditions map entry."); + } + m.insert(make_pair(k,v)); } - m.insert(make_pair(k,v)); - } - template<typename BINDER, typename OBJECT, typename KEY> - static void insert_map_key(const BINDER& b, - OBJECT& object, - const string& key_val, - const string& val_type, - const string& val, - const KEY*) - { - KEY key; - BasicGrammar::instance<KEY>().fromString(&key, key_val); - // Short and char is not part of the standard dictionaries. Fall back to 'int'. - if ( val_type.substr(0,4) == "char" ) - insert_map_item(b, object, key, val, (int*)0); - else if ( val_type.substr(0,5) == "short" ) - insert_map_item(b, object, key, val, (int*)0); - else if ( val_type.substr(0,3) == "int" ) - insert_map_item(b, object, key, val, (int*)0); - else if ( val_type.substr(0,4) == "long" ) - insert_map_item(b, object, key, val, (long*)0); - else if ( val_type.substr(0,5) == "float" ) - insert_map_item(b, object, key, val, (float*)0); - else if ( val_type.substr(0,6) == "double" ) - insert_map_item(b, object, key, val, (double*)0); - else if ( val_type.substr(0,6) == "string" ) - insert_map_item(b, object, key, val, (string*)0); - else if ( val_type == "std::string" ) - insert_map_item(b, object, key, val, (string*)0); - else { - printout(INFO,"Param","++ Unknown conditions parameter type:%s data:%s", - val_type.c_str(),val.c_str()); - insert_map_item(b, object, key, val, (string*)0); + template<typename BINDER, typename OBJECT, typename KEY> + static void insert_map_key(const BINDER& b, + OBJECT& object, + const string& key_val, + const string& val_type, + const string& val, + const KEY*) + { + KEY key; + BasicGrammar::instance<KEY>().fromString(&key, key_val); + // Short and char is not part of the standard dictionaries. Fall back to 'int'. + if ( val_type.substr(0,4) == "char" ) + insert_map_item(b, object, key, val, (int*)0); + else if ( val_type.substr(0,5) == "short" ) + insert_map_item(b, object, key, val, (int*)0); + else if ( val_type.substr(0,3) == "int" ) + insert_map_item(b, object, key, val, (int*)0); + else if ( val_type.substr(0,4) == "long" ) + insert_map_item(b, object, key, val, (long*)0); + else if ( val_type.substr(0,5) == "float" ) + insert_map_item(b, object, key, val, (float*)0); + else if ( val_type.substr(0,6) == "double" ) + insert_map_item(b, object, key, val, (double*)0); + else if ( val_type.substr(0,6) == "string" ) + insert_map_item(b, object, key, val, (string*)0); + else if ( val_type == "std::string" ) + insert_map_item(b, object, key, val, (string*)0); + else { + printout(INFO,"Param","++ Unknown conditions parameter type:%s data:%s", + val_type.c_str(),val.c_str()); + insert_map_item(b, object, key, val, (string*)0); + } } - } - template<typename BINDER, typename OBJECT, typename KEY, typename VAL> - static void insert_map_pair(const BINDER&, - OBJECT& object, - const string& data, - const KEY*, - const VAL*) - { - typedef map<KEY,VAL> map_t; - pair<KEY,VAL> entry; - map_t& m = object.template get<map_t>(); - if ( !BasicGrammar::instance<pair<KEY,VAL> >().fromString(&entry,data) ) { - except("OpaqueDataBinder","++ Failed to convert conditions map entry."); + template<typename BINDER, typename OBJECT, typename KEY, typename VAL> + static void insert_map_pair(const BINDER&, + OBJECT& object, + const string& data, + const KEY*, + const VAL*) + { + typedef map<KEY,VAL> map_t; + pair<KEY,VAL> entry; + map_t& m = object.template get<map_t>(); + if ( !BasicGrammar::instance<pair<KEY,VAL> >().fromString(&entry,data) ) { + except("OpaqueDataBinder","++ Failed to convert conditions map entry."); + } + m.insert(entry); } - m.insert(entry); - } - template<typename BINDER, typename OBJECT, typename KEY> - static void insert_map_data(const BINDER& b, - OBJECT& object, - const string& val_type, - const string& pair_data, - const KEY*) - { - // Short and char is not part of the standard dictionaries. Fall back to 'int'. - if ( val_type.substr(0,4) == "char" ) - insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0); - else if ( val_type.substr(0,5) == "short" ) - insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0); - else if ( val_type.substr(0,3) == "int" ) - insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0); - else if ( val_type.substr(0,4) == "long" ) - insert_map_pair(b, object, pair_data, (KEY*)0, (long*)0); - else if ( val_type.substr(0,5) == "float" ) - insert_map_pair(b, object, pair_data, (KEY*)0, (float*)0); - else if ( val_type.substr(0,6) == "double" ) - insert_map_pair(b, object, pair_data, (KEY*)0, (double*)0); - else if ( val_type.substr(0,6) == "string" ) - insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0); - else if ( val_type == "std::string" ) - insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0); - else { - printout(INFO,"Param","++ Unknown conditions parameter type:%s data:%s", - val_type.c_str(),pair_data.c_str()); - insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0); + template<typename BINDER, typename OBJECT, typename KEY> + static void insert_map_data(const BINDER& b, + OBJECT& object, + const string& val_type, + const string& pair_data, + const KEY*) + { + // Short and char is not part of the standard dictionaries. Fall back to 'int'. + if ( val_type.substr(0,4) == "char" ) + insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0); + else if ( val_type.substr(0,5) == "short" ) + insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0); + else if ( val_type.substr(0,3) == "int" ) + insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0); + else if ( val_type.substr(0,4) == "long" ) + insert_map_pair(b, object, pair_data, (KEY*)0, (long*)0); + else if ( val_type.substr(0,5) == "float" ) + insert_map_pair(b, object, pair_data, (KEY*)0, (float*)0); + else if ( val_type.substr(0,6) == "double" ) + insert_map_pair(b, object, pair_data, (KEY*)0, (double*)0); + else if ( val_type.substr(0,6) == "string" ) + insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0); + else if ( val_type == "std::string" ) + insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0); + else { + printout(INFO,"Param","++ Unknown conditions parameter type:%s data:%s", + val_type.c_str(),pair_data.c_str()); + insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0); + } } - } - template<typename BINDER, typename OBJECT, typename KEY> - static void bind_mapping(const BINDER& b, const string& val_type, OBJECT& object, const KEY*) { - if ( val_type.substr(0,3) == "int" ) - __bind__(b,object, (map<KEY,int>*)0); + template<typename BINDER, typename OBJECT, typename KEY> + static void bind_mapping(const BINDER& b, const string& val_type, OBJECT& object, const KEY*) { + if ( val_type.substr(0,3) == "int" ) + __bind__(b,object, (map<KEY,int>*)0); #if defined(DD4HEP_HAVE_ALL_PARSERS) - else if ( val_type.substr(0,12) == "unsigned int" ) - __bind__(b,object, (map<KEY,unsigned int>*)0); - else if ( val_type.substr(0,4) == "char" ) - __bind__(b,object, (map<KEY,char>*)0); - else if ( val_type.substr(0,13) == "unsigned char" ) - __bind__(b,object, (map<KEY,unsigned char>*)0); - else if ( val_type.substr(0,5) == "short" ) - __bind__(b,object, (map<KEY,short>*)0); - else if ( val_type.substr(0,14) == "unsigned short" ) - __bind__(b,object, (map<KEY,unsigned short>*)0); - else if ( val_type.substr(0,13) == "unsigned long" ) - __bind__(b,object, (map<KEY,unsigned long>*)0); + else if ( val_type.substr(0,12) == "unsigned int" ) + __bind__(b,object, (map<KEY,unsigned int>*)0); + else if ( val_type.substr(0,4) == "char" ) + __bind__(b,object, (map<KEY,char>*)0); + else if ( val_type.substr(0,13) == "unsigned char" ) + __bind__(b,object, (map<KEY,unsigned char>*)0); + else if ( val_type.substr(0,5) == "short" ) + __bind__(b,object, (map<KEY,short>*)0); + else if ( val_type.substr(0,14) == "unsigned short" ) + __bind__(b,object, (map<KEY,unsigned short>*)0); + else if ( val_type.substr(0,13) == "unsigned long" ) + __bind__(b,object, (map<KEY,unsigned long>*)0); #else - // Short and char is not part of the standard dictionaries. Fall back to 'int'. - else if ( val_type.substr(0,4) == "char" ) - __bind__(b,object, (map<KEY,int>*)0); - else if ( val_type.substr(0,5) == "short" ) - __bind__(b,object, (map<KEY,int>*)0); + // Short and char is not part of the standard dictionaries. Fall back to 'int'. + else if ( val_type.substr(0,4) == "char" ) + __bind__(b,object, (map<KEY,int>*)0); + else if ( val_type.substr(0,5) == "short" ) + __bind__(b,object, (map<KEY,int>*)0); #endif - else if ( val_type.substr(0,4) == "long" ) - __bind__(b,object, (map<KEY,long>*)0); - else if ( val_type.substr(0,5) == "float" ) - __bind__(b,object, (map<KEY,float>*)0); - else if ( val_type.substr(0,6) == "double" ) - __bind__(b,object, (map<KEY,double>*)0); - else if ( val_type.substr(0,6) == "string" ) - __bind__(b,object, (map<KEY,string>*)0); - else if ( val_type == "std::string" ) - __bind__(b,object, (map<KEY,string>*)0); - else { - __bind__(b,object, (map<KEY,string>*)0); + else if ( val_type.substr(0,4) == "long" ) + __bind__(b,object, (map<KEY,long>*)0); + else if ( val_type.substr(0,5) == "float" ) + __bind__(b,object, (map<KEY,float>*)0); + else if ( val_type.substr(0,6) == "double" ) + __bind__(b,object, (map<KEY,double>*)0); + else if ( val_type.substr(0,6) == "string" ) + __bind__(b,object, (map<KEY,string>*)0); + else if ( val_type == "std::string" ) + __bind__(b,object, (map<KEY,string>*)0); + else { + __bind__(b,object, (map<KEY,string>*)0); + } } - } - /// Binding function for STL maps - template <typename BINDER, typename OBJECT> - bool OpaqueDataBinder::bind_map(const BINDER& b, OBJECT& object, - const string& key_type, const string& val_type) { - // Short and char is not part of the standard dictionaries. Fall back to 'int'. - if ( key_type.substr(0,3) == "int" ) - bind_mapping(b, val_type, object, Primitive<int>::null_pointer()); + /// Binding function for STL maps + template <typename BINDER, typename OBJECT> + bool OpaqueDataBinder::bind_map(const BINDER& b, OBJECT& object, + const string& key_type, const string& val_type) { + // Short and char is not part of the standard dictionaries. Fall back to 'int'. + if ( key_type.substr(0,3) == "int" ) + bind_mapping(b, val_type, object, Primitive<int>::null_pointer()); #if defined(DD4HEP_HAVE_ALL_PARSERS) - else if ( key_type.substr(0,4) == "char" ) - bind_mapping(b, val_type, object, Primitive<int>::null_pointer()); - else if ( key_type.substr(0,5) == "short" ) - bind_mapping(b, val_type, object, Primitive<int>::null_pointer()); - else if ( key_type.substr(0,4) == "long" ) - bind_mapping(b, val_type, object, Primitive<long>::null_pointer()); - else if ( key_type.substr(0,5) == "float" ) - bind_mapping(b, val_type, object, Primitive<float>::null_pointer()); - else if ( key_type.substr(0,6) == "double" ) - bind_mapping(b, val_type, object, Primitive<double>::null_pointer()); + else if ( key_type.substr(0,4) == "char" ) + bind_mapping(b, val_type, object, Primitive<int>::null_pointer()); + else if ( key_type.substr(0,5) == "short" ) + bind_mapping(b, val_type, object, Primitive<int>::null_pointer()); + else if ( key_type.substr(0,4) == "long" ) + bind_mapping(b, val_type, object, Primitive<long>::null_pointer()); + else if ( key_type.substr(0,5) == "float" ) + bind_mapping(b, val_type, object, Primitive<float>::null_pointer()); + else if ( key_type.substr(0,6) == "double" ) + bind_mapping(b, val_type, object, Primitive<double>::null_pointer()); #endif - else if ( key_type.substr(0,6) == "string" ) - bind_mapping(b, val_type, object, Primitive<string>::null_pointer()); - else if ( key_type == "std::string" ) - bind_mapping(b, val_type, object, Primitive<string>::null_pointer()); - else { - printout(INFO,"OpaqueDataBinder","++ Unknown MAP-conditions key-type:%s",key_type.c_str()); - bind_mapping(b, val_type, object, Primitive<string>::null_pointer()); + else if ( key_type.substr(0,6) == "string" ) + bind_mapping(b, val_type, object, Primitive<string>::null_pointer()); + else if ( key_type == "std::string" ) + bind_mapping(b, val_type, object, Primitive<string>::null_pointer()); + else { + printout(INFO,"OpaqueDataBinder","++ Unknown MAP-conditions key-type:%s",key_type.c_str()); + bind_mapping(b, val_type, object, Primitive<string>::null_pointer()); + } + return true; } - return true; - } - /// Filling function for STL maps. - template <typename BINDER, typename OBJECT> - bool OpaqueDataBinder::insert_map(const BINDER& b, OBJECT& object, - const string& key_type, const string& key, - const string& val_type, const string& val) - { - if ( key_type.substr(0,3) == "int" ) - insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer()); + /// Filling function for STL maps. + template <typename BINDER, typename OBJECT> + bool OpaqueDataBinder::insert_map(const BINDER& b, OBJECT& object, + const string& key_type, const string& key, + const string& val_type, const string& val) + { + if ( key_type.substr(0,3) == "int" ) + insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer()); #if defined(DD4HEP_HAVE_ALL_PARSERS) - // Short and char is not part of the standard dictionaries. Fall back to 'int'. - else if ( key_type.substr(0,4) == "char" ) - insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer()); - else if ( key_type.substr(0,5) == "short" ) - insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer()); - else if ( key_type.substr(0,4) == "long" ) - insert_map_key(b, object, key, val_type, val, Primitive<long>::null_pointer()); - else if ( key_type.substr(0,5) == "float" ) - insert_map_key(b, object, key, val_type, val, Primitive<float>::null_pointer()); - else if ( key_type.substr(0,6) == "double" ) - insert_map_key(b, object, key, val_type, val, Primitive<double>::null_pointer()); + // Short and char is not part of the standard dictionaries. Fall back to 'int'. + else if ( key_type.substr(0,4) == "char" ) + insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer()); + else if ( key_type.substr(0,5) == "short" ) + insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer()); + else if ( key_type.substr(0,4) == "long" ) + insert_map_key(b, object, key, val_type, val, Primitive<long>::null_pointer()); + else if ( key_type.substr(0,5) == "float" ) + insert_map_key(b, object, key, val_type, val, Primitive<float>::null_pointer()); + else if ( key_type.substr(0,6) == "double" ) + insert_map_key(b, object, key, val_type, val, Primitive<double>::null_pointer()); #endif - else if ( key_type.substr(0,6) == "string" ) - insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer()); - else if ( key_type == "std::string" ) - insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer()); - else { - printout(INFO,"OpaqueDataBinder","++ Unknown MAP-conditions key-type:%s",key_type.c_str()); - insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer()); + else if ( key_type.substr(0,6) == "string" ) + insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer()); + else if ( key_type == "std::string" ) + insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer()); + else { + printout(INFO,"OpaqueDataBinder","++ Unknown MAP-conditions key-type:%s",key_type.c_str()); + insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer()); + } + return true; } - return true; - } - /// Filling function for STL maps. - template <typename BINDER, typename OBJECT> - bool OpaqueDataBinder::insert_map(const BINDER& b, OBJECT& object, - const std::string& key_type, const std::string& val_type, - const std::string& pair_data) - { - if ( key_type.substr(0,3) == "int" ) - insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer()); + /// Filling function for STL maps. + template <typename BINDER, typename OBJECT> + bool OpaqueDataBinder::insert_map(const BINDER& b, OBJECT& object, + const std::string& key_type, const std::string& val_type, + const std::string& pair_data) + { + if ( key_type.substr(0,3) == "int" ) + insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer()); #if defined(DD4HEP_HAVE_ALL_PARSERS) - // Short and char is not part of the standard dictionaries. Fall back to 'int'. - else if ( key_type.substr(0,4) == "char" ) - insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer()); - else if ( key_type.substr(0,5) == "short" ) - insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer()); - else if ( key_type.substr(0,4) == "long" ) - insert_map_data(b, object, val_type, pair_data, Primitive<long>::null_pointer()); - else if ( key_type.substr(0,5) == "float" ) - insert_map_data(b, object, val_type, pair_data, Primitive<float>::null_pointer()); - else if ( key_type.substr(0,6) == "double" ) - insert_map_data(b, object, val_type, pair_data, Primitive<double>::null_pointer()); + // Short and char is not part of the standard dictionaries. Fall back to 'int'. + else if ( key_type.substr(0,4) == "char" ) + insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer()); + else if ( key_type.substr(0,5) == "short" ) + insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer()); + else if ( key_type.substr(0,4) == "long" ) + insert_map_data(b, object, val_type, pair_data, Primitive<long>::null_pointer()); + else if ( key_type.substr(0,5) == "float" ) + insert_map_data(b, object, val_type, pair_data, Primitive<float>::null_pointer()); + else if ( key_type.substr(0,6) == "double" ) + insert_map_data(b, object, val_type, pair_data, Primitive<double>::null_pointer()); #endif - else if ( key_type.substr(0,6) == "string" ) - insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer()); - else if ( key_type == "std::string" ) - insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer()); - else { - printout(INFO,"OpaqueDataBinder","++ Unknown MAP-conditions key-type:%s",key_type.c_str()); - insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer()); + else if ( key_type.substr(0,6) == "string" ) + insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer()); + else if ( key_type == "std::string" ) + insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer()); + else { + printout(INFO,"OpaqueDataBinder","++ Unknown MAP-conditions key-type:%s",key_type.c_str()); + insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer()); + } + return true; } - return true; - } - template bool OpaqueDataBinder::bind_sequence<OpaqueDataBlock>(OpaqueDataBlock& object,const string& typ,const string& val); - template bool OpaqueDataBinder::bind_map<MapBinder,OpaqueDataBlock>( const MapBinder& b, OpaqueDataBlock& object, - const string& typ,const string& val); - template bool OpaqueDataBinder::insert_map<MapBinder,OpaqueDataBlock>( const MapBinder& b, OpaqueDataBlock& object, - const string& key_type, const string& key, - const string& val_type, const string& val); - template bool OpaqueDataBinder::insert_map<MapBinder,OpaqueDataBlock>( const MapBinder& b, OpaqueDataBlock& object, - const string& key_type, const string& val_type, - const string& pair_data); + template bool OpaqueDataBinder::bind_sequence<OpaqueDataBlock>(OpaqueDataBlock& object,const string& typ,const string& val); + template bool OpaqueDataBinder::bind_map<MapBinder,OpaqueDataBlock>( const MapBinder& b, OpaqueDataBlock& object, + const string& typ,const string& val); + template bool OpaqueDataBinder::insert_map<MapBinder,OpaqueDataBlock>( const MapBinder& b, OpaqueDataBlock& object, + const string& key_type, const string& key, + const string& val_type, const string& val); + template bool OpaqueDataBinder::insert_map<MapBinder,OpaqueDataBlock>( const MapBinder& b, OpaqueDataBlock& object, + const string& key_type, const string& val_type, + const string& pair_data); - /// Instantiation for Conditions: - template bool OpaqueDataBinder::bind_sequence<Conditions::Condition>( Conditions::Condition& object, - const string& typ,const string& val); - /// Conditions binding function for STL maps - template <> bool OpaqueDataBinder::bind_map(const MapBinder& b, Conditions::Condition& object, - const string& key_type, const string& val_type) - { return bind_map(b, object->data, key_type, val_type); } + /// Instantiation for Conditions: + template bool OpaqueDataBinder::bind_sequence<Condition>( Condition& object, + const string& typ,const string& val); + /// Conditions binding function for STL maps + template <> bool OpaqueDataBinder::bind_map(const MapBinder& b, Condition& object, + const string& key_type, const string& val_type) + { return bind_map(b, object->data, key_type, val_type); } - /// Conditions: Filling function for STL maps. - template <> bool OpaqueDataBinder::insert_map(const MapBinder& b, Conditions::Condition& object, - const string& key_type, const string& key, - const string& val_type, const string& val) - { return insert_map(b, object->data, key_type, key, val_type, val); } + /// Conditions: Filling function for STL maps. + template <> bool OpaqueDataBinder::insert_map(const MapBinder& b, Condition& object, + const string& key_type, const string& key, + const string& val_type, const string& val) + { return insert_map(b, object->data, key_type, key, val_type, val); } - /// Conditions: Filling function for STL maps. - template <> bool OpaqueDataBinder::insert_map(const MapBinder& b, Conditions::Condition& object, - const string& key_type, const string& val_type, const string& pair_data) - { return insert_map(b, object->data, key_type, val_type, pair_data); } + /// Conditions: Filling function for STL maps. + template <> bool OpaqueDataBinder::insert_map(const MapBinder& b, Condition& object, + const string& key_type, const string& val_type, const string& pair_data) + { return insert_map(b, object->data, key_type, val_type, pair_data); } + } } diff --git a/DDCore/src/Path.cpp b/DDCore/src/Path.cpp index 432867874..6d72f1562 100644 --- a/DDCore/src/Path.cpp +++ b/DDCore/src/Path.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; +using namespace dd4hep; namespace { const char dot = '.'; diff --git a/DDCore/src/PluginCreators.cpp b/DDCore/src/PluginCreators.cpp index 88e895908..60d0e1066 100644 --- a/DDCore/src/PluginCreators.cpp +++ b/DDCore/src/PluginCreators.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,14 +22,14 @@ //#include <dlfcn.h> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { static inline ComponentCast* component(void* p) { return (ComponentCast*)p; } - void* createProcessor(Geometry::LCDD& lcdd, int argc, char** argv, void* (*cast)(void*)) { + void* createProcessor(Detector& description, int argc, char** argv, void* (*cast)(void*)) { void* processor = 0; if ( argc < 2 ) { - except("createProcessor","++ DD4hep-plugins: No processor creator name given!"); + except("createProcessor","++ dd4hep-plugins: No processor creator name given!"); } for(int i=0; i<argc; ++i) { if ( 0 == ::strncmp(argv[i],"-processor",4) ) { @@ -41,12 +41,12 @@ namespace DD4hep { args.push_back(argv[j]); int num_arg = int(args.size()); args.push_back(0); - processor = PluginService::Create<void*>(fac,&lcdd,num_arg,&args[0]); + processor = PluginService::Create<void*>(fac,&description,num_arg,&args[0]); if ( !processor ) { PluginDebug dbg; - processor = PluginService::Create<void*>(fac,&lcdd,num_arg,&args[0]); + processor = PluginService::Create<void*>(fac,&description,num_arg,&args[0]); if ( !processor ) { - except("createProcessor","DD4hep-plugins: Failed to locate plugin %s. \n%s %s", + except("createProcessor","dd4hep-plugins: Failed to locate plugin %s. \n%s %s", fac.c_str(), dbg.missingFactory(fac).c_str(), /* ::dlerror() ? ::dlerror() : */ ""); } @@ -61,19 +61,19 @@ namespace DD4hep { } if ( !processor ) { except("createProcessor", - "DD4hep-plugins: Found arguments in plugin call, but could not make any sense of them: %s", + "dd4hep-plugins: Found arguments in plugin call, but could not make any sense of them: %s", arguments(argc,argv).c_str()); } return processor; } - void* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, int argc, char** argv, void* (*cast)(void*)) { - void* object = PluginService::Create<void*>(factory, &lcdd, argc, argv); + void* createPlugin(const std::string& factory, Detector& description, int argc, char** argv, void* (*cast)(void*)) { + void* object = PluginService::Create<void*>(factory, &description, argc, argv); if ( !object ) { PluginDebug dbg; - object = PluginService::Create<void*>(factory, &lcdd, argc, argv); + object = PluginService::Create<void*>(factory, &description, argc, argv); if ( !object ) { - except("ConditionsManager","DD4hep-plugins: Failed to locate plugin %s. \n%s.", + except("ConditionsManager","dd4hep-plugins: Failed to locate plugin %s. \n%s.", factory.c_str(), dbg.missingFactory(factory).c_str()); } } @@ -87,19 +87,19 @@ namespace DD4hep { } /// Handler for factories of type: ConstructionFactory - void* createPlugin(const std::string& factory, Geometry::LCDD& lcdd, void* (*cast)(void*)) { + void* createPlugin(const std::string& factory, Detector& description, void* (*cast)(void*)) { char* argv[] = {0}; int argc = 0; - return createPlugin(factory, lcdd, argc, argv, cast); + return createPlugin(factory, description, argc, argv, cast); } /// Handler for factories of type: ConstructionFactory void* createPlugin(const std::string& factory, - Geometry::LCDD& lcdd, + Detector& description, const std::string& arg, void* (*cast)(void*)) { char* argv[] = { (char*)arg.c_str(), 0 }; int argc = 1; - return createPlugin(factory, lcdd, argc, argv, cast); + return createPlugin(factory, description, argc, argv, cast); } } diff --git a/DDCore/src/PluginTester.cpp b/DDCore/src/PluginTester.cpp index 3810e0e50..3a7e78b5d 100644 --- a/DDCore/src/PluginTester.cpp +++ b/DDCore/src/PluginTester.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files #include <stdexcept> -using namespace DD4hep; +using namespace dd4hep; namespace { static int s_extensionID = 0; @@ -41,7 +41,7 @@ PluginTester::~PluginTester() { InstanceCount::decrement(this); } -/// Internal object destructor: release extension object(s) +/// detaill object destructor: release extension object(s) void PluginTester::clear(bool destroy) { for (Extensions::iterator i = extensions.begin(); i != extensions.end(); ++i) { void* ptr = (*i).second; @@ -71,7 +71,7 @@ void* PluginTester::addExtension(void* ptr, const std::string& name, const std:: } return extensions[key] = ptr; } - throw std::runtime_error("DD4hep: addExtension: Object already has an extension "+name+ + throw std::runtime_error("dd4hep: addExtension: Object already has an extension "+name+ " of type:" + typeName(info) + "."); } @@ -92,7 +92,7 @@ void* PluginTester::removeExtension(const std::string& name, const std::type_inf extensions.erase(j); return ptr; } - throw std::runtime_error("DD4hep: removeExtension: The object "+name+ + throw std::runtime_error("dd4hep: removeExtension: The object "+name+ " of type " + typeName(info) + " is not present."); } @@ -105,7 +105,7 @@ void* PluginTester::extension(const std::string& name, const std::type_info& inf } else if ( !alert ) return 0; - throw std::runtime_error("DD4hep: extension: Object has no extension "+name+ + throw std::runtime_error("dd4hep: extension: Object has no extension "+name+ " of type:" + typeName(info) + "."); } diff --git a/DDCore/src/Plugins.cpp b/DDCore/src/Plugins.cpp index 65e22babc..f2b26de3a 100644 --- a/DDCore/src/Plugins.cpp +++ b/DDCore/src/Plugins.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include <cstdlib> using namespace std; -using namespace DD4hep; +using namespace dd4hep; namespace { inline int* s_debug_value() { @@ -102,7 +102,7 @@ namespace { if ( !fp.fptr.ptr ) fp.fptr.ptr = ::dlsym(0, entry); #endif if ( 0 == fp.fptr.ptr ) { - string err = "DD4hep:PluginService: Failed to access symbol " + string err = "dd4hep:PluginService: Failed to access symbol " "\""+string(entry)+"\" in plugin library "+string(plugin)+ " ["+string(::strerror(errno))+"]"; throw runtime_error(err); @@ -169,19 +169,19 @@ void PluginService::addFactory(const std::string& id, stub_t stub, #endif #if !defined(DD4HEP_PARSERS_NO_ROOT) -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Handle.h" #include "DD4hep/GeoHandler.h" #include "XML/XMLElements.h" -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(NamedObject*, (Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(NamedObject*, (Geometry::LCDD*,XML::Handle_t*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(NamedObject*, (Geometry::LCDD*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Geometry::LCDD*,XML::Handle_t*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Geometry::LCDD*,XML::Handle_t const*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Geometry::LCDD*, int, char**)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Geometry::LCDD*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Geometry::LCDD*, const Geometry::GeoHandler*, const std::map<std::string,std::string>*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(NamedObject*, (Detector*,xml::Handle_t*,Ref_t*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(NamedObject*, (Detector*,xml::Handle_t*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(NamedObject*, (Detector*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Detector*,xml::Handle_t*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Detector*,xml::Handle_t const*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Detector*, int, char**)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Detector*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Detector*, const GeoHandler*, const std::map<std::string,std::string>*)) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, ()) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(void*, (const char*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(void*, (Geometry::LCDD*,int,char**)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(void*, (Detector*,int,char**)) #endif diff --git a/DDCore/src/PolarGridRPhi.cpp b/DDCore/src/PolarGridRPhi.cpp index b47ec9e81..3cde97121 100644 --- a/DDCore/src/PolarGridRPhi.cpp +++ b/DDCore/src/PolarGridRPhi.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// determine the position based on the cell ID Position PolarGridRPhi::position(const CellID& id) const { @@ -27,7 +27,7 @@ Position PolarGridRPhi::position(const CellID& id) const { } /// determine the cell ID based on the position -DD4hep::CellID PolarGridRPhi::cellID(const Position& local, +dd4hep::CellID PolarGridRPhi::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/PolarGridRPhi2.cpp b/DDCore/src/PolarGridRPhi2.cpp index 516d749b5..d3a527de0 100644 --- a/DDCore/src/PolarGridRPhi2.cpp +++ b/DDCore/src/PolarGridRPhi2.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// determine the position based on the cell ID Position PolarGridRPhi2::position(const CellID& id) const { @@ -27,7 +27,7 @@ Position PolarGridRPhi2::position(const CellID& id) const { } /// determine the cell ID based on the position -DD4hep::CellID PolarGridRPhi2::cellID(const Position& local, +dd4hep::CellID PolarGridRPhi2::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/Primitives.cpp b/DDCore/src/Primitives.cpp index 54c32cec8..b31962414 100644 --- a/DDCore/src/Primitives.cpp +++ b/DDCore/src/Primitives.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -145,14 +145,14 @@ namespace { } /// Convert volumeID to string format (016X) -std::string DD4hep::volumeID(VolumeID vid) { +std::string dd4hep::volumeID(VolumeID vid) { char text[32]; ::snprintf(text,sizeof(text),"%016llx",vid); return text; } /// We need it so often: one-at-time 64 bit hash function -unsigned long long int DD4hep::hash64(const char* key) { +unsigned long long int dd4hep::detail::hash64(const char* key) { //return murmur_hash_64(key, strlen(key)); unsigned char* str = (unsigned char*)key; unsigned long long int hash = FNV1a_64::hashinit; @@ -160,12 +160,12 @@ unsigned long long int DD4hep::hash64(const char* key) { return hash; } -unsigned long long int DD4hep::hash64(const std::string& key) { +unsigned long long int dd4hep::detail::hash64(const std::string& key) { //return murmur_hash_64(key.data(), key.length()); return std::accumulate(begin(key),end(key),FNV1a_64::hashinit,FNV1a_64::doByte); } -long int DD4hep::makeTime(int year, int month, int day, +long int dd4hep::detail::makeTime(int year, int month, int day, int hour, int minutes, int seconds) { struct tm tm_init; @@ -179,23 +179,23 @@ long int DD4hep::makeTime(int year, int month, int day, tm_init.tm_isdst = -1; long int ti = ::mktime(&tm_init); if ( ti >= 0 ) return ti; - except("DD4hep","Invalid time data given for conversion to epoch: %d-%d-%d %02d:%02d:%02d", + except("dd4hep","Invalid time data given for conversion to epoch: %d-%d-%d %02d:%02d:%02d", year, month, day, hour, minutes, seconds); return ti; } /// Convert date into epoch time (seconds since 1970) -long int DD4hep::makeTime(const std::string& date, const char* fmt) { +long int dd4hep::detail::makeTime(const std::string& date, const char* fmt) { struct tm tm; char* c = ::strptime(date.c_str(),fmt,&tm); if ( 0 == c ) { - except("DD4hep", + except("dd4hep", "Invalid time format given for update:%s should be: %s", date.c_str(), fmt); } long ti = ::mktime(&tm); if ( ti >= 0 ) return ti; - except("DD4hep", + except("dd4hep", "Invalid time string given for conversion to epoch: %s (fmt='%s')", date.c_str(), fmt); return ti; @@ -319,16 +319,16 @@ static const std::string __typeinfoName(const std::type_info& tinfo) { return result; } -std::string DD4hep::typeName(const std::type_info& typ) { +std::string dd4hep::typeName(const std::type_info& typ) { return __typeinfoName(typ); } -void DD4hep::invalidHandleError(const std::type_info& type) +void dd4hep::invalidHandleError(const std::type_info& type) { throw invalid_handle_exception("Attempt to access invalid object of type "+typeName(type)+" [Invalid Handle]"); } -void DD4hep::invalidHandleAssignmentError(const std::type_info& from, +void dd4hep::invalidHandleAssignmentError(const std::type_info& from, const std::type_info& to) { std::string msg = "Wrong assingment from "; @@ -340,76 +340,78 @@ void DD4hep::invalidHandleAssignmentError(const std::type_info& from, } /// Throw exception when handles are check for validity -void DD4hep::notImplemented(const std::string& msg) +void dd4hep::notImplemented(const std::string& msg) { std::string m = "The requested feature " + msg + " is not implemented!"; throw std::runtime_error(m); } -void DD4hep::typeinfoCheck(const std::type_info& typ1, const std::type_info& typ2, const std::string& text) +void dd4hep::typeinfoCheck(const std::type_info& typ1, const std::type_info& typ2, const std::string& text) { if (typ1 != typ2) { throw unrelated_type_error(typ1, typ2, text); } } -namespace DD4hep { - template<> const char* Primitive<bool>::default_format() { return "%d"; } - template<> const char* Primitive<char>::default_format() { return "%c"; } - template<> const char* Primitive<unsigned char>::default_format() { return "%02X"; } - template<> const char* Primitive<short>::default_format() { return "%d"; } - template<> const char* Primitive<unsigned short>::default_format() { return "%04X"; } - template<> const char* Primitive<int>::default_format() { return "%d"; } - template<> const char* Primitive<unsigned int>::default_format() { return "%08X"; } - template<> const char* Primitive<long>::default_format() { return "%ld"; } - template<> const char* Primitive<unsigned long>::default_format() { return "%016X"; } - template<> const char* Primitive<float>::default_format() { return "%f"; } - template<> const char* Primitive<double>::default_format() { return "%g"; } - template<> const char* Primitive<char*>::default_format() { return "%s"; } - template<> const char* Primitive<const char*>::default_format() { return "%s"; } - template<> const char* Primitive<std::string>::default_format() { return "%s"; } - - /// Generic function to convert to string - template <typename T> std::string Primitive<T>::toString(T value) { - char text[1024]; - ::snprintf(text,sizeof(text),default_format(),value); - return text; - } +namespace dd4hep { + namespace detail { + template<> const char* Primitive<bool>::default_format() { return "%d"; } + template<> const char* Primitive<char>::default_format() { return "%c"; } + template<> const char* Primitive<unsigned char>::default_format() { return "%02X"; } + template<> const char* Primitive<short>::default_format() { return "%d"; } + template<> const char* Primitive<unsigned short>::default_format() { return "%04X"; } + template<> const char* Primitive<int>::default_format() { return "%d"; } + template<> const char* Primitive<unsigned int>::default_format() { return "%08X"; } + template<> const char* Primitive<long>::default_format() { return "%ld"; } + template<> const char* Primitive<unsigned long>::default_format() { return "%016X"; } + template<> const char* Primitive<float>::default_format() { return "%f"; } + template<> const char* Primitive<double>::default_format() { return "%g"; } + template<> const char* Primitive<char*>::default_format() { return "%s"; } + template<> const char* Primitive<const char*>::default_format() { return "%s"; } + template<> const char* Primitive<std::string>::default_format() { return "%s"; } + + /// Generic function to convert to string + template <typename T> std::string Primitive<T>::toString(T value) { + char text[1024]; + ::snprintf(text,sizeof(text),default_format(),value); + return text; + } - /// Convert string to string - template <> std::string Primitive<const char*>::toString(const char* value) { - if ( value ) { - return value; + /// Convert string to string + template <> std::string Primitive<const char*>::toString(const char* value) { + if ( value ) { + return value; + } + throw std::runtime_error("Failed to convert (char*)NULL to std::string!"); } - throw std::runtime_error("Failed to convert (char*)NULL to std::string!"); - } - /// Convert string to string - template <> std::string Primitive<char*>::toString(char* value) { - if ( value ) { + /// Convert string to string + template <> std::string Primitive<char*>::toString(char* value) { + if ( value ) { + return value; + } + throw std::runtime_error("Failed to convert (char*)NULL to std::string!"); + } + /// Convert string to string + template <> std::string Primitive<std::string>::toString(std::string value) { return value; } - throw std::runtime_error("Failed to convert (char*)NULL to std::string!"); - } - /// Convert string to string - template <> std::string Primitive<std::string>::toString(std::string value) { - return value; - } - template std::string Primitive<bool>::toString(bool value); - template std::string Primitive<char>::toString(char value); - template std::string Primitive<unsigned char>::toString(unsigned char value); - template std::string Primitive<short>::toString(short value); - template std::string Primitive<unsigned short>::toString(unsigned short value); - template std::string Primitive<int>::toString(int value); - template std::string Primitive<unsigned int>::toString(unsigned int value); - template std::string Primitive<long>::toString(long value); - template std::string Primitive<unsigned long>::toString(unsigned long value); - template std::string Primitive<float>::toString(float value); - template std::string Primitive<double>::toString(double value); + template std::string Primitive<bool>::toString(bool value); + template std::string Primitive<char>::toString(char value); + template std::string Primitive<unsigned char>::toString(unsigned char value); + template std::string Primitive<short>::toString(short value); + template std::string Primitive<unsigned short>::toString(unsigned short value); + template std::string Primitive<int>::toString(int value); + template std::string Primitive<unsigned int>::toString(unsigned int value); + template std::string Primitive<long>::toString(long value); + template std::string Primitive<unsigned long>::toString(unsigned long value); + template std::string Primitive<float>::toString(float value); + template std::string Primitive<double>::toString(double value); + } } /// Initializing Constructor -DD4hep::ComponentCast::ComponentCast(const std::type_info& t, destroy_t d, cast_t c) +dd4hep::ComponentCast::ComponentCast(const std::type_info& t, destroy_t d, cast_t c) : type(t), destroy(d), cast(c) { #ifdef __APPLE__ abi_class = 0; @@ -422,7 +424,7 @@ DD4hep::ComponentCast::ComponentCast(const std::type_info& t, destroy_t d, cast_ } /// Defautl destructor -DD4hep::ComponentCast::~ComponentCast() { +dd4hep::ComponentCast::~ComponentCast() { } #if 0 @@ -452,7 +454,7 @@ static inline void* cast_wrap(const void* p, #endif /// Apply cast using typeinfo instead of dynamic_cast -void* DD4hep::ComponentCast::apply_dynCast(const ComponentCast& to, const void* ptr) const +void* dd4hep::ComponentCast::apply_dynCast(const ComponentCast& to, const void* ptr) const { if (&to == this) { return (void*) ptr; @@ -492,7 +494,7 @@ void* DD4hep::ComponentCast::apply_dynCast(const ComponentCast& to, const void* } /// Apply cast using typeinfo instead of dynamic_cast -void* DD4hep::ComponentCast::apply_upCast(const ComponentCast& to, const void* ptr) const +void* dd4hep::ComponentCast::apply_upCast(const ComponentCast& to, const void* ptr) const { if (&to == this) { return (void*) ptr; @@ -501,7 +503,7 @@ void* DD4hep::ComponentCast::apply_upCast(const ComponentCast& to, const void* p } /// Apply cast using typeinfo instead of dynamic_cast -void* DD4hep::ComponentCast::apply_downCast(const ComponentCast& to, const void* ptr) const +void* dd4hep::ComponentCast::apply_downCast(const ComponentCast& to, const void* ptr) const { if (&to == this) { return (void*) ptr; diff --git a/DDCore/src/Printout.cpp b/DDCore/src/Printout.cpp index 7ad0ab0d4..adb28c4c7 100644 --- a/DDCore/src/Printout.cpp +++ b/DDCore/src/Printout.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,33 +27,33 @@ using namespace std; namespace { - size_t _the_printer_1(void*, DD4hep::PrintLevel lvl, const char* src, const char* text); - size_t _the_printer_2(void* par, DD4hep::PrintLevel lvl, const char* src, const char* fmt, va_list& args); + size_t _the_printer_1(void*, dd4hep::PrintLevel lvl, const char* src, const char* text); + size_t _the_printer_2(void* par, dd4hep::PrintLevel lvl, const char* src, const char* fmt, va_list& args); std::string print_fmt = "%-16s %5s %s"; - DD4hep::PrintLevel print_lvl = DD4hep::INFO; + dd4hep::PrintLevel print_lvl = dd4hep::INFO; void* print_arg = 0; - DD4hep::output_function1_t print_func_1 = 0; - DD4hep::output_function2_t print_func_2 = _the_printer_2; + dd4hep::output_function1_t print_func_1 = 0; + dd4hep::output_function2_t print_func_2 = _the_printer_2; - const char* print_level(DD4hep::PrintLevel lvl) { + const char* print_level(dd4hep::PrintLevel lvl) { switch(lvl) { - case DD4hep::NOLOG: return "NOLOG"; - case DD4hep::VERBOSE: return "VERB "; - case DD4hep::DEBUG: return "DEBUG"; - case DD4hep::INFO: return "INFO "; - case DD4hep::WARNING: return "WARN "; - case DD4hep::ERROR: return "ERROR"; - case DD4hep::FATAL: return "FATAL"; - case DD4hep::ALWAYS: return " "; + case dd4hep::NOLOG: return "NOLOG"; + case dd4hep::VERBOSE: return "VERB "; + case dd4hep::DEBUG: return "DEBUG"; + case dd4hep::INFO: return "INFO "; + case dd4hep::WARNING: return "WARN "; + case dd4hep::ERROR: return "ERROR"; + case dd4hep::FATAL: return "FATAL"; + case dd4hep::ALWAYS: return " "; default: - if ( lvl> DD4hep::ALWAYS ) - return print_level(DD4hep::ALWAYS); - return print_level(DD4hep::NOLOG); + if ( lvl> dd4hep::ALWAYS ) + return print_level(dd4hep::ALWAYS); + return print_level(dd4hep::NOLOG); } } - size_t _the_printer_1(void*, DD4hep::PrintLevel lvl, const char* src, const char* text) { + size_t _the_printer_1(void*, dd4hep::PrintLevel lvl, const char* src, const char* text) { ::fflush(stdout); ::fflush(stderr); cout << flush; @@ -63,7 +63,7 @@ namespace { return len; } - size_t _the_printer_2(void* par, DD4hep::PrintLevel lvl, const char* src, const char* fmt, va_list& args) { + size_t _the_printer_2(void* par, dd4hep::PrintLevel lvl, const char* src, const char* fmt, va_list& args) { if ( !print_func_1 ) { char text[4096]; ::fflush(stdout); @@ -93,7 +93,7 @@ namespace { * \arg argv [char**,read-only] Argument strings * \return String containing the concatenated arguments */ -string DD4hep::arguments(int argc, char** argv) { +string dd4hep::arguments(int argc, char** argv) { stringstream str; for(int i=0; i<argc;) { str << argv[i]; @@ -108,7 +108,7 @@ string DD4hep::arguments(int argc, char** argv) { * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const char* src, const char* fmt, ...) { +int dd4hep::printout(PrintLevel severity, const char* src, const char* fmt, ...) { if (severity >= print_lvl) { va_list args; va_start(args, fmt); @@ -124,7 +124,7 @@ int DD4hep::printout(PrintLevel severity, const char* src, const char* fmt, ...) * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const string& src, const char* fmt, ...) { +int dd4hep::printout(PrintLevel severity, const string& src, const char* fmt, ...) { if (severity >= print_lvl) { va_list args; va_start(args, fmt); @@ -140,7 +140,7 @@ int DD4hep::printout(PrintLevel severity, const string& src, const char* fmt, .. * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const char* src, const string& fmt, ...) { +int dd4hep::printout(PrintLevel severity, const char* src, const string& fmt, ...) { if (severity >= print_lvl) { va_list args; va_start(args, &fmt); @@ -156,7 +156,7 @@ int DD4hep::printout(PrintLevel severity, const char* src, const string& fmt, .. * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const string& src, const string& fmt, ...) { +int dd4hep::printout(PrintLevel severity, const string& src, const string& fmt, ...) { if (severity >= print_lvl) { va_list args; va_start(args, &fmt); @@ -172,7 +172,7 @@ int DD4hep::printout(PrintLevel severity, const string& src, const string& fmt, * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const char* src, const char* fmt, va_list& args) { +int dd4hep::printout(PrintLevel severity, const char* src, const char* fmt, va_list& args) { if (severity >= print_lvl) { print_func_2(print_arg, severity,src,fmt,args); } @@ -185,7 +185,7 @@ int DD4hep::printout(PrintLevel severity, const char* src, const char* fmt, va_l * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const string& src, const char* fmt, va_list& args) { +int dd4hep::printout(PrintLevel severity, const string& src, const char* fmt, va_list& args) { return printout(severity, src.c_str(), fmt, args); } @@ -195,7 +195,7 @@ int DD4hep::printout(PrintLevel severity, const string& src, const char* fmt, va * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const char* src, const string& fmt, va_list& args) { +int dd4hep::printout(PrintLevel severity, const char* src, const string& fmt, va_list& args) { return printout(severity, src, fmt.c_str(), args); } @@ -205,7 +205,7 @@ int DD4hep::printout(PrintLevel severity, const char* src, const string& fmt, va * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const string& src, const string& fmt, va_list& args) { +int dd4hep::printout(PrintLevel severity, const string& src, const string& fmt, va_list& args) { return printout(severity, src.c_str(), fmt.c_str(), args); } @@ -214,7 +214,7 @@ int DD4hep::printout(PrintLevel severity, const string& src, const string& fmt, * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::except(const string& src, const string& fmt, ...) { +int dd4hep::except(const string& src, const string& fmt, ...) { va_list args; va_start(args, &fmt); return except(src.c_str(),fmt.c_str(), args); @@ -225,7 +225,7 @@ int DD4hep::except(const string& src, const string& fmt, ...) { * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::except(const char* src, const char* fmt, ...) { +int dd4hep::except(const char* src, const char* fmt, ...) { va_list args; va_start(args, fmt); return except(src, fmt, args); @@ -237,7 +237,7 @@ int DD4hep::except(const char* src, const char* fmt, ...) { * \arg args [ap_list,read-only] List with variable number of arguments to fill format string. * \return Status code indicating success or failure */ -int DD4hep::except(const string& src, const string& fmt, va_list& args) { +int dd4hep::except(const string& src, const string& fmt, va_list& args) { string msg = __format(fmt.c_str(), args); va_end(args); printout(ERROR, src.c_str(), "%s", msg.c_str()); @@ -251,7 +251,7 @@ int DD4hep::except(const string& src, const string& fmt, va_list& args) { * \arg args [ap_list,read-only] List with variable number of arguments to fill format string. * \return Status code indicating success or failure */ -int DD4hep::except(const char* src, const char* fmt, va_list& args) { +int dd4hep::except(const char* src, const char* fmt, va_list& args) { string msg = __format(fmt, args); va_end(args); printout(ERROR, src, "%s", msg.c_str()); @@ -264,7 +264,7 @@ int DD4hep::except(const char* src, const char* fmt, va_list& args) { * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -string DD4hep::format(const string& src, const string& fmt, ...) { +string dd4hep::format(const string& src, const string& fmt, ...) { va_list args; va_start(args, &fmt); string str = format(src, fmt, args); @@ -277,7 +277,7 @@ string DD4hep::format(const string& src, const string& fmt, ...) { * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -string DD4hep::format(const char* src, const char* fmt, ...) { +string dd4hep::format(const char* src, const char* fmt, ...) { va_list args; va_start(args, fmt); string str = format(src, fmt, args); @@ -291,7 +291,7 @@ string DD4hep::format(const char* src, const char* fmt, ...) { * \arg args [ap_list,read-only] List with variable number of arguments to fill format string. * \return Status code indicating success or failure */ -string DD4hep::format(const string& src, const string& fmt, va_list& args) { +string dd4hep::format(const string& src, const string& fmt, va_list& args) { return format(src.c_str(), fmt.c_str(), args); } @@ -301,7 +301,7 @@ string DD4hep::format(const string& src, const string& fmt, va_list& args) { * \arg args [ap_list,read-only] List with variable number of arguments to fill format string. * \return Status code indicating success or failure */ -string DD4hep::format(const char* src, const char* fmt, va_list& args) { +string dd4hep::format(const char* src, const char* fmt, va_list& args) { char str[4096]; size_t len1 = ::snprintf(str, sizeof(str), "%s: ", src); size_t len2 = ::vsnprintf(str + len1, sizeof(str) - len1, fmt, args); @@ -313,67 +313,67 @@ string DD4hep::format(const char* src, const char* fmt, va_list& args) { } /// Set new print level. Returns the old print level -DD4hep::PrintLevel DD4hep::setPrintLevel(PrintLevel new_level) { +dd4hep::PrintLevel dd4hep::setPrintLevel(PrintLevel new_level) { PrintLevel old = print_lvl; print_lvl = new_level; return old; } /// Access the current printer level -DD4hep::PrintLevel DD4hep::printLevel() { +dd4hep::PrintLevel dd4hep::printLevel() { return print_lvl; } /// Translate the printer level from string to value -DD4hep::PrintLevel DD4hep::printLevel(const char* value) { +dd4hep::PrintLevel dd4hep::printLevel(const char* value) { if ( !value ) except("Printout","Invalid printlevel requested [EINVAL: Null-pointer argument]"); // Explicit values - if ( strcmp(value,"NOLOG") == 0 ) return DD4hep::NOLOG; - if ( strcmp(value,"VERBOSE") == 0 ) return DD4hep::VERBOSE; - if ( strcmp(value,"DEBUG") == 0 ) return DD4hep::DEBUG; - if ( strcmp(value,"INFO") == 0 ) return DD4hep::INFO; - if ( strcmp(value,"WARNING") == 0 ) return DD4hep::WARNING; - if ( strcmp(value,"ERROR") == 0 ) return DD4hep::ERROR; - if ( strcmp(value,"FATAL") == 0 ) return DD4hep::FATAL; - if ( strcmp(value,"ALWAYS") == 0 ) return DD4hep::ALWAYS; + if ( strcmp(value,"NOLOG") == 0 ) return dd4hep::NOLOG; + if ( strcmp(value,"VERBOSE") == 0 ) return dd4hep::VERBOSE; + if ( strcmp(value,"DEBUG") == 0 ) return dd4hep::DEBUG; + if ( strcmp(value,"INFO") == 0 ) return dd4hep::INFO; + if ( strcmp(value,"WARNING") == 0 ) return dd4hep::WARNING; + if ( strcmp(value,"ERROR") == 0 ) return dd4hep::ERROR; + if ( strcmp(value,"FATAL") == 0 ) return dd4hep::FATAL; + if ( strcmp(value,"ALWAYS") == 0 ) return dd4hep::ALWAYS; // Numeric values - if ( strcmp(value,"0") == 0 ) return DD4hep::NOLOG; - if ( strcmp(value,"1") == 0 ) return DD4hep::VERBOSE; - if ( strcmp(value,"2") == 0 ) return DD4hep::DEBUG; - if ( strcmp(value,"3") == 0 ) return DD4hep::INFO; - if ( strcmp(value,"4") == 0 ) return DD4hep::WARNING; - if ( strcmp(value,"5") == 0 ) return DD4hep::ERROR; - if ( strcmp(value,"6") == 0 ) return DD4hep::FATAL; - if ( strcmp(value,"7") == 0 ) return DD4hep::ALWAYS; + if ( strcmp(value,"0") == 0 ) return dd4hep::NOLOG; + if ( strcmp(value,"1") == 0 ) return dd4hep::VERBOSE; + if ( strcmp(value,"2") == 0 ) return dd4hep::DEBUG; + if ( strcmp(value,"3") == 0 ) return dd4hep::INFO; + if ( strcmp(value,"4") == 0 ) return dd4hep::WARNING; + if ( strcmp(value,"5") == 0 ) return dd4hep::ERROR; + if ( strcmp(value,"6") == 0 ) return dd4hep::FATAL; + if ( strcmp(value,"7") == 0 ) return dd4hep::ALWAYS; except("Printout","Unknown printlevel requested:%s",value); - return DD4hep::ALWAYS; + return dd4hep::ALWAYS; } /// Translate the printer level from string to value -DD4hep::PrintLevel DD4hep::printLevel(const std::string& value) { +dd4hep::PrintLevel dd4hep::printLevel(const std::string& value) { return printLevel(value.c_str()); } /// Check if this print level would result in some output -bool DD4hep::isActivePrintLevel(int severity) { +bool dd4hep::isActivePrintLevel(int severity) { return severity >= print_lvl; } /// Set new printout format for the 3 fields: source-level-message. All 3 are strings -string DD4hep::setPrintFormat(const string& new_format) { +string dd4hep::setPrintFormat(const string& new_format) { string old = print_fmt; print_fmt = new_format; return old; } /// Customize printer function -void DD4hep::setPrinter(void* arg, output_function1_t fcn) { +void dd4hep::setPrinter(void* arg, output_function1_t fcn) { print_arg = arg; print_func_1 = fcn ? fcn : _the_printer_1; } /// Customize printer function -void DD4hep::setPrinter2(void* arg, output_function2_t fcn) { +void dd4hep::setPrinter2(void* arg, output_function2_t fcn) { print_arg = arg; print_func_2 = fcn ? fcn : _the_printer_2; } diff --git a/DDCore/src/Readout.cpp b/DDCore/src/Readout.cpp index 881b20c7c..b5a0506a4 100644 --- a/DDCore/src/Readout.cpp +++ b/DDCore/src/Readout.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,11 +18,11 @@ #include "DD4hep/detail/Handle.inl" #include "DD4hep/InstanceCount.h" #include "DD4hep/DD4hepUnits.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; /// Copy constructor HitCollection::HitCollection(const HitCollection& c) @@ -58,7 +58,7 @@ size_t Readout::numCollections() const { Object& ro = object<Object>(); return ro.hits.size(); } - throw runtime_error("DD4hep: Readout::numCollections: Cannot access object data [Invalid Handle]"); + throw runtime_error("dd4hep: Readout::numCollections: Cannot access object data [Invalid Handle]"); } /// Access names of hit collections @@ -72,7 +72,7 @@ vector<string> Readout::collectionNames() const { } return colls; } - throw runtime_error("DD4hep: Readout::collectionsNames: Cannot access object data [Invalid Handle]"); + throw runtime_error("dd4hep: Readout::collectionsNames: Cannot access object data [Invalid Handle]"); } /// Access hit collections @@ -86,7 +86,7 @@ vector<const HitCollection*> Readout::collections() const { } return colls; } - throw runtime_error("DD4hep: Readout::collections: Cannot access object data [Invalid Handle]"); + throw runtime_error("dd4hep: Readout::collections: Cannot access object data [Invalid Handle]"); } /// Assign IDDescription to readout structure @@ -102,7 +102,7 @@ void Readout::setIDDescriptor(const Ref_t& new_descriptor) const { return; } } - throw runtime_error("DD4hep: Readout::setIDDescriptor: Cannot assign ID descriptor [Invalid Handle]"); + throw runtime_error("dd4hep: Readout::setIDDescriptor: Cannot assign ID descriptor [Invalid Handle]"); } /// Access IDDescription structure @@ -123,7 +123,7 @@ void Readout::setSegmentation(const Segmentation& seg) const { return; } } - throw runtime_error("DD4hep: Readout::setSegmentation: Cannot assign segmentation [Invalid Handle]"); + throw runtime_error("dd4hep: Readout::setSegmentation: Cannot assign segmentation [Invalid Handle]"); } /// Access segmentation structure diff --git a/DDCore/src/Segmentations.cpp b/DDCore/src/Segmentations.cpp index 0df7ca996..c100a1e94 100644 --- a/DDCore/src/Segmentations.cpp +++ b/DDCore/src/Segmentations.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,8 +24,8 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; DD4HEP_INSTANTIATE_HANDLE_UNNAMED(SegmentationObject); @@ -53,12 +53,12 @@ bool Segmentation::useForHitPosition() const { } /// Access to the parameters -Segmentation::Parameters Segmentation::parameters() const { +DDSegmentation::Parameters Segmentation::parameters() const { return data<Object>()->parameters(); } /// Access to parameter by name -Segmentation::Parameter Segmentation::parameter(const std::string& parameterName) const { +DDSegmentation::Parameter Segmentation::parameter(const std::string& parameterName) const { return data<Object>()->parameter(parameterName); } @@ -93,12 +93,12 @@ std::vector<double> Segmentation::cellDimensions(const CellID& cell) const { } /// Access to the base DDSegmentation object. WARNING: Deprecated call! -Segmentation::BaseSegmentation* Segmentation::segmentation() const { +DDSegmentation::Segmentation* Segmentation::segmentation() const { return data<Object>()->segmentation; } /// Access the underlying decoder -BitField64* Segmentation::decoder() const { +const BitField64* Segmentation::decoder() const { return data<Object>()->segmentation->decoder(); } diff --git a/DDCore/src/SegmentationsInterna.cpp b/DDCore/src/SegmentationsInterna.cpp index 860b20386..e793fdeb1 100644 --- a/DDCore/src/SegmentationsInterna.cpp +++ b/DDCore/src/SegmentationsInterna.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,17 +15,11 @@ #include "DD4hep/detail/SegmentationsInterna.h" #include "DD4hep/InstanceCount.h" -// C/C++ include files - using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; -using DD4hep::DDSegmentation::Parameter; -using DD4hep::DDSegmentation::Parameters; - +using namespace dd4hep; /// Standard constructor -SegmentationObject::SegmentationObject(BaseSegmentation* s) +SegmentationObject::SegmentationObject(DDSegmentation::Segmentation* s) : magic(magic_word()), useForHitPosition(0), detector(0), sensitive(0), segmentation(s) { @@ -65,7 +59,7 @@ const string& SegmentationObject::description() const { } /// Access the underlying decoder -BitField64* SegmentationObject::decoder() const { +const BitField64* SegmentationObject::decoder() const { return segmentation->decoder(); } @@ -75,17 +69,17 @@ void SegmentationObject::setDecoder(BitField64* ptr_decoder) const { } /// Access to parameter by name -Parameter SegmentationObject::parameter(const string& parameterName) const { +DDSegmentation::Parameter SegmentationObject::parameter(const string& parameterName) const { return segmentation->parameter(parameterName); } /// Access to all parameters -Parameters SegmentationObject::parameters() const { +DDSegmentation::Parameters SegmentationObject::parameters() const { return segmentation->parameters(); } /// Set all parameters from an existing set of parameters -void SegmentationObject::setParameters(const Parameters& params) { +void SegmentationObject::setParameters(const DDSegmentation::Parameters& params) { segmentation->setParameters(params); } diff --git a/DDCore/src/Shapes.cpp b/DDCore/src/Shapes.cpp index 67a588812..55cde6a77 100644 --- a/DDCore/src/Shapes.cpp +++ b/DDCore/src/Shapes.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define _USE_MATH_DEFINES // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/MatrixHelpers.h" #include "DD4hep/DD4hepUnits.h" @@ -42,10 +42,11 @@ #include "TGeoCompositeShape.h" using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; +namespace units = dd4hep; /// Pretty print of solid attributes -std::string DD4hep::Geometry::toStringSolid(const TGeoShape* shape, int precision) { +std::string dd4hep::toStringSolid(const TGeoShape* shape, int precision) { stringstream log; if ( !shape ) { @@ -58,87 +59,87 @@ std::string DD4hep::Geometry::toStringSolid(const TGeoShape* shape, int precisio log << setprecision(precision); log << cl->GetName(); if ( cl == TGeoBBox::Class() ) { - TGeoBBox* s = (TGeoBBox*) shape; - log << " x:" << s->GetDX() - << " y:" << s->GetDY() - << " z:" << s->GetDZ(); + TGeoBBox* sh = (TGeoBBox*) shape; + log << " x:" << sh->GetDX() + << " y:" << sh->GetDY() + << " z:" << sh->GetDZ(); } else if (cl == TGeoHalfSpace::Class()) { - TGeoHalfSpace* s = (TGeoHalfSpace*)(const_cast<TGeoShape*>(shape)); - log << " Point: (" << s->GetPoint()[0] << ", " << s->GetPoint()[1] << ", " << s->GetPoint()[2] << ") " - << " Normal: (" << s->GetNorm()[0] << ", " << s->GetNorm()[1] << ", " << s->GetNorm()[2] << ") "; + TGeoHalfSpace* sh = (TGeoHalfSpace*)(const_cast<TGeoShape*>(shape)); + log << " Point: (" << sh->GetPoint()[0] << ", " << sh->GetPoint()[1] << ", " << sh->GetPoint()[2] << ") " + << " Normal: (" << sh->GetNorm()[0] << ", " << sh->GetNorm()[1] << ", " << sh->GetNorm()[2] << ") "; } else if (cl == TGeoTube::Class()) { - const TGeoTube* s = (const TGeoTube*) shape; - log << " rmin:" << s->GetRmin() << " rmax:" << s->GetRmax() << " dz:" << s->GetDz(); + const TGeoTube* sh = (const TGeoTube*) shape; + log << " rmin:" << sh->GetRmin() << " rmax:" << sh->GetRmax() << " dz:" << sh->GetDz(); } else if (cl == TGeoTubeSeg::Class()) { - const TGeoTubeSeg* s = (const TGeoTubeSeg*) shape; - log << " rmin:" << s->GetRmin() << " rmax:" << s->GetRmax() << " dz:" << s->GetDz() - << " Phi1:" << s->GetPhi1() << " Phi2:" << s->GetPhi2(); + const TGeoTubeSeg* sh = (const TGeoTubeSeg*) shape; + log << " rmin:" << sh->GetRmin() << " rmax:" << sh->GetRmax() << " dz:" << sh->GetDz() + << " Phi1:" << sh->GetPhi1() << " Phi2:" << sh->GetPhi2(); } else if (cl == TGeoTrd1::Class()) { - const TGeoTrd1* s = (const TGeoTrd1*) shape; - log << " x1:" << s->GetDx1() << " x2:" << s->GetDx2() << " y:" << s->GetDy() << " z:" << s->GetDz(); + const TGeoTrd1* sh = (const TGeoTrd1*) shape; + log << " x1:" << sh->GetDx1() << " x2:" << sh->GetDx2() << " y:" << sh->GetDy() << " z:" << sh->GetDz(); } else if (cl == TGeoTrd2::Class()) { - const TGeoTrd2* s = (const TGeoTrd2*) shape; - log << " x1:" << s->GetDx1() << " x2:" << s->GetDx2() - << " y1:" << s->GetDy1() << " y2:" << s->GetDy2() << " z:" << s->GetDz(); + const TGeoTrd2* sh = (const TGeoTrd2*) shape; + log << " x1:" << sh->GetDx1() << " x2:" << sh->GetDx2() + << " y1:" << sh->GetDy1() << " y2:" << sh->GetDy2() << " z:" << sh->GetDz(); } else if (cl == TGeoHype::Class()) { - const TGeoHype* s = (const TGeoHype*) shape; - log << " rmin:" << s->GetRmin() << " rmax:" << s->GetRmax() << " dz:" << s->GetDz() - << " StIn:" << s->GetStIn() << " StOut:" << s->GetStOut(); + const TGeoHype* sh = (const TGeoHype*) shape; + log << " rmin:" << sh->GetRmin() << " rmax:" << sh->GetRmax() << " dz:" << sh->GetDz() + << " StIn:" << sh->GetStIn() << " StOut:" << sh->GetStOut(); } else if (cl == TGeoPgon::Class()) { - const TGeoPgon* s = (const TGeoPgon*) shape; - log << " Phi1:" << s->GetPhi1() << " dPhi:" << s->GetDphi() - << " NEdges:" << s->GetNedges() << " Nz:" << s->GetNz(); - for(int i=0, n=s->GetNz(); i<n; ++i) { - log << " i=" << i << " z:" << s->GetZ(i) - << " r:[" << s->GetRmin(i) << "," << s->GetRmax(i) << "]"; + const TGeoPgon* sh = (const TGeoPgon*) shape; + log << " Phi1:" << sh->GetPhi1() << " dPhi:" << sh->GetDphi() + << " NEdges:" << sh->GetNedges() << " Nz:" << sh->GetNz(); + for(int i=0, n=sh->GetNz(); i<n; ++i) { + log << " i=" << i << " z:" << sh->GetZ(i) + << " r:[" << sh->GetRmin(i) << "," << sh->GetRmax(i) << "]"; } } else if (cl == TGeoPcon::Class()) { - const TGeoPcon* s = (const TGeoPcon*) shape; - log << " Phi1:" << s->GetPhi1() << " dPhi:" << s->GetDphi() << " Nz:" << s->GetNz(); - for(int i=0, n=s->GetNz(); i<n; ++i) { - log << " i=" << i << " z:" << s->GetZ(i) - << " r:[" << s->GetRmin(i) << "," << s->GetRmax(i) << "]"; + const TGeoPcon* sh = (const TGeoPcon*) shape; + log << " Phi1:" << sh->GetPhi1() << " dPhi:" << sh->GetDphi() << " Nz:" << sh->GetNz(); + for(int i=0, n=sh->GetNz(); i<n; ++i) { + log << " i=" << i << " z:" << sh->GetZ(i) + << " r:[" << sh->GetRmin(i) << "," << sh->GetRmax(i) << "]"; } } else if (cl == TGeoConeSeg::Class()) { - const TGeoConeSeg* s = (const TGeoConeSeg*) shape; - log << " rmin1:" << s->GetRmin1() << " rmax1:" << s->GetRmax1() - << " rmin2:" << s->GetRmin2() << " rmax2:" << s->GetRmax2() - << " dz:" << s->GetDz() - << " Phi1:" << s->GetPhi1() << " Phi2:" << s->GetPhi2(); + const TGeoConeSeg* sh = (const TGeoConeSeg*) shape; + log << " rmin1:" << sh->GetRmin1() << " rmax1:" << sh->GetRmax1() + << " rmin2:" << sh->GetRmin2() << " rmax2:" << sh->GetRmax2() + << " dz:" << sh->GetDz() + << " Phi1:" << sh->GetPhi1() << " Phi2:" << sh->GetPhi2(); } else if (cl == TGeoParaboloid::Class()) { - const TGeoParaboloid* s = (const TGeoParaboloid*) shape; - log << " dz:" << s->GetDz() << " RLo:" << s->GetRlo() << " Rhi:" << s->GetRhi(); + const TGeoParaboloid* sh = (const TGeoParaboloid*) shape; + log << " dz:" << sh->GetDz() << " RLo:" << sh->GetRlo() << " Rhi:" << sh->GetRhi(); } else if (cl == TGeoSphere::Class()) { - const TGeoSphere* s = (const TGeoSphere*) shape; - log << " rmin:" << s->GetRmin() << " rmax:" << s->GetRmax() - << " Phi1:" << s->GetPhi1() << " Phi2:" << s->GetPhi2() - << " Theta1:" << s->GetTheta1() << " Theta2:" << s->GetTheta2(); + const TGeoSphere* sh = (const TGeoSphere*) shape; + log << " rmin:" << sh->GetRmin() << " rmax:" << sh->GetRmax() + << " Phi1:" << sh->GetPhi1() << " Phi2:" << sh->GetPhi2() + << " Theta1:" << sh->GetTheta1() << " Theta2:" << sh->GetTheta2(); } else if (cl == TGeoTorus::Class()) { - const TGeoTorus* s = (const TGeoTorus*) shape; - log << " rmin:" << s->GetRmin() << " rmax:" << s->GetRmax() << " r:" << s->GetR() - << " Phi1:" << s->GetPhi1() << " dPhi:" << s->GetDphi(); + const TGeoTorus* sh = (const TGeoTorus*) shape; + log << " rmin:" << sh->GetRmin() << " rmax:" << sh->GetRmax() << " r:" << sh->GetR() + << " Phi1:" << sh->GetPhi1() << " dPhi:" << sh->GetDphi(); } else if (cl == TGeoTrap::Class()) { - const TGeoTrap* s = (const TGeoTrap*) shape; - log << " dz:" << s->GetDz() << " Theta:" << s->GetTheta() << " Phi:" << s->GetPhi() - << " H1:" << s->GetH1() << " Bl1:" << s->GetBl1() << " Tl1:" << s->GetTl1() << " Alpha1:" << s->GetAlpha1() - << " H2:" << s->GetH2() << " Bl2:" << s->GetBl2() << " Tl2:" << s->GetTl2() << " Alpha2:" << s->GetAlpha2(); + const TGeoTrap* sh = (const TGeoTrap*) shape; + log << " dz:" << sh->GetDz() << " Theta:" << sh->GetTheta() << " Phi:" << sh->GetPhi() + << " H1:" << sh->GetH1() << " Bl1:" << sh->GetBl1() << " Tl1:" << sh->GetTl1() << " Alpha1:" << sh->GetAlpha1() + << " H2:" << sh->GetH2() << " Bl2:" << sh->GetBl2() << " Tl2:" << sh->GetTl2() << " Alpha2:" << sh->GetAlpha2(); } else if (shape->IsA() == TGeoCompositeShape::Class()) { - const TGeoCompositeShape* s = (const TGeoCompositeShape*) shape; - const TGeoBoolNode* boolean = s->GetBoolNode(); + const TGeoCompositeShape* sh = (const TGeoCompositeShape*) shape; + const TGeoBoolNode* boolean = sh->GetBoolNode(); const TGeoShape* left = boolean->GetLeftShape(); const TGeoShape* right = boolean->GetRightShape(); TGeoBoolNode::EGeoBoolType oper = boolean->GetBooleanOperator(); @@ -206,14 +207,14 @@ double Box::z() const { return this->ptr()->GetDZ(); } -/// Internal helper method to support object construction +/// detaill helper method to support object construction void HalfSpace::make(const double* const point, const double* const normal) { _assign(new TGeoHalfSpace("",(Double_t*)point, (Double_t*)normal), "", "halfspace",true); } /// Constructor to be used when creating a new object Polycone::Polycone(double start, double delta) { - _assign(new TGeoPcon(start/dd4hep::deg, delta/dd4hep::deg, 0), "", "polycone", false); + _assign(new TGeoPcon(start/units::deg, delta/units::deg, 0), "", "polycone", false); } /// Constructor to be used when creating a new polycone object. Add at the same time all Z planes @@ -221,10 +222,10 @@ Polycone::Polycone(double start, double delta, const vector<double>& rmin, const const vector<double>& z) { vector<double> params; if (rmin.size() < 2) { - throw runtime_error("DD4hep: PolyCone::addZPlanes> Not enough Z planes. minimum is 2!"); + throw runtime_error("dd4hep: PolyCone::addZPlanes> Not enough Z planes. minimum is 2!"); } - params.push_back(start/dd4hep::deg); - params.push_back(delta/dd4hep::deg); + params.push_back(start/units::deg); + params.push_back(delta/units::deg); params.push_back(rmin.size()); for (size_t i = 0; i < rmin.size(); ++i) { params.push_back(z[i] ); @@ -236,19 +237,19 @@ Polycone::Polycone(double start, double delta, const vector<double>& rmin, const /// Add Z-planes to the Polycone void Polycone::addZPlanes(const vector<double>& rmin, const vector<double>& rmax, const vector<double>& z) { - TGeoPcon* s = *this; + TGeoPcon* sh = *this; vector<double> params; - size_t num = s->GetNz(); + size_t num = sh->GetNz(); if (rmin.size() < 2) { - throw runtime_error("DD4hep: PolyCone::addZPlanes> Not enough Z planes. minimum is 2!"); + throw runtime_error("dd4hep: PolyCone::addZPlanes> Not enough Z planes. minimum is 2!"); } - params.push_back(s->GetPhi1()); - params.push_back(s->GetDphi()); + params.push_back(sh->GetPhi1()); + params.push_back(sh->GetDphi()); params.push_back(num + rmin.size()); for (size_t i = 0; i < num; ++i) { - params.push_back(s->GetZ(i)); - params.push_back(s->GetRmin(i)); - params.push_back(s->GetRmax(i)); + params.push_back(sh->GetZ(i)); + params.push_back(sh->GetRmin(i)); + params.push_back(sh->GetRmax(i)); } for (size_t i = 0; i < rmin.size(); ++i) { params.push_back(z[i] ); @@ -263,7 +264,7 @@ ConeSegment::ConeSegment(double dz, double rmin1, double rmax1, double rmin2, double rmax2, double phi1, double phi2) { - _assign(new TGeoConeSeg(dz, rmin1, rmax1, rmin2, rmax2, phi1/dd4hep::deg, phi2/dd4hep::deg), "", "cone_segment", true); + _assign(new TGeoConeSeg(dz, rmin1, rmax1, rmin2, rmax2, phi1/units::deg, phi2/units::deg), "", "cone_segment", true); } /// Set the cone segment dimensions @@ -271,14 +272,14 @@ ConeSegment& ConeSegment::setDimensions(double dz, double rmin1, double rmax1, double rmin2, double rmax2, double phi1, double phi2) { - double params[] = { dz, rmin1, rmax1, rmin2, rmax2, phi1/dd4hep::deg, phi2/dd4hep::deg }; + double params[] = { dz, rmin1, rmax1, rmin2, rmax2, phi1/units::deg, phi2/units::deg }; _setDimensions(params); return *this; } /// Constructor to be used when creating a new object with attribute initialization void Tube::make(const string& nam, double rmin, double rmax, double z, double startPhi, double deltaPhi) { - //_assign(new TGeoTubeSeg(rmin,rmax,z,startPhi/dd4hep::deg,deltaPhi/dd4hep::deg),name,"tube",true); + //_assign(new TGeoTubeSeg(rmin,rmax,z,startPhi/units::deg,deltaPhi/units::deg),name,"tube",true); _assign(new MyConeSeg(), nam, "tube", true); setDimensions(rmin, rmax, z, startPhi, deltaPhi); } @@ -286,7 +287,7 @@ void Tube::make(const string& nam, double rmin, double rmax, double z, double st /// Set the tube dimensions Tube& Tube::setDimensions(double rmin, double rmax, double z, double startPhi, double deltaPhi) { //double params[] = {rmin,rmax,z,startPhi,deltaPhi}; - double params[] = { z, rmin, rmax, rmin, rmax, startPhi/dd4hep::deg,deltaPhi/dd4hep::deg }; + double params[] = { z, rmin, rmax, rmin, rmax, startPhi/units::deg,deltaPhi/units::deg }; _setDimensions(params); return *this; } @@ -346,36 +347,36 @@ Paraboloid& Paraboloid::setDimensions(double r_low, double r_high, double delta_ /// Constructor to create a new anonymous object with attribute initialization Hyperboloid::Hyperboloid(double rin, double stin, double rout, double stout, double dz) { - _assign(new TGeoHype(rin, stin/dd4hep::deg, rout, stout/dd4hep::deg, dz), "", "hyperboloid", true); + _assign(new TGeoHype(rin, stin/units::deg, rout, stout/units::deg, dz), "", "hyperboloid", true); } /// Set the Hyperboloid dimensions Hyperboloid& Hyperboloid::setDimensions(double rin, double stin, double rout, double stout, double dz) { - double params[] = { rin, stin/dd4hep::deg, rout, stout/dd4hep::deg, dz}; + double params[] = { rin, stin/units::deg, rout, stout/units::deg, dz}; _setDimensions(params); return *this; } /// Constructor to be used when creating a new object with attribute initialization Sphere::Sphere(double rmin, double rmax, double theta, double delta_theta, double phi, double delta_phi) { - _assign(new TGeoSphere(rmin, rmax, theta/dd4hep::deg, delta_theta/dd4hep::deg, phi/dd4hep::deg, delta_phi/dd4hep::deg), "", "sphere", true); + _assign(new TGeoSphere(rmin, rmax, theta/units::deg, delta_theta/units::deg, phi/units::deg, delta_phi/units::deg), "", "sphere", true); } /// Set the Sphere dimensions Sphere& Sphere::setDimensions(double rmin, double rmax, double theta, double delta_theta, double phi, double delta_phi) { - double params[] = { rmin, rmax, theta, delta_theta/dd4hep::deg, phi/dd4hep::deg, delta_phi/dd4hep::deg }; + double params[] = { rmin, rmax, theta, delta_theta/units::deg, phi/units::deg, delta_phi/units::deg }; _setDimensions(params); return *this; } /// Constructor to be used when creating a new object with attribute initialization void Torus::make(double r, double rmin, double rmax, double phi, double delta_phi) { - _assign(new TGeoTorus(r, rmin, rmax, phi/dd4hep::deg, delta_phi/dd4hep::deg), "", "torus", true); + _assign(new TGeoTorus(r, rmin, rmax, phi/units::deg, delta_phi/units::deg), "", "torus", true); } /// Set the Torus dimensions Torus& Torus::setDimensions(double r, double rmin, double rmax, double phi, double delta_phi) { - double params[] = { r, rmin, rmax, phi/dd4hep::deg, delta_phi/dd4hep::deg }; + double params[] = { r, rmin, rmax, phi/units::deg, delta_phi/units::deg }; _setDimensions(params); return *this; } @@ -383,7 +384,7 @@ Torus& Torus::setDimensions(double r, double rmin, double rmax, double phi, doub /// Constructor to be used when creating a new anonymous object with attribute initialization Trap::Trap(double z, double theta, double phi, double y1, double x1, double x2, double alpha1, double y2, double x3, double x4, double alpha2) { - _assign(new TGeoTrap(z, theta, phi, y1, x1, x2, alpha1/dd4hep::deg, y2, x3, x4, alpha2/dd4hep::deg), "", "trap", true); + _assign(new TGeoTrap(z, theta, phi, y1, x1, x2, alpha1/units::deg, y2, x3, x4, alpha2/units::deg), "", "trap", true); } /// Constructor to be used when creating a new anonymous object with attribute initialization @@ -395,13 +396,13 @@ void Trap::make(double pz, double py, double px, double pLTX) { double x1 = px / 2e0; double x2 = pLTX / 2e0; double alpha1 = (pLTX - px) / py; - _assign(new TGeoTrap(z, theta, phi, y1, x1, x2, alpha1/dd4hep::deg, y1, x1, x2, alpha1/dd4hep::deg), "", "trap", true); + _assign(new TGeoTrap(z, theta, phi, y1, x1, x2, alpha1/units::deg, y1, x1, x2, alpha1/units::deg), "", "trap", true); } /// Set the trap dimensions Trap& Trap::setDimensions(double z, double theta, double phi, double y1, double x1, double x2, double alpha1, double y2, double x3, double x4, double alpha2) { - double params[] = { z, theta, phi, y1, x1, x2, alpha1/dd4hep::deg, y2, x3, x4, alpha2/dd4hep::deg }; + double params[] = { z, theta, phi, y1, x1, x2, alpha1/units::deg, y2, x3, x4, alpha2/units::deg }; _setDimensions(params); return *this; } @@ -409,9 +410,9 @@ Trap& Trap::setDimensions(double z, double theta, double phi, double y1, double /// Helper function to create holy hedron void PolyhedraRegular::_create(int nsides, double rmin, double rmax, double zpos, double zneg, double start, double delta) { if (rmin < 0e0 || rmin > rmax) - throw runtime_error("DD4hep: PolyhedraRegular: Illegal argument rmin:<" + _toString(rmin) + "> is invalid!"); + throw runtime_error("dd4hep: PolyhedraRegular: Illegal argument rmin:<" + _toString(rmin) + "> is invalid!"); else if (rmax < 0e0) - throw runtime_error("DD4hep: PolyhedraRegular: Illegal argument rmax:<" + _toString(rmax) + "> is invalid!"); + throw runtime_error("dd4hep: PolyhedraRegular: Illegal argument rmax:<" + _toString(rmax) + "> is invalid!"); _assign(new TGeoPgon(), "", "polyhedra", false); double params[] = { start, delta, double(nsides), 2e0, zpos, rmin, rmax, zneg, rmin, rmax }; _setDimensions(¶ms[0]); @@ -424,7 +425,7 @@ PolyhedraRegular::PolyhedraRegular(int nsides, double rmin, double rmax, double /// Constructor to be used when creating a new object PolyhedraRegular::PolyhedraRegular(int nsides, double phistart, double rmin, double rmax, double zlen) { - _create(nsides, rmin, rmax, zlen / 2, -zlen / 2, phistart/dd4hep::deg, 360.); + _create(nsides, rmin, rmax, zlen / 2, -zlen / 2, phistart/units::deg, 360.); } /// Constructor to be used when creating a new object @@ -439,95 +440,95 @@ void EightPointSolid::make(double dz, const double* vtx) { /// Constructor to be used when creating a new object. Position is identity, Rotation is the identity rotation SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2) { - TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, identityTransform(), identityTransform()); + TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, Matrices::_identity(), Matrices::_identity()); _assign(new TGeoCompositeShape("", sub), "", "subtraction", true); } /// Constructor to be used when creating a new object. Placement by a generic transformation within the mother SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& trans) { - TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, identityTransform(), _transform(trans)); + TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, Matrices::_identity(), Matrices::_transform(trans)); _assign(new TGeoCompositeShape("", sub), "", "subtraction", true); } /// Constructor to be used when creating a new object. Rotation is the identity rotation SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const Position& pos) { - TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, identityTransform(), _translation(pos)); + TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, Matrices::_identity(), Matrices::_translation(pos)); _assign(new TGeoCompositeShape("", sub), "", "subtraction", true); } /// Constructor to be used when creating a new object SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot) { - TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, identityTransform(), _rotationZYX(rot)); + TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, Matrices::_identity(), Matrices::_rotationZYX(rot)); _assign(new TGeoCompositeShape("", sub), "", "subtraction", true); } /// Constructor to be used when creating a new object SubtractionSolid::SubtractionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot) { - TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, identityTransform(), _rotation3D(rot)); + TGeoSubtraction* sub = new TGeoSubtraction(shape1, shape2, Matrices::_identity(), Matrices::_rotation3D(rot)); _assign(new TGeoCompositeShape("", sub), "", "subtraction", true); } /// Constructor to be used when creating a new object. Position is identity, Rotation is identity rotation UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2) { - TGeoUnion* uni = new TGeoUnion(shape1, shape2, identityTransform(), identityTransform()); + TGeoUnion* uni = new TGeoUnion(shape1, shape2, Matrices::_identity(), Matrices::_identity()); _assign(new TGeoCompositeShape("", uni), "", "union", true); } /// Constructor to be used when creating a new object. Placement by a generic transformation within the mother UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& trans) { - TGeoUnion* uni = new TGeoUnion(shape1, shape2, identityTransform(), _transform(trans)); + TGeoUnion* uni = new TGeoUnion(shape1, shape2, Matrices::_identity(), Matrices::_transform(trans)); _assign(new TGeoCompositeShape("", uni), "", "union", true); } /// Constructor to be used when creating a new object. Rotation is identity rotation UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Position& pos) { - TGeoUnion* uni = new TGeoUnion(shape1, shape2, identityTransform(), _translation(pos)); + TGeoUnion* uni = new TGeoUnion(shape1, shape2, Matrices::_identity(), Matrices::_translation(pos)); _assign(new TGeoCompositeShape("", uni), "", "union", true); } /// Constructor to be used when creating a new object UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot) { - TGeoUnion *uni = new TGeoUnion(shape1, shape2, identityTransform(), _rotationZYX(rot)); + TGeoUnion *uni = new TGeoUnion(shape1, shape2, Matrices::_identity(), Matrices::_rotationZYX(rot)); _assign(new TGeoCompositeShape("", uni), "", "union", true); } /// Constructor to be used when creating a new object UnionSolid::UnionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot) { - TGeoUnion *uni = new TGeoUnion(shape1, shape2, identityTransform(), _rotation3D(rot)); + TGeoUnion *uni = new TGeoUnion(shape1, shape2, Matrices::_identity(), Matrices::_rotation3D(rot)); _assign(new TGeoCompositeShape("", uni), "", "union", true); } /// Constructor to be used when creating a new object. Position is identity, Rotation is identity rotation IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2) { - TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, identityTransform(), identityTransform()); + TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, Matrices::_identity(), Matrices::_identity()); _assign(new TGeoCompositeShape("", inter), "", "intersection", true); } /// Constructor to be used when creating a new object. Placement by a generic transformation within the mother IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const Transform3D& trans) { - TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, identityTransform(), _transform(trans)); + TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, Matrices::_identity(), Matrices::_transform(trans)); _assign(new TGeoCompositeShape("", inter), "", "intersection", true); } /// Constructor to be used when creating a new object. Position is identity. IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const Position& pos) { - TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, identityTransform(), _translation(pos)); + TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, Matrices::_identity(), Matrices::_translation(pos)); _assign(new TGeoCompositeShape("", inter), "", "intersection", true); } /// Constructor to be used when creating a new object IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const RotationZYX& rot) { - TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, identityTransform(), _rotationZYX(rot)); + TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, Matrices::_identity(), Matrices::_rotationZYX(rot)); _assign(new TGeoCompositeShape("", inter), "", "intersection", true); } /// Constructor to be used when creating a new object IntersectionSolid::IntersectionSolid(const Solid& shape1, const Solid& shape2, const Rotation3D& rot) { - TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, identityTransform(), _rotation3D(rot)); + TGeoIntersection* inter = new TGeoIntersection(shape1, shape2, Matrices::_identity(), Matrices::_rotation3D(rot)); _assign(new TGeoCompositeShape("", inter), "", "intersection", true); } -#define INSTANTIATE(X) template class DD4hep::Geometry::Solid_type<X> +#define INSTANTIATE(X) template class dd4hep::Solid_type<X> INSTANTIATE(TGeoShape); INSTANTIATE(TGeoBBox); diff --git a/DDCore/src/SimpleGDMLWriter.cpp b/DDCore/src/SimpleGDMLWriter.cpp index ab01dbe14..5060d0edf 100644 --- a/DDCore/src/SimpleGDMLWriter.cpp +++ b/DDCore/src/SimpleGDMLWriter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "SimpleGDMLWriter.h" // ROOT includes @@ -38,8 +38,8 @@ // C/C++ include files #include <iostream> -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::detail; +using namespace dd4hep; using namespace std; namespace { @@ -190,10 +190,10 @@ void* SimpleGDMLWriter::handleSolid(const string& name, const TGeoShape* shape) } /// Dump structure information in GDML format to output stream -void SimpleGDMLWriter::handleStructure(const VolumeVector& volset) const { +void SimpleGDMLWriter::handleStructure(const vector<Volume>& volset) const { m_output << "\t<structure>" << endl; - for (VolumeVector::const_iterator i = volset.begin(); i != volset.end(); ++i) - handleVolume((*i)->GetName(), (*i)); + for ( const auto v : volset ) + handleVolume(v->GetName(), v); m_output << "\t</structure>" << endl; } @@ -221,35 +221,34 @@ void* SimpleGDMLWriter::handleTransformation(const string& name, const TGeoMatri } /// Dump Transformations in GDML format to output stream -void SimpleGDMLWriter::handleTransformations(const TransformSet& trafos) const { +void SimpleGDMLWriter::handleTransformations(const vector<pair<string, TGeoMatrix*> >& trafos) const { m_output << "\t<define>" << endl; - for (TransformSet::const_iterator i = trafos.begin(); i != trafos.end(); ++i) - handleTransformation((*i).first, (*i).second); + for (const auto& t : trafos ) + handleTransformation(t.first, t.second); m_output << "\t</define>" << endl; } /// Dump all solids in GDML format to output stream -void SimpleGDMLWriter::handleSolids(const SolidSet& solids) const { +void SimpleGDMLWriter::handleSolids(const set<TGeoShape*>& solids) const { m_output << "\t<solids>" << endl; - for (SolidSet::const_iterator i = solids.begin(); i != solids.end(); ++i) - handleSolid((*i)->GetName(), (*i)); + for (const auto s : solids ) + handleSolid(s->GetName(), s); m_output << "\t</solids>" << endl; } /// Dump all constants in GDML format to output stream -void SimpleGDMLWriter::handleDefines(const LCDD::HandleMap& defs) const { +void SimpleGDMLWriter::handleDefines(const Detector::HandleMap& defs) const { m_output << "\t<define>" << endl; - for (LCDD::HandleMap::const_iterator i = defs.begin(); i != defs.end(); ++i) - m_output << "\t\t<constant name=\"" << (*i).second->GetName() << "\" value=\"" << (*i).second->GetTitle() << "\" />" + for (const auto i : defs ) + m_output << "\t\t<constant name=\"" << i.second->GetName() << "\" value=\"" << i.second->GetTitle() << "\" />" << endl; m_output << "\t</define>" << endl; } -/// Dump all visualisation specs in LCDD format to output stream -void SimpleGDMLWriter::handleVisualisation(const VisRefs& vis) const { +/// Dump all visualisation specs in Detector format to output stream +void SimpleGDMLWriter::handleVisualisation(const set<VisAttr>& vis) const { m_output << "\t<display>" << endl; - for (VisRefs::const_iterator i = vis.begin(); i != vis.end(); ++i) { - VisAttr v = Ref_t(*i); + for (const auto v : vis ) { if (v.isValid()) { float r = 1., g = 1., b = 1., alpha = 1.; TColor *color = gROOT->GetColor(v.color()); @@ -291,8 +290,8 @@ void SimpleGDMLWriter::handleVisualisation(const VisRefs& vis) const { void SimpleGDMLWriter::create(DetElement top) { GeometryInfo geo; collect(top, geo); - //handleSetup(LCDD::getInstance().header()); - handleDefines(LCDD::getInstance().constants()); + //handleSetup(Detector::getInstance().header()); + handleDefines(Detector::getInstance().constants()); handleVisualisation(geo.vis); handleTransformations(geo.trafos); handleSolids(geo.solids); diff --git a/DDCore/src/SimpleGDMLWriter.h b/DDCore/src/SimpleGDMLWriter.h index 53bcac151..1ed88d0c5 100644 --- a/DDCore/src/SimpleGDMLWriter.h +++ b/DDCore/src/SimpleGDMLWriter.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +15,7 @@ #define DD4HEP_SIMPLEGDMLWRITER_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/GeoHandler.h" // C/C++ include files @@ -28,10 +28,10 @@ class TGeoVolume; class TGeoNode; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { /// Simple GDML creator from TGeo geometries in memory /** @@ -61,17 +61,17 @@ namespace DD4hep { virtual void* handleSolid(const std::string& name, const TGeoShape* volume) const; /// Dump all constants in GDML format to output stream - virtual void handleDefines(const DefinitionSet& defs) const; - /// Dump all visualisation specs in LCDD format to output stream - void handleVisualisation(const VisRefs& vis) const; + virtual void handleDefines(const Detector::HandleMap& defs) const; + /// Dump all visualisation specs in Detector format to output stream + void handleVisualisation(const std::set<VisAttr>& vis) const; /// Dump all solids in GDML format to output stream - virtual void handleSolids(const SolidSet& solids) const; + virtual void handleSolids(const std::set<TGeoShape*>& solids) const; /// Dump Transformations in GDML format to output stream - virtual void handleTransformations(const TransformSet& trafos) const; + virtual void handleTransformations(const std::vector<std::pair<std::string, TGeoMatrix*> >& trafos) const; /// Dump structure information in GDML format to output stream - virtual void handleStructure(const VolumeVector& volset) const; + virtual void handleStructure(const std::vector<Volume>& volset) const; }; - } // End namespace Geometry -} // End namespace DD4hep + } // End namespace detail +} // End namespace dd4hep #endif // DD4HEP_SIMPLEGDMLWRITER_H diff --git a/DDCore/src/SurfaceInstaller.cpp b/DDCore/src/SurfaceInstaller.cpp index 6abb56218..b8e93d083 100644 --- a/DDCore/src/SurfaceInstaller.cpp +++ b/DDCore/src/SurfaceInstaller.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,19 +23,19 @@ #include "TClass.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep; typedef DetElement::Children _C; /// Initializing constructor -SurfaceInstaller::SurfaceInstaller(LCDD& lcdd, int argc, char** argv) - : m_lcdd(lcdd), m_det(), m_stopScanning(false) +SurfaceInstaller::SurfaceInstaller(Detector& description, int argc, char** argv) + : m_detDesc(description), m_det(), m_stopScanning(false) { if ( argc > 0 ) { string det_name = argv[0]; string n = det_name[0] == '-' ? det_name.substr(1) : det_name; - m_det = lcdd.detector(n); + m_det = description.detector(n); if ( !m_det.isValid() ) { stringstream err; err << "The subdetector " << det_name << " is not known to the geometry."; @@ -81,10 +81,10 @@ void SurfaceInstaller::install(DetElement component, PlacedVolume pv) { stringstream log; PlacementPath all_nodes; ElementPath det_elts; - DetectorTools::elementPath(component,det_elts); - DetectorTools::placementPath(component,all_nodes); - string elt_path = DetectorTools::elementPath(det_elts); - string node_path = DetectorTools::placementPath(all_nodes); + detail::tools::elementPath(component,det_elts); + detail::tools::placementPath(component,all_nodes); + string elt_path = detail::tools::elementPath(det_elts); + string node_path = detail::tools::placementPath(all_nodes); log << "Lookup " << " Detector[" << det_elts.size() << "]: " << elt_path; printout(INFO,m_det.name(),log.str()); diff --git a/DDCore/src/ToStream.cpp b/DDCore/src/ToStream.cpp index a2ead899c..e74e4b0b0 100644 --- a/DDCore/src/ToStream.cpp +++ b/DDCore/src/ToStream.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,12 +16,12 @@ #define DD4HEP_NEED_EVALUATOR // This is the case, if the parsers are externalized -// and the DD4hep namespace is renamed! +// and the dd4hep namespace is renamed! #include DD4HEP_PARSER_HEADER #else -// Standard DD4hep parser handling +// Standard dd4hep parser handling #include "DD4hep/ToStream.h" #endif @@ -30,7 +30,7 @@ // ============================================================================ // print XYZ-point -std::ostream& DD4hep::Utils::toStream(const ROOT::Math::XYZPoint& obj, std::ostream& s) { +std::ostream& dd4hep::Utils::toStream(const ROOT::Math::XYZPoint& obj, std::ostream& s) { s << "( "; toStream(obj.X () , s ); s << " , "; @@ -42,7 +42,7 @@ std::ostream& DD4hep::Utils::toStream(const ROOT::Math::XYZPoint& obj, std::ost } // ============================================================================ // print XYZ-vector -std::ostream& DD4hep::Utils::toStream(const ROOT::Math::XYZVector& obj, std::ostream& s) { +std::ostream& dd4hep::Utils::toStream(const ROOT::Math::XYZVector& obj, std::ostream& s) { s << "( "; toStream(obj.X () , s ); s << " , "; @@ -54,7 +54,7 @@ std::ostream& DD4hep::Utils::toStream(const ROOT::Math::XYZVector& obj, std::ost } // ============================================================================ // print LorentzVector -std::ostream& DD4hep::Utils::toStream(const ROOT::Math::PxPyPzEVector& obj, std::ostream& s){ +std::ostream& dd4hep::Utils::toStream(const ROOT::Math::PxPyPzEVector& obj, std::ostream& s){ s << "( "; toStream(obj.Px () , s , 12 ); s << " , "; diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index c1db4c7aa..0fe547a4a 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/MatrixHelpers.h" #include "DD4hep/detail/DetectorInterna.h" @@ -25,14 +25,33 @@ #include <iomanip> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; + +namespace { + class ContextExtension { + public: + /// The placement of the (sensitive) volume + PlacedVolume placement{0}; + /// The transformation of space-points to the coordinate system of the closests detector element + TGeoHMatrix toElement; + /// Default constructor + ContextExtension() = default; + /// Default destructor + ~ContextExtension() = default; + }; + + inline ContextExtension* _getExtension(const VolumeManagerContext* ctxt) { + char* p = (char*)ctxt; + return (ContextExtension*)(p + sizeof(VolumeManagerContext)); + } +} /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { /// Helper class to populate the volume manager /** @@ -43,8 +62,8 @@ namespace DD4hep { typedef PlacedVolume::VolIDs VolIDs; typedef vector<TGeoNode*> Chain; typedef pair<VolumeID, VolumeID> Encoding; - /// Reference to the LCDD instance - LCDD& m_lcdd; + /// Reference to the Detector instance + Detector& m_detDesc; /// Reference to the volume manager to be populated VolumeManager m_volManager; /// Set of already added entries @@ -54,8 +73,8 @@ namespace DD4hep { public: /// Default constructor - VolumeManager_Populator(LCDD& lcdd, VolumeManager vm) - : m_lcdd(lcdd), m_volManager(vm) + VolumeManager_Populator(Detector& description, VolumeManager vm) + : m_detDesc(description), m_volManager(vm) { m_debug = (0 != ::getenv("DD4HEP_VOLMGR_DEBUG")); } @@ -66,7 +85,7 @@ namespace DD4hep { const DetElement::Children& c = e.children(); SensitiveDetector parent_sd; if ( e->flag&DetElement::Object::HAVE_SENSITIVE_DETECTOR ) { - parent_sd = m_lcdd.sensitiveDetector(e.name()); + parent_sd = m_detDesc.sensitiveDetector(e.name()); } //printout(INFO, "VolumeManager", "++ Executing %s plugin manager version",typ ? "***NEW***" : "***OLD***"); for (const auto& i : c ) { @@ -107,9 +126,9 @@ namespace DD4hep { if ( is_sensitive ) sd = vol.sensitiveDetector(); else if ( (parent->flag&DetElement::Object::HAVE_SENSITIVE_DETECTOR) ) - sd = m_lcdd.sensitiveDetector(parent.name()); + sd = m_detDesc.sensitiveDetector(parent.name()); else if ( (e->flag&DetElement::Object::HAVE_SENSITIVE_DETECTOR) ) - sd = m_lcdd.sensitiveDetector(e.name()); + sd = m_detDesc.sensitiveDetector(e.name()); } chain.push_back(node); if ( sd.isValid() && !pv_ids.empty() ) { @@ -203,8 +222,8 @@ namespace DD4hep { static Encoding update_encoding(const IDDescriptor iddesc, const VolIDs& ids, const Encoding& initial) { VolumeID volume_id = initial.first, mask = initial.second; for (VolIDs::const_iterator i = ids.begin(); i != ids.end(); ++i) { - const PlacedVolume::VolID& id = (*i); - IDDescriptor::Field f = iddesc.field(id.first); + const auto& id = (*i); + const BitFieldValue* f = iddesc.field(id.first); VolumeID msk = f->mask(); int off = f->offset(); VolumeID val = id.second; // Necessary to extend volume IDs > 32 bit @@ -217,8 +236,8 @@ namespace DD4hep { static Encoding encoding(const IDDescriptor iddesc, const VolIDs& ids) { VolumeID volume_id = 0, mask = 0; for (VolIDs::const_iterator i = ids.begin(); i != ids.end(); ++i) { - const PlacedVolume::VolID& id = (*i); - IDDescriptor::Field f = iddesc.field(id.first); + const auto& id = (*i); + const BitFieldValue* f = iddesc.field(id.first); VolumeID msk = f->mask(); int off = f->offset(); VolumeID val = id.second; // Necessary to extend volume IDs > 32 bit @@ -235,76 +254,30 @@ namespace DD4hep { if (m_entries.find(code.first) == m_entries.end()) { Readout ro = sd.readout(); string sd_name = sd.name(); - DetElement sub_detector = m_lcdd.detector(sd_name); + DetElement sub_detector = m_detDesc.detector(sd_name); VolumeManager section = m_volManager.addSubdetector(sub_detector, ro); // This is the block, we effectively have to save for each physical volume with a VolID - VolumeManager::Context* context = new VolumeManager::Context; + size_t len = nodes.empty() + ? sizeof(VolumeManagerContext) + : sizeof(VolumeManagerContext) + sizeof(ContextExtension); + void* ptr = ::operator new(len); + VolumeManagerContext* context = new(ptr) VolumeManagerContext; context->identifier = code.first; context->mask = code.second; - context->detector = parent; - context->placement = PlacedVolume(n); context->element = e; - for (size_t i = nodes.size(); i > 1; --i) { // Omit the placement of the parent DetElement - TGeoMatrix* m = nodes[i-1]->GetMatrix(); - context->toWorld.MultiplyLeft(m); + if ( nodes.size() > 0 ) { + ContextExtension* ext = new(_getExtension(context)) ContextExtension(); + ext->placement = PlacedVolume(n); + for (size_t i = nodes.size(); i > 1; --i) { // Omit the placement of the parent DetElement + TGeoMatrix* m = nodes[i-1]->GetMatrix(); + ext->toElement.MultiplyLeft(m); + } } - // context->volID = ids; - // context->path = nodes; - context->toElement = context->toWorld; - context->toDetector = context->toWorld; - context->toDetector.MultiplyLeft(nodes[0]->GetMatrix()); - context->toWorld.MultiplyLeft(&e.nominal().worldTransformation()); if ( !section.adoptPlacement(context) || m_debug ) { print_node(sd, parent, e, n, code, nodes); - //context->toWorld.Print(); } m_entries.insert(code.first); - - /** Comment this section to avoid too many computations .... - * These are only consistentcyu tests - */ - - { - int res1 = _matrixEqual(e->__worldTransformation(),e.nominal().worldTransformation()); - int res2 = _matrixEqual(e->__parentTransformation(),e.nominal().detectorTransformation()); - if ( res1 != MATRICES_EQUAL || res2 != MATRICES_EQUAL ) { - stringstream log; - // We HAVE to check at least once if the matrices from the original DetElement - // and from the nominal alignment are identical.... - string p = ""; - for (size_t i=0; i<nodes.size(); ++i) { // Omit the placement of the parent DetElement - p += "/"; - p += nodes[i]->GetName(); - } - - log << "Alignment:"; - for(size_t j=0; j<e.nominal().nodes().size(); ++j) - log << " " << (void*)e.nominal().nodes()[j].ptr(); - log << " Nodes:"; - for (size_t j = 0; j<nodes.size(); ++j) { - log << " " << (void*)nodes[j]; - } - if ( res1 != MATRICES_EQUAL ) { - res1 = _matrixEqual(e->__worldTransformation(),e.nominal().worldTransformation()); - const char* tag = (res1==MATRICES_DIFFER_TRANSLATION) ? "translation" - : (res1==MATRICES_DIFFER_ROTATION) ? "rotation" - : "translation+rotation"; - printout(WARNING,"VolumeManager", - "+++ World matrix of %s // %s is NOT equal (%s)! Pointers:%s", - e.placementPath().c_str(),p.c_str(),tag,log.str().c_str()); - } - if ( res2 != MATRICES_EQUAL ) { - res2 = _matrixEqual(e->__parentTransformation(),e.nominal().detectorTransformation()); - const char* tag = (res2==MATRICES_DIFFER_TRANSLATION) ? "translation" - : (res2==MATRICES_DIFFER_ROTATION) ? "rotation" - : "translation+rotation"; - printout(WARNING,"VolumeManager", - "+++ Parent matrix of %s // %s is NOT equal (%s)! Pointers:%s ", - e.placementPath().c_str(),p.c_str(), tag, log.str().c_str()); - } - } - } } } } @@ -332,16 +305,33 @@ namespace DD4hep { printout(m_debug ? INFO : DEBUG, "VolumeManager", log.str().c_str()); } }; - } /* End namespace Geometry */ -} /* End namespace DD4hep */ + } /* End namespace detail */ +} /* End namespace dd4hep */ + +/// Default destructor +VolumeManagerContext::~VolumeManagerContext() { + if ( 0 == flag ) return; + _getExtension(this)->~ContextExtension(); +} + +/// Acces the sensitive volume placement +PlacedVolume VolumeManagerContext::placement() const { + return (0 == flag ) ? element.placement() : _getExtension(this)->placement; +} + +/// Access the transformation to the closest detector element +const TGeoHMatrix& VolumeManagerContext::toElement() const { + static TGeoHMatrix identity; + return (0 == flag ) ? identity : _getExtension(this)->toElement; +} /// Initializing constructor to create a new object -VolumeManager::VolumeManager(LCDD& lcdd, const string& nam, DetElement elt, Readout ro, int flags) { +VolumeManager::VolumeManager(Detector& description, const string& nam, DetElement elt, Readout ro, int flags) { printout(INFO, "VolumeManager", " - populating volume ids - be patient ..." ); Object* obj_ptr = new Object(); assign(obj_ptr, nam, "VolumeManager"); if (elt.isValid()) { - VolumeManager_Populator p(lcdd, *this); + detail::VolumeManager_Populator p(description, *this); obj_ptr->detector = elt; obj_ptr->id = ro.isValid() ? ro.idSpec() : IDDescriptor(); obj_ptr->top = obj_ptr; @@ -359,11 +349,11 @@ VolumeManager::VolumeManager(DetElement sub_detector, Readout ro) { assign(obj_ptr, sub_detector.name(), "VolumeManager"); } -VolumeManager VolumeManager::getVolumeManager(LCDD& lcdd) { - if( not lcdd.volumeManager().isValid() ) { - lcdd.apply("DD4hepVolumeManager", 0, 0); +VolumeManager VolumeManager::getVolumeManager(Detector& description) { + if( not description.volumeManager().isValid() ) { + description.apply("dd4hepVolumeManager", 0, 0); } - return lcdd.volumeManager(); + return description.volumeManager(); } /// Add a new Volume manager section according to a new subdetector @@ -371,41 +361,41 @@ VolumeManager VolumeManager::addSubdetector(DetElement det, Readout ro) { if (isValid()) { Object& o = _data(); if (!det.isValid()) { - throw runtime_error("DD4hep: VolumeManager::addSubdetector: Only valid subdetectors " + throw runtime_error("dd4hep: VolumeManager::addSubdetector: Only valid subdetectors " "are allowed. [Invalid DetElement]"); } - Detectors::const_iterator i = o.subdetectors.find(det); + auto i = o.subdetectors.find(det); if (i == o.subdetectors.end()) { string det_name = det.name(); // First check all pre-conditions if (!ro.isValid()) { - throw runtime_error("DD4hep: VolumeManager::addSubdetector: Only subdetectors with a " + throw runtime_error("dd4hep: VolumeManager::addSubdetector: Only subdetectors with a " "valid readout descriptor are allowed. [Invalid DetElement:" + det_name + "]"); } PlacedVolume pv = det.placement(); if (!pv.isValid()) { - throw runtime_error("DD4hep: VolumeManager::addSubdetector: Only subdetectors with a " + throw runtime_error("dd4hep: VolumeManager::addSubdetector: Only subdetectors with a " "valid placement are allowed. [Invalid DetElement:" + det_name + "]"); } - VolIDs::Base::const_iterator vit = pv.volIDs().find("system"); + auto vit = pv.volIDs().find("system"); if (vit == pv.volIDs().end()) { - throw runtime_error("DD4hep: VolumeManager::addSubdetector: Only subdetectors with " + throw runtime_error("dd4hep: VolumeManager::addSubdetector: Only subdetectors with " "valid placement VolIDs are allowed. [Invalid DetElement:" + det_name + "]"); } i = o.subdetectors.insert(make_pair(det, VolumeManager(det,ro))).first; - const PlacedVolume::VolID& id = (*vit); + const auto& id = (*vit); VolumeManager m = (*i).second; - IDDescriptor::Field field = ro.idSpec().field(id.first); + const BitFieldValue* field = ro.idSpec().field(id.first); if (!field) { - throw runtime_error("DD4hep: VolumeManager::addSubdetector: IdDescriptor of " + + throw runtime_error("dd4hep: VolumeManager::addSubdetector: IdDescriptor of " + string(det.name()) + " has no field " + id.first); } Object& mo = m._data(); - mo.top = o.top; - mo.flags = o.flags; - mo.system = field; - mo.sysID = id.second; + mo.top = o.top; + mo.flags = o.flags; + mo.system = field; + mo.sysID = id.second; mo.detMask = mo.sysID; o.managers[mo.sysID] = m; det.callAtUpdate(DetElement::PLACEMENT_CHANGED|DetElement::PLACEMENT_DETECTOR, @@ -413,7 +403,7 @@ VolumeManager VolumeManager::addSubdetector(DetElement det, Readout ro) { } return (*i).second; } - throw runtime_error("DD4hep: VolumeManager::addSubdetector: " + throw runtime_error("dd4hep: VolumeManager::addSubdetector: " "Failed to add subdetector section. [Invalid Manager Handle]"); } @@ -428,10 +418,10 @@ VolumeManager VolumeManager::subdetector(VolumeID id) const { if ( sys_id == mo.sysID ) return j.second; } - throw runtime_error("DD4hep: VolumeManager::subdetector(VolID): " + throw runtime_error("dd4hep: VolumeManager::subdetector(VolID): " "Attempt to access unknown subdetector section."); } - throw runtime_error("DD4hep: VolumeManager::subdetector(VolID): " + throw runtime_error("dd4hep: VolumeManager::subdetector(VolID): " "Cannot assign ID descriptor [Invalid Manager Handle]"); } @@ -440,7 +430,7 @@ DetElement VolumeManager::detector() const { if (isValid()) { return _data().detector; } - throw runtime_error("DD4hep: VolumeManager::detector: Cannot access DetElement [Invalid Handle]"); + throw runtime_error("dd4hep: VolumeManager::detector: Cannot access DetElement [Invalid Handle]"); } /// Access IDDescription structure @@ -449,23 +439,24 @@ IDDescriptor VolumeManager::idSpec() const { } /// Register physical volume with the manager (normally: section manager) -bool VolumeManager::adoptPlacement(VolumeID /* sys_id */, Context* context) { +bool VolumeManager::adoptPlacement(VolumeID /* sys_id */, VolumeManagerContext* context) { stringstream err; - Object& o = _data(); - VolumeID vid = context->identifier; - VolumeID mask = context->mask; - PlacedVolume pv = context->placement; - Volumes::iterator i = o.volumes.find(vid); + Object& o = _data(); + VolumeID vid = context->identifier; + VolumeID mask = context->mask; + PlacedVolume pv = context->placement(); + auto i = o.volumes.find(vid); if ( (vid&mask) != vid ) { err << "Bad context mask:" << (void*)mask << " id:" << (void*)vid - << " pv:" << pv.name() << " Sensitive:" - << yes_no(pv.volume().isSensitive()) << endl; + << " pv:" << pv.name() + << " Sensitive:" << yes_no(pv.volume().isSensitive()) + << endl; goto Fail; } - if (i == o.volumes.end()) { + if ( i == o.volumes.end()) { o.volumes[vid] = context; o.detMask |= mask; err << "Inserted new volume:" << setw(6) << left << o.volumes.size() @@ -484,18 +475,20 @@ bool VolumeManager::adoptPlacement(VolumeID /* sys_id */, Context* context) { << " to detector " << o.detector.name() << " ptr:" << (void*) pv.ptr() << " Name:" << pv.name() - << " Sensitive:" << yes_no(pv.volume().isSensitive()) << endl; + << " Sensitive:" << yes_no(pv.volume().isSensitive()) + << endl; printout(ERROR, "VolumeManager", "%s", err.str().c_str()); err.str(""); context = (*i).second; - pv = context->placement; + //pv = context->placement; err << " !!!!! +++ Clashing" << " id:" << setw(16) << hex << right << setfill('0') << vid << dec << setfill(' ') << " mask:" << setw(16) << hex << right << setfill('0') << mask << dec << setfill(' ') << " to detector " << o.detector.name() << " ptr:" << (void*) pv.ptr() << " Name:" << pv.name() - << " Sensitive:" << yes_no(pv.volume().isSensitive()) << endl; + << " Sensitive:" << yes_no(pv.volume().isSensitive()) + << endl; Fail: printout(ERROR, "VolumeManager", "%s", err.str().c_str()); // throw runtime_error(err.str()); @@ -503,52 +496,50 @@ bool VolumeManager::adoptPlacement(VolumeID /* sys_id */, Context* context) { } /// Register physical volume with the manager (normally: section manager) -bool VolumeManager::adoptPlacement(Context* context) { +bool VolumeManager::adoptPlacement(VolumeManagerContext* context) { stringstream err; - if (isValid()) { + if ( isValid() ) { Object& o = _data(); - if (context) { - if ((o.flags & ONE) == ONE) { + if ( context ) { + if ( (o.flags & ONE) == ONE ) { VolumeManager top(Ref_t(o.top)); return top.adoptPlacement(context); } - if ((o.flags & TREE) == TREE) { + if ( (o.flags & TREE) == TREE ) { bool isTop = ptr() == o.top; - if (!isTop) { + if ( !isTop ) { VolumeID sys_id = o.system->value(context->identifier); - if (sys_id == o.sysID) { + if ( sys_id == o.sysID ) { return adoptPlacement(sys_id, context); } VolumeManager top(Ref_t(o.top)); return top.adoptPlacement(context); } - for (Managers::iterator j = o.managers.begin(); j != o.managers.end(); ++j) { - Object& m = (*j).second._data(); + for( auto& j : o.managers ) { + Object& m = j.second._data(); VolumeID sid = m.system->value(context->identifier); - if ((*j).first == sid) { - return (*j).second.adoptPlacement(sid, context); + if ( j.first == sid ) { + return j.second.adoptPlacement(sid, context); } } } return false; } - err << "Failed to add new physical volume to detector:" << o.detector.name() << " [Invalid Context]"; - goto Fail; + except("VolumeManager","dd4hep: Failed to add new physical volume to detector: %s " + "[Invalid Context]", o.detector.name()); } - err << "Failed to add new physical volume [Invalid Manager Handle]"; - goto Fail; - Fail: throw runtime_error("DD4hep: " + err.str()); + except("VolumeManager","dd4hep: Failed to add new physical volume [Invalid Manager Handle]"); return false; } /// Lookup the context, which belongs to a registered physical volume. -VolumeManager::Context* VolumeManager::lookupContext(VolumeID volume_id) const { +VolumeManagerContext* VolumeManager::lookupContext(VolumeID volume_id) const { if (isValid()) { - Context* c = 0; + VolumeManagerContext* c = 0; const Object& o = _data(); bool is_top = o.top == ptr(); bool one_tree = (o.flags & ONE) == ONE; - if (!is_top && one_tree) { + if ( !is_top && one_tree ) { return VolumeManager(Ref_t(o.top)).lookupContext(volume_id); } VolumeID id = volume_id; @@ -558,46 +549,65 @@ VolumeManager::Context* VolumeManager::lookupContext(VolumeID volume_id) const { return c; /// Second: look in the subdetector volume cache if the entry is found. if (!one_tree) { - for (Detectors::const_iterator j = o.subdetectors.begin(); j != o.subdetectors.end(); ++j) { - if ((c = (*j).second._data().search(id)) != 0) + for (const auto& j : o.subdetectors ) { + if ((c = j.second._data().search(id)) != 0) return c; } } - stringstream err; - err << "VolumeManager::lookupContext: Failed to search Volume context [Unknown identifier]" - << (void*) volume_id; - throw runtime_error("DD4hep: " + err.str()); + except("VolumeManager","lookupContext: Failed to search Volume context %016llX [Unknown identifier]", (void*)volume_id); } - throw runtime_error("DD4hep: VolumeManager::lookupContext: " - "Failed to search Volume context [Invalid Manager Handle]"); + except("VolumeManager","lookupContext: Failed to search Volume context [Invalid Manager Handle]"); + return 0; } /// Lookup a physical (placed) volume identified by its 64 bit hit ID PlacedVolume VolumeManager::lookupPlacement(VolumeID volume_id) const { - Context* c = lookupContext(volume_id); - return c->placement; + VolumeManagerContext* c = lookupContext(volume_id); // Throws exception if not found! + return c->placement(); } /// Lookup a top level subdetector detector element according to a contained 64 bit hit ID DetElement VolumeManager::lookupDetector(VolumeID volume_id) const { - Context* c = lookupContext(volume_id); - return c->detector; + if (isValid()) { + const Object& o = _data(); + VolumeID sys_id = 0; + if ( o.system ) { + sys_id = o.system->value(volume_id); + } + else { + for (const auto& j : o.subdetectors ) { + if ( (volume_id&j.second->sysID) == j.second->sysID ) { + sys_id = j.second->sysID; + break; + } + } + } + VolumeID det_id = (volume_id&sys_id); + VolumeManagerContext* c = lookupContext(det_id); // Throws exception if not found! + return c->element; + } + except("VolumeManager","lookupContext: Failed to search Volume context [Invalid Manager Handle]"); + return 0; } /// Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID DetElement VolumeManager::lookupDetElement(VolumeID volume_id) const { - Context* c = lookupContext(volume_id); + VolumeManagerContext* c = lookupContext(volume_id); // Throws exception if not found! return c->element; } /// Access the transformation of a physical volume to the world coordinate system -const TGeoMatrix& VolumeManager::worldTransformation(VolumeID volume_id) const { - Context* c = lookupContext(volume_id); - return c->toWorld; +const TGeoMatrix& +VolumeManager::worldTransformation(const ConditionsMap& mapping, + VolumeID volume_id) const +{ + VolumeManagerContext* c = lookupContext(volume_id); // Throws exception if not found! + Alignment a = mapping.get(c->element,align::Keys::alignmentKey); + return a.worldTransformation(); } /// Enable printouts for debugging -std::ostream& DD4hep::Geometry::operator<<(std::ostream& os, const VolumeManager& m) { +std::ostream& dd4hep::operator<<(std::ostream& os, const VolumeManager& m) { const VolumeManager::Object& o = *m.data<VolumeManager::Object>(); VolumeManager::Object* top = dynamic_cast<VolumeManager::Object*>(o.top); bool isTop = top == &o; @@ -611,83 +621,16 @@ std::ostream& DD4hep::Geometry::operator<<(std::ostream& os, const VolumeManager << " placements "; if (!(o.managers.empty() && o.volumes.empty())) os << endl; - for (VolumeManager::Volumes::const_iterator i = o.volumes.begin(); i != o.volumes.end(); ++i) { - const VolumeManager::Context* c = (*i).second; - PlacedVolume pv = c->placement; - os << prefix << "PV:" << setw(32) << left << pv.name() - << " id:" << setw(18) << left << (void*) c->identifier - << " mask:" << setw(18) << left << (void*) c->mask + for ( const auto& i : o.volumes ) { + const VolumeManagerContext* c = i.second; + os << prefix + << "Element:" << setw(32) << left << c->element.path() + << " pv:" << setw(32) << left << c->placement().name() + << " id:" << setw(18) << left << (void*) c->identifier + << " mask:" << setw(18) << left << (void*) c->mask << endl; } - for (VolumeManager::Managers::const_iterator i = o.managers.begin(); i != o.managers.end(); ++i) - os << prefix << (*i).second << endl; + for( const auto& i : o.managers ) + os << prefix << i.second << endl; return os; } - -// #if 0 - -// It was wishful thinking, the implementation of the reverse lookups would be as simple. -// Hence the folling calls are removed for the time being. - -// Markus Frank - -// /** This set of functions is required when reading/analyzing -// * already created hits which have a VolumeID attached. -// */ -// /// Lookup the context, which belongs to a registered physical volume. -// Context* lookupContext(PlacedVolume vol) const throw(); -// /// Access the physical volume identifier from the placed volume -// VolumeID lookupID(PlacedVolume vol) const; -// /// Lookup a top level subdetector detector element according to a contained 64 bit hit ID -// DetElement lookupDetector(PlacedVolume vol) const; -// /// Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID -// DetElement lookupDetElement(PlacedVolume vol) const; -// /// Access the transformation of a physical volume to the world coordinate system -// const TGeoMatrix& worldTransformation(PlacedVolume vol) const; - -// /// Lookup the context, which belongs to a registered physical volume. -// VolumeManager::Context* VolumeManager::lookupContext(PlacedVolume pv) const throw() { -// if ( isValid() ) { -// Context* c = 0; -// const Object& o = _data(); -// if ( o.top != ptr() && (o.flags&ONE) == ONE ) { -// return VolumeManager(Ref_t(o.top)).lookupContext(pv); -// } -// /// First look in our own volume cache if the entry is found. -// c = o.search(pv); -// if ( c ) return c; -// /// Second: look in the subdetector volume cache if the entry is found. -// for(Detectors::const_iterator j=o.subdetectors.begin(); j != o.subdetectors.end(); ++j) { -// if ( (c=(*j).second._data().search(pv)) != 0 ) -// return c; -// } -// throw runtime_error("VolumeManager::lookupContext: Failed to search Volume context [Unknown identifier]"); -// } -// throw runtime_error("VolumeManager::lookupContext: Failed to search Volume context [Invalid Manager Handle]"); -// } - -// /// Access the physical volume identifier from the placed volume -// VolumeManager::VolumeID VolumeManager::lookupID(PlacedVolume vol) const { -// Context* c = lookupContext(vol); -// return c->identifier; -// } - -// /// Lookup a top level subdetector detector element according to a contained 64 bit hit ID -// DetElement VolumeManager::lookupDetector(PlacedVolume vol) const { -// Context* c = lookupContext(vol); -// return c->detector; -// } - -// /// Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID -// DetElement VolumeManager::lookupDetElement(PlacedVolume vol) const { -// Context* c = lookupContext(vol); -// return c->element; -// } - -// /// Access the transformation of a physical volume to the world coordinate system -// const TGeoMatrix& VolumeManager::worldTransformation(PlacedVolume vol) const { -// Context* c = lookupContext(vol); -// return c->toWorld; -// } - -// #endif diff --git a/DDCore/src/VolumeManagerInterna.cpp b/DDCore/src/VolumeManagerInterna.cpp index 75b8c4775..fa461b1fa 100644 --- a/DDCore/src/VolumeManagerInterna.cpp +++ b/DDCore/src/VolumeManagerInterna.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,25 +16,11 @@ #include "DD4hep/detail/Handle.inl" #include "DD4hep/detail/VolumeManagerInterna.h" -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; DD4HEP_INSTANTIATE_HANDLE_NAMED(VolumeManagerObject); -/// Default constructor -VolumeManagerContext::VolumeManagerContext() - : identifier(0), mask(~0x0ULL) { -} - -/// Default destructor -VolumeManagerContext::~VolumeManagerContext() { -} - -/// Default constructor -VolumeManagerObject::VolumeManagerObject() - : top(0), system(0), sysID(0), detMask(~0x0ULL), flags(VolumeManager::NONE) { -} - /// Default destructor VolumeManagerObject::~VolumeManagerObject() { /// Cleanup volume tree @@ -51,22 +37,13 @@ void VolumeManagerObject::update(unsigned long tags, DetElement& det, void* para printout(DEBUG,"VolumeManager","+++ Conditions update %s param:%p",det.path().c_str(),param); if ( DetElement::PLACEMENT_CHANGED == (tags&DetElement::PLACEMENT_CHANGED) ) printout(DEBUG,"VolumeManager","+++ Alignment update %s param:%p",det.path().c_str(),param); - - for(Volumes::iterator i=volumes.begin(); i != volumes.end(); ++i) { - Context* c = (*i).second; - printout(DEBUG,"VolumeManager","+++ Alignment update %s",c->placement.name()); - - } + + for(const auto& i : volumes ) + printout(DEBUG,"VolumeManager","+++ Alignment update %s",i.second->placement().name()); } /// Search the locally cached volumes for a matching ID -VolumeManager::Context* VolumeManagerObject::search(const VolumeID& vol_id) const { - Context* context = 0; - VolumeID volume_id(vol_id); - volume_id &= detMask; - Volumes::const_iterator i = volumes.find(volume_id); - if (i != volumes.end()) { - context = (*i).second; - } - return context; +VolumeManagerContext* VolumeManagerObject::search(const VolumeID& vol_id) const { + auto i = volumes.find(vol_id&detMask); + return (i == volumes.end()) ? 0 : (*i).second; } diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp index 69eb0cc7b..ef319b179 100644 --- a/DDCore/src/Volumes.cpp +++ b/DDCore/src/Volumes.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" #include "DD4hep/MatrixHelpers.h" @@ -36,11 +36,12 @@ #include <sstream> using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; #ifdef DD4HEP_EMULATE_TGEOEXTENSIONS -namespace DD4hep { - namespace Geometry { +namespace dd4hep { + namespace detail { struct DDExtension { TGeoExtension* m_extension; @@ -373,9 +374,8 @@ string PlacedVolumeExtension::VolIDs::str() const { static PlacedVolume::Object* _data(const PlacedVolume& v) { PlacedVolume::Object* o = _userExtension(v); - if (o) - return o; - throw runtime_error("DD4hep: Attempt to access invalid handle of type: PlacedVolume"); + if (o) return o; + throw runtime_error("dd4hep: Attempt to access invalid handle of type: PlacedVolume"); } /// Check if placement is properly instrumented @@ -387,23 +387,23 @@ PlacedVolume::Object* PlacedVolume::data() const { /// Add identifier PlacedVolume& PlacedVolume::addPhysVolID(const string& nam, int value) { Object* obj = _data(*this); - obj->volIDs.push_back(VolID(nam, value)); + obj->volIDs.push_back(make_pair(nam, value)); return *this; } /// Volume material Material PlacedVolume::material() const { - return Material::handle_t(m_element ? m_element->GetMedium() : 0); + return Material(m_element ? m_element->GetMedium() : 0); } /// Logical volume of this placement Volume PlacedVolume::volume() const { - return Volume::handle_t(m_element ? m_element->GetVolume() : 0); + return Volume(m_element ? m_element->GetVolume() : 0); } /// Parent volume (envelope) Volume PlacedVolume::motherVol() const { - return Volume::handle_t(m_element ? m_element->GetMotherVolume() : 0); + return Volume(m_element ? m_element->GetMotherVolume() : 0); } /// Access to the volume IDs @@ -479,7 +479,7 @@ Volume::Object* _data(const Volume& v, bool throw_exception = true) { return o; else if (!throw_exception) return 0; - throw runtime_error("DD4hep: Attempt to access invalid handle of type: PlacedVolume"); + throw runtime_error("dd4hep: Attempt to access invalid handle of type: PlacedVolume"); } /// Constructor to be used when creating a new geometry tree. @@ -500,12 +500,12 @@ Volume::Object* Volume::data() const { static PlacedVolume _addNode(TGeoVolume* par, TGeoVolume* daughter, TGeoMatrix* transform) { if ( !daughter ) { - throw runtime_error("DD4hep: Volume: Attempt to assign an invalid physical daughter volume."); + throw runtime_error("dd4hep: Volume: Attempt to assign an invalid physical daughter volume."); } TGeoVolume* parent = par; TObjArray* a = parent->GetNodes(); Int_t id = a ? a->GetEntries() : 0; - if (transform && transform != identityTransform()) { + if (transform && transform != Matrices::_identity()) { string nam = string(daughter->GetName()) + "_placement"; transform->SetName(nam.c_str()); } @@ -528,27 +528,27 @@ static PlacedVolume _addNode(TGeoVolume* par, TGeoVolume* daughter, TGeoMatrix* /// Place daughter volume according to generic Transform3D PlacedVolume Volume::placeVolume(const Volume& volume, const Transform3D& trans) const { - return _addNode(m_element, volume, _transform(trans)); + return _addNode(m_element, volume, Matrices::_transform(trans)); } /// Place daughter volume. The position and rotation are the identity PlacedVolume Volume::placeVolume(const Volume& volume) const { - return _addNode(m_element, volume, identityTransform()); + return _addNode(m_element, volume, Matrices::_identity()); } /// Place un-rotated daughter volume at the given position. PlacedVolume Volume::placeVolume(const Volume& volume, const Position& pos) const { - return _addNode(m_element, volume, _translation(pos)); + return _addNode(m_element, volume, Matrices::_translation(pos)); } /// Place rotated daughter volume. The position is automatically the identity position PlacedVolume Volume::placeVolume(const Volume& volume, const RotationZYX& rot) const { - return _addNode(m_element, volume, _rotationZYX(rot)); + return _addNode(m_element, volume, Matrices::_rotationZYX(rot)); } /// Place rotated daughter volume. The position is automatically the identity position PlacedVolume Volume::placeVolume(const Volume& volume, const Rotation3D& rot) const { - return _addNode(m_element, volume, _rotation3D(rot)); + return _addNode(m_element, volume, Matrices::_rotation3D(rot)); } /// Set the volume's material @@ -559,9 +559,9 @@ const Volume& Volume::setMaterial(const Material& m) const { m_element->SetMedium(medium); return *this; } - throw runtime_error("DD4hep: Volume: Medium " + string(m.name()) + " is not registered with geometry manager."); + throw runtime_error("dd4hep: Volume: Medium " + string(m.name()) + " is not registered with geometry manager."); } - throw runtime_error("DD4hep: Volume: Attempt to assign invalid material."); + throw runtime_error("dd4hep: Volume: Attempt to assign invalid material."); } /// Access to the Volume material @@ -655,34 +655,34 @@ const Volume& Volume::setVisAttributes(const VisAttr& attr) const { } /// Set Visualization attributes to the volume -const Volume& Volume::setVisAttributes(const LCDD& lcdd, const string& nam) const { +const Volume& Volume::setVisAttributes(const Detector& description, const string& nam) const { if (!nam.empty()) { - VisAttr attr = lcdd.visAttributes(nam); + VisAttr attr = description.visAttributes(nam); setVisAttributes(attr); } else { /* string tag = this->name(); if ( ::strstr(tag.c_str(),"_slice") ) // Slices turned off by default - setVisAttributes(lcdd.visAttributes("InvisibleNoDaughters")); + setVisAttributes(description.visAttributes("InvisibleNoDaughters")); else if ( ::strstr(tag.c_str(),"_layer") ) // Layers turned off, but daughters possibly visible - setVisAttributes(lcdd.visAttributes("InvisibleWithDaughters")); + setVisAttributes(description.visAttributes("InvisibleWithDaughters")); else if ( ::strstr(tag.c_str(),"_module") ) // Tracker modules similar to layers - setVisAttributes(lcdd.visAttributes("InvisibleWithDaughters")); + setVisAttributes(description.visAttributes("InvisibleWithDaughters")); else if ( ::strstr(tag.c_str(),"_module_component") ) // Tracker modules similar to layers - setVisAttributes(lcdd.visAttributes("InvisibleNoDaughters")); + setVisAttributes(description.visAttributes("InvisibleNoDaughters")); */ } return *this; } /// Attach attributes to the volume -const Volume& Volume::setAttributes(const LCDD& lcdd, const string& rg, const string& ls, const string& vis) const { +const Volume& Volume::setAttributes(const Detector& description, const string& rg, const string& ls, const string& vis) const { if (!rg.empty()) - setRegion(lcdd.region(rg)); + setRegion(description.region(rg)); if (!ls.empty()) - setLimitSet(lcdd.limitSet(ls)); - setVisAttributes(lcdd, vis); + setLimitSet(description.limitSet(ls)); + setVisAttributes(description, vis); return *this; } @@ -706,9 +706,9 @@ Solid Volume::solid() const { } /// Set the regional attributes to the volume -const Volume& Volume::setRegion(const LCDD& lcdd, const string& nam) const { +const Volume& Volume::setRegion(const Detector& description, const string& nam) const { if (!nam.empty()) { - return setRegion(lcdd.region(nam)); + return setRegion(description.region(nam)); } return *this; } @@ -725,9 +725,9 @@ Region Volume::region() const { } /// Set the limits to the volume -const Volume& Volume::setLimitSet(const LCDD& lcdd, const string& nam) const { +const Volume& Volume::setLimitSet(const Detector& description, const string& nam) const { if (!nam.empty()) { - return setLimitSet(lcdd.limitSet(nam)); + return setLimitSet(description.limitSet(nam)); } return *this; } diff --git a/DDCore/src/WaferGridXY.cpp b/DDCore/src/WaferGridXY.cpp index 436d2721c..e365bc202 100644 --- a/DDCore/src/WaferGridXY.cpp +++ b/DDCore/src/WaferGridXY.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep; /// determine the position based on the cell ID Position WaferGridXY::position(const CellID& id) const { @@ -27,7 +27,7 @@ Position WaferGridXY::position(const CellID& id) const { } /// determine the cell ID based on the position -DD4hep::CellID WaferGridXY::cellID(const Position& local, +dd4hep::CellID WaferGridXY::cellID(const Position& local, const Position& global, const VolumeID& volID) const { diff --git a/DDCore/src/World.cpp b/DDCore/src/World.cpp index 4c48ef7f1..c847b9715 100644 --- a/DDCore/src/World.cpp +++ b/DDCore/src/World.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,12 +13,9 @@ // Framework include files #include "DD4hep/World.h" -#include "DD4hep/Printout.h" #include "DD4hep/detail/DetectorInterna.h" -using namespace DD4hep::Geometry; - /// Access the detector descrion tree -LCDD& World::lcdd() const { - return *(access()->lcdd); +dd4hep::Detector& dd4hep::World::detectorDescription() const { + return *(access()->description); } diff --git a/DDCore/src/XML/DocumentHandler.cpp b/DDCore/src/XML/DocumentHandler.cpp index f363b559c..66269ed05 100644 --- a/DDCore/src/XML/DocumentHandler.cpp +++ b/DDCore/src/XML/DocumentHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,8 +27,8 @@ #endif using namespace std; -using namespace DD4hep; -using namespace DD4hep::XML; +using namespace dd4hep; +using namespace dd4hep::xml; #ifndef __TIXML__ #include "xercesc/framework/LocalFileFormatTarget.hpp" @@ -51,10 +51,10 @@ using namespace DD4hep::XML; using namespace xercesc; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace containing utilities to parse XML files using XercesC or TinyXML - namespace XML { + namespace xml { /// XML-DOM ERror handler class for the XercesC document parser. class DocumentErrorHandler: public ErrorHandler, public DOMErrorHandler { @@ -130,15 +130,15 @@ namespace DD4hep { namespace { /// Specialized DOM parser to handle special system IDs - class DD4hepDOMParser : public XercesDOMParser { + class dd4hepDOMParser : public XercesDOMParser { /// Pointer to URI reader UriReader* m_reader; /// Xerces Error handler - DocumentErrorHandler m_errHandler; + DocumentErrorHandler m_errHandle_tr; class Resolver : public XMLEntityResolver { - DD4hepDOMParser* parser; + dd4hepDOMParser* parser; public: - Resolver(DD4hepDOMParser* p) : parser(p) {} + Resolver(dd4hepDOMParser* p) : parser(p) {} virtual ~Resolver() {} virtual InputSource *resolveEntity(XMLResourceIdentifier *id) { return parser->read_uri(id); } @@ -146,13 +146,13 @@ namespace DD4hep { Resolver m_resolver; public: /// Initializing constructor - DD4hepDOMParser(UriReader* rdr) : XercesDOMParser(), m_reader(rdr), m_resolver(this) { + dd4hepDOMParser(UriReader* rdr) : XercesDOMParser(), m_reader(rdr), m_resolver(this) { //printout(FATAL,"XercesC","+++ Creating new parser"); - setErrorHandler(&m_errHandler); + setErrorHandler(&m_errHandle_tr); setXMLEntityResolver(&m_resolver); } /// Default destructor - virtual ~DD4hepDOMParser() { + virtual ~dd4hepDOMParser() { //printout(FATAL,"XercesC","+++ Deleting new parser"); } /// Entity resolver overload to use uri reader @@ -177,7 +177,7 @@ namespace DD4hep { /// Helper function to create a XercesC pareser XercesDOMParser* make_parser(UriReader* reader=0) { - XercesDOMParser* parser = new DD4hepDOMParser(reader); + XercesDOMParser* parser = new dd4hepDOMParser(reader); parser->setValidationScheme(XercesDOMParser::Val_Auto); parser->setValidationSchemaFullChecking(true); parser->setCreateEntityReferenceNodes(false); @@ -383,9 +383,9 @@ int DocumentHandler::output(Document doc, const string& fname) const { #include "XML/tinyxml.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace containing utilities to parse XML files using XercesC or TinyXML - namespace XML { + namespace xml { /// XML-DOM ERror handler class for the TinyXML document parser (Compatibility class) class DocumentErrorHandler {}; @@ -477,9 +477,9 @@ Document DocumentHandler::load(const std::string& fname, UriReader* reader) cons doc->ErrorDesc()); printout(FATAL,"DocumentHandler","+++ Document:%s Location Line:%d Column:%d", doc->Value(), doc->ErrorRow(), doc->ErrorCol()); - except("DD4hep:XML","++ file:%s error:%s",clean.c_str(),doc->ErrorDesc()); + except("dd4hep:XML","++ file:%s error:%s",clean.c_str(),doc->ErrorDesc()); } - except("DD4hep:XML","++ Unknown error (TinyXML) while parsing:%s",fname.c_str()); + except("dd4hep:XML","++ Unknown error (TinyXML) while parsing:%s",fname.c_str()); } } catch(exception& e) { @@ -518,9 +518,9 @@ Document DocumentHandler::parse(const char* bytes, size_t /* length */, const ch printout(FATAL,"DocumentHandler", "+++ XML Document error: %s Location Line:%d Column:%d", doc->Value(), doc->ErrorRow(), doc->ErrorCol()); - throw runtime_error(string("DD4hep: ")+doc->ErrorDesc()); + throw runtime_error(string("dd4hep: ")+doc->ErrorDesc()); } - throw runtime_error("DD4hep: Unknown error while parsing XML document with TiXml."); + throw runtime_error("dd4hep: Unknown error while parsing XML document with TiXml."); } catch(exception& e) { printout(ERROR,"DocumentHandler","+++ Exception (TinyXML): parse(string):%s",e.what()); @@ -543,7 +543,7 @@ int DocumentHandler::output(Document doc, const string& fname) const { } /// Dump partial or full XML trees -void DD4hep::XML::dump_tree(Handle_t elt, ostream& os) { +void dd4hep::xml::dump_tree(Handle_t elt, ostream& os) { TiXmlNode* node = (TiXmlNode*)elt.ptr(); TiXmlPrinter printer; printer.SetStreamPrinting(); @@ -552,7 +552,7 @@ void DD4hep::XML::dump_tree(Handle_t elt, ostream& os) { } /// Dump partial or full XML documents -void DD4hep::XML::dump_tree(Document doc, ostream& os) { +void dd4hep::xml::dump_tree(Document doc, ostream& os) { TiXmlDocument* node = (TiXmlDocument*)doc.ptr(); TiXmlPrinter printer; printer.SetStreamPrinting(); @@ -572,8 +572,8 @@ DocumentHandler::~DocumentHandler() {} std::string DocumentHandler::defaultComment() { const char comment[] = "\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - " ++++ DD4hep generated alignment file using the ++++\n" - " ++++ DD4hep Detector description XML generator. ++++\n" + " ++++ dd4hep generated alignment file using the ++++\n" + " ++++ dd4hep Detector description XML generator. ++++\n" " ++++ ++++\n" " ++++ Parser:" XML_IMPLEMENTATION_TYPE @@ -638,11 +638,11 @@ Document DocumentHandler::create(const std::string& tag, const std::string& comm } /// Dump partial or full XML trees to stdout -void DD4hep::XML::dump_tree(Handle_t elt) { +void dd4hep::xml::dump_tree(Handle_t elt) { dump_tree(elt,cout); } /// Dump partial or full XML documents to stdout -void DD4hep::XML::dump_tree(Document doc) { +void dd4hep::xml::dump_tree(Document doc) { dump_tree(doc,cout); } diff --git a/DDCore/src/XML/Layering.cpp b/DDCore/src/XML/Layering.cpp index 67bea2dc4..9484eb0fe 100644 --- a/DDCore/src/XML/Layering.cpp +++ b/DDCore/src/XML/Layering.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,30 +24,8 @@ #include <cmath> using namespace std; -using namespace DD4hep; -using namespace DD4hep::XML; - -LayerSlice& LayerSlice::operator=(const LayerSlice& c) { - if (&c != this) { - _sensitive = c._sensitive; - _thickness = c._thickness; - _material = c._material; - } - return *this; -} - -Layer::Layer(const Layer& c) - : _thickness(c._thickness), _preOffset(c._preOffset), _slices(c._slices) { -} - -Layer& Layer::operator=(const Layer& c) { - if (this != &c) { - _thickness = c._thickness; - _preOffset = c._preOffset; - _slices = c._slices; - } - return *this; -} +using namespace dd4hep; +using namespace dd4hep::xml; void Layer::compute() { _thickness = 0.; @@ -59,30 +37,27 @@ double LayerStack::sectionThickness(size_t is, size_t ie) const { double thick = 0.; if (is > ie) throw runtime_error( - "LayerStack::sectionThickness: First index (" + _toString(is) + ") must be <= second index (" + _toString(ie) + ")!"); + "LayerStack::sectionThickness: First index (" + _toString(is) + ") " + "must be <= second index (" + _toString(ie) + ")!"); else if (is > _layers.size()) throw runtime_error( - "LayerStack::sectionThickness: First index (" + _toString(is) + ") out of range. #layers=" + _toString(_layers.size()) + "LayerStack::sectionThickness: First index (" + _toString(is) + ") " + "out of range. #layers=" + _toString(_layers.size()) + ")."); else if (ie > _layers.size()) throw runtime_error( - "LayerStack::sectionThickness: Second index (" + _toString(is) + ") out of range. #layers=" + _toString(_layers.size()) + "LayerStack::sectionThickness: Second index (" + _toString(is) + ") " + "out of range. #layers=" + _toString(_layers.size()) + ")."); for (size_t i = is; i <= ie; ++i) thick += _layers[i]->thicknessWithPreOffset(); return thick; } -Layering::Layering() { -} - Layering::Layering(Element e) { LayeringCnv(e).fromCompact(*this); } -Layering::~Layering() { -} - const Layer* Layering::layer(size_t which) const { return _stack.layers()[which]; } @@ -90,7 +65,7 @@ const Layer* Layering::layer(size_t which) const { void LayeringCnv::fromCompact(Layering& layering) const { vector<Layer*>& layers = layering.layers(); int count = 0; - for_each(layers.begin(), layers.end(), deletePtr<Layer>); + for_each(layers.begin(), layers.end(), detail::deletePtr<Layer>); for (Collection_t c(m_element, _U (layer)); c; ++c) { Layer lay; Component layer = c; @@ -112,7 +87,7 @@ void LayeringCnv::fromCompact(Layering& layering) const { } } -double Layering::singleLayerThickness(XML::Element e) const { +double Layering::singleLayerThickness(xml::Element e) const { Component lay = e; double thickness = 0e0; for (Collection_t s(lay, _U(slice)); s; ++s) { @@ -122,7 +97,7 @@ double Layering::singleLayerThickness(XML::Element e) const { return thickness; } -double Layering::absorberThicknessInLayer(XML::Element e) const { +double Layering::absorberThicknessInLayer(xml::Element e) const { Component lay = e; double thickness = 0e0; for (Collection_t s(lay, _U(slice)); s; ++s) { @@ -133,7 +108,7 @@ double Layering::absorberThicknessInLayer(XML::Element e) const { return thickness; } -void Layering::sensitivePositionsInLayer(XML::Element e, std::vector<double>& sens_pos) const { +void Layering::sensitivePositionsInLayer(xml::Element e, std::vector<double>& sens_pos) const { Component lay = e; double pos=-singleLayerThickness(e)/2.0; for (Collection_t s(lay, _U(slice)); s; ++s) { diff --git a/DDCore/src/XML/UriReader.cpp b/DDCore/src/XML/UriReader.cpp index a2ebf54c9..fc9054647 100644 --- a/DDCore/src/XML/UriReader.cpp +++ b/DDCore/src/XML/UriReader.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,51 +15,51 @@ #include "XML/UriReader.h" /// Default destructor -DD4hep::XML::UriReader::~UriReader() { +dd4hep::xml::UriReader::~UriReader() { } /// Resolve a given URI to a string containing the data -bool DD4hep::XML::UriReader::load(const std::string& system_id, std::string& data) { +bool dd4hep::xml::UriReader::load(const std::string& system_id, std::string& data) { return this->load(system_id, context(), data); } /// Inform reader about a locally (e.g. by XercesC) handled source load -void DD4hep::XML::UriReader::parserLoaded(const std::string& system_id) { +void dd4hep::xml::UriReader::parserLoaded(const std::string& system_id) { this->parserLoaded(system_id, context()); } /// Default constructor -DD4hep::XML::UriContextReader::UriContextReader(UriReader* reader, UriReader::UserContext* ctxt) +dd4hep::xml::UriContextReader::UriContextReader(UriReader* reader, UriReader::UserContext* ctxt) : m_reader(reader), m_context(ctxt) { } /// Copy constructor -DD4hep::XML::UriContextReader::UriContextReader(const UriContextReader& copy) +dd4hep::xml::UriContextReader::UriContextReader(const UriContextReader& copy) : m_reader(copy.m_reader), m_context(copy.m_context) { } /// Default destructor -DD4hep::XML::UriContextReader::~UriContextReader() { +dd4hep::xml::UriContextReader::~UriContextReader() { } /// Resolve a given URI to a string containing the data -bool DD4hep::XML::UriContextReader::load(const std::string& system_id, std::string& data) { +bool dd4hep::xml::UriContextReader::load(const std::string& system_id, std::string& data) { return m_reader->load(system_id, context(), data); } /// Resolve a given URI to a string containing the data -bool DD4hep::XML::UriContextReader::load(const std::string& system_id, UserContext* ctxt, std::string& data) { +bool dd4hep::xml::UriContextReader::load(const std::string& system_id, UserContext* ctxt, std::string& data) { return m_reader->load(system_id, ctxt, data); } /// Inform reader about a locally (e.g. by XercesC) handled source load -void DD4hep::XML::UriContextReader::parserLoaded(const std::string& system_id) { +void dd4hep::xml::UriContextReader::parserLoaded(const std::string& system_id) { m_reader->parserLoaded(system_id, context()); } /// Inform reader about a locally (e.g. by XercesC) handled source load -void DD4hep::XML::UriContextReader::parserLoaded(const std::string& system_id, UserContext* ctxt) { +void dd4hep::xml::UriContextReader::parserLoaded(const std::string& system_id, UserContext* ctxt) { m_reader->parserLoaded(system_id, ctxt); } diff --git a/DDCore/src/XML/Utilities.cpp b/DDCore/src/XML/Utilities.cpp index 8a343d9a7..147dda5be 100644 --- a/DDCore/src/XML/Utilities.cpp +++ b/DDCore/src/XML/Utilities.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,23 +15,23 @@ #include "XML/Utilities.h" #include "DD4hep/Printout.h" #include "DD4hep/Plugins.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; /// Create a solid shape using the plugin mechanism from the attributes of the XML element -Geometry::Solid -DD4hep::XML::createShape(Geometry::LCDD& lcdd, const std::string& shape_type, XML::Element element) { +Solid +dd4hep::xml::createShape(Detector& description, const std::string& shape_type, xml::Element element) { string fac = shape_type + "__shape_constructor"; - XML::Handle_t solid_elt = element; - Geometry::Solid solid = Geometry::Ref_t(PluginService::Create<NamedObject*>(fac, &lcdd, &solid_elt)); + xml::Handle_t solid_elt = element; + Solid solid = Ref_t(PluginService::Create<NamedObject*>(fac, &description, &solid_elt)); if ( !solid.isValid() ) { PluginDebug dbg; - PluginService::Create<NamedObject*>(shape_type, &lcdd, &solid_elt); - except("XML::createShape","Failed to create solid of type %s [%s]", + PluginService::Create<NamedObject*>(shape_type, &description, &solid_elt); + except("xml::createShape","Failed to create solid of type %s [%s]", shape_type.c_str(),dbg.missingFactory(shape_type).c_str()); } return solid; @@ -40,13 +40,13 @@ DD4hep::XML::createShape(Geometry::LCDD& lcdd, const std::string& shape_type, XM -Geometry::Volume DD4hep::XML::createPlacedEnvelope( DD4hep::Geometry::LCDD& lcdd, DD4hep::XML::Handle_t e , - DD4hep::Geometry::DetElement sdet ){ +Volume dd4hep::xml::createPlacedEnvelope( dd4hep::Detector& description, dd4hep::xml::Handle_t e , + dd4hep::DetElement sdet ){ xml_det_t x_det = e; string det_name = x_det.nameStr(); - xml_comp_t x_env = x_det.child( DD4hep::XML::Strng_t("envelope") ) ; + xml_comp_t x_env = x_det.child( dd4hep::xml::Strng_t("envelope") ) ; xml_comp_t x_shape = x_env.child( _U(shape) ); @@ -82,7 +82,7 @@ Geometry::Volume DD4hep::XML::createPlacedEnvelope( DD4hep::Geometry::LCDD& lcdd std::string(" for detector " ) + det_name ) ; } - Material env_mat = lcdd.material( x_shape.materialStr() ); + Material env_mat = description.material( x_shape.materialStr() ); envelope = Volume( det_name+"_envelope", env_solid, env_mat ); } @@ -91,7 +91,7 @@ Geometry::Volume DD4hep::XML::createPlacedEnvelope( DD4hep::Geometry::LCDD& lcdd PlacedVolume env_pv ; - Volume mother = lcdd.pickMotherVolume(sdet); + Volume mother = description.pickMotherVolume(sdet); // ---- place the envelope into the mother volume @@ -117,19 +117,19 @@ Geometry::Volume DD4hep::XML::createPlacedEnvelope( DD4hep::Geometry::LCDD& lcdd sdet.setPlacement( env_pv ) ; - envelope.setAttributes( lcdd,x_det.regionStr(),x_det.limitsStr(),x_env.visStr()); + envelope.setAttributes( description,x_det.regionStr(),x_det.limitsStr(),x_env.visStr()); return envelope ; } -void DD4hep::XML::setDetectorTypeFlag( DD4hep::XML::Handle_t e, DD4hep::Geometry::DetElement sdet ){ +void dd4hep::xml::setDetectorTypeFlag( dd4hep::xml::Handle_t e, dd4hep::DetElement sdet ){ xml_det_t x_det = e; string det_name = x_det.nameStr(); try{ - xml_comp_t x_dettype = x_det.child( DD4hep::XML::Strng_t("type_flags") ) ; + xml_comp_t x_dettype = x_det.child( dd4hep::xml::Strng_t("type_flags") ) ; unsigned int typeFlag = x_dettype.type() ; diff --git a/DDCore/src/XML/XMLElements.cpp b/DDCore/src/XML/XMLElements.cpp index 057a9f829..4d00724f0 100644 --- a/DDCore/src/XML/XMLElements.cpp +++ b/DDCore/src/XML/XMLElements.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,16 +24,16 @@ #include <map> using namespace std; -using namespace DD4hep::XML; +using namespace dd4hep::xml; static const size_t INVALID_NODE = ~0U; // Forward declarations -namespace DD4hep { +namespace dd4hep { XmlTools::Evaluator& evaluator(); } // Static storage namespace { - XmlTools::Evaluator& eval(DD4hep::evaluator()); + XmlTools::Evaluator& eval(dd4hep::evaluator()); string _checkEnviron(const string& env) { string r = getEnviron(env); return r.empty() ? env : r; @@ -90,15 +90,15 @@ namespace { return cnt; } } -XmlChar* DD4hep::XML::XmlString::replicate(const XmlChar* c) { +XmlChar* dd4hep::xml::XmlString::replicate(const XmlChar* c) { return c ? ::strdup(c) : 0; } -XmlChar* DD4hep::XML::XmlString::transcode(const char* c) {return c ? ::strdup(c) : 0; +XmlChar* dd4hep::xml::XmlString::transcode(const char* c) {return c ? ::strdup(c) : 0; } -void DD4hep::XML::XmlString::release(char** p) { +void dd4hep::xml::XmlString::release(char** p) { if(p && *p) {::free(*p); *p=0;} } -size_t DD4hep::XML::XmlString::length(const char* p) { +size_t dd4hep::xml::XmlString::length(const char* p) { return p ? ::strlen(p) : 0; } @@ -124,25 +124,25 @@ union Xml { XmlElement* xe; }; -XmlChar* DD4hep::XML::XmlString::replicate(const XmlChar* c) { +XmlChar* dd4hep::xml::XmlString::replicate(const XmlChar* c) { return xercesc::XMLString::replicate(c); } -char* DD4hep::XML::XmlString::transcode(const XmlChar* c) { +char* dd4hep::xml::XmlString::transcode(const XmlChar* c) { return xercesc::XMLString::transcode(c); } -XmlChar* DD4hep::XML::XmlString::transcode(const char* c) { +XmlChar* dd4hep::xml::XmlString::transcode(const char* c) { return xercesc::XMLString::transcode(c); } -void DD4hep::XML::XmlString::release(XmlChar** p) { +void dd4hep::xml::XmlString::release(XmlChar** p) { return xercesc::XMLString::release(p); } -void DD4hep::XML::XmlString::release(char** p) { +void dd4hep::xml::XmlString::release(char** p) { return xercesc::XMLString::release(p); } -size_t DD4hep::XML::XmlString::length(const char* p) { +size_t dd4hep::xml::XmlString::length(const char* p) { return p ? xercesc::XMLString::stringLen(p) : 0; } -size_t DD4hep::XML::XmlString::length(const XmlChar* p) { +size_t dd4hep::xml::XmlString::length(const XmlChar* p) { return p ? xercesc::XMLString::stringLen(p) : 0; } @@ -182,7 +182,7 @@ namespace { } /// Convert XML char to std::string -string DD4hep::XML::_toString(const XmlChar *toTranscode) { +string dd4hep::xml::_toString(const XmlChar *toTranscode) { char *buff = XmlString::transcode(toTranscode); string tmp(buff == 0 ? "" : buff); XmlString::release(&buff); @@ -206,7 +206,7 @@ namespace { #endif } -string DD4hep::XML::_toString(Attribute attr) { +string dd4hep::xml::_toString(Attribute attr) { if (attr) return _toString(attribute_value(attr)); return ""; @@ -219,64 +219,64 @@ template <typename T> static inline string __to_string(T value, const char* fmt) } /// Do-nothing version. Present for completeness and argument interchangeability -string DD4hep::XML::_toString(const char* s) { +string dd4hep::xml::_toString(const char* s) { if ( !s || *s == 0 ) return ""; else if ( !(*s == '$' && *(s+1) == '{') ) return s; return _checkEnviron(s); } /// Do-nothing version. Present for completeness and argument interchangeability -string DD4hep::XML::_toString(const string& s) { +string dd4hep::xml::_toString(const string& s) { if ( s.length() < 3 || s[0] != '$' ) return s; else if ( !(s[0] == '$' && s[1] == '{') ) return s; return _checkEnviron(s); } /// Format unsigned long integer to string with arbitrary format -string DD4hep::XML::_toString(unsigned long v, const char* fmt) { +string dd4hep::xml::_toString(unsigned long v, const char* fmt) { return __to_string(v, fmt); } /// Format unsigned integer (32 bits) to string with arbitrary format -string DD4hep::XML::_toString(unsigned int v, const char* fmt) { +string dd4hep::xml::_toString(unsigned int v, const char* fmt) { return __to_string(v, fmt); } /// Format signed integer (32 bits) to string with arbitrary format -string DD4hep::XML::_toString(int v, const char* fmt) { +string dd4hep::xml::_toString(int v, const char* fmt) { return __to_string(v, fmt); } /// Format signed long integer to string with arbitrary format -string DD4hep::XML::_toString(long v, const char* fmt) { +string dd4hep::xml::_toString(long v, const char* fmt) { return __to_string(v, fmt); } /// Format single procision float number (32 bits) to string with arbitrary format -string DD4hep::XML::_toString(float v, const char* fmt) { +string dd4hep::xml::_toString(float v, const char* fmt) { return __to_string(v, fmt); } /// Format double procision float number (64 bits) to string with arbitrary format -string DD4hep::XML::_toString(double v, const char* fmt) { +string dd4hep::xml::_toString(double v, const char* fmt) { return __to_string(v, fmt); } /// Convert Strng_t to std::string -string DD4hep::XML::_toString(const Strng_t& s) { +string dd4hep::xml::_toString(const Strng_t& s) { return _toString(Tag_t(s)); } /// Convert Tag_t to std::string -string DD4hep::XML::_toString(const Tag_t& s) { +string dd4hep::xml::_toString(const Tag_t& s) { return s.str(); } /// Format pointer to string with arbitrary format -string DD4hep::XML::_ptrToString(const void* v, const char* fmt) { +string dd4hep::xml::_ptrToString(const void* v, const char* fmt) { return __to_string(v, fmt); } -long DD4hep::XML::_toLong(const XmlChar* value) { +long dd4hep::xml::_toLong(const XmlChar* value) { if (value) { string s = _toString(value); size_t idx = s.find("(int)"); @@ -291,14 +291,14 @@ long DD4hep::XML::_toLong(const XmlChar* value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << s << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + s); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + s); } return (long) result; } return -1; } -int DD4hep::XML::_toInt(const XmlChar* value) { +int dd4hep::xml::_toInt(const XmlChar* value) { if (value) { string s = _toString(value); size_t idx = s.find("(int)"); @@ -310,14 +310,14 @@ int DD4hep::XML::_toInt(const XmlChar* value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << s << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + s); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + s); } return (int) result; } return -1; } -bool DD4hep::XML::_toBool(const XmlChar* value) { +bool dd4hep::xml::_toBool(const XmlChar* value) { if (value) { string s = _toString(value); return s == "true"; @@ -325,7 +325,7 @@ bool DD4hep::XML::_toBool(const XmlChar* value) { return false; } -float DD4hep::XML::_toFloat(const XmlChar* value) { +float dd4hep::xml::_toFloat(const XmlChar* value) { if (value) { string s = _toString(value); double result = eval.evaluate(s.c_str()); @@ -333,28 +333,28 @@ float DD4hep::XML::_toFloat(const XmlChar* value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << s << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + s); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + s); } return (float) result; } return 0.0; } -double DD4hep::XML::_toDouble(const XmlChar* value) { +double dd4hep::xml::_toDouble(const XmlChar* value) { if (value) { string s = _toString(value); double result = eval.evaluate(s.c_str()); if (eval.status() != XmlTools::Evaluator::OK) { cerr << s << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + s); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + s); } return result; } return 0.0; } -void DD4hep::XML::_toDictionary(const XmlChar* name, const XmlChar* value) { +void dd4hep::xml::_toDictionary(const XmlChar* name, const XmlChar* value) { string n = _toString(name).c_str(), v = _toString(value); size_t idx = v.find("(int)"); if (idx != string::npos) @@ -365,45 +365,45 @@ void DD4hep::XML::_toDictionary(const XmlChar* name, const XmlChar* value) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << v << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during expression evaluation of " + v); + throw runtime_error("dd4hep: Severe error during expression evaluation of " + v); } eval.setVariable(n.c_str(), result); } /// Helper function to populate the evaluator dictionary \ingroup DD4HEP_XML -void DD4hep::XML::_toDictionary(const XmlChar* name, const Strng_t& s) { +void dd4hep::xml::_toDictionary(const XmlChar* name, const Strng_t& s) { return _toDictionary(name, s.ptr()); } /// Helper function to populate the evaluator dictionary \ingroup DD4HEP_XML -void DD4hep::XML::_toDictionary(const XmlChar* name, const Tag_t& t) { +void dd4hep::xml::_toDictionary(const XmlChar* name, const Tag_t& t) { return _toDictionary(name, t.ptr()); } template <typename T> -void DD4hep::XML::_toDictionary(const XmlChar* name, T value) { +void dd4hep::xml::_toDictionary(const XmlChar* name, T value) { Strng_t item = _toString(value); const XmlChar* item_value = item; _toDictionary(name, item_value); } #ifndef DD4HEP_USE_TINYXML -template void DD4hep::XML::_toDictionary(const XmlChar* name, const char* value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, const char* value); #endif -template void DD4hep::XML::_toDictionary(const XmlChar* name, const Tag_t& value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, const Strng_t& value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, const string& value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, unsigned long value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, unsigned int value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, unsigned short value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, int value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, long value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, short value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, float value); -template void DD4hep::XML::_toDictionary(const XmlChar* name, double value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, const Tag_t& value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, const Strng_t& value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, const string& value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, unsigned long value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, unsigned int value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, unsigned short value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, int value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, long value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, short value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, float value); +template void dd4hep::xml::_toDictionary(const XmlChar* name, double value); /// Evaluate string constant using environment stored in the evaluator -string DD4hep::XML::getEnviron(const string& env) { +string dd4hep::xml::getEnviron(const string& env) { size_t id1 = env.find("${"); size_t id2 = env.rfind("}"); if ( id1 == string::npos || id2 == string::npos ) { @@ -415,7 +415,7 @@ string DD4hep::XML::getEnviron(const string& env) { if (eval.status() != XmlTools::Evaluator::OK) { cerr << env << ": "; eval.print_error(); - throw runtime_error("DD4hep: Severe error during environment lookup of " + env); + throw runtime_error("dd4hep: Severe error during environment lookup of " + env); } v = env.substr(0,id1); v += ret; @@ -431,68 +431,68 @@ static inline string i_add(const string& a, B b) { return r; } -Strng_t DD4hep::XML::operator+(const Strng_t& a, const string& b) { +Strng_t dd4hep::xml::operator+(const Strng_t& a, const string& b) { return _toString(a.ptr()) + b; } -Strng_t DD4hep::XML::operator+(const string& a, const Strng_t& b) { +Strng_t dd4hep::xml::operator+(const string& a, const Strng_t& b) { return a + _toString(b.ptr()); } -Strng_t DD4hep::XML::operator+(const Strng_t& a, const char* b) { +Strng_t dd4hep::xml::operator+(const Strng_t& a, const char* b) { return _toString(a.ptr()) + b; } -Strng_t DD4hep::XML::operator+(const char* a, const Strng_t& b) { +Strng_t dd4hep::xml::operator+(const char* a, const Strng_t& b) { return string(a) + _toString(b.ptr()); } -Strng_t DD4hep::XML::operator+(const Strng_t& a, const Strng_t& b) { +Strng_t dd4hep::xml::operator+(const Strng_t& a, const Strng_t& b) { return _toString(a.ptr()) + _toString(b.ptr()); } -Tag_t DD4hep::XML::operator+(const Tag_t& a, const char* b) { +Tag_t dd4hep::xml::operator+(const Tag_t& a, const char* b) { string res = a.str() + b; return Tag_t(res); } -Tag_t DD4hep::XML::operator+(const char* a, const Tag_t& b) { +Tag_t dd4hep::xml::operator+(const char* a, const Tag_t& b) { string res = a + b.str(); return Tag_t(res); } -Tag_t DD4hep::XML::operator+(const Tag_t& a, const Strng_t& b) { +Tag_t dd4hep::xml::operator+(const Tag_t& a, const Strng_t& b) { string res = a.str() + _toString(b); return Tag_t(res); } -Tag_t DD4hep::XML::operator+(const Tag_t& a, const string& b) { +Tag_t dd4hep::xml::operator+(const Tag_t& a, const string& b) { string res = a.str() + b; return Tag_t(res); } #ifndef DD4HEP_USE_TINYXML -Strng_t DD4hep::XML::operator+(const Strng_t& a, const XmlChar* b) { +Strng_t dd4hep::xml::operator+(const Strng_t& a, const XmlChar* b) { string res = _toString(a.ptr()) + _toString(b); return Tag_t(res); } -Strng_t DD4hep::XML::operator+(const XmlChar* a, const Strng_t& b) { +Strng_t dd4hep::xml::operator+(const XmlChar* a, const Strng_t& b) { string res = _toString(a) + _toString(b.ptr()); return Tag_t(res); } -Strng_t DD4hep::XML::operator+(const XmlChar* a, const string& b) { +Strng_t dd4hep::xml::operator+(const XmlChar* a, const string& b) { string res = _toString(a) + b; return Tag_t(res); } -Strng_t DD4hep::XML::operator+(const string& a, const XmlChar* b) { +Strng_t dd4hep::xml::operator+(const string& a, const XmlChar* b) { string res = a + _toString(b); return Tag_t(res); } -Tag_t DD4hep::XML::operator+(const Tag_t& a, const XmlChar* b) { +Tag_t dd4hep::xml::operator+(const Tag_t& a, const XmlChar* b) { string res = a.str() + _toString(b); return Tag_t(res); } @@ -1235,9 +1235,9 @@ size_t Collection_t::size() const { /// Helper function to throw an exception void Collection_t::throw_loop_exception(const exception& e) const { if (m_node) { - throw runtime_error(string(e.what()) + "\n" + "DD4hep: Error interpreting XML nodes of type <" + tag() + "/>"); + throw runtime_error(string(e.what()) + "\n" + "dd4hep: Error interpreting XML nodes of type <" + tag() + "/>"); } - throw runtime_error(string(e.what()) + "\n" + "DD4hep: Error interpreting collections XML nodes."); + throw runtime_error(string(e.what()) + "\n" + "dd4hep: Error interpreting collections XML nodes."); } void Collection_t::operator++() const { diff --git a/DDCore/src/XML/XMLHelpers.cpp b/DDCore/src/XML/XMLHelpers.cpp index 2b1c2e07b..d70e8384a 100644 --- a/DDCore/src/XML/XMLHelpers.cpp +++ b/DDCore/src/XML/XMLHelpers.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,10 +16,10 @@ #include "XML/XMLDimension.inl" #include "XML/XMLChildValue.inl" -using namespace DD4hep::XML; - // Instantiate here the concrete implementations -#define DD4HEP_DIMENSION_NS XML +#define DD4HEP_DIMENSION_NS xml +using namespace dd4hep::DD4HEP_DIMENSION_NS; + #include "XML/detail/Detector.imp" #include "XML/detail/Dimension.imp" #include "XML/detail/ChildValue.imp" diff --git a/DDCore/src/XML/XMLParsers.cpp b/DDCore/src/XML/XMLParsers.cpp index 1513f53dc..06d68b3c1 100644 --- a/DDCore/src/XML/XMLParsers.cpp +++ b/DDCore/src/XML/XMLParsers.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,24 +27,24 @@ #include <stdexcept> using std::string; -using namespace DD4hep; -typedef DD4hep::XML::Handle_t xml_h; -typedef DD4hep::XML::Dimension xml_dim_t; -typedef DD4hep::XML::Collection_t xml_coll_t; +using namespace dd4hep; +typedef dd4hep::xml::Handle_t xml_h; +typedef dd4hep::xml::Dimension xml_dim_t; +typedef dd4hep::xml::Collection_t xml_coll_t; namespace { PrintLevel s_print = DEBUG; } /// Set debug level for this module. Default is OFF -bool DD4hep::XML::setXMLParserDebug(bool value) { +bool dd4hep::xml::setXMLParserDebug(bool value) { bool old = s_print==ALWAYS; s_print = value ? ALWAYS : DEBUG; return old; } -/// Convert rotation XML objects to DD4hep::Geometry::RotationZYX -void DD4hep::XML::parse(xml_h e, Geometry::RotationZYX& rot) { +/// Convert rotation XML objects to dd4hep::RotationZYX +void dd4hep::xml::parse(xml_h e, RotationZYX& rot) { xml_dim_t r(e); rot.SetComponents(r.z(), r.y(), r.x()); printout(s_print,"<rotation>", @@ -52,28 +52,27 @@ void DD4hep::XML::parse(xml_h e, Geometry::RotationZYX& rot) { r.x(), r.y(), r.z(), rot.Phi(), rot.Psi(), rot.Theta()); } -/// Convert XML position objects to DD4hep::Geometry::Position -void DD4hep::XML::parse(xml_h e, Geometry::Position& pos) { +/// Convert XML position objects to dd4hep::Position +void dd4hep::xml::parse(xml_h e, Position& pos) { xml_dim_t p(e); pos.SetXYZ(p.x(), p.y(), p.z()); printout(s_print,"<position>"," Position: x=%9.3f y=%9.3f z=%9.3f", pos.X(), pos.Y(), pos.Z()); } -/// Convert XML pivot objects to DD4hep::Geometry::Translation3D objects -void DD4hep::XML::parse(xml_h e, Geometry::Translation3D& tr) { +/// Convert XML pivot objects to dd4hep::Translation3D objects +void dd4hep::xml::parse(xml_h e, Translation3D& tr) { xml_dim_t p(e); double x,y,z; tr.SetXYZ(x=p.x(), y=p.y(), z=p.z()); printout(s_print,"<translation>"," Pivot: x=%9.3f y=%9.3f z=%9.3f",x,y,z); } -/// Convert alignment delta objects to Alignments::Delta -void DD4hep::XML::parse(xml_h e, Alignments::Delta& delta) { - using Alignments::Delta; - Geometry::Position pos; - Geometry::RotationZYX rot; - Geometry::Translation3D piv; +/// Convert alignment delta objects to Delta +void dd4hep::xml::parse(xml_h e, Delta& delta) { + Position pos; + RotationZYX rot; + Translation3D piv; xml_h child_rot, child_pos, child_piv; if ( (child_pos=e.child(_U(position),false)) ) @@ -96,37 +95,37 @@ void DD4hep::XML::parse(xml_h e, Alignments::Delta& delta) { } /// Parse delta into an opaque data block -void DD4hep::XML::parse_delta(Handle_t e, OpaqueDataBlock& block) { - Alignments::Delta& delta = block.bind<Alignments::Delta>(); +void dd4hep::xml::parse_delta(Handle_t e, OpaqueDataBlock& block) { + Delta& delta = block.bind<Delta>(); parse(e, delta); } /// Converts opaque maps to OpaqueDataBlock objects -void DD4hep::XML::parse_mapping(xml_h e, OpaqueDataBlock& b) { +void dd4hep::xml::parse_mapping(xml_h e, OpaqueDataBlock& b) { string val_type = e.attr<string>(_U(value)); string key_type = e.attr<string>(_U(key)); - MapBinder binder; + detail::MapBinder binder; - OpaqueDataBinder::bind_map(binder, b, key_type, val_type); + detail::OpaqueDataBinder::bind_map(binder, b, key_type, val_type); for(xml_coll_t i(e,_U(item)); i; ++i) { // If explicit key, value data are present in attributes: if ( i.hasAttr(_U(key)) && i.hasAttr(_U(value)) ) { string key = i.attr<string>(_U(key)); string val = i.attr<string>(_U(value)); - OpaqueDataBinder::insert_map(binder, b, key_type, key, val_type, val); + detail::OpaqueDataBinder::insert_map(binder, b, key_type, key, val_type, val); continue; } // Otherwise interprete the data directly from the data content - OpaqueDataBinder::insert_map(binder, b, key_type, val_type, i.text()); + detail::OpaqueDataBinder::insert_map(binder, b, key_type, val_type, i.text()); } } /// Converts linear STL containers from their string representation. -void DD4hep::XML::parse_sequence(xml_h e, OpaqueDataBlock& block) { +void dd4hep::xml::parse_sequence(xml_h e, OpaqueDataBlock& block) { xml_dim_t elt(e); string typ = elt.typeStr(); string val = elt.hasAttr(_U(value)) ? elt.valueStr() : elt.text(); - if ( !OpaqueDataBinder::bind_sequence(block, typ, val) ) { + if ( !detail::OpaqueDataBinder::bind_sequence(block, typ, val) ) { except("XMLParsers", "++ Failed to convert unknown sequence conditions type: %s",typ.c_str()); } diff --git a/DDCore/src/XML/XMLTags.cpp b/DDCore/src/XML/XMLTags.cpp index ea04bb4f8..4ec2a13ce 100644 --- a/DDCore/src/XML/XMLTags.cpp +++ b/DDCore/src/XML/XMLTags.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,7 +26,7 @@ namespace { struct __Init { - typedef std::map<std::string,DD4hep::XML::Tag_t*> Inventory_t; + typedef std::map<std::string,dd4hep::xml::Tag_t*> Inventory_t; Inventory_t m_inventory; __Init() { #ifndef __TIXML__ @@ -46,10 +46,10 @@ namespace { xercesc::XMLPlatformUtils::Terminate(); #endif } - static void register_tag(const std::string& name, DD4hep::XML::Tag_t* tag); + static void register_tag(const std::string& name, dd4hep::xml::Tag_t* tag); }; __Init __In__; - void __Init::register_tag(const std::string& name, DD4hep::XML::Tag_t* tag) { + void __Init::register_tag(const std::string& name, dd4hep::xml::Tag_t* tag) { Inventory_t::const_iterator i = __In__.m_inventory.find(name); if ( i != __In__.m_inventory.end() ) { std::string err = "XMLTags: Failed to register XML tag: "+name+". [Tag already exists]"; @@ -62,16 +62,16 @@ namespace { #define UNICODE(x) extern const Tag_t Unicode_##x (#x, #x, __Init::register_tag) /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities - namespace XML { + namespace xml { #include "XML/UnicodeValues.h" } } -namespace DD4hep { - namespace XML { +namespace dd4hep { + namespace xml { extern const Tag_t Unicode_NULL("NULL", "0", __Init::register_tag); extern const Tag_t Unicode_empty("", "", __Init::register_tag); diff --git a/DDCore/src/XML/tinyxml_inl.h b/DDCore/src/XML/tinyxml_inl.h index 6d9c6272b..b94ee23f0 100644 --- a/DDCore/src/XML/tinyxml_inl.h +++ b/DDCore/src/XML/tinyxml_inl.h @@ -1095,7 +1095,7 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) ++p; } } - // Handle any left over characters. + // Handle_t any left over characters. if ( p-lastPos ) { data.append( lastPos, p-lastPos ); } @@ -1653,55 +1653,55 @@ std::string& operator<< (std::string& out, const TiXmlNode& base ) #endif -TiXmlHandle TiXmlHandle::FirstChild() const +TiXmlHandle_t TiXmlHandle_t::FirstChild() const { if ( node ) { TiXmlNode* child = node->FirstChild(); if ( child ) - return TiXmlHandle( child ); + return TiXmlHandle_t( child ); } - return TiXmlHandle( 0 ); + return TiXmlHandle_t( 0 ); } -TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const +TiXmlHandle_t TiXmlHandle_t::FirstChild( const char * value ) const { if ( node ) { TiXmlNode* child = node->FirstChild( value ); if ( child ) - return TiXmlHandle( child ); + return TiXmlHandle_t( child ); } - return TiXmlHandle( 0 ); + return TiXmlHandle_t( 0 ); } -TiXmlHandle TiXmlHandle::FirstChildElement() const +TiXmlHandle_t TiXmlHandle_t::FirstChildElement() const { if ( node ) { TiXmlElement* child = node->FirstChildElement(); if ( child ) - return TiXmlHandle( child ); + return TiXmlHandle_t( child ); } - return TiXmlHandle( 0 ); + return TiXmlHandle_t( 0 ); } -TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const +TiXmlHandle_t TiXmlHandle_t::FirstChildElement( const char * value ) const { if ( node ) { TiXmlElement* child = node->FirstChildElement( value ); if ( child ) - return TiXmlHandle( child ); + return TiXmlHandle_t( child ); } - return TiXmlHandle( 0 ); + return TiXmlHandle_t( 0 ); } -TiXmlHandle TiXmlHandle::Child( int count ) const +TiXmlHandle_t TiXmlHandle_t::Child( int count ) const { if ( node ) { @@ -1714,13 +1714,13 @@ TiXmlHandle TiXmlHandle::Child( int count ) const // nothing } if ( child ) - return TiXmlHandle( child ); + return TiXmlHandle_t( child ); } - return TiXmlHandle( 0 ); + return TiXmlHandle_t( 0 ); } -TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const +TiXmlHandle_t TiXmlHandle_t::Child( const char* value, int count ) const { if ( node ) { @@ -1733,13 +1733,13 @@ TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const // nothing } if ( child ) - return TiXmlHandle( child ); + return TiXmlHandle_t( child ); } - return TiXmlHandle( 0 ); + return TiXmlHandle_t( 0 ); } -TiXmlHandle TiXmlHandle::ChildElement( int count ) const +TiXmlHandle_t TiXmlHandle_t::ChildElement( int count ) const { if ( node ) { @@ -1752,13 +1752,13 @@ TiXmlHandle TiXmlHandle::ChildElement( int count ) const // nothing } if ( child ) - return TiXmlHandle( child ); + return TiXmlHandle_t( child ); } - return TiXmlHandle( 0 ); + return TiXmlHandle_t( 0 ); } -TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const +TiXmlHandle_t TiXmlHandle_t::ChildElement( const char* value, int count ) const { if ( node ) { @@ -1771,9 +1771,9 @@ TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const // nothing } if ( child ) - return TiXmlHandle( child ); + return TiXmlHandle_t( child ); } - return TiXmlHandle( 0 ); + return TiXmlHandle_t( 0 ); } diff --git a/DDCore/src/XML/tinyxmlparser_inl.h b/DDCore/src/XML/tinyxmlparser_inl.h index 922e6e9a5..9a0ade46b 100644 --- a/DDCore/src/XML/tinyxmlparser_inl.h +++ b/DDCore/src/XML/tinyxmlparser_inl.h @@ -1161,7 +1161,7 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc return 0; } - // Handle the strange case of double attributes: + // Handle_t the strange case of double attributes: #ifdef TIXML_USE_STL TiXmlAttribute* node = attributeSet.Find( attrib->NameTStr() ); #else diff --git a/DDCore/src/parsers/Evaluators.cpp b/DDCore/src/parsers/Evaluators.cpp index 47fc0c781..eef10dbcb 100644 --- a/DDCore/src/parsers/Evaluators.cpp +++ b/DDCore/src/parsers/Evaluators.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,12 +16,12 @@ #define DD4HEP_NEED_EVALUATOR // This is the case, if the parsers are externalized -// and the DD4hep namespace is renamed! +// and the dd4hep namespace is renamed! #include DD4HEP_PARSER_HEADER #else -// Standard DD4hep parser handling +// Standard dd4hep parser handling #include "DD4hep/ToStream.h" #endif @@ -30,15 +30,15 @@ // C/C++ include files #include <stdexcept> -namespace DD4hep { +namespace dd4hep { XmlTools::Evaluator& g4Evaluator(); } namespace { - XmlTools::Evaluator& eval(DD4hep::g4Evaluator()); + XmlTools::Evaluator& eval(dd4hep::g4Evaluator()); } //============================================================================== -namespace DD4hep { namespace Parsers { +namespace dd4hep { namespace Parsers { template <typename T> T evaluate_string(const std::string& /* value */) { throw "Bad undefined call"; } @@ -48,7 +48,7 @@ namespace DD4hep { namespace Parsers { if (eval.status() != XmlTools::Evaluator::OK) { std::cerr << value << ": "; eval.print_error(); - throw std::runtime_error("DD4hep::Properties: Severe error during expression evaluation of " + value); + throw std::runtime_error("dd4hep::Properties: Severe error during expression evaluation of " + value); } return result; } @@ -57,7 +57,7 @@ namespace DD4hep { namespace Parsers { if (eval.status() != XmlTools::Evaluator::OK) { std::cerr << value << ": "; eval.print_error(); - throw std::runtime_error("DD4hep::Properties: Severe error during expression evaluation of " + value); + throw std::runtime_error("dd4hep::Properties: Severe error during expression evaluation of " + value); } return (float) result; } diff --git a/DDCore/src/parsers/GrammarsV2.h b/DDCore/src/parsers/GrammarsV2.h index 89cd396cc..bbb86b778 100644 --- a/DDCore/src/parsers/GrammarsV2.h +++ b/DDCore/src/parsers/GrammarsV2.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -42,7 +42,7 @@ #include <boost/spirit/repository/include/qi_confix.hpp> //============================================================================== -namespace DD4hep { namespace Parsers { +namespace dd4hep { namespace Parsers { //============================================================================== // Namespace aliases: //============================================================================== @@ -371,7 +371,7 @@ namespace DD4hep { namespace Parsers { }; // END KeyValueGrammar // We don't register KeyalueGrammar because it's a special parser // ============================================================================ - }} // DD4hep::Parsers + }} // dd4hep::Parsers //============================================================================== @@ -380,7 +380,7 @@ namespace DD4hep { namespace Parsers { #include "Math/Vector3D.h" #include "Math/Vector4D.h" -namespace DD4hep { namespace Parsers { +namespace dd4hep { namespace Parsers { // ============================================================================ template< typename Iterator, typename PointT, typename Skipper> @@ -496,7 +496,7 @@ namespace DD4hep { namespace Parsers { typedef Pnt4DGrammar<Iterator, ROOT::Math::LorentzVector<T1>, Skipper> Grammar; }; // ============================================================================ - }} // DD4hep::Parsers + }} // dd4hep::Parsers #endif //============================================================================ #endif diff --git a/DDCore/src/parsers/ParserStandardList_Mapint_bool.cpp b/DDCore/src/parsers/ParserStandardList_Mapint_bool.cpp index bdf1712ea..5da178df7 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapint_bool.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapint_bool.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,6 +10,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,int,bool) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapint_double.cpp b/DDCore/src/parsers/ParserStandardList_Mapint_double.cpp index d00e0a973..372bcbd72 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapint_double.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapint_double.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,6 +10,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,int,double) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapint_float.cpp b/DDCore/src/parsers/ParserStandardList_Mapint_float.cpp index c64853232..4fc4cabc6 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapint_float.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapint_float.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapint_float.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,int,float) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapint_int.cpp b/DDCore/src/parsers/ParserStandardList_Mapint_int.cpp index 78f3f82ed..f92fa302c 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapint_int.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapint_int.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapint_int.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,int,int) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapint_long.cpp b/DDCore/src/parsers/ParserStandardList_Mapint_long.cpp index 1f4d3bb5c..27e52a9fd 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapint_long.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapint_long.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapint_long.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,int,long) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapint_string.cpp b/DDCore/src/parsers/ParserStandardList_Mapint_string.cpp index 13b0bec08..62dd72d00 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapint_string.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapint_string.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapint_string.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,int,std::string) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapped_bool.cpp b/DDCore/src/parsers/ParserStandardList_Mapped_bool.cpp index 5062a74d8..b3e0f2f0f 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapped_bool.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapped_bool.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapped_bool.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_MAPPED_PARSERS(pair,bool) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapped_double.cpp b/DDCore/src/parsers/ParserStandardList_Mapped_double.cpp index 378ce13ea..bd5428f5a 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapped_double.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapped_double.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapped_double.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_MAPPED_PARSERS(pair,double) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapped_float.cpp b/DDCore/src/parsers/ParserStandardList_Mapped_float.cpp index 77bc0e921..92178bbdc 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapped_float.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapped_float.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapped_float.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_MAPPED_PARSERS(pair,float) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapped_int.cpp b/DDCore/src/parsers/ParserStandardList_Mapped_int.cpp index 9e51c4731..418e7ed2d 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapped_int.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapped_int.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapped_int.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_MAPPED_PARSERS(pair,int) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapped_long.cpp b/DDCore/src/parsers/ParserStandardList_Mapped_long.cpp index 415360f81..c1540f7c8 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapped_long.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapped_long.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapped_long.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_MAPPED_PARSERS(pair,long) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapped_string.cpp b/DDCore/src/parsers/ParserStandardList_Mapped_string.cpp index 2b85b89de..18f703873 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapped_string.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapped_string.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapped_string.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_MAPPED_PARSERS(pair,std::string) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapstring_bool.cpp b/DDCore/src/parsers/ParserStandardList_Mapstring_bool.cpp index b65fa263c..9428191eb 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapstring_bool.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapstring_bool.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapstring_bool.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,std::string,bool) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapstring_double.cpp b/DDCore/src/parsers/ParserStandardList_Mapstring_double.cpp index 1069c3987..8a7e2d0f5 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapstring_double.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapstring_double.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapstring_double.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,std::string,double) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapstring_float.cpp b/DDCore/src/parsers/ParserStandardList_Mapstring_float.cpp index 215867a58..a05159389 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapstring_float.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapstring_float.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapstring_float.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,std::string,float) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapstring_int.cpp b/DDCore/src/parsers/ParserStandardList_Mapstring_int.cpp index aae0436f4..2aa4f24fd 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapstring_int.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapstring_int.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapstring_int.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,std::string,int) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapstring_long.cpp b/DDCore/src/parsers/ParserStandardList_Mapstring_long.cpp index 70601bdda..76051cc46 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapstring_long.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapstring_long.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapstring_long.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,std::string,long) }} diff --git a/DDCore/src/parsers/ParserStandardList_Mapstring_string.cpp b/DDCore/src/parsers/ParserStandardList_Mapstring_string.cpp index 815bdc05c..ab2a2734b 100644 --- a/DDCore/src/parsers/ParserStandardList_Mapstring_string.cpp +++ b/DDCore/src/parsers/ParserStandardList_Mapstring_string.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_Mapstring_string.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,std::string,std::string) }} diff --git a/DDCore/src/parsers/ParserStandardList_list_bool.cpp b/DDCore/src/parsers/ParserStandardList_list_bool.cpp index 57211c4f8..bb9aa026b 100644 --- a/DDCore/src/parsers/ParserStandardList_list_bool.cpp +++ b/DDCore/src/parsers/ParserStandardList_list_bool.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_list_bool.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::list,bool) }} diff --git a/DDCore/src/parsers/ParserStandardList_list_double.cpp b/DDCore/src/parsers/ParserStandardList_list_double.cpp index 0569d65fe..da6cb55cc 100644 --- a/DDCore/src/parsers/ParserStandardList_list_double.cpp +++ b/DDCore/src/parsers/ParserStandardList_list_double.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_list_double.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::list,double) }} diff --git a/DDCore/src/parsers/ParserStandardList_list_float.cpp b/DDCore/src/parsers/ParserStandardList_list_float.cpp index 69157cd58..d53d37290 100644 --- a/DDCore/src/parsers/ParserStandardList_list_float.cpp +++ b/DDCore/src/parsers/ParserStandardList_list_float.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_list_float.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::list,float) }} diff --git a/DDCore/src/parsers/ParserStandardList_list_int.cpp b/DDCore/src/parsers/ParserStandardList_list_int.cpp index 4046c477d..a697939ac 100644 --- a/DDCore/src/parsers/ParserStandardList_list_int.cpp +++ b/DDCore/src/parsers/ParserStandardList_list_int.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_list_int.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::list,int) }} diff --git a/DDCore/src/parsers/ParserStandardList_list_long.cpp b/DDCore/src/parsers/ParserStandardList_list_long.cpp index 4833f9b54..6912b4b9d 100644 --- a/DDCore/src/parsers/ParserStandardList_list_long.cpp +++ b/DDCore/src/parsers/ParserStandardList_list_long.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_list_long.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::list,long) }} diff --git a/DDCore/src/parsers/ParserStandardList_list_string.cpp b/DDCore/src/parsers/ParserStandardList_list_string.cpp index c39aba3cb..3e15719eb 100644 --- a/DDCore/src/parsers/ParserStandardList_list_string.cpp +++ b/DDCore/src/parsers/ParserStandardList_list_string.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_list_string.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::list,std::string) }} diff --git a/DDCore/src/parsers/ParserStandardList_set_bool.cpp b/DDCore/src/parsers/ParserStandardList_set_bool.cpp index 60c2b56b5..ef742afde 100644 --- a/DDCore/src/parsers/ParserStandardList_set_bool.cpp +++ b/DDCore/src/parsers/ParserStandardList_set_bool.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_set_bool.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::set,bool) }} diff --git a/DDCore/src/parsers/ParserStandardList_set_double.cpp b/DDCore/src/parsers/ParserStandardList_set_double.cpp index dcc952f80..fc9affd32 100644 --- a/DDCore/src/parsers/ParserStandardList_set_double.cpp +++ b/DDCore/src/parsers/ParserStandardList_set_double.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_set_double.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::set,double) }} diff --git a/DDCore/src/parsers/ParserStandardList_set_float.cpp b/DDCore/src/parsers/ParserStandardList_set_float.cpp index 06706be40..f5ad768fa 100644 --- a/DDCore/src/parsers/ParserStandardList_set_float.cpp +++ b/DDCore/src/parsers/ParserStandardList_set_float.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_set_float.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::set,float) }} diff --git a/DDCore/src/parsers/ParserStandardList_set_int.cpp b/DDCore/src/parsers/ParserStandardList_set_int.cpp index 5155901d0..4fdbb4845 100644 --- a/DDCore/src/parsers/ParserStandardList_set_int.cpp +++ b/DDCore/src/parsers/ParserStandardList_set_int.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_set_int.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::set,int) }} diff --git a/DDCore/src/parsers/ParserStandardList_set_long.cpp b/DDCore/src/parsers/ParserStandardList_set_long.cpp index 76bcb87e4..f6437283b 100644 --- a/DDCore/src/parsers/ParserStandardList_set_long.cpp +++ b/DDCore/src/parsers/ParserStandardList_set_long.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_set_long.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::set,long) }} diff --git a/DDCore/src/parsers/ParserStandardList_set_string.cpp b/DDCore/src/parsers/ParserStandardList_set_string.cpp index f9672785c..f0424935c 100644 --- a/DDCore/src/parsers/ParserStandardList_set_string.cpp +++ b/DDCore/src/parsers/ParserStandardList_set_string.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_set_string.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::set,std::string) }} diff --git a/DDCore/src/parsers/ParserStandardList_vector_bool.cpp b/DDCore/src/parsers/ParserStandardList_vector_bool.cpp index 8351f08ad..a6a015e5f 100644 --- a/DDCore/src/parsers/ParserStandardList_vector_bool.cpp +++ b/DDCore/src/parsers/ParserStandardList_vector_bool.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_vector_bool.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::vector,bool) }} diff --git a/DDCore/src/parsers/ParserStandardList_vector_double.cpp b/DDCore/src/parsers/ParserStandardList_vector_double.cpp index d25a8d440..3020da1cd 100644 --- a/DDCore/src/parsers/ParserStandardList_vector_double.cpp +++ b/DDCore/src/parsers/ParserStandardList_vector_double.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_vector_double.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::vector,double) }} diff --git a/DDCore/src/parsers/ParserStandardList_vector_float.cpp b/DDCore/src/parsers/ParserStandardList_vector_float.cpp index c4a603980..7d887f2d5 100644 --- a/DDCore/src/parsers/ParserStandardList_vector_float.cpp +++ b/DDCore/src/parsers/ParserStandardList_vector_float.cpp @@ -1,6 +1,6 @@ // $Id: ParserStandardList_vector_float.cpp 2166 2016-03-17 16:37:06Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::vector,float) }} diff --git a/DDCore/src/parsers/ParserStandardList_vector_int.cpp b/DDCore/src/parsers/ParserStandardList_vector_int.cpp index 39f8ce770..299141d15 100644 --- a/DDCore/src/parsers/ParserStandardList_vector_int.cpp +++ b/DDCore/src/parsers/ParserStandardList_vector_int.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,6 +10,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::vector,int) }} diff --git a/DDCore/src/parsers/ParserStandardList_vector_long.cpp b/DDCore/src/parsers/ParserStandardList_vector_long.cpp index d7772379d..f40131997 100644 --- a/DDCore/src/parsers/ParserStandardList_vector_long.cpp +++ b/DDCore/src/parsers/ParserStandardList_vector_long.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,6 +10,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::vector,long) }} diff --git a/DDCore/src/parsers/ParserStandardList_vector_string.cpp b/DDCore/src/parsers/ParserStandardList_vector_string.cpp index f5ab9c627..5a674529a 100644 --- a/DDCore/src/parsers/ParserStandardList_vector_string.cpp +++ b/DDCore/src/parsers/ParserStandardList_vector_string.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,6 +10,6 @@ //========================================================================== #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(std::vector,std::string) }} diff --git a/DDCore/src/parsers/ParsersFactory.h b/DDCore/src/parsers/ParsersFactory.h index ea16ecabc..f232ce76b 100644 --- a/DDCore/src/parsers/ParsersFactory.h +++ b/DDCore/src/parsers/ParsersFactory.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,13 +24,13 @@ #include <boost/mpl/assert.hpp> #include <boost/type_traits.hpp> // ============================================================================ -// DD4hep +// dd4hep // ============================================================================ #include "UsedParser.h" #include "GrammarsV2.h" // ============================================================================ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector for utilities using boost::spirit parsers namespace Parsers { @@ -61,15 +61,15 @@ namespace DD4hep { //========================================================================= } // end of namespace Parsers -} // end of namespace DD4hep +} // end of namespace dd4hep //============================================================================= // ============================================================================ #define PARSERS_DEF_FOR_SINGLE(Type) \ PARSERS_DECL_FOR_SINGLE(Type) \ - int DD4hep::Parsers::parse(Type& result, const std::string& input) \ - { return DD4hep::Parsers::parse_(result, input); } + int dd4hep::Parsers::parse(Type& result, const std::string& input) \ + { return dd4hep::Parsers::parse_(result, input); } // ============================================================================ #endif // DD4HEPPROPERTYPARSERS_PARSERSGENERATOR_H diff --git a/DDCore/src/parsers/ParsersObjects_PxPyPzEVector.cpp b/DDCore/src/parsers/ParsersObjects_PxPyPzEVector.cpp index bd1940e43..e2747bd23 100644 --- a/DDCore/src/parsers/ParsersObjects_PxPyPzEVector.cpp +++ b/DDCore/src/parsers/ParsersObjects_PxPyPzEVector.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,7 +25,7 @@ namespace ROOT { namespace Math { }} // ============================================================================ -namespace DD4hep { +namespace dd4hep { namespace Parsers { int parse(ROOT::Math::PxPyPzEVector& result, const std::string& input) { diff --git a/DDCore/src/parsers/ParsersObjects_XYZPoint.cpp b/DDCore/src/parsers/ParsersObjects_XYZPoint.cpp index 0ab9f44cb..38af26205 100644 --- a/DDCore/src/parsers/ParsersObjects_XYZPoint.cpp +++ b/DDCore/src/parsers/ParsersObjects_XYZPoint.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +23,7 @@ namespace ROOT { namespace Math { } }} // ============================================================================ -namespace DD4hep { +namespace dd4hep { namespace Parsers { // ========================================================================== diff --git a/DDCore/src/parsers/ParsersObjects_XYZVector.cpp b/DDCore/src/parsers/ParsersObjects_XYZVector.cpp index eda3a701e..e848371f0 100644 --- a/DDCore/src/parsers/ParsersObjects_XYZVector.cpp +++ b/DDCore/src/parsers/ParsersObjects_XYZVector.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,7 +28,7 @@ template struct std::less<ROOT::Math::XYZVector>; template struct std::less<ROOT::Math::PxPyPzEVector>; // ============================================================================ -namespace DD4hep { +namespace dd4hep { namespace Parsers { // ========================================================================== diff --git a/DDCore/src/parsers/ParsersStandardListCommon.h b/DDCore/src/parsers/ParsersStandardListCommon.h index 76470c0fe..3271114bd 100644 --- a/DDCore/src/parsers/ParsersStandardListCommon.h +++ b/DDCore/src/parsers/ParsersStandardListCommon.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -56,13 +56,13 @@ // ============================================================================ #define PARSERS_DEF_FOR_LIST(InnerType) \ - namespace DD4hep{ namespace Parsers{ \ + namespace dd4hep{ namespace Parsers{ \ IMPLEMENT_STL_PARSERS(InnerType) \ IMPLEMENT_MAPPED_PARSERS(pair,InnerType) }} #ifndef DD4HEP_PARSERS_NO_ROOT // ============================================================================ -namespace DD4hep { +namespace dd4hep { namespace Parsers { // ======================================================================== template<typename T1, typename T2> inline int diff --git a/DDCore/src/parsers/ParsersStandardMisc1.cpp b/DDCore/src/parsers/ParsersStandardMisc1.cpp index 3af30b632..25bc57b99 100644 --- a/DDCore/src/parsers/ParsersStandardMisc1.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc1.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,18 +11,18 @@ //========================================================================== #include "ParsersStandardMiscCommon.h" -int DD4hep::Parsers::parse(std::pair<double,double>& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::pair<double,double>& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } -int DD4hep::Parsers::parse(std::vector<std::pair<double, double> >& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::vector<std::pair<double, double> >& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } -int DD4hep::Parsers::parse(std::vector<std::pair<int, int> >& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::vector<std::pair<int, int> >& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } -int DD4hep::Parsers::parse(std::vector<std::vector<std::string> >& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::vector<std::vector<std::string> >& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } diff --git a/DDCore/src/parsers/ParsersStandardMisc2.cpp b/DDCore/src/parsers/ParsersStandardMisc2.cpp index bab51bb23..d8360d887 100644 --- a/DDCore/src/parsers/ParsersStandardMisc2.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc2.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardMiscCommon.h" -int DD4hep::Parsers::parse(std::vector<std::vector<double> >& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::vector<std::vector<double> >& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } diff --git a/DDCore/src/parsers/ParsersStandardMisc3.cpp b/DDCore/src/parsers/ParsersStandardMisc3.cpp index 873302446..6aaae862d 100644 --- a/DDCore/src/parsers/ParsersStandardMisc3.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc3.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,6 +11,6 @@ //========================================================================== #include "ParsersStandardMiscCommon.h" -int DD4hep::Parsers::parse(std::map<std::string, std::vector<std::string> >& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::map<std::string, std::vector<std::string> >& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } diff --git a/DDCore/src/parsers/ParsersStandardMisc4.cpp b/DDCore/src/parsers/ParsersStandardMisc4.cpp index d1908c61b..e9ddccc89 100644 --- a/DDCore/src/parsers/ParsersStandardMisc4.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc4.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,10 +11,10 @@ //========================================================================== #include "ParsersStandardMiscCommon.h" -int DD4hep::Parsers::parse(std::map<std::string, std::vector<int> >& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::map<std::string, std::vector<int> >& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } -int DD4hep::Parsers::parse(std::map<std::string, std::vector<double> >& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::map<std::string, std::vector<double> >& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } diff --git a/DDCore/src/parsers/ParsersStandardMisc5.cpp b/DDCore/src/parsers/ParsersStandardMisc5.cpp index ab449db2b..7cc009a31 100644 --- a/DDCore/src/parsers/ParsersStandardMisc5.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc5.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,12 +11,12 @@ #include "ParsersStandardMiscCommon.h" #if defined(DD4HEP_HAVE_ALL_PARSERS) -int DD4hep::Parsers::parse(std::map<unsigned int, std::string>& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::map<unsigned int, std::string>& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } #endif -int DD4hep::Parsers::parse(std::string& name, std::string& value, const std::string& input ) { +int dd4hep::Parsers::parse(std::string& name, std::string& value, const std::string& input ) { Skipper skipper; KeyValueGrammar<IteratorT, Skipper> g; KeyValueGrammar<IteratorT, Skipper>::ResultT result; @@ -30,6 +30,6 @@ int DD4hep::Parsers::parse(std::string& name, std::string& value, const std::str return parse_result; } -int DD4hep::Parsers::parse(std::map<std::string, std::pair<double, double> >& result, const std::string& input) { - return DD4hep::Parsers::parse_(result, input); +int dd4hep::Parsers::parse(std::map<std::string, std::pair<double, double> >& result, const std::string& input) { + return dd4hep::Parsers::parse_(result, input); } diff --git a/DDCore/src/parsers/ParsersStandardMiscCommon.h b/DDCore/src/parsers/ParsersStandardMiscCommon.h index b8fa5392c..9df29330c 100644 --- a/DDCore/src/parsers/ParsersStandardMiscCommon.h +++ b/DDCore/src/parsers/ParsersStandardMiscCommon.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDCore/src/parsers/ParsersStandardSingle.cpp b/DDCore/src/parsers/ParsersStandardSingle.cpp index 4722847f8..849aef7d9 100644 --- a/DDCore/src/parsers/ParsersStandardSingle.cpp +++ b/DDCore/src/parsers/ParsersStandardSingle.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDCore/src/parsers/UsedParser.h b/DDCore/src/parsers/UsedParser.h index 978e82a7f..92ad04567 100644 --- a/DDCore/src/parsers/UsedParser.h +++ b/DDCore/src/parsers/UsedParser.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,12 +14,12 @@ #if defined(DD4HEP_PARSER_HEADER) // This is the case, if the parsers are externalized -// and the DD4hep namespace is renamed! +// and the dd4hep namespace is renamed! #include DD4HEP_PARSER_HEADER #else -// Standard DD4hep parser handling +// Standard dd4hep parser handling #include "DD4hep/Parsers.h" #include "DD4hep/ToStream.h" diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index 7fe25b46d..b0b1212f9 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -36,23 +36,20 @@ #include <set> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; + +namespace dd4hep { + class Debug; + class Isotope; + class Plugin; + class Compact; + class Includes; + class GdmlFile; + class Property; + class XMLFile; + class JsonFile; + class DetElementInclude; -namespace DD4hep { - namespace Geometry { - class Debug; - class Isotope; - class Plugin; - class Compact; - class Includes; - class GdmlFile; - class Property; - class XMLFile; - class JsonFile; - class AlignmentFile; - class DetElementInclude {}; - } template <> void Converter<Debug>::operator()(xml_h element) const; template <> void Converter<Plugin>::operator()(xml_h element) const; template <> void Converter<Constant>::operator()(xml_h element) const; @@ -60,7 +57,6 @@ namespace DD4hep { template <> void Converter<Atom>::operator()(xml_h element) const; template <> void Converter<Isotope>::operator()(xml_h element) const; template <> void Converter<VisAttr>::operator()(xml_h element) const; - template <> void Converter<AlignmentEntry>::operator()(xml_h element) const; template <> void Converter<Region>::operator()(xml_h element) const; template <> void Converter<Readout>::operator()(xml_h element) const; template <> void Converter<Segmentation>::operator()(xml_h element) const; @@ -72,7 +68,6 @@ namespace DD4hep { template <> void Converter<GdmlFile>::operator()(xml_h element) const; template <> void Converter<JsonFile>::operator()(xml_h element) const; template <> void Converter<XMLFile>::operator()(xml_h element) const; - template <> void Converter<AlignmentFile>::operator()(xml_h element) const; template <> void Converter<Header>::operator()(xml_h element) const; template <> void Converter<DetElementInclude>::operator()(xml_h element) const; template <> void Converter<Compact>::operator()(xml_h element) const; @@ -94,7 +89,7 @@ namespace { bool s_debug_segmentation = false; } -static Ref_t create_ConstantField(lcdd_t& /* lcdd */, xml_h e) { +static Ref_t create_ConstantField(Detector& /* description */, xml_h e) { CartesianField obj; xml_comp_t field(e), strength(e.child(_U(strength))); string t = e.attr<string>(_U(field)); @@ -108,7 +103,7 @@ static Ref_t create_ConstantField(lcdd_t& /* lcdd */, xml_h e) { } DECLARE_XMLELEMENT(ConstantField,create_ConstantField) -static Ref_t create_SolenoidField(lcdd_t& lcdd, xml_h e) { +static Ref_t create_SolenoidField(Detector& description, xml_h e) { xml_comp_t c(e); bool has_inner_radius = c.hasAttr(_U(inner_radius)); bool has_outer_radius = c.hasAttr(_U(outer_radius)); @@ -129,12 +124,12 @@ static Ref_t create_SolenoidField(lcdd_t& lcdd, xml_h e) { ptr->outerRadius = c.attr<double>(_U(outer_radius)); } else if (has_inner_radius) { - Box box = lcdd.worldVolume().solid(); + Box box = description.worldVolume().solid(); ptr->innerRadius = c.attr<double>(_U(inner_radius)); ptr->outerRadius = box.x(); } else if (has_outer_radius) { - Box box = lcdd.worldVolume().solid(); + Box box = description.worldVolume().solid(); ptr->innerRadius = c.attr<double>(_U(outer_radius)); ptr->outerRadius = box.x(); } @@ -145,7 +140,7 @@ static Ref_t create_SolenoidField(lcdd_t& lcdd, xml_h e) { if (c.hasAttr(_U(zmax))) ptr->maxZ = c.attr<double>(_U(zmax)); else - ptr->maxZ = lcdd.constant<double>("world_side"); + ptr->maxZ = description.constant<double>("world_side"); if (c.hasAttr(_U(zmin))) ptr->minZ = c.attr<double>(_U(zmin)); else @@ -157,7 +152,7 @@ DECLARE_XMLELEMENT(SolenoidMagnet,create_SolenoidField) // This is the plugin required for slic: note the different name DECLARE_XMLELEMENT(solenoid,create_SolenoidField) -static Ref_t create_DipoleField(lcdd_t& /* lcdd */, xml_h e) { +static Ref_t create_DipoleField(Detector& /* description */, xml_h e) { xml_comp_t c(e); CartesianField obj; DipoleField* ptr = new DipoleField(); @@ -186,7 +181,7 @@ static Ref_t create_DipoleField(lcdd_t& /* lcdd */, xml_h e) { } DECLARE_XMLELEMENT(DipoleMagnet,create_DipoleField) -static Ref_t create_MultipoleField(lcdd_t& lcdd, xml_h e) { +static Ref_t create_MultipoleField(Detector& description, xml_h e) { xml_dim_t c(e), child; CartesianField obj; MultipoleField* ptr = new MultipoleField(); @@ -205,7 +200,7 @@ static Ref_t create_MultipoleField(lcdd_t& lcdd, xml_h e) { } if ((child = c.child(_U(shape), false))) { // Shape is not mandatory string type = child.typeStr(); - ptr->volume = XML::createShape(lcdd, type, child); + ptr->volume = xml::createShape(description, type, child); } ptr->B_z = bz; ptr->transform = Transform3D(rot,pos).Inverse(); @@ -224,8 +219,8 @@ static Ref_t create_MultipoleField(lcdd_t& lcdd, xml_h e) { } DECLARE_XMLELEMENT(MultipoleMagnet,create_MultipoleField) -static long create_Compact(lcdd_t& lcdd, xml_h element) { - Converter<Compact>converter(lcdd); +static long create_Compact(Detector& description, xml_h element) { + Converter<Compact>converter(description); converter(element); return 1; } @@ -267,7 +262,7 @@ template <> void Converter<Plugin>::operator()(xml_h e) const { } for(vector<string>::iterator i=arguments.begin(); i!=arguments.end(); ++i) argv.push_back(&((*i)[0])); - lcdd.apply(name.c_str(),int(argv.size()), &argv[0]); + description.apply(name.c_str(),int(argv.size()), &argv[0]); } /** Convert compact constant objects (defines) @@ -281,7 +276,7 @@ template <> void Converter<Constant>::operator()(xml_h e) const { string typ = constant.hasAttr(_U(type)) ? constant.attr<string>(_U(type)) : "number"; Constant c(nam, val, typ); _toDictionary(nam, val, typ); - lcdd.addConstant(c); + description.addConstant(c); } /** Convert compact constant objects (defines) * @@ -295,7 +290,7 @@ template <> void Converter<Header>::operator()(xml_h e) const { h.setStatus(e.attr<string>(_U(status))); h.setVersion(e.attr<string>(_U(version))); h.setComment(e.child(_U(comment)).text()); - lcdd.setHeader(h); + description.setHeader(h); } /** Convert compact material/element description objects @@ -315,20 +310,20 @@ template <> void Converter<Header>::operator()(xml_h e) const { * */ template <> void Converter<Material>::operator()(xml_h e) const { - xml_ref_t m(e); - TGeoManager& mgr = lcdd.manager(); - xml_tag_t mname = m.name(); + xml_ref_t x_mat(e); + TGeoManager& mgr = description.manager(); + xml_tag_t mname = x_mat.name(); const char* matname = mname.c_str(); TGeoElementTable* table = mgr.GetElementTable(); TGeoMaterial* mat = mgr.GetMaterial(matname); TGeoMixture* mix = dynamic_cast<TGeoMixture*>(mat); - xml_coll_t fractions(m, _U(fraction)); - xml_coll_t composites(m, _U(composite)); + xml_coll_t fractions(x_mat, _U(fraction)); + xml_coll_t composites(x_mat, _U(composite)); if (0 == mat) { TGeoMaterial* comp_mat; TGeoElement* comp_elt; - xml_h density = m.child(_U(D), false); + xml_h density = x_mat.child(_U(D), false); double dens_val = density.ptr() ? density.attr<double>(_U(value)) : 0.0; double dens_unit = 1.0; @@ -337,7 +332,7 @@ template <> void Converter<Material>::operator()(xml_h e) const { + string( matname ) ) ; } if ( density.hasAttr(_U(unit)) ) { - dens_unit = density.attr<double>(_U(unit))/XML::_toDouble(_Unicode(gram/cm3)); + dens_unit = density.attr<double>(_U(unit))/xml::_toDouble(_Unicode(gram/cm3)); } if ( dens_unit != 1.0 ) { cout << matname << " Density unit:" << dens_unit; @@ -348,14 +343,14 @@ template <> void Converter<Material>::operator()(xml_h e) const { printout(s_debug_materials ? ALWAYS : DEBUG, "Compact", "++ Converting material %-16s Density: %.3f.",matname, dens_val); #if 0 - cout << "Gev " << XML::_toDouble(_Unicode(GeV)) << endl; - cout << "sec " << XML::_toDouble(_Unicode(second)) << endl; - cout << "nsec " << XML::_toDouble(_Unicode(nanosecond)) << endl; - cout << "kilo " << XML::_toDouble(_Unicode(kilogram)) << endl; - cout << "kilo " << XML::_toDouble(_Unicode(joule*s*s/(m*m))) << endl; - cout << "meter " << XML::_toDouble(_Unicode(meter)) << endl; - cout << "ampere " << XML::_toDouble(_Unicode(ampere)) << endl; - cout << "degree " << XML::_toDouble(_Unicode(degree)) << endl; + cout << "Gev " << xml::_toDouble(_Unicode(GeV)) << endl; + cout << "sec " << xml::_toDouble(_Unicode(second)) << endl; + cout << "nsec " << xml::_toDouble(_Unicode(nanosecond)) << endl; + cout << "kilo " << xml::_toDouble(_Unicode(kilogram)) << endl; + cout << "kilo " << xml::_toDouble(_Unicode(joule*s*s/(m*m))) << endl; + cout << "meter " << xml::_toDouble(_Unicode(meter)) << endl; + cout << "ampere " << xml::_toDouble(_Unicode(ampere)) << endl; + cout << "degree " << xml::_toDouble(_Unicode(degree)) << endl; #endif //throw 1; mat = mix = new TGeoMixture(matname, composites.size(), dens_val); @@ -426,8 +421,8 @@ template <> void Converter<Material>::operator()(xml_h e) const { } // TGeo has no notion of a material "formula" // Hence, treat the formula the same way as the material itself - if (m.hasAttr(_U(formula))) { - string form = m.attr<string>(_U(formula)); + if (x_mat.hasAttr(_U(formula))) { + string form = x_mat.attr<string>(_U(formula)); if (form != matname) { medium = mgr.GetMedium(form.c_str()); if (0 == medium) { @@ -448,7 +443,7 @@ template <> void Converter<Material>::operator()(xml_h e) const { */ template <> void Converter<Isotope>::operator()(xml_h e) const { xml_dim_t isotope(e); - TGeoManager& mgr = lcdd.manager(); + TGeoManager& mgr = description.manager(); string nam = isotope.nameStr(); TGeoElementTable* tab = mgr.GetElementTable(); TGeoIsotope* iso = tab->FindIsotope(nam.c_str()); @@ -490,7 +485,7 @@ template <> void Converter<Isotope>::operator()(xml_h e) const { template <> void Converter<Atom>::operator()(xml_h e) const { xml_ref_t elem(e); xml_tag_t name = elem.name(); - TGeoManager& mgr = lcdd.manager(); + TGeoManager& mgr = description.manager(); TGeoElementTable* tab = mgr.GetElementTable(); TGeoElement* elt = tab->FindElement(name.c_str()); if ( !elt ) { @@ -542,7 +537,7 @@ template <> void Converter<Atom>::operator()(xml_h e) const { } } -/** Convert compact visualization attribute to LCDD visualization attribute +/** Convert compact visualization attribute to Detector visualization attribute * * <vis name="SiVertexBarrelModuleVis" * alpha="1.0" r="1.0" g="0.75" b="0.76" @@ -552,14 +547,14 @@ template <> void Converter<Atom>::operator()(xml_h e) const { */ template <> void Converter<VisAttr>::operator()(xml_h e) const { VisAttr attr(e.attr<string>(_U(name))); - float r = e.hasAttr(_U(r)) ? e.attr<float>(_U(r)) : 1.0f; - float g = e.hasAttr(_U(g)) ? e.attr<float>(_U(g)) : 1.0f; - float b = e.hasAttr(_U(b)) ? e.attr<float>(_U(b)) : 1.0f; + float red = e.hasAttr(_U(r)) ? e.attr<float>(_U(r)) : 1.0f; + float green = e.hasAttr(_U(g)) ? e.attr<float>(_U(g)) : 1.0f; + float blue = e.hasAttr(_U(b)) ? e.attr<float>(_U(b)) : 1.0f; printout(s_debug_visattr ? ALWAYS : DEBUG, "Compact", "++ Converting VisAttr structure: %-16s. R=%.3f G=%.3f B=%.3f", - attr.name(), r, g, b); - attr.setColor(r, g, b); + attr.name(), red, green, blue); + attr.setColor(red, green, blue); if (e.hasAttr(_U(alpha))) attr.setAlpha(e.attr<float>(_U(alpha))); if (e.hasAttr(_U(visible))) @@ -588,38 +583,7 @@ template <> void Converter<VisAttr>::operator()(xml_h e) const { attr.setShowDaughters(e.attr<bool>(_U(showDaughters))); else attr.setShowDaughters(true); - lcdd.addVisAttribute(attr); -} - -/** Specialized converter for compact AlignmentEntry objects. - * - * <alignment name="<path/to/object>" shortcut="short_cut_name"> - * <position x="x-value" y="y-value" z="z-value"/> - * <rotation theta="theta-value" phi="phi-value" psi="psi-value"/> - * </alignment> - */ -template <> void Converter<AlignmentEntry>::operator()(xml_h e) const { - xml_comp_t child(e); - string path = e.attr<string>(_U(name)); - bool check = e.hasAttr(_U(check)); - bool overlap = e.hasAttr(_U(overlap)); - AlignmentEntry alignment(path); - Position pos; - RotationZYX rot; - if ((child = e.child(_U(position), false))) { // Position is not mandatory! - pos.SetXYZ(child.x(), child.y(), child.z()); - } - if ((child = e.child(_U(rotation), false))) { // Rotation is not mandatory - rot.SetComponents(child.z(), child.y(), child.x()); - } - if (overlap) { - double ovl = e.attr<double>(_U(overlap)); - alignment.align(pos, rot, check, ovl); - } - else { - alignment.align(pos, rot, check); - } - lcdd.addAlignment(alignment); + description.addVisAttribute(attr); } /** Specialized converter for compact region objects. @@ -647,7 +611,7 @@ template <> void Converter<Region>::operator()(xml_h elt) const { } for (xml_coll_t user_limits(e, _U(limitsetref)); user_limits; ++user_limits) limits.push_back(user_limits.attr<string>(_U(name))); - lcdd.addRegion(region); + description.addRegion(region); } @@ -665,14 +629,12 @@ template <> void Converter<Segmentation>::operator()(xml_h seg) const { BitField64* bitfield = opt->second.ptr(); Segmentation segment(type, name, bitfield); - if (segment.isValid()) { - typedef Segmentation::Parameters _PARS; - const _PARS& pars = segment.parameters(); + if ( segment.isValid() ) { + const DDSegmentation::Parameters& pars = segment.parameters(); printout(s_debug_segmentation ? ALWAYS : DEBUG, "Compact", "++ Converting segmentation structure: %s of type %s.",name.c_str(),type.c_str()); - for(_PARS::const_iterator it = pars.begin(); it != pars.end(); ++it) { - Segmentation::Parameter p = *it; - XML::Strng_t pNam(p->name()); + for(const auto p : pars ) { + xml::Strng_t pNam(p->name()); if ( seg.hasAttr(pNam) ) { string pType = p->type(); if ( pType.compare("int") == 0 ) { @@ -687,9 +649,9 @@ template <> void Converter<Segmentation>::operator()(xml_h seg) const { printout(s_debug_segmentation ? ALWAYS : DEBUG, "Compact", "++ Converting this string structure: %s.",par.c_str()); vector<string> elts = DDSegmentation::splitString(par); - for (vector<string>::const_iterator j = elts.begin(); j != elts.end(); ++j) { - if ((*j).empty()) continue; - valueVector.push_back(_toDouble((*j))); + for (const string& spar : elts ) { + if ( spar.empty() ) continue; + valueVector.push_back(_toDouble(spar)); } typedef DDSegmentation::TypedSegmentationParameter< vector<double> > ParDouVec; static_cast<ParDouVec*>(p)->setTypedValue(valueVector); @@ -708,21 +670,21 @@ template <> void Converter<Segmentation>::operator()(xml_h seg) const { DDSegmentation::Segmentation* base = segment->segmentation; for(xml_coll_t sub(seg,_U(segmentation)); sub; ++sub) { std::pair<Segmentation,IDDescriptor> sub_object(Segmentation(),opt->second); - Converter<Segmentation> sub_conv(lcdd,param,&sub_object); + Converter<Segmentation> sub_conv(description,param,&sub_object); sub_conv(sub); if ( sub_object.first.isValid() ) { Segmentation sub_seg = sub_object.first; - xml_dim_t s(sub); + xml_dim_t x_seg(sub); if ( sub.hasAttr(_U(key_value)) ) { - key_min = key_max = s.key_value(); + key_min = key_max = x_seg.key_value(); } else if ( sub.hasAttr(_U(key_min)) && sub.hasAttr(_U(key_max)) ) { - key_min = s.key_min(); - key_max = s.key_max(); + key_min = x_seg.key_min(); + key_max = x_seg.key_max(); } else { stringstream tree; - XML::dump_tree(sub,tree); + xml::dump_tree(sub,tree); throw_print("Nested segmentations: Invalid key specification:"+tree.str()); } printout(s_debug_segmentation ? ALWAYS : DEBUG,"Compact", @@ -757,10 +719,10 @@ template <> void Converter<Readout>::operator()(xml_h e) const { // <id>system:6,barrel:3,module:4,layer:8,slice:5,x:32:-16,y:-16</id> opt.second = IDDescriptor(id.text()); opt.second->SetName(ro.name()); - lcdd.addIDSpecification(opt.second); + description.addIDSpecification(opt.second); } if (seg) { // Segmentation is not mandatory! - Converter<Segmentation>(lcdd,param,&opt)(seg); + Converter<Segmentation>(description,param,&opt)(seg); opt.first->setName(name); } /// The next 2 if-clauses are a bit tricky, because they are not commutativ. @@ -798,7 +760,7 @@ template <> void Converter<Readout>::operator()(xml_h e) const { } else { stringstream tree; - XML::dump_tree(e,tree); + xml::dump_tree(e,tree); throw_print("Reaout: Invalid specificatrion for multiple hit collections."+tree.str()); } printout(s_debug_readout ? ALWAYS : DEBUG,"Compact", @@ -808,7 +770,7 @@ template <> void Converter<Readout>::operator()(xml_h e) const { ro->hits.push_back(hits); } } - lcdd.addReadout(ro); + description.addReadout(ro); } /** Specialized converter for compact LimitSet objects. @@ -830,29 +792,27 @@ template <> void Converter<LimitSet>::operator()(xml_h e) const { limit.value = _multiply<double>(limit.content, limit.unit); ls.addLimit(limit); } - lcdd.addLimitSet(ls); + description.addLimitSet(ls); } -/** Specialized converter for generic LCDD properties +/** Specialized converter for generic Detector properties * * <properties> * <attributes name="key" type="" .... /> * ... </properties> */ template <> void Converter<Property>::operator()(xml_h e) const { - string name = e.attr<string>(_U(name)); - LCDD::Properties& prp = lcdd.properties(); - if (name.empty()) { + string name = e.attr<string>(_U(name)); + Detector::Properties& prp = description.properties(); + if ( name.empty() ) throw_print("Failed to convert properties. No name given!"); - } - vector<xml_attr_t>a = e.attributes(); - if (prp.find(name) == prp.end()) { - prp.insert(make_pair(name, LCDD::PropertyValues())); - } - for (vector<xml_attr_t>::iterator i = a.begin(); i != a.end(); ++i) { - pair<string, string>val(xml_tag_t(e.attr_name(*i)).str(), e.attr<string>(*i)); - prp[name].insert(val); - } + + vector<xml_attr_t> a = e.attributes(); + if ( prp.find(name) == prp.end() ) + prp.insert(make_pair(name, Detector::PropertyValues())); + + for (xml_attr_t i : a ) + prp[name].insert(make_pair(xml_tag_t(e.attr_name(i)).str(),e.attr<string>(i))); } /** Specialized converter for electric and magnetic fields @@ -864,36 +824,35 @@ template <> void Converter<Property>::operator()(xml_h e) const { * </field> */ template <> void Converter<CartesianField>::operator()(xml_h e) const { - string msg = "updated"; + string msg = "updated"; string name = e.attr<string>(_U(name)); string type = e.attr<string>(_U(type)); - CartesianField field = lcdd.field(name); - if (!field.isValid()) { - // The field is not present: We create it and add it to LCDD - field = Ref_t(PluginService::Create<NamedObject*>(type, &lcdd, &e)); - if (!field.isValid()) { + CartesianField field = description.field(name); + if ( !field.isValid() ) { + // The field is not present: We create it and add it to Detector + field = Ref_t(PluginService::Create<NamedObject*>(type, &description, &e)); + if ( !field.isValid() ) { PluginDebug dbg; - PluginService::Create<NamedObject*>(type, &lcdd, &e); - throw_print("Failed to create field object of type " + type + ". " + dbg.missingFactory(type)); + PluginService::Create<NamedObject*>(type, &description, &e); + throw_print("Failed to create field object of type "+type + ". "+dbg.missingFactory(type)); } - lcdd.addField(field); + description.addField(field); msg = "created"; } type = field.type(); // Now update the field structure with the generic part ie. set it's properties CartesianField::Properties& prp = field.properties(); - for (xml_coll_t c(e, _U(properties)); c; ++c) { + for ( xml_coll_t c(e, _U(properties)); c; ++c ) { string props_name = c.attr<string>(_U(name)); vector<xml_attr_t>a = c.attributes(); - if (prp.find(props_name) == prp.end()) { - prp.insert(make_pair(props_name, CartesianField::PropertyValues())); - } - for (vector<xml_attr_t>::iterator i = a.begin(); i != a.end(); ++i) { - pair<string, string>val(xml_tag_t(c.attr_name(*i)).str(), c.attr<string>(*i)); - prp[props_name].insert(val); + if ( prp.find(props_name) == prp.end() ) { + prp.insert(make_pair(props_name, Detector::PropertyValues())); } + for ( xml_attr_t i : a ) + prp[props_name].insert(make_pair(xml_tag_t(c.attr_name(i)).str(), c.attr<string>(i))); + if (c.hasAttr(_U(global)) && c.attr<bool>(_U(global))) { - lcdd.field().properties() = prp; + description.field().properties() = prp; } } printout(INFO, "Compact", "++ Converted field: Successfully %s field %s [%s]", msg.c_str(), name.c_str(), type.c_str()); @@ -915,33 +874,32 @@ template <> void Converter<CartesianField>::operator()(xml_h e) const { template <> void Converter<SensitiveDetector>::operator()(xml_h element) const { string name = element.attr<string>(_U(name)); try { - SensitiveDetector sd = lcdd.sensitiveDetector(name); - + SensitiveDetector sd = description.sensitiveDetector(name); xml_attr_t type = element.attr_nothrow(_U(type)); - if (type) { + if ( type ) { sd.setType(element.attr<string>(type)); } xml_attr_t verbose = element.attr_nothrow(_U(verbose)); - if (verbose) { + if ( verbose ) { sd.setVerbose(element.attr<bool>(verbose)); } xml_attr_t combine = element.attr_nothrow(_U(combine_hits)); - if (combine) { + if ( combine ) { sd.setCombineHits(element.attr<bool>(combine)); } xml_attr_t limits = element.attr_nothrow(_U(limits)); - if (limits) { + if ( limits ) { string l = element.attr<string>(limits); - LimitSet ls = lcdd.limitSet(l); + LimitSet ls = description.limitSet(l); if (!ls.isValid()) { throw_print("Converter<SensitiveDetector>: Request for non-existing limitset:" + l); } sd.setLimitSet(ls); } xml_attr_t region = element.attr_nothrow(_U(region)); - if (region) { + if ( region ) { string r = element.attr<string>(region); - Region reg = lcdd.region(r); + Region reg = description.region(r); if (!reg.isValid()) { throw_print("Converter<SensitiveDetector>: Request for non-existing region:" + r); } @@ -1006,9 +964,9 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { if (attr_par) { // We have here a nested detector. If the mother volume is not yet registered // it must be done here, so that the detector constructor gets the correct answer from - // the call to LCDD::pickMotherVolume(DetElement). + // the call to Detector::pickMotherVolume(DetElement). string par_name = element.attr<string>(attr_par); - DetElement parent_detector = lcdd.detector(par_name); + DetElement parent_detector = description.detector(par_name); if ( !parent_detector.isValid() ) { except("Compact","Failed to access valid parent detector of %s",name.c_str()); } @@ -1017,13 +975,13 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { except("Compact","Failed to access valid parent volume of %s from %s", name.c_str(), par_name.c_str()); } - lcdd.declareMotherVolume(name, parent_volume); + description.declareMotherVolume(name, parent_volume); } xml_attr_t attr_ro = element.attr_nothrow(_U(readout)); SensitiveDetector sd; Segmentation seg; if ( attr_ro ) { - Readout ro = lcdd.readout(element.attr<string>(attr_ro)); + Readout ro = description.readout(element.attr<string>(attr_ro)); if (!ro.isValid()) { throw runtime_error("No Readout structure present for detector:" + name); } @@ -1031,10 +989,10 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { sd = SensitiveDetector(name, "sensitive"); sd.setHitsCollection(ro.name()); sd.setReadout(ro); - lcdd.addSensitiveDetector(sd); + description.addSensitiveDetector(sd); } Ref_t sens = sd; - DetElement det(Ref_t(PluginService::Create<NamedObject*>(type, &lcdd, &element, &sens))); + DetElement det(Ref_t(PluginService::Create<NamedObject*>(type, &description, &element, &sens))); if (det.isValid()) { setChildTitles(make_pair(name, det)); if ( sd.isValid() ) { @@ -1051,10 +1009,10 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { if (!det.isValid()) { PluginDebug dbg; - PluginService::Create<NamedObject*>(type, &lcdd, &element, &sens); + PluginService::Create<NamedObject*>(type, &description, &element, &sens); throw runtime_error("Failed to execute subdetector creation plugin. " + dbg.missingFactory(type)); } - lcdd.addDetector(det); + description.addDetector(det); return; } catch (const exception& e) { @@ -1069,66 +1027,58 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { /// Read material entries from a seperate file in one of the include sections of the geometry template <> void Converter<GdmlFile>::operator()(xml_h element) const { - XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); + xml::DocumentHolder doc(xml::DocumentHandler().load(element, element.attr_value(_U(ref)))); xml_h materials = doc.root(); - xml_coll_t(materials, _U(isotope)).for_each(Converter<Isotope>(this->lcdd,0,0)); - xml_coll_t(materials, _U(element)).for_each(Converter<Atom>(this->lcdd)); - xml_coll_t(materials, _U(material)).for_each(Converter<Material>(this->lcdd)); + xml_coll_t(materials, _U(isotope)).for_each(Converter<Isotope>(this->description,0,0)); + xml_coll_t(materials, _U(element)).for_each(Converter<Atom>(this->description)); + xml_coll_t(materials, _U(material)).for_each(Converter<Material>(this->description)); } /// Read material entries from a seperate file in one of the include sections of the geometry template <> void Converter<JsonFile>::operator()(xml_h element) const { - string base = XML::DocumentHandler::system_directory(element); + string base = xml::DocumentHandler::system_directory(element); string file = element.attr<string>(_U(ref)); vector<char*> argv{&file[0],&base[0]}; - lcdd.apply("DD4hep_JsonProcessor",int(argv.size()), &argv[0]); + description.apply("dd4hep_JsonProcessor",int(argv.size()), &argv[0]); } /// Read alignment entries from a seperate file in one of the include sections of the geometry template <> void Converter<XMLFile>::operator()(xml_h element) const { - this->lcdd.fromXML(element.attr<string>(_U(ref))); -} - -/// Read alignment entries from a seperate file in one of the include sections of the geometry -template <> void Converter<AlignmentFile>::operator()(xml_h element) const { - XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); - xml_h alignments = doc.root(); - xml_coll_t(alignments, _U(alignment)).for_each(Converter<AlignmentEntry>(this->lcdd)); - xml_coll_t(alignments, _U(include)).for_each(Converter<XMLFile>(this->lcdd)); + this->description.fromXML(element.attr<string>(_U(ref))); } /// Read material entries from a seperate file in one of the include sections of the geometry template <> void Converter<DetElementInclude>::operator()(xml_h element) const { string type = element.hasAttr(_U(type)) ? element.attr<string>(_U(type)) : string("xml"); if ( type == "xml" ) { - XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); + xml::DocumentHolder doc(xml::DocumentHandler().load(element, element.attr_value(_U(ref)))); xml_h node = doc.root(); string tag = node.tag(); if ( tag == "lccdd" ) - Converter<Compact>(this->lcdd)(node); + Converter<Compact>(this->description)(node); else if ( tag == "define" ) - xml_coll_t(node, _U(constant)).for_each(Converter<Constant>(this->lcdd)); + xml_coll_t(node, _U(constant)).for_each(Converter<Constant>(this->description)); else if ( tag == "readouts" ) - xml_coll_t(node, _U(readout)).for_each(Converter<Readout>(this->lcdd)); + xml_coll_t(node, _U(readout)).for_each(Converter<Readout>(this->description)); else if ( tag == "regions" ) - xml_coll_t(node, _U(region)).for_each(Converter<Region>(this->lcdd)); + xml_coll_t(node, _U(region)).for_each(Converter<Region>(this->description)); else if ( tag == "limitsets" ) - xml_coll_t(node, _U(limitset)).for_each(Converter<LimitSet>(this->lcdd)); + xml_coll_t(node, _U(limitset)).for_each(Converter<LimitSet>(this->description)); else if ( tag == "display" ) - xml_coll_t(node,_U(vis)).for_each(Converter<VisAttr>(this->lcdd)); + xml_coll_t(node,_U(vis)).for_each(Converter<VisAttr>(this->description)); else if ( tag == "detector" ) - Converter<DetElement>(this->lcdd)(node); + Converter<DetElement>(this->description)(node); else if ( tag == "detectors" ) - xml_coll_t(node,_U(detector)).for_each(Converter<DetElement>(this->lcdd)); + xml_coll_t(node,_U(detector)).for_each(Converter<DetElement>(this->description)); } else if ( type == "json" ) { - Converter<JsonFile>(this->lcdd)(element); + Converter<JsonFile>(this->description)(element); } else if ( type == "gdml" ) { - Converter<GdmlFile>(this->lcdd)(element); + Converter<GdmlFile>(this->description)(element); } else if ( type == "xml-extended" ) { - Converter<XMLFile>(this->lcdd)(element); + Converter<XMLFile>(this->description)(element); } else { except("Compact","++ FAILED Invalid file type:%s. This cannot be processed!",type.c_str()); @@ -1146,7 +1096,7 @@ template <> void Converter<Compact>::operator()(xml_h element) const { bool close_geometry = true; if (element.hasChild(_U(debug))) - (Converter<Debug>(lcdd))(xml_h(compact.child(_U(debug)))); + (Converter<Debug>(description))(xml_h(compact.child(_U(debug)))); if ( steer_geometry ) { xml_elt_t steer = compact.child(_U(geometry)); @@ -1155,7 +1105,7 @@ template <> void Converter<Compact>::operator()(xml_h element) const { for (xml_coll_t clr(steer, _U(clear)); clr; ++clr) { string nam = clr.hasAttr(_U(name)) ? clr.attr<string>(_U(name)) : string(); if ( nam.substr(0,6) == "elemen" ) { - TGeoElementTable* table = lcdd.manager().GetElementTable(); + TGeoElementTable* table = description.manager().GetElementTable(); table->TGeoElementTable::~TGeoElementTable(); new(table) TGeoElementTable(); // This will initialize the table without filling: @@ -1167,41 +1117,39 @@ template <> void Converter<Compact>::operator()(xml_h element) const { } } - xml_coll_t(compact, _U(define)).for_each(_U(include), Converter<DetElementInclude>(lcdd)); - xml_coll_t(compact, _U(define)).for_each(_U(constant), Converter<Constant>(lcdd)); - xml_coll_t(compact, _U(includes)).for_each(_U(gdmlFile), Converter<GdmlFile>(lcdd)); + xml_coll_t(compact, _U(define)).for_each(_U(include), Converter<DetElementInclude>(description)); + xml_coll_t(compact, _U(define)).for_each(_U(constant), Converter<Constant>(description)); + xml_coll_t(compact, _U(includes)).for_each(_U(gdmlFile), Converter<GdmlFile>(description)); if (element.hasChild(_U(info))) - (Converter<Header>(lcdd))(xml_h(compact.child(_U(info)))); + (Converter<Header>(description))(xml_h(compact.child(_U(info)))); - xml_coll_t(compact, _U(materials)).for_each(_U(element), Converter<Atom>(lcdd)); - xml_coll_t(compact, _U(materials)).for_each(_U(material), Converter<Material>(lcdd)); - xml_coll_t(compact, _U(properties)).for_each(_U(attributes), Converter<Property>(lcdd)); - if ( open_geometry ) lcdd.init(); - xml_coll_t(compact, _U(limits)).for_each(_U(limitset), Converter<LimitSet>(lcdd)); - xml_coll_t(compact, _U(display)).for_each(_U(include), Converter<DetElementInclude>(lcdd)); - xml_coll_t(compact, _U(display)).for_each(_U(vis), Converter<VisAttr>(lcdd)); + xml_coll_t(compact, _U(materials)).for_each(_U(element), Converter<Atom>(description)); + xml_coll_t(compact, _U(materials)).for_each(_U(material), Converter<Material>(description)); + xml_coll_t(compact, _U(properties)).for_each(_U(attributes), Converter<Property>(description)); + if ( open_geometry ) description.init(); + xml_coll_t(compact, _U(limits)).for_each(_U(limitset), Converter<LimitSet>(description)); + xml_coll_t(compact, _U(display)).for_each(_U(include), Converter<DetElementInclude>(description)); + xml_coll_t(compact, _U(display)).for_each(_U(vis), Converter<VisAttr>(description)); printout(DEBUG, "Compact", "++ Converting readout structures..."); - xml_coll_t(compact, _U(readouts)).for_each(_U(readout), Converter<Readout>(lcdd)); + xml_coll_t(compact, _U(readouts)).for_each(_U(readout), Converter<Readout>(description)); printout(DEBUG, "Compact", "++ Converting region structures..."); - xml_coll_t(compact, _U(regions)).for_each(_U(region), Converter<Region>(lcdd)); + xml_coll_t(compact, _U(regions)).for_each(_U(region), Converter<Region>(description)); printout(DEBUG, "Compact", "++ Converting included files with subdetector structures..."); - xml_coll_t(compact, _U(detectors)).for_each(_U(include), Converter<DetElementInclude>(lcdd)); + xml_coll_t(compact, _U(detectors)).for_each(_U(include), Converter<DetElementInclude>(description)); printout(DEBUG, "Compact", "++ Converting detector structures..."); - xml_coll_t(compact, _U(detectors)).for_each(_U(detector), Converter<DetElement>(lcdd)); - xml_coll_t(compact, _U(include)).for_each(Converter<DetElementInclude>(this->lcdd)); + xml_coll_t(compact, _U(detectors)).for_each(_U(detector), Converter<DetElement>(description)); + xml_coll_t(compact, _U(include)).for_each(Converter<DetElementInclude>(this->description)); - xml_coll_t(compact, _U(includes)).for_each(_U(alignment), Converter<AlignmentFile>(lcdd)); - xml_coll_t(compact, _U(includes)).for_each(_U(xml), Converter<XMLFile>(lcdd)); - xml_coll_t(compact, _U(alignments)).for_each(_U(alignment), Converter<AlignmentEntry>(lcdd)); - xml_coll_t(compact, _U(fields)).for_each(_U(field), Converter<CartesianField>(lcdd)); - xml_coll_t(compact, _U(sensitive_detectors)).for_each(_U(sd), Converter<SensitiveDetector>(lcdd)); + xml_coll_t(compact, _U(includes)).for_each(_U(xml), Converter<XMLFile>(description)); + xml_coll_t(compact, _U(fields)).for_each(_U(field), Converter<CartesianField>(description)); + xml_coll_t(compact, _U(sensitive_detectors)).for_each(_U(sd), Converter<SensitiveDetector>(description)); ::snprintf(text, sizeof(text), "%u", xml_h(element).checksum(0)); - lcdd.addConstant(Constant("compact_checksum", text)); + description.addConstant(Constant("compact_checksum", text)); if ( --num_calls == 0 && close_geometry ) { - lcdd.endDocument(); + description.endDocument(); } - xml_coll_t(compact, _U(plugins)).for_each(_U(plugin), Converter<Plugin> (lcdd)); + xml_coll_t(compact, _U(plugins)).for_each(_U(plugin), Converter<Plugin> (description)); } #ifdef _WIN32 @@ -1210,7 +1158,6 @@ template <> void Converter<Compact>::operator()(xml_h element) const { template Converter<Material>; template Converter<Atom>; template Converter<VisAttr>; - template Converter<AlignmentEntry>; template Converter<Region>; template Converter<Readout>; template Converter<Segmentation>; @@ -1221,7 +1168,6 @@ template <> void Converter<Compact>::operator()(xml_h element) const { template Converter<DetElement>; template Converter<GdmlFile>; template Converter<XMLFile>; - template Converter<AlignmentFile>; template Converter<Header>; template Converter<DetElementInclude>; template Converter<Compact>; diff --git a/DDCore/src/plugins/DetectorFields.cpp b/DDCore/src/plugins/DetectorFields.cpp new file mode 100644 index 000000000..c409ae705 --- /dev/null +++ b/DDCore/src/plugins/DetectorFields.cpp @@ -0,0 +1,78 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +// Framework includes +#include "DD4hep/FieldTypes.h" +#include "DD4hep/DetFactoryHelper.h" + +using namespace dd4hep; + +static Ref_t convert_constant_field(Detector&, xml_h field, Ref_t object) { + xml_doc_t doc = xml_elt_t(field).document(); + ConstantField* fld = object.data<ConstantField>(); + field.setAttr(_U(lunit), "mm"); + //field.setAttr(_U(funit),"tesla"); + if (fld->type == CartesianField::ELECTRIC) + field.setAttr(_U(field), "electric"); + else if (fld->type == CartesianField::MAGNETIC) + field.setAttr(_U(field), "magnetic"); + + xml_elt_t strength = xml_elt_t(doc, _U(strength)); + strength.setAttr(_U(x), fld->direction.X()); + strength.setAttr(_U(y), fld->direction.Y()); + strength.setAttr(_U(z), fld->direction.Z()); + field.append(strength); + return object; +} +DECLARE_XML_PROCESSOR(ConstantField_Convert2Detector,convert_constant_field) + +static Ref_t convert_solenoid(Detector&, xml_h field, Ref_t object) { + char text[128]; + SolenoidField* fld = object.data<SolenoidField>(); + field.setAttr(_U(lunit), "mm"); + field.setAttr(_U(funit), "tesla"); + ::snprintf(text, sizeof(text), "%g/mm", fld->outerRadius); + field.setAttr(_U(outer_radius), dd4hep::_toDouble(text)); + ::snprintf(text, sizeof(text), "%g/mm", fld->innerRadius); + field.setAttr(_U(inner_radius), dd4hep::_toDouble(text)); + ::snprintf(text, sizeof(text), "%g/tesla", fld->innerField); + field.setAttr(_U(inner_field), dd4hep::_toDouble(text)); + ::snprintf(text, sizeof(text), "%g/tesla", fld->outerField); + field.setAttr(_U(outer_field), dd4hep::_toDouble(text)); + field.setAttr(_U(zmin), fld->minZ); + field.setAttr(_U(zmax), fld->maxZ); + return object; +} +DECLARE_XML_PROCESSOR(solenoid_Convert2Detector,convert_solenoid) + +static Ref_t convert_dipole(Detector&, xml_h field, Ref_t object) { + char text[128]; + xml_doc_t doc = xml_elt_t(field).document(); + DipoleField* fld = object.data<DipoleField>(); + field.setAttr(_U(lunit), "mm"); + field.setAttr(_U(funit), "tesla"); + ::snprintf(text, sizeof(text), "%g/mm", fld->rmax); + field.setAttr(_U(rmax), dd4hep::_toDouble(text)); + ::snprintf(text, sizeof(text), "%g/mm", fld->zmax); + field.setAttr(_U(zmax), dd4hep::_toDouble(text)); + ::snprintf(text, sizeof(text), "%g/mm", fld->zmin); + field.setAttr(_U(zmin), dd4hep::_toDouble(text)); + for (auto c : fld->coefficents ) { + xml_elt_t coeff = xml_elt_t(doc, _U(dipole_coeff)); + coeff.setValue(dd4hep::_toString(c)); + field.append(coeff); + } + return object; +} +DECLARE_XML_PROCESSOR(DipoleField_Convert2Detector,convert_dipole) + diff --git a/DDCore/src/plugins/LCDDHelperTest.cpp b/DDCore/src/plugins/DetectorHelperTest.cpp similarity index 59% rename from DDCore/src/plugins/LCDDHelperTest.cpp rename to DDCore/src/plugins/DetectorHelperTest.cpp index 60b41f430..556490130 100644 --- a/DDCore/src/plugins/LCDDHelperTest.cpp +++ b/DDCore/src/plugins/DetectorHelperTest.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,49 +12,49 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/Factories.h" -#include "DD4hep/LCDDHelper.h" +#include "DD4hep/DetectorHelper.h" // C/C++ include files #include <stdexcept> #include <algorithm> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; namespace { - /** @class LCDDHelperTest + /** @class DetectorHelperTest * - * Test LCDDHelper handle object to easily access the sensitive detector object of a detector + * Test DetectorHelper handle object to easily access the sensitive detector object of a detector * using either the subdetector name or the detector element (or one of its children). * * This helper recusively searches for all children of a subdetector the sensitive detector. * - * See: DD4hep/LCDDHelper.h + * See: dd4hep/DetectorHelper.h * Test: geoPluginRun -input file:../DD4hep.trunk/examples/CLICSiD/compact/compact.xml \ - * -plugin CLICSiD_LCDDHelperTest \ + * -plugin CLICSiD_DetectorHelperTest \ * optional: -<detector-name (default:SiVertexEndcap)> [Note the '-'!!!] * * @author M.Frank * @version 1.0 */ - struct LCDDHelperTest { + struct DetectorHelperTest { /// Initializing constructor - LCDDHelperTest(LCDD& lcdd, int argc, char** argv) { - LCDDHelper h(&lcdd); + DetectorHelperTest(Detector& description, int argc, char** argv) { + DetectorHelper h(&description); const char* nam = argc>1 ? argv[1]+1 : "SiVertexEndcap"; printSD(h,nam); - walkSD(h,lcdd.detector(nam)); + walkSD(h,description.detector(nam)); } /// Default destructor - virtual ~LCDDHelperTest() {} + virtual ~DetectorHelperTest() {} - void walkSD(LCDDHelper h, DetElement de) const { + void walkSD(DetectorHelper h, DetElement de) const { printSD(h,de); for(DetElement::Children::const_iterator i=de.children().begin(); i!=de.children().end(); ++i) { DetElement child = (*i).second; @@ -62,27 +62,27 @@ namespace { if ( child.children().size() > 0 ) walkSD(h,child); } } - void printSD(LCDDHelper h, DetElement de) const { + void printSD(DetectorHelper h, DetElement de) const { SensitiveDetector sd = h.sensitiveDetector(de); - printout(INFO,"LCDDHelperTest","Sensitive detector[%s]: %p --> %s",de.path().c_str(),(void*)sd.ptr(), + printout(INFO,"DetectorHelperTest","Sensitive detector[%s]: %p --> %s",de.path().c_str(),(void*)sd.ptr(), sd.ptr() ? sd.name() : "????"); } - void printSD(LCDDHelper h, const char* nam) const { + void printSD(DetectorHelper h, const char* nam) const { SensitiveDetector sd = h.sensitiveDetector(nam); - printout(INFO,"LCDDHelperTest","Sensitive detector[%s]: %p --> %s",nam,(void*)sd.ptr(), + printout(INFO,"DetectorHelperTest","Sensitive detector[%s]: %p --> %s",nam,(void*)sd.ptr(), sd.ptr() ? sd.name() : "????"); } /// Action routine to execute the test - static long run(LCDD& lcdd,int argc,char** argv) { - LCDDHelperTest test(lcdd,argc,argv); + static long run(Detector& description,int argc,char** argv) { + DetectorHelperTest test(description,argc,argv); return 1; } }; } -namespace DD4hep { - using ::LCDDHelperTest; +namespace dd4hep { + using ::DetectorHelperTest; } -DECLARE_APPLY(CLICSiD_LCDDHelperTest,LCDDHelperTest::run) +DECLARE_APPLY(CLICSiD_DetectorHelperTest,DetectorHelperTest::run) diff --git a/DDCore/src/plugins/Geant4XML.cpp b/DDCore/src/plugins/Geant4XML.cpp index 7cb6c3994..3720c0c83 100644 --- a/DDCore/src/plugins/Geant4XML.cpp +++ b/DDCore/src/plugins/Geant4XML.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,39 +14,36 @@ #include "XML/Conversions.h" #include "DD4hep/DetFactoryHelper.h" -namespace DD4hep { +namespace dd4hep { struct Geant4; - namespace Geometry { - class GdmlFile; - class Property; - class SensitiveDetector; - } + class GdmlFile; + class Property; + class SensitiveDetector; } -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; -namespace DD4hep { +namespace dd4hep { template <> void Converter<Geant4>::operator()(xml_h e) const; - template <> void Converter<Geometry::GdmlFile>::operator()(xml_h e) const; - template <> void Converter<Geometry::Property>::operator()(xml_h e) const; - template <> void Converter<Geometry::SensitiveDetector>::operator()(xml_h e) const; + template <> void Converter<GdmlFile>::operator()(xml_h e) const; + template <> void Converter<Property>::operator()(xml_h e) const; + template <> void Converter<SensitiveDetector>::operator()(xml_h e) const; } template <> void Converter<Geant4>::operator()(xml_h element) const { xml_elt_t compact(element); - //xml_coll_t(compact,_U(includes) ).for_each(_U(gdmlFile), Converter<Geometry::GdmlFile>(lcdd,param)); - xml_coll_t(compact, _U(properties)).for_each(_U(attributes), Converter < Geometry::Property > (lcdd, param)); - xml_coll_t(compact, _U(sensitive_detectors)).for_each(_U(sd), Converter < Geometry::SensitiveDetector > (lcdd, param)); + //xml_coll_t(compact,_U(includes) ).for_each(_U(gdmlFile), Converter<GdmlFile>(description,param)); + xml_coll_t(compact, _U(properties)).for_each(_U(attributes), Converter < Property > (description, param)); + xml_coll_t(compact, _U(sensitive_detectors)).for_each(_U(sd), Converter < SensitiveDetector > (description, param)); } -static long create_Geant4(lcdd_t& lcdd, const xml_h& element) { - (Converter < Geant4 > (lcdd))(element); +static long create_Geant4(Detector& description, const xml_h& element) { + (Converter < Geant4 > (description))(element); return 1; } DECLARE_XML_DOC_READER(geant4,create_Geant4) -static Ref_t handle_Geant4(lcdd_t& lcdd, const xml_h& element) { - (Converter < Geant4 > (lcdd))(element); +static Ref_t handle_Geant4(Detector& description, const xml_h& element) { + (Converter < Geant4 > (description))(element); return Ref_t(0); } DECLARE_XMLELEMENT(geant4_xml_setup,handle_Geant4) diff --git a/DDCore/src/plugins/GeometryWalk.cpp b/DDCore/src/plugins/GeometryWalk.cpp index d93204294..0245a6145 100644 --- a/DDCore/src/plugins/GeometryWalk.cpp +++ b/DDCore/src/plugins/GeometryWalk.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/Factories.h" #include "DD4hep/IDDescriptor.h" @@ -25,11 +25,11 @@ #include <algorithm> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -typedef DetectorTools::ElementPath ElementPath; -typedef DetectorTools::PlacementPath PlacementPath; +typedef detail::tools::ElementPath ElementPath; +typedef detail::tools::PlacementPath PlacementPath; namespace { /** @class GeometryWalk @@ -41,52 +41,51 @@ namespace { * @version 1.0 */ struct GeometryWalk { - typedef vector<PlacedVolume::VolID> VolIDs; /// Helper to scan volume ids struct FND { const string& test; FND(const string& c) : test(c) {} - bool operator()(const VolIDs::value_type& c) const { return c.first == test; } + bool operator()(const PlacedVolume::VolIDs::value_type& c) const { return c.first == test; } }; VolumeManager m_mgr; DetElement m_det; /// Initializing constructor - GeometryWalk(LCDD& lcdd, DetElement sdet); + GeometryWalk(Detector& description, DetElement sdet); /// Default destructor virtual ~GeometryWalk() {} /// Walk through tree of detector elements - void walk(DetElement de, VolIDs ids) const; + void walk(DetElement de, PlacedVolume::VolIDs ids) const; /// Printout volume information - void print(DetElement e, PlacedVolume pv, const VolIDs& child_ids) const; + void print(DetElement e, PlacedVolume pv, const PlacedVolume::VolIDs& child_ids) const; /// Action routine to execute the test - static long run(LCDD& lcdd,int argc,char** argv); + static long run(Detector& description,int argc,char** argv); }; } typedef DetElement::Children _C; /// Initializing constructor -GeometryWalk::GeometryWalk(LCDD& lcdd, DetElement sdet) : m_det(sdet) { - m_mgr = lcdd.volumeManager(); +GeometryWalk::GeometryWalk(Detector& description, DetElement sdet) : m_det(sdet) { + m_mgr = description.volumeManager(); if ( !m_det.isValid() ) { stringstream err; err << "The subdetector " << m_det.name() << " is not known to the geometry."; printout(INFO,"GeometryWalk",err.str().c_str()); throw runtime_error(err.str()); } - walk(m_det,VolIDs()); + walk(m_det,PlacedVolume::VolIDs()); } /// Printout volume information -void GeometryWalk::print(DetElement e, PlacedVolume pv, const VolIDs& /* child_ids */) const { +void GeometryWalk::print(DetElement e, PlacedVolume pv, const PlacedVolume::VolIDs& /* child_ids */) const { stringstream log; PlacementPath all_nodes; ElementPath det_elts; - DetectorTools::elementPath(e,det_elts); - DetectorTools::placementPath(e,all_nodes); - string elt_path = DetectorTools::elementPath(det_elts); - string node_path = DetectorTools::placementPath(all_nodes); + detail::tools::elementPath(e,det_elts); + detail::tools::placementPath(e,all_nodes); + string elt_path = detail::tools::elementPath(det_elts); + string node_path = detail::tools::placementPath(all_nodes); log << "Lookup " << left << setw(32) << pv.name() << " Detector[" << det_elts.size() << "]: " << elt_path; printout(INFO,m_det.name(),log.str()); log.str(""); @@ -102,10 +101,10 @@ void GeometryWalk::print(DetElement e, PlacedVolume pv, const VolIDs& /* child_i } /// Walk through tree of volume placements -void GeometryWalk::walk(DetElement e, VolIDs ids) const { +void GeometryWalk::walk(DetElement e, PlacedVolume::VolIDs ids) const { const _C& children = e.children(); PlacedVolume pv = e.placement(); - VolIDs child_ids(ids); + PlacedVolume::VolIDs child_ids(ids); print(e,pv,ids); child_ids.insert(child_ids.end(),pv.volIDs().begin(),pv.volIDs().end()); for (_C::const_iterator i=children.begin(); i!=children.end(); ++i) { @@ -114,28 +113,28 @@ void GeometryWalk::walk(DetElement e, VolIDs ids) const { } /// Action routine to execute the test -long GeometryWalk::run(LCDD& lcdd,int argc,char** argv) { +long GeometryWalk::run(Detector& description,int argc,char** argv) { cout << "++ Processing plugin....GeometryWalker.." << endl; for(int in=1; in < argc; ++in) { string name = argv[in]+1; if ( name == "all" || name == "All" || name == "ALL" ) { - const _C& children = lcdd.world().children(); + const _C& children = description.world().children(); for (_C::const_iterator i=children.begin(); i!=children.end(); ++i) { DetElement sdet = (*i).second; cout << "++ Processing subdetector: " << sdet.name() << endl; - GeometryWalk test(lcdd,sdet); + GeometryWalk test(description,sdet); } return 1; } cout << "++ Processing subdetector: " << name << endl; - GeometryWalk test(lcdd,lcdd.detector(name)); + GeometryWalk test(description,description.detector(name)); } return 1; } -namespace DD4hep { - namespace Geometry { +namespace dd4hep { + namespace detail { using ::GeometryWalk; } } diff --git a/DDCore/src/plugins/JsonProcessor.cpp b/DDCore/src/plugins/JsonProcessor.cpp index 92d58fcf9..e6d18fae9 100644 --- a/DDCore/src/plugins/JsonProcessor.cpp +++ b/DDCore/src/plugins/JsonProcessor.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -47,8 +47,8 @@ namespace { } using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; static void setChildTitles(const pair<string, DetElement>& e) { DetElement parent = e.second.parent(); @@ -59,7 +59,7 @@ static void setChildTitles(const pair<string, DetElement>& e) { for_each(children.begin(), children.end(), setChildTitles); } -namespace DD4hep { +namespace dd4hep { template <> void Converter<detector>::operator()(json_h element) const; } @@ -75,9 +75,9 @@ template <> void Converter<detector>::operator()(json_h element) const { if (attr_par) { // We have here a nested detector. If the mother volume is not yet registered // it must be done here, so that the detector constructor gets the correct answer from - // the call to LCDD::pickMotherVolume(DetElement). + // the call to Detector::pickMotherVolume(DetElement). string par_name = element.attr<string>(attr_par); - DetElement parent_detector = lcdd.detector(par_name); + DetElement parent_detector = description.detector(par_name); if ( !parent_detector.isValid() ) { except("Compact","Failed to access valid parent detector of %s",name.c_str()); } @@ -86,13 +86,13 @@ template <> void Converter<detector>::operator()(json_h element) const { except("Compact","Failed to access valid parent volume of %s from %s", name.c_str(), par_name.c_str()); } - lcdd.declareMotherVolume(name, parent_volume); + description.declareMotherVolume(name, parent_volume); } json_attr_t attr_ro = element.attr_nothrow(_U(readout)); SensitiveDetector sd; Segmentation seg; if ( attr_ro ) { - Readout ro = lcdd.readout(element.attr<string>(attr_ro)); + Readout ro = description.readout(element.attr<string>(attr_ro)); if (!ro.isValid()) { throw runtime_error("No Readout structure present for detector:" + name); } @@ -100,10 +100,10 @@ template <> void Converter<detector>::operator()(json_h element) const { sd = SensitiveDetector(name, "sensitive"); sd.setHitsCollection(ro.name()); sd.setReadout(ro); - lcdd.addSensitiveDetector(sd); + description.addSensitiveDetector(sd); } Ref_t sens = sd; - DetElement det(Ref_t(PluginService::Create<NamedObject*>(type, &lcdd, &element, &sens))); + DetElement det(Ref_t(PluginService::Create<NamedObject*>(type, &description, &element, &sens))); if (det.isValid()) { setChildTitles(make_pair(name, det)); if ( sd.isValid() ) { @@ -120,10 +120,10 @@ template <> void Converter<detector>::operator()(json_h element) const { if (!det.isValid()) { PluginDebug dbg; - PluginService::Create<NamedObject*>(type, &lcdd, &element, &sens); + PluginService::Create<NamedObject*>(type, &description, &element, &sens); throw runtime_error("Failed to execute subdetector creation plugin. " + dbg.missingFactory(type)); } - lcdd.addDetector(det); + description.addDetector(det); return; } catch (const exception& e) { @@ -136,9 +136,9 @@ template <> void Converter<detector>::operator()(json_h element) const { } } -static long handle_json(lcdd_t& lcdd, int argc, char** argv) { +static long handle_json(Detector& description, int argc, char** argv) { if ( argc < 1 || (argc<2 && argv[0][0] != '/') ) { - ::printf("DD4hep_JsonProcessor <file> <directory> \n" + ::printf("dd4hep_JsonProcessor <file> <directory> \n" " If file is an absolute path (does NOT start with '/')\n" " the directory path is mandatory. \n" " The file name is then assumed to be relative. \n" @@ -149,14 +149,14 @@ static long handle_json(lcdd_t& lcdd, int argc, char** argv) { if ( file[0] != '/' ) file = string(argv[1]) + "/" + file; printout(INFO,"JsonProcessor","++ Processing JSON input: %s",file.c_str()); - JSON::DocumentHolder doc(JSON::DocumentHandler().load(file.c_str())); - JSON::Element elt = doc.root(); + json::DocumentHolder doc(json::DocumentHandler().load(file.c_str())); + json::Element elt = doc.root(); - json_coll_t(elt,_U(detector)).for_each(Converter<detector>(lcdd)); + json_coll_t(elt,_U(detector)).for_each(Converter<detector>(description)); printout(INFO,"JsonProcessor","++ ... Successfully processed JSON input: %s",file.c_str()); return 1; } -DECLARE_APPLY(DD4hep_JsonProcessor,handle_json) +DECLARE_APPLY(dd4hep_JsonProcessor,handle_json) #endif // DD4HEP_USE_BOOST diff --git a/DDCore/src/plugins/LCDD2Output.cpp b/DDCore/src/plugins/LCDD2Output.cpp index de36bd882..b5f5dbcd0 100644 --- a/DDCore/src/plugins/LCDD2Output.cpp +++ b/DDCore/src/plugins/LCDD2Output.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== #include "XML/Conversions.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Objects.h" #include "DD4hep/Printout.h" #include "DD4hep/IDDescriptor.h" @@ -26,8 +26,8 @@ #include <iomanip> using namespace std; -namespace DD4hep { - using namespace Geometry; +namespace dd4hep { + using namespace detail; void dumpNode(TGeoNode* n, int level) { TGeoMatrix* mat = n->GetMatrix(); @@ -78,7 +78,7 @@ namespace DD4hep { } } - void dumpTopVolume(const LCDD& lcdd) { - dumpVolume(lcdd.manager().GetTopVolume(), 0); + void dumpTopVolume(const Detector& description) { + dumpVolume(description.manager().GetTopVolume(), 0); } } diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp index 5991d6082..011bff975 100644 --- a/DDCore/src/plugins/LCDDConverter.cpp +++ b/DDCore/src/plugins/LCDDConverter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -55,8 +55,8 @@ #include <sstream> #include <iomanip> -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::detail; +using namespace dd4hep; using namespace std; namespace { typedef Position XYZRotation; @@ -112,18 +112,18 @@ namespace { } } -void LCDDConverter::GeometryInfo::check(const string& name, const TNamed* n, map<string, const TNamed*>& m) const { - map<string, const TNamed*>::const_iterator i = m.find(name); - if (i != m.end()) { - const char* isa = n ? n->IsA()->GetName() : (*i).second ? (*i).second->IsA()->GetName() : "Unknown"; - cout << isa << "(position): duplicate entry with name:" << name << " " << (void*) n << " " << (void*) (*i).second << endl; +void LCDDConverter::GeometryInfo::check(const string& name, const TNamed* _n, map<string, const TNamed*>& _m) const { + map<string, const TNamed*>::const_iterator i = _m.find(name); + if (i != _m.end()) { + const char* isa = _n ? _n->IsA()->GetName() : (*i).second ? (*i).second->IsA()->GetName() : "Unknown"; + cout << isa << "(position): duplicate entry with name:" << name << " " << (void*) _n << " " << (void*) (*i).second << endl; } - m.insert(make_pair(name, n)); + _m.insert(make_pair(name, _n)); } /// Initializing Constructor -LCDDConverter::LCDDConverter(LCDD& lcdd) - : m_lcdd(lcdd), m_dataPtr(0) { +LCDDConverter::LCDDConverter(Detector& description) + : m_detDesc(description), m_dataPtr(0) { } LCDDConverter::~LCDDConverter() { @@ -240,218 +240,218 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con string shape_name = shape->GetName(); //genName(shape->GetName(),shape); geo.checkShape(name, shape); if (isa == TGeoBBox::Class()) { - const TGeoBBox* s = (const TGeoBBox*) shape; + const TGeoBBox* sh = (const TGeoBBox*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(box))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(x), 2 * s->GetDX()); - solid.setAttr(_U(y), 2 * s->GetDY()); - solid.setAttr(_U(z), 2 * s->GetDZ()); + solid.setAttr(_U(x), 2 * sh->GetDX()); + solid.setAttr(_U(y), 2 * sh->GetDY()); + solid.setAttr(_U(z), 2 * sh->GetDZ()); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoTube::Class()) { - const TGeoTube* s = (const TGeoTube*) shape; + const TGeoTube* sh = (const TGeoTube*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(tube))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(rmin), s->GetRmin()); - solid.setAttr(_U(rmax), s->GetRmax()); - solid.setAttr(_U(z), 2 * s->GetDz()); + solid.setAttr(_U(rmin), sh->GetRmin()); + solid.setAttr(_U(rmax), sh->GetRmax()); + solid.setAttr(_U(z), 2 * sh->GetDz()); solid.setAttr(_U(startphi), 0e0); solid.setAttr(_U(deltaphi), 360.0); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoTubeSeg::Class()) { - const TGeoTubeSeg* s = (const TGeoTubeSeg*) shape; + const TGeoTubeSeg* sh = (const TGeoTubeSeg*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(tube))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(rmin), s->GetRmin()); - solid.setAttr(_U(rmax), s->GetRmax()); - solid.setAttr(_U(z), 2 * s->GetDz()); // Full zlen in GDML, half zlen in TGeo - solid.setAttr(_U(startphi), s->GetPhi1()); - solid.setAttr(_U(deltaphi), s->GetPhi2()); + solid.setAttr(_U(rmin), sh->GetRmin()); + solid.setAttr(_U(rmax), sh->GetRmax()); + solid.setAttr(_U(z), 2 * sh->GetDz()); // Full zlen in GDML, half zlen in TGeo + solid.setAttr(_U(startphi), sh->GetPhi1()); + solid.setAttr(_U(deltaphi), sh->GetPhi2()); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoEltu::Class()) { - const TGeoEltu* s = (const TGeoEltu*) shape; + const TGeoEltu* sh = (const TGeoEltu*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(eltube))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(dx), s->GetA()); - solid.setAttr(_U(dy), s->GetB()); - solid.setAttr(_U(dz), s->GetDz()); + solid.setAttr(_U(dx), sh->GetA()); + solid.setAttr(_U(dy), sh->GetB()); + solid.setAttr(_U(dz), sh->GetDz()); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoTrd1::Class()) { - const TGeoTrd1* s = (const TGeoTrd1*) shape; + const TGeoTrd1* sh = (const TGeoTrd1*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(trd))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(x1), 2 * s->GetDx1()); - solid.setAttr(_U(x2), 2 * s->GetDx2()); - solid.setAttr(_U(y1), 2 * s->GetDy()); - solid.setAttr(_U(y2), 2 * s->GetDy()); - solid.setAttr(_U(z), 2 * s->GetDz()); // Full zlen in GDML, half zlen in TGeo + solid.setAttr(_U(x1), 2 * sh->GetDx1()); + solid.setAttr(_U(x2), 2 * sh->GetDx2()); + solid.setAttr(_U(y1), 2 * sh->GetDy()); + solid.setAttr(_U(y2), 2 * sh->GetDy()); + solid.setAttr(_U(z), 2 * sh->GetDz()); // Full zlen in GDML, half zlen in TGeo solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoTrd2::Class()) { - const TGeoTrd2* s = (const TGeoTrd2*) shape; + const TGeoTrd2* sh = (const TGeoTrd2*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(trd))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(x1), 2 * s->GetDx1()); - solid.setAttr(_U(x2), 2 * s->GetDx2()); - solid.setAttr(_U(y1), 2 * s->GetDy1()); - solid.setAttr(_U(y2), 2 * s->GetDy2()); - solid.setAttr(_U(z), 2 * s->GetDz()); // Full zlen in GDML, half zlen in TGeo + solid.setAttr(_U(x1), 2 * sh->GetDx1()); + solid.setAttr(_U(x2), 2 * sh->GetDx2()); + solid.setAttr(_U(y1), 2 * sh->GetDy1()); + solid.setAttr(_U(y2), 2 * sh->GetDy2()); + solid.setAttr(_U(z), 2 * sh->GetDz()); // Full zlen in GDML, half zlen in TGeo solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoHype::Class()) { - const TGeoHype* s = (const TGeoHype*) shape; + const TGeoHype* sh = (const TGeoHype*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(hype))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(rmin), s->GetRmin()); - solid.setAttr(_U(rmax), s->GetRmax()); - solid.setAttr(Unicode("inst"), s->GetStIn()); - solid.setAttr(_U(outst), s->GetStOut()); - solid.setAttr(_U(z), s->GetDz()); // Full zlen in GDML, half zlen in TGeo + solid.setAttr(_U(rmin), sh->GetRmin()); + solid.setAttr(_U(rmax), sh->GetRmax()); + solid.setAttr(Unicode("inst"), sh->GetStIn()); + solid.setAttr(_U(outst), sh->GetStOut()); + solid.setAttr(_U(z), sh->GetDz()); // Full zlen in GDML, half zlen in TGeo solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoPgon::Class()) { - const TGeoPgon* s = (const TGeoPgon*) shape; + const TGeoPgon* sh = (const TGeoPgon*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(polyhedra))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(startphi), s->GetPhi1()); - solid.setAttr(_U(deltaphi), s->GetDphi()); - solid.setAttr(_U(numsides), s->GetNedges()); + solid.setAttr(_U(startphi), sh->GetPhi1()); + solid.setAttr(_U(deltaphi), sh->GetDphi()); + solid.setAttr(_U(numsides), sh->GetNedges()); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); - for (Int_t i = 0; i < s->GetNz(); ++i) { + for (Int_t i = 0; i < sh->GetNz(); ++i) { zplane = xml_elt_t(geo.doc, _U(zplane)); - zplane.setAttr(_U(z), s->GetZ(i)); - zplane.setAttr(_U(rmin), s->GetRmin(i)); - zplane.setAttr(_U(rmax), s->GetRmax(i)); + zplane.setAttr(_U(z), sh->GetZ(i)); + zplane.setAttr(_U(rmin), sh->GetRmin(i)); + zplane.setAttr(_U(rmax), sh->GetRmax(i)); solid.append(zplane); } } else if (isa == TGeoPcon::Class()) { - const TGeoPcon* s = (const TGeoPcon*) shape; + const TGeoPcon* sh = (const TGeoPcon*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(polycone))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(startphi), s->GetPhi1()); - solid.setAttr(_U(deltaphi), s->GetDphi()); + solid.setAttr(_U(startphi), sh->GetPhi1()); + solid.setAttr(_U(deltaphi), sh->GetDphi()); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); - for (Int_t i = 0; i < s->GetNz(); ++i) { + for (Int_t i = 0; i < sh->GetNz(); ++i) { zplane = xml_elt_t(geo.doc, _U(zplane)); - zplane.setAttr(_U(z), s->GetZ(i)); - zplane.setAttr(_U(rmin), s->GetRmin(i)); - zplane.setAttr(_U(rmax), s->GetRmax(i)); + zplane.setAttr(_U(z), sh->GetZ(i)); + zplane.setAttr(_U(rmin), sh->GetRmin(i)); + zplane.setAttr(_U(rmax), sh->GetRmax(i)); solid.append(zplane); } solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoCone::Class()) { - const TGeoCone* s = (const TGeoCone*) shape; + const TGeoCone* sh = (const TGeoCone*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(cone))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(z), 2 * s->GetDz()); - solid.setAttr(_U(rmin1), s->GetRmin1()); - solid.setAttr(_U(rmax1), s->GetRmax1()); - solid.setAttr(_U(rmin2), s->GetRmin2()); - solid.setAttr(_U(rmax2), s->GetRmax2()); + solid.setAttr(_U(z), 2 * sh->GetDz()); + solid.setAttr(_U(rmin1), sh->GetRmin1()); + solid.setAttr(_U(rmax1), sh->GetRmax1()); + solid.setAttr(_U(rmin2), sh->GetRmin2()); + solid.setAttr(_U(rmax2), sh->GetRmax2()); solid.setAttr(_U(startphi), 0e0); solid.setAttr(_U(deltaphi), 360.0); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoConeSeg::Class()) { - const TGeoConeSeg* s = (const TGeoConeSeg*) shape; + const TGeoConeSeg* sh = (const TGeoConeSeg*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(cone))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(z), 2*s->GetDz()); - solid.setAttr(_U(rmin1), s->GetRmin1()); - solid.setAttr(_U(rmin2), s->GetRmin2()); - solid.setAttr(_U(rmax1), s->GetRmax1()); - solid.setAttr(_U(rmax2), s->GetRmax2()); - solid.setAttr(_U(startphi), s->GetPhi1()); - solid.setAttr(_U(deltaphi), s->GetPhi2() - s->GetPhi1()); + solid.setAttr(_U(z), 2*sh->GetDz()); + solid.setAttr(_U(rmin1), sh->GetRmin1()); + solid.setAttr(_U(rmin2), sh->GetRmin2()); + solid.setAttr(_U(rmax1), sh->GetRmax1()); + solid.setAttr(_U(rmax2), sh->GetRmax2()); + solid.setAttr(_U(startphi), sh->GetPhi1()); + solid.setAttr(_U(deltaphi), sh->GetPhi2() - sh->GetPhi1()); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoParaboloid::Class()) { - const TGeoParaboloid* s = (const TGeoParaboloid*) shape; + const TGeoParaboloid* sh = (const TGeoParaboloid*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(paraboloid))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(rlo), s->GetRlo()); - solid.setAttr(_U(rhi), s->GetRhi()); - solid.setAttr(_U(dz), s->GetDz()); + solid.setAttr(_U(rlo), sh->GetRlo()); + solid.setAttr(_U(rhi), sh->GetRhi()); + solid.setAttr(_U(dz), sh->GetDz()); solid.setAttr(_U(lunit), "cm"); } #if 0 else if (isa == TGeoEllipsoid::Class()) { - const TGeoEllipsoid* s = (const TGeoEllipsoid*) shape; + const TGeoEllipsoid* sh = (const TGeoEllipsoid*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(ellipsoid))); solid.setAttr(_U(lunit), "cm"); } #endif else if (isa == TGeoSphere::Class()) { - const TGeoSphere* s = (const TGeoSphere*) shape; + const TGeoSphere* sh = (const TGeoSphere*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(sphere))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(rmin), s->GetRmin()); - solid.setAttr(_U(rmax), s->GetRmax()); - solid.setAttr(_U(startphi), s->GetPhi1()); - solid.setAttr(_U(deltaphi), (s->GetPhi2() - s->GetPhi1())); - solid.setAttr(_U(starttheta), s->GetTheta1()); - solid.setAttr(_U(deltatheta), (s->GetTheta2() - s->GetTheta1())); + solid.setAttr(_U(rmin), sh->GetRmin()); + solid.setAttr(_U(rmax), sh->GetRmax()); + solid.setAttr(_U(startphi), sh->GetPhi1()); + solid.setAttr(_U(deltaphi), (sh->GetPhi2() - sh->GetPhi1())); + solid.setAttr(_U(starttheta), sh->GetTheta1()); + solid.setAttr(_U(deltatheta), (sh->GetTheta2() - sh->GetTheta1())); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoTorus::Class()) { - const TGeoTorus* s = (const TGeoTorus*) shape; + const TGeoTorus* sh = (const TGeoTorus*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(torus))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(rtor), s->GetR()); - solid.setAttr(_U(rmin), s->GetRmin()); - solid.setAttr(_U(rmax), s->GetRmax()); - solid.setAttr(_U(startphi), s->GetPhi1()); - solid.setAttr(_U(deltaphi), s->GetDphi()); + solid.setAttr(_U(rtor), sh->GetR()); + solid.setAttr(_U(rmin), sh->GetRmin()); + solid.setAttr(_U(rmax), sh->GetRmax()); + solid.setAttr(_U(startphi), sh->GetPhi1()); + solid.setAttr(_U(deltaphi), sh->GetDphi()); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoTrap::Class()) { - const TGeoTrap* s = (const TGeoTrap*) shape; + const TGeoTrap* sh = (const TGeoTrap*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(trap))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(z), 2 * s->GetDz()); // Full zlen in GDML, half zlen in TGeo - solid.setAttr(_U(x1), 2 * s->GetBl1()); - solid.setAttr(_U(x2), 2 * s->GetTl1()); - solid.setAttr(_U(x3), 2 * s->GetBl2()); - solid.setAttr(_U(x4), 2 * s->GetTl2()); - solid.setAttr(_U(y1), 2 * s->GetH1()); - solid.setAttr(_U(y2), 2 * s->GetH2()); - solid.setAttr(_U(alpha1), s->GetAlpha1()); - solid.setAttr(_U(alpha2), s->GetAlpha2()); - solid.setAttr(_U(theta), s->GetTheta()); - solid.setAttr(_U(phi), s->GetPhi()); + solid.setAttr(_U(z), 2 * sh->GetDz()); // Full zlen in GDML, half zlen in TGeo + solid.setAttr(_U(x1), 2 * sh->GetBl1()); + solid.setAttr(_U(x2), 2 * sh->GetTl1()); + solid.setAttr(_U(x3), 2 * sh->GetBl2()); + solid.setAttr(_U(x4), 2 * sh->GetTl2()); + solid.setAttr(_U(y1), 2 * sh->GetH1()); + solid.setAttr(_U(y2), 2 * sh->GetH2()); + solid.setAttr(_U(alpha1), sh->GetAlpha1()); + solid.setAttr(_U(alpha2), sh->GetAlpha2()); + solid.setAttr(_U(theta), sh->GetTheta()); + solid.setAttr(_U(phi), sh->GetPhi()); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoPara::Class()) { - const TGeoPara* s = (const TGeoPara*) shape; + const TGeoPara* sh = (const TGeoPara*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(para))); solid.setAttr(_U(name), Unicode(shape_name)); - solid.setAttr(_U(x), s->GetX()); - solid.setAttr(_U(y), s->GetY()); - solid.setAttr(_U(z), s->GetZ()); - solid.setAttr(_U(alpha), s->GetAlpha()); - solid.setAttr(_U(theta), s->GetTheta()); - solid.setAttr(_U(phi), s->GetPhi()); + solid.setAttr(_U(x), sh->GetX()); + solid.setAttr(_U(y), sh->GetY()); + solid.setAttr(_U(z), sh->GetZ()); + solid.setAttr(_U(alpha), sh->GetAlpha()); + solid.setAttr(_U(theta), sh->GetTheta()); + solid.setAttr(_U(phi), sh->GetPhi()); solid.setAttr(_U(aunit), "deg"); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoArb8::Class()) { - TGeoArb8* s = (TGeoArb8*) shape; - const double* vtx = s->GetVertices(); + TGeoArb8* sh = (TGeoArb8*) shape; + const double* vtx = sh->GetVertices(); geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(arb8))); solid.setAttr(_U(name), Unicode(shape_name)); solid.setAttr(_U(v1x), vtx[0]); @@ -470,15 +470,15 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con solid.setAttr(_U(v7y), vtx[13]); solid.setAttr(_U(v8x), vtx[14]); solid.setAttr(_U(v8y), vtx[15]); - solid.setAttr(_U(dz), s->GetDz()); + solid.setAttr(_U(dz), sh->GetDz()); solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoCompositeShape::Class() || isa == TGeoUnion::Class() || isa == TGeoIntersection::Class() || isa == TGeoSubtraction::Class() ) { - const TGeoCompositeShape* s = (const TGeoCompositeShape*) shape; - const TGeoBoolNode* boolean = s->GetBoolNode(); + const TGeoCompositeShape* sh = (const TGeoCompositeShape*) shape; + const TGeoBoolNode* boolean = sh->GetBoolNode(); TGeoBoolNode::EGeoBoolType oper = boolean->GetBooleanOperator(); TGeoMatrix* rm = boolean->GetRightMatrix(); TGeoMatrix* lm = boolean->GetLeftMatrix(); @@ -488,10 +488,10 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con xml_h right = handleSolid(rs->GetName(), rs); xml_h first(0), second(0); if (!left) { - throw runtime_error("G4Converter: No left LCDD Solid present for composite shape:" + name); + throw runtime_error("G4Converter: No left Detector Solid present for composite shape:" + name); } if (!right) { - throw runtime_error("G4Converter: No right LCDD Solid present for composite shape:" + name); + throw runtime_error("G4Converter: No right Detector Solid present for composite shape:" + name); } //specific case! @@ -661,9 +661,9 @@ xml_h LCDDConverter::handleVolume(const string& /* name */, Volume volume) const const TGeoVolume* v = volume; Volume _v = Ref_t(v); string n = genName(v->GetName(),v); - TGeoMedium* m = v->GetMedium(); - TGeoShape* s = v->GetShape(); - xml_ref_t sol = handleSolid(s->GetName(), s); + TGeoMedium* medium = v->GetMedium(); + TGeoShape* sh = v->GetShape(); + xml_ref_t sol = handleSolid(sh->GetName(), sh); geo.checkVolume(n, volume); if (v->IsAssembly()) { @@ -672,15 +672,15 @@ xml_h LCDDConverter::handleVolume(const string& /* name */, Volume volume) const } else { if (!sol) - throw runtime_error("G4Converter: No LCDD Solid present for volume:" + n); + throw runtime_error("G4Converter: No Detector Solid present for volume:" + n); else if (!m) - throw runtime_error("G4Converter: No LCDD material present for volume:" + n); + throw runtime_error("G4Converter: No Detector material present for volume:" + n); vol = xml_elt_t(geo.doc, _U(volume)); vol.setAttr(_U(name), n); if (m) { - string mat_name = m->GetName(); - xml_ref_t med = handleMaterial(mat_name, Material(m)); + string mat_name = medium->GetName(); + xml_ref_t med = handleMaterial(mat_name, Material(medium)); vol.setRef(_U(materialref), med.name()); } vol.setRef(_U(solidref), sol.name()); @@ -695,9 +695,9 @@ xml_h LCDDConverter::handleVolume(const string& /* name */, Volume volume) const } } if (geo.doc_header && is_volume(volume)) { - Region reg = _v.region(); + Region reg = _v.region(); LimitSet lim = _v.limitSet(); - VisAttr vis = _v.visAttributes(); + VisAttr vis = _v.visAttributes(); SensitiveDetector det = _v.sensitiveDetector(); if (det.isValid()) { xml_ref_t xml_data = handleSensitive(det.name(), det); @@ -768,10 +768,10 @@ void LCDDConverter::checkVolumes(const string& /* name */, Volume v) const { stringstream str; str << "++ CheckVolumes: Volume " << n << " "; if (is_volume(v.ptr())) { - SensitiveDetector s = v.sensitiveDetector(); + SensitiveDetector sd = v.sensitiveDetector(); VisAttr vis = v.visAttributes(); - if (s.isValid()) { - str << "of " << s.name() << " "; + if (sd.isValid()) { + str << "of " << sd.name() << " "; } else if (vis.isValid()) { str << "with VisAttrs " << vis.name() << " "; @@ -826,7 +826,7 @@ xml_h LCDDConverter::handlePlacement(const string& name,PlacedVolume node) const return place; } -/// Convert the geometry type region into the corresponding LCDD object(s). +/// Convert the geometry type region into the corresponding Detector object(s). xml_h LCDDConverter::handleRegion(const std::string& /* name */, Region region) const { GeometryInfo& geo = data(); xml_h reg = geo.xmlRegions[region]; @@ -842,7 +842,7 @@ xml_h LCDDConverter::handleRegion(const std::string& /* name */, Region region) return reg; } -/// Convert the geometry type LimitSet into the corresponding LCDD object(s) +/// Convert the geometry type LimitSet into the corresponding Detector object(s) xml_h LCDDConverter::handleLimitSet(const std::string& /* name */, LimitSet lim) const { GeometryInfo& geo = data(); xml_h xml = geo.xmlLimits[lim]; @@ -864,7 +864,7 @@ xml_h LCDDConverter::handleLimitSet(const std::string& /* name */, LimitSet lim) return xml; } -/// Convert the segmentation of a SensitiveDetector into the corresponding LCDD object +/// Convert the segmentation of a SensitiveDetector into the corresponding Detector object xml_h LCDDConverter::handleSegmentation(Segmentation seg) const { xml_h xml; if (seg.isValid()) { @@ -896,7 +896,7 @@ xml_h LCDDConverter::handleSegmentation(Segmentation seg) const { return xml; } -/// Convert the geometry type SensitiveDetector into the corresponding LCDD object(s). +/// Convert the geometry type SensitiveDetector into the corresponding Detector object(s). xml_h LCDDConverter::handleSensitive(const string& /* name */, SensitiveDetector sd) const { GeometryInfo& geo = data(); xml_h sensdet = geo.xmlSensDets[sd]; @@ -931,11 +931,11 @@ xml_h LCDDConverter::handleIdSpec(const std::string& name, IDDescriptor id_spec) IDDescriptor desc = Ref_t(id_spec); geo.doc_idDict.append(id = xml_elt_t(geo.doc, _U(idspec))); id.setAttr(_U(name), name); - const IDDescriptor::FieldMap& m = desc.fields(); - for (IDDescriptor::FieldMap::const_iterator i = m.begin(); i != m.end(); ++i) { + const IDDescriptor::FieldMap& fm = desc.fields(); + for (const auto& i : fm ) { xml_h idfield = xml_elt_t(geo.doc, _U(idfield)); #if 0 - const IDDescriptor::Field& f = (*i).second; + const BitFieldValue* f = i.second; start = f.first; length = f.second<0 ? -f.second : f.second; idfield.setAttr(_U(signed),f.second<0 ? true : false); @@ -943,7 +943,7 @@ xml_h LCDDConverter::handleIdSpec(const std::string& name, IDDescriptor id_spec) idfield.setAttr(_U(length),length); idfield.setAttr(_U(start),start); #else - IDDescriptor::Field f = (*i).second; + const BitFieldValue* f = i.second; idfield.setAttr(_U(signed),f->isSigned() ? true : false); idfield.setAttr(_U(label), f->name()); idfield.setAttr(_U(length), (int) f->width()); @@ -957,7 +957,7 @@ xml_h LCDDConverter::handleIdSpec(const std::string& name, IDDescriptor id_spec) return id; } -/// Convert the geometry visualisation attributes to the corresponding LCDD object(s). +/// Convert the geometry visualisation attributes to the corresponding Detector object(s). xml_h LCDDConverter::handleVis(const string& /* name */, VisAttr attr) const { GeometryInfo& geo = data(); xml_h vis = geo.xmlVis[attr]; @@ -1000,12 +1000,12 @@ xml_h LCDDConverter::handleField(const std::string& /* name */, OverlayedField f string type = f->GetTitle(); field = xml_elt_t(geo.doc, Unicode(type)); field.setAttr(_U(name), f->GetName()); - fld = PluginService::Create<NamedObject*>(type + "_Convert2LCDD", &m_lcdd, &field, &fld); + fld = PluginService::Create<NamedObject*>(type + "_Convert2Detector", &m_detDesc, &field, &fld); printout(ALWAYS,"LCDDConverter","++ %s electromagnetic field:%s of type %s", (fld.isValid() ? "Converted" : "FAILED to convert "), f->GetName(), type.c_str()); if (!fld.isValid()) { PluginDebug dbg; - PluginService::Create<NamedObject*>(type + "_Convert2LCDD", &m_lcdd, &field, &fld); + PluginService::Create<NamedObject*>(type + "_Convert2Detector", &m_detDesc, &field, &fld); throw runtime_error("Failed to locate plugin to convert electromagnetic field:" + string(f->GetName()) + " of type " + type + ". " + dbg.missingFactory(type)); @@ -1016,15 +1016,15 @@ xml_h LCDDConverter::handleField(const std::string& /* name */, OverlayedField f } /// Handle the geant 4 specific properties -void LCDDConverter::handleProperties(LCDD::Properties& prp) const { +void LCDDConverter::handleProperties(Detector::Properties& prp) const { map<string, string> processors; static int s_idd = 9999999; string id; - for (LCDD::Properties::const_iterator i = prp.begin(); i != prp.end(); ++i) { + for (Detector::Properties::const_iterator i = prp.begin(); i != prp.end(); ++i) { const string& nam = (*i).first; - const LCDD::PropertyValues& vals = (*i).second; + const Detector::PropertyValues& vals = (*i).second; if (nam.substr(0, 6) == "geant4") { - LCDD::PropertyValues::const_iterator id_it = vals.find("id"); + Detector::PropertyValues::const_iterator id_it = vals.find("id"); if (id_it != vals.end()) { id = (*id_it).second; } @@ -1039,13 +1039,13 @@ void LCDDConverter::handleProperties(LCDD::Properties& prp) const { for (map<string, string>::const_iterator i = processors.begin(); i != processors.end(); ++i) { const GeoHandler* ptr = this; string nam = (*i).second; - const LCDD::PropertyValues& vals = prp[nam]; + const Detector::PropertyValues& vals = prp[nam]; string type = vals.find("type")->second; string tag = type + "_Geant4_action"; - long result = PluginService::Create<long>(tag, &m_lcdd, ptr, &vals); + long result = PluginService::Create<long>(tag, &m_detDesc, ptr, &vals); if (0 == result) { PluginDebug dbg; - result = PluginService::Create<long>(tag, &m_lcdd, ptr, &vals); + result = PluginService::Create<long>(tag, &m_detDesc, ptr, &vals); if (0 == result) { throw runtime_error("Failed to locate plugin to interprete files of type" " \"" + tag + "\" - no factory:" + type + ". " + @@ -1056,14 +1056,14 @@ void LCDDConverter::handleProperties(LCDD::Properties& prp) const { if (result != 1) { throw runtime_error("Failed to invoke the plugin " + tag + " of type " + type); } - printout(INFO,"","+++ Executed Successfully LCDD setup module %s.",type.c_str()); + printout(INFO,"","+++ Executed Successfully Detector setup module %s.",type.c_str()); } } -/// Add header information in LCDD format +/// Add header information in Detector format void LCDDConverter::handleHeader() const { GeometryInfo& geo = data(); - Header hdr = m_lcdd.header(); + Header hdr = m_detDesc.header(); if ( hdr.isValid() ) { xml_h obj; geo.doc_header.append(obj = xml_elt_t(geo.doc, _U(detector))); @@ -1072,14 +1072,14 @@ void LCDDConverter::handleHeader() const { obj.setAttr(_U(name), "LCDDConverter"); obj.setAttr(_U(version), hdr.version()); obj.setAttr(_U(file), hdr.url()); - obj.setAttr(_U(checksum), Unicode(m_lcdd.constantAsString("compact_checksum"))); + obj.setAttr(_U(checksum), Unicode(m_detDesc.constantAsString("compact_checksum"))); geo.doc_header.append(obj = xml_elt_t(geo.doc, _U(author))); obj.setAttr(_U(name), hdr.author()); geo.doc_header.append(obj = xml_elt_t(geo.doc, _U(comment))); obj.setText(hdr.comment()); return; } - printout(WARNING,"LCDDConverter","+++ No LCDD header information availible from the geometry description."); + printout(WARNING,"LCDDConverter","+++ No Detector header information availible from the geometry description."); } template <typename O, typename C, typename F> void handle(const O* o, const C& c, F pmf) { @@ -1101,7 +1101,7 @@ template <typename O, typename C, typename F> void handleRMap(const O* o, const /// Create geometry conversion xml_doc_t LCDDConverter::createGDML(DetElement top) { - LCDD& lcdd = m_lcdd; + Detector& description = m_detDesc; if (!top.isValid()) { throw runtime_error("Attempt to call createGDML with an invalid geometry!"); } @@ -1110,7 +1110,7 @@ xml_doc_t LCDDConverter::createGDML(DetElement top) { collect(top, geo); printout(ALWAYS,"LCDDConverter","++ ==> Converting in memory detector description to GDML format..."); - XML::DocumentHandler docH; + xml::DocumentHandler docH; geo.doc = docH.create("gdml", docH.defaultComment()); geo.doc_root = geo.doc.root(); geo.doc_root.setAttr(Unicode("xmlns:xs"), "http://www.w3.org/2001/XMLSchema-instance"); @@ -1120,7 +1120,7 @@ xml_doc_t LCDDConverter::createGDML(DetElement top) { // geo.doc_root.setAttr(Unicode("xmlns:gdml_simple_extension"),"http://www.example.org"); // geo.doc_root.setAttr(Unicode("xs:noNamespaceSchemaLocation"), // "http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd"); - Volume world_vol = lcdd.worldVolume(); + Volume world_vol = description.worldVolume(); geo.doc_root.append(geo.doc_define = xml_elt_t(geo.doc, _U(define))); geo.doc_root.append(geo.doc_materials = xml_elt_t(geo.doc, _U(materials))); geo.doc_root.append(geo.doc_solids = xml_elt_t(geo.doc, _U(solids))); @@ -1130,10 +1130,10 @@ xml_doc_t LCDDConverter::createGDML(DetElement top) { geo.doc_setup.setAttr(_U(name), Unicode("default")); geo.doc_setup.setAttr(_U(version), Unicode("1.0")); - // Ensure that all required materials are present in the LCDD material table + // Ensure that all required materials are present in the Detector material table #if 0 - const LCDD::HandleMap& mat = lcdd.materials(); - for(LCDD::HandleMap::const_iterator i=mat.begin(); i!=mat.end(); ++i) + const Detector::HandleMap& mat = description.materials(); + for(Detector::HandleMap::const_iterator i=mat.begin(); i!=mat.end(); ++i) geo.materials.insert(dynamic_cast<TGeoMedium*>((*i).second.ptr())); #endif @@ -1158,7 +1158,7 @@ xml_doc_t LCDDConverter::createGDML(DetElement top) { /// Create geometry conversion xml_doc_t LCDDConverter::createVis(DetElement top) { if (!top.isValid()) { - throw runtime_error("Attempt to call createLCDD with an invalid geometry!"); + throw runtime_error("Attempt to call createDetector with an invalid geometry!"); } GeometryInfo& geo = *(m_dataPtr = new GeometryInfo); @@ -1166,7 +1166,7 @@ xml_doc_t LCDDConverter::createVis(DetElement top) { collect(top, geo); printout(ALWAYS,"LCDDConverter","++ ==> Dump visualisation attributes " "from in memory detector description..."); - XML::DocumentHandler docH; + xml::DocumentHandler docH; xml_elt_t elt(0); geo.doc = docH.create("visualization", docH.defaultComment()); geo.doc_root = geo.doc.root(); @@ -1180,24 +1180,24 @@ xml_doc_t LCDDConverter::createVis(DetElement top) { } /// Create geometry conversion -xml_doc_t LCDDConverter::createLCDD(DetElement top) { - LCDD& lcdd = m_lcdd; +xml_doc_t LCDDConverter::createDetector(DetElement top) { + Detector& description = m_detDesc; if (!top.isValid()) { - throw runtime_error("Attempt to call createLCDD with an invalid geometry!"); + throw runtime_error("Attempt to call createDetector with an invalid geometry!"); } GeometryInfo& geo = *(m_dataPtr = new GeometryInfo); m_data->clear(); collect(top, geo); - XML::DocumentHandler docH; + xml::DocumentHandler docH; xml_elt_t elt(0); - Volume world_vol = lcdd.worldVolume(); - geo.doc = docH.create("lcdd", docH.defaultComment()); + Volume world_vol = description.worldVolume(); + geo.doc = docH.create("description", docH.defaultComment()); geo.doc_root = geo.doc.root(); - geo.doc_root.setAttr(Unicode("xmlns:lcdd"), "http://www.lcsim.org/schemas/lcdd/1.0"); + geo.doc_root.setAttr(Unicode("xmlns:description"), "http://www.lcsim.org/schemas/description/1.0"); geo.doc_root.setAttr(Unicode("xmlns:xs"), "http://www.w3.org/2001/XMLSchema-instance"); geo.doc_root.setAttr(Unicode("xs:noNamespaceSchemaLocation"), - "http://www.lcsim.org/schemas/lcdd/1.0/lcdd.xsd"); + "http://www.lcsim.org/schemas/description/1.0/description.xsd"); geo.doc_root.append(geo.doc_header = xml_elt_t(geo.doc, _U(header))); geo.doc_root.append(geo.doc_idDict = xml_elt_t(geo.doc, _U(iddict))); @@ -1217,12 +1217,12 @@ xml_doc_t LCDDConverter::createLCDD(DetElement top) { geo.doc_setup.setAttr(_U(name), Unicode("default")); geo.doc_setup.setAttr(_U(version), Unicode("1.0")); - // Ensure that all required materials are present in the LCDD material table - const LCDD::HandleMap& fld = lcdd.fields(); - for (LCDD::HandleMap::const_iterator i = fld.begin(); i != fld.end(); ++i) + // Ensure that all required materials are present in the Detector material table + const Detector::HandleMap& fld = description.fields(); + for (Detector::HandleMap::const_iterator i = fld.begin(); i != fld.end(); ++i) geo.fields.insert((*i).second); - printout(ALWAYS,"LCDDConverter","++ ==> Converting in memory detector description to LCDD format..."); + printout(ALWAYS,"LCDDConverter","++ ==> Converting in memory detector description to Detector format..."); handleHeader(); // Start creating the objects for materials, solids and log volumes. handle(this, geo.materials, &LCDDConverter::handleMaterial); @@ -1256,7 +1256,7 @@ xml_doc_t LCDDConverter::createLCDD(DetElement top) { handle(this, geo.volumes, &LCDDConverter::checkVolumes); #if 0 //==================== Fields - handleProperties(m_lcdd.properties()); + handleProperties(m_detDesc.properties()); #endif return geo.doc; } @@ -1270,28 +1270,28 @@ LCDDConverter::GeometryInfo::GeometryInfo() } static long dump_output(xml_doc_t doc, int argc, char** argv) { - XML::DocumentHandler docH; + xml::DocumentHandler docH; return docH.output(doc, argc > 0 ? argv[0] : ""); } -static long create_gdml(LCDD& lcdd, int argc, char** argv) { - LCDDConverter wr(lcdd); - return dump_output(wr.createGDML(lcdd.world()), argc, argv); +static long create_gdml(Detector& description, int argc, char** argv) { + LCDDConverter wr(description); + return dump_output(wr.createGDML(description.world()), argc, argv); } -static long create_lcdd(LCDD& lcdd, int argc, char** argv) { - LCDDConverter wr(lcdd); - return dump_output(wr.createLCDD(lcdd.world()), argc, argv); +static long create_description(Detector& description, int argc, char** argv) { + LCDDConverter wr(description); + return dump_output(wr.createDetector(description.world()), argc, argv); } -static long create_vis(LCDD& lcdd, int argc, char** argv) { - LCDDConverter wr(lcdd); - return dump_output(wr.createVis(lcdd.world()), argc, argv); +static long create_vis(Detector& description, int argc, char** argv) { + LCDDConverter wr(description); + return dump_output(wr.createVis(description.world()), argc, argv); } -static long create_visASCII(LCDD& lcdd, int /* argc */, char** argv) { - LCDDConverter wr(lcdd); - /* xml_doc_t doc = */ wr.createVis(lcdd.world()); +static long create_visASCII(Detector& description, int /* argc */, char** argv) { + LCDDConverter wr(description); + /* xml_doc_t doc = */ wr.createVis(description.world()); LCDDConverter::GeometryInfo& geo = wr.data(); map<string, xml_comp_t> vis_map; for (xml_coll_t c(geo.doc_display, _U(vis)); c; ++c) @@ -1316,7 +1316,7 @@ static long create_visASCII(LCDD& lcdd, int /* argc */, char** argv) { return 1; } -DECLARE_APPLY(DD4hepGeometry2VIS, create_vis) -DECLARE_APPLY(DD4hepGeometry2VISASCII, create_visASCII) -DECLARE_APPLY(DD4hepGeometry2GDML, create_gdml) -DECLARE_APPLY(DD4hepGeometry2LCDD, create_lcdd) +DECLARE_APPLY(dd4hepGeometry2VIS, create_vis) +DECLARE_APPLY(dd4hepGeometry2VISASCII, create_visASCII) +DECLARE_APPLY(dd4hepGeometry2GDML, create_gdml) +DECLARE_APPLY(dd4hepGeometry2Detector, create_description) diff --git a/DDCore/src/plugins/LCDDConverter.h b/DDCore/src/plugins/LCDDConverter.h index 614dc5c2f..bea8e1788 100644 --- a/DDCore/src/plugins/LCDDConverter.h +++ b/DDCore/src/plugins/LCDDConverter.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,11 +11,11 @@ // //========================================================================== -#ifndef DD4HEP_GEOMETRY_LCDDCONVERTER_H -#define DD4HEP_GEOMETRY_LCDDCONVERTER_H +#ifndef DD4HEP_GEOMETRY_DetectorCONVERTER_H +#define DD4HEP_GEOMETRY_DetectorCONVERTER_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/GeoHandler.h" #include "DD4hep/DetFactoryHelper.h" @@ -33,15 +33,15 @@ class TGeoNode; class TGeoMatrix; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { // Forward declarations class SensitiveDetectorObject; - /// Geometry converter from DD4hep to Geant 4 in LCDD format. + /// Geometry converter from dd4hep to Geant 4 in Detector format. /** * \author M.Frank * \version 1.0 @@ -49,7 +49,7 @@ namespace DD4hep { */ class LCDDConverter: public GeoHandler { public: - typedef XML::XmlElement XmlElement; + typedef xml::XmlElement XmlElement; typedef std::map<Atom, XmlElement*> ElementMap; typedef std::map<Material, XmlElement*> MaterialMap; typedef std::map<LimitSet, XmlElement*> LimitMap; @@ -62,7 +62,7 @@ namespace DD4hep { typedef std::map<const TGeoShape*, XmlElement*> SolidMap; typedef std::map<OverlayedField, XmlElement*> FieldMap; typedef std::map<const TGeoMatrix*, XmlElement*> TrafoMap; - /// Data structure of the geometry converter from DD4hep to Geant 4 in LCDD format. + /// Data structure of the geometry converter from dd4hep to Geant 4 in Detector format. /** * \author M.Frank * \version 1.0 @@ -70,22 +70,22 @@ namespace DD4hep { */ class GeometryInfo: public GeoHandler::GeometryInfo { public: - ElementMap xmlElements; - MaterialMap xmlMaterials; - SolidMap xmlSolids; - VolumeMap xmlVolumes; + ElementMap xmlElements; + MaterialMap xmlMaterials; + SolidMap xmlSolids; + VolumeMap xmlVolumes; PlacementMap xmlPlacements; - RegionMap xmlRegions; - VisMap xmlVis; - LimitMap xmlLimits; - IdSpecMap xmlIdSpecs; - SensDetMap xmlSensDets; - TrafoMap xmlPositions; - TrafoMap xmlRotations; - FieldMap xmlFields; - SensitiveDetectorSet sensitives; - RegionSet regions; - LimitSetSet limits; + RegionMap xmlRegions; + VisMap xmlVis; + LimitMap xmlLimits; + IdSpecMap xmlIdSpecs; + SensDetMap xmlSensDets; + TrafoMap xmlPositions; + TrafoMap xmlRotations; + FieldMap xmlFields; + std::set<SensitiveDetector> sensitives; + std::set<Region> regions; + std::set<LimitSet> limits; // These we need for redundancy and checking the data integrity typedef std::map<std::string, const TNamed*> CheckIter; struct _checks { @@ -118,7 +118,7 @@ namespace DD4hep { typedef std::set<std::string> NameSet; /// Reference to detector description - LCDD& m_lcdd; + Detector& m_detDesc; mutable NameSet m_checkNames; GeometryInfo* m_dataPtr; @@ -130,7 +130,7 @@ namespace DD4hep { void checkVolumes(const std::string& name, Volume volume) const; /// Initializing Constructor - LCDDConverter(LCDD& lcdd); + LCDDConverter(Detector& description); /// Standard destructor virtual ~LCDDConverter(); @@ -138,13 +138,13 @@ namespace DD4hep { /// Create geometry conversion in GDML format xml_doc_t createGDML(DetElement top); - /// Create geometry conversion in LCDD format - xml_doc_t createLCDD(DetElement top); + /// Create geometry conversion in Detector format + xml_doc_t createDetector(DetElement top); /// Create geometry conversion in Vis format xml_doc_t createVis(DetElement top); - /// Add header information in LCDD format + /// Add header information in Detector format virtual void handleHeader() const; /// Convert the geometry type material into the corresponding Xml object(s). @@ -182,7 +182,7 @@ namespace DD4hep { /// Convert the geometry type SensitiveDetector into the corresponding Xml object(s). virtual xml_h handleSensitive(const std::string& name, SensitiveDetector sens_det) const; - /// Convert the segmentation of a SensitiveDetector into the corresponding LCDD object + /// Convert the segmentation of a SensitiveDetector into the corresponding Detector object virtual xml_h handleSegmentation(Segmentation seg) const; /// Convert the Position into the corresponding Xml object(s). @@ -195,9 +195,9 @@ namespace DD4hep { virtual xml_h handleField(const std::string& name, OverlayedField field) const; /// Handle the geant 4 specific properties - void handleProperties(LCDD::Properties& prp) const; + void handleProperties(Detector::Properties& prp) const; }; - } // End namespace XML -} // End namespace DD4hep + } // End namespace xml +} // End namespace dd4hep -#endif // DD4HEP_GEOMETRY_LCDDCONVERTER_H +#endif // DD4HEP_GEOMETRY_DetectorCONVERTER_H diff --git a/DDCore/src/plugins/LCDDFields.cpp b/DDCore/src/plugins/LCDDFields.cpp deleted file mode 100644 index 1264decc0..000000000 --- a/DDCore/src/plugins/LCDDFields.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//========================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see $DD4hepINSTALL/LICENSE. -// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -// -// Author : M.Frank -// -//========================================================================== - -// Framework includes -#include "DD4hep/FieldTypes.h" -#include "DD4hep/DetFactoryHelper.h" - -using namespace DD4hep::Geometry; - -static Ref_t convert_constant_field(LCDD&, xml_h field, Ref_t object) { - xml_doc_t doc = xml_elt_t(field).document(); - ConstantField* s = object.data<ConstantField>(); - field.setAttr(_U(lunit), "mm"); - //field.setAttr(_U(funit),"tesla"); - if (s->type == CartesianField::ELECTRIC) - field.setAttr(_U(field), "electric"); - else if (s->type == CartesianField::MAGNETIC) - field.setAttr(_U(field), "magnetic"); - - xml_elt_t strength = xml_elt_t(doc, _U(strength)); - strength.setAttr(_U(x), s->direction.X()); - strength.setAttr(_U(y), s->direction.Y()); - strength.setAttr(_U(z), s->direction.Z()); - field.append(strength); - return object; -} -DECLARE_XML_PROCESSOR(ConstantField_Convert2LCDD,convert_constant_field) - -static Ref_t convert_solenoid(LCDD&, xml_h field, Ref_t object) { - char text[128]; - SolenoidField* s = object.data<SolenoidField>(); - field.setAttr(_U(lunit), "mm"); - field.setAttr(_U(funit), "tesla"); - ::snprintf(text, sizeof(text), "%g/mm", s->outerRadius); - field.setAttr(_U(outer_radius), DD4hep::_toDouble(text)); - ::snprintf(text, sizeof(text), "%g/mm", s->innerRadius); - field.setAttr(_U(inner_radius), DD4hep::_toDouble(text)); - ::snprintf(text, sizeof(text), "%g/tesla", s->innerField); - field.setAttr(_U(inner_field), DD4hep::_toDouble(text)); - ::snprintf(text, sizeof(text), "%g/tesla", s->outerField); - field.setAttr(_U(outer_field), DD4hep::_toDouble(text)); - field.setAttr(_U(zmin), s->minZ); - field.setAttr(_U(zmax), s->maxZ); - return object; -} -DECLARE_XML_PROCESSOR(solenoid_Convert2LCDD,convert_solenoid) - -static Ref_t convert_dipole(LCDD&, xml_h field, Ref_t object) { - char text[128]; - xml_doc_t doc = xml_elt_t(field).document(); - DipoleField* s = object.data<DipoleField>(); - field.setAttr(_U(lunit), "mm"); - field.setAttr(_U(funit), "tesla"); - ::snprintf(text, sizeof(text), "%g/mm", s->rmax); - field.setAttr(_U(rmax), DD4hep::_toDouble(text)); - ::snprintf(text, sizeof(text), "%g/mm", s->zmax); - field.setAttr(_U(zmax), DD4hep::_toDouble(text)); - ::snprintf(text, sizeof(text), "%g/mm", s->zmin); - field.setAttr(_U(zmin), DD4hep::_toDouble(text)); - DipoleField::Coefficents::const_iterator i = s->coefficents.begin(); - for (; i != s->coefficents.end(); ++i) { - xml_elt_t coeff = xml_elt_t(doc, _U(dipole_coeff)); - coeff.setValue(DD4hep::_toString(*i)); - field.append(coeff); - } - return object; -} -DECLARE_XML_PROCESSOR(DipoleField_Convert2LCDD,convert_dipole) - diff --git a/DDCore/src/plugins/PandoraConverter.cpp b/DDCore/src/plugins/PandoraConverter.cpp index 57cbb9977..42977ed89 100644 --- a/DDCore/src/plugins/PandoraConverter.cpp +++ b/DDCore/src/plugins/PandoraConverter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,23 +14,23 @@ #define DD4HEP_GEOMETRY_PANDORACONVERTER_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/GeoHandler.h" #include "DD4hep/DetFactoryHelper.h" /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { /* * XML namespace declaration */ - namespace Geometry { + namespace detail { /** @class PandoraConverter PandoraConverter.h XML/PandoraConverter.h * - * Geometry converter from DD4hep to Geant 4. + * Geometry converter from dd4hep to Geant 4. * * @author M.Frank * @version 1.0 @@ -45,14 +45,14 @@ namespace DD4hep { }; /// Reference to detector description - LCDD& m_lcdd; + Detector& m_detDesc; /// Data pointer GeometryInfo* m_dataPtr; public: /// Initializing Constructor - PandoraConverter(LCDD& lcdd); + PandoraConverter(Detector& description); /// Standard destructor virtual ~PandoraConverter(); @@ -61,12 +61,12 @@ namespace DD4hep { xml_doc_t create(DetElement top); }; - } // End namespace XML -} // End namespace DD4hep + } // End namespace xml +} // End namespace dd4hep #endif // DD4HEP_GEOMETRY_PANDORACONVERTER_H //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -79,7 +79,7 @@ namespace DD4hep { //========================================================================== // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/GeoHandler.h" #include "DD4hep/DetFactoryHelper.h" #include "XML/DocumentHandler.h" @@ -87,8 +87,8 @@ namespace DD4hep { // C/C++ include files #include <stdexcept> -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::detail; +using namespace dd4hep; using namespace std; /// Helper constructor @@ -97,8 +97,8 @@ PandoraConverter::GeometryInfo::GeometryInfo() } /// Initializing Constructor -PandoraConverter::PandoraConverter(LCDD& lcdd) - : m_lcdd(lcdd), m_dataPtr(0) { +PandoraConverter::PandoraConverter(Detector& description) + : m_detDesc(description), m_dataPtr(0) { } /// Standard destructor @@ -114,17 +114,17 @@ xml_doc_t PandoraConverter::create(DetElement /* top */) { "<!-- \n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" " ++++ Linear collider detector description in C++ ++++\n" - " ++++ DD4hep Detector description generator. ++++\n" + " ++++ dd4hep Detector description generator. ++++\n" " ++++ ++++\n" " ++++ M.Frank CERN/LHCb ++++\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" "-->\n" "<pandoraSetup>\n\0\0"; - XML::DocumentHandler docH; + xml::DocumentHandler docH; GeometryInfo& geo = *(m_dataPtr = new GeometryInfo); xml_elt_t elt(0); - Header hdr = m_lcdd.header(); + Header hdr = m_detDesc.header(); geo.doc = docH.parse(empty_xml, sizeof(empty_xml)); geo.doc_root = geo.doc.root(); geo.doc_root.append(geo.doc_calorimeters = xml_elt_t(geo.doc, _Unicode(calorimeters))); @@ -139,7 +139,7 @@ xml_doc_t PandoraConverter::create(DetElement /* top */) { return geo.doc; } -static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { +static long create_description(Detector& /* description */, int /* argc */, char** /* argv */) { throw runtime_error("The pandora xml conversion plugin is not yet implemented"); return 0; #if 0 @@ -897,4 +897,4 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { } #endif } -DECLARE_APPLY(DD4hepGeometry2PANDORA,create_lcdd) +DECLARE_APPLY(dd4hepGeometry2PANDORA,create_description) diff --git a/DDCore/src/plugins/PluginInvoker.cpp b/DDCore/src/plugins/PluginInvoker.cpp index 99a268252..05ca9534b 100644 --- a/DDCore/src/plugins/PluginInvoker.cpp +++ b/DDCore/src/plugins/PluginInvoker.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "XML/Conversions.h" #include "XML/XMLElements.h" @@ -23,9 +23,9 @@ #include <stdexcept> /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { namespace { /// Some utility class to specialize the converters: @@ -41,8 +41,8 @@ namespace DD4hep { template <> void Converter<arg>::operator()(xml_h e) const; } using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; /** Convert arg objects * @@ -70,11 +70,11 @@ template <> void Converter<plugin>::operator()(xml_h e) const { vector<const char*> cargs; //args.push_back("plugin:"+nam); - xml_coll_t(e,"arg").for_each(Converter<arg>(lcdd,&args)); + xml_coll_t(e,"arg").for_each(Converter<arg>(description,&args)); for(vector<string>::const_iterator i=args.begin(); i!=args.end();++i) cargs.push_back((*i).c_str()); printout(INFO,"ConverterPlugin","+++ Now executing plugin:%s [%d args]",nam.c_str(),int(cargs.size())); - lcdd.apply(nam.c_str(),int(cargs.size()),(char**)&cargs[0]); + description.apply(nam.c_str(),int(cargs.size()),(char**)&cargs[0]); } /** Convert include_file objects @@ -84,13 +84,13 @@ template <> void Converter<plugin>::operator()(xml_h e) const { * @date 01/04/2014 */ template <> void Converter<include_file>::operator()(xml_h element) const { - XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref)))); + xml::DocumentHolder doc(xml::DocumentHandler().load(element, element.attr_value(_U(ref)))); xml_h node = doc.root(); string tag = node.tag(); if ( tag == "plugin" ) - Converter<plugin>(lcdd,param)(node); + Converter<plugin>(description,param)(node); else if ( tag == "plugins" ) - Converter<plugins>(lcdd,param)(node); + Converter<plugins>(description,param)(node); else throw runtime_error("Undefined tag name in XML structure:"+tag+" XML parsing abandoned."); } @@ -102,12 +102,12 @@ template <> void Converter<include_file>::operator()(xml_h element) const { * @date 01/04/2014 */ template <> void Converter<plugins>::operator()(xml_h e) const { - xml_coll_t(e,"include").for_each(Converter<include_file>(lcdd,param)); - xml_coll_t(e,"plugin").for_each(Converter<plugin>(lcdd,param)); + xml_coll_t(e,"include").for_each(Converter<include_file>(description,param)); + xml_coll_t(e,"plugin").for_each(Converter<plugin>(description,param)); } -static long handle_plugins(lcdd_t& lcdd, const xml_h& element) { - (DD4hep::Converter < plugins > (lcdd))(element); +static long handle_plugins(Detector& description, const xml_h& element) { + (dd4hep::Converter < plugins > (description))(element); return 1; } DECLARE_XML_DOC_READER(plugins,handle_plugins) diff --git a/DDCore/src/plugins/LCDDSegmentations.cpp b/DDCore/src/plugins/ReadoutSegmentations.cpp similarity index 58% rename from DDCore/src/plugins/LCDDSegmentations.cpp rename to DDCore/src/plugins/ReadoutSegmentations.cpp index 39498a97c..e7ac8394c 100644 --- a/DDCore/src/plugins/LCDDSegmentations.cpp +++ b/DDCore/src/plugins/ReadoutSegmentations.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,54 +15,54 @@ #include "DD4hep/detail/SegmentationsInterna.h" #include "DD4hep/Factories.h" -using namespace DD4hep::Geometry; -using namespace DD4hep::DDSegmentation; +using namespace dd4hep; +using namespace dd4hep::DDSegmentation; namespace { - template<typename T> DD4hep::Geometry::SegmentationObject* - create_segmentation(DD4hep::Geometry::BitField64* decoder) { - return new DD4hep::Geometry::SegmentationWrapper<T>(decoder); + template<typename T> dd4hep::SegmentationObject* + create_segmentation(dd4hep::BitField64* decoder) { + return new dd4hep::SegmentationWrapper<T>(decoder); } } #include "DDSegmentation/NoSegmentation.h" -DECLARE_SEGMENTATION(NoSegmentation,create_segmentation<DD4hep::DDSegmentation::NoSegmentation>) +DECLARE_SEGMENTATION(NoSegmentation,create_segmentation<dd4hep::DDSegmentation::NoSegmentation>) #include "DDSegmentation/CartesianGridXY.h" -DECLARE_SEGMENTATION(CartesianGridXY,create_segmentation<DD4hep::DDSegmentation::CartesianGridXY>) +DECLARE_SEGMENTATION(CartesianGridXY,create_segmentation<dd4hep::DDSegmentation::CartesianGridXY>) #include "DDSegmentation/CartesianGridXZ.h" -DECLARE_SEGMENTATION(CartesianGridXZ,create_segmentation<DD4hep::DDSegmentation::CartesianGridXZ>) +DECLARE_SEGMENTATION(CartesianGridXZ,create_segmentation<dd4hep::DDSegmentation::CartesianGridXZ>) #include "DDSegmentation/CartesianGridYZ.h" -DECLARE_SEGMENTATION(CartesianGridYZ,create_segmentation<DD4hep::DDSegmentation::CartesianGridYZ>) +DECLARE_SEGMENTATION(CartesianGridYZ,create_segmentation<dd4hep::DDSegmentation::CartesianGridYZ>) #include "DDSegmentation/CartesianGridXYZ.h" -DECLARE_SEGMENTATION(CartesianGridXYZ,create_segmentation<DD4hep::DDSegmentation::CartesianGridXYZ>) +DECLARE_SEGMENTATION(CartesianGridXYZ,create_segmentation<dd4hep::DDSegmentation::CartesianGridXYZ>) #include "DDSegmentation/TiledLayerGridXY.h" -DECLARE_SEGMENTATION(TiledLayerGridXY,create_segmentation<DD4hep::DDSegmentation::TiledLayerGridXY>) +DECLARE_SEGMENTATION(TiledLayerGridXY,create_segmentation<dd4hep::DDSegmentation::TiledLayerGridXY>) #include "DDSegmentation/MegatileLayerGridXY.h" -DECLARE_SEGMENTATION(MegatileLayerGridXY,create_segmentation<DD4hep::DDSegmentation::MegatileLayerGridXY>) +DECLARE_SEGMENTATION(MegatileLayerGridXY,create_segmentation<dd4hep::DDSegmentation::MegatileLayerGridXY>) #include "DDSegmentation/WaferGridXY.h" -DECLARE_SEGMENTATION(WaferGridXY,create_segmentation<DD4hep::DDSegmentation::WaferGridXY>) +DECLARE_SEGMENTATION(WaferGridXY,create_segmentation<dd4hep::DDSegmentation::WaferGridXY>) #include "DDSegmentation/PolarGridRPhi.h" -DECLARE_SEGMENTATION(PolarGridRPhi,create_segmentation<DD4hep::DDSegmentation::PolarGridRPhi>) +DECLARE_SEGMENTATION(PolarGridRPhi,create_segmentation<dd4hep::DDSegmentation::PolarGridRPhi>) #include "DDSegmentation/GridPhiEta.h" -DECLARE_SEGMENTATION(GridPhiEta,create_segmentation<DD4hep::DDSegmentation::GridPhiEta>) +DECLARE_SEGMENTATION(GridPhiEta,create_segmentation<dd4hep::DDSegmentation::GridPhiEta>) #include "DDSegmentation/GridRPhiEta.h" -DECLARE_SEGMENTATION(GridRPhiEta,create_segmentation<DD4hep::DDSegmentation::GridRPhiEta>) +DECLARE_SEGMENTATION(GridRPhiEta,create_segmentation<dd4hep::DDSegmentation::GridRPhiEta>) #include "DDSegmentation/PolarGridRPhi2.h" -DECLARE_SEGMENTATION(PolarGridRPhi2,create_segmentation<DD4hep::DDSegmentation::PolarGridRPhi2>) +DECLARE_SEGMENTATION(PolarGridRPhi2,create_segmentation<dd4hep::DDSegmentation::PolarGridRPhi2>) #include "DDSegmentation/ProjectiveCylinder.h" -DECLARE_SEGMENTATION(ProjectiveCylinder,create_segmentation<DD4hep::DDSegmentation::ProjectiveCylinder>) +DECLARE_SEGMENTATION(ProjectiveCylinder,create_segmentation<dd4hep::DDSegmentation::ProjectiveCylinder>) #include "DDSegmentation/MultiSegmentation.h" -DECLARE_SEGMENTATION(MultiSegmentation,create_segmentation<DD4hep::DDSegmentation::MultiSegmentation>) +DECLARE_SEGMENTATION(MultiSegmentation,create_segmentation<dd4hep::DDSegmentation::MultiSegmentation>) diff --git a/DDCore/src/plugins/ShapePlugins.cpp b/DDCore/src/plugins/ShapePlugins.cpp index 1f535d6e6..a77a3678c 100644 --- a/DDCore/src/plugins/ShapePlugins.cpp +++ b/DDCore/src/plugins/ShapePlugins.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,22 +16,22 @@ #include "TGeoShapeAssembly.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_Assembly(lcdd_t&, xml_h e) { +static Ref_t create_Assembly(Detector&, xml_h e) { xml_dim_t dim(e); return Ref_t(new TGeoShapeAssembly()); } DECLARE_XMLELEMENT(Assembly__shape_constructor,create_Assembly) -static Ref_t create_Box(lcdd_t&, xml_h e) { +static Ref_t create_Box(Detector&, xml_h e) { xml_dim_t dim(e); return Box(dim.dx(),dim.dy(),dim.dz()); } DECLARE_XMLELEMENT(Box__shape_constructor,create_Box) -static Ref_t create_HalfSpace(lcdd_t&, xml_h e) { +static Ref_t create_HalfSpace(Detector&, xml_h e) { xml_dim_t dim(e); xml_dim_t point = e.child(_U(point)); xml_dim_t normal = e.child(_U(normal)); @@ -41,7 +41,7 @@ static Ref_t create_HalfSpace(lcdd_t&, xml_h e) { } DECLARE_XMLELEMENT(HalfSpace__shape_constructor,create_HalfSpace) -static Ref_t create_Polycone(lcdd_t&, xml_h element) { +static Ref_t create_Polycone(Detector&, xml_h element) { xml_dim_t e(element); int num = 0; vector<double> rmin,rmax,z; @@ -59,32 +59,32 @@ static Ref_t create_Polycone(lcdd_t&, xml_h element) { } DECLARE_XMLELEMENT(Polycone__shape_constructor,create_Polycone) -static Ref_t create_ConeSegment(lcdd_t&, xml_h element) { +static Ref_t create_ConeSegment(Detector&, xml_h element) { xml_dim_t e(element); return ConeSegment(e.rmin(0.0),e.rmax(),e.dz(0.0),e.startphi(0.0),e.deltaphi(2*M_PI)); } DECLARE_XMLELEMENT(ConeSegment__shape_constructor,create_ConeSegment) -static Ref_t create_Tube(lcdd_t&, xml_h element) { +static Ref_t create_Tube(Detector&, xml_h element) { xml_dim_t e(element); return Tube(e.rmin(0.0),e.rmax(),e.dz(0.0),e.startphi(0.0),e.deltaphi(2*M_PI)); } DECLARE_XMLELEMENT(Tube__shape_constructor,create_Tube) -static Ref_t create_EllipticalTube(lcdd_t&, xml_h element) { +static Ref_t create_EllipticalTube(Detector&, xml_h element) { xml_dim_t e(element); return EllipticalTube(e.a(),e.b(),e.dz()); } DECLARE_XMLELEMENT(EllipticalTube__shape_constructor,create_EllipticalTube) -static Ref_t create_Cone(lcdd_t&, xml_h element) { +static Ref_t create_Cone(Detector&, xml_h element) { xml_dim_t e(element); double rmi1 = e.rmin1(0.0), rma1 = e.rmax1(); return Cone(e.z(0.0),rmi1,rma1,e.rmin2(rmi1),e.rmax2(rma1)); } DECLARE_XMLELEMENT(Cone__shape_constructor,create_Cone) -static Ref_t create_Trap(lcdd_t&, xml_h element) { +static Ref_t create_Trap(Detector&, xml_h element) { xml_dim_t e(element); if ( e.hasAttr(_U(dz)) ) return Trap(e.dz(),e.dy(),e.dx(),_toDouble(_Unicode(pLTX))); @@ -92,43 +92,43 @@ static Ref_t create_Trap(lcdd_t&, xml_h element) { } DECLARE_XMLELEMENT(Trap__shape_constructor,create_Trap) -static Ref_t create_Trapezoid(lcdd_t&, xml_h element) { +static Ref_t create_Trapezoid(Detector&, xml_h element) { xml_dim_t e(element); return Trapezoid(e.x1(),e.x2(),e.y1(),e.y2(),e.z(0.0)); } DECLARE_XMLELEMENT(Trapezoid__shape_constructor,create_Trapezoid) -static Ref_t create_Torus(lcdd_t&, xml_h element) { +static Ref_t create_Torus(Detector&, xml_h element) { xml_dim_t e(element); return Torus(e.r(),e.rmin(),e.rmax(),e.phi(M_PI),e.deltaphi(2.*M_PI)); } DECLARE_XMLELEMENT(Torus__shape_constructor,create_Torus) -static Ref_t create_Sphere(lcdd_t&, xml_h element) { +static Ref_t create_Sphere(Detector&, xml_h element) { xml_dim_t e(element); return Sphere(e.rmin(),e.rmax(),e.theta(0e0),e.deltatheta(M_PI),e.phi(0e0),e.deltaphi(2.*M_PI)); } DECLARE_XMLELEMENT(Sphere__shape_constructor,create_Sphere) -static Ref_t create_Paraboloid(lcdd_t&, xml_h element) { +static Ref_t create_Paraboloid(Detector&, xml_h element) { xml_dim_t e(element); return Paraboloid(e.rmin(0.0),e.rmax(),e.dz()); } DECLARE_XMLELEMENT(Paraboloid__shape_constructor,create_Paraboloid) -static Ref_t create_Hyperboloid(lcdd_t&, xml_h element) { +static Ref_t create_Hyperboloid(Detector&, xml_h element) { xml_dim_t e(element); return Hyperboloid(e.rmin(), e.inner_stereo(), e.rmax(), e.outer_stereo(), e.dz()); } DECLARE_XMLELEMENT(Hyperboloid__shape_constructor,create_Hyperboloid) -static Ref_t create_PolyhedraRegular(lcdd_t&, xml_h element) { +static Ref_t create_PolyhedraRegular(Detector&, xml_h element) { xml_dim_t e(element); return PolyhedraRegular(e.numsides(),e.rmin(),e.rmax(),e.dz()); } DECLARE_XMLELEMENT(PolyhedraRegular__shape_constructor,create_PolyhedraRegular) -static Ref_t create_EightPointSolid(lcdd_t&, xml_h element) { +static Ref_t create_EightPointSolid(Detector&, xml_h element) { xml_dim_t e(element); double v[8][2]; int num = 0; @@ -152,7 +152,7 @@ DECLARE_XMLELEMENT(EightPointSolid__shape_constructor,create_EightPointSolid) * @date 03/2015 * @author F.Gaede, CERN/DESY */ -static Ref_t create_BooleanShape(lcdd_t&, xml_h element) { +static Ref_t create_BooleanShape(Detector&, xml_h element) { xml_det_t e(element); @@ -167,7 +167,7 @@ static Ref_t create_BooleanShape(lcdd_t&, xml_h element) { Solid solid2( xml_comp_t( x_shape2 ).createShape()) ; - std::string op = e.attr<std::string>( DD4hep::XML::Strng_t("operation") ) ; + std::string op = e.attr<std::string>( dd4hep::xml::Strng_t("operation") ) ; std::transform( op.begin(), op.end(), op.begin(), ::tolower); Solid resultSolid ; diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index b8c56761a..303e00e76 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Memory.h" #include "DD4hep/DD4hepUI.h" #include "DD4hep/Factories.h" @@ -25,7 +25,7 @@ #include "XML/DocumentHandler.h" #include "XML/XMLElements.h" #include "XML/XMLTags.h" -#include "../LCDDImp.h" +#include "../DetectorImp.h" // ROOT includes #include "TInterpreter.h" @@ -42,32 +42,32 @@ #include <sstream> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -/// Basic entry point to create a LCDD instance +/// Basic entry point to create a Detector instance /** - * Factory: LCDD_constructor + * Factory: Detector_constructor * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static void* create_lcdd_instance(const char* /* name */) { - return &LCDD::getInstance(); +static void* create_description_instance(const char* /* name */) { + return &Detector::getInstance(); } -DECLARE_CONSTRUCTOR(LCDD_constructor,create_lcdd_instance) +DECLARE_CONSTRUCTOR(Detector_constructor,create_description_instance) /// Basic entry point to display the currently loaded geometry using the ROOT OpenGL viewer /** - * Factory: DD4hepGeometryDisplay + * Factory: dd4hepGeometryDisplay * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long display(LCDD& lcdd, int argc, char** argv) { - TGeoManager& mgr = lcdd.manager(); +static long display(Detector& description, int argc, char** argv) { + TGeoManager& mgr = description.manager(); const char* opt = "ogl"; if (argc > 0) { opt = argv[0]; @@ -81,91 +81,91 @@ static long display(LCDD& lcdd, int argc, char** argv) { } return 0; } -DECLARE_APPLY(DD4hepGeometryDisplay,display) +DECLARE_APPLY(dd4hepGeometryDisplay,display) /// Basic entry point to start the ROOT interpreter. /** - * Factory: DD4hepRint + * Factory: dd4hepRint * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long run_interpreter(LCDD& /* lcdd */, int argc, char** argv) { +static long run_interpreter(Detector& /* description */, int argc, char** argv) { pair<int, char**> a(argc,argv); - TRint app("DD4hep", &a.first, a.second); + TRint app("dd4hep", &a.first, a.second); app.Run(); return 1; } -DECLARE_APPLY(DD4hepRint,run_interpreter) +DECLARE_APPLY(dd4hepRint,run_interpreter) /// Basic entry point to start the ROOT interpreter. /** * The UI will show up in the ROOT prompt and is accessible * in the interpreter with the global variable - * DD4hep::DD4hepUI* gDD4hepUI; + * dd4hep::DD4hepUI* gdd4hepUI; * - * Factory: DD4hepInteractiveUI + * Factory: dd4hepInteractiveUI * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long root_ui(LCDD& lcdd, int /* argc */, char** /* argv */) { +static long root_ui(Detector& description, int /* argc */, char** /* argv */) { char cmd[256]; - DD4hepUI* ui = new DD4hepUI(lcdd); - ::snprintf(cmd,sizeof(cmd),"DD4hep::DD4hepUI* gDD4hepUI = (DD4hep::DD4hepUI*)%p;",(void*)ui); + DD4hepUI* ui = new DD4hepUI(description); + ::snprintf(cmd,sizeof(cmd),"dd4hep::detail::DD4hepUI* gDD4hepUI = (dd4hep::detail::DD4hepUI*)%p;",(void*)ui); gInterpreter->ProcessLine(cmd); printout(ALWAYS,"DD4hepUI", "Use the ROOT interpreter variable gDD4hepUI " "to interact with the detector description."); return 1; } -DECLARE_APPLY(DD4hepInteractiveUI,root_ui) +DECLARE_APPLY(dd4hepInteractiveUI,root_ui) /// Basic entry point to dump the ROOT TGeoElementTable object /** * Dump the elment table to stdout or file. * - * Factory: DD4hepElementTable -format xml/text(default) -output <file-name> + * Factory: dd4hepElementTable -format xml/text(default) -output <file-name> * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long root_elements(LCDD& lcdd, int argc, char** argv) { +static long root_elements(Detector& description, int argc, char** argv) { struct ElementPrint { ElementPrint() = default; virtual ~ElementPrint() = default; - virtual void operator()(TGeoElement* e) { e->Print(); } - virtual void operator()(TGeoIsotope* i) { i->Print(); } + virtual void operator()(TGeoElement* elt) { elt->Print(); } + virtual void operator()(TGeoIsotope* iso) { iso->Print(); } }; struct ElementPrintXML : public ElementPrint { - typedef XML::Element elt_h; + typedef xml::Element elt_h; elt_h root; ElementPrintXML(elt_h r) : root(r) {} virtual ~ElementPrintXML() {} - virtual void operator()(TGeoElement* e) { + virtual void operator()(TGeoElement* element) { elt_h elt = root.addChild(_U(element)); - elt.setAttr(_U(Z),e->Z()); - elt.setAttr(_U(N),e->N()); - elt.setAttr(_U(formula),e->GetName()); - elt.setAttr(_U(name),e->GetName()); + elt.setAttr(_U(Z),element->Z()); + elt.setAttr(_U(N),element->N()); + elt.setAttr(_U(formula),element->GetName()); + elt.setAttr(_U(name),element->GetName()); elt_h atom = elt.addChild(_U(atom)); atom.setAttr(_U(type),"A"); atom.setAttr(_U(unit),"g/mole"); - atom.setAttr(_U(value),e->A()); + atom.setAttr(_U(value),element->A()); } - virtual void operator()(TGeoIsotope* i) { + virtual void operator()(TGeoIsotope* isotope) { elt_h iso = root.addChild(_U(isotope)); - iso.setAttr(_U(Z),i->GetZ()); - iso.setAttr(_U(N),i->GetN()); - iso.setAttr(_U(formula),i->GetName()); - iso.setAttr(_U(name),i->GetName()); + iso.setAttr(_U(Z),isotope->GetZ()); + iso.setAttr(_U(N),isotope->GetN()); + iso.setAttr(_U(formula),isotope->GetName()); + iso.setAttr(_U(name),isotope->GetName()); elt_h atom = iso.addChild(_U(atom)); atom.setAttr(_U(type),"A"); atom.setAttr(_U(unit),"g/mole"); - atom.setAttr(_U(value),i->GetA()); + atom.setAttr(_U(value),isotope->GetA()); } }; @@ -176,7 +176,7 @@ static long root_elements(LCDD& lcdd, int argc, char** argv) { if ( c == 't' && i+1<argc ) type = argv[++i]; else if ( c == 'o' && i+1<argc ) output = argv[++i]; else { - ::printf("DD4hepElementTable -opt [-opt] \n" + ::printf("dd4hepElementTable -opt [-opt] \n" " -type <string> Output format: text or xml \n" " -output <file-name> Output file specifier (xml only) \n" "\n"); @@ -185,14 +185,14 @@ static long root_elements(LCDD& lcdd, int argc, char** argv) { } } - XML::Document doc(0); - XML::DocumentHandler docH; - XML::Element element(0); + xml::Document doc(0); + xml::DocumentHandler docH; + xml::Element element(0); if ( type == "xml" ) { const char comment[] = "\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" " ++++ Linear collider detector description in C++ ++++\n" - " ++++ DD4hep Detector description generator. ++++\n" + " ++++ dd4hep Detector description generator. ++++\n" " ++++ ++++\n" " ++++ Parser:" XML_IMPLEMENTATION_TYPE @@ -208,7 +208,7 @@ static long root_elements(LCDD& lcdd, int argc, char** argv) { dd4hep_ptr<ElementPrint> printer(element ? new ElementPrintXML(element) : new ElementPrint()); - TGeoElementTable* table = lcdd.manager().GetElementTable(); + TGeoElementTable* table = description.manager().GetElementTable(); for(Int_t i=0, n=table->GetNelements(); i < n; ++i) (*printer)(table->GetElement(i)); @@ -221,45 +221,45 @@ static long root_elements(LCDD& lcdd, int argc, char** argv) { } } if ( element ) { - XML::DocumentHandler dH; + xml::DocumentHandler dH; dH.output(doc, output); } return 1; } -DECLARE_APPLY(DD4hepElementTable,root_elements) +DECLARE_APPLY(dd4hepElementTable,root_elements) /// Basic entry point to dump the ROOT TGeoElementTable object /** * Dump the elment table to stdout or file. * - * Factory: DD4hepElementTable -format xml/text(default) -output <file-name> + * Factory: dd4hepElementTable -format xml/text(default) -output <file-name> * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long root_materials(LCDD& lcdd, int argc, char** argv) { +static long root_materials(Detector& description, int argc, char** argv) { struct MaterialPrint { - typedef XML::Element elt_h; + typedef xml::Element elt_h; MaterialPrint() = default; virtual ~MaterialPrint() = default; - virtual elt_h print(TGeoMaterial* m) { + virtual elt_h print(TGeoMaterial* mat) { ::printf("%-8s %-32s Aeff=%7.3f Zeff=%7.4f rho=%8.3f [g/mole] radlen=%8.3g [cm] intlen=%8.3g [cm] index=%3d\n", - m->IsMixture() ? "Mixture" : "Material", - m->GetName(), m->GetA(), m->GetZ(), m->GetDensity(), - m->GetRadLen(), m->GetIntLen(), m->GetIndex()); + mat->IsMixture() ? "Mixture" : "Material", + mat->GetName(), mat->GetA(), mat->GetZ(), mat->GetDensity(), + mat->GetRadLen(), mat->GetIntLen(), mat->GetIndex()); return elt_h(0); } - virtual void print(elt_h, TGeoElement* e, double frac) { + virtual void print(elt_h, TGeoElement* elt, double frac) { ::printf(" %-6s Fraction: %7.3f Z=%3d A=%6.2f N=%3d Neff=%6.2f\n", - e->GetName(), frac, e->Z(), e->A(), e->N(), e->Neff()); + elt->GetName(), frac, elt->Z(), elt->A(), elt->N(), elt->Neff()); } - virtual void operator()(TGeoMaterial* m) { - Double_t* mix = m->IsMixture() ? ((TGeoMixture*)m)->GetWmixt() : 0; - elt_h mh = print(m); - for(int n=m->GetNelements(), i=0; i<n; ++i) { - TGeoElement* e = m->GetElement(i); - print(mh, e, mix ? mix[i] : 1); + virtual void operator()(TGeoMaterial* mat) { + Double_t* mix = mat->IsMixture() ? ((TGeoMixture*)mat)->GetWmixt() : 0; + elt_h mh = print(mat); + for(int n=mat->GetNelements(), i=0; i<n; ++i) { + TGeoElement* elt = mat->GetElement(i); + print(mh, elt, mix ? mix[i] : 1); } } }; @@ -267,25 +267,25 @@ static long root_materials(LCDD& lcdd, int argc, char** argv) { elt_h root; MaterialPrintXML(elt_h r) : root(r) {} virtual ~MaterialPrintXML() {} - virtual elt_h print(TGeoMaterial* m) { + virtual elt_h print(TGeoMaterial* mat) { elt_h elt = root.addChild(_U(material)); - elt.setAttr(_U(name),m->GetName()); - if ( ::strlen(m->GetTitle())>0 ) { - elt.setAttr(_U(formula),m->GetTitle()); + elt.setAttr(_U(name),mat->GetName()); + if ( ::strlen(mat->GetTitle())>0 ) { + elt.setAttr(_U(formula),mat->GetTitle()); } - else if ( m->GetNelements() == 1 ) { - elt.setAttr(_U(formula),m->GetElement(0)->GetName()); + else if ( mat->GetNelements() == 1 ) { + elt.setAttr(_U(formula),mat->GetElement(0)->GetName()); } elt_h D = elt.addChild(_U(D)); D.setAttr(_U(type),"density"); - D.setAttr(_U(value),m->GetDensity()); + D.setAttr(_U(value),mat->GetDensity()); D.setAttr(_U(unit),"g/cm3"); return elt; } - virtual void print(elt_h mat, TGeoElement* e, double frac) { + virtual void print(elt_h mat, TGeoElement* element, double frac) { elt_h elt = mat.addChild(_U(composite)); elt.setAttr(_U(n),frac); - elt.setAttr(_U(ref),e->GetName()); + elt.setAttr(_U(ref),element->GetName()); } }; @@ -296,7 +296,7 @@ static long root_materials(LCDD& lcdd, int argc, char** argv) { if ( c == 't' && i+1<argc ) type = argv[++i]; else if ( c == 'o' && i+1<argc ) output = argv[++i]; else { - ::printf("DD4hepElementTable -opt [-opt] \n" + ::printf("dd4hepElementTable -opt [-opt] \n" " -type <string> Output format: text or xml \n" " -output <file-name> Output file specifier (xml only) \n" "\n"); @@ -305,14 +305,14 @@ static long root_materials(LCDD& lcdd, int argc, char** argv) { } } - XML::Document doc(0); - XML::DocumentHandler docH; - XML::Element element(0); + xml::Document doc(0); + xml::DocumentHandler docH; + xml::Element element(0); if ( type == "xml" ) { const char comment[] = "\n" " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" " ++++ Linear collider detector description in C++ ++++\n" - " ++++ DD4hep Detector description generator. ++++\n" + " ++++ dd4hep Detector description generator. ++++\n" " ++++ ++++\n" " ++++ Parser:" XML_IMPLEMENTATION_TYPE @@ -329,19 +329,19 @@ static long root_materials(LCDD& lcdd, int argc, char** argv) { ? new MaterialPrintXML(element) : new MaterialPrint()); TObject* obj = 0; - TList* mats = lcdd.manager().GetListOfMaterials(); + TList* mats = description.manager().GetListOfMaterials(); dd4hep_ptr<TIterator> iter(mats->MakeIterator()); while( (obj=iter->Next()) != 0 ) { TGeoMaterial* mat = (TGeoMaterial*)obj; (*printer)(mat); } if ( element ) { - XML::DocumentHandler dH; + xml::DocumentHandler dH; dH.output(doc, output); } return 1; } -DECLARE_APPLY(DD4hepMaterialTable,root_materials) +DECLARE_APPLY(dd4hepMaterialTable,root_materials) /// Basic entry point to interprete an XML document /** @@ -350,30 +350,30 @@ DECLARE_APPLY(DD4hepMaterialTable,root_materials) * - The processing hint (build type) is passed as optional * second argument. * - * Factory: DD4hepCompactLoader + * Factory: dd4hepCompactLoader * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long load_compact(LCDD& lcdd, int argc, char** argv) { +static long load_compact(Detector& description, int argc, char** argv) { if ( argc > 0 ) { - LCDDBuildType type = BUILD_DEFAULT; + DetectorBuildType type = BUILD_DEFAULT; string input = argv[0]; if ( argc > 1 ) { type = buildType(argv[1]); printout(INFO,"CompactLoader","+++ Processing compact file: %s with flag %s", input.c_str(), argv[1]); - lcdd.fromCompact(input,type); + description.fromCompact(input,type); return 1; } printout(INFO,"CompactLoader","+++ Processing compact file: %s",input.c_str()); - lcdd.fromCompact(input); + description.fromCompact(input); return 1; } return 0; } -DECLARE_APPLY(DD4hepCompactLoader,load_compact) +DECLARE_APPLY(dd4hepCompactLoader,load_compact) /// Basic entry point to process any XML document. /** @@ -384,30 +384,30 @@ DECLARE_APPLY(DD4hepCompactLoader,load_compact) * * The root tag defines the plugin to interprete it. * - * Factory: DD4hepXMLLoader + * Factory: dd4hepXMLLoader * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long load_xml(LCDD& lcdd, int argc, char** argv) { +static long load_xml(Detector& description, int argc, char** argv) { if ( argc > 0 ) { - LCDDBuildType type = BUILD_DEFAULT; + DetectorBuildType type = BUILD_DEFAULT; string input = argv[0]; if ( argc > 1 ) { type = buildType(argv[1]); printout(INFO,"XMLLoader","+++ Processing XML file: %s with flag %s", input.c_str(), argv[1]); - lcdd.fromXML(input,type); + description.fromXML(input,type); return 1; } printout(INFO,"XMLLoader","+++ Processing XML file: %s",input.c_str()); - lcdd.fromXML(input); + description.fromXML(input); return 1; } return 0; } -DECLARE_APPLY(DD4hepXMLLoader,load_xml) +DECLARE_APPLY(dd4hepXMLLoader,load_xml) /// Basic entry point to process any pre-parsed XML document. /** @@ -418,19 +418,19 @@ DECLARE_APPLY(DD4hepXMLLoader,load_xml) * * The root tag defines the plugin to interprete it. * - * Factory: DD4hepXMLProcessor + * Factory: dd4hepXMLProcessor * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long process_xml_doc(LCDD& lcdd, int argc, char** argv) { +static long process_xml_doc(Detector& description, int argc, char** argv) { if ( argc > 0 ) { - LCDDBuildType type = BUILD_DEFAULT; - LCDDImp* imp = dynamic_cast<LCDDImp*>(&lcdd); + DetectorBuildType type = BUILD_DEFAULT; + DetectorImp* imp = dynamic_cast<DetectorImp*>(&description); if ( imp ) { - XML::XmlElement* h = (XML::XmlElement*)argv[0]; - XML::Handle_t input(h); + xml::XmlElement* h = (xml::XmlElement*)argv[0]; + xml::Handle_t input(h); if ( input.ptr() ) { if ( argc > 1 ) { type = buildType(argv[1]); @@ -440,26 +440,26 @@ static long process_xml_doc(LCDD& lcdd, int argc, char** argv) { imp->processXMLElement(input, type); return 1; } - except("DD4hepXMLProcessor", + except("dd4hepXMLProcessor", "++ The passed reference to the parsed XML document is invalid."); } } return 0; } -DECLARE_APPLY(DD4hepXMLProcessor,process_xml_doc) +DECLARE_APPLY(dd4hepXMLProcessor,process_xml_doc) /// Basic entry point to load the volume manager object /** - * Factory: DD4hepVolumeManager + * Factory: dd4hepVolumeManager * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long load_volmgr(LCDD& lcdd, int, char**) { - printout(INFO,"DD4hepVolumeManager","**** running plugin DD4hepVolumeManager ! " ); +static long load_volmgr(Detector& description, int, char**) { + printout(INFO,"dd4hepVolumeManager","**** running plugin dd4hepVolumeManager ! " ); try { - LCDDImp* imp = dynamic_cast<LCDDImp*>(&lcdd); + DetectorImp* imp = dynamic_cast<DetectorImp*>(&description); if ( imp ) { imp->imp_loadVolumeManager(); printout(INFO,"VolumeManager","+++ Volume manager populated and loaded."); @@ -468,77 +468,73 @@ static long load_volmgr(LCDD& lcdd, int, char**) { } catch (const exception& e) { throw runtime_error(string(e.what()) + "\n" - "DD4hep: while programming VolumeManager. Are your volIDs correct?"); + "dd4hep: while programming VolumeManager. Are your volIDs correct?"); } catch (...) { throw runtime_error("UNKNOWN exception while programming VolumeManager. Are your volIDs correct?"); } return 0; } -DECLARE_APPLY(DD4hepVolumeManager,load_volmgr) +DECLARE_APPLY(dd4hepVolumeManager,load_volmgr) -/// Basic entry point to dump a DD4hep geometry to a ROOT file +/// Basic entry point to dump a dd4hep geometry to a ROOT file /** - * Factory: DD4hepGeometry2ROOT + * Factory: dd4hepGeometry2ROOT * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long dump_geometry2root(LCDD& lcdd, int argc, char** argv) { +static long dump_geometry2root(Detector& description, int argc, char** argv) { if ( argc > 0 ) { string output = argv[0]; printout(INFO,"Geometry2ROOT","+++ Dump geometry to root file:%s",output.c_str()); - //lcdd.manager().Export(output.c_str()+1); - if ( DD4hepRootPersistency::save(lcdd,output.c_str(),"Geometry") > 1 ) { + //description.manager().Export(output.c_str()+1); + if ( DD4hepRootPersistency::save(description,output.c_str(),"Geometry") > 1 ) { return 1; } } printout(ERROR,"Geometry2ROOT","+++ No output file name given."); return 0; } -DECLARE_APPLY(DD4hepGeometry2ROOT,dump_geometry2root) +DECLARE_APPLY(dd4hepGeometry2ROOT,dump_geometry2root) -/// Basic entry point to load a DD4hep geometry directly from the ROOT file +/// Basic entry point to load a dd4hep geometry directly from the ROOT file /** - * Factory: DD4hepRootLoader + * Factory: dd4hepRootLoader * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long load_geometryFromroot(LCDD& lcdd, int argc, char** argv) { +static long load_geometryFromroot(Detector& description, int argc, char** argv) { if ( argc > 0 ) { string input = argv[0]; - printout(INFO,"DD4hepRootLoader","+++ Read geometry from root file:%s",input.c_str()); - if ( 1 == DD4hepRootPersistency::load(lcdd,input.c_str(),"Geometry") ) { + printout(INFO,"dd4hepRootLoader","+++ Read geometry from root file:%s",input.c_str()); + if ( 1 == DD4hepRootPersistency::load(description,input.c_str(),"Geometry") ) { return 1; } } - printout(ERROR,"DD4hepRootLoader","+++ No input file name given."); + printout(ERROR,"dd4hepRootLoader","+++ No input file name given."); return 0; } -DECLARE_APPLY(DD4hepRootLoader,load_geometryFromroot) +DECLARE_APPLY(dd4hepRootLoader,load_geometryFromroot) /// Basic entry point to print out the volume hierarchy /** - * Factory: DD4hepVolumeDump + * Factory: dd4hepVolumeDump * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long dump_volume_tree(LCDD& lcdd, int argc, char** argv) { +static long dump_volume_tree(Detector& description, int argc, char** argv) { struct Actor { - typedef PlacedVolume::VolID VID; - typedef PlacedVolume::VolIDs VIDs; - bool m_printVolIDs; - bool m_printPointers; - bool m_printPositions; - bool m_printSensitivesOnly; - Actor(int ac, char** av) - : m_printVolIDs(false), m_printPointers(false), m_printPositions(false), m_printSensitivesOnly(false) - { + bool m_printVolIDs = false; + bool m_printPointers = false; + bool m_printPositions = false; + bool m_printSensitivesOnly = false; + Actor(int ac, char** av) { for(int i=0; i<ac; ++i) { char c = ::tolower(av[i][0]); char* p = av[i]; @@ -550,7 +546,7 @@ static long dump_volume_tree(LCDD& lcdd, int argc, char** argv) { } } - long dump(TGeoNode* ideal, TGeoNode* aligned,int level, VIDs volids) const { + long dump(TGeoNode* ideal, TGeoNode* aligned,int level, PlacedVolume::VolIDs volids) const { char fmt[128]; string opt_info; PlacedVolume pv(ideal); @@ -566,13 +562,13 @@ static long dump_volume_tree(LCDD& lcdd, int argc, char** argv) { } // Top level volume! have no volume ids if ( m_printVolIDs && ideal && ideal->GetMotherVolume() ) { - VIDs vid = pv.volIDs(); + PlacedVolume::VolIDs vid = pv.volIDs(); if ( !vid.empty() ) { sensitive = true; log << " VolID: "; - volids.std::vector<VID>::insert(volids.end(),vid.begin(),vid.end()); - for(VIDs::const_iterator i=volids.begin(); i!=volids.end(); ++i) { - ::snprintf(fmt, sizeof(fmt), "%s:%2d ",(*i).first.c_str(), (*i).second); + volids.insert(volids.end(),vid.begin(),vid.end()); + for( const auto& i : volids ) { + ::snprintf(fmt, sizeof(fmt), "%s:%2d ",i.first.c_str(),i.second); log << fmt; } if ( !vid.empty() || pv.volume().isSensitive() ) { @@ -642,21 +638,21 @@ static long dump_volume_tree(LCDD& lcdd, int argc, char** argv) { return 1; } }; - string place = lcdd.world().placementPath(); - DetectorTools::PlacementPath path; - DetectorTools::placementPath(lcdd.world(), path); - PlacedVolume pv = DetectorTools::findNode(lcdd.world().placement(),place); + string place = description.world().placementPath(); + detail::tools::PlacementPath path; + detail::tools::placementPath(description.world(), path); + PlacedVolume pv = detail::tools::findNode(description.world().placement(),place); Actor actor(argc,argv); - return actor.dump(lcdd.world().placement().ptr(),pv.ptr(),0,PlacedVolume::VolIDs()); + return actor.dump(description.world().placement().ptr(),pv.ptr(),0,PlacedVolume::VolIDs()); } -DECLARE_APPLY(DD4hepVolumeDump,dump_volume_tree) +DECLARE_APPLY(dd4hepVolumeDump,dump_volume_tree) // ====================================================================================== /// Plugin function: Apply arbitrary functor callback on the tree of detector elements /** - * Factory: DD4hep_DetElementProcessor + * Factory: dd4hep_DetElementProcessor * - * Invokation: -plugin DD4hep_DetElementProcessor + * Invokation: -plugin dd4hep_DetElementProcessor * -detector /path/to/detElement (default: /world) * -processor <factory-name> <processor-args> * @@ -664,48 +660,47 @@ DECLARE_APPLY(DD4hepVolumeDump,dump_volume_tree) * \version 1.0 * \date 18/11/2016 */ -static int detelement_processor(LCDD& lcdd, int argc, char** argv) { - DetElement det = lcdd.world(); - unique_ptr<DetectorProcessor> proc(DD4hep::createProcessor<DetectorProcessor>(lcdd, argc, argv)); +static int detelement_processor(Detector& description, int argc, char** argv) { + DetElement det = description.world(); + unique_ptr<DetectorProcessor> proc(dd4hep::createProcessor<DetectorProcessor>(description, argc, argv)); for(int i=0, num=std::min(argc,3); i<num; ++i) { if ( 0 == ::strncmp(argv[i],"-detector",4) ) { - det = DetectorTools::findElement(lcdd, argv[++i]); + det = detail::tools::findElement(description, argv[++i]); break; } } return DetectorScanner().scan(*proc,det); } -DECLARE_APPLY(DD4hep_DetElementProcessor,detelement_processor) +DECLARE_APPLY(dd4hep_DetElementProcessor,detelement_processor) /// Basic entry point to print out the detector element hierarchy /** - * Factory: DD4hepDetectorDump, DD4hepDetectorVolumeDump + * Factory: dd4hepDetectorDump, dd4hepDetectorVolumeDump * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -template <int flag> long dump_detelement_tree(LCDD& lcdd, int argc, char** argv) { +template <int flag> long dump_detelement_tree(Detector& description, int argc, char** argv) { struct Actor { static long dump(DetElement de,int level, bool sensitive_only) { const DetElement::Children& c = de.children(); if ( !sensitive_only || 0 != de.volumeID() ) { PlacedVolume place = de.placement(); - const TGeoNode* node = place.ptr(); - char sens = node ? place.volume().isSensitive() ? 'S' : ' ' : ' '; + char sens = place.isValid() ? place.volume().isSensitive() ? 'S' : ' ' : ' '; char fmt[128]; switch(flag) { case 0: if ( de.placement() == de.idealPlacement() ) { ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s NumDau:%%d VolID:%%08X Place:%%p %%c",level+1,2*level+1); printout(INFO,"DetectorDump",fmt,"",de.path().c_str(),int(c.size()), - (unsigned long)de.volumeID(), (void*)node, sens); + (unsigned long)de.volumeID(), (void*)place.ptr(), sens); break; } ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s NumDau:%%d VolID:%%08X Place:%%p [ideal:%%p aligned:%%p] %%c", level+1,2*level+1); printout(INFO,"DetectorDump",fmt,"",de.path().c_str(),int(c.size()), - (unsigned long)de.volumeID(), (void*)de.idealPlacement().ptr(), (void*)node, sens); + (unsigned long)de.volumeID(), (void*)de.idealPlacement().ptr(), (void*)place.ptr(), sens); break; case 1: ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Detector: %%s NumDau:%%d VolID:%%p",level+1,2*level+1); @@ -717,7 +712,7 @@ template <int flag> long dump_detelement_tree(LCDD& lcdd, int argc, char** argv) } ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds Placement: %%s [ideal:%%p aligned:%%p] %%c",level+1,2*level+3); printout(INFO,"DetectorDump",fmt,"", de.placementPath().c_str(), - (void*)de.idealPlacement().ptr(), (void*)node, sens); + (void*)de.idealPlacement().ptr(), (void*)place.ptr(), sens); break; default: break; @@ -732,20 +727,20 @@ template <int flag> long dump_detelement_tree(LCDD& lcdd, int argc, char** argv) for(int i=0; i<argc; ++i) { if ( ::strcmp(argv[i],"--sensitive")==0 ) { sensitive_only = true; } } - return Actor::dump(lcdd.world(),0,sensitive_only); + return Actor::dump(description.world(),0,sensitive_only); } -DECLARE_APPLY(DD4hepDetectorDump,dump_detelement_tree<0>) -DECLARE_APPLY(DD4hepDetectorVolumeDump,dump_detelement_tree<1>) +DECLARE_APPLY(dd4hepDetectorDump,dump_detelement_tree<0>) +DECLARE_APPLY(dd4hepDetectorVolumeDump,dump_detelement_tree<1>) /// Basic entry point to print out the volume hierarchy /** - * Factory: DD4hepDetElementCache + * Factory: dd4hepDetElementCache * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long detelement_cache(LCDD& lcdd, int , char** ) { +static long detelement_cache(Detector& description, int , char** ) { struct Actor { static long cache(DetElement de) { const DetElement::Children& c = de.children(); @@ -753,89 +748,88 @@ static long detelement_cache(LCDD& lcdd, int , char** ) { de.nominal().detectorTransformation(); de.placementPath(); de.path(); - for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) - cache((*i).second); + for( const auto& i : c ) cache(i.second); return 1; } }; - return Actor::cache(lcdd.world()); + return Actor::cache(description.world()); } -DECLARE_APPLY(DD4hepDetElementCache,detelement_cache) +DECLARE_APPLY(dd4hepDetElementCache,detelement_cache) -/// Basic entry point to dump the geometry tree of the lcdd instance +/// Basic entry point to dump the geometry tree of the description instance /** - * Factory: DD4hepGeometryTreeDump + * Factory: dd4hepGeometryTreeDump * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ #include "../GeometryTreeDump.h" -static long exec_GeometryTreeDump(LCDD& lcdd, int, char** ) { +static long exec_GeometryTreeDump(Detector& description, int, char** ) { GeometryTreeDump dmp; - dmp.create(lcdd.world()); + dmp.create(description.world()); return 1; } -DECLARE_APPLY(DD4hepGeometryTreeDump,exec_GeometryTreeDump) +DECLARE_APPLY(dd4hepGeometryTreeDump,exec_GeometryTreeDump) /// Basic entry point to dump the geometry in GDML format /** - * Factory: DD4hepSimpleGDMLWriter + * Factory: dd4hepSimpleGDMLWriter * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ #include "../SimpleGDMLWriter.h" -static long exec_SimpleGDMLWriter(LCDD& lcdd, int argc, char** argv) { +static long exec_SimpleGDMLWriter(Detector& description, int argc, char** argv) { if ( argc > 1 ) { string output = argv[1]; ofstream out(output.c_str()+1,ios_base::out); SimpleGDMLWriter dmp(out); - dmp.create(lcdd.world()); + dmp.create(description.world()); } else { SimpleGDMLWriter dmp(cout); - dmp.create(lcdd.world()); + dmp.create(description.world()); } return 1; } -DECLARE_APPLY(DD4hepSimpleGDMLWriter,exec_SimpleGDMLWriter) +DECLARE_APPLY(dd4hepSimpleGDMLWriter,exec_SimpleGDMLWriter) /// Basic entry point to print out detector type map /** - * Factory: DD4hepDetectorTypes + * Factory: dd4hepDetectorTypes * * \author M.Frank * \version 1.0 * \date 01/04/2014 */ -static long detectortype_cache(LCDD& lcdd, int , char** ) { - vector<string> v = lcdd.detectorTypes(); +static long detectortype_cache(Detector& description, int , char** ) { + vector<string> v = description.detectorTypes(); printout(INFO,"DetectorTypes","Detector type dump: %ld types:",long(v.size())); for(vector<string>::const_iterator i=v.begin(); i!=v.end(); ++i) { - const vector<DetElement>& vv=lcdd.detectors(*i); + const vector<DetElement>& vv=description.detectors(*i); printout(INFO,"DetectorTypes","\t --> %ld %s detectors:",long(vv.size()),(*i).c_str()); for(vector<DetElement>::const_iterator j=vv.begin(); j!=vv.end(); ++j) printout(INFO,"DetectorTypes","\t\t %-16s --> %s [%s]",(*i).c_str(),(*j).name(),(*j).type().c_str()); } return 1; } -DECLARE_APPLY(DD4hepDetectorTypes,detectortype_cache) +DECLARE_APPLY(dd4hepDetectorTypes,detectortype_cache) #include "DD4hep/SurfaceInstaller.h" typedef SurfaceInstaller TestSurfacesPlugin; DECLARE_SURFACE_INSTALLER(TestSurfaces,TestSurfacesPlugin) #include "DD4hep/PluginTester.h" -static long install_plugin_tester(LCDD& lcdd, int , char** ) { - PluginTester* test = lcdd.extension<PluginTester>(false); +static long install_plugin_tester(Detector& description, int , char** ) { + PluginTester* test = description.extension<PluginTester>(false); if ( !test ) { - lcdd.addExtension<PluginTester>(new PluginTester()); + description.addExtension<PluginTester>(new PluginTester()); printout(INFO,"PluginTester", - "+++ Successfully installed PluginTester instance to LCDD."); + "+++ Successfully installed PluginTester instance to Detector."); } return 1; } -DECLARE_APPLY(DD4hepPluginTester,install_plugin_tester) +DECLARE_APPLY(dd4hepPluginTester,install_plugin_tester) diff --git a/DDCore/src/plugins/VolumeMgrTest.cpp b/DDCore/src/plugins/VolumeMgrTest.cpp index b04e0fc52..34085eb34 100644 --- a/DDCore/src/plugins/VolumeMgrTest.cpp +++ b/DDCore/src/plugins/VolumeMgrTest.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,13 +12,14 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/Factories.h" #include "DD4hep/IDDescriptor.h" #include "DD4hep/VolumeManager.h" #include "DD4hep/DetectorTools.h" #include "DD4hep/MatrixHelpers.h" +#include "DD4hep/AlignmentsNominalMap.h" #include "DD4hep/detail/VolumeManagerInterna.h" // C/C++ include files @@ -26,8 +27,8 @@ #include <algorithm> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; namespace { /** @class VolIDTest @@ -39,20 +40,22 @@ namespace { * @version 1.0 */ struct VolIDTest { - typedef DetectorTools::PlacementPath Chain; - typedef PlacedVolume::VolIDs VolIDs; + typedef detail::tools::PlacementPath Chain; + typedef PlacedVolume::VolIDs VolIDs; + /// Helper to scan volume ids struct FND { const string& test; FND(const string& c) : test(c) {} bool operator()(const VolIDs::value_type& c) const { return c.first == test; } }; + AlignmentsNominalMap m_mapping; IDDescriptor m_iddesc; VolumeManager m_mgr; DetElement m_det; /// Initializing constructor - VolIDTest(LCDD& lcdd, DetElement sdet, size_t depth); + VolIDTest(Detector& description, DetElement sdet, size_t depth); /// Default destructor virtual ~VolIDTest() {} /// Check volume integrity @@ -63,20 +66,20 @@ namespace { void walkVolume(DetElement e, PlacedVolume pv, VolIDs ids, const Chain& chain, size_t depth, size_t mx_depth) const; /// Action routine to execute the test - static long run(LCDD& lcdd,int argc,char** argv); + static long run(Detector& description,int argc,char** argv); }; } /// Initializing constructor -VolIDTest::VolIDTest(LCDD& lcdd, DetElement sdet, size_t depth) : m_det(sdet) { - m_mgr = lcdd.volumeManager(); +VolIDTest::VolIDTest(Detector& description, DetElement sdet, size_t depth) : m_mapping(description.world()), m_det(sdet) { + m_mgr = description.volumeManager(); if ( !m_det.isValid() ) { stringstream err; err << "The subdetector " << m_det.name() << " is not known to the geometry."; printout(INFO,"VolIDTest",err.str().c_str()); throw runtime_error(err.str()); } - if ( !lcdd.sensitiveDetector(m_det.name()).isValid() ) { + if ( !description.sensitiveDetector(m_det.name()).isValid() ) { stringstream err; err << "The sensitive detector of subdetector " << m_det.name() << " is not known to the geometry."; @@ -84,7 +87,7 @@ VolIDTest::VolIDTest(LCDD& lcdd, DetElement sdet, size_t depth) : m_det(sdet) { //throw runtime_error(err.str()); return; } - m_iddesc = lcdd.sensitiveDetector(m_det.name()).readout().idSpec(); + m_iddesc = description.sensitiveDetector(m_det.name()).readout().idSpec(); //walk(m_det,VolIDs(),Chain(),0,depth); PlacedVolume pv = sdet.placement(); VolIDs ids = pv.volIDs(); @@ -100,14 +103,14 @@ void VolIDTest::checkVolume(DetElement detector, PlacedVolume pv, const VolIDs& VolumeID det_vol_id = detector.volumeID(); VolumeID vid = det_vol_id; DetElement top_sdet, det_elem; - VolumeManager::Context* mgr_ctxt = 0; + VolumeManagerContext* mgr_ctxt = 0; try { vid = m_iddesc.encode(child_ids); top_sdet = m_mgr.lookupDetector(vid); det_elem = m_mgr.lookupDetElement(vid); mgr_ctxt = m_mgr.lookupContext(vid); - + if ( pv.volume().isSensitive() ) { PlacedVolume det_place = m_mgr.lookupPlacement(vid); if ( pv.ptr() != det_place.ptr() ) { @@ -122,8 +125,8 @@ void VolIDTest::checkVolume(DetElement detector, PlacedVolume pv, const VolIDs& << " instead of " << detector.path() << " (" << (void*)detector.ptr() << ")" << " vid:" << volumeID(vid); } - // This is sort of a bit wischi-waschi.... - else if ( !DetectorTools::isParentElement(detector,det_elem) ) { + else if ( !detail::tools::isParentElement(detector,det_elem) ) { + // This is sort of a bit wischi-waschi.... err << "VolumeMgrTest: Wrong associated detector element vid=" << volumeID(vid) << " got " << det_elem.path() << " (" << (void*)det_elem.ptr() << ") " << " instead of " << detector.path() << " (" << (void*)detector.ptr() << ")" @@ -163,7 +166,7 @@ void VolIDTest::checkVolume(DetElement detector, PlacedVolume pv, const VolIDs& printout(INFO,m_det.name()," Elt:%-64s vid:%s %s Parent-OK:%3s", det_elem.path().c_str(),volumeID(det_elem.volumeID()).c_str(), id_desc.c_str(), - yes_no(DetectorTools::isParentElement(detector,det_elem))); + yes_no(detail::tools::isParentElement(detector,det_elem))); try { if ( pv.volume().isSensitive() ) { @@ -185,7 +188,7 @@ void VolIDTest::checkVolume(DetElement detector, PlacedVolume pv, const VolIDs& det_elem.path().c_str(),volumeID(det_elem.volumeID()).c_str()); det_elem.nominal().worldTransformation().Print(); ::printf("VolumeMgr Trafo: %s [%s]\t\t",det_elem.path().c_str(),volumeID(vid).c_str()); - m_mgr.worldTransformation(vid).Print(); + m_mgr.worldTransformation(m_mapping,vid).Print(); if ( 0 == mgr_ctxt ) { printout(ERROR,m_det.name(),"VOLUME_MANAGER FAILED: Could not find entry for vid:%s.", volumeID(vid).c_str()); @@ -193,9 +196,9 @@ void VolIDTest::checkVolume(DetElement detector, PlacedVolume pv, const VolIDs& if ( pv.ptr() == det_elem.placement().ptr() ) { // The computed transformation 'trafo' MUST be equal to: // m_mgr.worldTransformation(vid) AND det_elem.nominal().worldTransformation() - int res1 = _matrixEqual(trafo, det_elem.nominal().worldTransformation()); - int res2 = _matrixEqual(trafo, m_mgr.worldTransformation(vid)); - if ( res1 != MATRICES_EQUAL || res2 != MATRICES_EQUAL ) { + int res1 = Matrices::_matrixEqual(trafo, det_elem.nominal().worldTransformation()); + int res2 = Matrices::_matrixEqual(trafo, m_mgr.worldTransformation(m_mapping,vid)); + if ( res1 != Matrices::MATRICES_EQUAL || res2 != Matrices::MATRICES_EQUAL ) { printout(ERROR,m_det.name(),"DETELEMENT_PLACEMENT FAILED: World transformation DIFFER."); } else { @@ -207,8 +210,8 @@ void VolIDTest::checkVolume(DetElement detector, PlacedVolume pv, const VolIDs& // The computed transformation 'trafo' MUST be equal to: // m_mgr.worldTransformation(vid) // The det_elem.nominal().worldTransformation() however is DIFFERENT! - int res2 = _matrixEqual(trafo, m_mgr.worldTransformation(vid)); - if ( res2 != MATRICES_EQUAL ) { + int res2 = Matrices::_matrixEqual(trafo, m_mgr.worldTransformation(m_mapping,vid)); + if ( res2 != Matrices::MATRICES_EQUAL ) { printout(ERROR,m_det.name(),"VOLUME_PLACEMENT FAILED: World transformation DIFFER."); } else { @@ -216,18 +219,6 @@ void VolIDTest::checkVolume(DetElement detector, PlacedVolume pv, const VolIDs& volumeID(vid).c_str()); } } -#if 0 - int ii=1; - DetElement par = det_elem; - while( (par.isValid()) ) { - const TGeoMatrix* mat = par.placement()->GetMatrix(); - ::printf("Element placement [%d] VolID:%s %s\t\t",int(ii), - par.placement().volIDs().str().c_str(), par.path().c_str()); - mat->Print(); - par = par.parent(); - ++ii; - } -#endif } } catch(const exception& ex) { @@ -285,24 +276,24 @@ void VolIDTest::walk(DetElement detector, VolIDs ids, const Chain& chain, size_t } #endif /// Action routine to execute the test -long VolIDTest::run(LCDD& lcdd,int argc,char** argv) { - printout(ALWAYS,"DD4hepVolumeMgrTest","++ Processing plugin..."); +long VolIDTest::run(Detector& description,int argc,char** argv) { + printout(ALWAYS,"dd4hepVolumeMgrTest","++ Processing plugin..."); for(int iarg=0; iarg<argc;++iarg) { if ( argv[iarg] == 0 ) break; string name = argv[iarg]; if ( name == "all" || name == "All" || name == "ALL" ) { - const DetElement::Children& children = lcdd.world().children(); + const DetElement::Children& children = description.world().children(); for (DetElement::Children::const_iterator i=children.begin(); i!=children.end(); ++i) { DetElement sdet = (*i).second; - printout(INFO,"DD4hepVolumeMgrTest","++ Processing subdetector: %s",sdet.name()); - VolIDTest test(lcdd,sdet,99); + printout(INFO,"dd4hepVolumeMgrTest","++ Processing subdetector: %s",sdet.name()); + VolIDTest test(description,sdet,99); } return 1; } - printout(INFO,"DD4hepVolumeMgrTest","++ Processing subdetector: %s",name.c_str()); - VolIDTest test(lcdd,lcdd.detector(name),99); + printout(INFO,"dd4hepVolumeMgrTest","++ Processing subdetector: %s",name.c_str()); + VolIDTest test(description,description.detector(name),99); } return 1; } -DECLARE_APPLY(DD4hepVolumeMgrTest,VolIDTest::run) +DECLARE_APPLY(dd4hepVolumeMgrTest,VolIDTest::run) diff --git a/DDDB/CMakeLists.txt b/DDDB/CMakeLists.txt index b2d7d61c3..01dbd959e 100644 --- a/DDDB/CMakeLists.txt +++ b/DDDB/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/DDDB/include/DDDB/DDDBConditionsLoader.h b/DDDB/include/DDDB/DDDBConditionsLoader.h index 2ea0ad392..ab6ac287a 100644 --- a/DDDB/include/DDDB/DDDBConditionsLoader.h +++ b/DDDB/include/DDDB/DDDBConditionsLoader.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -29,9 +29,9 @@ #include "XML/UriReader.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit + /// Namespace for implementation details of the AIDA detector description toolkit namespace DDDB { /// Implementation of a stack of conditions assembled before application @@ -40,10 +40,7 @@ namespace DD4hep { * \version 1.0 * \ingroup DD4HEP_CONDITIONS */ - class DDDBConditionsLoader : public Conditions::ConditionsDataLoader { - typedef Conditions::Condition Condition; - typedef Conditions::RangeConditions RangeConditions; - typedef Conditions::ConditionsManager ConditionsManager; + class DDDBConditionsLoader : public cond::ConditionsDataLoader { typedef std::pair<std::string, std::string> Key; typedef std::map<Condition::key_type, Key> KeyMap; /** @@ -51,45 +48,45 @@ namespace DD4hep { * \version 1.0 * \ingroup DD4HEP_CONDITIONS */ - class KeyCollector : public Conditions::ConditionsListener { + class KeyCollector : public cond::ConditionsListener { public: - std::pair<ConditionsListener*,void*> call; + std::pair<cond::ConditionsListener*,void*> call; KeyMap keys; /// Initializing constructor KeyCollector(); /// ConditionsListener overload: onRegister new condition - virtual void onRegisterCondition(Conditions::Condition cond, void* param); + virtual void onRegisterCondition(Condition cond, void* param); }; - XML::UriReader* m_resolver; + xml::UriReader* m_resolver; KeyCollector m_keys; /// Load single conditions document - void loadDocument(XML::UriContextReader& rdr, const Key& k); + void loadDocument(xml::UriContextReader& rdr, const Key& k); /// Load single conditions document - void loadDocument(XML::UriContextReader& rdr, + void loadDocument(xml::UriContextReader& rdr, const std::string& sys_id, const std::string& obj_id); public: /// Default constructor - DDDBConditionsLoader(Geometry::LCDD& lcdd, ConditionsManager mgr, const std::string& nam); + DDDBConditionsLoader(Detector& description, cond::ConditionsManager mgr, const std::string& nam); /// Default destructor virtual ~DDDBConditionsLoader(); /// Load a condition set given a Detector Element and the conditions name according to their validity virtual size_t load_single(key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions); /// Load a condition set given a Detector Element and the conditions name according to their validity virtual size_t load_range( key_type key, - const iov_type& req_validity, + const IOV& req_validity, RangeConditions& conditions); /// Optimized update using conditions slice data - virtual size_t load_many( const iov_type& req_validity, + virtual size_t load_many( const IOV& req_validity, RequiredItems& work, LoadedItems& loaded, - iov_type& conditions_validity); + IOV& conditions_validity); }; } /* End namespace DDDB */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDDB_DDDBCONDITONSLOADER_H */ diff --git a/DDDB/include/DDDB/DDDBConversion.h b/DDDB/include/DDDB/DDDBConversion.h index 44e885a14..9b33185ea 100644 --- a/DDDB/include/DDDB/DDDBConversion.h +++ b/DDDB/include/DDDB/DDDBConversion.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -30,49 +30,41 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities namespace DDDB { /// Forward declarations - class Shape; - class LogVol; - class Catalog; - class TabProperty; - class Document; - - using Geometry::DetElement; - using Geometry::Rotation3D; - using Geometry::RotationZYX; - using Geometry::Transform3D; - using Geometry::Translation3D; - using Geometry::Position; - using Geometry::LCDD; + class DDDBShape; + class DDDBLogVol; + class DDDBCatalog; + class DDDBTabProperty; + class DDDBDocument; /// Basic named object /** \ingroup DD4HEP_DDDB */ - class Named : public Conditions::ClientData { + class DDDBNamed : public cond::ClientData { public: typedef std::map<std::string, std::string> StringMap; typedef std::map<std::string, std::pair<std::string,std::string > > StringPairMap; std::string name, id; - Document* document; + DDDBDocument* document; int refCount; /// Default constructor - Named(); + DDDBNamed(); /// Initializing constructor - Named(const std::string& c); + DDDBNamed(const std::string& c); /// Copy constructor - Named(const Named& c); + DDDBNamed(const DDDBNamed& c); /// Default destructor - virtual ~Named(); + virtual ~DDDBNamed(); /// Assignment operator - Named& operator=(const Named& c); + DDDBNamed& operator=(const DDDBNamed& c); /// Assign document - void setDocument(Document* doc); + void setDocument(DDDBDocument* doc); const char* c_name() const { return name.c_str(); } const char* c_id() const { return id.c_str(); } @@ -82,89 +74,89 @@ namespace DD4hep { /// Structure supporting basic XML document information /** \ingroup DD4HEP_DDDB */ - class Document : public Named { + class DDDBDocument : public DDDBNamed { public: DDDBReaderContext context; /// Default constructor - Document(); + DDDBDocument(); /// Default destructor - virtual ~Document(); + virtual ~DDDBDocument(); /// Reference count mechanism - Document* addRef() { ++refCount; return this; } + DDDBDocument* addRef() { ++refCount; return this; } }; /// Intermediate structure representing author's data /** \ingroup DD4HEP_DDDB */ - class Author : public Named { + class DDDBAuthor : public DDDBNamed { public: - Author() : Named() {} + DDDBAuthor() : DDDBNamed() {} }; /// Intermediate structure representing versioning data /** \ingroup DD4HEP_DDDB */ - class Version : Named { + class DDDBVersion : DDDBNamed { public: - Version() : Named() {} + DDDBVersion() : DDDBNamed() {} }; /// Intermediate structure representing data of one atom /** \ingroup DD4HEP_DDDB */ - class Atom { + class DDDBAtom { public: double A = 0E0, Zeff = 0E0; - Atom() = default; + DDDBAtom() = default; }; /// Intermediate structure representing data of a Isotope /** \ingroup DD4HEP_DDDB */ - class Isotope : public Named { + class DDDBIsotope : public DDDBNamed { public: double A = 0E0,Z = 0E0,density = 0E0; /// Default constructor - Isotope(); + DDDBIsotope(); /// Default destructor - virtual ~Isotope(); + virtual ~DDDBIsotope(); /// Reference count mechanism - Isotope* addRef() { ++refCount; return this; } + DDDBIsotope* addRef() { ++refCount; return this; } }; /// Intermediate structure representing data of a Element /** \ingroup DD4HEP_DDDB */ - class Element : public Named { + class DDDBElement : public DDDBNamed { public: enum {SOLID,LIQUID,GAS,UNKNOWN}; std::vector<std::pair<std::string,double> > isotopes; std::string path, symbol; - class Atom atom; + DDDBAtom atom; double density, ionization; int state; /// Default constructor - Element(); + DDDBElement(); /// Copy constructor - Element(const Element& e); + DDDBElement(const DDDBElement& e); /// Default destructor - virtual ~Element(); + virtual ~DDDBElement(); /// Reference count mechanism - Element* addRef() { ++refCount; return this; } + DDDBElement* addRef() { ++refCount; return this; } }; /// Intermediate structure representing data of a material component /** \ingroup DD4HEP_DDDB */ - class MaterialComponent { + class DDDBMaterialComponent { public: std::string name; double fractionmass; int natoms; - MaterialComponent() : name(), fractionmass(-1), natoms(-1) {} - MaterialComponent(const MaterialComponent& c) : name(c.name), fractionmass(c.fractionmass), natoms(c.natoms) {} - MaterialComponent& operator=(const MaterialComponent& c) { + DDDBMaterialComponent() : name(), fractionmass(-1), natoms(-1) {} + DDDBMaterialComponent(const DDDBMaterialComponent& c) : name(c.name), fractionmass(c.fractionmass), natoms(c.natoms) {} + DDDBMaterialComponent& operator=(const DDDBMaterialComponent& c) { fractionmass = c.fractionmass; natoms = c.natoms; name = c.name; @@ -176,26 +168,26 @@ namespace DD4hep { /// Intermediate structure representing data of a material definition /** \ingroup DD4HEP_DDDB */ - class Material : public Named { + class DDDBMaterial : public DDDBNamed { public: - typedef std::vector<MaterialComponent> Components; + typedef std::vector<DDDBMaterialComponent> Components; typedef std::vector<std::string> Properties; std::string path; Components components; Properties properties; double density, pressure, temperature, radlen, lambda; /// Default constructor - Material(); + DDDBMaterial(); /// Default destructor - virtual ~Material(); + virtual ~DDDBMaterial(); /// Reference count mechanism - Material* addRef() { ++refCount; return this; } + DDDBMaterial* addRef() { ++refCount; return this; } }; /// Structure supporting conversion of the Box shape /** \ingroup DD4HEP_DDDB */ - class Box { + class DDDBBox { public: static int type() { return 100; } double x,y,z; @@ -205,7 +197,7 @@ namespace DD4hep { /// Structure supporting conversion of the Cons shape /** \ingroup DD4HEP_DDDB */ - class Cons { + class DDDBCons { public: static int type() { return 102; } double innerRadiusMZ, innerRadiusPZ, outerRadiusMZ, outerRadiusPZ, sizeZ; @@ -214,7 +206,7 @@ namespace DD4hep { /// Structure supporting conversion of the ConsSegment shape /** \ingroup DD4HEP_DDDB */ - class ConeSegment { + class DDDBConeSegment { public: static int type() { return 103; } double start, delta; @@ -224,7 +216,7 @@ namespace DD4hep { /// Structure supporting conversion of the Tubs shape /** \ingroup DD4HEP_DDDB */ - class Tubs { + class DDDBTubs { public: static int type() { return 104; } double innerRadius, outerRadius, sizeZ, start, delta; @@ -233,7 +225,7 @@ namespace DD4hep { /// Structure supporting conversion of the elliptical tube shape /** \ingroup DD4HEP_DDDB */ - class EllipticalTube { + class DDDBEllipticalTube { public: static int type() { return 105; } double a, b, dz; @@ -242,7 +234,7 @@ namespace DD4hep { /// Structure supporting conversion of a z-plane /** \ingroup DD4HEP_DDDB */ - class ZPlane { + class DDDBZPlane { public: static int type() { return 106; } double innerRadius, outerRadius, z; @@ -251,7 +243,7 @@ namespace DD4hep { /// Structure supporting conversion of the Polycone shape /** \ingroup DD4HEP_DDDB */ - class Polycone { + class DDDBPolycone { public: static int type() { return 107; } double start, delta; @@ -260,7 +252,7 @@ namespace DD4hep { /// Structure supporting conversion of the Polycone shape /** \ingroup DD4HEP_DDDB */ - class Polygon { + class DDDBPolygon { public: static int type() { return 108; } double nsides, start, innerRadius, outerRadius, z; @@ -269,7 +261,7 @@ namespace DD4hep { /// Structure supporting conversion of the torus /** \ingroup DD4HEP_DDDB */ - class Torus { + class DDDBTorus { public: static int type() { return 109; } double rmin, rmax, r, phi, dphi; @@ -278,7 +270,7 @@ namespace DD4hep { /// Structure supporting conversion of the Sphere /** \ingroup DD4HEP_DDDB */ - class Sphere { + class DDDBSphere { public: static int type() { return 110; } double rmin, rmax, theta, delta_theta, phi, delta_phi; @@ -287,7 +279,7 @@ namespace DD4hep { /// Structure supporting conversion of the Ellipsoid /** \ingroup DD4HEP_DDDB */ - class Ellipsoid { + class DDDBEllipsoid { public: static int type() { return 111; } double rlow, rhigh, dz; @@ -296,7 +288,7 @@ namespace DD4hep { /// Structure supporting conversion of the Trap /** \ingroup DD4HEP_DDDB */ - class Trap { + class DDDBTrap { public: static int type() { return 112; } double dz, phi, theta, h1, bl1, tl1, alpha1, h2, bl2, tl2, alpha2; @@ -305,7 +297,7 @@ namespace DD4hep { /// Structure supporting conversion of the Paraboloid /** \ingroup DD4HEP_DDDB */ - class Paraboloid { + class DDDBParaboloid { public: static int type() { return 113; } double rlow, rhigh, dz; @@ -314,7 +306,7 @@ namespace DD4hep { /// Structure supporting conversion of the Paraboloid /** \ingroup DD4HEP_DDDB */ - class Hyperboloid { + class DDDBHyperboloid { public: static int type() { return 114; } double rmin, rmax, stIn, stOut, dz; @@ -323,7 +315,7 @@ namespace DD4hep { /// Structure supporting conversion of the TRD /** \ingroup DD4HEP_DDDB */ - class TRD { + class DDDBTRD { public: static int type() { return 115; } double x1, x2, y1, y2, z; @@ -332,7 +324,7 @@ namespace DD4hep { /// Structure supporting conversion of the Assembly /** \ingroup DD4HEP_DDDB */ - class Assembly { + class DDDBAssembly { public: static int type() { return 199; } }; @@ -340,15 +332,15 @@ namespace DD4hep { /// Structure supporting boolean shapes /** \ingroup DD4HEP_DDDB */ - class BooleanShape { + class DDDBBooleanShape { public: - class Shape* first; + class DDDBShape* first; }; /// Structure supporting conversion of boolean unions /** \ingroup DD4HEP_DDDB */ - class BooleanUnion : public BooleanShape { + class DDDBBooleanUnion : public DDDBBooleanShape { public: static int type() { return 206; } }; @@ -356,7 +348,7 @@ namespace DD4hep { /// Structure supporting conversion of boolean subtractions /** \ingroup DD4HEP_DDDB */ - class BooleanSubtraction : public BooleanShape { + class DDDBBooleanSubtraction : public DDDBBooleanShape { public: static int type() { return 207; } }; @@ -364,7 +356,7 @@ namespace DD4hep { /// Structure supporting conversion of boolean intersections /** \ingroup DD4HEP_DDDB */ - class BooleanIntersection : public BooleanShape { + class DDDBBooleanIntersection : public DDDBBooleanShape { public: static int type() { return 208; } }; @@ -372,18 +364,18 @@ namespace DD4hep { /// Structure supporting conversion of boolean operations /** \ingroup DD4HEP_DDDB */ - class BooleanOperation { + class DDDBBooleanOperation { public: - class Shape* shape; + class DDDBShape* shape; Transform3D trafo; - BooleanOperation() : shape(0) {} + DDDBBooleanOperation() : shape(0) {} }; /// Structure supporting conversion of a physical volume /** \ingroup DD4HEP_DDDB */ - class PhysVol : public Named { + class DDDBPhysVol : public DDDBNamed { public: enum { PHYSVOL_REGULAR=1, PHYSVOL_PARAM1D=2, @@ -394,14 +386,14 @@ namespace DD4hep { std::string logvol, path; Transform3D trafo; /// Default constructor - PhysVol(); + DDDBPhysVol(); /// Copy constructor - PhysVol(const PhysVol& c); + DDDBPhysVol(const DDDBPhysVol& c); /// Default destructor - virtual ~PhysVol(); - PhysVol& operator=(const PhysVol& c) { + virtual ~DDDBPhysVol(); + DDDBPhysVol& operator=(const DDDBPhysVol& c) { if ( this != &c ) { - this->Named::operator=(c); + this->DDDBNamed::operator=(c); type = c.type; logvol = c.logvol; path = c.path; @@ -410,23 +402,23 @@ namespace DD4hep { return *this; } /// Reference count mechanism - PhysVol* addRef() { ++refCount; return this; } + DDDBPhysVol* addRef() { ++refCount; return this; } }; /// Structure supporting conversion of parametrized physical volumes /** \ingroup DD4HEP_DDDB */ - class ParamPhysVol : public PhysVol { + class DDDBParamPhysVol : public DDDBPhysVol { public: int number1; Transform3D trafo1; /// Default constructor - ParamPhysVol() : PhysVol(), number1(0) { type = PHYSVOL_PARAM1D; } + DDDBParamPhysVol() : DDDBPhysVol(), number1(0) { type = PHYSVOL_PARAM1D; } /// Copy constructor - ParamPhysVol(const ParamPhysVol& c) : PhysVol(c), number1(c.number1), trafo1(c.trafo1) {} - ParamPhysVol& operator=(const ParamPhysVol& c) { + DDDBParamPhysVol(const DDDBParamPhysVol& c) : DDDBPhysVol(c), number1(c.number1), trafo1(c.trafo1) {} + DDDBParamPhysVol& operator=(const DDDBParamPhysVol& c) { if ( this != &c ) { - this->PhysVol::operator=(c); + this->DDDBPhysVol::operator=(c); trafo1 = c.trafo1; number1 = c.number1; } @@ -437,48 +429,48 @@ namespace DD4hep { /// Structure supporting conversion of 2D parametrized physical volumes /** \ingroup DD4HEP_DDDB */ - class ParamPhysVol2D : public ParamPhysVol { + class DDDBParamPhysVol2D : public DDDBParamPhysVol { public: int number2; Transform3D trafo2; /// Default constructor - ParamPhysVol2D() : ParamPhysVol(), number2(0), trafo2() { type = PHYSVOL_PARAM2D; } + DDDBParamPhysVol2D() : DDDBParamPhysVol(), number2(0), trafo2() { type = PHYSVOL_PARAM2D; } }; /// Structure supporting conversion of 3D parametrized physical volumes /** \ingroup DD4HEP_DDDB */ - class ParamPhysVol3D : public ParamPhysVol2D { + class DDDBParamPhysVol3D : public DDDBParamPhysVol2D { public: int number3; Transform3D trafo3; /// Default constructor - ParamPhysVol3D() : ParamPhysVol2D(), number3(0), trafo3() { type = PHYSVOL_PARAM3D; } + DDDBParamPhysVol3D() : DDDBParamPhysVol2D(), number3(0), trafo3() { type = PHYSVOL_PARAM3D; } }; /// Structure supporting conversion of a logical volume /** \ingroup DD4HEP_DDDB */ - class LogVol : public Named { + class DDDBLogVol : public DDDBNamed { public: std::string material, shape, path; - std::vector<PhysVol*> physvols; + std::vector<DDDBPhysVol*> physvols; /// Default constructor - LogVol(); + DDDBLogVol(); /// Default destructor - virtual ~LogVol(); + virtual ~DDDBLogVol(); /// Reference count mechanism - LogVol* addRef() { ++refCount; return this; } + DDDBLogVol* addRef() { ++refCount; return this; } }; /// Structure supporting conversion of a detector element or a catalog /** \ingroup DD4HEP_DDDB */ - class Catalog : public Named { + class DDDBCatalog : public DDDBNamed { public: - typedef std::map<std::string, Catalog*> CatRefs; - typedef std::map<std::string, LogVol*> LvRefs; - typedef std::map<std::string, TabProperty*> PropRefs; + typedef std::map<std::string, DDDBCatalog*> CatRefs; + typedef std::map<std::string, DDDBLogVol*> LvRefs; + typedef std::map<std::string, DDDBTabProperty*> PropRefs; LvRefs logvolrefs; LvRefs logvols; CatRefs catalogrefs; @@ -489,55 +481,55 @@ namespace DD4hep { std::string type, path, author, version, logvol, condition, support, npath; int level, typeID; /// Default constructor - Catalog(); - Catalog(const Catalog&, const DetElement&) : level(0), typeID(0) {} + DDDBCatalog(); + DDDBCatalog(const DDDBCatalog&, const DetElement&) : level(0), typeID(0) {} /// Default destructor - virtual ~Catalog(); + virtual ~DDDBCatalog(); /// Reference count mechanism - Catalog* addRef() { ++refCount; return this; } - std::pair<const Catalog*,std::string> parent(const std::string& nam) const; + DDDBCatalog* addRef() { ++refCount; return this; } + std::pair<const DDDBCatalog*,std::string> parent(const std::string& nam) const; }; /// Structure supporting conversion of any arbitrary shape /** \ingroup DD4HEP_DDDB */ - class Shape : public Named { + class DDDBShape : public DDDBNamed { public: - typedef std::vector<ZPlane> ZPlanes; - typedef std::vector<BooleanOperation> Operations; - typedef std::vector<ParamPhysVol> ParamVolumes; + typedef std::vector<DDDBZPlane> ZPlanes; + typedef std::vector<DDDBBooleanOperation> Operations; + typedef std::vector<DDDBParamPhysVol> ParamVolumes; int type; union { - class Assembly assembly; - class Box box; - class Cons cons; - class Tubs tubs; - class Polycone polycone; - class ConeSegment coneSegment; - class EllipticalTube ellipticalTube; - class Polygon polygon; - class Torus torus; - class Sphere sphere; - class Ellipsoid ellipsoid; - class Paraboloid paraboloid; - class Hyperboloid hyperboloid; - class TRD trd; - class Trap trap; - class BooleanShape boolean; - class BooleanUnion boolean_union; - class BooleanSubtraction BooleanSubtraction; - class BooleanIntersection boolean_intersection; + class DDDBAssembly assembly; + class DDDBBox box; + class DDDBCons cons; + class DDDBTubs tubs; + class DDDBPolycone polycone; + class DDDBConeSegment coneSegment; + class DDDBEllipticalTube ellipticalTube; + class DDDBPolygon polygon; + class DDDBTorus torus; + class DDDBSphere sphere; + class DDDBEllipsoid ellipsoid; + class DDDBParaboloid paraboloid; + class DDDBHyperboloid hyperboloid; + class DDDBTRD trd; + class DDDBTrap trap; + class DDDBBooleanShape boolean; + class DDDBBooleanUnion boolean_union; + class DDDBBooleanSubtraction boolean_subtraction; + class DDDBBooleanIntersection boolean_intersection; } s; ZPlanes zplanes; Operations boolean_ops; ParamVolumes paramVols; std::string path; /// Default constructor - Shape(); + DDDBShape(); /// Default destructor - ~Shape(); + ~DDDBShape(); /// Reference count mechanism - Shape* addRef() { ++refCount; return this; } + DDDBShape* addRef() { ++refCount; return this; } }; /// Tabulated property @@ -547,17 +539,17 @@ namespace DD4hep { * \date 31/03/2016 * \ingroup DD4HEP_DDDB */ - class TabProperty : public Named { + class DDDBTabProperty : public DDDBNamed { public: typedef std::pair<double, double> Entry; std::string path, type, xunit, yunit, xaxis, yaxis; std::vector<Entry> data; /// Default constructor - TabProperty(); + DDDBTabProperty(); /// Default destructor - ~TabProperty(); + ~DDDBTabProperty(); /// Reference count mechanism - TabProperty* addRef() { ++refCount; return this; } + DDDBTabProperty* addRef() { ++refCount; return this; } }; /// LHCb geometry description interface to the conditions database @@ -570,17 +562,17 @@ namespace DD4hep { class dddb { public: typedef std::pair<long long int, long long int> iov_t; - typedef std::map<std::string,std::string> Refs; - typedef std::map<std::string,Document*> Documents; - typedef std::map<std::string,LogVol*> Volumes; - typedef std::map<std::string,PhysVol*> Placements; - typedef std::map<std::string,Catalog*> Catalogs; - typedef std::map<std::string,Isotope*> Isotopes; - typedef std::map<std::string,Element*> Elements; - typedef std::map<std::string,Material*> Materials; - typedef std::map<std::string,Shape*> Shapes; - typedef std::map<std::string,TabProperty*> TabProperties; - typedef std::map<std::string,Conditions::Condition::Object*> Conditions; + typedef std::map<std::string,std::string> Refs; + typedef std::map<std::string,DDDBDocument*> Documents; + typedef std::map<std::string,DDDBLogVol*> Volumes; + typedef std::map<std::string,DDDBPhysVol*> Placements; + typedef std::map<std::string,DDDBCatalog*> Catalogs; + typedef std::map<std::string,DDDBIsotope*> Isotopes; + typedef std::map<std::string,DDDBElement*> Elements; + typedef std::map<std::string,DDDBMaterial*> Materials; + typedef std::map<std::string,DDDBShape*> Shapes; + typedef std::map<std::string,DDDBTabProperty*> TabProperties; + typedef std::map<std::string,Condition::Object*> Conditions; /// Default constructor dddb(); @@ -588,7 +580,7 @@ namespace DD4hep { virtual ~dddb(); /// World dimensions - Box world; + DDDBBox world; /// Inventory of input documents Documents documents; /// Inventory of isotopes @@ -610,7 +602,7 @@ namespace DD4hep { /// Inventory of catalogs Catalogs catalogs, catalogPaths; /// Detector element hierarchy - Catalog *top, *structure, *geometry; + DDDBCatalog *top, *structure, *geometry; }; class dddb_conditions {}; @@ -626,6 +618,6 @@ namespace DD4hep { /// Specialized printout method. Not all above object types are supported. template <typename T> void dddb_print(const T* object); -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDDB_DDDBCONVERSION_H */ diff --git a/DDDB/include/DDDB/DDDBDimension.h b/DDDB/include/DDDB/DDDBDimension.h index 82850dc6d..7e1fc49f6 100644 --- a/DDDB/include/DDDB/DDDBDimension.h +++ b/DDDB/include/DDDB/DDDBDimension.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,7 +25,7 @@ #include "XML/XMLDimension.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the AIDA detector description toolkit supporting XML utilities namespace DDDB { @@ -55,15 +55,15 @@ namespace DD4hep { * \version 1.0 * \ingroup DD4HEP_XML */ - struct dddb_dim_t : public XML::Dimension { + struct dddb_dim_t : public xml::Dimension { /// Default constructor - dddb_dim_t() : XML::Dimension(0) { + dddb_dim_t() : xml::Dimension(0) { } /// Constructor from Handle - dddb_dim_t(XML::Handle_t e) : XML::Dimension(e) { + dddb_dim_t(xml::Handle_t e) : xml::Dimension(e) { } /// Constructor from Element - dddb_dim_t(const XML::Element& e) : XML::Dimension(e) { + dddb_dim_t(const xml::Element& e) : xml::Dimension(e) { } double alp1() const; double alp1(double default_value) const; @@ -150,5 +150,5 @@ namespace DD4hep { std::string zaxis() const; }; } /* End namespace DDDB */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDDB_XMLDIMENSION_H */ diff --git a/DDDB/include/DDDB/DDDBHelper.h b/DDDB/include/DDDB/DDDBHelper.h index b6f43779e..78011d088 100644 --- a/DDDB/include/DDDB/DDDBHelper.h +++ b/DDDB/include/DDDB/DDDBHelper.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -34,7 +34,7 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace of the DDDB conversion stuff namespace DDDB { @@ -42,7 +42,7 @@ namespace DD4hep { /// Forward declarations class dddb; - /// Class supporting the interface of the LHCb conditions database to DD4hep + /// Class supporting the interface of the LHCb conditions database to dd4hep /** * * \author M.Frank @@ -51,39 +51,39 @@ namespace DD4hep { */ class DDDBHelper { public: - typedef std::vector<std::pair<std::string, Geometry::VisAttr> > VisAttrs; - typedef std::map<std::string,std::pair<Geometry::DetElement,std::string> > Det_Conditions; + typedef std::vector<std::pair<std::string, VisAttr> > VisAttrs; + typedef std::map<std::string,std::pair<DetElement,std::string> > Det_Conditions; public: /// Standard constructor - DDDBHelper(Geometry::LCDD& lcdd); + DDDBHelper(Detector& description); /// Default destructor virtual ~DDDBHelper(); /// Access XML reader object - XML::UriReader* xmlReader() const { return m_xmlReader; } + xml::UriReader* xmlReader() const { return m_xmlReader; } /// Set XML reader object - void setXmlReader(XML::UriReader* rdr) { m_xmlReader = rdr; } + void setXmlReader(xml::UriReader* rdr) { m_xmlReader = rdr; } /// Access local database representation dddb* detectorDescription() const { return m_detDesc; } /// Set XML reader object void setDetectorDescription(dddb* geo); /// Access visualization attribute for a given volume by path - Geometry::VisAttr visAttr(const std::string& path) const; + VisAttr visAttr(const std::string& path) const; /// Add visualization attribute void addVisAttr(const std::string& path, const std::string attr_name); /// Add visualization attribute - void addVisAttr(const std::string& path, Geometry::VisAttr attr); + void addVisAttr(const std::string& path, VisAttr attr); /// Add new conditions entry - bool addConditionEntry(const std::string& val, Geometry::DetElement det, const std::string& item); + bool addConditionEntry(const std::string& val, DetElement det, const std::string& item); /// Access conditions entry - std::pair<Geometry::DetElement,std::string> getConditionEntry(const std::string& item) const; + std::pair<DetElement,std::string> getConditionEntry(const std::string& item) const; public: /// Reference to main detector description instance - Geometry::LCDD& m_lcdd; + Detector& m_description; /// Reference to XML entity resolver - XML::UriReader* m_xmlReader; + xml::UriReader* m_xmlReader; /// Reference to extracted detector description information dddb* m_detDesc; /// Optional container of visualization attributes @@ -93,5 +93,5 @@ namespace DD4hep { }; } /* End namespace DDDB */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDDB_DDDBHELPER_H */ diff --git a/DDDB/include/DDDB/DDDBReader.h b/DDDB/include/DDDB/DDDBReader.h index 3e77596c3..cc42c6f2d 100644 --- a/DDDB/include/DDDB/DDDBReader.h +++ b/DDDB/include/DDDB/DDDBReader.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,19 +25,19 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace of the DDDB conversion stuff namespace DDDB { - /// Class supporting the interface of the LHCb conditions database to DD4hep + /// Class supporting the interface of the LHCb conditions database to dd4hep /** * * \author M.Frank * \version 1.0 * \ingroup DD4HEP_XML */ - class DDDBReader : public DD4hep::XML::UriReader { + class DDDBReader : public dd4hep::xml::UriReader { public: /// Standard constructor DDDBReader(const std::string& dir=""); @@ -70,5 +70,5 @@ namespace DD4hep { DDDBReaderContext m_context; }; } /* End namespace DDDB */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDDB_DDDBFILEREADER_H */ diff --git a/DDDB/include/DDDB/DDDBReaderContext.h b/DDDB/include/DDDB/DDDBReaderContext.h index af60e6360..b971ef8b1 100644 --- a/DDDB/include/DDDB/DDDBReaderContext.h +++ b/DDDB/include/DDDB/DDDBReaderContext.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace of the DDDB conversion stuff namespace DDDB { @@ -36,7 +36,7 @@ namespace DD4hep { * \date 31/03/2016 * \ingroup DD4HEP_DDDB */ - class DDDBReaderContext : public XML::UriReader::UserContext { + class DDDBReaderContext : public xml::UriReader::UserContext { public: long long int event_time = 0; long long int valid_since = 0; @@ -46,7 +46,7 @@ namespace DD4hep { DDDBReaderContext() = default; /// Copy constructor DDDBReaderContext(const DDDBReaderContext& c) - : XML::UriReader::UserContext(c), + : xml::UriReader::UserContext(c), event_time(c.event_time), valid_since(c.valid_since), valid_until(c.valid_until), @@ -57,5 +57,5 @@ namespace DD4hep { DDDBReaderContext& operator=(const DDDBReaderContext& c) = default; }; } /* End namespace DDDB */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDDB_DDDBREADERCONTEXT_H */ diff --git a/DDDB/include/DDDB/DDDBTags.h b/DDDB/include/DDDB/DDDBTags.h index cee52f64a..248f0669a 100644 --- a/DDDB/include/DDDB/DDDBTags.h +++ b/DDDB/include/DDDB/DDDBTags.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,11 +22,11 @@ // Framework include files #include "XML/XMLElements.h" #ifndef UNICODE -#define UNICODE(x) extern const ::DD4hep::XML::Tag_t Unicode_##x +#define UNICODE(x) extern const ::dd4hep::xml::Tag_t Unicode_##x #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace of DDDB conversion namespace namespace DDDB { @@ -150,11 +150,11 @@ namespace DD4hep { //UNICODE(); } /* End namespace DDDB */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #undef UNICODE // Do not miss this one! #include "XML/XMLTags.h" -#define _LBU(a) ::DD4hep::DDDB::Unicode_##a +#define _LBU(a) ::dd4hep::DDDB::Unicode_##a #endif /* DD4HEP_DDDB_DDDBTAGS_H */ diff --git a/DDDB/src/DDDBConditionsLoader.cpp b/DDDB/src/DDDBConditionsLoader.cpp index 4af9f9a22..cb2830f08 100644 --- a/DDDB/src/DDDBConditionsLoader.cpp +++ b/DDDB/src/DDDBConditionsLoader.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include "DDDB/DDDBReaderContext.h" #include "DDDB/DDDBHelper.h" -// Other DD4hep includes +// Other dd4hep includes #include "DD4hep/Printout.h" #include "DD4hep/Operators.h" #include "DDCond/ConditionsManagerObject.h" @@ -32,15 +32,13 @@ // Forward declartions using namespace std; -using namespace DD4hep; -using Geometry::LCDD; -using Conditions::Condition; -using Conditions::RangeConditions; -using Conditions::ConditionsSlice; -using Conditions::ConditionsListener; -using Conditions::ConditionsDescriptor; -using Conditions::ConditionsManagerObject; -using Conditions::ConditionsLoadInfo; +using namespace dd4hep; +using namespace dd4hep::cond; +using cond::ConditionsSlice; +using cond::ConditionsListener; +using cond::ConditionsDescriptor; +using cond::ConditionsManagerObject; +using cond::ConditionsLoadInfo; using DDDB::DDDBConditionsLoader; namespace { @@ -49,8 +47,8 @@ namespace { REPLACE=2, NONE }; - typedef Conditions::ConditionsDataLoader::RequiredItems Entries; - typedef Conditions::ConditionsDataLoader::LoadedItems Loaded; + typedef ConditionsDataLoader::RequiredItems Entries; + typedef ConditionsDataLoader::LoadedItems Loaded; /// Loader callback for Item loaders: load_single(...), load_range(...) /** @@ -60,18 +58,17 @@ namespace { */ struct ItemCollector : public ConditionsListener { private: - typedef Conditions::RangeConditions RC; CMD cmd; Condition::key_type key; - RC& rc; - const Condition::iov_type& req_iov; + RangeConditions& rc; + const IOV& req_iov; public: - Condition::iov_type iov; + IOV iov; public: /// Initializing constructor - ItemCollector(CMD c, Condition::key_type k, const Condition::iov_type& i, RC& r) + ItemCollector(CMD c, Condition::key_type k, const IOV& i, RangeConditions& r) : cmd(c), key(k), rc(r), req_iov(i), iov(i.iovType) {} /// ConditionsListener overload: onRegister new condition virtual void onRegisterCondition(Condition cond, void* param ) { @@ -81,7 +78,7 @@ namespace { IOV::key_is_contained(c->iov->keyData,req_iov.keyData) ) { if ( cmd == REPLACE ) { - RC::iterator i=std::find_if(rc.begin(),rc.end(),byName(cond)); + auto i=std::find_if(rc.begin(),rc.end(),byName(cond)); if ( i != rc.end() ) { (*i) = cond; printout(DEBUG,"DDDB","++ Got MATCH: %-40s [%16llX] --> %s.", @@ -108,15 +105,15 @@ namespace { */ struct GroupCollector : public ConditionsListener { private: - Loaded& loaded; - const Condition::iov_type& req_iov; + Loaded& loaded; + const IOV& req_iov; public: - Condition::iov_type iov; + IOV iov; public: /// Initializing constructor - GroupCollector(const Condition::iov_type& i, Loaded& l) + GroupCollector(const IOV& i, Loaded& l) : loaded(l), req_iov(i), iov(req_iov.iovType) {} /// ConditionsListener overload: onRegister new condition virtual void onRegisterCondition(Condition cond, void* param) { @@ -132,18 +129,18 @@ namespace { } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit + /// Namespace for implementation details of the AIDA detector description toolkit namespace DDDB { /// Plugin entry points. - long load_dddb_conditions_from_uri(LCDD& lcdd, int argc, char** argv); - long dddb_conditions_2_dd4hep(LCDD& lcdd, int argc, char** argv); + long load_dddb_conditions_from_uri(Detector& description, int argc, char** argv); + long dddb_conditions_2_dd4hep(Detector& description, int argc, char** argv); - long load_dddb_from_uri(LCDD& lcdd, int argc, char** argv); - long dddb_2_dd4hep(LCDD& lcdd, int argc, char** argv); + long load_dddb_from_uri(Detector& description, int argc, char** argv); + long dddb_2_dd4hep(Detector& description, int argc, char** argv); } /* End namespace DDDB */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ /// Initializing constructor @@ -151,7 +148,7 @@ DDDBConditionsLoader::KeyCollector::KeyCollector() : call(this,0) { } /// ConditionsListener overload: onRegister new condition -void DDDBConditionsLoader::KeyCollector::onRegisterCondition(Conditions::Condition cond, void*) { +void DDDBConditionsLoader::KeyCollector::onRegisterCondition(Condition cond, void*) { Condition::Object* c = cond.ptr(); // Register address key if ( (0==(c->flags&Condition::DERIVED)) && !c->address.empty() ) { @@ -169,10 +166,10 @@ void DDDBConditionsLoader::KeyCollector::onRegisterCondition(Conditions::Conditi } /// Standard constructor, initializes variables -DDDBConditionsLoader::DDDBConditionsLoader(LCDD& lcdd, ConditionsManager mgr, const string& nam) - : Conditions::ConditionsDataLoader(lcdd, mgr, nam) +DDDBConditionsLoader::DDDBConditionsLoader(Detector& description, ConditionsManager mgr, const string& nam) + : ConditionsDataLoader(description, mgr, nam) { - DDDBHelper* helper = lcdd.extension<DDDBHelper>(); // Ensures object existence! + DDDBHelper* helper = description.extension<DDDBHelper>(); // Ensures object existence! // It is UGLY to listen on conditions appearing to know from which file they origin // but we do not have a better way as of now.... m_mgr->callOnRegister(m_keys.call,true); @@ -185,23 +182,23 @@ DDDBConditionsLoader::~DDDBConditionsLoader() { } /// Load single conditions document -void DDDBConditionsLoader::loadDocument(XML::UriContextReader& rdr, const Key& k) +void DDDBConditionsLoader::loadDocument(xml::UriContextReader& rdr, const Key& k) { loadDocument(rdr, k.first, k.second); } /// Load single conditions document -void DDDBConditionsLoader::loadDocument(XML::UriContextReader& rdr, +void DDDBConditionsLoader::loadDocument(xml::UriContextReader& rdr, const string& sys_id, const string& obj_id) { const void* argv_conddb[] = {&rdr, sys_id.c_str(), obj_id.c_str(), 0}; - long result = load_dddb_conditions_from_uri(m_lcdd, 3, (char**)argv_conddb); + long result = load_dddb_conditions_from_uri(m_detDesc, 3, (char**)argv_conddb); if ( 0 == result ) { except("DDDB","++ Failed to load conditions from URI:%s",sys_id.c_str()); } const void* argv_dddb[] = {"conditions_only", 0}; - result = dddb_conditions_2_dd4hep(m_lcdd, 1, (char**)argv_dddb); + result = dddb_conditions_2_dd4hep(m_detDesc, 1, (char**)argv_dddb); if ( 0 == result ) { except("DDDBLoader","++ Failed to process conditions from URI:%s",sys_id.c_str()); } @@ -209,7 +206,7 @@ void DDDBConditionsLoader::loadDocument(XML::UriContextReader& rdr, /// Load a condition set given a Detector Element and the conditions name according to their validity size_t DDDBConditionsLoader::load_range(key_type key, - const iov_type& req_iov, + const IOV& req_iov, RangeConditions& conditions) { KeyMap::const_iterator k = m_keys.keys.find(key); if ( k != m_keys.keys.end() ) { @@ -217,7 +214,7 @@ size_t DDDBConditionsLoader::load_range(key_type key, DDDBReaderContext local; const Key& url_key = (*k).second; long start = req_iov.keyData.first; - XML::UriContextReader local_reader(m_resolver, &local); + xml::UriContextReader local_reader(m_resolver, &local); ItemCollector listener(INSERT, key, req_iov, conditions); m_mgr->callOnRegister(make_pair(&listener,&listener), true); @@ -237,14 +234,14 @@ size_t DDDBConditionsLoader::load_range(key_type key, /// Access single conditions from the persistent medium size_t DDDBConditionsLoader::load_single(key_type key, - const iov_type& req_iov, + const IOV& req_iov, RangeConditions& conditions) { KeyMap::const_iterator k = m_keys.keys.find(key); if ( k != m_keys.keys.end() ) { size_t len = conditions.size(); DDDBReaderContext local; ItemCollector listener(INSERT, key, req_iov, conditions); - XML::UriContextReader local_reader(m_resolver, &local); + xml::UriContextReader local_reader(m_resolver, &local); local.valid_since = 0; local.valid_until = 0; @@ -258,10 +255,10 @@ size_t DDDBConditionsLoader::load_single(key_type key, } /// Optimized update using conditions slice data -size_t DDDBConditionsLoader::load_many(const iov_type& req_iov, +size_t DDDBConditionsLoader::load_many(const IOV& req_iov, RequiredItems& work, LoadedItems& loaded, - iov_type& conditions_validity) + IOV& conditions_validity) { DDDBReaderContext local; size_t len = loaded.size(); @@ -271,7 +268,7 @@ size_t DDDBConditionsLoader::load_many(const iov_type& req_iov, local.valid_since = 0; local.valid_until = 0; - XML::UriContextReader local_reader(m_resolver, &local); + xml::UriContextReader local_reader(m_resolver, &local); // First collect all required URIs which need loading. // Since one file contains many conditions, we have diff --git a/DDDB/src/DDDBConversion.cpp b/DDDB/src/DDDBConversion.cpp index 2bb6e4492..3b1bb6e28 100644 --- a/DDDB/src/DDDBConversion.cpp +++ b/DDDB/src/DDDBConversion.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,6 @@ #include "DD4hep/InstanceCount.h" #include "DD4hep/Primitives.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" // C/C++ include files #include <cstring> @@ -36,7 +35,7 @@ } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { using namespace std; using namespace DDDB; @@ -49,61 +48,61 @@ namespace DD4hep { /// Default destructor dddb::~dddb() { // need to release heare all allocated resources. - releaseObjects(isotopes); - releaseObjects(elements); - releaseObjects(elementPaths); + detail::releaseObjects(isotopes); + detail::releaseObjects(elements); + detail::releaseObjects(elementPaths); - releaseObjects(materials); - releaseObjects(materialPaths); + detail::releaseObjects(materials); + detail::releaseObjects(materialPaths); - releaseObjects(shapes); + detail::releaseObjects(shapes); - releaseObjects(volumes); - releaseObjects(volumePaths); + detail::releaseObjects(volumes); + detail::releaseObjects(volumePaths); - releaseObjects(placements); - releaseObjects(placementPaths); + detail::releaseObjects(placements); + detail::releaseObjects(placementPaths); - releaseObjects(tabproperties); - releaseObjects(tabpropertyPaths); + detail::releaseObjects(tabproperties); + detail::releaseObjects(tabpropertyPaths); conditions.clear(); conditionPaths.clear(); - //releaseObjects(conditions); - //releaseObjects(conditionPaths); - releaseObjects(catalogs); - releaseObjects(catalogPaths); - releaseObjects(documents); + //detail::releaseObjects(conditions); + //detail::releaseObjects(conditionPaths); + detail::releaseObjects(catalogs); + detail::releaseObjects(catalogPaths); + detail::releaseObjects(documents); printout(DEBUG,"dddb","++ All intermediate objects deleted!"); InstanceCount::decrement(this); } /// Default constructor - Named::Named() + DDDBNamed::DDDBNamed() : name(), id(), document(0), refCount(0) { } /// Initializing constructor - Named::Named(const std::string& c) + DDDBNamed::DDDBNamed(const std::string& c) : name(c), id(), document(0), refCount(0) { } /// Copy constructor - Named::Named(const Named& c) + DDDBNamed::DDDBNamed(const DDDBNamed& c) : name(c.name), id(c.id), document(c.document), refCount(0) { if ( document ) document->addRef(); } /// Default destructor - Named::~Named() { + DDDBNamed::~DDDBNamed() { if ( document ) document->release(); } /// Assignment operator - Named& Named::operator=(const Named& c) { + DDDBNamed& DDDBNamed::operator=(const DDDBNamed& c) { if ( this != &c ) { setDocument(c.document); name = c.name; @@ -113,41 +112,41 @@ namespace DD4hep { } /// Assign document - void Named::setDocument(Document* doc) { + void DDDBNamed::setDocument(DDDBDocument* doc) { if ( doc ) doc->addRef(); if ( document ) document->release(); document = doc; } /// Default constructor - Document::Document() : Named(), context() { + DDDBDocument::DDDBDocument() : DDDBNamed(), context() { InstanceCount::increment(this); } /// Default destructor - Document::~Document() { + DDDBDocument::~DDDBDocument() { //printout(INFO,"Document","Delete doc %s",c_id()); InstanceCount::decrement(this); } /// Default constructor - Isotope::Isotope() : Named() { + DDDBIsotope::DDDBIsotope() : DDDBNamed() { InstanceCount::increment(this); } /// Default destructor - Isotope::~Isotope() { + DDDBIsotope::~DDDBIsotope() { InstanceCount::decrement(this); } /// Default constructor - Element::Element() : Named(), density(0), ionization(0), state(UNKNOWN) { + DDDBElement::DDDBElement() : DDDBNamed(), density(0), ionization(0), state(UNKNOWN) { InstanceCount::increment(this); } /// Copy constructor - Element::Element(const Element& e) - : Named(e), isotopes(e.isotopes), path(e.path), symbol(e.symbol), + DDDBElement::DDDBElement(const DDDBElement& e) + : DDDBNamed(e), isotopes(e.isotopes), path(e.path), symbol(e.symbol), atom(e.atom), density(e.density), ionization(e.ionization), state(e.state) { @@ -155,58 +154,58 @@ namespace DD4hep { } /// Default destructor - Element::~Element() { + DDDBElement::~DDDBElement() { InstanceCount::decrement(this); } /// Default constructor - Material::Material() : density(0), pressure(-1), temperature(-1), radlen(0), lambda(0) { + DDDBMaterial::DDDBMaterial() : density(0), pressure(-1), temperature(-1), radlen(0), lambda(0) { InstanceCount::increment(this); } /// Default destructor - Material::~Material() { + DDDBMaterial::~DDDBMaterial() { InstanceCount::decrement(this); } /// Default constructor - LogVol::LogVol() : Named(), material(), shape(), physvols() { + DDDBLogVol::DDDBLogVol() : DDDBNamed(), material(), shape(), physvols() { InstanceCount::increment(this); } /// Default destructor - LogVol::~LogVol() { + DDDBLogVol::~DDDBLogVol() { InstanceCount::decrement(this); } /// Default constructor - PhysVol::PhysVol() : type(PHYSVOL_REGULAR), logvol(), path(), trafo() { + DDDBPhysVol::DDDBPhysVol() : type(PHYSVOL_REGULAR), logvol(), path(), trafo() { InstanceCount::increment(this); } /// Copy constructor - PhysVol::PhysVol(const PhysVol& c) - : Named(c), type(c.type), logvol(c.logvol), path(c.path), trafo(c.trafo) { + DDDBPhysVol::DDDBPhysVol(const DDDBPhysVol& c) + : DDDBNamed(c), type(c.type), logvol(c.logvol), path(c.path), trafo(c.trafo) { InstanceCount::increment(this); } /// Default destructor - PhysVol::~PhysVol() { + DDDBPhysVol::~DDDBPhysVol() { InstanceCount::decrement(this); } /// Default constructor - Shape::Shape() : type(0), zplanes(), boolean_ops() { + DDDBShape::DDDBShape() : type(0), zplanes(), boolean_ops() { ::memset(&s,0,sizeof(s)); InstanceCount::increment(this); } /// Default destructor - Shape::~Shape() { - if ( type == BooleanUnion::type() || - type == BooleanSubtraction::type() || - type == BooleanIntersection::type() ) { - Shape* shape = s.boolean.first; + DDDBShape::~DDDBShape() { + if ( type == DDDBBooleanUnion::type() || + type == DDDBBooleanSubtraction::type() || + type == DDDBBooleanIntersection::type() ) { + DDDBShape* shape = s.boolean.first; if ( shape ) delete shape; for(Operations::iterator i=boolean_ops.begin(); i!=boolean_ops.end(); ++i) delete (*i).shape; @@ -216,28 +215,28 @@ namespace DD4hep { } /// Default constructor - Catalog::Catalog() : Named(), level(0), typeID(0) { + DDDBCatalog::DDDBCatalog() : DDDBNamed(), level(0), typeID(0) { InstanceCount::increment(this); } /// Default destructor - Catalog::~Catalog() { + DDDBCatalog::~DDDBCatalog() { InstanceCount::decrement(this); } /// Default constructor - TabProperty::TabProperty() { + DDDBTabProperty::DDDBTabProperty() { InstanceCount::increment(this); } /// Default destructor - TabProperty::~TabProperty() { + DDDBTabProperty::~DDDBTabProperty() { InstanceCount::decrement(this); } - pair<const Catalog*,string> Catalog::parent(const string& nam) const { - const Catalog* cat = this; + pair<const DDDBCatalog*,string> DDDBCatalog::parent(const string& nam) const { + const DDDBCatalog* cat = this; string rest = nam.substr(cat->path.length()+1); size_t idx = rest.find('/'); string sub = rest.substr(0,idx); @@ -275,7 +274,7 @@ namespace DD4hep { if ( dot_pos>1e-10 ) dddb_print(&pos); } - template <> void dddb_print(const Isotope* i) { + template <> void dddb_print(const DDDBIsotope* i) { CHECK_OBJECT(i); printout(INFO,"Isotope","++ %-20s A=%6.0f Z=%3.0f Density=%8.2g id=%s", i->c_name(), i->A, i->Z, i->density,i->c_id()); @@ -287,7 +286,7 @@ namespace DD4hep { i->GetName(), i->GetN(), i->GetZ(), i->GetA()); } - template <> void dddb_print(const Element* e) { + template <> void dddb_print(const DDDBElement* e) { CHECK_OBJECT(e); printout(INFO,"Element","++ %-20s A=%6.0f Z=%3.0f Density=%8g ioni:%8.2g (%d isotopes) id=%s", (e->name+"/"+e->symbol).c_str(), e->atom.A, e->atom.Zeff, @@ -300,7 +299,7 @@ namespace DD4hep { e->GetName(), e->N(), e->Z(), e->A()); } - template <> void dddb_print(const Material* m) { + template <> void dddb_print(const DDDBMaterial* m) { CHECK_OBJECT(m); printout(INFO,"Material","++ %-20s Density=%8g P=%f T=%f %d components id:%s", ("'"+m->path+"'").c_str(), m->density, m->pressure, m->temperature, @@ -318,37 +317,37 @@ namespace DD4hep { mat->GetNelements()); } - template <> void dddb_print(const Shape* s) { + template <> void dddb_print(const DDDBShape* s) { CHECK_OBJECT(s); - if (s-> type == Box::type() ) { + if (s-> type == DDDBBox::type() ) { printout(INFO,"Box","++ %3d/%-12s: x=%f y=%f z=%f", s->type,s->c_name(), s->s.box.x,s->s.box.y,s->s.box.z); } - else if (s-> type == Cons::type() ) { + else if (s-> type == DDDBCons::type() ) { printout(INFO,"Cons","++ %3d/%-12s: z=%f innerMZ=%f innerPZ=%f outerMZ=%f outerPZ=%f", s->type,s->c_name(),s->s.cons.sizeZ, s->s.cons.innerRadiusMZ,s->s.cons.innerRadiusPZ, s->s.cons.outerRadiusMZ,s->s.cons.outerRadiusPZ); } - else if (s-> type == Tubs::type() ) { + else if (s-> type == DDDBTubs::type() ) { printout(INFO,"Tubs","++ %3d/%-12s: z=%f innerR=%f outerR=%f", s->type,s->c_name(),s->s.tubs.sizeZ, s->s.tubs.innerRadius,s->s.tubs.outerRadius); } - else if (s-> type == Polycone::type() ) { + else if (s-> type == DDDBPolycone::type() ) { printout(INFO,"Polycone","++ %3d/%-12s: %d zplanes", s->type,s->c_name(),int(s->zplanes.size())); } - else if (s-> type == BooleanUnion::type() ) { + else if (s-> type == DDDBBooleanUnion::type() ) { printout(INFO,"union","++ %3d/%-12s: %d modifications", s->type,s->c_name(),int(s->boolean_ops.size())); } - else if (s-> type == BooleanSubtraction::type() ) { + else if (s-> type == DDDBBooleanSubtraction::type() ) { printout(INFO,"subtraction","++ %3d/%-12s: %d modifications", s->type,s->c_name(),int(s->boolean_ops.size())); } - else if (s-> type == BooleanIntersection::type() ) { + else if (s-> type == DDDBBooleanIntersection::type() ) { printout(INFO,"intersection","++ %3d%-12s: %d modifications", s->type,s->path.c_str(),int(s->boolean_ops.size())); } @@ -356,7 +355,7 @@ namespace DD4hep { "", s->path.c_str(), s->c_id()); } - template <> void dddb_print(const PhysVol* obj) { + template <> void dddb_print(const DDDBPhysVol* obj) { CHECK_OBJECT(obj); printout(INFO,"PhysVol","++ %-12s: logvol:%s", obj->path.c_str(),obj->logvol.c_str()); @@ -364,7 +363,7 @@ namespace DD4hep { "",obj->c_name(),obj->c_id()); } - template <> void dddb_print(const LogVol* obj) { + template <> void dddb_print(const DDDBLogVol* obj) { CHECK_OBJECT(obj); printout(INFO,"LogVol", "++ %-12s: Material:%s Shape:%s", obj->path.c_str(),obj->material.c_str(), @@ -373,7 +372,7 @@ namespace DD4hep { "",obj->c_name(),obj->c_id()); } - template <> void dddb_print(const TabProperty* obj) { + template <> void dddb_print(const DDDBTabProperty* obj) { CHECK_OBJECT(obj); printout(INFO,"Detector", "++ %-12s: [%s] xunit:%s xaxis:%s yunit:%s yaxis:%s siz:%d", obj->path.c_str(), obj->type.c_str(), @@ -382,7 +381,7 @@ namespace DD4hep { int(obj->data.size())); } - template <> void dddb_print(const Catalog* obj) { + template <> void dddb_print(const DDDBCatalog* obj) { CHECK_OBJECT(obj); printout(INFO,"Detector", "++ %-12s: [%s] %d children support:%s geo:%s", obj->path.c_str(), obj->type.c_str(), int(obj->catalogrefs.size()), @@ -390,7 +389,7 @@ namespace DD4hep { printout(INFO,"Detector", "++ %-12s name:%s id:%s", "",obj->c_name(),obj->c_id()); } - template <> void dddb_print(const Document* obj) { + template <> void dddb_print(const DDDBDocument* obj) { CHECK_OBJECT(obj); char c_since[64], c_until[64], c_evt[64]; struct tm since, until, evt; diff --git a/DDDB/src/DDDBDimension.cpp b/DDDB/src/DDDBDimension.cpp index 12737e93a..349a9a1ec 100644 --- a/DDDB/src/DDDBDimension.cpp +++ b/DDDB/src/DDDBDimension.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,52 +22,52 @@ #include "DDDB/DDDBDimension.h" #include "DDDB/DDDBTags.h" -#define DD4HEP_DIMENSION_NS XML -using namespace DD4hep::XML; +#define DD4HEP_DIMENSION_NS xml +using namespace dd4hep::DD4HEP_DIMENSION_NS; -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, alp1) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, alp2) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeX) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeX1) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeX2) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeX3) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeX4) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeY) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeY1) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeY2) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, sizeZ) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, rotX) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, rotY) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, rotZ) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, outerRadius) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, outerRadiusPZ) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, outerRadiusMZ) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, innerRadius) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, innerRadiusPZ) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, innerRadiusMZ) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, radlen) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, lambda) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, fractionmass) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, ionization) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, phiAngle) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, startPhiAngle) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, deltaPhiAngle) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, thetaAngle) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, startThetaAngle) -XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, deltaThetaAngle) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, alp1) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, alp2) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeX) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeX1) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeX2) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeX3) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeX4) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeY) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeY1) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeY2) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, sizeZ) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, rotX) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, rotY) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, rotZ) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, outerRadius) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, outerRadiusPZ) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, outerRadiusMZ) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, innerRadius) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, innerRadiusPZ) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, innerRadiusMZ) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, radlen) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, lambda) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, fractionmass) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, ionization) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, phiAngle) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, startPhiAngle) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, deltaPhiAngle) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, thetaAngle) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, startThetaAngle) +XML_ATTR_NS_ACCESSOR_DOUBLE(dd4hep::DDDB::dddb_dim_t, deltaThetaAngle) -XML_ATTR_NS_ACCESSOR_INT( DD4hep::DDDB::dddb_dim_t, natoms) -XML_ATTR_NS_ACCESSOR_INT( DD4hep::DDDB::dddb_dim_t, number) -XML_ATTR_NS_ACCESSOR_INT( DD4hep::DDDB::dddb_dim_t, number1) -XML_ATTR_NS_ACCESSOR_INT( DD4hep::DDDB::dddb_dim_t, number2) -XML_ATTR_NS_ACCESSOR_INT( DD4hep::DDDB::dddb_dim_t, number3) -XML_ATTR_NS_ACCESSOR_STRING(DD4hep::DDDB::dddb_dim_t, symbol) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, href) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, state) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, logvol) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, xunit) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, xaxis) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, yunit) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, yaxis) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, zunit) -XML_ATTR_NS_ACCESSOR(std::string,DD4hep::DDDB::dddb_dim_t, zaxis) +XML_ATTR_NS_ACCESSOR_INT( dd4hep::DDDB::dddb_dim_t, natoms) +XML_ATTR_NS_ACCESSOR_INT( dd4hep::DDDB::dddb_dim_t, number) +XML_ATTR_NS_ACCESSOR_INT( dd4hep::DDDB::dddb_dim_t, number1) +XML_ATTR_NS_ACCESSOR_INT( dd4hep::DDDB::dddb_dim_t, number2) +XML_ATTR_NS_ACCESSOR_INT( dd4hep::DDDB::dddb_dim_t, number3) +XML_ATTR_NS_ACCESSOR_STRING(dd4hep::DDDB::dddb_dim_t, symbol) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, href) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, state) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, logvol) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, xunit) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, xaxis) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, yunit) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, yaxis) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, zunit) +XML_ATTR_NS_ACCESSOR(std::string,dd4hep::DDDB::dddb_dim_t, zaxis) diff --git a/DDDB/src/DDDBHelper.cpp b/DDDB/src/DDDBHelper.cpp index a69f7102f..6de660fc7 100644 --- a/DDDB/src/DDDBHelper.cpp +++ b/DDDB/src/DDDBHelper.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,39 +22,39 @@ #include "DDDB/DDDBConversion.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::DDDB; +using namespace dd4hep; +using namespace dd4hep::DDDB; namespace { struct ByName { const string& n; ByName(const string& s) : n(s) {} - bool operator() (const pair<string, Geometry::VisAttr>& o) const { + bool operator() (const pair<string, VisAttr>& o) const { return o.first == n; } }; } /// Standard constructor -DDDBHelper::DDDBHelper(Geometry::LCDD& l) - : m_lcdd(l), m_xmlReader(0), m_detDesc(0) +DDDBHelper::DDDBHelper(Detector& dsc) + : m_description(dsc), m_xmlReader(0), m_detDesc(0) { } /// Default destructor DDDBHelper::~DDDBHelper() { - deletePtr(m_detDesc); + detail::deletePtr(m_detDesc); m_visAttrs.clear(); } /// Attach detectorDescription information void DDDBHelper::setDetectorDescription(dddb* geo) { - deletePtr(m_detDesc); + detail::deletePtr(m_detDesc); m_detDesc = geo; } /// Access visualization attribute for a given volume by path -Geometry::VisAttr DDDBHelper::visAttr(const std::string& path) const { +VisAttr DDDBHelper::visAttr(const std::string& path) const { VisAttrs::const_iterator i = std::find_if(m_visAttrs.begin(), m_visAttrs.end(), ByName(path)); if ( i == m_visAttrs.end() ) { for( i=m_visAttrs.begin(); i != m_visAttrs.end(); ++i) { @@ -63,21 +63,21 @@ Geometry::VisAttr DDDBHelper::visAttr(const std::string& path) const { return (*i).second; } } - return Geometry::VisAttr(); + return VisAttr(); } return (*i).second; } /// Add visualization attribute void DDDBHelper::addVisAttr(const std::string& path, const std::string attr_name) { - Geometry::VisAttr attr = m_lcdd.visAttributes(attr_name); + VisAttr attr = m_description.visAttributes(attr_name); if ( attr.isValid() ) { addVisAttr(path, attr); } } /// Add visualization attribute -void DDDBHelper::addVisAttr(const std::string& path, Geometry::VisAttr attr) { +void DDDBHelper::addVisAttr(const std::string& path, VisAttr attr) { if ( attr.isValid() ) { VisAttrs::const_iterator i = std::find_if(m_visAttrs.begin(), m_visAttrs.end(), ByName(path)); if ( i == m_visAttrs.end() ) { @@ -87,13 +87,13 @@ void DDDBHelper::addVisAttr(const std::string& path, Geometry::VisAttr attr) } /// Add new conditions entry -bool DDDBHelper::addConditionEntry(const std::string& key, Geometry::DetElement det, const std::string& item) { +bool DDDBHelper::addConditionEntry(const std::string& key, DetElement det, const std::string& item) { return m_detCond.insert(make_pair(key,make_pair(det,item))).second; } /// Access conditions entry -std::pair<Geometry::DetElement,std::string> DDDBHelper::getConditionEntry(const std::string& key) const { - Det_Conditions::const_iterator i=m_detCond.find(key); +std::pair<DetElement,std::string> DDDBHelper::getConditionEntry(const std::string& key) const { + auto i = m_detCond.find(key); if ( i != m_detCond.end() ) return (*i).second; return make_pair(DetElement(0),""); diff --git a/DDDB/src/DDDBReader.cpp b/DDDB/src/DDDBReader.cpp index 9b2a5635c..540a5c47e 100644 --- a/DDDB/src/DDDBReader.cpp +++ b/DDDB/src/DDDBReader.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,27 +26,27 @@ #include <cstring> using namespace std; -using namespace DD4hep; -using namespace DD4hep::DDDB; +using namespace dd4hep; +using namespace dd4hep::DDDB; /// Standard constructor DDDBReader::DDDBReader(const std::string& dir) : m_directory(dir), m_match("conddb:") { - m_context.valid_since = makeTime(1970,1,1); - m_context.valid_until = makeTime(2030,1,1); - m_context.event_time = makeTime(2015,7,1,12,0,0); + m_context.valid_since = detail::makeTime(1970,1,1); + m_context.valid_until = detail::makeTime(2030,1,1); + m_context.event_time = detail::makeTime(2015,7,1,12,0,0); } /// Resolve a given URI to a string containing the data bool DDDBReader::load(const string& system_id, string& buffer) { - return XML::UriReader::load(system_id, buffer); + return xml::UriReader::load(system_id, buffer); } /// Resolve a given URI to a string containing the data bool DDDBReader::load(const string& system_id, - UserContext* ctxt, - string& buffer) + UserContext* ctxt, + string& buffer) { if ( system_id.substr(0,m_match.length()) == m_match ) { string mm = m_match + "//"; @@ -71,7 +71,7 @@ bool DDDBReader::load(const string& system_id, /// Inform reader about a locally (e.g. by XercesC) handled source load void DDDBReader::parserLoaded(const std::string& system_id) { - return XML::UriReader::parserLoaded(system_id); + return xml::UriReader::parserLoaded(system_id); } /// Inform reader about a locally (e.g. by XercesC) handled source load diff --git a/DDDB/src/DDDBTags.cpp b/DDDB/src/DDDBTags.cpp index 8a9546e0d..4a7a9726f 100644 --- a/DDDB/src/DDDBTags.cpp +++ b/DDDB/src/DDDBTags.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,6 +22,6 @@ // Define unicode tags #ifndef UNICODE -#define UNICODE(x) extern const ::DD4hep::XML::Tag_t Unicode_##x ( #x ) +#define UNICODE(x) extern const ::dd4hep::xml::Tag_t Unicode_##x ( #x ) #endif #include "DDDB/DDDBTags.h" diff --git a/DDDB/src/plugins/CondDB2DDDB.cpp b/DDDB/src/plugins/CondDB2DDDB.cpp index 5bbb791d8..33b0a6fc0 100644 --- a/DDDB/src/plugins/CondDB2DDDB.cpp +++ b/DDDB/src/plugins/CondDB2DDDB.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -29,47 +29,45 @@ // C/C++ include files using namespace std; -using namespace DD4hep; -using namespace DD4hep::DDDB; +using namespace dd4hep; +using namespace dd4hep::DDDB; #ifdef __GNUC__ // Disable some diagnostics. #pragma GCC diagnostic ignored "-Wunused-function" #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Keep all in here anonymous. Does not have to be visible outside. namespace { - using Conditions::Condition; - using Conditions::AbstractMap; + using cond::AbstractMap; - typedef Alignments::Delta AlignmentDelta; typedef AbstractMap::Params ConditionParams; - struct LogVolRef {}; - struct ElementRef {}; - struct MaterialRef {}; - struct CatalogRef {}; - struct ConditionRef {}; - struct TabPropertyRef {}; - struct DetElemRef {}; - - struct ConditionInfo {}; - struct DetElem {}; - struct Param {}; - struct Parameter {}; - struct GeometryInfo {}; - struct ConditionParam {}; - struct ConditionParamMap {}; - struct ConditionParamVector {}; - struct ConditionParamSpecific {}; + struct DDDBLogVolRef {}; + struct DDDBElementRef {}; + struct DDDBMaterialRef {}; + struct DDDBCatalogRef {}; + struct DDDBConditionRef {}; + struct DDDBTabPropertyRef {}; + struct DDDBDetElemRef {}; + + struct DDDBConditionInfo {}; + struct DDDBDetElem {}; + struct DDDBParam {}; + struct DDDBParameter {}; + struct DDDBGeometryInfo {}; + struct DDDBConditionParam {}; + struct DDDBConditionParamMap {}; + struct DDDBConditionParamVector {}; + struct DDDBConditionParamSpecific {}; /// Main processing context /** \ingroup DD4HEP_DDDB */ - class Context { + class DDDBContext { private: template <typename T,typename Q> @@ -103,7 +101,7 @@ namespace DD4hep { class Locals { public: string obj_path; - Document* xml_doc; + DDDBDocument* xml_doc; Locals() : obj_path(), xml_doc(0) {} Locals(const Locals& c) : obj_path(c.obj_path), xml_doc(c.xml_doc) {} Locals& operator=(const Locals& c) { @@ -118,7 +116,7 @@ namespace DD4hep { */ class PreservedLocals : public Locals { public: - Context* context; + DDDBContext* context; #ifdef __DEBUG_LOCALS void print(const char* opt, bool inc) const { static int preserv_level = 0; @@ -131,7 +129,7 @@ namespace DD4hep { #else inline void print(const char*, bool) const {} #endif - PreservedLocals(Context* c) : Locals(c->locals), context(c) { + PreservedLocals(DDDBContext* c) : Locals(c->locals), context(c) { print("PUSH", true); } ~PreservedLocals() { @@ -141,8 +139,8 @@ namespace DD4hep { }; public: - lcdd_t& lcdd; - XML::UriReader* resolver; + Detector& description; + xml::UriReader* resolver; dddb* geo; Locals locals; bool check; @@ -163,8 +161,8 @@ namespace DD4hep { bool print_tabprop; /// Default constructor - Context(lcdd_t& l) - : lcdd(l), resolver(0), geo(0), check(true), + DDDBContext(Detector& l) + : description(l), resolver(0), geo(0), check(true), print_xml(false), print_docs(false), print_materials(false), @@ -182,29 +180,29 @@ namespace DD4hep { print_tabprop(false) { } /// Default destructor - ~Context() { + ~DDDBContext() { } /** Printout helpers */ - void print(const Isotope* obj) const { if ( print_materials ) dddb_print(obj); } - void print(const Element* obj) const { if ( print_materials ) dddb_print(obj); } - void print(const Material* obj) const { if ( print_materials ) dddb_print(obj); } - void print(const Shape* obj) const { if ( print_shapes ) dddb_print(obj); } - void print(const PhysVol* obj) const { if ( print_physvol ) dddb_print(obj); } - void print(const LogVol* obj) const { if ( print_logvol ) dddb_print(obj); } - void print(const Catalog* obj) const { if ( print_catalog ) dddb_print(obj); } - void print(const TabProperty* obj) const { if ( print_tabprop ) dddb_print(obj); } - void print(const Document* obj) const { if ( print_docs ) dddb_print(obj); } + void print(const DDDBIsotope* obj) const { if ( print_materials ) dddb_print(obj); } + void print(const DDDBElement* obj) const { if ( print_materials ) dddb_print(obj); } + void print(const DDDBMaterial* obj) const { if ( print_materials ) dddb_print(obj); } + void print(const DDDBShape* obj) const { if ( print_shapes ) dddb_print(obj); } + void print(const DDDBPhysVol* obj) const { if ( print_physvol ) dddb_print(obj); } + void print(const DDDBLogVol* obj) const { if ( print_logvol ) dddb_print(obj); } + void print(const DDDBCatalog* obj) const { if ( print_catalog ) dddb_print(obj); } + void print(const DDDBTabProperty* obj) const { if ( print_tabprop ) dddb_print(obj); } + void print(const DDDBDocument* obj) const { if ( print_docs ) dddb_print(obj); } /** Data collection helpers for indexing by object identifier */ - void collect(const string& id, Catalog* obj) { collect_id(geo->catalogs, id, obj); } - void collect(const string& id, Shape* obj) { collect_id(geo->shapes, id, obj); } - void collect(const string& id, PhysVol* obj) { collect_id(geo->placements, id, obj); } - void collect(const string& id, LogVol* obj) { collect_id(geo->volumes, id, obj); } - void collect(const string& id, Isotope* obj) { collect_id(geo->isotopes, id, obj); } - void collect(const string& id, Element* obj) { collect_id(geo->elements, id, obj); } - void collect(const string& id, Material* obj) { collect_id(geo->materials, id, obj); } - void collect(const string& id, TabProperty* obj) { collect_id(geo->tabproperties, id, obj); } + void collect(const string& id, DDDBCatalog* obj) { collect_id(geo->catalogs, id, obj); } + void collect(const string& id, DDDBShape* obj) { collect_id(geo->shapes, id, obj); } + void collect(const string& id, DDDBPhysVol* obj) { collect_id(geo->placements, id, obj); } + void collect(const string& id, DDDBLogVol* obj) { collect_id(geo->volumes, id, obj); } + void collect(const string& id, DDDBIsotope* obj) { collect_id(geo->isotopes, id, obj); } + void collect(const string& id, DDDBElement* obj) { collect_id(geo->elements, id, obj); } + void collect(const string& id, DDDBMaterial* obj) { collect_id(geo->materials, id, obj); } + void collect(const string& id, DDDBTabProperty* obj) { collect_id(geo->tabproperties, id, obj); } void collect(const string& id, Condition& object) { dddb::Conditions::const_iterator i=geo->conditions.find(id); if ( i != geo->conditions.end() ) { @@ -216,12 +214,12 @@ namespace DD4hep { } /** Data collection helpers for indexing by path */ - void collectPath(const string& path, Element* obj) { collect_p(geo->elementPaths, path, obj); } - void collectPath(const string& path, Material* obj) { collect_p(geo->materialPaths, path, obj); } - void collectPath(const string& path, PhysVol* obj) { collect_p(geo->placementPaths, path, obj); } - void collectPath(const string& path, LogVol* obj) { collect_p(geo->volumePaths, path, obj); } - void collectPath(const string& path, TabProperty* obj) { collect_p(geo->tabpropertyPaths, path, obj); } - void collectPath(const string& path, Catalog* obj) { collect_p(geo->catalogPaths, path, obj); } + void collectPath(const string& path, DDDBElement* obj) { collect_p(geo->elementPaths, path, obj); } + void collectPath(const string& path, DDDBMaterial* obj) { collect_p(geo->materialPaths, path, obj); } + void collectPath(const string& path, DDDBPhysVol* obj) { collect_p(geo->placementPaths, path, obj); } + void collectPath(const string& path, DDDBLogVol* obj) { collect_p(geo->volumePaths, path, obj); } + void collectPath(const string& path, DDDBTabProperty* obj) { collect_p(geo->tabpropertyPaths, path, obj); } + void collectPath(const string& path, DDDBCatalog* obj) { collect_p(geo->catalogPaths, path, obj); } void collectPath(const string& path, Condition& object) { dddb::Conditions::const_iterator i=geo->conditionPaths.find(path); if ( i != geo->conditionPaths.end() ) { @@ -239,21 +237,21 @@ namespace DD4hep { template <typename T> struct Conv : protected Converter<T> { public: /// Initializing constructor of the functor with initialization of the user parameter - Conv(lcdd_t& l, void* p, void* o=0) : Converter<T>(l,p,o) {} - void convert(XML::Handle_t element) const; - void fill(XML::Handle_t, T*) const {} - void operator()(XML::Handle_t element) const { + Conv(Detector& l, void* p, void* o=0) : Converter<T>(l,p,o) {} + void convert(xml::Handle_t element) const; + void fill(xml::Handle_t, T*) const {} + void operator()(xml::Handle_t element) const { Increment<T> incr; try { convert(element); } catch(const exception& e) { printout(INFO,typeName(typeid(T)),"Failed to convert XML object: %s", e.what()); - XML::dump_tree(element.parent()); + xml::dump_tree(element.parent()); } catch(...) { printout(INFO,typeName(typeid(T)),"Failed to convert XML object."); - XML::dump_tree(element.parent()); + xml::dump_tree(element.parent()); } } }; @@ -264,59 +262,58 @@ namespace DD4hep { template <typename T> struct ShapeConv : private Converter<T> { public: /// Initializing constructor of the functor with initialization of the user parameter - ShapeConv(lcdd_t& l, void* p) : Converter<T>(l,p,0) {} - void operator()(XML::Handle_t element, Shape*& ptr_shape) const { + ShapeConv(Detector& l, void* p) : Converter<T>(l,p,0) {} + void operator()(xml::Handle_t element, DDDBShape*& ptr_shape) const { Increment<T> incr; try { convert(element, ptr_shape); } catch(const exception& e) { printout(INFO,typeName(typeid(T)),"Failed to convert object: %s",e.what()); - XML::dump_tree(element.parent()); + xml::dump_tree(element.parent()); } catch(...) { printout(INFO,typeName(typeid(T)),"Failed to convert object."); - XML::dump_tree(element.parent()); + xml::dump_tree(element.parent()); } } - void convert(XML::Handle_t element, Shape*& ptr_shape) const; + void convert(xml::Handle_t element, DDDBShape*& ptr_shape) const; }; /// Explicit template instantiations - template <> void ShapeConv<Shape>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<Assembly>::convert(xml_h , Shape*& s) const; - template <> void ShapeConv<Box>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<Cons>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<ConeSegment>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<Tubs>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<Trap>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<Polycone>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<Polygon>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<EllipticalTube>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<TRD>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<Sphere>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<BooleanShape>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<BooleanUnion>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<BooleanIntersection>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<BooleanSubtraction>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<BooleanSubtraction>::convert(xml_h element, Shape*& s) const; - template <> void ShapeConv<BooleanOperation>::convert(xml_h element, Shape*& ptr_shape) const; - - template <> void Conv<ZPlane>::convert(xml_h element) const; + template <> void ShapeConv<DDDBShape>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBAssembly>::convert(xml_h , DDDBShape*& s) const; + template <> void ShapeConv<DDDBBox>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBCons>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBConeSegment>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBTubs>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBTrap>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBPolycone>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBPolygon>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBEllipticalTube>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBTRD>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBSphere>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBBooleanShape>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBBooleanUnion>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBBooleanIntersection>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBBooleanSubtraction>::convert(xml_h element, DDDBShape*& s) const; + template <> void ShapeConv<DDDBBooleanOperation>::convert(xml_h element, DDDBShape*& ptr_shape) const; + + template <> void Conv<DDDBZPlane>::convert(xml_h element) const; template <> void Conv<dddb>::convert(xml_h element) const; - template <> void Conv<LogVol>::convert(xml_h element) const; - template <> void Conv<LogVolRef>::convert(xml_h element) const; - template <> void Conv<PhysVol>::convert(xml_h element) const; - template <> void Conv<ParamPhysVol>::convert(xml_h element) const; - template <> void Conv<ParamPhysVol2D>::convert(xml_h element) const; - template <> void Conv<ParamPhysVol3D>::convert(xml_h element) const; - template <> void Conv<ConditionParam>::convert(xml_h element) const; - template <> void Conv<AlignmentDelta>::convert(xml_h element) const; - - void extract_transformation(lcdd_t& lcdd, void* context, xml_coll_t& collection, Transform3D& tr, int which=-1); - void build_transformation(lcdd_t& lcdd, void* context, xml_h element, Transform3D& tr, int which=-1) { + template <> void Conv<DDDBLogVol>::convert(xml_h element) const; + template <> void Conv<DDDBLogVolRef>::convert(xml_h element) const; + template <> void Conv<DDDBPhysVol>::convert(xml_h element) const; + template <> void Conv<DDDBParamPhysVol>::convert(xml_h element) const; + template <> void Conv<DDDBParamPhysVol2D>::convert(xml_h element) const; + template <> void Conv<DDDBParamPhysVol3D>::convert(xml_h element) const; + template <> void Conv<DDDBConditionParam>::convert(xml_h element) const; + template <> void Conv<Delta>::convert(xml_h element) const; + + void extract_transformation(Detector& description, void* context, xml_coll_t& collection, Transform3D& tr, int which=-1); + void build_transformation(Detector& description, void* context, xml_h element, Transform3D& tr, int which=-1) { xml_coll_t p(element,_U(star)); - extract_transformation(lcdd,context,p,tr,which); + extract_transformation(description,context,p,tr,which); } string reference_href(xml_h element, const string& ref); @@ -335,7 +332,7 @@ namespace DD4hep { return xml_h(0); } - string object_path(Context* context, const string& ref) { + string object_path(DDDBContext* context, const string& ref) { size_t hash = ref.rfind("#"); Path path = hash==0 ? ref.substr(1) : ref; if ( ref[0] != '/' ) { @@ -345,14 +342,14 @@ namespace DD4hep { return path.normalize().native(); } string object_href(xml_h element, const string& ref) { - string p = XML::DocumentHandler::system_path(element); + string p = xml::DocumentHandler::system_path(element); Path path = p; p = path.normalize().native(); p += '#'; p += ref; return p; } - string reference_path(Context* context, const string& ref) { + string reference_path(DDDBContext* context, const string& ref) { size_t hash = ref.rfind("#"); size_t idx = ref.find(":"); size_t idq = ref.find("/"); @@ -364,7 +361,7 @@ namespace DD4hep { } return path.normalize().native(); } - void print_ref(const char* desc, Context* context, xml_h element, const string& ref, const string& opt="") { + void print_ref(const char* desc, DDDBContext* context, xml_h element, const string& ref, const string& opt="") { size_t hash = ref.find("#"); string path = reference_path(context,ref); string obj = hash == string::npos ? ref : ref.substr(hash+1); @@ -375,8 +372,8 @@ namespace DD4hep { } template <typename ACTION=dddb> - void load_dddb_entity(Context* context, - Catalog* catalog, + void load_dddb_entity(DDDBContext* context, + DDDBCatalog* catalog, xml_h element, const string& ref, bool print=false); @@ -386,13 +383,13 @@ namespace DD4hep { return container.find(id) != container.end(); } - bool checkParents(Context* context, Catalog* det) { + bool checkParents(DDDBContext* context, DDDBCatalog* det) { dddb* geo = context->geo; if ( det == geo->top ) { return true; } else if ( det ) { - Catalog* par = 0; + DDDBCatalog* par = 0; string parent_id = det->support; dddb::Catalogs::const_iterator k = geo->catalogPaths.find(parent_id); if ( k != geo->catalogPaths.end() ) { @@ -417,20 +414,20 @@ namespace DD4hep { return false; } - void checkParents(Context* context) { + void checkParents(DDDBContext* context) { dddb* geo = context->geo; if ( context->check ) { for(dddb::Catalogs::iterator i=geo->catalogs.begin(); i!=geo->catalogs.end(); ++i) { - Catalog* det = (*i).second; + DDDBCatalog* det = (*i).second; checkParents(context,det); } } } - void fixCatalogs(Context* context) { + void fixCatalogs(DDDBContext* context) { dddb* geo = context->geo; for(dddb::Catalogs::iterator i=geo->catalogs.begin(); i!=geo->catalogs.end(); ++i) { - Catalog* det = (*i).second; + DDDBCatalog* det = (*i).second; for(dddb::Catalogs::iterator j=det->catalogrefs.begin(); j!=det->catalogrefs.end(); ++j) { const string& child_id = (*j).first; dddb::Catalogs::const_iterator k = geo->catalogs.find(child_id); @@ -438,14 +435,14 @@ namespace DD4hep { printout(ERROR,"fixCatalogs","++ MISSING ID: %s child:%s",det->id.c_str(),child_id.c_str()); continue; } - Catalog* c = (*k).second; + DDDBCatalog* c = (*k).second; det->catalogs[c->name] = c; if ( 0 == (*j).second ) { (*j).second = c; } } for(dddb::Volumes::iterator j=det->logvolrefs.begin(); j!=det->logvolrefs.end(); ++j) { - LogVol* c = (*j).second; + DDDBLogVol* c = (*j).second; if ( !c ) { printout(ERROR,"fixCatalogs","++ MISSING Volume: %s child:%s",det->id.c_str(),(*j).first.c_str()); continue; @@ -485,18 +482,18 @@ namespace DD4hep { } /// Specialized conversion of <param/> entities - template <> void Conv<ConditionParam>::convert(xml_h element) const { + template <> void Conv<DDDBConditionParam>::convert(xml_h element) const { string nam = element.attr<string>(_U(name)); string typ = element.hasAttr(_U(type)) ? element.attr<string>(_U(type)) : string("int"); string data = element.text(); pair<string,OpaqueDataBlock> block; block.first = nam; try { - OpaqueDataBinder::bind(ValueBinder(), block.second, typ, data); + detail::OpaqueDataBinder::bind(detail::ValueBinder(), block.second, typ, data); } catch(...) { pair<string,OpaqueDataBlock> block1; - OpaqueDataBinder::bind(ValueBinder(), block1.second, typ, data); + detail::OpaqueDataBinder::bind(detail::ValueBinder(), block1.second, typ, data); } ConditionParams* par = _option<ConditionParams>(); pair<ConditionParams::iterator,bool> res = par->insert(block); @@ -506,7 +503,7 @@ namespace DD4hep { } /// Specialized conversion of <paramVector> entities - template <> void Conv<ConditionParamVector>::convert(xml_h element) const { + template <> void Conv<DDDBConditionParamVector>::convert(xml_h element) const { string nam = element.attr<string>(_U(name)); string typ = element.hasAttr(_U(type)) ? element.attr<string>(_U(type)) : string("int"); string data = clean_cond_data('[',element.text(),']'); @@ -514,7 +511,7 @@ namespace DD4hep { pair<string,OpaqueDataBlock> block; block.first = nam; - OpaqueDataBinder::bind(VectorBinder(), block.second, typ, data); + detail::OpaqueDataBinder::bind(detail::VectorBinder(), block.second, typ, data); pair<ConditionParams::iterator,bool> res = par->insert(block); if ( !res.second ) { printout(INFO,"ParamVector","++ Failed to insert condition parameter:%s",nam.c_str()); @@ -522,20 +519,20 @@ namespace DD4hep { } /// Specialized conversion of <map/> conditions entities - template <> void Conv<ConditionParamMap>::convert(xml_h element) const { + template <> void Conv<DDDBConditionParamMap>::convert(xml_h element) const { dddb_dim_t e = element; string nam = element.attr<string>(_U(name)); string key_type = e.attr<string>(_LBU(keytype)); string val_type = e.attr<string>(_LBU(valuetype)); pair<string,OpaqueDataBlock> block; - MapBinder binder; + detail::MapBinder binder; block.first = nam; - OpaqueDataBinder::bind_map(binder,block.second, key_type, val_type); + detail::OpaqueDataBinder::bind_map(binder,block.second, key_type, val_type); for(xml_coll_t i(e,_LBU(item)); i; ++i) { string key = i.attr<string>(_LBU(key)); string val = i.attr<string>(_LBU(value)); - OpaqueDataBinder::insert_map(binder,block.second, key_type, key, val_type, val); + detail::OpaqueDataBinder::insert_map(binder,block.second, key_type, key, val_type, val); } ConditionParams* par = _option<ConditionParams>(); pair<ConditionParams::iterator,bool> res = par->insert(block); @@ -544,12 +541,12 @@ namespace DD4hep { } /// Specialized conversion of <specific/> conditions entities - template <> void Conv<ConditionParamSpecific>::convert(xml_h element) const { + template <> void Conv<DDDBConditionParamSpecific>::convert(xml_h element) const { string nam = element.parent().attr<string>(_U(name)); pair<string,OpaqueDataBlock> block; stringstream str; - XML::dump_tree(element, str); + xml::dump_tree(element, str); block.second.bind<string>(str.str()); block.first = nam; @@ -561,46 +558,46 @@ namespace DD4hep { } /// Specialized conversion of <param/> and <paramVector> entities in alignments - template <> void Conv<AlignmentDelta>::convert(xml_h element) const { + template <> void Conv<Delta>::convert(xml_h element) const { string nam = element.attr<string>(_U(name)); string data = clean_cond_data('(',element.text(),')'); - AlignmentDelta* a = _option<AlignmentDelta>(); + Delta* a = _option<Delta>(); Position pos; const BasicGrammar& g = BasicGrammar::instance<Position>(); if ( !g.fromString(&pos,data) ) g.invalidConversion(data, g.type()); if ( nam == "dPosXYZ" ) { a->translation = pos; - a->flags |= AlignmentDelta::HAVE_TRANSLATION; + a->flags |= Delta::HAVE_TRANSLATION; } else if ( nam == "dRotXYZ" ) { a->rotation = RotationZYX(pos.z(),pos.y(),pos.x()); - a->flags |= AlignmentDelta::HAVE_ROTATION; + a->flags |= Delta::HAVE_ROTATION; } else if ( nam == "pivotXYZ" ) { a->pivot = Translation3D(pos.x(),pos.y(),pos.z()); - a->flags |= AlignmentDelta::HAVE_PIVOT; + a->flags |= Delta::HAVE_PIVOT; } else { - printout(ERROR,"AlignmentDelta","++ Unknown alignment conditions tag: %s",nam.c_str()); + printout(ERROR,"Delta","++ Unknown alignment conditions tag: %s",nam.c_str()); } } /// Specialized conversion of <condition/> entities template <> void Conv<Condition>::convert(xml_h element) const { - Context* context = _param<Context>(); + DDDBContext* context = _param<DDDBContext>(); string name = element.attr<string>(_U(name)); string id = object_href(element,name); if ( !_find(id, context->geo->conditions) ) { - Catalog* catalog = _option<Catalog>(); - Document* doc = context->locals.xml_doc; + DDDBCatalog* catalog = _option<DDDBCatalog>(); + DDDBDocument* doc = context->locals.xml_doc; string path = object_path(context,name); static int num_param=0, num_vector=0, num_map=0, num_spec=0, num_align=0; Condition cond(path,"DDDB"); cond->address = doc->name+"@"+id; cond->value = path; // doc->name; cond->validity = ""; - cond->hash = hash64(path); + cond->hash = detail::hash64(path); if ( element.hasAttr(_U(comment)) ) { cond->comment = element.attr<string>(_U(comment)); } @@ -611,7 +608,7 @@ namespace DD4hep { } #if 0 if ( cls_id == AbstractMap::ALIGNMENT ) { - Conv<AlignmentDelta> conv(lcdd,context,&cond.bind<AlignmentDelta>()); + Conv<Delta> conv(description,context,&cond.bind<Delta>()); xml_coll_t(element,_LBU(paramVector)).for_each(conv); cond->setFlag(Condition::ALIGNMENT_DELTA); ++num_align; @@ -620,12 +617,12 @@ namespace DD4hep { if ( cls_id == AbstractMap::ALIGNMENT ) { AbstractMap& d = cond.bind<AbstractMap>(); pair<string,OpaqueDataBlock> block; - AlignmentDelta& align = block.second.bind<AlignmentDelta>(); + Delta& align = block.second.bind<Delta>(); d.clientData = doc->addRef(); d.classID = cls_id; - block.first = Alignments::Keys::deltaName; + block.first = align::Keys::deltaName; - Conv<AlignmentDelta> conv(lcdd,context,&align); + Conv<Delta> conv(description,context,&align); xml_coll_t(element,_LBU(paramVector)).for_each(conv); cond.setFlag(Condition::ALIGNMENT_DELTA); pair<ConditionParams::iterator,bool> res = d.params.insert(block); @@ -647,16 +644,16 @@ namespace DD4hep { d.clientData = doc->addRef(); d.classID = cls_id; - Conv<ConditionParam> object_cnv(lcdd,context,&d.params); + Conv<DDDBConditionParam> object_cnv(description,context,&d.params); xml_coll_t(element,_U(param)).for_each(object_cnv); - Conv<ConditionParamVector> vector_cnv(lcdd,context,&d.params); + Conv<DDDBConditionParamVector> vector_cnv(description,context,&d.params); xml_coll_t(element,_LBU(paramVector)).for_each(vector_cnv); - Conv<ConditionParamMap> map_cnv(lcdd,context,&d.params); + Conv<DDDBConditionParamMap> map_cnv(description,context,&d.params); xml_coll_t(element,_LBU(map)).for_each(map_cnv); - Conv<ConditionParamSpecific> specific_cnv(lcdd,context,&d.params); + Conv<DDDBConditionParamSpecific> specific_cnv(description,context,&d.params); xml_coll_t(element,_LBU(specific)).for_each(specific_cnv); for(xml_coll_t iter(element,_U(star)); iter; ++iter) { string tag = iter.tag(); @@ -686,16 +683,16 @@ namespace DD4hep { } /// Specialized conversion of <conditionref/> entities - template <> void Conv<ConditionRef>::convert(xml_h element) const { - Context* context = _param<Context>(); - Catalog* catalog = _option<Catalog>(); + template <> void Conv<DDDBConditionRef>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); string href = element.attr<string>(_LBU(href)); string refid = reference_href(element,href); string path; xml_h target = find_local_element(element, href, _LBU(condition)); if ( target ) - Conv<Condition>(lcdd,context,catalog)(target); + Conv<Condition>(description,context,catalog)(target); else load_dddb_entity(context, catalog, element, href); dddb::Conditions::const_iterator i=context->geo->conditions.find(refid); @@ -716,20 +713,20 @@ namespace DD4hep { } /// Specialized conversion of <author/> entities - template <> void Conv<Author>::convert(xml_h element) const { + template <> void Conv<DDDBAuthor>::convert(xml_h element) const { string* context = _option<string>(); if ( element.hasAttr(_U(author)) ) *context = element.attr<string>(_U(author)); } /// Specialized conversion of <version/> entities - template <> void Conv<Version>::convert(xml_h element) const { + template <> void Conv<DDDBVersion>::convert(xml_h element) const { string* context = _option<string>(); if ( element.hasAttr(_U(version)) ) *context = element.attr<string>(_U(version)); } /// Specialized conversion of <param/> entities - template <> void Conv<Param>::convert(xml_h element) const { - Catalog* det = _option<Catalog>(); + template <> void Conv<DDDBParam>::convert(xml_h element) const { + DDDBCatalog* det = _option<DDDBCatalog>(); string name = element.attr<string>(_U(name)); string type = element.hasAttr(_U(type)) ? element.attr<string>(_U(type)) : string("int"); string value = element.text(); @@ -737,21 +734,21 @@ namespace DD4hep { } /// Specialized conversion of <ConditionInfo/> entities - template <> void Conv<ConditionInfo>::convert(xml_h element) const { - Catalog* det = _option<Catalog>(); + template <> void Conv<DDDBConditionInfo>::convert(xml_h element) const { + DDDBCatalog* det = _option<DDDBCatalog>(); string name = element.attr<string>(_U(name)); string cond = element.attr<string>(_LBU(condition)); det->conditioninfo[name] = cond; } /// Specialized conversion of <isotope/> entities - template <> void Conv<Isotope>::convert(xml_h element) const { - Context* context = _param<Context>(); + template <> void Conv<DDDBIsotope>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); dddb_dim_t x_i = element; string name = x_i.nameStr(); string id = object_path(context,name); if ( !_find(id, context->geo->isotopes) ) { - Isotope* i = new Isotope(); + DDDBIsotope* i = new DDDBIsotope(); i->name = name; i->A = x_i.A(-1.0); i->Z = x_i.Z(-1.0); @@ -762,9 +759,9 @@ namespace DD4hep { } /// Specialized conversion of <elementref/> entities - template <> void Conv<ElementRef>::convert(xml_h element) const { - Context* context = _param<Context>(); - Catalog* catalog = _option<Catalog>(); + template <> void Conv<DDDBElementRef>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); string href = element.attr<string>(_LBU(href)); string refid = reference_href(element,href); load_dddb_entity(context, catalog, element, href); @@ -772,19 +769,19 @@ namespace DD4hep { if ( i == context->geo->elements.end() ) { printout(ERROR,"ElementRef","++ MISSING ID: %s Failed to convert ref:%s",refid.c_str(),href.c_str()); } - Element* e = (*i).second; + DDDBElement* e = (*i).second; string path = object_path(context,e->name); context->collectPath(path, e); } /// Specialized conversion of <element/> entities - template <> void Conv<Element>::convert(xml_h element) const { - Context* context = _param<Context>(); + template <> void Conv<DDDBElement>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); dddb_dim_t x_elem = element; string name = x_elem.nameStr(); string id = object_href(element, name); if ( !_find(id, context->geo->elements) ) { - Element* e = new Element(); + DDDBElement* e = new DDDBElement(); dddb_dim_t atom = x_elem.child(_U(atom),false); e->id = id; e->name = name; @@ -795,10 +792,10 @@ namespace DD4hep { e->atom.A = atom ? atom.attr<double>(_U(A)) : -1.0; e->atom.Zeff = atom ? atom.attr<double>(_U(Zeff)) : -1.0; string st = x_elem.state(); - if ( st == "solid" ) e->state = Element::SOLID; - else if ( st == "liquid" ) e->state = Element::LIQUID; - else if ( st == "gas" ) e->state = Element::GAS; - else e->state = Element::UNKNOWN; + if ( st == "solid" ) e->state = DDDBElement::SOLID; + else if ( st == "liquid" ) e->state = DDDBElement::LIQUID; + else if ( st == "gas" ) e->state = DDDBElement::GAS; + else e->state = DDDBElement::UNKNOWN; for(xml_coll_t p(x_elem,_LBU(isotoperef)); p; ++p) { dddb_dim_t isotope = p; @@ -813,20 +810,20 @@ namespace DD4hep { } /// Specialized conversion of <material><component/></material> entities - template <> void Conv<MaterialComponent>::convert(xml_h element) const { - Material* m = _option<Material>(); + template <> void Conv<DDDBMaterialComponent>::convert(xml_h element) const { + DDDBMaterial* m = _option<DDDBMaterial>(); dddb_dim_t x_mat = element; - m->components.push_back(MaterialComponent()); - MaterialComponent& c = m->components.back(); + m->components.push_back(DDDBMaterialComponent()); + DDDBMaterialComponent& c = m->components.back(); c.name = x_mat.nameStr(); c.natoms = x_mat.natoms(1); c.fractionmass = x_mat.fractionmass(1.0); } /// Specialized conversion of <materialref/> entities - template <> void Conv<MaterialRef>::convert(xml_h element) const { - Context* context = _param<Context>(); - Catalog* catalog = _option<Catalog>(); + template <> void Conv<DDDBMaterialRef>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); string href = element.attr<string>(_LBU(href)); string refid = reference_href(element,href); load_dddb_entity(context, catalog, element, href); @@ -835,21 +832,21 @@ namespace DD4hep { printout(ERROR,"MaterialRef","++ MISSING ID: %s Failed to convert ref:%s",refid.c_str(),href.c_str()); } if ( catalog ) { - Material* m = (*i).second; + DDDBMaterial* m = (*i).second; string path = object_path(context,m->name); context->collectPath(path, m); } } /// Specialized conversion of <material/> entities - template <> void Conv<Material>::convert(xml_h element) const { - Context* context = _param<Context>(); - Catalog* catalog = _option<Catalog>(); + template <> void Conv<DDDBMaterial>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); dddb_dim_t x_mat = element; string name = x_mat.nameStr(); string id = object_href(element, name); if ( !_find(id, context->geo->materials) ) { - Material* m = new Material(); + DDDBMaterial* m = new DDDBMaterial(); m->name = name; m->id = id; m->path = object_path(context,name); @@ -861,7 +858,7 @@ namespace DD4hep { for(xml_coll_t p(element,_LBU(tabprops)); p; ++p) m->properties.push_back(p.attr<string>(_LBU(address))); - xml_coll_t(element, _U(component)).for_each(Conv<MaterialComponent>(lcdd,context,m)); + xml_coll_t(element, _U(component)).for_each(Conv<DDDBMaterialComponent>(description,context,m)); context->collect(m->id, m); // We collect materials by NAME!!! context->collect(m->name, m); m->setDocument(context->locals.xml_doc); @@ -870,8 +867,8 @@ namespace DD4hep { } /// Specialized conversion of <geometryinfo/> entities - template <> void Conv<GeometryInfo>::convert(xml_h element) const { - Catalog* context = _option<Catalog>(); + template <> void Conv<DDDBGeometryInfo>::convert(xml_h element) const { + DDDBCatalog* context = _option<DDDBCatalog>(); context->logvol = element.attr<string>(_LBU(lvname)); if ( element.hasAttr(_LBU(npath)) ) context->npath = element.attr<string>(_LBU(npath)); if ( element.hasAttr(_LBU(support)) ) context->support = element.attr<string>(_LBU(support)); @@ -897,15 +894,15 @@ namespace DD4hep { /// Specialized conversion of <transformation/> entities template <> void Conv<Transform3D>::convert(xml_h element) const { Transform3D* tr = _option<Transform3D>(); - build_transformation(lcdd, param, element, *tr); + build_transformation(description, param, element, *tr); //dddb_print(tr); } /// Specialized conversion of <zplane/> entities - template <> void Conv<ZPlane>::convert(xml_h element) const { - Shape* s = _param<Shape>(); + template <> void Conv<DDDBZPlane>::convert(xml_h element) const { + DDDBShape* s = _param<DDDBShape>(); dddb_dim_t dim = element; - ZPlane plane; + DDDBZPlane plane; plane.innerRadius = dim.innerRadius(0.0); plane.outerRadius = dim.outerRadius(0.0); plane.z = dim.z(0.0); @@ -913,24 +910,24 @@ namespace DD4hep { } /// Specialized common shape conversion - template <> void ShapeConv<Shape>::convert(xml_h element, Shape*& s) const { - Context* context = _param<Context>(); + template <> void ShapeConv<DDDBShape>::convert(xml_h element, DDDBShape*& s) const { + DDDBContext* context = _param<DDDBContext>(); xml_dim_t dim = element; - s = new Shape; + s = new DDDBShape; s->name = dim.nameStr(); s->path = object_path(context, s->name); } /// Specialized conversion of assemblies (logical volumes without shapes) - template <> void ShapeConv<Assembly>::convert(xml_h , Shape*& s) const { - s = new Shape(); + template <> void ShapeConv<DDDBAssembly>::convert(xml_h , DDDBShape*& s) const { + s = new DDDBShape(); s->name = "assembly"; s->type = to_type::type(); } /// Specialized conversion of Box shapes - template <> void ShapeConv<Box>::convert(xml_h element, Shape*& s) const { - ShapeConv<Shape>(lcdd,param)(element,s); + template <> void ShapeConv<DDDBBox>::convert(xml_h element, DDDBShape*& s) const { + ShapeConv<DDDBShape>(description,param)(element,s); dddb_dim_t dim = element; s->type = to_type::type(); s->s.box.x = dim.sizeX(0.0)/2e0; @@ -939,9 +936,9 @@ namespace DD4hep { } /// Specialized conversion of Cons shapes - template <> void ShapeConv<Cons>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBCons>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); s->type = to_type::type(); s->s.cons.innerRadiusMZ = dim.innerRadiusMZ(0.0); s->s.cons.innerRadiusPZ = dim.innerRadiusPZ(0.0); @@ -951,9 +948,9 @@ namespace DD4hep { } /// Specialized conversion of ConeSegment shapes - template <> void ShapeConv<ConeSegment>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBConeSegment>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); s->type = to_type::type(); s->s.coneSegment.start = dim.startPhiAngle(0.0); s->s.coneSegment.delta = dim.deltaPhiAngle(2.0*M_PI); @@ -965,9 +962,9 @@ namespace DD4hep { } /// Specialized conversion of Tubs shapes - template <> void ShapeConv<Tubs>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBTubs>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); s->type = to_type::type(); s->s.tubs.start = dim.startPhiAngle(0.0); s->s.tubs.delta = dim.deltaPhiAngle(2.0*M_PI); @@ -977,9 +974,9 @@ namespace DD4hep { } /// Specialized conversion of Trap shapes - template <> void ShapeConv<Trap>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBTrap>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); if ( s->name == "Cut_out_right" ) { s->type = to_type::type(); } @@ -998,32 +995,32 @@ namespace DD4hep { } /// Specialized conversion of Polycone shapes - template <> void ShapeConv<Polycone>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBPolycone>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); s->type = to_type::type(); s->s.polycone.start = dim.startPhiAngle(0.0); s->s.polycone.delta = dim.deltaPhiAngle(2.0*M_PI); - xml_coll_t(element, _U(zplane)).for_each(Conv<ZPlane>(lcdd,s)); + xml_coll_t(element, _U(zplane)).for_each(Conv<DDDBZPlane>(description,s)); } /// Specialized conversion of Polygon shapes - template <> void ShapeConv<Polygon>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBPolygon>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); s->type = to_type::type(); s->s.polygon.z = dim.z(); s->s.polygon.start = dim.start(0.0); s->s.polygon.nsides = dim.nsides(); s->s.polygon.innerRadius = dim.innerRadius(0.0); s->s.polygon.outerRadius = dim.outerRadius(0.0); - xml_coll_t(element, _U(zplane)).for_each(Conv<ZPlane>(lcdd,s)); + xml_coll_t(element, _U(zplane)).for_each(Conv<DDDBZPlane>(description,s)); } /// Specialized conversion of EllipticalTube shapes - template <> void ShapeConv<EllipticalTube>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBEllipticalTube>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); s->type = to_type::type(); s->s.ellipticalTube.a = dim.a(); s->s.ellipticalTube.b = dim.b(); @@ -1031,9 +1028,9 @@ namespace DD4hep { } /// Specialized conversion of EllipticalTube shapes - template <> void ShapeConv<TRD>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBTRD>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); s->type = to_type::type(); s->s.trd.x1 = dim.sizeX1()/2e0; s->s.trd.x2 = dim.sizeX2()/2e0; @@ -1043,9 +1040,9 @@ namespace DD4hep { } /// Specialized conversion of EllipticalTube shapes - template <> void ShapeConv<Sphere>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBSphere>::convert(xml_h element, DDDBShape*& s) const { dddb_dim_t dim = element; - ShapeConv<Shape>(lcdd,param)(element,s); + ShapeConv<DDDBShape>(description,param)(element,s); s->type = to_type::type(); s->s.sphere.rmin = dim.innerRadius(0); s->s.sphere.rmax = dim.outerRadius(0); @@ -1056,22 +1053,22 @@ namespace DD4hep { } /// Specialized common conversion of boolean shapes - template <> void ShapeConv<BooleanShape>::convert(xml_h element, Shape*& s) const { - ShapeConv<Shape>(lcdd,param)(element,s); - Context* context = _param<Context>(); + template <> void ShapeConv<DDDBBooleanShape>::convert(xml_h element, DDDBShape*& s) const { + ShapeConv<DDDBShape>(description,param)(element,s); + DDDBContext* context = _param<DDDBContext>(); string id = object_path(context,s->name); - Context::PreservedLocals locals(context); + DDDBContext::PreservedLocals locals(context); context->locals.obj_path = id; s->s.boolean.first = 0; for(xml_coll_t p(element,_U(star)); p; ++p) { if ( p.parent() == element ) { // Only next level is processed here if ( 0 == s->s.boolean.first ) { - ShapeConv<BooleanOperation>(lcdd,context)(p,s->s.boolean.first); + ShapeConv<DDDBBooleanOperation>(description,context)(p,s->s.boolean.first); s->s.boolean.first->id = id + "/" + s->s.boolean.first->name; ++p; } - BooleanOperation op; - ShapeConv<BooleanOperation>(lcdd,context)(p,op.shape); + DDDBBooleanOperation op; + ShapeConv<DDDBBooleanOperation>(description,context)(p,op.shape); if ( 0 == op.shape ) { // Error. What to do? // Anyhow: ShapeConv<BooleanOperation> throws exception if the @@ -1081,71 +1078,71 @@ namespace DD4hep { } op.shape->id = id + "/" + op.shape->name; ++p; - extract_transformation(lcdd, param, p, op.trafo); + extract_transformation(description, param, p, op.trafo); s->boolean_ops.push_back(op); } } } /// Specialized conversion of boolean union shapes - template <> void ShapeConv<BooleanUnion>::convert(xml_h element, Shape*& s) const { - ShapeConv<BooleanShape>(lcdd,param)(element,s); + template <> void ShapeConv<DDDBBooleanUnion>::convert(xml_h element, DDDBShape*& s) const { + ShapeConv<DDDBBooleanShape>(description,param)(element,s); s->type = to_type::type(); } /// Specialized conversion of boolean intersection shapes - template <> void ShapeConv<BooleanIntersection>::convert(xml_h element, Shape*& s) const { - ShapeConv<BooleanShape>(lcdd,param)(element,s); + template <> void ShapeConv<DDDBBooleanIntersection>::convert(xml_h element, DDDBShape*& s) const { + ShapeConv<DDDBBooleanShape>(description,param)(element,s); s->type = to_type::type(); } /// Specialized conversion of boolean subtraction shapes - template <> void ShapeConv<BooleanSubtraction>::convert(xml_h element, Shape*& s) const { - ShapeConv<BooleanShape>(lcdd,param)(element,s); + template <> void ShapeConv<DDDBBooleanSubtraction>::convert(xml_h element, DDDBShape*& s) const { + ShapeConv<DDDBBooleanShape>(description,param)(element,s); s->type = to_type::type(); } /// Specialized conversion of boolean operations - template <> void ShapeConv<BooleanOperation>::convert(xml_h element, Shape*& s) const { + template <> void ShapeConv<DDDBBooleanOperation>::convert(xml_h element, DDDBShape*& s) const { xml_h elt = element; string tag = element.tag(); - Context* context = _param<Context>(); + DDDBContext* context = _param<DDDBContext>(); // Now convert all possible / supported shapes if ( tag == "box" ) - ShapeConv<Box>(lcdd,context)(elt,s); + ShapeConv<DDDBBox>(description,context)(elt,s); else if ( tag == "cons" ) - ShapeConv<Cons>(lcdd,context)(elt,s); + ShapeConv<DDDBCons>(description,context)(elt,s); else if ( tag == "tubs" ) - ShapeConv<Tubs>(lcdd,context)(elt,s); + ShapeConv<DDDBTubs>(description,context)(elt,s); else if ( tag == "trap" ) - ShapeConv<Trap>(lcdd,context)(elt,s); + ShapeConv<DDDBTrap>(description,context)(elt,s); else if ( tag == "polycone" ) - ShapeConv<Polycone>(lcdd,context)(elt,s); + ShapeConv<DDDBPolycone>(description,context)(elt,s); else if ( tag == "polygon" ) - ShapeConv<Polygon>(lcdd,context)(elt,s); + ShapeConv<DDDBPolygon>(description,context)(elt,s); else if ( tag == "trd" ) - ShapeConv<TRD>(lcdd,context)(elt,s); + ShapeConv<DDDBTRD>(description,context)(elt,s); else if ( tag == "eltu" ) - ShapeConv<EllipticalTube>(lcdd,context)(elt,s); + ShapeConv<DDDBEllipticalTube>(description,context)(elt,s); else if ( tag == "sphere" ) - ShapeConv<Sphere>(lcdd,context)(elt,s); + ShapeConv<DDDBSphere>(description,context)(elt,s); else if ( tag == "union" ) - ShapeConv<BooleanUnion>(lcdd,context)(elt,s); + ShapeConv<DDDBBooleanUnion>(description,context)(elt,s); else if ( tag == "subtraction" ) - ShapeConv<BooleanSubtraction>(lcdd,context)(elt,s); + ShapeConv<DDDBBooleanSubtraction>(description,context)(elt,s); else if ( tag == "intersection" ) - ShapeConv<BooleanIntersection>(lcdd,context)(elt,s); + ShapeConv<DDDBBooleanIntersection>(description,context)(elt,s); else { - XML::dump_tree(element.parent()); + xml::dump_tree(element.parent()); except("BooleanOperation","Unknown shape conversion requested:"+tag); } } /// Specialized conversion of <logvolref/> entities - template <> void Conv<LogVolRef>::convert(xml_h element) const { - Context* context = _param<Context>(); - Catalog* catalog = _option<Catalog>(); + template <> void Conv<DDDBLogVolRef>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); string href = element.attr<string>(_LBU(href)); string refid = reference_href(element,href); @@ -1155,7 +1152,7 @@ namespace DD4hep { string r = reference_href(element,href); printout(ERROR,"LogVolRef","++ MISSING ID: %s Failed to convert ref:%s",refid.c_str(),href.c_str()); } - LogVol* vol = (*i).second; + DDDBLogVol* vol = (*i).second; catalog->logvolrefs[vol->id] = vol; string path = object_path(context,vol->name); context->collectPath(path, vol); @@ -1165,44 +1162,44 @@ namespace DD4hep { } /// Specialized conversion of <logvol/> entities - template <> void Conv<LogVol>::convert(xml_h element) const { - Context* context = _param<Context>(); + template <> void Conv<DDDBLogVol>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); string name = element.attr<string>(_U(name)); string id = object_href(element, name); if ( !_find(id, context->geo->volumes) ) { - Catalog* catalog = _option<Catalog>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); string material; - LogVol* vol = new LogVol; + DDDBLogVol* vol = new DDDBLogVol; xml_h elt; vol->name = name; vol->path = object_path(context,name); if ( element.hasAttr(_U(material)) ) { vol->material = element.attr<string>(_U(material)); } - Shape* s = 0; + DDDBShape* s = 0; // Now convert all possible / supported shapes if ( (elt=element.child(_U(box),false)) ) - ShapeConv<Box>(lcdd,context)(elt,s); + ShapeConv<DDDBBox>(description,context)(elt,s); else if ( (elt=element.child(_U(cons),false)) ) - ShapeConv<Cons>(lcdd,context)(elt,s); + ShapeConv<DDDBCons>(description,context)(elt,s); else if ( (elt=element.child(_U(tubs),false)) ) - ShapeConv<Tubs>(lcdd,context)(elt,s); + ShapeConv<DDDBTubs>(description,context)(elt,s); else if ( (elt=element.child(_U(trap),false)) ) - ShapeConv<Trap>(lcdd,context)(elt,s); + ShapeConv<DDDBTrap>(description,context)(elt,s); else if ( (elt=element.child(_U(trd),false)) ) - ShapeConv<TRD>(lcdd,context)(elt,s); + ShapeConv<DDDBTRD>(description,context)(elt,s); else if ( (elt=element.child(_U(polycone),false)) ) - ShapeConv<Polycone>(lcdd,context)(elt,s); + ShapeConv<DDDBPolycone>(description,context)(elt,s); else if ( (elt=element.child(_U(sphere),false)) ) - ShapeConv<Sphere>(lcdd,context)(elt,s); + ShapeConv<DDDBSphere>(description,context)(elt,s); else if ( (elt=element.child(_U(union),false)) ) - ShapeConv<BooleanUnion>(lcdd,context)(elt,s); + ShapeConv<DDDBBooleanUnion>(description,context)(elt,s); else if ( (elt=element.child(_U(subtraction),false)) ) - ShapeConv<BooleanSubtraction>(lcdd,context)(elt,s); + ShapeConv<DDDBBooleanSubtraction>(description,context)(elt,s); else if ( (elt=element.child(_U(intersection),false)) ) - ShapeConv<BooleanIntersection>(lcdd,context)(elt,s); + ShapeConv<DDDBBooleanIntersection>(description,context)(elt,s); else { - ShapeConv<Assembly>(lcdd,context)(elt,s); + ShapeConv<DDDBAssembly>(description,context)(elt,s); // Dump element if not known and processed.... for(xml_coll_t p(element,_U(star)); p; ++p) { if ( p.parent() == element ) { @@ -1212,7 +1209,7 @@ namespace DD4hep { if ( tag == "paramphysvol2D" ) continue; if ( tag == "paramphysvol3D" ) continue; printout(WARNING,"LogVol","++ Unknown and not processed tag found: %s",tag.c_str()); - XML::dump_tree(element); + xml::dump_tree(element); break; } } @@ -1225,94 +1222,94 @@ namespace DD4hep { context->collect(id, vol); if ( catalog ) context->collectPath(vol->path, vol); { - Context::PreservedLocals locals(context); + DDDBContext::PreservedLocals locals(context); context->locals.obj_path = id; - xml_coll_t(element, _U(physvol)).for_each(Conv<PhysVol>(lcdd,context,vol)); - xml_coll_t(element, _LBU(paramphysvol)).for_each(Conv<ParamPhysVol>(lcdd,context,vol)); - xml_coll_t(element, _LBU(paramphysvol2D)).for_each(Conv<ParamPhysVol2D>(lcdd,context,vol)); - xml_coll_t(element, _LBU(paramphysvol3D)).for_each(Conv<ParamPhysVol3D>(lcdd,context,vol)); + xml_coll_t(element, _U(physvol)).for_each(Conv<DDDBPhysVol>(description,context,vol)); + xml_coll_t(element, _LBU(paramphysvol)).for_each(Conv<DDDBParamPhysVol>(description,context,vol)); + xml_coll_t(element, _LBU(paramphysvol2D)).for_each(Conv<DDDBParamPhysVol2D>(description,context,vol)); + xml_coll_t(element, _LBU(paramphysvol3D)).for_each(Conv<DDDBParamPhysVol3D>(description,context,vol)); } } } /// Specialized conversion of <physvol/> entities - template <> void Conv<PhysVol>::fill(xml_h element, PhysVol* pv) const { + template <> void Conv<DDDBPhysVol>::fill(xml_h element, DDDBPhysVol* pv) const { xml_h elt; dddb_dim_t x_vol = element; string name = x_vol.nameStr(); - Context* context = _param<Context>(); + DDDBContext* context = _param<DDDBContext>(); pv->name = name; pv->logvol = x_vol.logvol(); pv->path = object_path(context,name); - build_transformation(lcdd, param, element, pv->trafo, -1); + build_transformation(description, param, element, pv->trafo, -1); } - template <> void Conv<PhysVol>::convert(xml_h element) const { - Context* context = _param<Context>(); + template <> void Conv<DDDBPhysVol>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); dddb_dim_t x_vol = element; string name = x_vol.nameStr(); string id = object_href(element, name); if ( !_find(id, context->geo->placements) ) { - PhysVol* vol = new PhysVol(); + DDDBPhysVol* vol = new DDDBPhysVol(); this->fill(element, vol); context->collect(id, vol); context->collectPath(vol->path,vol); vol->setDocument(context->locals.xml_doc); if ( optional ) { - _option<LogVol>()->physvols.push_back(vol); + _option<DDDBLogVol>()->physvols.push_back(vol); } } } /// Specialized conversion of EllipticalTube shapes - template <> void Conv<ParamPhysVol>::fill(xml_h element, ParamPhysVol* pv) const { + template <> void Conv<DDDBParamPhysVol>::fill(xml_h element, DDDBParamPhysVol* pv) const { dddb_dim_t x_pv = element.child(_U(physvol)); dddb_dim_t elt = element; - Conv<PhysVol>(lcdd,param).fill(x_pv, pv); + Conv<DDDBPhysVol>(description,param).fill(x_pv, pv); pv->number1 = elt.number(0); - build_transformation(lcdd, param, element, pv->trafo1, 0); + build_transformation(description, param, element, pv->trafo1, 0); } - template <> void Conv<ParamPhysVol>::convert(xml_h element) const { - ParamPhysVol* pv = new ParamPhysVol(); + template <> void Conv<DDDBParamPhysVol>::convert(xml_h element) const { + DDDBParamPhysVol* pv = new DDDBParamPhysVol(); this->fill(element, pv); - _option<LogVol>()->physvols.push_back(pv); + _option<DDDBLogVol>()->physvols.push_back(pv); } /// Specialized conversion of EllipticalTube shapes - template <> void Conv<ParamPhysVol2D>::fill(xml_h element, ParamPhysVol2D* pv) const { + template <> void Conv<DDDBParamPhysVol2D>::fill(xml_h element, DDDBParamPhysVol2D* pv) const { dddb_dim_t elt = element; - Conv<ParamPhysVol>(lcdd,param).fill(element, pv); + Conv<DDDBParamPhysVol>(description,param).fill(element, pv); pv->number1 = elt.number1(); pv->number2 = elt.number2(); - build_transformation(lcdd, param, element, pv->trafo2, 1); + build_transformation(description, param, element, pv->trafo2, 1); } - template <> void Conv<ParamPhysVol2D>::convert(xml_h element) const { - ParamPhysVol2D* pv = new ParamPhysVol2D(); + template <> void Conv<DDDBParamPhysVol2D>::convert(xml_h element) const { + DDDBParamPhysVol2D* pv = new DDDBParamPhysVol2D(); this->fill(element,pv); - _option<LogVol>()->physvols.push_back(pv); + _option<DDDBLogVol>()->physvols.push_back(pv); } /// Specialized conversion of EllipticalTube shapes - template <> void Conv<ParamPhysVol3D>::fill(xml_h element, ParamPhysVol3D* pv) const { + template <> void Conv<DDDBParamPhysVol3D>::fill(xml_h element, DDDBParamPhysVol3D* pv) const { dddb_dim_t elt = element; - Conv<ParamPhysVol2D>(lcdd,param).fill(element, pv); + Conv<DDDBParamPhysVol2D>(description,param).fill(element, pv); pv->number3 = elt.number3(); - build_transformation(lcdd, param, element, pv->trafo3, 2); + build_transformation(description, param, element, pv->trafo3, 2); } - template <> void Conv<ParamPhysVol3D>::convert(xml_h element) const { - ParamPhysVol3D* pv = new ParamPhysVol3D(); + template <> void Conv<DDDBParamPhysVol3D>::convert(xml_h element) const { + DDDBParamPhysVol3D* pv = new DDDBParamPhysVol3D(); this->fill(element,pv); - _option<LogVol>()->physvols.push_back(pv); + _option<DDDBLogVol>()->physvols.push_back(pv); } /// Specialized conversion of <geometryinfo/> entities - template <> void Conv<TabProperty>::convert(xml_h element) const { - Context* context = _param<Context>(); + template <> void Conv<DDDBTabProperty>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); dddb_dim_t x_dim = element; string name = x_dim.nameStr(); string id = object_href(element, name); if ( !_find(id, context->geo->tabproperties) ) { - TabProperty* p = new TabProperty(); + DDDBTabProperty* p = new DDDBTabProperty(); p->name = name; p->path = object_path(context,name); if ( element.hasAttr(_U(type)) ) p->type = element.attr<string>(_U(type)); @@ -1327,9 +1324,9 @@ namespace DD4hep { } /// Specialized conversion of <tabpropertyref/> entities - template <> void Conv<TabPropertyRef>::convert(xml_h element) const { - Context* context = _param<Context>(); - Catalog* catalog = _option<Catalog>(); + template <> void Conv<DDDBTabPropertyRef>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); string href = element.attr<string>(_LBU(href)); string refid = reference_href(element,href); @@ -1340,7 +1337,7 @@ namespace DD4hep { printout(ERROR,"TabPropertyRef","++ MISSING ID: %s Failed to convert ref:%s",refid.c_str(),href.c_str()); return; } - TabProperty* p = (*i).second; + DDDBTabProperty* p = (*i).second; catalog->tabpropertyrefs[p->id] = p; string path = object_path(context,p->name); context->collectPath(path, p); @@ -1350,8 +1347,8 @@ namespace DD4hep { } /// Specialized conversion of <parameter/> entities - template <> void Conv<Parameter>::convert(xml_h element) const { - Context* context = _param<Context>(); + template <> void Conv<DDDBParameter>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); string name = element.attr<string>(_U(name)); string value = element.attr<string>(_U(value)); _toDictionary(name,value); @@ -1361,15 +1358,15 @@ namespace DD4hep { } /// Specialized conversion of <detelemref/> entities - template <> void Conv<DetElemRef>::convert(xml_h element) const { - Context* context = _param<Context>(); - Catalog* catalog = _option<Catalog>(); + template <> void Conv<DDDBDetElemRef>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); string href = element.attr<string>(_LBU(href)); string refid = reference_href(element, href); xml_h target = find_local_element(element, href, _LBU(detelem)); if ( target ) - Conv<DetElem>(lcdd,context,catalog)(target); + Conv<DDDBDetElem>(description,context,catalog)(target); else load_dddb_entity(context, catalog, element, href); dddb::Catalogs::const_iterator i=context->geo->catalogs.find(refid); @@ -1380,8 +1377,8 @@ namespace DD4hep { } /// Specialized conversion of <detelem/> entities - template <> void Conv<DetElem>::convert(xml_h element) const { - Context* context = _param<Context>(); + template <> void Conv<DDDBDetElem>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); dddb* geo = context->geo; dddb_dim_t x_det = element; string name = x_det.nameStr(); @@ -1390,10 +1387,10 @@ namespace DD4hep { dddb::Catalogs::iterator idet = geo->catalogs.find(id); if ( idet == geo->catalogs.end() ) { xml_h elt; - string path = object_path(context, name); + string path = object_path(context, name); Path p(path); - string parent = p.parent_path().native(); - Catalog* det = new Catalog(); + string parent = p.parent_path().native(); + DDDBCatalog* det = new DDDBCatalog(); det->typeID = 1; det->name = name; det->type = x_det.typeStr(); @@ -1414,18 +1411,18 @@ namespace DD4hep { } // Now extract all availible information from the xml if ( (elt=x_det.child(_U(author),false)) ) - Conv<Author>(lcdd,context,&det->author)(elt); + Conv<DDDBAuthor>(description,context,&det->author)(elt); if ( (elt=x_det.child(_U(version),false)) ) - Conv<Version>(lcdd,context,&det->version)(elt); - xml_coll_t(element, _U(param)).for_each(Conv<Param>(lcdd,context,det)); - xml_coll_t(element, _LBU(userParameter)).for_each(Conv<Param>(lcdd,context,det)); - xml_coll_t(element, _LBU(conditioninfo)).for_each(Conv<ConditionInfo>(lcdd,context,det)); + Conv<DDDBVersion>(description,context,&det->version)(elt); + xml_coll_t(element, _U(param)).for_each(Conv<DDDBParam>(description,context,det)); + xml_coll_t(element, _LBU(userParameter)).for_each(Conv<DDDBParam>(description,context,det)); + xml_coll_t(element, _LBU(conditioninfo)).for_each(Conv<DDDBConditionInfo>(description,context,det)); { - Context::PreservedLocals locals(context); + DDDBContext::PreservedLocals locals(context); context->locals.obj_path = det->path; - xml_coll_t(element, _LBU(geometryinfo)).for_each(Conv<GeometryInfo>(lcdd,context,det)); - xml_coll_t(element, _LBU(detelem)).for_each(Conv<DetElem>(lcdd,context,det)); - xml_coll_t(element, _LBU(detelemref)).for_each(Conv<DetElemRef>(lcdd,context,det)); + xml_coll_t(element, _LBU(geometryinfo)).for_each(Conv<DDDBGeometryInfo>(description,context,det)); + xml_coll_t(element, _LBU(detelem)).for_each(Conv<DDDBDetElem>(description,context,det)); + xml_coll_t(element, _LBU(detelemref)).for_each(Conv<DDDBDetElemRef>(description,context,det)); } det->path = det->support + "/" + det->name; context->collect(det->id, det); @@ -1437,9 +1434,9 @@ namespace DD4hep { } /// Specialized conversion of references to catalogs - template <> void Conv<CatalogRef>::convert(xml_h element) const { - Context* context = _param<Context>(); - Catalog* catalog = _option<Catalog>(); + template <> void Conv<DDDBCatalogRef>::convert(xml_h element) const { + DDDBContext* context = _param<DDDBContext>(); + DDDBCatalog* catalog = _option<DDDBCatalog>(); string href = element.attr<string>(_LBU(href)); string refid = reference_href(element,href); #if 0 @@ -1449,7 +1446,7 @@ namespace DD4hep { #endif xml_h target = find_local_element(element, href,_LBU(catalog)); if ( target ) { - Conv<Catalog>(lcdd,context,catalog)(target); + Conv<DDDBCatalog>(description,context,catalog)(target); } else { load_dddb_entity(context, catalog, element, href); @@ -1462,18 +1459,18 @@ namespace DD4hep { } /// Specialized conversion of <catalog/> entities - template <> void Conv<Catalog>::convert(xml_h e) const { - Context* context = _param<Context>(); + template <> void Conv<DDDBCatalog>::convert(xml_h e) const { + DDDBContext* context = _param<DDDBContext>(); string name = e.attr<string>(_U(name)); string id = object_href(e,name); dddb::Catalogs::const_iterator icat = context->geo->catalogs.find(id); if ( icat == context->geo->catalogs.end() ) { - Catalog* catalog = new Catalog(); + DDDBCatalog* catalog = new DDDBCatalog(); catalog->name = name; catalog->path = object_path(context,name); printout(DEBUG,"Catalog","PROCESSING: xid:%s -> %s",id.c_str(),catalog->path.c_str()); - catalog->level = Increment<Catalog>::counter(); + catalog->level = Increment<DDDBCatalog>::counter(); catalog->type = "Logical"; catalog->support = ""; catalog->setDocument(context->locals.xml_doc); @@ -1492,32 +1489,32 @@ namespace DD4hep { context->geo->geometry = catalog; } { - Context::PreservedLocals locals(context); + DDDBContext::PreservedLocals locals(context); context->locals.obj_path = catalog->path; - xml_coll_t(e, _U(parameter)).for_each(Conv<Parameter>(lcdd,context,catalog)); - xml_coll_t(e, _U(isotope)).for_each(Conv<Isotope>(lcdd,context,catalog)); - xml_coll_t(e, _U(element)).for_each(Conv<Element>(lcdd,context,catalog)); - xml_coll_t(e, _U(material)).for_each(Conv<Material>(lcdd,context,catalog)); - xml_coll_t(e, _U(logvol)).for_each(Conv<LogVol>(lcdd,context,catalog)); - - xml_coll_t(e, _LBU(tabproperty)).for_each(Conv<TabProperty>(lcdd,context,catalog)); - - //xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(lcdd,context,catalog)); - //xml_coll_t(e, _LBU(detelem)).for_each(Conv<DetElem>(lcdd,context,catalog)); - //xml_coll_t(e, _LBU(catalog)).for_each(Conv<Catalog>(lcdd,context,catalog)); - - xml_coll_t(e, _LBU(elementref)).for_each(Conv<ElementRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(materialref)).for_each(Conv<MaterialRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(logvolref)).for_each(Conv<LogVolRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(tabpropertyref)).for_each(Conv<TabPropertyRef>(lcdd,context,catalog)); - - xml_coll_t(e, _LBU(conditionref)).for_each(Conv<ConditionRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(catalogref)).for_each(Conv<CatalogRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(detelemref)).for_each(Conv<DetElemRef>(lcdd,context,catalog)); - - xml_coll_t(e, _LBU(catalog)).for_each(Conv<Catalog>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(detelem)).for_each(Conv<DetElem>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(lcdd,context,catalog)); + xml_coll_t(e, _U(parameter)).for_each(Conv<DDDBParameter>(description,context,catalog)); + xml_coll_t(e, _U(isotope)).for_each(Conv<DDDBIsotope>(description,context,catalog)); + xml_coll_t(e, _U(element)).for_each(Conv<DDDBElement>(description,context,catalog)); + xml_coll_t(e, _U(material)).for_each(Conv<DDDBMaterial>(description,context,catalog)); + xml_coll_t(e, _U(logvol)).for_each(Conv<DDDBLogVol>(description,context,catalog)); + + xml_coll_t(e, _LBU(tabproperty)).for_each(Conv<DDDBTabProperty>(description,context,catalog)); + + //xml_coll_t(e, _LBU(condition)).for_each(Conv<DDDBCondition>(description,context,catalog)); + //xml_coll_t(e, _LBU(detelem)).for_each(Conv<DDDBDetElem>(description,context,catalog)); + //xml_coll_t(e, _LBU(catalog)).for_each(Conv<DDDBCatalog>(description,context,catalog)); + + xml_coll_t(e, _LBU(elementref)).for_each(Conv<DDDBElementRef>(description,context,catalog)); + xml_coll_t(e, _LBU(materialref)).for_each(Conv<DDDBMaterialRef>(description,context,catalog)); + xml_coll_t(e, _LBU(logvolref)).for_each(Conv<DDDBLogVolRef>(description,context,catalog)); + xml_coll_t(e, _LBU(tabpropertyref)).for_each(Conv<DDDBTabPropertyRef>(description,context,catalog)); + + xml_coll_t(e, _LBU(conditionref)).for_each(Conv<DDDBConditionRef>(description,context,catalog)); + xml_coll_t(e, _LBU(catalogref)).for_each(Conv<DDDBCatalogRef>(description,context,catalog)); + xml_coll_t(e, _LBU(detelemref)).for_each(Conv<DDDBDetElemRef>(description,context,catalog)); + + xml_coll_t(e, _LBU(catalog)).for_each(Conv<DDDBCatalog>(description,context,catalog)); + xml_coll_t(e, _LBU(detelem)).for_each(Conv<DDDBDetElem>(description,context,catalog)); + xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(description,context,catalog)); } return; } @@ -1526,46 +1523,46 @@ namespace DD4hep { /// Specialized conversion of <DDDB/> entities template <> void Conv<dddb>::convert(xml_h e) const { - Catalog* catalog = 0; - Context* context = _param<Context>(); - xml_coll_t(e, _U(parameter)).for_each(Conv<Parameter>(lcdd,context,catalog)); - xml_coll_t(e, _U(isotope)).for_each(Conv<Isotope>(lcdd,context,catalog)); - xml_coll_t(e, _U(element)).for_each(Conv<Element>(lcdd,context,catalog)); - xml_coll_t(e, _U(material)).for_each(Conv<Material>(lcdd,context,catalog)); - xml_coll_t(e, _U(logvol)).for_each(Conv<LogVol>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(tabproperty)).for_each(Conv<TabProperty>(lcdd,context,catalog)); - - //xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(lcdd,context,catalog)); - //xml_coll_t(e, _LBU(detelem)).for_each(Conv<DetElem>(lcdd,context,catalog)); - //xml_coll_t(e, _LBU(catalog)).for_each(Conv<Catalog>(lcdd,context,catalog)); - - xml_coll_t(e, _LBU(elementref)).for_each(Conv<ElementRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(materialref)).for_each(Conv<MaterialRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(logvolref)).for_each(Conv<LogVolRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(tabpropertyref)).for_each(Conv<TabPropertyRef>(lcdd,context,catalog)); - - xml_coll_t(e, _LBU(conditionref)).for_each(Conv<ConditionRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(catalogref)).for_each(Conv<CatalogRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(detelemref)).for_each(Conv<DetElemRef>(lcdd,context,catalog)); - - xml_coll_t(e, _LBU(detelem)).for_each(Conv<DetElem>(lcdd,context,catalog)); + DDDBCatalog* catalog = 0; + DDDBContext* context = _param<DDDBContext>(); + xml_coll_t(e, _U(parameter)).for_each(Conv<DDDBParameter>(description,context,catalog)); + xml_coll_t(e, _U(isotope)).for_each(Conv<DDDBIsotope>(description,context,catalog)); + xml_coll_t(e, _U(element)).for_each(Conv<DDDBElement>(description,context,catalog)); + xml_coll_t(e, _U(material)).for_each(Conv<DDDBMaterial>(description,context,catalog)); + xml_coll_t(e, _U(logvol)).for_each(Conv<DDDBLogVol>(description,context,catalog)); + xml_coll_t(e, _LBU(tabproperty)).for_each(Conv<DDDBTabProperty>(description,context,catalog)); + + //xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(description,context,catalog)); + //xml_coll_t(e, _LBU(detelem)).for_each(Conv<DDDBDetElem>(description,context,catalog)); + //xml_coll_t(e, _LBU(catalog)).for_each(Conv<DDDBCatalog>(description,context,catalog)); + + xml_coll_t(e, _LBU(elementref)).for_each(Conv<DDDBElementRef>(description,context,catalog)); + xml_coll_t(e, _LBU(materialref)).for_each(Conv<DDDBMaterialRef>(description,context,catalog)); + xml_coll_t(e, _LBU(logvolref)).for_each(Conv<DDDBLogVolRef>(description,context,catalog)); + xml_coll_t(e, _LBU(tabpropertyref)).for_each(Conv<DDDBTabPropertyRef>(description,context,catalog)); + + xml_coll_t(e, _LBU(conditionref)).for_each(Conv<DDDBConditionRef>(description,context,catalog)); + xml_coll_t(e, _LBU(catalogref)).for_each(Conv<DDDBCatalogRef>(description,context,catalog)); + xml_coll_t(e, _LBU(detelemref)).for_each(Conv<DDDBDetElemRef>(description,context,catalog)); + + xml_coll_t(e, _LBU(detelem)).for_each(Conv<DDDBDetElem>(description,context,catalog)); // First handle the catalog. It may refer to local conditions! - xml_coll_t(e, _LBU(catalog)).for_each(Conv<Catalog>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(lcdd,context,catalog)); + xml_coll_t(e, _LBU(catalog)).for_each(Conv<DDDBCatalog>(description,context,catalog)); + xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(description,context,catalog)); } /// Specialized conversion of <DDDB/> entities template <> void Conv<dddb_conditions>::convert(xml_h e) const { - Catalog* catalog = 0; - Context* context = _param<Context>(); + DDDBCatalog* catalog = 0; + DDDBContext* context = _param<DDDBContext>(); context->check = false; - xml_coll_t(e, _LBU(conditionref)).for_each(Conv<ConditionRef>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(catalogref)).for_each(Conv<CatalogRef>(lcdd,context,catalog)); + xml_coll_t(e, _LBU(conditionref)).for_each(Conv<DDDBConditionRef>(description,context,catalog)); + xml_coll_t(e, _LBU(catalogref)).for_each(Conv<DDDBCatalogRef>(description,context,catalog)); { - Context::PreservedLocals locals(context); + DDDBContext::PreservedLocals locals(context); // First handle the catalog. It may refer to local conditions! - xml_coll_t(e, _LBU(catalog)).for_each(Conv<Catalog>(lcdd,context,catalog)); - xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(lcdd,context,catalog)); + xml_coll_t(e, _LBU(catalog)).for_each(Conv<DDDBCatalog>(description,context,catalog)); + xml_coll_t(e, _LBU(condition)).for_each(Conv<Condition>(description,context,catalog)); } } @@ -1602,7 +1599,7 @@ namespace DD4hep { } } - void extract_transformation(lcdd_t& lcdd, void* context, xml_coll_t& p, Transform3D& tr, int which) { + void extract_transformation(Detector& description, void* context, xml_coll_t& p, Transform3D& tr, int which) { int count = 0; int apply = 0; Position pos; @@ -1614,7 +1611,7 @@ namespace DD4hep { string tag = p.tag(); if ( tag == "transformation" && (which<0 || count == which) ) { apply_trafo(apply, pos, rot, trafo, tr); - Conv<Transform3D>(lcdd,context,&trafo)(p); + Conv<Transform3D>(description,context,&trafo)(p); apply = 99; } else if ( tag == "posXYZ" && (which<0 || count == which) ) { @@ -1655,7 +1652,7 @@ namespace DD4hep { return ref; } // Resolve relative path - string p = XML::DocumentHandler::system_path(element); + string p = xml::DocumentHandler::system_path(element); if ( hash == 0 ) { // This is a local object. Take the element's path p += ref; Path path = p; // Remote object. Parent + local path @@ -1683,8 +1680,8 @@ namespace DD4hep { } template <typename ACTION> - void load_dddb_entity(Context* context, - Catalog* catalog, + void load_dddb_entity(DDDBContext* context, + DDDBCatalog* catalog, xml_h element, const string& ref, bool prt) @@ -1714,9 +1711,9 @@ namespace DD4hep { key = doc_path.substr(idx+1,idq-idx-1); fp = doc_path.substr(0,idx); } - XML::UriReader* rdr = context->resolver; + xml::UriReader* rdr = context->resolver; DDDBReaderContext* ctx = (DDDBReaderContext*)rdr->context(); - Document* xml_doc = new Document(); + DDDBDocument* xml_doc = new DDDBDocument(); xml_doc->id = doc_path; xml_doc->name = context->locals.obj_path; xml_doc->context.doc = xml_doc->id; @@ -1724,14 +1721,14 @@ namespace DD4hep { xml_doc->context.valid_since = 0; xml_doc->context.valid_until = 0; docs.insert(make_pair(doc_path,xml_doc->addRef())); - XML::UriContextReader reader(rdr, &xml_doc->context); + xml::UriContextReader reader(rdr, &xml_doc->context); xml_doc_holder_t doc(xml_handler_t().load(fp, &reader)); xml_h e = doc.root(); context->print(xml_doc); if ( e ) { if ( !key.empty() ) { stringstream str; - XML::dump_tree(e, str); + xml::dump_tree(e, str); string buffer = str.str(); while( (idx=buffer.find("-KEY-")) != string::npos ) buffer.replace(idx,5,key); @@ -1741,11 +1738,11 @@ namespace DD4hep { &reader)); e = doc.root(); } - Context::PreservedLocals locals(context); + DDDBContext::PreservedLocals locals(context); context->locals.xml_doc = xml_doc; - Conv<ACTION> converter(context->lcdd, context, catalog); + Conv<ACTION> converter(context->description, context, catalog); context->print_condition = prt; - if ( prt || context->print_xml ) XML::dump_tree(e); + if ( prt || context->print_xml ) xml::dump_tree(e); converter(e); } } @@ -1758,12 +1755,12 @@ namespace DD4hep { } } - void config_context(Context& context, - XML::UriReader* rdr, + void config_context(DDDBContext& context, + xml::UriReader* rdr, const std::string& doc_path, const std::string& obj_path) { DDDBReaderContext* ctx = (DDDBReaderContext*)rdr->context(); - Document* doc = new Document(); + DDDBDocument* doc = new DDDBDocument(); doc->name = obj_path; doc->id = doc_path; doc->context.event_time = ctx->event_time; @@ -1793,18 +1790,18 @@ namespace DD4hep { /// Plugin entry point. template <typename ACTION> - long load_dddb_objects(lcdd_t& lcdd, int argc, char** argv) { - DDDBHelper* hlp = lcdd.extension<DDDBHelper>(false); + long load_dddb_objects(Detector& description, int argc, char** argv) { + DDDBHelper* hlp = description.extension<DDDBHelper>(false); if ( hlp ) { - Context ctxt(lcdd); + DDDBContext ctxt(description); string sys_id = "conddb://lhcb.xml"; string obj_path = "/"; - XML::UriReader* rdr = hlp->xmlReader(); + xml::UriReader* rdr = hlp->xmlReader(); if ( argc == 0 ) { return 0; } if ( argc >= 1 && argv[0] != 0 ) { - rdr = (XML::UriReader*)argv[0]; + rdr = (xml::UriReader*)argv[0]; } if ( argc >= 2 && argv[1] != 0 ) { sys_id = argv[1]; @@ -1832,20 +1829,20 @@ namespace DD4hep { } namespace DDDB { - long load_dddb_from_uri(lcdd_t& lcdd, int argc, char** argv) { - return load_dddb_objects<dddb>(lcdd,argc,argv); + long load_dddb_from_uri(Detector& description, int argc, char** argv) { + return load_dddb_objects<dddb>(description,argc,argv); } - long load_dddb_conditions_from_uri(lcdd_t& lcdd, int argc, char** argv) { - return load_dddb_objects<dddb_conditions>(lcdd,argc,argv); + long load_dddb_conditions_from_uri(Detector& description, int argc, char** argv) { + return load_dddb_objects<dddb_conditions>(description,argc,argv); } /// Plugin entry point. - long load_dddb_from_handle(lcdd_t& lcdd, xml_h element) { - DDDBHelper* helper = lcdd.extension<DDDBHelper>(false); + long load_dddb_from_handle(Detector& description, xml_h element) { + DDDBHelper* helper = description.extension<DDDBHelper>(false); if ( helper ) { - Context context(lcdd); + DDDBContext context(description); config_context(context, helper->xmlReader(), "conddb://lhcb.xml", "/"); /// Convert the XML information - Conv<dddb> converter(lcdd, &context); + Conv<dddb> converter(description, &context); converter( element ); checkParents( &context ); fixCatalogs( &context ); @@ -1864,14 +1861,14 @@ DECLARE_APPLY(DDDB_Loader,load_dddb_from_uri) DECLARE_APPLY(DDDB_ConditionsLoader,load_dddb_conditions_from_uri) /// Plugin entry point. -static long install_helper(lcdd_t& lcdd, int argc, char** argv) { - DDDBHelper* helper = lcdd.extension<DDDBHelper>(false); +static long install_helper(Detector& description, int argc, char** argv) { + DDDBHelper* helper = description.extension<DDDBHelper>(false); if ( !helper ) { - helper = new DDDBHelper(lcdd); + helper = new DDDBHelper(description); if ( argc > 0 ) { - helper->setXmlReader((XML::UriReader*)argv[0]); + helper->setXmlReader((xml::UriReader*)argv[0]); } - lcdd.addExtension<DDDBHelper,DDDBHelper>(helper); + description.addExtension<DDDBHelper,DDDBHelper>(helper); } return 1; } diff --git a/DDDB/src/plugins/DDDB2Objects.cpp b/DDDB/src/plugins/DDDB2Objects.cpp index 47bb36f3f..c49b39710 100644 --- a/DDDB/src/plugins/DDDB2Objects.cpp +++ b/DDDB/src/plugins/DDDB2Objects.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +23,7 @@ #include "DDDB/DDDBHelper.h" #include "DDDB/DDDBConversion.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Path.h" //#include "DD4hep/DetConditions.h" #include "DD4hep/ConditionsData.h" @@ -42,32 +42,27 @@ #include <set> using namespace std; -using namespace DD4hep; -using namespace DD4hep::DDDB; +using namespace dd4hep; +using namespace dd4hep::DDDB; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Keep all in here anonymous. Does not have to be visible outside. namespace { - struct DetElem {}; + struct DDDBDetElem; - typedef Conditions::Interna::ConditionObject GeoCondition; - typedef Conditions::ConditionsManager ConditionsManager; - typedef Conditions::ConditionsPool ConditionsPool; - typedef Conditions::AbstractMap AbstractMap; - typedef Geometry::PlacedVolume GeoPlacement; - typedef Geometry::Volume GeoVolume; - typedef Geometry::Material GeoMaterial; - typedef Geometry::Solid GeoSolid; + typedef detail::ConditionObject GeoCondition; + typedef cond::ConditionsManager ConditionsManager; + typedef cond::ConditionsPool ConditionsPool; + typedef cond::AbstractMap AbstractMap; /// Helper class to facilitate conversion. Purely local. struct Context { - typedef set<string> StringSet; - Context(LCDD& l, dddb* g) : lcdd(l), geo(g) { + Context(Detector& l, dddb* g) : description(l), geo(g) { } ~Context() { //printout(INFO,"Context","Destructor calling...."); @@ -79,18 +74,18 @@ namespace DD4hep { } template <typename T> void collect(const string& id, T* s); template <typename T,typename Q> void collect(const string& id, T* s, Q* c); - LCDD& lcdd; + Detector& description; DDDB::dddb* geo = 0; DDDB::DDDBHelper* helper = 0; - typedef std::map<Isotope*, TGeoIsotope*> Isotopes; - typedef std::map<Element*, TGeoElement*> Elements; - typedef std::map<Material*, TGeoMedium*> Materials; - typedef std::map<Shape*, TGeoShape*> Shapes; - typedef std::map<LogVol*, TGeoVolume*> Volumes; - typedef std::map<PhysVol*, TGeoNode*> Placements; - typedef std::map<std::string, DetElement> DetectorMap; - typedef std::map<std::string, TGeoVolume*> VolumeMap; - typedef std::map<DetElement, Catalog*> DetectorElements; + typedef std::map<DDDBIsotope*, TGeoIsotope*> Isotopes; + typedef std::map<DDDBElement*, TGeoElement*> Elements; + typedef std::map<DDDBMaterial*, TGeoMedium*> Materials; + typedef std::map<DDDBShape*, TGeoShape*> Shapes; + typedef std::map<DDDBLogVol*, TGeoVolume*> Volumes; + typedef std::map<DDDBPhysVol*, TGeoNode*> Placements; + typedef std::map<std::string, DetElement> DetectorMap; + typedef std::map<std::string, TGeoVolume*> VolumeMap; + typedef std::map<DetElement, DDDBCatalog*> DetectorElements; Isotopes isotopes; Elements elements; @@ -102,7 +97,7 @@ namespace DD4hep { DetElement detectors; DetectorMap catalogPaths; DetectorElements detelements; - GeoVolume lvDummy; + Volume lvDummy; ConditionsManager manager; const IOVType* epoch = 0; int max_volume_depth = 9999; @@ -122,15 +117,15 @@ namespace DD4hep { bool print_vis = false; bool conditions_only = false; - static GeoPlacement placement(DetElement de) { + static PlacedVolume placement(DetElement de) { if ( de.isValid() ) { - GeoPlacement p = de.placement(); + PlacedVolume p = de.placement(); if ( p.isValid() ) return p; return placement(de.parent()); } - return GeoPlacement(0); + return PlacedVolume(0); } - static bool volumePlaced(GeoVolume par_vol, GeoVolume vol) { + static bool volumePlaced(Volume par_vol, Volume vol) { if ( par_vol.isValid() && vol.isValid() && par_vol.ptr() == vol.ptr() ) { for(int i=0; i < vol->GetNdaughters(); ++i) { TGeoNode* dau = vol->GetNode(i); @@ -161,8 +156,8 @@ namespace DD4hep { return 0; } - GeoPlacement supportPlacement(DetElement parent, const string& npath) { - GeoVolume par_vol = parent.volume(); + PlacedVolume supportPlacement(DetElement parent, const string& npath) { + Volume par_vol = parent.volume(); return par_vol.isValid() ? supportPlacement(par_vol.ptr(), npath) : 0; } }; @@ -170,11 +165,12 @@ namespace DD4hep { template <typename T> struct CNV : Converter<T,T*> { public: /// Initializing constructor of the functor with initialization of the user parameter - CNV(LCDD& l, void* p, void* o=0) : Converter<T,T*>(l,p,o) {} - template<typename Q> CNV<Q> cnv() const { return CNV<Q>(this->lcdd,this->param,this->optional); } + CNV(Detector& l, void* p, void* o=0) : Converter<T,T*>(l,p,o) {} + template<typename Q> CNV<Q> cnv() const { return CNV<Q>(this->description,this->param,this->optional); } void* convert(T* obj) const; template<typename Q> Q get(const string& /* obj */) const { - throw runtime_error("NOT implemented virtual call !"); + throw runtime_error("NOT implemented virtual call ! CNV<"+ + typeName(typeid(T))+">::get<"+typeName(typeid(Q))+">(string)"); } void operator()(T* obj) const { convert(obj); } void operator()(const pair<string,T*>& arg) const { @@ -198,29 +194,28 @@ namespace DD4hep { namespace { template <> void* CNV<GeoCondition>::convert(GeoCondition *object) const; - template <> void* CNV<Isotope>::convert(Isotope *object) const; - template <> void* CNV<Element>::convert(Element *object) const; - template <> void* CNV<Material>::convert(Material *object) const; - template <> void* CNV<BooleanOperation>::convert(BooleanOperation *object) const; - template <> void* CNV<Shape>::convert(Shape *object) const; - template <> void* CNV<DetElem>::convert(DetElem *object) const; - template <> void* CNV<LogVol>::convert(LogVol *object) const; - template <> void* CNV<Catalog>::convert(Catalog *object) const; + template <> void* CNV<DDDBIsotope>::convert(DDDBIsotope *object) const; + template <> void* CNV<DDDBElement>::convert(DDDBElement *object) const; + template <> void* CNV<DDDBMaterial>::convert(DDDBMaterial *object) const; + template <> void* CNV<DDDBBooleanOperation>::convert(DDDBBooleanOperation *object) const; + template <> void* CNV<DDDBShape>::convert(DDDBShape *object) const; + template <> void* CNV<DDDBDetElem>::convert(DDDBDetElem *object) const; + template <> void* CNV<DDDBLogVol>::convert(DDDBLogVol *object) const; + template <> void* CNV<DDDBCatalog>::convert(DDDBCatalog *object) const; template <> void* CNV<dddb>::convert(dddb *obj) const; - template <> template <> GeoMaterial CNV<Material>::get<GeoMaterial>(const string& material_name) const; - template <> template <> LogVol* CNV<LogVol>::get<LogVol*>(const string& obj) const; - template <> template <> GeoVolume CNV<LogVol>::get<GeoVolume>(const string& obj) const; + template <> template <> Material CNV<DDDBMaterial>::get<Material>(const string& material_name) const; + template <> template <> DDDBLogVol* CNV<DDDBLogVol>::get<DDDBLogVol*>(const string& obj) const; + template <> template <> Volume CNV<DDDBLogVol>::get<Volume>(const string& obj) const; /// Convert single condition objects template <> void* CNV<GeoCondition>::convert(GeoCondition *obj) const { if ( obj ) { typedef IOV::Key _K; - using Conditions::Condition; Context* context = _param<Context>(); Condition cond = obj; AbstractMap& d = cond.get<AbstractMap>(); - Document* doc = d.option<Document>(); + DDDBDocument* doc = d.option<DDDBDocument>(); _K::first_type since = doc->context.valid_since; _K::second_type until = doc->context.valid_until; _K iov_key(since,until); @@ -229,7 +224,7 @@ namespace DD4hep { /// This will allow us to re-use all alignment utilities for DDDB. if ( obj->testFlag(Condition::ALIGNMENT_DELTA) ) { const pair<string,OpaqueDataBlock>& block = *(d.params.begin()); - Alignments::Delta delta = block.second.get<Alignments::Delta>(); + Delta delta = block.second.get<Delta>(); string typ = obj->type, add = obj->address, val = obj->value; int flg = obj->flags; // In-place replacement with Delta condition... @@ -238,14 +233,14 @@ namespace DD4hep { cond.setFlag(flg); cond->address = add; cond->value = val; - cond.bind<Alignments::Delta>() = delta; + cond.bind<Delta>() = delta; ++context->delta_conditions; if ( !e.first.isValid() ) ++context->unmatched_deltas; } if ( e.first.isValid() ) { cond->SetName(e.second.c_str()); - cond->hash = Conditions::ConditionKey::KeyMaker(e.first.key(),hash32(cond.name())).hash; + cond->hash = ConditionKey::KeyMaker(e.first.key(),detail::hash32(cond.name())).hash; printout(DEBUG,"DDDB","Insert condition: %s # %s --> %16llX", e.first.path().c_str(),cond.name(),cond.key()); printout(DEBUG,"DDDB"," %s -> %s",cond->value.c_str(),cond->address.c_str()); @@ -264,7 +259,7 @@ namespace DD4hep { } /// Convert single isotope objects - template <> void* CNV<Isotope>::convert(Isotope *o) const { + template <> void* CNV<DDDBIsotope>::convert(DDDBIsotope *o) const { Context* context = _param<Context>(); TGeoIsotope* iso = Context::find(context->isotopes, o); if ( !iso ) { @@ -277,7 +272,7 @@ namespace DD4hep { } /// Convert single element objects - TGeoElement* createElement(const char* nam, Context* context, Element *o) { + TGeoElement* createElement(const char* nam, Context* context, DDDBElement *o) { TGeoElementTable* t = TGeoElement::GetElementTable(); TGeoElement* e = t->FindElement(nam); if ( !e ) { @@ -289,9 +284,9 @@ namespace DD4hep { printout(ERROR,"DDDB","++ Invalid isotope: %s [Ignore Isotope]",(*i).first.c_str()); continue; } - Isotope* isotope = (*iso).second; + DDDBIsotope* isotope = (*iso).second; TGeoIsotope* geo_iso = - (TGeoIsotope*)CNV<Isotope>(context->lcdd,context).convert(isotope); + (TGeoIsotope*)CNV<DDDBIsotope>(context->description,context).convert(isotope); if ( !geo_iso ) { printout(ERROR,"DDDB","++ Invalid isotope: %s [Ignore Isotope]",(*iso).first.c_str()); continue; @@ -306,35 +301,35 @@ namespace DD4hep { } if ( context->print_materials ) dddb_print(e); } - Material* material = Context::find(context->geo->materials,string(nam)); + DDDBMaterial* material = Context::find(context->geo->materials,string(nam)); if ( !material ) { - TGeoManager& mgr = context->lcdd.manager(); + TGeoManager& mgr = context->description.manager(); if ( !mgr.GetMaterial(nam) || !mgr.GetMedium(nam) ) { - MaterialComponent comp; - material = new Material; + DDDBMaterialComponent comp; + material = new DDDBMaterial; material->name = nam; material->density = o->density; comp.name = nam; comp.fractionmass = 1.0; material->components.push_back(comp); context->geo->materials.insert(make_pair(nam,material)); - CNV<Material>(context->lcdd,context)(material); + CNV<DDDBMaterial>(context->description,context)(material); } } return e; } /// Convert single element objects and the counterpart using the full name - template <> void* CNV<Element>::convert(Element *object) const { + template <> void* CNV<DDDBElement>::convert(DDDBElement *object) const { Context* context = _param<Context>(); TGeoElement* e = Context::find(context->elements, object); if ( !e ) { e = createElement(object->c_name(), context, object); context->elements.insert(make_pair(object,e)); if ( !object->symbol.empty() && object->symbol != object->name ) { - Element* esym = Context::find(context->geo->elements, object->symbol); + DDDBElement* esym = Context::find(context->geo->elements, object->symbol); if ( !esym ) { - esym = new Element(*object); + esym = new DDDBElement(*object); esym->name = object->symbol; context->geo->elements.insert(make_pair(object->symbol,esym)); } @@ -349,19 +344,19 @@ namespace DD4hep { } /// Convert single material objects - template <> void* CNV<Material>::convert(Material *object) const { + template <> void* CNV<DDDBMaterial>::convert(DDDBMaterial *object) const { Context* context = _param<Context>(); TGeoMedium* medium = Context::find(context->materials, object); if ( !medium ) { const char* name = object->c_name(); - TGeoManager& mgr = lcdd.manager(); + TGeoManager& mgr = description.manager(); TGeoElementTable* tab = TGeoElement::GetElementTable(); TGeoMaterial* mat = mgr.GetMaterial(name); TGeoMixture* mix = dynamic_cast<TGeoMixture*>(mat); medium = mgr.GetMedium(name); if ( 0 == mat ) { - Material::Components& comp = object->components; + DDDBMaterial::Components& comp = object->components; //printout(INFO, "Cnv<Material>", "++ Converting material %s", name); mat = mix = new TGeoMixture(name, comp.size(), object->density); if ( object->radlen > 0 && object->lambda > 0 ) @@ -373,7 +368,7 @@ namespace DD4hep { if ( object->temperature > 0 ) mat->SetTemperature(object->temperature); for(auto i = comp.begin(); i != comp.end(); ++i) { - MaterialComponent& c=(*i); + DDDBMaterialComponent& c=(*i); TGeoElement* e = tab->FindElement(c.c_name()); if ( e && c.natoms>0 ) { // Add simple elements using atomic numbers mix->AddElement(e, c.natoms); @@ -384,7 +379,7 @@ namespace DD4hep { continue; } else if ( c.fractionmass >= 0 ) { - GeoMaterial mm = this->get<GeoMaterial>(c.name); + Material mm = this->get<Material>(c.name); mix->AddElement(mm->GetMaterial(), c.fractionmass); continue; } @@ -406,9 +401,9 @@ namespace DD4hep { /// Access/on the fly convert material objects by name template <> template <> - GeoMaterial CNV<Material>::get<GeoMaterial>(const string& material_name) const { + Material CNV<DDDBMaterial>::get<Material>(const string& material_name) const { Context* context = _param<Context>(); - Material* mat = Context::find(context->geo->materials,material_name); + DDDBMaterial* mat = Context::find(context->geo->materials,material_name); if ( !mat ) { string mat_name = material_name; // HACK! for bad material names in IT size_t idx; @@ -427,111 +422,111 @@ namespace DD4hep { dddb_print((*im).second); except("Materials","++ Undefined material %s",material_name.c_str()); } - TGeoMedium* medium = (TGeoMedium*)CNV<Material>(context->lcdd,context).convert(mat); - return GeoMaterial::handle_t(medium); + TGeoMedium* medium = (TGeoMedium*)CNV<DDDBMaterial>(context->description,context).convert(mat); + return Material(medium); } /// Convert shape entities - template <> void* CNV<Shape>::convert(Shape *object) const { + template <> void* CNV<DDDBShape>::convert(DDDBShape *object) const { Context* context = _param<Context>(); - GeoSolid shape = Context::find(context->shapes, object); + Solid shape = Context::find(context->shapes, object); if ( !shape ) { if ( object->id == "/dd/Geometry/LHCb/lvLHCb" ) { - shape = lcdd.worldVolume().solid(); + shape = description.worldVolume().solid(); } - else if ( object->type == Assembly::type() ) { + else if ( object->type == DDDBAssembly::type() ) { except("Cnv<Shape>","++ Assembly shapes cannot be converted!"); } - else if ( object->type == Box::type() ) { - shape = Geometry::Box(object->s.box.x, object->s.box.y, object->s.box.z).ptr(); + else if ( object->type == DDDBBox::type() ) { + shape = Box(object->s.box.x, object->s.box.y, object->s.box.z).ptr(); } - else if ( object->type == Cons::type() ) { - const Cons& c = object->s.cons; - shape = Geometry::Cone(c.sizeZ, + else if ( object->type == DDDBCons::type() ) { + const DDDBCons& c = object->s.cons; + shape = Cone(c.sizeZ, c.innerRadiusMZ, c.outerRadiusMZ, c.innerRadiusPZ, c.outerRadiusPZ).ptr(); } - else if ( object->type == ConeSegment::type() ) { - const ConeSegment& o = object->s.coneSegment; - shape = Geometry::ConeSegment(o.sizeZ, + else if ( object->type == DDDBConeSegment::type() ) { + const DDDBConeSegment& o = object->s.coneSegment; + shape = ConeSegment(o.sizeZ, o.innerRadiusMZ, o.outerRadiusMZ, o.innerRadiusPZ, o.outerRadiusPZ, o.start, o.delta).ptr(); } - else if ( object->type == EllipticalTube::type() ) { - const EllipticalTube& o = object->s.ellipticalTube; - shape = Geometry::EllipticalTube(o.a, o.b, o.dz).ptr(); + else if ( object->type == DDDBEllipticalTube::type() ) { + const DDDBEllipticalTube& o = object->s.ellipticalTube; + shape = EllipticalTube(o.a, o.b, o.dz).ptr(); } - else if ( object->type == Tubs::type() ) { - const Tubs& t = object->s.tubs; - shape = Geometry::Tube(t.innerRadius, t.outerRadius, t.sizeZ, t.start, t.delta); + else if ( object->type == DDDBTubs::type() ) { + const DDDBTubs& t = object->s.tubs; + shape = Tube(t.innerRadius, t.outerRadius, t.sizeZ, t.start, t.delta); } - else if ( object->type == Polycone::type() ) { - Polycone& o = object->s.polycone; + else if ( object->type == DDDBPolycone::type() ) { + DDDBPolycone& o = object->s.polycone; TGeoPcon* pc = new TGeoPcon(o.start, o.delta, object->zplanes.size()); for(size_t iz=0; iz< object->zplanes.size(); ++iz) { - const ZPlane& plane = object->zplanes[iz]; + const DDDBZPlane& plane = object->zplanes[iz]; pc->DefineSection(iz, plane.z, plane.innerRadius, plane.outerRadius); } shape = pc; } - else if ( object->type == Polygon::type() ) { - Polygon& o = object->s.polygon; - shape = Geometry::PolyhedraRegular(o.nsides, o.start, o.innerRadius, o.outerRadius, o.z); + else if ( object->type == DDDBPolygon::type() ) { + DDDBPolygon& o = object->s.polygon; + shape = PolyhedraRegular(o.nsides, o.start, o.innerRadius, o.outerRadius, o.z); } - else if ( object->type == Sphere::type() ) { - const Sphere& o = object->s.sphere; - shape = Geometry::Sphere(o.rmin, o.rmax, o.theta, o.theta+o.delta_theta, o.phi, o.phi+o.delta_phi); + else if ( object->type == DDDBSphere::type() ) { + const DDDBSphere& o = object->s.sphere; + shape = Sphere(o.rmin, o.rmax, o.theta, o.theta+o.delta_theta, o.phi, o.phi+o.delta_phi); } //else if ( object->type == Ellipsoid::type() ) { // const Ellipsoid& o = object->s.ellipsoid; - // shape = Geometry::Ellipsoid(o.rlow, o.rhigh, o.dz).ptr(); + // shape = Ellipsoid(o.rlow, o.rhigh, o.dz).ptr(); //} - else if ( object->type == Paraboloid::type() ) { - const Paraboloid& o = object->s.paraboloid; - shape = Geometry::Paraboloid(o.rlow, o.rhigh, o.dz).ptr(); + else if ( object->type == DDDBParaboloid::type() ) { + const DDDBParaboloid& o = object->s.paraboloid; + shape = Paraboloid(o.rlow, o.rhigh, o.dz).ptr(); } - else if ( object->type == Hyperboloid::type() ) { - const Hyperboloid& o = object->s.hyperboloid; - shape = Geometry::Hyperboloid(o.rmin, o.rmax, o.stIn, o.stOut, o.dz).ptr(); + else if ( object->type == DDDBHyperboloid::type() ) { + const DDDBHyperboloid& o = object->s.hyperboloid; + shape = Hyperboloid(o.rmin, o.rmax, o.stIn, o.stOut, o.dz).ptr(); } - else if ( object->type == TRD::type() ) { - const TRD& o = object->s.trd; - shape = Geometry::Trapezoid(o.x1, o.x2, o.y1, o.y2, o.z).ptr(); + else if ( object->type == DDDBTRD::type() ) { + const DDDBTRD& o = object->s.trd; + shape = Trapezoid(o.x1, o.x2, o.y1, o.y2, o.z).ptr(); } - else if ( object->type == Trap::type() ) { - const Trap& o = object->s.trap; - shape = Geometry::Trap(o.dz, o.theta, o.phi, + else if ( object->type == DDDBTrap::type() ) { + const DDDBTrap& o = object->s.trap; + shape = Trap(o.dz, o.theta, o.phi, o.h1, o.bl1, o.tl1, o.alpha1, o.h2, o.bl2, o.tl2, o.alpha2); } - else if ( object->type == BooleanUnion::type() || - object->type == BooleanSubtraction::type() || - object->type == BooleanIntersection::type() ) { + else if ( object->type == DDDBBooleanUnion::type() || + object->type == DDDBBooleanSubtraction::type() || + object->type == DDDBBooleanIntersection::type() ) { shape = context->lvDummy.solid(); - Shape::Operations::const_iterator i; - Shape* left_shape = object->s.boolean.first; - GeoSolid left_solid = (TGeoShape*)convert(left_shape); + DDDBShape::Operations::const_iterator i; + DDDBShape* left_shape = object->s.boolean.first; + Solid left_solid = (TGeoShape*)convert(left_shape); if ( !left_solid.isValid() ) { // Error .... except("Cnv<Shape>","++ %s: Unknown left boolean shape creation:%s -> %d", object->c_name(), left_shape->c_name(), left_shape->type); } shape = left_solid; for(i=object->boolean_ops.begin(); i != object->boolean_ops.end(); ++i) { - Shape* right_shape = (*i).shape; - GeoSolid right_solid = (TGeoShape*)convert(right_shape); + DDDBShape* right_shape = (*i).shape; + Solid right_solid = (TGeoShape*)convert(right_shape); const Transform3D& trafo = (*i).trafo; if ( !right_solid.isValid() ) { // Error .... except("Cnv<Shape>","++ %s: Unknown right boolean shape creation:%s -> %d", object->c_name(), right_shape->c_name(), right_shape->type); } - shape = GeoSolid(); - if ( object->type == BooleanUnion::type() ) - shape = Geometry::UnionSolid(left_solid, right_solid, trafo); - else if ( object->type == BooleanSubtraction::type() ) - shape = Geometry::SubtractionSolid(left_solid, right_solid, trafo); - else if ( object->type == BooleanIntersection::type() ) - shape = Geometry::IntersectionSolid(left_solid, right_solid, trafo); + shape = Solid(); + if ( object->type == DDDBBooleanUnion::type() ) + shape = UnionSolid(left_solid, right_solid, trafo); + else if ( object->type == DDDBBooleanSubtraction::type() ) + shape = SubtractionSolid(left_solid, right_solid, trafo); + else if ( object->type == DDDBBooleanIntersection::type() ) + shape = IntersectionSolid(left_solid, right_solid, trafo); if ( !shape.isValid() ) { except("Cnv<Shape>","++ %s: Unknown boolean shape creation:%d", object->c_name(), object->type); @@ -552,8 +547,8 @@ namespace DD4hep { return shape; } - inline GeoPlacement place_daughter(const char* pv, GeoVolume mother, GeoVolume daughter, const Transform3D& tr) { - GeoPlacement place = mother.placeVolume(daughter, tr); + inline PlacedVolume place_daughter(const char* pv, Volume mother, Volume daughter, const Transform3D& tr) { + PlacedVolume place = mother.placeVolume(daughter, tr); // Use title for user defined physical volume name, since TGeo sets already the name! place->SetTitle(pv); return place; @@ -566,11 +561,11 @@ namespace DD4hep { } /// Convert logical volumes - template <> void* CNV<LogVol>::convert(LogVol *object) const { + template <> void* CNV<DDDBLogVol>::convert(DDDBLogVol *object) const { struct VolumeDepth {}; Increment<VolumeDepth> depth; Context* context = _param<Context>(); - GeoVolume mother = Context::find(context->volumes, object); + Volume mother = Context::find(context->volumes, object); if ( !mother.isValid() ) { if ( depth.counter() >= context->max_volume_depth ) { @@ -581,19 +576,19 @@ namespace DD4hep { depth.counter(), object->path.c_str()); return mother; } - Shape* shape = Context::find(context->geo->shapes,object->shape); - if ( object->shape.empty() || shape->type == Assembly::type() ) { - mother = Geometry::Assembly(object->name); + DDDBShape* shape = Context::find(context->geo->shapes,object->shape); + if ( object->shape.empty() || shape->type == DDDBAssembly::type() ) { + mother = Assembly(object->name); } else { - GeoSolid s = (TGeoShape*)cnv<Shape>().convert(shape); + Solid s = (TGeoShape*)cnv<DDDBShape>().convert(shape); if ( s.isValid() ) { - GeoMaterial m = cnv<Material>().get<GeoMaterial>(object->material); - mother = GeoVolume(object->name, s, m); + Material m = cnv<DDDBMaterial>().get<Material>(object->material); + mother = Volume(object->name, s, m); } } mother->SetTitle(object->path.c_str()); - Geometry::VisAttr vis = context->helper->visAttr(object->path); + VisAttr vis = context->helper->visAttr(object->path); if ( vis.isValid() ) { if ( context->print_vis ) { printout(INFO,"Cnv<LogVol>","++ Vol:%s Vis:%s",mother->GetTitle(), vis.name()); @@ -610,10 +605,10 @@ namespace DD4hep { context->volumePaths[object->path] = mother.ptr(); // Now place all daughter volumes for(auto i=object->physvols.begin(); i!=object->physvols.end(); ++i) { - PhysVol* pv = *i; - GeoPlacement place = context->find(context->placements, pv); + DDDBPhysVol* pv = *i; + PlacedVolume place = context->find(context->placements, pv); if ( !place.isValid() ) { - GeoVolume daughter = this->get<GeoVolume>(pv->logvol); + Volume daughter = this->get<Volume>(pv->logvol); if ( !daughter.isValid() ) { printout(WARNING,"Cnv<PhysVol>","++ Failed to convert placement: %s." " Unknown daughter vol:%s.",pv->c_id(), pv->logvol.c_str()); @@ -622,13 +617,13 @@ namespace DD4hep { int num_places = 0; const char* pv_name = pv->name.c_str(); switch(pv->type) { - case PhysVol::PHYSVOL_REGULAR: { + case DDDBPhysVol::PHYSVOL_REGULAR: { place = place_daughter(pv_name, mother, daughter, pv->trafo); num_places = 1; break; } - case PhysVol::PHYSVOL_PARAM1D: { - ParamPhysVol* pDim = (ParamPhysVol*)pv; + case DDDBPhysVol::PHYSVOL_PARAM1D: { + DDDBParamPhysVol* pDim = (DDDBParamPhysVol*)pv; Transform3D tr; Position pos1, p1; RotationZYX rot1, r1; @@ -644,8 +639,8 @@ namespace DD4hep { } break; } - case PhysVol::PHYSVOL_PARAM2D: { - ParamPhysVol2D* pDim = (ParamPhysVol2D*)pv; + case DDDBPhysVol::PHYSVOL_PARAM2D: { + DDDBParamPhysVol2D* pDim = (DDDBParamPhysVol2D*)pv; Position pos1, pos2, p1, p2; RotationZYX rot1, rot2, r1, r2; Transform3D tr; @@ -669,8 +664,8 @@ namespace DD4hep { } break; } - case PhysVol::PHYSVOL_PARAM3D: { - ParamPhysVol3D* pDim = (ParamPhysVol3D*)pv; + case DDDBPhysVol::PHYSVOL_PARAM3D: { + DDDBParamPhysVol3D* pDim = (DDDBParamPhysVol3D*)pv; Position pos1, pos2, pos3, p1, p2, p3; RotationZYX rot1, rot2, rot3, r1, r2, r3; Transform3D tr; @@ -729,9 +724,9 @@ namespace DD4hep { /// Access logical volumes from string name template <> template <> - LogVol* CNV<LogVol>::get<LogVol*>(const string& nam) const { + DDDBLogVol* CNV<DDDBLogVol>::get<DDDBLogVol*>(const string& nam) const { Context* context = _param<Context>(); - LogVol* lv = Context::find(context->geo->volumes,nam); + DDDBLogVol* lv = Context::find(context->geo->volumes,nam); if ( lv ) { return lv; } @@ -739,9 +734,9 @@ namespace DD4hep { if ( lv ) { return lv; } - pair<const Catalog*,string> cat = context->geo->geometry->parent(nam); + pair<const DDDBCatalog*,string> cat = context->geo->geometry->parent(nam); if ( cat.first ) { - const Catalog* c = cat.first; + const DDDBCatalog* c = cat.first; dddb::Volumes::const_iterator iv = c->logvols.find(cat.second); if ( iv != c->logvols.end() ) { lv = (*iv).second; @@ -757,23 +752,23 @@ namespace DD4hep { /// Convert logical volumes from string template <> template <> - GeoVolume CNV<LogVol>::get<GeoVolume>(const string& nam) const { - LogVol* lv = this->get<LogVol*>(nam); + Volume CNV<DDDBLogVol>::get<Volume>(const string& nam) const { + DDDBLogVol* lv = this->get<DDDBLogVol*>(nam); if ( lv ) { return (TGeoVolume*)this->convert(lv); } - return GeoVolume(0); + return Volume(0); } - template <> void* CNV<Catalog>::convert(Catalog *object) const { + template <> void* CNV<DDDBCatalog>::convert(DDDBCatalog *object) const { Context* context = _param<Context>(); dddb* geo = context->geo; Context::DetectorMap::const_iterator j=context->catalogPaths.find(object->path); if ( j != context->catalogPaths.end() ) { return (*j).second.ptr(); } - GeoVolume vol; - Catalog* support = 0; + Volume vol; + DDDBCatalog* support = 0; DetElement det(0), parent_element(0); if ( context->print_detelem ) { printout(INFO,"CNV<Catalog>","++ Starting catalog %p %s [cref:%d/%d lref:%d/%d lv:%s sup:%s np:%s] Cond:%s ", @@ -789,14 +784,14 @@ namespace DD4hep { object->condition.c_str()); } if ( object->path == "/dd/Structure" ) { - const Box& o = geo->world; + const DDDBBox& o = geo->world; printout(WARNING,"World","World: %g %g %g",o.x,o.y,o.z); _toDictionary("world_x",_toString(o.x)); _toDictionary("world_y",_toString(o.y)); _toDictionary("world_z",_toString(o.z)); - lcdd.init(); - det = lcdd.world(); - vol = lcdd.worldVolume(); + description.init(); + det = description.world(); + vol = description.worldVolume(); context->detectors = det; } else if ( object->path.find("/dd/TrackfitGeometry") == 0 ) { @@ -807,7 +802,7 @@ namespace DD4hep { } else if ( object->path.find("/dd/Structure") == 0 ) { det = DetElement(object->name,object->type,0); - det.addExtension<Catalog>(object->addRef()); + det.addExtension<DDDBCatalog>(object->addRef()); if ( !object->support.empty() ) { try { j = context->catalogPaths.find(object->support); @@ -823,9 +818,9 @@ namespace DD4hep { parent_element.add(det); } else { - pair<const Catalog*,string> cat = context->geo->structure->parent(object->support); + pair<const DDDBCatalog*,string> cat = context->geo->structure->parent(object->support); if ( cat.first ) { - const Catalog* c = cat.first; + const DDDBCatalog* c = cat.first; dddb::Catalogs::const_iterator icc = c->catalogs.find(cat.second); if ( icc != c->catalogs.end() ) { support = (*icc).second; @@ -847,13 +842,13 @@ namespace DD4hep { // Deal with true detector elements from /dd/Structure if ( det.isValid() ) { if ( !object->logvol.empty() ) { - CNV<LogVol> conv(lcdd,param); + CNV<DDDBLogVol> conv(description,param); // Convert the logical volume, so that all daughters are present! - vol = conv.get<GeoVolume>(object->logvol); + vol = conv.get<Volume>(object->logvol); //printout(INFO,"CNV<DetElem>","++ Set Placement: %s : %s -> %s", // object->path.c_str(), object->logvol.c_str(), object->npath.c_str()); if ( !object->npath.empty() ) { - GeoPlacement place = context->supportPlacement(parent_element, object->npath); + PlacedVolume place = context->supportPlacement(parent_element, object->npath); if ( !place.isValid() ) { char txt[64]; ::snprintf(txt,sizeof(txt),"++ %%%lds %%s %%s",long(object->path.length())); @@ -867,13 +862,13 @@ namespace DD4hep { } } else { - GeoPlacement par_place = context->placement(parent_element); - GeoVolume par_vol = par_place.volume(); + PlacedVolume par_place = context->placement(parent_element); + Volume par_vol = par_place.volume(); if ( context->volumePlaced(par_vol, vol) ) { printout(WARNING,"CNV<DetElem>","++ %s : Volume already placed %s -> %s", det.path().c_str(), par_vol->GetTitle(), vol->GetTitle()); } - GeoPlacement det_place = par_vol.placeVolume(vol); + PlacedVolume det_place = par_vol.placeVolume(vol); det.setPlacement(det_place); } } @@ -885,14 +880,14 @@ namespace DD4hep { context->detelements[det] = object; context->catalogPaths[object->path] = det; } - for_each(object->logvolrefs.begin(), object->logvolrefs.end(), CNV<LogVol>(lcdd,param,det.ptr())); + for_each(object->logvolrefs.begin(), object->logvolrefs.end(), CNV<DDDBLogVol>(description,param,det.ptr())); for_each(object->catalogrefs.begin(), object->catalogrefs.end(), *this); #if 0 - for(Catalog::LvRefs::const_iterator i=object->logvolrefs.begin(); i!=object->logvolrefs.end(); ++i) { - LogVol* lv = (*i).second; + for(DDDBCatalog::LvRefs::const_iterator i=object->logvolrefs.begin(); i!=object->logvolrefs.end(); ++i) { + DDDBLogVol* lv = (*i).second; string lp = object->path+"/"+lv->name; - GeoVolume gv = Context::find(context->volumes, lv); + Volume gv = Context::find(context->volumes, lv); context->volumePaths[lp] = gv.ptr(); } #endif @@ -903,7 +898,7 @@ namespace DD4hep { ::snprintf(text,sizeof(text)," %%%lds -> %%s",long(object->condition.length())); printout(DEBUG,"DDDB","+ Match Align %s -> %s",object->condition.c_str(), object->path.c_str()); printout(DEBUG,"DDDB",text,"",det.path().c_str()); - res = context->helper->addConditionEntry(object->condition,det,Alignments::Keys::deltaName); + res = context->helper->addConditionEntry(object->condition,det,align::Keys::deltaName); if ( !res ) { printout(DEBUG,"DDDB","++ Conditions entry with key:%s already exists!", object->condition.c_str()); @@ -945,8 +940,8 @@ namespace DD4hep { } cnt = 0; for( const auto& v : object->logvolrefs ) { - LogVol* lv = v.second; - GeoVolume geoVol = Context::find(context->volumes, lv); + DDDBLogVol* lv = v.second; + Volume geoVol = Context::find(context->volumes, lv); if ( lv ) printout(INFO,"CNV<DE>:lref","++ DE:%s ref[%2d]: %p / %s -> %p [%s]", object->path.c_str(), cnt, (void*)lv, lv->c_name(), @@ -957,9 +952,9 @@ namespace DD4hep { } cnt = 0; for( const auto& v : object->logvols ) { - LogVol* lv = v.second; + DDDBLogVol* lv = v.second; if ( lv ) { - GeoVolume geoVol = Context::find(context->volumes, lv); + Volume geoVol = Context::find(context->volumes, lv); printout(INFO,"CNV<DE>:lvol","++ DE:%s ref[%2d]: %p / %s -> %p [%s]", object->path.c_str(), cnt, (void*)lv, lv->c_id(), (void*)geoVol.ptr(), geoVol.isValid() ? geoVol->GetName() : "????"); @@ -983,51 +978,51 @@ namespace DD4hep { template <> void* CNV<dddb>::convert(dddb *obj) const { Context* context = _param<Context>(); if ( !context->conditions_only ) { - GeoVolume world = lcdd.worldVolume(); + Volume world = description.worldVolume(); - for_each(obj->isotopes.begin(), obj->isotopes.end(), cnv<Isotope>()); + for_each(obj->isotopes.begin(), obj->isotopes.end(), cnv<DDDBIsotope>()); printout(INFO,"DDDB2Object","++ Converted %d isotopes.",int(obj->isotopes.size())); - for_each(obj->elements.begin(), obj->elements.end(), cnv<Element>()); + for_each(obj->elements.begin(), obj->elements.end(), cnv<DDDBElement>()); printout(INFO,"DDDB2Object","++ Converted %d elements.",int(obj->elements.size())); - //for_each(obj->materials.begin(), obj->materials.end(), cnv<Material>()); + //for_each(obj->materials.begin(), obj->materials.end(), cnv<DDDBMaterial>()); //printout(INFO,"DDDB2Object","++ Converted %d materials.",int(obj->materials.size())); - //for_each(obj->shapes.begin(), obj->shapes.end(), cnv<Shape>()); + //for_each(obj->shapes.begin(), obj->shapes.end(), cnv<DDDBShape>()); //printout(INFO,"DDDB2Object","++ Converted %d shapes.",int(obj->shapes.size())); - //for_each(obj->volumes.begin(), obj->volumes.end(), cnv<LogVol>()); + //for_each(obj->volumes.begin(), obj->volumes.end(), cnv<DDDBLogVol>()); //printout(INFO,"DDDB2Object","++ Converted %d volumes.",int(obj->volumes.size())); - //for_each(obj->placements.begin(),obj->placements.end(), cnv<PhysVol>()); + //for_each(obj->placements.begin(),obj->placements.end(), cnv<DDDBPhysVol>()); //printout(INFO,"DDDB2Object","++ Converted %d placements.",int(obj->placements.size())); if ( obj->top ) { if ( !context->lvDummy.isValid() ) { - lcdd.manager().SetVisLevel(context->max_volume_depth); - context->lvDummy = GeoVolume("Dummy",Geometry::Box(0.0001,0.0001, 0.0001),lcdd.vacuum()); - context->lvDummy.setVisAttributes(lcdd.invisible()); + description.manager().SetVisLevel(context->max_volume_depth); + context->lvDummy = Volume("Dummy",Box(0.0001,0.0001, 0.0001),description.vacuum()); + context->lvDummy.setVisAttributes(description.invisible()); } if ( !world.isValid() ) { string top = "/dd/Geometry/LHCb/lvLHCb"; - const LogVol* lv = Context::find(obj->volumePaths,top); + const DDDBLogVol* lv = Context::find(obj->volumePaths,top); if ( !lv ) { - except("DDDB2DD4hep","++ No World volume defined."); + except("DDDB2dd4hep","++ No World volume defined."); } - const Shape* s = Context::find(obj->shapes,lv->id); + const DDDBShape* s = Context::find(obj->shapes,lv->id); if ( !s ) { - except("DDDB2DD4hep","++ No Shape for the world volume defined."); + except("DDDB2dd4hep","++ No Shape for the world volume defined."); } obj->world = s->s.box; } /// Main detector conversion invokation - cnv<Catalog>().convert(obj->top); - if ( !world.isValid() && lcdd.worldVolume().isValid() ) { - lcdd.endDocument(); + cnv<DDDBCatalog>().convert(obj->top); + if ( !world.isValid() && description.worldVolume().isValid() ) { + description.endDocument(); } /// Now configure the conditions manager if ( !context->manager.isValid() ) { - Conditions::ConditionsManager manager = Conditions::ConditionsManager::from(lcdd); - manager["PoolType"] = "DD4hep_ConditionsLinearPool"; + ConditionsManager manager = ConditionsManager::from(description); + manager["PoolType"] = "dd4hep_ConditionsLinearPool"; manager["LoaderType"] = "dddb"; - manager["UserPoolType"] = "DD4hep_ConditionsMapUserPool"; - manager["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool"; + manager["UserPoolType"] = "dd4hep_ConditionsMapUserPool"; + manager["UpdatePoolType"] = "dd4hep_ConditionsLinearUpdatePool"; manager.initialize(); pair<bool,const IOVType*> e = manager.registerIOVType(0, "epoch"); context->manager = manager; @@ -1036,7 +1031,7 @@ namespace DD4hep { } } if ( !context->manager.isValid() ) { - Conditions::ConditionsManager manager = Conditions::ConditionsManager::from(lcdd); + ConditionsManager manager = ConditionsManager::from(description); pair<bool,const IOVType*> e = manager.registerIOVType(0, "epoch"); context->manager = manager; context->epoch = e.second; @@ -1047,12 +1042,12 @@ namespace DD4hep { } } - /// Namespace for the geometry part of the AIDA detector description toolkit + /// Namespace for implementation details of the AIDA detector description toolkit namespace DDDB { - long dddb_2_dd4hep(LCDD& lcdd, int , char** ) { - DDDBHelper* helper = lcdd.extension<DDDBHelper>(false); + long dddb_2_dd4hep(Detector& description, int , char** ) { + DDDBHelper* helper = description.extension<DDDBHelper>(false); if ( helper ) { - Context context(lcdd, helper->detectorDescription()); + Context context(description, helper->detectorDescription()); context.helper = helper; context.print_materials = false; context.print_logvol = false; @@ -1065,7 +1060,7 @@ namespace DD4hep { context.print_vis = false; context.max_volume_depth = 11; - CNV<dddb> cnv(lcdd,&context); + CNV<dddb> cnv(description,&context); cnv(make_pair(string("World"),context.geo)); printout(INFO,"DDDB","+========================= Conversion summary =========================+"); printout(INFO,"DDDB","++ Converted %8d isotopes.", int(context.isotopes.size())); @@ -1091,14 +1086,14 @@ namespace DD4hep { except("DDDB","++ No DDDBHelper instance installed. Geometry conversion failed!"); return 1; } - long dddb_conditions_2_dd4hep(LCDD& lcdd, int , char** ) { - DDDBHelper* helper = lcdd.extension<DDDBHelper>(false); + long dddb_conditions_2_dd4hep(Detector& description, int , char** ) { + DDDBHelper* helper = description.extension<DDDBHelper>(false); if ( helper ) { - Context context(lcdd, helper->detectorDescription()); + Context context(description, helper->detectorDescription()); context.helper = helper; context.print_conditions = false; context.conditions_only = true; - CNV<dddb> cnv(lcdd,&context); + CNV<dddb> cnv(description,&context); cnv(make_pair(string(),context.geo)); helper->setDetectorDescription(0); return 1; @@ -1108,6 +1103,6 @@ namespace DD4hep { } } /* End namespace DDDB */ -} /* End namespace DD4hep */ -DECLARE_APPLY(DDDB_2DD4hep,dddb_2_dd4hep) -DECLARE_APPLY(DDDB_Conditions2DD4hep,dddb_conditions_2_dd4hep) +} /* End namespace dd4hep */ +DECLARE_APPLY(DDDB_2dd4hep,dddb_2_dd4hep) +DECLARE_APPLY(DDDB_Conditions2dd4hep,dddb_conditions_2_dd4hep) diff --git a/DDDB/src/plugins/DDDBAlignmentTest.cpp b/DDDB/src/plugins/DDDBAlignmentTest.cpp index 79833dfa8..451721d5e 100644 --- a/DDDB/src/plugins/DDDBAlignmentTest.cpp +++ b/DDDB/src/plugins/DDDBAlignmentTest.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ //========================================================================== // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Path.h" #include "DD4hep/Printout.h" #include "DD4hep/Factories.h" @@ -35,12 +35,10 @@ #include "TTimeStamp.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; -using Alignments::Delta; -using Alignments::Alignment; -using Alignments::deltaCollector; -using Alignments::AlignmentsCalculator; +using namespace dd4hep; +using namespace dd4hep::cond; +using align::deltaCollector; +using align::AlignmentsCalculator; /// Anonymous namespace for plugins namespace { @@ -55,7 +53,7 @@ namespace { class AlignmentSelector { public: typedef std::shared_ptr<ConditionsContent> Content; - LCDD& lcdd; + Detector& description; string name; PrintLevel printLevel = INFO; TStatistic load_stat, comp_stat; @@ -63,8 +61,8 @@ namespace { ConditionsPrinter printer; /// Initializing constructor - AlignmentSelector(LCDD& l, PrintLevel p) - : lcdd(l), name("DDDBAlignments"), printLevel(p), + AlignmentSelector(Detector& l, PrintLevel p) + : description(l), name("DDDBAlignments"), printLevel(p), load_stat("Load"), comp_stat("Compute"), printer(0,"Alignments") { printer.printLevel = DEBUG; @@ -82,7 +80,7 @@ namespace { printout(INFO,name, "++ DDDB: Initial prepare: %7ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) for IOV:%-12s", cres.total(), cres.selected, cres.loaded, cres.computed, cres.missing, iov.str().c_str()); - Conditions::fill_content(manager,*content,*iov.iovType); + cond::fill_content(manager,*content,*iov.iovType); printout(INFO,name,"++ DDDB: Content: %ld conditions, %ld derived conditions.", content->conditions().size(), content->derived().size()); return 1; @@ -94,7 +92,7 @@ namespace { bool access = false) { AlignmentsCalculator align; - AlignmentsCalculator::Deltas align_deltas; + std::map<DetElement, Delta> align_deltas; slice.reset(new ConditionsSlice(manager,content)); TTimeStamp acc_start; ConditionsManager::Result cres = manager.prepare(iov, *slice); @@ -104,7 +102,7 @@ namespace { "++ DDDB: Prepared %7ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) for IOV:%-12s", cres.total(), cres.selected, cres.loaded, cres.computed, cres.missing, iov.str().c_str()); - Geometry::DetectorScanner(deltaCollector(*slice,align_deltas),lcdd.world(),0,true); + DetectorScanner(deltaCollector(*slice,align_deltas),description.world(),0,true); TTimeStamp comp_start; AlignmentsCalculator::Result ares = align.compute(align_deltas,*slice); @@ -117,7 +115,7 @@ namespace { if ( access ) { set<DetElement> detectors; for ( const auto& e : align_deltas ) { - Condition c = slice->get(e.first,Alignments::Keys::alignmentKey); + Condition c = slice->get(e.first,align::Keys::alignmentKey); Alignment a = c; const Delta& D = a.data().delta; printout(PrintLevel(printLevel+1),"Alignment", @@ -142,20 +140,20 @@ namespace { namespace { /// Plugin function: Load dependent alignment conditions according to time stamps. - long dddb_derived_alignments(LCDD& lcdd, int argc, char** argv) { + long dddb_derived_alignments(Detector& description, int argc, char** argv) { int turns = 1, accesses = 1; PrintLevel level = INFO; - long time = makeTime(2016,4,1,12); + long time = detail::makeTime(2016,4,1,12); string fname = Path(__FILE__).filename(); for(int i=0; i<argc; ++i) { if ( ::strncmp(argv[i],"-time",3)==0 ) { - time = makeTime(argv[++i],"%d-%m-%Y %H:%M:%S"); + time = detail::makeTime(argv[++i],"%d-%m-%Y %H:%M:%S"); printout(level,"DDDB","Setting event time in %s to %s [%ld]", fname.c_str(), argv[i-1], time); } else if ( ::strncmp(argv[i],"-print",3)==0 ) { - level = DD4hep::printLevel(argv[++i]); + level = dd4hep::printLevel(argv[++i]); printout(level,"DDDB","Setting print level in %s to %s [%d]", fname.c_str(), argv[i-1], level); } @@ -179,8 +177,8 @@ namespace { } int ret; { - AlignmentSelector selec(lcdd, level); - ConditionsManager manager(ConditionsManager::from(lcdd)); + AlignmentSelector selec(description, level); + ConditionsManager manager(ConditionsManager::from(description)); TStatistic cr_stat("Initialize"), re_acc_stat("Reaccess"); const IOVType* iovType = manager.iovType("epoch"); { @@ -235,17 +233,17 @@ DECLARE_APPLY(DDDB_DerivedAlignmentsTest,dddb_derived_alignments) namespace { /// Plugin function: Access dependent alignment conditions from DetElement object using global and local keys - long dddb_access_alignments(LCDD& lcdd, int argc, char** argv) { + long dddb_access_alignments(Detector& description, int argc, char** argv) { PrintLevel level = INFO; - long time = makeTime(2016,4,1,12); + long time = detail::makeTime(2016,4,1,12); for(int i=0; i<argc; ++i) { if ( ::strcmp(argv[i],"-time")==0 ) { - time = makeTime(argv[++i],"%d-%m-%Y %H:%M:%S"); + time = detail::makeTime(argv[++i],"%d-%m-%Y %H:%M:%S"); printout(level,"DDDB","Setting event time in %s to %s [%ld]", Path(__FILE__).filename().c_str(), argv[i-1], time); } else if ( ::strcmp(argv[i],"-print")==0 ) { - level = DD4hep::printLevel(argv[++i]); + level = dd4hep::printLevel(argv[++i]); printout(level,"DDDB","Setting print level in %s to %s [%d]", Path(__FILE__).filename().c_str(), argv[i-1], level); } @@ -257,8 +255,8 @@ namespace { ::exit(EINVAL); } } - AlignmentSelector selec(lcdd,level); - ConditionsManager manager(ConditionsManager::from(lcdd)); + AlignmentSelector selec(description,level); + ConditionsManager manager(ConditionsManager::from(description)); const IOVType* iovType = manager.iovType("epoch"); IOV iov(iovType, time); int ret = selec.collect(manager,iov); diff --git a/DDDB/src/plugins/DDDBDerivedCondTest.cpp b/DDDB/src/plugins/DDDBDerivedCondTest.cpp index 776ff4742..9d07ab421 100644 --- a/DDDB/src/plugins/DDDBDerivedCondTest.cpp +++ b/DDDB/src/plugins/DDDBDerivedCondTest.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ //========================================================================== // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Path.h" #include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" @@ -34,28 +34,14 @@ #include "DDDB/DDDBConversion.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; +using namespace dd4hep; +using namespace dd4hep::cond; -using DDDB::Document; -using Geometry::LCDD; -using Geometry::DetElement; +using DDDB::DDDBDocument; /// Anonymous namespace for plugins namespace { - /// Helper containing shared typedefs - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CONDITIONS - */ - class DataTypes { - public: - typedef Alignments::AlignmentData Data; - typedef Alignments::Delta Delta; - }; - /// Helper containing shared context /** * \author M.Frank @@ -86,7 +72,7 @@ namespace { * \version 1.0 * \ingroup DD4HEP_CONDITIONS */ - class ConditionUpdate1 : public ConditionUpdateCall, public DataTypes { + class ConditionUpdate1 : public ConditionUpdateCall { public: CallContext& context; ConditionUpdate1(CallContext& c) : context(c) { @@ -94,15 +80,15 @@ namespace { } virtual ~ConditionUpdate1() { } /// Interface to client Callback in order to update the condition - virtual Condition operator()(const ConditionKey& key, const Context& ctxt) { + virtual Condition operator()(const ConditionKey& key, const ConditionUpdateContext& ctxt) { printout(context.level,"ConditionUpdate1","++ Building dependent condition: %s",key.name.c_str()); Condition target(key.name,"Alignment"); try { - Data& data = target.bind<Data>(); - Condition cond0 = ctxt.condition(0); - const Delta& delta = cond0.get<Delta>(); - data.delta = delta; - data.flag = Data::HAVE_NONE; + AlignmentData& data = target.bind<AlignmentData>(); + Condition cond0 = ctxt.condition(0); + const Delta& delta = cond0.get<Delta>(); + data.delta = delta; + data.flag = AlignmentData::HAVE_NONE; ++context.numBuild1; } catch(const exception& exc) { @@ -121,7 +107,7 @@ namespace { * \version 1.0 * \ingroup DD4HEP_CONDITIONS */ - class ConditionUpdate2 : public ConditionUpdateCall, public DataTypes { + class ConditionUpdate2 : public ConditionUpdateCall { public: CallContext& context; ConditionUpdate2(CallContext& c) : context(c) { @@ -129,17 +115,17 @@ namespace { } virtual ~ConditionUpdate2() { } /// Interface to client Callback in order to update the condition - virtual Condition operator()(const ConditionKey& key, const Context& ctxt) { + virtual Condition operator()(const ConditionKey& key, const ConditionUpdateContext& ctxt) { printout(context.level,"ConditionUpdate2","++ Building dependent condition: %s",key.name.c_str()); Condition target(key.name,"Alignment"); try { - Data& data = target.bind<Data>(); + AlignmentData& data = target.bind<AlignmentData>(); Condition cond0 = ctxt.condition(0); const Delta& delta0 = cond0.get<Delta>(); - const Data& data1 = ctxt.get<Data>(1); // Equivalent to ctxt.condition(1).get<Data>() + const AlignmentData& data1 = ctxt.get<AlignmentData>(1); // Equivalent to ctxt.condition(1).get<AlignmentData>() data.delta = delta0; data.delta = data1.delta; - data.flag = Data::HAVE_NONE; + data.flag = AlignmentData::HAVE_NONE; ++context.numBuild2; } catch(const exception& exc) { @@ -158,7 +144,7 @@ namespace { * \version 1.0 * \ingroup DD4HEP_CONDITIONS */ - class ConditionUpdate3 : public ConditionUpdateCall, public DataTypes { + class ConditionUpdate3 : public ConditionUpdateCall { public: CallContext& context; ConditionUpdate3(CallContext& c) : context(c) { @@ -166,19 +152,19 @@ namespace { } virtual ~ConditionUpdate3() { } /// Interface to client Callback in order to update the condition - virtual Condition operator()(const ConditionKey& key, const Context& ctxt) { + virtual Condition operator()(const ConditionKey& key, const ConditionUpdateContext& ctxt) { printout(context.level,"ConditionUpdate3","++ Building dependent condition: %s",key.name.c_str()); Condition target(key.name,"Alignment"); try { - Data& data = target.bind<Data>(); - Condition cond0 = ctxt.condition(0); + AlignmentData& data = target.bind<AlignmentData>(); + Condition cond0 = ctxt.condition(0); const Delta& delta0 = cond0.get<Delta>(); - const Data& data1 = ctxt.get<Data>(1); - const Data& data2 = ctxt.get<Data>(2); + const AlignmentData& data1 = ctxt.get<AlignmentData>(1); + const AlignmentData& data2 = ctxt.get<AlignmentData>(2); data.delta = delta0; data.delta = data1.delta; data.delta = data2.delta; - data.flag = Data::HAVE_NONE; + data.flag = AlignmentData::HAVE_NONE; ++context.numBuild3; } catch(const exception& exc) { @@ -242,8 +228,7 @@ namespace { RangeConditions findCond(const string& match) { RangeConditions result; if ( !match.empty() ) { - for(RangeConditions::iterator ic=m_allConditions.begin(); ic!=m_allConditions.end(); ++ic) { - Condition cond = (*ic); + for( Condition cond : m_allConditions ) { size_t idx = cond->value.find(match); if ( idx == 0 ) { if (cond->value.length() == match.length() ) { @@ -262,14 +247,14 @@ namespace { } long collectDependencies(DetElement de, int level) { char fmt[64]; - DDDB::Catalog* cat = 0; + DDDB::DDDBCatalog* cat = 0; const DetElement::Children& c = de.children(); ::snprintf(fmt,sizeof(fmt),"%%-%ds-> ",2*level+5); try { ::sprintf(fmt,"%03d %%-%ds Detector: %%s #Dau:%%d VolID:%%p",level+1,2*level+1); printout(m_level,m_name,fmt,"",de.path().c_str(),int(c.size()),(void*)de.volumeID()); - cat = de.extension<DDDB::Catalog>(); + cat = de.extension<DDDB::DDDBCatalog>(); ::sprintf(fmt,"%03d %%-%ds %%-20s -> %%s", level+1, 2*level+3); // // We use here the alignment entry from the DDDB catalog: @@ -280,10 +265,9 @@ namespace { printout(m_level,m_name,fmt,"","Alignment: ", rc.empty() ? (cat->condition+" !!!UNRESOLVED!!!").c_str() : cat->condition.c_str()); if ( !rc.empty() ) { - for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic) { - Condition cond = *ic; + for( Condition cond : rc ) { ConditionKey key(de, cond->name); - if ( key.hash == cond.key() && cond.typeInfo() == typeid(Alignments::Delta) ) { + if ( key.hash == cond.key() && cond.typeInfo() == typeid(Delta) ) { ConditionKey target1(de,cond->name+"/derived_1"); ConditionKey target2(de,cond->name+"/derived_2"); ConditionKey target3(de,cond->name+"/derived_3"); @@ -340,17 +324,17 @@ namespace { //======================================================================== /// Plugin function /// Load, compute and access derived conditions - long dddb_derived_alignments(LCDD& lcdd, int argc, char** argv) { + long dddb_derived_alignments(Detector& description, int argc, char** argv) { PrintLevel level = INFO; - long time = makeTime(2016,4,1,12); + long time = detail::makeTime(2016,4,1,12); for(int i=0; i<argc; ++i) { if ( ::strcmp(argv[i],"-time")==0 ) { - time = makeTime(argv[++i],"%d-%m-%Y %H:%M:%S"); + time = detail::makeTime(argv[++i],"%d-%m-%Y %H:%M:%S"); printout(level,"DDDB","Setting event time in %s to %s [%ld]", Path(__FILE__).filename().c_str(), argv[i-1], time); } else if ( ::strcmp(argv[i],"-print")==0 ) { - level = DD4hep::printLevel(argv[++i]); + level = dd4hep::printLevel(argv[++i]); printout(level,"DDDB","Setting print level in %s to %s [%d]", Path(__FILE__).filename().c_str(), argv[i-1], level); } @@ -363,8 +347,8 @@ namespace { } } - ConditionsSelector selector("DDDB_Derived",ConditionsManager::from(lcdd), level); - int ret = selector.collectDependencies(lcdd.world(), 0); + ConditionsSelector selector("DDDB_Derived",ConditionsManager::from(description), level); + int ret = selector.collectDependencies(description.world(), 0); if ( ret == 1 ) { ret = selector.computeDependencies(time); } diff --git a/DDDB/src/plugins/DDDBDetectorDumps.cpp b/DDDB/src/plugins/DDDBDetectorDumps.cpp index f109ecbd7..0f12728d2 100644 --- a/DDDB/src/plugins/DDDBDetectorDumps.cpp +++ b/DDDB/src/plugins/DDDBDetectorDumps.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ //========================================================================== // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" #include "DD4hep/Factories.h" @@ -37,8 +37,7 @@ #include <memory> using namespace std; -using namespace DD4hep; -using Geometry::LCDD; +using namespace dd4hep; /// Anonymous namespace for plugins namespace { @@ -47,10 +46,10 @@ namespace { //========================================================================== /// Plugin function -static long dddb_plugin_print_level(Geometry::LCDD& /* lcdd */, int argc, char** argv) { +static long dddb_plugin_print_level(Detector& /* description */, int argc, char** argv) { for(int i=0; i<argc; ++i) { if ( ::strcmp(argv[i],"--print")==0 ) { - s_PrintLevel = DD4hep::printLevel(argv[++i]); + s_PrintLevel = dd4hep::printLevel(argv[++i]); printout(INFO,"DDDB","Setting print level for %s to %s [%d]",__FILE__,argv[i-1],s_PrintLevel); return 1; } @@ -63,7 +62,7 @@ DECLARE_APPLY(DDDB_PluginLevel,dddb_plugin_print_level) /// Anonymous namespace for plugins namespace { - using namespace Conditions; + using namespace dd4hep::cond; /// Basic entry point to print out the detector element hierarchy /** @@ -71,11 +70,10 @@ namespace { * \version 1.0 * \date 01/04/2014 */ - long dump_det_tree(LCDD& lcdd, int flag, int argc, char** argv) { + long dump_det_tree(Detector& description, int flag, int argc, char** argv) { - using Alignments::deltaCollector; - using Alignments::Delta; - using DDDB::Catalog; + using align::deltaCollector; + using DDDB::DDDBCatalog; /// Callback object to print selective information @@ -115,15 +113,15 @@ namespace { bool m_sensitivesOnly; bool m_dumpConditions; string m_name; - LCDD& m_lcdd; + Detector& m_detDesc; /// Standard constructor - DumpActor(LCDD& l, int flg, bool sens, bool dmp) + DumpActor(Detector& l, int flg, bool sens, bool dmp) : m_detElementPrinter(0,"DDDBDetectors"), m_catalogPrinter(0,"DDDBConditions"), m_alignPrinter(0,"DDDBAlignments"), - m_flag(flg), m_sensitivesOnly(sens), m_dumpConditions(dmp), m_lcdd(l) + m_flag(flg), m_sensitivesOnly(sens), m_dumpConditions(dmp), m_detDesc(l) { - m_manager = ConditionsManager::from(m_lcdd); + m_manager = ConditionsManager::from(m_detDesc); m_slice.reset(new ConditionsSlice(m_manager,shared_ptr<ConditionsContent>(new ConditionsContent()))); m_detElementPrinter.printLevel = s_PrintLevel; m_detElementPrinter.name = "DetElement-Info"; @@ -164,7 +162,7 @@ namespace { } m_counters.reset(); m_allConditions.clear(); - Operators::collectAllConditions(m_lcdd, rc); + Operators::collectAllConditions(m_detDesc, rc); iov.reset().invert(); iov.iovType = 0; for ( Condition cond : rc ) { @@ -176,7 +174,7 @@ namespace { IOV req_iov(iov.iovType, iov.keyData.first); - Conditions::fill_content(m_manager,*m_slice->content,*iov_typ); + cond::fill_content(m_manager,*m_slice->content,*iov_typ); ConditionsManager::Result r = m_manager.prepare(req_iov,*m_slice); // Now compute the tranformation matrices printout(INFO,m_name,"Prepare: Total %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) of IOV %s", @@ -255,7 +253,7 @@ namespace { } /// __________________________________________________________________________________ void printCatalog_ConditionInfo(int level, DetElement de, bool with_elements=false) { - Catalog* cat = de.extension<Catalog>(); + DDDBCatalog* cat = de.extension<DDDBCatalog>(); if ( cat && !cat->conditioninfo.empty() ) { char fmt[128]; ++m_counters.numConditions; @@ -274,7 +272,7 @@ namespace { } } /// __________________________________________________________________________________ - void printCatalog_Alignment(int level, Catalog* cat, bool with_values=false) { + void printCatalog_Alignment(int level, DDDBCatalog* cat, bool with_values=false) { if ( cat && !cat->condition.empty() ) { char fmt[128]; ::sprintf(fmt,"%03d %%-%ds %%-20s -> %%s",level+1,2*level+3); @@ -292,7 +290,7 @@ namespace { /// __________________________________________________________________________________ long dump(DetElement de, int level) { char fmt[64], text[512]; - Catalog* cat = 0; + DDDBCatalog* cat = 0; const DetElement::Children& c = de.children(); ::snprintf(fmt,sizeof(fmt),"%%-%ds-> ",2*level+5); ::snprintf(text,sizeof(text),fmt,""); @@ -305,24 +303,24 @@ namespace { break; case 1: printDetElement(level, de, false, false); - cat = de.extension<Catalog>(); + cat = de.extension<DDDBCatalog>(); printCatalog_Alignment(level, cat, false); printCatalog_ConditionInfo(level, de, false); break; case 2: printDetElement(level, de, true, true); - cat = de.extension<Catalog>(); + cat = de.extension<DDDBCatalog>(); printCatalog_Alignment(level, cat, false); printCatalog_ConditionInfo(level, de, false); break; case 3: printDetElement(level, de, false, false); - cat = de.extension<Catalog>(); + cat = de.extension<DDDBCatalog>(); printCatalog_Alignment(level, cat, true); break; case 4: printDetElement(level, de, true, true); - cat = de.extension<Catalog>(); + cat = de.extension<DDDBCatalog>(); printCatalog_Alignment(level, cat, true); printCatalog_ConditionInfo(level, de, true); break; @@ -331,7 +329,7 @@ namespace { break; case 6: printDetElement(level, de, true, true, true); - cat = de.extension<Catalog>(); + cat = de.extension<DDDBCatalog>(); printCatalog_Alignment(level, cat, true); printCatalog_ConditionInfo(level, de, true); break; @@ -360,7 +358,7 @@ namespace { if ( ::strcmp(argv[i],"-sensitive")==0 ) { dump_sensitive_only = true; } else if ( ::strcmp(argv[i],"-dump")==0 ) { dump_all_cond = true; } else if ( ::strcmp(argv[i],"-print")==0 ) { - s_PrintLevel = DD4hep::printLevel(argv[++i]); + s_PrintLevel = dd4hep::printLevel(argv[++i]); printout(INFO,"DDDB","Setting print level for %s to %s [%d]",__FILE__,argv[i-1],s_PrintLevel); } else if ( ::strcmp(argv[i],"--help")==0 ) { @@ -372,7 +370,7 @@ namespace { return 0; } } - DumpActor actor(lcdd, flag, dump_sensitive_only, dump_all_cond); + DumpActor actor(description, flag, dump_sensitive_only, dump_all_cond); actor.m_name = "DDDBDetectorDump"; if ( flag == 1 ) actor.m_name = "DDDBDetVolumeDump"; @@ -387,11 +385,11 @@ namespace { else if ( flag == 5 ) actor.m_name = "DDDBDetectorDumpAll"; printout(INFO,actor.m_name,"**************** DDDB Detector dump *****************************"); - return actor.init().dump(lcdd.world(), 0); + return actor.init().dump(description.world(), 0); } - template <int flag> long dump_detelement_tree(LCDD& lcdd, int argc, char** argv) - { return dump_det_tree(lcdd,flag,argc,argv); } + template <int flag> long dump_detelement_tree(Detector& description, int argc, char** argv) + { return dump_det_tree(description,flag,argc,argv); } } /* End anonymous namespace */ DECLARE_APPLY(DDDB_DetectorDump,dump_detelement_tree<0>) diff --git a/DDDB/src/plugins/DDDBExecutor.cpp b/DDDB/src/plugins/DDDBExecutor.cpp index c665fd409..5ab0cd89d 100644 --- a/DDDB/src/plugins/DDDBExecutor.cpp +++ b/DDDB/src/plugins/DDDBExecutor.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ #include "DDDB/DDDBHelper.h" #include "DD4hep/Factories.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Path.h" // C/C++ include files @@ -36,8 +36,8 @@ #include "TRint.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::DDDB; +using namespace dd4hep; +using namespace dd4hep::DDDB; static void check_result(long result) { if ( 0 == result ) @@ -57,7 +57,7 @@ static void usage_load_xml_dddb() { " -input <file-name> Directory containing DDDB \n" " -config <plugin> Execute config plugin initializing the helper. \n" " -match <string> Match string for entity resolver e.g.'conddb:' \n" - " -xml <file-name> Parse additional XML files using LCDD. \n" + " -xml <file-name> Parse additional XML files using Detector. \n" " -setup <plugin> Add setup plugin after dddb parsing. \n" " -exec <plugin> Add execution plugin after setup. \n" " -attr <file-name> Optional XML parsing for visualization attrs. \n" @@ -69,12 +69,12 @@ static void usage_load_xml_dddb() { ::exit(EINVAL); } -static long run_plugin(Geometry::LCDD& lcdd, const std::string& plugin, std::vector<char*>& args) { +static long run_plugin(Detector& description, const std::string& plugin, std::vector<char*>& args) { args.push_back(0); - return lcdd.apply(plugin.c_str(), args.size()-1, &args[0]); + return description.apply(plugin.c_str(), args.size()-1, &args[0]); } -static long load_xml_dddb(Geometry::LCDD& lcdd, int argc, char** argv) { +static long load_xml_dddb(Detector& description, int argc, char** argv) { if ( argc > 0 ) { string sys_id, params, match="conddb:", attr="", loader_name="DDDB_FileReader"; std::vector<string> setup, xmlFiles, executors, config; @@ -157,12 +157,12 @@ static long load_xml_dddb(Geometry::LCDD& lcdd, int argc, char** argv) { /// Install helper { - lcdd.apply("DDDB_InstallHelper", 0, 0); + description.apply("DDDB_InstallHelper", 0, 0); } - DDDBHelper* helper = lcdd.extension<DDDBHelper>(); + DDDBHelper* helper = description.extension<DDDBHelper>(); if ( !loader_name.empty() ) { - DDDBReader* resolver = (DDDBReader*)DD4hep::PluginService::Create<void*>(loader_name,(const char*)0); + DDDBReader* resolver = (DDDBReader*)dd4hep::PluginService::Create<void*>(loader_name,(const char*)0); resolver->setMatch(match); resolver->setDirectory(path.parent_path().c_str()); helper->setXmlReader(resolver); @@ -170,13 +170,13 @@ static long load_xml_dddb(Geometry::LCDD& lcdd, int argc, char** argv) { /// Execute config plugins without arguments for(size_t i=0; i<config.size(); ++i) - run_plugin(lcdd, config[i], c_args[config[i]]); + run_plugin(description, config[i], c_args[config[i]]); /// Pre-Process Parameters if ( !params.empty() ) { const void* args[] = {0, params.c_str(), 0}; printout(INFO,"DDDBExecutor","+++ Processing parameters: %s",params.c_str()); - result = lcdd.apply("DDDB_Loader", 2, (char**)args); + result = description.apply("DDDB_Loader", 2, (char**)args); check_result(result); } @@ -184,23 +184,23 @@ static long load_xml_dddb(Geometry::LCDD& lcdd, int argc, char** argv) { if ( !attr.empty() ) { const void* args[] = {attr.c_str(), 0}; printout(INFO,"DDDBExecutor","+++ Processing visualization attributes: %s", attr.c_str()); - result = lcdd.apply("DD4hepXMLLoader", 1, (char**)args); + result = description.apply("dd4hepXMLLoader", 1, (char**)args); check_result(result); } /// Process XML if ( !sys_id.empty() ) { - long long int init_time = makeTime(2016,4,1,12); + long long int init_time = detail::makeTime(2016,4,1,12); const void* args[] = {0, sys_id.c_str(), "/", &init_time, 0}; printout(INFO,"DDDBExecutor","+++ Processing DDDB: %s", sys_id.c_str()); - result = lcdd.apply("DDDB_Loader", 4, (char**)args); + result = description.apply("DDDB_Loader", 4, (char**)args); check_result(result); printout(INFO,"DDDBExecutor"," .... done"); } /// Convert local database to TGeo { - result = lcdd.apply("DDDB_2DD4hep", 0, 0); + result = description.apply("DDDB_2dd4hep", 0, 0); check_result(result); } @@ -208,29 +208,29 @@ static long load_xml_dddb(Geometry::LCDD& lcdd, int argc, char** argv) { if ( !xmlFiles.empty() ) { for(size_t i=0; i<xmlFiles.size(); ++i) { const void* args[] = {xmlFiles[i].c_str(), 0}; - lcdd.apply("DD4hepXMLLoader", 1, (char**)args); + description.apply("dd4hepXMLLoader", 1, (char**)args); } } /// Execute further setup plugins without arguments for(size_t i=0; i<setup.size(); ++i) - run_plugin(lcdd, setup[i], s_args[setup[i]]); + run_plugin(description, setup[i], s_args[setup[i]]); /// Call executors for(size_t i=0; i<executors.size(); ++i) - run_plugin(lcdd, executors[i], e_args[executors[i]]); + run_plugin(description, executors[i], e_args[executors[i]]); if ( dump ) { printout(INFO,"DDDBExecutor","------------------> Conditions dump:"); - lcdd.apply("DDDB_DetectorConditionDump", 0, 0); + description.apply("DDDB_DetectorConditionDump", 0, 0); } if ( visualize ) { /// Fire off display pair<int, char**> a(0,0); TRint app("DDDB", &a.first, a.second); - TGeoManager& mgr = lcdd.manager(); + TGeoManager& mgr = description.manager(); mgr.SetVisLevel(999); mgr.SetVisOption(1); - lcdd.worldVolume()->Draw("ogl"); + description.worldVolume()->Draw("ogl"); app.Run(); } } diff --git a/DDDB/src/plugins/DDDBFileReader.cpp b/DDDB/src/plugins/DDDBFileReader.cpp index c2c793b43..0c3a351ba 100644 --- a/DDDB/src/plugins/DDDBFileReader.cpp +++ b/DDDB/src/plugins/DDDBFileReader.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,12 +21,12 @@ #include "DDDB/DDDBReader.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace of the DDDB conversion stuff namespace DDDB { - /// Class supporting the interface of the LHCb conditions database to DD4hep + /// Class supporting the interface of the LHCb conditions database to dd4hep /** * * \author M.Frank @@ -48,14 +48,14 @@ namespace DD4hep { }; } /* End namespace DDDB */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ //========================================================================== // Framework includes #include "DD4hep/Factories.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // C/C++ include files #include <sys/types.h> @@ -63,7 +63,7 @@ namespace DD4hep { #include <unistd.h> #include <fcntl.h> -int DD4hep::DDDB::DDDBFileReader::getObject(const std::string& system_id, +int dd4hep::DDDB::DDDBFileReader::getObject(const std::string& system_id, UserContext* /* ctxt */, std::string& buffer) { @@ -95,12 +95,12 @@ int DD4hep::DDDB::DDDBFileReader::getObject(const std::string& system_id, } /// Resolve a given URI to a string containing the data -bool DD4hep::DDDB::DDDBFileReader::load(const std::string& system_id, std::string& buffer) { - return XML::UriReader::load(system_id, buffer); +bool dd4hep::DDDB::DDDBFileReader::load(const std::string& system_id, std::string& buffer) { + return xml::UriReader::load(system_id, buffer); } /// Resolve a given URI to a string containing the data -bool DD4hep::DDDB::DDDBFileReader::load(const std::string& system_id, +bool dd4hep::DDDB::DDDBFileReader::load(const std::string& system_id, UserContext* ctxt, std::string& buffer) { @@ -115,7 +115,7 @@ bool DD4hep::DDDB::DDDBFileReader::load(const std::string& system_id, namespace { void* create_dddb_xml_file_reader(const char* /* arg */) { - return new DD4hep::DDDB::DDDBFileReader(); + return new dd4hep::DDDB::DDDBFileReader(); } } DECLARE_CONSTRUCTOR(DDDB_FileReader,create_dddb_xml_file_reader) diff --git a/DDDB/src/plugins/DDDBLogVolumeDump.cpp b/DDDB/src/plugins/DDDBLogVolumeDump.cpp index de7c7c0ef..5a5d6e855 100644 --- a/DDDB/src/plugins/DDDBLogVolumeDump.cpp +++ b/DDDB/src/plugins/DDDBLogVolumeDump.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,15 +18,15 @@ //========================================================================== // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" #include "DD4hep/Factories.h" #include "DD4hep/detail/DetectorInterna.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; /// Anonymous namespace for plugins namespace { @@ -55,9 +55,9 @@ namespace { }; /// Plugin function - long dddb_dump_logical_volumes(LCDD& lcdd, int , char** ) { + long dddb_dump_logical_volumes(Detector& description, int , char** ) { VolumeScan scan; - Volume world_vol = lcdd.worldVolume(); + Volume world_vol = description.worldVolume(); int count = scan.scan_daughters(world_vol,string()); printout(INFO,"DDDB_vol_dump","Found %d unique logical volumes.",count); return 1; diff --git a/DDDB/src/plugins/DDDBPlugins.cpp b/DDDB/src/plugins/DDDBPlugins.cpp index 462385774..f80f16f02 100644 --- a/DDDB/src/plugins/DDDBPlugins.cpp +++ b/DDDB/src/plugins/DDDBPlugins.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,16 +18,16 @@ //========================================================================== // Framework includes -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/Factories.h" #include "DDDB/DDDBConditionsLoader.h" -using namespace DD4hep; +using namespace dd4hep; //========================================================================== /// Plugin function -static long dddb_dump_conditions(Geometry::LCDD& lcdd, int argc, char** argv) { +static long dddb_dump_conditions(Detector& description, int argc, char** argv) { const char* prt_level = "INFO"; for(int i=0; i<argc; ++i) { if ( ::strcmp(argv[i],"--print")==0 ) { @@ -35,35 +35,34 @@ static long dddb_dump_conditions(Geometry::LCDD& lcdd, int argc, char** argv) { printout(INFO,"DDDB","Setting conditions print level to %s",prt_level); } } - const void* args[] = { "-processor", "DD4hep_ConditionsPrinter", + const void* args[] = { "-processor", "dd4hep_ConditionsPrinter", "-name", "DDDB", "-prefix", "DDDB", "-print", prt_level, "-end-processor", 0}; - lcdd.apply("DD4hep_ConditionsDump", 9, (char**)args); + description.apply("dd4hep_ConditionsDump", 9, (char**)args); return 1; } DECLARE_APPLY(DDDB_ConditionsDump,dddb_dump_conditions) //========================================================================== /// Plugin function -static long dddb_dump_conditions_summary(Geometry::LCDD& lcdd, int , char** ) { - const void* args[] = { "-processor", "DD4hep_ConditionsPrinter", +static long dddb_dump_conditions_summary(Detector& description, int , char** ) { + const void* args[] = { "-processor", "dd4hep_ConditionsPrinter", "-name", "DDDB", "-prefix", "DDDB", "-print", "DEBUG", "-end-processor", 0}; - lcdd.apply("DD4hep_ConditionsDump", 9, (char**)args); + description.apply("dd4hep_ConditionsDump", 9, (char**)args); return 1; } DECLARE_APPLY(DDDB_ConditionsSummary,dddb_dump_conditions_summary) //========================================================================== /// Plugin function -static void* create_dddb_loader(Geometry::LCDD& lcdd, int argc, char** argv) { - using Conditions::ConditionsManagerObject; +static void* create_dddb_loader(Detector& description, int argc, char** argv) { const char* name = argc>0 ? argv[0] : "DDDBLoader"; - ConditionsManagerObject* m = (ConditionsManagerObject*)(argc>0 ? argv[1] : 0); - return new DDDB::DDDBConditionsLoader(lcdd,m,name); + cond::ConditionsManagerObject* m = (cond::ConditionsManagerObject*)(argc>0 ? argv[1] : 0); + return new DDDB::DDDBConditionsLoader(description,m,name); } -DECLARE_LCDD_CONSTRUCTOR(DD4hep_Conditions_dddb_Loader,create_dddb_loader) +DECLARE_Detector_CONSTRUCTOR(dd4hep_Conditions_dddb_Loader,create_dddb_loader) diff --git a/DDDB/src/plugins/DDDBvis.cpp b/DDDB/src/plugins/DDDBvis.cpp index 9701dfffc..d97afdba4 100644 --- a/DDDB/src/plugins/DDDBvis.cpp +++ b/DDDB/src/plugins/DDDBvis.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,14 +26,11 @@ #include <set> using namespace std; -using namespace DD4hep; -using namespace DD4hep::DDDB; -using DD4hep::Geometry::LCDD; -using DD4hep::Geometry::VisAttr; - +using namespace dd4hep; +using namespace dd4hep::DDDB; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Keep all in here anonymous. Does not have to be visible outside. namespace { @@ -49,7 +46,7 @@ namespace DD4hep { template <> void Converter<volume>::operator()(xml_h element) const; template <> void Converter<include>::operator()(xml_h element) const; - /** Convert compact visualization attribute to LCDD visualization attribute + /** Convert compact visualization attribute to Detector visualization attribute * * <vis name="SiVertexBarrelModuleVis" * alpha="1.0" r="1.0" g="0.75" b="0.76" @@ -59,12 +56,12 @@ namespace DD4hep { */ template <> void Converter<vis>::operator()(xml_h e) const { VisAttr attr(e.attr<string>(_U(name))); - float r = e.hasAttr(_U(r)) ? e.attr<float>(_U(r)) : 1.0f; - float g = e.hasAttr(_U(g)) ? e.attr<float>(_U(g)) : 1.0f; - float b = e.hasAttr(_U(b)) ? e.attr<float>(_U(b)) : 1.0f; + float red = e.hasAttr(_U(r)) ? e.attr<float>(_U(r)) : 1.0f; + float green = e.hasAttr(_U(g)) ? e.attr<float>(_U(g)) : 1.0f; + float blue = e.hasAttr(_U(b)) ? e.attr<float>(_U(b)) : 1.0f; printout(DEBUG, "Compact", "++ Converting VisAttr structure: %s.",attr.name()); - attr.setColor(r, g, b); + attr.setColor(red, green, blue); if (e.hasAttr(_U(alpha))) attr.setAlpha(e.attr<float>(_U(alpha))); if (e.hasAttr(_U(visible))) @@ -93,22 +90,22 @@ namespace DD4hep { attr.setShowDaughters(e.attr<bool>(_U(showDaughters))); else attr.setShowDaughters(true); - lcdd.addVisAttribute(attr); + description.addVisAttribute(attr); } template <> void Converter<include>::operator()(xml_h e) const { - XML::DocumentHolder doc(XML::DocumentHandler().load(e, e.attr_value(_U(ref)))); + xml::DocumentHolder doc(xml::DocumentHandler().load(e, e.attr_value(_U(ref)))); xml_h node = doc.root(); string tag = node.tag(); if ( tag == "display" ) - xml_coll_t(node,_U(vis)).for_each(Converter<vis>(this->lcdd,param)); + xml_coll_t(node,_U(vis)).for_each(Converter<vis>(this->description,param)); else if ( tag == "vismapping" ) - xml_coll_t(node,_U(volume)).for_each(Converter<volume>(this->lcdd,param)); + xml_coll_t(node,_U(volume)).for_each(Converter<volume>(this->description,param)); else if ( tag == "DDDB_VIS" ) - Converter<dddb_vis>(lcdd,param)(node); + Converter<dddb_vis>(description,param)(node); else if ( tag == "dddb_vis" ) - Converter<dddb_vis>(lcdd,param)(node); + Converter<dddb_vis>(description,param)(node); } template <> void Converter<volume>::operator()(xml_h e) const { @@ -120,19 +117,19 @@ namespace DD4hep { } template <> void Converter<dddb_vis>::operator()(xml_h e) const { - xml_coll_t(e, _U(include)).for_each( Converter<include>(lcdd,param)); - xml_coll_t(e, _U(display)).for_each(_U(include), Converter<include>(lcdd,param)); - xml_coll_t(e, _LBU(vismapping)).for_each(_U(include), Converter<include>(lcdd,param)); - xml_coll_t(e, _U(display)).for_each(_U(vis), Converter<vis> (lcdd,param)); - xml_coll_t(e, _LBU(vismapping)).for_each(_U(volume), Converter<volume> (lcdd,param)); + xml_coll_t(e, _U(include)).for_each( Converter<include>(description,param)); + xml_coll_t(e, _U(display)).for_each(_U(include), Converter<include>(description,param)); + xml_coll_t(e, _LBU(vismapping)).for_each(_U(include), Converter<include>(description,param)); + xml_coll_t(e, _U(display)).for_each(_U(vis), Converter<vis> (description,param)); + xml_coll_t(e, _LBU(vismapping)).for_each(_U(volume), Converter<volume> (description,param)); } } /// Plugin entry point. -static long load_dddb_vis(lcdd_t& lcdd, xml_h element) { - DDDBHelper* helper = lcdd.extension<DDDBHelper>(false); +static long load_dddb_vis(Detector& description, xml_h element) { + DDDBHelper* helper = description.extension<DDDBHelper>(false); if ( helper ) { - DD4hep::Converter<dddb_vis> cnv(lcdd,helper); + dd4hep::Converter<dddb_vis> cnv(description,helper); cnv(element); return 1; } diff --git a/DDDetectors/CMakeLists.txt b/DDDetectors/CMakeLists.txt index c0e0c65af..fa491430c 100644 --- a/DDDetectors/CMakeLists.txt +++ b/DDDetectors/CMakeLists.txt @@ -1,7 +1,7 @@ #========================================================================== # $Id: $ # -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/DDDetectors/compact/SiD/SiD_Beamcal.xml b/DDDetectors/compact/SiD/SiD_Beamcal.xml index 11e9ca212..6048f91b2 100644 --- a/DDDetectors/compact/SiD/SiD_Beamcal.xml +++ b/DDDetectors/compact/SiD/SiD_Beamcal.xml @@ -37,7 +37,7 @@ <!-- Includes for sensitives and support --> <detectors> - <detector id="14" name="BeamCal" reflect="true" type="DD4hep_ForwardDetector" readout="BeamCalHits" vis="BeamCalVis" calorimeterType="BEAM"> + <detector id="14" name="BeamCal" reflect="true" type="dd4hep_ForwardDetector" readout="BeamCalHits" vis="BeamCalVis" calorimeterType="BEAM"> <comment>Beam Calorimeter</comment> diff --git a/DDDetectors/compact/SiD/SiD_Beampipe.xml b/DDDetectors/compact/SiD/SiD_Beampipe.xml index 08cb8a97d..dc6df5193 100644 --- a/DDDetectors/compact/SiD/SiD_Beampipe.xml +++ b/DDDetectors/compact/SiD/SiD_Beampipe.xml @@ -30,7 +30,7 @@ <detectors> <comment>Beampipe</comment> - <detector name="Beampipe" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> + <detector name="Beampipe" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> <comment>Central Be Beampipe</comment> @@ -39,7 +39,7 @@ <zplane rmin="CentralBeamPipe_rmin" rmax="CentralBeamPipe_rmax" z="CentralBeamPipe_zmax" /> </detector> - <detector name="SteelConeZbackward" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> + <detector name="SteelConeZbackward" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> <material name="Iron"/> <zplane rmin="BeamPipe_rmax - BeamPipe_thickness" rmax="BeamPipe_rmax" @@ -52,7 +52,7 @@ z="-CentralBeamPipe_zmax"/> </detector> - <detector name="SteelConeZbackward2" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="BeamPipeVis"> + <detector name="SteelConeZbackward2" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="BeamPipeVis"> <material name="Iron"/> <zplane rmin="BeamPipe_rmax - BeamPipe_thickness" rmax="BeamPipe_rmax" @@ -71,7 +71,7 @@ z="- (ForwardMask_zmin - BeamPipe_endThickness)" /> </detector> - <detector name="SteelConeZforward" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> + <detector name="SteelConeZforward" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> <material name="Iron"/> <zplane rmin="CentralBeamPipe_rmin" rmax="CentralBeamPipe_rmax" @@ -84,7 +84,7 @@ z="tracking_region_zmax" /> </detector> - <detector name="SteelConeZforward2" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="BeamPipeVis"> + <detector name="SteelConeZforward2" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="BeamPipeVis"> <material name="Iron"/> <zplane rmin="BeamPipe_rmax - BeamPipe_thickness" rmax="BeamPipe_rmax" @@ -103,7 +103,7 @@ z="ForwardMask_zmin - BeamPipe_endThickness" /> </detector> - <detector name="NorthIncomingBeampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> + <detector name="NorthIncomingBeampipe" type="dd4hep_TubeSegment" vis="BeamPipeVis"> <material name="Iron" /> <tubs rmin="IncomingBP_radius - IncomingBP_thickness" rmax="IncomingBP_radius" zhalf="(MuonEndcap_zmax - ForwardMask_zmin)/2.0" /> <position x="-((ForwardMask_zmin + MuonEndcap_zmax)/2.0*tan(CrossingAngle/rad)/2.0)" y="0" z="(ForwardMask_zmin + MuonEndcap_zmax)/2.0" /> @@ -111,21 +111,21 @@ </detector> - <detector name="SouthIncomingBeampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> + <detector name="SouthIncomingBeampipe" type="dd4hep_TubeSegment" vis="BeamPipeVis"> <material name="Iron" /> <tubs rmin="IncomingBP_radius - IncomingBP_thickness" rmax="IncomingBP_radius" zhalf="(MuonEndcap_zmax - ForwardMask_zmin)/2.0" /> <position x="-((ForwardMask_zmin + MuonEndcap_zmax)/2.0*tan(CrossingAngle/rad)/2.0)" y="0" z="- (ForwardMask_zmin + MuonEndcap_zmax)/2.0" /> <rotation x="0.0" y="-CrossingAngle/2.0/rad" z="0.0" /> </detector> - <detector name="NorthOutgoingBeampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> + <detector name="NorthOutgoingBeampipe" type="dd4hep_TubeSegment" vis="BeamPipeVis"> <material name="Iron" /> <tubs rmin="OutgoingBP_radius - OutgoingBP_thickness" rmax="OutgoingBP_radius" zhalf="(MuonEndcap_zmax - ForwardMask_zmin)/2.0" /> <position x="((ForwardMask_zmin + MuonEndcap_zmax)/2.0*tan(CrossingAngle/rad)/2.0)" y="0" z="(ForwardMask_zmin + MuonEndcap_zmax)/2.0" /> <rotation x="0.0" y="-CrossingAngle/2.0/rad" z="0.0" /> </detector> - <detector name="SouthOutgoingBeampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> + <detector name="SouthOutgoingBeampipe" type="dd4hep_TubeSegment" vis="BeamPipeVis"> <material name="Iron" /> <tubs rmin="OutgoingBP_radius - OutgoingBP_thickness" rmax="OutgoingBP_radius" zhalf="(MuonEndcap_zmax - ForwardMask_zmin)/2.0" /> <position x="((ForwardMask_zmin + MuonEndcap_zmax)/2.0*tan(CrossingAngle/rad)/2.0)" y="0" z="- (ForwardMask_zmin + MuonEndcap_zmax)/2.0" /> @@ -133,7 +133,7 @@ </detector> <!-- Beam pipe liner is not needed, use thicker conical steel pipe instead - <detector name="BeamPipeLiner" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="InvisibleNoDaughters"> + <detector name="BeamPipeLiner" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="InvisibleNoDaughters"> <comment>BeamPipe Liner to shield bremsstrahlung photons</comment> <material name="Titanium"/> <zplane rmin="(tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax - BeamPipe_thickness - BeamPipeLiner_thickness" rmax="(tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax - BeamPipe_thickness" z="-tracking_region_zmax" /> @@ -145,7 +145,7 @@ </detector> --> - <detector name="BeamPipeVacuum" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="InvisibleNoDaughters"> + <detector name="BeamPipeVacuum" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="InvisibleNoDaughters"> <comment>Vacuum inside beampipe</comment> @@ -164,7 +164,7 @@ z="tracking_region_zmax" /> </detector> - <detector name="ForwardVacuum" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="InvisibleNoDaughters"> + <detector name="ForwardVacuum" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="InvisibleNoDaughters"> <material name="Vacuum"/> <zplane rmin="0.*cm" rmax="BeamPipe_rmax - BeamPipe_thickness" @@ -183,7 +183,7 @@ z="ForwardMask_zmin - BeamPipe_endThickness" /> </detector> - <detector name="BackwardVacuum" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="InvisibleNoDaughters"> + <detector name="BackwardVacuum" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="InvisibleNoDaughters"> <material name="Vacuum"/> <zplane rmin="0.*cm" rmax="BeamPipe_rmax - BeamPipe_thickness" diff --git a/DDDetectors/compact/SiD/SiD_EcalBarrel.xml b/DDDetectors/compact/SiD/SiD_EcalBarrel.xml index 1b0c54865..288d11de1 100644 --- a/DDDetectors/compact/SiD/SiD_EcalBarrel.xml +++ b/DDDetectors/compact/SiD/SiD_EcalBarrel.xml @@ -6,7 +6,7 @@ <!-- ====================================================================== --> <detectors> - <detector id="EcalBarrel_ID" name="EcalBarrel" type="DD4hep_EcalBarrel" readout="EcalBarrelHits" vis="EcalBarrelVis" calorimeterType="EM_BARREL"> + <detector id="EcalBarrel_ID" name="EcalBarrel" type="dd4hep_EcalBarrel" readout="EcalBarrelHits" vis="EcalBarrelVis" calorimeterType="EM_BARREL"> <comment>Electromagnetic Calorimeter Barrel</comment> diff --git a/DDDetectors/compact/SiD/SiD_EcalEndcap.xml b/DDDetectors/compact/SiD/SiD_EcalEndcap.xml index 362cf46fd..235b3a73e 100644 --- a/DDDetectors/compact/SiD/SiD_EcalEndcap.xml +++ b/DDDetectors/compact/SiD/SiD_EcalEndcap.xml @@ -6,7 +6,7 @@ <!-- ====================================================================== --> <detectors> - <detector id="EcalEndcap_ID" name="EcalEndcap" type="DD4hep_PolyhedraEndcapCalorimeter2" reflect="true" readout="EcalEndcapHits" vis="EcalEndcapVis" calorimeterType="EM_ENDCAP"> + <detector id="EcalEndcap_ID" name="EcalEndcap" type="dd4hep_PolyhedraEndcapCalorimeter2" reflect="true" readout="EcalEndcapHits" vis="EcalEndcapVis" calorimeterType="EM_ENDCAP"> <comment>Electromagnetic Calorimeter Endcaps</comment> diff --git a/DDDetectors/compact/SiD/SiD_HcalBarrel.xml b/DDDetectors/compact/SiD/SiD_HcalBarrel.xml index 8dce6fc71..4c0d55e1b 100644 --- a/DDDetectors/compact/SiD/SiD_HcalBarrel.xml +++ b/DDDetectors/compact/SiD/SiD_HcalBarrel.xml @@ -6,7 +6,7 @@ <!-- ====================================================================== --> <detectors> - <detector id="HcalBarrel_ID" name="HcalBarrel" type="DD4hep_PolyhedraBarrelCalorimeter2" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="0.*cm" material="Steel235"> + <detector id="HcalBarrel_ID" name="HcalBarrel" type="dd4hep_PolyhedraBarrelCalorimeter2" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="0.*cm" material="Steel235"> <comment>Hadron Calorimeter Barrel</comment> diff --git a/DDDetectors/compact/SiD/SiD_HcalEndcap.xml b/DDDetectors/compact/SiD/SiD_HcalEndcap.xml index ec64195ee..7f8b89986 100644 --- a/DDDetectors/compact/SiD/SiD_HcalEndcap.xml +++ b/DDDetectors/compact/SiD/SiD_HcalEndcap.xml @@ -6,7 +6,7 @@ <!-- ====================================================================== --> <detectors> - <detector id="9" name="HcalEndcap" type="DD4hep_PolyhedraEndcapCalorimeter2" readout="HcalEndcapHits" vis="HcalEndcapVis" calorimeterType="HAD_ENDCAP"> + <detector id="9" name="HcalEndcap" type="dd4hep_PolyhedraEndcapCalorimeter2" readout="HcalEndcapHits" vis="HcalEndcapVis" calorimeterType="HAD_ENDCAP"> <comment>Hadron Calorimeter Endcaps</comment> diff --git a/DDDetectors/compact/SiD/SiD_HcalPlug.xml b/DDDetectors/compact/SiD/SiD_HcalPlug.xml index 02378e4e0..5808ceaa4 100644 --- a/DDDetectors/compact/SiD/SiD_HcalPlug.xml +++ b/DDDetectors/compact/SiD/SiD_HcalPlug.xml @@ -6,7 +6,7 @@ <!-- ====================================================================== --> <detectors> - <detector id="HcalPlug_ID" name="HcalPlug" type="DD4hep_PolyhedraEndcapCalorimeter2" readout="HcalPlugHits" vis="MuonEndcapVis"> + <detector id="HcalPlug_ID" name="HcalPlug" type="dd4hep_PolyhedraEndcapCalorimeter2" readout="HcalPlugHits" vis="MuonEndcapVis"> <comment>Hadron Calorimeter Plug</comment> diff --git a/DDDetectors/compact/SiD/SiD_Lumical.xml b/DDDetectors/compact/SiD/SiD_Lumical.xml index a295fd404..89234839a 100644 --- a/DDDetectors/compact/SiD/SiD_Lumical.xml +++ b/DDDetectors/compact/SiD/SiD_Lumical.xml @@ -37,7 +37,7 @@ <!-- Includes for sensitives and support --> <detectors> - <detector id="13" name="LumiCal" reflect="true" type="DD4hep_CylindricalEndcapCalorimeter" readout="LumiCalHits" vis="LumiCalVis" calorimeterType="LUMI"> + <detector id="13" name="LumiCal" reflect="true" type="dd4hep_CylindricalEndcapCalorimeter" readout="LumiCalHits" vis="LumiCalVis" calorimeterType="LUMI"> <comment>Luminosity Calorimeter</comment> @@ -58,14 +58,14 @@ </layer> </detector> - <detector name="LumiReadout_Forward" type="DD4hep_PolyconeSupport" vis="LumiCalVis"> + <detector name="LumiReadout_Forward" type="dd4hep_PolyconeSupport" vis="LumiCalVis"> <comment>Readout for Luminosity Calorimeter</comment> <material name="G10"/> <zplane rmin="LumiCal_rmax" rmax="LumiCalElectronics_rmax" z="LumiCal_zmin"/> <zplane rmin="LumiCal_rmax" rmax="LumiCalElectronics_rmax" z="LumiCal_zmin+LumiCal_thickness"/> </detector> - <detector name="LumiReadout_Backward" type="DD4hep_PolyconeSupport" vis="LumiCalVis"> + <detector name="LumiReadout_Backward" type="dd4hep_PolyconeSupport" vis="LumiCalVis"> <comment>Readout for Luminosity Calorimeter</comment> <material name="G10"/> <zplane rmin="LumiCal_rmax" rmax="LumiCalElectronics_rmax" z="-LumiCal_zmin"/> diff --git a/DDDetectors/compact/SiD/SiD_MuonBarrel.xml b/DDDetectors/compact/SiD/SiD_MuonBarrel.xml index 76e683e25..b0c242bc7 100644 --- a/DDDetectors/compact/SiD/SiD_MuonBarrel.xml +++ b/DDDetectors/compact/SiD/SiD_MuonBarrel.xml @@ -6,7 +6,7 @@ <!-- ====================================================================== --> <detectors> - <detector id="MuonBarrel_ID" name="MuonBarrel" type="DD4hep_PolyhedraBarrelCalorimeter2" readout="MuonBarrelHits" vis="MuonBarrelVis" calorimeterType="MUON_BARREL" gap="0.*cm" material="Steel235"> + <detector id="MuonBarrel_ID" name="MuonBarrel" type="dd4hep_PolyhedraBarrelCalorimeter2" readout="MuonBarrelHits" vis="MuonBarrelVis" calorimeterType="MUON_BARREL" gap="0.*cm" material="Steel235"> <comment>Muon Calorimeter Barrel</comment> diff --git a/DDDetectors/compact/SiD/SiD_MuonEndcap.xml b/DDDetectors/compact/SiD/SiD_MuonEndcap.xml index 73baced9c..ec1f2b87c 100644 --- a/DDDetectors/compact/SiD/SiD_MuonEndcap.xml +++ b/DDDetectors/compact/SiD/SiD_MuonEndcap.xml @@ -6,7 +6,7 @@ <!-- ====================================================================== --> <detectors> - <detector id="MuonEndcap_ID" name="MuonEndcap" type="DD4hep_PolyhedraEndcapCalorimeter2" readout="MuonEndcapHits" reflect="true" vis="MuonEndcapVis" calorimeterType="MUON_ENDCAP"> + <detector id="MuonEndcap_ID" name="MuonEndcap" type="dd4hep_PolyhedraEndcapCalorimeter2" readout="MuonEndcapHits" reflect="true" vis="MuonEndcapVis" calorimeterType="MUON_ENDCAP"> <comment>Muon Calorimeter Endcaps</comment> diff --git a/DDDetectors/compact/SiD/SiD_Shields.xml b/DDDetectors/compact/SiD/SiD_Shields.xml index c7a7c9fc0..b4a201b90 100644 --- a/DDDetectors/compact/SiD/SiD_Shields.xml +++ b/DDDetectors/compact/SiD/SiD_Shields.xml @@ -32,28 +32,28 @@ <comment>Masks and Shielding</comment> - <detector name="LumiShielding_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="LumiShielding_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="LumiCal_rmin" rmax="LumiCalElectronics_rmax" z="LumiCal_zmax"/> <zplane rmin="LumiCal_rmin" rmax="LumiCalElectronics_rmax" z="LumiCal_zmax+ForwardShielding_thickness"/> </detector> - <detector name="LumiShielding_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="LumiShielding_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="LumiCal_rmin" rmax="LumiCalElectronics_rmax" z="-LumiCal_zmax"/> <zplane rmin="LumiCal_rmin" rmax="LumiCalElectronics_rmax" z="-(LumiCal_zmax+ForwardShielding_thickness)"/> </detector> - <detector name="ECalShielding_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="ECalShielding_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="LumiCalElectronics_rmax" rmax="HcalEndcap_rmin-SupportTube_thickness-1.0*cm" z="HcalEndcap_zmin"/> <zplane rmin="LumiCalElectronics_rmax" rmax="HcalEndcap_rmin-SupportTube_thickness-1.0*cm" z="HcalEndcap_zmin+ForwardShielding_thickness"/> </detector> - <detector name="ECalShielding_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="ECalShielding_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="LumiCalElectronics_rmax" rmax="HcalEndcap_rmin-SupportTube_thickness-1.0*cm" z="-HcalEndcap_zmin"/> <zplane rmin="LumiCalElectronics_rmax" rmax="HcalEndcap_rmin-SupportTube_thickness-1.0*cm" z="-(HcalEndcap_zmin+ForwardShielding_thickness)"/> </detector> - <detector name="ShieldingTube_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="ShieldingTube_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="HcalEndcap_rmin - SupportTube_thickness - ForwardShielding_thickness - 1.0*cm" rmax="HcalEndcap_rmin - SupportTube_thickness - 1.0*cm" @@ -63,7 +63,7 @@ z="HcalEndcap_zmax"/> </detector> - <detector name="ShieldingTube_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="ShieldingTube_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="HcalEndcap_rmin - SupportTube_thickness - ForwardShielding_thickness - 1.0*cm" rmax="HcalEndcap_rmin - SupportTube_thickness - 1.0*cm" @@ -73,7 +73,7 @@ z="-HcalEndcap_zmax"/> </detector> - <detector name="SupportTube_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="SupportTubeVis"> + <detector name="SupportTube_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="SupportTubeVis"> <material name="Steel235" /> <zplane rmin="HcalEndcap_rmin - 2*SupportTube_thickness" rmax="HcalEndcap_rmin - SupportTube_thickness" @@ -83,7 +83,7 @@ z="MuonEndcap_zmax"/> </detector> - <detector name="SupportTube_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="SupportTubeVis"> + <detector name="SupportTube_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="SupportTubeVis"> <material name="Steel235" /> <zplane rmin="HcalEndcap_rmin - 2*SupportTube_thickness" rmax="HcalEndcap_rmin - SupportTube_thickness" @@ -93,7 +93,7 @@ z="-MuonEndcap_zmax"/> </detector> - <detector name="ForwardLowZ" type="DD4hep_ForwardDetector" vis="TungstenShieldingVis" reflect="true"> + <detector name="ForwardLowZ" type="dd4hep_ForwardDetector" vis="TungstenShieldingVis" reflect="true"> <dimensions outer_r="BeamCal_rmax" inner_r="0.0*cm" inner_z="ForwardMask_zmin" /> <beampipe crossing_angle="CrossingAngle" outgoing_r="OutgoingBP_radius + 0.05*cm" incoming_r="IncomingBP_radius + 0.05*cm" /> <layer repeat="1"> diff --git a/DDDetectors/compact/SiD/SiD_Solenoid.xml b/DDDetectors/compact/SiD/SiD_Solenoid.xml index a83610865..869ec5104 100644 --- a/DDDetectors/compact/SiD/SiD_Solenoid.xml +++ b/DDDetectors/compact/SiD/SiD_Solenoid.xml @@ -31,7 +31,7 @@ <comment>Solenoid</comment> - <detector name="SolenoidCoilBarrel" type="DD4hep_MultiLayerTracker" insideTrackingVolume="false" reflect="true"> + <detector name="SolenoidCoilBarrel" type="dd4hep_MultiLayerTracker" insideTrackingVolume="false" reflect="true"> <layer id="1" inner_r="SolenoidBarrelInnerRadius" outer_z="SolenoidBarrelOuterZ" vis="SolenoidBarrelLayerVis"> <slice material="Steel235" thickness="SolenoidBarrelInnerCryostatThickness" /> <slice material="Vacuum" thickness="SolenoidBarrelInnerAirgapThickness" /> @@ -46,13 +46,13 @@ </layer> </detector> - <detector name="SolenoidCoilEnds" type="DD4hep_DiskTracker" reflect="true" insideTrackingVolume="false"> + <detector name="SolenoidCoilEnds" type="dd4hep_DiskTracker" reflect="true" insideTrackingVolume="false"> <layer id="1" inner_r="SolenoidBarrelInnerRadius" inner_z="SolenoidBarrelOuterZ" outer_r="SolenoidBarrelOuterRadius" vis="SolenoidCoilEndsVis"> <slice material="Steel235" thickness="SolenoidEndcapCryostatThickness" /> </layer> </detector> - <detector name="AntiSolenoid_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="AntiSolenoidVis"> + <detector name="AntiSolenoid_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="AntiSolenoidVis"> <material name="Steel235" /> <zplane rmin="HcalEndcap_rmin + 1.0*cm" rmax="MuonEndcap_rmin - 1.0*cm" @@ -61,7 +61,7 @@ rmax="MuonEndcap_rmin - 1.0*cm" z="MuonEndcap_zmax"/> </detector> - <detector name="AntiSolenoid_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="AntiSolenoidVis"> + <detector name="AntiSolenoid_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="AntiSolenoidVis"> <material name="Steel235" /> <zplane rmin="HcalEndcap_rmin + 1.0*cm" rmax="MuonEndcap_rmin - 1.0*cm" diff --git a/DDDetectors/compact/SiD/SiD_TrackerBarrel.xml b/DDDetectors/compact/SiD/SiD_TrackerBarrel.xml index 38d8e6883..be87354b1 100644 --- a/DDDetectors/compact/SiD/SiD_TrackerBarrel.xml +++ b/DDDetectors/compact/SiD/SiD_TrackerBarrel.xml @@ -6,7 +6,7 @@ <!-- ==================================================================== --> <detectors> - <detector id="SiTrackerBarrel_ID" name="SiTrackerBarrel" type="DD4hep_SiTrackerBarrel" readout="SiTrackerBarrelHits" region="SiTrackerBarrelRegion" limits="SiTrackerBarrelRegionLimitSet"> + <detector id="SiTrackerBarrel_ID" name="SiTrackerBarrel" type="dd4hep_SiTrackerBarrel" readout="SiTrackerBarrelHits" region="SiTrackerBarrelRegion" limits="SiTrackerBarrelRegionLimitSet"> <comment>Silicon Outer Tracker Barrel</comment> diff --git a/DDDetectors/compact/SiD/SiD_TrackerEndcap.xml b/DDDetectors/compact/SiD/SiD_TrackerEndcap.xml index 14a5138e5..48ad712dd 100644 --- a/DDDetectors/compact/SiD/SiD_TrackerEndcap.xml +++ b/DDDetectors/compact/SiD/SiD_TrackerEndcap.xml @@ -6,7 +6,7 @@ <!-- ==================================================================== --> <detectors> - <detector id="SiTrackerEndcap_ID" name="SiTrackerEndcap" type="DD4hep_SiTrackerEndcap2" readout="SiTrackerEndcapHits" reflect="true"> + <detector id="SiTrackerEndcap_ID" name="SiTrackerEndcap" type="dd4hep_SiTrackerEndcap2" readout="SiTrackerEndcapHits" reflect="true"> <comment>Silicon Outer Tracker Endcaps</comment> diff --git a/DDDetectors/compact/SiD/SiD_TrackerForward.xml b/DDDetectors/compact/SiD/SiD_TrackerForward.xml index bed9d1d37..b9c405fde 100644 --- a/DDDetectors/compact/SiD/SiD_TrackerForward.xml +++ b/DDDetectors/compact/SiD/SiD_TrackerForward.xml @@ -6,7 +6,7 @@ <!-- ==================================================================== --> <detectors> - <detector id="ForwardTracker_ID" name="SiTrackerForward" type="DD4hep_SiTrackerEndcap2" readout="SiTrackerForwardHits" reflect="true"> + <detector id="ForwardTracker_ID" name="SiTrackerForward" type="dd4hep_SiTrackerEndcap2" readout="SiTrackerForwardHits" reflect="true"> <comment>Forward Tracker inside Vertex Support Barrel</comment> diff --git a/DDDetectors/compact/SiD/SiD_TrackerSupport.xml b/DDDetectors/compact/SiD/SiD_TrackerSupport.xml index 61e921058..ba8544517 100644 --- a/DDDetectors/compact/SiD/SiD_TrackerSupport.xml +++ b/DDDetectors/compact/SiD/SiD_TrackerSupport.xml @@ -9,7 +9,7 @@ <comment>Outer Tracker Supports and Readout</comment> - <detector name="TrackerBarrelSupports" type="DD4hep_MultiLayerTracker" reflect="true"> + <detector name="TrackerBarrelSupports" type="dd4hep_MultiLayerTracker" reflect="true"> <comment>Barrels</comment> @@ -42,168 +42,168 @@ <comment>Dished endcap disks</comment> - <detector name="SiTrackerEndcapSupport1" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport1" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="(750.417-0.001)*mm" /> <zplane rmin="504.711*mm" rmax="510.448*mm" z="(750.919-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(777.034-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(777.535-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport2" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport2" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="750.919*mm" /> <zplane rmin="438.449*mm" rmax="510.448*mm" z="757.218*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="777.535*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="783.834*mm" /> </detector> - <detector name="SiTrackerEndcapSupport3" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport3" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="(757.218+0.001)*mm" /> <zplane rmin="504.711*mm" rmax="510.448*mm" z="(757.720+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(783.834+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(784.336+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport4" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport4" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="(1014.437-0.001)*mm" /> <zplane rmin="758.059*mm" rmax="763.796*mm" z="(1014.939-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1063.219-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1063.721-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport5" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport5" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="1014.939*mm" /> <zplane rmin="691.797*mm" rmax="763.796*mm" z="1021.238*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="1063.721*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="1070.020*mm" /> </detector> - <detector name="SiTrackerEndcapSupport6" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport6" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="(1021.238+0.001)*mm" /> <zplane rmin="758.059*mm" rmax="763.796*mm" z="(1021.740+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1070.020+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1070.522+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport7" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport7" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="(1272.885-0.001)*mm" /> <zplane rmin="1010.011*mm" rmax="1015.748*mm" z="(1273.387-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1343.711-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1344.213-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport8" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport8" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="1273.387*mm" /> <zplane rmin="943.753*mm" rmax="1015.748*mm" z="1279.686*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="1344.213*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="1350.512*mm" /> </detector> - <detector name="SiTrackerEndcapSupport9" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport9" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="(1279.686+0.001)*mm" /> <zplane rmin="1010.011*mm" rmax="1015.748*mm" z="(1280.188+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1350.512+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1351.014+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport10" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport10" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="(1536.560-0.001)*mm" /> <zplane rmin="1258.071*mm" rmax="1263.808*mm" z="(1537.062-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1629.089-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1629.591-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport11" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport11" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="1537.062*mm" /> <zplane rmin="1191.810*mm" rmax="1263.808*mm" z="1543.361*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="1629.591*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="1635.890*mm" /> </detector> - <detector name="SiTrackerEndcapSupport12" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport12" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="(1543.361+0.001)*mm" /> <zplane rmin="1258.071*mm" rmax="1263.808*mm" z="(1543.863+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1635.890+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1636.392+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport1Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport1Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="(-750.417+0.001)*mm" /> <zplane rmin="504.711*mm" rmax="510.448*mm" z="(-750.919+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-777.034+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-777.535+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport2Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport2Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="-750.919*mm" /> <zplane rmin="438.449*mm" rmax="510.448*mm" z="-757.218*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="-777.535*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="-783.834*mm" /> </detector> - <detector name="SiTrackerEndcapSupport3Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport3Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="(-757.218-0.001)*mm" /> <zplane rmin="504.711*mm" rmax="510.448*mm" z="(-757.720-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-783.834-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-784.336-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport4Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport4Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="(-1014.437+0.001)*mm" /> <zplane rmin="758.059*mm" rmax="763.796*mm" z="(-1014.939+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1063.219+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1063.721+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport5Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport5Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="-1014.939*mm" /> <zplane rmin="691.797*mm" rmax="763.796*mm" z="-1021.238*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="-1063.721*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="-1070.020*mm" /> </detector> - <detector name="SiTrackerEndcapSupport6Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport6Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="(-1021.238-0.001)*mm" /> <zplane rmin="758.059*mm" rmax="763.796*mm" z="(-1021.740-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1070.020-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1070.522-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport7Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport7Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="(-1272.885+0.001)*mm" /> <zplane rmin="1010.011*mm" rmax="1015.748*mm" z="(-1273.387+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1343.711+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1344.213+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport8Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport8Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="-1273.387*mm" /> <zplane rmin="943.753*mm" rmax="1015.748*mm" z="-1279.686*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="-1344.213*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="-1350.512*mm" /> </detector> - <detector name="SiTrackerEndcapSupport9Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport9Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="(-1279.686-0.001)*mm" /> <zplane rmin="1010.011*mm" rmax="1015.748*mm" z="(-1280.188-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1350.512-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1351.014-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport10Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport10Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="(-1536.560+0.001)*mm" /> <zplane rmin="1258.071*mm" rmax="1263.808*mm" z="(-1537.062+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1629.089+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1629.591+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport11Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport11Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="-1537.062*mm" /> <zplane rmin="1191.810*mm" rmax="1263.808*mm" z="-1543.361*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="-1629.591*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="-1635.890*mm" /> </detector> - <detector name="SiTrackerEndcapSupport12Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport12Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="(-1543.361-0.001)*mm" /> <zplane rmin="1258.071*mm" rmax="1263.808*mm" z="(-1543.863-0.001)*mm" /> @@ -211,7 +211,7 @@ <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1636.392-0.001)*mm" /> </detector> - <detector name="TrackerReadout" type="DD4hep_DiskTracker" reflect="true" vis="GreenVis"> + <detector name="TrackerReadout" type="dd4hep_DiskTracker" reflect="true" vis="GreenVis"> <comment>Readouts</comment> diff --git a/DDDetectors/compact/SiD/SiD_VertexBarrel.xml b/DDDetectors/compact/SiD/SiD_VertexBarrel.xml index eb04a92d2..fe12db1e2 100644 --- a/DDDetectors/compact/SiD/SiD_VertexBarrel.xml +++ b/DDDetectors/compact/SiD/SiD_VertexBarrel.xml @@ -30,7 +30,7 @@ <!-- ==================================================================== --> <detectors> - <detector id="VertexBarrel_ID" name="SiVertexBarrel" type="DD4hep_SiTrackerBarrel" readout="SiVertexBarrelHits" insideTrackingVolume="true"> + <detector id="VertexBarrel_ID" name="SiVertexBarrel" type="dd4hep_SiTrackerBarrel" readout="SiVertexBarrelHits" insideTrackingVolume="true"> <comment>Vertex Detector Barrel</comment> diff --git a/DDDetectors/compact/SiD/SiD_VertexEndcap.xml b/DDDetectors/compact/SiD/SiD_VertexEndcap.xml index 0b4bce075..33fa852d6 100644 --- a/DDDetectors/compact/SiD/SiD_VertexEndcap.xml +++ b/DDDetectors/compact/SiD/SiD_VertexEndcap.xml @@ -38,7 +38,7 @@ <comment>Vertex Detector Endcaps</comment> - <detector id="2" name="SiVertexEndcap" type="DD4hep_SiTrackerEndcap2" readout="SiVertexEndcapHits" reflect="true"> + <detector id="2" name="SiVertexEndcap" type="dd4hep_SiTrackerEndcap2" readout="SiVertexEndcapHits" reflect="true"> <module name="SiVertexEndcapModule1"> <trd x1="VertexEndcap_rmin1 * tan(pi/(VertexEndcapModules-0.1))" x2="VertexEndcap_rmax * sin(pi/(VertexEndcapModules-0.1*cm))" z="(VertexEndcap_rmax - VertexEndcap_rmin1) / 2" /> <module_component thickness="0.005*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"/> diff --git a/DDDetectors/compact/SiD/SiD_VertexSupport.xml b/DDDetectors/compact/SiD/SiD_VertexSupport.xml index 512b2c492..6fb05e0e7 100644 --- a/DDDetectors/compact/SiD/SiD_VertexSupport.xml +++ b/DDDetectors/compact/SiD/SiD_VertexSupport.xml @@ -9,7 +9,7 @@ <comment>Vertex Detector Supports and Readout</comment> - <detector name="VertexBarrelSupports" type="DD4hep_MultiLayerTracker" vis="SupportVis" reflect="true"> + <detector name="VertexBarrelSupports" type="dd4hep_MultiLayerTracker" vis="SupportVis" reflect="true"> <comment>Double-walled Carbon Fiber support tube</comment> @@ -20,7 +20,7 @@ <slice material = "CarbonFiber" thickness ="VXD_CF_support"/> </layer> </detector> - <detector name="VertexEndSupports" type="DD4hep_DiskTracker" reflect="true" vis="SupportVis"> + <detector name="VertexEndSupports" type="dd4hep_DiskTracker" reflect="true" vis="SupportVis"> <layer id="7" inner_r = "(86.88*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexEndcap_offset" inner_z = "86.88*cm" outer_r = "16.87*cm"> <slice material = "CarbonFiber" thickness = "VXD_CF_support" /> </layer> @@ -29,7 +29,7 @@ </layer> </detector> - <detector name="VertexReadout" type="DD4hep_DiskTracker" reflect="true" vis="CableVis"> + <detector name="VertexReadout" type="dd4hep_DiskTracker" reflect="true" vis="CableVis"> <comment>Readout and Cabling</comment> @@ -86,7 +86,7 @@ </layer> </detector> - <detector name="VXDcableZforwardBarrel" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZforwardBarrel" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin = "(CentralBeamPipe_rmax)" rmax = "(CentralBeamPipe_rmax + VertexCableThickness)" @@ -96,7 +96,7 @@ z="CentralBeamPipe_zmax"/> </detector> - <detector name="VXDcableZbackwardBarrel" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZbackwardBarrel" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin = "(CentralBeamPipe_rmax)" rmax = "(CentralBeamPipe_rmax + VertexCableThickness)" @@ -106,7 +106,7 @@ z="-CentralBeamPipe_zmax"/> </detector> - <detector name="VXDcableZbackwardOuter" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZbackwardOuter" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin = "((tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax)" rmax = "((tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + 0.004*cm)" @@ -116,7 +116,7 @@ z="-(VertexService_zmax + 0.01*cm)"/> </detector> - <detector name="VXDcableZbackwardInner" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZbackwardInner" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin="CentralBeamPipe_rmax" rmax="CentralBeamPipe_rmax + VertexCableThickness" @@ -126,7 +126,7 @@ z="-(VertexService_zmin - 0.01*cm)"/> </detector> - <detector name="VXDcableZforwardOuter" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZforwardOuter" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin = "((tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax)" rmax = "((tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + 0.004*cm)" @@ -136,7 +136,7 @@ z="VertexService_zmax + 0.01*cm"/> </detector> - <detector name="VXDcableZforwardInner" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZforwardInner" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin="(VertexService_zmin - 0.01*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax" rmax="(VertexService_zmin - 0.01*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexCableThickness" @@ -146,7 +146,7 @@ z="CentralBeamPipe_zmax"/> </detector> - <detector name="VXDserviceZbackward" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDserviceZbackward" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="G10"/> <zplane rmin = "(VertexService_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax" rmax="(VertexService_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexServiceThickness" @@ -156,7 +156,7 @@ z="-VertexService_zmin"/> </detector> - <detector name="VXDserviceZforward" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDserviceZforward" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="G10"/> <zplane rmin = "(VertexService_zmin - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax" rmax="(VertexService_zmin - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexServiceThickness" diff --git a/DDDetectors/compact/SiD_Markus.xml b/DDDetectors/compact/SiD_Markus.xml index b7185809d..6ddb8d99a 100644 --- a/DDDetectors/compact/SiD_Markus.xml +++ b/DDDetectors/compact/SiD_Markus.xml @@ -241,13 +241,13 @@ </fields> <plugins> - <plugin name="DD4hep_SiTrackerEndcapSurfacePlugin"> + <plugin name="dd4hep_SiTrackerEndcapSurfacePlugin"> <argument value="SiVertexEndcap"/> <argument value="dimension=1"/> </plugin> </plugins> <plugins> - <plugin name="DD4hep_SiTrackerBarrelSurfacePlugin"> + <plugin name="dd4hep_SiTrackerBarrelSurfacePlugin"> <argument value="SiVertexBarrel"/> <argument value="dimension=1"/> </plugin> diff --git a/DDDetectors/doc/README.ExtensionPlugins b/DDDetectors/doc/README.ExtensionPlugins index c35c76a83..fcdbabd18 100644 --- a/DDDetectors/doc/README.ExtensionPlugins +++ b/DDDetectors/doc/README.ExtensionPlugins @@ -6,7 +6,7 @@ The need of the various reconstruction programs used to create e.g. tracks from hits may differ significantly and may require different helper data to perform the required functions. In general the reconstruction is supported by the detector elements with -helper objects (in DD4hep speak these are called Views). Some default views +helper objects (in dd4hep speak these are called Views). Some default views are provided by this package for some of the detector constructors of the "default subdetector palette". We first show how to invoke these plugins in order to attach the required @@ -40,19 +40,19 @@ Available plugins ================= -- "SubdetectorExtensionPlugin" - argument: subdetector name as registered to LCDD - Adds an extension of type DD4hep::DDRec::SubdetectorExtension. + argument: subdetector name as registered to Detector + Adds an extension of type dd4hep::rec::SubdetectorExtension. Please see documentation in DDRec for details. In general applicable to any top level detector object. -- "LayeringExtensionPlugin" - argument: subdetector name as registered to LCDD - Adds an extension of the interface type DD4hep::DDRec::LayeringExtension - and the implementation type DD4hep::DDRec::LayeringExtensionImpl. + argument: subdetector name as registered to Detector + Adds an extension of the interface type dd4hep::rec::LayeringExtension + and the implementation type dd4hep::rec::LayeringExtensionImpl. Please see documentation in DDRec for details. --- "DD4hep_SiTrackerBarrelSurfacePlugin" - argument: subdetector name as registered to LCDD +-- "dd4hep_SiTrackerBarrelSurfacePlugin" + argument: subdetector name as registered to Detector This plugin adds measurement surfaces of interface type DDSurfaces::ISurface to each detector element which has a placement with a sensitive volume. @@ -61,8 +61,8 @@ Available plugins - SiTrackerBarrel - EcalBarrel --- "DD4hep_SiTrackerEndcapSurfacePlugin" - argument: subdetector name as registered to LCDD +-- "dd4hep_SiTrackerEndcapSurfacePlugin" + argument: subdetector name as registered to Detector This plugin adds measurement surfaces of interface type DDSurfaces::ISurface to each detector element which has a placement with a sensitive volume. diff --git a/DDDetectors/doc/README.SiD b/DDDetectors/doc/README.SiD index 92f205ac6..1ffcebdc1 100644 --- a/DDDetectors/doc/README.SiD +++ b/DDDetectors/doc/README.SiD @@ -4,38 +4,38 @@ Describing the SiD detector concept using the standard detector palette This XML description mimics the SiD detector concept using the -standard DD4hep supplied detector palette. +standard dd4hep supplied detector palette. System Subdetector Palette Type Sensitive type --------------------------------------------------------------------------------------- -Vertex: SiVertexBarrel DD4hep_SiTrackerBarrel [tracker] - SiVertexEndcap DD4hep_SiTrackerEndcap2 [tracker] - SUPPORTS of type: DD4hep_MultiLayerTracker - DD4hep_DiskTracker - DD4hep_PolyconeSupport -Tracker:SiTrackerEndcap DD4hep_SiTrackerEndcap2 [tracker] - SiTrackerBarrel DD4hep_SiTrackerBarrel [tracker] - SiTrackerForward DD4hep_SiTrackerEndcap2 [tracker] - SUPPORTS of type: DD4hep_MultiLayerTracker - DD4hep_PolyconeSupport - DD4hep_DiskTracker -Ecal: EcalBarrel DD4hep_EcalBarrel [calorimeter] - EcalEndcap DD4hep_PolyhedraEndcapCalorimeter2 [calorimeter] -Hcal: HcalBarrel DD4hep_PolyhedraBarrelCalorimeter2 [calorimeter] - HcalEndcap DD4hep_PolyhedraEndcapCalorimeter2 [calorimeter] -Muon: MuonBarrel DD4hep_PolyhedraBarrelCalorimeter2 [calorimeter] - MuonEndcap DD4hep_PolyhedraEndcapCalorimeter2 [calorimeter] -LumiCal:LumiCal DD4hep_CylindricalEndcapCalorimeter [calorimeter] - SUPPORTS of type: DD4hep_PolyconeSupport -BeamCal:BeamCal DD4hep_ForwardDetector [calorimeter] -Magnet: SolenoidCoilBarrel DD4hep_MultiLayerTracker - SolenoidCoilEnds DD4hep_DiskTracker - AntiSolenoid_Forward DD4hep_PolyconeSupport - AntiSolenoid_Backward DD4hep_PolyconeSupport +Vertex: SiVertexBarrel dd4hep_SiTrackerBarrel [tracker] + SiVertexEndcap dd4hep_SiTrackerEndcap2 [tracker] + SUPPORTS of type: dd4hep_MultiLayerTracker + dd4hep_DiskTracker + dd4hep_PolyconeSupport +Tracker:SiTrackerEndcap dd4hep_SiTrackerEndcap2 [tracker] + SiTrackerBarrel dd4hep_SiTrackerBarrel [tracker] + SiTrackerForward dd4hep_SiTrackerEndcap2 [tracker] + SUPPORTS of type: dd4hep_MultiLayerTracker + dd4hep_PolyconeSupport + dd4hep_DiskTracker +Ecal: EcalBarrel dd4hep_EcalBarrel [calorimeter] + EcalEndcap dd4hep_PolyhedraEndcapCalorimeter2 [calorimeter] +Hcal: HcalBarrel dd4hep_PolyhedraBarrelCalorimeter2 [calorimeter] + HcalEndcap dd4hep_PolyhedraEndcapCalorimeter2 [calorimeter] +Muon: MuonBarrel dd4hep_PolyhedraBarrelCalorimeter2 [calorimeter] + MuonEndcap dd4hep_PolyhedraEndcapCalorimeter2 [calorimeter] +LumiCal:LumiCal dd4hep_CylindricalEndcapCalorimeter [calorimeter] + SUPPORTS of type: dd4hep_PolyconeSupport +BeamCal:BeamCal dd4hep_ForwardDetector [calorimeter] +Magnet: SolenoidCoilBarrel dd4hep_MultiLayerTracker + SolenoidCoilEnds dd4hep_DiskTracker + AntiSolenoid_Forward dd4hep_PolyconeSupport + AntiSolenoid_Backward dd4hep_PolyconeSupport -Shields and dead material: DD4hep_PolyconeSupport - (all SUPPORTS) DD4hep_ForwardDetector - DD4hep_TubeSegment +Shields and dead material: dd4hep_PolyconeSupport + (all SUPPORTS) dd4hep_ForwardDetector + dd4hep_TubeSegment Note: The palette drivers allow for many other designs. This explicit design is only an example diff --git a/DDDetectors/include/DDDetectors/OtherDetectorHelpers.h b/DDDetectors/include/DDDetectors/OtherDetectorHelpers.h index 16457c045..886ab2ea6 100644 --- a/DDDetectors/include/DDDetectors/OtherDetectorHelpers.h +++ b/DDDetectors/include/DDDetectors/OtherDetectorHelpers.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -73,8 +73,8 @@ namespace ODH {//OtherDetectorHelpers static bool checkForSensibleGeometry(double crossingAngle, ECrossType crossType) { if (crossingAngle == 0 && crossType != kCenter) { - printout(DD4hep::ERROR, "Mask/Beampip", "You are trying to build a crossing geometry without a crossing angle.\n" ); - printout(DD4hep::ERROR, "Mask/Beampip", "This is probably not what you want - better check your geometry data!"); + printout(dd4hep::ERROR, "Mask/Beampip", "You are trying to build a crossing geometry without a crossing angle.\n" ); + printout(dd4hep::ERROR, "Mask/Beampip", "This is probably not what you want - better check your geometry data!"); return false; // premature exit, dd4hep will abort now } return true; diff --git a/DDDetectors/src/Beampipe_o1_v01_geo.cpp b/DDDetectors/src/Beampipe_o1_v01_geo.cpp index 9e9988322..97f006b6c 100644 --- a/DDDetectors/src/Beampipe_o1_v01_geo.cpp +++ b/DDDetectors/src/Beampipe_o1_v01_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,17 +25,17 @@ #include <map> #include <string> -using DD4hep::Geometry::Transform3D; -using DD4hep::Geometry::Position; -using DD4hep::Geometry::RotationY; -using DD4hep::Geometry::RotateY; -using DD4hep::Geometry::ConeSegment; -using DD4hep::Geometry::SubtractionSolid; -using DD4hep::Geometry::Material; -using DD4hep::Geometry::Volume; -using DD4hep::Geometry::Solid; -using DD4hep::Geometry::Tube; - +using dd4hep::Transform3D; +using dd4hep::Position; +using dd4hep::RotationY; +using dd4hep::RotateY; +using dd4hep::ConeSegment; +using dd4hep::SubtractionSolid; +using dd4hep::Material; +using dd4hep::Volume; +using dd4hep::Solid; +using dd4hep::Tube; +namespace units = dd4hep; using dd4hep::rec::Vector3D; using dd4hep::rec::VolCylinder; using dd4hep::rec::VolCone; @@ -46,7 +46,7 @@ class SimpleCylinderImpl : public dd4hep::rec::VolCylinderImpl{ double _half_length ; public: /// standard c'tor with all necessary arguments - origin is (0,0,0) if not given. - SimpleCylinderImpl( DD4hep::Geometry::Volume vol, SurfaceType type, + SimpleCylinderImpl( dd4hep::Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer, Vector3D origin ) : dd4hep::rec::VolCylinderImpl( vol, type, thickness_inner, thickness_outer, origin ), _half_length(0){ @@ -54,7 +54,7 @@ public: void setHalfLength( double half_length){ _half_length = half_length ; } - void setID( DD4hep::long64 id ) { _id = id ; + void setID( dd4hep::long64 id ) { _id = id ; } // overwrite to include points inside the inner radius of the barrel bool insideBounds(const Vector3D& point, double epsilon) const { @@ -94,7 +94,7 @@ public: class SimpleCylinder : public dd4hep::rec::VolSurface{ public: - SimpleCylinder( DD4hep::Geometry::Volume vol, dd4hep::rec::SurfaceType type, double thickness_inner , + SimpleCylinder( dd4hep::Volume vol, dd4hep::rec::SurfaceType type, double thickness_inner , double thickness_outer, Vector3D origin ) : dd4hep::rec::VolSurface( new SimpleCylinderImpl( vol, type, thickness_inner , thickness_outer, origin ) ) { } @@ -102,26 +102,26 @@ public: } ; -static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, +static dd4hep::Ref_t create_element(dd4hep::Detector& description, xml_h element, - DD4hep::Geometry::SensitiveDetector /*sens*/) { + dd4hep::SensitiveDetector /*sens*/) { - printout(DD4hep::DEBUG,"DD4hep_Beampipe", "Creating Beampipe" ) ; + printout(dd4hep::DEBUG,"dd4hep_Beampipe", "Creating Beampipe" ) ; //Access to the XML File xml_det_t xmlBeampipe = element; const std::string name = xmlBeampipe.nameStr(); - DD4hep::Geometry::DetElement tube( name, xmlBeampipe.id() ) ; + dd4hep::DetElement tube( name, xmlBeampipe.id() ) ; // --- create an envelope volume and position it into the world --------------------- - Volume envelope = DD4hep::XML::createPlacedEnvelope( lcdd, element , tube ) ; + Volume envelope = dd4hep::xml::createPlacedEnvelope( description, element , tube ) ; - DD4hep::XML::setDetectorTypeFlag( element, tube ) ; + dd4hep::xml::setDetectorTypeFlag( element, tube ) ; - if( lcdd.buildType() == DD4hep::BUILD_ENVELOPE ) return tube ; + if( description.buildType() == dd4hep::BUILD_ENVELOPE ) return tube ; //----------------------------------------------------------------------------------- @@ -130,10 +130,10 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, //DD4hep/TGeo seems to need rad (as opposed to the manual) const double phi1 = 0 ; - const double phi2 = 360.0*dd4hep::degree; + const double phi2 = 360.0*units::degree; //Parameters we have to know about - DD4hep::XML::Component xmlParameter = xmlBeampipe.child(_Unicode(parameter)); + dd4hep::xml::Component xmlParameter = xmlBeampipe.child(_Unicode(parameter)); const double crossingAngle = xmlParameter.attr< double >(_Unicode(crossingangle))*0.5; // only half the angle @@ -151,22 +151,22 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, const double rOuterStart = xmlSection.attr< double > (_Unicode(rMax1)); const double rOuterEnd = xmlSection.attr< double > (_Unicode(rMax2)); const double thickness = rOuterStart - rInnerStart; - Material sectionMat = lcdd.material(xmlSection.materialStr()); + Material sectionMat = description.material(xmlSection.materialStr()); const std::string volName = "tube_" + xmlSection.nameStr(); std::stringstream pipeInfo; - pipeInfo << std::setw(8) << zStart /dd4hep::mm - << std::setw(8) << zEnd /dd4hep::mm - << std::setw(8) << rInnerStart /dd4hep::mm - << std::setw(8) << rInnerEnd /dd4hep::mm - << std::setw(8) << rOuterStart /dd4hep::mm - << std::setw(8) << rOuterEnd /dd4hep::mm - << std::setw(8) << thickness /dd4hep::mm + pipeInfo << std::setw(8) << zStart /units::mm + << std::setw(8) << zEnd /units::mm + << std::setw(8) << rInnerStart /units::mm + << std::setw(8) << rInnerEnd /units::mm + << std::setw(8) << rOuterStart /units::mm + << std::setw(8) << rOuterEnd /units::mm + << std::setw(8) << thickness /units::mm << std::setw(8) << crossType << std::setw(35) << volName << std::setw(15) << sectionMat.name(); - printout(DD4hep::INFO, "DD4hep_Beampipe", pipeInfo.str() ); + printout(dd4hep::INFO, "dd4hep_Beampipe", pipeInfo.str() ); if( crossType == ODH::kCenter ) { // store only the central sections ! dd4hep::rec::ConicalSupportData::Section section ; @@ -179,7 +179,7 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, // things which can be calculated immediately const double zHalf = fabs(zEnd - zStart) * 0.5; // half z length of the cone const double zPosition = fabs(zEnd + zStart) * 0.5; // middle z position - Material coreMaterial = lcdd.material("beam"); // always the same + Material coreMaterial = description.material("beam"); // always the same Material wallMaterial = sectionMat; // this could mess up your geometry, so better check it @@ -261,10 +261,10 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, if( rOuterStart < min_radius ) min_radius = rOuterStart ; } - wallLog.setVisAttributes(lcdd, "TubeVis"); - wallLog2.setVisAttributes(lcdd, "TubeVis"); - tubeLog.setVisAttributes(lcdd, "VacVis"); - tubeLog2.setVisAttributes(lcdd, "VacVis"); + wallLog.setVisAttributes(description, "TubeVis"); + wallLog2.setVisAttributes(description, "TubeVis"); + tubeLog.setVisAttributes(description, "VacVis"); + tubeLog2.setVisAttributes(description, "VacVis"); // placement as a daughter volume of the tube, will appear in both placements of the tube tubeLog.placeVolume( wallLog, Transform3D() ); @@ -330,10 +330,10 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, Volume wallLog0( volName + "_wall_0", wallSolid0, wallMaterial ); Volume wallLog1( volName + "_wall_1", wallSolid1, wallMaterial ); - wallLog0.setVisAttributes(lcdd, "TubeVis"); - wallLog1.setVisAttributes(lcdd, "TubeVis"); - tubeLog0.setVisAttributes(lcdd, "VacVis"); - tubeLog1.setVisAttributes(lcdd, "VacVis"); + wallLog0.setVisAttributes(description, "TubeVis"); + wallLog1.setVisAttributes(description, "TubeVis"); + tubeLog0.setVisAttributes(description, "VacVis"); + tubeLog1.setVisAttributes(description, "VacVis"); // placement as a daughter volumes of the tube tubeLog0.placeVolume( wallLog0, Position() ); @@ -384,11 +384,11 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, Volume wallLog0( volName + "_wall_0", wallSolid0, wallMaterial ); Volume wallLog1( volName + "_wall_1", wallSolid1, wallMaterial ); - wallLog0.setVisAttributes(lcdd, "TubeVis"); - wallLog1.setVisAttributes(lcdd, "TubeVis"); + wallLog0.setVisAttributes(description, "TubeVis"); + wallLog1.setVisAttributes(description, "TubeVis"); - tubeLog0.setVisAttributes(lcdd, "VacVis"); - tubeLog1.setVisAttributes(lcdd, "VacVis"); + tubeLog0.setVisAttributes(description, "VacVis"); + tubeLog1.setVisAttributes(description, "VacVis"); // placement as a daughter volumes of the tube tubeLog0.placeVolume( wallLog0 , Position() ); @@ -447,11 +447,11 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, Volume wallLog0( volName + "_wall_0", wallSolid0, wallMaterial ); Volume wallLog1( volName + "_wall_1", wallSolid1, wallMaterial ); - wallLog0.setVisAttributes(lcdd, "TubeVis"); - wallLog1.setVisAttributes(lcdd, "TubeVis"); + wallLog0.setVisAttributes(description, "TubeVis"); + wallLog1.setVisAttributes(description, "TubeVis"); - tubeLog0.setVisAttributes(lcdd, "VacVis"); - tubeLog1.setVisAttributes(lcdd, "VacVis"); + tubeLog0.setVisAttributes(description, "VacVis"); + tubeLog1.setVisAttributes(description, "VacVis"); // placement as a daughter volumes of the tube tubeLog0.placeVolume( wallLog0, Position() ); @@ -509,11 +509,11 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, Volume wallLog0( volName + "_wall_0", wallSolid0, wallMaterial ); Volume wallLog1( volName + "_wall_1", wallSolid1, wallMaterial ); - wallLog0.setVisAttributes(lcdd, "TubeVis"); - wallLog1.setVisAttributes(lcdd, "TubeVis"); + wallLog0.setVisAttributes(description, "TubeVis"); + wallLog1.setVisAttributes(description, "TubeVis"); - tubeLog0.setVisAttributes(lcdd, "VacVis"); - tubeLog1.setVisAttributes(lcdd, "VacVis"); + tubeLog0.setVisAttributes(description, "VacVis"); + tubeLog1.setVisAttributes(description, "VacVis"); // placement as a daughter volumes of the tube tubeLog0.placeVolume( wallLog0, Transform3D() ); @@ -578,11 +578,11 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, Volume wallLog0(volName + "_wall_0", wallSolid0, wallMaterial ); Volume wallLog1(volName + "_wall_1", wallSolid1, wallMaterial ); - wallLog0.setVisAttributes(lcdd, "TubeVis"); - wallLog1.setVisAttributes(lcdd, "TubeVis"); + wallLog0.setVisAttributes(description, "TubeVis"); + wallLog1.setVisAttributes(description, "TubeVis"); - tubeLog0.setVisAttributes(lcdd, "VacVis"); - tubeLog1.setVisAttributes(lcdd, "VacVis"); + tubeLog0.setVisAttributes(description, "VacVis"); + tubeLog1.setVisAttributes(description, "VacVis"); // placement as a daughter volumes of the tube tubeLog0.placeVolume( wallLog0, Transform3D() ); @@ -606,17 +606,17 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, Vector3D oIPCyl( (min_radius-1.e-3) , 0. , 0. ) ; SimpleCylinder ipCylSurf( envelope , SurfaceType( SurfaceType::Helper ) , 1.e-5 , 1e-5 , oIPCyl ) ; // the length does not really matter here as long as it is long enough for all tracks ... - ipCylSurf->setHalfLength( 100*dd4hep::cm ) ; + ipCylSurf->setHalfLength( 100*units::cm ) ; dd4hep::rec::volSurfaceList( tube )->push_back( ipCylSurf ) ; tube.addExtension< dd4hep::rec::ConicalSupportData >( beampipeData ) ; //-------------------------------------- - tube.setVisAttributes( lcdd, xmlBeampipe.visStr(), envelope ); + tube.setVisAttributes( description, xmlBeampipe.visStr(), envelope ); // // tube.setPlacement(pv); return tube; } -DECLARE_DETELEMENT(DD4hep_Beampipe_o1_v01,create_element) +DECLARE_DETELEMENT(dd4hep_Beampipe_o1_v01,create_element) diff --git a/DDDetectors/src/BoxSegment_geo.cpp b/DDDetectors/src/BoxSegment_geo.cpp index 33c9fcbc9..c0d01af23 100644 --- a/DDDetectors/src/BoxSegment_geo.cpp +++ b/DDDetectors/src/BoxSegment_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,25 +18,25 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t sens) { +static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { xml_det_t x_det = e; string name = x_det.nameStr(); xml_comp_t box (x_det.child(_U(box))); xml_dim_t pos (x_det.child(_U(position))); xml_dim_t rot (x_det.child(_U(rotation))); - Material mat (lcdd.material(x_det.materialStr())); + Material mat (description.material(x_det.materialStr())); DetElement det (name,x_det.id()); Volume det_vol(name+"_vol",Box(box.x(),box.y(),box.z()), mat); - Volume mother = lcdd.pickMotherVolume(det); + Volume mother = description.pickMotherVolume(det); Transform3D transform(Rotation3D(RotationZYX(rot.z(),rot.y(),rot.x())),Position(pos.x(),pos.y(),pos.z())); PlacedVolume phv = mother.placeVolume(det_vol,transform); - det_vol.setVisAttributes(lcdd, x_det.visStr()); - det_vol.setLimitSet(lcdd, x_det.limitsStr()); - det_vol.setRegion(lcdd, x_det.regionStr()); + det_vol.setVisAttributes(description, x_det.visStr()); + det_vol.setLimitSet(description, x_det.limitsStr()); + det_vol.setRegion(description, x_det.regionStr()); if ( x_det.isSensitive() ) { SensitiveDetector sd = sens; xml_dim_t sd_typ = x_det.child(_U(sensitive)); @@ -51,5 +51,5 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t sens) { } // first argument is the type from the xml file -DECLARE_DETELEMENT(DD4hep_BoxSegment,create_element) +DECLARE_DETELEMENT(dd4hep_BoxSegment,create_element) DECLARE_DEPRECATED_DETELEMENT(BoxSegment,create_element) diff --git a/DDDetectors/src/CaloFaceBarrel_surfaces.cpp b/DDDetectors/src/CaloFaceBarrel_surfaces.cpp index 413b43d79..ac9d851d9 100644 --- a/DDDetectors/src/CaloFaceBarrel_surfaces.cpp +++ b/DDDetectors/src/CaloFaceBarrel_surfaces.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,7 +28,7 @@ namespace { // Framework include files #define SURFACEINSTALLER_DATA UserData -#define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_CaloFaceBarrelSurfacePlugin +#define DD4HEP_USE_SURFACEINSTALL_HELPER dd4hep_CaloFaceBarrelSurfacePlugin #include "DD4hep/Printout.h" #include "DD4hep/SurfaceInstaller.h" #include "DDRec/DetectorData.h" @@ -47,7 +47,7 @@ namespace{ double thickness_inner ,double thickness_outer, dd4hep::rec::Vector3D u_val ,dd4hep::rec::Vector3D v_val , dd4hep::rec::Vector3D n_val , dd4hep::rec::Vector3D o_val, - DD4hep::Geometry::Volume vol, int id_val ) : + dd4hep::Volume vol, int id_val ) : dd4hep::rec::VolPlaneImpl( typ, thickness_inner,thickness_outer, u_val, v_val, n_val, o_val, vol, id_val), _length(0),_width(0) {} @@ -56,7 +56,7 @@ namespace{ _width = width ; } - void setID( DD4hep::long64 id_val ) { _id = id_val ; } + void setID( dd4hep::long64 id_val ) { _id = id_val ; } // overwrite to include points inside the inner radius of the barrel bool insideBounds(const dd4hep::rec::Vector3D& point, double epsilon) const { @@ -88,9 +88,9 @@ namespace{ char* ptr = ::strchr(argv[i],'='); if ( ptr ) { std::string name( argv[i] , ptr ) ; - double value = DD4hep::_toDouble(++ptr); + double value = dd4hep::_toDouble(++ptr); - printout(DD4hep::DEBUG,"DD4hep_CaloFaceBarrelSurfacePlugin", "argument[%d] = %s = %f" , i, name.c_str() , value ) ; + printout(dd4hep::DEBUG,"dd4hep_CaloFaceBarrelSurfacePlugin", "argument[%d] = %s = %f" , i, name.c_str() , value ) ; if( name=="length" ) data.length = value ; else if( name=="radius" ) data.radius = value ; @@ -99,7 +99,7 @@ namespace{ else if( name=="systemID") data.systemID = value ; else if( name=="encoding") data.encoding = ptr ; else { - printout(DD4hep::WARNING,"DD4hep_CaloFaceBarrelSurfacePlugin", "unknown parameter: %s ", name.c_str() ) ; + printout(dd4hep::WARNING,"dd4hep_CaloFaceBarrelSurfacePlugin", "unknown parameter: %s ", name.c_str() ) ; } } } @@ -107,9 +107,9 @@ namespace{ /// Install measurement surfaces template <typename UserData> - void Installer<UserData>::install(DetElement component, PlacedVolume pv) { + void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVolume pv) { - Volume comp_vol = pv.volume(); + dd4hep::Volume comp_vol = pv.volume(); double length = data.length ; double symmetry = data.symmetry ; @@ -124,11 +124,11 @@ namespace{ double inner_thickness = 1e-6 ; double outer_thickness = 1e-6 ; - printout(DD4hep::INFO,"DD4hep_CaloFaceBarrelSurfacePlugin", "install tracking surfaces for : %s ", component.name() ) ; + printout(dd4hep::INFO,"dd4hep_CaloFaceBarrelSurfacePlugin", "install tracking surfaces for : %s ", component.name() ) ; - DD4hep::DDSegmentation::BitField64 bf( "system:5,side:-2,layer:9,module:8,sensor:8" ) ; - // DD4hep::DDSegmentation::BitField64 bf( data.encoding ) ; + dd4hep::DDSegmentation::BitField64 bf( "system:5,side:-2,layer:9,module:8,sensor:8" ) ; + // dd4hep::DDSegmentation::BitField64 bf( data.encoding ) ; bf["system"] = data.systemID ; diff --git a/DDDetectors/src/CaloFaceEndcap_surfaces.cpp b/DDDetectors/src/CaloFaceEndcap_surfaces.cpp index 761b58665..038154e92 100644 --- a/DDDetectors/src/CaloFaceEndcap_surfaces.cpp +++ b/DDDetectors/src/CaloFaceEndcap_surfaces.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,7 +27,7 @@ namespace { // Framework include files #define SURFACEINSTALLER_DATA UserData -#define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_CaloFaceEndcapSurfacePlugin +#define DD4HEP_USE_SURFACEINSTALL_HELPER dd4hep_CaloFaceEndcapSurfacePlugin #include "DD4hep/Printout.h" #include "DD4hep/SurfaceInstaller.h" #include "DDRec/DetectorData.h" @@ -47,7 +47,7 @@ namespace{ double thickness_inner ,double thickness_outer, dd4hep::rec::Vector3D u_val ,dd4hep::rec::Vector3D v_val , dd4hep::rec::Vector3D n_val , dd4hep::rec::Vector3D o_val, - DD4hep::Geometry::Volume vol, int id_val ) : + dd4hep::Volume vol, int id_val ) : dd4hep::rec::VolPlaneImpl( typ, thickness_inner,thickness_outer, u_val, v_val, n_val, o_val, vol, id_val), _r(0),_phi0(0),_sym(0) {} @@ -56,7 +56,7 @@ namespace{ _phi0 = phi0 ; _sym = symmetry ; } - void setID( DD4hep::long64 id_val ) { _id = id_val; } + void setID( dd4hep::long64 id_val ) { _id = id_val; } // overwrite to include points inside the inner radius of the endcap bool insideBounds(const dd4hep::rec::Vector3D& point, double epsilon) const { @@ -93,9 +93,9 @@ namespace{ char* ptr = ::strchr(argv[i],'='); if ( ptr ) { std::string name( argv[i] , ptr ) ; - double value = DD4hep::_toDouble(++ptr); + double value = dd4hep::_toDouble(++ptr); - printout(DD4hep::DEBUG,"DD4hep_CaloFaceEndcapSurfacePlugin", "argument[%d] = %s = %f" , i, name.c_str() , value ) ; + printout(dd4hep::DEBUG,"dd4hep_CaloFaceEndcapSurfacePlugin", "argument[%d] = %s = %f" , i, name.c_str() , value ) ; if( name=="zpos" ) data.zpos = value ; else if( name=="radius" ) data.radius = value ; @@ -104,7 +104,7 @@ namespace{ else if( name=="systemID") data.systemID = value ; else if( name=="encoding") data.encoding = ptr ; else { - printout(DD4hep::WARNING,"DD4hep_CaloFaceEndcapSurfacePlugin", "unknown parameter: %s ", name.c_str() ) ; + printout(dd4hep::WARNING,"dd4hep_CaloFaceEndcapSurfacePlugin", "unknown parameter: %s ", name.c_str() ) ; } } } @@ -112,9 +112,9 @@ namespace{ /// Install measurement surfaces template <typename UserData> - void Installer<UserData>::install(DetElement component, PlacedVolume pv) { + void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVolume pv) { - Volume comp_vol = pv.volume(); + dd4hep::Volume comp_vol = pv.volume(); double zpos = data.zpos ; @@ -128,11 +128,11 @@ namespace{ double inner_thickness = 1e-6 ; double outer_thickness = 1e-6 ; - printout(DD4hep::INFO,"DD4hep_CaloFaceEndcapSurfacePlugin", "install tracking surfaces for : %s ", component.name() ) ; + printout(dd4hep::INFO,"dd4hep_CaloFaceEndcapSurfacePlugin", "install tracking surfaces for : %s ", component.name() ) ; - DD4hep::DDSegmentation::BitField64 bf( "system:5,side:-2,layer:9,module:8,sensor:8" ) ; - //DD4hep::DDSegmentation::BitField64 bf( data.encoding ) ; + dd4hep::DDSegmentation::BitField64 bf( "system:5,side:-2,layer:9,module:8,sensor:8" ) ; + //dd4hep::DDSegmentation::BitField64 bf( data.encoding ) ; bf["system"] = data.systemID ; bf["side"] = 1 ; diff --git a/DDDetectors/src/CylinderShell_geo.cpp b/DDDetectors/src/CylinderShell_geo.cpp index 67fcda22c..d71ac525d 100644 --- a/DDDetectors/src/CylinderShell_geo.cpp +++ b/DDDetectors/src/CylinderShell_geo.cpp @@ -1,6 +1,6 @@ // $Id$ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Generic cylindric shell detector to be used to measure @@ -43,15 +43,15 @@ to be joined by a sensitive detector: #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sensitive) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sensitive) { xml_det_t x_det = e; string name = x_det.nameStr(); DetElement sdet (name,x_det.id()); Assembly assembly(name+"_assembly"); - Material mat (lcdd.material(x_det.materialStr())); + Material mat (description.material(x_det.materialStr())); PlacedVolume pv; sensitive.setType("escape_counter"); @@ -71,16 +71,16 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sensitive) } Polycone cone (0.,2*M_PI,rmin,rmax,z); Volume volume(name, cone, mat); - volume.setVisAttributes(lcdd, vis); + volume.setVisAttributes(description, vis); volume.setSensitiveDetector(sensitive); pv = assembly.placeVolume(volume); pv.addPhysVolID("barrel",mod.id()); } - pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); + pv = description.pickMotherVolume(sdet).placeVolume(assembly); pv.addPhysVolID("system",x_det.id()); sdet.setPlacement(pv); return sdet; } -DECLARE_DETELEMENT(DD4hep_CylinderShell,create_detector) +DECLARE_DETELEMENT(dd4hep_CylinderShell,create_detector) diff --git a/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp b/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp index 2327e874c..2e5bf742f 100644 --- a/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp +++ b/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,13 +18,13 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; xml_dim_t dim = x_det.dimensions(); - Material air = lcdd.air(); + Material air = description.air(); string det_name = x_det.nameStr(); DetElement sdet (det_name,x_det.id()); double z = dim.outer_z(); @@ -45,7 +45,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { for(xml_coll_t l(x_layer,_U(slice)); l; ++l, ++m) { xml_comp_t x_slice = l; double router = r + x_slice.thickness(); - Material slice_mat = lcdd.material(x_slice.materialStr()); + Material slice_mat = description.material(x_slice.materialStr()); string slice_name = layer_name + _toString(m,"slice%d"); Tube slice_tube(r,router,z*2); Volume slice_vol (slice_name,slice_tube,slice_mat); @@ -55,11 +55,11 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { slice_vol.setSensitiveDetector(sens); } r = router; - slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + slice_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // Instantiate physical volume layer_vol.placeVolume(slice_vol); } - layer_vol.setVisAttributes(lcdd,x_layer.visStr()); + layer_vol.setVisAttributes(description,x_layer.visStr()); layer_tub.setDimensions(rlayer,r,z*2,0,2*M_PI); PlacedVolume layer_physvol = envelopeVol.placeVolume(layer_vol); @@ -69,13 +69,13 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } envelope.setDimensions(rmin,r,2*z); // Set region of slice - envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + envelopeVol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); - PlacedVolume physvol = lcdd.pickMotherVolume(sdet).placeVolume(envelopeVol); + PlacedVolume physvol = description.pickMotherVolume(sdet).placeVolume(envelopeVol); physvol.addPhysVolID("system",sdet.id()).addPhysVolID(_U(barrel),0); sdet.setPlacement(physvol); return sdet; } -DECLARE_DETELEMENT(DD4hep_CylindricalBarrelCalorimeter,create_detector) +DECLARE_DETELEMENT(dd4hep_CylindricalBarrelCalorimeter,create_detector) DECLARE_DEPRECATED_DETELEMENT(CylindricalBarrelCalorimeter,create_detector) diff --git a/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp b/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp index b05f5795d..abaa8b112 100644 --- a/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp +++ b/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,13 +20,13 @@ #include "XML/Layering.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; xml_dim_t dim = x_det.dimensions(); - Material air = lcdd.air(); + Material air = description.air(); string det_name = x_det.nameStr(); bool reflect = x_det.reflect(); double zmin = dim.inner_z(); @@ -54,19 +54,19 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_comp_t x_slice = l; double w = x_slice.thickness(); string slice_name = layer_name + _toString(m+1,"slice%d"); - Material slice_mat = lcdd.material(x_slice.materialStr()); + Material slice_mat = description.material(x_slice.materialStr()); Volume slice_vol (slice_name,Tube(rmin,rmax,w),slice_mat); if ( x_slice.isSensitive() ) { sens.setType("calorimeter"); slice_vol.setSensitiveDetector(sens); } - slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + slice_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); pv = layer_vol.placeVolume(slice_vol,Position(0,0,z-zlayer-layerWidth/2+w/2)); pv.addPhysVolID("slice",m+1); z += w; } - layer_vol.setVisAttributes(lcdd,x_layer.visStr()); + layer_vol.setVisAttributes(description,x_layer.visStr()); Position layer_pos(0,0,zlayer-zmin-totWidth/2+layerWidth/2); pv = envelopeVol.placeVolume(layer_vol,layer_pos); @@ -77,11 +77,11 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } envelope.setDimensions(rmin,rmax,totWidth/2); // Set attributes of slice - envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + envelopeVol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); DetElement sdet(det_name,x_det.id()); Assembly assembly(det_name+"_assembly"); - Volume motherVol = lcdd.pickMotherVolume(sdet); + Volume motherVol = description.pickMotherVolume(sdet); PlacedVolume phv = motherVol.placeVolume(assembly); phv.addPhysVolID("system",sdet.id()); sdet.setPlacement(phv); @@ -101,5 +101,5 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { return sdet; } -DECLARE_DETELEMENT(DD4hep_CylindricalEndcapCalorimeter,create_detector) +DECLARE_DETELEMENT(dd4hep_CylindricalEndcapCalorimeter,create_detector) DECLARE_DEPRECATED_DETELEMENT(CylindricalEndcapCalorimeter,create_detector) diff --git a/DDDetectors/src/DiskTracker_geo.cpp b/DDDetectors/src/DiskTracker_geo.cpp index f1e9a2d0a..8d3ca4b5b 100644 --- a/DDDetectors/src/DiskTracker_geo.cpp +++ b/DDDetectors/src/DiskTracker_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,12 +18,12 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; - Material air = lcdd.air(); + Material air = description.air(); string det_name = x_det.nameStr(); bool reflect = x_det.reflect(); DetElement sdet(det_name,x_det.id()); @@ -46,11 +46,11 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } Tube l_tub(rmin,rmax,layerWidth,2*M_PI); Volume l_vol(l_nam,l_tub,air); - l_vol.setVisAttributes(lcdd,x_layer.visStr()); + l_vol.setVisAttributes(description,x_layer.visStr()); for(xml_coll_t j(x_layer,_U(slice)); j; ++j, ++s_num) { xml_comp_t x_slice = j; double thick = x_slice.thickness(); - Material mat = lcdd.material(x_slice.materialStr()); + Material mat = description.material(x_slice.materialStr()); string s_nam = l_nam+_toString(s_num,"_slice%d"); Volume s_vol(s_nam, Tube(rmin,rmax,thick), mat); @@ -58,7 +58,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { sens.setType("tracker"); s_vol.setSensitiveDetector(sens); } - s_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + s_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); pv = l_vol.placeVolume(s_vol,Position(0,0,z-zmin-layerWidth/2+thick/2)); pv.addPhysVolID("slice",s_num); } @@ -79,11 +79,11 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { if ( x_det.hasAttr(_U(combineHits)) ) { sdet.setCombineHits(x_det.attr<bool>(_U(combineHits)),sens); } - pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); + pv = description.pickMotherVolume(sdet).placeVolume(assembly); pv.addPhysVolID("system", x_det.id()); // Set the subdetector system ID. sdet.setPlacement(pv); return sdet; } -DECLARE_DETELEMENT(DD4hep_DiskTracker,create_detector) +DECLARE_DETELEMENT(dd4hep_DiskTracker,create_detector) DECLARE_DEPRECATED_DETELEMENT(DiskTracker,create_detector) diff --git a/DDDetectors/src/EcalBarrel_geo.cpp b/DDDetectors/src/EcalBarrel_geo.cpp index b1d1e8808..8a608d96c 100644 --- a/DDDetectors/src/EcalBarrel_geo.cpp +++ b/DDDetectors/src/EcalBarrel_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,14 +19,14 @@ #include "XML/Layering.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { static double tolerance = 0e0; Layering layering (e); xml_det_t x_det = e; - Material air = lcdd.air(); + Material air = description.air(); int det_id = x_det.id(); string det_name = x_det.nameStr(); xml_comp_t x_staves = x_det.staves(); @@ -39,7 +39,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double outer_r = inner_r + mod_z; double totThick = mod_z; DetElement sdet (det_name,det_id); - Volume motherVol = lcdd.pickMotherVolume(sdet); + Volume motherVol = description.pickMotherVolume(sdet); PolyhedraRegular hedra (nsides,inner_r,inner_r+totThick+tolerance*2e0,x_dim.z()); Volume envelope (det_name,hedra,air); PlacedVolume env_phv = motherVol.placeVolume(envelope,RotationZYX(0,0,M_PI/nsides)); @@ -68,7 +68,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { Volume mod_vol("stave",trd,air); sens.setType("calorimeter"); - { // ===== buildBarrelStave(lcdd, sens, module_volume) ===== + { // ===== buildBarrelStave(description, sens, module_volume) ===== // Parameters for computing the layer X dimension: double stave_z = trd_y1/2; double l_dim_x = trd_x1/2; // Starting X dimension for the layer. @@ -103,13 +103,13 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { string s_name = _toString(s_num,"slice%d"); double s_thick = x_slice.thickness(); Box s_box(l_dim_x*2-tolerance,stave_z*2-tolerance,s_thick-tolerance); - Volume s_vol(s_name,s_box,lcdd.material(x_slice.materialStr())); + Volume s_vol(s_name,s_box,description.material(x_slice.materialStr())); DetElement slice(layer,s_name,det_id); if ( x_slice.isSensitive() ) { s_vol.setSensitiveDetector(sens); } - slice.setAttributes(lcdd,s_vol,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + slice.setAttributes(description,s_vol,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // Slice placement. PlacedVolume slice_phv = l_vol.placeVolume(s_vol,Position(0,0,s_pos_z+s_thick/2)); @@ -123,7 +123,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } // Set region, limitset, and vis of layer. - layer.setAttributes(lcdd,l_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); + layer.setAttributes(description,l_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); PlacedVolume layer_phv = mod_vol.placeVolume(l_vol,l_pos); layer_phv.addPhysVolID("layer", l_num); @@ -137,7 +137,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // Set stave visualization. if ( x_staves ) { - mod_vol.setVisAttributes(lcdd.visAttributes(x_staves.visStr())); + mod_vol.setVisAttributes(description.visAttributes(x_staves.visStr())); } // Phi start for a stave. double phi = M_PI / nsides; @@ -160,9 +160,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } // Set envelope volume attributes. - envelope.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + envelope.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); return sdet; } -DECLARE_DETELEMENT(DD4hep_EcalBarrel,create_detector) +DECLARE_DETELEMENT(dd4hep_EcalBarrel,create_detector) DECLARE_DEPRECATED_DETELEMENT(EcalBarrel,create_detector) diff --git a/DDDetectors/src/ForwardDetector_geo.cpp b/DDDetectors/src/ForwardDetector_geo.cpp index 540a28260..c0c8e3d8e 100644 --- a/DDDetectors/src/ForwardDetector_geo.cpp +++ b/DDDetectors/src/ForwardDetector_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,21 +19,21 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; xml_dim_t dim = x_det.dimensions(); bool reflect = x_det.reflect(); xml_comp_t beam = x_det.beampipe(); string det_name = x_det.nameStr(); int id = x_det.id(); - Material air = lcdd.air(); + Material air = description.air(); DetElement sdet (det_name,id); Layering layering (x_det); - Volume motherVol = lcdd.pickMotherVolume(sdet); + Volume motherVol = description.pickMotherVolume(sdet); double rmax = dim.outer_r(); double rmin = dim.inner_r(); @@ -116,7 +116,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { string slice_nam = _toString(sliceCount,"slice%d"); /** Get slice parameters. */ double sliceThickness = x_slice.thickness(); - Material slice_mat = lcdd.material(x_slice.materialStr()); + Material slice_mat = description.material(x_slice.materialStr()); // Go to mid of this slice. sliceDisplZ += sliceThickness / 2; @@ -140,7 +140,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { sliceVol.setSensitiveDetector(sens); } // Set attributes of slice - slice.setAttributes(lcdd, sliceVol, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + slice.setAttributes(description, sliceVol, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); // Place volume in layer PlacedVolume pv = layerVol.placeVolume(sliceVol,Position(0,0,slicePosZ)); @@ -153,7 +153,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { ++sliceCount; } // Set attributes of slice - layer.setAttributes(lcdd, layerVol, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr()); + layer.setAttributes(description, layerVol, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr()); // Layer PV. PlacedVolume layerPV = envelopeVol.placeVolume(layerVol,Position(0,0,layerPosZ)); @@ -166,7 +166,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { ++layerCount; } } - sdet.setVisAttributes(lcdd, x_det.visStr(), envelopeVol); + sdet.setVisAttributes(description, x_det.visStr(), envelopeVol); // Reflect it. if ( reflect ) { @@ -195,5 +195,5 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { return sdet; } -DECLARE_DETELEMENT(DD4hep_ForwardDetector,create_detector) +DECLARE_DETELEMENT(dd4hep_ForwardDetector,create_detector) DECLARE_DEPRECATED_DETELEMENT(ForwardDetector,create_detector) diff --git a/DDDetectors/src/GenericSurfaceInstaller.cpp b/DDDetectors/src/GenericSurfaceInstaller.cpp index d8e74aaaa..bdce522f8 100644 --- a/DDDetectors/src/GenericSurfaceInstaller.cpp +++ b/DDDetectors/src/GenericSurfaceInstaller.cpp @@ -7,13 +7,13 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -// Author : N. Nikiforou, adapted from DD4hep/SiTrackerBarrel_surfaces.cpp +// Author : N. Nikiforou, adapted from dd4hep/SiTrackerBarrel_surfaces.cpp // by M. Frank. Originally part of the lcgeo package //========================================================================== /** \addtogroup SurfacePlugin * @{ - * \package DD4hep_GenericSurfaceInstallerPlugin + * \package dd4hep_GenericSurfaceInstallerPlugin * \brief Plugin to install measurement surfaces on a generic sliced detector * * Takes up to 13 arguments: @@ -34,7 +34,7 @@ * plugin for the VertexEndcap detector, put this snippet in the relevant compact file: * \verbatim <plugins> - <plugin name="DD4hep_GenericSurfaceInstallerPlugin"> + <plugin name="dd4hep_GenericSurfaceInstallerPlugin"> <argument value="VertexEndcap"/> <argument value="dimension=2"/> <argument value="u_x=-1."/> @@ -70,7 +70,7 @@ namespace { // Framework include files #define SURFACEINSTALLER_DATA UserData -#define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_GenericSurfaceInstallerPlugin +#define DD4HEP_USE_SURFACEINSTALL_HELPER dd4hep_GenericSurfaceInstallerPlugin #include "DD4hep/SurfaceInstaller.h" namespace{ @@ -96,8 +96,8 @@ namespace{ char* ptr = ::strchr(argv[i],'='); if ( ptr ) { std::string name( argv[i] , ptr ) ; - value = DD4hep::_toDouble(++ptr); - std::cout << "DD4hep_GenericSurfaceInstallerPlugin: argument[" << i << "] = " << name + value = dd4hep::_toDouble(++ptr); + std::cout << "dd4hep_GenericSurfaceInstallerPlugin: argument[" << i << "] = " << name << " = " << value << std::endl; if( name=="dimension" ) data.dimension = value ; if( name=="u_x" ) data.uvector[0]=value ; @@ -115,7 +115,7 @@ namespace{ } } - std::cout <<"DD4hep_GenericSurfaceInstallerPlugin: vectors: "; + std::cout <<"dd4hep_GenericSurfaceInstallerPlugin: vectors: "; std::cout <<"u( "<<data.uvector[0]<<" , "<<data.uvector[1]<<" , "<<data.uvector[2]<<") "; std::cout <<"v( "<<data.vvector[0]<<" , "<<data.vvector[1]<<" , "<<data.vvector[2]<<") "; std::cout <<"n( "<<data.nvector[0]<<" , "<<data.nvector[1]<<" , "<<data.nvector[2]<<") "; @@ -125,15 +125,15 @@ namespace{ /// Install measurement surfaces template <typename UserData> - void Installer<UserData>::install(DetElement component, PlacedVolume pv) { - Volume comp_vol = pv.volume(); + void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVolume pv) { + dd4hep::Volume comp_vol = pv.volume(); if ( comp_vol.isSensitive() ) { - Volume mod_vol = parentVolume(component); + dd4hep::Volume mod_vol = parentVolume(component); //FIXME: WHAT IF TRAPEZOID? Should work if trapezoid since it will fit minimal box and dy1=dy2=dy - DD4hep::Geometry::Box mod_shape(mod_vol.solid()), comp_shape(comp_vol.solid()); + dd4hep::Box mod_shape(mod_vol.solid()), comp_shape(comp_vol.solid()); if ( !comp_shape.isValid() || !mod_shape.isValid() ) { - invalidInstaller("DD4hep_GenericSurfaceInstallerPlugin: Components and/or modules are not boxes -- invalid shapes"); + invalidInstaller("dd4hep_GenericSurfaceInstallerPlugin: Components and/or modules are not boxes -- invalid shapes"); }else if ( !handleUsingCache(component,comp_vol) ) { const double* trans = placementTranslation(component); @@ -152,7 +152,7 @@ namespace{ sensitive_z_position = data.nvector[2]>0 ? trans[2] : -trans[2]; } else { - throw std::runtime_error("**** DD4hep_GenericSurfaceInstallerPlugin: normal vector unsupported! It has to be " + throw std::runtime_error("**** dd4hep_GenericSurfaceInstallerPlugin: normal vector unsupported! It has to be " "perpenidcular to one of the box sides, i.e. only one non-zero component.") ; } @@ -170,7 +170,7 @@ namespace{ if( data.dimension == 1 ) { type.setProperty( Type::Measurement1D , true ) ; } else if( data.dimension != 2 ) { - throw std::runtime_error("**** DD4hep_GenericSurfaceInstallerPlugin: no or wrong " + throw std::runtime_error("**** dd4hep_GenericSurfaceInstallerPlugin: no or wrong " "'dimension' argument given - has to be 1 or 2") ; } VolPlane surf(comp_vol, type, inner_thickness, outer_thickness, u, v, n, o); diff --git a/DDDetectors/src/LayeringExtensionPlugin.cpp b/DDDetectors/src/LayeringExtensionPlugin.cpp index 3dc8c6213..4779057c9 100644 --- a/DDDetectors/src/LayeringExtensionPlugin.cpp +++ b/DDDetectors/src/LayeringExtensionPlugin.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,8 +17,8 @@ #include <map> #include "DDRec/Extensions/LayeringExtensionImpl.h" -using namespace DD4hep::DDRec; -using namespace DD4hep::Geometry; +using namespace dd4hep::rec; +using namespace dd4hep; namespace { struct LayeringContext { diff --git a/DDDetectors/src/Mask_o1_v01_geo.cpp b/DDDetectors/src/Mask_o1_v01_geo.cpp index bc6b56114..183d402e7 100644 --- a/DDDetectors/src/Mask_o1_v01_geo.cpp +++ b/DDDetectors/src/Mask_o1_v01_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,24 +17,25 @@ #include <cmath> #include <string> -using DD4hep::Geometry::Transform3D; -using DD4hep::Geometry::Position; -using DD4hep::Geometry::RotationY; -using DD4hep::Geometry::RotateY; -using DD4hep::Geometry::ConeSegment; -using DD4hep::Geometry::SubtractionSolid; -using DD4hep::Geometry::Material; -using DD4hep::Geometry::Volume; -using DD4hep::Geometry::Solid; -using DD4hep::Geometry::Tube; -using DD4hep::Geometry::PlacedVolume; -using DD4hep::Geometry::Assembly; - -static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, +using dd4hep::Transform3D; +using dd4hep::Position; +using dd4hep::RotationY; +using dd4hep::RotateY; +using dd4hep::ConeSegment; +using dd4hep::SubtractionSolid; +using dd4hep::Material; +using dd4hep::Volume; +using dd4hep::Solid; +using dd4hep::Tube; +using dd4hep::PlacedVolume; +using dd4hep::Assembly; +namespace units = dd4hep; + +static dd4hep::Ref_t create_element(dd4hep::Detector& description, xml_h xmlHandle, - DD4hep::Geometry::SensitiveDetector /*sens*/) { + dd4hep::SensitiveDetector /*sens*/) { - printout(DD4hep::DEBUG,"DD4hep_Mask", "Creating Mask" ) ; + printout(dd4hep::DEBUG,"dd4hep_Mask", "Creating Mask" ) ; //Access to the XML File xml_det_t xmlMask = xmlHandle; @@ -44,13 +45,13 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, Assembly envelope( name + "_assembly" ) ; //-------------------------------- - DD4hep::Geometry::DetElement tube( name, xmlMask.id() ) ; + dd4hep::DetElement tube( name, xmlMask.id() ) ; const double phi1 = 0 ; - const double phi2 = 360.0*dd4hep::degree; + const double phi2 = 360.0*units::degree; //Parameters we have to know about - DD4hep::XML::Component xmlParameter = xmlMask.child(_Unicode(parameter)); + dd4hep::xml::Component xmlParameter = xmlMask.child(_Unicode(parameter)); const double crossingAngle = xmlParameter.attr< double >(_Unicode(crossingangle))*0.5; // only half the angle for(xml_coll_t c( xmlMask ,Unicode("section")); c; ++c) { @@ -65,22 +66,22 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, const double rOuterStart = xmlSection.attr< double > (_Unicode(rMax1)); const double rOuterEnd = xmlSection.attr< double > (_Unicode(rMax2)); const double thickness = rOuterStart - rInnerStart; - Material sectionMat = lcdd.material(xmlSection.materialStr()); + Material sectionMat = description.material(xmlSection.materialStr()); const std::string volName = "tube_" + xmlSection.nameStr(); std::stringstream pipeInfo; - pipeInfo << std::setw(8) << zStart /dd4hep::mm - << std::setw(8) << zEnd /dd4hep::mm - << std::setw(8) << rInnerStart /dd4hep::mm - << std::setw(8) << rInnerEnd /dd4hep::mm - << std::setw(8) << rOuterStart /dd4hep::mm - << std::setw(8) << rOuterEnd /dd4hep::mm - << std::setw(8) << thickness /dd4hep::mm + pipeInfo << std::setw(8) << zStart /units::mm + << std::setw(8) << zEnd /units::mm + << std::setw(8) << rInnerStart /units::mm + << std::setw(8) << rInnerEnd /units::mm + << std::setw(8) << rOuterStart /units::mm + << std::setw(8) << rOuterEnd /units::mm + << std::setw(8) << thickness /units::mm << std::setw(8) << crossType << std::setw(35) << volName << std::setw(15) << sectionMat.name(); - printout(DD4hep::INFO, "DD4hep_Mask", pipeInfo.str() ); + printout(dd4hep::INFO, "dd4hep_Mask", pipeInfo.str() ); // things which can be calculated immediately const double zHalf = fabs(zEnd - zStart) * 0.5; // half z length of the cone @@ -111,7 +112,7 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, // tube consists of vacuum Volume tubeLog( volName, tubeSolid, material ) ; - tubeLog.setVisAttributes(lcdd, xmlMask.visStr() ); + tubeLog.setVisAttributes(description, xmlMask.visStr() ); // placement of the tube in the world, both at +z and -z envelope.placeVolume( tubeLog, transformer ); @@ -163,8 +164,8 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, // tube consists of vacuum (will later have two different daughters) Volume tubeLog0( volName + "_0", finalSolid0, material ); Volume tubeLog1( volName + "_1", finalSolid1, material ); - tubeLog0.setVisAttributes(lcdd, xmlMask.visStr() ); - tubeLog1.setVisAttributes(lcdd, xmlMask.visStr() ); + tubeLog0.setVisAttributes(description, xmlMask.visStr() ); + tubeLog1.setVisAttributes(description, xmlMask.visStr() ); // placement of the tube in the world, both at +z and -z envelope.placeVolume( tubeLog0, placementTransformer ); @@ -202,8 +203,8 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, // tube consists of vacuum (will later have two different daughters) Volume tubeLog0( volName + "_0", finalSolid0, material ); Volume tubeLog1( volName + "_1", finalSolid1, material ); - tubeLog0.setVisAttributes(lcdd, xmlMask.visStr() ); - tubeLog1.setVisAttributes(lcdd, xmlMask.visStr() ); + tubeLog0.setVisAttributes(description, xmlMask.visStr() ); + tubeLog1.setVisAttributes(description, xmlMask.visStr() ); // placement of the tube in the world, both at +z and -z envelope.placeVolume( tubeLog0, placementTransformer ); @@ -219,14 +220,14 @@ static DD4hep::Geometry::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, }//for all xmlSections //-------------------------------------- - Volume mother = lcdd.pickMotherVolume( tube ) ; + Volume mother = description.pickMotherVolume( tube ) ; PlacedVolume pv(mother.placeVolume(envelope)); pv.addPhysVolID( "system", xmlMask.id() ) ; //.addPhysVolID("side", 0 ) ; - tube.setVisAttributes( lcdd, xmlMask.visStr(), envelope ); + tube.setVisAttributes( description, xmlMask.visStr(), envelope ); tube.setPlacement(pv); return tube; } -DECLARE_DETELEMENT(DD4hep_Mask_o1_v01,create_element) +DECLARE_DETELEMENT(dd4hep_Mask_o1_v01,create_element) diff --git a/DDDetectors/src/MultiLayerTracker_geo.cpp b/DDDetectors/src/MultiLayerTracker_geo.cpp index 206cf55c6..ead77cdd8 100644 --- a/DDDetectors/src/MultiLayerTracker_geo.cpp +++ b/DDDetectors/src/MultiLayerTracker_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,13 +17,13 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; string det_name = x_det.nameStr(); - Material air = lcdd.air(); + Material air = description.air(); DetElement sdet (det_name,x_det.id()); Assembly assembly (det_name+"_assembly"); PlacedVolume pv; @@ -42,7 +42,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { for(xml_coll_t j(x_layer,_U(slice)); j; ++j, ++m) { xml_comp_t x_slice = j; - Material mat = lcdd.material(x_slice.materialStr()); + Material mat = description.material(x_slice.materialStr()); string s_name= l_name+_toString(m,"_slice%d"); double thickness = x_slice.thickness(); Tube s_tub(r,r+thickness,z,2*M_PI); @@ -54,14 +54,14 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { s_vol.setSensitiveDetector(sens); } // Set Attributes - s_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + s_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); pv = l_vol.placeVolume(s_vol); // Slices have no extra id. Take the ID of the layer! pv.addPhysVolID("slice",m); } l_tub.setDimensions(rmin,r,z); //cout << l_name << " " << rmin << " " << r << " " << z << endl; - l_vol.setVisAttributes(lcdd,x_layer.visStr()); + l_vol.setVisAttributes(description,x_layer.visStr()); pv = assembly.placeVolume(l_vol); pv.addPhysVolID("layer",n); @@ -71,11 +71,11 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { sdet.setCombineHits(x_det.combineHits(),sens); } - pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); + pv = description.pickMotherVolume(sdet).placeVolume(assembly); pv.addPhysVolID("system",sdet.id()).addPhysVolID("barrel",0); sdet.setPlacement(pv); return sdet; } -DECLARE_DETELEMENT(DD4hep_MultiLayerTracker,create_detector) +DECLARE_DETELEMENT(dd4hep_MultiLayerTracker,create_detector) DECLARE_DEPRECATED_DETELEMENT(MultiLayerTracker,create_detector) diff --git a/DDDetectors/src/PolyconeSupport_geo.cpp b/DDDetectors/src/PolyconeSupport_geo.cpp index 7030df9e8..528858987 100644 --- a/DDDetectors/src/PolyconeSupport_geo.cpp +++ b/DDDetectors/src/PolyconeSupport_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,14 +17,14 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, Ref_t sens) { +static Ref_t create_detector(Detector& description, xml_h e, Ref_t sens) { xml_det_t x_det = e; string name = x_det.nameStr(); DetElement sdet (name,x_det.id()); - Material mat (lcdd.material(x_det.materialStr())); + Material mat (description.material(x_det.materialStr())); vector<double> rmin,rmax,z; int num = 0; @@ -39,12 +39,12 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, Ref_t sens) { } Polycone cone (0,2*M_PI,rmin,rmax,z); Volume det_vol(name, cone, mat); - PlacedVolume pv = lcdd.pickMotherVolume(sdet).placeVolume(det_vol); + PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(det_vol); sdet.setPlacement(pv); - det_vol.setVisAttributes(lcdd, x_det.visStr()); - det_vol.setLimitSet(lcdd, x_det.limitsStr()); - det_vol.setRegion(lcdd, x_det.regionStr()); + det_vol.setVisAttributes(description, x_det.visStr()); + det_vol.setLimitSet(description, x_det.limitsStr()); + det_vol.setRegion(description, x_det.regionStr()); if ( x_det.isSensitive() ) { SensitiveDetector sd = sens; xml_dim_t sd_typ = x_det.child(_U(sensitive)); @@ -59,5 +59,5 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, Ref_t sens) { return sdet; } -DECLARE_DETELEMENT(DD4hep_PolyconeSupport,create_detector) +DECLARE_DETELEMENT(dd4hep_PolyconeSupport,create_detector) DECLARE_DEPRECATED_DETELEMENT(PolyconeSupport,create_detector) diff --git a/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp b/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp index 96a7186f2..8b382fe20 100644 --- a/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp +++ b/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,8 +18,8 @@ #include "XML/Layering.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; static void placeStaves(DetElement& parent, DetElement& stave, double rmin, int numsides, double total_thickness, Volume envelopeVolume, double innerAngle, Volume sectVolume) { @@ -45,13 +45,13 @@ static void placeStaves(DetElement& parent, DetElement& stave, double rmin, int } } -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; Layering layering(x_det); xml_comp_t staves = x_det.staves(); xml_dim_t dim = x_det.dimensions(); string det_name = x_det.nameStr(); - Material air = lcdd.air(); + Material air = description.air(); double totalThickness = layering.totalThickness(); double gap = xml_dim_t(x_det).gap(); int numSides = dim.numsides(); @@ -59,7 +59,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double rmin = dim.rmin(); DetElement sdet(det_name, x_det.id()); DetElement stave("stave1", x_det.id()); - Volume motherVol = lcdd.pickMotherVolume(sdet); + Volume motherVol = description.pickMotherVolume(sdet); #if 0 int totalRepeat = 0; @@ -120,7 +120,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_comp_t x_slice = k; string slice_name = _toString(slice_number, "slice%d"); double slice_thickness = x_slice.thickness(); - Material slice_material = lcdd.material(x_slice.materialStr()); + Material slice_material = description.material(x_slice.materialStr()); DetElement slice(layer, slice_name, slice_number); slice_pos_z += slice_thickness / 2; @@ -132,7 +132,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { slice_vol.setSensitiveDetector(sens); } // Set region, limitset, and vis. - slice_vol.setAttributes(lcdd, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + slice_vol.setAttributes(description, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); // slice PlacedVolume PlacedVolume slice_phv = layer_vol.placeVolume(slice_vol, Position(0, 0, slice_pos_z)); slice_phv.addPhysVolID("slice", slice_number); @@ -144,7 +144,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { ++slice_number; } // Set region, limitset, and vis. - layer_vol.setAttributes(lcdd, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr()); + layer_vol.setAttributes(description, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr()); // Layer physical volume. PlacedVolume layer_phv = staveInnerVol.placeVolume(layer_vol, Position(0, 0, layer_pos_z)); @@ -164,13 +164,13 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { staveOuterVol.placeVolume(staveInnerVol); if ( staves ) { // Set the vis attributes of the outer stave section. - stave.setVisAttributes(lcdd, staves.visStr(), staveInnerVol); - stave.setVisAttributes(lcdd, staves.visStr(), staveOuterVol); + stave.setVisAttributes(description, staves.visStr(), staveInnerVol); + stave.setVisAttributes(description, staves.visStr(), staveOuterVol); } // Place the staves. placeStaves(sdet, stave, rmin, numSides, totalThickness, envelopeVol, innerAngle, staveOuterVol); // Set envelope volume attributes. - envelopeVol.setAttributes(lcdd, x_det.regionStr(), x_det.limitsStr(), x_det.visStr()); + envelopeVol.setAttributes(description, x_det.regionStr(), x_det.limitsStr(), x_det.visStr()); double z_offset = dim.hasAttr(_U(z_offset)) ? dim.z_offset() : 0.0; Transform3D transform(RotationZ(M_PI / numSides), Translation3D(0, 0, z_offset)); @@ -184,5 +184,5 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { return sdet; } -DECLARE_DETELEMENT(DD4hep_PolyhedraBarrelCalorimeter2, create_detector) +DECLARE_DETELEMENT(dd4hep_PolyhedraBarrelCalorimeter2, create_detector) DECLARE_DEPRECATED_DETELEMENT(PolyhedraBarrelCalorimeter2,create_detector) diff --git a/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp b/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp index f8875eb3b..9aa4ee684 100644 --- a/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp +++ b/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,16 +18,16 @@ #include "XML/Layering.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; xml_dim_t dim = x_det.dimensions(); int det_id = x_det.id(); bool reflect = x_det.reflect(true); string det_name = x_det.nameStr(); - Material air = lcdd.air(); + Material air = description.air(); int numsides = dim.numsides(); double rmin = dim.rmin(); double rmax = dim.rmax()*std::cos(M_PI/numsides); @@ -41,7 +41,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { int layerType = 0; double layerZ = -totalThickness/2; - endcapVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + endcapVol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); for(xml_coll_t c(x_det,_U(layer)); c; ++c) { xml_comp_t x_layer = c; @@ -57,10 +57,10 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_comp_t x_slice = s; string s_name = _toString(s_num,"slice%d"); double s_thick = x_slice.thickness(); - Material s_mat = lcdd.material(x_slice.materialStr()); + Material s_mat = description.material(x_slice.materialStr()); Volume s_vol(s_name,PolyhedraRegular(numsides,rmin,rmax,s_thick),s_mat); - s_vol.setVisAttributes(lcdd.visAttributes(x_slice.visStr())); + s_vol.setVisAttributes(description.visAttributes(x_slice.visStr())); sliceZ += s_thick/2; PlacedVolume s_phv = l_vol.placeVolume(s_vol,Position(0,0,sliceZ)); s_phv.addPhysVolID("slice",s_num); @@ -72,7 +72,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { sliceZ += s_thick/2; s_num++; } - l_vol.setVisAttributes(lcdd.visAttributes(x_layer.visStr())); + l_vol.setVisAttributes(description.visAttributes(x_layer.visStr())); if ( l_repeat <= 0 ) throw std::runtime_error(x_det.nameStr()+"> Invalid repeat value"); for(int j=0; j<l_repeat; ++j) { string phys_lay = _toString(l_num,"layer%d"); @@ -98,7 +98,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { if ( reflect ) { Assembly assembly(det_name); DetElement both_endcaps(det_name,det_id); - Volume motherVol = lcdd.pickMotherVolume(both_endcaps); + Volume motherVol = description.pickMotherVolume(both_endcaps); DetElement sdetA = endcap; Ref_t(sdetA)->SetName((det_name+"_A").c_str()); DetElement sdetB = endcap.clone(det_name+"_B",x_det.id()); @@ -120,7 +120,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { both_endcaps.add(sdetB); return both_endcaps; } - Volume motherVol = lcdd.pickMotherVolume(endcap); + Volume motherVol = description.pickMotherVolume(endcap); pv = motherVol.placeVolume(endcapVol,Transform3D(RotationZYX(M_PI/numsides,0,0), Position(0,0,z_pos))); pv.addPhysVolID("system", det_id); @@ -130,5 +130,5 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { return endcap; } -DECLARE_DETELEMENT(DD4hep_PolyhedraEndcapCalorimeter2,create_detector) +DECLARE_DETELEMENT(dd4hep_PolyhedraEndcapCalorimeter2,create_detector) DECLARE_DEPRECATED_DETELEMENT(PolyhedraEndcapCalorimeter2,create_detector) diff --git a/DDDetectors/src/PolyhedraEndcapCalorimeter2_surfaces.cpp b/DDDetectors/src/PolyhedraEndcapCalorimeter2_surfaces.cpp index 19080db7b..d098e11c7 100644 --- a/DDDetectors/src/PolyhedraEndcapCalorimeter2_surfaces.cpp +++ b/DDDetectors/src/PolyhedraEndcapCalorimeter2_surfaces.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,22 +15,22 @@ // //========================================================================== // Framework include files -#define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_PolyhedraEndcapCalorimeterSurfacePlugin +#define DD4HEP_USE_SURFACEINSTALL_HELPER dd4hep_PolyhedraEndcapCalorimeterSurfacePlugin #include "DD4hep/SurfaceInstaller.h" /// Install measurement surfaces template <typename UserData> -void Installer<UserData>::install(DetElement component, PlacedVolume pv) { - Volume comp_vol = pv.volume(); +void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVolume pv) { + dd4hep::Volume comp_vol = pv.volume(); if ( comp_vol.isSensitive() ) { - Volume mod_vol = parentVolume(component); - DD4hep::Geometry::PolyhedraRegular comp_shape(comp_vol.solid()), mod_shape(mod_vol.solid()); + dd4hep::Volume mod_vol = parentVolume(component); + dd4hep::PolyhedraRegular comp_shape(comp_vol.solid()), mod_shape(mod_vol.solid()); if ( !comp_shape.isValid() || !mod_shape.isValid() ) { invalidInstaller("Components and/or modules are not Trapezoid -- invalid shapes"); } else if ( !handleUsingCache(component,comp_vol) ) { - DetElement par = component.parent(); + dd4hep::DetElement par = component.parent(); const TGeoHMatrix& m = par.nominal().worldTransformation(); double dz = m.GetTranslation()[2]; const double* trans = placementTranslation(component); diff --git a/DDDetectors/src/SiTrackerBarrel_geo.cpp b/DDDetectors/src/SiTrackerBarrel_geo.cpp index 78f1349c7..2bcde0c3e 100644 --- a/DDDetectors/src/SiTrackerBarrel_geo.cpp +++ b/DDDetectors/src/SiTrackerBarrel_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,13 +18,13 @@ #include "DD4hep/Printout.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { typedef vector<PlacedVolume> Placements; xml_det_t x_det = e; - Material air = lcdd.air(); + Material air = description.air(); int det_id = x_det.id(); string det_name = x_det.nameStr(); DetElement sdet (det_name,det_id); @@ -46,14 +46,14 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { throw runtime_error("Logics error in building modules."); } volumes[m_nam] = m_vol; - m_vol.setVisAttributes(lcdd.visAttributes(x_mod.visStr())); + m_vol.setVisAttributes(description.visAttributes(x_mod.visStr())); for(xml_coll_t ci(x_mod,_U(module_component)); ci; ++ci, ++ncomponents) { xml_comp_t x_comp = ci; xml_comp_t x_pos = x_comp.position(false); xml_comp_t x_rot = x_comp.rotation(false); string c_nam = _toString(ncomponents,"component%d"); Box c_box(x_comp.width()/2,x_comp.length()/2,x_comp.thickness()/2); - Volume c_vol(c_nam,c_box,lcdd.material(x_comp.materialStr())); + Volume c_vol(c_nam,c_box,description.material(x_comp.materialStr())); if ( x_pos && x_rot ) { Position c_pos(x_pos.x(0),x_pos.y(0),x_pos.z(0)); @@ -69,9 +69,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { else { pv = m_vol.placeVolume(c_vol); } - c_vol.setRegion(lcdd, x_comp.regionStr()); - c_vol.setLimitSet(lcdd, x_comp.limitsStr()); - c_vol.setVisAttributes(lcdd, x_comp.visStr()); + c_vol.setRegion(description, x_comp.regionStr()); + c_vol.setLimitSet(description, x_comp.limitsStr()); + c_vol.setVisAttributes(description, x_comp.visStr()); if ( x_comp.isSensitive() ) { pv.addPhysVolID(_U(sensor),sensor_number++); c_vol.setSensitiveDetector(sens); @@ -155,17 +155,17 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // Create the PhysicalVolume for the layer. pv = assembly.placeVolume(lay_vol); // Place layer in mother pv.addPhysVolID("layer", lay_id); // Set the layer ID. - lay_elt.setAttributes(lcdd,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); + lay_elt.setAttributes(description,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); lay_elt.setPlacement(pv); } - sdet.setAttributes(lcdd,assembly,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); - assembly.setVisAttributes(lcdd.invisible()); - pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); + sdet.setAttributes(description,assembly,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + assembly.setVisAttributes(description.invisible()); + pv = description.pickMotherVolume(sdet).placeVolume(assembly); pv.addPhysVolID("system", det_id); // Set the subdetector system ID. pv.addPhysVolID("barrel", 0); // Flag this as a barrel subdetector. sdet.setPlacement(pv); return sdet; } -DECLARE_DETELEMENT(DD4hep_SiTrackerBarrel,create_detector) +DECLARE_DETELEMENT(dd4hep_SiTrackerBarrel,create_detector) DECLARE_DEPRECATED_DETELEMENT(SiTrackerBarrel,create_detector) diff --git a/DDDetectors/src/SiTrackerBarrel_surfaces.cpp b/DDDetectors/src/SiTrackerBarrel_surfaces.cpp index 63c64339d..c20aa9400 100644 --- a/DDDetectors/src/SiTrackerBarrel_surfaces.cpp +++ b/DDDetectors/src/SiTrackerBarrel_surfaces.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +23,7 @@ namespace { // Framework include files #define SURFACEINSTALLER_DATA UserData -#define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_SiTrackerBarrelSurfacePlugin +#define DD4HEP_USE_SURFACEINSTALL_HELPER dd4hep_SiTrackerBarrelSurfacePlugin #include "DD4hep/SurfaceInstaller.h" namespace{ @@ -33,9 +32,9 @@ namespace{ char* ptr = ::strchr(argv[i],'='); if ( ptr ) { std::string name( argv[i] , ptr ) ; - double value = DD4hep::_toDouble(++ptr); + double value = dd4hep::_toDouble(++ptr); if( name=="dimension" ) data.dimension = value ; - std::cout << "DD4hep_SiTrackerBarrelSurfacePlugin: argument[" << i << "] = " << name + std::cout << "dd4hep_SiTrackerBarrelSurfacePlugin: argument[" << i << "] = " << name << " = " << value << std::endl; } } @@ -43,11 +42,11 @@ namespace{ /// Install measurement surfaces template <typename UserData> - void Installer<UserData>::install(DetElement component, PlacedVolume pv) { - Volume comp_vol = pv.volume(); + void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVolume pv) { + dd4hep::Volume comp_vol = pv.volume(); if ( comp_vol.isSensitive() ) { - Volume mod_vol = parentVolume(component); - DD4hep::Geometry::Box mod_shape(mod_vol.solid()), comp_shape(comp_vol.solid()); + dd4hep::Volume mod_vol = parentVolume(component); + dd4hep::Box mod_shape(mod_vol.solid()), comp_shape(comp_vol.solid()); if ( !comp_shape.isValid() || !mod_shape.isValid() ) { invalidInstaller("Components and/or modules are not boxes -- invalid shapes"); @@ -67,7 +66,7 @@ namespace{ if( data.dimension == 1 ) { type.setProperty( Type::Measurement1D , true ) ; } else if( data.dimension != 2 ) { - throw std::runtime_error("**** DD4hep_SiTrackerBarrelSurfacePlugin: no or wrong " + throw std::runtime_error("**** dd4hep_SiTrackerBarrelSurfacePlugin: no or wrong " "'dimension' argument given - has to be 1 or 2") ; } VolPlane surf(comp_vol, type, inner_thickness, outer_thickness, u, v, n, o); diff --git a/DDDetectors/src/SiTrackerEndcap2_geo.cpp b/DDDetectors/src/SiTrackerEndcap2_geo.cpp index 25123ab4c..b422ce6cc 100644 --- a/DDDetectors/src/SiTrackerEndcap2_geo.cpp +++ b/DDDetectors/src/SiTrackerEndcap2_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,26 +19,26 @@ #include <map> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { typedef vector<PlacedVolume> Placements; xml_det_t x_det = e; - Material vacuum = lcdd.vacuum(); + Material vacuum = description.vacuum(); int det_id = x_det.id(); string det_name = x_det.nameStr(); bool reflect = x_det.reflect(false); DetElement sdet (det_name,det_id); Assembly assembly (det_name); //Volume assembly (det_name,Box(10000,10000,10000),vacuum); - Volume motherVol = lcdd.pickMotherVolume(sdet); + Volume motherVol = description.pickMotherVolume(sdet); int m_id=0, c_id=0, n_sensor=0; map<string,Volume> modules; map<string, Placements> sensitives; PlacedVolume pv; - assembly.setVisAttributes(lcdd.invisible()); + assembly.setVisAttributes(description.invisible()); sens.setType("tracker"); for(xml_coll_t mi(x_det,_U(module)); mi; ++mi, ++m_id) { @@ -56,16 +56,16 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { y1 = y2 = total_thickness / 2; Volume m_volume(m_nam, Trapezoid(x1, x2, y1, y2, z), vacuum); - m_volume.setVisAttributes(lcdd.visAttributes(x_mod.visStr())); + m_volume.setVisAttributes(description.visAttributes(x_mod.visStr())); for(ci.reset(), n_sensor=1, c_id=0, posY=-y1; ci; ++ci, ++c_id) { xml_comp_t c = ci; double c_thick = c.thickness(); - Material c_mat = lcdd.material(c.materialStr()); + Material c_mat = description.material(c.materialStr()); string c_name = _toString(c_id,"component%d"); Volume c_vol(c_name, Trapezoid(x1,x2,c_thick/2e0,c_thick/2e0,z), c_mat); - c_vol.setVisAttributes(lcdd.visAttributes(c.visStr())); + c_vol.setVisAttributes(description.visAttributes(c.visStr())); pv = m_volume.placeVolume(c_vol,Position(0,posY+c_thick/2,0)); if ( c.isSensitive() ) { sdet.check(n_sensor > 2,"SiTrackerEndcap2::fromCompact: "+c_name+" Max of 2 modules allowed!"); @@ -133,5 +133,5 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { return sdet; } -DECLARE_DETELEMENT(DD4hep_SiTrackerEndcap2,create_detector) +DECLARE_DETELEMENT(dd4hep_SiTrackerEndcap2,create_detector) DECLARE_DEPRECATED_DETELEMENT(SiTrackerEndcap2,create_detector) diff --git a/DDDetectors/src/SiTrackerEndcap_surfaces.cpp b/DDDetectors/src/SiTrackerEndcap_surfaces.cpp index 60fda77ee..c524d6b8e 100644 --- a/DDDetectors/src/SiTrackerEndcap_surfaces.cpp +++ b/DDDetectors/src/SiTrackerEndcap_surfaces.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,16 +15,16 @@ // //========================================================================== // Framework include files -#define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_SiTrackerEndcapSurfacePlugin +#define DD4HEP_USE_SURFACEINSTALL_HELPER dd4hep_SiTrackerEndcapSurfacePlugin #include "DD4hep/SurfaceInstaller.h" /// Install measurement surfaces template <typename UserData> -void Installer<UserData>::install(DetElement component, PlacedVolume pv) { - Volume comp_vol = pv.volume(); +void Installer<UserData>::install(dd4hep::DetElement component, dd4hep::PlacedVolume pv) { + dd4hep::Volume comp_vol = pv.volume(); if ( comp_vol.isSensitive() ) { - Volume mod_vol = parentVolume(component); - DD4hep::Geometry::Trapezoid comp_shape(comp_vol.solid()), mod_shape(mod_vol.solid()); + dd4hep::Volume mod_vol = parentVolume(component); + dd4hep::Trapezoid comp_shape(comp_vol.solid()), mod_shape(mod_vol.solid()); if ( !comp_shape.isValid() || !mod_shape.isValid() ) { invalidInstaller("Components and/or modules are not Trapezoid -- invalid shapes"); diff --git a/DDDetectors/src/Solenoid_o1_v01_gep.cpp b/DDDetectors/src/Solenoid_o1_v01_gep.cpp index 95dc903d0..bbfe18b0e 100644 --- a/DDDetectors/src/Solenoid_o1_v01_gep.cpp +++ b/DDDetectors/src/Solenoid_o1_v01_gep.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ #include "TGeoTrd2.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; int det_id = x_det.id(); string det_name = x_det.nameStr(); @@ -32,23 +32,23 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // --- create an envelope volume and position it into the world --------------------- - Volume envelope = XML::createPlacedEnvelope( lcdd, e , sdet ) ; - XML::setDetectorTypeFlag( e, sdet ) ; + Volume envelope = xml::createPlacedEnvelope( description, e , sdet ) ; + xml::setDetectorTypeFlag( e, sdet ) ; - if( lcdd.buildType() == BUILD_ENVELOPE ) return sdet ; + if( description.buildType() == BUILD_ENVELOPE ) return sdet ; //----------------------------------------------------------------------------------- - Material air = lcdd.air(); + Material air = description.air(); PlacedVolume pv; int n = 0; //added code by Thorben Quast for event display - dd4hep::rec::LayeredCalorimeterData* solenoidData = new dd4hep::rec::LayeredCalorimeterData; + rec::LayeredCalorimeterData* solenoidData = new rec::LayeredCalorimeterData; solenoidData->inner_symmetry = 0; solenoidData->outer_symmetry = 0; - solenoidData->layoutType = dd4hep::rec::LayeredCalorimeterData::BarrelLayout ; + solenoidData->layoutType = rec::LayeredCalorimeterData::BarrelLayout ; double inner_radius= std::numeric_limits<double>::max(); double outer_radius= 0; @@ -69,13 +69,13 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { for(xml_coll_t j(x_layer,_U(slice)); j; ++j, ++m) { xml_comp_t x_slice = j; - Material mat = lcdd.material(x_slice.materialStr()); + Material mat = description.material(x_slice.materialStr()); string s_name= l_name+_toString(m,"_slice%d"); double thickness = x_slice.thickness(); //NN: These probably need to be fixed and ced modified to read the extent, rather than the layer //added code by Thorben Quast for event display - dd4hep::rec::LayeredCalorimeterData::Layer solenoidLayer; + rec::LayeredCalorimeterData::Layer solenoidLayer; solenoidLayer.distance = r; solenoidLayer.inner_thickness = thickness/2.; @@ -94,7 +94,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { s_vol.setSensitiveDetector(sens); } // Set Attributes - s_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + s_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); pv = l_vol.placeVolume(s_vol); // Slices have no extra id. Take the ID of the layer! pv.addPhysVolID("slice",m); @@ -110,7 +110,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { if (r>outer_radius) outer_radius = r; - l_vol.setVisAttributes(lcdd,x_layer.visStr()); + l_vol.setVisAttributes(description,x_layer.visStr()); pv = envelope.placeVolume(l_vol); pv.addPhysVolID("layer",n); @@ -127,11 +127,10 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { solenoidData->extent[3] = detZ; //added code by Thorben Quast for event display - sdet.addExtension< dd4hep::rec::LayeredCalorimeterData >( solenoidData ) ; - + sdet.addExtension< rec::LayeredCalorimeterData >( solenoidData ) ; return sdet; } -DECLARE_DETELEMENT(DD4hep_Solenoid_o1_v01,create_detector) +DECLARE_DETELEMENT(dd4hep_Solenoid_o1_v01,create_detector) diff --git a/DDDetectors/src/SubdetectorAssembly_geo.cpp b/DDDetectors/src/SubdetectorAssembly_geo.cpp index 1c13cb3a5..113f6b775 100644 --- a/DDDetectors/src/SubdetectorAssembly_geo.cpp +++ b/DDDetectors/src/SubdetectorAssembly_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ #include "XML/Utilities.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { +static Ref_t create_element(Detector& description, xml_h e, Ref_t) { xml_det_t x_det (e); string det_name = x_det.nameStr(); DetElement sdet(det_name, x_det.id()); @@ -35,7 +35,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { RotationZYX rot; sdet.setType("compound"); - XML::setDetectorTypeFlag( e, sdet ) ; + xml::setDetectorTypeFlag( e, sdet ) ; if( usePos ) { pos = Position(x_det.position().x(), x_det.position().y(), x_det.position().z()); @@ -47,8 +47,8 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { if ( x_det.hasChild(_U(shape)) ) { xml_comp_t x_shape = x_det.child(_U(shape)); string type = x_shape.typeStr(); - Solid solid = XML::createShape(lcdd, type, x_shape); - Material mat = lcdd.material(x_shape.materialStr()); + Solid solid = xml::createShape(description, type, x_shape); + Material mat = description.material(x_shape.materialStr()); printout(DEBUG,det_name,"+++ Creating detector assembly with shape of type:%s",type.c_str()); vol = Volume(det_name,solid,mat); } @@ -60,12 +60,12 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { for(xml_coll_t c(x_det,_U(composite)); c; ++c) { xml_dim_t component = c; string nam = component.nameStr(); - lcdd.declareMotherVolume(nam, vol); + description.declareMotherVolume(nam, vol); } - vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); - Volume mother = lcdd.pickMotherVolume(sdet); + Volume mother = description.pickMotherVolume(sdet); PlacedVolume pv; if( useRot && usePos ){ pv = mother.placeVolume(vol, Transform3D(rot, pos)); @@ -81,4 +81,4 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { return sdet; } -DECLARE_DETELEMENT(DD4hep_SubdetectorAssembly,create_element) +DECLARE_DETELEMENT(dd4hep_SubdetectorAssembly,create_element) diff --git a/DDDetectors/src/SubdetectorExtensionPlugin.cpp b/DDDetectors/src/SubdetectorExtensionPlugin.cpp index 3348ec299..5aeb90cd8 100644 --- a/DDDetectors/src/SubdetectorExtensionPlugin.cpp +++ b/DDDetectors/src/SubdetectorExtensionPlugin.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,8 +20,8 @@ #include "DD4hep/SurfaceInstaller.h" /// Install volume information. Default implementation only prints! -template <typename T> void Installer<T>::install(DetElement /* layer */, PlacedVolume /* pv */) { - using namespace DD4hep::DDRec; +template <typename T> void Installer<T>::install(dd4hep::DetElement /* layer */, dd4hep::PlacedVolume /* pv */) { + using namespace dd4hep::rec; SubdetectorExtensionImpl* e = new SubdetectorExtensionImpl(m_det); m_det.addExtension<SubdetectorExtension>(e); stopScanning(); diff --git a/DDDetectors/src/SurfaceExamplePlugin.cpp b/DDDetectors/src/SurfaceExamplePlugin.cpp index 9bdc88c7a..1d6e72e8f 100644 --- a/DDDetectors/src/SurfaceExamplePlugin.cpp +++ b/DDDetectors/src/SurfaceExamplePlugin.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +17,7 @@ // Framework include files namespace { struct UserData { /* int a,b,c; */ }; } #define SURFACEINSTALLER_DATA UserData -#define DD4HEP_USE_SURFACEINSTALL_HELPER DD4hep_SurfaceExamplePlugin +#define DD4HEP_USE_SURFACEINSTALL_HELPER dd4hep_SurfaceExamplePlugin #include "DD4hep/SurfaceInstaller.h" namespace { @@ -27,7 +26,7 @@ namespace { double value = -1; char* ptr = ::strchr(argv[i],'='); if ( ptr ) { - value = DD4hep::_toDouble(++ptr); + value = dd4hep::_toDouble(++ptr); } std::cout << "SurfaceExamplePlugin: argument[" << i << "] = " << argv[i] << " value = " << value << std::endl; @@ -36,7 +35,7 @@ namespace { /// Install measurement surfaces template <> - void Installer<UserData>::install(DetElement /* component */, PlacedVolume /* pv */) { + void Installer<UserData>::install(dd4hep::DetElement /* component */, dd4hep::PlacedVolume /* pv */) { // Do here whatever is necessary .... } } diff --git a/DDDetectors/src/TubeSegment_geo.cpp b/DDDetectors/src/TubeSegment_geo.cpp index 8ad502d6e..927c07b48 100644 --- a/DDDetectors/src/TubeSegment_geo.cpp +++ b/DDDetectors/src/TubeSegment_geo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,21 +18,21 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t sens) { +static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { xml_det_t x_det (e); xml_comp_t x_tube = x_det.tubs(); xml_dim_t pos = x_det.position(); xml_dim_t rot = x_det.rotation(); string name = x_det.nameStr(); Tube tub (x_tube.rmin(),x_tube.rmax(),x_tube.zhalf()); - Volume vol (name,tub,lcdd.material(x_det.materialStr())); + Volume vol (name,tub,description.material(x_det.materialStr())); - vol.setVisAttributes(lcdd, x_det.visStr()); - vol.setLimitSet(lcdd, x_det.limitsStr()); - vol.setRegion(lcdd, x_det.regionStr()); + vol.setVisAttributes(description, x_det.visStr()); + vol.setLimitSet(description, x_det.limitsStr()); + vol.setRegion(description, x_det.regionStr()); if ( x_det.isSensitive() ) { SensitiveDetector sd = sens; xml_dim_t sd_typ = x_det.child(_U(sensitive)); @@ -41,7 +41,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t sens) { } DetElement sdet(name,x_det.id()); - Volume mother = lcdd.pickMotherVolume(sdet); + Volume mother = description.pickMotherVolume(sdet); PlacedVolume phv = mother.placeVolume(vol,Transform3D(RotationZYX(rot.z(),rot.y(),rot.x()),Position(-pos.x(),-pos.y(),pos.z()))); if ( x_det.hasAttr(_U(id)) ) { @@ -51,5 +51,5 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t sens) { return sdet; } -DECLARE_DETELEMENT(DD4hep_TubeSegment,create_element) +DECLARE_DETELEMENT(dd4hep_TubeSegment,create_element) DECLARE_DEPRECATED_DETELEMENT(TubeSegment,create_element) diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt index de0139faa..6659efdbd 100644 --- a/DDEve/CMakeLists.txt +++ b/DDEve/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/DDEve/DDEve/DDEve.C b/DDEve/DDEve/DDEve.C index 82ebe5ba1..32d703f49 100644 --- a/DDEve/DDEve/DDEve.C +++ b/DDEve/DDEve/DDEve.C @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,7 +27,7 @@ void DDEve(const char* xmlConfig=0) { const char* dd4hep = gSystem->Getenv("DD4hepINSTALL"); if ( 0 == dd4hep ) { Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - Error("DDEve","+++ Your DD4hep installation seems incomplete. The environment DD4hepINSTALL is not defined! +++"); + Error("DDEve","+++ Your dd4hep installation seems incomplete. The environment DD4hepINSTALL is not defined! +++"); Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); gSystem->Exit(EINVAL); } @@ -56,7 +56,7 @@ void DDEve(const char* xmlConfig=0) { result = gSystem->Load("libDDEve"); if ( 0 != result ) { Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - Error("DDEve","+++ Your DD4hep installation seems incomplete. FAILED to load the library 'libDD4hepEve'! +++"); + Error("DDEve","+++ Your dd4hep installation seems incomplete. FAILED to load the library 'libdd4hepEve'! +++"); Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); gSystem->Exit(EINVAL); } @@ -76,8 +76,8 @@ void DDEve(const char* xmlConfig=0) { } #endif if ( xmlConfig ) - ::snprintf(text,sizeof(text),"DD4hep::DDEve::run(\"%s\")",xmlConfig); + ::snprintf(text,sizeof(text),"dd4hep::DDEve::run(\"%s\")",xmlConfig); else - ::snprintf(text,sizeof(text),"DD4hep::DDEve::run(0)"); + ::snprintf(text,sizeof(text),"dd4hep::DDEve::run(0)"); gInterpreter->ProcessLine(text); } diff --git a/DDEve/DDEve/DDG4IO.C b/DDEve/DDEve/DDG4IO.C index c807ccb85..87559f3dc 100644 --- a/DDEve/DDEve/DDG4IO.C +++ b/DDEve/DDEve/DDG4IO.C @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // CINT configuration #if defined(__MAKECINT__) || defined(__CINT__) || defined(__CLING__) || defined(__ROOTCLING__) -namespace DD4hep { namespace Simulation { +namespace dd4hep { namespace sim { typedef Geant4Tracker SimpleTracker; typedef Geant4Calorimeter SimpleCalorimeter; typedef Geant4HitData SimpleHit; @@ -34,14 +34,14 @@ namespace DD4hep { namespace Simulation { #include "TClass.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; namespace { template <typename T> T* _fill(Geant4HitData* ptr, DDEveHit* target) { T* s = dynamic_cast<T*>(ptr); if ( s ) { - Simulation::Position* p = &s->position; + sim::Position* p = &s->position; target->x = p->X(); target->y = p->Y(); target->z = p->Z(); @@ -106,7 +106,7 @@ namespace { } #include "DD4hep/Factories.h" -using namespace DD4hep::Geometry; +using namespace dd4hep::detail; DECLARE_CONSTRUCTOR(DDEve_DDG4HitAccess,_convertHit) DECLARE_CONSTRUCTOR(DDEve_DDG4ParticleAccess,_convertParticle) #endif diff --git a/DDEve/DDEve/IO.cpp b/DDEve/DDEve/IO.cpp index 79a8b7a21..4a0d95f5e 100644 --- a/DDEve/DDEve/IO.cpp +++ b/DDEve/DDEve/IO.cpp @@ -1,4 +1,4 @@ -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDEve/include/DDEve/Annotation.h b/DDEve/include/DDEve/Annotation.h index a9f8745c0..5299c9da9 100644 --- a/DDEve/include/DDEve/Annotation.h +++ b/DDEve/include/DDEve/Annotation.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ class TEveViewer; class TGLOvlSelectRecord; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Class to add annotations to eve viewers /** @@ -44,6 +44,6 @@ namespace DD4hep { /// Default margin for placement in bottom left corner static float DefaultMargin(); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_ANNOTATION_H */ diff --git a/DDEve/include/DDEve/Calo2DProjection.h b/DDEve/include/DDEve/Calo2DProjection.h index 4912aad74..f4ce29ede 100644 --- a/DDEve/include/DDEve/Calo2DProjection.h +++ b/DDEve/include/DDEve/Calo2DProjection.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ class TEveCalo3D; class TEveCaloDataHist; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// 2D projection operator for calorimeters /* @@ -51,5 +51,5 @@ namespace DD4hep { ClassDefOverride(Calo2DProjection,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_CALO2DPROJECTION_H */ diff --git a/DDEve/include/DDEve/Calo3DProjection.h b/DDEve/include/DDEve/Calo3DProjection.h index c0afffc7c..9df889bb8 100644 --- a/DDEve/include/DDEve/Calo3DProjection.h +++ b/DDEve/include/DDEve/Calo3DProjection.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ class TEveCalo3D; class TEveCaloDataHist; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// 3D projection for calorimeters /* @@ -45,6 +45,6 @@ namespace DD4hep { ClassDefOverride(Calo3DProjection,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_CALO3DPROJECTION_H */ diff --git a/DDEve/include/DDEve/CaloLego.h b/DDEve/include/DDEve/CaloLego.h index 67ef45bf1..658e9509b 100644 --- a/DDEve/include/DDEve/CaloLego.h +++ b/DDEve/include/DDEve/CaloLego.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ class TEveCalo3D; class TEveCaloDataHist; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Lego plot for calorimeter energy deposits /* @@ -51,5 +51,5 @@ namespace DD4hep { /// Root implementation macro ClassDefOverride(CaloLego,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_CALOLEGO_H */ diff --git a/DDEve/include/DDEve/ContextMenu.h b/DDEve/include/DDEve/ContextMenu.h index 959285faa..ec5b27ba5 100644 --- a/DDEve/include/DDEve/ContextMenu.h +++ b/DDEve/include/DDEve/ContextMenu.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,9 +23,9 @@ #include <string> /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { /** @class ContextMenuHandler ContextMenu.h DDEve/ContextMenu.h * @@ -87,7 +87,7 @@ namespace DD4hep { }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_CONTEXTMENU_H */ diff --git a/DDEve/include/DDEve/DD4hepMenu.h b/DDEve/include/DDEve/DD4hepMenu.h index 0f472bacc..20365eeb3 100644 --- a/DDEve/include/DDEve/DD4hepMenu.h +++ b/DDEve/include/DDEve/DD4hepMenu.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,19 +22,19 @@ class TGMenuBar; class TGMenuEntry; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class View; class EventControl; - /// DD4hep Menu for the ROOT browser + /// dd4hep Menu for the ROOT browser /* * \author M.Frank * \version 1.0 * \ingroup DD4HEP_EVE */ - class DD4hepMenu : public PopupMenu { + class dd4hepMenu : public PopupMenu { public: protected: @@ -43,9 +43,9 @@ namespace DD4hep { EventControl* m_evtCtrl; public: /// Standard constructor - DD4hepMenu(Display* eve); + dd4hepMenu(Display* eve); /// Default destructor - virtual ~DD4hepMenu(); + virtual ~dd4hepMenu(); /// Add the menu to the menu bar virtual void Build(TGMenuBar* bar, int hints=kLHintsNormal) override; @@ -67,9 +67,9 @@ namespace DD4hep { /// Callback when the geometry was loaded void OnGeometryLoaded(); /// ROOT implementation macro - ClassDefOverride(DD4hepMenu,0); + ClassDefOverride(dd4hepMenu,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_DD4HEPMENU_H */ diff --git a/DDEve/include/DDEve/DDEveEventData.h b/DDEve/include/DDEve/DDEveEventData.h index aeb5c4b40..874b3257b 100644 --- a/DDEve/include/DDEve/DDEveEventData.h +++ b/DDEve/include/DDEve/DDEveEventData.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include <set> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// DDEve event classes: Basic hit /** @@ -71,6 +71,6 @@ namespace DD4hep { DDEveParticle& operator=(const DDEveParticle& c); }; typedef std::vector<DDEveParticle> DDEveParticles; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_DDEVEHIT_H */ diff --git a/DDEve/include/DDEve/DDG4EventHandler.h b/DDEve/include/DDEve/DDG4EventHandler.h index 87b54f726..2ae464bdb 100644 --- a/DDEve/include/DDEve/DDG4EventHandler.h +++ b/DDEve/include/DDEve/DDG4EventHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,9 +26,9 @@ class TFile; class TBranch; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /** Event I/O handler class for the DD4hep event display + /** Event I/O handler class for the dd4hep event display * * \author M.Frank * \version 1.0 @@ -84,6 +84,6 @@ namespace DD4hep { ClassDefOverride(DDG4EventHandler,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_DDG4EVENTHANDLER_H */ diff --git a/DDEve/include/DDEve/Dictionary.h b/DDEve/include/DDEve/Dictionary.h index ffd03d08e..de71d3d10 100644 --- a/DDEve/include/DDEve/Dictionary.h +++ b/DDEve/include/DDEve/Dictionary.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -38,7 +38,7 @@ #include "DDEve/GenericEventHandler.h" #include "DDEve/DDG4EventHandler.h" -namespace DD4hep { +namespace dd4hep { void EveDisplay(const char* xmlFile, const char* eventFileName); struct DDEve { static void run(const char* xmlFile) { @@ -52,48 +52,48 @@ namespace DD4hep { #pragma link off all classes; #pragma link off all functions; -#pragma link C++ namespace DD4hep; +#pragma link C++ namespace dd4hep; -#pragma link C++ function DD4hep::EveDisplay(const char* xmlFile, const char* eventFileName); +#pragma link C++ function dd4hep::EveDisplay(const char* xmlFile, const char* eventFileName); -#pragma link C++ class DD4hep::DDEve; -#pragma link C++ class DD4hep::Display; -#pragma link C++ class DD4hep::Annotation; -#pragma link C++ class DD4hep::ElementList; -#pragma link C++ class DD4hep::FrameControl; -#pragma link C++ class DD4hep::EventHandler; -#pragma link C++ class DD4hep::EventConsumer; -#pragma link C++ class DD4hep::DDG4EventHandler; -#pragma link C++ class DD4hep::GenericEventHandler; -#pragma link C++ class DD4hep::EventControl; +#pragma link C++ class dd4hep::DDEve; +#pragma link C++ class dd4hep::Display; +#pragma link C++ class dd4hep::Annotation; +#pragma link C++ class dd4hep::ElementList; +#pragma link C++ class dd4hep::FrameControl; +#pragma link C++ class dd4hep::EventHandler; +#pragma link C++ class dd4hep::EventConsumer; +#pragma link C++ class dd4hep::DDG4EventHandler; +#pragma link C++ class dd4hep::GenericEventHandler; +#pragma link C++ class dd4hep::EventControl; -#pragma link C++ class DD4hep::DisplayConfiguration::Config; -//#pragma link C++ class std::list<DD4hep::DisplayConfiguration::Config>; -#pragma link C++ class DD4hep::DisplayConfiguration::ViewConfig; -//#pragma link C++ class std::list<DD4hep::DisplayConfiguration::ViewConfig>; -#pragma link C++ class DD4hep::DisplayConfiguration; +#pragma link C++ class dd4hep::DisplayConfiguration::Config; +//#pragma link C++ class std::list<dd4hep::DisplayConfiguration::Config>; +#pragma link C++ class dd4hep::DisplayConfiguration::ViewConfig; +//#pragma link C++ class std::list<dd4hep::DisplayConfiguration::ViewConfig>; +#pragma link C++ class dd4hep::DisplayConfiguration; -#pragma link C++ class DD4hep::View; -#pragma link C++ class DD4hep::View3D; -#pragma link C++ class DD4hep::Projection; -#pragma link C++ class DD4hep::RhoZProjection; -#pragma link C++ class DD4hep::RhoPhiProjection; -#pragma link C++ class DD4hep::CaloLego; -#pragma link C++ class DD4hep::Calo2DProjection; -#pragma link C++ class DD4hep::Calo3DProjection; -#pragma link C++ class DD4hep::MultiView; +#pragma link C++ class dd4hep::View; +#pragma link C++ class dd4hep::View3D; +#pragma link C++ class dd4hep::Projection; +#pragma link C++ class dd4hep::RhoZProjection; +#pragma link C++ class dd4hep::RhoPhiProjection; +#pragma link C++ class dd4hep::CaloLego; +#pragma link C++ class dd4hep::Calo2DProjection; +#pragma link C++ class dd4hep::Calo3DProjection; +#pragma link C++ class dd4hep::MultiView; -#pragma link C++ class DD4hep::PopupMenu; -#pragma link C++ class DD4hep::ViewMenu; -#pragma link C++ class DD4hep::DD4hepMenu; -#pragma link C++ class DD4hep::ContextMenu; -#pragma link C++ class DD4hep::ContextMenuHandler; -#pragma link C++ class DD4hep::EveUserContextMenu; -#pragma link C++ class DD4hep::ElementListContextMenu; -#pragma link C++ class DD4hep::EveShapeContextMenu; -#pragma link C++ class DD4hep::EvePgonSetProjectedContextMenu; -//#pragma link C++ class DD4hep::; +#pragma link C++ class dd4hep::PopupMenu; +#pragma link C++ class dd4hep::ViewMenu; +#pragma link C++ class dd4hep::dd4hepMenu; +#pragma link C++ class dd4hep::ContextMenu; +#pragma link C++ class dd4hep::ContextMenuHandler; +#pragma link C++ class dd4hep::EveUserContextMenu; +#pragma link C++ class dd4hep::ElementListContextMenu; +#pragma link C++ class dd4hep::EveShapeContextMenu; +#pragma link C++ class dd4hep::EvePgonSetProjectedContextMenu; +//#pragma link C++ class dd4hep::; #endif diff --git a/DDEve/include/DDEve/Display.h b/DDEve/include/DDEve/Display.h index e1296400c..94d2c25c7 100644 --- a/DDEve/include/DDEve/Display.h +++ b/DDEve/include/DDEve/Display.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_DDEVE_DISPLAY_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DDEve/PopupMenu.h" #include "DDEve/EventHandler.h" @@ -35,12 +35,12 @@ class TGClient; class TFile; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class View; class ViewMenu; - class DD4hepMenu; + class dd4hepMenu; class EventHandler; class ViewConfiguration; class CalodataConfiguration; @@ -80,13 +80,13 @@ namespace DD4hep { /// Reference to TEve manager TEveManager* m_eve; /// Reference to geometry hub - Geometry::LCDD* m_lcdd; + Detector* m_detDesc; /// Reference to the event reader object GenericEventHandler* m_evtHandler; TEveElementList* m_geoGlobal; TEveElementList* m_eveGlobal; ViewMenu* m_viewMenu; - DD4hepMenu* m_dd4Menu; + dd4hepMenu* m_dd4Menu; Topics m_geoTopics; Topics m_eveTopics; Views m_eveViews; @@ -109,7 +109,7 @@ namespace DD4hep { virtual ~Display(); /// Access to geometry hub - Geometry::LCDD& lcdd() const; + Detector& detectorDescription() const; /// Access to the EVE manager TEveManager& manager() const { return *m_eve; } /// Access View configurations @@ -201,6 +201,6 @@ namespace DD4hep { ClassDefOverride(Display,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_DISPLAY_H */ diff --git a/DDEve/include/DDEve/DisplayConfiguration.h b/DDEve/include/DDEve/DisplayConfiguration.h index 311f8cf47..a0bab7d35 100644 --- a/DDEve/include/DDEve/DisplayConfiguration.h +++ b/DDEve/include/DDEve/DisplayConfiguration.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +23,7 @@ #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class Display; @@ -124,6 +124,6 @@ namespace DD4hep { /// Root implementation macro ClassDef(DisplayConfiguration,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_DISPLAYCONFIGURATION_H */ diff --git a/DDEve/include/DDEve/ElementList.h b/DDEve/include/DDEve/ElementList.h index f5ace2f6c..6bf93c64d 100644 --- a/DDEve/include/DDEve/ElementList.h +++ b/DDEve/include/DDEve/ElementList.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ #include "TEveElement.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Local implementation with overrides of the TEveElementList /* @@ -67,5 +67,5 @@ namespace DD4hep { ClassDef(ElementListContextMenu,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_ELEMENTLIST_H */ diff --git a/DDEve/include/DDEve/EvePgonSetProjectedContextMenu.h b/DDEve/include/DDEve/EvePgonSetProjectedContextMenu.h index 5fccae904..a2a4fac1b 100644 --- a/DDEve/include/DDEve/EvePgonSetProjectedContextMenu.h +++ b/DDEve/include/DDEve/EvePgonSetProjectedContextMenu.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDEve/EveUserContextMenu.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class EvePgonSetProjectedContextMenu EvePgonSetProjectedContextMenu.h DDEve/EvePgonSetProjectedContextMenu.h /* @@ -37,5 +37,5 @@ namespace DD4hep { /// Root implementation macro ClassDefOverride(EvePgonSetProjectedContextMenu,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_EVEPGONSETPROJECTEDCONTEXTMENU_H */ diff --git a/DDEve/include/DDEve/EveShapeContextMenu.h b/DDEve/include/DDEve/EveShapeContextMenu.h index 4a09c3074..bfbecaddd 100644 --- a/DDEve/include/DDEve/EveShapeContextMenu.h +++ b/DDEve/include/DDEve/EveShapeContextMenu.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDEve/EveUserContextMenu.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class EveShapeContextMenu EveShapeContextMenu.h DDEve/EveShapeContextMenu.h /* @@ -37,5 +37,5 @@ namespace DD4hep { /// Root implementation macro ClassDefOverride(EveShapeContextMenu,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_EVESHAPECONTEXTMENU_H */ diff --git a/DDEve/include/DDEve/EveUserContextMenu.h b/DDEve/include/DDEve/EveUserContextMenu.h index e3e501748..b906e3308 100644 --- a/DDEve/include/DDEve/EveUserContextMenu.h +++ b/DDEve/include/DDEve/EveUserContextMenu.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ class TEveManager; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class Display; @@ -73,5 +73,5 @@ namespace DD4hep { /// Root implementation macro ClassDef(EveUserContextMenu,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_EVEUSERCONTEXTMENU_H */ diff --git a/DDEve/include/DDEve/EventControl.h b/DDEve/include/DDEve/EventControl.h index 8d8ccc803..c92283eff 100644 --- a/DDEve/include/DDEve/EventControl.h +++ b/DDEve/include/DDEve/EventControl.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ class TGPictureButton; class TGLabel; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class Display; @@ -79,6 +79,6 @@ namespace DD4hep { ClassDefOverride(EventControl,0) // Top level window frame }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_EVENTCONTROL_H */ diff --git a/DDEve/include/DDEve/EventHandler.h b/DDEve/include/DDEve/EventHandler.h index 108be95ef..e52518009 100644 --- a/DDEve/include/DDEve/EventHandler.h +++ b/DDEve/include/DDEve/EventHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,9 +27,9 @@ class TH2F; #define MEV_2_GEV 0.001 /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { // Forward declarations class EventConsumer; @@ -133,6 +133,6 @@ namespace DD4hep { ClassDef(EventConsumer,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_EVENTHANDLER_H */ diff --git a/DDEve/include/DDEve/Factories.h b/DDEve/include/DDEve/Factories.h index 6b4155a61..578d3812d 100644 --- a/DDEve/include/DDEve/Factories.h +++ b/DDEve/include/DDEve/Factories.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,10 +24,10 @@ namespace { template <typename P, typename S> class Factory; /// DDEve view factory - DD4HEP_PLUGIN_FACTORY_ARGS_2(DD4hep::View*,DD4hep::Display*,const char*) { return new P(a0,a1); } + DD4HEP_PLUGIN_FACTORY_ARGS_2(dd4hep::View*,dd4hep::Display*,const char*) { return new P(a0,a1); } } #define DECLARE_VIEW_FACTORY(x) \ -DD4HEP_PLUGINSVC_FACTORY(x,DD4hep_DDEve_##x,DD4hep::View*(DD4hep::Display*, const char*),__LINE__) +DD4HEP_PLUGINSVC_FACTORY(x,dd4hep_DDEve_##x,dd4hep::View*(dd4hep::Display*, const char*),__LINE__) #endif // DD4HEP_DDEVE_FACTORIES_H diff --git a/DDEve/include/DDEve/FrameControl.h b/DDEve/include/DDEve/FrameControl.h index a714a9b76..843e9c41e 100644 --- a/DDEve/include/DDEve/FrameControl.h +++ b/DDEve/include/DDEve/FrameControl.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,7 +25,7 @@ class TGPicture; class TGCompositeFrame; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class FrameControl FrameControl.h DDEve/FrameControl.h /* @@ -65,6 +65,6 @@ namespace DD4hep { ClassDefOverride(FrameControl,0) // Top level window frame }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_FRAMECONTROL_H */ diff --git a/DDEve/include/DDEve/GenericEventHandler.h b/DDEve/include/DDEve/GenericEventHandler.h index 8a42ca81a..88b1a5c6b 100644 --- a/DDEve/include/DDEve/GenericEventHandler.h +++ b/DDEve/include/DDEve/GenericEventHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // Forward declarations /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Event handler base class. Interface to all DDEve I/O actions /** @@ -74,7 +74,7 @@ namespace DD4hep { ClassDefOverride(GenericEventHandler,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_GENERICEVENTHANDLER_H */ diff --git a/DDEve/include/DDEve/HitActors.h b/DDEve/include/DDEve/HitActors.h index 1969e2028..15832a70d 100644 --- a/DDEve/include/DDEve/HitActors.h +++ b/DDEve/include/DDEve/HitActors.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ class TEvePointSet; class TEveBoxSet; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Fill EtaPhi histograms from a hit collection /* @@ -103,7 +103,7 @@ namespace DD4hep { virtual void operator()(const DDEveHit& hit); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_HITHANDLERS_H */ diff --git a/DDEve/include/DDEve/MultiView.h b/DDEve/include/DDEve/MultiView.h index bd46b21a5..63a645123 100644 --- a/DDEve/include/DDEve/MultiView.h +++ b/DDEve/include/DDEve/MultiView.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ class TEveWindowPack; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class MultiView MultiView.h DDEve/MultiView.h /* @@ -40,5 +40,5 @@ namespace DD4hep { /// Root implementation macro ClassDefOverride(MultiView,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_MULTIVIEW_H */ diff --git a/DDEve/include/DDEve/ParticleActors.h b/DDEve/include/DDEve/ParticleActors.h index 6bc1d6186..41be1d3c3 100644 --- a/DDEve/include/DDEve/ParticleActors.h +++ b/DDEve/include/DDEve/ParticleActors.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,7 +27,7 @@ class TEveElement; class TEveLine; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Fill eve particles from a MC particle collection /* @@ -54,7 +54,7 @@ namespace DD4hep { void close(); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_PARTICLEHANDLERS_H */ diff --git a/DDEve/include/DDEve/PopupMenu.h b/DDEve/include/DDEve/PopupMenu.h index 2af45832f..dfe655539 100644 --- a/DDEve/include/DDEve/PopupMenu.h +++ b/DDEve/include/DDEve/PopupMenu.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,7 +25,7 @@ class TGWindow; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class PopupMenu PopupMenu.h DDEve/PopupMenu.h /* @@ -82,6 +82,6 @@ namespace DD4hep { ClassDef(PopupMenu,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_POPUPMENU_H */ diff --git a/DDEve/include/DDEve/Projection.h b/DDEve/include/DDEve/Projection.h index 935a9361c..6bb8ad8f9 100644 --- a/DDEve/include/DDEve/Projection.h +++ b/DDEve/include/DDEve/Projection.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ #include <TEveProjectionAxes.h> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class Projection Projection.h DDEve/Projection.h /* @@ -64,5 +64,5 @@ namespace DD4hep { ClassDefOverride(Projection,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_PROJECTION_H */ diff --git a/DDEve/include/DDEve/RhoPhiProjection.h b/DDEve/include/DDEve/RhoPhiProjection.h index 482ca82ef..2f2d48793 100644 --- a/DDEve/include/DDEve/RhoPhiProjection.h +++ b/DDEve/include/DDEve/RhoPhiProjection.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include "DDEve/Projection.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class RhoPhiProjection RhoPhiProjection.h DDEve/RhoPhiProjection.h /* @@ -37,6 +37,6 @@ namespace DD4hep { /// Root implementation macro ClassDefOverride(RhoPhiProjection,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_RHOPHIPROJECTION_H */ diff --git a/DDEve/include/DDEve/RhoZProjection.h b/DDEve/include/DDEve/RhoZProjection.h index 44f59fc04..ab133c3dd 100644 --- a/DDEve/include/DDEve/RhoZProjection.h +++ b/DDEve/include/DDEve/RhoZProjection.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include "DDEve/Projection.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class RhoZProjection RhoZProjection.h DDEve/RhoZProjection.h /* @@ -37,6 +37,6 @@ namespace DD4hep { /// Root implementation macro ClassDefOverride(RhoZProjection,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_RHOZPROJECTION_H */ diff --git a/DDEve/include/DDEve/Utilities.h b/DDEve/include/DDEve/Utilities.h index 03d1db68b..4e2459b9f 100644 --- a/DDEve/include/DDEve/Utilities.h +++ b/DDEve/include/DDEve/Utilities.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_DDEVE_UTILITIES_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // ROOT include files #include "TGeoMatrix.h" @@ -22,7 +22,7 @@ #include "TNamed.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { namespace Utilities { int findNodeWithMatrix(TGeoNode* p, TGeoNode* n, TGeoHMatrix* mat, std::string* sub_path=0); @@ -32,7 +32,7 @@ namespace DD4hep { TGeoHMatrix& mat, const std::string& node_name); std::pair<bool,TEveElement*> - LoadDetElement(Geometry::DetElement element,int levels, TEveElement* parent); + LoadDetElement(DetElement element,int levels, TEveElement* parent); /// Make a set of nodes starting from a top element (in-)visible with a given depth void MakeNodesVisible(TEveElement* e, bool visible, int level); @@ -47,6 +47,6 @@ namespace DD4hep { return n ? n->GetName() : "???"; } } -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_UTILITIES_H */ diff --git a/DDEve/include/DDEve/View.h b/DDEve/include/DDEve/View.h index c30d6c9bb..952c07656 100644 --- a/DDEve/include/DDEve/View.h +++ b/DDEve/include/DDEve/View.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_DDEVE_VIEW_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDEve/DisplayConfiguration.h" // Eve include files @@ -30,7 +30,7 @@ class TEveManager; class TEveElementList; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class Display; @@ -44,9 +44,6 @@ namespace DD4hep { */ class View { public: - typedef Geometry::LCDD LCDD; - typedef Geometry::DetElement DetElement; - typedef Geometry::SensitiveDetector SensitiveDetector; typedef std::map<std::string, TEveElementList*> Topics; protected: Display *m_eve; @@ -155,5 +152,5 @@ namespace DD4hep { /// Root implementation macro ClassDef(View,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_VIEW_H */ diff --git a/DDEve/include/DDEve/View3D.h b/DDEve/include/DDEve/View3D.h index 26aff0972..e6fe4bebf 100644 --- a/DDEve/include/DDEve/View3D.h +++ b/DDEve/include/DDEve/View3D.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include "DDEve/View.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// class View3D View3D.h DDEve/View3D.h /* @@ -41,5 +41,5 @@ namespace DD4hep { /// Root implementation macro ClassDefOverride(View3D,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_VIEW3D_H */ diff --git a/DDEve/include/DDEve/ViewMenu.h b/DDEve/include/DDEve/ViewMenu.h index 4049cf4c3..66c9594f3 100644 --- a/DDEve/include/DDEve/ViewMenu.h +++ b/DDEve/include/DDEve/ViewMenu.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ class TGMenuBar; class TGMenuEntry; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class View; @@ -67,6 +67,6 @@ namespace DD4hep { /// ROOT implementation macro ClassDefOverride(ViewMenu,0); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_VIEWMENU_H */ diff --git a/DDEve/lcio/LCIOEventHandler.cpp b/DDEve/lcio/LCIOEventHandler.cpp index ec259ca8d..7ee523ddd 100644 --- a/DDEve/lcio/LCIOEventHandler.cpp +++ b/DDEve/lcio/LCIOEventHandler.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -33,7 +33,7 @@ using namespace std; using namespace lcio; -using namespace DD4hep; +using namespace dd4hep; using namespace EVENT; using namespace IMPL; @@ -70,7 +70,7 @@ static void* _create(const char*) { EventHandler* h = new LCIOEventHandler(); return h; } -using namespace DD4hep::Geometry; +using namespace dd4hep::detail; DECLARE_CONSTRUCTOR(DDEve_LCIOEventHandler,_create) /// Standard constructor diff --git a/DDEve/lcio/LCIOEventHandler.h b/DDEve/lcio/LCIOEventHandler.h index 1ec941fb6..d95a7196e 100644 --- a/DDEve/lcio/LCIOEventHandler.h +++ b/DDEve/lcio/LCIOEventHandler.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,9 +26,9 @@ // Forward declarations /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { /** @class LCIOEventHandler LCIOEventHandler.h DDEve/LCIOEventHandler.h * @@ -76,7 +76,7 @@ namespace DD4hep { virtual bool GotoEvent(long event_number); }; -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDEVE_LCIOEVENTHANDLER_H */ diff --git a/DDEve/src/Annotation.cpp b/DDEve/src/Annotation.cpp index 8781249b6..a20ea90e4 100644 --- a/DDEve/src/Annotation.cpp +++ b/DDEve/src/Annotation.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ // Forward declarations -using namespace DD4hep; +using namespace dd4hep; ClassImp(Annotation) diff --git a/DDEve/src/Calo2DProjection.cpp b/DDEve/src/Calo2DProjection.cpp index 568694387..68d34faac 100644 --- a/DDEve/src/Calo2DProjection.cpp +++ b/DDEve/src/Calo2DProjection.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,7 +25,7 @@ #include "TEveArrow.h" using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(Calo2DProjection) DECLARE_VIEW_FACTORY(Calo2DProjection) diff --git a/DDEve/src/Calo3DProjection.cpp b/DDEve/src/Calo3DProjection.cpp index 23400f179..5173caf11 100644 --- a/DDEve/src/Calo3DProjection.cpp +++ b/DDEve/src/Calo3DProjection.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDEve/Factories.h" #include "DD4hep/InstanceCount.h" -using namespace DD4hep; +using namespace dd4hep; ClassImp(Calo3DProjection) DECLARE_VIEW_FACTORY(Calo3DProjection) diff --git a/DDEve/src/CaloLego.cpp b/DDEve/src/CaloLego.cpp index ba1f4f01d..40a194f3e 100644 --- a/DDEve/src/CaloLego.cpp +++ b/DDEve/src/CaloLego.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -30,7 +30,7 @@ #include <limits> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(CaloLego) DECLARE_VIEW_FACTORY(CaloLego) diff --git a/DDEve/src/ContextMenu.cpp b/DDEve/src/ContextMenu.cpp index 4596e6d07..1150da3f8 100644 --- a/DDEve/src/ContextMenu.cpp +++ b/DDEve/src/ContextMenu.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include <map> using namespace std; -using namespace DD4hep; +using namespace dd4hep; typedef map<string,ContextMenu*> Contexts; static Contexts& mapped_entries() { diff --git a/DDEve/src/DD4hepMenu.cpp b/DDEve/src/DD4hepMenu.cpp index ad5279a58..08718ce7a 100644 --- a/DDEve/src/DD4hepMenu.cpp +++ b/DDEve/src/DD4hepMenu.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -37,43 +36,43 @@ class TEveWindowSlot; using namespace std; -using namespace DD4hep; +using namespace dd4hep; -ClassImp(DD4hepMenu) +ClassImp(dd4hepMenu) /// Initializing constructor -DD4hepMenu::DD4hepMenu(Display* display) +dd4hepMenu::dd4hepMenu(Display* display) : PopupMenu(display->client().GetRoot()), m_display(display), m_evtCtrl(0) { InstanceCount::increment(this); } /// Default destructor -DD4hepMenu::~DD4hepMenu() { - deletePtr(m_evtCtrl); +dd4hepMenu::~dd4hepMenu() { + detail::deletePtr(m_evtCtrl); InstanceCount::decrement(this); } /// Add the menu to the menu bar -void DD4hepMenu::Build(TGMenuBar* bar, int hints) { +void dd4hepMenu::Build(TGMenuBar* bar, int hints) { int id; PopupMenu& m = *this; - m.AddEntry("&Load XML", this, &DD4hepMenu::OnLoadXML); - //Not for now: m.AddEntry("&Load ROOT Geometry",this, &DD4hepMenu::OnLoadRootGeometry); - id = m.AddEntry("&Show Event I/O", this, &DD4hepMenu::OnCreateEventIO); + m.AddEntry("&Load XML", this, &dd4hepMenu::OnLoadXML); + //Not for now: m.AddEntry("&Load ROOT Geometry",this, &dd4hepMenu::OnLoadRootGeometry); + id = m.AddEntry("&Show Event I/O", this, &dd4hepMenu::OnCreateEventIO); m.menu().DisableEntry(id); - id = m.AddEntry("&Open Event Data", this, &DD4hepMenu::OnOpenEventData); + id = m.AddEntry("&Open Event Data", this, &dd4hepMenu::OnOpenEventData); m.menu().DisableEntry(id); - id = m.AddEntry("&Next Event", this, &DD4hepMenu::OnNextEvent); + id = m.AddEntry("&Next Event", this, &dd4hepMenu::OnNextEvent); m.menu().DisableEntry(id); - id = m.AddEntry("&Previous Event", this, &DD4hepMenu::OnPreviousEvent); + id = m.AddEntry("&Previous Event", this, &dd4hepMenu::OnPreviousEvent); m.menu().DisableEntry(id); - m.AddEntry("&Exit", this, &DD4hepMenu::OnExit); - bar->AddPopup("&DD4hep",*this, new TGLayoutHints(hints, 0, 4, 0, 0)); + m.AddEntry("&Exit", this, &dd4hepMenu::OnExit); + bar->AddPopup("&dd4hep",*this, new TGLayoutHints(hints, 0, 4, 0, 0)); } /// Callback when the geometry was loaded -void DD4hepMenu::OnGeometryLoaded() { +void dd4hepMenu::OnGeometryLoaded() { TGPopupMenu& m = menu(); m.DisableEntry(m.GetEntry("Load XML")->GetEntryId()); m.EnableEntry(m.GetEntry("Show Event I/O")->GetEntryId()); @@ -83,7 +82,7 @@ void DD4hepMenu::OnGeometryLoaded() { } /// Callback when loading the configuration -void DD4hepMenu::OnLoadXML(TGMenuEntry* /* entry */, void* /* ptr */) { +void dd4hepMenu::OnLoadXML(TGMenuEntry* /* entry */, void* /* ptr */) { std::string fname = m_display->OpenXmlFileDialog("."); if ( !fname.empty() ) { m_display->LoadXML(fname.c_str()); @@ -92,7 +91,7 @@ void DD4hepMenu::OnLoadXML(TGMenuEntry* /* entry */, void* /* ptr */) { } /// Callback when loading the configuration -void DD4hepMenu::OnLoadRootGeometry(TGMenuEntry* /* entry */, void* /* ptr */) { +void dd4hepMenu::OnLoadRootGeometry(TGMenuEntry* /* entry */, void* /* ptr */) { std::string fname = m_display->OpenEventFileDialog("."); if ( !fname.empty() ) { m_display->LoadGeometryRoot(fname.c_str()); @@ -100,7 +99,7 @@ void DD4hepMenu::OnLoadRootGeometry(TGMenuEntry* /* entry */, void* /* ptr */) } /// Callback to show the event I/O panel -void DD4hepMenu::OnCreateEventIO(TGMenuEntry* /* entry */, void* /* ptr */) { +void dd4hepMenu::OnCreateEventIO(TGMenuEntry* /* entry */, void* /* ptr */) { if ( 0 == m_evtCtrl ) { TEveBrowser* browser = m_display->manager().GetBrowser(); browser->StartEmbedding(TRootBrowser::kLeft); @@ -113,7 +112,7 @@ void DD4hepMenu::OnCreateEventIO(TGMenuEntry* /* entry */, void* /* ptr */) { } /// Callback when loading a new event data file -void DD4hepMenu::OnOpenEventData(TGMenuEntry* /* entry */, void* /* ptr */) { +void dd4hepMenu::OnOpenEventData(TGMenuEntry* /* entry */, void* /* ptr */) { if ( 0 == m_evtCtrl ) { OnCreateEventIO(0,0); } @@ -126,17 +125,17 @@ void DD4hepMenu::OnOpenEventData(TGMenuEntry* /* entry */, void* /* ptr */) { } /// Callback when loading the next event -void DD4hepMenu::OnNextEvent(TGMenuEntry* /* entry */, void* /* ptr */) { +void dd4hepMenu::OnNextEvent(TGMenuEntry* /* entry */, void* /* ptr */) { m_display->eventHandler().NextEvent(); } /// Callback when loading the previous event -void DD4hepMenu::OnPreviousEvent(TGMenuEntry* /* entry */, void* /* ptr */) { +void dd4hepMenu::OnPreviousEvent(TGMenuEntry* /* entry */, void* /* ptr */) { m_display->eventHandler().PreviousEvent(); } /// Callback when exiting the display -void DD4hepMenu::OnExit(TGMenuEntry* /* entry */, void* /* ptr */) { +void dd4hepMenu::OnExit(TGMenuEntry* /* entry */, void* /* ptr */) { delete m_display; printout(INFO,"DDEve","+++ The life of this display instance ended.... good bye!"); gSystem->Exit(0,kTRUE); diff --git a/DDEve/src/DDEveEventData.cpp b/DDEve/src/DDEveEventData.cpp index 00f075ef0..aa640dfee 100644 --- a/DDEve/src/DDEveEventData.cpp +++ b/DDEve/src/DDEveEventData.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +15,7 @@ // Framework include files #include "DDEve/DDEveEventData.h" -using namespace DD4hep; +using namespace dd4hep; /// Default constructor DDEveHit::DDEveHit() diff --git a/DDEve/src/DDEvePlugins.cpp b/DDEve/src/DDEvePlugins.cpp index bbbb155e3..47f2b49c0 100644 --- a/DDEve/src/DDEvePlugins.cpp +++ b/DDEve/src/DDEvePlugins.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,4 +17,4 @@ #include "DD4hep/detail/Plugins.inl" #include "DDEve/Factories.h" -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(DD4hep::View*, (DD4hep::Display*, const char*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(dd4hep::View*, (dd4hep::Display*, const char*)) diff --git a/DDEve/src/DDG4EventHandler.cpp b/DDEve/src/DDG4EventHandler.cpp index 72d9532de..fb412e01e 100644 --- a/DDEve/src/DDG4EventHandler.cpp +++ b/DDEve/src/DDG4EventHandler.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,7 +26,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(DDG4EventHandler) namespace { @@ -42,7 +42,7 @@ namespace { return h; } } -using namespace DD4hep::Geometry; +using namespace dd4hep::detail; DECLARE_CONSTRUCTOR(DDEve_DDG4EventHandler,_create) /// Standard constructor @@ -105,13 +105,13 @@ EventHandler::CollectionType DDG4EventHandler::collectionType(const std::string& Branches::const_iterator i = m_branches.find(collection); if ( i != m_branches.end() ) { const char* cl = (*i).second.first->GetClassName(); - if ( ::strstr(cl,"Simulation::Geant4Calorimeter::Hit") ) return CALO_HIT_COLLECTION; - else if ( ::strstr(cl,"Simulation::Geant4Tracker::Hit") ) return TRACKER_HIT_COLLECTION; - else if ( ::strstr(cl,"Simulation::Geant4Particle") ) return PARTICLE_COLLECTION; + if ( ::strstr(cl,"sim::Geant4Calorimeter::Hit") ) return CALO_HIT_COLLECTION; + else if ( ::strstr(cl,"sim::Geant4Tracker::Hit") ) return TRACKER_HIT_COLLECTION; + else if ( ::strstr(cl,"sim::Geant4Particle") ) return PARTICLE_COLLECTION; // These are OLD types. Eventually remove these lines..... - else if ( ::strstr(cl,"Simulation::SimpleCalorimeter::Hit") ) return CALO_HIT_COLLECTION; - else if ( ::strstr(cl,"Simulation::SimpleTracker::Hit") ) return TRACKER_HIT_COLLECTION; - else if ( ::strstr(cl,"Simulation::Particle") ) return PARTICLE_COLLECTION; + else if ( ::strstr(cl,"sim::SimpleCalorimeter::Hit") ) return CALO_HIT_COLLECTION; + else if ( ::strstr(cl,"sim::SimpleTracker::Hit") ) return TRACKER_HIT_COLLECTION; + else if ( ::strstr(cl,"sim::Particle") ) return PARTICLE_COLLECTION; } return NO_COLLECTION; } diff --git a/DDEve/src/Display.cpp b/DDEve/src/Display.cpp index 815531c7b..0fc0461d7 100644 --- a/DDEve/src/Display.cpp +++ b/DDEve/src/Display.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,8 +25,8 @@ #include "DDEve/HitActors.h" #include "DDEve/ParticleActors.h" -#include "DD4hep/LCDD.h" -#include "DD4hep/LCDDData.h" +#include "DD4hep/Detector.h" +#include "DD4hep/DetectorData.h" #include "DD4hep/Printout.h" // ROOT include files @@ -54,13 +54,13 @@ #include <climits> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; ClassImp(Display) -namespace DD4hep { +namespace dd4hep { void EveDisplay(const char* xmlConfig = 0, const char* eventFileName = 0) { Display* display = new Display(TEveManager::Create(true,"VI")); if ( xmlConfig != 0 ) { @@ -108,7 +108,7 @@ Display::CalodataContext& Display::CalodataContext::operator=(const CalodataCont /// Standard constructor Display::Display(TEveManager* eve) - : m_eve(eve), m_lcdd(0), m_evtHandler(0), m_geoGlobal(0), m_eveGlobal(0), + : m_eve(eve), m_detDesc(0), m_evtHandler(0), m_geoGlobal(0), m_eveGlobal(0), m_viewMenu(0), m_dd4Menu(0), m_visLevel(7), m_loadLevel(1) { TEveBrowser* br = m_eve->GetBrowser(); @@ -116,10 +116,10 @@ Display::Display(TEveManager* eve) EveShapeContextMenu::install(this); EvePgonSetProjectedContextMenu::install(this); ElementListContextMenu::install(this); - m_lcdd = &Geometry::LCDD::getInstance(); + m_detDesc = &Detector::getInstance(); m_evtHandler = new GenericEventHandler(); m_evtHandler->Subscribe(this); - m_lcdd->addExtension<Display>(this); + m_detDesc->addExtension<Display>(this); br->ShowCloseTab(kFALSE); m_eve->GetViewers()->SwitchColorSet(); TFile::SetCacheFileDir("."); @@ -130,7 +130,7 @@ Display::Display(TEveManager* eve) /// Default destructor Display::~Display() { TRootBrowser* br = m_eve->GetBrowser(); - m_lcdd->removeExtension<Display>(false); + m_detDesc->removeExtension<Display>(false); m_viewConfigs.clear(); deletePtr(m_evtHandler); deletePtr(m_eveGlobal); @@ -140,18 +140,18 @@ Display::~Display() { deletePtr(m_viewMenu); deletePtr(m_eve); //br->ReallyDelete(); - LCDDData* data = dynamic_cast<LCDDData*>(m_lcdd); + DetectorData* data = dynamic_cast<DetectorData*>(m_detDesc); if ( data ) data->destroyData(false); - deletePtr(m_lcdd); + deletePtr(m_detDesc); gGeoManager = 0; gEve = 0; } /// Load geometry from compact xml file void Display::LoadXML(const char* xmlFile) { - TGeoManager& mgr = m_lcdd->manager(); + TGeoManager& mgr = m_detDesc->manager(); bool has_geo = !m_geoTopics.empty(); - m_lcdd->fromXML(xmlFile); + m_detDesc->fromXML(xmlFile); if ( !has_geo ) { LoadGeoChildren(0,m_loadLevel,false); mgr.SetVisLevel(m_visLevel); @@ -175,8 +175,8 @@ void Display::ChooseGeometry() { } /// Access to geometry hub -Geometry::LCDD& Display::lcdd() const { - return *m_lcdd; +Detector& Display::detectorDescription() const { + return *m_detDesc; } /// Access to X-client @@ -355,7 +355,7 @@ void Display::BuildMenus(TGMenuBar* bar) { bar = m_eve->GetBrowser()->GetMenuBar(); } if ( 0 == m_dd4Menu ) { - m_dd4Menu = new DD4hepMenu(this); + m_dd4Menu = new dd4hepMenu(this); AddMenu(bar, m_dd4Menu); } if ( 0 == m_viewMenu && !m_viewConfigs.empty() ) { @@ -534,8 +534,8 @@ void Display::ImportEvent(TEveElement* el) { /// Load 'levels' Children into the geometry scene void Display::LoadGeoChildren(TEveElement* start, int levels, bool redraw) { - using namespace DD4hep::Geometry; - DetElement world = m_lcdd->world(); + using namespace dd4hep::detail; + DetElement world = m_detDesc->world(); if ( world.children().size() == 0 ) { MessageBox(INFO,"It looks like there is no\nGeometry loaded.\nNo event display availible.\n"); } @@ -549,7 +549,7 @@ void Display::LoadGeoChildren(TEveElement* start, int levels, bool redraw) { world.placement().name(), levels); for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) { DetElement de = (*i).second; - SensitiveDetector sd = m_lcdd->sensitiveDetector(de.name()); + SensitiveDetector sd = m_detDesc->sensitiveDetector(de.name()); TEveElementList& parent = sd.isValid() ? sens : struc; pair<bool,TEveElement*> e = Utilities::LoadDetElement(de,levels,&parent); if ( e.second && e.first ) { @@ -563,7 +563,7 @@ void Display::LoadGeoChildren(TEveElement* start, int levels, bool redraw) { if ( 0 != n ) { TGeoHMatrix mat; const char* node_name = n->GetName(); - int level = Utilities::findNodeWithMatrix(lcdd().world().placement().ptr(),n,&mat); + int level = Utilities::findNodeWithMatrix(detectorDescription().world().placement().ptr(),n,&mat); if ( level > 0 ) { pair<bool,TEveElement*> e(false,0); const DetElement::Children& c = world.children(); diff --git a/DDEve/src/DisplayConfiguration.cpp b/DDEve/src/DisplayConfiguration.cpp index 09f171818..4d1eb35ef 100644 --- a/DDEve/src/DisplayConfiguration.cpp +++ b/DDEve/src/DisplayConfiguration.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ // C/C++ include files #include <stdexcept> -using namespace DD4hep; +using namespace dd4hep; ClassImp(DisplayConfiguration) diff --git a/DDEve/src/DisplayConfigurationParser.cpp b/DDEve/src/DisplayConfigurationParser.cpp index 4b853e615..7d98316b1 100644 --- a/DDEve/src/DisplayConfigurationParser.cpp +++ b/DDEve/src/DisplayConfigurationParser.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,8 +12,8 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" -#include "DD4hep/LCDDLoad.h" +#include "DD4hep/Detector.h" +#include "DD4hep/DetectorLoad.h" #include "DD4hep/Printout.h" #include "XML/Conversions.h" #include "XML/XMLElements.h" @@ -27,10 +27,10 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; +using namespace dd4hep; -namespace DD4hep { namespace { +namespace dd4hep { namespace { /// Some utility class to specialize the convetrers: class ddeve; class view; @@ -60,7 +60,7 @@ namespace DD4hep { namespace { template <> void Converter<detelement>::operator()(xml_h seq) const; } -#define DECL_TAG(x) XML::Strng_t u_##x(#x) +#define DECL_TAG(x) xml::Strng_t u_##x(#x) namespace { DECL_TAG(clone); DECL_TAG(load_geo); @@ -159,10 +159,10 @@ template <> void Converter<view>::operator()(xml_h e) const { c.name = e.attr<string>(_U(name)); printout(INFO,"DisplayConfiguration","+++ View: %s sensitive:%d structure:%d.", c.name.c_str(), c.show_sensitive, c.show_structure); - xml_coll_t(e,_Unicode(panel)).for_each(Converter<panel>(lcdd,&c.subdetectors)); - xml_coll_t(e,_Unicode(detelement)).for_each(Converter<detelement>(lcdd,&c.subdetectors)); - xml_coll_t(e,_Unicode(calodata)).for_each(Converter<calodata_configs>(lcdd,&c.subdetectors)); - xml_coll_t(e,_Unicode(collection)).for_each(Converter<collection_configs>(lcdd,&c.subdetectors)); + xml_coll_t(e,_Unicode(panel)).for_each(Converter<panel>(description,&c.subdetectors)); + xml_coll_t(e,_Unicode(detelement)).for_each(Converter<detelement>(description,&c.subdetectors)); + xml_coll_t(e,_Unicode(calodata)).for_each(Converter<calodata_configs>(description,&c.subdetectors)); + xml_coll_t(e,_Unicode(collection)).for_each(Converter<collection_configs>(description,&c.subdetectors)); configs->push_back(c); } @@ -246,12 +246,12 @@ template <> void Converter<collection>::operator()(xml_h e) const { */ template <> void Converter<include>::operator()(xml_h e) const { if ( e ) { - LCDDLoad* load = dynamic_cast<LCDDLoad*>(&this->lcdd); + DetectorLoad* load = dynamic_cast<DetectorLoad*>(&this->description); if ( load ) { load->processXML(e,e.attr<string>(_U(ref))); return; } - except("DisplayConfiguration","++ Invalid LCDDLoad instance in XML converter <include>"); + except("DisplayConfiguration","++ Invalid DetectorLoad instance in XML converter <include>"); } except("DisplayConfiguration","++ Attempt to parse invalid include statement [Invalid XML element]"); } @@ -289,11 +289,11 @@ template <> void Converter<ddeve>::operator()(xml_h e) const { Display* disp = (Display*)param; DisplayConfiguration cfg(disp); /// Now we process all allowed elements within this tag - xml_coll_t(e,_Unicode(display)).for_each(Converter<display>(lcdd,disp)); - xml_coll_t(e,_Unicode(include)).for_each(Converter<include>(lcdd,disp)); - xml_coll_t(e,_Unicode(calodata)).for_each(Converter<calodata>(lcdd,&cfg.calodata)); - xml_coll_t(e,_Unicode(collection)).for_each(Converter<collection>(lcdd,&cfg.collections)); - xml_coll_t(e,_Unicode(view)).for_each(Converter<view>(lcdd,&cfg.views)); + xml_coll_t(e,_Unicode(display)).for_each(Converter<display>(description,disp)); + xml_coll_t(e,_Unicode(include)).for_each(Converter<include>(description,disp)); + xml_coll_t(e,_Unicode(calodata)).for_each(Converter<calodata>(description,&cfg.calodata)); + xml_coll_t(e,_Unicode(collection)).for_each(Converter<collection>(description,&cfg.collections)); + xml_coll_t(e,_Unicode(view)).for_each(Converter<view>(description,&cfg.views)); disp->ImportConfiguration(cfg); } @@ -304,12 +304,12 @@ template <> void Converter<ddeve>::operator()(xml_h e) const { * @version 1.0 * @date 01/06/2014 */ -static long setup_DDEve(lcdd_t& lcdd, const xml_h& e) { - Display* display = lcdd.extension<Display>(); +static long setup_DDEve(Detector& description, const xml_h& e) { + Display* display = description.extension<Display>(); static bool first = true; if ( first ) { first = false; -#define add_root_enum(x) XML::_toDictionary(XML::Strng_t(#x),int(x)) +#define add_root_enum(x) xml::_toDictionary(xml::Strng_t(#x),int(x)) add_root_enum(kOrange); add_root_enum(kBlue); add_root_enum(kAzure); @@ -355,7 +355,7 @@ static long setup_DDEve(lcdd_t& lcdd, const xml_h& e) { add_root_enum(TEveProjection::kGM_Polygons); add_root_enum(TEveProjection::kGM_Segments); } - (DD4hep::Converter<DD4hep::ddeve>(lcdd,display))(e); + (dd4hep::Converter<dd4hep::ddeve>(description,display))(e); return 1; } DECLARE_XML_DOC_READER(ddeve,setup_DDEve) diff --git a/DDEve/src/ElementList.cpp b/DDEve/src/ElementList.cpp index 60bfa8ceb..3ab4ddd2a 100644 --- a/DDEve/src/ElementList.cpp +++ b/DDEve/src/ElementList.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(ElementList) ClassImp(ElementListContextMenu) diff --git a/DDEve/src/EvePgonSetProjectedContextMenu.cpp b/DDEve/src/EvePgonSetProjectedContextMenu.cpp index 7f7244ace..16b869152 100644 --- a/DDEve/src/EvePgonSetProjectedContextMenu.cpp +++ b/DDEve/src/EvePgonSetProjectedContextMenu.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +23,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(EvePgonSetProjectedContextMenu) diff --git a/DDEve/src/EveShapeContextMenu.cpp b/DDEve/src/EveShapeContextMenu.cpp index f01c2af57..7383cd292 100644 --- a/DDEve/src/EveShapeContextMenu.cpp +++ b/DDEve/src/EveShapeContextMenu.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(EveShapeContextMenu) diff --git a/DDEve/src/EveUserContextMenu.cpp b/DDEve/src/EveUserContextMenu.cpp index 23c516e95..ca3d6aeda 100644 --- a/DDEve/src/EveUserContextMenu.cpp +++ b/DDEve/src/EveUserContextMenu.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,7 +26,7 @@ // C/C++ include files using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(EveUserContextMenu) diff --git a/DDEve/src/EventControl.cpp b/DDEve/src/EventControl.cpp index c74dd7ca2..a41add5d0 100644 --- a/DDEve/src/EventControl.cpp +++ b/DDEve/src/EventControl.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -30,7 +30,7 @@ #include <libgen.h> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(EventControl) @@ -184,7 +184,7 @@ void EventControl::OnBuild() { // ----------------------------------------------------------------------------------------- top->AddFrame(new TGLabel(top,"Open event file:"), new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2, 2, 2, 2)); m_open = b = new TGPictureButton(top, LoadPicture((icondir+"bld_open.png"))); - b->Connect("Clicked()", "DD4hep::EventControl", this, "Open()"); + b->Connect("Clicked()", "dd4hep::EventControl", this, "Open()"); b->SetSize(TGDimension(32,32)); top->AddFrame(b, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); group->AddFrame(top, new TGLayoutHints(kLHintsExpandX|kLHintsCenterX, 2, 2, 2, 2)); @@ -192,14 +192,14 @@ void EventControl::OnBuild() { top = new TGHorizontalFrame(group); top->AddFrame(new TGLabel(top,"Previous:"), new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2, 2, 2, 2)); m_prev = b = new TGPictureButton(top, LoadPicture((icondir+"bld_undo.png"))); - b->Connect("Clicked()", "DD4hep::EventControl", this, "PreviousEvent()"); + b->Connect("Clicked()", "dd4hep::EventControl", this, "PreviousEvent()"); b->SetSize(TGDimension(32,32)); top->AddFrame(b, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); top->AddFrame(new TGLabel(top,""), new TGLayoutHints(kLHintsExpandX|kLHintsCenterY, 2, 2, 2, 2)); top->AddFrame(new TGLabel(top,"Next:"), new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2, 2, 2, 2)); m_next = b = new TGPictureButton(top, LoadPicture((icondir+"bld_redo.png"))); - b->Connect("Clicked()", "DD4hep::EventControl", this, "NextEvent()"); + b->Connect("Clicked()", "dd4hep::EventControl", this, "NextEvent()"); b->SetSize(TGDimension(32,32)); top->AddFrame(b, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); group->AddFrame(top,new TGLayoutHints(kLHintsExpandX|kLHintsCenterX, 2, 2, 2, 2)); @@ -207,7 +207,7 @@ void EventControl::OnBuild() { top = new TGHorizontalFrame(group); top->AddFrame(new TGLabel(top,"Goto event:"), new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2, 2, 2, 2)); m_goto = b = new TGPictureButton(top, LoadPicture((icondir+"ed_goto.png"))); - b->Connect("Clicked()", "DD4hep::EventControl", this, "GotoEvent()"); + b->Connect("Clicked()", "dd4hep::EventControl", this, "GotoEvent()"); b->SetSize(TGDimension(32,32)); top->AddFrame(b, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2)); group->AddFrame(top,new TGLayoutHints(kLHintsExpandX|kLHintsCenterX, 2, 2, 2, 2)); diff --git a/DDEve/src/EventHandler.cpp b/DDEve/src/EventHandler.cpp index c8facea73..efb4bd008 100644 --- a/DDEve/src/EventHandler.cpp +++ b/DDEve/src/EventHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ // Framework include files #include "DDEve/EventHandler.h" -using namespace DD4hep; +using namespace dd4hep; ClassImp(EventHandler) ClassImp(EventConsumer) diff --git a/DDEve/src/FrameControl.cpp b/DDEve/src/FrameControl.cpp index 7846da6bb..ad5b72a93 100644 --- a/DDEve/src/FrameControl.cpp +++ b/DDEve/src/FrameControl.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(FrameControl) diff --git a/DDEve/src/GenericEventHandler.cpp b/DDEve/src/GenericEventHandler.cpp index d817e43b7..f2cbb4f1f 100644 --- a/DDEve/src/GenericEventHandler.cpp +++ b/DDEve/src/GenericEventHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include <climits> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(GenericEventHandler) @@ -35,7 +35,7 @@ GenericEventHandler::GenericEventHandler() : m_current(0) { /// Default destructor GenericEventHandler::~GenericEventHandler() { m_subscriptions.clear(); - deletePtr(m_current); + detail::deletePtr(m_current); } EventHandler* GenericEventHandler::current() const { @@ -104,7 +104,7 @@ bool GenericEventHandler::Open(const string& file_type, const string& file_name) m_hasFile = false; m_hasEvent = false; try { - deletePtr(m_current); + detail::deletePtr(m_current); // prefer event handler configured in xml if ( file_type.find("FCC") != string::npos ) { m_current = (EventHandler*)PluginService::Create<void*>("DDEve_FCCEventHandler",(const char*)0); @@ -126,7 +126,7 @@ bool GenericEventHandler::Open(const string& file_type, const string& file_name) return true; } err = "+++ Failed to open the data file:"+file_name; - deletePtr(m_current); + detail::deletePtr(m_current); } else { err = "+++ Failed to create fikle reader for file '"+file_name+"' of type '"+file_type+"'"; diff --git a/DDEve/src/HitActors.cpp b/DDEve/src/HitActors.cpp index 8dcbe6f73..b8a15347d 100644 --- a/DDEve/src/HitActors.cpp +++ b/DDEve/src/HitActors.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,12 +24,12 @@ #include "TEveCompound.h" using namespace std; -using namespace DD4hep; +using namespace dd4hep; /// Action callback of this functor: void EtaPhiHistogramActor::operator()(const DDEveHit& hit) { - const Geometry::Position pos(hit.x/MM_2_CM,hit.y/MM_2_CM,hit.z/MM_2_CM); + const Position pos(hit.x/MM_2_CM,hit.y/MM_2_CM,hit.z/MM_2_CM); histogram->Fill(pos.Eta(),pos.Phi(),hit.deposit); } diff --git a/DDEve/src/MultiView.cpp b/DDEve/src/MultiView.cpp index 10945371e..6d1eb099d 100644 --- a/DDEve/src/MultiView.cpp +++ b/DDEve/src/MultiView.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ #include <iostream> using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(MultiView) DECLARE_VIEW_FACTORY(MultiView) @@ -73,11 +73,11 @@ View& MultiView::Build(TEveWindow* slot) { /// First panel if ( panels.size()>0) { const DisplayConfiguration::Config& cfg = panels[0]; - string typ = "DD4hep__"+cfg.use; + string typ = "dd4hep__"+cfg.use; v = PluginService::Create<View*>(typ.c_str(),m_eve,cfg.name.c_str()); } else { - v = PluginService::Create<View*>("DD4hep_DDEve_RhoZProjection",m_eve,(m_name+" - RhoZ View").c_str()); + v = PluginService::Create<View*>("dd4hep_DDEve_RhoZProjection",m_eve,(m_name+" - RhoZ View").c_str()); } (new_slot = pack->NewSlot())->MakeCurrent(); _build(m_eve,v,new_slot); @@ -85,11 +85,11 @@ View& MultiView::Build(TEveWindow* slot) { /// Second panel if ( panels.size()>1) { const DisplayConfiguration::Config& cfg = panels[1]; - string typ = "DD4hep__"+cfg.use; + string typ = "dd4hep__"+cfg.use; v = PluginService::Create<View*>(typ.c_str(),m_eve,cfg.name.c_str()); } else { - v = PluginService::Create<View*>("DD4hep_DDEve_RhoPhiProjection",m_eve,(m_name+" - RPhi View").c_str()); + v = PluginService::Create<View*>("dd4hep_DDEve_RhoPhiProjection",m_eve,(m_name+" - RPhi View").c_str()); } (new_slot = pack->NewSlot())->MakeCurrent(); _build(m_eve,v,new_slot); diff --git a/DDEve/src/ParticleActors.cpp b/DDEve/src/ParticleActors.cpp index 67a11fb30..5a6793da0 100644 --- a/DDEve/src/ParticleActors.cpp +++ b/DDEve/src/ParticleActors.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,7 +25,7 @@ #include "TGeoManager.h" using namespace std; -using namespace DD4hep; +using namespace dd4hep; static Color_t Colors[] = { kRed, kBlue, kYellow, kGreen, kPink, kAzure, kOrange, kTeal, kViolet, kSpring, kMagenta, kCyan diff --git a/DDEve/src/PopupMenu.cpp b/DDEve/src/PopupMenu.cpp index c9f19b8e5..e1e85ed56 100644 --- a/DDEve/src/PopupMenu.cpp +++ b/DDEve/src/PopupMenu.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,13 +21,13 @@ // Forward declarations -using namespace DD4hep; +using namespace dd4hep; ClassImp(PopupMenu) /// Standard constructor PopupMenu::PopupMenu(const TGWindow *parent) : m_popup(parent), m_cmd(0) { - m_popup.Connect("Activated(int)", "DD4hep::PopupMenu", this, "HandleMenu(int)"); + m_popup.Connect("Activated(int)", "dd4hep::PopupMenu", this, "HandleMenu(int)"); InstanceCount::increment(this); } diff --git a/DDEve/src/Projection.cpp b/DDEve/src/Projection.cpp index ba17545a2..ef7279d0f 100644 --- a/DDEve/src/Projection.cpp +++ b/DDEve/src/Projection.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include <TGLViewer.h> using namespace std; -using namespace DD4hep; +using namespace dd4hep; /// Initializing constructor Projection::Projection(Display* eve, const string& nam) diff --git a/DDEve/src/RhoPhiProjection.cpp b/DDEve/src/RhoPhiProjection.cpp index c26d2e8db..75205d696 100644 --- a/DDEve/src/RhoPhiProjection.cpp +++ b/DDEve/src/RhoPhiProjection.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDEve/RhoPhiProjection.h" #include "DDEve/Factories.h" -using namespace DD4hep; +using namespace dd4hep; ClassImp(RhoPhiProjection) DECLARE_VIEW_FACTORY(RhoPhiProjection) diff --git a/DDEve/src/RhoZProjection.cpp b/DDEve/src/RhoZProjection.cpp index aadec6d52..930836998 100644 --- a/DDEve/src/RhoZProjection.cpp +++ b/DDEve/src/RhoZProjection.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDEve/RhoZProjection.h" #include "DDEve/Factories.h" -using namespace DD4hep; +using namespace dd4hep; ClassImp(RhoZProjection) diff --git a/DDEve/src/Utilities.cpp b/DDEve/src/Utilities.cpp index 3f5fa0b42..ad80ece37 100644 --- a/DDEve/src/Utilities.cpp +++ b/DDEve/src/Utilities.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ // Framework include files #include "DD4hep/Objects.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Volumes.h" #include "DD4hep/Printout.h" #include "DDEve/Utilities.h" @@ -30,8 +30,8 @@ #include "TEveElement.h" #include "TEveTrans.h" -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; using namespace std; /// Set the rendering flags for the object and the next level children @@ -182,7 +182,7 @@ int Utilities::findNodeWithMatrix(TGeoNode* p, TGeoNode* n, TGeoHMatrix* mat, st return 0; } -std::pair<bool,TEveElement*> Utilities::LoadDetElement(Geometry::DetElement de,int levels, TEveElement* parent) { +std::pair<bool,TEveElement*> Utilities::LoadDetElement(DetElement de,int levels, TEveElement* parent) { if ( !strstr(de.name(),"BeamCal") ) { PlacedVolume pv = de.placement(); if (pv.isValid()) { diff --git a/DDEve/src/View.cpp b/DDEve/src/View.cpp index 22cd107a0..f039097ba 100644 --- a/DDEve/src/View.cpp +++ b/DDEve/src/View.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,7 +28,7 @@ #include <TGLViewer.h> using namespace std; -using namespace DD4hep; +using namespace dd4hep; template <typename T> static inline typename T::const_iterator find(const T& c,const string& s) { @@ -122,7 +122,7 @@ TEveElement* View::ImportEventElement(TEveElement* el, TEveElementList* list) { /// Access the global instance of the subdetector geometry pair<bool,TEveElement*> View::GetGlobalGeometry(DetElement de, const DisplayConfiguration::Config& /* cfg */) { - SensitiveDetector sd = m_eve->lcdd().sensitiveDetector(de.name()); + SensitiveDetector sd = m_eve->detectorDescription().sensitiveDetector(de.name()); TEveElementList& global = m_eve->GetGeoTopic(sd.isValid() ? "Sensitive" : "Structure"); TEveElement* elt = global.FindChild(de.name()); return pair<bool,TEveElement*>(true,elt); @@ -131,7 +131,7 @@ View::GetGlobalGeometry(DetElement de, const DisplayConfiguration::Config& /* cf /// Create a new instance of the geometry of a sub-detector pair<bool,TEveElement*> View::CreateGeometry(DetElement de, const DisplayConfiguration::Config& cfg) { - SensitiveDetector sd = m_eve->lcdd().sensitiveDetector(de.name()); + SensitiveDetector sd = m_eve->detectorDescription().sensitiveDetector(de.name()); TEveElementList& topic = GetGeoTopic(sd.isValid() ? "Sensitive" : "Structure"); return Utilities::LoadDetElement(de,cfg.data.defaults.load_geo,&topic); } @@ -161,7 +161,7 @@ void View::ConfigureGeometry(const DisplayConfiguration::ViewConfig& config) string dets; DisplayConfiguration::Configurations::const_iterator ic; float legend_y = Annotation::DefaultTextSize()+Annotation::DefaultMargin(); - const DetElement::Children& c = m_eve->lcdd().world().children(); + const DetElement::Children& c = m_eve->detectorDescription().world().children(); for( ic=config.subdetectors.begin(); ic != config.subdetectors.end(); ++ic) { const DisplayConfiguration::Config& cfg = *ic; string nam = cfg.name; @@ -184,7 +184,7 @@ void View::ConfigureGeometry(const DisplayConfiguration::ViewConfig& config) DetElement::Children::const_iterator i = c.find(nam); if ( i != c.end() ) { DetElement de = (*i).second; - SensitiveDetector sd = m_eve->lcdd().sensitiveDetector(nam); + SensitiveDetector sd = m_eve->detectorDescription().sensitiveDetector(nam); TEveElementList& topic = GetGeoTopic(sd.isValid() ? "Sensitive" : "Structure"); pair<bool,TEveElement*> e(false,0); if ( cfg.data.defaults.load_geo > 0 ) // Create a new instance @@ -243,7 +243,7 @@ void View::ConfigureEventFromGlobal() { /// Configure a single view void View::ConfigureEvent(const DisplayConfiguration::ViewConfig& config) { - DetElement world = m_eve->lcdd().world(); + DetElement world = m_eve->detectorDescription().world(); const DetElement::Children& c = world.children(); DisplayConfiguration::Configurations::const_iterator ic; for( ic=config.subdetectors.begin(); ic != config.subdetectors.end(); ++ic) { @@ -267,7 +267,7 @@ void View::ConfigureEvent(const DisplayConfiguration::ViewConfig& config) { // Not using the global scene! DetElement::Children::const_iterator i = c.find(nam); if ( i != c.end() && cfg.data.defaults.show_evt>0 ) { - SensitiveDetector sd = m_eve->lcdd().sensitiveDetector(nam); + SensitiveDetector sd = m_eve->detectorDescription().sensitiveDetector(nam); if ( sd.isValid() ) { // This should be configurable! const char* coll = sd.readout().name(); diff --git a/DDEve/src/View3D.cpp b/DDEve/src/View3D.cpp index 0296719fe..e3cfbbd38 100644 --- a/DDEve/src/View3D.cpp +++ b/DDEve/src/View3D.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDEve/View3D.h" #include "DDEve/Factories.h" -using namespace DD4hep; +using namespace dd4hep; ClassImp(View3D) DECLARE_VIEW_FACTORY(View3D) diff --git a/DDEve/src/ViewMenu.cpp b/DDEve/src/ViewMenu.cpp index 5588cfd57..197c2f568 100644 --- a/DDEve/src/ViewMenu.cpp +++ b/DDEve/src/ViewMenu.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -35,7 +35,7 @@ class TEveWindowSlot; using namespace std; -using namespace DD4hep; +using namespace dd4hep; ClassImp(ViewMenu) @@ -55,13 +55,13 @@ ViewMenu::~ViewMenu() { void ViewMenu::Build(TGMenuBar* bar, int hints) { pair<string,string>* p = 0; PopupMenu* view_menu = this; - view_menu->AddEntry("3&D View", this, &ViewMenu::CreateView, p=new pair<string,string>("DD4hep_DDEve_View3D","3D")); - view_menu->AddEntry("Rho-&Z Projection", this, &ViewMenu::CreateView, p=new pair<string,string>("DD4hep_DDEve_RhoZProjection","Rho-Z")); - view_menu->AddEntry("Rho-&Phi Projection",this, &ViewMenu::CreateView, p=new pair<string,string>("DD4hep_DDEve_RhoPhiProjection","Rho-Phi")); + view_menu->AddEntry("3&D View", this, &ViewMenu::CreateView, p=new pair<string,string>("dd4hep_DDEve_View3D","3D")); + view_menu->AddEntry("Rho-&Z Projection", this, &ViewMenu::CreateView, p=new pair<string,string>("dd4hep_DDEve_RhoZProjection","Rho-Z")); + view_menu->AddEntry("Rho-&Phi Projection",this, &ViewMenu::CreateView, p=new pair<string,string>("dd4hep_DDEve_RhoPhiProjection","Rho-Phi")); const Display::ViewConfigurations& vc = m_display->viewConfigurations(); for(Display::ViewConfigurations::const_iterator i=vc.begin(); i!=vc.end(); ++i) { const Display::ViewConfig& v = (*i).second; - view_menu->AddEntry(v.name.c_str(), this, &ViewMenu::CreateView,p=new pair<string,string>("DD4hep_DDEve_"+v.type,v.name)); + view_menu->AddEntry(v.name.c_str(), this, &ViewMenu::CreateView,p=new pair<string,string>("dd4hep_DDEve_"+v.type,v.name)); } bar->AddPopup(m_title.c_str(),*view_menu, new TGLayoutHints(hints, 0, 4, 0, 0)); } @@ -73,7 +73,7 @@ void ViewMenu::CreateView(TGMenuEntry*, void* ud) { } View* ViewMenu::CreateView(const std::string& type, const std::string& title) { - pair<string,string> args("DD4hep_DDEve_"+type,title); + pair<string,string> args("dd4hep_DDEve_"+type,title); View* v = PluginService::Create<View*>(type.c_str(),m_display,title.c_str()); BuildView(v); return v; @@ -81,17 +81,17 @@ View* ViewMenu::CreateView(const std::string& type, const std::string& title) /// Create a new 3D view View* ViewMenu::CreateView3D(const std::string& title) { - return CreateView("DD4hep_DDEve_View3D",title.c_str()); + return CreateView("dd4hep_DDEve_View3D",title.c_str()); } /// Create a new R-Z view View* ViewMenu::CreateRhoZProjection(const std::string& title ) { - return CreateView("DD4hep_DDEve_RhoZProjection",title.c_str()); + return CreateView("dd4hep_DDEve_RhoZProjection",title.c_str()); } /// Create a new R-Phi view View* ViewMenu::CreateRhoPhiProjection(const std::string& title ) { - return CreateView("DD4hep_DDEve_RhoPhiProjection",title.c_str()); + return CreateView("dd4hep_DDEve_RhoPhiProjection",title.c_str()); } /// Import Geometry data diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index 89a5c2906..9f55fc5c3 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -44,8 +44,8 @@ dd4hep_add_plugin(DDG4Python dd4hep_add_plugin(DDG4LCIO OPTIONAL [LCIO REQUIRED SOURCES lcio/*.cpp] ) #--------------------------- DDRec dependent Plugins ----------------------------- -dd4hep_add_plugin(DDG4Reco - OPTIONAL [DDRec REQUIRED SOURCES reco/*.cpp] ) +#dd4hep_add_plugin(DDG4Reco +# OPTIONAL [DDRec REQUIRED SOURCES reco/*.cpp] ) #----------------------------------------------------------------------------------- dd4hep_add_executable(g4gdmlDisplay SOURCES g4gdmlDisplay.cpp) #----------------------------------------------------------------------------------- diff --git a/DDG4/ddsim.cpp b/DDG4/ddsim.cpp index 726d1120e..37cc25637 100644 --- a/DDG4/ddsim.cpp +++ b/DDG4/ddsim.cpp @@ -1,5 +1,5 @@ //==================================================================== -// DDSim - LC simulation based on DD4hep +// DDSim - LC simulation based on dd4hep //-------------------------------------------------------------------- // F.Gaede, DESY //==================================================================== @@ -9,7 +9,7 @@ #include <iostream> #include <stdexcept> -using namespace DD4hep::Simulation::Setup; +using namespace dd4hep::sim::Setup; /** Simple main program to run a simulation with DDG4 * Loops over all xml files given on command line: @@ -25,8 +25,8 @@ int main_wrapper(int argc, char** argv) { exit( 0 ) ; } - DD4hep::Geometry::LCDD& lcdd = DD4hep::Geometry::LCDD::getInstance(); - Kernel& kernel = Kernel::instance(lcdd); + dd4hep::Detector& description = dd4hep::Detector::getInstance(); + Kernel& kernel = Kernel::instance(description); // first argument: geometry file diff --git a/DDG4/examples/CLICSidSimuLCIO.py b/DDG4/examples/CLICSidSimuLCIO.py index 49f8861de..8e79b4518 100644 --- a/DDG4/examples/CLICSidSimuLCIO.py +++ b/DDG4/examples/CLICSidSimuLCIO.py @@ -7,7 +7,7 @@ from SystemOfUnits import * # """ - DD4hep simulation example setup using the python configuration + dd4hep simulation example setup using the python configuration @author M.Frank @version 1.0 diff --git a/DDG4/examples/CLICSidSimuMarkus.py b/DDG4/examples/CLICSidSimuMarkus.py index 98f720047..f25cf2a62 100644 --- a/DDG4/examples/CLICSidSimuMarkus.py +++ b/DDG4/examples/CLICSidSimuMarkus.py @@ -7,7 +7,7 @@ from SystemOfUnits import * # """ - DD4hep simulation example setup using the python configuration + dd4hep simulation example setup using the python configuration @author M.Frank @version 1.0 @@ -17,12 +17,12 @@ from DDG4 import OutputLevel as Output from SystemOfUnits import * kernel = DDG4.Kernel() -lcdd = kernel.lcdd() +description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] example_dir = install_dir+'/examples/DDG4/examples'; kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD_Markus.xml") kernel.loadXML("file:"+example_dir+"/DDG4_field.xml") -DDG4.importConstants(lcdd,debug=False) +DDG4.importConstants(description,debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') geant4.printDetectors() # Configure UI @@ -37,12 +37,12 @@ kernel.configure() """ def run(): kernel = DDG4.Kernel() - lcdd = kernel.lcdd() + description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] example_dir = install_dir+'/examples/DDG4/examples'; kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD_Markus.xml") ##kernel.loadXML("file:"+example_dir+"/DDG4_field.xml") - DDG4.importConstants(lcdd,debug=False) + DDG4.importConstants(description,debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') geant4.printDetectors() # Configure UI diff --git a/DDG4/examples/SiDSim.py b/DDG4/examples/SiDSim.py index 022a3de9e..2fc64257c 100644 --- a/DDG4/examples/SiDSim.py +++ b/DDG4/examples/SiDSim.py @@ -8,7 +8,7 @@ from SystemOfUnits import * print \ """ - DD4hep simulation example setup using the python configuration + dd4hep simulation example setup using the python configuration @author M.Frank @version 1.0 @@ -16,10 +16,10 @@ print \ """ def run(): kernel = DDG4.Kernel() - lcdd = kernel.lcdd() + description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD.xml") - DDG4.importConstants(lcdd) + DDG4.importConstants(description) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') geant4.printDetectors() diff --git a/DDG4/examples/SiDSim_MT.py b/DDG4/examples/SiDSim_MT.py index 289e7f79f..3f9a227e1 100644 --- a/DDG4/examples/SiDSim_MT.py +++ b/DDG4/examples/SiDSim_MT.py @@ -8,7 +8,7 @@ from SystemOfUnits import * print \ """ - DD4hep simulation example setup DDG4 + dd4hep simulation example setup DDG4 in multi-threaded mode using the python configuration @author M.Frank @@ -132,11 +132,11 @@ def setupSensitives(geant4): def run(): kernel = DDG4.Kernel() - lcdd = kernel.lcdd() + description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] DDG4.Core.setPrintFormat("%-32s %6s %s") kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD.xml") - DDG4.importConstants(lcdd) + DDG4.importConstants(description) kernel.NumberOfThreads = 3 geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') diff --git a/DDG4/examples/SiD_Markus.py b/DDG4/examples/SiD_Markus.py index ce1a154c8..12bd55ebf 100644 --- a/DDG4/examples/SiD_Markus.py +++ b/DDG4/examples/SiD_Markus.py @@ -8,7 +8,7 @@ global geant4 # """ - DD4hep simulation example setup using the python configuration + dd4hep simulation example setup using the python configuration @author M.Frank @version 1.0 @@ -147,10 +147,10 @@ def dummy_geom(): def run(): global geant4 kernel = DDG4.Kernel() - lcdd = kernel.lcdd() + description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD_Markus.xml") - DDG4.importConstants(lcdd) + DDG4.importConstants(description) DDG4.Core.setPrintLevel(Output.DEBUG) DDG4.Core.setPrintFormat("%-32s %6s %s") diff --git a/DDG4/examples/TEve.C b/DDG4/examples/TEve.C index af45add8c..a9e66c377 100644 --- a/DDG4/examples/TEve.C +++ b/DDG4/examples/TEve.C @@ -9,7 +9,7 @@ // Author : M.Frank // //==================================================================== -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // ROOT include files #include "TGeoManager.h" @@ -26,19 +26,19 @@ #define private public #include "TEveManager.h" -using namespace DD4hep::Geometry; +using namespace dd4hep::detail; void TEve() { - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); const char* fname = "file:../DD4hep.trunk/DDExamples/CLICSiD/compact/compact.xml"; - lcdd.apply("DD4hepCompactLoader",1,(char**)&fname); + description.apply("dd4hepCompactLoader",1,(char**)&fname); TEveManager::Create(); //TFile::SetCacheFileDir("."); //gGeoManager = gEve->GetGeometry("LHCb.gdml"); //gGeoManager = gEve->GetGeometry("lhcbfull_v1.root"); - gEve->fGeometries->Add(new TObjString(fname),&lcdd.manager()); + gEve->fGeometries->Add(new TObjString(fname),&description.manager()); //gGeoManager->DefaultColors(); TEveGeoTopNode* tn = new TEveGeoTopNode(gGeoManager, gGeoManager->GetTopNode()); diff --git a/DDG4/examples/initAClick.C b/DDG4/examples/initAClick.C index 4ba9f5cda..3567ce4d0 100644 --- a/DDG4/examples/initAClick.C +++ b/DDG4/examples/initAClick.C @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/examples/readHEPMC.py b/DDG4/examples/readHEPMC.py index 525d5f0c8..6aae610e8 100644 --- a/DDG4/examples/readHEPMC.py +++ b/DDG4/examples/readHEPMC.py @@ -1,6 +1,6 @@ """ -DD4hep simulation example setup using the python configuration +dd4hep simulation example setup using the python configuration @author M.Frank @version 1.0 @@ -10,7 +10,7 @@ def run(input_file): import DDG4 from DDG4 import OutputLevel as Output kernel = DDG4.Kernel() - lcdd = kernel.lcdd() + description = kernel.detectorDescription() gen = DDG4.GeneratorAction(kernel,"Geant4InputAction/Input") kernel.generatorAction().adopt(gen) gen.Input = "Geant4EventReaderHepMC|/home/frankm/SW/data/hepmc_geant4.dat" @@ -18,7 +18,7 @@ def run(input_file): gen.Input = "Geant4EventReaderHepMC|"+input_file gen.OutputLevel = Output.DEBUG gen.HaveAbort = False - prim_vtx = DDG4.std_vector('DD4hep::Simulation::Geant4Vertex*')() + prim_vtx = DDG4.std_vector('dd4hep::sim::Geant4Vertex*')() parts = gen.new_particles() ret = 1 while ret: diff --git a/DDG4/examples/run.C b/DDG4/examples/run.C index 51ed9ebad..0605c4de3 100644 --- a/DDG4/examples/run.C +++ b/DDG4/examples/run.C @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/g4FromXML.cpp b/DDG4/g4FromXML.cpp index f28e363ba..352f1aaa1 100644 --- a/DDG4/g4FromXML.cpp +++ b/DDG4/g4FromXML.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,11 +19,11 @@ #include <iostream> #include <cerrno> -using namespace DD4hep::Simulation::Setup; +using namespace dd4hep::sim::Setup; int setupG4_XML() { - DD4hep::Geometry::LCDD& lcdd = DD4hep::Geometry::LCDD::getInstance(); - Kernel& kernel = Kernel::instance(lcdd); + dd4hep::Detector& description = dd4hep::Detector::getInstance(); + Kernel& kernel = Kernel::instance(description); kernel.loadGeometry("file:../DD4hep.trunk/DDExamples/CLICSiD/compact/compact.xml"); kernel.loadXML("DDG4_field.xml"); kernel.loadXML("sequences.xml"); diff --git a/DDG4/g4gdmlDisplay.cpp b/DDG4/g4gdmlDisplay.cpp index d6f501c1e..640ece170 100644 --- a/DDG4/g4gdmlDisplay.cpp +++ b/DDG4/g4gdmlDisplay.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -39,7 +39,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace { class EmptyPhysicsList: public G4VUserPhysicsList { diff --git a/DDG4/include/DDG4/ComponentUtils.h b/DDG4/include/DDG4/ComponentUtils.h index f1a03358e..5cd9e5a48 100644 --- a/DDG4/include/DDG4/ComponentUtils.h +++ b/DDG4/include/DDG4/ComponentUtils.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,9 +20,9 @@ #include "DD4hep/Exceptions.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { -} // End namespace DD4hep +} // End namespace dd4hep #endif // DD4HEP_DDG4_COMPONENTTUILS_H diff --git a/DDG4/include/DDG4/DDG4Dict.h b/DDG4/include/DDG4/DDG4Dict.h index 52b5c60e5..025265de1 100644 --- a/DDG4/include/DDG4/DDG4Dict.h +++ b/DDG4/include/DDG4/DDG4Dict.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,10 +28,10 @@ // FRamework include files #include "DDG4/Geant4Data.h" #include "DDG4/Geant4Particle.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { } - namespace Simulation { } - namespace Geometry { } + namespace sim { } + namespace detail { } } // CINT configuration @@ -43,69 +43,69 @@ namespace DD4hep { using namespace std; /// Define namespaces -#pragma link C++ namespace DD4hep; -#pragma link C++ namespace DD4hep::Geometry; -#pragma link C++ namespace DD4hep::Simulation; +#pragma link C++ namespace dd4hep; +#pragma link C++ namespace dd4hep::detail; +#pragma link C++ namespace dd4hep::sim; /// Simple stuff -#pragma link C++ class DD4hep::Simulation::SimpleRun+; -#pragma link C++ class DD4hep::Simulation::SimpleEvent+; -#pragma link C++ class DD4hep::Simulation::DataExtension+; +#pragma link C++ class dd4hep::sim::SimpleRun+; +#pragma link C++ class dd4hep::sim::SimpleEvent+; +#pragma link C++ class dd4hep::sim::DataExtension+; /// Dictionaires for Geant4 particles -#pragma link C++ class DD4hep::Simulation::ParticleExtension+; +#pragma link C++ class dd4hep::sim::ParticleExtension+; /// Auto-pointers related. ROOT cannot handle I/O! -#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::DataExtension>; -#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::ParticleExtension>; +#pragma link C++ class dd4hep::dd4hep_ptr<dd4hep::sim::DataExtension>; +#pragma link C++ class dd4hep::dd4hep_ptr<dd4hep::sim::ParticleExtension>; #ifdef DD4HEP_DD4HEP_PTR_AUTO -#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::DataExtension>::base_t; -#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::ParticleExtension>::base_t; +#pragma link C++ class dd4hep::dd4hep_ptr<dd4hep::sim::DataExtension>::base_t; +#pragma link C++ class dd4hep::dd4hep_ptr<dd4hep::sim::ParticleExtension>::base_t; #endif -#pragma link C++ class DD4hep::Simulation::Geant4Particle+; -#pragma link C++ class vector<DD4hep::Simulation::Geant4Particle*>+; -#pragma link C++ class map<int,DD4hep::Simulation::Geant4Particle*>+; -#pragma link C++ class map<int,DD4hep::Simulation::Geant4Particle*>::iterator; -#pragma link C++ class map<int,DD4hep::Simulation::Geant4Particle*>::const_iterator; +#pragma link C++ class dd4hep::sim::Geant4Particle+; +#pragma link C++ class vector<dd4hep::sim::Geant4Particle*>+; +#pragma link C++ class map<int,dd4hep::sim::Geant4Particle*>+; +#pragma link C++ class map<int,dd4hep::sim::Geant4Particle*>::iterator; +#pragma link C++ class map<int,dd4hep::sim::Geant4Particle*>::const_iterator; #ifdef R__MACOSX // We only need these declarations for the clang compiler -#pragma link C++ function operator==( const map<int,DD4hep::Simulation::Geant4Particle*>::iterator&, const map<int,DD4hep::Simulation::Geant4Particle*>::iterator& ); -#pragma link C++ function operator!=( const map<int,DD4hep::Simulation::Geant4Particle*>::iterator&, const map<int,DD4hep::Simulation::Geant4Particle*>::iterator& ); +#pragma link C++ function operator==( const map<int,dd4hep::sim::Geant4Particle*>::iterator&, const map<int,dd4hep::sim::Geant4Particle*>::iterator& ); +#pragma link C++ function operator!=( const map<int,dd4hep::sim::Geant4Particle*>::iterator&, const map<int,dd4hep::sim::Geant4Particle*>::iterator& ); #endif //#pragma link C++ class type_info; /// Dictionaires for basic Hit data structures -#pragma link C++ class DD4hep::Simulation::Geant4HitData+; -#pragma link C++ class vector<DD4hep::Simulation::Geant4HitData*>+; -#pragma link C++ class DD4hep::Simulation::Geant4HitData::Contribution+; -#pragma link C++ class DD4hep::Simulation::Geant4HitData::Contributions+; +#pragma link C++ class dd4hep::sim::Geant4HitData+; +#pragma link C++ class vector<dd4hep::sim::Geant4HitData*>+; +#pragma link C++ class dd4hep::sim::Geant4HitData::Contribution+; +#pragma link C++ class dd4hep::sim::Geant4HitData::Contributions+; /// Dictionaires for Tracker Hit data structures -#pragma link C++ class DD4hep::Simulation::Geant4Tracker+; -#pragma link C++ class DD4hep::Simulation::Geant4Tracker::Hit+; -#pragma link C++ class vector<DD4hep::Simulation::Geant4Tracker::Hit*>+; +#pragma link C++ class dd4hep::sim::Geant4Tracker+; +#pragma link C++ class dd4hep::sim::Geant4Tracker::Hit+; +#pragma link C++ class vector<dd4hep::sim::Geant4Tracker::Hit*>+; /// Dictionaires for Calorimeter Hit data structures -#pragma link C++ class DD4hep::Simulation::Geant4Calorimeter+; -#pragma link C++ class DD4hep::Simulation::Geant4Calorimeter::Hit+; -#pragma link C++ class vector<DD4hep::Simulation::Geant4Calorimeter::Hit*>+; +#pragma link C++ class dd4hep::sim::Geant4Calorimeter+; +#pragma link C++ class dd4hep::sim::Geant4Calorimeter::Hit+; +#pragma link C++ class vector<dd4hep::sim::Geant4Calorimeter::Hit*>+; #endif #ifdef __DDG4_STANDALONE_DICTIONARIES__ /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { /* * Simulation namespace declaration */ - namespace Simulation { + namespace sim { #define NO_CALL { throw "This function shoule never ever be called!"; } /// Default constructor inline SimpleRun::SimpleRun() : runID(0), numEvents(0) { } diff --git a/DDG4/include/DDG4/Defs.h b/DDG4/include/DDG4/Defs.h index 82cbaf045..430ca6c13 100644 --- a/DDG4/include/DDG4/Defs.h +++ b/DDG4/include/DDG4/Defs.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,21 +15,13 @@ #define DDG4_DEFS_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { - - using Geometry::Transform3D; - using Geometry::RotationZYX; - using Geometry::Position; - using Geometry::LCDD; - using Geometry::Readout; - using Geometry::DetElement; - + namespace sim { // Forward declarations; typedef Position Direction; typedef Position Momentum; @@ -41,6 +33,6 @@ namespace DD4hep { class Geant4SensitiveDetector; template <class T> class Geant4GenericSD; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DDG4_DEFS_H diff --git a/DDG4/include/DDG4/Factories.h b/DDG4/include/DDG4/Factories.h index e4e52e058..75838c0f4 100644 --- a/DDG4/include/DDG4/Factories.h +++ b/DDG4/include/DDG4/Factories.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,7 +10,6 @@ // Author : M.Frank // //========================================================================== - #ifndef DDG4_FACTORIES_H #define DDG4_FACTORIES_H @@ -37,16 +36,18 @@ class G4VPrimaryGenerator; class G4VProcess; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { + + class DetElement; + class Detector; - /// Namespace for the geometry part of the AIDA detector description toolkit - namespace Geometry { + /// Namespace for implementation details of the AIDA detector description toolkit + namespace detail { class GeoHandler; - class DetElement; - class LCDD; } + /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { class Geant4Context; class Geant4Action; class Geant4Converter; @@ -59,39 +60,37 @@ namespace DD4hep { /// Templated factory method to invoke setup action template <typename T> class Geant4SetupAction : public PluginFactoryBase { public: - static long create(lcdd_t& lcdd, const DD4hep::Geometry::GeoHandler& cnv, const std::map<str_t,str_t>& attrs); + static long create(dd4hep::Detector& description, const dd4hep::detail::GeoHandler& cnv, const std::map<str_t,str_t>& attrs); }; /// Deprecated: Templated factory method to create sensitive detector template <typename T> class Geant4SensitiveDetectorFactory : public PluginFactoryBase { public: - static G4VSensitiveDetector* create(const str_t& name, lcdd_t& lcdd); + static G4VSensitiveDetector* create(const str_t& name, dd4hep::Detector& description); }; } namespace { - namespace DS = DD4hep::Simulation; + namespace DS = dd4hep::sim; struct _ns { - typedef DD4hep::Geometry::LCDD LCDD; - typedef DD4hep::Geometry::GeoHandler GH; - typedef DD4hep::Geometry::DetElement DE; - typedef DD4hep::Simulation::Geant4Action GA; - typedef DD4hep::Simulation::Geant4Context CT; - typedef DD4hep::Simulation::Geant4EventReader RDR; + typedef dd4hep::detail::GeoHandler GH; + typedef dd4hep::sim::Geant4Action GA; + typedef dd4hep::sim::Geant4Context CT; + typedef dd4hep::sim::Geant4EventReader RDR; typedef std::map<std::string,std::string> STRM; typedef G4MagIntegratorStepper Stepper; }; - DD4HEP_PLUGIN_FACTORY_ARGS_3(long, _ns::LCDD*, const _ns::GH*, const _ns::STRM*) - { return make_return<long>(DD4hep::Geant4SetupAction<P>::create(*a0, *a1, *a2)); } + DD4HEP_PLUGIN_FACTORY_ARGS_3(long, dd4hep::Detector*, const _ns::GH*, const _ns::STRM*) + { return make_return<long>(dd4hep::Geant4SetupAction<P>::create(*a0, *a1, *a2)); } /// Factory to create Geant4 sensitive detectors - DD4HEP_PLUGIN_FACTORY_ARGS_2(G4VSensitiveDetector*,std::string,_ns::LCDD*) - { return DD4hep::Geant4SensitiveDetectorFactory<P>::create(a0,*a1); } + DD4HEP_PLUGIN_FACTORY_ARGS_2(G4VSensitiveDetector*,std::string,dd4hep::Detector*) + { return dd4hep::Geant4SensitiveDetectorFactory<P>::create(a0,*a1); } /// Factory to create Geant4 sensitive detectors - DD4HEP_PLUGIN_FACTORY_ARGS_4(DS::Geant4Sensitive*,_ns::CT*,std::string,_ns::DE*,_ns::LCDD*) + DD4HEP_PLUGIN_FACTORY_ARGS_4(DS::Geant4Sensitive*,_ns::CT*,std::string,dd4hep::DetElement*,dd4hep::Detector*) { return new P(a0, a1, *a2, *a3); } /// Factory to create Geant4 action objects @@ -134,8 +133,8 @@ namespace { /// Factory to create Geant4 physics constructions DD4HEP_PLUGIN_FACTORY_ARGS_2(G4VUserPhysicsList*,DS::Geant4PhysicsListActionSequence*,int) { - DD4hep::printout(DD4hep::INFO,"PhysicsList","+++ Create physics list of type:%s", - DD4hep::typeName(typeid(P)).c_str()); + dd4hep::printout(dd4hep::INFO,"PhysicsList","+++ Create physics list of type:%s", + dd4hep::typeName(typeid(P)).c_str()); return new P(a0,a1); } @@ -144,10 +143,10 @@ namespace { { return new P(a0); } } -#define __IMPLEMENT_GEANT4SENSDET(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,geant4_sd_##name) { \ +#define __IMPLEMENT_GEANT4SENSDET(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,geant4_sd_##name) { \ template <> G4VSensitiveDetector* Geant4SensitiveDetectorFactory< geant4_sd_##name >:: \ - create(const str_t& n,_ns::LCDD& l) { return func (n,l); } \ - DD4HEP_PLUGINSVC_FACTORY(geant4_sd_##name,name,G4VSensitiveDetector*(std::string,_ns::LCDD*),__LINE__) } + create(const str_t& n,dd4hep::Detector& l) { return func (n,l); } \ + DD4HEP_PLUGINSVC_FACTORY(geant4_sd_##name,name,G4VSensitiveDetector*(std::string,dd4hep::Detector*),__LINE__) } #define DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(id,func) __IMPLEMENT_GEANT4SENSDET(id,func) #define DECLARE_GEANT4SENSITIVEDETECTOR(id) __IMPLEMENT_GEANT4SENSDET(id,new id) @@ -155,14 +154,14 @@ namespace { #define DECLARE_GEANT4SENSITIVE_NS(name_space,name) using name_space::name; \ - DD4HEP_PLUGINSVC_FACTORY(name,name,DS::Geant4Sensitive*(_ns::CT*,std::string,_ns::DE*,_ns::LCDD*),__LINE__) -#define DECLARE_GEANT4SENSITIVE(name) DECLARE_GEANT4SENSITIVE_NS(DD4hep::Simulation,name) + DD4HEP_PLUGINSVC_FACTORY(name,name,DS::Geant4Sensitive*(_ns::CT*,std::string,dd4hep::DetElement*,dd4hep::Detector*),__LINE__) +#define DECLARE_GEANT4SENSITIVE(name) DECLARE_GEANT4SENSITIVE_NS(dd4hep::sim,name) /// Plugin defintion to create Geant4Action objects #define DECLARE_GEANT4ACTION_NS(name_space,name) using name_space::name; \ - DD4HEP_PLUGINSVC_FACTORY(name,name,DD4hep::Simulation::Geant4Action*(_ns::CT*,std::string),__LINE__) + DD4HEP_PLUGINSVC_FACTORY(name,name,dd4hep::sim::Geant4Action*(_ns::CT*,std::string),__LINE__) /// Plugin defintion to create Geant4Action objects -#define DECLARE_GEANT4ACTION(name) DECLARE_GEANT4ACTION_NS(DD4hep::Simulation,name) +#define DECLARE_GEANT4ACTION(name) DECLARE_GEANT4ACTION_NS(dd4hep::sim,name) /// Plugin definition to create Geant4 stepper objects #define DECLARE_GEANT4_STEPPER(name) DD4HEP_PLUGINSVC_FACTORY(G4##name,name,_ns::Stepper*(G4EquationOfMotion*),__LINE__) @@ -183,10 +182,10 @@ namespace { #define DECLARE_GEANT4_PHYSICS_LIST(name) typedef DS::Geant4UserPhysicsList< name > G4_physics_list_##name; \ DD4HEP_PLUGINSVC_FACTORY(G4_physics_list_##name,name,G4VUserPhysicsList*(DS::Geant4PhysicsListActionSequence*,int),__LINE__) /// Plugin defintion for setup actions -#define DECLARE_GEANT4_SETUP(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,xml_g4_setup_##name) { \ +#define DECLARE_GEANT4_SETUP(name,func) DD4HEP_OPEN_PLUGIN(dd4hep,xml_g4_setup_##name) { \ template <> long Geant4SetupAction< xml_g4_setup_##name >:: \ - create(_ns::LCDD& l,const _ns::GH& e, const _ns::STRM& a) {return func(l,e,a);} \ - DD4HEP_PLUGINSVC_FACTORY(xml_g4_setup_##name,name##_Geant4_action,long(_ns::LCDD*,const _ns::GH*,const _ns::STRM*),__LINE__) } + create(dd4hep::Detector& l,const _ns::GH& e, const _ns::STRM& a) {return func(l,e,a);} \ + DD4HEP_PLUGINSVC_FACTORY(xml_g4_setup_##name,name##_Geant4_action,long(dd4hep::Detector*,const _ns::GH*,const _ns::STRM*),__LINE__) } /// Plugin defintion to create event reader objects #define DECLARE_GEANT4_EVENT_READER(name) DD4HEP_PLUGINSVC_FACTORY(name,name,_ns::RDR*(std::string),__LINE__) diff --git a/DDG4/include/DDG4/Geant4Action.h b/DDG4/include/DDG4/Geant4Action.h index 30b10cb2a..4837f0ec8 100644 --- a/DDG4/include/DDG4/Geant4Action.h +++ b/DDG4/include/DDG4/Geant4Action.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -36,10 +36,10 @@ class G4UIdirectory; #include <cstdarg> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4UIMessenger; @@ -365,7 +365,7 @@ namespace DD4hep { m_properties.add(nam, val); return *this; } - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4ACTION_H diff --git a/DDG4/include/DDG4/Geant4ActionContainer.h b/DDG4/include/DDG4/Geant4ActionContainer.h index df5b1100b..9d2f6c8ab 100644 --- a/DDG4/include/DDG4/Geant4ActionContainer.h +++ b/DDG4/include/DDG4/Geant4ActionContainer.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,10 +24,10 @@ #include <typeinfo> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Context; @@ -172,6 +172,6 @@ namespace DD4hep { } }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4KERNEL_H diff --git a/DDG4/include/DDG4/Geant4ActionPhase.h b/DDG4/include/DDG4/Geant4ActionPhase.h index 8fef273d4..7d0ceb2f1 100644 --- a/DDG4/include/DDG4/Geant4ActionPhase.h +++ b/DDG4/include/DDG4/Geant4ActionPhase.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +21,10 @@ #include <vector> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Generic action for Geant4 phases /** @@ -141,7 +141,7 @@ namespace DD4hep { template <typename A0, typename A1, typename A2> void call(A0 a0, A1 a1, A2 a2); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4ACTIONPHASE_H diff --git a/DDG4/include/DDG4/Geant4AssemblyVolume.h b/DDG4/include/DDG4/Geant4AssemblyVolume.h index 1cc900184..af3f010f8 100644 --- a/DDG4/include/DDG4/Geant4AssemblyVolume.h +++ b/DDG4/include/DDG4/Geant4AssemblyVolume.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,10 +26,10 @@ #endif /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Hack! Wrapper around G4AssemblyVolume to access protected members. /** diff --git a/DDG4/include/DDG4/Geant4Call.h b/DDG4/include/DDG4/Geant4Call.h index e0f74e50f..1e6dee069 100644 --- a/DDG4/include/DDG4/Geant4Call.h +++ b/DDG4/include/DDG4/Geant4Call.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,10 +15,10 @@ #define DD4HEP_DDG4_GEANT4CALL_H /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Callback interface class with argument /** @@ -34,6 +34,6 @@ namespace DD4hep { virtual void operator()(void* param) = 0; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4CALL_H diff --git a/DDG4/include/DDG4/Geant4Callback.h b/DDG4/include/DDG4/Geant4Callback.h index b03882f02..a605491a7 100644 --- a/DDG4/include/DDG4/Geant4Callback.h +++ b/DDG4/include/DDG4/Geant4Callback.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #ifndef DD4HEP_DDG4_GEANT4CALLBACK_H #define DD4HEP_DDG4_GEANT4CALLBACK_H -// Just forward header for DD4hep callbacks +// Just forward header for dd4hep callbacks #include "DD4hep/Callback.h" #endif // DD4HEP_DDG4_GEANT4CALLBACK_H diff --git a/DDG4/include/DDG4/Geant4Config.h b/DDG4/include/DDG4/Geant4Config.h index f53eeb254..c315cae1f 100644 --- a/DDG4/include/DDG4/Geant4Config.h +++ b/DDG4/include/DDG4/Geant4Config.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #define DDG4_GEANT4CONFIG_H /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations template <typename TYPE> class Geant4Handle; @@ -87,8 +87,8 @@ namespace DD4hep { typedef Geant4Handle<Geant4DetectorConstructionSequence> DetectorConstructionSeq; } - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #include "DDG4/Geant4Particle.h" #include "DDG4/Geant4Handle.h" @@ -107,6 +107,6 @@ namespace DD4hep { #include "DDG4/Geant4UserInitialization.h" #include "DDG4/Geant4UserParticleHandler.h" #include "DDG4/ComponentUtils.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #endif // DDG4_GEANT4CONFIG_H diff --git a/DDG4/include/DDG4/Geant4Context.h b/DDG4/include/DDG4/Geant4Context.h index f5d5bc29c..aff3d5f5c 100644 --- a/DDG4/include/DDG4/Geant4Context.h +++ b/DDG4/include/DDG4/Geant4Context.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,16 +26,14 @@ class G4VTrajectory; class G4TrackingManager; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations - namespace Geometry { - class LCDD; - class DetElement; - } + class Detector; + class DetElement; /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { class Geant4Run; class Geant4Event; @@ -86,12 +84,12 @@ namespace DD4hep { * To add an extension, which should NOT be deleted, * set 'dtor' to ObjectExtensions::_noDelete or 0. */ - void* addExtension(void* ptr, const std::type_info& info, destruct_t dtor) { + void* addExtension(void* ptr, const std::type_info& info, void (*dtor)(void*)) { return ObjectExtensions::addExtension(ptr,info,dtor); } /// Add user extension object. Ownership is transferred! template <typename T> T* addExtension(T* ptr, bool take_ownership=true) { - destruct_t dt = ObjectExtensions::_delete<T>; + void (*dt)(void*) = ObjectExtensions::_delete<T>; return (T*)ObjectExtensions::addExtension(ptr,typeid(T),take_ownership ? dt : 0); } /// Access to type safe extension object. Exception is thrown if the object is invalid @@ -144,12 +142,12 @@ namespace DD4hep { * To add an extension, which should NOT be deleted, * set 'dtor' to ObjectExtensions::_noDelete or 0. */ - void* addExtension(void* ptr, const std::type_info& info, destruct_t dtor) { + void* addExtension(void* ptr, const std::type_info& info, void (*dtor)(void*)) { return ObjectExtensions::addExtension(ptr,info,dtor); } /// Add user extension object. Ownership is transferred and object deleted at the end of the event. template <typename T> T* addExtension(T* ptr, bool take_ownership=true) { - destruct_t dt = ObjectExtensions::_delete<T>; + void (*dt)(void*) = ObjectExtensions::_delete<T>; return (T*)ObjectExtensions::addExtension(ptr,typeid(T),take_ownership ? dt : 0); } /// Access to type safe extension object. Exception is thrown if the object is invalid @@ -166,12 +164,6 @@ namespace DD4hep { */ class Geant4Context { friend class Geant4Kernel; - public: -#ifdef R__DICTIONARY_FILENAME - /// ROOT does not know how to process the nested ns otherwise - public: - typedef Geometry::LCDD LCDD; -#endif protected: Geant4Kernel* m_kernel; Geant4Run* m_run; @@ -196,7 +188,7 @@ namespace DD4hep { /// Access to the kernel object Geant4Kernel& kernel() const { return *m_kernel; } /// Access to detector description - Geometry::LCDD& lcdd() const; + Detector& detectorDescription() const; /// Access the tracking manager G4TrackingManager* trackMgr() const; /// Create a user trajectory @@ -217,7 +209,7 @@ namespace DD4hep { Geant4SensDetSequences& sensitiveActions() const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4CONTEXT_H diff --git a/DDG4/include/DDG4/Geant4Converter.h b/DDG4/include/DDG4/Geant4Converter.h index d1729afd6..938b63def 100644 --- a/DDG4/include/DDG4/Geant4Converter.h +++ b/DDG4/include/DDG4/Geant4Converter.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,18 +18,18 @@ #include "DDG4/Geant4Mapping.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { - /// Geometry converter from DD4hep to Geant 4. + /// Geometry converter from dd4hep to Geant 4. /** * \author M.Frank * \version 1.0 * \ingroup DD4HEP_SIMULATION */ - class Geant4Converter : public Geometry::GeoHandler, public Geant4Mapping { + class Geant4Converter : public detail::GeoHandler, public Geant4Mapping { public: /// Property: Flag to debug materials during conversion mechanism bool debugMaterials = false; @@ -55,10 +55,10 @@ namespace DD4hep { PrintLevel outputLevel; /// Initializing Constructor - Geant4Converter(LCDD& lcdd); + Geant4Converter(Detector& description); /// Initializing Constructor - Geant4Converter(LCDD& lcdd, PrintLevel level); + Geant4Converter(Detector& description, PrintLevel level); /// Standard destructor virtual ~Geant4Converter(); @@ -96,7 +96,7 @@ namespace DD4hep { virtual void* handleLimitSet(LimitSet limitset, const std::set<const TGeoVolume*>& volumes) const; /// Handle the geant 4 specific properties - void handleProperties(LCDD::Properties& prp) const; + void handleProperties(Detector::Properties& prp) const; /// Print the geometry type SensitiveDetector virtual void printSensitive(SensitiveDetector sens_det, const std::set<const TGeoVolume*>& volumes) const; @@ -104,7 +104,7 @@ namespace DD4hep { /// Print Geant4 placement virtual void* printPlacement(const std::string& name, const TGeoNode* node) const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4CONVERTER_H diff --git a/DDG4/include/DDG4/Geant4Data.h b/DDG4/include/DDG4/Geant4Data.h index be296a579..2eb355f89 100644 --- a/DDG4/include/DDG4/Geant4Data.h +++ b/DDG4/include/DDG4/Geant4Data.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,10 +28,10 @@ class G4Step; class G4StepPoint; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward type definitions typedef ROOT::Math::XYZVector Position; @@ -293,6 +293,6 @@ namespace DD4hep { typedef Geant4Tracker SimpleTracker; typedef Geant4Calorimeter SimpleCalorimeter; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4DATA_H diff --git a/DDG4/include/DDG4/Geant4DataConversion.h b/DDG4/include/DDG4/Geant4DataConversion.h index 3daa1a515..4d683466e 100644 --- a/DDG4/include/DDG4/Geant4DataConversion.h +++ b/DDG4/include/DDG4/Geant4DataConversion.h @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,14 +16,14 @@ // Framework include files #include "DD4hep/VolumeManager.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include <typeinfo> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Helper class for data conversion /** @@ -39,11 +38,11 @@ namespace DD4hep { /// Default destructor virtual ~Geant4ConversionHelper(); /// Access to the data encoding using the volume manager and a specified volume id - static std::string encoding(Geometry::VolumeManager vm, Geometry::VolumeManager::VolumeID vid); + static std::string encoding(VolumeManager vm, VolumeID vid); /// Access to the hit encoding in this sensitive detector - static std::string encoding(Geometry::Handle<Geometry::SensitiveDetectorObject> sd); + static std::string encoding(Handle<SensitiveDetectorObject> sd); /// Access to the hit encoding in this readout object - static std::string encoding(Geometry::Readout ro); + static std::string encoding(Readout ro); }; /// Data conversion class @@ -58,7 +57,7 @@ namespace DD4hep { typedef OUTPUT output_t; typedef Geant4Conversion<output_t, arg_t> self_t; typedef std::map<const std::type_info*, Geant4Conversion*> Converters; - static Converters& conversions(); + static Converters& conversions(); static const Geant4Conversion& converter(const std::type_info& typ); /// Default constructor Geant4Conversion(); @@ -66,21 +65,21 @@ namespace DD4hep { virtual ~Geant4Conversion(); virtual OUTPUT* operator()(const ARGS& args) const = 0; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #if defined(DDG4_MAKE_INSTANTIATIONS) #include <stdexcept> /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { /* * Simulation namespace declaration */ - namespace Simulation { + namespace sim { template <typename OUTPUT,typename ARGS> Geant4Conversion<OUTPUT,ARGS>::Geant4Conversion() @@ -136,12 +135,12 @@ namespace DD4hep { virtual OUTPUT* operator()(const ARGS& args) const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #define GEANT4_CNAME(a,b) a ## _instance_ ## b #define DECLARE_GEANT4_DATACONVERTER(output_type,args_type,tag,serial) \ - DD4hep::Simulation::Geant4DataConversion<output_type,args_type,tag> GEANT4_CNAME(s_g4_data_cnv,serial) (0); + dd4hep::sim::Geant4DataConversion<output_type,args_type,tag> GEANT4_CNAME(s_g4_data_cnv,serial) (0); #define DECLARE_GEANT4_HITCONVERTER(output_type,args_type,tag) DECLARE_GEANT4_DATACONVERTER(output_type,args_type,tag,__LINE__) diff --git a/DDG4/include/DDG4/Geant4DataDump.h b/DDG4/include/DDG4/Geant4DataDump.h index fb5b61bc7..d561ad280 100644 --- a/DDG4/include/DDG4/Geant4DataDump.h +++ b/DDG4/include/DDG4/Geant4DataDump.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,10 +23,10 @@ #include <vector> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Class to dump the records of the intrinsic Geant4 event model. /** @@ -77,7 +77,7 @@ namespace DD4hep { void print(PrintLevel level, const std::string& container, const CalorimeterHits* hits) const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4DATADUMP_H */ diff --git a/DDG4/include/DDG4/Geant4DetectorConstruction.h b/DDG4/include/DDG4/Geant4DetectorConstruction.h index ff202dd86..ee6d74889 100644 --- a/DDG4/include/DDG4/Geant4DetectorConstruction.h +++ b/DDG4/include/DDG4/Geant4DetectorConstruction.h @@ -1,6 +1,5 @@ -// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -29,15 +28,13 @@ class G4LogicalVolume; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations - namespace Geometry { - class LCDD; - } + class Detector; /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Kernel; @@ -62,9 +59,9 @@ namespace DD4hep { public: /// Reference to geometry object #ifdef __CINT__ - Geometry::LCDD* lcdd; + Detector* description; #else - Geometry::LCDD& lcdd; + Detector& description; #endif /// Reference to the world after construction G4VPhysicalVolume* world; @@ -73,9 +70,8 @@ namespace DD4hep { /// G4 User detector initializer G4VUserDetectorConstruction* detector; /// Initializing Constructor - Geant4DetectorConstructionContext(Geometry::LCDD& l, - G4VUserDetectorConstruction* d) - : lcdd(l), world(0), geometry(0), detector(d) { } + Geant4DetectorConstructionContext(Detector& l,G4VUserDetectorConstruction* d) + : description(l), world(0), geometry(0), detector(d) { } /// Default destructor ~Geant4DetectorConstructionContext() { } /// Helper: Assign sensitive detector to logical volume @@ -155,28 +151,28 @@ namespace DD4hep { //@{ Accessor to the various geant4 maps after construction /// Access to the converted materials - const Geant4GeometryMaps::MaterialMap& materials() const; + const std::map<Material, G4Material*>& materials() const; /// Access to the converted elements - const Geant4GeometryMaps::ElementMap& elements() const; + const std::map<Atom, G4Element*>& elements() const; /// Access to the converted shapes - const Geant4GeometryMaps::SolidMap& shapes() const; + const std::map<const TGeoShape*, G4VSolid*>& shapes() const; /// Access to the converted volumes - const Geant4GeometryMaps::VolumeMap& volumes() const; + const std::map<Volume, G4LogicalVolume*>& volumes() const; /// Access to the converted placements - const Geant4GeometryMaps::PlacementMap& placements() const; + const std::map<PlacedVolume, G4VPhysicalVolume*>& placements() const; /// Access to the converted assemblys - const Geant4GeometryMaps::AssemblyMap& assemblies() const; + const std::map<PlacedVolume, Geant4AssemblyVolume*>& assemblies() const; /// Access to the converted limit sets - const Geant4GeometryMaps::LimitMap& limits() const; + const std::map<LimitSet, G4UserLimits*>& limits() const; /// Access to the converted regions - const Geant4GeometryMaps::RegionMap& regions() const; + const std::map<Region, G4Region*>& regions() const; #endif //@} }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4DETECTORCONSTRUCTION_H diff --git a/DDG4/include/DDG4/Geant4EventAction.h b/DDG4/include/DDG4/Geant4EventAction.h index ba1aec3ae..7027fc285 100644 --- a/DDG4/include/DDG4/Geant4EventAction.h +++ b/DDG4/include/DDG4/Geant4EventAction.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +21,10 @@ class G4Event; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4EventAction; @@ -183,7 +183,6 @@ namespace DD4hep { virtual void end(const G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep - + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4EVENTACTION_H diff --git a/DDG4/include/DDG4/Geant4EventSeed.h b/DDG4/include/DDG4/Geant4EventSeed.h index c682920a3..692198969 100644 --- a/DDG4/include/DDG4/Geant4EventSeed.h +++ b/DDG4/include/DDG4/Geant4EventSeed.h @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +17,10 @@ #include "DDG4/Geant4RunAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /** * \addtogroup Geant4RunActions @@ -199,7 +198,7 @@ namespace DD4hep { return seed; } - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4EVENTSEED_H diff --git a/DDG4/include/DDG4/Geant4Field.h b/DDG4/include/DDG4/Geant4Field.h index ebced70ee..4973421a1 100644 --- a/DDG4/include/DDG4/Geant4Field.h +++ b/DDG4/include/DDG4/Geant4Field.h @@ -1,6 +1,5 @@ -// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,22 +15,22 @@ #define DD4HEP_DDG4_GEANT4FIELD_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // Geant 4 include files #include "G4ElectroMagneticField.hh" #include "G4MagneticField.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Field; - /// Mediator class to allow Geant4 accessing magnetic fields defined in DD4hep + /// Mediator class to allow Geant4 accessing magnetic fields defined in dd4hep /** * \author M.Frank * \version 1.0 @@ -40,22 +39,19 @@ namespace DD4hep { class Geant4Field : public G4MagneticField { protected: /// Reference to the detector description field - Geometry::OverlayedField m_field; + OverlayedField m_field; public: /// Constructor. The sensitive detector element is identified by the detector name - Geant4Field(Geometry::OverlayedField field) - : m_field(field) { - } + Geant4Field(OverlayedField field) : m_field(field) { } /// Standard destructor - virtual ~Geant4Field() { - } + virtual ~Geant4Field() { } /// Access field values at a given point virtual void GetFieldValue(const double pos[4], double *arr) const; /// Does field change energy ? virtual G4bool DoesFieldChangeEnergy() const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4FIELD_H diff --git a/DDG4/include/DDG4/Geant4GDMLDetector.h b/DDG4/include/DDG4/Geant4GDMLDetector.h index 15426f2ee..c669aaf32 100644 --- a/DDG4/include/DDG4/Geant4GDMLDetector.h +++ b/DDG4/include/DDG4/Geant4GDMLDetector.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Class to read Geant4 geometry from GDML file /** diff --git a/DDG4/include/DDG4/Geant4GeneratorAction.h b/DDG4/include/DDG4/Geant4GeneratorAction.h index 1da6ea268..20e0fcdeb 100644 --- a/DDG4/include/DDG4/Geant4GeneratorAction.h +++ b/DDG4/include/DDG4/Geant4GeneratorAction.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +21,10 @@ class G4Event; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4GeneratorAction; @@ -141,7 +141,7 @@ namespace DD4hep { virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4GENERATORACTION_H diff --git a/DDG4/include/DDG4/Geant4GeneratorActionInit.h b/DDG4/include/DDG4/Geant4GeneratorActionInit.h index ac9b4c2c5..ff83fef32 100644 --- a/DDG4/include/DDG4/Geant4GeneratorActionInit.h +++ b/DDG4/include/DDG4/Geant4GeneratorActionInit.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,10 +23,10 @@ class G4Event; class G4Run; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Initialize the Geant4Event objects to host generator and MC truth related information /** Geant4 actions to collect the MC particle information. @@ -73,7 +73,7 @@ namespace DD4hep { void end(const G4Run* run); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4GENERATORACTIONINIT_H diff --git a/DDG4/include/DDG4/Geant4GeneratorWrapper.h b/DDG4/include/DDG4/Geant4GeneratorWrapper.h index c79655f1e..f6495f3a5 100644 --- a/DDG4/include/DDG4/Geant4GeneratorWrapper.h +++ b/DDG4/include/DDG4/Geant4GeneratorWrapper.h @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,10 +22,10 @@ class G4VPrimaryGenerator; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Geant4Action to merge several independent interaction to one /** Wrap native G4 particle ganerators like the generic particle source etc. @@ -54,7 +54,7 @@ namespace DD4hep { /// Event generation action callback virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4GENERATORWRAPPER_H diff --git a/DDG4/include/DDG4/Geant4GeometryInfo.h b/DDG4/include/DDG4/Geant4GeometryInfo.h index 3b66db96c..477e5fb0a 100644 --- a/DDG4/include/DDG4/Geant4GeometryInfo.h +++ b/DDG4/include/DDG4/Geant4GeometryInfo.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -43,10 +43,10 @@ class G4AssemblyVolume; class G4VSensitiveDetector; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Mapping; @@ -59,37 +59,22 @@ namespace DD4hep { * \ingroup DD4HEP_SIMULATION */ namespace Geant4GeometryMaps { - using Geometry::Atom; - using Geometry::Material; - using Geometry::VisAttr; - using Geometry::Volume; - using Geometry::PlacedVolume; - using Geometry::Region; - using Geometry::LimitSet; - using Geometry::SensitiveDetector; + //typedef std::vector<const G4VPhysicalVolume*> Geant4PlacementPath; + typedef std::map<Atom, G4Element*> ElementMap; + typedef std::map<Material, G4Material*> MaterialMap; + //typedef std::map<LimitSet, G4UserLimits*> LimitMap; + typedef std::map<PlacedVolume, G4VPhysicalVolume*> PlacementMap; + //typedef std::map<Region, G4Region*> RegionMap; + typedef std::map<Volume, G4LogicalVolume*> VolumeMap; + typedef std::map<PlacedVolume, Geant4AssemblyVolume*> AssemblyMap; - typedef std::vector<const G4VPhysicalVolume*> Geant4PlacementPath; - typedef std::map<Atom, G4Element*> ElementMap; - typedef std::map<Material, G4Material*> MaterialMap; - typedef std::map<LimitSet, G4UserLimits*> LimitMap; - typedef std::map<PlacedVolume, G4VPhysicalVolume*> PlacementMap; - typedef std::map<Region, G4Region*> RegionMap; - typedef std::map<Volume, G4LogicalVolume*> VolumeMap; - typedef std::map<PlacedVolume, Geant4AssemblyVolume*> AssemblyMap; - - typedef std::vector<const TGeoNode*> VolumeChain; + typedef std::vector<const TGeoNode*> VolumeChain; typedef std::pair<VolumeChain,const G4VPhysicalVolume*> ImprintEntry; - typedef std::vector<ImprintEntry> Imprints; - typedef std::map<Volume,Imprints> VolumeImprintMap; - typedef std::map<const TGeoShape*, G4VSolid*> SolidMap; - typedef std::map<VisAttr, G4VisAttributes*> VisMap; - typedef std::map<Geant4PlacementPath, VolumeID> Geant4PathMap; - - typedef Geometry::GeoHandlerTypes::SensitiveVolumes SensitiveVolumes; - typedef Geometry::GeoHandlerTypes::RegionVolumes RegionVolumes; - typedef Geometry::GeoHandlerTypes::LimitVolumes LimitVolumes; - /// Assemble Geant4 volume path - std::string placementPath(const Geant4PlacementPath& path, bool reverse=true); + typedef std::vector<ImprintEntry> Imprints; + typedef std::map<Volume,Imprints> VolumeImprintMap; + typedef std::map<const TGeoShape*, G4VSolid*> SolidMap; + //typedef std::map<VisAttr, G4VisAttributes*> VisMap; + //typedef std::map<Geant4PlacementPath, VolumeID> Geant4PathMap; } /// Concreate class holding the relation information between geant4 objects and dd4hep objects. @@ -98,23 +83,24 @@ namespace DD4hep { * \version 1.0 * \ingroup DD4HEP_SIMULATION */ - class Geant4GeometryInfo : public TNamed, public Geometry::GeoHandlerTypes::GeometryInfo { + class Geant4GeometryInfo : public TNamed, public detail::GeoHandlerTypes::GeometryInfo { public: - Geant4GeometryMaps::ElementMap g4Elements; - Geant4GeometryMaps::MaterialMap g4Materials; - Geant4GeometryMaps::SolidMap g4Solids; - Geant4GeometryMaps::VolumeMap g4Volumes; - Geant4GeometryMaps::PlacementMap g4Placements; - Geant4GeometryMaps::AssemblyMap g4AssemblyVolumes; + typedef std::vector<const G4VPhysicalVolume*> Geant4PlacementPath; + Geant4GeometryMaps::ElementMap g4Elements; + Geant4GeometryMaps::MaterialMap g4Materials; + Geant4GeometryMaps::SolidMap g4Solids; + Geant4GeometryMaps::VolumeMap g4Volumes; + Geant4GeometryMaps::PlacementMap g4Placements; + Geant4GeometryMaps::AssemblyMap g4AssemblyVolumes; Geant4GeometryMaps::VolumeImprintMap g4VolumeImprints; - Geant4GeometryMaps::RegionMap g4Regions; - Geant4GeometryMaps::VisMap g4Vis; - Geant4GeometryMaps::LimitMap g4Limits; - Geant4GeometryMaps::Geant4PathMap g4Paths; - Geant4GeometryMaps::SensitiveVolumes sensitives; - Geant4GeometryMaps::RegionVolumes regions; - Geant4GeometryMaps::LimitVolumes limits; - G4VPhysicalVolume* m_world; + std::map<Region, G4Region*> g4Regions; + std::map<VisAttr, G4VisAttributes*> g4Vis; + std::map<LimitSet, G4UserLimits*> g4Limits; + std::map<Geant4PlacementPath, VolumeID> g4Paths; + std::map<SensitiveDetector,std::set<const TGeoVolume*> > sensitives; + std::map<Region, std::set<const TGeoVolume*> > regions; + std::map<LimitSet, std::set<const TGeoVolume*> > limits; + G4VPhysicalVolume* m_world; bool valid; private: friend class Geant4Mapping; @@ -127,9 +113,11 @@ namespace DD4hep { G4VPhysicalVolume* world() const; /// Set the world volume void setWorld(const TGeoNode* node); + /// Assemble Geant4 volume path + static std::string placementPath(const Geant4PlacementPath& path, bool reverse=true); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4GEOMETRYINFO_H diff --git a/DDG4/include/DDG4/Geant4Handle.h b/DDG4/include/DDG4/Geant4Handle.h index e7790aad5..25ebd47ab 100644 --- a/DDG4/include/DDG4/Geant4Handle.h +++ b/DDG4/include/DDG4/Geant4Handle.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,17 +16,17 @@ // Framework include files #include "DD4hep/ComponentProperties.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // C/C++ include files #include <string> #include <memory> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Forward declarations class Geant4Kernel; @@ -41,17 +41,17 @@ namespace DD4hep { template <typename TYPE> class Geant4Handle { protected: void checked_assign(TYPE* p); + TYPE* null() { return 0; } public: - typedef TYPE handled_type; /// Pointer to referenced object - mutable handled_type* value = 0; + mutable TYPE* value = 0; /// Default constructor explicit Geant4Handle() = default; /// Construction initialized with object pointer - Geant4Handle(handled_type* typ); + Geant4Handle(TYPE* typ); /// Cross type initialization template <typename T> Geant4Handle(T* typ) : value(0) { - checked_assign(dynamic_cast<handled_type*>(typ)); + checked_assign(dynamic_cast<TYPE*>(typ)); } /// Copy constructor Geant4Handle(const Geant4Handle& handle); @@ -72,19 +72,19 @@ namespace DD4hep { /// Move assignment operator Geant4Handle& operator=(Geant4Handle&& handle); /// Assignment operator - Geant4Handle& operator=(handled_type* ptr); + Geant4Handle& operator=(TYPE* ptr); /// Validity check bool operator!() const; /// Access to the underlying object Geant4Action* action() const; /// Access to the underlying object - handled_type* operator->() const; + TYPE* operator->() const; /// Conversion operator - operator handled_type*() const; + operator TYPE*() const; /// Access to the underlying object - handled_type* get() const; + TYPE* get() const; /// Release the underlying object - handled_type* release(); + TYPE* release(); }; /// Handle to Geant4 actions with built-in creation mechanism @@ -95,9 +95,8 @@ namespace DD4hep { */ class KernelHandle { public: - typedef Geant4Kernel handled_type; /// Pointer to referenced object - mutable handled_type* value; + mutable Geant4Kernel* value; /// Default constructor explicit KernelHandle(); /// Construction initialized with object pointer @@ -107,18 +106,18 @@ namespace DD4hep { /// Default destructor ~KernelHandle() { } /// Conversion operator - operator handled_type*() const { return value; } + operator Geant4Kernel*() const { return value; } /// Access to the underlying object - handled_type* get() const { return value; } + Geant4Kernel* get() const { return value; } /// Access to the underlying object - handled_type* operator->() const { return value; } + Geant4Kernel* operator->() const { return value; } /// Access to worker thread KernelHandle worker(); /// Destroy referenced object (program termination) void destroy(); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4SETUP_H diff --git a/DDG4/include/DDG4/Geant4HierarchyDump.h b/DDG4/include/DDG4/Geant4HierarchyDump.h index dac42d0df..eda45cae0 100644 --- a/DDG4/include/DDG4/Geant4HierarchyDump.h +++ b/DDG4/include/DDG4/Geant4HierarchyDump.h @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -11,7 +10,6 @@ // Author : M.Frank // //========================================================================== - #ifndef DD4HEP_DDG4_GEANT4HIERARCHYDUMP_H #define DD4HEP_DDG4_GEANT4HIERARCHYDUMP_H @@ -19,15 +17,13 @@ #include "G4VPhysicalVolume.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations - namespace Geometry { - class LCDD; - } + class Detector; /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Helper to dump Geant4 volume hierarchy /** @@ -37,12 +33,11 @@ namespace DD4hep { */ class Geant4HierarchyDump { public: - typedef Geometry::LCDD LCDD; - LCDD& m_lcdd; + Detector& m_detDesc; public: /// Initializing Constructor - Geant4HierarchyDump(LCDD& lcdd); + Geant4HierarchyDump(Detector& description); /// Standard destructor virtual ~Geant4HierarchyDump(); /// Dump the volume hierarchy as it is known to geant 4 diff --git a/DDG4/include/DDG4/Geant4HitCollection.h b/DDG4/include/DDG4/Geant4HitCollection.h index e026b45bf..6e531f413 100644 --- a/DDG4/include/DDG4/Geant4HitCollection.h +++ b/DDG4/include/DDG4/Geant4HitCollection.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,10 +28,10 @@ #include <stdexcept> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Sensitive; @@ -428,7 +428,7 @@ namespace DD4hep { return 0; } - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4HITCOLLECTION_H diff --git a/DDG4/include/DDG4/Geant4Hits.h b/DDG4/include/DDG4/Geant4Hits.h index 176e391c3..d5176a12b 100644 --- a/DDG4/include/DDG4/Geant4Hits.h +++ b/DDG4/include/DDG4/Geant4Hits.h @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,10 +25,10 @@ #include "G4StepPoint.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations; class Geant4Hit; @@ -195,7 +195,7 @@ namespace DD4hep { void operator delete(void *ptr); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4HITS_H diff --git a/DDG4/include/DDG4/Geant4InputAction.h b/DDG4/include/DDG4/Geant4InputAction.h index cd0c27624..7b0c50a3c 100644 --- a/DDG4/include/DDG4/Geant4InputAction.h +++ b/DDG4/include/DDG4/Geant4InputAction.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,10 +28,10 @@ class G4Event; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Basic geant4 event reader class. This interface/base-class must be implemented by concrete readers. /** @@ -76,7 +76,7 @@ namespace DD4hep { T& parameter, T defaultValue ) { if( parameters.find( parameterName ) != parameters.end() ) { - DD4hep::Parsers::parse( parameter, parameters.at( parameterName ) ); + dd4hep::Parsers::parse( parameter, parameters.at( parameterName ) ); parameters.erase( parameterName ); } else { parameter = defaultValue; @@ -171,6 +171,6 @@ namespace DD4hep { /// Callback to generate primary particles virtual void operator()(G4Event* event); }; - } /* End namespace Simulation */ -} /* End namespace DD4hep */ + } /* End namespace sim */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDG4_GEANT4INPUTACTION_H */ diff --git a/DDG4/include/DDG4/Geant4InputHandling.h b/DDG4/include/DDG4/Geant4InputHandling.h index 44bbd3ac3..c41906d20 100644 --- a/DDG4/include/DDG4/Geant4InputHandling.h +++ b/DDG4/include/DDG4/Geant4InputHandling.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,10 +25,10 @@ class G4PrimaryParticle; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Action; @@ -67,6 +67,6 @@ namespace DD4hep { const Geant4Context* context, G4Event* event); - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4INPUTHANDLING_H */ diff --git a/DDG4/include/DDG4/Geant4InteractionMerger.h b/DDG4/include/DDG4/Geant4InteractionMerger.h index 260b37963..59e50a8a9 100644 --- a/DDG4/include/DDG4/Geant4InteractionMerger.h +++ b/DDG4/include/DDG4/Geant4InteractionMerger.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,10 +17,10 @@ #include "DDG4/Geant4GeneratorAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4PrimaryInteraction; @@ -46,7 +46,7 @@ namespace DD4hep { /// Event generation action callback virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4INTERACTIONMERGER_H diff --git a/DDG4/include/DDG4/Geant4InteractionVertexBoost.h b/DDG4/include/DDG4/Geant4InteractionVertexBoost.h index 05265a2f4..c38a80998 100644 --- a/DDG4/include/DDG4/Geant4InteractionVertexBoost.h +++ b/DDG4/include/DDG4/Geant4InteractionVertexBoost.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "DDG4/Geant4GeneratorAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Action class to boost the primary vertex (and all outgoing particles) of a single interaction /** @@ -56,6 +56,6 @@ namespace DD4hep { /// Callback to generate primary particles virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4INTERACTIONVERTEXBOOST_H */ diff --git a/DDG4/include/DDG4/Geant4InteractionVertexSmear.h b/DDG4/include/DDG4/Geant4InteractionVertexSmear.h index 75a3a21a9..1382cb140 100644 --- a/DDG4/include/DDG4/Geant4InteractionVertexSmear.h +++ b/DDG4/include/DDG4/Geant4InteractionVertexSmear.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ #include "Math/Vector4D.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Forward declarations class Geant4PrimaryInteraction; @@ -66,6 +66,6 @@ namespace DD4hep { /// Callback to generate primary particles virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4INTERACTIONVERTEXSMEAR_H */ diff --git a/DDG4/include/DDG4/Geant4IsotropeGenerator.h b/DDG4/include/DDG4/Geant4IsotropeGenerator.h index 9ab7dd652..84f25069e 100644 --- a/DDG4/include/DDG4/Geant4IsotropeGenerator.h +++ b/DDG4/include/DDG4/Geant4IsotropeGenerator.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "DDG4/Geant4ParticleGenerator.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Generate particles isotrop in space around origine (0,0,0) /** * \author M.Frank @@ -65,6 +65,6 @@ namespace DD4hep { /// Default destructor virtual ~Geant4IsotropeGenerator(); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4ISOTROPEGENERATOR_H */ diff --git a/DDG4/include/DDG4/Geant4Kernel.h b/DDG4/include/DDG4/Geant4Kernel.h index 9c6746af7..fc488f8c1 100644 --- a/DDG4/include/DDG4/Geant4Kernel.h +++ b/DDG4/include/DDG4/Geant4Kernel.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,10 +25,10 @@ class G4RunManager; class G4UIdirectory; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4ActionPhase; @@ -41,11 +41,10 @@ namespace DD4hep { */ class Geant4Kernel : public Geant4ActionContainer { public: - typedef DD4hep::Geometry::LCDD LCDD; - typedef std::map<unsigned long, Geant4Kernel*> Workers; + typedef std::map<unsigned long, Geant4Kernel*> Workers; typedef std::map<std::string, Geant4ActionPhase*> Phases; - typedef std::map<std::string, Geant4Action*> GlobalActions; - typedef std::map<std::string,int> ClientOutputLevels; + typedef std::map<std::string, Geant4Action*> GlobalActions; + typedef std::map<std::string,int> ClientOutputLevels; protected: /// Reference to the run manager @@ -55,7 +54,7 @@ namespace DD4hep { /// Reference to Geant4 track manager G4TrackingManager* m_trackMgr; /// Detector description object - LCDD* m_lcdd; + Detector* m_detDesc; /// Property pool PropertyManager m_properties; @@ -100,7 +99,7 @@ namespace DD4hep { public: /// Standard constructor for the master instance - Geant4Kernel(LCDD& lcdd); + Geant4Kernel(Detector& description); /// Thread's master context Geant4Kernel& master() const { return *m_master; } @@ -144,12 +143,12 @@ namespace DD4hep { #ifndef __CINT__ /// Instance accessor - static Geant4Kernel& instance(LCDD& lcdd); + static Geant4Kernel& instance(Detector& description); #endif /// Access phase phases const Phases& phases() const { return m_phases; } /// Access to detector description - LCDD& lcdd() const { return *m_lcdd; } + Detector& detectorDescription() const { return *m_detDesc; } /// Access the tracking manager G4TrackingManager* trackMgr() const { return m_trackMgr; } /// Access the tracking manager @@ -233,7 +232,7 @@ namespace DD4hep { /// Execute phase action if it exists virtual bool executePhase(const std::string& name, const void** args) const; - /// Construct detector geometry using lcdd plugin + /// Construct detector geometry using description plugin virtual void loadGeometry(const std::string& compact_file); /// Load XML file virtual void loadXML(const char* fname); @@ -282,6 +281,6 @@ namespace DD4hep { static int terminate(Geant4Kernel& kernel); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4KERNEL_H diff --git a/DDG4/include/DDG4/Geant4Mapping.h b/DDG4/include/DDG4/Geant4Mapping.h index ad7049d14..4d5eed2e8 100644 --- a/DDG4/include/DDG4/Geant4Mapping.h +++ b/DDG4/include/DDG4/Geant4Mapping.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,51 +10,38 @@ // Author : M.Frank // //========================================================================== - #ifndef DD4HEP_DDG4_GEANT4MAPPING_H #define DD4HEP_DDG4_GEANT4MAPPING_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" +#include "DD4hep/Volumes.h" #include "DD4hep/GeoHandler.h" #include "DDG4/Geant4GeometryInfo.h" #include "DDG4/Geant4VolumeManager.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { - /// Geometry mapping from DD4hep to Geant 4. + /// Geometry mapping from dd4hep to Geant 4. /** * \author M.Frank * \version 1.0 * \ingroup DD4HEP_SIMULATION */ - class Geant4Mapping: public Geometry::GeoHandlerTypes { - public: - typedef Geometry::LCDD LCDD; - typedef Geometry::DetElement DetElement; - typedef Geometry::SensitiveDetector SensitiveDetector; - typedef Geometry::Solid Solid; - typedef Geometry::Volume Volume; - typedef Geometry::PlacedVolume PlacedVolume; - typedef Geometry::Atom Atom; - typedef Geometry::Material Material; - typedef Geometry::Region Region; - typedef Geometry::VisAttr VisAttr; - typedef Geometry::LimitSet LimitSet; - + class Geant4Mapping: public detail::GeoHandlerTypes { protected: - LCDD& m_lcdd; + Detector& m_detDesc; Geant4GeometryInfo* m_dataPtr; /// When resolving pointers, we must check for the validity of the data block void checkValidity() const; public: /// Initializing Constructor - Geant4Mapping(LCDD& lcdd); + Geant4Mapping(Detector& description); /// Standard destructor virtual ~Geant4Mapping(); @@ -62,9 +49,9 @@ namespace DD4hep { /// Possibility to define a singleton instance static Geant4Mapping& instance(); - /// Accesor to the LCDD instance - LCDD& lcdd() const { - return m_lcdd; + /// Accesor to the Detector instance + Detector& detectorDescription() const { + return m_detDesc; } /// Access to the data pointer @@ -92,7 +79,7 @@ namespace DD4hep { /// Accessor to resolve geometry placements PlacedVolume placement(const G4VPhysicalVolume* node) const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4MAPPING_H diff --git a/DDG4/include/DDG4/Geant4MonteCarloTruth.h b/DDG4/include/DDG4/Geant4MonteCarloTruth.h index 0d297c334..248e16fb3 100644 --- a/DDG4/include/DDG4/Geant4MonteCarloTruth.h +++ b/DDG4/include/DDG4/Geant4MonteCarloTruth.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,10 +27,10 @@ class G4Track; class G4Event; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Particle; @@ -80,7 +80,7 @@ namespace DD4hep { virtual void mark(const G4Step* step, int reason); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4MONTECARLOTRUTH_H diff --git a/DDG4/include/DDG4/Geant4Output2ROOT.h b/DDG4/include/DDG4/Geant4Output2ROOT.h index cba8bc437..9be1e1c98 100644 --- a/DDG4/include/DDG4/Geant4Output2ROOT.h +++ b/DDG4/include/DDG4/Geant4Output2ROOT.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,12 +22,12 @@ class TTree; class TBranch; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { class ComponentCast; /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Class to output Geant4 event data to ROOT files /** @@ -72,6 +72,6 @@ namespace DD4hep { virtual void commit(OutputContext<G4Event>& ctxt); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4OUTPUT2ROOT_H diff --git a/DDG4/include/DDG4/Geant4OutputAction.h b/DDG4/include/DDG4/Geant4OutputAction.h index 3e664dfca..14a553081 100644 --- a/DDG4/include/DDG4/Geant4OutputAction.h +++ b/DDG4/include/DDG4/Geant4OutputAction.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,10 +23,10 @@ class G4VHitsCollection; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4ParticleMap; @@ -89,6 +89,6 @@ namespace DD4hep { virtual void commit(OutputContext<G4Event>& ctxt); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4OUTPUTACTION_H diff --git a/DDG4/include/DDG4/Geant4Particle.h b/DDG4/include/DDG4/Geant4Particle.h index eb9d30d8a..fe5aaef96 100644 --- a/DDG4/include/DDG4/Geant4Particle.h +++ b/DDG4/include/DDG4/Geant4Particle.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -29,10 +29,10 @@ class G4VProcess; #include <map> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Particle; @@ -337,6 +337,6 @@ namespace DD4hep { }; #endif - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4PARTICLE_H diff --git a/DDG4/include/DDG4/Geant4ParticleGenerator.h b/DDG4/include/DDG4/Geant4ParticleGenerator.h index 62c6703f6..6099e9f66 100644 --- a/DDG4/include/DDG4/Geant4ParticleGenerator.h +++ b/DDG4/include/DDG4/Geant4ParticleGenerator.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,10 +22,10 @@ class G4ParticleDefinition; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4PrimaryInteraction; @@ -80,6 +80,6 @@ namespace DD4hep { /// Callback to generate primary particles virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4PARTICLEGENERATOR_H */ diff --git a/DDG4/include/DDG4/Geant4ParticleGun.h b/DDG4/include/DDG4/Geant4ParticleGun.h index 943cd3db5..5f2f62139 100644 --- a/DDG4/include/DDG4/Geant4ParticleGun.h +++ b/DDG4/include/DDG4/Geant4ParticleGun.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DDG4/Geant4IsotropeGenerator.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Implementation of a particle gun using Geant4Particles. /** @@ -68,6 +68,6 @@ namespace DD4hep { /// Callback to generate primary particles virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4PARTICLEGUN_H */ diff --git a/DDG4/include/DDG4/Geant4ParticleHandler.h b/DDG4/include/DDG4/Geant4ParticleHandler.h index 5bc85a2b0..2ef446974 100644 --- a/DDG4/include/DDG4/Geant4ParticleHandler.h +++ b/DDG4/include/DDG4/Geant4ParticleHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,10 +26,10 @@ class G4Event; class G4SteppingManager; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4UserParticleHandler; @@ -160,7 +160,7 @@ namespace DD4hep { static bool defaultKeepParticle(Particle& particle); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PARTICLEHANDLER_H diff --git a/DDG4/include/DDG4/Geant4ParticlePrint.h b/DDG4/include/DDG4/Geant4ParticlePrint.h index 90e09d007..40592ca42 100644 --- a/DDG4/include/DDG4/Geant4ParticlePrint.h +++ b/DDG4/include/DDG4/Geant4ParticlePrint.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,10 +23,10 @@ class G4Event; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Geant4Action to print MC particle information. /** @@ -76,7 +76,7 @@ namespace DD4hep { virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PARTICLEPRINT_H diff --git a/DDG4/include/DDG4/Geant4PhysicsConstructor.h b/DDG4/include/DDG4/Geant4PhysicsConstructor.h index 4262a5b36..b3a045d8e 100644 --- a/DDG4/include/DDG4/Geant4PhysicsConstructor.h +++ b/DDG4/include/DDG4/Geant4PhysicsConstructor.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,10 +24,10 @@ #include "G4VPhysicsConstructor.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Implementation base of a Geant4 physics constructor /** @@ -85,7 +85,7 @@ namespace DD4hep { virtual void constructParticle(Constructor& ctor); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DDG4_GEANT4PHYSICSCONSTRUCTOR_H diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h index ad52cfc6d..c0c6be12c 100644 --- a/DDG4/include/DDG4/Geant4PhysicsList.h +++ b/DDG4/include/DDG4/Geant4PhysicsList.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,10 +27,10 @@ class G4VModularPhysicsList; class G4VUserPhysicsList; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Concrete basic implementation of a Geant4 physics list action /** @@ -250,7 +250,7 @@ namespace DD4hep { G4VUserPhysicsList* extensionList(); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PHYSICSLIST_H diff --git a/DDG4/include/DDG4/Geant4Primary.h b/DDG4/include/DDG4/Geant4Primary.h index 6ecae7b66..d44fd3e7b 100644 --- a/DDG4/include/DDG4/Geant4Primary.h +++ b/DDG4/include/DDG4/Geant4Primary.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -29,10 +29,10 @@ class G4PrimaryParticle; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Particle; @@ -175,6 +175,6 @@ namespace DD4hep { std::vector<Geant4PrimaryInteraction*> interactions() const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4PRIMARY_H diff --git a/DDG4/include/DDG4/Geant4PrimaryHandler.h b/DDG4/include/DDG4/Geant4PrimaryHandler.h index 726a62c5c..53d13ae6c 100644 --- a/DDG4/include/DDG4/Geant4PrimaryHandler.h +++ b/DDG4/include/DDG4/Geant4PrimaryHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,10 +17,10 @@ #include "DDG4/Geant4GeneratorAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Geant4Action to convert the particle information to Geant4 /** Convert the primary interaction (object \tt{Geant4PrimaryInteraction} object @@ -40,7 +40,7 @@ namespace DD4hep { /// Event generation action callback virtual void operator()(G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PRIMARYHANDLER_H diff --git a/DDG4/include/DDG4/Geant4Primitives.h b/DDG4/include/DDG4/Geant4Primitives.h index aa4fb192a..8ee01aa86 100644 --- a/DDG4/include/DDG4/Geant4Primitives.h +++ b/DDG4/include/DDG4/Geant4Primitives.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,11 +19,11 @@ /// Geant 4 forward declarations /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PRIMITIVES_H diff --git a/DDG4/include/DDG4/Geant4Random.h b/DDG4/include/DDG4/Geant4Random.h index a1cb78cce..df3a4bbfd 100644 --- a/DDG4/include/DDG4/Geant4Random.h +++ b/DDG4/include/DDG4/Geant4Random.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,10 +26,10 @@ class TRandom; namespace CLHEP { class HepRandomEngine; } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Exec; @@ -161,6 +161,6 @@ namespace DD4hep { void sphere(double &x, double &y, double &z, double r); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4RANDOM_H diff --git a/DDG4/include/DDG4/Geant4ReadoutVolumeFilter.h b/DDG4/include/DDG4/Geant4ReadoutVolumeFilter.h index bf93d2078..9507cd206 100644 --- a/DDG4/include/DDG4/Geant4ReadoutVolumeFilter.h +++ b/DDG4/include/DDG4/Geant4ReadoutVolumeFilter.h @@ -1,6 +1,5 @@ -// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +19,10 @@ #include "DDG4/Geant4SensDetAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Default base class for all geant 4 tracking actions. /** @@ -32,30 +31,26 @@ namespace DD4hep { * \ingroup DD4HEP_SIMULATION */ class Geant4ReadoutVolumeFilter: public Geant4Filter { - typedef Geometry::IDDescriptor::Field Field; - typedef Geometry::Readout Readout; - typedef Readout::Collection Collection; - protected: /// Reference to readout descriptor - Readout m_readout; + Readout m_readout; /// Collection index - const Collection* m_collection; + const HitCollection* m_collection; /// Bit field value from ID descriptor - Field m_key; + const BitFieldValue* m_key; public: /// Standard constructor - Geant4ReadoutVolumeFilter(Geant4Context* context, + Geant4ReadoutVolumeFilter(Geant4Context* context, const std::string& name, - Readout ro, + Readout ro, const std::string& coll); /// Default destructor virtual ~Geant4ReadoutVolumeFilter(); /// Filter action. Return true if hits should be processed virtual bool operator()(const G4Step* step) const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4READOUTVOLUMEFILTER_H diff --git a/DDG4/include/DDG4/Geant4RunAction.h b/DDG4/include/DDG4/Geant4RunAction.h index d979d5852..92b2efb99 100644 --- a/DDG4/include/DDG4/Geant4RunAction.h +++ b/DDG4/include/DDG4/Geant4RunAction.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +21,10 @@ class G4Run; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4RunAction; @@ -169,7 +169,7 @@ namespace DD4hep { virtual void end(const G4Run* run); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4RUNACTION_H diff --git a/DDG4/include/DDG4/Geant4SensDetAction.h b/DDG4/include/DDG4/Geant4SensDetAction.h index 6ef79e335..bd810de55 100644 --- a/DDG4/include/DDG4/Geant4SensDetAction.h +++ b/DDG4/include/DDG4/Geant4SensDetAction.h @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +15,7 @@ #define DD4HEP_DDG4_GEANT4SENSDETACTION_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Geant4Action.h" #include "DDG4/Geant4HitCollection.h" @@ -32,17 +31,15 @@ class G4VHitsCollection; class G4VReadOutGeometry; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations - namespace Geometry { - class LCDD; - class DetElement; - class SensitiveDetector; - } + class Detector; + class DetElement; + class SensitiveDetector; /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4StepHandler; @@ -64,9 +61,6 @@ namespace DD4hep { /// Default destructor virtual ~Geant4ActionSD(); public: - /// Definition: Sensitive detector type - typedef Geometry::SensitiveDetector SensitiveDetector; - /// Initialize the usage of a hit collection. Returns the collection identifier virtual size_t defineCollection(const std::string& name) = 0; /// Access to the readout geometry of the sensitive detector @@ -75,7 +69,7 @@ namespace DD4hep { virtual G4int GetCollectionID(G4int i) = 0; /// Is the detector active? virtual bool isActive() const = 0; - /// Access to the LCDD sensitive detector handle + /// Access to the Detector sensitive detector handle virtual SensitiveDetector sensitiveDetector() const = 0; /// G4VSensitiveDetector internals: Access to the detector path name virtual std::string path() const = 0; @@ -95,10 +89,8 @@ namespace DD4hep { protected: /// Inhibit copy constructor Geant4Filter() = default; - /// Inhibit copy constructor Geant4Filter(const Geant4Filter& copy) = delete; - /// Inhibit assignment operator Geant4Filter& operator=(const Geant4Filter& copy) = delete; @@ -119,16 +111,6 @@ namespace DD4hep { */ class Geant4Sensitive: public Geant4Action { public: - typedef Geometry::LCDD LCDD; - typedef Geometry::Readout Readout; - typedef Geometry::DetElement DetElement; - typedef Geometry::Segmentation Segmentation; - /// Definition: Sensitive detector type - typedef Geometry::SensitiveDetector SensitiveDetector; - - typedef Geant4StepHandler StepHandler; - typedef Geant4HitCollection HitCollection; - enum HitCreationFlags { SIMPLE_MODE = 0, MEDIUM_MODE = 1<<0, @@ -145,7 +127,7 @@ namespace DD4hep { /// Property: Hit creation mode. Maybe one of the enum HitCreationFlags int m_hitCreationMode = 0; /// Reference to the detector description object - LCDD& m_lcdd; + Detector& m_detDesc; /// Reference to the detector element describing this sensitive element DetElement m_detector; /// Reference to the sensitive detector element @@ -159,17 +141,14 @@ namespace DD4hep { /// Protect the default constructor Geant4Sensitive() = default; - /// Inhibit copy constructor Geant4Sensitive(const Geant4Sensitive& copy) = delete; - /// Inhibit assignment operator Geant4Sensitive& operator=(const Geant4Sensitive& copy) = delete; public: /// Constructor. The sensitive detector element is identified by the detector name - Geant4Sensitive(Geant4Context* context, const std::string& name, DetElement det, LCDD& lcdd); - + Geant4Sensitive(Geant4Context* context, const std::string& name, DetElement det, Detector& description); /// Standard destructor virtual ~Geant4Sensitive(); @@ -204,7 +183,7 @@ namespace DD4hep { return detector().isActive(); } - /// Access the DD4hep sensitive detector + /// Access the dd4hep sensitive detector SensitiveDetector sensitiveDetector() const { return m_sensitive; } @@ -247,10 +226,10 @@ namespace DD4hep { const std::string& hitCollectionName(size_t which) const; /// Retrieve the hits collection associated with this detector by its serial number - HitCollection* collection(size_t which); + Geant4HitCollection* collection(size_t which); /// Retrieve the hits collection associated with this detector by its collection identifier - HitCollection* collectionByID(size_t id); + Geant4HitCollection* collectionByID(size_t id); /// Define collections created by this sensitivie action object virtual void defineCollections(); @@ -300,8 +279,6 @@ namespace DD4hep { */ class Geant4SensDetActionSequence: public Geant4Action { public: - - typedef Geometry::SensitiveDetector SensitiveDetector; typedef Geant4HitCollection* (*create_t)(const std::string&, const std::string&, Geant4Sensitive*); typedef std::pair<std::string, std::pair<Geant4Sensitive*,create_t> > HitCollection; typedef std::vector<HitCollection> HitCollections; @@ -518,8 +495,8 @@ namespace DD4hep { /// Standard , initializing constructor Geant4SensitiveAction(Geant4Context* context, const std::string& name, - Geometry::DetElement det, - Geometry::LCDD& lcdd); + DetElement det, + Detector& description); /// Default destructor virtual ~Geant4SensitiveAction(); @@ -559,7 +536,7 @@ namespace DD4hep { }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4RUNACTION_H diff --git a/DDG4/include/DDG4/Geant4SensDetAction.inl b/DDG4/include/DDG4/Geant4SensDetAction.inl index 66b38fe95..56570cf64 100644 --- a/DDG4/include/DDG4/Geant4SensDetAction.inl +++ b/DDG4/include/DDG4/Geant4SensDetAction.inl @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,18 +22,18 @@ #include "DDG4/Geant4Data.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Standard , initializing constructor template <typename T> Geant4SensitiveAction<T>::Geant4SensitiveAction(Geant4Context* ctxt, const std::string& nam, - Geometry::DetElement det, - Geometry::LCDD& lcdd_ref) - : Geant4Sensitive(ctxt,nam,det,lcdd_ref), m_collectionName(), m_collectionID(0) + DetElement det, + Detector& description_ref) + : Geant4Sensitive(ctxt,nam,det,description_ref), m_collectionName(), m_collectionID(0) { declareProperty("CollectionName", m_collectionName); initialize(); @@ -81,14 +81,11 @@ namespace DD4hep { /// Define readout specific hit collection. matching name must be present in readout structure template <typename T> template <typename HIT> size_t Geant4SensitiveAction<T>::defineReadoutCollection(const std::string match_name) { - typedef Geometry::ReadoutObject _RO; Readout ro = m_sensitive.readout(); - for(_RO::Collections::const_iterator i=ro->hits.begin(); i!=ro->hits.end(); ++i) { - const _RO::Collection& c = *i; + for(const auto& c : ro->hits ) { if ( c.name == match_name ) { size_t coll_id = defineCollection<HIT>(match_name); - Geant4Filter* filter = - new Geant4ReadoutVolumeFilter(context(),name()+"_"+c.name,ro,c.name); + Geant4Filter* filter = new Geant4ReadoutVolumeFilter(context(),name()+"_"+c.name,ro,c.name); adopt_front(filter); return coll_id; } @@ -113,8 +110,8 @@ namespace DD4hep { typedef Geant4HitData::Contribution HitContribution; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #include "DD4hep/Printout.h" diff --git a/DDG4/include/DDG4/Geant4SensitiveDetector.h b/DDG4/include/DDG4/Geant4SensitiveDetector.h index e6832786e..81f5b9f97 100644 --- a/DDG4/include/DDG4/Geant4SensitiveDetector.h +++ b/DDG4/include/DDG4/Geant4SensitiveDetector.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_GEANT4SENSITIVEDETECTOR_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Geant4Hits.h" // Geant 4 include files @@ -27,10 +27,10 @@ #include <algorithm> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4StepHandler; @@ -45,7 +45,6 @@ namespace DD4hep { */ class Geant4SensitiveDetector : public G4VSensitiveDetector { public: - typedef Geometry::SensitiveDetector SensitiveDetector; typedef G4THitsCollection<Geant4Hit> HitCollection; typedef Geant4Hit::Contribution HitContribution; typedef Geant4StepHandler StepHandler; @@ -53,7 +52,7 @@ namespace DD4hep { protected: /// Reference to the detector description object - LCDD& m_lcdd; + Detector& m_detDesc; /// Reference to the detector element describing this sensitive element DetElement m_detector; /// Reference to the sensitive detector element @@ -73,7 +72,7 @@ namespace DD4hep { public: /// Constructor. The sensitive detector element is identified by the detector name - Geant4SensitiveDetector(const std::string& name, LCDD& lcdd); + Geant4SensitiveDetector(const std::string& name, Detector& description); /// Initialize the sensitive detector for the usage of a single hit collection virtual bool defineCollection(const std::string& coll_name); @@ -143,7 +142,7 @@ namespace DD4hep { T userData; public: /// Constructor. The sensitive detector element is identified by the detector name - Geant4GenericSD(const std::string& name, LCDD& lcdd); + Geant4GenericSD(const std::string& name, Detector& description); /// Initialize the sensitive detector for the usage of a single hit collection virtual bool defineCollection(const std::string& coll_name); @@ -172,7 +171,7 @@ namespace DD4hep { virtual bool buildHits(G4Step* step,G4TouchableHistory* history); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4SENSITIVEDETECTOR_H diff --git a/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h b/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h index 516f174e8..ba3414d87 100644 --- a/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h +++ b/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,13 +19,13 @@ #include "DDG4/Geant4SensitiveDetector.h" /// Constructor. The sensitive detector element is identified by the detector name -template <class SD> DD4hep::Simulation::Geant4GenericSD<SD>::Geant4GenericSD(const std::string& nam, LCDD& lcdd_ref) - : Geant4SensitiveDetector(nam, lcdd_ref) { +template <class SD> dd4hep::sim::Geant4GenericSD<SD>::Geant4GenericSD(const std::string& nam, Detector& description_ref) + : Geant4SensitiveDetector(nam, description_ref) { defineCollection(m_sensitive.hitsCollection()); } /// Initialize the sensitive detector for the usage of a single hit collection -template <class SD> bool DD4hep::Simulation::Geant4GenericSD<SD>::defineCollection(const std::string& coll_name) { +template <class SD> bool dd4hep::sim::Geant4GenericSD<SD>::defineCollection(const std::string& coll_name) { return Geant4SensitiveDetector::defineCollection(coll_name); } @@ -33,27 +33,27 @@ template <class SD> bool DD4hep::Simulation::Geant4GenericSD<SD>::defineCollecti * The hits collection(s) created by this sensitive detector must * be set to the G4HCofThisEvent object at one of these two methods. */ -template <class SD> void DD4hep::Simulation::Geant4GenericSD<SD>::Initialize(G4HCofThisEvent* HCE) { +template <class SD> void dd4hep::sim::Geant4GenericSD<SD>::Initialize(G4HCofThisEvent* HCE) { this->Geant4SensitiveDetector::Initialize(HCE); } /// Method invoked at the end of each event. -template <class SD> void DD4hep::Simulation::Geant4GenericSD<SD>::EndOfEvent(G4HCofThisEvent* HCE) { +template <class SD> void dd4hep::sim::Geant4GenericSD<SD>::EndOfEvent(G4HCofThisEvent* HCE) { this->Geant4SensitiveDetector::EndOfEvent(HCE); } /// Method invoked if the event was aborted. -template <class SD> void DD4hep::Simulation::Geant4GenericSD<SD>::clear() { +template <class SD> void dd4hep::sim::Geant4GenericSD<SD>::clear() { this->Geant4SensitiveDetector::clear(); } /// Method for generating hit(s) using the information of G4Step object. -template <class SD> G4bool DD4hep::Simulation::Geant4GenericSD<SD>::ProcessHits(G4Step* step, G4TouchableHistory* history) { +template <class SD> G4bool dd4hep::sim::Geant4GenericSD<SD>::ProcessHits(G4Step* step, G4TouchableHistory* history) { return this->Geant4SensitiveDetector::ProcessHits(step, history); } /// Method for generating hit(s) using the information of G4Step object. -template <class SD> bool DD4hep::Simulation::Geant4GenericSD<SD>::buildHits(G4Step*, G4TouchableHistory*) { +template <class SD> bool dd4hep::sim::Geant4GenericSD<SD>::buildHits(G4Step*, G4TouchableHistory*) { return true; } diff --git a/DDG4/include/DDG4/Geant4StackingAction.h b/DDG4/include/DDG4/Geant4StackingAction.h index 95e492840..916f53f04 100644 --- a/DDG4/include/DDG4/Geant4StackingAction.h +++ b/DDG4/include/DDG4/Geant4StackingAction.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "DDG4/Geant4Action.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4StackingAction; @@ -132,7 +132,7 @@ namespace DD4hep { virtual void prepare(); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4STACKINGACTION_H diff --git a/DDG4/include/DDG4/Geant4StepHandler.h b/DDG4/include/DDG4/Geant4StepHandler.h index 92b521d87..495023cae 100644 --- a/DDG4/include/DDG4/Geant4StepHandler.h +++ b/DDG4/include/DDG4/Geant4StepHandler.h @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,10 +26,10 @@ #include "G4Version.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations; class Geant4StepHandler; @@ -249,7 +249,7 @@ namespace DD4hep { } }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4STEPHANDLER_H diff --git a/DDG4/include/DDG4/Geant4SteppingAction.h b/DDG4/include/DDG4/Geant4SteppingAction.h index 1da17bd59..7e95ae3c1 100644 --- a/DDG4/include/DDG4/Geant4SteppingAction.h +++ b/DDG4/include/DDG4/Geant4SteppingAction.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +21,10 @@ class G4SteppingManager; class G4Step; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4SteppingAction; @@ -133,7 +133,7 @@ namespace DD4hep { virtual void operator()(const G4Step* step, G4SteppingManager* mgr); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4STEPPINGACTION_H diff --git a/DDG4/include/DDG4/Geant4TestActions.h b/DDG4/include/DDG4/Geant4TestActions.h index 93784c8a3..613b41276 100644 --- a/DDG4/include/DDG4/Geant4TestActions.h +++ b/DDG4/include/DDG4/Geant4TestActions.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,10 +27,10 @@ #include "DDG4/Geant4SensDetAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Convenience namespace to separate test classes from the DDG4 simulation toolkit namespace Test { @@ -160,7 +160,7 @@ namespace DD4hep { size_t m_collectionID; public: /// Standard constructor with initializing arguments - Geant4TestSensitive(Geant4Context* c, const std::string& n, DetElement det, LCDD& lcdd); + Geant4TestSensitive(Geant4Context* c, const std::string& n, DetElement det, Detector& description); /// Default destructor virtual ~Geant4TestSensitive(); /// Begin-of-tracking callback @@ -171,7 +171,7 @@ namespace DD4hep { virtual bool process(G4Step*, G4TouchableHistory*); }; } // End namespace Test - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4TESTACTIONS_H diff --git a/DDG4/include/DDG4/Geant4TouchableHandler.h b/DDG4/include/DDG4/Geant4TouchableHandler.h index 466d0b5c9..9b554f7af 100644 --- a/DDG4/include/DDG4/Geant4TouchableHandler.h +++ b/DDG4/include/DDG4/Geant4TouchableHandler.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,10 +24,10 @@ class G4VTouchable; class G4Step; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations; class Geant4TouchableHandler; @@ -64,7 +64,7 @@ namespace DD4hep { int depth() const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4TOUCHABLEHANDLER_H diff --git a/DDG4/include/DDG4/Geant4TrackHandler.h b/DDG4/include/DDG4/Geant4TrackHandler.h index 49097098b..444873fbe 100644 --- a/DDG4/include/DDG4/Geant4TrackHandler.h +++ b/DDG4/include/DDG4/Geant4TrackHandler.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -33,10 +33,10 @@ class G4VTouchableHandle; class G4VUserTrackInformation; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations; class Geant4TrackHandler; @@ -203,6 +203,6 @@ namespace DD4hep { } }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4TRACKHANDLER_H diff --git a/DDG4/include/DDG4/Geant4TrackInformation.h b/DDG4/include/DDG4/Geant4TrackInformation.h index 97362729d..e2400f3bc 100644 --- a/DDG4/include/DDG4/Geant4TrackInformation.h +++ b/DDG4/include/DDG4/Geant4TrackInformation.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "G4VUserTrackInformation.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Unused. /** @@ -52,7 +52,7 @@ namespace DD4hep { }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4TRACKINFORMATION_H diff --git a/DDG4/include/DDG4/Geant4TrackingAction.h b/DDG4/include/DDG4/Geant4TrackingAction.h index 26fba8875..ac802a69c 100644 --- a/DDG4/include/DDG4/Geant4TrackingAction.h +++ b/DDG4/include/DDG4/Geant4TrackingAction.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,10 +22,10 @@ class G4TrackingManager; class G4Track; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4TrackInformation; @@ -174,6 +174,6 @@ namespace DD4hep { virtual void end(const G4Track* track); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4TRACKINGACTION_H diff --git a/DDG4/include/DDG4/Geant4TrackingPostAction.h b/DDG4/include/DDG4/Geant4TrackingPostAction.h index 3ee803922..6886bd39a 100644 --- a/DDG4/include/DDG4/Geant4TrackingPostAction.h +++ b/DDG4/include/DDG4/Geant4TrackingPostAction.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include <vector> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Default base class for all geant 4 tracking actions. /** @@ -50,7 +50,7 @@ namespace DD4hep { /// End-of-tracking callback virtual void end(const G4Track* track); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4TRACKINGPOSTACTION_H diff --git a/DDG4/include/DDG4/Geant4TrackingPreAction.h b/DDG4/include/DDG4/Geant4TrackingPreAction.h index 671a395ee..a46b9d9ad 100644 --- a/DDG4/include/DDG4/Geant4TrackingPreAction.h +++ b/DDG4/include/DDG4/Geant4TrackingPreAction.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "DDG4/Geant4TrackingAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Default base class for all geant 4 tracking actions. /** @@ -40,7 +40,7 @@ namespace DD4hep { /// End-of-tracking callback virtual void end(const G4Track* track); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4TRACKINGPREACTION_H diff --git a/DDG4/include/DDG4/Geant4UIManager.h b/DDG4/include/DDG4/Geant4UIManager.h index 0eab53558..779667a14 100644 --- a/DDG4/include/DDG4/Geant4UIManager.h +++ b/DDG4/include/DDG4/Geant4UIManager.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,10 +25,10 @@ class G4UIExecutive; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Standard UI interface implementation with configuration using property options /** The {\tt{Geant4UIManager}} is a component attached to the {\tt{Geant4Kernel}} object. @@ -90,6 +90,6 @@ namespace DD4hep { virtual void operator()(void* param); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4UIMANAGER_H diff --git a/DDG4/include/DDG4/Geant4UIMessenger.h b/DDG4/include/DDG4/Geant4UIMessenger.h index 3f38b5812..659fa11f7 100644 --- a/DDG4/include/DDG4/Geant4UIMessenger.h +++ b/DDG4/include/DDG4/Geant4UIMessenger.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,10 +22,10 @@ #include "G4UIdirectory.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Generic implementation to export properties and actions to the Geant4 command prompt. /** @class Geant4UIMessenger Geant4UIMessenger.h DDG4/Geant4UIMessenger.h @@ -72,7 +72,7 @@ namespace DD4hep { G4String GetCurrentValue(G4UIcommand *c); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4UIMESSENGER_H diff --git a/DDG4/include/DDG4/Geant4UserInitialization.h b/DDG4/include/DDG4/Geant4UserInitialization.h index 0e91f50b4..52cf40584 100644 --- a/DDG4/include/DDG4/Geant4UserInitialization.h +++ b/DDG4/include/DDG4/Geant4UserInitialization.h @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ // Forward declarations /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to initialize a multi-threaded or single threaded Geant4 application /** @@ -83,6 +83,6 @@ namespace DD4hep { virtual void buildMaster() const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4USERINITIALIZATION_H diff --git a/DDG4/include/DDG4/Geant4UserParticleHandler.h b/DDG4/include/DDG4/Geant4UserParticleHandler.h index 5da782c7e..cb9ebc41d 100644 --- a/DDG4/include/DDG4/Geant4UserParticleHandler.h +++ b/DDG4/include/DDG4/Geant4UserParticleHandler.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,10 +26,10 @@ class G4SteppingManager; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Particle; @@ -120,7 +120,7 @@ namespace DD4hep { */ virtual void combine(Particle& to_be_deleted, Particle& remaining_parent); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4USERPARTICLEHANDLER_H diff --git a/DDG4/include/DDG4/Geant4Vertex.h b/DDG4/include/DDG4/Geant4Vertex.h index 99887430e..7d5b41934 100644 --- a/DDG4/include/DDG4/Geant4Vertex.h +++ b/DDG4/include/DDG4/Geant4Vertex.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ #include <set> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Vertex; @@ -75,6 +75,6 @@ namespace DD4hep { void release(); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_GEANT4VERTEX_H diff --git a/DDG4/include/DDG4/Geant4VolumeManager.h b/DDG4/include/DDG4/Geant4VolumeManager.h index 66fcac9ef..d9fd903c1 100644 --- a/DDG4/include/DDG4/Geant4VolumeManager.h +++ b/DDG4/include/DDG4/Geant4VolumeManager.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_DDG4_GEANT4VOLUMEMANAGER_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/IDDescriptor.h" #include "DDG4/Geant4Primitives.h" #include "DDG4/Geant4GeometryInfo.h" @@ -23,10 +23,10 @@ class G4VTouchable; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4VolumeManager; @@ -38,20 +38,10 @@ namespace DD4hep { * @author M.Frank * @version 1.0 */ - class Geant4VolumeManager: public Geometry::Handle<Geant4GeometryInfo> { - public: - // Forward declarations - typedef Geometry::Handle<Geant4GeometryInfo> Base; - typedef Geometry::PlacedVolume PlacedVolume; - typedef Geometry::IDDescriptor IDDescriptor; - typedef IDDescriptor::VolIDFields VolIDFields; - typedef std::pair<VolumeID, VolIDFields> VolIDDescriptor; - typedef Geant4GeometryMaps::Geant4PlacementPath PlacementPath; - typedef Geant4GeometryInfo Object; - + class Geant4VolumeManager : public Handle<Geant4GeometryInfo> { protected: /// Optimization flag to shortcut object checks - mutable bool m_isValid; + mutable bool m_isValid = false; /// Check the validity of the information before accessing it. bool checkValidity() const; @@ -62,44 +52,35 @@ namespace DD4hep { static const VolumeID NonExisting = 0ULL; /// Initializing constructor. The tree will automatically be built if possible - Geant4VolumeManager(Geometry::LCDD& lcdd, Geant4GeometryInfo* info); + Geant4VolumeManager(Detector& description, Geant4GeometryInfo* info); /// Default constructor - Geant4VolumeManager() - : Base(), m_isValid(false) { - } + Geant4VolumeManager() = default; /// Constructor to be used when reading the already parsed object - Geant4VolumeManager(const Base& e) - : Base(e), m_isValid(false) { - } + Geant4VolumeManager(const Handle<Geant4GeometryInfo>& e) + : Handle<Geant4GeometryInfo>(e), m_isValid(false) { } /// Constructor to be used when reading the already parsed object - Geant4VolumeManager(const Geant4VolumeManager& e) - : Base(e), m_isValid(false) { - } + Geant4VolumeManager(const Geant4VolumeManager& e) = default; /// Constructor to be used when reading the already parsed object - template <typename Q> Geant4VolumeManager(const Geometry::Handle<Q>& e) - : Base(e), m_isValid(false) { + template <typename Q> Geant4VolumeManager(const Handle<Q>& e) + : Handle<Geant4GeometryInfo>(e), m_isValid(false) { } /// Assignment operator - Geant4VolumeManager& operator=(const Geant4VolumeManager& c) { - if ( this != &c ) { - m_element = c.m_element; - m_isValid = c.m_isValid; - } - return *this; - } - + Geant4VolumeManager& operator=(const Geant4VolumeManager& c) = default; /// Helper: Generate placement path from touchable object - PlacementPath placementPath(const G4VTouchable* touchable, bool exception = true) const; + std::vector<const G4VPhysicalVolume*> + placementPath(const G4VTouchable* touchable, bool exception = true) const; /// Access CELLID by placement path - VolumeID volumeID(const PlacementPath& path) const; + VolumeID volumeID(const std::vector<const G4VPhysicalVolume*>& path) const; /// Access CELLID by Geant4 touchable object VolumeID volumeID(const G4VTouchable* touchable) const; /// Accessfully decoded volume fields by placement path - void volumeDescriptor(const PlacementPath& path, VolIDDescriptor& volume_desc) const; + void volumeDescriptor(const std::vector<const G4VPhysicalVolume*>& path, + std::pair<VolumeID,std::vector<std::pair<const BitFieldValue*, VolumeID> > >& volume_desc) const; /// Access fully decoded volume fields by Geant4 touchable object - void volumeDescriptor(const G4VTouchable* touchable, VolIDDescriptor& volume_desc) const; + void volumeDescriptor(const G4VTouchable* touchable, + std::pair<VolumeID,std::vector<std::pair<const BitFieldValue*, VolumeID> > >& volume_desc) const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4VOLUMEMANAGER_H diff --git a/DDG4/include/DDG4/IoStreams.h b/DDG4/include/DDG4/IoStreams.h index 1c6173db6..d526e1a6c 100644 --- a/DDG4/include/DDG4/IoStreams.h +++ b/DDG4/include/DDG4/IoStreams.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -41,7 +41,7 @@ class TFile; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations template <typename T> class dd4hep_file_source; @@ -52,7 +52,7 @@ namespace DD4hep { close_handle = 3 }; - /// DD4hep file handling extension to boost::iostreams + /// dd4hep file handling extension to boost::iostreams /** * Basic file handling for data sources and data sinks. * Please see boost::iostreams for details. @@ -113,7 +113,7 @@ namespace DD4hep { }; - /// DD4hep file source extension to boost::iostreams + /// dd4hep file source extension to boost::iostreams /** * Basic data sources implementation. * Please see boost::iostreams for details. @@ -177,7 +177,7 @@ namespace DD4hep { { open(detail_path(path), mode); } }; - /// DD4hep file sink extension to boost::iostreams + /// dd4hep file sink extension to boost::iostreams /** * Basic data sink implementation. * Please see boost::iostreams for details. diff --git a/DDG4/include/DDG4/Python/DDPython.h b/DDG4/include/DDG4/Python/DDPython.h index d78500bf0..f049c3425 100644 --- a/DDG4/include/DDG4/Python/DDPython.h +++ b/DDG4/include/DDG4/Python/DDPython.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ #include "TPyReturn.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { struct DDPythonGlobalState; diff --git a/DDG4/include/DDG4/Python/Geant4PythonAction.h b/DDG4/include/DDG4/Python/Geant4PythonAction.h index 0a7db9c90..137093cea 100644 --- a/DDG4/include/DDG4/Python/Geant4PythonAction.h +++ b/DDG4/include/DDG4/Python/Geant4PythonAction.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "TPyReturn.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to initialize a multi-threaded or single threaded Geant4 application /** @@ -49,6 +49,6 @@ namespace DD4hep { /// Invoke command prompt static void prompt(); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PYTHONACTION_H diff --git a/DDG4/include/DDG4/Python/Geant4PythonCall.h b/DDG4/include/DDG4/Python/Geant4PythonCall.h index 22b08c8c4..9c8ccc640 100644 --- a/DDG4/include/DDG4/Python/Geant4PythonCall.h +++ b/DDG4/include/DDG4/Python/Geant4PythonCall.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "TPyReturn.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to initialize a multi-threaded or single threaded Geant4 application /** @@ -58,6 +58,6 @@ namespace DD4hep { /// Set the callback structures for callbacks without arguments void set(PyObject* callable); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PYTHONCALL_H diff --git a/DDG4/include/DDG4/Python/Geant4PythonDetectorConstruction.h b/DDG4/include/DDG4/Python/Geant4PythonDetectorConstruction.h index b0c01dc3d..590ea0858 100644 --- a/DDG4/include/DDG4/Python/Geant4PythonDetectorConstruction.h +++ b/DDG4/include/DDG4/Python/Geant4PythonDetectorConstruction.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DDG4/Python/Geant4PythonCall.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to initialize a multi-threaded or single threaded Geant4 application /** @@ -90,6 +90,6 @@ namespace DD4hep { virtual void constructSensitives(Geant4DetectorConstructionContext* ctxt); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PYTHONDETECTORCONSTRUCTION_H diff --git a/DDG4/include/DDG4/Python/Geant4PythonInitialization.h b/DDG4/include/DDG4/Python/Geant4PythonInitialization.h index 001521ca0..5d75d1380 100644 --- a/DDG4/include/DDG4/Python/Geant4PythonInitialization.h +++ b/DDG4/include/DDG4/Python/Geant4PythonInitialization.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DDG4/Python/Geant4PythonCall.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to initialize a multi-threaded or single threaded Geant4 application /** @@ -81,6 +81,6 @@ namespace DD4hep { /// Callback function to build setup for the MT master thread virtual void buildMaster() const; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PYTHONINITIALIZATION_H diff --git a/DDG4/include/DDG4/Python/PyDDG4.h b/DDG4/include/DDG4/Python/PyDDG4.h index c0f89a55c..3ee0a83eb 100644 --- a/DDG4/include/DDG4/Python/PyDDG4.h +++ b/DDG4/include/DDG4/Python/PyDDG4.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,13 +15,13 @@ #define DD4HEP_DDG4_PYDDG4_H /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4Kernel; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep /// Python interface class for Geant4 python involation @@ -31,7 +31,7 @@ namespace DD4hep { * \ingroup DD4HEP_SIMULATION */ struct PyDDG4 { - typedef DD4hep::Simulation::Geant4Kernel Kernel; + typedef dd4hep::sim::Geant4Kernel Kernel; static int execute(); static int process(const char* fname); diff --git a/DDG4/lcio/Geant4Output2LCIO.cpp b/DDG4/lcio/Geant4Output2LCIO.cpp index 0e4f95575..1f5dfba96 100644 --- a/DDG4/lcio/Geant4Output2LCIO.cpp +++ b/DDG4/lcio/Geant4Output2LCIO.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +21,7 @@ #include "G4Threading.hh" #include "G4AutoLock.hh" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include <G4Version.hh> // lcio include files @@ -34,12 +34,12 @@ using namespace lcio ; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { class ComponentCast; /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { class Geant4ParticleMap; @@ -80,13 +80,12 @@ namespace DD4hep { virtual void begin(const G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4OUTPUT2LCIO_H -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -100,7 +99,7 @@ namespace DD4hep { // Framework include files #include "DD4hep/InstanceCount.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Geant4HitCollection.h" #include "DDG4/Geant4DataConversion.h" #include "DDG4/Geant4Context.h" @@ -124,8 +123,8 @@ namespace DD4hep { #include "IMPL/MCParticleImpl.h" #include "UTIL/ILDConf.h" -using namespace DD4hep::Simulation; -using namespace DD4hep; +using namespace dd4hep::sim; +using namespace dd4hep; using namespace std; namespace { G4Mutex action_mutex=G4MUTEX_INITIALIZER; @@ -147,7 +146,7 @@ Geant4Output2LCIO::~Geant4Output2LCIO() { G4AutoLock protection_lock(&action_mutex); if ( m_file ) { m_file->close(); - deletePtr(m_file); + detail::deletePtr(m_file); } InstanceCount::decrement(this); } @@ -188,7 +187,7 @@ void Geant4Output2LCIO::saveRun(const G4Run* run) { rh->parameters().setValue("GEANT4Version", G4Version); rh->parameters().setValue("DD4HEPVersion", versionString()); rh->setRunNumber(m_runNo=run->GetRunID()); - rh->setDetectorName(context()->lcdd().header().name()); + rh->setDetectorName(context()->detectorDescription().header().name()); m_file->writeRunHeader(rh); } @@ -201,7 +200,7 @@ void Geant4Output2LCIO::begin(const G4Event* /* event */) { /// Data conversion interface for MC particles to LCIO format lcio::LCCollectionVec* Geant4Output2LCIO::saveParticles(Geant4ParticleMap* particles) { - typedef ReferenceBitMask<const int> PropertyMask; + typedef detail::ReferenceBitMask<const int> PropertyMask; typedef Geant4ParticleMap::ParticleMap ParticleMap; const ParticleMap& pm = particles->particleMap; size_t nparts = pm.size(); @@ -306,7 +305,7 @@ void Geant4Output2LCIO::saveEvent(OutputContext<G4Event>& ctxt) { lcio::LCEventImpl* e = context()->event().extension<lcio::LCEventImpl>(); e->setRunNumber(m_runNo); e->setEventNumber(ctxt.context->GetEventID()); - e->setDetectorName(context()->lcdd().header().name()); + e->setDetectorName(context()->detectorDescription().header().name()); e->setRunNumber(m_runNo); lcio::LCEventImpl* evt = context()->event().extension<lcio::LCEventImpl>(); Geant4ParticleMap* part_map = context()->event().extension<Geant4ParticleMap>(false); diff --git a/DDG4/lcio/LCIOConversions.cpp b/DDG4/lcio/LCIOConversions.cpp index 4cb9a364e..d326c316f 100644 --- a/DDG4/lcio/LCIOConversions.cpp +++ b/DDG4/lcio/LCIOConversions.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ // Framework include files #define DDG4_MAKE_INSTANTIATIONS -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DDG4/Geant4HitCollection.h" #include "DDG4/Geant4DataConversion.h" @@ -57,17 +57,17 @@ using namespace lcio ; //================================================================================== /* - * DD4hep namespace declaration + * dd4hep namespace declaration */ -namespace DD4hep { +namespace dd4hep { /* * Simulation namespace declaration */ - namespace Simulation { + namespace sim { - typedef Geometry::VolumeManager VolMgr; - typedef Geometry::IDDescriptor IDDescriptor; + typedef VolumeManager VolMgr; + typedef IDDescriptor IDDescriptor; /// Data conversion interface calling lower level explicit convetrers /** @@ -319,8 +319,8 @@ namespace DD4hep { DECLARE_GEANT4_HITCONVERTER(lcio::LCCollectionVec,CONVERSION_ARGS,lcio::SimTrackerHitImpl) DECLARE_GEANT4_HITCONVERTER(lcio::LCCollectionVec,CONVERSION_ARGS,lcio::SimCalorimeterHitImpl) DECLARE_GEANT4_HITCONVERTER(lcio::LCCollectionVec,CONVERSION_ARGS,lcio::ClusterImpl) - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep diff --git a/DDG4/lcio/LCIOEventReader.cpp b/DDG4/lcio/LCIOEventReader.cpp index 23d83ff2d..e349ab569 100644 --- a/DDG4/lcio/LCIOEventReader.cpp +++ b/DDG4/lcio/LCIOEventReader.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,12 +26,12 @@ #include "G4Event.hh" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; -typedef DD4hep::ReferenceBitMask<int> PropertyMask; +using namespace dd4hep; +using namespace dd4hep::sim; +typedef dd4hep::detail::ReferenceBitMask<int> PropertyMask; // Neede for backwards compatibility: -namespace DD4hep{namespace Simulation{typedef Geant4InputAction LCIOInputAction;}} +namespace dd4hep{namespace sim{typedef Geant4InputAction LCIOInputAction;}} DECLARE_GEANT4ACTION(LCIOInputAction) diff --git a/DDG4/lcio/LCIOEventReader.h b/DDG4/lcio/LCIOEventReader.h index 77790f346..e3c304355 100644 --- a/DDG4/lcio/LCIOEventReader.h +++ b/DDG4/lcio/LCIOEventReader.h @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +21,10 @@ namespace EVENT { class LCCollection; } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to read lcio files. /** @@ -48,6 +48,6 @@ namespace DD4hep { virtual EventReaderStatus readParticleCollection(int event_number, EVENT::LCCollection** particles) = 0; }; - } /* End namespace Simulation */ -} /* End namespace DD4hep */ + } /* End namespace sim */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDG4_LCIOEVENTREADER_H */ diff --git a/DDG4/lcio/LCIOFileReader.cpp b/DDG4/lcio/LCIOFileReader.cpp index 4b0cc1abb..bd80075f3 100644 --- a/DDG4/lcio/LCIOFileReader.cpp +++ b/DDG4/lcio/LCIOFileReader.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -36,10 +35,10 @@ using namespace lcio ; namespace IO { class LCReader; } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to read lcio event files /** @@ -71,13 +70,13 @@ namespace DD4hep { #include "DDG4/Factories.h" #include "UTIL/ILDConf.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; // Factory entry -DECLARE_GEANT4_EVENT_READER_NS(DD4hep::Simulation,LCIOFileReader) +DECLARE_GEANT4_EVENT_READER_NS(dd4hep::sim,LCIOFileReader) /// Initializing constructor -DD4hep::Simulation::LCIOFileReader::LCIOFileReader(const std::string& nam) +dd4hep::sim::LCIOFileReader::LCIOFileReader(const std::string& nam) : LCIOEventReader(nam) { m_reader = ::lcio::LCFactory::getInstance()->createLCReader(LCReader::directAccess); @@ -87,14 +86,14 @@ DD4hep::Simulation::LCIOFileReader::LCIOFileReader(const std::string& nam) } /// Default destructor -DD4hep::Simulation::LCIOFileReader::~LCIOFileReader() { - DD4hep::deletePtr(m_reader); +dd4hep::sim::LCIOFileReader::~LCIOFileReader() { + dd4hep::detail::deletePtr(m_reader); } /// moveToSpecifiedEvent, a.k.a. skipNEvents Geant4EventReader::EventReaderStatus -DD4hep::Simulation::LCIOFileReader::moveToEvent(int event_number) { +dd4hep::sim::LCIOFileReader::moveToEvent(int event_number) { // ::lcio::LCEvent* evt = m_reader->readEvent(/*runNumber*/ 0, event_number); // fg: direct access does not work if run number is different from 0 and/or event numbers are not stored consecutively if( m_currEvent == 0 && event_number != 0 ) { @@ -109,7 +108,7 @@ DD4hep::Simulation::LCIOFileReader::moveToEvent(int event_number) { /// Read an event and fill a vector of MCParticles. Geant4EventReader::EventReaderStatus -DD4hep::Simulation::LCIOFileReader::readParticleCollection(int /*event_number*/, EVENT::LCCollection** particles) { +dd4hep::sim::LCIOFileReader::readParticleCollection(int /*event_number*/, EVENT::LCCollection** particles) { ::lcio::LCEvent* evt = m_reader->readNextEvent(); // simply read the events sequentially ++m_currEvent ; diff --git a/DDG4/lcio/LCIOSDTestActions.cpp b/DDG4/lcio/LCIOSDTestActions.cpp index 1603f814b..b69af910a 100644 --- a/DDG4/lcio/LCIOSDTestActions.cpp +++ b/DDG4/lcio/LCIOSDTestActions.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,8 +27,8 @@ #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" -using namespace DD4hep::Simulation; -using namespace DD4hep; +using namespace dd4hep::sim; +using namespace dd4hep; /// Test namespace. namespace Tests { @@ -54,8 +53,8 @@ namespace Tests { public: // typedef SimpleHit::Contribution HitContribution; // Standard , initializing constructor - Geant4SensitiveAction(Geant4Context* ctxt, const std::string& nam, DetElement det, LCDD& lcdd_ref) - : Geant4Sensitive(ctxt,nam,det,lcdd_ref), m_collectionID(0) { + Geant4SensitiveAction(Geant4Context* ctxt, const std::string& nam, DetElement det, Detector& description_ref) + : Geant4Sensitive(ctxt,nam,det,description_ref), m_collectionID(0) { declareProperty("detailedHitsStoring", _detailedHitsStoring ) ; defineCollections(); InstanceCount::increment(this); @@ -104,7 +103,7 @@ namespace Tests { /// Method for generating hit(s) using the information of G4Step object. template <> bool Geant4SensitiveAction<LcioTestTracker>::process(G4Step* step,G4TouchableHistory* /*hist*/ ) { - StepHandler h(step); + Geant4StepHandler h(step); Position prePos = h.prePos(); Position postPos = h.postPos(); diff --git a/DDG4/lcio/LCIOStdHepReader.cpp b/DDG4/lcio/LCIOStdHepReader.cpp index f65c78435..10a728864 100644 --- a/DDG4/lcio/LCIOStdHepReader.cpp +++ b/DDG4/lcio/LCIOStdHepReader.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,10 +20,10 @@ #include "LCIOEventReader.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to read StdHep files with lcio /** @@ -49,12 +48,12 @@ namespace DD4hep { }; } /* End namespace lcio */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_DDG4_LCIOSTDHEPREADER_H */ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -70,9 +69,9 @@ namespace DD4hep { #include "DDG4/Factories.h" // Factory entry -DECLARE_GEANT4_EVENT_READER_NS(DD4hep::Simulation,LCIOStdHepReader) +DECLARE_GEANT4_EVENT_READER_NS(dd4hep::sim,LCIOStdHepReader) -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Initializing constructor LCIOStdHepReader::LCIOStdHepReader(const std::string& nam) @@ -82,7 +81,7 @@ LCIOStdHepReader::LCIOStdHepReader(const std::string& nam) /// Default destructor LCIOStdHepReader::~LCIOStdHepReader() { - DD4hep::deletePtr(m_reader); + dd4hep::detail::deletePtr(m_reader); } diff --git a/DDG4/legacy/Geant4CalorimeterSD.cpp b/DDG4/legacy/Geant4CalorimeterSD.cpp index ca9ca277f..e4fef9054 100644 --- a/DDG4/legacy/Geant4CalorimeterSD.cpp +++ b/DDG4/legacy/Geant4CalorimeterSD.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,12 +21,12 @@ #include "G4VProcess.hh" using namespace std; -using namespace DD4hep::Geometry; +using namespace dd4hep::detail; /* - * DD4hep::Simulation namespace declaration + * dd4hep::sim namespace declaration */ -namespace DD4hep { namespace Simulation { +namespace dd4hep { namespace sim { /// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /// Geant4GenericSD<Calorimeter> @@ -51,14 +51,14 @@ namespace DD4hep { namespace Simulation { return true; } typedef Geant4GenericSD<Calorimeter> Geant4Calorimeter; - }} // End namespace DD4hep::Simulation + }} // End namespace dd4hep::sim -DECLARE_GEANT4SENSITIVEDETECTOR_NS(DD4hep::Simulation,Geant4Calorimeter) +DECLARE_GEANT4SENSITIVEDETECTOR_NS(dd4hep::sim,Geant4Calorimeter) /* - * DD4hep::Simulation namespace declaration + * dd4hep::sim namespace declaration */ -namespace DD4hep { namespace Simulation { +namespace dd4hep { namespace sim { /// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /// Geant4GenericSD<OpticalCalorimeter> @@ -68,8 +68,8 @@ namespace DD4hep { namespace Simulation { template <> class Geant4GenericSD<OpticalCalorimeter> : public Geant4GenericSD<Calorimeter> { public: /// Constructor. The sensitive detector element is identified by the detector name - Geant4GenericSD(const string& nam, LCDD& lcdd_ref) - : Geant4GenericSD<Calorimeter>(nam,lcdd_ref) { } + Geant4GenericSD(const string& nam, Detector& description_ref) + : Geant4GenericSD<Calorimeter>(nam,description_ref) { } /// Initialize the sensitive detector for the usage of a single hit collection bool defineCollection(const string& coll_name) { @@ -107,6 +107,6 @@ namespace DD4hep { namespace Simulation { } }; typedef Geant4GenericSD<OpticalCalorimeter> Geant4OpticalCalorimeter; - }} // End namespace DD4hep::Simulation + }} // End namespace dd4hep::sim -DECLARE_GEANT4SENSITIVEDETECTOR_NS(DD4hep::Simulation,Geant4OpticalCalorimeter) +DECLARE_GEANT4SENSITIVEDETECTOR_NS(dd4hep::sim,Geant4OpticalCalorimeter) diff --git a/DDG4/legacy/Geant4TrackerCombineSD.cpp b/DDG4/legacy/Geant4TrackerCombineSD.cpp index 958e7270f..706af1fc7 100644 --- a/DDG4/legacy/Geant4TrackerCombineSD.cpp +++ b/DDG4/legacy/Geant4TrackerCombineSD.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,9 +17,9 @@ #include "DDG4/Factories.h" /* - * DD4hep::Simulation namespace declaration + * dd4hep::sim namespace declaration */ -namespace DD4hep { namespace Simulation { +namespace dd4hep { namespace sim { /// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /// Geant4GenericSD<TrackerCombine> @@ -116,6 +116,6 @@ namespace DD4hep { namespace Simulation { return return_code; } typedef Geant4GenericSD<TrackerCombine> Geant4TrackerCombine; - }} // End namespace DD4hep::Simulation + }} // End namespace dd4hep::sim -DECLARE_GEANT4SENSITIVEDETECTOR_NS(DD4hep::Simulation,Geant4TrackerCombine) +DECLARE_GEANT4SENSITIVEDETECTOR_NS(dd4hep::sim,Geant4TrackerCombine) diff --git a/DDG4/legacy/Geant4TrackerSD.cpp b/DDG4/legacy/Geant4TrackerSD.cpp index 12a9c29f8..bb5276087 100644 --- a/DDG4/legacy/Geant4TrackerSD.cpp +++ b/DDG4/legacy/Geant4TrackerSD.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,9 +22,9 @@ #include <stdexcept> /* - * DD4hep::Simulation namespace declaration + * dd4hep::sim namespace declaration */ -namespace DD4hep { namespace Simulation { +namespace dd4hep { namespace sim { /// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /// Geant4GenericSD<Tracker> @@ -65,6 +65,6 @@ namespace DD4hep { namespace Simulation { throw std::runtime_error("new() failed: Cannot allocate hit object"); } typedef Geant4GenericSD<Tracker> Geant4Tracker; - }} // End namespace DD4hep::Simulation + }} // End namespace dd4hep::sim -DECLARE_GEANT4SENSITIVEDETECTOR_NS(DD4hep::Simulation,Geant4Tracker) +DECLARE_GEANT4SENSITIVEDETECTOR_NS(dd4hep::sim,Geant4Tracker) diff --git a/DDG4/plugins/Geant4.10.PhysicsConstructors.h b/DDG4/plugins/Geant4.10.PhysicsConstructors.h index 49422095d..6daf19edc 100644 --- a/DDG4/plugins/Geant4.10.PhysicsConstructors.h +++ b/DDG4/plugins/Geant4.10.PhysicsConstructors.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/plugins/Geant4.9.PhysicsConstructors.h b/DDG4/plugins/Geant4.9.PhysicsConstructors.h index 9b29920ef..c1520771e 100644 --- a/DDG4/plugins/Geant4.9.PhysicsConstructors.h +++ b/DDG4/plugins/Geant4.9.PhysicsConstructors.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/plugins/Geant4DefaultRangeCut.cpp b/DDG4/plugins/Geant4DefaultRangeCut.cpp index da9dc7417..47de5a7b1 100644 --- a/DDG4/plugins/Geant4DefaultRangeCut.cpp +++ b/DDG4/plugins/Geant4DefaultRangeCut.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -35,10 +35,10 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Geant4 physics list action to set global range cuts for secondary productions /** @@ -76,5 +76,5 @@ namespace DD4hep { #endif // DDG4_Geant4DefaultRangeCut_h #include "DDG4/Factories.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; DECLARE_GEANT4ACTION(Geant4DefaultRangeCut) diff --git a/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp b/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp index 319fb02aa..7a4f80c93 100644 --- a/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp +++ b/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,14 +16,14 @@ #include "DDG4/Geant4DetectorConstruction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Class to create Geant4 detector geometry from TGeo representation in memory /** - * On demand (ie. when calling "Construct") the DD4hep geometry is converted + * On demand (ie. when calling "Construct") the dd4hep geometry is converted * to Geant4 with all volumes, assemblies, shapes, materials etc. * The actuak work is performed by the Geant4Converter class called by this method. * @@ -63,14 +63,14 @@ namespace DD4hep { /// Geometry construction callback. Called at "Construct()" void constructGeo(Geant4DetectorConstructionContext* ctxt); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep // Framework include files #include "DD4hep/InstanceCount.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Geant4HierarchyDump.h" #include "DDG4/Geant4Converter.h" @@ -84,8 +84,8 @@ namespace DD4hep { #endif using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; DECLARE_GEANT4ACTION(Geant4DetectorGeometryConstruction) /// Initializing constructor for other clients @@ -115,8 +115,8 @@ Geant4DetectorGeometryConstruction::~Geant4DetectorGeometryConstruction() { /// Geometry construction callback. Called at "Construct()" void Geant4DetectorGeometryConstruction::constructGeo(Geant4DetectorConstructionContext* ctxt) { Geant4Mapping& g4map = Geant4Mapping::instance(); - Geometry::DetElement world = ctxt->lcdd.world(); - Geant4Converter conv(ctxt->lcdd, outputLevel()); + DetElement world = ctxt->description.world(); + Geant4Converter conv(ctxt->description, outputLevel()); conv.debugMaterials = m_debugMaterials; conv.debugElements = m_debugElements; conv.debugShapes = m_debugShapes; @@ -130,7 +130,7 @@ void Geant4DetectorGeometryConstruction::constructGeo(Geant4DetectorConstruction // Create Geant4 volume manager only if not yet available g4map.volumeManager(); if ( m_dumpHierarchy ) { - Geant4HierarchyDump dmp(ctxt->lcdd); + Geant4HierarchyDump dmp(ctxt->description); dmp.dump("",w); } #ifdef GEANT4_HAS_GDML diff --git a/DDG4/plugins/Geant4DetectorSensitivesConstruction.cpp b/DDG4/plugins/Geant4DetectorSensitivesConstruction.cpp index df4d61f16..afd3c54db 100644 --- a/DDG4/plugins/Geant4DetectorSensitivesConstruction.cpp +++ b/DDG4/plugins/Geant4DetectorSensitivesConstruction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,10 +16,10 @@ #include "DDG4/Geant4DetectorConstruction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Class to create Geant4 detector geometry from TGeo representation in memory /** @@ -41,15 +41,15 @@ namespace DD4hep { /// Sensitives construction callback. Called at "ConstructSDandField()" void constructSensitives(Geant4DetectorConstructionContext* ctxt); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep // Framework include files #include "DD4hep/InstanceCount.h" #include "DD4hep/Printout.h" #include "DD4hep/Plugins.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Geant4Mapping.h" #include "DDG4/Factories.h" @@ -62,8 +62,8 @@ namespace DD4hep { #include "G4VSensitiveDetector.hh" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; DECLARE_GEANT4ACTION(Geant4DetectorSensitivesConstruction) @@ -81,24 +81,20 @@ Geant4DetectorSensitivesConstruction::~Geant4DetectorSensitivesConstruction() { /// Sensitive detector construction callback. Called at "ConstructSDandField()" void Geant4DetectorSensitivesConstruction::constructSensitives(Geant4DetectorConstructionContext* ctxt) { - typedef Geometry::GeoHandlerTypes::SensitiveVolumes _SV; - typedef Geometry::GeoHandlerTypes::ConstVolumeSet VolSet; Geant4GeometryInfo* p = Geant4Mapping::instance().ptr(); - _SV& vols = p->sensitives; - - for(_SV::const_iterator iv=vols.begin(); iv != vols.end(); ++iv) { - Geometry::SensitiveDetector sd = (*iv).first; + for(const auto& iv : p->sensitives ) { + SensitiveDetector sd = iv.first; string typ = sd.type(), nam = sd.name(); G4VSensitiveDetector* g4sd = - PluginService::Create<G4VSensitiveDetector*>(typ, nam, &ctxt->lcdd); + PluginService::Create<G4VSensitiveDetector*>(typ, nam, &ctxt->description); if (!g4sd) { string tmp = typ; tmp[0] = ::toupper(tmp[0]); typ = "Geant4" + tmp; - g4sd = PluginService::Create<G4VSensitiveDetector*>(typ, nam, &ctxt->lcdd); + g4sd = PluginService::Create<G4VSensitiveDetector*>(typ, nam, &ctxt->description); if ( !g4sd ) { PluginDebug dbg; - g4sd = PluginService::Create<G4VSensitiveDetector*>(typ, nam, &ctxt->lcdd); + g4sd = PluginService::Create<G4VSensitiveDetector*>(typ, nam, &ctxt->description); if ( !g4sd ) { throw runtime_error("ConstructSDandField: FATAL Failed to " "create Geant4 sensitive detector " + nam + @@ -108,9 +104,7 @@ void Geant4DetectorSensitivesConstruction::constructSensitives(Geant4DetectorCon } g4sd->Activate(true); G4SDManager::GetSDMpointer()->AddNewDetector(g4sd); - const VolSet& sens_vols = (*iv).second; - for(VolSet::const_iterator i=sens_vols.begin(); i!= sens_vols.end(); ++i) { - const TGeoVolume* vol = *i; + for(const TGeoVolume* vol : iv.second ) { G4LogicalVolume* g4v = p->g4Volumes[vol]; if ( !g4v ) { throw runtime_error("ConstructSDandField: Failed to access G4LogicalVolume for SD "+ @@ -119,5 +113,5 @@ void Geant4DetectorSensitivesConstruction::constructSensitives(Geant4DetectorCon ctxt->setSensitiveDetector(g4v,g4sd); } } - print("Geant4Converter", "++ Handled %ld sensitive detectors.",vols.size()); + print("Geant4Converter", "++ Handled %ld sensitive detectors.",p->sensitives.size()); } diff --git a/DDG4/plugins/Geant4EscapeCounter.cpp b/DDG4/plugins/Geant4EscapeCounter.cpp index 60d17ff59..411c86e6f 100644 --- a/DDG4/plugins/Geant4EscapeCounter.cpp +++ b/DDG4/plugins/Geant4EscapeCounter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,15 +14,15 @@ #define DD4HEP_DDG4_GEANT4ESCAPECOUNTER_H // Framework include files -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DDG4/Geant4SensDetAction.h" #include "DDG4/Geant4SteppingAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Class to measure the energy of escaping tracks /** Class to measure the energy of escaping tracks of a detector using Geant 4 @@ -39,20 +39,20 @@ namespace DD4hep { std::vector<std::string> m_detectorNames; public: /// Standard constructor - Geant4EscapeCounter(Geant4Context* ctxt, const std::string& name, DetElement det, LCDD& lcdd); + Geant4EscapeCounter(Geant4Context* ctxt, const std::string& name, DetElement det, Detector& description); /// Default destructor virtual ~Geant4EscapeCounter(); /// G4VSensitiveDetector interface: Method for generating hit(s) using the information of G4Step object. virtual bool process(G4Step* step, G4TouchableHistory* history) override; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4ESCAPECOUNTER_H */ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -76,12 +76,12 @@ namespace DD4hep { #include "G4VProcess.hh" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Standard constructor -Geant4EscapeCounter::Geant4EscapeCounter(Geant4Context* ctxt, const string& nam, DetElement det, LCDD& lcdd_ref) - : Geant4Sensitive(ctxt, nam, det, lcdd_ref) +Geant4EscapeCounter::Geant4EscapeCounter(Geant4Context* ctxt, const string& nam, DetElement det, Detector& description_ref) + : Geant4Sensitive(ctxt, nam, det, description_ref) { string coll_name = name()+"Hits"; m_needsControl = true; @@ -102,8 +102,8 @@ bool Geant4EscapeCounter::process(G4Step* step, G4TouchableHistory* /* history * Geant4TouchableHandler handler(step); string hdlr_path = handler.path(); Position prePos = h.prePos(); - HitCollection* coll = collection(m_collectionID); - SimpleTracker::Hit* hit = new SimpleTracker::Hit(th.id(),th.pdgID(),h.deposit(),th.time()); + Geant4HitCollection* coll = collection(m_collectionID); + SimpleTracker::Hit* hit = new SimpleTracker::Hit(th.id(),th.pdgID(),h.deposit(),th.time()); hit->cellID = volumeID(step); hit->energyDeposit = th.energy(); hit->position = prePos; diff --git a/DDG4/plugins/Geant4EventReaderGuineaPig.cpp b/DDG4/plugins/Geant4EventReaderGuineaPig.cpp index f01d6d878..fea7aa2f1 100644 --- a/DDG4/plugins/Geant4EventReaderGuineaPig.cpp +++ b/DDG4/plugins/Geant4EventReaderGuineaPig.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include <fstream> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /** * Reader for ascii files with e+e- pairs created from GuineaPig. @@ -52,8 +52,8 @@ namespace DD4hep { virtual EventReaderStatus skipEvent() override { return EVENT_READER_OK; } virtual EventReaderStatus setParameters( std::map< std::string, std::string > & parameters ) override ; }; - } /* End namespace Simulation */ -} /* End namespace DD4hep */ + } /* End namespace sim */ +} /* End namespace dd4hep */ // Framework include files @@ -67,8 +67,8 @@ namespace DD4hep { using namespace std; using namespace CLHEP; -using namespace DD4hep::Simulation; -typedef DD4hep::ReferenceBitMask<int> PropertyMask; +using namespace dd4hep::sim; +typedef dd4hep::detail::ReferenceBitMask<int> PropertyMask; // Factory entry DECLARE_GEANT4_EVENT_READER(Geant4EventReaderGuineaPig) @@ -109,7 +109,7 @@ Geant4EventReader::EventReaderStatus Geant4EventReaderGuineaPig::moveToEvent(int event_number) { printout(DEBUG,"EventReader"," move to event_number: %d , m_currEvent %d", - event_number,m_currEvent ) ; + event_number,m_currEvent ) ; if( m_currEvent == 0 && event_number > 0 ){ @@ -128,15 +128,15 @@ Geant4EventReaderGuineaPig::moveToEvent(int event_number) { // First check the input file status if ( !m_input.good() || m_input.eof() ) { - return EVENT_READER_IO_ERROR; + return EVENT_READER_IO_ERROR; } for (unsigned i = 0; i<nSkipParticles; ++i){ - if (m_input.ignore(numeric_limits<streamsize>::max(), m_input.widen('\n'))){ - //just skipping the line - } - else - return EVENT_READER_IO_ERROR ; + if (m_input.ignore(numeric_limits<streamsize>::max(), m_input.widen('\n'))){ + //just skipping the line + } + else + return EVENT_READER_IO_ERROR ; } } } @@ -148,8 +148,8 @@ Geant4EventReaderGuineaPig::moveToEvent(int event_number) { /// Read an event and fill a vector of MCParticles. Geant4EventReader::EventReaderStatus Geant4EventReaderGuineaPig::readParticles(int /* event_number */, - Vertices& vertices, - vector<Particle*>& particles) { + Vertices& vertices, + vector<Particle*>& particles) { // if no number of particles per event set, we will read the whole file @@ -183,17 +183,17 @@ Geant4EventReaderGuineaPig::readParticles(int /* event_number */, for( int counter = 0; counter < m_part_num ; ++counter ){ m_input >> Energy - >> betaX >> betaY >> betaZ - >> posX >> posY >> posZ ; + >> betaX >> betaY >> betaZ + >> posX >> posY >> posZ ; if( std::isnan( Energy ) || - std::isnan( betaX ) || - std::isnan( betaY ) || - std::isnan( betaZ ) || - std::isnan( posX ) || - std::isnan( posY ) || - std::isnan( posZ ) ){ + std::isnan( betaX ) || + std::isnan( betaY ) || + std::isnan( betaZ ) || + std::isnan( posX ) || + std::isnan( posY ) || + std::isnan( posZ ) ){ printout(WARNING,"EventReader","### Read line with 'nan' entries - particle will be ignored ! " ) ; @@ -204,12 +204,12 @@ Geant4EventReaderGuineaPig::readParticles(int /* event_number */, if( m_input.eof() ) { if( counter==0 ) { - return EVENT_READER_IO_ERROR ; // reading first particle of event failed + return EVENT_READER_IO_ERROR ; // reading first particle of event failed } else{ - ++m_currEvent; - return EVENT_READER_OK ; // simply EOF + ++m_currEvent; + return EVENT_READER_OK ; // simply EOF } } diff --git a/DDG4/plugins/Geant4EventReaderHepEvt.cpp b/DDG4/plugins/Geant4EventReaderHepEvt.cpp index 6cfea5313..02bf25b1b 100644 --- a/DDG4/plugins/Geant4EventReaderHepEvt.cpp +++ b/DDG4/plugins/Geant4EventReaderHepEvt.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include <fstream> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Class to populate Geant4 primaries from StdHep files. /** @@ -51,11 +51,11 @@ namespace DD4hep { virtual EventReaderStatus moveToEvent(int event_number); virtual EventReaderStatus skipEvent() { return EVENT_READER_OK; } }; - } /* End namespace Simulation */ -} /* End namespace DD4hep */ + } /* End namespace sim */ +} /* End namespace dd4hep */ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -79,8 +79,8 @@ namespace DD4hep { using namespace std; using namespace CLHEP; -using namespace DD4hep::Simulation; -typedef DD4hep::ReferenceBitMask<int> PropertyMask; +using namespace dd4hep::sim; +typedef dd4hep::detail::ReferenceBitMask<int> PropertyMask; #define HEPEvtShort 1 #define HEPEvtLong 2 @@ -137,8 +137,8 @@ Geant4EventReaderHepEvt::moveToEvent(int event_number) { std::vector<Particle*> particles; Vertices vertices ; EventReaderStatus sc = readParticles(m_currEvent,vertices,particles); - for_each(vertices.begin(),vertices.end(),deleteObject<Vertex>); - for_each(particles.begin(),particles.end(),deleteObject<Particle>); + for_each(vertices.begin(),vertices.end(),detail::deleteObject<Vertex>); + for_each(particles.begin(),particles.end(),detail::deleteObject<Particle>); if ( sc != EVENT_READER_OK ) return sc; //Current event is increased in readParticles already! // ++m_currEvent; diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp index 454fba280..7ee8d7701 100644 --- a/DDG4/plugins/Geant4EventReaderHepMC.cpp +++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ // C/C++ include files /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { namespace HepMC { class EventStream; } /// Class to populate Geant4 primaries from StdHep files. @@ -54,11 +54,11 @@ namespace DD4hep { virtual EventReaderStatus skipEvent() override { return EVENT_READER_OK; } }; - } /* End namespace Simulation */ -} /* End namespace DD4hep */ + } /* End namespace sim */ +} /* End namespace dd4hep */ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // //==================================================================== @@ -77,17 +77,17 @@ namespace DD4hep { using namespace std; using namespace CLHEP; -using namespace DD4hep::Simulation; -typedef DD4hep::ReferenceBitMask<int> PropertyMask; +using namespace dd4hep::sim; +typedef dd4hep::detail::ReferenceBitMask<int> PropertyMask; // Factory entry DECLARE_GEANT4_EVENT_READER(Geant4EventReaderHepMC) /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { namespace HepMC { @@ -219,7 +219,7 @@ Geant4EventReaderHepMC::readParticles(int /* ev_id */, Position pos(primary_vertex->x,primary_vertex->y,primary_vertex->z); output.reserve(parts.size()); - transform(parts.begin(),parts.end(),back_inserter(output),reference2nd(parts)); + transform(parts.begin(),parts.end(),back_inserter(output),detail::reference2nd(parts)); m_events->clear(); if (pos.mag2() > numeric_limits<double>::epsilon() ) { for(Particles::iterator k=output.begin(); k != output.end(); ++k) { @@ -626,8 +626,8 @@ bool HepMC::EventStream::ok() const { } void HepMC::EventStream::clear() { - releaseObjects(m_vertices); - releaseObjects(m_particles); + detail::releaseObjects(m_vertices); + detail::releaseObjects(m_particles); } bool HepMC::EventStream::read() { @@ -636,8 +636,8 @@ bool HepMC::EventStream::read() { static int num_evt = 0; int num_line = 0, num_line_accepted = 0; - releaseObjects(vertices()); - releaseObjects(particles()); + detail::releaseObjects(vertices()); + detail::releaseObjects(particles()); ++num_evt; if ( num_evt == 998 ) { @@ -748,8 +748,8 @@ bool HepMC::EventStream::read() { continue; Skip: printout(WARNING,"HepMC::EventStream","+++ Skip event with ID: %d",this->header.id); - releaseObjects(vertices()); - releaseObjects(particles()); + detail::releaseObjects(vertices()); + detail::releaseObjects(particles()); read_until_event_end(instream); event_read = false; if ( instream.eof() ) return false; @@ -758,6 +758,6 @@ bool HepMC::EventStream::read() { if( not instream.good() ) return false; Done: fix_particles(info); - releaseObjects(vertices()); + detail::releaseObjects(vertices()); return true; } diff --git a/DDG4/plugins/Geant4EventSeed.cpp b/DDG4/plugins/Geant4EventSeed.cpp index 87ade680d..65960cbdd 100644 --- a/DDG4/plugins/Geant4EventSeed.cpp +++ b/DDG4/plugins/Geant4EventSeed.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,7 +28,7 @@ #include <G4Run.hh> #include <G4Event.hh> -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4EventSeed::Geant4EventSeed(Geant4Context* c, const std::string& typ) : Geant4RunAction(c, typ), @@ -57,7 +57,7 @@ void Geant4EventSeed::begin(const G4Run* run) { m_runID = run->GetRunID(); - DD4hep::printout( DD4hep::INFO, m_type, "Get RunID: runID=%u", m_runID ); + dd4hep::printout( dd4hep::INFO, m_type, "Get RunID: runID=%u", m_runID ); } @@ -69,13 +69,13 @@ void Geant4EventSeed::beginEvent(const G4Event* evt) { unsigned int eventID = evt->GetEventID(); unsigned int newSeed = hash( m_initialSeed, eventID, m_runID ); - DD4hep::printout( DD4hep::INFO, m_type, + dd4hep::printout( dd4hep::INFO, m_type, "At beginEvent: eventID=%u, runID=%u initialSeed=%u, newSeed=%u" , evt->GetEventID(), m_runID, m_initialSeed, newSeed ); rndm->setSeed( newSeed ); - if ( DD4hep::printLevel() <= DD4hep::DEBUG ) { + if ( dd4hep::printLevel() <= dd4hep::DEBUG ) { rndm->showStatus(); } diff --git a/DDG4/plugins/Geant4ExtraParticles.cpp b/DDG4/plugins/Geant4ExtraParticles.cpp index aaab732c9..6d874e6f0 100644 --- a/DDG4/plugins/Geant4ExtraParticles.cpp +++ b/DDG4/plugins/Geant4ExtraParticles.cpp @@ -36,7 +36,7 @@ #include "G4RunManager.hh" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; Geant4ExtraParticles::Geant4ExtraParticles(Geant4Context* ctxt, const std::string& nam) : Geant4PhysicsConstructor(ctxt, nam), m_decay(0), m_ionise(0), m_scatter(0) @@ -45,9 +45,9 @@ Geant4ExtraParticles::Geant4ExtraParticles(Geant4Context* ctxt, const std::strin } Geant4ExtraParticles::~Geant4ExtraParticles() { - deletePtr(m_decay); - deletePtr(m_ionise); - deletePtr(m_scatter); + detail::deletePtr(m_decay); + detail::deletePtr(m_ionise); + detail::deletePtr(m_scatter); } // bool Geant4ExtraParticles::FileExists() { diff --git a/DDG4/plugins/Geant4ExtraParticles.h b/DDG4/plugins/Geant4ExtraParticles.h index 6c39260a1..d220cdf1f 100644 --- a/DDG4/plugins/Geant4ExtraParticles.h +++ b/DDG4/plugins/Geant4ExtraParticles.h @@ -19,10 +19,10 @@ #include "G4ParticleTable.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { class Geant4ExtraParticles : public Geant4PhysicsConstructor { public: diff --git a/DDG4/plugins/Geant4Factories.cpp b/DDG4/plugins/Geant4Factories.cpp index 77e48b742..a0a95ce7a 100644 --- a/DDG4/plugins/Geant4Factories.cpp +++ b/DDG4/plugins/Geant4Factories.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ // Framework include files #include "DDG4/Factories.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; #include "DDG4/Geant4Random.h" DECLARE_GEANT4ACTION(Geant4Random) @@ -127,10 +127,10 @@ DECLARE_GEANT4ACTION(Geant4GeneratorWrapper) //============================= #include "DDG4/Geant4TestActions.h" -namespace DD4hep { namespace Simulation { +namespace dd4hep { namespace sim { namespace Test {} //using namespace Test; - using namespace DD4hep::Simulation::Test; + using namespace dd4hep::sim::Test; typedef Geant4TestSensitive Geant4TestSensitiveTracker; typedef Geant4TestSensitive Geant4TestSensitiveCalorimeter; }} diff --git a/DDG4/plugins/Geant4FieldTrackingSetup.cpp b/DDG4/plugins/Geant4FieldTrackingSetup.cpp index b80c0de67..14ac6ecda 100644 --- a/DDG4/plugins/Geant4FieldTrackingSetup.cpp +++ b/DDG4/plugins/Geant4FieldTrackingSetup.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,15 +15,15 @@ #define DD4HEP_DDG4_GEANT4FIELDTRACKINGSETUP_H 1 // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Geant4ActionPhase.h" #include "DDG4/Geant4DetectorConstruction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Generic Setup component to perform the magnetic field tracking in Geant4 /** Geant4FieldTrackingSetup. @@ -65,7 +65,7 @@ namespace DD4hep { /// Default destructor virtual ~Geant4FieldTrackingSetup(); /// Perform the setup of the magnetic field tracking in Geant4 - virtual int execute(Geometry::LCDD& lcdd); + virtual int execute(Detector& description); }; /// Phase action to perform the setup of the Geant4 tracking in magnetic fields @@ -85,13 +85,10 @@ namespace DD4hep { public: /// Standard constructor Geant4FieldTrackingSetupAction(Geant4Context* context, const std::string& nam); - /// Default destructor virtual ~Geant4FieldTrackingSetupAction() {} - /// Phase action callback void operator()(); - }; /// Detector construction action to perform the setup of the Geant4 tracking in magnetic fields @@ -119,14 +116,14 @@ namespace DD4hep { void operator()(); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4FIELDTRACKINGSETUP_H // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -154,9 +151,8 @@ namespace DD4hep { using namespace std; using namespace CLHEP; -using namespace DD4hep; -using namespace DD4hep::Simulation; -typedef DD4hep::Geometry::LCDD lcdd_t; +using namespace dd4hep; +using namespace dd4hep::sim; /// Local declaration in anonymous namespace namespace { @@ -170,7 +166,7 @@ namespace { }; string Geant4SetupPropertyMap::value(const string& key) const { - lcdd_t::PropertyValues::const_iterator iV = vals.find(key); + Detector::PropertyValues::const_iterator iV = vals.find(key); return iV == vals.end() ? "" : (*iV).second; } @@ -196,9 +192,9 @@ Geant4FieldTrackingSetup::~Geant4FieldTrackingSetup() { } /// Perform the setup of the magnetic field tracking in Geant4 -int Geant4FieldTrackingSetup::execute(Geometry::LCDD& lcdd) { - Geometry::OverlayedField fld = lcdd.field(); - G4MagneticField* mag_field = new Simulation::Geant4Field(fld); +int Geant4FieldTrackingSetup::execute(Detector& description) { + OverlayedField fld = description.field(); + G4MagneticField* mag_field = new sim::Geant4Field(fld); G4Mag_EqRhs* mag_equation = PluginService::Create<G4Mag_EqRhs*>(eq_typ,mag_field); G4MagIntegratorStepper* fld_stepper = PluginService::Create<G4MagIntegratorStepper*>(stepper_typ,mag_equation); G4ChordFinder* chordFinder = new G4ChordFinder(mag_field,min_chord_step,fld_stepper); @@ -228,11 +224,11 @@ int Geant4FieldTrackingSetup::execute(Geometry::LCDD& lcdd) { return 1; } -static long setup_fields(lcdd_t& lcdd, const DD4hep::Geometry::GeoHandler& /* cnv */, const map<string,string>& vals) { +static long setup_fields(Detector& description, const dd4hep::detail::GeoHandler& /* cnv */, const map<string,string>& vals) { struct XMLFieldTrackingSetup : public Geant4FieldTrackingSetup { XMLFieldTrackingSetup(const map<string,string>& values) : Geant4FieldTrackingSetup() { Geant4SetupPropertyMap pm(values); - lcdd_t::PropertyValues::const_iterator iV = values.find("min_chord_step"); + Detector::PropertyValues::const_iterator iV = values.find("min_chord_step"); eq_typ = pm.value("equation"); stepper_typ = pm.value("stepper"); min_chord_step = _toDouble((iV==values.end()) ? string("1e-2 * mm") : (*iV).second); @@ -245,7 +241,7 @@ static long setup_fields(lcdd_t& lcdd, const DD4hep::Geometry::GeoHandler& /* cn } virtual ~XMLFieldTrackingSetup() {} } setup(vals); - return setup.execute(lcdd); + return setup.execute(description); } /// Standard constructor @@ -265,7 +261,7 @@ Geant4FieldTrackingSetupAction::Geant4FieldTrackingSetupAction(Geant4Context* ct /// Post-track action callback void Geant4FieldTrackingSetupAction::operator()() { - execute(context()->lcdd()); + execute(context()->detectorDescription()); printout( INFO, "FieldSetup", "Geant4 magnetic field tracking configured."); printout( INFO, "FieldSetup", "G4MagIntegratorStepper:%s G4Mag_EqRhs:%s", stepper_typ.c_str(), eq_typ.c_str()); @@ -292,7 +288,7 @@ Geant4FieldTrackingConstruction::Geant4FieldTrackingConstruction(Geant4Context* /// Post-track action callback void Geant4FieldTrackingConstruction::operator()() { - execute(context()->lcdd()); + execute(context()->detectorDescription()); printout( INFO, "FieldSetup", "Geant4 magnetic field tracking configured."); printout( INFO, "FieldSetup", "G4MagIntegratorStepper:%s G4Mag_EqRhs:%s", stepper_typ.c_str(), eq_typ.c_str()); diff --git a/DDG4/plugins/Geant4HitDumpAction.cpp b/DDG4/plugins/Geant4HitDumpAction.cpp index ba631f582..f9e75bd1b 100644 --- a/DDG4/plugins/Geant4HitDumpAction.cpp +++ b/DDG4/plugins/Geant4HitDumpAction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ class G4VHitsCollection; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4ParticleMap; @@ -56,13 +56,13 @@ namespace DD4hep { virtual void end(const G4Event* event) override; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4HITDUMPACTION_H */ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -84,8 +84,8 @@ namespace DD4hep { #include "G4Event.hh" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Standard constructor Geant4HitDumpAction::Geant4HitDumpAction(Geant4Context* ctxt, const string& nam) diff --git a/DDG4/plugins/Geant4HitExtractor.cpp b/DDG4/plugins/Geant4HitExtractor.cpp index 7379fb0f8..cce859bec 100644 --- a/DDG4/plugins/Geant4HitExtractor.cpp +++ b/DDG4/plugins/Geant4HitExtractor.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,13 +14,13 @@ // Framework include files #include "DDG4/Geant4Data.h" -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the DD4hep event display specializations + /// Namespace for the dd4hep event display specializations namespace DDEve { /// SimulationHit definition @@ -56,7 +56,7 @@ namespace DD4hep { /// Hit conversion function \ingroup DD4HEP_EVE static void* _convertHitCollection(const char* source) { - typedef DD4hep::DDEve::SimulationHit SimulationHit; + typedef dd4hep::DDEve::SimulationHit SimulationHit; const std::vector<SimpleHit*>* c = (std::vector<SimpleHit*>*)source; std::vector<SimulationHit>* pv = new std::vector<SimulationHit>(); if ( source && c->size() > 0 ) { @@ -77,5 +77,5 @@ static void* _convertHitCollection(const char* source) { } #include "DD4hep/Factories.h" -using namespace DD4hep::Geometry; +using namespace dd4hep::detail; DECLARE_CONSTRUCTOR(DDEve_DDG4CollectionAccess,_convertHitCollection) diff --git a/DDG4/plugins/Geant4HitTruthHandler.cpp b/DDG4/plugins/Geant4HitTruthHandler.cpp index 1cdf5efd9..f7d51ddec 100644 --- a/DDG4/plugins/Geant4HitTruthHandler.cpp +++ b/DDG4/plugins/Geant4HitTruthHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ class G4VHitsCollection; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4ParticleMap; @@ -53,13 +53,13 @@ namespace DD4hep { virtual void end(const G4Event* event) override; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4HITTRUTHHANDLER_H */ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -81,8 +81,8 @@ namespace DD4hep { #include "G4Event.hh" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Standard constructor Geant4HitTruthHandler::Geant4HitTruthHandler(Geant4Context* ctxt, const string& nam) diff --git a/DDG4/plugins/Geant4MaterialScanner.cpp b/DDG4/plugins/Geant4MaterialScanner.cpp index 0594bf7bd..a820a37e9 100644 --- a/DDG4/plugins/Geant4MaterialScanner.cpp +++ b/DDG4/plugins/Geant4MaterialScanner.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ class G4LogicalVolume; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Class to perform directional material scans using Geantinos. /** @@ -77,7 +77,7 @@ namespace DD4hep { // $Id: $ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : M.Frank @@ -96,7 +96,7 @@ namespace DD4hep { #include "G4Material.hh" using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; #include "DDG4/Factories.h" DECLARE_GEANT4ACTION(Geant4MaterialScanner) @@ -152,7 +152,7 @@ void Geant4MaterialScanner::operator()(const G4Step* step, G4SteppingManager*) { /// Registered callback on Begin-event void Geant4MaterialScanner::beginEvent(const G4Event* /* event */) { - for_each(m_steps.begin(),m_steps.end(),DestroyObject<StepInfo*>()); + for_each(m_steps.begin(),m_steps.end(),detail::DestroyObject<StepInfo*>()); m_steps.clear(); m_sumX0 = 0; m_sumLambda = 0; @@ -162,7 +162,7 @@ void Geant4MaterialScanner::beginEvent(const G4Event* /* event */) { /// Begin-of-tracking callback void Geant4MaterialScanner::begin(const G4Track* track) { printP2("Starting tracking action for track ID=%d",track->GetTrackID()); - for_each(m_steps.begin(),m_steps.end(),DestroyObject<StepInfo*>()); + for_each(m_steps.begin(),m_steps.end(),detail::DestroyObject<StepInfo*>()); m_steps.clear(); m_sumX0 = 0; m_sumLambda = 0; @@ -215,7 +215,7 @@ void Geant4MaterialScanner::end(const G4Track* track) { postPos.X()/cm,postPos.Y()/cm,postPos.Z()/cm); //cout << *m << endl; } - for_each(m_steps.begin(),m_steps.end(),DestroyObject<StepInfo*>()); + for_each(m_steps.begin(),m_steps.end(),detail::DestroyObject<StepInfo*>()); m_steps.clear(); } } diff --git a/DDG4/plugins/Geant4ParticleDumpAction.cpp b/DDG4/plugins/Geant4ParticleDumpAction.cpp index 77bcbb194..3b9c4b92d 100644 --- a/DDG4/plugins/Geant4ParticleDumpAction.cpp +++ b/DDG4/plugins/Geant4ParticleDumpAction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ class G4VHitsCollection; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class Geant4ParticleMap; @@ -48,13 +48,13 @@ namespace DD4hep { virtual void end(const G4Event* event) override; }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif /* DD4HEP_DDG4_GEANT4PARTICLEDUMPACTION_H */ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -76,8 +76,8 @@ namespace DD4hep { #include "G4Event.hh" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Standard constructor Geant4ParticleDumpAction::Geant4ParticleDumpAction(Geant4Context* ctxt, const string& nam) diff --git a/DDG4/plugins/Geant4Particles.cpp b/DDG4/plugins/Geant4Particles.cpp index 2d03ff39e..9e7712d77 100644 --- a/DDG4/plugins/Geant4Particles.cpp +++ b/DDG4/plugins/Geant4Particles.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/plugins/Geant4PhysicsConstructors.cpp b/DDG4/plugins/Geant4PhysicsConstructors.cpp index 0f2ec2447..4182f73d7 100644 --- a/DDG4/plugins/Geant4PhysicsConstructors.cpp +++ b/DDG4/plugins/Geant4PhysicsConstructors.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/plugins/Geant4PrimaryGenerators.cpp b/DDG4/plugins/Geant4PrimaryGenerators.cpp index 1490a4873..3b003a9c0 100644 --- a/DDG4/plugins/Geant4PrimaryGenerators.cpp +++ b/DDG4/plugins/Geant4PrimaryGenerators.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/plugins/Geant4Processes.cpp b/DDG4/plugins/Geant4Processes.cpp index 4bf4ba4d6..1a2791099 100644 --- a/DDG4/plugins/Geant4Processes.cpp +++ b/DDG4/plugins/Geant4Processes.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/plugins/Geant4ROOTDump.cpp b/DDG4/plugins/Geant4ROOTDump.cpp index e997b2dea..d88e81468 100644 --- a/DDG4/plugins/Geant4ROOTDump.cpp +++ b/DDG4/plugins/Geant4ROOTDump.cpp @@ -1,6 +1,5 @@ -// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Factories.h" #include "DD4hep/Primitives.h" #include "DDG4/Geant4DataDump.h" @@ -27,8 +26,8 @@ #include "TROOT.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; typedef Geant4DataDump::Particles Particles; typedef Geant4DataDump::TrackerHits TrackerHits; @@ -63,7 +62,7 @@ static pair<TClass*,void*> load(TBranch* branch, int entry) { return pair<TClass*,void*>(cl,obj); } -static long dump_root(DD4hep::Geometry::LCDD&, int argc, char** argv) { +static long dump_root(Detector&, int argc, char** argv) { std::string input = "", tag="Geant4ROOTDump"; int entry = -1; @@ -134,7 +133,7 @@ static long dump_root(DD4hep::Geometry::LCDD&, int argc, char** argv) { if ( data.first == cl_particles ) { Particles* parts = (Particles*)data.second; dump.print(INFO, (*i).first, parts); - for_each(parts->begin(), parts->end(), DestroyObject<Geant4Particle*>()); + for_each(parts->begin(), parts->end(), detail::DestroyObject<Geant4Particle*>()); } } for(ENTRIES::const_iterator i=event.begin(); i!=event.end(); ++i) { @@ -144,12 +143,12 @@ static long dump_root(DD4hep::Geometry::LCDD&, int argc, char** argv) { else if ( data.first == cl_tracker ) { TrackerHits* hits = (TrackerHits*)data.second; dump.print(INFO, (*i).first, hits); - for_each(hits->begin(), hits->end(), DestroyObject<Geant4Tracker::Hit*>()); + for_each(hits->begin(), hits->end(), detail::DestroyObject<Geant4Tracker::Hit*>()); } else if ( data.first == cl_calo ) { CalorimeterHits* hits = (CalorimeterHits*)data.second; dump.print(INFO, (*i).first, hits); - for_each(hits->begin(), hits->end(), DestroyObject<Geant4Calorimeter::Hit*>()); + for_each(hits->begin(), hits->end(), detail::DestroyObject<Geant4Calorimeter::Hit*>()); } if ( data.first ) data.first->Destructor(data.second); } diff --git a/DDG4/plugins/Geant4SDActions.cpp b/DDG4/plugins/Geant4SDActions.cpp index 35f13bd0d..fc099eeaa 100644 --- a/DDG4/plugins/Geant4SDActions.cpp +++ b/DDG4/plugins/Geant4SDActions.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ using namespace CLHEP; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Geant4SensitiveAction<Geant4Tracker> @@ -47,7 +47,7 @@ namespace DD4hep { /// Method for generating hit(s) using the information of G4Step object. template <> bool Geant4SensitiveAction<Geant4Tracker>::process(G4Step* step,G4TouchableHistory* /*hist*/ ) { typedef Geant4Tracker::Hit Hit; - StepHandler h(step); + Geant4StepHandler h(step); Position prePos = h.prePos(); Position postPos = h.postPos(); Position direction = postPos - prePos; @@ -103,9 +103,9 @@ namespace DD4hep { /// Method for generating hit(s) using the information of G4Step object. template <> bool Geant4SensitiveAction<Geant4Calorimeter>::process(G4Step* step,G4TouchableHistory*) { typedef Geant4Calorimeter::Hit Hit; - StepHandler h(step); + Geant4StepHandler h(step); HitContribution contrib = Hit::extractContribution(step); - HitCollection* coll = collection(m_collectionID); + Geant4HitCollection* coll = collection(m_collectionID); VolumeID cell = 0; try { @@ -191,8 +191,8 @@ namespace DD4hep { } else { typedef Geant4Calorimeter::Hit Hit; - StepHandler h(step); - HitCollection* coll = collection(m_collectionID); + Geant4StepHandler h(step); + Geant4HitCollection* coll = collection(m_collectionID); HitContribution contrib = Hit::extractContribution(step); Position pos = h.prePos(); Hit* hit = coll->find<Hit>(PositionCompare<Hit,Position>(pos)); @@ -243,9 +243,9 @@ namespace DD4hep { /// Method for generating hit(s) using the information of G4Step object. template <> bool Geant4SensitiveAction<Geant4ScintillatorCalorimeter>::process(G4Step* step,G4TouchableHistory*) { typedef Geant4Calorimeter::Hit Hit; - StepHandler h(step); + Geant4StepHandler h(step); HitContribution contrib = Hit::extractContribution(step,true); - HitCollection* coll = collection(m_collectionID); + Geant4HitCollection* coll = collection(m_collectionID); VolumeID cell = 0; try { cell = cellID(step); @@ -315,7 +315,6 @@ namespace DD4hep { struct TrackerCombine { - typedef Geant4HitCollection HitCollection; Geant4Tracker::Hit pre, post; Position mean_pos; Geant4Sensitive* sensitive; @@ -486,7 +485,7 @@ namespace DD4hep { } } -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; #include "DDG4/Factories.h" DECLARE_GEANT4SENSITIVE(Geant4TrackerAction) diff --git a/DDG4/plugins/Geant4SensDet.cpp b/DDG4/plugins/Geant4SensDet.cpp index 90e487e62..85ff4ae81 100644 --- a/DDG4/plugins/Geant4SensDet.cpp +++ b/DDG4/plugins/Geant4SensDet.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,10 +27,10 @@ #include "G4Run.hh" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Private helper to support sequence reference counting /** @@ -40,7 +40,6 @@ namespace DD4hep { */ template <typename T> class RefCountedSequence { public: - typedef RefCountedSequence<T> Base; T* m_sequence; /// Default constructor RefCountedSequence() : m_sequence(0) { } @@ -54,7 +53,7 @@ namespace DD4hep { m_sequence->addRef(); } void _release() { - releasePtr(m_sequence); + detail::releasePtr(m_sequence); InstanceCount::decrement(this); } }; @@ -75,13 +74,14 @@ namespace DD4hep { SensitiveDetector m_sensitive; public: /// Constructor. The detector element is identified by the name - Geant4SensDet(const std::string& nam, Geometry::LCDD& lcdd) + Geant4SensDet(const std::string& nam, Detector& description) : G4VSensitiveDetector(nam), G4VSDFilter(nam), - Geant4Action(0,nam), Geant4ActionSD(nam), Base() + Geant4Action(0,nam), Geant4ActionSD(nam), + RefCountedSequence<Geant4SensDetActionSequence>() { - Geant4Kernel& master = Geant4Kernel::instance(lcdd); + Geant4Kernel& master = Geant4Kernel::instance(description); Geant4Kernel& kernel = master.worker(Geant4Kernel::thread_self()); - m_sensitive = lcdd.sensitiveDetector(nam); + m_sensitive = description.sensitiveDetector(nam); m_context = kernel.workerContext(); m_outputLevel = kernel.getOutputLevel(nam); _aquire(kernel.sensitiveAction(nam)); @@ -110,7 +110,7 @@ namespace DD4hep { /// Access to the readout geometry of the sensitive detector virtual G4VReadOutGeometry* readoutGeometry() const { return this->G4VSensitiveDetector::GetROgeometry(); } - /// Access to the LCDD sensitive detector handle + /// Access to the Detector sensitive detector handle virtual SensitiveDetector sensitiveDetector() const { return m_sensitive; } /// Access to the sensitive type of the detector @@ -141,15 +141,15 @@ namespace DD4hep { } }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #include "DDG4/Factories.h" -typedef DD4hep::Simulation::Geant4SensDet Geant4SensDet; -typedef DD4hep::Simulation::Geant4SensDet Geant4tracker; -typedef DD4hep::Simulation::Geant4SensDet Geant4calorimeter; +typedef dd4hep::sim::Geant4SensDet Geant4SensDet; +typedef dd4hep::sim::Geant4SensDet Geant4tracker; +typedef dd4hep::sim::Geant4SensDet Geant4calorimeter; DECLARE_GEANT4SENSITIVEDETECTOR(Geant4SensDet) DECLARE_GEANT4SENSITIVEDETECTOR(Geant4tracker) diff --git a/DDG4/plugins/Geant4SensDetFilters.cpp b/DDG4/plugins/Geant4SensDetFilters.cpp index d50de3db7..feec7eea8 100644 --- a/DDG4/plugins/Geant4SensDetFilters.cpp +++ b/DDG4/plugins/Geant4SensDetFilters.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ class G4ParticleDefinition; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Geant4 sensitive detector filter base class for particle filters /** @@ -124,8 +124,8 @@ namespace DD4hep { #include "G4Track.hh" #include "G4Step.hh" -using namespace DD4hep::Simulation; -using namespace DD4hep; +using namespace dd4hep::sim; +using namespace dd4hep; using namespace std; //DECLARE_GEANT4ACTION() diff --git a/DDG4/plugins/Geant4Steppers.cpp b/DDG4/plugins/Geant4Steppers.cpp index 4832327b2..31adb45b1 100644 --- a/DDG4/plugins/Geant4Steppers.cpp +++ b/DDG4/plugins/Geant4Steppers.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDG4/plugins/Geant4TCUserParticleHandler.cpp b/DDG4/plugins/Geant4TCUserParticleHandler.cpp index febdc16ea..4b6f2b9a8 100644 --- a/DDG4/plugins/Geant4TCUserParticleHandler.cpp +++ b/DDG4/plugins/Geant4TCUserParticleHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "DDG4/Geant4UserParticleHandler.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Rejects to keep particles, which are created outside a tracking cylinder. /** Geant4TCUserParticleHandler @@ -55,14 +55,14 @@ namespace DD4hep { virtual void end(const G4Event* event); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4TCUSERPARTICLEHANDLER_H // $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : M.Frank @@ -74,7 +74,7 @@ namespace DD4hep { #include "DDG4/Factories.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; DECLARE_GEANT4ACTION(Geant4TCUserParticleHandler) /// Standard constructor @@ -92,7 +92,7 @@ void Geant4TCUserParticleHandler::end(const G4Track* /* track */, Particle& p) double z_prod = std::fabs(p.vsz); bool starts_in_trk_vol = ( r_prod <= m_rTracker && z_prod <= m_zTracker ) ; - DD4hep::ReferenceBitMask<int> reason(p.reason); + dd4hep::detail::ReferenceBitMask<int> reason(p.reason); if( reason.isSet(G4PARTICLE_PRIMARY) ) { //do nothing @@ -124,7 +124,7 @@ void Geant4TCUserParticleHandler::end(const G4Track* /* track */, Particle& p) } // Set the simulator status bits - DD4hep::ReferenceBitMask<int> simStatus(p.status); + dd4hep::detail::ReferenceBitMask<int> simStatus(p.status); if( ends_in_trk_vol ) { simStatus.set(G4PARTICLE_SIM_DECAY_TRACKER); diff --git a/DDG4/plugins/Geant4TrackerWeightedSD.cpp b/DDG4/plugins/Geant4TrackerWeightedSD.cpp index 9d76e316c..876305dba 100644 --- a/DDG4/plugins/Geant4TrackerWeightedSD.cpp +++ b/DDG4/plugins/Geant4TrackerWeightedSD.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,12 +27,12 @@ using namespace std; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { - using namespace Geometry; + using namespace detail; /// Geant4 sensitive detector combining all deposits of one G4Track within one sensitive element. /** @@ -408,7 +408,7 @@ namespace DD4hep { } } -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; #include "DDG4/Factories.h" DECLARE_GEANT4SENSITIVE(Geant4TrackerWeightedAction) diff --git a/DDG4/plugins/Geant4UserActionInitialization.cpp b/DDG4/plugins/Geant4UserActionInitialization.cpp index ccd41f8b3..12d62739f 100644 --- a/DDG4/plugins/Geant4UserActionInitialization.cpp +++ b/DDG4/plugins/Geant4UserActionInitialization.cpp @@ -1,5 +1,5 @@ #if 0 -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "DDG4/Geant4UserInitialization.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to initialize a multi-threaded or single threaded Geant4 application /** @@ -41,12 +41,12 @@ namespace DD4hep { /// Callback function to build setup for the MT master thread virtual void buildMaster(); }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4USERACTIONINITIALIZATION_H -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -68,7 +68,7 @@ namespace DD4hep { // C/C++ include files using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; //DECLARE_GEANT4ACTION(Geant4UserActionInitialization) diff --git a/DDG4/plugins/Geant4XMLSetup.cpp b/DDG4/plugins/Geant4XMLSetup.cpp index f91a82344..55d2fe640 100644 --- a/DDG4/plugins/Geant4XMLSetup.cpp +++ b/DDG4/plugins/Geant4XMLSetup.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,27 +12,23 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/DetFactoryHelper.h" #include "XML/Conversions.h" #include "DDG4/Geant4Config.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { // Forward declarations class ActionSequence; using namespace std; - using namespace DD4hep::Simulation; - using namespace DD4hep::Simulation::Setup; - - typedef DD4hep::Geometry::LCDD lcdd_t; - typedef DD4hep::Geometry::DetElement DetElement; - typedef DD4hep::Geometry::SensitiveDetector SensitiveDetector; + using namespace dd4hep::sim; + using namespace dd4hep::sim::Setup; /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { // Forward declarations class XMLSetup; @@ -49,12 +45,12 @@ namespace DD4hep { /// Set the properties of a Geant4 Action object from XML object attributes template <typename T> static void _setAttributes(const T& handle, xml_h& e) { - XML::Handle_t props(e); + xml::Handle_t props(e); // Now we set the object properties - vector<XML::Attribute> attrs = props.attributes(); - for(vector<XML::Attribute>::iterator i=attrs.begin(); i!=attrs.end(); ++i) { - XML::Attribute a = *i; - handle[XML::_toString(props.attr_name(a))].str(props.attr<string>(a)); + vector<xml::Attribute> attrs = props.attributes(); + for(vector<xml::Attribute>::iterator i=attrs.begin(); i!=attrs.end(); ++i) { + xml::Attribute a = *i; + handle[xml::_toString(props.attr_name(a))].str(props.attr<string>(a)); } } @@ -62,7 +58,7 @@ namespace DD4hep { template <typename T> static void _setProperties(const T& handle, xml_h& e) { xml_comp_t action(e); // Now we set the object properties - XML::Handle_t props = action.child(_Unicode(properties),false); + xml::Handle_t props = action.child(_Unicode(properties),false); if ( props ) { _setAttributes(handle, props); } @@ -72,9 +68,9 @@ namespace DD4hep { } /// Create/Configure Geant4 sensitive action object from XML - static Action _convertSensitive(lcdd_t& lcdd, xml_h e, const string& detector) { + static Action _convertSensitive(Detector& description, xml_h e, const string& detector) { xml_comp_t action(e); - Kernel& kernel = Kernel::instance(lcdd); + Kernel& kernel = Kernel::instance(description); TypeName tn = TypeName::split(action.attr<string>(_U(name))); // Create the object using the factory method Sensitive handle(kernel,action.attr<string>(_U(name)),detector); @@ -91,9 +87,9 @@ namespace DD4hep { } /// Create/Configure Action object from XML - static Action _convertAction(lcdd_t& lcdd, xml_h e) { + static Action _convertAction(Detector& description, xml_h e) { xml_comp_t action(e); - Kernel& kernel = Kernel::instance(lcdd); + Kernel& kernel = Kernel::instance(description); TypeName tn = TypeName::split(action.attr<string>(_U(name))); // Create the object using the factory method Action handle(kernel,action.attr<string>(_U(name))); @@ -114,19 +110,19 @@ namespace DD4hep { enum { SENSITIVE, ACTION, FILTER }; /// Create/Configure Action object from XML - Action _createAction(lcdd_t& lcdd, xml_h a, const string& seqType, int what) { + Action _createAction(Detector& description, xml_h a, const string& seqType, int what) { string nam = a.attr<string>(_U(name)); TypeName typ = TypeName::split(nam); - Kernel& kernel = Kernel::instance(lcdd); + Kernel& kernel = Kernel::instance(description); Action action((what==FILTER) ? (Geant4Action*)kernel.globalFilter(typ.second,false) : (what==ACTION) ? kernel.globalAction(typ.second,false) /// : (what==FILTER) ? kernel.globalAction(typ.second,false) : 0); // Create the object using the factory method if ( !action ) { - action = (what == SENSITIVE) ? Action(_convertSensitive(lcdd, a, seqType)) - : (what==ACTION) ? _convertAction(lcdd, a) - : (what==FILTER) ? _convertAction(lcdd, a) + action = (what == SENSITIVE) ? Action(_convertSensitive(description, a, seqType)) + : (what==ACTION) ? _convertAction(description, a) + : (what==FILTER) ? _convertAction(description, a) : Action(); if ( !action ) { throw runtime_error(format("Geant4ActionSequence","DDG4: The action '%s'" @@ -148,8 +144,8 @@ namespace DD4hep { * </actions> */ template <> void Converter<Action>::operator()(xml_h e) const { - Action a = _convertAction(lcdd, e); - Kernel::instance(lcdd).registerGlobalAction(a); + Action a = _convertAction(description, e); + Kernel::instance(description).registerGlobalAction(a); } /// Convert Sensitive detector filters @@ -164,8 +160,8 @@ namespace DD4hep { * </filters> */ template <> void Converter<Filter>::operator()(xml_h e) const { - Action a = _convertAction(lcdd, e); - Kernel::instance(lcdd).registerGlobalFilter(a); + Action a = _convertAction(description, e); + Kernel::instance(description).registerGlobalFilter(a); } /// Convert Geant4Phase objects @@ -180,7 +176,7 @@ namespace DD4hep { */ template <> void Converter<Phase>::operator()(xml_h e) const { xml_comp_t x_phase(e); - Kernel& kernel = Kernel::instance(lcdd); + Kernel& kernel = Kernel::instance(description); string nam = x_phase.attr<string>(_U(type)); typedef Geant4ActionPhase PH; Phase p; @@ -233,14 +229,14 @@ namespace DD4hep { } else { TypeName tn = TypeName::split(nam); - DetElement det = lcdd.detector(tn.first); + DetElement det = description.detector(tn.first); if ( !det.isValid() ) { throw runtime_error(format("Phase","DDG4: The phase '%s' of type SensitiveSeq" " cannot be attached to a non-existing detector" " [Detector-Missing]",nam.c_str())); } - Geometry::SensitiveDetector sd = lcdd.sensitiveDetector(tn.first); + SensitiveDetector sd = description.sensitiveDetector(tn.first); if ( !sd.isValid() ) { throw runtime_error(format("Phase","DDG4: The phase '%s' of type SensitiveSeq" " cannot be attached to a non-existing sensitive detector" @@ -287,11 +283,11 @@ namespace DD4hep { string seqNam; TypeName seqType; int what = ACTION; - Kernel& kernel = Kernel::instance(lcdd); + Kernel& kernel = Kernel::instance(description); if ( seq.hasAttr(_U(sd)) ) { string sd_nam = seq.attr<string>(_U(sd)); - SensitiveDetector sensitive = lcdd.sensitiveDetector(sd_nam); + SensitiveDetector sensitive = description.sensitiveDetector(sd_nam); seqNam = seq.attr<string>(_U(type))+"/"+sd_nam; if ( !sensitive.isValid() ) { printout(ALWAYS,"Geant4Setup","+++ ActionSequence %s is defined, " @@ -313,31 +309,31 @@ namespace DD4hep { if ( seqType.second == "PhysicsList" ) { PhysicsActionSeq pl(&kernel.physicsList()); - PropertyManager& m = kernel.physicsList().properties(); - m.dump(); + PropertyManager& props = kernel.physicsList().properties(); + props.dump(); _setAttributes(pl,e); - m.dump(); + props.dump(); } for(xml_coll_t a(seq,_Unicode(action)); a; ++a) { string nam = a.attr<string>(_U(name)); - Action action(_createAction(lcdd,a,seqType.second,what)); + Action action(_createAction(description,a,seqType.second,what)); if ( seqType.second == "RunAction" ) - kernel.runAction().adopt(_action<RunAction::handled_type>(action.get())); + kernel.runAction().adopt(_action<Geant4RunAction>(action.get())); else if ( seqType.second == "EventAction" ) - kernel.eventAction().adopt(_action<EventAction::handled_type>(action.get())); + kernel.eventAction().adopt(_action<Geant4EventAction>(action.get())); else if ( seqType.second == "GeneratorAction" ) - kernel.generatorAction().adopt(_action<GenAction::handled_type>(action.get())); + kernel.generatorAction().adopt(_action<Geant4GeneratorAction>(action.get())); else if ( seqType.second == "TrackingAction" ) - kernel.trackingAction().adopt(_action<TrackAction::handled_type>(action.get())); + kernel.trackingAction().adopt(_action<Geant4TrackingAction>(action.get())); else if ( seqType.second == "StackingAction" ) - kernel.stackingAction().adopt(_action<StackAction::handled_type>(action.get())); + kernel.stackingAction().adopt(_action<Geant4StackingAction>(action.get())); else if ( seqType.second == "SteppingAction" ) - kernel.steppingAction().adopt(_action<StepAction::handled_type>(action.get())); + kernel.steppingAction().adopt(_action<Geant4SteppingAction>(action.get())); else if ( seqType.second == "PhysicsList" ) - kernel.physicsList().adopt(_action<PhysicsList::handled_type>(action.get())); + kernel.physicsList().adopt(_action<Geant4PhysicsList>(action.get())); else if ( sdSeq.get() ) - sdSeq->adopt(_action<Sensitive::handled_type>(action.get())); + sdSeq->adopt(_action<Geant4Sensitive>(action.get())); else { throw runtime_error(format("ActionSequence","DDG4: The action '%s'" " cannot be attached to any sequence '%s'." @@ -349,12 +345,12 @@ namespace DD4hep { if ( what == SENSITIVE ) { for(xml_coll_t a(seq,_Unicode(filter)); a; ++a) { string nam = a.attr<string>(_U(name)); - Action action(_createAction(lcdd,a,"",FILTER)); + Action action(_createAction(description,a,"",FILTER)); installMessenger(action); printout(INFO,"Geant4Setup","+++ ActionSequence %s added filter object:%s", seqType.second.c_str(),action->name().c_str()); if ( sdSeq.get() ) - sdSeq->adopt(_action<Filter::handled_type>(action.get())); + sdSeq->adopt(_action<Geant4Filter>(action.get())); else { throw runtime_error(format("ActionSequence","DDG4: The action '%s'" " cannot be attached to any sequence '%s'." @@ -439,7 +435,7 @@ namespace DD4hep { */ struct PhysicsListExtension; template <> void Converter<PhysicsListExtension>::operator()(xml_h e) const { - Kernel& kernel = Kernel::instance(lcdd); + Kernel& kernel = Kernel::instance(description); string ext = xml_comp_t(e).nameStr(); kernel.physicsList().properties()["extends"].str(ext); printout(INFO,"Geant4Setup","+++ PhysicsListExtension: Set predefined Geant4 physics list to '%s'",ext.c_str()); @@ -448,19 +444,19 @@ namespace DD4hep { /// Create/Configure PhysicsList objects: Predefined Geant4 Physics lists template <> void Converter<PhysicsList>::operator()(xml_h e) const { string name = e.attr<string>(_U(name)); - Kernel& kernel = Kernel::instance(lcdd); + Kernel& kernel = Kernel::instance(description); PhysicsList handle(kernel,name); _setAttributes(handle,e); - xml_coll_t(e,_Unicode(particles)).for_each(_Unicode(construct),Converter<Geant4PhysicsList::ParticleConstructor>(lcdd,handle.get())); - xml_coll_t(e,_Unicode(processes)).for_each(_Unicode(particle),Converter<Geant4PhysicsList::ParticleProcesses>(lcdd,handle.get())); - xml_coll_t(e,_Unicode(physics)).for_each(_Unicode(construct),Converter<Geant4PhysicsList::PhysicsConstructor>(lcdd,handle.get())); - xml_coll_t(e,_Unicode(extends)).for_each(Converter<PhysicsListExtension>(lcdd,handle.get())); + xml_coll_t(e,_Unicode(particles)).for_each(_Unicode(construct),Converter<Geant4PhysicsList::ParticleConstructor>(description,handle.get())); + xml_coll_t(e,_Unicode(processes)).for_each(_Unicode(particle),Converter<Geant4PhysicsList::ParticleProcesses>(description,handle.get())); + xml_coll_t(e,_Unicode(physics)).for_each(_Unicode(construct),Converter<Geant4PhysicsList::PhysicsConstructor>(description,handle.get())); + xml_coll_t(e,_Unicode(extends)).for_each(Converter<PhysicsListExtension>(description,handle.get())); kernel.physicsList().adopt(handle); } /// Create/Configure Geant4Kernel objects template <> void Converter<Kernel>::operator()(xml_h e) const { - Kernel& kernel = Kernel::instance(lcdd); + Kernel& kernel = Kernel::instance(description); xml_comp_t k(e); if ( k.hasAttr(_Unicode(NumEvents)) ) kernel.property("NumEvents").str(k.attr<string>(_Unicode(NumEvents))); @@ -472,28 +468,28 @@ namespace DD4hep { template <> void Converter<XMLSetup>::operator()(xml_h seq) const { xml_elt_t compact(seq); // First execute the basic setup from the plugins module - long result = PluginService::Create<long>("geant4_XML_reader",&lcdd,&seq); + long result = PluginService::Create<long>("geant4_XML_reader",&description,&seq); if ( 0 == result ) { - throw runtime_error("DD4hep: Failed to locate plugin to interprete files of type" + throw runtime_error("dd4hep: Failed to locate plugin to interprete files of type" " \"" + seq.tag() + "\" - no factory of type geant4_XML_reader."); } result = *(long*) result; if (result != 1) { - throw runtime_error("DD4hep: Failed to parse the XML tag " + seq.tag() + " with the plugin geant4_XML_reader"); + throw runtime_error("dd4hep: Failed to parse the XML tag " + seq.tag() + " with the plugin geant4_XML_reader"); } - xml_coll_t(compact,_Unicode(kernel)).for_each(Converter<Kernel>(lcdd,param)); + xml_coll_t(compact,_Unicode(kernel)).for_each(Converter<Kernel>(description,param)); // Now deal with the new stuff..... - xml_coll_t(compact,_Unicode(actions) ).for_each(_Unicode(action),Converter<Action>(lcdd,param)); - xml_coll_t(compact,_Unicode(filters) ).for_each(_Unicode(filter),Converter<Filter>(lcdd,param)); - xml_coll_t(compact,_Unicode(sequences) ).for_each(_Unicode(sequence),Converter<ActionSequence>(lcdd,param)); - xml_coll_t(compact,_Unicode(phases) ).for_each(_Unicode(phase),Converter<Phase>(lcdd,param)); - xml_coll_t(compact,_Unicode(physicslist)).for_each(Converter<PhysicsList>(lcdd,param)); + xml_coll_t(compact,_Unicode(actions) ).for_each(_Unicode(action),Converter<Action>(description,param)); + xml_coll_t(compact,_Unicode(filters) ).for_each(_Unicode(filter),Converter<Filter>(description,param)); + xml_coll_t(compact,_Unicode(sequences) ).for_each(_Unicode(sequence),Converter<ActionSequence>(description,param)); + xml_coll_t(compact,_Unicode(phases) ).for_each(_Unicode(phase),Converter<Phase>(description,param)); + xml_coll_t(compact,_Unicode(physicslist)).for_each(Converter<PhysicsList>(description,param)); } } /// Factory method -static long setup_Geant4(lcdd_t& lcdd, const xml_h& element) { - (DD4hep::Converter<DD4hep::Simulation::XMLSetup>(lcdd))(element); +static long setup_Geant4(dd4hep::Detector& description, const xml_h& element) { + (dd4hep::Converter<dd4hep::sim::XMLSetup>(description))(element); return 1; } // Factory declaration diff --git a/DDG4/pyddg4.cpp b/DDG4/pyddg4.cpp index 3618f5cdc..b5ebc7b80 100644 --- a/DDG4/pyddg4.cpp +++ b/DDG4/pyddg4.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -55,9 +55,9 @@ int main(int argc, char** argv) { if ( !have_prompt && args.size()>0 ) { libs.push_back((char*)"libDDG4Python"); if ( 0 == (ret=load_libs(libs)) ) { - DD4hep::DDPython::instance().setArgs(args.size(), &args[0]); - DD4hep::DDPython::instance().setMainThread(); - DD4hep::DDPython::instance().runFile(args[0]); + dd4hep::DDPython::instance().setArgs(args.size(), &args[0]); + dd4hep::DDPython::instance().setMainThread(); + dd4hep::DDPython::instance().runFile(args[0]); if ( do_execute ) return gInterpreter->ProcessLine("PyDDG4::execute()"); else @@ -67,7 +67,7 @@ int main(int argc, char** argv) { } if ( 0 == (ret=load_libs(libs)) ) { ::printf("+++ Calling now Py_Main...\n"); - ret = DD4hep::DDPython::run_interpreter(args.size(), &args[0]); + ret = dd4hep::DDPython::run_interpreter(args.size(), &args[0]); //::printf("+++ Return code Py_Main=%d\n",ret); } return ret; diff --git a/DDG4/python/DD4hep.py b/DDG4/python/DD4hep.py deleted file mode 100644 index 8c6941a58..000000000 --- a/DDG4/python/DD4hep.py +++ /dev/null @@ -1,226 +0,0 @@ -#========================================================================== -# AIDA Detector description implementation for LCD -#-------------------------------------------------------------------------- -# Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -# All rights reserved. -# -# For the licensing terms see $DD4hepINSTALL/LICENSE. -# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -# -#========================================================================== -# -# We compile the DDG4 plugin on the fly if it does not exist using the AClick mechanism: -def compileAClick(dictionary,g4=True): - from ROOT import gInterpreter, gSystem - import sys, imp, exceptions - import os.path - dd4hep = os.environ['DD4hepINSTALL'] - inc = ' -I'+os.environ['ROOTSYS']+'/include -I'+dd4hep+'/include ' - lib = ' -L'+dd4hep+'/lib -lDDCore -lDDG4 -lDDSegmentation ' - if g4: - geant4 = os.environ['G4INSTALL'] - inc = inc + ' -I'+geant4+'/include/Geant4 -Wno-shadow -g -O0 ' - lib = lib + ' -L'+geant4+'/lib -L'+geant4+'/lib64 -lG4event -lG4tracking -lG4particles ' - - gSystem.AddIncludePath(inc) - gSystem.AddLinkedLibs(lib) - #####print "Includes: ",gSystem.GetIncludePath(),"\n","Linked libs:",gSystem.GetLinkedLibs() - print 'Loading AClick ',dictionary - package = imp.find_module('DDG4') - dic = os.path.dirname(package[1])+os.sep+dictionary - ###print dic - gInterpreter.ProcessLine('.L '+dic+'+') - #####gInterpreter.Load('DDG4Dict_C.so') - from ROOT import DD4hep as module - return module - -def loadDD4hep(): - import os, sys - # Add ROOT to the python path in case it is not yet there.... - sys.path.append(os.environ['ROOTSYS']+os.sep+'lib') - import ROOT - from ROOT import gSystem - - import platform - if platform.system()=="Darwin": - gSystem.SetDynamicPath(os.environ['DD4HEP_LIBRARY_PATH']) - - result = gSystem.Load("libDDCore") - if result < 0: - raise Exception('DD4hep.py: Failed to load the DD4hep library libDDCore: '+gSystem.GetErrorStr()) - from ROOT import DD4hep as module - return module - -# We are nearly there .... -name_space = __import__(__name__) -def import_namespace_item(ns,nam): - scope = getattr(name_space,ns) - attr = getattr(scope,nam) - setattr(name_space,nam,attr) - return attr - -def import_root(nam): - #print 'import ROOT class ',nam,str(name_space) - setattr(name_space,nam,getattr(ROOT,nam)) - -#--------------------------------------------------------------------------- -# -try: - DD4hep = loadDD4hep() - import ROOT -except Exception,X: - import sys - print '+--%-100s--+'%(100*'-',) - print '| %-100s |'%('Failed to load DD4hep base library:',) - print '| %-100s |'%(str(X),) - print '+--%-100s--+'%(100*'-',) - sys.exit(1) - -class _Levels: - def __init__(self): - self.VERBOSE=1 - self.DEBUG=2 - self.INFO=3 - self.WARNING=4 - self.ERROR=5 - self.FATAL=6 - self.ALWAYS=7 - -OutputLevel = _Levels() -#------------------------Generic STL stuff can be accessed using std: ----- -# -#-- e.g. Create an instance of std::vector<DD4hep::Simulation::Geant4Vertex*>: -# >>> v=DD4hep.vector('DD4hep::Simulation::Geant4Vertex*')() -# -#--------------------------------------------------------------------------- -import cppyy -std = cppyy.gbl.std -std_vector = std.vector -std_list = std.list -std_map = std.map -std_pair = std.pair -#--------------------------------------------------------------------------- -Core = DD4hep -Geo = DD4hep.Geometry -Geometry = DD4hep.Geometry -Conditions = DD4hep.Conditions -Alignments = DD4hep.Alignments - -import_root('XmlTools') -import_namespace_item('XmlTools','Evaluator') -#--------------------------------------------------------------------------- -import_namespace_item('Core','NamedObject') -import_namespace_item('Core','run_interpreter') - -def import_geometry(): - import_namespace_item('Core','setPrintLevel') - import_namespace_item('Core','setPrintFormat') - import_namespace_item('Core','printLevel') - import_namespace_item('Geo','LCDD') - import_namespace_item('Core','evaluator') - import_namespace_item('Core','g4Evaluator') - - import_namespace_item('Geo','VolumeManager') - import_namespace_item('Geo','OverlayedField') - import_namespace_item('Geo','Ref_t') - - #// Objects.h - import_namespace_item('Geo','Author') - import_namespace_item('Geo','Header') - import_namespace_item('Geo','Constant') - import_namespace_item('Geo','Atom') - import_namespace_item('Geo','Material') - import_namespace_item('Geo','VisAttr') - import_namespace_item('Geo','AlignmentEntry') - import_namespace_item('Geo','Limit') - import_namespace_item('Geo','LimitSet') - import_namespace_item('Geo','Region') - - #// Readout.h - import_namespace_item('Geo','Readout') - - #// Alignments.h - import_namespace_item('Alignments','Alignment') - import_namespace_item('Alignments','AlignmentCondition') - - #// Conditions.h - import_namespace_item('Conditions','Condition') - import_namespace_item('Conditions','ConditionKey') - - #// DetElement.h - import_namespace_item('Geo','World') - import_namespace_item('Geo','DetElement') - import_namespace_item('Geo','SensitiveDetector') - - #// Volume.h - import_namespace_item('Geo','Volume') - import_namespace_item('Geo','PlacedVolume') - - #// Shapes.h - import_namespace_item('Geo','Polycone') - import_namespace_item('Geo','ConeSegment') - import_namespace_item('Geo','Box') - import_namespace_item('Geo','Torus') - import_namespace_item('Geo','Cone') - import_namespace_item('Geo','Tube') - import_namespace_item('Geo','Trap') - import_namespace_item('Geo','Trapezoid') - import_namespace_item('Geo','Sphere') - import_namespace_item('Geo','Paraboloid') - import_namespace_item('Geo','PolyhedraRegular') - import_namespace_item('Geo','BooleanSolid') - import_namespace_item('Geo','SubtractionSolid') - import_namespace_item('Geo','UnionSolid') - import_namespace_item('Geo','IntersectionSolid') - - -def import_tgeo(): - import_root('TGeoManager') - import_root('TGeoNode') - import_root('TGeoNodeMatrix') - - import_root('TGeoVolume') - import_root('TGeoVolumeMulti') - import_root('TGeoVolumeAssembly') - - import_root('TGeoMaterial') - import_root('TGeoMedium') - import_root('TGeoIsotope') - import_root('TGeoElement') - - import_root('TGeoMatrix') - import_root('TGeoHMatrix') - import_root('TGeoIdentity') - import_root('TGeoTranslation') - import_root('TGeoRotation') - import_root('TGeoScale') - import_root('TGeoCombiTrans') - - import_root('TGeoShape') - import_root('TGeoBBox') - import_root('TGeoArb8') - import_root('TGeoTrap') - import_root('TGeoGtra') - import_root('TGeoCompositeShape') - import_root('TGeoCone') - import_root('TGeoConeSeg') - import_root('TGeoTube') - import_root('TGeoTubeSeg') - import_root('TGeoCtub') - import_root('TGeoEltu') - import_root('TGeoHype') - import_root('TGeoHalfSpace') - import_root('TGeoPara') - import_root('TGeoParaboloid') - import_root('TGeoPcon') - import_root('TGeoPgon') - import_root('TGeoScaledShape') - import_root('TGeoShapeAssembly') - import_root('TGeoSphere') - import_root('TGeoTorus') - import_root('TGeoTrd1') - import_root('TGeoTrd2') - import_root('TGeoXtru') - -import_tgeo() -import_geometry() diff --git a/DDG4/python/DDG4.py b/DDG4/python/DDG4.py index 84a4c6747..e033e3af0 100644 --- a/DDG4/python/DDG4.py +++ b/DDG4/python/DDG4.py @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -9,7 +9,7 @@ # #========================================================================== -from DD4hep import * +from dd4hep import * def loadDDG4(): ## import ROOT ## done in import * above @@ -30,7 +30,7 @@ def loadDDG4(): result = gSystem.Load("libDDG4Plugins") if 0 != result: raise Exception('DDG4.py: Failed to load the DDG4 library libDDG4Plugins: '+gSystem.GetErrorStr()) - from ROOT import DD4hep as module + from ROOT import dd4hep as module return module # We are nearly there .... @@ -42,7 +42,7 @@ def _import_class(ns,nam): #--------------------------------------------------------------------------- # try: - DD4hep = loadDDG4() + dd4hep = loadDDG4() except Exception as X: print '+--%-100s--+'%(100*'-',) print '| %-100s |'%('Failed to load DDG4 library:',) @@ -51,25 +51,25 @@ except Exception as X: exit(1) from ROOT import CLHEP as CLHEP -Core = DD4hep -Sim = DD4hep.Simulation -Simulation = DD4hep.Simulation +Core = dd4hep +Sim = dd4hep.sim +Simulation = dd4hep.sim Kernel = Sim.KernelHandle Interface = Sim.Geant4ActionCreation -LCDD = Geo.LCDD -from DD4hep import std, std_vector, std_list, std_map, std_pair +Detector = Core.Detector +from dd4hep import std, std_vector, std_list, std_map, std_pair #--------------------------------------------------------------------------- def _constant(self,name): return self.constantAsString(name) -LCDD.globalVal = _constant +Detector.globalVal = _constant #--------------------------------------------------------------------------- """ - Import the LCDD constants into the DDG4 namespace + Import the Detector constants into the DDG4 namespace """ -def importConstants(lcdd,namespace=None,debug=False): +def importConstants(description,namespace=None,debug=False): scope = current ns = current if namespace is not None and not hasattr(current,namespace): @@ -77,12 +77,12 @@ def importConstants(lcdd,namespace=None,debug=False): m = imp.new_module('DDG4.'+namespace) setattr(current,namespace,m) ns = m - evaluator = DD4hep.g4Evaluator() + evaluator = dd4hep.g4Evaluator() cnt = 0 num = 0 todo = {} strings = {} - for c in lcdd.constants(): + for c in description.constants(): if c.second.dataType == 'string': strings[c.first] = c.second.GetTitle() else: @@ -331,7 +331,7 @@ class Geant4: self._kernel = kernel if kernel is None: self._kernel = Kernel() - self.lcdd = self._kernel.lcdd() + self.description = self._kernel.detectorDescription() self.sensitive_types = {} self.sensitive_types['tracker'] = tracker self.sensitive_types['calorimeter'] = calo @@ -490,10 +490,10 @@ class Geant4: def printDetectors(self): print '+++ List of sensitive detectors:' - for i in self.lcdd.detectors(): + for i in self.description.detectors(): #print i.second.ptr().GetName() o = DetElement(i.second.ptr()) - sd = self.lcdd.sensitiveDetector(o.name()) + sd = self.description.sensitiveDetector(o.name()) if sd.isValid(): typ = sd.type() sdtyp = 'Unknown' @@ -524,7 +524,7 @@ class Geant4: seq.enableUI() acts = [] if collections is None: - sd = self.lcdd.sensitiveDetector(name) + sd = self.description.sensitiveDetector(name) ro = sd.readout() #print dir(ro) collections = ro.collectionNames() @@ -564,13 +564,13 @@ class Geant4: return (seq,acts[0]) def setupCalorimeter(self,name,type=None,collections=None): - sd = self.lcdd.sensitiveDetector(name) + sd = self.description.sensitiveDetector(name) sd.setType('calorimeter') if type is None: type = self.sensitive_types['calorimeter'] return self.setupDetector(name,type,collections) def setupTracker(self,name,type=None,collections=None): - sd = self.lcdd.sensitiveDetector(name) + sd = self.description.sensitiveDetector(name) sd.setType('tracker') if type is None: type = self.sensitive_types['tracker'] return self.setupDetector(name,type,collections) diff --git a/DDG4/python/DDG4Dict.C b/DDG4/python/DDG4Dict.C index 4a0eed727..af7485268 100644 --- a/DDG4/python/DDG4Dict.C +++ b/DDG4/python/DDG4Dict.C @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -33,10 +33,10 @@ #include "DDG4/Geant4GeneratorWrapper.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { using std::string; @@ -47,7 +47,7 @@ namespace DD4hep { x##Handle(const x##Handle& h) : action(h.action) { if ( action ) action->addRef();} \ ~x##Handle() { if ( action) action->release(); } \ Geant4##x* release() { Geant4##x* tmp = action; action=0; return tmp; } \ - operator DD4hep::Simulation::Geant4##x* () const { return action; } \ + operator dd4hep::sim::Geant4##x* () const { return action; } \ Geant4##x* operator->() const { return action; } \ Geant4##x* get() const { return action; } \ } @@ -212,13 +212,13 @@ namespace DD4hep { } } -typedef DD4hep::Simulation::Geant4ActionCreation Geant4ActionCreation; +typedef dd4hep::sim::Geant4ActionCreation Geant4ActionCreation; #include "DD4hep/detail/DetectorInterna.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; // CINT configuration #if defined(__CINT__) || defined(__MAKECINT__) || defined(__CLING__) || defined(__ROOTCLING__) @@ -355,8 +355,8 @@ namespace { // somehow the symbol Geometry moved into global namespace. Redeclare it here -//namespace Geometry {} -//#pragma link C++ namespace Geometry; +//namespace detail {} +//#pragma link C++ namespace detail; #endif diff --git a/DDG4/python/checkGeometry.py b/DDG4/python/checkGeometry.py index a4e1c0a57..a8bd83633 100755 --- a/DDG4/python/checkGeometry.py +++ b/DDG4/python/checkGeometry.py @@ -1,6 +1,6 @@ #!/bin/python #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -63,15 +63,15 @@ except ImportError,X: sys.exit(errno.ENOENT) try: - import DD4hep + import dd4hep except ImportError,X: - print 'DD4hep python interface not accessible:',X + print 'dd4hep python interface not accessible:',X sys.exit(errno.ENOENT) -DD4hep.setPrintLevel(DD4hep.OutputLevel.ERROR) +dd4hep.setPrintLevel(dd4hep.OutputLevel.ERROR) print '+++%s\n+++ Loading compact geometry:%s\n+++%s'%(120*'=',opts.compact,120*'=') -lcdd = DD4hep.Geo.LCDD.getInstance() -lcdd.fromXML(opts.compact) +description = dd4hep.Detector.getInstance() +description.fromXML(opts.compact) opts.num_tracks = int(opts.num_tracks) opts.vx = float(opts.vx) opts.vy = float(opts.vy) @@ -79,9 +79,9 @@ opts.vz = float(opts.vz) print '+++%s\n+++ Checking geometry:%s full-check:%s\n+++%s'%(120*'=',opts.compact,opts.full,120*'=') if opts.full: print '+++ # tracks:%d vertex:(%7.3f, %7.3f, %7.3f) [cm]'%(opts.num_tracks,opts.vx,opts.vy,opts.vz,) - lcdd.manager().CheckGeometryFull(opts.num_tracks,opts.vx,opts.vy,opts.vz,opts.option) + description.manager().CheckGeometryFull(opts.num_tracks,opts.vx,opts.vy,opts.vz,opts.option) else: - lcdd.manager().CheckGeometry() + description.manager().CheckGeometry() # # print '+++ Execution finished...' diff --git a/DDG4/python/checkOverlaps.py b/DDG4/python/checkOverlaps.py index 4120fe841..e33f32b13 100755 --- a/DDG4/python/checkOverlaps.py +++ b/DDG4/python/checkOverlaps.py @@ -1,6 +1,6 @@ #!/bin/python #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -48,25 +48,25 @@ except ImportError,X: sys.exit(errno.ENOENT) try: - import DD4hep + import dd4hep except ImportError,X: - print 'DD4hep python interface not accessible:',X + print 'dd4hep python interface not accessible:',X print parser.format_help() sys.exit(errno.ENOENT) # # opts.tolerance = float(opts.tolerance) -DD4hep.setPrintLevel(DD4hep.OutputLevel.ERROR) +dd4hep.setPrintLevel(dd4hep.OutputLevel.ERROR) print '+++%s\n+++ Loading compact geometry:%s\n+++%s'%(120*'=',opts.compact,120*'=') -lcdd = DD4hep.Geo.LCDD.getInstance() -lcdd.fromXML(opts.compact) +description = dd4hep.Detector.getInstance() +description.fromXML(opts.compact) print '+++%s\n+++ Checking overlaps of geometry:%s tolerance:%f option:%s\n+++%s'%(120*'=',opts.compact,opts.tolerance,opts.option,120*'=') -lcdd.manager().CheckOverlaps(opts.tolerance,opts.option) +description.manager().CheckOverlaps(opts.tolerance,opts.option) # # if opts.print_overlaps: print '+++%s\n+++ Printing overlaps of geometry:%s\n+++%s'%(120*'=',opts.compact,120*'=') - lcdd.manager().PrintOverlaps() + description.manager().PrintOverlaps() # # print '+++ Execution finished...' diff --git a/DDG4/python/g4MaterialScan.py b/DDG4/python/g4MaterialScan.py index a25c50a2c..8748fb8e6 100644 --- a/DDG4/python/g4MaterialScan.py +++ b/DDG4/python/g4MaterialScan.py @@ -1,6 +1,6 @@ #!/bin/python #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -26,9 +26,9 @@ def materialScan(opts): geant4 = DDG4.Geant4(kernel) # Configure UI geant4.setupCshUI(ui=None) - for i in geant4.lcdd.detectors(): + for i in geant4.description.detectors(): o = DDG4.DetElement(i.second.ptr()) - sd = geant4.lcdd.sensitiveDetector(o.name()) + sd = geant4.description.sensitiveDetector(o.name()) if sd.isValid(): typ = sd.type() if geant4.sensitive_types.has_key(typ): @@ -77,7 +77,7 @@ parser.add_option('-c', '--compact', dest='compact', default=None, metavar='<FILE>') parser.add_option('-P', '--print', dest='print_level', default=2, - help='Set DD4hep print level.', + help='Set dd4hep print level.', metavar='<int>') parser.add_option('-p', '--position', dest='position', default='0.0,0.0,0.0', diff --git a/DDG4/reco/Geant4SurfaceTest.cpp b/DDG4/reco/Geant4SurfaceTest.cpp index aad44659d..84b6bb147 100644 --- a/DDG4/reco/Geant4SurfaceTest.cpp +++ b/DDG4/reco/Geant4SurfaceTest.cpp @@ -1,4 +1,4 @@ -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,10 +18,10 @@ #include "DDG4/Geant4EventAction.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /** @class Geant4SurfaceTest Geant4SurfaceTest.h reco/Geant4SurfaceTest.h */ @@ -42,13 +42,13 @@ namespace DD4hep { private: }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4SURFACETEST_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DD4hepUnits.h" #include "DD4hep/InstanceCount.h" @@ -74,9 +74,9 @@ namespace DD4hep { #include <sstream> using namespace std; -using namespace DD4hep::DDRec; -using namespace DD4hep::Geometry; -using namespace DD4hep::Simulation; +using namespace dd4hep::DDRec; +using namespace dd4hep::detail; +using namespace dd4hep::sim; DECLARE_GEANT4ACTION(Geant4SurfaceTest) @@ -101,8 +101,8 @@ void Geant4SurfaceTest::begin(const G4Event* event) { /// End-of-event callback void Geant4SurfaceTest::end(const G4Event* evt) { stringstream sst; - LCDD& lcdd = context()->lcdd(); - SurfaceManager& surfMan = *lcdd.extension< SurfaceManager >() ; + Detector& description = context()->detectorDescription(); + SurfaceManager& surfMan = *description.extension< SurfaceManager >() ; const SurfaceMap& surfMap = *surfMan.map( "world" ) ; G4HCofThisEvent* hce = evt->GetHCofThisEvent(); diff --git a/DDG4/scripts/dumpDDG4.C b/DDG4/scripts/dumpDDG4.C index b0a07fcbe..4b9c48bbc 100644 --- a/DDG4/scripts/dumpDDG4.C +++ b/DDG4/scripts/dumpDDG4.C @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +15,7 @@ #include "CLHEP/Units/SystemOfUnits.h" #include "DD4hep/DD4hepUnits.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Geant4Particle.h" #include "DDG4/Geant4Data.h" #include <vector> @@ -29,12 +29,12 @@ using namespace std; using namespace CLHEP; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -typedef DD4hep::Simulation::Geant4Tracker Geant4Tracker; -typedef DD4hep::Simulation::Geant4Calorimeter Geant4Calorimeter; -typedef DD4hep::Simulation::Geant4Particle Geant4Particle; +typedef dd4hep::sim::Geant4Tracker Geant4Tracker; +typedef dd4hep::sim::Geant4Calorimeter Geant4Calorimeter; +typedef dd4hep::sim::Geant4Particle Geant4Particle; namespace { static const char* line = "+-------------------------------------------------------------+"; @@ -59,16 +59,16 @@ namespace { } else if ( have_geometry ) { string det_name = container; - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); det_name = det_name.substr(0,det_name.length()-4); - DetElement det(lcdd.detector(det_name)); - SensitiveDetector sd(lcdd.sensitiveDetector(det_name)); + DetElement det(description.detector(det_name)); + SensitiveDetector sd(description.sensitiveDetector(det_name)); Segmentation seg = sd.readout().segmentation(); - VolumeManager vm = lcdd.volumeManager(); + VolumeManager vm = description.volumeManager(); for(_H::const_iterator i=hits->begin(); i!=hits->end(); ++i) { const Geant4Tracker::Hit* h = *i; - const Geometry::Position& pos = h->position; - Geometry::Position pos_cell = seg.position(h->cellID); + const Position& pos = h->position; + Position pos_cell = seg.position(h->cellID); PlacedVolume pv = vm.lookupPlacement(h->cellID); printout(ALWAYS,container, "+++ Track:%3d PDG:%6d Pos:(%+.2e,%+.2e,%+.2e)[mm] Pixel:(%+.2e,%+.2e,%+.2e)[mm] %s Deposit:%7.3f MeV CellID:%16lX", @@ -83,7 +83,7 @@ namespace { else { for(_H::const_iterator i=hits->begin(); i!=hits->end(); ++i) { const Geant4Tracker::Hit* h = *i; - const Geometry::Position& pos = h->position; + const Position& pos = h->position; printout(ALWAYS,container, "+++ Track:%3d PDG:%6d Pos:(%+.2e,%+.2e,%+.2e)[mm] Deposit:%7.3f MeV CellID:%16lX", h->truth.trackID,h->truth.pdgID, @@ -105,16 +105,16 @@ namespace { } else { string det_name = container; - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); det_name = det_name.substr(0,det_name.length()-4); - DetElement det(lcdd.detector(det_name)); - SensitiveDetector sd(lcdd.sensitiveDetector(det_name)); + DetElement det(description.detector(det_name)); + SensitiveDetector sd(description.sensitiveDetector(det_name)); Segmentation seg = sd.readout().segmentation(); - VolumeManager vm = lcdd.volumeManager(); + VolumeManager vm = description.volumeManager(); for(_H::const_iterator i=hits->begin(); i!=hits->end(); ++i) { const Geant4Calorimeter::Hit* h = *i; - const Geometry::Position& pos = h->position; - Geometry::Position pos_cell = seg.position(h->cellID); + const Position& pos = h->position; + Position pos_cell = seg.position(h->cellID); PlacedVolume pv = vm.lookupPlacement(h->cellID); printout(ALWAYS,container, "+++ Pos:(%+.2e,%+.2e,%+.2e)[mm] Pixel:(%+.2e,%+.2e,%+.2e)[mm] %s Deposit:%7.3f MeV CellID:%16lX", @@ -138,7 +138,7 @@ namespace { } else { for(_P::const_iterator i=particles->begin(); i!=particles->end(); ++i) { - DD4hep::Simulation::Geant4ParticleHandle p(*i); + dd4hep::sim::Geant4ParticleHandle p(*i); char text[256]; text[0]=0; if ( p->parents.size() == 1 ) @@ -187,15 +187,15 @@ int dumpDDG4(const char* fname, int event_num) { } string br_name = b->GetName(); string cl_name = b->GetClassName(); - if ( cl_name.find("DD4hep::Simulation::Geant4Tracker::Hit") != string::npos ) { + if ( cl_name.find("dd4hep::sim::Geant4Tracker::Hit") != string::npos ) { typedef vector<Geant4Tracker::Hit*> _H; printHits(br_name,(_H*)e); } - else if ( cl_name.find("DD4hep::Simulation::Geant4Calorimeter::Hit") != string::npos ) { + else if ( cl_name.find("dd4hep::sim::Geant4Calorimeter::Hit") != string::npos ) { typedef vector<Geant4Calorimeter::Hit*> _H; printHits(br_name,(_H*)e); } - else if ( cl_name.find("DD4hep::Simulation::Geant4Particle") != string::npos ) { + else if ( cl_name.find("dd4hep::sim::Geant4Particle") != string::npos ) { typedef vector<Geant4Particle*> _H; ::printf("%s\n+ Particle Dump of event %8d [%8d bytes] +\n%s\n", line,event,nbytes,line); @@ -213,8 +213,8 @@ int dumpddg4_load_geometry(const char* fname) { if ( !have_geometry ) { have_geometry = true; gSystem->Load("libDDG4Plugins"); - LCDD& lcdd = LCDD::getInstance(); - lcdd.fromXML(fname); + Detector& description = Detector::getInstance(); + description.fromXML(fname); VolumeManager::getVolumeManager(); } return 1; diff --git a/DDG4/src/Geant4Action.cpp b/DDG4/src/Geant4Action.cpp index 9bd58d723..090435b7f 100644 --- a/DDG4/src/Geant4Action.cpp +++ b/DDG4/src/Geant4Action.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,8 +26,8 @@ #include <algorithm> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; TypeName TypeName::split(const string& type_name, const string& delim) { size_t idx = type_name.find(delim); @@ -155,7 +155,7 @@ void Geant4Action::print(const char* fmt, ...) const { if ( level >= printLevel() ) { va_list args; va_start(args, fmt); - DD4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); + dd4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); va_end(args); } } @@ -166,7 +166,7 @@ void Geant4Action::printM1(const char* fmt, ...) const { if ( level >= printLevel() ) { va_list args; va_start(args, fmt); - DD4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); + dd4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); va_end(args); } } @@ -177,7 +177,7 @@ void Geant4Action::printM2(const char* fmt, ...) const { if ( level >= printLevel() ) { va_list args; va_start(args, fmt); - DD4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); + dd4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); va_end(args); } } @@ -188,7 +188,7 @@ void Geant4Action::printP1(const char* fmt, ...) const { if ( level >= printLevel() ) { va_list args; va_start(args, fmt); - DD4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); + dd4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); va_end(args); } } @@ -199,7 +199,7 @@ void Geant4Action::printP2(const char* fmt, ...) const { if ( level >= printLevel() ) { va_list args; va_start(args, fmt); - DD4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); + dd4hep::printout((PrintLevel)level, m_name.c_str(), fmt, args); va_end(args); } } @@ -208,7 +208,7 @@ void Geant4Action::printP2(const char* fmt, ...) const { void Geant4Action::debug(const char* fmt, ...) const { va_list args; va_start(args, fmt); - DD4hep::printout(DD4hep::DEBUG, m_name, fmt, args); + dd4hep::printout(dd4hep::DEBUG, m_name, fmt, args); va_end(args); } @@ -216,7 +216,7 @@ void Geant4Action::debug(const char* fmt, ...) const { void Geant4Action::info(const char* fmt, ...) const { va_list args; va_start(args, fmt); - DD4hep::printout(DD4hep::INFO, m_name, fmt, args); + dd4hep::printout(dd4hep::INFO, m_name, fmt, args); va_end(args); } @@ -224,7 +224,7 @@ void Geant4Action::info(const char* fmt, ...) const { void Geant4Action::warning(const char* fmt, ...) const { va_list args; va_start(args, fmt); - DD4hep::printout(DD4hep::WARNING, m_name, fmt, args); + dd4hep::printout(dd4hep::WARNING, m_name, fmt, args); va_end(args); } @@ -232,7 +232,7 @@ void Geant4Action::warning(const char* fmt, ...) const { void Geant4Action::error(const char* fmt, ...) const { va_list args; va_start(args, fmt); - DD4hep::printout(DD4hep::ERROR, m_name, fmt, args); + dd4hep::printout(dd4hep::ERROR, m_name, fmt, args); va_end(args); } @@ -240,7 +240,7 @@ void Geant4Action::error(const char* fmt, ...) const { bool Geant4Action::return_error(bool return_value, const char* fmt, ...) const { va_list args; va_start(args, fmt); - DD4hep::printout(DD4hep::ERROR, m_name, fmt, args); + dd4hep::printout(dd4hep::ERROR, m_name, fmt, args); va_end(args); return return_value; } @@ -249,7 +249,7 @@ bool Geant4Action::return_error(bool return_value, const char* fmt, ...) const { void Geant4Action::fatal(const char* fmt, ...) const { va_list args; va_start(args, fmt); - DD4hep::printout(DD4hep::FATAL, m_name, fmt, args); + dd4hep::printout(dd4hep::FATAL, m_name, fmt, args); va_end(args); } @@ -257,8 +257,8 @@ void Geant4Action::fatal(const char* fmt, ...) const { void Geant4Action::except(const char* fmt, ...) const { va_list args; va_start(args, fmt); - DD4hep::printout(DD4hep::FATAL, m_name, fmt, args); - string err = DD4hep::format(m_name, fmt, args); + dd4hep::printout(dd4hep::FATAL, m_name, fmt, args); + string err = dd4hep::format(m_name, fmt, args); va_end(args); throw runtime_error(err); } @@ -269,7 +269,7 @@ void Geant4Action::abortRun(const string& exception, const char* fmt, ...) const string issuer = name()+" ["+typ+"]"; va_list args; va_start(args, fmt); - desc = DD4hep::format("*** Geant4Action:", fmt, args); + desc = dd4hep::format("*** Geant4Action:", fmt, args); va_end(args); G4Exception(issuer.c_str(),exception.c_str(),RunMustBeAborted,desc.c_str()); //throw runtime_error(issuer+"> "+desc); diff --git a/DDG4/src/Geant4ActionContainer.cpp b/DDG4/src/Geant4ActionContainer.cpp index ef78984f9..94b2a51da 100644 --- a/DDG4/src/Geant4ActionContainer.cpp +++ b/DDG4/src/Geant4ActionContainer.cpp @@ -1,6 +1,5 @@ -// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -34,7 +33,7 @@ #include <algorithm> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4ActionContainer::Geant4ActionContainer(Geant4Context* ctxt) @@ -55,16 +54,16 @@ Geant4ActionContainer::~Geant4ActionContainer() { /// Terminate all associated action instances int Geant4ActionContainer::terminate() { - releasePtr (m_physicsList); - releasePtr (m_constructionAction); - releasePtr (m_stackingAction); - releasePtr (m_steppingAction); - releasePtr (m_trackingAction); - releasePtr (m_eventAction); - releasePtr (m_generatorAction); - releasePtr (m_runAction); - deletePtr (m_sensDetActions); - deletePtr (m_context); + detail::releasePtr (m_physicsList); + detail::releasePtr (m_constructionAction); + detail::releasePtr (m_stackingAction); + detail::releasePtr (m_steppingAction); + detail::releasePtr (m_trackingAction); + detail::releasePtr (m_eventAction); + detail::releasePtr (m_generatorAction); + detail::releasePtr (m_runAction); + detail::deletePtr (m_sensDetActions); + detail::deletePtr (m_context); return 1; } diff --git a/DDG4/src/Geant4ActionPhase.cpp b/DDG4/src/Geant4ActionPhase.cpp index d6683ffb4..d31d96202 100644 --- a/DDG4/src/Geant4ActionPhase.cpp +++ b/DDG4/src/Geant4ActionPhase.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDG4/Geant4ActionPhase.h" using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4PhaseAction::Geant4PhaseAction(Geant4Context* ctxt, const std::string& nam) @@ -33,7 +33,7 @@ Geant4PhaseAction::~Geant4PhaseAction() { void Geant4PhaseAction::operator()() { } -DD4hep::Callback Geant4PhaseAction::callback() { +dd4hep::Callback Geant4PhaseAction::callback() { return Callback(this).make(&Geant4PhaseAction::operator()); } @@ -98,8 +98,8 @@ class G4TouchableHistory; #include "DDG4/Geant4TrackingAction.h" #include "DDG4/Geant4SteppingAction.h" #include "DDG4/Geant4GeneratorAction.h" -namespace DD4hep { - namespace Simulation { +namespace dd4hep { + namespace sim { /// Callback in Begin stacking action void Geant4ActionPhase::call() { this->execute(0); diff --git a/DDG4/src/Geant4Call.cpp b/DDG4/src/Geant4Call.cpp index 2504e5a92..b01490761 100644 --- a/DDG4/src/Geant4Call.cpp +++ b/DDG4/src/Geant4Call.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,6 +16,6 @@ #include "DDG4/Geant4Call.h" /// Default destructor (keep here to avoid weak linkage to vtable) -DD4hep::Simulation::Geant4Call::~Geant4Call() { +dd4hep::sim::Geant4Call::~Geant4Call() { } diff --git a/DDG4/src/Geant4Context.cpp b/DDG4/src/Geant4Context.cpp index 6a68706d9..7ffb0eb54 100644 --- a/DDG4/src/Geant4Context.cpp +++ b/DDG4/src/Geant4Context.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,8 +22,8 @@ #include <algorithm> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Intializing constructor Geant4Run::Geant4Run(const G4Run* run_pointer) @@ -86,14 +86,14 @@ Geant4Event& Geant4Context::event() const { } /// Access to detector description -Geometry::LCDD& Geant4Context::lcdd() const { - return m_kernel->lcdd(); +Detector& Geant4Context::detectorDescription() const { + return m_kernel->detectorDescription(); } /// Create a user trajectory G4VTrajectory* Geant4Context::createTrajectory(const G4Track* /* track */) const { - string err = DD4hep::format("Geant4Kernel", "createTrajectory: Purely virtual method. requires overloading!"); - DD4hep::printout(DD4hep::FATAL, "Geant4Kernel", "createTrajectory: Purely virtual method. requires overloading!"); + string err = dd4hep::format("Geant4Kernel", "createTrajectory: Purely virtual method. requires overloading!"); + dd4hep::printout(dd4hep::FATAL, "Geant4Kernel", "createTrajectory: Purely virtual method. requires overloading!"); throw runtime_error(err); } diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index 050a1a48d..bcd500e16 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DD4hep/Volumes.h" #include "DD4hep/Printout.h" @@ -91,10 +91,10 @@ #include <iomanip> #include <sstream> -using namespace DD4hep::Simulation; -//using namespace DD4hep::Simulation::Geant4GeometryMaps; -using namespace DD4hep::Geometry; -using namespace DD4hep; +namespace units = dd4hep; +using namespace dd4hep::detail; +using namespace dd4hep::sim; +using namespace dd4hep; using namespace std; #include "DDG4/Geant4AssemblyVolume.h" @@ -137,13 +137,13 @@ void Geant4AssemblyVolume::imprint(Geant4GeometryInfo& info, ImprintsCountPlus(); std::vector<G4AssemblyTriplet> triplets = pAssembly->fTriplets; - //cout << " Assembly:" << DetectorTools::placementPath(chain) << endl; + //cout << " Assembly:" << detail::tools::placementPath(chain) << endl; for( unsigned int i = 0; i < triplets.size(); i++ ) { const TGeoNode* node = pAssembly->m_entries[i]; Chain new_chain = chain; new_chain.push_back(node); - //cout << " Assembly: Entry: " << DetectorTools::placementPath(new_chain) << endl; + //cout << " Assembly: Entry: " << detail::tools::placementPath(new_chain) << endl; G4Transform3D Ta( *(triplets[i].GetRotation()), triplets[i].GetTranslation() ); @@ -194,7 +194,7 @@ void Geant4AssemblyVolume::imprint(Geant4GeometryInfo& info, #if 0 cout << " Assembly:Parent:" << parent->GetName() << " " << node->GetName() << " " << (void*)node << " G4:" << pvName.str() << " Daughter:" - << DetectorTools::placementPath(new_chain) << endl; + << detail::tools::placementPath(new_chain) << endl; cout << endl; #endif @@ -261,16 +261,16 @@ namespace { } /// Initializing Constructor -Geant4Converter::Geant4Converter(LCDD& lcdd_ref) - : Geant4Mapping(lcdd_ref), checkOverlaps(true) { +Geant4Converter::Geant4Converter(Detector& description_ref) + : Geant4Mapping(description_ref), checkOverlaps(true) { this->Geant4Mapping::init(); m_propagateRegions = true; outputLevel = PrintLevel(printLevel() - 1); } /// Initializing Constructor -Geant4Converter::Geant4Converter(LCDD& lcdd_ref, PrintLevel level) - : Geant4Mapping(lcdd_ref), checkOverlaps(true) { +Geant4Converter::Geant4Converter(Detector& description_ref, PrintLevel level) + : Geant4Mapping(description_ref), checkOverlaps(true) { this->Geant4Mapping::init(); m_propagateRegions = true; outputLevel = level; @@ -814,7 +814,7 @@ void* Geant4Converter::handleRegion(Region region, const set<const TGeoVolume*>& // set production cut if( not r.useDefaultCut() ) { G4ProductionCuts* cuts = new G4ProductionCuts(); - cuts->SetProductionCut(r.cut()*CLHEP::mm/dd4hep::mm); + cuts->SetProductionCut(r.cut()*CLHEP::mm/units::mm); g4->SetProductionCuts(cuts); } @@ -824,21 +824,20 @@ void* Geant4Converter::handleRegion(Region region, const set<const TGeoVolume*>& } G4UserRegionInformation* info = new G4UserRegionInformation(); info->region = r; - info->threshold = r.threshold()*CLHEP::MeV/dd4hep::MeV; + info->threshold = r.threshold()*CLHEP::MeV/units::MeV; info->storeSecondaries = r.storeSecondaries(); g4->SetUserInformation(info); printout(lvl, "Geant4Converter", "++ Converted region settings of:%s.", r.name()); vector < string > &limits = r.limits(); - for (vector<string>::const_iterator i = limits.begin(); i != limits.end(); ++i) { - const string& nam = *i; - LimitSet ls = m_lcdd.limitSet(nam); + for (const auto& nam : limits ) { + LimitSet ls = m_detDesc.limitSet(nam); if (ls.isValid()) { bool found = false; - const Geant4GeometryMaps::LimitMap& lm = data().g4Limits; - for (Geant4GeometryMaps::LimitMap::const_iterator j = lm.begin(); j != lm.end(); ++j) { - if (nam == (*j).first->GetName()) { - g4->SetUserLimits((*j).second); + const auto& lm = data().g4Limits; + for (const auto& j : lm ) { + if (nam == j.first->GetName()) { + g4->SetUserLimits(j.second); found = true; break; } @@ -846,7 +845,7 @@ void* Geant4Converter::handleRegion(Region region, const set<const TGeoVolume*>& if (found) continue; } - throw runtime_error("G4Region: Failed to resolve user limitset:" + *i); + throw runtime_error("G4Region: Failed to resolve user limitset:" + nam); } data().g4Regions[region] = g4; } @@ -863,13 +862,13 @@ void* Geant4Converter::handleLimitSet(LimitSet limitset, const set<const TGeoVol for (LimitSet::Object::const_iterator i = limits.begin(); i != limits.end(); ++i) { const Limit& l = *i; if (l.name == "step_length_max") - g4->SetMaxAllowedStep(l.value*CLHEP::mm/dd4hep::mm); + g4->SetMaxAllowedStep(l.value*CLHEP::mm/units::mm); else if (l.name == "track_length_max") - g4->SetMaxAllowedStep(l.value*CLHEP::mm/dd4hep::mm); + g4->SetMaxAllowedStep(l.value*CLHEP::mm/units::mm); else if (l.name == "time_max") - g4->SetUserMaxTime(l.value*CLHEP::ns/dd4hep::ns); + g4->SetUserMaxTime(l.value*CLHEP::ns/units::ns); else if (l.name == "ekin_min") - g4->SetUserMinEkine(l.value*CLHEP::MeV/dd4hep::MeV); + g4->SetUserMinEkine(l.value*CLHEP::MeV/units::MeV); else if (l.name == "range_min") g4->SetUserMinRange(l.value); else @@ -907,15 +906,15 @@ void* Geant4Converter::handleVis(const string& /* name */, VisAttr attr) const { } /// Handle the geant 4 specific properties -void Geant4Converter::handleProperties(LCDD::Properties& prp) const { +void Geant4Converter::handleProperties(Detector::Properties& prp) const { map < string, string > processors; static int s_idd = 9999999; string id; - for (LCDD::Properties::const_iterator i = prp.begin(); i != prp.end(); ++i) { + for (Detector::Properties::const_iterator i = prp.begin(); i != prp.end(); ++i) { const string& nam = (*i).first; - const LCDD::PropertyValues& vals = (*i).second; + const Detector::PropertyValues& vals = (*i).second; if (nam.substr(0, 6) == "geant4") { - LCDD::PropertyValues::const_iterator id_it = vals.find("id"); + Detector::PropertyValues::const_iterator id_it = vals.find("id"); if (id_it != vals.end()) { id = (*id_it).second; } @@ -928,12 +927,12 @@ void Geant4Converter::handleProperties(LCDD::Properties& prp) const { } } for (map<string, string>::const_iterator i = processors.begin(); i != processors.end(); ++i) { - const Geometry::GeoHandler* hdlr = this; + const GeoHandler* hdlr = this; string nam = (*i).second; - const LCDD::PropertyValues& vals = prp[nam]; + const Detector::PropertyValues& vals = prp[nam]; string type = vals.find("type")->second; string tag = type + "_Geant4_action"; - long result = PluginService::Create<long>(tag, &m_lcdd, hdlr, &vals); + long result = PluginService::Create<long>(tag, &m_detDesc, hdlr, &vals); if (0 == result) { throw runtime_error("Failed to locate plugin to interprete files of type" " \"" + tag + "\" - no factory:" + type); @@ -948,9 +947,9 @@ void Geant4Converter::handleProperties(LCDD::Properties& prp) const { /// Convert the geometry type SensitiveDetector into the corresponding Geant4 object(s). void Geant4Converter::printSensitive(SensitiveDetector sens_det, const set<const TGeoVolume*>& /* volumes */) const { - Geant4GeometryInfo& info = data(); - ConstVolumeSet& volset = info.sensitives[sens_det]; - SensitiveDetector sd = Ref_t(sens_det); + Geant4GeometryInfo& info = data(); + set<const TGeoVolume*>& volset = info.sensitives[sens_det]; + SensitiveDetector sd = Ref_t(sens_det); stringstream str; printout(INFO, "Geant4Converter", "++ SensitiveDetector: %-18s %-20s Hits:%-16s", sd.name(), ("[" + sd.type() + "]").c_str(), @@ -964,8 +963,8 @@ void Geant4Converter::printSensitive(SensitiveDetector sens_det, const set<const str << "."; printout(INFO, "Geant4Converter", str.str().c_str()); - for (ConstVolumeSet::iterator i = volset.begin(); i != volset.end(); ++i) { - map<Volume, G4LogicalVolume*>::iterator v = info.g4Volumes.find(*i); + for (const auto i : volset ) { + map<Volume, G4LogicalVolume*>::iterator v = info.g4Volumes.find(i); G4LogicalVolume* vol = (*v).second; str.str(""); str << " | " << "Volume:" << setw(24) << left << vol->GetName() << " " @@ -1071,7 +1070,7 @@ Geant4Converter& Geant4Converter::create(DetElement top) { // Now place all this stuff appropriately handleRMap(this, *m_data, &Geant4Converter::handlePlacement); //==================== Fields - handleProperties(m_lcdd.properties()); + handleProperties(m_detDesc.properties()); if ( printSensitives ) { handleMap(this, geo.sensitives, &Geant4Converter::printSensitive); } diff --git a/DDG4/src/Geant4Converter.cpp.save b/DDG4/src/Geant4Converter.cpp.save index 26608774a..556540503 100644 --- a/DDG4/src/Geant4Converter.cpp.save +++ b/DDG4/src/Geant4Converter.cpp.save @@ -1,13 +1,13 @@ // $Id: Geant4Converter.cpp 788 2013-09-20 17:04:50Z gaede $ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : M.Frank // //==================================================================== -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DD4hep/Volumes.h" #include "DD4hep/Printout.h" @@ -79,9 +79,9 @@ #include <iomanip> #include <sstream> -using namespace DD4hep::Simulation; -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::sim; +using namespace dd4hep::detail; +using namespace dd4hep; using namespace std; #define private public @@ -225,8 +225,8 @@ namespace { } /// Initializing Constructor -Geant4Converter::Geant4Converter( LCDD& lcdd ) - : Geant4Mapping(lcdd), m_checkOverlaps(true) +Geant4Converter::Geant4Converter( Detector& description ) + : Geant4Mapping(description), m_checkOverlaps(true) { this->Geant4Mapping::init(); } @@ -659,7 +659,7 @@ void* Geant4Converter::handleRegion(const TNamed* region, const set<const TGeoVo vector<string>& limits = r.limits(); for(vector<string>::const_iterator i=limits.begin(); i!=limits.end(); ++i) { const string& nam = *i; - LimitSet ls = m_lcdd.limitSet(nam); + LimitSet ls = m_detDesc.limitSet(nam); if ( ls.isValid() ) { bool found = false; const LimitMap& lm = data().g4Limits; @@ -713,15 +713,15 @@ void* Geant4Converter::handleSensitive(const TNamed* sens_det, const set<const T if ( !g4 ) { SensitiveDetector sd = Ref_t(sens_det); string type = sd.type(), name = sd.name(); - g4 = PluginService::Create<G4VSensitiveDetector*>(type,name,&m_lcdd); + g4 = PluginService::Create<G4VSensitiveDetector*>(type,name,&m_detDesc); if ( !g4 ) { string tmp = type; tmp[0] = ::toupper(tmp[0]); type = "Geant4"+tmp; - g4 = PluginService::Create<G4VSensitiveDetector*>(type,name,&m_lcdd); + g4 = PluginService::Create<G4VSensitiveDetector*>(type,name,&m_detDesc); if ( !g4 ) { PluginDebug dbg; - g4 = ROOT::Reflex::PluginService::Create<G4VSensitiveDetector*>(type,name,&m_lcdd); + g4 = ROOT::Reflex::PluginService::Create<G4VSensitiveDetector*>(type,name,&m_detDesc); throw runtime_error("Geant4Converter<SensitiveDetector>: FATAL Failed to " "create Geant4 sensitive detector factory "+name+" of type "+type+"."); } @@ -761,15 +761,15 @@ void* Geant4Converter::handleVis(const string& /* name */, const TNamed* vis) co } /// Handle the geant 4 specific properties -void Geant4Converter::handleProperties(LCDD::Properties& prp) const { +void Geant4Converter::handleProperties(Detector::Properties& prp) const { map<string,string> processors; static int s_idd = 9999999; string id; - for(LCDD::Properties::const_iterator i=prp.begin(); i!=prp.end(); ++i) { + for(Detector::Properties::const_iterator i=prp.begin(); i!=prp.end(); ++i) { const string& nam = (*i).first; - const LCDD::PropertyValues& vals = (*i).second; + const Detector::PropertyValues& vals = (*i).second; if ( nam.substr(0,6) == "geant4" ) { - LCDD::PropertyValues::const_iterator id_it = vals.find("id"); + Detector::PropertyValues::const_iterator id_it = vals.find("id"); if ( id_it != vals.end() ) { id= (*id_it).second; } @@ -784,10 +784,10 @@ void Geant4Converter::handleProperties(LCDD::Properties& prp) const { for(map<string,string>::const_iterator i=processors.begin(); i!=processors.end(); ++i) { const Geant4Converter* ptr = this; string nam = (*i).second; - const LCDD::PropertyValues& vals = prp[nam]; + const Detector::PropertyValues& vals = prp[nam]; string type = vals.find("type")->second; string tag = type + "_Geant4_action"; - long result = ROOT::Reflex::PluginService::Create<long>(tag,&m_lcdd,ptr,&vals); + long result = ROOT::Reflex::PluginService::Create<long>(tag,&m_detDesc,ptr,&vals); if ( 0 == result ) { throw runtime_error("Failed to locate plugin to interprete files of type" " \""+tag+"\" - no factory:"+type); @@ -907,9 +907,9 @@ Geant4Converter& Geant4Converter::create(DetElement top) { // We do not have to handle defines etc. // All positions and the like are not really named. // Hence, start creating the G4 objects for materials, solids and log volumes. - Material mat = m_lcdd.material("Argon"); + Material mat = m_detDesc.material("Argon"); handleMaterial(mat.name(),mat.ptr()); - mat = m_lcdd.material("Silicon"); + mat = m_detDesc.material("Silicon"); handleMaterial(mat.name(),mat.ptr()); handle(this, geo.volumes, &Geant4Converter::collectVolume); @@ -928,7 +928,7 @@ Geant4Converter& Geant4Converter::create(DetElement top) { // Now place all this stuff appropriately handleRMap(this, *m_data, &Geant4Converter::handlePlacement); //==================== Fields - handleProperties(m_lcdd.properties()); + handleProperties(m_detDesc.properties()); //handleMap(this, geo.sensitives, &Geant4Converter::printSensitive); //handleRMap(this, *m_data, &Geant4Converter::printPlacement); diff --git a/DDG4/src/Geant4Data.cpp b/DDG4/src/Geant4Data.cpp index 7e6229f88..07218db10 100644 --- a/DDG4/src/Geant4Data.cpp +++ b/DDG4/src/Geant4Data.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,8 +24,8 @@ #include "G4OpticalPhoton.hh" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Default constructor SimpleRun::SimpleRun() diff --git a/DDG4/src/Geant4DataConversion.cpp b/DDG4/src/Geant4DataConversion.cpp index c6944865a..bcb7fe2a9 100644 --- a/DDG4/src/Geant4DataConversion.cpp +++ b/DDG4/src/Geant4DataConversion.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,7 +14,7 @@ // Framework include files #include "DDG4/Geant4DataConversion.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Default constructor Geant4ConversionHelper::Geant4ConversionHelper() { @@ -26,20 +25,20 @@ Geant4ConversionHelper::~Geant4ConversionHelper() { } /// Access to the data encoding using the volume manager and a specified volume id -std::string Geant4ConversionHelper::encoding(Geometry::VolumeManager vm, Geometry::VolumeManager::VolumeID vid) { - Geometry::PlacedVolume pv = vm.lookupPlacement(vid); - Geometry::SensitiveDetector sd = pv.volume().sensitiveDetector(); +std::string Geant4ConversionHelper::encoding(VolumeManager vm, VolumeID vid) { + PlacedVolume pv = vm.lookupPlacement(vid); + SensitiveDetector sd = pv.volume().sensitiveDetector(); return encoding(sd); } /// Access to the hit encoding in this sensitive detector -std::string Geant4ConversionHelper::encoding(Geometry::Handle<Geometry::SensitiveDetectorObject> sd) { - Geometry::IDDescriptor id = Geometry::SensitiveDetector(sd).readout().idSpec(); +std::string Geant4ConversionHelper::encoding(Handle<SensitiveDetectorObject> sd) { + IDDescriptor id = SensitiveDetector(sd).readout().idSpec(); return id.fieldDescription(); } /// Access to the hit encoding in this readout object -std::string Geant4ConversionHelper::encoding(Geometry::Readout ro) { - Geometry::IDDescriptor id = ro.idSpec(); +std::string Geant4ConversionHelper::encoding(Readout ro) { + IDDescriptor id = ro.idSpec(); return id.fieldDescription(); } diff --git a/DDG4/src/Geant4DataDump.cpp b/DDG4/src/Geant4DataDump.cpp index 1306d9c00..d0f420f0c 100644 --- a/DDG4/src/Geant4DataDump.cpp +++ b/DDG4/src/Geant4DataDump.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,10 +17,10 @@ #include "DDG4/Geant4DataDump.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; -typedef ReferenceBitMask<const int> PropertyMask; +typedef detail::ReferenceBitMask<const int> PropertyMask; /// Default constructor Geant4DataDump::Geant4DataDump(const std::string& tag) : m_tag(tag) { diff --git a/DDG4/src/Geant4DetectorConstruction.cpp b/DDG4/src/Geant4DetectorConstruction.cpp index a58e755de..286e477f3 100644 --- a/DDG4/src/Geant4DetectorConstruction.cpp +++ b/DDG4/src/Geant4DetectorConstruction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,8 +21,8 @@ #include "G4SDManager.hh" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Helper: Assign sensitive detector to logical volume void Geant4DetectorConstructionContext::setSensitiveDetector(G4LogicalVolume* vol, G4VSensitiveDetector* sd) { @@ -100,7 +100,7 @@ void Geant4DetectorConstructionSequence::constructSensitives(Geant4DetectorConst } /// Access to the converted regions -const Geant4GeometryMaps::RegionMap& Geant4DetectorConstructionSequence::regions() const { +const map<Region, G4Region*>& Geant4DetectorConstructionSequence::regions() const { Geant4GeometryInfo* p = Geant4Mapping::instance().ptr(); if ( p ) return p->g4Regions; throw runtime_error("+++ Geant4DetectorConstructionSequence::regions: Access not possible. Geometry is not yet converted!"); @@ -114,35 +114,35 @@ const Geant4GeometryMaps::SensDetMap& Geant4DetectorConstructionSequence::sensit } #endif /// Access to the converted volumes -const Geant4GeometryMaps::VolumeMap& Geant4DetectorConstructionSequence::volumes() const { +const map<Volume, G4LogicalVolume*>& Geant4DetectorConstructionSequence::volumes() const { Geant4GeometryInfo* p = Geant4Mapping::instance().ptr(); if ( p ) return p->g4Volumes; throw runtime_error("+++ Geant4DetectorConstructionSequence::volumes: Access not possible. Geometry is not yet converted!"); } /// Access to the converted shapes -const Geant4GeometryMaps::SolidMap& Geant4DetectorConstructionSequence::shapes() const { +const map<const TGeoShape*, G4VSolid*>& Geant4DetectorConstructionSequence::shapes() const { Geant4GeometryInfo* p = Geant4Mapping::instance().ptr(); if ( p ) return p->g4Solids; throw runtime_error("+++ Geant4DetectorConstructionSequence::shapes: Access not possible. Geometry is not yet converted!"); } /// Access to the converted limit sets -const Geant4GeometryMaps::LimitMap& Geant4DetectorConstructionSequence::limits() const { +const map<LimitSet, G4UserLimits*>& Geant4DetectorConstructionSequence::limits() const { Geant4GeometryInfo* p = Geant4Mapping::instance().ptr(); if ( p ) return p->g4Limits; throw runtime_error("+++ Geant4DetectorConstructionSequence::limits: Access not possible. Geometry is not yet converted!"); } /// Access to the converted assemblies -const Geant4GeometryMaps::AssemblyMap& Geant4DetectorConstructionSequence::assemblies() const { +const map<PlacedVolume, Geant4AssemblyVolume*>& Geant4DetectorConstructionSequence::assemblies() const { Geant4GeometryInfo* p = Geant4Mapping::instance().ptr(); if ( p ) return p->g4AssemblyVolumes; throw runtime_error("+++ Geant4DetectorConstructionSequence::assemblies: Access not possible. Geometry is not yet converted!"); } /// Access to the converted placements -const Geant4GeometryMaps::PlacementMap& Geant4DetectorConstructionSequence::placements() const { +const map<PlacedVolume, G4VPhysicalVolume*>& Geant4DetectorConstructionSequence::placements() const { Geant4GeometryInfo* p = Geant4Mapping::instance().ptr(); if ( p ) return p->g4Placements; throw runtime_error("+++ Geant4DetectorConstructionSequence::placements: Access not possible. Geometry is not yet converted!"); diff --git a/DDG4/src/Geant4EventAction.cpp b/DDG4/src/Geant4EventAction.cpp index b4ec0cab4..5e12acdb0 100644 --- a/DDG4/src/Geant4EventAction.cpp +++ b/DDG4/src/Geant4EventAction.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +21,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace { G4Mutex event_action_mutex=G4MUTEX_INITIALIZER; @@ -57,7 +56,7 @@ Geant4SharedEventAction::Geant4SharedEventAction(Geant4Context* ctxt, const stri /// Default destructor Geant4SharedEventAction::~Geant4SharedEventAction() { - releasePtr(m_action); + detail::releasePtr(m_action); InstanceCount::decrement(this); } diff --git a/DDG4/src/Geant4Exec.cpp b/DDG4/src/Geant4Exec.cpp index 04d6832ae..ec8c721e0 100644 --- a/DDG4/src/Geant4Exec.cpp +++ b/DDG4/src/Geant4Exec.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -52,10 +51,10 @@ namespace { } /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Sequence handler implementing common actions to all sequences. template <typename T> class SequenceHdl { @@ -85,7 +84,7 @@ namespace DD4hep { } } void _release() { - releasePtr(m_sequence); + detail::releasePtr(m_sequence); InstanceCount::decrement(this); } Geant4Context* context() const { @@ -107,7 +106,7 @@ namespace DD4hep { Geant4Run* r = m_activeContext->runPtr(); if ( r ) { m_activeContext->setRun(0); - deletePtr(r); + detail::deletePtr(r); } } void createClientContext(const G4Event* evt) { @@ -118,7 +117,7 @@ namespace DD4hep { Geant4Event* e = m_activeContext->eventPtr(); if ( e ) { m_activeContext->setEvent(0); - deletePtr(e); + detail::deletePtr(e); } } }; @@ -309,7 +308,7 @@ namespace DD4hep { /// Standard constructor Geant4UserDetectorConstruction(Geant4Context* ctxt, Geant4DetectorConstructionSequence* seq) : G4VUserDetectorConstruction(), Base(ctxt, seq), - m_ctxt(ctxt->kernel().lcdd(), this) + m_ctxt(ctxt->kernel().detectorDescription(), this) { } /// Default destructor @@ -394,7 +393,7 @@ namespace DD4hep { updateContext(ctx); } - /// Construct electro magnetic field entity from the DD4hep field + /// Construct electro magnetic field entity from the dd4hep field G4VPhysicalVolume* Geant4UserDetectorConstruction::Construct() { // The G4TransportationManager is thread-local. // Thus, regardless of whether the field class object is global or local @@ -468,14 +467,14 @@ namespace DD4hep { } } -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DDG4/Geant4DetectorConstruction.h" #include "DDG4/Geant4Kernel.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; // Geant4 include files #include "G4RunManager.hh" @@ -493,7 +492,7 @@ Geant4DetectorConstructionSequence* Geant4Compatibility::buildDefaultDetectorCon Geant4DetectorConstructionSequence* seq = kernel.detectorConstruction(true); printout(WARNING, "Geant4Exec", "+++ Building default Geant4DetectorConstruction for single threaded compatibility."); - // Attach first the geometry converter from DD4hep to Geant4 + // Attach first the geometry converter from dd4hep to Geant4 cr = PluginService::Create<Geant4Action*>("Geant4DetectorGeometryConstruction",ctx,string("ConstructGeometry")); det_cr = dynamic_cast<Geant4DetectorConstruction*>(cr); if ( det_cr ) @@ -512,7 +511,7 @@ Geant4DetectorConstructionSequence* Geant4Compatibility::buildDefaultDetectorCon /// Configure the simulation int Geant4Exec::configure(Geant4Kernel& kernel) { - Geometry::LCDD& lcdd = kernel.lcdd(); + Detector& description = kernel.detectorDescription(); Geant4Context* ctx = kernel.workerContext(); Geant4Random* rndm = Geant4Random::instance(false); @@ -528,10 +527,10 @@ int Geant4Exec::configure(Geant4Kernel& kernel) { G4RunManager& runManager = kernel.runManager(); // Check if the geometry was loaded - if (lcdd.sensitiveDetectors().size() <= 1) { + if (description.sensitiveDetectors().size() <= 1) { printout(WARNING, "Geant4Exec", "+++ Only %d subdetectors present. " "You sure you loaded the geometry properly?", - int(lcdd.sensitiveDetectors().size())); + int(description.sensitiveDetectors().size())); } // Get the detector constructed diff --git a/DDG4/src/Geant4Field.cpp b/DDG4/src/Geant4Field.cpp index 3033736d4..811df35c4 100644 --- a/DDG4/src/Geant4Field.cpp +++ b/DDG4/src/Geant4Field.cpp @@ -1,6 +1,5 @@ -// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,16 +15,17 @@ #include "DDG4/Geant4Field.h" #include "DD4hep/DD4hepUnits.h" #include "CLHEP/Units/SystemOfUnits.h" +namespace units = dd4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; G4bool Geant4Field::DoesFieldChangeEnergy() const { return m_field.changesEnergy(); } void Geant4Field::GetFieldValue(const double pos[4], double *field) const { - static const double fac1 = dd4hep::mm/CLHEP::mm; - static const double fac2 = CLHEP::tesla/dd4hep::tesla; + static const double fac1 = units::mm/CLHEP::mm; + static const double fac2 = CLHEP::tesla/units::tesla; double p[3] = {pos[0]*fac1, pos[1]*fac1, pos[2]*fac1}; // Convert from CLHEP units to tgeo units field[0] = field[1] = field[2] = 0.0; // Reset field vector m_field.magneticField(p, field); diff --git a/DDG4/src/Geant4GDMLDetector.cpp b/DDG4/src/Geant4GDMLDetector.cpp index 18816057e..ca968ea36 100644 --- a/DDG4/src/Geant4GDMLDetector.cpp +++ b/DDG4/src/Geant4GDMLDetector.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,13 +25,13 @@ #endif using namespace std; -using namespace DD4hep; +using namespace dd4hep; -DD4hep::Simulation::Geant4GDMLDetector::Geant4GDMLDetector(const std::string& gdmlFile) +dd4hep::sim::Geant4GDMLDetector::Geant4GDMLDetector(const std::string& gdmlFile) : m_fileName(gdmlFile), m_world(0) { } -G4VPhysicalVolume* DD4hep::Simulation::Geant4GDMLDetector::Construct() { +G4VPhysicalVolume* dd4hep::sim::Geant4GDMLDetector::Construct() { #ifdef GEANT4_HAS_GDML G4GDMLParser parser; parser.Read( m_fileName ); diff --git a/DDG4/src/Geant4GeneratorAction.cpp b/DDG4/src/Geant4GeneratorAction.cpp index 7b5a74a96..da144575f 100644 --- a/DDG4/src/Geant4GeneratorAction.cpp +++ b/DDG4/src/Geant4GeneratorAction.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +21,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace { G4Mutex action_mutex=G4MUTEX_INITIALIZER; @@ -48,7 +47,7 @@ Geant4SharedGeneratorAction::Geant4SharedGeneratorAction(Geant4Context* ctxt, co /// Default destructor Geant4SharedGeneratorAction::~Geant4SharedGeneratorAction() { - releasePtr(m_action); + detail::releasePtr(m_action); InstanceCount::decrement(this); } diff --git a/DDG4/src/Geant4GeneratorActionInit.cpp b/DDG4/src/Geant4GeneratorActionInit.cpp index 107ccd949..e86fda8f1 100644 --- a/DDG4/src/Geant4GeneratorActionInit.cpp +++ b/DDG4/src/Geant4GeneratorActionInit.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ #include "G4Run.hh" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4GeneratorActionInit::Geant4GeneratorActionInit(Geant4Context* ctxt, const std::string& nam) diff --git a/DDG4/src/Geant4GeneratorWrapper.cpp b/DDG4/src/Geant4GeneratorWrapper.cpp index 47005db88..6086cbfc6 100644 --- a/DDG4/src/Geant4GeneratorWrapper.cpp +++ b/DDG4/src/Geant4GeneratorWrapper.cpp @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -32,7 +32,7 @@ #include <stdexcept> #include <set> -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; using namespace std; /// Standard constructor @@ -46,7 +46,7 @@ Geant4GeneratorWrapper::Geant4GeneratorWrapper(Geant4Context* ctxt, const string /// Default destructor Geant4GeneratorWrapper::~Geant4GeneratorWrapper() { - deletePtr(m_generator); + detail::deletePtr(m_generator); InstanceCount::decrement(this); } diff --git a/DDG4/src/Geant4GeometryInfo.cpp b/DDG4/src/Geant4GeometryInfo.cpp index ab4bfb686..c97474dd7 100644 --- a/DDG4/src/Geant4GeometryInfo.cpp +++ b/DDG4/src/Geant4GeometryInfo.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,10 +20,10 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; -string Geant4GeometryMaps::placementPath(const Geant4PlacementPath& path, bool reverse) { +string Geant4GeometryInfo::placementPath(const Geant4PlacementPath& path, bool reverse) { string s; if ( reverse ) { for (Geant4PlacementPath::const_reverse_iterator pIt = path.rbegin(); pIt != path.rend(); ++pIt) { diff --git a/DDG4/src/Geant4Handle.cpp b/DDG4/src/Geant4Handle.cpp index 371f6a03e..63aea5366 100644 --- a/DDG4/src/Geant4Handle.cpp +++ b/DDG4/src/Geant4Handle.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" @@ -38,14 +38,14 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; namespace { G4Mutex creation_mutex=G4MUTEX_INITIALIZER; } -namespace DD4hep { - namespace Simulation { +namespace dd4hep { + namespace sim { template <typename TYPE> static inline TYPE* checked_value(TYPE* p) { @@ -215,11 +215,11 @@ namespace DD4hep { return *this; } - //namespace DD4hep { - // namespace Simulation { + //namespace dd4hep { + // namespace sim { KernelHandle::KernelHandle() { - value = &Geant4Kernel::instance(Geometry::LCDD::getInstance()); + value = &Geant4Kernel::instance(Detector::getInstance()); } KernelHandle::KernelHandle(Geant4Kernel* k) : value(k) { } @@ -237,67 +237,67 @@ namespace DD4hep { template <> Geant4Handle<Geant4RunAction>::Geant4Handle(Geant4Kernel& kernel, const string& type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::runAction,type_name, - "Geant4SharedRunAction",shared,(handled_type*)0); + "Geant4SharedRunAction",shared,null()); } template <> Geant4Handle<Geant4RunAction>::Geant4Handle(Geant4Kernel& kernel, const char* type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::runAction,type_name, - "Geant4SharedRunAction",shared,(handled_type*)0); + "Geant4SharedRunAction",shared,null()); } template <> Geant4Handle<Geant4EventAction>::Geant4Handle(Geant4Kernel& kernel, const string& type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::eventAction,type_name, - "Geant4SharedEventAction",shared,(handled_type*)0); + "Geant4SharedEventAction",shared,null()); } template <> Geant4Handle<Geant4EventAction>::Geant4Handle(Geant4Kernel& kernel, const char* type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::eventAction,type_name, - "Geant4SharedEventAction",shared,(handled_type*)0); + "Geant4SharedEventAction",shared,null()); } template <> Geant4Handle<Geant4GeneratorAction>::Geant4Handle(Geant4Kernel& kernel, const string& type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::generatorAction,type_name, - "Geant4SharedGeneratorAction",shared,(handled_type*)0); + "Geant4SharedGeneratorAction",shared,null()); } template <> Geant4Handle<Geant4GeneratorAction>::Geant4Handle(Geant4Kernel& kernel, const char* type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::generatorAction,type_name, - "Geant4SharedGeneratorAction",shared,(handled_type*)0); + "Geant4SharedGeneratorAction",shared,null()); } template <> Geant4Handle<Geant4TrackingAction>::Geant4Handle(Geant4Kernel& kernel, const string& type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::trackingAction,type_name, - "Geant4SharedTrackingAction",shared,(handled_type*)0); + "Geant4SharedTrackingAction",shared,null()); } template <> Geant4Handle<Geant4TrackingAction>::Geant4Handle(Geant4Kernel& kernel, const char* type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::trackingAction,type_name, - "Geant4SharedTrackingAction",shared,(handled_type*)0); + "Geant4SharedTrackingAction",shared,null()); } template <> Geant4Handle<Geant4SteppingAction>::Geant4Handle(Geant4Kernel& kernel, const string& type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::steppingAction,type_name, - "Geant4SharedSteppingAction",shared,(handled_type*)0); + "Geant4SharedSteppingAction",shared,null()); } template <> Geant4Handle<Geant4SteppingAction>::Geant4Handle(Geant4Kernel& kernel, const char* type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::steppingAction,type_name, - "Geant4SharedSteppingAction",shared,(handled_type*)0); + "Geant4SharedSteppingAction",shared,null()); } template <> Geant4Handle<Geant4StackingAction>::Geant4Handle(Geant4Kernel& kernel, const string& type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::stackingAction,type_name, - "Geant4SharedStackingAction",shared,(handled_type*)0); + "Geant4SharedStackingAction",shared,null()); } template <> Geant4Handle<Geant4StackingAction>::Geant4Handle(Geant4Kernel& kernel, const char* type_name, bool shared) { value = _create_share(kernel,&Geant4ActionContainer::stackingAction,type_name, - "Geant4SharedStackingAction",shared,(handled_type*)0); + "Geant4SharedStackingAction",shared,null()); } template <> Geant4Handle<Geant4Sensitive>::Geant4Handle(Geant4Kernel& kernel, const string& type_name, @@ -305,9 +305,9 @@ namespace DD4hep { try { Geant4Context* ctxt = kernel.workerContext(); TypeName typ = TypeName::split(type_name); - Geometry::LCDD& lcdd = kernel.lcdd(); - Geometry::DetElement det = lcdd.detector(detector); - Geant4Sensitive* object = PluginService::Create<Geant4Sensitive*>(typ.first, ctxt, typ.second, &det, &lcdd); + Detector& description = kernel.detectorDescription(); + DetElement det = description.detector(detector); + Geant4Sensitive* object = PluginService::Create<Geant4Sensitive*>(typ.first, ctxt, typ.second, &det, &description); if (object) { value = object; return; diff --git a/DDG4/src/Geant4HierarchyDump.cpp b/DDG4/src/Geant4HierarchyDump.cpp index 9f5d9c72d..74412bf39 100644 --- a/DDG4/src/Geant4HierarchyDump.cpp +++ b/DDG4/src/Geant4HierarchyDump.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DD4hep/Volumes.h" #include "DD4hep/Printout.h" @@ -60,9 +59,8 @@ #include <iomanip> #include <sstream> -using namespace DD4hep::Simulation; -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::sim; +using namespace dd4hep; using namespace std; static const char* _T(const std::string& s) { @@ -82,8 +80,7 @@ enum { static unsigned long m_flags = ~0x0UL; /// Initializing Constructor -Geant4HierarchyDump::Geant4HierarchyDump(LCDD& lcdd) -: m_lcdd(lcdd) { +Geant4HierarchyDump::Geant4HierarchyDump(Detector& description) : m_detDesc(description) { } /// Standard destructor diff --git a/DDG4/src/Geant4HitCollection.cpp b/DDG4/src/Geant4HitCollection.cpp index a6f6988f6..3e156d82b 100644 --- a/DDG4/src/Geant4HitCollection.cpp +++ b/DDG4/src/Geant4HitCollection.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,8 +18,8 @@ #include "DDG4/Geant4Data.h" #include "G4Allocator.hh" -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; G4ThreadLocal G4Allocator<Geant4HitWrapper>* HitWrapperAllocator = 0; diff --git a/DDG4/src/Geant4Hits.cpp b/DDG4/src/Geant4Hits.cpp index acf871076..be7154a33 100644 --- a/DDG4/src/Geant4Hits.cpp +++ b/DDG4/src/Geant4Hits.cpp @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,7 +26,7 @@ #include <iostream> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; G4ThreadLocal G4Allocator<Geant4TrackerHit>* TrackerHitAllocator = 0; G4ThreadLocal G4Allocator<Geant4CalorimeterHit>* CalorimeterHitAllocator = 0; diff --git a/DDG4/src/Geant4InputAction.cpp b/DDG4/src/Geant4InputAction.cpp index d45f122c3..16ad21e6b 100644 --- a/DDG4/src/Geant4InputAction.cpp +++ b/DDG4/src/Geant4InputAction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,8 +22,8 @@ #include "G4Event.hh" using namespace std; -using namespace DD4hep::Simulation; -typedef DD4hep::ReferenceBitMask<int> PropertyMask; +using namespace dd4hep::sim; +typedef dd4hep::detail::ReferenceBitMask<int> PropertyMask; typedef Geant4InputAction::Vertices Vertices ; @@ -48,7 +48,7 @@ Geant4EventReader::EventReaderStatus Geant4EventReader::skipEvent() { ++m_currEvent; EventReaderStatus sc = readParticles(m_currEvent,vertices,particles); - for_each(particles.begin(),particles.end(),deleteObject<Particle>); + for_each(particles.begin(),particles.end(),detail::deleteObject<Particle>); return sc; } diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp index fe174a7aa..2fa767798 100644 --- a/DDG4/src/Geant4InputHandling.cpp +++ b/DDG4/src/Geant4InputHandling.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -31,14 +31,14 @@ #include <cmath> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; -typedef ReferenceBitMask<int> PropertyMask; +typedef detail::ReferenceBitMask<int> PropertyMask; /// Create a vertex object from the Geant4 primary vertex -Geant4Vertex* DD4hep::Simulation::createPrimary(const G4PrimaryVertex* g4) { +Geant4Vertex* dd4hep::sim::createPrimary(const G4PrimaryVertex* g4) { Geant4Vertex* v = new Geant4Vertex(); v->x = g4->GetX0(); v->y = g4->GetY0(); @@ -49,7 +49,7 @@ Geant4Vertex* DD4hep::Simulation::createPrimary(const G4PrimaryVertex* g4) /// Create a particle object from the Geant4 primary particle Geant4Particle* -DD4hep::Simulation::createPrimary(int particle_id, +dd4hep::sim::createPrimary(int particle_id, const Geant4Vertex* v, const G4PrimaryParticle* g4p) { @@ -119,7 +119,7 @@ static void collectPrimaries(Geant4PrimaryMap* pm, /// Import a Geant4 interaction defined by a primary vertex into a DDG4 interaction record Geant4PrimaryInteraction* -DD4hep::Simulation::createPrimary(int mask, +dd4hep::sim::createPrimary(int mask, Geant4PrimaryMap* pm, const G4PrimaryVertex* gv) { @@ -137,7 +137,7 @@ DD4hep::Simulation::createPrimary(int mask, } /// Initialize the generation of one event -int DD4hep::Simulation::generationInitialization(const Geant4Action* /* caller */, +int dd4hep::sim::generationInitialization(const Geant4Action* /* caller */, const Geant4Context* context) { /** @@ -219,7 +219,7 @@ static void rebaseVertices(Geant4PrimaryInteraction::VertexMap& vertices, int pa } } /// Merge all interactions present in the context -int DD4hep::Simulation::mergeInteractions(const Geant4Action* caller, +int dd4hep::sim::mergeInteractions(const Geant4Action* caller, const Geant4Context* context) { typedef Geant4PrimaryEvent::Interaction Interaction; @@ -250,7 +250,7 @@ int DD4hep::Simulation::mergeInteractions(const Geant4Action* caller, } /// Boost particles of one interaction identified by its mask -int DD4hep::Simulation::boostInteraction(const Geant4Action* caller, +int dd4hep::sim::boostInteraction(const Geant4Action* caller, Geant4PrimaryEvent::Interaction* inter, double alpha) { @@ -306,7 +306,7 @@ int DD4hep::Simulation::boostInteraction(const Geant4Action* caller, } /// Smear the primary vertex of an interaction -int DD4hep::Simulation::smearInteraction(const Geant4Action* caller, +int dd4hep::sim::smearInteraction(const Geant4Action* caller, Geant4PrimaryEvent::Interaction* inter, double dx, double dy, double dz, double dt) { @@ -415,7 +415,7 @@ getRelevant(set<int>& visited, } /// Generate all primary vertices corresponding to the merged interaction -int DD4hep::Simulation::generatePrimaries(const Geant4Action* caller, +int dd4hep::sim::generatePrimaries(const Geant4Action* caller, const Geant4Context* context, G4Event* event) { diff --git a/DDG4/src/Geant4InteractionMerger.cpp b/DDG4/src/Geant4InteractionMerger.cpp index ea47479f4..6cf153817 100644 --- a/DDG4/src/Geant4InteractionMerger.cpp +++ b/DDG4/src/Geant4InteractionMerger.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include "DDG4/Geant4InputHandling.h" #include "DDG4/Geant4InteractionMerger.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4InteractionMerger::Geant4InteractionMerger(Geant4Context* ctxt, const std::string& nam) diff --git a/DDG4/src/Geant4InteractionVertexBoost.cpp b/DDG4/src/Geant4InteractionVertexBoost.cpp index 369e6e12d..b73a72179 100644 --- a/DDG4/src/Geant4InteractionVertexBoost.cpp +++ b/DDG4/src/Geant4InteractionVertexBoost.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include "DDG4/Geant4InputHandling.h" #include "DDG4/Geant4InteractionVertexBoost.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4InteractionVertexBoost::Geant4InteractionVertexBoost(Geant4Context* ctxt, const std::string& nam) diff --git a/DDG4/src/Geant4InteractionVertexSmear.cpp b/DDG4/src/Geant4InteractionVertexSmear.cpp index 396f35f96..41be15c27 100644 --- a/DDG4/src/Geant4InteractionVertexSmear.cpp +++ b/DDG4/src/Geant4InteractionVertexSmear.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +23,7 @@ // C/C++ include files #include <cmath> -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4InteractionVertexSmear::Geant4InteractionVertexSmear(Geant4Context* ctxt, const std::string& nam) diff --git a/DDG4/src/Geant4IsotropeGenerator.cpp b/DDG4/src/Geant4IsotropeGenerator.cpp index f8157a4bd..236ad8fd8 100644 --- a/DDG4/src/Geant4IsotropeGenerator.cpp +++ b/DDG4/src/Geant4IsotropeGenerator.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include "DDG4/Geant4IsotropeGenerator.h" using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4IsotropeGenerator::Geant4IsotropeGenerator(Geant4Context* ctxt, const string& nam) diff --git a/DDG4/src/Geant4Kernel.cpp b/DDG4/src/Geant4Kernel.cpp index 0e0e0934c..f2f326926 100644 --- a/DDG4/src/Geant4Kernel.cpp +++ b/DDG4/src/Geant4Kernel.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Memory.h" #include "DD4hep/Printout.h" #include "DD4hep/Primitives.h" @@ -39,11 +39,11 @@ #include <memory> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace { G4Mutex kernel_mutex=G4MUTEX_INITIALIZER; - DD4hep::dd4hep_ptr<Geant4Kernel> s_main_instance(0); + dd4hep::dd4hep_ptr<Geant4Kernel> s_main_instance(0); } /// Standard constructor @@ -74,12 +74,12 @@ Geant4ActionPhase& Geant4Kernel::PhaseSelector::operator[](const std::string& na } /// Standard constructor -Geant4Kernel::Geant4Kernel(LCDD& lcdd_ref) - : Geant4ActionContainer(), m_runManager(0), m_control(0), m_trackMgr(0), m_lcdd(&lcdd_ref), +Geant4Kernel::Geant4Kernel(Detector& description_ref) + : Geant4ActionContainer(), m_runManager(0), m_control(0), m_trackMgr(0), m_detDesc(&description_ref), m_numThreads(0), m_id(Geant4Kernel::thread_self()), m_master(this), m_shared(0), m_threadContext(0), phase(this) { - m_lcdd->addExtension < Geant4Kernel > (this); + m_detDesc->addExtension < Geant4Kernel > (this); m_ident = -1; declareProperty("UI",m_uiName); declareProperty("OutputLevel", m_outputLevel = DEBUG); @@ -90,18 +90,18 @@ Geant4Kernel::Geant4Kernel(LCDD& lcdd_ref) m_control = new G4UIdirectory(m_controlName.c_str()); m_control->SetGuidance("Control for named Geant4 actions"); setContext(new Geant4Context(this)); - //m_shared = new Geant4Kernel(lcdd_ref, this, -2); + //m_shared = new Geant4Kernel(description_ref, this, -2); InstanceCount::increment(this); } /// Standard constructor Geant4Kernel::Geant4Kernel(Geant4Kernel* m, unsigned long ident) - : Geant4ActionContainer(), m_runManager(0), m_control(0), m_trackMgr(0), m_lcdd(0), + : Geant4ActionContainer(), m_runManager(0), m_control(0), m_trackMgr(0), m_detDesc(0), m_numThreads(1), m_id(ident), m_master(m), m_shared(0), m_threadContext(0), phase(this) { char text[64]; - m_lcdd = m_master->m_lcdd; + m_detDesc = m_master->m_detDesc; m_ident = m_master->m_workers.size(); m_numEvent = m_master->m_numEvent; declareProperty("UI",m_uiName = m_master->m_uiName); @@ -120,19 +120,19 @@ Geant4Kernel::~Geant4Kernel() { if ( this == s_main_instance.get() ) { s_main_instance.release(); } - destroyObjects(m_workers); + detail::destroyObjects(m_workers); if ( isMaster() ) { - releaseObjects(m_globalFilters); - releaseObjects(m_globalActions); + detail::releaseObjects(m_globalFilters); + detail::releaseObjects(m_globalActions); } destroyPhases(); - deletePtr(m_runManager); + detail::deletePtr(m_runManager); Geant4ActionContainer::terminate(); - if ( m_lcdd && isMaster() ) { + if ( m_detDesc && isMaster() ) { try { - m_lcdd->removeExtension < Geant4Kernel > (false); - m_lcdd->destroyInstance(); - m_lcdd = 0; + m_detDesc->removeExtension < Geant4Kernel > (false); + m_detDesc->destroyInstance(); + m_detDesc = 0; } catch(...) { } @@ -141,11 +141,11 @@ Geant4Kernel::~Geant4Kernel() { } /// Instance accessor -Geant4Kernel& Geant4Kernel::instance(LCDD& lcdd) { +Geant4Kernel& Geant4Kernel::instance(Detector& description) { if ( 0 == s_main_instance.get() ) { G4AutoLock protection_lock(&kernel_mutex); { if ( 0 == s_main_instance.get() ) { // Need to check again! - s_main_instance.adopt(new Geant4Kernel(lcdd)); + s_main_instance.adopt(new Geant4Kernel(description)); } } } @@ -212,7 +212,7 @@ bool Geant4Kernel::hasProperty(const std::string& name) const { } /// Access single property -DD4hep::Property& Geant4Kernel::property(const std::string& name) { +dd4hep::Property& Geant4Kernel::property(const std::string& name) { return properties()[name]; } @@ -222,14 +222,14 @@ void Geant4Kernel::setOutputLevel(const std::string object, PrintLevel new_level } /// Retrieve the global output level of a named object. -DD4hep::PrintLevel Geant4Kernel::getOutputLevel(const std::string object) const { +dd4hep::PrintLevel Geant4Kernel::getOutputLevel(const std::string object) const { ClientOutputLevels::const_iterator i=m_clientLevels.find(object); if ( i != m_clientLevels.end() ) return (PrintLevel)(*i).second; - return DD4hep::PrintLevel(DD4hep::printLevel()-1); + return dd4hep::PrintLevel(dd4hep::printLevel()-1); } /// Set the output level; returns previous value -DD4hep::PrintLevel Geant4Kernel::setOutputLevel(PrintLevel new_level) { +dd4hep::PrintLevel Geant4Kernel::setOutputLevel(PrintLevel new_level) { int old = m_outputLevel; m_outputLevel = new_level; return (PrintLevel)old; @@ -263,17 +263,17 @@ G4RunManager& Geant4Kernel::runManager() { "a G4RunManager object!")); } -/// Construct detector geometry using lcdd plugin +/// Construct detector geometry using description plugin void Geant4Kernel::loadGeometry(const std::string& compact_file) { char* arg = (char*) compact_file.c_str(); - m_lcdd->apply("DD4hepXMLLoader", 1, &arg); + m_detDesc->apply("dd4hepXMLLoader", 1, &arg); //return *this; } // Utility function to load XML files void Geant4Kernel::loadXML(const char* fname) { const char* args[] = { fname, 0 }; - m_lcdd->apply("DD4hepXMLLoader", 1, (char**) args); + m_detDesc->apply("dd4hepXMLLoader", 1, (char**) args); } int Geant4Kernel::configure() { @@ -309,16 +309,16 @@ int Geant4Kernel::terminate() { Geant4Exec::terminate(*this); } destroyPhases(); - releaseObjects(m_globalFilters); - releaseObjects(m_globalActions); + detail::releaseObjects(m_globalFilters); + detail::releaseObjects(m_globalActions); if ( ptr == this ) { - deletePtr (m_runManager); + detail::deletePtr (m_runManager); } Geant4ActionContainer::terminate(); - if ( ptr == this && m_lcdd ) { - m_lcdd->removeExtension < Geant4Kernel > (false); - m_lcdd->destroyInstance(); - m_lcdd = 0; + if ( ptr == this && m_detDesc ) { + m_detDesc->removeExtension < Geant4Kernel > (false); + m_detDesc->destroyInstance(); + m_detDesc = 0; } return 1; } @@ -447,5 +447,5 @@ bool Geant4Kernel::removePhase(const std::string& nam) { /// Destroy all phases. To be called only at shutdown void Geant4Kernel::destroyPhases() { - destroyObjects(m_phases); + detail::destroyObjects(m_phases); } diff --git a/DDG4/src/Geant4Mapping.cpp b/DDG4/src/Geant4Mapping.cpp index cabd35ca6..9bc8efcf8 100644 --- a/DDG4/src/Geant4Mapping.cpp +++ b/DDG4/src/Geant4Mapping.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,13 +19,13 @@ #include "G4PVPlacement.hh" #include <stdexcept> -using namespace DD4hep::Simulation; -using namespace DD4hep::Geometry; +using namespace dd4hep::sim; +using namespace dd4hep; using namespace std; /// Initializing Constructor -Geant4Mapping::Geant4Mapping(LCDD& lcdd_ref) - : m_lcdd(lcdd_ref), m_dataPtr(0) { +Geant4Mapping::Geant4Mapping(Detector& description_ref) + : m_detDesc(description_ref), m_dataPtr(0) { } /// Standard destructor @@ -37,7 +37,7 @@ Geant4Mapping::~Geant4Mapping() { /// Possibility to define a singleton instance Geant4Mapping& Geant4Mapping::instance() { - static Geant4Mapping inst(LCDD::getInstance()); + static Geant4Mapping inst(Detector::getInstance()); return inst; } @@ -73,10 +73,10 @@ void Geant4Mapping::attach(Geant4GeometryInfo* data_ptr) { Geant4VolumeManager Geant4Mapping::volumeManager() const { if ( m_dataPtr ) { if ( m_dataPtr->g4Paths.empty() ) { - VolumeManager::getVolumeManager(m_lcdd); - return Geant4VolumeManager(m_lcdd, m_dataPtr); + VolumeManager::getVolumeManager(m_detDesc); + return Geant4VolumeManager(m_detDesc, m_dataPtr); } - return Geant4VolumeManager(Geometry::Handle < Geant4GeometryInfo > (m_dataPtr)); + return Geant4VolumeManager(Handle < Geant4GeometryInfo > (m_dataPtr)); } throw runtime_error(format("Geant4Mapping", "Cannot create volume manager without Geant4 geometry info [Invalid-Info]")); } diff --git a/DDG4/src/Geant4MonteCarloTruth.cpp b/DDG4/src/Geant4MonteCarloTruth.cpp index a5e80e997..c512ab6ea 100644 --- a/DDG4/src/Geant4MonteCarloTruth.cpp +++ b/DDG4/src/Geant4MonteCarloTruth.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4MonteCarloTruth.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard action constructor Geant4MonteCarloTruth::Geant4MonteCarloTruth() { diff --git a/DDG4/src/Geant4Output2ROOT.cpp b/DDG4/src/Geant4Output2ROOT.cpp index a479c17c8..b6eef4212 100644 --- a/DDG4/src/Geant4Output2ROOT.cpp +++ b/DDG4/src/Geant4Output2ROOT.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,8 +27,8 @@ #include "TTree.h" #include "TBranch.h" -using namespace DD4hep::Simulation; -using namespace DD4hep; +using namespace dd4hep::sim; +using namespace dd4hep; using namespace std; /// Standard constructor @@ -47,7 +47,7 @@ Geant4Output2ROOT::~Geant4Output2ROOT() { m_tree->Write(); m_file->Close(); m_tree = 0; - deletePtr (m_file); + detail::deletePtr (m_file); } } @@ -67,9 +67,9 @@ TTree* Geant4Output2ROOT::section(const string& nam) { void Geant4Output2ROOT::beginRun(const G4Run* run) { if (!m_file && !m_output.empty()) { TDirectory::TContext ctxt(TDirectory::CurrentDirectory()); - m_file = TFile::Open(m_output.c_str(), "RECREATE", "DD4hep Simulation data"); + m_file = TFile::Open(m_output.c_str(), "RECREATE", "dd4hep Simulation data"); if (m_file->IsZombie()) { - deletePtr (m_file); + detail::deletePtr (m_file); throw runtime_error("Failed to open ROOT output file:'" + m_output + "'"); } m_tree = section("EVENT"); diff --git a/DDG4/src/Geant4OutputAction.cpp b/DDG4/src/Geant4OutputAction.cpp index babb91f26..a49bc42f1 100644 --- a/DDG4/src/Geant4OutputAction.cpp +++ b/DDG4/src/Geant4OutputAction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,8 +22,8 @@ #include "G4HCofThisEvent.hh" #include "G4Event.hh" -using namespace DD4hep::Simulation; -using namespace DD4hep; +using namespace dd4hep::sim; +using namespace dd4hep; using namespace std; /// Standard constructor diff --git a/DDG4/src/Geant4Particle.cpp b/DDG4/src/Geant4Particle.cpp index 899a054b3..d3887835b 100644 --- a/DDG4/src/Geant4Particle.cpp +++ b/DDG4/src/Geant4Particle.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,9 +26,9 @@ #include <iostream> -using namespace DD4hep; -using namespace DD4hep::Simulation; -typedef ReferenceBitMask<int> PropertyMask; +using namespace dd4hep; +using namespace dd4hep::sim; +typedef detail::ReferenceBitMask<int> PropertyMask; /// Default destructor ParticleExtension::~ParticleExtension() { @@ -139,7 +139,7 @@ Geant4Particle& Geant4Particle::get_data(Geant4Particle& c) { #else extension = c.extension; #endif - //dd4hep_ptr<ParticleExtension>(c.extension.release()); + //DD4hep_ptr<ParticleExtension>(c.extension.release()); } return *this; } @@ -244,7 +244,7 @@ void Geant4ParticleHandle::dump1(int level, const std::string& src, const char* for(std::set<int>::const_iterator i=p->parents.begin(); i!=p->parents.end(); ++i) ::snprintf(text+strlen(text),sizeof(text)-strlen(text),"%d ",*i); } - printout((DD4hep::PrintLevel)level,src, + printout((dd4hep::PrintLevel)level,src, "+++ %s %4d def [%-11s,%8s] reason:%8d E:%+.2e %3s #Dau:%3d #Par:%3d%-5s", tag, p->id, p.particleName().c_str(), @@ -263,7 +263,7 @@ void Geant4ParticleHandle::dump2(int level, const std::string& src, const char* if ( p->parents.size() == 0 ) text[0]=0; else if ( p->parents.size() == 1 ) ::snprintf(text,sizeof(text),"/%d",*(p->parents.begin())); else if ( p->parents.size() > 1 ) ::snprintf(text,sizeof(text),"/%d..",*(p->parents.begin())); - printout((DD4hep::PrintLevel)level,src, + printout((dd4hep::PrintLevel)level,src, "+++ %s %4d G4:%4d [%-12s,%8s] reason:%8d " "E:%+.2e in record:%s #Par:%3d%-5s #Dau:%3d", tag, p->id, g4id, @@ -288,7 +288,7 @@ void Geant4ParticleHandle::dumpWithVertex(int level, const std::string& src, con for(std::set<int>::const_iterator i=p->parents.begin(); i!=p->parents.end(); ++i) ::snprintf(text+strlen(text),sizeof(text)-strlen(text),"%d ",*i); } - printout((DD4hep::PrintLevel)level,src, + printout((dd4hep::PrintLevel)level,src, "+++ %s ID:%3d %-12s status:%08X PDG:%6d Vtx:(%+.2e,%+.2e,%+.2e)[mm] " "time: %+.2e [ns] #Dau:%3d #Par:%1d%-6s", tag,p->id,p.particleName().c_str(),p->status,p->pdgID, @@ -311,7 +311,7 @@ void Geant4ParticleHandle::dumpWithMomentum(int level, const std::string& src, c for(std::set<int>::const_iterator i=p->parents.begin(); i!=p->parents.end(); ++i) ::snprintf(text+strlen(text),sizeof(text)-strlen(text),"%d ",*i); } - printout((DD4hep::PrintLevel)level,src, + printout((dd4hep::PrintLevel)level,src, "+++%s ID:%3d %-12s stat:%08X PDG:%6d Mom:(%+.2e,%+.2e,%+.2e)[MeV] " "time: %+.2e [ns] #Dau:%3d #Par:%1d%-6s", tag,p->id,p.particleName().c_str(),p->status,p->pdgID, @@ -333,7 +333,7 @@ void Geant4ParticleHandle::dumpWithMomentumAndVertex(int level, const std::strin for(std::set<int>::const_iterator i=p->parents.begin(); i!=p->parents.end(); ++i) ::snprintf(text+strlen(text),sizeof(text)-strlen(text),"%d ",*i); } - printout((DD4hep::PrintLevel)level,src, + printout((dd4hep::PrintLevel)level,src, "+++%s %3d %-12s stat:%08X PDG:%6d Mom:(%+.2e,%+.2e,%+.2e)[MeV] " "Vtx:(%+.2e,%+.2e,%+.2e)[mm] #Dau:%3d #Par:%1d%-6s", tag,p->id,p.particleName().c_str(),p->status,p->pdgID, @@ -357,7 +357,7 @@ void Geant4ParticleHandle::dump4(int level, const std::string& src, const char* if ( p->parents.end() == p->parents.find(p->g4Parent) ) { ::snprintf(equiv,sizeof(equiv),"/%d",p->g4Parent); } - printout((DD4hep::PrintLevel)level,src, + printout((dd4hep::PrintLevel)level,src, "+++ %s ID:%7d %12s %6d%-7s %7s %3s %5d %3s %+.3e %-4s %-7s %-3s %-3s %2d [%s%s%s] %c%c%c%c -- %c%c%c%c%c%c%c", tag, p->id, @@ -398,7 +398,7 @@ Geant4ParticleMap::~Geant4ParticleMap() { /// Clear particle maps void Geant4ParticleMap::clear() { - releaseObjects(particleMap); + detail::releaseObjects(particleMap); particleMap.clear(); equivalentTracks.clear(); } diff --git a/DDG4/src/Geant4ParticleGenerator.cpp b/DDG4/src/Geant4ParticleGenerator.cpp index 2f822eb8b..4ab75c1bc 100644 --- a/DDG4/src/Geant4ParticleGenerator.cpp +++ b/DDG4/src/Geant4ParticleGenerator.cpp @@ -1,6 +1,6 @@ // $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : M.Frank @@ -26,7 +26,7 @@ using CLHEP::MeV; using CLHEP::GeV; using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4ParticleGenerator::Geant4ParticleGenerator(Geant4Context* ctxt, const string& nam) diff --git a/DDG4/src/Geant4ParticleGun.cpp b/DDG4/src/Geant4ParticleGun.cpp index 5b2307934..f0a720e5e 100644 --- a/DDG4/src/Geant4ParticleGun.cpp +++ b/DDG4/src/Geant4ParticleGun.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,7 +25,7 @@ #include <limits> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4ParticleGun::Geant4ParticleGun(Geant4Context* ctxt, const string& nam) diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp index 8438132cd..265efd5c1 100644 --- a/DDG4/src/Geant4ParticleHandler.cpp +++ b/DDG4/src/Geant4ParticleHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -41,10 +41,10 @@ using CLHEP::MeV; using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; -typedef ReferenceBitMask<int> PropertyMask; +typedef detail::ReferenceBitMask<int> PropertyMask; /// Standard constructor Geant4ParticleHandler::Geant4ParticleHandler(Geant4Context* ctxt, const string& nam) @@ -86,7 +86,7 @@ Geant4ParticleHandler::Geant4ParticleHandler() /// Default destructor Geant4ParticleHandler::~Geant4ParticleHandler() { clear(); - releasePtr(m_userHandler); + detail::releasePtr(m_userHandler); InstanceCount::decrement(this); } @@ -115,7 +115,7 @@ bool Geant4ParticleHandler::adopt(Geant4Action* action) { /// Clear particle maps void Geant4ParticleHandler::clear() { - releaseObjects(m_particleMap); + detail::releaseObjects(m_particleMap); m_particleMap.clear(); m_equivalentTracks.clear(); } diff --git a/DDG4/src/Geant4ParticlePrint.cpp b/DDG4/src/Geant4ParticlePrint.cpp index 66c031e54..922402a6f 100644 --- a/DDG4/src/Geant4ParticlePrint.cpp +++ b/DDG4/src/Geant4ParticlePrint.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,10 +26,10 @@ #include <cstring> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; -typedef ReferenceBitMask<const int> PropertyMask; +typedef detail::ReferenceBitMask<const int> PropertyMask; /// Standard constructor Geant4ParticlePrint::Geant4ParticlePrint(Geant4Context* ctxt, const std::string& nam) diff --git a/DDG4/src/Geant4PhysicsConstructor.cpp b/DDG4/src/Geant4PhysicsConstructor.cpp index 3ed066e85..b5ae6ca7e 100644 --- a/DDG4/src/Geant4PhysicsConstructor.cpp +++ b/DDG4/src/Geant4PhysicsConstructor.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "G4VModularPhysicsList.hh" #include "G4Version.hh" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace { diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index 53668b389..fa70820b8 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -33,8 +33,8 @@ #include <regex.h> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; namespace { diff --git a/DDG4/src/Geant4Plugins.cpp b/DDG4/src/Geant4Plugins.cpp index 947acf370..b22db7d03 100644 --- a/DDG4/src/Geant4Plugins.cpp +++ b/DDG4/src/Geant4Plugins.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -31,11 +31,11 @@ #include "G4VUserPhysicsList.hh" #include "G4VPrimaryGenerator.hh" -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4VSensitiveDetector*, (std::string,DD4hep::Geometry::LCDD*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(DD4hep::Simulation::Geant4Sensitive*, (DD4hep::Simulation::Geant4Context*, - std::string,DD4hep::Geometry::DetElement*, - DD4hep::Geometry::LCDD*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(DD4hep::Simulation::Geant4Action*, (DD4hep::Simulation::Geant4Context*,std::string)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4VSensitiveDetector*, (std::string,dd4hep::Detector*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(dd4hep::sim::Geant4Sensitive*, (dd4hep::sim::Geant4Context*, + std::string,dd4hep::DetElement*, + dd4hep::Detector*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(dd4hep::sim::Geant4Action*, (dd4hep::sim::Geant4Context*,std::string)) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4MagIntegratorStepper*, (G4EquationOfMotion*)) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4MagIntegratorStepper*, (G4Mag_EqRhs*)) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4Mag_EqRhs*, (G4MagneticField*)) @@ -43,5 +43,5 @@ DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4VProcess*, ()) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4VPhysicsConstructor*, ()) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4VPrimaryGenerator*, ()) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4ParticleDefinition*, ()) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4VUserPhysicsList*, (DD4hep::Simulation::Geant4PhysicsListActionSequence*,int)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(DD4hep::Simulation::Geant4EventReader*, (std::string)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4VUserPhysicsList*, (dd4hep::sim::Geant4PhysicsListActionSequence*,int)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(dd4hep::sim::Geant4EventReader*, (std::string)) diff --git a/DDG4/src/Geant4Primary.cpp b/DDG4/src/Geant4Primary.cpp index 72ab573b7..311a708cb 100644 --- a/DDG4/src/Geant4Primary.cpp +++ b/DDG4/src/Geant4Primary.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,8 +23,8 @@ #include <stdexcept> #include <cstdio> -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Default destructor PrimaryExtension::~PrimaryExtension() { @@ -32,7 +32,7 @@ PrimaryExtension::~PrimaryExtension() { /// Default destructor Geant4PrimaryMap::~Geant4PrimaryMap() { - releaseObjects(m_primaryMap); + detail::releaseObjects(m_primaryMap); } /// Add a new object pair (G4 primary particle, DDG4 particle) into the maps @@ -58,9 +58,9 @@ Geant4PrimaryInteraction::~Geant4PrimaryInteraction() { Geant4PrimaryInteraction::VertexMap::iterator iv, ivend; for( iv=vertices.begin(), ivend=vertices.end(); iv != ivend; ++iv ){ for( Geant4Vertex* vtx : (*iv).second ) - ReleaseObject<Geant4Vertex*>()( vtx ); + detail::ReleaseObject<Geant4Vertex*>()( vtx ); } - releaseObjects(particles); + detail::releaseObjects(particles); } /// Access a new particle identifier within the interaction @@ -92,7 +92,7 @@ bool Geant4PrimaryInteraction::applyMask() { /// Default destructor Geant4PrimaryEvent::~Geant4PrimaryEvent() { - destroyObjects(m_interactions); + detail::destroyObjects(m_interactions); } /// Add a new interaction object to the event diff --git a/DDG4/src/Geant4PrimaryHandler.cpp b/DDG4/src/Geant4PrimaryHandler.cpp index 836e4701c..8b9cbe727 100644 --- a/DDG4/src/Geant4PrimaryHandler.cpp +++ b/DDG4/src/Geant4PrimaryHandler.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDG4/Geant4InputHandling.h" #include "DDG4/Geant4PrimaryHandler.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4PrimaryHandler::Geant4PrimaryHandler(Geant4Context* ctxt, const std::string& nam) diff --git a/DDG4/src/Geant4Random.cpp b/DDG4/src/Geant4Random.cpp index 040f9d002..a86728d2a 100644 --- a/DDG4/src/Geant4Random.cpp +++ b/DDG4/src/Geant4Random.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,7 +26,7 @@ #include <cmath> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace CLHEP { unsigned long crc32ul(const std::string& s); @@ -105,7 +105,7 @@ Geant4Random::~Geant4Random() { // Reset instance pointer if ( s_instance == this ) s_instance = 0; // Finally delete the TRandom instance wrapper - deletePtr(m_rootRandom); + detail::deletePtr(m_rootRandom); InstanceCount::decrement(this); } diff --git a/DDG4/src/Geant4ReadoutVolumeFilter.cpp b/DDG4/src/Geant4ReadoutVolumeFilter.cpp index f5a494358..39219523f 100644 --- a/DDG4/src/Geant4ReadoutVolumeFilter.cpp +++ b/DDG4/src/Geant4ReadoutVolumeFilter.cpp @@ -1,6 +1,5 @@ -// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,7 +20,7 @@ #include "DDG4/Geant4VolumeManager.h" #include "DDG4/Geant4ReadoutVolumeFilter.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4ReadoutVolumeFilter::Geant4ReadoutVolumeFilter(Geant4Context* ctxt, @@ -32,7 +31,7 @@ Geant4ReadoutVolumeFilter::Geant4ReadoutVolumeFilter(Geant4Context* ctxt, { InstanceCount::increment(this); for(size_t i=0; i<ro->hits.size(); ++i) { - const Collection& c = ro->hits[i]; + const HitCollection& c = ro->hits[i]; if ( c.name == coll ) { m_collection = &c; m_key = ro.idSpec().field(c.key); diff --git a/DDG4/src/Geant4RunAction.cpp b/DDG4/src/Geant4RunAction.cpp index f764c925e..5544708de 100644 --- a/DDG4/src/Geant4RunAction.cpp +++ b/DDG4/src/Geant4RunAction.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace { G4Mutex action_mutex=G4MUTEX_INITIALIZER; @@ -57,7 +57,7 @@ Geant4SharedRunAction::Geant4SharedRunAction(Geant4Context* ctxt, const string& /// Default destructor Geant4SharedRunAction::~Geant4SharedRunAction() { - releasePtr(m_action); + detail::releasePtr(m_action); InstanceCount::decrement(this); } diff --git a/DDG4/src/Geant4SensDetAction.cpp b/DDG4/src/Geant4SensDetAction.cpp index f7c6d6460..37086187d 100644 --- a/DDG4/src/Geant4SensDetAction.cpp +++ b/DDG4/src/Geant4SensDetAction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -31,8 +31,8 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; #if 0 namespace { @@ -85,9 +85,9 @@ bool Geant4Filter::operator()(const G4Step*) const { } /// Constructor. The detector element is identified by the name -Geant4Sensitive::Geant4Sensitive(Geant4Context* ctxt, const string& nam, DetElement det, LCDD& lcdd_ref) +Geant4Sensitive::Geant4Sensitive(Geant4Context* ctxt, const string& nam, DetElement det, Detector& description_ref) : Geant4Action(ctxt, nam), m_sensitiveDetector(0), m_sequence(0), - m_lcdd(lcdd_ref), m_detector(det), m_sensitive(), m_readout(), m_segmentation() + m_detDesc(description_ref), m_detector(det), m_sensitive(), m_readout(), m_segmentation() { InstanceCount::increment(this); if (!det.isValid()) { @@ -95,7 +95,7 @@ Geant4Sensitive::Geant4Sensitive(Geant4Context* ctxt, const string& nam, DetElem } declareProperty("HitCreationMode", m_hitCreationMode = SIMPLE_MODE); m_sequence = context()->kernel().sensitiveAction(m_detector.name()); - m_sensitive = lcdd_ref.sensitiveDetector(det.name()); + m_sensitive = description_ref.sensitiveDetector(det.name()); m_readout = m_sensitive.readout(); m_segmentation = m_readout.segmentation(); } @@ -223,7 +223,7 @@ long long int Geant4Sensitive::volumeID(const G4Step* s) { /// Returns the cellID(volumeID+local coordinate encoding) of the sensitive volume corresponding to the step long long int Geant4Sensitive::cellID(const G4Step* s) { - StepHandler h(s); + Geant4StepHandler h(s); Geant4VolumeManager volMgr = Geant4Mapping::instance().volumeManager(); VolumeID volID = volMgr.volumeID(h.preTouchable()); if ( m_segmentation.isValid() ) { @@ -244,7 +244,7 @@ Geant4SensDetActionSequence::Geant4SensDetActionSequence(Geant4Context* ctxt, co m_needsControl = true; context()->sensitiveActions().insert(name(), this); /// Update the sensitive detector type, so that the proper instance is created - m_sensitive = context()->lcdd().sensitiveDetector(nam); + m_sensitive = context()->detectorDescription().sensitiveDetector(nam); m_sensitiveType = m_sensitive.type(); m_sensitive.setType("Geant4SensDet"); InstanceCount::increment(this); @@ -397,7 +397,7 @@ void Geant4SensDetActionSequence::clear() { /// Default destructor Geant4SensDetSequences::~Geant4SensDetSequences() { - releaseObjects(m_sequences); + detail::releaseObjects(m_sequences); m_sequences.clear(); } diff --git a/DDG4/src/Geant4SensitiveDetector.cpp b/DDG4/src/Geant4SensitiveDetector.cpp index 3ac6a52fe..557f75e9c 100644 --- a/DDG4/src/Geant4SensitiveDetector.cpp +++ b/DDG4/src/Geant4SensitiveDetector.cpp @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include "DDG4/Geant4Hits.h" #include "DD4hep/Segmentations.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // Geant4 include files #include "G4Step.hh" @@ -34,14 +34,14 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Constructor. The detector element is identified by the name -Geant4SensitiveDetector::Geant4SensitiveDetector(const string& nam, LCDD& lcdd) - : G4VSensitiveDetector(nam), m_lcdd(lcdd), m_detector(), m_sensitive(), m_readout(), m_hce(0) { - m_sensitive = lcdd.sensitiveDetector(nam); - m_detector = lcdd.detector(nam); +Geant4SensitiveDetector::Geant4SensitiveDetector(const string& nam, Detector& description) + : G4VSensitiveDetector(nam), m_detDesc(description), m_detector(), m_sensitive(), m_readout(), m_hce(0) { + m_sensitive = description.sensitiveDetector(nam); + m_detector = description.detector(nam); m_readout = m_sensitive.readout(); } @@ -71,8 +71,8 @@ const string& Geant4SensitiveDetector::hitCollectionName(int which) const { Geant4SensitiveDetector::HitCollection* Geant4SensitiveDetector::createCollection(const string& coll_name) const { return new G4THitsCollection<Geant4Hit>(GetName(), coll_name); } -namespace DD4hep { - namespace Simulation { +namespace dd4hep { + namespace sim { template <> Geant4CalorimeterHit* Geant4SensitiveDetector::find<Geant4CalorimeterHit>(const HitCollection* c, const HitCompare<Geant4CalorimeterHit>& cmp) { typedef vector<Geant4CalorimeterHit*> _V; @@ -151,12 +151,10 @@ void Geant4SensitiveDetector::clear() { /// Dump Step information (careful: very verbose) void Geant4SensitiveDetector::dumpStep(G4Step* st, G4TouchableHistory* /* history */) { Geant4StepHandler step(st); - Geant4Mapping& cnv = Geant4Mapping::instance(); - //Geant4Converter::G4GeometryInfo& data = cnv.data(); - - Position pos1 = step.prePos(); - Position pos2 = step.postPos(); - Momentum mom = step.postMom(); + Geant4Mapping& cnv = Geant4Mapping::instance(); + Position pos1 = step.prePos(); + Position pos2 = step.postPos(); + Momentum mom = step.postMom(); printout(INFO, "G4Step", " Track:%08ld Pos:(%8f %8f %8f) -> (%f %f %f) Mom:%7.0f %7.0f %7.0f", long(step.track), pos1.X(), @@ -172,16 +170,14 @@ void Geant4SensitiveDetector::dumpStep(G4Step* st, G4TouchableHistory* /* histor typedef Geant4GeometryMaps::PlacementMap Places; const Places& places = cnv.data().g4Placements; - for (Places::const_iterator i = places.begin(); i != places.end(); ++i) { - const G4VPhysicalVolume* pl = (*i).second; + for (const auto& i : places ) { + const G4VPhysicalVolume* pl = i.second; const G4VPhysicalVolume* qv = pl; - if (qv == pv) { - const TGeoNode* tpv = (*i).first.ptr(); + const TGeoNode* tpv = i.first.ptr(); printf(" Found TGeoNode:%s!\n", tpv->GetName()); } } - } long long Geant4SensitiveDetector::getVolumeID(G4Step* aStep) { @@ -220,8 +216,8 @@ long long Geant4SensitiveDetector::getVolumeID(G4Step* aStep) { long long Geant4SensitiveDetector::getCellID(G4Step* s) { StepHandler h(s); Geant4VolumeManager volMgr = Geant4Mapping::instance().volumeManager(); - VolumeID volID = volMgr.volumeID(h.preTouchable()); - Geometry::Segmentation seg = m_readout.segmentation(); + VolumeID volID = volMgr.volumeID(h.preTouchable()); + Segmentation seg = m_readout.segmentation(); if ( seg.isValid() ) { G4ThreeVector global = 0.5 * ( h.prePosG4()+h.postPosG4()); G4ThreeVector local = h.preTouchable()->GetHistory()->GetTopTransform().TransformPoint(global); diff --git a/DDG4/src/Geant4StackingAction.cpp b/DDG4/src/Geant4StackingAction.cpp index 091771d5d..b229d2487 100644 --- a/DDG4/src/Geant4StackingAction.cpp +++ b/DDG4/src/Geant4StackingAction.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +22,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace { G4Mutex action_mutex=G4MUTEX_INITIALIZER; } @@ -48,7 +47,7 @@ Geant4SharedStackingAction::Geant4SharedStackingAction(Geant4Context* ctxt, cons /// Default destructor Geant4SharedStackingAction::~Geant4SharedStackingAction() { - releasePtr(m_action); + detail::releasePtr(m_action); InstanceCount::decrement(this); } diff --git a/DDG4/src/Geant4StepHandler.cpp b/DDG4/src/Geant4StepHandler.cpp index 141a20e6c..99bb433da 100644 --- a/DDG4/src/Geant4StepHandler.cpp +++ b/DDG4/src/Geant4StepHandler.cpp @@ -1,6 +1,5 @@ -// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,8 +15,9 @@ #include "DDG4/Geant4StepHandler.h" #include "DDSegmentation/Segmentation.h" #include "DD4hep/DD4hepUnits.h" - -using namespace DD4hep::Simulation; +namespace units = dd4hep; +using namespace dd4hep; +using namespace dd4hep::sim; /// Returns the step status in form of a string const char* Geant4StepHandler::stepStatus(G4StepStatus status) { diff --git a/DDG4/src/Geant4SteppingAction.cpp b/DDG4/src/Geant4SteppingAction.cpp index 5914422a2..6899711cd 100644 --- a/DDG4/src/Geant4SteppingAction.cpp +++ b/DDG4/src/Geant4SteppingAction.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +21,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; namespace { G4Mutex action_mutex=G4MUTEX_INITIALIZER; } @@ -51,7 +50,7 @@ Geant4SharedSteppingAction::Geant4SharedSteppingAction(Geant4Context* ctxt, cons /// Default destructor Geant4SharedSteppingAction::~Geant4SharedSteppingAction() { - releasePtr(m_action); + detail::releasePtr(m_action); InstanceCount::decrement(this); } diff --git a/DDG4/src/Geant4TestActions.cpp b/DDG4/src/Geant4TestActions.cpp index 4254503c6..fdee04f5a 100644 --- a/DDG4/src/Geant4TestActions.cpp +++ b/DDG4/src/Geant4TestActions.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,8 +24,8 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; -using namespace DD4hep::Simulation::Test; +using namespace dd4hep::sim; +using namespace dd4hep::sim::Test; namespace { struct TestHit { @@ -187,8 +186,8 @@ void Geant4TestStepAction::operator()(const G4Step*, G4SteppingManager*) { } /// Standard constructor with initializing arguments -Geant4TestSensitive::Geant4TestSensitive(Geant4Context* c, const std::string& n, DetElement det, LCDD& lcdd) - : Geant4Sensitive(c, n, det, lcdd), Geant4TestBase(this, "Geant4TestSensitive") { +Geant4TestSensitive::Geant4TestSensitive(Geant4Context* c, const std::string& n, DetElement det, Detector& description) + : Geant4Sensitive(c, n, det, description), Geant4TestBase(this, "Geant4TestSensitive") { InstanceCount::increment(this); m_collectionID = defineCollection < TestHit > (n); PRINT("%s> Collection ID is %d", m_type.c_str(), int(m_collectionID)); diff --git a/DDG4/src/Geant4TouchableHandler.cpp b/DDG4/src/Geant4TouchableHandler.cpp index 9b9d51df1..4baad0a78 100644 --- a/DDG4/src/Geant4TouchableHandler.cpp +++ b/DDG4/src/Geant4TouchableHandler.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ // C/C++ include files #include <stdexcept> -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Default constructor. Takes the step's pre-touchable Geant4TouchableHandler::Geant4TouchableHandler(const G4Step* step, bool use_post_step_point) { @@ -60,6 +60,6 @@ Geant4TouchableHandler::Geant4PlacementPath Geant4TouchableHandler::placementPat /// Helper: Access the placement path of a Geant4 touchable object as a string std::string Geant4TouchableHandler::path() const { - return Geant4GeometryMaps::placementPath(this->placementPath()); + return Geant4GeometryInfo::placementPath(this->placementPath()); } diff --git a/DDG4/src/Geant4TrackInformation.cpp b/DDG4/src/Geant4TrackInformation.cpp index 15afa5ba5..8b84ac31d 100644 --- a/DDG4/src/Geant4TrackInformation.cpp +++ b/DDG4/src/Geant4TrackInformation.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,8 +16,8 @@ #include "DDG4/Geant4TrackInformation.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Default constructor Geant4TrackInformation::Geant4TrackInformation() diff --git a/DDG4/src/Geant4TrackingAction.cpp b/DDG4/src/Geant4TrackingAction.cpp index 417770c5d..6b778e850 100644 --- a/DDG4/src/Geant4TrackingAction.cpp +++ b/DDG4/src/Geant4TrackingAction.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -29,8 +28,8 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; class G4Step; class G4TouchableHistory; namespace { @@ -130,7 +129,7 @@ Geant4SharedTrackingAction::Geant4SharedTrackingAction(Geant4Context* ctxt, cons /// Default destructor Geant4SharedTrackingAction::~Geant4SharedTrackingAction() { - releasePtr(m_action); + detail::releasePtr(m_action); InstanceCount::decrement(this); } diff --git a/DDG4/src/Geant4TrackingPostAction.cpp b/DDG4/src/Geant4TrackingPostAction.cpp index 696a5b7d5..e152ab966 100644 --- a/DDG4/src/Geant4TrackingPostAction.cpp +++ b/DDG4/src/Geant4TrackingPostAction.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,7 +24,7 @@ #include <algorithm> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Helper class to manipulate strings /** diff --git a/DDG4/src/Geant4TrackingPreAction.cpp b/DDG4/src/Geant4TrackingPreAction.cpp index dbde08366..e08225f3b 100644 --- a/DDG4/src/Geant4TrackingPreAction.cpp +++ b/DDG4/src/Geant4TrackingPreAction.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ // Geant4 include files #include "G4TrackingManager.hh" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4TrackingPreAction::Geant4TrackingPreAction(Geant4Context* ctxt, const std::string& nam) diff --git a/DDG4/src/Geant4UIManager.cpp b/DDG4/src/Geant4UIManager.cpp index 9c435af7f..078c5ba61 100644 --- a/DDG4/src/Geant4UIManager.cpp +++ b/DDG4/src/Geant4UIManager.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,7 +25,7 @@ #include "G4UIExecutive.hh" #include "G4RunManager.hh" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; using namespace std; namespace { @@ -147,6 +146,6 @@ void Geant4UIManager::start() { /// Stop and release resources void Geant4UIManager::stop() { - deletePtr(m_vis); - deletePtr(m_ui); + detail::deletePtr(m_vis); + detail::deletePtr(m_ui); } diff --git a/DDG4/src/Geant4UIMessenger.cpp b/DDG4/src/Geant4UIMessenger.cpp index b61f29781..bc2e8e652 100644 --- a/DDG4/src/Geant4UIMessenger.cpp +++ b/DDG4/src/Geant4UIMessenger.cpp @@ -1,6 +1,5 @@ -// $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -25,8 +24,8 @@ #include <algorithm> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; namespace { struct InstallProperties { @@ -55,8 +54,8 @@ Geant4UIMessenger::Geant4UIMessenger(const string& name, const string& path) /// Default destructor Geant4UIMessenger::~Geant4UIMessenger() { - destroyFirst(m_propertyCmd); - destroyFirst(m_actionCmd); + detail::destroyFirst(m_propertyCmd); + detail::destroyFirst(m_actionCmd); } /// Add a new callback structure diff --git a/DDG4/src/Geant4UserInitialization.cpp b/DDG4/src/Geant4UserInitialization.cpp index d86a8140d..8a0e2a45b 100644 --- a/DDG4/src/Geant4UserInitialization.cpp +++ b/DDG4/src/Geant4UserInitialization.cpp @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #include <stdexcept> using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4UserInitialization::Geant4UserInitialization(Geant4Context* ctxt, const string& nam) diff --git a/DDG4/src/Geant4UserParticleHandler.cpp b/DDG4/src/Geant4UserParticleHandler.cpp index 6f1dc7017..912d292fd 100644 --- a/DDG4/src/Geant4UserParticleHandler.cpp +++ b/DDG4/src/Geant4UserParticleHandler.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include "DDG4/Geant4UserParticleHandler.h" #include "CLHEP/Units/SystemOfUnits.h" -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; /// Standard constructor Geant4UserParticleHandler::Geant4UserParticleHandler(Geant4Context* ctxt, const std::string& nam) diff --git a/DDG4/src/Geant4Vertex.cpp b/DDG4/src/Geant4Vertex.cpp index 3648e50b6..c2815572d 100644 --- a/DDG4/src/Geant4Vertex.cpp +++ b/DDG4/src/Geant4Vertex.cpp @@ -1,6 +1,6 @@ // $Id: $ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,8 +17,8 @@ #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4Vertex.h" -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Default destructor VertexExtension::~VertexExtension() { diff --git a/DDG4/src/Geant4VolumeManager.cpp b/DDG4/src/Geant4VolumeManager.cpp index 86775173d..cb36b0c98 100644 --- a/DDG4/src/Geant4VolumeManager.cpp +++ b/DDG4/src/Geant4VolumeManager.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ // Framework include files #include "DD4hep/Printout.h" #include "DD4hep/Volumes.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/DetectorTools.h" #include "DDG4/Geant4VolumeManager.h" #include "DDG4/Geant4TouchableHandler.h" @@ -28,33 +28,31 @@ // C/C++ include files #include <sstream> -using namespace DD4hep::Simulation; -using namespace DD4hep::Simulation::Geant4GeometryMaps; -using namespace DD4hep::Geometry; -using namespace DD4hep; +using namespace dd4hep::sim::Geant4GeometryMaps; +using namespace dd4hep::detail::tools; +using namespace dd4hep::detail; +using namespace dd4hep::sim; +using namespace dd4hep; using namespace std; #include "DDG4/Geant4AssemblyVolume.h" - +typedef pair<VolumeID,vector<pair<const BitFieldValue*, VolumeID> > > VolIDDescriptor; namespace { /// Helper class to populate the Geant4 volume manager struct Populator { typedef vector<const TGeoNode*> Chain; - typedef DD4hep::Geometry::LCDD LCDD; - typedef DD4hep::Geometry::Readout Readout; - typedef DD4hep::Geometry::DetElement DetElement; - typedef map<VolumeID,Geant4PlacementPath> Registries; - /// Reference to the LCDD instance - LCDD& m_lcdd; + typedef map<VolumeID,Geant4GeometryInfo::Geant4PlacementPath> Registries; + /// Reference to the Detector instance + Detector& m_detDesc; /// Set of already added entries Registries m_entries; /// Reference to Geant4 translation information Geant4GeometryInfo& m_geo; /// Default constructor - Populator(LCDD& lcdd, Geant4GeometryInfo& g) - : m_lcdd(lcdd), m_geo(g) { + Populator(Detector& description, Geant4GeometryInfo& g) + : m_detDesc(description), m_geo(g) { } /// Populate the Volume manager @@ -68,7 +66,7 @@ namespace { SensitiveDetector sd; PlacedVolume::VolIDs ids; m_entries.clear(); - chain.push_back(m_lcdd.world().placement().ptr()); + chain.push_back(m_detDesc.world().placement().ptr()); scanPhysicalVolume(pv.ptr(), ids, sd, chain); continue; } @@ -109,7 +107,7 @@ namespace { Chain control; const TGeoNode* node; Volume vol; - Geant4PlacementPath path; + Geant4GeometryInfo::Geant4PlacementPath path; Readout ro = sd.readout(); IDDescriptor iddesc = ro.idSpec(); VolumeID code = iddesc.encode(ids); @@ -119,7 +117,7 @@ namespace { PrintLevel print_res = VERBOSE; printout(print_action,"Geant4VolumeManager","+++ Add path:%s vid:%016X", - DetectorTools::placementPath(nodes,false).c_str(),code); + detail::tools::placementPath(nodes,false).c_str(),code); if (i == m_entries.end()) { path.reserve(nodes.size()); @@ -143,7 +141,7 @@ namespace { if ( c.size() <= control.size() && control == c ) { path.push_back((*iImp).second); printout(print_chain, "Geant4VolumeManager", "+++ Chain: Node OK: %s %s -> %s", - node->GetName(), DetectorTools::placementPath(c,false).c_str(), + node->GetName(), detail::tools::placementPath(c,false).c_str(), (*iImp).second->GetName().c_str()); control.clear(); break; @@ -153,21 +151,21 @@ namespace { } if ( control.empty() ) { printout(print_res, "Geant4VolumeManager", "+++ Volume IDs:%s", - DetectorTools::toString(ro.idSpec(),ids,code).c_str()); + detail::tools::toString(ro.idSpec(),ids,code).c_str()); path.erase(path.begin()+path.size()-1); printout(print_res, "Geant4VolumeManager", "+++ Map %016X to Geant4 Path:%s", - (void*)code, placementPath(path).c_str()); + (void*)code, Geant4GeometryInfo::placementPath(path).c_str()); if (m_geo.g4Paths.find(path) == m_geo.g4Paths.end()) { m_geo.g4Paths[path] = code; m_entries.insert(make_pair(code,path)); return; } printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Geant4 path!!!! %s %s", - " [THIS SHOULD NEVER HAPPEN]",placementPath(path).c_str()); + " [THIS SHOULD NEVER HAPPEN]",Geant4GeometryInfo::placementPath(path).c_str()); goto Err; } printout(INFO, "Geant4VolumeManager", "Control block has still %d entries:%s", - int(control.size()),DetectorTools::placementPath(control,true).c_str()); + int(control.size()),detail::tools::placementPath(control,true).c_str()); goto Err; } printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Volume entry: %X" @@ -175,30 +173,31 @@ namespace { Err: if ( i != m_entries.end() ) - printout(ERROR,"Geant4VolumeManager"," Known G4 path: %s",placementPath((*i).second).c_str()); + printout(ERROR,"Geant4VolumeManager"," Known G4 path: %s",Geant4GeometryInfo::placementPath((*i).second).c_str()); if ( !path.empty() ) - printout(ERROR,"Geant4VolumeManager"," New G4 path: %s",placementPath(path).c_str()); + printout(ERROR,"Geant4VolumeManager"," New G4 path: %s",Geant4GeometryInfo::placementPath(path).c_str()); if ( !nodes.empty() ) - printout(ERROR,"Geant4VolumeManager"," TGeo path: %s",DetectorTools::placementPath(nodes,false).c_str()); - printout(ERROR,"Geant4VolumeManager", " Offend.VolIDs: %s",DetectorTools::toString(ro.idSpec(),ids,code).c_str()); + printout(ERROR,"Geant4VolumeManager"," TGeo path: %s",detail::tools::placementPath(nodes,false).c_str()); + printout(ERROR,"Geant4VolumeManager", " Offend.VolIDs: %s",detail::tools::toString(ro.idSpec(),ids,code).c_str()); throw runtime_error("Failed to populate Geant4 volume manager!"); } }; } /// Initializing constructor. The tree will automatically be built if possible -Geant4VolumeManager::Geant4VolumeManager(LCDD& lcdd, Geant4GeometryInfo* info) - : Base(info), m_isValid(false) { +Geant4VolumeManager::Geant4VolumeManager(Detector& description, Geant4GeometryInfo* info) + : Handle<Geant4GeometryInfo>(info), m_isValid(false) { if (info && info->valid && info->g4Paths.empty()) { - Populator p(lcdd, *info); - p.populate(lcdd.world()); + Populator p(description, *info); + p.populate(description.world()); return; } throw runtime_error(format("Geant4VolumeManager", "Attempt populate from invalid Geant4 geometry info [Invalid-Info]")); } /// Helper: Generate placement path from touchable object -Geant4PlacementPath Geant4VolumeManager::placementPath(const G4VTouchable* touchable, bool exception) const { +vector<const G4VPhysicalVolume*> +Geant4VolumeManager::placementPath(const G4VTouchable* touchable, bool exception) const { Geant4TouchableHandler handler(touchable); return handler.placementPath(exception); } @@ -219,10 +218,10 @@ bool Geant4VolumeManager::checkValidity() const { } /// Access CELLID by placement path -VolumeID Geant4VolumeManager::volumeID(const PlacementPath& path) const { +VolumeID Geant4VolumeManager::volumeID(const vector<const G4VPhysicalVolume*>& path) const { if (!path.empty() && checkValidity()) { - const Geant4PathMap& m = ptr()->g4Paths; - Geant4PathMap::const_iterator i = m.find(path); + const auto& m = ptr()->g4Paths; + auto i = m.find(path); if (i != m.end()) return (*i).second; if (!path[0]) @@ -231,7 +230,7 @@ VolumeID Geant4VolumeManager::volumeID(const PlacementPath& path) const { return Insensitive; } printout(INFO, "Geant4VolumeManager","+++ Bad volume Geant4 Path: %s", - Geant4GeometryMaps::placementPath(path).c_str()); + Geant4GeometryInfo::placementPath(path).c_str()); return NonExisting; } @@ -242,12 +241,14 @@ VolumeID Geant4VolumeManager::volumeID(const G4VTouchable* touchable) const { } /// Accessfully decoded volume fields by placement path -void Geant4VolumeManager::volumeDescriptor(const PlacementPath& path, VolIDDescriptor& vol_desc) const { +void Geant4VolumeManager::volumeDescriptor(const vector<const G4VPhysicalVolume*>& path, + VolIDDescriptor& vol_desc) const +{ vol_desc.second.clear(); vol_desc.first = NonExisting; if (!path.empty() && checkValidity()) { - const Geant4PathMap& m = ptr()->g4Paths; - Geant4PathMap::const_iterator i = m.find(path); + const auto& m = ptr()->g4Paths; + auto i = m.find(path); if (i != m.end()) { VolumeID vid = (*i).second; G4LogicalVolume* lvol = path[0]->GetLogicalVolume(); @@ -257,8 +258,8 @@ void Geant4VolumeManager::volumeDescriptor(const PlacementPath& path, VolIDDescr for (PlacementMap::const_iterator ipm = pm.begin(); ipm != pm.end(); ++ipm) { if ((*ipm).second == node) { PlacedVolume pv = (*ipm).first; - Geometry::SensitiveDetector sd = pv.volume().sensitiveDetector(); - Geometry::IDDescriptor dsc = sd.readout().idSpec(); + SensitiveDetector sd = pv.volume().sensitiveDetector(); + IDDescriptor dsc = sd.readout().idSpec(); vol_desc.first = vid; dsc.decodeFields(vid, vol_desc.second); return; @@ -278,7 +279,8 @@ void Geant4VolumeManager::volumeDescriptor(const PlacementPath& path, VolIDDescr } /// Access fully decoded volume fields by Geant4 touchable object -void Geant4VolumeManager::volumeDescriptor(const G4VTouchable* touchable, VolIDDescriptor& vol_desc) const { +void Geant4VolumeManager::volumeDescriptor(const G4VTouchable* touchable, + VolIDDescriptor& vol_desc) const { volumeDescriptor(placementPath(touchable), vol_desc); } diff --git a/DDG4/src/IoStreams.cpp b/DDG4/src/IoStreams.cpp index 55a8ccec0..ff9414f1a 100644 --- a/DDG4/src/IoStreams.cpp +++ b/DDG4/src/IoStreams.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,7 +23,7 @@ // ROOT include files #include "TFile.h" -using namespace DD4hep; +using namespace dd4hep; namespace { /// Anonymous cast class to get access to protected members of TFile ;-) @@ -41,7 +41,7 @@ namespace { }; } -namespace DD4hep { +namespace dd4hep { /// Specialization for standard file descriptor files according to the posix standard template<> void dd4hep_file<int>::open(const char* path, BOOST_IOS::openmode mode) { diff --git a/DDG4/src/python/DDG4Python.C b/DDG4/src/python/DDG4Python.C index ad1d0be3c..729ff023b 100644 --- a/DDG4/src/python/DDG4Python.C +++ b/DDG4/src/python/DDG4Python.C @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,11 +24,11 @@ // CINT configuration #if defined(__MAKECINT__) -#pragma link C++ namespace DD4hep; -#pragma link C++ namespace DD4hep::Simulation; -#pragma link C++ class DD4hep::Simulation::Geant4PythonCall; -#pragma link C++ class DD4hep::Simulation::Geant4PythonAction; -#pragma link C++ class DD4hep::Simulation::Geant4PythonInitialization; -#pragma link C++ class DD4hep::Simulation::Geant4PythonDetectorConstruction; +#pragma link C++ namespace dd4hep; +#pragma link C++ namespace dd4hep::sim; +#pragma link C++ class dd4hep::sim::Geant4PythonCall; +#pragma link C++ class dd4hep::sim::Geant4PythonAction; +#pragma link C++ class dd4hep::sim::Geant4PythonInitialization; +#pragma link C++ class dd4hep::sim::Geant4PythonDetectorConstruction; #pragma link C++ class PyDDG4; #endif diff --git a/DDG4/src/python/Geant4PythonAction.cpp b/DDG4/src/python/Geant4PythonAction.cpp index 1fe10b549..66b7dc803 100644 --- a/DDG4/src/python/Geant4PythonAction.cpp +++ b/DDG4/src/python/Geant4PythonAction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -23,8 +23,8 @@ #include <fstream> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; DECLARE_GEANT4ACTION(Geant4PythonAction) diff --git a/DDG4/src/python/Geant4PythonCall.cpp b/DDG4/src/python/Geant4PythonCall.cpp index 30cdb676a..b8f12fd99 100644 --- a/DDG4/src/python/Geant4PythonCall.cpp +++ b/DDG4/src/python/Geant4PythonCall.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -21,8 +21,8 @@ #include <stdexcept> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; +using namespace dd4hep; +using namespace dd4hep::sim; /// Standard constructor, initializes variables Geant4PythonCall::Geant4PythonCall() @@ -51,7 +51,7 @@ void Geant4PythonCall::set(PyObject* callable) { DDPython::assignObject(m_arguments,0); } -namespace DD4hep { namespace Simulation { +namespace dd4hep { namespace sim { /// Execute command in the python interpreter. template <typename RETURN> RETURN Geant4PythonCall::execute() const { diff --git a/DDG4/src/python/Geant4PythonDetectorConstruction.cpp b/DDG4/src/python/Geant4PythonDetectorConstruction.cpp index a6151dce3..a8213a221 100644 --- a/DDG4/src/python/Geant4PythonDetectorConstruction.cpp +++ b/DDG4/src/python/Geant4PythonDetectorConstruction.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #include "DDG4/Python/Geant4PythonDetectorConstruction.h" using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; #include "DDG4/Factories.h" DECLARE_GEANT4ACTION(Geant4PythonDetectorConstruction) diff --git a/DDG4/src/python/Geant4PythonDetectorConstructionLast.cpp b/DDG4/src/python/Geant4PythonDetectorConstructionLast.cpp index 1c53b7ea1..caa699248 100644 --- a/DDG4/src/python/Geant4PythonDetectorConstructionLast.cpp +++ b/DDG4/src/python/Geant4PythonDetectorConstructionLast.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,10 +19,10 @@ #include "DDG4/Python/DDPython.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit - namespace Simulation { + namespace sim { /// Base class to initialize a multi-threaded or single threaded Geant4 application /** @@ -46,11 +46,11 @@ namespace DD4hep { DDPython::allowThreads(); } }; - } // End namespace Simulation -} // End namespace DD4hep + } // End namespace sim +} // End namespace dd4hep #endif // DD4HEP_DDG4_GEANT4PYTHONDETECTORCONSTRUCTIONLAST_H -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; #include "DDG4/Factories.h" DECLARE_GEANT4ACTION(Geant4PythonDetectorConstructionLast) diff --git a/DDG4/src/python/Geant4PythonInitialization.cpp b/DDG4/src/python/Geant4PythonInitialization.cpp index bf805f5a9..bb751becd 100644 --- a/DDG4/src/python/Geant4PythonInitialization.cpp +++ b/DDG4/src/python/Geant4PythonInitialization.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,7 +19,7 @@ #include "DDG4/Python/Geant4PythonInitialization.h" using namespace std; -using namespace DD4hep::Simulation; +using namespace dd4hep::sim; DECLARE_GEANT4ACTION(Geant4PythonInitialization) diff --git a/DDG4/src/python/PyDDG4.cpp b/DDG4/src/python/PyDDG4.cpp index f12d17390..fca81b2e0 100644 --- a/DDG4/src/python/PyDDG4.cpp +++ b/DDG4/src/python/PyDDG4.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,14 +13,14 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Python/PyDDG4.h" #include "DDG4/Python/DDPython.h" #include "DDG4/Geant4Kernel.h" int PyDDG4::run(Kernel& kernel) { int ret; - DD4hep::DDPython::AllowThreads allow(0); + dd4hep::DDPython::AllowThreads allow(0); if ( 1 != (ret=kernel.configure()) ) return ret; else if ( 1 != (ret=kernel.initialize()) ) @@ -29,21 +29,21 @@ int PyDDG4::run(Kernel& kernel) { return ret; else if ( 1 != (ret=kernel.terminate()) ) return ret; - //DD4hep::DDPython::shutdown(); + //dd4hep::DDPython::shutdown(); return ret; } int PyDDG4::execute() { - Kernel& k = Kernel::instance(DD4hep::Geometry::LCDD::getInstance()); + Kernel& k = Kernel::instance(dd4hep::Detector::getInstance()); return run(k); } int PyDDG4::process(const char* fname) { - return DD4hep::DDPython::instance().runFile(fname); + return dd4hep::DDPython::instance().runFile(fname); } int PyDDG4::run(const char* fname) { - int ret = DD4hep::DDPython::instance().runFile(fname); + int ret = dd4hep::DDPython::instance().runFile(fname); if ( 1 != ret ) return ret; return execute(); } diff --git a/DDG4/tpython/DDPython.C b/DDG4/tpython/DDPython.C index 861675a24..4a083c761 100644 --- a/DDG4/tpython/DDPython.C +++ b/DDG4/tpython/DDPython.C @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,15 +19,15 @@ // FRamework include files #include "DDG4/Python/DDPython.h" -struct DD4hepPython { +struct dd4hepPython { static void setMainThread() { - DD4hep::DDPython::setMainThread(); + dd4hep::DDPython::setMainThread(); } }; // CINT configuration #if defined(__MAKECINT__) -#pragma link C++ namespace DD4hep; -#pragma link C++ class DD4hep::DDPython; -#pragma link C++ class DD4hepPython; +#pragma link C++ namespace dd4hep; +#pragma link C++ class dd4hep::DDPython; +#pragma link C++ class dd4hepPython; #endif diff --git a/DDG4/tpython/DDPython.cpp b/DDG4/tpython/DDPython.cpp index db7bf812b..240591d92 100644 --- a/DDG4/tpython/DDPython.cpp +++ b/DDG4/tpython/DDPython.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -39,7 +39,7 @@ #endif using namespace std; -using namespace DD4hep; +using namespace dd4hep; namespace { string loadScript(const string& fname) { @@ -153,14 +153,14 @@ DDPython::DDPython() : context(0) { if ( !module || ::PyErr_Occurred() ) { ::PyErr_Print(); ::PyErr_Clear(); - DD4hep::printout(WARNING,"DDPython","Main dictionary pointer is NULL. Try to continue like this!"); + dd4hep::printout(WARNING,"DDPython","Main dictionary pointer is NULL. Try to continue like this!"); } else { _main_dict = ::PyModule_GetDict(module); if ( _main_dict ) { Py_INCREF( _main_dict ); } - DD4hep::printout(DEBUG,"DDPython","Pointer to main dict:%p",(void*)_main_dict); + dd4hep::printout(DEBUG,"DDPython","Pointer to main dict:%p",(void*)_main_dict); } setMainThread(); } @@ -174,7 +174,7 @@ DDPython::DDPython() : context(0) { DDPython::~DDPython() { --_refCount; if ( 0 == _refCount && ::Py_IsInitialized() ) { - DD4hep::printout(ALWAYS,"DDPython","+++ Shutdown python interpreter......"); + dd4hep::printout(ALWAYS,"DDPython","+++ Shutdown python interpreter......"); if ( _main_dict ) { Py_DECREF(_main_dict); _main_dict = 0; diff --git a/DDRec/CMakeLists.txt b/DDRec/CMakeLists.txt index 162922c54..9d838b657 100644 --- a/DDRec/CMakeLists.txt +++ b/DDRec/CMakeLists.txt @@ -1,6 +1,6 @@ # $Id: $ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/DDRec/include/DDRec/API/Calorimeter.h b/DDRec/include/DDRec/API/Calorimeter.h index f68a2fb06..207b5261b 100644 --- a/DDRec/include/DDRec/API/Calorimeter.h +++ b/DDRec/include/DDRec/API/Calorimeter.h @@ -7,25 +7,25 @@ * Author: Christian Grefe, CERN */ -#ifndef DDRec_CALORIMETER_H_ -#define DDRec_CALORIMETER_H_ +#ifndef rec_CALORIMETER_H_ +#define rec_CALORIMETER_H_ #include "DDRec/API/LayeredSubdetector.h" #include "DDRec/API/Subdetector.h" -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { -class [[gnu::deprecated(" unmaintained code ")]] Calorimeter: public LayeredSubdetector, public Subdetector { +class Calorimeter: public LayeredSubdetector, public Subdetector { public: - Calorimeter(const Geometry::DetElement& det) : - Geometry::DetElement(det), LayeredSubdetector(det), Subdetector(det) { + Calorimeter(const DetElement& det) : + DetElement(det), LayeredSubdetector(det), Subdetector(det) { } virtual ~Calorimeter() {} }; -} /* namespace DDRec */ -} /* namespace DD4hep */ -#endif /* DDRec_CALORIMETER_H_ */ +} /* namespace rec */ +} /* namespace dd4hep */ +#endif /* rec_CALORIMETER_H_ */ diff --git a/DDRec/include/DDRec/API/Exceptions.h b/DDRec/include/DDRec/API/Exceptions.h index 0d55ea988..0256b4fe4 100644 --- a/DDRec/include/DDRec/API/Exceptions.h +++ b/DDRec/include/DDRec/API/Exceptions.h @@ -1,16 +1,16 @@ /* * Exceptions.h * - * Collection of Exception classes used in DDRec + * Collection of Exception classes used in rec * * Created on: Oct 31, 2014 * Author: Christian Grefe, Bonn University */ -#ifndef DDRec_EXCEPTIONS_H_ -#define DDRec_EXCEPTIONS_H_ +#ifndef rec_EXCEPTIONS_H_ +#define rec_EXCEPTIONS_H_ -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Objects.h" #include "DDSegmentation/Segmentation.h" @@ -19,10 +19,10 @@ #include <string> #include <sstream> -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { -class [[gnu::deprecated(" unmaintained code ")]] invalid_cell_id: public std::invalid_argument { +class invalid_cell_id: public std::invalid_argument { public: invalid_cell_id(const std::string& msg, const DDSegmentation::CellID& cellID = 0) : std::invalid_argument(createMsg(msg, cellID)) { @@ -37,26 +37,26 @@ private: } }; -class [[gnu::deprecated(" unmaintained code ")]] invalid_position: public std::invalid_argument { +class invalid_position: public std::invalid_argument { public: - invalid_position(const std::string& msg, const Geometry::Position& position) : + invalid_position(const std::string& msg, const Position& position) : std::invalid_argument(createMsg(msg, position)) { } private: - static std::string createMsg(const std::string& msg, const Geometry::Position& position) { + static std::string createMsg(const std::string& msg, const Position& position) { std::stringstream s; s << "Invalid position: " << msg << " " << position; return s.str(); } }; -class [[gnu::deprecated(" unmaintained code ")]] invalid_detector_element: public std::invalid_argument { +class invalid_detector_element: public std::invalid_argument { public: - invalid_detector_element(const std::string& msg, const Geometry::DetElement& det) : + invalid_detector_element(const std::string& msg, const DetElement& det) : std::invalid_argument(createMsg(msg, det)) { } private: - static std::string createMsg(const std::string& msg, const Geometry::DetElement& det) { + static std::string createMsg(const std::string& msg, const DetElement& det) { std::stringstream s; s << "Invalid detector element: " << msg; if (det.isValid()) @@ -66,5 +66,5 @@ private: }; } /* namespace DD4Rec */ -} /* namespace DD4hep */ -#endif /* DDRec_EXCEPTIONS_H_ */ +} /* namespace dd4hep */ +#endif /* rec_EXCEPTIONS_H_ */ diff --git a/DDRec/include/DDRec/API/IDDecoder.h b/DDRec/include/DDRec/API/IDDecoder.h index 50be3086f..f9f1ad281 100644 --- a/DDRec/include/DDRec/API/IDDecoder.h +++ b/DDRec/include/DDRec/API/IDDecoder.h @@ -12,14 +12,15 @@ #include "DD4hep/VolumeManager.h" #include "DDSegmentation/Segmentation.h" +#include "DDRec/tempdefs.h" #include <set> #include <string> class TGeoManager; -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { typedef DDSegmentation::CellID CellID; typedef DDSegmentation::VolumeID VolumeID; @@ -29,10 +30,8 @@ typedef DDSegmentation::VolumeID VolumeID; * high level interface for position to cell ID and cell ID to position conversions * and related information. */ - - class [[gnu::deprecated(" replaced with CellIDPositionConverter ")]] IDDecoder{ - - public: +class IDDecoder { +public: class BarrelEndcapFlag { public: enum BarrelEncapID { @@ -82,46 +81,46 @@ typedef DDSegmentation::VolumeID VolumeID; virtual ~IDDecoder() {}; /// Returns the cell ID from the local position in the given volume ID. - CellID cellIDFromLocal(const Geometry::Position& local, const VolumeID volumeID) const; + CellID cellIDFromLocal(const Position& local, const VolumeID volumeID) const; /// Returns the global cell ID from a given global position - CellID cellID(const Geometry::Position& global) const; + CellID cellID(const Position& global) const; /// Returns the global position from a given cell ID - Geometry::Position position(const CellID& cellID) const; + Position position(const CellID& cellID) const; /// Returns the local position from a given cell ID - Geometry::Position localPosition(const CellID& cellID) const; + Position localPosition(const CellID& cellID) const; /// Returns the volume ID of a given cell ID VolumeID volumeID(const CellID& cellID) const; /// Returns the volume ID of a given global position - VolumeID volumeID(const Geometry::Position& global) const; + VolumeID volumeID(const Position& global) const; /// Returns the placement for a given cell ID - Geometry::PlacedVolume placement(const CellID& cellID) const; + PlacedVolume placement(const CellID& cellID) const; /// Returns the placement for a given global position - Geometry::PlacedVolume placement(const Geometry::Position& global) const; + PlacedVolume placement(const Position& global) const; /// Returns the subdetector for a given cell ID - Geometry::DetElement subDetector(const CellID& cellID) const; + DetElement subDetector(const CellID& cellID) const; /// Returns the subdetector for a given global position - Geometry::DetElement subDetector(const Geometry::Position& global) const; + DetElement subDetector(const Position& global) const; /// Returns the closest detector element in the hierarchy for a given cell ID - Geometry::DetElement detectorElement(const CellID& cellID) const; + DetElement detectorElement(const CellID& cellID) const; /// Returns the closest detector element in the hierarchy for a given global position - Geometry::DetElement detectorElement(const Geometry::Position& global) const; + DetElement detectorElement(const Position& global) const; /// Access to the Readout object for a given cell ID - Geometry::Readout readout(const CellID& cellID) const; + Readout readout(const CellID& cellID) const; /// Access to the Readout object for a given global position - Geometry::Readout readout(const Geometry::Position& global) const; + Readout readout(const Position& global) const; /// Calculates the neighbours of the given cell ID and adds them to the list of neighbours void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const; @@ -151,13 +150,13 @@ typedef DDSegmentation::VolumeID VolumeID; } protected: - Geometry::VolumeManager _volumeManager; + VolumeManager _volumeManager; /// Helper method to find the corresponding Readout object to a DetElement - Geometry::Readout findReadout(const Geometry::DetElement& det) const; + Readout findReadout(const DetElement& det) const; /// Helper method to get the closest daughter DetElement to the position starting from the given DetElement - static Geometry::DetElement getClosestDaughter(const Geometry::DetElement& det, const Geometry::Position& position); + static DetElement getClosestDaughter(const DetElement& det, const Position& position); private: /// Default constructor @@ -170,6 +169,6 @@ private: void operator=(const IDDecoder&); }; -} /* namespace DDRec */ -} /* namespace DD4hep */ +} /* namespace rec */ +} /* namespace dd4hep */ #endif /* IDDECODER_H_ */ diff --git a/DDRec/include/DDRec/API/LayeredSubdetector.h b/DDRec/include/DDRec/API/LayeredSubdetector.h index db2d00c48..90cc12742 100644 --- a/DDRec/include/DDRec/API/LayeredSubdetector.h +++ b/DDRec/include/DDRec/API/LayeredSubdetector.h @@ -7,22 +7,22 @@ * Author: Christian Grefe, CERN */ -#ifndef DDRec_LAYEREDSUBDETECTOR_H_ -#define DDRec_LAYEREDSUBDETECTOR_H_ +#ifndef rec_LAYEREDSUBDETECTOR_H_ +#define rec_LAYEREDSUBDETECTOR_H_ #include "DDRec/API/Exceptions.h" #include "DDRec/Extensions/LayeringExtension.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { -class [[gnu::deprecated(" unmaintained code ")]] LayeredSubdetector: public virtual Geometry::DetElement, public LayeringExtension { +class LayeredSubdetector: public virtual DetElement, public LayeringExtension { public: /// Default constructor - LayeredSubdetector(const Geometry::DetElement& det) : - Geometry::DetElement(det) { + LayeredSubdetector(const DetElement& det) : + DetElement(det) { getLayeringExtension(); } @@ -39,15 +39,15 @@ public: return _layering->numberOfSensors(layerIndex); } - Geometry::DetElement layer(int layerIndex) const { + DetElement layer(int layerIndex) const { return _layering->layer(layerIndex); } - const std::vector<Geometry::DetElement>& sensors(int layerIndex = 0) const { + const std::vector<DetElement>& sensors(int layerIndex = 0) const { return _layering->sensors(layerIndex); } - const std::vector<Geometry::DetElement>& absorbers(int layerIndex = 0) const { + const std::vector<DetElement>& absorbers(int layerIndex = 0) const { return _layering->absorbers(layerIndex); } @@ -114,11 +114,11 @@ private: void getLayeringExtension() { _layering = this->isValid() ? this->extension<LayeringExtension>() : 0; if (not _layering) { - throw invalid_detector_element("Found no extension of type \"LayeringExtension\"", Geometry::DetElement(*this)); + throw invalid_detector_element("Found no extension of type \"LayeringExtension\"", DetElement(*this)); } } }; -} /* namespace DDRec */ -} /* namespace DD4hep */ -#endif /* DDReconstruction_LAYEREDSUBDETECTOR_H_ */ +} /* namespace rec */ +} /* namespace dd4hep */ +#endif /* reconstruction_LAYEREDSUBDETECTOR_H_ */ diff --git a/DDRec/include/DDRec/API/Subdetector.h b/DDRec/include/DDRec/API/Subdetector.h index a856754a0..59ddb852c 100644 --- a/DDRec/include/DDRec/API/Subdetector.h +++ b/DDRec/include/DDRec/API/Subdetector.h @@ -10,17 +10,17 @@ #ifndef SUBDETECTOR_H_ #define SUBDETECTOR_H_ -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DDRec/Extensions/SubdetectorExtension.h" -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { -class [[gnu::deprecated(" unmaintained code ")]] Subdetector: public virtual Geometry::DetElement { +class Subdetector: public virtual DetElement { public: /// Default constructor - Subdetector(const Geometry::DetElement& det) : - Geometry::DetElement(det) { + Subdetector(const DetElement& det) : + DetElement(det) { getSubdetectorExtension(); } @@ -75,12 +75,12 @@ private: void getSubdetectorExtension() { _subdetector = this->isValid() ? this->extension<SubdetectorExtension>() : 0; if (not _subdetector) { - throw invalid_detector_element("Found no extension of type \"SubdetectorExtension\"", Geometry::DetElement(*this)); + throw invalid_detector_element("Found no extension of type \"SubdetectorExtension\"", DetElement(*this)); } } }; -} /* namespace DDRec */ -} /* namespace DD4hep */ +} /* namespace rec */ +} /* namespace dd4hep */ #endif /* SUBDETECTOR_H_ */ diff --git a/DDRec/include/DDRec/API/Tracker.h b/DDRec/include/DDRec/API/Tracker.h index 52334726e..e3e384be7 100644 --- a/DDRec/include/DDRec/API/Tracker.h +++ b/DDRec/include/DDRec/API/Tracker.h @@ -7,20 +7,20 @@ * Author: Christian Grefe, CERN */ -#ifndef DDReconstruction_TRACKER_H_ -#define DDReconstruction_TRACKER_H_ +#ifndef reconstruction_TRACKER_H_ +#define reconstruction_TRACKER_H_ #include "DDRec/API/LayeredSubdetector.h" #include "DDRec/Extensions/TrackerExtension.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { -class [[gnu::deprecated(" unmaintained code ")]] Tracker: public LayeredSubdetector { +class Tracker: public LayeredSubdetector { public: - Tracker(const Geometry::DetElement& det) : - Geometry::DetElement(det) { + Tracker(const DetElement& det) : + DetElement(det) { getTrackerExtension(); } @@ -37,6 +37,6 @@ private: } }; -} /* namespace DDRec */ -} /* namespace DD4hep */ -#endif /* DDReconstruction_TRACKER_H_ */ +} /* namespace rec */ +} /* namespace dd4hep */ +#endif /* reconstruction_TRACKER_H_ */ diff --git a/DDRec/include/DDRec/CellIDPositionConverter.h b/DDRec/include/DDRec/CellIDPositionConverter.h index 42aaa81b3..a5b6eca8e 100644 --- a/DDRec/include/DDRec/CellIDPositionConverter.h +++ b/DDRec/include/DDRec/CellIDPositionConverter.h @@ -6,6 +6,7 @@ #include "DD4hep/VolumeManager.h" #include "DDSegmentation/Segmentation.h" +#include "DDRec/tempdefs.h" #include <set> #include <string> @@ -13,9 +14,9 @@ namespace dd4hep { namespace rec { - - typedef DD4hep::DDSegmentation::CellID CellID; - typedef DD4hep::DDSegmentation::VolumeID VolumeID; + + typedef DDSegmentation::CellID CellID; + typedef DDSegmentation::VolumeID VolumeID; /** Utility for position to cellID and cellID to position conversions. * (Correctly re-implements some of the functionality of the deprecated IDDecoder). @@ -32,9 +33,9 @@ namespace dd4hep { public: - /// The constructor - takes the main lcdd object. - CellIDPositionConverter( LCDD& lcdd ) : _lcdd( &lcdd ) { - _volumeManager = VolumeManager::getVolumeManager(lcdd); + /// The constructor - takes the main description object. + CellIDPositionConverter( Detector& description ) : _description( &description ) { + _volumeManager = VolumeManager::getVolumeManager(description); } /// Destructor @@ -72,9 +73,9 @@ namespace dd4hep { * invalid DetElement is returned. Uses the optionally given DetElement as start for the search. */ DetElement findDetElement(const Position& global, - const DetElement& det=DetElement() ) const; - - + const DetElement& det=DetElement() ) const; + + /** Find the lowest daughter Placement in the given Placement that * contains the point (in the coordinate system of the mother placement). * Return the local coordinates in this daughter Placement and collect all volIDs @@ -99,7 +100,7 @@ namespace dd4hep { protected: VolumeManager _volumeManager{} ; - const LCDD* _lcdd ; + const Detector* _description ; }; diff --git a/DDRec/include/DDRec/DDGear.h b/DDRec/include/DDRec/DDGear.h index 96cd3ba7b..ce5baf6d7 100644 --- a/DDRec/include/DDRec/DDGear.h +++ b/DDRec/include/DDRec/DDGear.h @@ -1,8 +1,8 @@ #ifndef DDGear_H #define DDGear_H -#include "DD4hep/LCDD.h" #include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "gear/GEAR.h" #include "gearimpl/GearParametersImpl.h" @@ -33,7 +33,7 @@ namespace dd4hep { std::vector< gear::SimpleMaterialImpl > _materials ; public : - /** Default c'tor - only used by DD4hep extenbsion mechanism.*/ + /** Default c'tor - only used by dd4hep extenbsion mechanism.*/ GearHandle() : _gObj( 0 ) , _name( "UNKNOWN" ) {} /** User c'tor - specify a name (should be the canonical name used in gear, eg. TPCParameters, SITParameters, etc.) and @@ -79,11 +79,11 @@ namespace dd4hep { //=============================================================================================================== /** Factory method that creates a GearMgr object pobulated with the GearParametersImpl objects from - all (top level) DetElements in the lcdd object + all (top level) DetElements in the description object @author F.Gaede, DESY @version $Id$ */ - gear::GearMgr* createGearMgr( LCDD& lcdd , const std::string& pluginName="GearForILD" ) ; + gear::GearMgr* createGearMgr( Detector& description , const std::string& pluginName="GearForILD" ) ; }} diff --git a/DDRec/include/DDRec/DetectorData.h b/DDRec/include/DDRec/DetectorData.h index d51263ff2..9daaa684e 100644 --- a/DDRec/include/DDRec/DetectorData.h +++ b/DDRec/include/DDRec/DetectorData.h @@ -1,12 +1,12 @@ -#ifndef DDRec_DetectorData_H_ -#define DDRec_DetectorData_H_ +#ifndef rec_DetectorData_H_ +#define rec_DetectorData_H_ #include <map> #include <bitset> #include <ostream> -#include "DD4hep/LCDD.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" +#include "DDRec/tempdefs.h" namespace dd4hep { namespace rec { @@ -193,7 +193,7 @@ namespace dd4hep { }; } ; - /** Internal helper struct for defining the layer layout. Layers are defined + /** detaill helper struct for defining the layer layout. Layers are defined * with a sensitive part and a support part. */ struct LayerLayout{ @@ -464,13 +464,13 @@ namespace dd4hep { struct NeighbourSurfacesStruct { /// map of all neighbours in the same layer - std::map<DD4hep::long64 , std::vector<DD4hep::long64 > > sameLayer ; + std::map<dd4hep::long64 , std::vector<dd4hep::long64 > > sameLayer ; /// map of all neighbours in the previous layer - std::map<DD4hep::long64 , std::vector<DD4hep::long64 > > prevLayer ; + std::map<dd4hep::long64 , std::vector<dd4hep::long64 > > prevLayer ; /// map of all neighbours in the next layer - std::map<DD4hep::long64 , std::vector<DD4hep::long64 > > nextLayer ; + std::map<dd4hep::long64 , std::vector<dd4hep::long64 > > nextLayer ; } ; typedef StructExtension<NeighbourSurfacesStruct> NeighbourSurfacesData ; @@ -481,4 +481,4 @@ namespace dd4hep { } /* namespace rec */ } /* namespace dd4hep */ -#endif // DDRec_DetectorData_H_ +#endif // rec_DetectorData_H_ diff --git a/DDRec/include/DDRec/DetectorSurfaces.h b/DDRec/include/DDRec/DetectorSurfaces.h index e84645f72..d48bc7da7 100644 --- a/DDRec/include/DDRec/DetectorSurfaces.h +++ b/DDRec/include/DDRec/DetectorSurfaces.h @@ -1,7 +1,8 @@ -#ifndef DDRec_DetectorSurfaces_H_ -#define DDRec_DetectorSurfaces_H_ +#ifndef rec_DetectorSurfaces_H_ +#define rec_DetectorSurfaces_H_ #include "DDRec/Surface.h" +#include "DDRec/tempdefs.h" namespace dd4hep { namespace rec { @@ -38,4 +39,4 @@ namespace dd4hep { namespace DD4hep { namespace DDRec { using namespace dd4hep::rec ; } } // bwd compatibility for old namsepaces -#endif // DDRec_DetectorSurfaces_H_ +#endif // rec_DetectorSurfaces_H_ diff --git a/DDRec/include/DDRec/Exceptions.h b/DDRec/include/DDRec/Exceptions.h index 7e4d8da7d..053f9654e 100644 --- a/DDRec/include/DDRec/Exceptions.h +++ b/DDRec/include/DDRec/Exceptions.h @@ -1,6 +1,6 @@ // $Id$ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : A.Muennich @@ -11,7 +11,7 @@ #include <exception> -namespace DD4hep { +namespace dd4hep { //define some exception to throw diff --git a/DDRec/include/DDRec/Extensions/CalorimeterExtension.h b/DDRec/include/DDRec/Extensions/CalorimeterExtension.h index 177e17872..140f882d1 100644 --- a/DDRec/include/DDRec/Extensions/CalorimeterExtension.h +++ b/DDRec/include/DDRec/Extensions/CalorimeterExtension.h @@ -7,18 +7,18 @@ * Author: Christian Grefe, CERN */ -#ifndef DDRec_CALORIMETEREXTENSION_H_ -#define DDRec_CALORIMETEREXTENSION_H_ +#ifndef rec_CALORIMETEREXTENSION_H_ +#define rec_CALORIMETEREXTENSION_H_ -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { -class [[gnu::deprecated(" unmaintained code ")]] CalorimeterExtension { +class CalorimeterExtension { public: CalorimeterExtension(); virtual ~CalorimeterExtension(); }; -} /* namespace DDRec */ -} /* namespace DD4hep */ -#endif /* DDRec_CALORIMETEREXTENSION_H_ */ +} /* namespace rec */ +} /* namespace dd4hep */ +#endif /* rec_CALORIMETEREXTENSION_H_ */ diff --git a/DDRec/include/DDRec/Extensions/LayeringExtension.h b/DDRec/include/DDRec/Extensions/LayeringExtension.h index 1c22d1710..92e43fd83 100644 --- a/DDRec/include/DDRec/Extensions/LayeringExtension.h +++ b/DDRec/include/DDRec/Extensions/LayeringExtension.h @@ -7,20 +7,21 @@ * Author: Christian Grefe, CERN */ -#ifndef DDRec_LAYERINGEXTENSION_H_ -#define DDRec_LAYERINGEXTENSION_H_ +#ifndef rec_LAYERINGEXTENSION_H_ +#define rec_LAYERINGEXTENSION_H_ -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" +#include "DDRec/tempdefs.h" -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { /** * Class describing the layer structure of a sub detector. * The information for one layer corresponds to a typical module * if, for example, a layer consists of multiple modules. */ -class [[gnu::deprecated(" unmaintained code ")]] LayeringExtension { +class LayeringExtension { public: /// Destructor virtual ~LayeringExtension() { @@ -33,13 +34,13 @@ public: virtual int numberOfSensors(int layerIndex) const = 0; /// Access to the layer DetElement for the given index - virtual Geometry::DetElement layer(int layerIndex) const = 0; + virtual DetElement layer(int layerIndex) const = 0; /// Access to the sensitive DetElements of a given layer index - virtual const std::vector<Geometry::DetElement>& sensors(int layerIndex) const = 0; + virtual const std::vector<DetElement>& sensors(int layerIndex) const = 0; /// Access to the non-sensitive DetElements of a given layer index - virtual const std::vector<Geometry::DetElement>& absorbers(int layerIndex) const = 0; + virtual const std::vector<DetElement>& absorbers(int layerIndex) const = 0; /// Access the total thickness of the sub detector virtual double totalThickness() const = 0; @@ -82,6 +83,6 @@ protected: } }; -} /* namespace DDRec */ -} /* namespace DD4hep */ -#endif /* DDRec_LAYERINGEXTENSION_H_ */ +} /* namespace rec */ +} /* namespace dd4hep */ +#endif /* rec_LAYERINGEXTENSION_H_ */ diff --git a/DDRec/include/DDRec/Extensions/LayeringExtensionImpl.h b/DDRec/include/DDRec/Extensions/LayeringExtensionImpl.h index 83cd30c97..faaf4f72f 100644 --- a/DDRec/include/DDRec/Extensions/LayeringExtensionImpl.h +++ b/DDRec/include/DDRec/Extensions/LayeringExtensionImpl.h @@ -7,14 +7,14 @@ * Author: Christian Grefe, CERN */ -#ifndef DDRec_LAYERINGEXTENSIONIMPL_H_ -#define DDRec_LAYERINGEXTENSIONIMPL_H_ +#ifndef rec_LAYERINGEXTENSIONIMPL_H_ +#define rec_LAYERINGEXTENSIONIMPL_H_ -// DDRec +// rec #include "DDRec/Extensions/LayeringExtension.h" -// DD4hep -#include "DD4hep/Detector.h" +// dd4hep +#include "DD4hep/DetElement.h" // C++ #include <map> @@ -22,19 +22,16 @@ class TGeoManager; -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { -class [[gnu::deprecated(" unmaintained code ")]] LayeringExtensionImpl: public LayeringExtension { +class LayeringExtensionImpl: public LayeringExtension { public: - /// Shortcut to use geometrical positions - typedef Geometry::Position Position; - /// Default constructor LayeringExtensionImpl(); /// Copy constructor - LayeringExtensionImpl(const LayeringExtensionImpl& /*e*/, const Geometry::DetElement& /*d*/) {}; + LayeringExtensionImpl(const LayeringExtensionImpl& /*e*/, const DetElement& /*d*/) {}; /// Destructor virtual ~LayeringExtensionImpl(); @@ -46,13 +43,13 @@ public: virtual int numberOfSensors(int layerIndex) const; /// Access to the layer DetElement for the given index - virtual Geometry::DetElement layer(int layerIndex) const; + virtual DetElement layer(int layerIndex) const; /// Access to the sensitive DetElements of a given layer index - virtual const std::vector<Geometry::DetElement>& sensors(int layerIndex) const; + virtual const std::vector<DetElement>& sensors(int layerIndex) const; /// Access to the non-sensitive DetElements of a given layer index - virtual const std::vector<Geometry::DetElement>& absorbers(int layerIndex) const; + virtual const std::vector<DetElement>& absorbers(int layerIndex) const; /// Access the total thickness of the sub detector virtual double totalThickness() const; @@ -91,16 +88,16 @@ public: virtual double sensorInteractionLength(int layerIndex) const; /// Stores the layer information for the given layer index - void setLayer(int layerIndex, Geometry::DetElement layer, const Position& normal); + void setLayer(int layerIndex, DetElement layer, const Position& normal); protected: /// Helper class to store layer attributes struct LayerAttributes { LayerAttributes(); - Geometry::DetElement layer; + DetElement layer; Position normal; - std::vector<Geometry::DetElement> sensors; - std::vector<Geometry::DetElement> absorbers; + std::vector<DetElement> sensors; + std::vector<DetElement> absorbers; double thickness; double radiationLength; double interactionLength; @@ -114,7 +111,7 @@ protected: /// Helper method to calculate attributes from layer void calculate(); private: - double addElement(const Geometry::DetElement& det); + double addElement(const DetElement& det); TGeoManager* _tgeoManager; }; @@ -124,7 +121,7 @@ protected: void checkMap(int layerIndex) const; }; -} /* namespace DDRec */ -} /* namespace DD4hep */ +} /* namespace rec */ +} /* namespace dd4hep */ -#endif /* DDReconstruction_LAYERINGEXTENSIONIMPL_H_ */ +#endif /* reconstruction_LAYERINGEXTENSIONIMPL_H_ */ diff --git a/DDRec/include/DDRec/Extensions/SubdetectorExtension.h b/DDRec/include/DDRec/Extensions/SubdetectorExtension.h index 79d9e14bf..0c7e0b789 100644 --- a/DDRec/include/DDRec/Extensions/SubdetectorExtension.h +++ b/DDRec/include/DDRec/Extensions/SubdetectorExtension.h @@ -7,18 +7,19 @@ * Author: Christian Grefe, CERN */ -#ifndef DDRec_SUBDETECTOREXTENSION_H_ -#define DDRec_SUBDETECTOREXTENSION_H_ +#ifndef rec_SUBDETECTOREXTENSION_H_ +#define rec_SUBDETECTOREXTENSION_H_ -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" +#include "DDRec/tempdefs.h" -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { /** * Class describing general parameters of a subdetector. */ -class [[gnu::deprecated(" unmaintained code ")]] SubdetectorExtension { +class SubdetectorExtension { public: /// Destructor virtual ~SubdetectorExtension() { @@ -53,6 +54,6 @@ protected: } }; -} /* namespace DDRec */ -} /* namespace DD4hep */ -#endif /* DDRec_SUBDETECTOREXTENSION_H_ */ +} /* namespace rec */ +} /* namespace dd4hep */ +#endif /* rec_SUBDETECTOREXTENSION_H_ */ diff --git a/DDRec/include/DDRec/Extensions/SubdetectorExtensionImpl.h b/DDRec/include/DDRec/Extensions/SubdetectorExtensionImpl.h index 4562fd1ae..157a922eb 100644 --- a/DDRec/include/DDRec/Extensions/SubdetectorExtensionImpl.h +++ b/DDRec/include/DDRec/Extensions/SubdetectorExtensionImpl.h @@ -7,14 +7,14 @@ * Author: Christian Grefe, Bonn University */ -#ifndef DDRec_SUBDETECTOREXTENSIONIMPL_H_ -#define DDRec_SUBDETECTOREXTENSIONIMPL_H_ +#ifndef rec_SUBDETECTOREXTENSIONIMPL_H_ +#define rec_SUBDETECTOREXTENSIONIMPL_H_ #include "DDRec/Extensions/SubdetectorExtension.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { /** * Class describing general parameters of a subdetector. @@ -22,13 +22,13 @@ namespace DDRec { * Values can be set manually which will superseed the information from * the DetElement. */ -class [[gnu::deprecated(" unmaintained code ")]] SubdetectorExtensionImpl: public SubdetectorExtension { +class SubdetectorExtensionImpl: public SubdetectorExtension { public: /// Default constructor using a top level DetElement - SubdetectorExtensionImpl(const Geometry::DetElement& det); + SubdetectorExtensionImpl(const DetElement& det); /// Copy constructor - SubdetectorExtensionImpl(const SubdetectorExtensionImpl& e, const Geometry::DetElement& d); + SubdetectorExtensionImpl(const SubdetectorExtensionImpl& e, const DetElement& d); /// Destructor virtual ~SubdetectorExtensionImpl(); @@ -58,7 +58,7 @@ public: virtual int getNSides() const; /// Sets the top level detector element used to determine shape information - void setDetectorElement(const Geometry::DetElement& det); + void setDetectorElement(const DetElement& det); /// Sets the isBarrel flag void setIsBarrel(bool value); @@ -82,7 +82,7 @@ public: void setNSides(int value); protected: - Geometry::DetElement det; + DetElement det; bool _isBarrel; bool _setIsBarrel; bool _isEndcap; @@ -101,6 +101,6 @@ protected: void resetAll(); }; -} /* namespace DDRec */ -} /* namespace DD4hep */ -#endif /* DDRec_SUBDETECTOREXTENSIONIMPL_H_ */ +} /* namespace rec */ +} /* namespace dd4hep */ +#endif /* rec_SUBDETECTOREXTENSIONIMPL_H_ */ diff --git a/DDRec/include/DDRec/Extensions/TrackerExtension.h b/DDRec/include/DDRec/Extensions/TrackerExtension.h index 6129a9573..e83914b41 100644 --- a/DDRec/include/DDRec/Extensions/TrackerExtension.h +++ b/DDRec/include/DDRec/Extensions/TrackerExtension.h @@ -7,18 +7,18 @@ * Author: Christian Grefe, CERN */ -#ifndef DDRec_TRACKEREXTENSION_H_ -#define DDRec_TRACKEREXTENSION_H_ +#ifndef rec_TRACKEREXTENSION_H_ +#define rec_TRACKEREXTENSION_H_ -namespace DD4hep { -namespace DDRec { +namespace dd4hep { +namespace rec { -class [[gnu::deprecated(" unmaintained code ")]] TrackerExtension { +class TrackerExtension { public: TrackerExtension(); virtual ~TrackerExtension(); }; -} /* namespace DDRec */ -} /* namespace DD4hep */ -#endif /* DDRec_TRACKEREXTENSION_H_ */ +} /* namespace rec */ +} /* namespace dd4hep */ +#endif /* rec_TRACKEREXTENSION_H_ */ diff --git a/DDRec/include/DDRec/Material.h b/DDRec/include/DDRec/Material.h index 0953a10e3..7b9bf8aed 100644 --- a/DDRec/include/DDRec/Material.h +++ b/DDRec/include/DDRec/Material.h @@ -1,8 +1,9 @@ -#ifndef DDRec_Material_H -#define DDRec_Material_H +#ifndef rec_Material_H +#define rec_Material_H -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDRec/IMaterial.h" +#include "DD4hep/Objects.h" #include <list> @@ -167,4 +168,4 @@ namespace dd4hep { namespace DD4hep { namespace DDRec { using namespace dd4hep::rec ; } } // bwd compatibility for old namsepaces -#endif /* DDRec_Material_H */ +#endif /* rec_Material_H */ diff --git a/DDRec/include/DDRec/MaterialManager.h b/DDRec/include/DDRec/MaterialManager.h index 6c0c60131..37c5a5442 100644 --- a/DDRec/include/DDRec/MaterialManager.h +++ b/DDRec/include/DDRec/MaterialManager.h @@ -1,12 +1,11 @@ -#ifndef DDRec_MaterialManager_H_ -#define DDRec_MaterialManager_H_ +#ifndef rec_MaterialManager_H_ +#define rec_MaterialManager_H_ #include "DD4hep/LCDD.h" #include "DD4hep/Objects.h" #include "DDRec/Vector3D.h" #include "DDRec/Material.h" #include "DD4hep/DD4hepUnits.h" -#include "DD4hep/Volumes.h" #include <vector> @@ -93,4 +92,4 @@ namespace dd4hep { namespace DD4hep { namespace DDRec { using namespace dd4hep::rec ; } } // bwd compatibility for old namsepaces -#endif // DDRec_MaterialManager_H_ +#endif // rec_MaterialManager_H_ diff --git a/DDRec/include/DDRec/Surface.h b/DDRec/include/DDRec/Surface.h index e4aeac21d..28e996535 100644 --- a/DDRec/include/DDRec/Surface.h +++ b/DDRec/include/DDRec/Surface.h @@ -1,9 +1,9 @@ -#ifndef DDRec_Surface_H -#define DDRec_Surface_H +#ifndef rec_Surface_H +#define rec_Surface_H #include "DD4hep/Objects.h" #include "DD4hep/Volumes.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DDRec/ISurface.h" #include "DDRec/Material.h" diff --git a/DDRec/include/DDRec/SurfaceHelper.h b/DDRec/include/DDRec/SurfaceHelper.h index 049e84ae1..0120d1b62 100644 --- a/DDRec/include/DDRec/SurfaceHelper.h +++ b/DDRec/include/DDRec/SurfaceHelper.h @@ -1,5 +1,5 @@ -#ifndef DDRec_SurfaceHelper_H_ -#define DDRec_SurfaceHelper_H_ +#ifndef rec_SurfaceHelper_H_ +#define rec_SurfaceHelper_H_ #include "DDRec/Surface.h" @@ -23,7 +23,7 @@ namespace dd4hep { ~SurfaceHelper(); /** Get the list of all surfaces added to this DetElement and all its daughters - - * instantiate SurfaceHelper with lcdd.world() to get all surfaces. + * instantiate SurfaceHelper with description.world() to get all surfaces. */ const SurfaceList& surfaceList() { return _sL ; } @@ -41,4 +41,4 @@ namespace dd4hep { namespace DD4hep { namespace DDRec { using namespace dd4hep::rec ; } } // bwd compatibility for old namsepaces -#endif // DDRec_SurfaceHelper_H_ +#endif // rec_SurfaceHelper_H_ diff --git a/DDRec/include/DDRec/SurfaceManager.h b/DDRec/include/DDRec/SurfaceManager.h index cec1da208..5849c8b49 100644 --- a/DDRec/include/DDRec/SurfaceManager.h +++ b/DDRec/include/DDRec/SurfaceManager.h @@ -1,5 +1,5 @@ -#ifndef DDRec_SurfaceManager_H_ -#define DDRec_SurfaceManager_H_ +#ifndef rec_SurfaceManager_H_ +#define rec_SurfaceManager_H_ #include "DDRec/ISurface.h" #include "DD4hep/LCDD.h" @@ -26,7 +26,7 @@ namespace dd4hep { public: /// The constructor - SurfaceManager(LCDD& theDetector); + SurfaceManager(Detector& theDetector); /// No default constructor SurfaceManager() = delete ; @@ -54,7 +54,7 @@ namespace dd4hep { /// initialize all known surface maps - void initialize(LCDD& theDetector) ; + void initialize(Detector& theDetector) ; SurfaceMapsMap _map ; }; @@ -65,4 +65,4 @@ namespace dd4hep { namespace DD4hep { namespace DDRec { using namespace dd4hep::rec ; } } // bwd compatibility for old namsepaces namespace DDSurfaces { using namespace dd4hep::rec ; } // bwd compatibility for old namsepaces -#endif // DDRec_SurfaceManager_H_ +#endif // rec_SurfaceManager_H_ diff --git a/DDRec/include/DDRec/tempdefs.h b/DDRec/include/DDRec/tempdefs.h new file mode 100644 index 000000000..eb4f91d02 --- /dev/null +++ b/DDRec/include/DDRec/tempdefs.h @@ -0,0 +1,19 @@ +namespace dd4hep { + class DetElement; + class Material; + class SensitiveDetector; + class Material; + class Readout; + class Detector; + class Segmentation; + namespace detail { + using dd4hep::SensitiveDetector; + using dd4hep::DetElement; + using dd4hep::Material; + using dd4hep::Position; + using dd4hep::Readout; + using dd4hep::Segmentation; + using dd4hep::Detector; + } +} + diff --git a/DDRec/src/CellIDPositionConverter.cpp b/DDRec/src/CellIDPositionConverter.cpp index 0a5bf142c..f55dc06c3 100644 --- a/DDRec/src/CellIDPositionConverter.cpp +++ b/DDRec/src/CellIDPositionConverter.cpp @@ -1,7 +1,7 @@ #include "DDRec/CellIDPositionConverter.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/detail/VolumeManagerInterna.h" #include "TGeoManager.h" @@ -9,6 +9,8 @@ namespace dd4hep { namespace rec { + using std::set; + const VolumeManagerContext* CellIDPositionConverter::findContext(const CellID& cellID) const { return _volumeManager.lookupContext( cellID ) ; @@ -57,7 +59,7 @@ namespace dd4hep { local.GetCoordinates(l); - const TGeoMatrix& volToElement = context->toElement ; + const TGeoMatrix& volToElement = context->toElement(); volToElement.LocalToMaster(l, e); const TGeoMatrix& elementToGlobal = det.nominal().worldTransformation(); @@ -74,7 +76,7 @@ namespace dd4hep { CellID result(0) ; - TGeoManager *geoManager = _lcdd->world().volume()->GetGeoManager() ; + TGeoManager *geoManager = _description->world().volume()->GetGeoManager() ; PlacedVolume pv = geoManager->FindNode( global.x() , global.y() , global.z() ) ; @@ -117,7 +119,7 @@ namespace dd4hep { // CellID result(0) ; - // DetElement motherDet = _lcdd->world() ; // could also start from an arbitrary DetElement here !? + // DetElement motherDet = _description->world() ; // could also start from an arbitrary DetElement here !? // DetElement det = findDetElement( global , motherDet ) ; @@ -133,7 +135,7 @@ namespace dd4hep { // PlacedVolume pv = findPlacement( Position( e[0], e[1] , e[2] ) , det.placement() , l , volIDs ) ; // TGeoManager *geoManager = det.volume()->GetGeoManager() ; - // // TGeoManager *geoManager = _lcdd->world().volume()->GetGeoManager() ; + // // TGeoManager *geoManager = _description->world().volume()->GetGeoManager() ; // PlacedVolume pv1 = geoManager->FindNode( global.x() , global.y() , global.z() ) ; @@ -146,7 +148,7 @@ namespace dd4hep { // if( pv.isValid() && pv.volume().isSensitive() ) { - // Geometry::SensitiveDetector sd = pv.volume().sensitiveDetector(); + // SensitiveDetector sd = pv.volume().sensitiveDetector(); // Readout r = sd.readout() ; // VolumeID volIDElement = det.volumeID() ; @@ -160,7 +162,7 @@ namespace dd4hep { // // << " for point " << global << " try with TGeoManager ... " << std::endl ; // // TGeoManager *geoManager = det.volume()->GetGeoManager() ; - // // // TGeoManager *geoManager = _lcdd->world().volume()->GetGeoManager() ; + // // // TGeoManager *geoManager = _description->world().volume()->GetGeoManager() ; // // PlacedVolume p = geoManager->FindNode( global.x() , global.y() , global.z() ) ; @@ -195,7 +197,7 @@ namespace dd4hep { DetElement CellIDPositionConverter::findDetElement(const Position& global, const DetElement& d) const { - DetElement det = ( d.isValid() ? d : _lcdd->world() ) ; + DetElement det = ( d.isValid() ? d : _description->world() ) ; // std::cout << " --- " << global << det.name() << std::endl ; diff --git a/DDRec/src/DetectorSurfaces.cpp b/DDRec/src/DetectorSurfaces.cpp index 266ca73b4..a6c104a2d 100644 --- a/DDRec/src/DetectorSurfaces.cpp +++ b/DDRec/src/DetectorSurfaces.cpp @@ -5,7 +5,7 @@ namespace dd4hep { - DetectorSurfaces::DetectorSurfaces(DD4hep::Geometry::DetElement const& e) : DetElement(e) , _sL( 0 ) { + DetectorSurfaces::DetectorSurfaces(dd4hep::DetElement const& e) : DetElement(e) , _sL( 0 ) { initialize() ; } diff --git a/DDRec/src/IDDecoder.cpp b/DDRec/src/IDDecoder.cpp index 93c07fd5e..85a2ecbcf 100644 --- a/DDRec/src/IDDecoder.cpp +++ b/DDRec/src/IDDecoder.cpp @@ -8,20 +8,12 @@ #include "DDRec/API/IDDecoder.h" #include "DDRec/API/Exceptions.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/VolumeManager.h" -namespace DD4hep { -namespace DDRec { - -using Geometry::DetElement; -using Geometry::LCDD; -using Geometry::PlacedVolume; -using Geometry::Readout; -using Geometry::Solid; -using Geometry::VolumeManager; -using Geometry::Volume; -using Geometry::Position; +namespace dd4hep { +namespace rec { + using std::set; IDDecoder& IDDecoder::getInstance() { @@ -31,8 +23,8 @@ IDDecoder& IDDecoder::getInstance() { /// Default constructor IDDecoder::IDDecoder() { - LCDD& lcdd = LCDD::getInstance(); - _volumeManager = VolumeManager::getVolumeManager(lcdd); + Detector& description = Detector::getInstance(); + _volumeManager = VolumeManager::getVolumeManager(description); } /** @@ -147,23 +139,23 @@ DetElement IDDecoder::detectorElement(const CellID& cell) const { * Returns the closest detector element in the hierarchy for a given global position */ DetElement IDDecoder::detectorElement(const Position& pos) const { - DetElement world = Geometry::LCDD::getInstance().world(); + DetElement world = Detector::getInstance().world(); DetElement det = getClosestDaughter(world, pos); if (not det.isValid()) { - throw invalid_position("DD4hep::DDRec::IDDecoder::detectorElement", pos); + throw invalid_position("dd4hep::rec::IDDecoder::detectorElement", pos); } std::cout << det.name() << std::endl; return det; } /// Access to the Readout object for a given cell ID -Geometry::Readout IDDecoder::readout(const CellID& cell) const { +Readout IDDecoder::readout(const CellID& cell) const { DetElement det = this->detectorElement(cell); return this->findReadout(det); } /// Access to the Readout object for a given global position -Geometry::Readout IDDecoder::readout(const Position& global) const { +Readout IDDecoder::readout(const Position& global) const { DetElement det = this->detectorElement(global); return this->findReadout(det); } @@ -205,11 +197,11 @@ long int IDDecoder::systemIndex(const CellID& cell) const { } // helper method to find the corresponding Readout object to a DetElement -Readout IDDecoder::findReadout(const Geometry::DetElement& det) const { +Readout IDDecoder::findReadout(const DetElement& det) const { // first check if top level is a sensitive detector if (det.volume().isValid() and det.volume().isSensitive()) { - Geometry::SensitiveDetector sd = det.volume().sensitiveDetector(); + SensitiveDetector sd = det.volume().sensitiveDetector(); if (sd.isValid() and sd.readout().isValid()) { return sd.readout(); } @@ -260,5 +252,5 @@ DetElement IDDecoder::getClosestDaughter(const DetElement& det, const Position& return result; } -} /* namespace DDRec */ -} /* namespace DD4hep */ +} /* namespace rec */ +} /* namespace dd4hep */ diff --git a/DDRec/src/LayeringExtensionImpl.cpp b/DDRec/src/LayeringExtensionImpl.cpp index e251b55b4..cac2b3de5 100644 --- a/DDRec/src/LayeringExtensionImpl.cpp +++ b/DDRec/src/LayeringExtensionImpl.cpp @@ -7,14 +7,12 @@ #include "DDRec/Extensions/LayeringExtensionImpl.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "TGeoManager.h" -namespace DD4hep { -namespace DDRec { - -using Geometry::DetElement; +namespace dd4hep { +namespace rec { using std::vector; using std::map; @@ -159,7 +157,7 @@ double LayeringExtensionImpl::sensorInteractionLength(int layerIndex) const { } /// Stores the layer information for the given layer index -void LayeringExtensionImpl::setLayer(int layerIndex, Geometry::DetElement layer_elt, const Position& normal) { +void LayeringExtensionImpl::setLayer(int layerIndex, DetElement layer_elt, const Position& normal) { LayerAttributes& layerAttributes = _layerMap[layerIndex]; layerAttributes.layer = layer_elt; layerAttributes.normal = normal.Unit(); @@ -183,7 +181,7 @@ void LayeringExtensionImpl::checkMap(int layerIndex) const { LayeringExtensionImpl::LayerAttributes::LayerAttributes() : thickness(0.), radiationLength(0.), interactionLength(0.), absorberThickness(0.), absorberRadiationLength(0.), absorberInteractionLength( 0.), sensorThickness(0.), sensorRadiationLength(0.), sensorInteractionLength(0.), isCalculated(false) { - _tgeoManager = Geometry::LCDD::getInstance().world().volume()->GetGeoManager(); + _tgeoManager = Detector::getInstance().world().volume()->GetGeoManager(); } void LayeringExtensionImpl::LayerAttributes::calculate() { @@ -215,10 +213,10 @@ double LayeringExtensionImpl::LayerAttributes::addElement(const DetElement& det) ++it; } - Geometry::Volume volume = det.volume(); + Volume volume = det.volume(); if (volume.isValid() and volume.solid().isValid()) { - Geometry::Solid solid = volume.solid(); - Geometry::Material material = volume.material(); + Solid solid = volume.solid(); + Material material = volume.material(); double origin[3] = { 0., 0., 0. }; double direction[3] = { normal.x(), normal.y(), normal.z() }; double reverse_direction[3] = { -normal.x(), -normal.y(), -normal.z() }; @@ -245,5 +243,5 @@ double LayeringExtensionImpl::LayerAttributes::addElement(const DetElement& det) return thisThickness; } -} /* namespace DDRec */ -} /* namespace DD4hep */ +} /* namespace rec */ +} /* namespace dd4hep */ diff --git a/DDRec/src/MaterialManager.cpp b/DDRec/src/MaterialManager.cpp index bbec301dc..ac5e90387 100644 --- a/DDRec/src/MaterialManager.cpp +++ b/DDRec/src/MaterialManager.cpp @@ -1,6 +1,6 @@ #include "DDRec/MaterialManager.h" #include "DD4hep/Exceptions.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "TGeoVolume.h" #include "TGeoManager.h" @@ -13,7 +13,7 @@ namespace dd4hep { namespace rec { - MaterialManager::MaterialManager(DD4hep::Geometry::Volume world) : _mV(0), _m( Material() ), _p0(),_p1(),_pos() { + MaterialManager::MaterialManager(Volume world) : _mV(0), _m( Material() ), _p0(),_p1(),_pos() { _tgeoMgr = world->GetGeoManager(); } @@ -21,7 +21,7 @@ namespace dd4hep { MaterialManager::MaterialManager() : _mV(0), _m( Material() ), _p0(),_p1(),_pos() { - _tgeoMgr = Geometry::LCDD::getInstance().world().volume()->GetGeoManager(); + _tgeoMgr = Detector::getInstance().world().volume()->GetGeoManager(); } MaterialManager::~MaterialManager(){ @@ -153,7 +153,7 @@ namespace dd4hep { } - const Geometry::Material& MaterialManager::materialAt(const Vector3D& pos ){ + const Material& MaterialManager::materialAt(const Vector3D& pos ){ if( pos != _pos ) { diff --git a/DDRec/src/SubdetectorExtensionImpl.cpp b/DDRec/src/SubdetectorExtensionImpl.cpp index ed95b645d..a616bbf4b 100644 --- a/DDRec/src/SubdetectorExtensionImpl.cpp +++ b/DDRec/src/SubdetectorExtensionImpl.cpp @@ -8,22 +8,19 @@ #include "DDRec/Extensions/SubdetectorExtensionImpl.h" #include "DDRec/API/IDDecoder.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" -namespace DD4hep { -namespace DDRec { - -using Geometry::DetElement; -using Geometry::Position; +namespace dd4hep { +namespace rec { /// Constructor using a top level DetElement -SubdetectorExtensionImpl::SubdetectorExtensionImpl(const Geometry::DetElement& det_elt) { +SubdetectorExtensionImpl::SubdetectorExtensionImpl(const DetElement& det_elt) { this->resetAll(); this->det = det_elt; } /// Copy constructor -SubdetectorExtensionImpl::SubdetectorExtensionImpl(const SubdetectorExtensionImpl& e, const Geometry::DetElement& d) { +SubdetectorExtensionImpl::SubdetectorExtensionImpl(const SubdetectorExtensionImpl& e, const DetElement& d) { this->resetAll(); this->det = d; if (e._setIsBarrel) { @@ -78,16 +75,16 @@ double SubdetectorExtensionImpl::getRMin() const { return _rMin; } if (det.isValid() and det.volume().isValid() and det.volume().solid().isValid()) { - Geometry::Solid solid = det.volume().solid(); + Solid solid = det.volume().solid(); try { - Geometry::Tube tube(solid); + Tube tube(solid); if (tube.isValid()) { return tube->GetRmin(); } } catch (std::runtime_error& e) { } try { - Geometry::PolyhedraRegular polyhedra(solid); + PolyhedraRegular polyhedra(solid); if (polyhedra.isValid()) { return polyhedra->GetRmin()[0]; } @@ -103,16 +100,16 @@ double SubdetectorExtensionImpl::getRMax() const { return _rMax; } if (det.isValid() and det.volume().isValid() and det.volume().solid().isValid()) { - Geometry::Solid solid = det.volume().solid(); + Solid solid = det.volume().solid(); try { - Geometry::Tube tube(solid); + Tube tube(solid); if (tube.isValid()) { return tube->GetRmin(); } } catch (std::runtime_error& e) { } try { - Geometry::PolyhedraRegular polyhedra(solid); + PolyhedraRegular polyhedra(solid); if (polyhedra.isValid()) { return polyhedra->GetRmax()[0]; } @@ -128,8 +125,8 @@ double SubdetectorExtensionImpl::getZMin() const { return _zMin; } if (det.isValid() and det.volume().isValid() and det.volume().solid().isValid()) { - Geometry::Solid solid = det.volume().solid(); - Geometry::Box box(solid); + Solid solid = det.volume().solid(); + Box box(solid); if (box.isValid()) { Position local(0.,0.,-box->GetDZ()/2.); Position global; @@ -146,8 +143,8 @@ double SubdetectorExtensionImpl::getZMax() const { return _zMax; } if (det.isValid() and det.volume().isValid() and det.volume().solid().isValid()) { - Geometry::Solid solid = det.volume().solid(); - Geometry::Box box(solid); + Solid solid = det.volume().solid(); + Box box(solid); if (box.isValid()) { Position local(0.,0.,box->GetDZ()/2.); Position global; @@ -167,9 +164,9 @@ int SubdetectorExtensionImpl::getNSides() const { return _nSides; } if (det.isValid() and det.volume().isValid() and det.volume().solid().isValid()) { - Geometry::Solid solid = det.volume().solid(); + Solid solid = det.volume().solid(); try { - Geometry::PolyhedraRegular polyhedra(solid); + PolyhedraRegular polyhedra(solid); if (polyhedra.isValid()) { return polyhedra->GetNedges(); } @@ -181,7 +178,7 @@ int SubdetectorExtensionImpl::getNSides() const { } /// Sets the top level detector element used to determine shape information -void SubdetectorExtensionImpl::setDetectorElement(const Geometry::DetElement& det_elt) { +void SubdetectorExtensionImpl::setDetectorElement(const DetElement& det_elt) { this->det = det_elt; } @@ -242,5 +239,5 @@ void SubdetectorExtensionImpl::resetAll() { _setNSides = false; } -} /* namespace DDRec */ -} /* namespace DD4hep */ +} /* namespace rec */ +} /* namespace dd4hep */ diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp index 113a4ad69..6205544ba 100644 --- a/DDRec/src/Surface.cpp +++ b/DDRec/src/Surface.cpp @@ -17,7 +17,7 @@ namespace dd4hep { namespace rec { - using namespace Geometry ; + using namespace detail ; //====================================================================================================== @@ -254,7 +254,7 @@ namespace dd4hep { } //====================================================================================================== - VolCylinderImpl::VolCylinderImpl( Geometry::Volume vol, SurfaceType typ, + VolCylinderImpl::VolCylinderImpl( Volume vol, SurfaceType typ, double thickness_inner ,double thickness_outer, Vector3D o ) : VolSurfaceBase(typ, thickness_inner, thickness_outer, Vector3D() , Vector3D() , Vector3D() , o , vol, 0) { @@ -318,7 +318,7 @@ namespace dd4hep { } //================================================================================================================ - VolConeImpl::VolConeImpl( Geometry::Volume vol, SurfaceType typ, + VolConeImpl::VolConeImpl( Volume vol, SurfaceType typ, double thickness_inner ,double thickness_outer, Vector3D v_val, Vector3D o_val ) : VolSurfaceBase(typ, thickness_inner, thickness_outer, Vector3D() , v_val , Vector3D() , Vector3D() , vol, 0) { @@ -594,7 +594,7 @@ namespace dd4hep { //====================================================================================================================== - Surface::Surface( Geometry::DetElement det, VolSurface volSurf ) : _det( det) , _volSurf( volSurf ), + Surface::Surface( DetElement det, VolSurface volSurf ) : _det( det) , _volSurf( volSurf ), _wtM(0) , _id( 0) , _type( _volSurf.type() ) { initialize() ; @@ -621,7 +621,7 @@ namespace dd4hep { if( ! ( mat.Z() > 0 ) ) { - MaterialManager matMgr( _det.volume() ) ; + MaterialManager matMgr ; Vector3D p = _o - innerThickness() * _n ; @@ -640,7 +640,7 @@ namespace dd4hep { if( ! ( mat.Z() > 0 ) ) { - MaterialManager matMgr( _det.volume() ) ; + MaterialManager matMgr ; Vector3D p = _o + outerThickness() * _n ; diff --git a/DDRec/src/SurfaceHelper.cpp b/DDRec/src/SurfaceHelper.cpp index d5c97b0e6..9b8ab42d4 100644 --- a/DDRec/src/SurfaceHelper.cpp +++ b/DDRec/src/SurfaceHelper.cpp @@ -1,17 +1,18 @@ #include "DDRec/SurfaceHelper.h" #include "DDRec/DetectorSurfaces.h" +#include "DD4hep/DetElement.h" #include "DD4hep/Detector.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/VolumeManager.h" namespace dd4hep { - using namespace Geometry ; + using namespace detail ; namespace rec { - SurfaceHelper::SurfaceHelper(DD4hep::Geometry::DetElement const& e) : _det(e) { + SurfaceHelper::SurfaceHelper(dd4hep::DetElement const& e) : _det(e) { initialize() ; } @@ -19,9 +20,14 @@ namespace dd4hep { SurfaceHelper::~SurfaceHelper(){ // nothing to do } - - + + void SurfaceHelper::initialize() { + + // have to populate the volume manager once in order to have + // the volumeIDs attached to the DetElements + Detector& description = Detector::getInstance(); + /* VolumeManager volMgr = */ VolumeManager::getVolumeManager(description); //------------------ breadth first tree traversal --------- std::list< DetElement > dets ; diff --git a/DDRec/src/SurfaceManager.cpp b/DDRec/src/SurfaceManager.cpp index 2be6c7588..47f544039 100644 --- a/DDRec/src/SurfaceManager.cpp +++ b/DDRec/src/SurfaceManager.cpp @@ -2,16 +2,20 @@ #include "DDRec/SurfaceHelper.h" #include "DD4hep/VolumeManager.h" +#include "DD4hep/Detector.h" #include <sstream> namespace dd4hep { + + using namespace detail ; namespace rec { + SurfaceManager::SurfaceManager(){ - SurfaceManager::SurfaceManager(LCDD& theDetector){ + SurfaceManager::SurfaceManager(Detector& theDetector){ // have to make sure the volume manager is populated once in order to have // the volumeIDs attached to the DetElements @@ -38,13 +42,15 @@ namespace dd4hep { return 0 ; } - void SurfaceManager::initialize(LCDD& theDetector) { + void SurfaceManager::initialize(Detector& theDetector) { - const std::vector<std::string>& types = theDetector.detectorTypes() ; + Detector& description = Detector::getInstance(); + + const std::vector<std::string>& types = description.detectorTypes() ; for(unsigned i=0,N=types.size();i<N;++i){ - const std::vector<DetElement>& dets = theDetector.detectors( types[i] ) ; + const std::vector<DetElement>& dets = description.detectors( types[i] ) ; for(unsigned j=0,M=dets.size();j<M;++j){ diff --git a/DDRec/src/convertToGear.cc b/DDRec/src/convertToGear.cc index ce66178f5..e41ce688e 100644 --- a/DDRec/src/convertToGear.cc +++ b/DDRec/src/convertToGear.cc @@ -1,4 +1,4 @@ -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DD4hepUnits.h" #include "DD4hep/Fields.h" @@ -19,6 +19,7 @@ using namespace std ; using namespace dd4hep ; +using namespace dd4hep::detail; using namespace dd4hep::rec ; //============================================================================= @@ -27,7 +28,7 @@ int main(int argc, char** argv ){ if( argc < 3 ) { std::cout << " usage: convertToGear plugin compact.xml [gear_file.xml]" << std::endl - << " plugin: name of a plugin with a signature \"long int (LCDD*, int, char**)\" \n " + << " plugin: name of a plugin with a signature \"long int (Detector*, int, char**)\" \n " << " e.g. GearForILD (same as 'default'), GearForCLIC, ..." << std::endl ; exit(1) ; @@ -39,11 +40,11 @@ int main(int argc, char** argv ){ std::string outFile = ( argc>3 ? argv[3] : "" ) ; - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - lcdd.fromCompact( inFile ); + description.fromCompact( inFile ); - gear::GearMgr* gearMgr = ( pluginName == "default" ) ? createGearMgr( lcdd ) : createGearMgr( lcdd , pluginName ) ; + gear::GearMgr* gearMgr = ( pluginName == "default" ) ? createGearMgr( description ) : createGearMgr( description , pluginName ) ; //---------------------------------------------------------------------------------- @@ -59,7 +60,7 @@ int main(int argc, char** argv ){ outFile = "gear_" + gearMgr->getDetectorName() + ".xml" ; } - gear::GearXML::createXMLFile ( gearMgr, outFile ) ; + gear::Gearxml::createXMLFile ( gearMgr, outFile ) ; std::cout << " ************************************************************** " << std::endl ; diff --git a/DDRec/src/gear/DDGear.cpp b/DDRec/src/gear/DDGear.cpp index 9af1dc048..db649e700 100644 --- a/DDRec/src/gear/DDGear.cpp +++ b/DDRec/src/gear/DDGear.cpp @@ -1,6 +1,6 @@ #include "DDRec/DDGear.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DD4hepUnits.h" #include "DD4hep/Fields.h" #include "DD4hep/Plugins.h" @@ -22,21 +22,21 @@ namespace dd4hep{ namespace rec{ + using namespace detail ; - - gear::GearMgr* createGearMgr( Geometry::LCDD& lcdd , const std::string& pluginName ){ + gear::GearMgr* createGearMgr( Detector& description , const std::string& pluginName ){ int argc(0); char** argv = 0 ; - lcdd.apply( pluginName.c_str() , argc, argv) ; + description.apply( pluginName.c_str() , argc, argv) ; - DetElement world = lcdd.world() ; + DetElement world = description.world() ; gear::GearMgrImpl* gearMgr = new gear::GearMgrImpl() ; - gearMgr->setDetectorName( lcdd.header().name() ) ; + gearMgr->setDetectorName( description.header().name() ) ; - std::cout << " **** will convert detector " << lcdd.header().name() << " to Gear \n" + std::cout << " **** will convert detector " << description.header().name() << " to Gear \n" << " Iterating over all subdetectors: " << std::endl ; @@ -125,7 +125,7 @@ namespace dd4hep{ // fixme: for now we just assume a constant field - should be a real field map ... double origin[3] = { 0., 0., 0. } ; double bfield[3] ; - OverlayedField ovField = lcdd.field() ; + OverlayedField ovField = description.field() ; ovField.magneticField( origin , bfield ) ; gearMgr->setBField( new gear::ConstantBField( gear::Vector3D( bfield[0]/ dd4hep::tesla , bfield[1]/ dd4hep::tesla , bfield[2] / dd4hep::tesla ) ) ) ; diff --git a/DDRec/src/gear/createGearForCLIC.cpp b/DDRec/src/gear/createGearForCLIC.cpp index 97e1a555d..92f8d3a32 100644 --- a/DDRec/src/gear/createGearForCLIC.cpp +++ b/DDRec/src/gear/createGearForCLIC.cpp @@ -1,4 +1,4 @@ -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Factories.h" #include "DD4hep/DD4hepUnits.h" @@ -20,7 +20,7 @@ namespace dd4hep{ namespace rec{ - using namespace Geometry ; + using namespace detail ; // using namespace gear ; using DDSurfaces::Vector3D ; @@ -35,7 +35,7 @@ namespace dd4hep{ * @version $Id$ */ - static long createGearForCLIC(LCDD& lcdd, int /*argc*/, char** /*argv*/) { + static long createGearForCLIC(Detector& description, int /*argc*/, char** /*argv*/) { std::cout << " **** running plugin createGearForCLIC ! " << std::endl ; @@ -43,7 +43,7 @@ namespace dd4hep{ //========= VXD ============================================================================== try{ - DetElement vxdDE = lcdd.detector("VertexBarrel") ; + DetElement vxdDE = description.detector("VertexBarrel") ; ZPlanarData* vxd = vxdDE.extension<ZPlanarData>() ; @@ -56,9 +56,9 @@ namespace dd4hep{ for(unsigned i=0,n=vxd->layers.size() ; i<n; ++i){ // std::cout<<"Working on layer "<<i<<" for a total of "<<n<<" layers."<<std::endl; - const DDRec::ZPlanarData::LayerLayout& l = vxd->layers[i] ; + const rec::ZPlanarData::LayerLayout& l = vxd->layers[i] ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... gearVXD->addLayer( l.ladderNumber, l.phi0, l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l.thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. , l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l.thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ; @@ -75,7 +75,7 @@ namespace dd4hep{ // -------- better: get right averaged material from first ladder: ------------------ // MaterialManager matMgr ; // -// const DDRec::ZPlanarData::LayerLayout& l = vxd->layers[0] ; +// const rec::ZPlanarData::LayerLayout& l = vxd->layers[0] ; // // Vector3D a( l.distanceSupport , l.phi0 , 0. , Vector3D::cylindrical ) ; // Vector3D b( l.distanceSupport + l.thicknessSupport , l.phi0 , 0. , Vector3D::cylindrical ) ; @@ -105,7 +105,7 @@ namespace dd4hep{ try{ - DetElement sitDE = lcdd.detector("InnerTrackerBarrel") ; + DetElement sitDE = description.detector("InnerTrackerBarrel") ; ZPlanarData* sit = sitDE.extension<ZPlanarData>() ; @@ -119,9 +119,9 @@ namespace dd4hep{ for(unsigned i=0,n=sit->layers.size() ; i<n; ++i){ - const DDRec::ZPlanarData::LayerLayout& l = sit->layers[i] ; + const rec::ZPlanarData::LayerLayout& l = sit->layers[i] ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... gearSIT->addLayer( l.ladderNumber, l.phi0, l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l. thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. , l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l. thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ; @@ -148,7 +148,7 @@ namespace dd4hep{ try { - DetElement setDE = lcdd.detector("OuterTrackerBarrel") ; + DetElement setDE = description.detector("OuterTrackerBarrel") ; ZPlanarData* set = setDE.extension<ZPlanarData>() ; @@ -161,9 +161,9 @@ namespace dd4hep{ for(unsigned i=0,n=set->layers.size() ; i<n; ++i){ - const DDRec::ZPlanarData::LayerLayout& l = set->layers[i] ; + const rec::ZPlanarData::LayerLayout& l = set->layers[i] ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... gearSET->addLayer( l.ladderNumber, l.phi0, l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l. thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. , l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l. thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ; @@ -190,7 +190,7 @@ namespace dd4hep{ try { - DetElement iteDE = lcdd.detector("InnerTrackerEndcap") ; + DetElement iteDE = description.detector("InnerTrackerEndcap") ; ZDiskPetalsData* iteData = iteDE.extension<ZDiskPetalsData>() ; @@ -204,7 +204,7 @@ namespace dd4hep{ for(unsigned i=0,n=iteData->layers.size() ; i<n; ++i){ - const DDRec::ZDiskPetalsData::LayerLayout& l = iteData->layers[i] ; + const rec::ZDiskPetalsData::LayerLayout& l = iteData->layers[i] ; thicknesses.push_back(l.thicknessSupport/ dd4hep::mm); innerRadii.push_back( l.distanceSensitive/ dd4hep::mm); @@ -217,13 +217,13 @@ namespace dd4hep{ //Append OuterTracker - DetElement oteDE = lcdd.detector("OuterTrackerEndcap") ; + DetElement oteDE = description.detector("OuterTrackerEndcap") ; ZDiskPetalsData* oteData = oteDE.extension<ZDiskPetalsData>() ; for(unsigned i=0,n=oteData->layers.size() ; i<n; ++i){ - const DDRec::ZDiskPetalsData::LayerLayout& l = oteData->layers[i] ; + const rec::ZDiskPetalsData::LayerLayout& l = oteData->layers[i] ; thicknesses.push_back(l.thicknessSupport/ dd4hep::mm); innerRadii.push_back( l.distanceSensitive/ dd4hep::mm); @@ -252,7 +252,7 @@ namespace dd4hep{ try { - DetElement coilDE = lcdd.detector("Solenoid") ; + DetElement coilDE = description.detector("Solenoid") ; gear::GearParametersImpl* gearCOIL = new gear::GearParametersImpl(); @@ -271,7 +271,7 @@ namespace dd4hep{ //============================================================================================ try { - DetElement tubeDE = lcdd.detector("Tube") ; + DetElement tubeDE = description.detector("Tube") ; ConicalSupportData* tube = tubeDE.extension<ConicalSupportData>() ; @@ -293,7 +293,7 @@ namespace dd4hep{ rOuter[i] = s.rOuter/ dd4hep::mm ; zStart[i] = s.zPos / dd4hep::mm ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... } gearTUBE->setDoubleVals("RInner" , rInner ) ; @@ -334,7 +334,7 @@ namespace dd4hep{ try { - DetElement caloDE = lcdd.detector( it->first ) ; + DetElement caloDE = description.detector( it->first ) ; LayeredCalorimeterData* calo = caloDE.extension<LayeredCalorimeterData>() ; @@ -350,7 +350,7 @@ namespace dd4hep{ LayeredCalorimeterData::Layer& l = calo->layers[i] ; - //Do some arithmetic to get thicknesses and (approximate) absorber thickneses from "new" DDRec structures + //Do some arithmetic to get thicknesses and (approximate) absorber thickneses from "new" rec structures //The positioning should come out right, but the absorber thickness should be overestimated due to the presence of //other less dense material if( i == 0 ) { @@ -393,7 +393,7 @@ namespace dd4hep{ //* test gear interface w/ LayeredExtensionImpl extension //********************************************************** - // DetElement calo2DE = lcdd.detector("EcalBarrel") ; + // DetElement calo2DE = description.detector("EcalBarrel") ; // Calorimeter calo2( calo2DE ) ; @@ -423,11 +423,11 @@ namespace dd4hep{ - // --- LCDD::apply() expects return code 1 if all went well ! ---- + // --- Detector::apply() expects return code 1 if all went well ! ---- return 1; } } } -DECLARE_APPLY( GearForCLIC, DD4hep::DDRec::createGearForCLIC ) +DECLARE_APPLY( GearForCLIC, dd4hep::rec::createGearForCLIC ) diff --git a/DDRec/src/gear/createGearForILD.cpp b/DDRec/src/gear/createGearForILD.cpp index 922641012..f801551c5 100644 --- a/DDRec/src/gear/createGearForILD.cpp +++ b/DDRec/src/gear/createGearForILD.cpp @@ -1,4 +1,4 @@ -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Factories.h" #include "DD4hep/DD4hepUnits.h" @@ -22,7 +22,7 @@ namespace dd4hep{ namespace rec{ - using namespace Geometry ; + using namespace detail ; // using namespace gear ; using DDSurfaces::Vector3D ; @@ -37,7 +37,7 @@ namespace dd4hep{ * @version $Id: $ */ - static long createGearForILD(LCDD& lcdd, int /*argc*/, char** /*argv*/) { + static long createGearForILD(Detector& description, int /*argc*/, char** /*argv*/) { std::cout << " **** running plugin createGearForILD ! " << std::endl ; @@ -46,13 +46,13 @@ namespace dd4hep{ // global parameters: double crossing_angle(0.) ; - try{ crossing_angle = lcdd.constant<double>("ILC_Main_Crossing_Angle") ; } catch(std::runtime_error&e) {std::cerr << " >>>> " << e.what() << std::endl ;} + try{ crossing_angle = description.constant<double>("ILC_Main_Crossing_Angle") ; } catch(std::runtime_error&e) {std::cerr << " >>>> " << e.what() << std::endl ;} //========= TPC ============================================================================== try{ - DetElement tpcDE = lcdd.detector("TPC") ; + DetElement tpcDE = description.detector("TPC") ; FixedPadSizeTPCData* tpc = tpcDE.extension<FixedPadSizeTPCData>() ; @@ -75,7 +75,7 @@ namespace dd4hep{ //========= VXD ============================================================================== try{ - DetElement vxdDE = lcdd.detector("VXD") ; + DetElement vxdDE = description.detector("VXD") ; ZPlanarData* vxd = vxdDE.extension<ZPlanarData>() ; @@ -86,9 +86,9 @@ namespace dd4hep{ for(unsigned i=0,n=vxd->layers.size() ; i<n; ++i){ - const DDRec::ZPlanarData::LayerLayout& l = vxd->layers[i] ; + const rec::ZPlanarData::LayerLayout& l = vxd->layers[i] ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... gearVXD->addLayer( l.ladderNumber, l.phi0, l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l.thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. , l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l.thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ; @@ -103,7 +103,7 @@ namespace dd4hep{ // -------- better: get right averaged material from first ladder: ------------------ MaterialManager matMgr ; - const DDRec::ZPlanarData::LayerLayout& l = vxd->layers[0] ; + const rec::ZPlanarData::LayerLayout& l = vxd->layers[0] ; Vector3D a( l.distanceSupport , l.phi0 , 0. , Vector3D::cylindrical ) ; Vector3D b( l.distanceSupport + l.thicknessSupport , l.phi0 , 0. , Vector3D::cylindrical ) ; @@ -132,7 +132,7 @@ namespace dd4hep{ try{ - DetElement sitDE = lcdd.detector("SIT") ; + DetElement sitDE = description.detector("SIT") ; ZPlanarData* sit = sitDE.extension<ZPlanarData>() ; @@ -144,9 +144,9 @@ namespace dd4hep{ for(unsigned i=0,n=sit->layers.size() ; i<n; ++i){ - const DDRec::ZPlanarData::LayerLayout& l = sit->layers[i] ; + const rec::ZPlanarData::LayerLayout& l = sit->layers[i] ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... gearSIT->addLayer( l.ladderNumber, l.phi0, l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l. thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. , l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l. thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ; @@ -173,7 +173,7 @@ namespace dd4hep{ try { - DetElement setDE = lcdd.detector("SET") ; + DetElement setDE = description.detector("SET") ; ZPlanarData* set = setDE.extension<ZPlanarData>() ; @@ -186,9 +186,9 @@ namespace dd4hep{ for(unsigned i=0,n=set->layers.size() ; i<n; ++i){ - const DDRec::ZPlanarData::LayerLayout& l = set->layers[i] ; + const rec::ZPlanarData::LayerLayout& l = set->layers[i] ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... gearSET->addLayer( l.ladderNumber, l.phi0, l.distanceSupport/dd4hep::mm, l.offsetSupport/dd4hep::mm, l. thicknessSupport/dd4hep::mm, l.zHalfSupport/dd4hep::mm, l.widthSupport/dd4hep::mm, 0. , l.distanceSensitive/dd4hep::mm, l.offsetSensitive/dd4hep::mm, l. thicknessSensitive/dd4hep::mm, l.zHalfSensitive/dd4hep::mm, l.widthSensitive/dd4hep::mm, 0. ) ; @@ -215,7 +215,7 @@ namespace dd4hep{ try { - DetElement ftdDE = lcdd.detector("FTD") ; + DetElement ftdDE = description.detector("FTD") ; ZDiskPetalsData* ftd = ftdDE.extension<ZDiskPetalsData>() ; @@ -223,15 +223,15 @@ namespace dd4hep{ for(unsigned i=0,n=ftd->layers.size() ; i<n; ++i){ - const DDRec::ZDiskPetalsData::LayerLayout& l = ftd->layers[i] ; + const rec::ZDiskPetalsData::LayerLayout& l = ftd->layers[i] ; - bool isDoubleSided = l.typeFlags[ DDRec::ZDiskPetalsStruct::SensorType::DoubleSided ] ; + bool isDoubleSided = l.typeFlags[ rec::ZDiskPetalsStruct::SensorType::DoubleSided ] ; // avoid 'undefined reference' at link time ( if built w/o optimization ): static const int PIXEL = gear::FTDParameters::PIXEL ; static const int STRIP = gear::FTDParameters::STRIP ; - int sensorType = ( l.typeFlags[ DDRec::ZDiskPetalsStruct::SensorType::Pixel ] ? PIXEL : STRIP ) ; + int sensorType = ( l.typeFlags[ rec::ZDiskPetalsStruct::SensorType::Pixel ] ? PIXEL : STRIP ) ; // gear::FTDParameters::PIXEL : gear::FTDParameters::STRIP ) ; double zoffset = fabs( l.zOffsetSupport ) ; @@ -251,7 +251,7 @@ namespace dd4hep{ 0. ) ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... } gearFTD->setDoubleVal("strip_width_mm" , ftd->widthStrip / dd4hep::mm ) ; @@ -270,7 +270,7 @@ namespace dd4hep{ try { - DetElement coilDE = lcdd.detector("Coil") ; + DetElement coilDE = description.detector("Coil") ; gear::GearParametersImpl* gearCOIL = new gear::GearParametersImpl(); @@ -290,7 +290,7 @@ namespace dd4hep{ try { - DetElement tubeDE = lcdd.detector("Tube") ; + DetElement tubeDE = description.detector("Tube") ; ConicalSupportData* tube = tubeDE.extension<ConicalSupportData>() ; @@ -312,7 +312,7 @@ namespace dd4hep{ rOuter[i] = s.rOuter/ dd4hep::mm ; zStart[i] = s.zPos / dd4hep::mm ; - // FIXME set rad lengths to 0 -> need to get from DD4hep .... + // FIXME set rad lengths to 0 -> need to get from dd4hep .... } gearTUBE->setDoubleVals("RInner" , rInner ) ; @@ -353,7 +353,7 @@ namespace dd4hep{ try { - DetElement caloDE = lcdd.detector( it->first ) ; + DetElement caloDE = description.detector( it->first ) ; LayeredCalorimeterData* calo = caloDE.extension<LayeredCalorimeterData>() ; @@ -368,7 +368,7 @@ namespace dd4hep{ LayeredCalorimeterData::Layer& l = calo->layers[i] ; - //Do some arithmetic to get thicknesses and (approximate) absorber thickneses from "new" DDRec structures + //Do some arithmetic to get thicknesses and (approximate) absorber thickneses from "new" rec structures //The positioning should come out right, but the absorber thickness should be overestimated due to the presence of //other less dense material if( i == 0 ) { @@ -401,7 +401,7 @@ namespace dd4hep{ try{ // additional parameters needed by BCalReco - SensitiveDetector sD = lcdd.sensitiveDetector( it->first ) ; + SensitiveDetector sD = description.sensitiveDetector( it->first ) ; Readout readOut = sD.readout() ; Segmentation seg = readOut.segmentation() ; @@ -449,7 +449,7 @@ namespace dd4hep{ //* test gear interface w/ LayeredExtensionImpl extension //********************************************************** - // DetElement calo2DE = lcdd.detector("EcalBarrel") ; + // DetElement calo2DE = description.detector("EcalBarrel") ; // Calorimeter calo2( calo2DE ) ; @@ -479,11 +479,11 @@ namespace dd4hep{ - // --- LCDD::apply() expects return code 1 if all went well ! ---- + // --- Detector::apply() expects return code 1 if all went well ! ---- return 1; } } } -DECLARE_APPLY( GearForILD, DD4hep::DDRec::createGearForILD ) +DECLARE_APPLY( GearForILD, dd4hep::rec::createGearForILD ) diff --git a/DDRec/src/plugins/createSurfaceManager.cpp b/DDRec/src/plugins/createSurfaceManager.cpp index 18bb0c156..ea4457c52 100644 --- a/DDRec/src/plugins/createSurfaceManager.cpp +++ b/DDRec/src/plugins/createSurfaceManager.cpp @@ -1,4 +1,4 @@ -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Factories.h" #include "DD4hep/Printout.h" @@ -7,7 +7,7 @@ namespace dd4hep{ namespace rec{ - using namespace Geometry ; + using namespace detail ; /** @@ -15,7 +15,7 @@ namespace dd4hep{ @{ \package SurfaceManager - * \brief Plugin that creates a SurfaceManager object and attaches it to lcdd as a user extension object. + * \brief Plugin that creates a SurfaceManager object and attaches it to description as a user extension object. * @} * @@ -25,19 +25,19 @@ namespace dd4hep{ */ - static long createSurfaceManager(LCDD& theDetector, int /*argc*/, char** /*argv*/) { + static long createSurfaceManager(Detector& description, int /*argc*/, char** /*argv*/) { printout(INFO,"InstallSurfaceManager","**** running plugin InstallSurfaceManager ! " ); - theDetector.addExtension<SurfaceManager>( new SurfaceManager(theDetector) ) ; + description.addExtension<SurfaceManager>( new SurfaceManager() ) ; - printout(INFO,"InstallSurfaceManager","%s" , theDetector.extension<SurfaceManager>()->toString().c_str() ); + printout(INFO,"InstallSurfaceManager","%s" , description.extension<SurfaceManager>()->toString().c_str() ); return 1; } } } -DECLARE_APPLY( InstallSurfaceManager, DD4hep::DDRec::createSurfaceManager ) +DECLARE_APPLY( InstallSurfaceManager, dd4hep::rec::createSurfaceManager ) diff --git a/DDSegmentation/CMakeLists.txt b/DDSegmentation/CMakeLists.txt index 1e51df50d..447490c72 100644 --- a/DDSegmentation/CMakeLists.txt +++ b/DDSegmentation/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) project(DDSegmentation) - #fg: version number must be the same as DD4hep !! + #fg: version number must be the same as dd4hep !! set(DDSegmentation_VERSION_MAJOR 0) set(DDSegmentation_VERSION_MINOR 24) set(DDSegmentation_VERSION_PATCH 0) diff --git a/DDSegmentation/cmake/DDSegmentationConfig.cmake.in b/DDSegmentation/cmake/DDSegmentationConfig.cmake.in index dfa7cbc8a..38756f07c 100644 --- a/DDSegmentation/cmake/DDSegmentationConfig.cmake.in +++ b/DDSegmentation/cmake/DDSegmentationConfig.cmake.in @@ -6,7 +6,7 @@ # DDSegmentation_FOUND : set to TRUE if DDSegmentation found # DDSegmentation_VERSION : package version # DDSegmentation_ROOT : path to this DDSegmentation installation -# DDSegmentation_LIBRARIES : list of DD4hep libraries +# DDSegmentation_LIBRARIES : list of dd4hep libraries # DDSegmentation_INCLUDE_DIRS : list of paths to be used with INCLUDE_DIRECTORIES # DDSegmentation_LIBRARY_DIR : list of paths to be used with LINK_DIRECTORIES # diff --git a/DDSegmentation/include/DDSegmentation/BitField64.h b/DDSegmentation/include/DDSegmentation/BitField64.h index 9cdaf24ee..60a170427 100644 --- a/DDSegmentation/include/DDSegmentation/BitField64.h +++ b/DDSegmentation/include/DDSegmentation/BitField64.h @@ -9,7 +9,7 @@ #include <sstream> -namespace DD4hep { +namespace dd4hep { //fixme: do need to do this also for 32 bit machines ? typedef long long int long64 ; diff --git a/DDSegmentation/include/DDSegmentation/CartesianGrid.h b/DDSegmentation/include/DDSegmentation/CartesianGrid.h index bef731766..3f054f8c3 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGrid.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGrid.h @@ -10,7 +10,7 @@ #include "DDSegmentation/Segmentation.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class CartesianGrid: public Segmentation { @@ -25,5 +25,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_CARTESIANGRID_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXY.h b/DDSegmentation/include/DDSegmentation/CartesianGridXY.h index b0b1d0ed1..da28508bc 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXY.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXY.h @@ -10,7 +10,7 @@ #include "DDSegmentation/CartesianGrid.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class CartesianGridXY: public CartesianGrid { @@ -101,5 +101,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_CARTESIANGRIDXY_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h index 99c3729a4..887306edc 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXYZ.h @@ -10,7 +10,7 @@ #include "DDSegmentation/CartesianGridXY.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class CartesianGridXYZ: public CartesianGridXY { @@ -72,5 +72,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_CARTESIANGRIDXYZ_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h index 98e575ccd..7181b7e50 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridXZ.h @@ -10,7 +10,7 @@ #include "DDSegmentation/CartesianGrid.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class CartesianGridXZ: public CartesianGrid { @@ -101,5 +101,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_CARTESIANGRIDXZ_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h b/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h index 08785d961..1cc12060c 100644 --- a/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h +++ b/DDSegmentation/include/DDSegmentation/CartesianGridYZ.h @@ -3,7 +3,7 @@ #include "DDSegmentation/CartesianGrid.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /** @@ -103,5 +103,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_CARTESIANGRIDXY_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/CylindricalSegmentation.h b/DDSegmentation/include/DDSegmentation/CylindricalSegmentation.h index 565dae3df..f5213b00a 100644 --- a/DDSegmentation/include/DDSegmentation/CylindricalSegmentation.h +++ b/DDSegmentation/include/DDSegmentation/CylindricalSegmentation.h @@ -12,7 +12,7 @@ #include <map> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class CylindricalSegmentation: public Segmentation { @@ -29,5 +29,5 @@ protected: } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_CYLINDRICALSEGMENTATION_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/GridPhiEta.h b/DDSegmentation/include/DDSegmentation/GridPhiEta.h index 53a60ac82..830dd9748 100644 --- a/DDSegmentation/include/DDSegmentation/GridPhiEta.h +++ b/DDSegmentation/include/DDSegmentation/GridPhiEta.h @@ -13,7 +13,7 @@ * @author Anna Zaborowska */ -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class GridPhiEta : public Segmentation { public: diff --git a/DDSegmentation/include/DDSegmentation/GridRPhiEta.h b/DDSegmentation/include/DDSegmentation/GridRPhiEta.h index 58dcb63f1..80257f5c4 100644 --- a/DDSegmentation/include/DDSegmentation/GridRPhiEta.h +++ b/DDSegmentation/include/DDSegmentation/GridRPhiEta.h @@ -13,7 +13,7 @@ * @author Anna Zaborowska */ -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class GridRPhiEta: public GridPhiEta { public: diff --git a/DDSegmentation/include/DDSegmentation/MegatileLayerGridXY.h b/DDSegmentation/include/DDSegmentation/MegatileLayerGridXY.h index b09871946..1c4da110a 100644 --- a/DDSegmentation/include/DDSegmentation/MegatileLayerGridXY.h +++ b/DDSegmentation/include/DDSegmentation/MegatileLayerGridXY.h @@ -31,7 +31,7 @@ */ -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class MegatileLayerGridXY: public CartesianGrid { @@ -147,5 +147,5 @@ namespace DD4hep { }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_MEGATILELAYERGRIDXY_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/MultiSegmentation.h b/DDSegmentation/include/DDSegmentation/MultiSegmentation.h index 8ac8bf874..b0393f132 100644 --- a/DDSegmentation/include/DDSegmentation/MultiSegmentation.h +++ b/DDSegmentation/include/DDSegmentation/MultiSegmentation.h @@ -1,6 +1,6 @@ // $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,7 +17,7 @@ #include "DDSegmentation/Segmentation.h" /// Main handle class to hold a TGeo alignment object of type TGeoPhysicalNode -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { @@ -94,6 +94,6 @@ namespace DD4hep { }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_MULITSEGMENTATION_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/NoSegmentation.h b/DDSegmentation/include/DDSegmentation/NoSegmentation.h index f9173f299..54e70a5ca 100644 --- a/DDSegmentation/include/DDSegmentation/NoSegmentation.h +++ b/DDSegmentation/include/DDSegmentation/NoSegmentation.h @@ -10,7 +10,7 @@ #include "DDSegmentation/Segmentation.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /** This class exists to provide a segmenation when it is need but doesn't exist. */ @@ -29,5 +29,5 @@ namespace DD4hep { } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_NoSegmentation */ diff --git a/DDSegmentation/include/DDSegmentation/PolarGrid.h b/DDSegmentation/include/DDSegmentation/PolarGrid.h index 5dde8535f..b1a587730 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGrid.h +++ b/DDSegmentation/include/DDSegmentation/PolarGrid.h @@ -10,7 +10,7 @@ #include "DDSegmentation/Segmentation.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class PolarGrid: public Segmentation { @@ -25,5 +25,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_POLARGRID_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h b/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h index a2110bf3f..089d3c322 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h +++ b/DDSegmentation/include/DDSegmentation/PolarGridRPhi.h @@ -11,7 +11,7 @@ #include "DDSegmentation/PolarGrid.h" #include <math.h> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class PolarGridRPhi: public PolarGrid { @@ -102,5 +102,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_POLARGRIDRPHI_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h b/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h index 5b69cad32..013f662eb 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h +++ b/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h @@ -12,7 +12,7 @@ #include <cmath> #include <vector> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { @@ -144,5 +144,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_PolarGridRPhi2_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h b/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h index b565fe9fb..5cc6cb32c 100644 --- a/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h +++ b/DDSegmentation/include/DDSegmentation/ProjectiveCylinder.h @@ -10,7 +10,7 @@ #include "CylindricalSegmentation.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class ProjectiveCylinder: public CylindricalSegmentation { @@ -101,5 +101,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* PROJECTIVECYLINDER_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/Segmentation.h b/DDSegmentation/include/DDSegmentation/Segmentation.h index 494201584..6743678c6 100644 --- a/DDSegmentation/include/DDSegmentation/Segmentation.h +++ b/DDSegmentation/include/DDSegmentation/Segmentation.h @@ -18,7 +18,7 @@ #include <string> #include <vector> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { typedef SegmentationParameter* Parameter; @@ -171,5 +171,5 @@ private: static const SegmentationCreator<classname> classname##_creator(#classname); } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_SEGMENTATION_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/SegmentationFactory.h b/DDSegmentation/include/DDSegmentation/SegmentationFactory.h index 8097c7e40..36100860a 100644 --- a/DDSegmentation/include/DDSegmentation/SegmentationFactory.h +++ b/DDSegmentation/include/DDSegmentation/SegmentationFactory.h @@ -16,7 +16,7 @@ #include <vector> #include <string> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// Forward declaration required because of circular dependency @@ -73,5 +73,5 @@ private: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_SEGMENTATIONFACTORY_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/SegmentationParameter.h b/DDSegmentation/include/DDSegmentation/SegmentationParameter.h index 325ef4543..d41802056 100644 --- a/DDSegmentation/include/DDSegmentation/SegmentationParameter.h +++ b/DDSegmentation/include/DDSegmentation/SegmentationParameter.h @@ -15,7 +15,7 @@ #include <typeinfo> #include <vector> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { @@ -284,5 +284,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_SEGMENTATIONPARAMETER_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/SegmentationUtil.h b/DDSegmentation/include/DDSegmentation/SegmentationUtil.h index 946503113..8785ef4ce 100644 --- a/DDSegmentation/include/DDSegmentation/SegmentationUtil.h +++ b/DDSegmentation/include/DDSegmentation/SegmentationUtil.h @@ -11,7 +11,7 @@ #include <cmath> #include <vector> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { namespace Util { @@ -115,6 +115,6 @@ inline Vector3D positionFromREtaPhi(double ar, double aeta, double aphi) { } /* namespace Util */ } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_SEGMENTATIONUTIL_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/TiledLayerGridXY.h b/DDSegmentation/include/DDSegmentation/TiledLayerGridXY.h index 2175a377f..67eb83bd3 100644 --- a/DDSegmentation/include/DDSegmentation/TiledLayerGridXY.h +++ b/DDSegmentation/include/DDSegmentation/TiledLayerGridXY.h @@ -14,7 +14,7 @@ #include <string> #include <vector> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class TiledLayerGridXY: public CartesianGrid { @@ -157,5 +157,5 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_TILEDLAYERGRIDXY_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h b/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h index 3027bd273..5de79d6a5 100644 --- a/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h +++ b/DDSegmentation/include/DDSegmentation/TiledLayerSegmentation.h @@ -14,7 +14,7 @@ #include <string> #include <vector> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class TiledLayerSegmentation: public Segmentation { @@ -113,6 +113,6 @@ protected: }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* TILEDLAYERSEGMENTATION_H_ */ diff --git a/DDSegmentation/include/DDSegmentation/WaferGridXY.h b/DDSegmentation/include/DDSegmentation/WaferGridXY.h index 68a7767ad..4387aaac4 100644 --- a/DDSegmentation/include/DDSegmentation/WaferGridXY.h +++ b/DDSegmentation/include/DDSegmentation/WaferGridXY.h @@ -13,7 +13,7 @@ #define MAX_GROUPS 100 #define MAX_WAFERS 100 -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class WaferGridXY: public CartesianGrid { @@ -130,5 +130,5 @@ namespace DD4hep { }; } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ #endif /* DDSegmentation_WAFERGRIDXY_H_ */ diff --git a/DDSegmentation/src/BitField64.cpp b/DDSegmentation/src/BitField64.cpp index 47e744dab..62686debf 100644 --- a/DDSegmentation/src/BitField64.cpp +++ b/DDSegmentation/src/BitField64.cpp @@ -4,7 +4,7 @@ #include <algorithm> #include <stdexcept> -namespace DD4hep{ +namespace dd4hep{ namespace DDSegmentation { diff --git a/DDSegmentation/src/CartesianGrid.cpp b/DDSegmentation/src/CartesianGrid.cpp index b213e7640..924eb7e06 100644 --- a/DDSegmentation/src/CartesianGrid.cpp +++ b/DDSegmentation/src/CartesianGrid.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/CartesianGrid.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// Default constructor used by derived classes passing the encoding string @@ -24,4 +24,4 @@ namespace DD4hep { } } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/CartesianGridXY.cpp b/DDSegmentation/src/CartesianGridXY.cpp index 876fc9934..d5ca8386c 100644 --- a/DDSegmentation/src/CartesianGridXY.cpp +++ b/DDSegmentation/src/CartesianGridXY.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/CartesianGridXY.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -79,4 +79,4 @@ std::vector<double> CartesianGridXY::cellDimensions(const CellID&) const { REGISTER_SEGMENTATION(CartesianGridXY) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/CartesianGridXYZ.cpp b/DDSegmentation/src/CartesianGridXYZ.cpp index d7b82bb01..11c7e873b 100644 --- a/DDSegmentation/src/CartesianGridXYZ.cpp +++ b/DDSegmentation/src/CartesianGridXYZ.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/CartesianGridXYZ.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -75,4 +75,4 @@ std::vector<double> CartesianGridXYZ::cellDimensions(const CellID&) const { REGISTER_SEGMENTATION(CartesianGridXYZ) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/CartesianGridXZ.cpp b/DDSegmentation/src/CartesianGridXZ.cpp index 6ed4359f5..e4ce6eed7 100644 --- a/DDSegmentation/src/CartesianGridXZ.cpp +++ b/DDSegmentation/src/CartesianGridXZ.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/CartesianGridXZ.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { using std::make_pair; @@ -82,4 +82,4 @@ std::vector<double> CartesianGridXZ::cellDimensions(const CellID&) const { REGISTER_SEGMENTATION(CartesianGridXZ) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/CartesianGridYZ.cpp b/DDSegmentation/src/CartesianGridYZ.cpp index d5075a01e..50b11384e 100644 --- a/DDSegmentation/src/CartesianGridYZ.cpp +++ b/DDSegmentation/src/CartesianGridYZ.cpp @@ -8,7 +8,7 @@ */ #include "DDSegmentation/CartesianGridYZ.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -80,4 +80,4 @@ std::vector<double> CartesianGridYZ::cellDimensions(const CellID&) const { REGISTER_SEGMENTATION(CartesianGridYZ) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/CylindricalSegmentation.cpp b/DDSegmentation/src/CylindricalSegmentation.cpp index b02374600..605e3b6c7 100644 --- a/DDSegmentation/src/CylindricalSegmentation.cpp +++ b/DDSegmentation/src/CylindricalSegmentation.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/CylindricalSegmentation.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -26,4 +26,4 @@ namespace DD4hep { } } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/GridPhiEta.cpp b/DDSegmentation/src/GridPhiEta.cpp index 741e7ed78..0a2b27a1d 100644 --- a/DDSegmentation/src/GridPhiEta.cpp +++ b/DDSegmentation/src/GridPhiEta.cpp @@ -1,7 +1,7 @@ #include "DDSegmentation/GridPhiEta.h" #include "DDSegmentation/SegmentationUtil.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { GridPhiEta::GridPhiEta(const std::string& cellEncoding) : diff --git a/DDSegmentation/src/GridRPhiEta.cpp b/DDSegmentation/src/GridRPhiEta.cpp index 31acecdad..78cc4b89a 100644 --- a/DDSegmentation/src/GridRPhiEta.cpp +++ b/DDSegmentation/src/GridRPhiEta.cpp @@ -1,7 +1,7 @@ #include "DDSegmentation/GridRPhiEta.h" #include "DDSegmentation/SegmentationUtil.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { GridRPhiEta::GridRPhiEta(const std::string& cellEncoding) : diff --git a/DDSegmentation/src/MegatileLayerGridXY.cpp b/DDSegmentation/src/MegatileLayerGridXY.cpp index b28124101..bf5fd18de 100644 --- a/DDSegmentation/src/MegatileLayerGridXY.cpp +++ b/DDSegmentation/src/MegatileLayerGridXY.cpp @@ -13,7 +13,7 @@ #include <cassert> #include <algorithm> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -180,4 +180,4 @@ namespace DD4hep { REGISTER_SEGMENTATION(MegatileLayerGridXY) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/MultiSegmentation.cpp b/DDSegmentation/src/MultiSegmentation.cpp index 8f2586522..adc75c2e4 100644 --- a/DDSegmentation/src/MultiSegmentation.cpp +++ b/DDSegmentation/src/MultiSegmentation.cpp @@ -11,7 +11,7 @@ using namespace std; -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -100,4 +100,4 @@ namespace DD4hep { REGISTER_SEGMENTATION(MultiSegmentation) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/NoSegmentation.cpp b/DDSegmentation/src/NoSegmentation.cpp index 9ac782df4..c627d36d5 100644 --- a/DDSegmentation/src/NoSegmentation.cpp +++ b/DDSegmentation/src/NoSegmentation.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/NoSegmentation.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { NoSegmentation::NoSegmentation(const std::string& cellEncoding) : @@ -39,4 +39,4 @@ namespace DD4hep { REGISTER_SEGMENTATION(NoSegmentation) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/PolarGrid.cpp b/DDSegmentation/src/PolarGrid.cpp index f39b9b535..99d01127c 100644 --- a/DDSegmentation/src/PolarGrid.cpp +++ b/DDSegmentation/src/PolarGrid.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/PolarGrid.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// Default constructor used by derived classes passing the encoding string @@ -23,4 +23,4 @@ namespace DD4hep { } } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/PolarGridRPhi.cpp b/DDSegmentation/src/PolarGridRPhi.cpp index 2a1f217c7..a0ea66a4e 100644 --- a/DDSegmentation/src/PolarGridRPhi.cpp +++ b/DDSegmentation/src/PolarGridRPhi.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/PolarGridRPhi.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -87,4 +87,4 @@ std::vector<double> PolarGridRPhi::cellDimensions(const CellID& cID) const { REGISTER_SEGMENTATION(PolarGridRPhi) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/PolarGridRPhi2.cpp b/DDSegmentation/src/PolarGridRPhi2.cpp index ab47c3097..003b4c725 100644 --- a/DDSegmentation/src/PolarGridRPhi2.cpp +++ b/DDSegmentation/src/PolarGridRPhi2.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/PolarGridRPhi2.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -107,4 +107,4 @@ std::vector<double> PolarGridRPhi2::cellDimensions(const CellID& cID) const { REGISTER_SEGMENTATION(PolarGridRPhi2) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/ProjectiveCylinder.cpp b/DDSegmentation/src/ProjectiveCylinder.cpp index 17dfde93e..6f483088b 100644 --- a/DDSegmentation/src/ProjectiveCylinder.cpp +++ b/DDSegmentation/src/ProjectiveCylinder.cpp @@ -11,7 +11,7 @@ #define _USE_MATH_DEFINES #include <cmath> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { using Util::thetaFromXYZ; @@ -97,4 +97,4 @@ double ProjectiveCylinder::phi(const CellID& cID) const { REGISTER_SEGMENTATION(ProjectiveCylinder) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/Segmentation.cpp b/DDSegmentation/src/Segmentation.cpp index 77b3086d2..cc15e929d 100644 --- a/DDSegmentation/src/Segmentation.cpp +++ b/DDSegmentation/src/Segmentation.cpp @@ -14,7 +14,7 @@ #include <algorithm> #include <iomanip> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { using std::cerr; @@ -201,4 +201,4 @@ namespace DD4hep { } } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/SegmentationFactory.cpp b/DDSegmentation/src/SegmentationFactory.cpp index 92091997f..163a6d83e 100644 --- a/DDSegmentation/src/SegmentationFactory.cpp +++ b/DDSegmentation/src/SegmentationFactory.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/SegmentationFactory.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { using std::map; @@ -55,4 +55,4 @@ void SegmentationFactory::registerSegmentation(const std::string& name, Segmenta } } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/TiledLayerGridXY.cpp b/DDSegmentation/src/TiledLayerGridXY.cpp index bd539e056..4367c6c30 100644 --- a/DDSegmentation/src/TiledLayerGridXY.cpp +++ b/DDSegmentation/src/TiledLayerGridXY.cpp @@ -13,7 +13,7 @@ #include <stdexcept> #include <cmath> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -23,7 +23,7 @@ TiledLayerGridXY::TiledLayerGridXY(const std::string& cellEncoding) : _type = "TiledLayerGridXY"; _description = "Cartesian segmentation in the local XY-plane using optimal tiling depending on the layer dimensions"; - std::cout << " ######### DD4hep::DDSegmentation::TiledLayerGridXY() " << std::endl ; + std::cout << " ######### dd4hep::DDSegmentation::TiledLayerGridXY() " << std::endl ; // register all necessary parameters registerParameter("grid_size_x", "Cell size in X", _gridSizeX, 1., SegmentationParameter::LengthUnit); @@ -45,7 +45,7 @@ TiledLayerGridXY::TiledLayerGridXY(BitField64* decode) : CartesianGrid(decode) { _type = "TiledLayerGridXY"; _description = "Cartesian segmentation in the local XY-plane using optimal tiling depending on the layer dimensions"; - std::cout << " ######### DD4hep::DDSegmentation::TiledLayerGridXY() " << std::endl ; + std::cout << " ######### dd4hep::DDSegmentation::TiledLayerGridXY() " << std::endl ; // register all necessary parameters registerParameter("grid_size_x", "Cell size in X", _gridSizeX, 1., SegmentationParameter::LengthUnit); @@ -125,4 +125,4 @@ std::vector<double> TiledLayerGridXY::cellDimensions(const CellID&) const { REGISTER_SEGMENTATION(TiledLayerGridXY) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/TiledLayerSegmentation.cpp b/DDSegmentation/src/TiledLayerSegmentation.cpp index d330fb52b..4956e68bf 100644 --- a/DDSegmentation/src/TiledLayerSegmentation.cpp +++ b/DDSegmentation/src/TiledLayerSegmentation.cpp @@ -12,7 +12,7 @@ #include <sstream> #include <stdexcept> -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { using std::find; @@ -155,4 +155,4 @@ double TiledLayerSegmentation::calculateOffset(double /* cellSize */, double /* } } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSegmentation/src/WaferGridXY.cpp b/DDSegmentation/src/WaferGridXY.cpp index c381e170d..198095605 100644 --- a/DDSegmentation/src/WaferGridXY.cpp +++ b/DDSegmentation/src/WaferGridXY.cpp @@ -7,7 +7,7 @@ #include "DDSegmentation/WaferGridXY.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string @@ -129,4 +129,4 @@ std::vector<double> WaferGridXY::cellDimensions(const CellID&) const { REGISTER_SEGMENTATION(WaferGridXY) } /* namespace DDSegmentation */ -} /* namespace DD4hep */ +} /* namespace dd4hep */ diff --git a/DDSurfaces/CMakeLists.txt b/DDSurfaces/CMakeLists.txt index a29c5cc60..ca2004216 100644 --- a/DDSurfaces/CMakeLists.txt +++ b/DDSurfaces/CMakeLists.txt @@ -1,6 +1,6 @@ # $Id: $ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt index 0d8483f71..9f1645402 100644 --- a/DDTest/CMakeLists.txt +++ b/DDTest/CMakeLists.txt @@ -1,7 +1,5 @@ #================================================================================= -# $Id: $ -# -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #--------------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/DDTest/README b/DDTest/README index b74fb3c3d..8bda615c6 100644 --- a/DDTest/README +++ b/DDTest/README @@ -1,6 +1,6 @@ ####################################################################### # -# DDTest - (unit) tests for DD4hep +# DDTest - (unit) tests for dd4hep # # F.Gaede, DESY, 2014 ####################################################################### diff --git a/DDTest/elements.xml b/DDTest/elements.xml index a5f2a20df..857b19cc4 100644 --- a/DDTest/elements.xml +++ b/DDTest/elements.xml @@ -3,7 +3,7 @@ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++ Linear collider detector description in C++ ++++ - ++++ DD4hep Detector description generator. ++++ + ++++ dd4hep Detector description generator. ++++ ++++ ++++ ++++ Parser: TinyXML DOM mini-parser ++++ ++++ ++++ diff --git a/DDTest/include/DD4hep/DDTest.h b/DDTest/include/DD4hep/DDTest.h index bff921f0e..c30711b90 100644 --- a/DDTest/include/DD4hep/DDTest.h +++ b/DDTest/include/DD4hep/DDTest.h @@ -2,7 +2,7 @@ #include <sstream> #include <stdlib.h> -namespace DD4hep{ +namespace dd4hep{ /** Simple class for defining unit tests. * Use in main program that is added as a test to ctest: diff --git a/DDTest/src/STR.h b/DDTest/src/STR.h index 60abf168b..ca6390df4 100644 --- a/DDTest/src/STR.h +++ b/DDTest/src/STR.h @@ -1,4 +1,4 @@ -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/DDTest/src/test_DetType.cc b/DDTest/src/test_DetType.cc index cb6bbeea2..e9a6815b2 100644 --- a/DDTest/src/test_DetType.cc +++ b/DDTest/src/test_DetType.cc @@ -8,7 +8,7 @@ using namespace std ; -using namespace DD4hep ; +using namespace dd4hep ; // this should be the first line in your test static DDTest test( "bitfield64" ) ; diff --git a/DDTest/src/test_EventReaders.cc b/DDTest/src/test_EventReaders.cc index 2dc456299..5efe6effb 100644 --- a/DDTest/src/test_EventReaders.cc +++ b/DDTest/src/test_EventReaders.cc @@ -12,11 +12,11 @@ #include "DDG4/Geant4Particle.h" #include "DDG4/Geant4Vertex.h" -//using namespace DD4hep::Simulation; -typedef DD4hep::Simulation::Geant4Vertex Vertex; -typedef DD4hep::Simulation::Geant4Particle Particle; +//using namespace dd4hep::sim; +typedef dd4hep::sim::Geant4Vertex Vertex; +typedef dd4hep::sim::Geant4Particle Particle; -static DD4hep::DDTest test( "EventReader" ) ; +static dd4hep::DDTest test( "EventReader" ) ; class TestTuple { public: @@ -50,7 +50,7 @@ int main(int argc, char** argv ){ bool skipEOF = (*it).skipEOF; //InputFiles are in DDTest/inputFiles, argument is cmake_source directory std::string inputFile = argv[1]+ std::string("/inputFiles/") + fileName; - DD4hep::Simulation::Geant4EventReader* thisReader = DD4hep::PluginService::Create<DD4hep::Simulation::Geant4EventReader*>(readerType, inputFile); + dd4hep::sim::Geant4EventReader* thisReader = dd4hep::PluginService::Create<dd4hep::sim::Geant4EventReader*>(readerType, inputFile); if ( not thisReader ) { test.log( "Plugin not found" ); test.log( readerType ); @@ -62,16 +62,16 @@ int main(int argc, char** argv ){ std::vector<Particle*> particles; std::vector<Vertex*> vertices ; - DD4hep::Simulation::Geant4EventReader::EventReaderStatus sc = thisReader->readParticles(3,vertices,particles); - std::for_each(particles.begin(),particles.end(),DD4hep::deleteObject<Particle>); - test( thisReader->currentEventNumber() == 2 && sc == DD4hep::Simulation::Geant4EventReader::EVENT_READER_OK, + dd4hep::sim::Geant4EventReader::EventReaderStatus sc = thisReader->readParticles(3,vertices,particles); + std::for_each(particles.begin(),particles.end(),dd4hep::detail::deleteObject<Particle>); + test( thisReader->currentEventNumber() == 2 && sc == dd4hep::sim::Geant4EventReader::EVENT_READER_OK, readerType + std::string("Event Number Read") ); //Reset Reader to check what happens if moving to far in the file if (not skipEOF) { - thisReader = DD4hep::PluginService::Create<DD4hep::Simulation::Geant4EventReader*>(readerType, inputFile); + thisReader = dd4hep::PluginService::Create<dd4hep::sim::Geant4EventReader*>(readerType, inputFile); sc = thisReader->moveToEvent(1000000); - test( sc != DD4hep::Simulation::Geant4EventReader::EVENT_READER_OK , readerType + std::string("EventReader False") ); + test( sc != dd4hep::sim::Geant4EventReader::EVENT_READER_OK , readerType + std::string("EventReader False") ); } } diff --git a/DDTest/src/test_PolarGridRPhi2.cc b/DDTest/src/test_PolarGridRPhi2.cc index 3a3951b7b..37f61a402 100644 --- a/DDTest/src/test_PolarGridRPhi2.cc +++ b/DDTest/src/test_PolarGridRPhi2.cc @@ -8,7 +8,7 @@ #include <exception> -static DD4hep::DDTest test( "PolarGridRPhi2" ) ; +static dd4hep::DDTest test( "PolarGridRPhi2" ) ; class TestTuple { public: @@ -22,7 +22,7 @@ public: int main() { try{ - DD4hep::DDSegmentation::PolarGridRPhi2 seg("system:8,layer:8,barrel:3,layer:8,slice:5,r:16,phi:16"); + dd4hep::DDSegmentation::PolarGridRPhi2 seg("system:8,layer:8,barrel:3,layer:8,slice:5,r:16,phi:16"); const int rBitOffset = 32; //sum of all the others before const int phiBitOffset = 16+32; //sum of all the others before @@ -97,7 +97,7 @@ int main() { tests.push_back( TestTuple( 160.0, -179*DegToRad, 14, 0 ) ); - DD4hep::DDSegmentation::VolumeID volID = 0; + dd4hep::DDSegmentation::VolumeID volID = 0; //Test from position to cellID for(std::vector<TestTuple>::const_iterator it = tests.begin(); it != tests.end(); ++it) { @@ -107,10 +107,10 @@ int main() { const long long rB = (*it)._rB; const long long pB = (*it)._pB; - DD4hep::DDSegmentation::Vector3D locPos ( r*cos(phi), r*sin(phi), 0.0); - DD4hep::DDSegmentation::Vector3D globPos( r*cos(phi), r*sin(phi), 0.0); + dd4hep::DDSegmentation::Vector3D locPos ( r*cos(phi), r*sin(phi), 0.0); + dd4hep::DDSegmentation::Vector3D globPos( r*cos(phi), r*sin(phi), 0.0); - DD4hep::DDSegmentation::CellID cid = seg.cellID(locPos, globPos, volID); + dd4hep::DDSegmentation::CellID cid = seg.cellID(locPos, globPos, volID); const long long phiShifted(pB << phiBitOffset); const long long rShifted (rB << rBitOffset); @@ -167,11 +167,11 @@ int main() { (*seg.decoder())["r"] = rB; (*seg.decoder())["phi"] = pB; - DD4hep::DDSegmentation::CellID cellID = (*seg.decoder()).getValue(); + dd4hep::DDSegmentation::CellID cellID = (*seg.decoder()).getValue(); std::cout << "CellID: " << cellID << std::endl; - DD4hep::DDSegmentation::Vector3D expectedPosition( r*cos(phi), r*sin(phi), 0.0); - DD4hep::DDSegmentation::Vector3D calculatedPosition = seg.position(cellID); + dd4hep::DDSegmentation::Vector3D expectedPosition( r*cos(phi), r*sin(phi), 0.0); + dd4hep::DDSegmentation::Vector3D calculatedPosition = seg.position(cellID); test( fabs(expectedPosition.x() - calculatedPosition.x()) < 1e-11, " Test get Position from ID: X" ); test( fabs(expectedPosition.y() - calculatedPosition.y()) < 1e-11, " Test get Position from ID: Y" ); diff --git a/DDTest/src/test_bitfield64.cc b/DDTest/src/test_bitfield64.cc index ab4f82b2a..8e39e6072 100644 --- a/DDTest/src/test_bitfield64.cc +++ b/DDTest/src/test_bitfield64.cc @@ -8,7 +8,7 @@ using namespace std ; -using namespace DD4hep ; +using namespace dd4hep ; using namespace DDSegmentation ; // this should be the first line in your test diff --git a/DDTest/src/test_cellDimensions.cc b/DDTest/src/test_cellDimensions.cc index a55b98aea..d678ed8f1 100644 --- a/DDTest/src/test_cellDimensions.cc +++ b/DDTest/src/test_cellDimensions.cc @@ -13,13 +13,13 @@ #include <cmath> -static DD4hep::DDTest test( "CellDimensions" ) ; +static dd4hep::DDTest test( "CellDimensions" ) ; int main() { try{ - DD4hep::DDSegmentation::CartesianGridXY seg("system:8,barrel:3,layer:8,slice:5,x:16,y:16"); + dd4hep::DDSegmentation::CartesianGridXY seg("system:8,barrel:3,layer:8,slice:5,x:16,y:16"); const double xSize=12343.43243; const double ySize=M_PI; @@ -27,7 +27,7 @@ int main() { seg.setGridSizeX(xSize); seg.setGridSizeY(ySize); - DD4hep::DDSegmentation::VolumeID volID = 0; + dd4hep::DDSegmentation::VolumeID volID = 0; test( fabs(seg.cellDimensions(volID)[0] - xSize ) < 1e-11, " CG_XY: Dimension for X" ); test( fabs(seg.cellDimensions(volID)[1] - ySize ) < 1e-11, " CG_XY: Dimension for Y" ); @@ -41,7 +41,7 @@ int main() { try{ - DD4hep::DDSegmentation::CartesianGridXZ seg("system:8,barrel:3,layer:8,slice:5,x:16,z:16"); + dd4hep::DDSegmentation::CartesianGridXZ seg("system:8,barrel:3,layer:8,slice:5,x:16,z:16"); const double xSize=12343.43243; const double zSize=M_PI; @@ -49,7 +49,7 @@ int main() { seg.setGridSizeX(xSize); seg.setGridSizeZ(zSize); - DD4hep::DDSegmentation::VolumeID volID = 0; + dd4hep::DDSegmentation::VolumeID volID = 0; test( fabs(seg.cellDimensions(volID)[0] - xSize ) < 1e-11, " CG_XZ: Dimension for X" ); test( fabs(seg.cellDimensions(volID)[1] - zSize ) < 1e-11, " CG_XZ: Dimension for Z" ); @@ -63,7 +63,7 @@ int main() { try{ - DD4hep::DDSegmentation::CartesianGridYZ seg("system:8,barrel:3,layer:8,slice:5,y:16,z:16"); + dd4hep::DDSegmentation::CartesianGridYZ seg("system:8,barrel:3,layer:8,slice:5,y:16,z:16"); const double ySize=12343.43243; const double zSize=M_PI; @@ -71,7 +71,7 @@ int main() { seg.setGridSizeY(ySize); seg.setGridSizeZ(zSize); - DD4hep::DDSegmentation::VolumeID volID = 0; + dd4hep::DDSegmentation::VolumeID volID = 0; test( fabs(seg.cellDimensions(volID)[0] - ySize ) < 1e-11, " CG_YZ: Dimension for Y" ); test( fabs(seg.cellDimensions(volID)[1] - zSize ) < 1e-11, " CG_YZ: Dimension for Z" ); @@ -85,7 +85,7 @@ int main() { try{ - DD4hep::DDSegmentation::CartesianGridXYZ seg("system:8,barrel:3,layer:8,slice:7,x:10,y:10,z:10"); + dd4hep::DDSegmentation::CartesianGridXYZ seg("system:8,barrel:3,layer:8,slice:7,x:10,y:10,z:10"); const double xSize=42.24; const double ySize=12343.43243; @@ -95,7 +95,7 @@ int main() { seg.setGridSizeY(ySize); seg.setGridSizeZ(zSize); - DD4hep::DDSegmentation::VolumeID volID = 0; + dd4hep::DDSegmentation::VolumeID volID = 0; test( fabs(seg.cellDimensions(volID)[0] - xSize ) < 1e-11, " CG_XYZ: Dimension for X" ); test( fabs(seg.cellDimensions(volID)[1] - ySize ) < 1e-11, " CG_XYZ: Dimension for Y" ); diff --git a/DDTest/src/test_cellDimensionsRPhi2.cc b/DDTest/src/test_cellDimensionsRPhi2.cc index cb50c2a2a..5fdfe0574 100644 --- a/DDTest/src/test_cellDimensionsRPhi2.cc +++ b/DDTest/src/test_cellDimensionsRPhi2.cc @@ -10,10 +10,10 @@ #include <exception> #include <cmath> -static DD4hep::DDTest test( "CellDimensions" ) ; +static dd4hep::DDTest test( "CellDimensions" ) ; -using DD4hep::DDSegmentation::Segmentation; -using DD4hep::DDSegmentation::CellID; +using dd4hep::DDSegmentation::Segmentation; +using dd4hep::DDSegmentation::CellID; Segmentation* createPolarGridRPhi2(); Segmentation* createPolarGridRPhi(double rSize, double phiSize); @@ -41,7 +41,7 @@ int main() { Segmentation* createPolarGridRPhi(double rSize, double phiSize) { - DD4hep::DDSegmentation::PolarGridRPhi* seg = new DD4hep::DDSegmentation::PolarGridRPhi("system:8,barrel:3,layer:8,slice:13,r:16,phi:16"); + dd4hep::DDSegmentation::PolarGridRPhi* seg = new dd4hep::DDSegmentation::PolarGridRPhi("system:8,barrel:3,layer:8,slice:13,r:16,phi:16"); seg->setGridSizeR(rSize); seg->setGridSizePhi(phiSize); @@ -51,7 +51,7 @@ Segmentation* createPolarGridRPhi(double rSize, double phiSize) { Segmentation* createPolarGridRPhi2() { - DD4hep::DDSegmentation::PolarGridRPhi2* seg = new DD4hep::DDSegmentation::PolarGridRPhi2("system:8,barrel:3,layer:8,slice:13,r:16,phi:16"); + dd4hep::DDSegmentation::PolarGridRPhi2* seg = new dd4hep::DDSegmentation::PolarGridRPhi2("system:8,barrel:3,layer:8,slice:13,r:16,phi:16"); std::vector<double> rValues, phiValues; @@ -99,7 +99,7 @@ Segmentation* createPolarGridRPhi2() { return seg; } -CellID getCellID(DD4hep::DDSegmentation::Segmentation* seg, long long rB, long long pB){ +CellID getCellID(dd4hep::DDSegmentation::Segmentation* seg, long long rB, long long pB){ (*seg->decoder())["r"] = rB; (*seg->decoder())["phi"] = pB; return (*seg->decoder()).getValue(); @@ -108,7 +108,7 @@ CellID getCellID(DD4hep::DDSegmentation::Segmentation* seg, long long rB, long l void testRPhi2(){ std::vector<TestTuple> tests; - DD4hep::DDSegmentation::Segmentation* seg = createPolarGridRPhi2(); + dd4hep::DDSegmentation::Segmentation* seg = createPolarGridRPhi2(); const double DegToRad = M_PI/180.0; tests.push_back( TestTuple( seg, 20.0, 20*10*DegToRad, 0, 1 ) ); tests.push_back( TestTuple( seg, 5.0, 32.5*20*DegToRad, 1, 1 ) ); @@ -139,7 +139,7 @@ void testRPhi(){ const double rSizeGrid = 10.0; const double phiSizeGrid = M_PI/36; - DD4hep::DDSegmentation::Segmentation* seg = createPolarGridRPhi(rSizeGrid, phiSizeGrid); + dd4hep::DDSegmentation::Segmentation* seg = createPolarGridRPhi(rSizeGrid, phiSizeGrid); tests.push_back( TestTuple( seg, rSizeGrid, rSizeGrid*(0) *phiSizeGrid, 0, 1 ) ); tests.push_back( TestTuple( seg, rSizeGrid, rSizeGrid*(1) *phiSizeGrid, 1, 1 ) ); diff --git a/DDTest/src/test_example.cc b/DDTest/src/test_example.cc index bc9910445..16d5e7037 100644 --- a/DDTest/src/test_example.cc +++ b/DDTest/src/test_example.cc @@ -5,7 +5,7 @@ #include <cmath> using namespace std ; -using namespace DD4hep ; +using namespace dd4hep ; // this should be the first line in your test static DDTest test( "example" ) ; diff --git a/DDTest/src/test_segmentationHandles.cc b/DDTest/src/test_segmentationHandles.cc index b1d7a2c50..b8045ffae 100644 --- a/DDTest/src/test_segmentationHandles.cc +++ b/DDTest/src/test_segmentationHandles.cc @@ -13,9 +13,9 @@ #include <cmath> -static DD4hep::DDTest test( "CellDimensions" ) ; -using namespace DD4hep; -using namespace DD4hep::Geometry; +static dd4hep::DDTest test( "CellDimensions" ) ; +using namespace dd4hep; +using namespace dd4hep::detail; int main() { try{ @@ -30,7 +30,7 @@ int main() { seg.setGridSizeX(xSize); seg.setGridSizeY(ySize); - DD4hep::DDSegmentation::VolumeID volID = 0; + dd4hep::DDSegmentation::VolumeID volID = 0; test( fabs(seg.cellDimensions(volID)[0] - xSize ) < 1e-11, " CG_XY: Dimension for X" ); test( fabs(seg.cellDimensions(volID)[1] - ySize ) < 1e-11, " CG_XY: Dimension for Y" ); @@ -76,7 +76,7 @@ int main() { seg.setGridSizeY(ySize); seg.setGridSizeZ(zSize); - DD4hep::DDSegmentation::VolumeID volID = 0; + dd4hep::DDSegmentation::VolumeID volID = 0; test( fabs(seg.cellDimensions(volID)[0] - ySize ) < 1e-11, " CG_YZ: Dimension for Y" ); test( fabs(seg.cellDimensions(volID)[1] - zSize ) < 1e-11, " CG_YZ: Dimension for Z" ); @@ -101,7 +101,7 @@ int main() { seg.setGridSizeY(ySize); seg.setGridSizeZ(zSize); - DD4hep::DDSegmentation::VolumeID volID = 0; + dd4hep::DDSegmentation::VolumeID volID = 0; test( fabs(seg.cellDimensions(volID)[0] - xSize ) < 1e-11, " CG_XYZ: Dimension for X" ); test( fabs(seg.cellDimensions(volID)[1] - ySize ) < 1e-11, " CG_XYZ: Dimension for Y" ); diff --git a/DDTest/src/test_surface.cc b/DDTest/src/test_surface.cc index e89482e2f..77793af57 100644 --- a/DDTest/src/test_surface.cc +++ b/DDTest/src/test_surface.cc @@ -1,9 +1,9 @@ #include "DD4hep/DDTest.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DD4hepUnits.h" #include "DD4hep/Volumes.h" -#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DDRec/Surface.h" #include "STR.h" @@ -16,7 +16,7 @@ using namespace std ; using namespace dd4hep ; using namespace dd4hep::rec ; - +using namespace detail; // this should be the first line in your test static DDTest test( "surface" ) ; @@ -35,16 +35,16 @@ int main(int argc, char** argv ){ // ----- write your tests in here ------------------------------------- - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - lcdd.fromCompact( argv[1] ); + description.fromCompact( argv[1] ); // --- test a planar surface double thick = 0.005 ; double width = 1.0 ; double length = 10.0 ; - Material mat = lcdd.material( "Silicon" ); + Material mat = description.material( "Silicon" ); Box box ( thick/2., width/2., length/2. ); Volume vol ( "test_box", box, mat); @@ -150,7 +150,7 @@ int main(int argc, char** argv ){ length = 100.0 ; double radius = 42.0 ; - mat = lcdd.material( "Air" ); + mat = description.material( "Air" ); Tube tube ( radius - thick/2., radius + thick/2. , length/2. ); vol = Volume( "test_tube", tube , mat); diff --git a/DDTest/src/test_units.cc b/DDTest/src/test_units.cc index 9af5e4663..cd460a668 100644 --- a/DDTest/src/test_units.cc +++ b/DDTest/src/test_units.cc @@ -1,6 +1,6 @@ #include "DD4hep/DDTest.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DD4hepUnits.h" #include "STR.h" @@ -10,8 +10,8 @@ #include <cmath> using namespace std ; -using namespace DD4hep ; -using namespace Geometry; +using namespace dd4hep ; +using namespace detail; using namespace dd4hep ; // this should be the first line in your test @@ -33,19 +33,19 @@ int main(int argc, char** argv ){ // ----- write your tests in here ------------------------------------- - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - lcdd.fromCompact( argv[1] ); + description.fromCompact( argv[1] ); // ======= deg and rad: - double al0_rad = lcdd.constant<double>( "alpha_half_arc_deg" ) / rad ; - double al1_rad = lcdd.constant<double>( "alpha_half_arc_rad" ) / rad ; + double al0_rad = description.constant<double>( "alpha_half_arc_deg" ) / rad ; + double al1_rad = description.constant<double>( "alpha_half_arc_rad" ) / rad ; test( STR(al0_rad), STR(al1_rad) , " alpha_half_arc in rad " ) ; - double al0_deg = lcdd.constant<double>( "alpha_half_arc_deg" ) / deg ; - double al1_deg = lcdd.constant<double>( "alpha_half_arc_rad" ) / deg ; + double al0_deg = description.constant<double>( "alpha_half_arc_deg" ) / deg ; + double al1_deg = description.constant<double>( "alpha_half_arc_rad" ) / deg ; test( STR( al0_deg ) , STR( 180. ) , " alpha_half_arc_deg in deg is 180." ) ; test( STR( al1_deg ) , STR( 180. ) , " alpha_half_arc_rad in deg is 180." ) ; @@ -55,13 +55,13 @@ int main(int argc, char** argv ){ //======== densities ========= - double rho1 = lcdd.constant<double>( "rho1" ) / g * cm3 ; - double rho2 = lcdd.constant<double>( "rho2" ) / g * cm3 ; + double rho1 = description.constant<double>( "rho1" ) / g * cm3 ; + double rho2 = description.constant<double>( "rho2" ) / g * cm3 ; test( STR(rho1), STR(rho2) , " densities in [g/cm3] " ) ; - rho1 = lcdd.constant<double>( "rho1" ) / kg * m3 ; - rho2 = lcdd.constant<double>( "rho2" ) / kg * m3 ; + rho1 = description.constant<double>( "rho1" ) / kg * m3 ; + rho2 = description.constant<double>( "rho2" ) / kg * m3 ; test( STR(rho1), STR(rho2) , " densities in [kg/cm3] " ) ; diff --git a/GaudiPluginService/Gaudi/Details/PluginServiceDetails.h b/GaudiPluginService/Gaudi/Details/PluginServiceDetails.h index 67b6d0026..fbcd7e37a 100644 --- a/GaudiPluginService/Gaudi/Details/PluginServiceDetails.h +++ b/GaudiPluginService/Gaudi/Details/PluginServiceDetails.h @@ -193,7 +193,7 @@ namespace Gaudi { namespace PluginService { /// Flag recording if the registry has been initialized or not. bool m_initialized; - /// Internal storage for factories. + /// detaill storage for factories. FactoryMap m_factories; #if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L diff --git a/GaudiPluginService/interface/DD4hep.cpp b/GaudiPluginService/interface/DD4hep.cpp index f5f3480d7..f114463e5 100644 --- a/GaudiPluginService/interface/DD4hep.cpp +++ b/GaudiPluginService/interface/DD4hep.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/README.md b/README.md index 4f0112b84..5d4206c90 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# DD4hep (Detector Description for High Energy Physics) +# dd4hep (Detector Description for High Energy Physics) [](https://travis-ci.org/AIDASoft/DD4hep) -[](https://scan.coverity.com/projects/dd4hep) +[](https://scan.coverity.com/projects/DD4hep) [](https://zenodo.org/badge/latestdoi/60682190) -DD4hep is a software framework for providing a complete solution for full detector description +dd4hep is a software framework for providing a complete solution for full detector description (geometry, materials, visualization, readout, alignment, calibration, etc.) for the full experiment life cycle (detector concept development, detector optimization, construction, operation). It offers a consistent description through a single source of detector information for simulation, reconstruction, analysis, etc. It distributed under the [GPLv3 License](http://www.gnu.org/licenses/gpl-3.0.en.html) [](https://www.gnu.org/licenses/gpl-3.0.en.html) ## Package Contents ------------------- -The DD4hep project consists of several packages. The idea has been to separate the common parts of the detector description toolkit from concrete detector examples. +The dd4hep project consists of several packages. The idea has been to separate the common parts of the detector description toolkit from concrete detector examples. - **DDCore** @@ -22,7 +22,7 @@ The DD4hep project consists of several packages. The idea has been to separate t - **DDG4** - Is the package that contains the conversion of DD4hep geometry into Geant4 geometry to be used for simulation. The conversion is currently based on the Virtual Geometry Modeler (VGM) package that is build internally when required. The option DD4HEP_USE_GEANT4:BOOL controls the building or not of this package that has the dependency to Geant4. The Geant4 installation needs to be located using the variable `-DGeant4_DIR=<path to Geant4Config.cmake>` + Is the package that contains the conversion of dd4hep geometry into Geant4 geometry to be used for simulation. The conversion is currently based on the Virtual Geometry Modeler (VGM) package that is build internally when required. The option DD4HEP_USE_GEANT4:BOOL controls the building or not of this package that has the dependency to Geant4. The Geant4 installation needs to be located using the variable `-DGeant4_DIR=<path to Geant4Config.cmake>` - **examples** @@ -34,7 +34,7 @@ and ‘src’ contain the equivalent drivers for the XercesC parser. ## Pre-requisites - DD4hep depends on a number of ‘external’ packages. The user will need to install these in his/her + dd4hep depends on a number of ‘external’ packages. The user will need to install these in his/her system before building and running the examples - **Mandatory** @@ -45,7 +45,7 @@ system before building and running the examples If the XercesC is used to parse compact descriptions and installation of XercesC will be required. To build and run the simulation examples Geant4 will be required. There is also an available interface to LCIO -## How to build DD4hep +## How to build dd4hep ### Checkout code `git clone git@github.com:AIDASoft/DD4hep.git` @@ -57,7 +57,7 @@ and ### Configure and build - `cd DD4hep` + `cd dd4hep` `mkdir build; cd build` @@ -99,7 +99,7 @@ or ## Testing - DD4hep has a testing mechanism built on CMake/CTest. If configured with `-DBUILD_TESTING=ON`, some make targets are + dd4hep has a testing mechanism built on CMake/CTest. If configured with `-DBUILD_TESTING=ON`, some make targets are created automatically. - running the tests: @@ -112,7 +112,7 @@ or - running the build - For each pull request all tests are run through **Travis CI** on SLC6 with GCC 6.2. DD4hep also tested against GCC 6.2 and LLVM 3.9 on SLC6 and CC7 as well as clang 8.0 on macOS Sierra. Build results can be observed [here](https://travis-ci.org/AIDASoft/DD4hep) and the status is indicated by the badge [](https://travis-ci.org/AIDASoft/DD4hep) + For each pull request all tests are run through **Travis CI** on SLC6 with GCC 6.2. dd4hep also tested against GCC 6.2 and LLVM 3.9 on SLC6 and CC7 as well as clang 8.0 on macOS Sierra. Build results can be observed [here](https://travis-ci.org/AIDASoft/DD4hep) and the status is indicated by the badge [](https://travis-ci.org/AIDASoft/DD4hep) - running individual tests with output (e.g. in case of failed tests): diff --git a/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt index 16f652599..b58dbe9c5 100644 --- a/UtilityApps/CMakeLists.txt +++ b/UtilityApps/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -29,7 +29,7 @@ dd4hep_add_executable( graphicalMaterialScan src/graphicalMaterialScan.cpp USES #----------------------------------------------------------------------------------- #dd4hep_add_executable( pydd4hep # USES [ROOT REQUIRED COMPONENTS PyROOT] -# OPTIONAL [PYTHON REQUIRED SOURCES src/dd4hep_python.cpp]) +# OPTIONAL [PYTHON REQUIRED SOURCES src/DD4hep_python.cpp]) #----------------------------------------------------------------------------------- dd4hep_add_executable( dumpdetector USES DDRec diff --git a/UtilityApps/src/EvNavHandler.h b/UtilityApps/src/EvNavHandler.h index b54b38291..7ea01865b 100644 --- a/UtilityApps/src/EvNavHandler.h +++ b/UtilityApps/src/EvNavHandler.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/UtilityApps/src/LinkDef.h b/UtilityApps/src/LinkDef.h index 1b4825845..862649a2a 100644 --- a/UtilityApps/src/LinkDef.h +++ b/UtilityApps/src/LinkDef.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/UtilityApps/src/MultiView.h b/UtilityApps/src/MultiView.h index 2ea61d13c..5b5fe1ce8 100644 --- a/UtilityApps/src/MultiView.h +++ b/UtilityApps/src/MultiView.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/UtilityApps/src/converter.cpp b/UtilityApps/src/converter.cpp index d4ce1e7fe..7651b8fc2 100644 --- a/UtilityApps/src/converter.cpp +++ b/UtilityApps/src/converter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -22,7 +22,7 @@ namespace { void usage() { cout << "geoConverter -opt [-opt] \n" " Action flags: Usage is exclusive, 1 required! \n" - " -compact2lcdd Convert compact xml geometry to lcdd. \n" + " -compact2description Convert compact xml geometry to description. \n" " -compact2gdml Convert compact xml geometry to gdml. \n" " -compact2pandora Convert compact xml to pandora xml \n" " -compact2vis Convert compact xml to visualisation attrs\n\n" @@ -32,7 +32,7 @@ namespace { " device is stdout. \n" " -ascii [OPTIONAL] Dump visualisation attrs in csv format. \n" " [Only valid for -compact2vis] \n" - " -destroy [OPTIONAL] Force destruction of the LCDD instance \n" + " -destroy [OPTIONAL] Force destruction of the Detector instance \n" " before exiting the application \n" " -volmgr [OPTIONAL] Load and populate phys.volume manager to \n" " check the volume ids for duplicates etc. \n" @@ -46,7 +46,7 @@ namespace { bool ascii = false; bool volmgr = false; bool destroy = false; - bool compact2lcdd = false; + bool compact2description = false; bool compact2gdml = false; bool compact2pand = false; bool compact2vis = false; @@ -54,8 +54,8 @@ namespace { vector<char*> geo_files; for(int i=1; i<argc;++i) { if ( argv[i][0]=='-' ) { - if ( strncmp(argv[i],"-compact2lcdd",12)==0 ) - compact2lcdd = true; + if ( strncmp(argv[i],"-compact2description",12)==0 ) + compact2description = true; else if ( strncmp(argv[i],"-compact2gdml",12)==0 ) compact2gdml = true; else if ( strncmp(argv[i],"-compact2pandora",12)==0 ) @@ -79,29 +79,29 @@ namespace { usage(); } } - if ( geo_files.empty() || (!compact2lcdd && !compact2gdml && !compact2pand && !compact2vis)) + if ( geo_files.empty() || (!compact2description && !compact2gdml && !compact2pand && !compact2vis)) usage(); - LCDD& lcdd = dd4hep_instance(); + Detector& description = dd4hep_instance(); // Load compact files for(size_t i=0; i<geo_files.size(); ++i) { const char* plugin_argv[] = {geo_files[i], 0}; - run_plugin(lcdd,"DD4hepCompactLoader",1,(char**)plugin_argv); + run_plugin(description,"dd4hepCompactLoader",1,(char**)plugin_argv); } // Create volume manager and populate it required - if ( volmgr ) run_plugin(lcdd,"DD4hepVolumeManager",0,0); + if ( volmgr ) run_plugin(description,"dd4hepVolumeManager",0,0); // Execute data converter. - if ( compact2lcdd ) - run_plugin(lcdd,"DD4hepGeometry2LCDD",output,&argv[output]); + if ( compact2description ) + run_plugin(description,"dd4hepGeometry2Detector",output,&argv[output]); else if ( compact2gdml ) - run_plugin(lcdd,"DD4hepGeometry2GDML",output,&argv[output]); + run_plugin(description,"dd4hepGeometry2GDML",output,&argv[output]); else if ( compact2pand ) - run_plugin(lcdd,"DD4hepGeometry2PANDORA",output,&argv[output]); + run_plugin(description,"dd4hepGeometry2PANDORA",output,&argv[output]); else if ( compact2vis && ascii ) - run_plugin(lcdd,"DD4hepGeometry2VISASCII",output,&argv[output]); + run_plugin(description,"dd4hepGeometry2VISASCII",output,&argv[output]); else if ( compact2vis ) - run_plugin(lcdd,"DD4hepGeometry2VIS",output,&argv[output]); - if ( destroy ) delete &lcdd; + run_plugin(description,"dd4hepGeometry2VIS",output,&argv[output]); + if ( destroy ) delete &description; return 0; } } diff --git a/UtilityApps/src/display.cpp b/UtilityApps/src/display.cpp index 834688e9b..7b5a12a52 100644 --- a/UtilityApps/src/display.cpp +++ b/UtilityApps/src/display.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,5 +16,5 @@ //______________________________________________________________________________ int main(int argc,char** argv) { - return main_default("DD4hepGeometryDisplay",argc,argv); + return main_default("dd4hepGeometryDisplay",argc,argv); } diff --git a/UtilityApps/src/dumpBfield.cpp b/UtilityApps/src/dumpBfield.cpp index d0bf1190f..c79b58897 100644 --- a/UtilityApps/src/dumpBfield.cpp +++ b/UtilityApps/src/dumpBfield.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,12 +16,12 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DD4hepUnits.h" using namespace std ; -using namespace DD4hep ; -using namespace DD4hep::Geometry; +using namespace dd4hep ; +using namespace dd4hep::detail; //============================================================================= @@ -51,8 +51,8 @@ static int invoke_dump_B_field(int argc, char** argv ){ - LCDD& lcdd = LCDD::getInstance(); - lcdd.fromCompact( inFile ); + Detector& description = Detector::getInstance(); + description.fromCompact( inFile ); printf("#######################################################################################################\n"); printf(" x[cm] y[cm] z[cm] Bx[Tesla] By[cm] Bz[cm] \n"); @@ -63,7 +63,7 @@ static int invoke_dump_B_field(int argc, char** argv ){ double posV[3] = { x, y, z } ; double bfieldV[3] ; - lcdd.field().magneticField( posV , bfieldV ) ; + description.field().magneticField( posV , bfieldV ) ; printf(" %+15.8e %+15.8e %+15.8e %+15.8e %+15.8e %+15.8e \n", posV[0], posV[1], posV[2], diff --git a/UtilityApps/src/dumpdetector.cpp b/UtilityApps/src/dumpdetector.cpp index 603a2c190..aad5ac5fc 100644 --- a/UtilityApps/src/dumpdetector.cpp +++ b/UtilityApps/src/dumpdetector.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DetType.h" #include "DD4hep/DetectorSelector.h" #include "DD4hep/DD4hepUnits.h" @@ -32,6 +32,7 @@ using namespace std ; using namespace dd4hep ; +using namespace dd4hep::detail; using namespace dd4hep::rec; @@ -63,8 +64,8 @@ static void printDetectorData( DetElement det ){ static void printDetectorSets( std::string name, unsigned int includeFlag, unsigned int excludeFlag=DetType::IGNORE ){ - LCDD& lcdd = LCDD::getInstance(); - const std::vector<DetElement>& dets = DetectorSelector(lcdd).detectors( includeFlag, excludeFlag ) ; + Detector& description = Detector::getInstance(); + const std::vector<DetElement>& dets = DetectorSelector(description).detectors( includeFlag, excludeFlag ) ; std::cout << " " << name ; for(int i=0,N=dets.size();i<N;++i) std::cout << dets[i].name() << ", " ; @@ -93,16 +94,16 @@ static int invoke_dump_detector(int argc, char** argv ){ bool printSurfaces = ( argc>2 && !strcmp( argv[2] , "-s" ) ); - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - lcdd.fromCompact( inFile ); + description.fromCompact( inFile ); - DetElement world = lcdd.world() ; + DetElement world = description.world() ; std::cout << "############################################################################### " << std::endl ; - Header h = lcdd.header() ; + Header h = description.header() ; std::cout << " detector model : " << h.name() << std::endl << " title : " << h.title() << std::endl @@ -127,9 +128,9 @@ static int invoke_dump_detector(int argc, char** argv ){ if( printDetData ){ - DD4hep::Geometry::LCDD::HandleMap dets = lcdd.detectors() ; + dd4hep::Detector::HandleMap dets = description.detectors() ; - for( DD4hep::Geometry::LCDD::HandleMap::const_iterator it = dets.begin() ; it != dets.end() ; ++it ){ + for( dd4hep::Detector::HandleMap::const_iterator it = dets.begin() ; it != dets.end() ; ++it ){ DetElement det = it->second ; @@ -151,13 +152,13 @@ static int invoke_dump_detector(int argc, char** argv ){ - DD4hep::Geometry::LCDD::HandleMap sensDet = lcdd.sensitiveDetectors() ; + dd4hep::Detector::HandleMap sensDet = description.sensitiveDetectors() ; std::cout << "############################################################################### " << std::endl << " sensitive detectors: " << std::endl ; - for( DD4hep::Geometry::LCDD::HandleMap::const_iterator it = sensDet.begin() ; it != sensDet.end() ; ++it ){ + for( dd4hep::Detector::HandleMap::const_iterator it = sensDet.begin() ; it != sensDet.end() ; ++it ){ SensitiveDetector sDet = it->second ; std::cout << " " << it->first << " : type = " << sDet.type() << std::endl ; @@ -206,7 +207,7 @@ static int invoke_dump_detector(int argc, char** argv ){ for(unsigned i=0 ; i < parentCount ; ++i ) std::cout << "\t" ; - std::cout << de.name() << "[ path: "<< de.placementPath () << "] (id: " << de.id() << ") - sens type : " << lcdd.sensitiveDetector( de.name() ).type() << "\t surfaces : " << ( sL.empty() ? 0 : sL.size() ) << std::endl ; + std::cout << de.name() << "[ path: "<< de.placementPath () << "] (id: " << de.id() << ") - sens type : " << description.sensitiveDetector( de.name() ).type() << "\t surfaces : " << ( sL.empty() ? 0 : sL.size() ) << std::endl ; // printDetectorData( de ) ; diff --git a/UtilityApps/src/graphicalMaterialScan.cpp b/UtilityApps/src/graphicalMaterialScan.cpp index 3673d94d0..edb423448 100644 --- a/UtilityApps/src/graphicalMaterialScan.cpp +++ b/UtilityApps/src/graphicalMaterialScan.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,7 +28,7 @@ #include "TH2F.h" // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DDRec/MaterialManager.h" @@ -40,7 +40,7 @@ #undef NDEBUG #include <cassert> -using namespace DD4hep; +using namespace dd4hep; using namespace dd4hep::rec; using std::cout; @@ -128,8 +128,8 @@ int main_wrapper(int argc, char** argv) { //------ - Geometry::LCDD& lcdd = Geometry::LCDD::getInstance(); - lcdd.fromCompact(inFile); + Detector& description = Detector::getInstance(); + description.fromCompact(inFile); //----- @@ -137,7 +137,7 @@ int main_wrapper(int argc, char** argv) { Vector3D p0, p1; // the two points between which material is calculated - MaterialManager matMgr( lcdd.world().volume() ) ; + MaterialManager matMgr; for (unsigned int isl=0; isl<nslice; isl++) { // loop over slices diff --git a/UtilityApps/src/main.h b/UtilityApps/src/main.h index 319fac963..7c80df169 100644 --- a/UtilityApps/src/main.h +++ b/UtilityApps/src/main.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/UtilityApps/src/materialScan.cpp b/UtilityApps/src/materialScan.cpp index da548f570..11390596b 100644 --- a/UtilityApps/src/materialScan.cpp +++ b/UtilityApps/src/materialScan.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -20,7 +20,7 @@ #include "TError.h" // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DDRec/MaterialManager.h" #include "main.h" @@ -53,11 +53,11 @@ int main_wrapper(int argc, char** argv) { if ( !sstr.good() ) Handler::usage(); setPrintLevel(WARNING); - Geometry::LCDD& lcdd = Geometry::LCDD::getInstance(); - lcdd.fromCompact(inFile); + Detector& description = Detector::getInstance(); + description.fromCompact(inFile); direction = (p1-p0).unit(); - MaterialManager matMgr( lcdd.world().volume() ) ; + MaterialManager matMgr; const MaterialVec& materials = matMgr.materialsBetween(p0, p1); double sum_x0 = 0; double sum_lambda = 0; diff --git a/UtilityApps/src/next_event_dummy.cpp b/UtilityApps/src/next_event_dummy.cpp index 4d6e839e3..c5eb6da93 100644 --- a/UtilityApps/src/next_event_dummy.cpp +++ b/UtilityApps/src/next_event_dummy.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/UtilityApps/src/next_event_lcio.cpp b/UtilityApps/src/next_event_lcio.cpp index dc6cd77a7..44fb3b330 100644 --- a/UtilityApps/src/next_event_lcio.cpp +++ b/UtilityApps/src/next_event_lcio.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/UtilityApps/src/plugin_runner.cpp b/UtilityApps/src/plugin_runner.cpp index 47cb4fbae..8e551476d 100644 --- a/UtilityApps/src/plugin_runner.cpp +++ b/UtilityApps/src/plugin_runner.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -45,23 +45,23 @@ namespace { if ( arguments.plugins.empty() ) usage(); - LCDD& lcdd = dd4hep_instance(); + Detector& description = dd4hep_instance(); // Load compact files if required by plugin if ( !arguments.geo_files.empty() ) { - load_compact(lcdd, arguments); + load_compact(description, arguments); } else { cout << "geoPluginRun: No geometry input supplied. No geometry will be loaded." << endl; } // Create volume manager and populate it required - if ( arguments.volmgr ) run_plugin(lcdd,"DD4hepVolumeManager",0,0); + if ( arguments.volmgr ) run_plugin(description,"dd4hepVolumeManager",0,0); // Execute plugin for(size_t i=0; i<arguments.plugins.size(); ++i) { std::vector<const char*>& plug = arguments.plugins[i]; int num_arg = int(plug.size())-2; - run_plugin(lcdd,plug[0], num_arg,(char**)&plug[1]); + run_plugin(description,plug[0], num_arg,(char**)&plug[1]); } - if ( arguments.destroy ) delete &lcdd; + if ( arguments.destroy ) delete &description; return 0; } } diff --git a/UtilityApps/src/print_materials.cpp b/UtilityApps/src/print_materials.cpp index 1e3bc8fba..622faad8c 100644 --- a/UtilityApps/src/print_materials.cpp +++ b/UtilityApps/src/print_materials.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,13 +16,14 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DD4hepUnits.h" #include "DDRec/MaterialManager.h" using namespace std ; -using namespace dd4hep ; +using namespace dd4hep::detail; using namespace dd4hep::rec; +using namespace dd4hep ; //============================================================================= @@ -50,14 +51,14 @@ int main_wrapper(int argc, char** argv ){ sstr >> y1 ; sstr >> z1 ; - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - lcdd.fromCompact( inFile ); + description.fromCompact( inFile ); Vector3D p0( x0, y0, z0 ) ; Vector3D p1( x1, y1, z1 ) ; - MaterialManager matMgr( lcdd.world().volume() ) ; + MaterialManager matMgr ; const MaterialVec& materials = matMgr.materialsBetween( p0 , p1 ) ; diff --git a/UtilityApps/src/run_plugin.h b/UtilityApps/src/run_plugin.h index 746b759e4..d393428de 100644 --- a/UtilityApps/src/run_plugin.h +++ b/UtilityApps/src/run_plugin.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" // C/C++ include files @@ -23,8 +23,8 @@ #include <string> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; //________________________________________________________________________________ #include "TRint.h" @@ -32,32 +32,32 @@ using namespace DD4hep::Geometry; namespace { //______________________________________________________________________________ - LCDD& dd4hep_instance(const char* /* name */ ="") { + Detector& dd4hep_instance(const char* /* name */ ="") { #if 0 #include "DD4hep/PluginService.h" try { - union { void* p; LCDD* l; } v; - v.p = ::DD4hep::PluginService::Create<void*>("LCDD_constructor",name); + union { void* p; Detector* l; } v; + v.p = ::dd4hep::PluginService::Create<void*>("Detector_constructor",name); if ( v.p ) { return *v.l; } - except("RunPlugin","++ Failed to locate plugin to create LCDD instance"); + except("RunPlugin","++ Failed to locate plugin to create Detector instance"); } catch(const exception& e) { except("RunPlugin","++ Exception: %s", e.what()); } catch(...) { - except("RunPlugin","++ UNKNOWN Exception while creating LCDD instance."); + except("RunPlugin","++ UNKNOWN Exception while creating Detector instance."); } - except("RunPlugin","++ UNKNOWN Exception while creating LCDD instance."); + except("RunPlugin","++ UNKNOWN Exception while creating Detector instance."); #endif - return LCDD::getInstance(); + return Detector::getInstance(); } //______________________________________________________________________________ - long run_plugin(LCDD& lcdd, const char* name, int argc, char** argv) { + long run_plugin(Detector& description, const char* name, int argc, char** argv) { try { - lcdd.apply(name,argc,argv); + description.apply(name,argc,argv); return 0; } catch(const exception& e) { @@ -79,7 +79,7 @@ namespace { " Default for each file is: BUILD_DEFAULT [=1] \n" " Allowed: BUILD_SIMU [=1], BUILD_RECO [=2], \n" " BUILD_DISPLAY [=3] or BUILD_ENVELOPE [=4] \n" - " -destroy [OPTIONAL] Force destruction of the LCDD instance \n" + " -destroy [OPTIONAL] Force destruction of the Detector instance \n" " before exiting the application \n" " -volmgr [OPTIONAL] Load and populate phys.volume manager to \n" " check the volume ids for duplicates etc. \n" @@ -90,10 +90,10 @@ namespace { " -plugin <name> <args> Execute plugin <name> after loading geometry. \n" " All arguments following until the next '-' \n" " are considered as arguments to the plugin. \n" - " -ui Install ROOT interpreter UI for DD4hep \n" + " -ui Install ROOT interpreter UI for dd4hep \n" " Will show up in the global interpreter variable\n" - " 'DD4hep::ROOTUI* gDD4hepUI' and allows the user\n" - " to interact with the the LCDD instance from the\n" + " 'dd4hep::ROOTUI* gdd4hepUI' and allows the user\n" + " to interact with the the Detector instance from the\n" " ROOT interactive prompt. \n"; return cout; } @@ -124,7 +124,7 @@ namespace { dry_run = false; destroy = false; interpreter = true; - print = DD4hep::INFO; + print = dd4hep::INFO; } //____________________________________________________________________________ @@ -144,7 +144,7 @@ namespace { else if ( strncmp(argv[i],"-dry-run",5)==0 ) dry_run = true; else if ( strncmp(argv[i],"-print",4)==0 ) - DD4hep::setPrintLevel(DD4hep::PrintLevel(print = decodePrintLevel(argv[++i]))); + dd4hep::setPrintLevel(dd4hep::PrintLevel(print = decodePrintLevel(argv[++i]))); else if ( strncmp(argv[i],"-destroy",5)==0 ) destroy = true; else if ( strncmp(argv[i],"-no-destroy",8)==0 ) @@ -176,7 +176,7 @@ namespace { } //____________________________________________________________________________ - long run(LCDD& lcdd, const char* name) { + long run(Detector& description, const char* name) { pair<int, char**> a(0,0); long result; for(size_t i=0; i<plugins.size(); ++i) { @@ -184,9 +184,9 @@ namespace { // Remove plugin name and trailing 0x0 from args. size_t num_args = plug.size()>2 ? plug.size()-2 : 0; - result = run_plugin(lcdd,plug[0],plug.size()-1,(char**)(num_args>0 ? &plug[1] : 0)); + result = run_plugin(description,plug[0],plug.size()-1,(char**)(num_args>0 ? &plug[1] : 0)); if ( result == EINVAL ) { - cout << "FAILED to execute DD4hep plugin: '" << plug[0] + cout << "FAILED to execute dd4hep plugin: '" << plug[0] << "' with args (" << num_args << ") :[ "; for(size_t j=1; j<plug.size(); ++j) { if ( plug[j] ) cout << plug[j] << " "; @@ -194,14 +194,14 @@ namespace { cout << "]" << endl; usage_default(name); } - cout << "Executed DD4hep plugin: '" << plug[0] + cout << "Executed dd4hep plugin: '" << plug[0] << "' with args (" << num_args << ") :[ "; for(size_t j=1; j<plug.size(); ++j) { if ( plug[j] ) cout << plug[j] << " "; } cout << "]" << endl; } - result = run_plugin(lcdd,name,a.first,a.second); + result = run_plugin(description,name,a.first,a.second); return result; } @@ -210,25 +210,25 @@ namespace { switch(::toupper(val[0])) { case '1': case 'V': - return DD4hep::VERBOSE; + return dd4hep::VERBOSE; case '2': case 'D': - return DD4hep::DEBUG; + return dd4hep::DEBUG; case '3': case 'I': - return DD4hep::INFO; + return dd4hep::INFO; case '4': case 'W': - return DD4hep::WARNING; + return dd4hep::WARNING; case '5': case 'E': - return DD4hep::ERROR; + return dd4hep::ERROR; case '6': case 'F': - return DD4hep::FATAL; + return dd4hep::FATAL; case '7': case 'A': - return DD4hep::FATAL; + return dd4hep::FATAL; default: cout << "Unknown print level supplied:'" << val << "'. Argument ignored." << endl; throw runtime_error("Invalid printLevel:"+val); @@ -237,11 +237,11 @@ namespace { }; //______________________________________________________________________________ - void load_compact(LCDD& lcdd, Args& args) { + void load_compact(Detector& description, Args& args) { // Load all compact files for(size_t i=0; i<args.geo_files.size(); ++i) { const char* argv[] = {args.geo_files[i], args.build_types[i], 0}; - run_plugin(lcdd,"DD4hepCompactLoader",2,(char**)argv); + run_plugin(description,"dd4hepCompactLoader",2,(char**)argv); } } @@ -263,12 +263,12 @@ namespace { if ( args.geo_files.empty() ) usage_default(name); - LCDD& lcdd = dd4hep_instance(); + Detector& description = dd4hep_instance(); // Load all compact files - load_compact(lcdd, args); - if ( args.ui ) run_plugin(lcdd,"DD4hepInteractiveUI",0,0); + load_compact(description, args); + if ( args.ui ) run_plugin(description,"dd4hepInteractiveUI",0,0); // Create volume manager and populate it required - if ( args.volmgr ) run_plugin(lcdd,"DD4hepVolumeManager",0,0); + if ( args.volmgr ) run_plugin(description,"dd4hepVolumeManager",0,0); // Create an interactive ROOT application if ( !args.dry_run ) { @@ -276,17 +276,17 @@ namespace { pair<int, char**> a(0,0); if ( args.interpreter ) { TRint app(name, &a.first, a.second); - result = args.run(lcdd,name); + result = args.run(description,name); if ( result != EINVAL ) app.Run(); } else - result = args.run(lcdd,name); + result = args.run(description,name); if ( result == EINVAL ) usage_default(name); } else { cout << "The geometry was loaded. Application now exiting." << endl; } - if ( args.destroy ) delete &lcdd; + if ( args.destroy ) delete &description; return 0; } diff --git a/UtilityApps/src/test_cellid_position_converter.cpp b/UtilityApps/src/test_cellid_position_converter.cpp index d58ec1f69..64f5adf36 100644 --- a/UtilityApps/src/test_cellid_position_converter.cpp +++ b/UtilityApps/src/test_cellid_position_converter.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -12,7 +12,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/DDTest.h" #include "DD4hep/DD4hepUnits.h" @@ -28,9 +28,9 @@ #include <sstream> using namespace std ; -using namespace DD4hep ; -using namespace DD4hep::Geometry; -using namespace DD4hep::DDRec ; +using namespace dd4hep ; +using namespace dd4hep::detail; +using namespace dd4hep::rec ; using namespace lcio; @@ -72,11 +72,11 @@ int main_wrapper(int argc, char** argv ){ std::string inFile = argv[1] ; - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - lcdd.fromCompact( inFile ); + description.fromCompact( inFile ); - CellIDPositionConverter idposConv( lcdd ) ; + CellIDPositionConverter idposConv( description ) ; //--------------------------------------------------------------------- @@ -124,8 +124,8 @@ int main_wrapper(int argc, char** argv ){ std::string cellIDEcoding = col->getParameters().getStringVal("CellIDEncoding") ; - DD4hep::BitField64 idDecoder0( cellIDEcoding ) ; - DD4hep::BitField64 idDecoder1( cellIDEcoding ) ; + dd4hep::BitField64 idDecoder0( cellIDEcoding ) ; + dd4hep::BitField64 idDecoder1( cellIDEcoding ) ; int nHit = std::min( col->getNumberOfElements(), maxHit ) ; @@ -134,12 +134,12 @@ int main_wrapper(int argc, char** argv ){ SimCalorimeterHit* sHit = (SimCalorimeterHit*) col->getElementAt(i) ; - DD4hep::long64 id0 = sHit->getCellID0() ; - DD4hep::long64 id1 = sHit->getCellID1() ; + dd4hep::long64 id0 = sHit->getCellID0() ; + dd4hep::long64 id1 = sHit->getCellID1() ; idDecoder0.setValue( id0 , id1 ) ; - DD4hep::long64 id = idDecoder0.getValue() ; + dd4hep::long64 id = idDecoder0.getValue() ; Position point( sHit->getPosition()[0]* dd4hep::mm , sHit->getPosition()[1]* dd4hep::mm , sHit->getPosition()[2]* dd4hep::mm ) ; diff --git a/UtilityApps/src/test_surfaces.cpp b/UtilityApps/src/test_surfaces.cpp index a614b35a5..b68a2794f 100644 --- a/UtilityApps/src/test_surfaces.cpp +++ b/UtilityApps/src/test_surfaces.cpp @@ -1,5 +1,5 @@ -//========================================================================== -// AIDA Detector description implementation for LCD +\//========================================================================== +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -10,7 +10,7 @@ //========================================================================== // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDRec/Surface.h" #include "DDRec/DetectorSurfaces.h" @@ -33,6 +33,7 @@ using namespace std ; using namespace dd4hep ; +using namespace dd4hep::detail; using namespace dd4hep::rec ; using namespace lcio; @@ -50,21 +51,21 @@ int main_wrapper(int argc, char** argv ){ std::string inFile = argv[1] ; - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - lcdd.fromCompact( inFile ); + description.fromCompact( inFile ); #if 0 // create a list of all surfaces in the detector: - DetElement world = lcdd.world() ; + DetElement world = description.world() ; SurfaceHelper surfMan( world ) ; const SurfaceList& sL = surfMan.surfaceList() ; // map of surfaces - std::map< DD4hep::long64, Surface* > surfMap ; + std::map< dd4hep::long64, Surface* > surfMap ; for( SurfaceList::const_iterator it = sL.begin() ; it != sL.end() ; ++it ){ @@ -79,7 +80,7 @@ int main_wrapper(int argc, char** argv ){ } #else - SurfaceManager& surfMan = *lcdd.extension< SurfaceManager >() ; + SurfaceManager& surfMan = *description.extension< SurfaceManager >() ; const SurfaceMap& surfMap = *surfMan.map( "world" ) ; #endif @@ -113,7 +114,7 @@ int main_wrapper(int argc, char** argv ){ std::string cellIDEcoding = col->getParameters().getStringVal("CellIDEncoding") ; - DD4hep::BitField64 idDecoder( cellIDEcoding ) ; + dd4hep::BitField64 idDecoder( cellIDEcoding ) ; int nHit = col->getNumberOfElements() ; @@ -121,7 +122,7 @@ int main_wrapper(int argc, char** argv ){ SimTrackerHit* sHit = (SimTrackerHit*) col->getElementAt(i) ; - DD4hep::long64 id = sHit->getCellID0() ; + dd4hep::long64 id = sHit->getCellID0() ; idDecoder.setValue( id ) ; // std::cout << " simhit with cellid : " << idDecoder << std::endl ; diff --git a/UtilityApps/src/teve_display.cpp b/UtilityApps/src/teve_display.cpp index ead169cc9..1b1261aba 100644 --- a/UtilityApps/src/teve_display.cpp +++ b/UtilityApps/src/teve_display.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -13,7 +13,7 @@ // Framework include files #include "DD4hep/Factories.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDRec/SurfaceHelper.h" #include "EvNavHandler.h" @@ -59,7 +59,9 @@ using namespace dd4hep ; -using namespace dd4hep::rec ; +using namespace rec ; +using namespace detail ; + //===================================================================================== // function declarations: @@ -71,9 +73,9 @@ TEveStraightLineSet* getSurfaceVectors(bool addO=true, bool addU= true, bool add //===================================================================================== -static long teve_display(LCDD& lcdd, int /* argc */, char** /* argv */) { +static long teve_display(Detector& description, int /* argc */, char** /* argv */) { - TGeoManager* mgr = &lcdd.manager(); + TGeoManager* mgr = &description.manager(); mgr->SetNsegments(100); // Increase the visualization resolution. TEveManager::Create(); @@ -147,13 +149,13 @@ static long teve_display(LCDD& lcdd, int /* argc */, char** /* argv */) { return 1; } -DECLARE_APPLY(DD4hepTEveDisplay,teve_display) +DECLARE_APPLY(dd4hepTEveDisplay,teve_display) //===================================================================================================================== int main(int argc,char** argv) { - return main_default("DD4hepTEveDisplay",argc,argv); + return main_default("dd4hepTEveDisplay",argc,argv); } //===================================================================================================================== @@ -163,9 +165,9 @@ TEveStraightLineSet* getSurfaceVectors(bool addO, bool addU, bool addV, bool add TEveStraightLineSet* ls = new TEveStraightLineSet(name); - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - DetElement world = lcdd.world() ; + DetElement world = description.world() ; // create a list of all surfaces in the detector: SurfaceHelper surfMan( world ) ; @@ -206,9 +208,9 @@ TEveStraightLineSet* getSurfaces(int col, const SurfaceType& type, TString name) TEveStraightLineSet* ls = new TEveStraightLineSet(name); - LCDD& lcdd = LCDD::getInstance(); + Detector& description = Detector::getInstance(); - DetElement world = lcdd.world() ; + DetElement world = description.world() ; // create a list of all surfaces in the detector: SurfaceHelper surfMan( world ) ; @@ -264,7 +266,7 @@ void make_gui() { browser->StartEmbedding(TRootBrowser::kLeft); TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600); - frmMain->SetWindowName("DD4hep GUI"); + frmMain->SetWindowName("dd4hep GUI"); frmMain->SetCleanup(kDeepCleanup); TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain); diff --git a/bootstrap.sh b/bootstrap.sh index ebed2b089..66213f929 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -2,7 +2,7 @@ ######################################################################################################################## # -# Assuming you have CVMFS and run SLC6, CERN Centos7 or macOS Sierra you can bootstrap DD4hep by executing this script +# Assuming you have CVMFS and run SLC6, CERN Centos7 or macOS Sierra you can bootstrap dd4hep by executing this script # ######################################################################################################################## diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake index cab0be362..a861f7a61 100644 --- a/cmake/DD4hep.cmake +++ b/cmake/DD4hep.cmake @@ -1,7 +1,6 @@ #================================================================================= -# $Id: $ # -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #--------------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index f8841c803..9a5f86634 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -1,6 +1,6 @@ #================================================================================= # -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #--------------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/cmake/DD4hepConfig.cmake.in b/cmake/DD4hepConfig.cmake.in index ce108159e..f994e3650 100644 --- a/cmake/DD4hepConfig.cmake.in +++ b/cmake/DD4hepConfig.cmake.in @@ -40,7 +40,7 @@ set( DD4hep_INCLUDE_DIRS DD4hep_INCLUDE_DIRS-NOTFOUND ) mark_as_advanced( DD4hep_INCLUDE_DIRS ) find_path( DD4hep_INCLUDE_DIRS - NAMES DD4hep/Detector.h + NAMES DD4hep/DetElement.h PATHS ${DD4hep_DIR}/include NO_DEFAULT_PATH ) diff --git a/cmake/Doxyfile.in b/cmake/Doxyfile.in index 9d6f8e8c1..28fab0bb1 100644 --- a/cmake/Doxyfile.in +++ b/cmake/Doxyfile.in @@ -684,7 +684,7 @@ INPUT += @CMAKE_CURRENT_SOURCE_DIR@/doc/doxygen/DD4hepGroups.h #INPUT += @CMAKE_CURRENT_SOURCE_DIR@//include # This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# that doxygen parses. detaillly doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. diff --git a/cmake/Version.h.in b/cmake/Version.h.in index 75c63a997..8cf142018 100644 --- a/cmake/Version.h.in +++ b/cmake/Version.h.in @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/doc/CHEP2013/DD4hep.tex b/doc/CHEP2013/DD4hep.tex index f6c192b86..a095ce203 100644 --- a/doc/CHEP2013/DD4hep.tex +++ b/doc/CHEP2013/DD4hep.tex @@ -2,7 +2,7 @@ \usepackage{graphicx} \begin{document} -\title{DD4hep: A Detector Description Toolkit \\ +\title{dd4hep: A Detector Description Toolkit \\ for High Energy Physics Experiments} \author{ @@ -60,7 +60,7 @@ detection techniques, constants required by alignment and calibration, description of the readout structures, conditions data, etc. \noindent -The design of the DD4hep toolkit\cite{bib:DD4hep} +The design of the dd4hep toolkit\cite{bib:dd4hep} is shaped on the experience of detector description systems, which were implemented for the LHC experiments, in particular the LHCb experiment~\cite{bib:LHCb,bib:LHCb-geometry}, @@ -70,7 +70,7 @@ the Linear Collider community~\cite{bib:ILD,bib:SiD}. Designing a coherent set of tools, with most of the basic components already existing in one form or another, is an opportunity for getting the best of all existing solutions. -DD4hep aims to widely reuse used existing software components, in particular +dd4hep aims to widely reuse used existing software components, in particular the ROOT geometry package~\cite{bib:ROOT-tgeo}, part of the ROOT project\cite{bib:ROOT}, a tool for building, browsing, navigating and visualizing detector geometries. The @@ -81,15 +81,15 @@ sophisticated 3D visualization functionality, which is ideal for building detector and event displays. The second component is the Geant4 simulation toolkit~\cite{bib:geant4}, which is used to simulate the detector response from particle collisions in complex designs. -In DD4hep the geometrical +In dd4hep the geometrical representation provided by ROOT is the main source of information. -In addition DD4hep provides the automatic conversions to other geometrical +In addition dd4hep provides the automatic conversions to other geometrical representations, such as Geant4, and the convenient usage of these components without the reinvention of the existing functionality. \noindent In Section~\ref{sec:architectural-concepts} the scope and the high-level -requirements of the DD4hep toolkit are elaborated (in the following +requirements of the dd4hep toolkit are elaborated (in the following also called "the toolkit"). This is basically the high level vision of the provided functionality to the experimental communities. In Section~\ref{sec:toolkit-design} the high-level or architectural design @@ -156,8 +156,8 @@ The following main requirements influenced the design of the toolkit: \begin{figure}[h] \vspace{-1cm} \begin{center} - \includegraphics[height=70mm] {DD4hep_big_picture.png} - \caption{The components of the DD4hep detector geometry toolkit.} + \includegraphics[height=70mm] {dd4hep_big_picture.png} + \caption{The components of the dd4hep detector geometry toolkit.} \label{fig:dd4hep-big-picture} \end{center} \vspace{-0.4cm} @@ -185,7 +185,7 @@ The model and its components will be described in subsequence sections. %============================================================================= \noindent Inspired from the work of the linear collider detector -simulation~\cite{bib:LCDD,bib:lcsim}, the compact detector description is used +simulation~\cite{bib:Detector,bib:lcsim}, the compact detector description is used to define an ideal detector as typically used during the conceptual design phase of an experiment. The compact description in its minimalistic form is probably not going to @@ -196,7 +196,7 @@ with deviations from the ideal would be needed by the experiment. \noindent In the compact description the detector is parametrized in minimalistic terms with user provided parameters in XML. -XML is an open format, the DD4hep parsers do not validate against a fix schema +XML is an open format, the dd4hep parsers do not validate against a fix schema and hence allow to easily introduce new elements and attributes to describe detectors. This feature minimizes the burden on the end-user while still supporting flexibility. @@ -209,7 +209,7 @@ general manner, therefore so called $Detector$ $Constructors$ are needed. %============================================================================= %\begin{figure}[h] % \begin{center} -% \includegraphics[width=16cm] {DD4hep_compact_xml.png} +% \includegraphics[width=16cm] {dd4hep_compact_xml.png} % \caption{An example sniplett of the compact detector description. The % example shows the description of a 2 layered silicon vertex % detector.} @@ -245,8 +245,8 @@ The compact description together with the detector constructors are sufficient to build the detector model and to visualize it. If during the lifetime of the experiment the detector model changes, the corresponding constructors will need to be adapted accordingly. -DD4hep provides already a palette of basic pre-implemented geometrical detector -concepts to design experiments. In view of usage of DD4hep as a detector +dd4hep provides already a palette of basic pre-implemented geometrical detector +concepts to design experiments. In view of usage of dd4hep as a detector description toolkit, this library may in the future also adopt generic designs of detector components created by end users e.g. during the design phase of future experiments. @@ -254,7 +254,7 @@ phase of future experiments. \begin{figure}[t] \vspace{-0.8cm} \begin{center} - \includegraphics[height=80mm] {DD4hep_classes.png} + \includegraphics[height=80mm] {dd4hep_classes.png} \caption{Class diagram with the main classes and their relations for the Generic Detector Description Model. The implementing ROOT classes are shown in brackets.} @@ -268,7 +268,7 @@ phase of future experiments. %============================================================================= \noindent -This is the heart of the DD4hep detector description toolkit. Its purpose is +This is the heart of the dd4hep detector description toolkit. Its purpose is to build in memory a model of the detector including its geometrical aspects as well as structural and functional aspects. The design reuses the elements from the ROOT geometry package and extends them in case required functionality @@ -288,7 +288,7 @@ the all TPC geometrical dimensions, the alignment and calibration constants and other slow varying conditions such as the gas pressure, end-plate temperatures etc. The $Detector$ $Element$ acts as a data concentrator. Applications may access the full experiment geometry and all connected data -through a singleton object called $LCDD$, which provides +through a singleton object called $Detector$, which provides management, bookkeeping and ownership to the model instances. \noindent @@ -326,7 +326,7 @@ to daughter starting from the top-level volume. \begin{figure}[t] \vspace{-0.8cm} \begin{center} - \includegraphics[height=70mm] {DD4hep_detelement_tree.png} + \includegraphics[height=70mm] {dd4hep_detelement_tree.png} \caption{The object diagram of a hypothetical TPC detector showing in parallel the $Detector$ $Element$ and the $Geometry$ hierarchy and the relationships between the objects.} @@ -388,7 +388,7 @@ simulation, tracking, etc. \begin{figure}[t] \vspace{-1cm} \begin{center} - \includegraphics[width=95mm] {DD4hep-extensions.png} + \includegraphics[width=95mm] {dd4hep-extensions.png} \caption{Extensions may be attached to common Detector Elements which extend the functionality of the common DetElement class and support e.g. caching of precomputed values.} @@ -420,7 +420,7 @@ This design allows to build views addressing the following use-cases: \noindent Detector-simulation depends strongly on the use of an underlying simulation toolkit, the most prominent candidate nowadays being Geant4~\cite{bib:geant4}. -DD4hep supports simulation activities with Geant4 providing +dd4hep supports simulation activities with Geant4 providing an automatic translation mechanism between geometry representations. The simulation response in the active elements of the detector is not implemented by the toolkit, since it is strongly influenced by the technical @@ -429,7 +429,7 @@ In Geant4 this response is computed in software constructs called $Sensitive$ $Detectors$. \noindent -Ideally DD4hep aims to provide a generic simulation application. +Ideally dd4hep aims to provide a generic simulation application. Similar to the palette of pre-implemented geometrical detector concepts to design experiments, it provides a palette of $Sensitive$ $Detectors$ to simulate the detector response in form of a component library. @@ -492,7 +492,7 @@ is envisaged. \section{Conclusions} %============================================================================= \noindent -The design of the core of the DD4hep Detector Description Toolkit described +The design of the core of the dd4hep Detector Description Toolkit described has been implemented to a large extent and several key aspects were addressed. The early adoption of parts of the linear collider community is an invaluable asset to verify the usefulness of the implemented design. These early @@ -508,7 +508,7 @@ These will be subject of future work. \section*{References} \begin{thebibliography}{9} -\bibitem{bib:DD4hep} DD4Hep web page, http://aidasoft.web.cern.ch/DD4hep. +\bibitem{bib:dd4hep} DD4Hep web page, http://aidasoft.web.cern.ch/DD4hep. \bibitem{bib:LHCb} LHCb Collaboration, "LHCb, the Large Hadron Collider beauty experiment, reoptimised detector @@ -516,11 +516,11 @@ These will be subject of future work. \bibitem{bib:LHCb-geometry} S. Ponce et al., "Detector Description Framework in LHCb", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), La Jolla, CA, 2003, proceedings. \bibitem{bib:ILD} The ILD Concept Group, - "The International Large Detector: Letter of Intent",\\ + "The detailtional Large Detector: Letter of Intent",\\ ISBN 978-3-935702-42-3, 2009. \bibitem{bib:SiD} H. Aihara, P. Burrows, M. Oreglia (Editors), @@ -538,15 +538,15 @@ These will be subject of future work. "Geant4 - A Simulation Toolkit", \\ Nuclear Instruments and Methods {\bf{A}} 506 (2003) 250-303. -\bibitem{bib:LCDD} T.Johnson et al., +\bibitem{bib:Detector} T.Johnson et al., "LCGO - geometry description for ILC detectors", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2007), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2007), Victoria, BC, Canada, 2012, Proceedings. \bibitem{bib:lcsim} N.Graf et al., "lcsim: An integrated detector simulation, reconstruction and analysis environment", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2012), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2012), New York, 2012, Proceedings. %\bibitem{bib:GDML} R. Chytracek et al., diff --git a/doc/CREDITS b/doc/CREDITS index f3c5cfe54..802ea0416 100644 --- a/doc/CREDITS +++ b/doc/CREDITS @@ -1,5 +1,5 @@ -This file lists the most important contributors to the DD4hep project. +This file lists the most important contributors to the dd4hep project. It is sorted by name and formatted to allow easy grepping and beautification by scripts. The fields are: name (N), email (E), description (D). @@ -27,11 +27,11 @@ D: Boost Spirit adapation taken from Gaudi N: Markus FRANK E: Markus.Frank@cern.ch -D: Main author of the DD4hep packages DDCore, DDG4, DDAlign, DDCond, DDEve. Project leader +D: Main author of the dd4hep packages DDCore, DDG4, DDAlign, DDCond, DDEve. Project leader N: Frank GAEDE E: Frank.Gaede@desy.de -D: Main author of the DD4hep package DDRec +D: Main author of the dd4hep package DDRec N. Alexander MAZUROV E: Alexander.Mazurov@gmail.com diff --git a/doc/CreateParsers.py b/doc/CreateParsers.py index 1a1ea391b..f51aa68c6 100644 --- a/doc/CreateParsers.py +++ b/doc/CreateParsers.py @@ -14,7 +14,7 @@ import os LICENSE ="""// $Id$ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -63,7 +63,7 @@ def createMappedFile( typ ): filename="ParserStandardList_Mapped_%s.cpp" % ( tName.replace(" ", "") ) fileContent= """ #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_MAPPED_PARSERS(pair,%(type)s) }} """ % { "type":typ } @@ -80,7 +80,7 @@ def createContainerFile( typ, cont ): filename="ParserStandardList_%s_%s.cpp" % ( cont[5:], tName.replace(" ", "")) fileContent= """ #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_PARSER(%(cont)s,%(type)s) }} """ % { "cont": cont, "type":typ } @@ -98,7 +98,7 @@ def createMapFile( typ, mtype ): filename="ParserStandardList_Map%s_%s.cpp" % ( mName.replace(" ", "") , tName.replace(" ", "")) fileContent= """ #include "ParsersStandardListCommon.h" -namespace DD4hep{ namespace Parsers{ +namespace dd4hep{ namespace Parsers{ IMPLEMENT_STL_MAP_PARSER(std::map,%(mtype)s,%(type)s) }} """ % { "mtype": mtype, "type":typ } diff --git a/doc/DD4hepStartersGuide.html b/doc/DD4hepStartersGuide.html index d32207847..4da6ecd64 100644 --- a/doc/DD4hepStartersGuide.html +++ b/doc/DD4hepStartersGuide.html @@ -10,7 +10,7 @@ <tr> <td id="projectlogo"><img alt="Logo" src="LaTex/CERN-logo.png" height="72"/></td> <td id="projectlogo"><img alt="Logo" src="LaTex/DD4hep-AIDA-logo.png" height="72"/></td> - <td id="projectbrief">DD4hep<br>The AIDA detector description toolkit</br> + <td id="projectbrief">dd4hep<br>The AIDA detector description toolkit</br> for high energy physics experiments</br></td> </tr> </tbody> @@ -22,7 +22,7 @@ <div class="space"></div> <div class="title"> -DD4hep +dd4hep <br> <br> Starter's Guide @@ -35,10 +35,10 @@ Starter's Guide <div class="space"></div> <div class="abstract"> -This starter's guide contains the basic information about <it>DD4hep</it>. +This starter's guide contains the basic information about <it>dd4hep</it>. This is the license information, instruction to obtain and build the software as well as suggestions of further reading concerning -the various <it>DD4hep</it> subpackages. +the various <it>dd4hep</it> subpackages. </div> <div class="space"></div> @@ -49,29 +49,29 @@ the various <it>DD4hep</it> subpackages. <hr /> -<h1><em>DD4hep</em> Project Information</h1> +<h1><em>dd4hep</em> Project Information</h1> <hr /> -<h2>The <em>DD4hep</em> Project Web</h2> +<h2>The <em>dd4hep</em> Project Web</h2> <p>The project's welcome page can be found under the folling URL: <a href="http://aidasoft.web.cern.ch/DD4hep">http://aidasoft.web.cern.ch/DD4hep</a></p> <p><strong><em>Please note:</em></strong> -To access the CERN intranet, to create new bugs in the <em>DD4hep</em> bug +To access the CERN intranet, to create new bugs in the <em>dd4hep</em> bug tracker etc, you require a CERN account, but you can create an external account very easily following <a href="https://account.cern.ch/account/Externals/RegisterAccount.aspx">these instructions</a>.</p> -<h2>The <em>DD4hep</em> Developers Mailing List</h2> +<h2>The <em>dd4hep</em> Developers Mailing List</h2> <p>Mailing list to contact developers is: <strong>dd4hep-developers@cern.ch</strong>.</p> <p>The mailing list archives can be consulted using the following -<a href="https://groups.cern.ch/group/dd4hep-developers/Lists/Archive/100.aspx">URL</a>.</p> +<a href="https://groups.cern.ch/group/DD4hep-developers/Lists/Archive/100.aspx">URL</a>.</p> -<h2>The <em>DD4hep</em> Issue Tracker</h2> +<h2>The <em>dd4hep</em> Issue Tracker</h2> <p>Bug tracking and issue solving as well as feature requests may be addressed to the developers using the following @@ -83,18 +83,18 @@ nano-seconds. Most of the contributors also have other assignments!</p> <h2>License</h2> -<p><em>DD4hep</em> is made available under the GPL license. -For full details see the file LICENSE in the <em>DD4hep</em> distribution or +<p><em>dd4hep</em> is made available under the GPL license. +For full details see the file LICENSE in the <em>dd4hep</em> distribution or at the following <a href="http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/LICENCE?view=markup">URL</a>.</p> <hr /> -<h1>Building and Installing <em>DD4hep</em></h1> +<h1>Building and Installing <em>dd4hep</em></h1> <hr /> -<p>The <em>DD4hep</em> software is distributed for each release in the form of </p> +<p>The <em>dd4hep</em> software is distributed for each release in the form of </p> <pre><code>* Precompiled tar-balls, where users only untar the downloaded software. @@ -104,7 +104,7 @@ at the following <h2>Release Versioning</h2> -<p>Currently <em>DD4hep</em> is released several times a year depending on the +<p>Currently <em>dd4hep</em> is released several times a year depending on the importance of new functionality. The versioning schema consists of two digits in the form:</p> @@ -115,7 +115,7 @@ We currently do not support patches, since the project is still quite young and the binary compatibility is broken with each release.</p> <p>Code changes, which require clients to modify existing code are getting -rare, since the main package <em>DD4hep</em> is maturing.</p> +rare, since the main package <em>dd4hep</em> is maturing.</p> <h2>Supported Platforms</h2> @@ -130,9 +130,9 @@ rare, since the main package <em>DD4hep</em> is maturing.</p> <pre><code> - Microsoft Windows. </code></pre> -<p>In principle <em>DD4hep</em> does not depend dramatically on specific +<p>In principle <em>dd4hep</em> does not depend dramatically on specific operating systems. In principle any compiler modern enough to support -<strong>C++11</strong> may should be capable of building <em>DD4hep</em>. +<strong>C++11</strong> may should be capable of building <em>dd4hep</em>. There are some <strong><em>C++ABI</em></strong> issues, which may have to be sorted out for non-gcc platforms, but most of this work was done for MacOS and it should be feasible to solve these problems for other platforms @@ -145,38 +145,38 @@ as well.</p> <h2>Prerequisites</h2> -<p><em>DD4hep</em> depends on a number of "external" packages. The user will need to +<p><em>dd4hep</em> depends on a number of "external" packages. The user will need to install these in his/her system before building and running the examples. -Depending on the usage of <em>DD4hep</em> and it's subpackages software of other +Depending on the usage of <em>dd4hep</em> and it's subpackages software of other projects is used. The configuration options are described later in this document.</p> <ul> -<li><em>DD4hep</em> uses the <em>CMake</em> build system. A recent version +<li><em>dd4hep</em> uses the <em>CMake</em> build system. A recent version (version 2.8 or higher) of <a href="#bib_cmake"><em>CMake</em></a> must be installed.</li> -<li><em>DD4hep</em> itself depends on the +<li><em>dd4hep</em> itself depends on the <a href="#bib_ROOT-tgeo">ROOT geometry package</a> <strong>Tgeo</strong> and in turn on the basic <a href="#bib_ROOT">ROOT libraries</a>. Version 5.30 or higher is required.</li> -<li><em>DD4hep</em> uses the <a href="#bib_boost"><em>Boost-Spirit</em></a> +<li><em>dd4hep</em> uses the <a href="#bib_boost"><em>Boost-Spirit</em></a> implementation to interprete input and options.</li> -<li>Optionally <em>DD4hep</em> can use <a href="#bib_xerces"><em>Xerces-C</em></a> as a +<li>Optionally <em>dd4hep</em> can use <a href="#bib_xerces"><em>Xerces-C</em></a> as a parser for XML input. By default it uses <a href="#bib_tinyxml"><em>TinyXML</em></a>, -which is included in the <em>DD4hep</em> release.</li> +which is included in the <em>dd4hep</em> release.</li> <li>The subpackages for alignment DDAlign, conditions data \DDC and event display <em>DDEve</em> do not require additional external libraries.</li> <li>The simulation extensions extension <em>DDG4</em> in addition depends on a valid <a href="#bib_geant4"><em>Geant4</em></a> installation. Version 9 and 10 of Geant4 is supported.</li> </ul> -<p>If <em>DD4hep</em> is not installed in the system name-space (/usr/bin, /usr/lib, etc.) -any number of <em>DD4hep</em> versions can exist in parallel.</p> +<p>If <em>dd4hep</em> is not installed in the system name-space (/usr/bin, /usr/lib, etc.) +any number of <em>dd4hep</em> versions can exist in parallel.</p> <h2>Package Contents</h2> -<p>The <em>DD4hep</em> project consists of several packages. +<p>The <em>dd4hep</em> project consists of several packages. The idea has been to separate the common parts of the detector description toolkit from concrete detector examples. </p> @@ -188,20 +188,20 @@ The package provides the basic mechanisms for constructing the "Generic Detector Description Model" in memory from XML compact detector definition files.</p> <p><strong>DDG4</strong>: -Is the package that contains the conversion of <em>DD4hep</em> geometry into +Is the package that contains the conversion of <em>dd4hep</em> geometry into Geant4 geometry to be used for simulation.</p> <p><strong>DDAlign</strong>: The DDAlign toolkit implements a modular and flexible approach to -introduce and access the alignment parameters in <em>DD4hep</em> geometry +introduce and access the alignment parameters in <em>dd4hep</em> geometry descruptions.</p> <p><strong>DDCond</strong>: -Support for conditions data for <em>DD4hep</em>.</p> +Support for conditions data for <em>dd4hep</em>.</p> <p><strong>DDEve</strong>: <em>DDEve</em> provides an event display for detector geometries -implemented using <em>DD4hep</em>. +implemented using <em>dd4hep</em>. <em>DDEve</em> hereby takes advantage of the TEve toolkit naturally provided by the ROOT framework like the ROOT geometry toolkit TGeo. </p> @@ -214,14 +214,14 @@ dependencies. For instance, the simulation application example will require to compiler and link against Geant4 but not the reconstruction application.</p> -<h2>Installing <em>DD4hep</em> from Precompiled Binaries</h2> +<h2>Installing <em>dd4hep</em> from Precompiled Binaries</h2> <p>The binaries are available for downloading from afs under the following location: <strong>to be done, currently not available....</strong>. </p> <p>Once downloaded you need to unzip and de-tar the file. For example, if you have downloaded the debug -version of <em>DD4hep</em> v00-13 for Linux-SLC6: +version of <em>dd4hep</em> v00-13 for Linux-SLC6: <code> % gunzip dd4hep-v00-13-slc6-gcc4.8-dbg.tar.gz % tar xvf dd4hep-v00-13-slc6-gcc4.8-dbg.tar.gz @@ -233,10 +233,10 @@ the directory structure.</p> <p><strong>TO BE DONE !!!</strong></p> -<h2>Access and Build <em>DD4hep</em> from the Repository</h2> +<h2>Access and Build <em>dd4hep</em> from the Repository</h2> <p>The following sections explain how to obtain a usable binary -build of the <em>DD4hep</em> software.</p> +build of the <em>dd4hep</em> software.</p> <h3>Downloading the Code from the Repository</h3> @@ -245,21 +245,21 @@ check out the most recent source. The compressed file is a one time only choice; every time you would like to upgrade you will need to download the entire new version.</p> -<p>The <em>DD4hep</em> code is accessible in anonymous read-only mode by anybody +<p>The <em>dd4hep</em> code is accessible in anonymous read-only mode by anybody from the svn repository at <strong>Desy</strong>: <code> % svn co https://svnsrv.desy.de/basic/aidasoft/DD4hep/trunk -% mv trunk DD4hep_src +% mv trunk dd4hep_src </code></p> <h3>Installing the Source from Subversion</h3> -<p>This paragraph describes how to checkout and build <em>DD4hep</em> from a checkout using subversion for Unix-like systems: +<p>This paragraph describes how to checkout and build <em>dd4hep</em> from a checkout using subversion for Unix-like systems: <code> -% mkdir DD4hep_install -% mkdir DD4hep_build +% mkdir dd4hep_install +% mkdir dd4hep_build % export DD4hepINSTALL=<code>pwd</code>/DD4hep_install -% cd DD4hep_build +% cd dd4hep_build % cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_INSTALL_PREFIX=\${DD4hepINSTALL} \ [option [option]] ... @@ -279,11 +279,11 @@ libraries in the shared lib search path (this will vary with OS, shell, etc.) e. <h3>CMake Configuration Options</h3> -<p>We describe in the following only options, which are unique to the build of <em>DD4hep</em>. Boolean values are either <strong>ON</strong> or <strong>OFF</strong> to enable or disable a feature.</p> +<p>We describe in the following only options, which are unique to the build of <em>dd4hep</em>. Boolean values are either <strong>ON</strong> or <strong>OFF</strong> to enable or disable a feature.</p> <table class="cmake_var"> -<tr><td colspan=2 class="cmake_desc">DD4hep_ROOT=<directory></td></tr> -<tr><td class="item">Function: </td><td> Location of the *DD4hep* installation directory.</td></tr> +<tr><td colspan=2 class="cmake_desc">dd4hep_ROOT=<directory></td></tr> +<tr><td class="item">Function: </td><td> Location of the *dd4hep* installation directory.</td></tr> </table> <table class="cmake_var"> @@ -326,7 +326,7 @@ libraries in the shared lib search path (this will vary with OS, shell, etc.) e. <table class="cmake_var"> <tr><td colspan=2 class="cmake_desc">BUILD_TESTING=<boolean> </td></tr> <tr><td class="item">Default: </td><td> OFF </td></tr> -<tr><td class="item">Function: </td><td> Build *DD4hep* tests. </td></tr> +<tr><td class="item">Function: </td><td> Build *dd4hep* tests. </td></tr> </table> <table class="cmake_var"> @@ -339,7 +339,7 @@ libraries in the shared lib search path (this will vary with OS, shell, etc.) e. <table class="cmake_var"> <tr><td colspan=2 class="cmake_desc">DD4HEP_USE_PYROOT=<boolean> </td></tr> <tr><td class="item">Default: </td><td> OFF </td></tr> -<tr><td class="item">Function: </td><td> Steer the usage of <bf>PyROOT</bf> *DD4hep* detector construction. </td></tr> +<tr><td class="item">Function: </td><td> Steer the usage of <bf>PyROOT</bf> *dd4hep* detector construction. </td></tr> <tr><td class="item">Remark: </td><td> <bf>DEPRECATED</bf>. Purely historical and unsupported. </td></tr> </table> @@ -348,11 +348,11 @@ libraries in the shared lib search path (this will vary with OS, shell, etc.) e. <p>During the build a shell script is generated and copied to the installation area called "thisdd4hep.(c)sh". To setup the runtime and build environment for layered software -using <em>DD4hep</em> this script musty be source'd.</p> +using <em>dd4hep</em> this script musty be source'd.</p> -<h3>Using <em>DD4hep</em> in Layered Software as a Client</h3> +<h3>Using <em>dd4hep</em> in Layered Software as a Client</h3> -<p>It is necessary to setup the <em>DD4hep</em> runtime environment before +<p>It is necessary to setup the <em>dd4hep</em> runtime environment before the configuration of the client software. In the installation directory the cmake build instructions <strong>DD4hepConfig.cmake</strong> are generated, @@ -361,7 +361,7 @@ Cmake should pick-up the build instructions automatically.</p> <h3>Relocation of the Installation directory</h3> -<p>Once build, <em>DD4hep</em> can be tar'ed and/or moved to any other +<p>Once build, <em>dd4hep</em> can be tar'ed and/or moved to any other directory. The instructions for the usage by layered client software stay intact.</p> @@ -369,7 +369,7 @@ stay intact.</p> <h3>Example Build Script</h3> -<p>The following commands may be used to build <em>DD4hep</em> from the +<p>The following commands may be used to build <em>dd4hep</em> from the <a href="http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/example_build_script.sh">script in the svn repository</a>.</p> <pre> @@ -429,24 +429,24 @@ python examples/DDG4/examples/CLICSidSimu.py <hr /> -<h1><em>DD4hep</em> Documentation</h1> +<h1><em>dd4hep</em> Documentation</h1> <hr /> <p>General build information is provided by <a href="http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/DD4hepStarter.pdf">this document</a>: -In addition all sub-packages of the <em>DD4hep</em> toolkit provide documentation in the form of manuals.</p> +In addition all sub-packages of the <em>dd4hep</em> toolkit provide documentation in the form of manuals.</p> <p>Suggestions (or better improvements) of user documentation of packages being validated are highly welcome. Please contact the -developers using the <em>DD4hep</em> mailing list. +developers using the <em>dd4hep</em> mailing list. If a package is under development and not offered to the public, please ignore the package and it's errors unless you are eager to contribute.</p> -<h2><em>DD4hep</em> User's Guide</h2> +<h2><em>dd4hep</em> User's Guide</h2> -<p>The <em>DD4hep</em> guide is part of the distribution and the +<p>The <em>dd4hep</em> guide is part of the distribution and the <a href="http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/DD4hepManual.pdf">svn repository</a>. <br>Author: M.Frank</p> @@ -470,7 +470,7 @@ contribute.</p> <p>The DDEve guide is part of the distribution and the <a href="http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/DDEveManual.pdf">svn repository</a>.</p> -<p><strong>Note:</strong> This package is not officially part of <em>DD4hep</em> and in addition +<p><strong>Note:</strong> This package is not officially part of <em>dd4hep</em> and in addition under development. The guide is very rudimentary.</p> <h2><em>DDG4</em> User's Guide</h2> @@ -503,7 +503,7 @@ provides daily information about the the current status of the software in the s <hr /> -<p><em>DD4hep</em> was started by me in the year 2012 in response of the +<p><em>dd4hep</em> was started by me in the year 2012 in response of the needs of the linear collider community (ILD, CLIC) for a flexible detector geometry usable to develop tracking code. This development relatively quickly emerged into desire to actually @@ -524,7 +524,7 @@ are more then welcome. If your changes affect the basic design I would appreciate to be contacted in advance for a brief discussion of your plans.</p> -<p><em>DD4hep</em> is supposed to quickly enable users to develop test and +<p><em>dd4hep</em> is supposed to quickly enable users to develop test and simulate the physics response of new detector models and concepts. Although a certain palette of such subdetectors concepts is provided in the <strong>DDDetectors</strong> package, the palette is @@ -539,7 +539,7 @@ or more detailed sensitive detector concepts for the <em>DDG4</em> package.</p> <h2>Contributors</h2> <p>In the <a href="http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/CREDITS">CREDITS file</a> -the most important contributors to the <em>DD4hep</em> project and a +the most important contributors to the <em>dd4hep</em> project and a short description of their work can be found. If you think you should be part of this list, but somehow got forgotten, please contact us.</p> @@ -556,7 +556,7 @@ be part of this list, but somehow got forgotten, please contact us.</p> <h2>References</h2> <table> -<tr><td>[1]</td><td> <div id="bib_DD4hep"><a href="http://aidasoft.web.cern.ch/DD4hep">DD4hep web page</a>.</div> +<tr><td>[1]</td><td> <div id="bib_dd4hep"><a href="http://aidasoft.web.cern.ch/DD4hep">dd4hep web page</a>.</div> </td></tr> <tr><td>[2]</td><td> <div id="bib_ROOT-tgeo">R.Brun, A.Gheata, M.Gheata, "The ROOT geometry package",<br> Nuclear Instruments and Methods A 502 (2003) 676-680.</div> diff --git a/doc/DDAlignManual.pdf b/doc/DDAlignManual.pdf index 4ce768c98f5561218d6eafe6e8273de466324fbf..202844137b844052231830ae50beeaa951451bd1 100644 GIT binary patch delta 72 zcmbPu+i>D-!-f{d7N!>FEi5Z^nNm{PSLw0<F)I+W0WtgbRk|GavOyAEGdX~m6NtIC Scg^J9xdkY=-PMoBM;-tIa~shB delta 72 zcmbPu+i>D-!-f{d7N!>FEi5Z^nOt1jSLw0<F)I+W0WtgbRk|GavOyAEGdX~m6NtIC Scg^J9xdkY=-PMoBM;-v|1RD_m diff --git a/doc/DDEveManual.pdf b/doc/DDEveManual.pdf index 40132c8400f4f5f25e36b870233608e5479dc849..35eaab8a221bb6a5e38b4843415199f783dbb010 100644 GIT binary patch delta 76 zcmcb%CgRqbh=vx%7N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J(MQ7NHj57LgXw gEn<^cm{L-vPhk;r;c!VUNlh-vFWP>GMXX8?0P4;eApigX delta 72 zcmcb$CgR$fh=vx%7N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J(MQ7NHj57LgXw cEn<^cm|R?@Phk;rVexTxaoPTWMXX8?0DsLEz5oCK diff --git a/doc/Detector_constructor_naming_convention.txt b/doc/Detector_constructor_naming_convention.txt index 479dec7f8..d92c8150d 100644 --- a/doc/Detector_constructor_naming_convention.txt +++ b/doc/Detector_constructor_naming_convention.txt @@ -15,12 +15,12 @@ methods in order to avoid nameing clashes. experiment specific packages such as ddsim (for ILD). -- Generic DD4hep detectors will have the prefix DD4hep_ +- Generic dd4hep detectors will have the prefix dd4hep_ __or__ (to be discussed) -- Generic DD4hep detectors will have no prefix -- Generic DD4hep detector constructors reside in the package DDDetectors +- Generic dd4hep detectors will have no prefix +- Generic dd4hep detector constructors reside in the package DDDetectors (to be created) diff --git a/doc/LaTex/AIDA2020-LaTex-template.tar b/doc/LaTex/AIDA2020-LaTex-template.tar index d7c2e8e2a550657ce6bd979dafb597e8a2a56791..0b133d92be9577d0c6ac6a556981a5b549fef8d8 100644 GIT binary patch delta 78 zcmZo@ko@~!V#8BGwv^P8#LS${Zv=nB*v)U0+utZN0x=U1GjD&R%px(31EMacc)H+C WX1VFQFPPcejdrnYH`>K|t`z_|M<8|p delta 85 zcmezSU!tKwa>G+WcF(+$)S|q^&94Q2B6F0PCi621Hp{8C%c(H}F%u9oZ<kYJc`}(3 YswJm*y5LP_xps|REZa49v0iNj0Cp4~DgXcg diff --git a/doc/LaTex/DD4hep-Overview.tex b/doc/LaTex/DD4hep-Overview.tex index 2c8cc8b2d..4690a4652 100644 --- a/doc/LaTex/DD4hep-Overview.tex +++ b/doc/LaTex/DD4hep-Overview.tex @@ -15,7 +15,7 @@ detection techniques, constants required by alignment and calibration, description of the readout structures, conditions data, etc. \noindent -The design of the DD4hep toolkit\cite{bib:DD4hep} +The design of the dd4hep toolkit\cite{bib:dd4hep} is shaped on the experience of detector description systems, which were implemented for the LHC experiments, in particular the LHCb experiment~\cite{bib:LHCb,bib:LHCb-geometry}, @@ -25,7 +25,7 @@ the Linear Collider community~\cite{bib:ILD,bib:SiD}. Designing a coherent set of tools, with most of the basic components already existing in one form or another, is an opportunity for getting the best of all existing solutions. -DD4hep aims to widely reuse used existing software components, in particular +dd4hep aims to widely reuse used existing software components, in particular the ROOT geometry package~\cite{bib:ROOT-tgeo}, part of the ROOT project\cite{bib:ROOT}, a tool for building, browsing, navigating and visualizing detector geometries. The @@ -36,15 +36,15 @@ sophisticated 3D visualization functionality, which is ideal for building detector and event displays. The second component is the Geant4 simulation toolkit~\cite{bib:geant4}, which is used to simulate the detector response from particle collisions in complex designs. -In DD4hep the geometrical +In dd4hep the geometrical representation provided by ROOT is the main source of information. -In addition DD4hep provides the automatic conversions to other geometrical +In addition dd4hep provides the automatic conversions to other geometrical representations, such as Geant4, and the convenient usage of these components without the reinvention of the existing functionality. \noindent In Section~\ref{sec:architectural-concepts} the scope and the high-level -requirements of the DD4hep toolkit are elaborated (in the following +requirements of the dd4hep toolkit are elaborated (in the following also called "the toolkit"). This is basically the high level vision of the provided functionality to the experimental communities. In Section~\ref{sec:toolkit-design} the high-level or architectural design @@ -110,8 +110,8 @@ The following main requirements influenced the design of the toolkit: %============================================================================= \begin{figure}[h] \begin{center} - \includegraphics[height=80mm] {DD4hep_big_picture.png} - \caption{The components of the DD4hep detector geometry toolkit.} + \includegraphics[height=80mm] {dd4hep_big_picture.png} + \caption{The components of the dd4hep detector geometry toolkit.} \label{fig:dd4hep-big-picture} \end{center} \vspace{-0.4cm} @@ -139,7 +139,7 @@ The model and its components will be described in subsequence sections. %============================================================================= \noindent Inspired from the work of the linear collider detector -simulation~\cite{bib:LCDD,bib:lcsim}, the compact detector description is used +simulation~\cite{bib:Detector,bib:lcsim}, the compact detector description is used to define an ideal detector as typically used during the conceptual design phase of an experiment. The compact description in its minimalistic form is probably not going to @@ -150,7 +150,7 @@ with deviations from the ideal would be needed by the experiment. \noindent In the compact description the detector is parametrized in minimalistic terms with user provided parameters in XML. -XML is an open format, the DD4hep parsers do not validate against a fix schema +XML is an open format, the dd4hep parsers do not validate against a fix schema and hence allow to easily introduce new elements and attributes to describe detectors. This feature minimizes the burden on the end-user while still supporting flexibility. @@ -163,7 +163,7 @@ general manner, therefore so called $Detector$ $Constructors$ are needed. %============================================================================= %\begin{figure}[h] % \begin{center} -% \includegraphics[width=16cm] {DD4hep_compact_xml.png} +% \includegraphics[width=16cm] {dd4hep_compact_xml.png} % \caption{An example sniplett of the compact detector description. The % example shows the description of a 2 layered silicon vertex % detector.} @@ -199,15 +199,15 @@ The compact description together with the detector constructors are sufficient to build the detector model and to visualize it. If during the lifetime of the experiment the detector model changes, the corresponding constructors will need to be adapted accordingly. -DD4hep provides already a palette of basic pre-implemented geometrical detector -concepts to design experiments. In view of usage of DD4hep as a detector +dd4hep provides already a palette of basic pre-implemented geometrical detector +concepts to design experiments. In view of usage of dd4hep as a detector description toolkit, this library may in the future also adopt generic designs of detector components created by end users e.g. during the design phase of future experiments. %============================================================================= \begin{figure}[t] \begin{center} - \includegraphics[height=110mm] {DD4hep_classes.png} + \includegraphics[height=110mm] {dd4hep_classes.png} \caption{Class diagram with the main classes and their relations for the Generic Detector Description Model. The implementing ROOT classes are shown in brackets.} @@ -220,7 +220,7 @@ phase of future experiments. %============================================================================= \noindent -This is the heart of the DD4hep detector description toolkit. Its purpose is +This is the heart of the dd4hep detector description toolkit. Its purpose is to build in memory a model of the detector including its geometrical aspects as well as structural and functional aspects. The design reuses the elements from the ROOT geometry package and extends them in case required functionality @@ -240,7 +240,7 @@ the all TPC geometrical dimensions, the alignment and calibration constants and other slow varying conditions such as the gas pressure, end-plate temperatures etc. The $Detector$ $Element$ acts as a data concentrator. Applications may access the full experiment geometry and all connected data -through a singleton object called $LCDD$, which provides +through a singleton object called $Detector$, which provides management, bookkeeping and ownership to the model instances. \noindent @@ -277,7 +277,7 @@ to daughter starting from the top-level volume. %============================================================================= \begin{figure}[t] \begin{center} - \includegraphics[height=85mm] {DD4hep_detelement_tree.png} + \includegraphics[height=85mm] {dd4hep_detelement_tree.png} \caption{The object diagram of a hypothetical TPC detector showing in parallel the $Detector$ $Element$ and the $Geometry$ hierarchy and the relationships between the objects.} @@ -337,7 +337,7 @@ simulation, tracking, etc. %============================================================================= \begin{figure}[t] \begin{center} - \includegraphics[width=115mm] {DD4hep-extensions.png} + \includegraphics[width=115mm] {dd4hep-extensions.png} \caption{Extensions may be attached to common Detector Elements which extend the functionality of the common DetElement class and support e.g. caching of precomputed values.} @@ -368,7 +368,7 @@ This design allows to build views addressing the following use-cases: \noindent Detector-simulation depends strongly on the use of an underlying simulation toolkit, the most prominent candidate nowadays being Geant4~\cite{bib:geant4}. -DD4hep supports simulation activities with Geant4 providing +dd4hep supports simulation activities with Geant4 providing an automatic translation mechanism between geometry representations. The simulation response in the active elements of the detector is not implemented by the toolkit, since it is strongly influenced by the technical @@ -377,7 +377,7 @@ In Geant4 this response is computed in software constructs called $Sensitive$ $Detectors$. \noindent -Ideally DD4hep aims to provide a generic simulation application. +Ideally dd4hep aims to provide a generic simulation application. Similar to the palette of pre-implemented geometrical detector concepts to design experiments, it provides a palette of $Sensitive$ $Detectors$ to simulate the detector response in form of a component library. diff --git a/doc/LaTex/DD4hep-bibliography.tex b/doc/LaTex/DD4hep-bibliography.tex index 1985339d4..5bd35c51a 100644 --- a/doc/LaTex/DD4hep-bibliography.tex +++ b/doc/LaTex/DD4hep-bibliography.tex @@ -1,4 +1,4 @@ -\bibitem{bib:DD4hep} DD4Hep web page, http://aidasoft.web.cern.ch/DD4hep. +\bibitem{bib:dd4hep} DD4Hep web page, http://aidasoft.web.cern.ch/DD4hep. \bibitem{bib:LHCb} LHCb Collaboration, "LHCb, the Large Hadron Collider beauty experiment, reoptimised detector @@ -6,11 +6,11 @@ \bibitem{bib:LHCb-geometry} S. Ponce et al., "Detector Description Framework in LHCb", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), La Jolla, CA, 2003, proceedings. \bibitem{bib:ILD} The ILD Concept Group, - "The International Large Detector: Letter of Intent",\\ + "The detailtional Large Detector: Letter of Intent",\\ ISBN 978-3-935702-42-3, 2009. \bibitem{bib:SiD} H. Aihara, P. Burrows, M. Oreglia (Editors), @@ -28,15 +28,15 @@ "Geant4 - A Simulation Toolkit", \\ Nuclear Instruments and Methods {\bf{A}} 506 (2003) 250-303. -\bibitem{bib:LCDD} T.Johnson et al., +\bibitem{bib:Detector} T.Johnson et al., "LCGO - geometry description for ILC detectors", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2007), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2007), Victoria, BC, Canada, 2012, Proceedings. \bibitem{bib:lcsim} N.Graf et al., "lcsim: An integrated detector simulation, reconstruction and analysis environment", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2012), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2012), New York, 2012, Proceedings. \bibitem{bib:GDML} R. Chytracek et al., diff --git a/doc/LaTex/DD4hep-setup.tex b/doc/LaTex/DD4hep-setup.tex index 21cf6d4e5..16a39b191 100644 --- a/doc/LaTex/DD4hep-setup.tex +++ b/doc/LaTex/DD4hep-setup.tex @@ -1,7 +1,7 @@ % \input{setup/AIDA2020-setup.tex} % -% === Command to insert http links to the DD4hep geomtery package +% === Command to insert http links to the dd4hep geomtery package % \newcommand{\detdesc}[2] { @@ -19,8 +19,8 @@ \href{http://root.cern.ch/root/html/#1:#2}{#3} } \newcommand{\DDE}{{$\tt{DDEve}$\space}} -\newcommand{\DDhep}{{$\tt{DD4hep}$\space}} -\newcommand{\DDH}{{$\tt{DD4hep}$\space}} +\newcommand{\DDhep}{{$\tt{dd4hep}$\space}} +\newcommand{\DDH}{{$\tt{dd4hep}$\space}} \newcommand{\DDG}{{\tt{DDG4}\space}} \newcommand{\DDA}{{\tt{DDAlign}\space}} \newcommand{\DDC}{{\tt{DDCond}\space}} diff --git a/doc/LaTex/DD4hepManual.tex b/doc/LaTex/DD4hepManual.tex index 0170a1f5e..1b29ea2cb 100644 --- a/doc/LaTex/DD4hepManual.tex +++ b/doc/LaTex/DD4hepManual.tex @@ -1,15 +1,15 @@ %============================================================================= \documentclass[10pt,a4paper]{article} % -\input{DD4hep-setup.tex} +\input{dd4hep-setup.tex} % -\pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{DD4hep User Manual}}} +\pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{dd4hep User Manual}}} % % \begin{document} % \mytitle{ -DD4hep +dd4hep }{ A Detector Description Toolkit\\ for High Energy Physics\\ @@ -27,7 +27,7 @@ Experiments \begin{abstract} \normalsize -\input{DD4hep-abstract.tex} +\input{dd4hep-abstract.tex} \end{abstract} \vspace{8cm} @@ -61,7 +61,7 @@ version & Date & Author \\[0.2cm] \hline %== Introduction =========================================================== \pagenumbering{arabic} \setcounter{page}{1} -\input{DD4hep-Overview.tex} +\input{dd4hep-Overview.tex} \noindent The alignment support will be subject to a separate development line of the @@ -97,7 +97,7 @@ This includes a discussion of the features of the \DDhep detector description and of its structure. %============================================================================= -\subsection{Building DD4hep} +\subsection{Building dd4hep} \label{sec:dd4hep-user-manual-building} %============================================================================= @@ -123,7 +123,7 @@ to ROOT's TGeom classes. \label{sec:dd4hep-user-manual-platforms} %============================================================================= \noindent -Supported platforms for DD4hep are the CERN Linux operating systems: +Supported platforms for dd4hep are the CERN Linux operating systems: \begin{itemize} \item \tw{Scientic} \tw{Linux} \tw{CERN} \tw{6} \item \tw{Scientic} \tw{Linux} \tw{CERN} \tw{7} - once approved. @@ -136,7 +136,7 @@ be actively supported by users who submit the necessary patches. \label{sec:dd4hep-user-manual-prerequisites} %============================================================================= \noindent -DD4hep depends on a number of $external$ packages. +dd4hep depends on a number of $external$ packages. The user will need to install these in his/her system before building and running the examples \begin{itemize}\itemcompact @@ -154,7 +154,7 @@ in the future.} \newpage %============================================================================= -\subsubsection{CMake Build Options for DD4hep} +\subsubsection{CMake Build Options for dd4hep} \label{sec:dd4hep-user-manual-building} %============================================================================= \noindent @@ -238,7 +238,7 @@ The following steps are necessary to build \DDhep: \item First checkout code from the repository: \begin{unnumberedcode} - svn co https://svnsrv.desy.de/public/aidasoft/DD4hep/trunk DD4hep + svn co https://svnsrv.desy.de/public/aidasoft/DD4hep/trunk dd4hep \end{unnumberedcode} \vspace{-0.6cm} @@ -305,7 +305,7 @@ Users must be aware of this fact. \newpage %============================================================================= -\subsection{DD4hep Handles} +\subsection{dd4hep Handles} \label{sec:dd4hep-user-manual-handles} %============================================================================= \noindent @@ -377,8 +377,8 @@ The handles to these objects serve two purposes: \item Enable the creation of new objects using specialized constructors within sub-classes. To ensure memory integrity and avoid resource leaks these created objects should always be stored in the - detector description data hub $LCDD$ described in - section~\ref{sec:dd4hep-user-manual-LCDD-hub}. + detector description data hub $Detector$ described in + section~\ref{sec:dd4hep-user-manual-Detector-hub}. \end{itemize} \newpage @@ -443,8 +443,8 @@ cache the pointer withing the client code if the usage is very frequent. \noindent There are currently three object types present which support this mechanism: \begin{itemize}\itemcompact -\item the central object of \DDhep, the \tw{LCDD} class discussed in - section~\ref{sec:dd4hep-user-manual-LCDD-hub}. +\item the central object of \DDhep, the \tw{Detector} class discussed in + section~\ref{sec:dd4hep-user-manual-Detector-hub}. \item the object describing subdetectors or parts thereof, the \tw{DetElement} class discussed in section~\ref{sec:dd4hep-user-manual-detector-elements}. @@ -519,7 +519,7 @@ looks very similar: In the above code snippet an XML (sub-)tree is passed to the executing function as a handle to an XML element ({\tt{xml\_h}}). Such handles may seamlessly be assigned to any supporting helper class inheriting from the -class {\tt{XML::Element}}, which encapsulates the functionality required to +class {\tt{xml::Element}}, which encapsulates the functionality required to interpret the XML structures. Effectively the various XML attributes and child nodes are accessed using functions with the same @@ -533,7 +533,7 @@ Note the macros $\tt{\_U(layer)}$ and $\tt{\_U(slice)}$: When using Xerces-C as an XML parser, it will expand to the reference to an object containing the unicode value of the string "layer". The full list of predefined tag names can be found in the -include file \detdesc{html/_unicode_values_8h.html}{DD4hep/UnicodeValues.h}. +include file \detdesc{html/_unicode_values_8h.html}{dd4hep/UnicodeValues.h}. If a user tag is not part in the precompiled tag list, the corresponding Unicode string may be created with the macro \tw{\_Unicode(layer)} or the function \tw{Unicode("layer")}. @@ -550,29 +550,29 @@ of defining new attribute names. There exist several utility classes to extract data from predefined XML tags: \begin{itemize}\itemcompact \item Any XML element is described by an XML handle - \detdesc{html/struct_d_d4hep_1_1_geometry_1_1_handle.html}{\tt{XML::Handle\_t}} + \detdesc{html/struct_d_d4hep_1_1_geometry_1_1_handle.html}{\tt{xml::Handle_t\_t}} ({\tt{xml\_t}}). Handles are the basic structure for the support of higher level interfaces described above. The assignment of a handle to any of the interfaces below is possible. -\item The class \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_element.html}{\tt{XML::Element}} +\item The class \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_element.html}{\tt{xml::Element}} ({\tt{xml\_elt\_t}}) supports in a simple way the navigation through the hierarchy of the XML tree accessing child nodes and attributes. Attributes at this level are named entities and the tag name must be supplied. -\item The class \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_dimension.html}{\tt{XML::Dimension}} +\item The class \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_dimension.html}{\tt{xml::Dimension}} with the type definition {\tt{xml\_dim\_t}}, supports numerous access functions named identical to the XML attribute names. Such helper classes simplify the tedious string handling required by the -\item The class \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_component.html}{\tt{XML::Component}} +\item The class \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_component.html}{\tt{xml::Component}} ({\tt{xml\_comp\_t}}) and \\ - the class \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_det_element.html}{\tt{XML::Detector}} + the class \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_det_element.html}{\tt{xml::Detector}} ({\tt{xml\_det\_t}}) resolving other issues useful to construct detectors. \item Sequences of XML elements with an identical tag name may be handled as iterations as shown in the Figure above using the class - \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_collection__t.html}{\tt{XML::Collection\_t}}. + \detdesc{html/struct_d_d4hep_1_1_x_m_l_1_1_collection__t.html}{\tt{xml::Collection\_t}}. \item Convenience classes, which allow easy access to element attributes - may easily be constructed using the methods of the {\tt{XML::Element}} + may easily be constructed using the methods of the {\tt{xml::Element}} class. This allows to construct very flexible thou non-intrusive extensions to \DDhep. Hence there is a priori no need to modify these helpers for the benefit of only one single client. @@ -583,7 +583,7 @@ from an XML element, which exist. If an attribute, a child node etc. is not found within the element an exception is thrown. \noindent -The basic interface of the \tw{XML::Element} class allows to access tags +The basic interface of the \tw{xml::Element} class allows to access tags and child nodes not exposed by the convenience wrappers: \begin{code} /// Access the tag name of this DOM element @@ -607,32 +607,32 @@ and child nodes not exposed by the convenience wrappers: /// Check the existence of a child with a given tag name bool hasChild(const XmlChar* tag) const; /// Access child by tag name. Thow an exception if required in case the child is not present - Handle_t child(const Strng_t& tag, bool except = true) const; + Handle child(const Strng_t& tag, bool except = true) const; /// Add a new child to the DOM node - Handle_t addChild(const XmlChar* tag) const; + Handle addChild(const XmlChar* tag) const; /// Check if a child with the required tag exists - if not create it and add it to the current node - Handle_t setChild(const XmlChar* tag) const; + Handle setChild(const XmlChar* tag) const; \end{code} %============================================================================= -\subsection{The Detector Description Data Hub: LCDD} -\label{sec:dd4hep-user-manual-LCDD-hub} +\subsection{The Detector Description Data Hub: Detector} +\label{sec:dd4hep-user-manual-Detector-hub} %============================================================================= \noindent As shown in Figure~\ref{fig:dd4hep-detector-model}, any access to the detector -description data is done using a standardized interface called \tw{LCDD}. +description data is done using a standardized interface called \tw{Detector}. During the configuration phase of the detector the interface is used to populate the internal data structures. Data structures present in the memory layout of the detector description may be retrieved by clients at any time using the -\detdesc{html/struct_d_d4hep_1_1_geometry_1_1_l_c_d_d.html}{\tw{LCDD} interface class}. +\detdesc{html/struct_d_d4hep_1_1_geometry_1_1_l_c_d_d.html}{\tw{Detector} interface class}. This includes of course, the access during the actual detector construction. The following code listing shows the accessor method to retrieve detector description entities from the interface. Not shown are access methods for groups of these entities and the methods to add objects: \begin{code} -struct LCDD { +struct Detector { ///+++ Shortcuts to access often used quantities @@ -695,7 +695,7 @@ struct LCDD { \end{code} \noindent -As shown in the above listing, the \tw{LCDD} interface is the main access point to access +As shown in the above listing, the \tw{Detector} interface is the main access point to access a whole set \begin{itemize}\itemcompact \item often used predefined values such as the material "air" or "vacuum" (line 5-10). @@ -748,7 +748,7 @@ actually very similar to other geometry description languages based on XML. For example the material description is nearly identical to the material description in \tw{GDML}~\cite{bib:GDML}. The syntactic structure of the compact XML description was taken from -the SiD detector description~\cite{bib:LCDD}. +the SiD detector description~\cite{bib:Detector}. The following listing shows the basic layout of any the compact detector description file with its different sections: @@ -994,13 +994,13 @@ description of the material's finish.}. Materials are not constructed by any client. Materials and elements are either already present in the the corresponding tables of the ROOT geometry package or they are added during the interpretation of the XML input. -Clients access the description of material using the \tw{LCDD} interface. +Clients access the description of material using the \tw{Detector} interface. \newpage \begin{figure}[t] \begin{center} - \includegraphics[width=160mm] {DD4hep-solids.png} + \includegraphics[width=160mm] {dd4hep-solids.png} \caption{Extensions may be attached to common Detector Elements which extend the functionality of the common DetElement class and support e.g. caching of precomputed values.} @@ -1278,7 +1278,7 @@ mother volume: \begin{code} Volume mother = ....ampercent - Material mat (lcdd.material("Iron")); + Material mat (description.material("Iron")); Tube tub (rmin, rmax, zhalf); Volume vol (name, tub, mat); Transform3D tr (RotationZYX(rotz,roty,rotx),Position(x,y,z)); @@ -1290,7 +1290,7 @@ The volume has the shape of a tube and consists of iron. Before being placed, the daughter volume is transformed within the mother coordinate system according to the requested transformation. The example also illustrates how to access $Material$ objects from the -$LCDD$ interface. +$Detector$ interface. \noindent The {\tt{Volume}} class provides several possibilities to declare @@ -1344,7 +1344,7 @@ are placed. %============================================================================= \begin{figure}[b] \begin{center} - \includegraphics[width=160mm] {DD4hep-detelement-drawing.png} + \includegraphics[width=160mm] {dd4hep-detelement-drawing.png} \caption{The basic layout of the \tw{DetElement} class aggregating all data entities necessary to process data.} \label{fig:dd4hep-user-manual-detelement-drawing} @@ -1451,7 +1451,7 @@ a \tw{DetElement} instance has the means to provide to clients information about \noindent Though the concept of sensitive detectors comes from Geant4 and simulation -activities, in DD4hep the sensitive detectors are the client interface to +activities, in dd4hep the sensitive detectors are the client interface to access the readout description (class \tw{Readout}) with its segmentation of sensitive elements (class \tw{Segmentation}) and the description of hit decoders (class \tw{IDDescriptors}). @@ -1488,8 +1488,8 @@ information~\footnote{The methods to set the data are not shown here.}: \begin{figure}[h] \begin{center} - \includegraphics[width=140mm] {DD4hep-sensitive-detectors.png} - \caption{The structure of DD4hep sensitive detectors.} + \includegraphics[width=140mm] {dd4hep-sensitive-detectors.png} + \caption{The structure of dd4hep sensitive detectors.} \label{fig:dd4hep-sensitive-detectors} \end{center} \vspace{-0.6cm} @@ -1530,7 +1530,7 @@ encoded using the \tw{IDDescriptor} object. \begin{figure}[h] \begin{center} - \includegraphics[width=100mm] {DD4hep-readout.png} + \includegraphics[width=100mm] {dd4hep-readout.png} \caption{The basic components to describe the \tw{Readout} structure of a subdetector. } \label{fig:dd4hep-sensitive-detectors} @@ -1571,7 +1571,7 @@ the energy deposits in a subdetector. For technical reasons and partial religious reasons are the segmentation implementation not part of the \DDhep toolkit, but an independent package call \tw{DDSegmentation}~\cite{bib:DDSegmentations}. Though the usage is an -integral part of DD4hep. +integral part of dd4hep. \subsubsection{Volume Manager} %============================================================================= @@ -1591,7 +1591,7 @@ geometrical location. Figure~\ref{fig:dd4hep-user-manual-volmgr} shows the design diagram of this component: \begin{figure}[h] \begin{center} - \includegraphics[width=170mm] {DD4hep-volmgr.png} + \includegraphics[width=170mm] {dd4hep-volmgr.png} \caption{Extensions may be attached to common Detector Elements which extend the functionality of the common DetElement class and support e.g. caching of precomputed values.} @@ -1790,10 +1790,10 @@ The C++ code snippet interpreting the XML data and expanding the geometry: #include "XML/Layering.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; string det_name = x_det.nameStr(); bool reflect = x_det.reflect(); @@ -1803,7 +1803,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double rmax = dim.outer_r(); double totWidth = Layering(x_det).totalThickness(); double z = zmin; - Material air = lcdd.air(); + Material air = description.air(); Tube envelope (rmin,rmax,totWidth,0,2*M_PI); Volume envelopeVol(det_name+"_envelope",envelope,air); int layer_num = 1; @@ -1825,19 +1825,19 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_comp_t x_slice = l; double w = x_slice.thickness(); string slice_name = layer_name + _toString(m+1,"slice%d"); - Material slice_mat = lcdd.material(x_slice.materialStr()); + Material slice_mat = description.material(x_slice.materialStr()); Volume slice_vol (slice_name,Tube(rmin,rmax,w),slice_mat); if ( x_slice.isSensitive() ) { sens.setType("calorimeter"); slice_vol.setSensitiveDetector(sens); } - slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + slice_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); pv = layer_vol.placeVolume(slice_vol,Position(0,0,z-zlayer-layerWidth/2+w/2)); pv.addPhysVolID("slice",m+1); z += w; } - layer_vol.setVisAttributes(lcdd,x_layer.visStr()); + layer_vol.setVisAttributes(description,x_layer.visStr()); Position layer_pos(0,0,zlayer-zmin-totWidth/2+layerWidth/2); pv = envelopeVol.placeVolume(layer_vol,layer_pos); pv.addPhysVolID("layer",layer_num); @@ -1845,10 +1845,10 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } } // Set attributes of slice - envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + envelopeVol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); DetElement sdet(det_name,x_det.id()); - Volume motherVol = lcdd.pickMotherVolume(sdet); + Volume motherVol = description.pickMotherVolume(sdet); PlacedVolume phv = motherVol.placeVolume(envelopeVol,Position(0,0,zmin+totWidth/2)); phv.addPhysVolID("system",sdet.id()) .addPhysVolID("barrel",1); @@ -1880,7 +1880,7 @@ DECLARE_DETELEMENT(CylindricalEndcapCalorimeter,create_detector); \docline{10,11}{Extracting the sub-detector name and properties from the xml handle.} \docline{12-17}{Access the $dimension$ child-element from the XML subtree, access the element's attributes and precompute values used later.} -\docline{18}{Retrieve a reference to the "air" material from LCDD.} +\docline{18}{Retrieve a reference to the "air" material from Detector.} \docline{19-20}{Construct the envelope volume shaped as a tube made out of air.} \docline{25}{Now the detector can be built: We loop over all layers types and over each layer type as often as necessary (attribute: repeat). @@ -1889,7 +1889,7 @@ DECLARE_DETELEMENT(CylindricalEndcapCalorimeter,create_detector); \docline{25}{Note the macro $\tt{\_U(layer)}$: When using Xerces-C as an XML parser, it will expand to the reference to an object containing the unicode value of the string "layer". The full list of predefined tag names can be found in the - include file \detdesc{html/_unicode_values_8h.html}{DD4hep/UnicodeValues.h}. + include file \detdesc{html/_unicode_values_8h.html}{dd4hep/UnicodeValues.h}. If a user tag is not part in the precompiled tag list, the corresponding Unicode string may be created with the macro \tw{\_Unicode(layer)} or \tw{Unicode("layer")}. } @@ -1962,8 +1962,8 @@ discussed in section~\ref{sec:dd4hep-manual-detector-constructors}. \begin{figure}[h] \begin{center} \begin{tabular}{l r} - \includegraphics[width=80mm] {DD4hep-Lumical.png} & - \includegraphics[width=80mm] {DD4hep-Lumical-detailed.png} \\ + \includegraphics[width=80mm] {dd4hep-Lumical.png} & + \includegraphics[width=80mm] {dd4hep-Lumical-detailed.png} \\ \end{tabular} \caption{Geometry visualization using the ROOT OpenGL plugin. To the left the entire luminosity calorimeter is shown, @@ -1974,18 +1974,18 @@ discussed in section~\ref{sec:dd4hep-manual-detector-constructors}. \end{figure} \noindent -The command to create the display is part of the DD4hep release: +The command to create the display is part of the dd4hep release: \begin{code} $> geoDisplay -compact <path to the XML file containing the detector description> - DD4hepGeometryDisplay -opt [-opt] + dd4hepGeometryDisplay -opt [-opt] -compact <file> Specify the compact geometry file [REQUIRED] At least one compact geo file is required! -build_type <number/string> Specify the build type [OPTIONAL] MUST come immediately after the -compact input. Default for each file is: BUILD_DEFAULT [=1] Allowed values: BUILD_SIMU [=1], BUILD_RECO [=2] or BUILD_DISPLAY [=3] - -destroy [OPTIONAL] Force destruction of the LCDD instance + -destroy [OPTIONAL] Force destruction of the Detector instance before exiting the application -volmgr [OPTIONAL] Load and populate phys.volume manager to check the volume ids for duplicates etc. @@ -2006,7 +2006,7 @@ $> geoDisplay -compact <path to the XML file containing the detector description Other applications may require other representation. In particular two other are worth mentioning: \begin{itemize}\itemcompact -\item \tw{LCDD}~\cite{bib:LCDD} the geometry representation used to +\item \tw{Detector}~\cite{bib:Detector} the geometry representation used to simulate the ILC detector design with the \tw{slic} application. \item \tw{GDML}~\cite{bib:GDML} a geometry markup language understood by Geant4 and \tw{ROOT}. @@ -2015,7 +2015,7 @@ Both conversions are supported in \DDhep with the geoConverter application: \begin{code} geoConverter -opt [-opt] Action flags: Usage is exclusive, 1 required! - -compact2lcdd Convert compact xml geometry to lcdd. + -compact2description Convert compact xml geometry to description. -compact2gdml Convert compact xml geometry to gdml. -compact2vis Convert compact xml to visualisation attrs @@ -2068,7 +2068,7 @@ please refer to the ROOT documentation of the class {\tt{TGeoManager}}: \end{itemize} \begin{code} - python <install>DD4hep/bin/checkGeometry.py --help + python <install>dd4hep/bin/checkGeometry.py --help Usage: checkGeometry.py [options] TGeo Geometry checking. @@ -2140,7 +2140,7 @@ program are: [OPTIONAL] MUST come immediately after the -compact input. Default for each file is: BUILD_DEFAULT [=1] Allowed values: BUILD_SIMU [=1], BUILD_RECO [=2] or BUILD_DISPLAY [=3] - -destroy [OPTIONAL] Force destruction of the LCDD instance + -destroy [OPTIONAL] Force destruction of the Detector instance before exiting the application -volmgr [OPTIONAL] Load and populate phys.volume manager to check the volume ids for duplicates etc. @@ -2155,10 +2155,10 @@ program are: %============================================================================= \newpage \begin{thebibliography}{9} -\input{DD4hep-bibliography.tex} +\input{dd4hep-bibliography.tex} \bibitem{bib:DDAlign} M.Frank, "DDAlign User Manual: - Alignment Support for the DD4hep Geometry Description Toolkit". + Alignment Support for the dd4hep Geometry Description Toolkit". \bibitem{bib:DDSegmentations} C.Grefe et al., "The DDSegmentation package", Non existing documentation to be written. diff --git a/doc/LaTex/DD4hepPaper.tex b/doc/LaTex/DD4hepPaper.tex index 85462cfe2..5c6cd9241 100644 --- a/doc/LaTex/DD4hepPaper.tex +++ b/doc/LaTex/DD4hepPaper.tex @@ -4,7 +4,7 @@ \begin{document} \title{ \vspace{-3cm}.\\ -DD4hep: A Detector Description Toolkit \\ +dd4hep: A Detector Description Toolkit \\ for High Energy Physics Experiments} \author{ @@ -20,15 +20,15 @@ P.Mato\textsuperscript{1} \ead{Markus.Frank@cern.ch} \begin{abstract} -\input{DD4hep-abstract.tex} +\input{dd4hep-abstract.tex} \end{abstract} -\input{DD4hep-Overview.tex} +\input{dd4hep-Overview.tex} \vspace{-0.1cm} \section*{References} \begin{thebibliography}{9} -\input{DD4hep-bibliography.tex} +\input{dd4hep-bibliography.tex} \end{thebibliography} \end{document} \ No newline at end of file diff --git a/doc/LaTex/DDAlignDesign.tex b/doc/LaTex/DDAlignDesign.tex index de0b40207..cfb3d5c71 100644 --- a/doc/LaTex/DDAlignDesign.tex +++ b/doc/LaTex/DDAlignDesign.tex @@ -1,10 +1,10 @@ %============================================================================= \documentclass[10pt,a4paper]{article} % -\input{DD4hep-setup.tex} +\input{dd4hep-setup.tex} % \pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{Software Design of the Alignment -Extension of the DD4hep Detector Description Toolkit\\ +Extension of the dd4hep Detector Description Toolkit\\ }}} % \begin{document} @@ -15,7 +15,7 @@ DDAlign }{ Alignment Support for the \\ \vspace{0.5cm} -DD4hep Geometry Description \\ +dd4hep Geometry Description \\ \vspace{0.5cm} Toolkit } @@ -142,7 +142,7 @@ document the support for alignment with its programming interfaces. %============================================================================= \begin{figure}[h] \begin{center} - \includegraphics[height=90mm] {DD4hep_classes.png} + \includegraphics[height=90mm] {dd4hep_classes.png} \caption{Class diagram with the main classes and their relations for the Generic Detector Description Model. The implementing ROOT classes are shown in brackets.} @@ -156,12 +156,12 @@ document the support for alignment with its programming interfaces. %============================================================================= \noindent -This is the heart of the DD4hep detector description toolkit. Its purpose is +This is the heart of the dd4hep detector description toolkit. Its purpose is to build in memory a model of the detector including its geometrical aspects as well as structural and functional aspects. The design reuses the elements from the ROOT geometry package and extends them in case required functionality is not available. Figure~\ref{fig:dd4hep-detector-model} illustrates the main -players and their relationships~\cite{bib:DD4hep}. +players and their relationships~\cite{bib:dd4hep}. Any detector is modeled as a tree of $Detector$ $Elements$, the entity central to this design, which is represented in the implementation by the $DetElement$ class~\cite{bib:LHCb-geometry}. It offers all @@ -176,7 +176,7 @@ the all TPC geometrical dimensions, the alignment and calibration constants and other slow varying conditions such as the gas pressure, end-plate temperatures etc. The $Detector$ $Element$ acts as a data concentrator. Applications may access the full experiment geometry and all connected data -through a singleton object called $LCDD$, which provides +through a singleton object called $Detector$, which provides management, bookkeeping and ownership to the model instances. \noindent @@ -190,7 +190,7 @@ is described in the following. %============================================================================= \begin{figure}[h] \begin{center} - \includegraphics[height=75mm] {DD4hep_detelement_tree.png} + \includegraphics[height=75mm] {dd4hep_detelement_tree.png} \caption{The object diagram of a hypothetical TPC detector showing in parallel the $Detector$ $Element$ and the $Geometry$ hierarchy and the relationships between the objects.} @@ -423,7 +423,7 @@ The simulation of such a geometry with applied alignment parameters can rather easily be realized using using the \DDhep, \DDA and the \DDG frameworks: \begin{itemize}\itemcompact \item The ideal geometry is constructed using the standard procedures - of \DDhep\cite{bib:DD4hep}. + of \DDhep\cite{bib:dd4hep}. \item Then the alignment parameters are applied. \item Finally the corrected geometry is translated to $Geant4$~\cite{bib:geant4} using the \DDG\cite{bib:DDG4} package. @@ -572,7 +572,7 @@ $DetElement$ entities. \noindent The interface of the $Alignment$ structure to access detector -alignment parameters is as follows (see also the corresponding header file DD4hep/Alignment.h): +alignment parameters is as follows (see also the corresponding header file dd4hep/Alignment.h): \begin{code} /// Number of nodes in this branch (=depth of the placement hierarchy from the top level volume) int numNodes() const; @@ -650,20 +650,20 @@ There are multiple possibilities to apply alignment parameters: \newpage %============================================================================= \begin{thebibliography}{9} -\bibitem{bib:DD4hep} M. Frank et al, "DD4hep: A Detector Description Toolkit +\bibitem{bib:dd4hep} M. Frank et al, "dd4hep: A Detector Description Toolkit for High Energy Physics Experiments", - International Conference on Computing in High Energy and Nuclear Physics + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2013), \\ Amsterdam, Netherlands, 2013, proceedings. \bibitem{bib:LHCb-geometry} S. Ponce et al., "Detector Description Framework in LHCb", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), La Jolla, CA, 2003, proceedings. \bibitem{bib:chris-parkes-priv-comm} C. Parkes, private communications. \bibitem{bib:DDG4} M.Frank, "DDG4 - A Simulation Toolkit for High Energy Physics Experiments using Geant4 \\ - and the DD4hep Geometry Description". + and the dd4hep Geometry Description". \bibitem{bib:ROOT-tgeo} R.Brun, A.Gheata, M.Gheata, "The ROOT geometry package",\\ Nuclear Instruments and Methods {\bf{A}} 502 (2003) 676-680. \bibitem{bib:geant4} S. Agostinelli et al., diff --git a/doc/LaTex/DDAlignManual.V2.tex b/doc/LaTex/DDAlignManual.V2.tex index a963f4821..9b2f73053 100644 --- a/doc/LaTex/DDAlignManual.V2.tex +++ b/doc/LaTex/DDAlignManual.V2.tex @@ -1,7 +1,7 @@ %============================================================================= \documentclass[10pt,a4paper]{article} % -\input{DD4hep-setup.tex} +\input{dd4hep-setup.tex} % \pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{DDAlign User Manual}}} % @@ -13,7 +13,7 @@ DDAlign }{ Alignment Support for the \\ \vspace{0.5cm} -DD4hep Geometry Description \\ +dd4hep Geometry Description \\ \vspace{0.5cm} Toolkit \vspace{2cm} @@ -139,7 +139,7 @@ document the support for alignment with its programming interfaces. %============================================================================= \begin{figure}[h] \begin{center} - \includegraphics[height=90mm] {DD4hep_classes.png} + \includegraphics[height=90mm] {dd4hep_classes.png} \caption{Class diagram with the main classes and their relations for the Generic Detector Description Model. The implementing ROOT classes are shown in brackets.} @@ -153,12 +153,12 @@ document the support for alignment with its programming interfaces. %============================================================================= \noindent -This is the heart of the DD4hep detector description toolkit. Its purpose is +This is the heart of the dd4hep detector description toolkit. Its purpose is to build in memory a model of the detector including its geometrical aspects as well as structural and functional aspects. The design reuses the elements from the ROOT geometry package and extends them in case required functionality is not available. Figure~\ref{fig:dd4hep-detector-model} illustrates the main -players and their relationships~\cite{bib:DD4hep}. +players and their relationships~\cite{bib:dd4hep}. Any detector is modeled as a tree of $Detector$ $Elements$, the entity central to this design, which is represented in the implementation by the $DetElement$ class~\cite{bib:LHCb-geometry}. It offers all @@ -173,7 +173,7 @@ the all TPC geometrical dimensions, the alignment and calibration constants and other slow varying conditions such as the gas pressure, end-plate temperatures etc. The $Detector$ $Element$ acts as a data concentrator. Applications may access the full experiment geometry and all connected data -through a singleton object called $LCDD$, which provides +through a singleton object called $Detector$, which provides management, bookkeeping and ownership to the model instances. \noindent @@ -188,7 +188,7 @@ is described in the following. %============================================================================= \begin{figure}[h] \begin{center} - \includegraphics[height=75mm] {DD4hep_detelement_tree.png} + \includegraphics[height=75mm] {dd4hep_detelement_tree.png} \caption{The object diagram of a hypothetical TPC detector showing in parallel the $Detector$ $Element$ and the $Geometry$ hierarchy and the relationships between the objects.} @@ -456,7 +456,7 @@ The simulation of such a geometry with applied alignment parameters can rather easily be realized using using the \DDhep, \DDA and the \DDG frameworks: \begin{itemize}\itemcompact \item The ideal geometry is constructed using the standard procedures - of \DDhep~\cite{bib:DD4hep}. + of \DDhep~\cite{bib:dd4hep}. \item Then the alignment parameters are applied and finally \item the corrected geometry is translated to $Geant4$~\cite{bib:geant4} using the \DDG~\cite{bib:DDG4} package. @@ -499,7 +499,7 @@ code snippet: \begin{code} /// First install the global alignment cache to build proper transactions - GlobalAlignmentCache* cache = GlobalAlignmentCache::install(lcdd); + GlobalAlignmentCache* cache = GlobalAlignmentCache::install(description); /// Now create the tranaction context. There may only be one context present GlobalAlignmentStack::create(); @@ -508,7 +508,7 @@ code snippet: /// Now we can push any number of global alignment entries to the stack: DetElement elt = ...detector element containing the volume to be re-aligned ...; string placement = "/full/path/to/the/volume/to/be/realigned"; - Alignments::Delta delta = ...; + Delta delta = ...; double ovl = allowed_overlap_in cm; // e.g. 0.001; // Create the new stack entry and insert it to the stack @@ -525,7 +525,7 @@ code snippet: \begin{tabular} {l||p{0cm}} \docline{Line}{} \docline{2}{Install the $GlobalAlignmentCache$. Required to be done -once. The object is registered to the LCDD instance and kept there.} +once. The object is registered to the Detector instance and kept there.} \docline{2-7}{The fact that the classes $GlobalAlignmentCache$ and $GlobalAlignmentStack$ are singletons is not a fundamental issue. However, we want to call the XML parser (or other database sources) @@ -543,10 +543,10 @@ once the transaction is committed.} In this section we describe how to load geometry imperfections and to apply them to an existing geometry. Loading the XML file is done automatically using the standard XML loader plugin provided by \DDhep. This plugin is interfaced to -the {\tt LCDD} instance and invoked from code as follows: +the {\tt Detector} instance and invoked from code as follows: \begin{code} - LCDD& lcdd = ....; - lcdd.fromXML("file:AlepTPC_alignment.xml"); + Detector& description = ....; + description.fromXML("file:AlepTPC_alignment.xml"); \end{code} To fully exploit the capabilities it is important to understand the interpreted structure of the XML file being processed. At the top level of the primary @@ -611,7 +611,7 @@ The structure of the alignment file explained quickly: \docline{5}{The first subdetector: {\tt TPC}. The subdetector tag is {\tt detelement} Each {\tt detelement} may recursively contain other {\tt detelement} tags. as they were defined in the {\tt DetElement} hierarchy. - Internal {\tt detelement} elements are processed in the context of the outer + detaill {\tt detelement} elements are processed in the context of the outer element i.e. pathes may be specified relative to the parent or as absolute pathes with respect to the world (starting with a '/').} \docline{7}{Global movement of the TPC} @@ -679,10 +679,10 @@ In this section we describe how to export geometry imperfections to an XML file. A small helper class {\tt AlignmentWriter} achieves this task as shown in the snippet: \begin{code} - LCDD& lcdd = ....; + Detector& description = ....; DetElement top = ....; if ( top.isValid() ) { - AlignmentWriter wr(lcdd); + AlignmentWriter wr(description); return wr.write(top,output,enable\_transactions); } \end{code} @@ -822,7 +822,7 @@ user caches it is mandatory to provide a user defined update callback to the $De \noindent The interface of the $Alignment$ structure to access detector -alignment parameters is as follows (see also the corresponding header file DD4hep/Alignment.h): +alignment parameters is as follows (see also the corresponding header file dd4hep/Alignment.h): \begin{code} /// Number of nodes in this branch (=depth of the placement hierarchy from the top level volume) int numNodes() const; @@ -906,7 +906,7 @@ There are multiple possibilities to apply alignment parameters: In this section we describe how to apply geometry imperfections to an existing detector geometry in memory using {\tt C++}. To apply misalignment to an existing geometry two classes are collaborating, the {\tt AlignmentCache} attached to -the geometry container {\tt LCDD} and a temporary structure the {\tt AlignmentStack}. +the geometry container {\tt Detector} and a temporary structure the {\tt AlignmentStack}. The {\tt AlignmentCache} allows to access all existing alignment entries based on their subdetector. The {\tt AlignmentStack} may exist in exactly one instance and is used to @@ -931,8 +931,8 @@ opening and closing a transaction: // Required include file(s) #include "DDAlign/AlignmentCache.h" - LCDD& lcdd = ....; - AlignmentCache* cache = lcdd.extension<Geometry::AlignmentCache>(); + Detector& description = ....; + AlignmentCache* cache = description.extension<AlignmentCache>(); // First things first: open the transaction. cache->openTransaction(); @@ -1039,20 +1039,20 @@ the geometry. For further shortcuts in the calling sequence please consult the \newpage %============================================================================= \begin{thebibliography}{9} -\bibitem{bib:DD4hep} M. Frank et al, "DD4hep: A Detector Description Toolkit +\bibitem{bib:dd4hep} M. Frank et al, "dd4hep: A Detector Description Toolkit for High Energy Physics Experiments", - International Conference on Computing in High Energy and Nuclear Physics + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2013), \\ Amsterdam, Netherlands, 2013, proceedings. \bibitem{bib:LHCb-geometry} S. Ponce et al., "Detector Description Framework in LHCb", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), La Jolla, CA, 2003, proceedings. \bibitem{bib:chris-parkes-priv-comm} C. Parkes, private communications. \bibitem{bib:DDG4} M.Frank, "DDG4 - A Simulation Toolkit for High Energy Physics Experiments using Geant4 \\ - and the DD4hep Geometry Description". + and the dd4hep Geometry Description". \bibitem{bib:ROOT-tgeo} R.Brun, A.Gheata, M.Gheata, "The ROOT geometry package",\\ Nuclear Instruments and Methods {\bf{A}} 502 (2003) 676-680. \bibitem{bib:geant4} S. Agostinelli et al., diff --git a/doc/LaTex/DDAlignManual.tex b/doc/LaTex/DDAlignManual.tex index bf9fc648a..4661f7b6f 100644 --- a/doc/LaTex/DDAlignManual.tex +++ b/doc/LaTex/DDAlignManual.tex @@ -1,7 +1,7 @@ %============================================================================= \documentclass[10pt,a4paper]{article} % -\input{DD4hep-setup.tex} +\input{dd4hep-setup.tex} % \pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{DDAlign User Manual}}} % @@ -13,7 +13,7 @@ DDAlign }{ Alignment Support for the \\ \vspace{0.5cm} -DD4hep Geometry Description \\ +dd4hep Geometry Description \\ \vspace{0.5cm} Toolkit \vspace{2cm} @@ -137,7 +137,7 @@ document the support for alignment with its programming interfaces. %============================================================================= \begin{figure}[h] \begin{center} - \includegraphics[height=90mm] {DD4hep_classes.png} + \includegraphics[height=90mm] {dd4hep_classes.png} \caption{Class diagram with the main classes and their relations for the Generic Detector Description Model. The implementing ROOT classes are shown in brackets.} @@ -151,12 +151,12 @@ document the support for alignment with its programming interfaces. %============================================================================= \noindent -This is the heart of the DD4hep detector description toolkit. Its purpose is +This is the heart of the dd4hep detector description toolkit. Its purpose is to build in memory a model of the detector including its geometrical aspects as well as structural and functional aspects. The design reuses the elements from the ROOT geometry package and extends them in case required functionality is not available. Figure~\ref{fig:dd4hep-detector-model} illustrates the main -players and their relationships~\cite{bib:DD4hep}. +players and their relationships~\cite{bib:dd4hep}. Any detector is modeled as a tree of $Detector$ $Elements$, the entity central to this design, which is represented in the implementation by the $DetElement$ class~\cite{bib:LHCb-geometry}. It offers all @@ -171,7 +171,7 @@ the all TPC geometrical dimensions, the alignment and calibration constants and other slow varying conditions such as the gas pressure, end-plate temperatures etc. The $Detector$ $Element$ acts as a data concentrator. Applications may access the full experiment geometry and all connected data -through a singleton object called $LCDD$, which provides +through a singleton object called $Detector$, which provides management, bookkeeping and ownership to the model instances. \noindent @@ -186,7 +186,7 @@ is described in the following. %============================================================================= \begin{figure}[h] \begin{center} - \includegraphics[height=75mm] {DD4hep_detelement_tree.png} + \includegraphics[height=75mm] {dd4hep_detelement_tree.png} \caption{The object diagram of a hypothetical TPC detector showing in parallel the $Detector$ $Element$ and the $Geometry$ hierarchy and the relationships between the objects.} @@ -423,7 +423,7 @@ The simulation of such a geometry with applied alignment parameters can rather easily be realized using using the \DDhep, \DDA and the \DDG frameworks: \begin{itemize}\itemcompact \item The ideal geometry is constructed using the standard procedures - of \DDhep~\cite{bib:DD4hep}. + of \DDhep~\cite{bib:dd4hep}. \item Then the alignment parameters are applied and finally \item the corrected geometry is translated to $Geant4$~\cite{bib:geant4} using the \DDG~\cite{bib:DDG4} package. @@ -542,7 +542,7 @@ user caches it is mandatory to provide a user defined update callback to the $De \noindent The interface of the $Alignment$ structure to access detector -alignment parameters is as follows (see also the corresponding header file DD4hep/Alignment.h): +alignment parameters is as follows (see also the corresponding header file dd4hep/Alignment.h): \begin{code} /// Number of nodes in this branch (=depth of the placement hierarchy from the top level volume) int numNodes() const; @@ -626,7 +626,7 @@ There are multiple possibilities to apply alignment parameters: In this section we describe how to apply geometry imperfections to an existing detector geometry in memory using {\tt C++}. To apply misalignment to an existing geometry two classes are collaborating, the {\tt AlignmentCache} attached to -the geometry container {\tt LCDD} and a temporary structure the {\tt AlignmentStack}. +the geometry container {\tt Detector} and a temporary structure the {\tt AlignmentStack}. The {\tt AlignmentCache} allows to access all existing alignment entries based on their subdetector. The {\tt AlignmentStack} may exist in exactly one instance and is used to @@ -651,8 +651,8 @@ opening and closing a transaction: // Required include file(s) #include "DDAlign/AlignmentCache.h" - LCDD& lcdd = ....; - AlignmentCache* cache = lcdd.extension<Geometry::AlignmentCache>(); + Detector& description = ....; + AlignmentCache* cache = description.extension<AlignmentCache>(); // First things first: open the transaction. cache->openTransaction(); @@ -764,10 +764,10 @@ the geometry. For further shortcuts in the calling sequence please consult the In this section we describe how to load geometry imperfections and to apply them to an existing geometry. Loading the XML file is done automatically using the standard XML loader plugin provided by \DDhep. This plugin is interfaced to -the {\tt LCDD} instance and invoked from code as follows: +the {\tt Detector} instance and invoked from code as follows: \begin{code} - LCDD& lcdd = ....; - lcdd.fromXML("file:AlepTPC_alignment.xml"); + Detector& description = ....; + description.fromXML("file:AlepTPC_alignment.xml"); \end{code} To fully exploit the capabilities it is important to understand the interpreted structure of the XML file being processed. At the top level of the primary @@ -832,7 +832,7 @@ The structure of the alignment file explained quickly: \docline{5}{The first subdetector: {\tt TPC}. The subdetector tag is {\tt detelement} Each {\tt detelement} may recursively contain other {\tt detelement} tags. as they were defined in the {\tt DetElement} hierarchy. - Internal {\tt detelement} elements are processed in the context of the outer + detaill {\tt detelement} elements are processed in the context of the outer element i.e. pathes may be specified relative to the parent or as absolute pathes with respect to the world (starting with a '/').} \docline{7}{Global movement of the TPC} @@ -897,10 +897,10 @@ In this section we describe how to export geometry imperfections to an XML file. A small helper class {\tt AlignmentWriter} achieves this task as shown in the snippet: \begin{code} - LCDD& lcdd = ....; + Detector& description = ....; DetElement top = ....; if ( top.isValid() ) { - AlignmentWriter wr(lcdd); + AlignmentWriter wr(description); return wr.write(top,output,enable\_transactions); } \end{code} @@ -915,20 +915,20 @@ be imported by another process. \newpage %============================================================================= \begin{thebibliography}{9} -\bibitem{bib:DD4hep} M. Frank et al, "DD4hep: A Detector Description Toolkit +\bibitem{bib:dd4hep} M. Frank et al, "dd4hep: A Detector Description Toolkit for High Energy Physics Experiments", - International Conference on Computing in High Energy and Nuclear Physics + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2013), \\ Amsterdam, Netherlands, 2013, proceedings. \bibitem{bib:LHCb-geometry} S. Ponce et al., "Detector Description Framework in LHCb", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), La Jolla, CA, 2003, proceedings. \bibitem{bib:chris-parkes-priv-comm} C. Parkes, private communications. \bibitem{bib:DDG4} M.Frank, "DDG4 - A Simulation Toolkit for High Energy Physics Experiments using Geant4 \\ - and the DD4hep Geometry Description". + and the dd4hep Geometry Description". \bibitem{bib:ROOT-tgeo} R.Brun, A.Gheata, M.Gheata, "The ROOT geometry package",\\ Nuclear Instruments and Methods {\bf{A}} 502 (2003) 676-680. \bibitem{bib:geant4} S. Agostinelli et al., diff --git a/doc/LaTex/DDConditionsManual.tex b/doc/LaTex/DDConditionsManual.tex index c6cfc36ed..c77ee3378 100644 --- a/doc/LaTex/DDConditionsManual.tex +++ b/doc/LaTex/DDConditionsManual.tex @@ -1,7 +1,7 @@ %============================================================================= \documentclass[10pt,a4paper]{article} % -\input{DD4hep-setup.tex} +\input{dd4hep-setup.tex} % \pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{DDAlign User Manual}}} % @@ -11,7 +11,7 @@ { Conditions Support for the \\ \vspace{0.5cm} -DD4hep Geometry Description \\ +dd4hep Geometry Description \\ \vspace{0.5cm} Toolkit \vspace{2cm} @@ -119,7 +119,7 @@ document the support for alignment with its programming interfaces. %============================================================================= \begin{figure}[h] \begin{center} - \includegraphics[height=90mm] {DD4hep_classes.png} + \includegraphics[height=90mm] {dd4hep_classes.png} \caption{Class diagram with the main classes and their relations for the Generic Detector Description Model. The implementing ROOT classes are shown in brackets.} @@ -133,14 +133,14 @@ document the support for alignment with its programming interfaces. %============================================================================= \noindent -This is the heart of the DD4hep detector description toolkit. Its purpose is +This is the heart of the dd4hep detector description toolkit. Its purpose is \newpage %============================================================================= \begin{thebibliography}{9} \bibitem{bib:LHCb-geometry} S. Ponce et al., "Detector Description Framework in LHCb", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), La Jolla, CA, 2003, proceedings. \end{thebibliography} %============================================================================= diff --git a/doc/LaTex/DDEveManual.tex b/doc/LaTex/DDEveManual.tex index 0eb1079e6..0c0f8e5e5 100644 --- a/doc/LaTex/DDEveManual.tex +++ b/doc/LaTex/DDEveManual.tex @@ -1,7 +1,7 @@ %============================================================================= \documentclass[10pt,a4paper]{article} % -\input{DD4hep-setup.tex} +\input{dd4hep-setup.tex} % \pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{DRAFT -- DDEve User Manual -- DRAFT}}} % @@ -12,7 +12,7 @@ DDEve }{ An Event Display for \\ \vspace{0.5cm} -DD4hep Geometries \\ +dd4hep Geometries \\ \vspace{2.5cm} -- DRAFT -- \\ } @@ -30,7 +30,7 @@ DD4hep Geometries \\ \noindent \normalsize \DDE is a framework implementing a event display for detector geometries -implemented using DD4hep. \DDE hereby takes advantage of the TEve toolkit +implemented using dd4hep. \DDE hereby takes advantage of the TEve toolkit naturally provided by the ROOT framework like the ROOT geometry toolkit TGeo. \noindent @@ -144,7 +144,7 @@ Next you should see the default pane with the instantiated CLICSiD detector: \newpage \noindent -Then open from the \tts{"DD4hep"} menu the item \tts{"Open Event Data"}. Move again to the +Then open from the \tts{"dd4hep"} menu the item \tts{"Open Event Data"}. Move again to the directory \tts{\$DD4hepINSTALL/examples/CLIDSid/eve} and open the sample file \tts{CLICSiD\_Events.root} containing a sample of events being the output of a \DDG simulation step: @@ -207,7 +207,7 @@ approach. Starting from the \tts{CLICSiD} example is not too bad an approach. %============================================================================= \newpage \begin{thebibliography}{9} -\input{DD4hep-bibliography.tex} +\input{dd4hep-bibliography.tex} \end{thebibliography} %============================================================================= \end{document} diff --git a/doc/LaTex/DDG4Manual-Introduction.tex b/doc/LaTex/DDG4Manual-Introduction.tex index e0bf5d2d9..328126b21 100644 --- a/doc/LaTex/DDG4Manual-Introduction.tex +++ b/doc/LaTex/DDG4Manual-Introduction.tex @@ -27,7 +27,7 @@ is strongly influenced by the technical choices and precise simulations depends on the very specific detection techniques. \noindent -Similar to the aim of \DDhep\cite{bib:DD4hep}, +Similar to the aim of \DDhep\cite{bib:dd4hep}, where with time a standard palette of detector components developed by users should become part of the toolkit, \DDG also hopes to provide a standard palette of components used diff --git a/doc/LaTex/DDG4Manual-MT.tex b/doc/LaTex/DDG4Manual-MT.tex index af921b539..cdf5dba5b 100644 --- a/doc/LaTex/DDG4Manual-MT.tex +++ b/doc/LaTex/DDG4Manual-MT.tex @@ -69,7 +69,7 @@ to basic useful quantities: \begin{code} struct Geant4DetectorConstructionContext { /// Reference to geometry object - Geometry::LCDD& lcdd; + Detector& description; /// Reference to the world after construction G4VPhysicalVolume* world; /// The cached geometry information @@ -254,7 +254,7 @@ Any other return code is assumed to be failure. \begin{code} """ - DD4hep simulation example setup DDG4 + dd4hep simulation example setup DDG4 in multi-threaded mode using the python configuration @author M.Frank @@ -315,11 +315,11 @@ def setupSensitives(geant4): def run(): kernel = DDG4.Kernel() - lcdd = kernel.lcdd() + description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] DDG4.Core.setPrintFormat("%-32s %6s %s") kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD.xml") - DDG4.importConstants(lcdd) + DDG4.importConstants(description) kernel.NumberOfThreads = 3 geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') diff --git a/doc/LaTex/DDG4Manual-Setup.tex b/doc/LaTex/DDG4Manual-Setup.tex index b4ec99e5a..cb02a1085 100644 --- a/doc/LaTex/DDG4Manual-Setup.tex +++ b/doc/LaTex/DDG4Manual-Setup.tex @@ -370,10 +370,10 @@ segment is discussed below line by line. #include <iostream> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; -using namespace DD4hep::Simulation::Test; -using namespace DD4hep::Simulation::Setup; +using namespace dd4hep; +using namespace dd4hep::sim; +using namespace dd4hep::sim::Test; +using namespace dd4hep::sim::Setup; #if defined(__MAKECINT__) #pragma link C++ class Geant4RunActionSequence; @@ -395,7 +395,7 @@ SensitiveSeq::handled_type* setupDetector(Kernel& kernel, const std::string& nam } void exampleAClick() { - Geant4Kernel& kernel = Geant4Kernel::instance(LCDD::getInstance()); + Geant4Kernel& kernel = Geant4Kernel::instance(Detector::getInstance()); kernel.loadGeometry("file:../DD4hep.trunk/DDExamples/CLICSiD/compact/compact.xml"); kernel.loadXML("DDG4_field.xml"); @@ -444,7 +444,7 @@ void exampleAClick() { properties to \tts{Geant4Action} objects. These helpers and the corresponding functionality are not included in the wrapped classes themselves to not clutter the code with stuff only used for the setup. - All contained objects are in the namespace \tts{DD4hep::Simulation::Setup}}. + All contained objects are in the namespace \tts{dd4hep::sim::Setup}}. \docline{6-10}{Save yourself specifying all the namespaces objects are in....} \docline{13-19}{CINT processing pragmas. Classes defined here will be available at the ROOT prompt @@ -525,7 +525,7 @@ to cope with the installation paths. \noindent Given the reflection interface of ROOT, the setup of the simulation interface -using DD4hep is of course also possible using the python interpreted language. +using dd4hep is of course also possible using the python interpreted language. In the following code example the setup of Geant4 using the \tts{ClicSid} example is shown using python~\footnote{For comparison, the same example was used to illustrate the setup using XML files.}. @@ -536,7 +536,7 @@ from SystemOfUnits import * """ - DD4hep example setup using the python configuration + dd4hep example setup using the python configuration @author M.Frank @version 1.0 @@ -547,11 +547,11 @@ def run(): kernel.loadGeometry("file:../DD4hep.trunk/DDExamples/CLICSiD/compact/compact.xml") kernel.loadXML("DDG4_field.xml") - lcdd = kernel.lcdd() + description = kernel.detectorDescription() print '+++ List of sensitive detectors:' - for i in lcdd.detectors(): + for i in description.detectors(): o = DDG4.DetElement(i.second) - sd = lcdd.sensitiveDetector(o.name()) + sd = description.sensitiveDetector(o.name()) if sd.isValid(): print '+++ %-32s type:%s'%(o.name(), sd.type(), ) diff --git a/doc/LaTex/DDG4Manual.tex b/doc/LaTex/DDG4Manual.tex index b58e8ddf7..730074a16 100644 --- a/doc/LaTex/DDG4Manual.tex +++ b/doc/LaTex/DDG4Manual.tex @@ -1,7 +1,7 @@ %============================================================================= \documentclass[10pt,a4paper]{article} % -\input{DD4hep-setup.tex} +\input{dd4hep-setup.tex} % \pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{DDG4 User Manual}}} % @@ -15,7 +15,7 @@ High Energy Physics Experiments\\ \vspace{0.5cm} using Geant4 and the \\ \vspace{0.5cm} -DD4hep Geometry Description\\ +dd4hep Geometry Description\\ } { % Author list M. Frank \\ @@ -92,7 +92,7 @@ version & Date & Author \\[0.2cm] \hline %============================================================================= \newpage \begin{thebibliography}{9} -\input{DD4hep-bibliography.tex} +\input{dd4hep-bibliography.tex} \bibitem{bib:DDSegmentations} C.Grefe et al., "The DDSegmentation package", Non existing documentation to be written. diff --git a/doc/LaTex/DDRecManual.tex b/doc/LaTex/DDRecManual.tex index 5c79ae597..2f377e1a2 100644 --- a/doc/LaTex/DDRecManual.tex +++ b/doc/LaTex/DDRecManual.tex @@ -1,7 +1,7 @@ %============================================================================= \documentclass[10pt,a4paper]{article} % -\input{DD4hep-setup.tex} +\input{dd4hep-setup.tex} % \pagestyle{fancyplain}{\fancyfoot[C]{\sffamily{DDRec User Manual}}} % @@ -13,7 +13,7 @@ DDRec }{ Reconstruction Interface for the \\ \vspace{0.5cm} -DD4hep Geometry Description \\ +dd4hep Geometry Description \\ \vspace{0.5cm} Toolkit \vspace{2cm} @@ -52,7 +52,7 @@ While in principle it is of course possible to extract this information from the detector geometry model used for simulation, doing so would tightly couple the reconstruction code to the specific implementation of the simulation model. \DDR provides a generalized API for reconstruction that can be used to decouple the details of -the \DDH\cite{bib:DD4hep} detector geometry model from the reconstruction algorithms. +the \DDH\cite{bib:dd4hep} detector geometry model from the reconstruction algorithms. \end{abstract} @@ -239,7 +239,7 @@ of the volume. There are currently two concrete implementations: code as described in\ref{subsec:ddrec-surfaces-constructors}. The second hierarchy is the actual implementation of the surface concept in \DDR to be used by reconstruction code as described in \ref{subsec:ddrec-surfaces-reconstruction}. -It uses the extension and views concept described in the main \DDH manual\cite{bib:DD4hepManual}. +It uses the extension and views concept described in the main \DDH manual\cite{bib:dd4hepManual}. The {\em Surface} class has a {\em VolSurface} object and a {\em DetElement} and uses these to establish the local to global coordinate transforms, the surface boundaries and the material properties. The materials on both sides of the surface are @@ -278,24 +278,24 @@ This is demonstrated in the following example code: // --- loop over layers ---- // ... - DD4hep::Geometry::Box box( dimX/2, dimY/2, dimZ/2 ) ; - DD4hep::Geometry::Volume vol( volumeName, lcdd.material( x_layer.materialStr() )) ; + dd4hep::Box box( dimX/2, dimY/2, dimZ/2 ) ; + dd4hep::Volume vol( volumeName, description.material( x_layer.materialStr() )) ; - DD4hep::Geometry::DetElement layerDetElement( parentDetElement , "layer"+_toString(i,"_%02d") , det_id ) ; + dd4hep::DetElement layerDetElement( parentDetElement , "layer"+_toString(i,"_%02d") , det_id ) ; // add a measurement surface to the layer for every sensitive slice: - DD4hep::DDRec::VolPlane surf( vol , + dd4hep::rec::VolPlane surf( vol , DDSurfaces::SurfaceType(DDSurfaces::SurfaceType::Sensitive), dimZ, dimZ, u, v, n , o ) ; // place the layer - DD4hep::Geometry::PlacedVolume pv = parentVol.placeVolume( vol, layerPlacement ); + dd4hep::PlacedVolume pv = parentVol.placeVolume( vol, layerPlacement ); layerDetElement.setPlacement( pv ) ; - DD4hep::DDRec::volSurfaceList( layerDetElement )->push_back( surf ) ; + dd4hep::rec::volSurfaceList( layerDetElement )->push_back( surf ) ; // --- end loop over layers ---- @@ -321,15 +321,15 @@ averaged along the thickness of the tube. \begin{code} //... - DD4hep::Geometry::Tube innerWallSolid(rInner ,rInner + dr_InnerWall ,dz_Wall / 2.0 ) ; + dd4hep::Tube innerWallSolid(rInner ,rInner + dr_InnerWall ,dz_Wall / 2.0 ) ; - DD4hep::Geometry::Volume innerWallVol( "TPCInnerWallVol", innerWallSolid, materialAir ) ; + dd4hep::Volume innerWallVol( "TPCInnerWallVol", innerWallSolid, materialAir ) ; pv = tpc_motherLog.placeVolume( innerWallVol ) ; DDSurfaces::Vector3D ocyl( rInner + 0.5*dr_InnerWall , 0. , 0. ) ; - DD4hep::DDRec::VolCylinder surfI( innerWallVol , + dd4hep::rec::VolCylinder surfI( innerWallVol , SurfaceType( SurfaceType::Helper ) , 0.5*dr_InnerWall, 0.5*dr_InnerWall, ocyl ) ; @@ -369,23 +369,23 @@ surface. \begin{code} // ... - DD4hep::Geometry::LCDD& lcdd = DD4hep::Geometry::LCDD::getInstance(); + dd4hep::Detector& description = dd4hep::Detector::getInstance(); - lcdd.fromCompact( inFile ); + description.fromCompact( inFile ); - DD4hep::Geometry::DetElement world = lcdd.world() ; + dd4hep::DetElement world = description.world() ; // create a list of all surfaces in the detector: - DD4hep::DDRec::SurfaceManager surfMan( world ) ; + dd4hep::rec::SurfaceManager surfMan( world ) ; - const DD4hep::DDRec::SurfaceList& sL = surfMan.surfaceList() ; + const dd4hep::rec::SurfaceList& sL = surfMan.surfaceList() ; // map of surfaces - std::map< long64, DD4hep::DDRec::Surface* > surfMap ; + std::map< long64, dd4hep::rec::Surface* > surfMap ; - for( DD4hep::DDRec::SurfaceList::const_iterator it = sL.begin() ; it != sL.end() ; ++it ){ + for( dd4hep::rec::SurfaceList::const_iterator it = sL.begin() ; it != sL.end() ; ++it ){ - DD4hep::DDRec::Surface* surf = *it ; + dd4hep::rec::Surface* surf = *it ; std::cout << " ------------------------- " << " surface: " << *surf << std::endl @@ -403,16 +403,16 @@ for a particular detector element: \begin{code} // ... - DD4hep::Geometry::DetElement ladderDE = lcdd.detector("VXD_layer02_ladder42") ; + dd4hep::DetElement ladderDE = description.detector("VXD_layer02_ladder42") ; // create surfaces - DD4hep::DDRec::DetectorSurfaces ds( ladderDE ) ; + dd4hep::rec::DetectorSurfaces ds( ladderDE ) ; - const DD4hep::DDRec::SurfaceList& detSL = ds.surfaceList() ; + const dd4hep::rec::SurfaceList& detSL = ds.surfaceList() ; - for( DD4hep::DDRec::SurfaceList::const_iterator it = detSL.begin() ; it != detSL.end() ; ++it ){ + for( dd4hep::rec::SurfaceList::const_iterator it = detSL.begin() ; it != detSL.end() ; ++it ){ - DD4hep::DDRec::Surface* surf = *it ; + dd4hep::rec::Surface* surf = *it ; std::cout << " ------------------------- " << " surface: " << *surf << std::endl @@ -464,16 +464,16 @@ The usage of this class is simple and best demonstrated with an example: \begin{code} - DD4hep::Geometry::LCDD& lcdd = DD4hep::Geometry::LCDD::getInstance(); + dd4hep::Detector& description = dd4hep::Detector::getInstance(); - lcdd.fromCompact( inFile ); + description.fromCompact( inFile ); DDSurfaces::Vector3D p0( x0, y0, z0 ) ; DDSurfaces::Vector3D p1( x1, y1, z1 ) ; - DD4hep::DDRec::MaterialManager matMgr ; + dd4hep::rec::MaterialManager matMgr ; - const DD4hep::DDRec::MaterialVec& materials = matMgr.materialsBetween( p0 , p1 ) ; + const dd4hep::rec::MaterialVec& materials = matMgr.materialsBetween( p0 , p1 ) ; std::cout << std::endl << " ####### materials between the two points : " @@ -485,7 +485,7 @@ The usage of this class is simple and best demonstrated with an example: double path_length = 0 ; for( unsigned i=0,n=materials.size();i<n;++i){ - DD4hep::DDRec::Material mat = materials[i].first ; + dd4hep::rec::Material mat = materials[i].first ; double length = materials[i].second ; double nx0 = length / mat.radLength() ; @@ -511,9 +511,9 @@ Creation of an averaged material: \begin{code} // ... - const DD4hep::DDRec::MaterialVec& materials = matMgr.materialsBetween( p0 , p1 ) ; + const dd4hep::rec::MaterialVec& materials = matMgr.materialsBetween( p0 , p1 ) ; - const DD4hep::DDRec::MaterialData& avMat = matMgr.createAveragedMaterial( materials ) ; + const dd4hep::rec::MaterialData& avMat = matMgr.createAveragedMaterial( materials ) ; std::cout << " averaged Material : " << " Z: " << avMat.Z() << " A: " << avMat.A() << " densitiy: " << avMat.density() @@ -568,46 +568,46 @@ the following interface: IDDecoder(const std::string& collectionName); /// Default constructor using a readout object - IDDecoder(const Geometry::Readout& readout); + IDDecoder(const Readout& readout); /// Destructor virtual ~IDDecoder(); /// Returns the cell ID from the local position in the given volume ID. - CellID cellIDFromLocal(const Geometry::Position& local, const VolumeID volumeID) const; + CellID cellIDFromLocal(const Position& local, const VolumeID volumeID) const; /// Returns the global cell ID from a given global position - CellID cellID(const Geometry::Position& global) const; + CellID cellID(const Position& global) const; /// Returns the global position from a given cell ID - Geometry::Position position(const CellID& cellID) const; + Position position(const CellID& cellID) const; /// Returns the local position from a given cell ID - Geometry::Position localPosition(const CellID& cellID) const; + Position localPosition(const CellID& cellID) const; /// Returns the volume ID of a given cell ID VolumeID volumeID(const CellID& cellID) const; /// Returns the volume ID of a given global position - VolumeID volumeID(const Geometry::Position& global) const; + VolumeID volumeID(const Position& global) const; /// Returns the placement for a given cell ID - Geometry::PlacedVolume placement(const CellID& cellID) const; + PlacedVolume placement(const CellID& cellID) const; /// Returns the placement for a given global position - Geometry::PlacedVolume placement(const Geometry::Position& global) const; + PlacedVolume placement(const Position& global) const; /// Returns the subdetector for a given cell ID - Geometry::DetElement subDetector(const CellID& cellID) const; + DetElement subDetector(const CellID& cellID) const; /// Returns the subdetector for a given global position - Geometry::DetElement subDetector(const Geometry::Position& global) const; + DetElement subDetector(const Position& global) const; /// Returns the closest detector element in the hierarchy for a given cell ID - Geometry::DetElement detectorElement(const CellID& cellID) const; + DetElement detectorElement(const CellID& cellID) const; /// Returns the closest detector element in the hierarchy for a given global position - Geometry::DetElement detectorElement(const Geometry::Position& global) const; + DetElement detectorElement(const Position& global) const; /// Calculates the neighbours of the given cell ID and adds them to the list of neighbours void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const; @@ -631,14 +631,14 @@ To be done ... \newpage %============================================================================= \begin{thebibliography}{9} -\bibitem{bib:DD4hep} M. Frank et al, "DD4hep: A Detector Description Toolkit +\bibitem{bib:dd4hep} M. Frank et al, "dd4hep: A Detector Description Toolkit for High Energy Physics Experiments", - International Conference on Computing in High Energy and Nuclear Physics + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2013), \\ Amsterdam, Netherlands, 2013, proceedings. -\bibitem{bib:DD4hepManual} M. Frank et al, "DD4hep: A Detector Description Toolkit - for High Energy Physics Experiments", Users manual (DD4hepManual.pdf). +\bibitem{bib:dd4hepManual} M. Frank et al, "dd4hep: A Detector Description Toolkit + for High Energy Physics Experiments", Users manual (dd4hepManual.pdf). \bibitem{bib:ROOT-tgeo} R.Brun, A.Gheata, M.Gheata, "The ROOT geometry package",\\ diff --git a/doc/LaTex/LaTex-template/AIDA2020-example.tex b/doc/LaTex/LaTex-template/AIDA2020-example.tex index 564d87eb4..d24d55e87 100644 --- a/doc/LaTex/LaTex-template/AIDA2020-example.tex +++ b/doc/LaTex/LaTex-template/AIDA2020-example.tex @@ -122,7 +122,7 @@ and now with line numbers: \begin{thebibliography}{9} \bibitem{bib:LHCb-geometry} S. Ponce et al., "Detector Description Framework in LHCb", - International Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), + detailtional Conference on Computing in High Energy and Nuclear Physics (CHEP 2003), La Jolla, CA, 2003, proceedings. \end{thebibliography} %============================================================================= diff --git a/doc/LaTex/LaTex-template/setup/lineno.sty b/doc/LaTex/LaTex-template/setup/lineno.sty index 1b1fbb3b4..961906cc7 100644 --- a/doc/LaTex/LaTex-template/setup/lineno.sty +++ b/doc/LaTex/LaTex-template/setup/lineno.sty @@ -1266,7 +1266,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % Line number references % \unskip}\label{s:LNref} % \subsection{% -% Internals %% New subsec. v4.3. +% detaills %% New subsec. v4.3. % \unskip} % The only way to get a label to a line number in a % paragraph is to ask the output routine to mark it. diff --git a/doc/LaTex/lineno.sty b/doc/LaTex/lineno.sty index 53a7b5242..78b93dc8f 100644 --- a/doc/LaTex/lineno.sty +++ b/doc/LaTex/lineno.sty @@ -1266,7 +1266,7 @@ Macro file lineno.sty for LaTeX: attach line numbers, refer to them. % Line number references % \unskip}\label{s:LNref} % \subsection{% -% Internals %% New subsec. v4.3. +% detaills %% New subsec. v4.3. % \unskip} % The only way to get a label to a line number in a % paragraph is to ask the output routine to mark it. diff --git a/doc/ReleaseNotes.md b/doc/ReleaseNotes.md index 06fd5d83d..8d4262a20 100644 --- a/doc/ReleaseNotes.md +++ b/doc/ReleaseNotes.md @@ -107,24 +107,24 @@ # v00-23 -* 2017-05-12 Marko Petric ([PR#152](https://github.com/aidasoft/dd4hep/pull/152)) +* 2017-05-12 Marko Petric ([PR#152](https://github.com/aidasoft/DD4hep/pull/152)) - Update CI to GCC 7.1 and LLVM 4.0 and include Geant4 10.3 -* 2017-05-22 Frank Gaede ([PR#154](https://github.com/aidasoft/dd4hep/pull/154)) +* 2017-05-22 Frank Gaede ([PR#154](https://github.com/aidasoft/DD4hep/pull/154)) - protect against NANs in Guineapig pairs files in Geant4EventReaderGuineaPig - - make INFO printout more consistent with DD4hep style + - make INFO printout more consistent with dd4hep style -* 2017-06-07 Frank Gaede ([PR#157](https://github.com/aidasoft/dd4hep/pull/157)) +* 2017-06-07 Frank Gaede ([PR#157](https://github.com/aidasoft/DD4hep/pull/157)) - bug fix in test_cellid_position_converter - with this no tests for position from cellID lookup should fail - re-implement ```CellIDPositionConverter::cellID(pos)``` -* 2017-06-08 Marko Petric ([PR#156](https://github.com/aidasoft/dd4hep/pull/156)) +* 2017-06-08 Marko Petric ([PR#156](https://github.com/aidasoft/DD4hep/pull/156)) - Mark all fallthroughs in case statements with attributes to suppress warning -* 2017-06-01 Frank Gaede ([PR#155](https://github.com/aidasoft/dd4hep/pull/155)) - - add new class DDRec::CellIDPositionConverter - - replaces DDRec::IDDecoder +* 2017-06-01 Frank Gaede ([PR#155](https://github.com/aidasoft/DD4hep/pull/155)) + - add new class rec::CellIDPositionConverter + - replaces rec::IDDecoder - implement positionNominal(CellID id) and cellID(position) - prepare for using alignment map by separating transforms to DetElement and daughter volume - do not use deprecated methods/members in VolumeManager @@ -134,7 +134,7 @@ # v00-22 -* 2017-04-28 Markus Frank ([PR#148](https://github.com/aidasoft/dd4hep/pull/148)) +* 2017-04-28 Markus Frank ([PR#148](https://github.com/aidasoft/DD4hep/pull/148)) Improvements to the compact xml processing =========================================== @@ -195,20 +195,20 @@ PrintPlacements PrintSensitives -* 2017-04-28 Ben Couturier ([PR#146](https://github.com/aidasoft/dd4hep/pull/146)) +* 2017-04-28 Ben Couturier ([PR#146](https://github.com/aidasoft/DD4hep/pull/146)) * Trivial fix for the DDDB converter to create paramphysvol3D volumes, which are otherwise ignored. -* 2017-04-20 Andre Sailer ([PR#145](https://github.com/aidasoft/dd4hep/pull/145)) +* 2017-04-20 Andre Sailer ([PR#145](https://github.com/aidasoft/DD4hep/pull/145)) - LCIOOutput: Add setting of ProducedBySecondary bit for SimTrackerHits if the hit is produced by a particle that is not stored in the MCParticle collection, needs lcio 2.8 -* 2017-05-05 Andre Sailer ([PR#150](https://github.com/aidasoft/dd4hep/pull/150)) - - Always create DD4hepConfigVersion.cmake in CMAKE_INSTALL_PREFIX and cmake folder +* 2017-05-05 Andre Sailer ([PR#150](https://github.com/aidasoft/DD4hep/pull/150)) + - Always create dd4hepConfigVersion.cmake in CMAKE_INSTALL_PREFIX and cmake folder - Create DD4hepConfig.cmake also in cmake folder - renamed Cmake Macro GENERATE_PACKAGE_CONFIGURATION_FILES to DD4HEP_GENERATE_PACKAGE_CONFIGURATION_FILES so it does not clash with the macro of the same name in ilcutil/cmakemodules -* 2017-05-07 Andre Sailer ([PR#151](https://github.com/aidasoft/dd4hep/pull/151)) - - Use cmake to create Version.h file to contain DD4hep version information and macros - - Change the way DD4hep package version is defined and set standard cmake variables for this purpose +* 2017-05-07 Andre Sailer ([PR#151](https://github.com/aidasoft/DD4hep/pull/151)) + - Use cmake to create Version.h file to contain dd4hep version information and macros + - Change the way dd4hep package version is defined and set standard cmake variables for this purpose # v00-21 @@ -320,10 +320,10 @@ Markus Frank 2016-12-19 - Add Multi-threading conditions example Andre Sailer 2016-12-16 -- Add drivers for Beampipe, Mask and Solenoid from lcgeo, changed name to DD4hep_* +- Add drivers for Beampipe, Mask and Solenoid from lcgeo, changed name to dd4hep_* Rosa Simonielo, Frank Gaede 2016-12-15 -- add new struct DDRec::NeighbourSurfacesStruct defined for neighbouring surfaces +- add new struct rec::NeighbourSurfacesStruct defined for neighbouring surfaces Frank Gaede 2016-12-14 - fix library pathes in env scripts for macos @@ -350,7 +350,7 @@ Markus Frank 2016-12-05 Andre Sailer 2016-12-06 - DDTest: fix location to install DDtest header files -- Remove minimum required cmake version from DD4hepBuild, this interferes with other packages depending on DD4hep +- Remove minimum required cmake version from DD4hepBuild, this interferes with other packages depending on dd4hep Marko Petric 2016-12-02 - Fix missing CLHEP in thisdd4hep.sh @@ -404,10 +404,10 @@ M.Petric: # v00-18 2016-11-09 F.Gaede -- updated DDRec::LayeredCalorimeterData::Layer: +- updated rec::LayeredCalorimeterData::Layer: - remove deprecated thickness - add phi0 -- add copy assignement to DDRec::MaterialData +- add copy assignement to rec::MaterialData 2016-11-08 M.Frank - Improve conditions handling. Started to implement using simple telescope @@ -423,12 +423,12 @@ M.Petric: system:16,barrel:16:-5 2016-10-18 M.Frank -- Due to pressure of the FCC folks, I tried to implement a more DD4hep like implementation of the +- Due to pressure of the FCC folks, I tried to implement a more dd4hep like implementation of the the segmentation objects. For testing only CartesianGridXY. If this mechanism works, it could be a starting recipe for the rest of the segmentations. The draw-back of this approach is, that assignments are not reversible: - DD4hep::CartesianGridXY xy = readout.segmentation(); // Works - DD4hep::Segmentation seg = xy; // Should not work + dd4hep::CartesianGridXY xy = readout.segmentation(); // Works + dd4hep::Segmentation seg = xy; // Should not work - Reason: the managed objects are different....at some point in time I will have to find a clean solution for this, but the required changes for such a solution shall be manageable. @@ -444,10 +444,10 @@ M.Petric: 2016-08-24 M.Frank - Adding first somehow useful implementation to use conditions and the consequent loading thereof. - Used by the DDDB implementation/example. DDDB is an alternative way to populate the DD4hep + Used by the DDDB implementation/example. DDDB is an alternative way to populate the dd4hep detector description using LHCb's detector description database. The reason is, that only a running experiment has a reasonable base to conditions data - to excercise the DD4hep conditions. + to excercise the dd4hep conditions. If interested, please have a look in the DDDB examples. - Still TODO: @@ -513,10 +513,10 @@ M.Petric: - fixed memory leak, compiled and valgrinded 2016-02-10 F.Gaede -- added utility DD4hep::XML::setDetectorTypeFlag() +- added utility dd4hep::xml::setDetectorTypeFlag() to set the TypeFlag from xml element <type_flag type="0x42"/> - select detectors with - DD4hep::Geometry::DetectorSelector(lcdd).detectors( ( DD4hep::DetType::TRACKER | DD4hep::DetType::ENDCAP )) ; + dd4hep::DetectorSelector(description).detectors( ( dd4hep::DetType::TRACKER | dd4hep::DetType::ENDCAP )) ; - used in UtilityApps/dumpdetector.cc - added detector_types.xml with int constants defined in DetType.h, include with : `<include ref="${DD4hepINSTALL}/DDDetectors/compact/detector_types.xml"/>` @@ -535,7 +535,7 @@ M.Petric: 2016-02-03 N.Nikiforou - DDDetectors - - Added plugin DD4hep_GenericSurfaceInstallerPlugin, copied from lcgeo + - Added plugin dd4hep_GenericSurfaceInstallerPlugin, copied from lcgeo to allow installation of surfaces to any sliced detector cmake/Doxyfile.in - Added DDDetectors to the sources directory so Doxygen picks up the @@ -585,7 +585,7 @@ M.Petric: (affected ILD VXD) 2016-01-05 F.Gaede -- added print functions for DDRec::DetectorData objects +- added print functions for rec::DetectorData objects - used in dumpdetector: dumpdetector compact.xml -d @@ -628,7 +628,7 @@ M.Petric: - Removal of compiler warnings 2015-11-23 F.Gaede -- added glbal method DD4hep::versionString() +- added glbal method dd4hep::versionString() 2015-11-13 S.Lu - Added a new AHcal Barrel segementation: TiledLayerGridXY, to be used e.g. @@ -689,7 +689,7 @@ M.Petric: 2015-08-27 F.Gaede - added macros DD4HEP_VERSION_GE(MAJV,MINV) and DD4HEP_VERSION_GT(MAJV,MINV) - to LCDD.h + to Detector.h - increased version number to v00-15 @@ -702,9 +702,9 @@ M.Petric: 2015-08-12 N.Nikiforou - DDCore/XML: Added new helper functions to Layering engine: - - double absorberThicknessInLayer(XML::Element e) : + - double absorberThicknessInLayer(xml::Element e) : returns total absorber thickness in given layer - - void sensitivePositionsInLayer(XML::Element e, std::vector<double>& sens_pos) : + - void sensitivePositionsInLayer(xml::Element e, std::vector<double>& sens_pos) : provides positions of sensitive slices within a layer with respect to the center of the layer @@ -712,7 +712,7 @@ M.Petric: 2015-07-25 M.Frank - DDSegmentation: Remove several 'shadow' warnings. -- New build system for the DD4hep core, which greatly simplyfies the cmake files +- New build system for the dd4hep core, which greatly simplyfies the cmake files for the various sub-packages. Tested with Andre's build script doc/CompileAllOptionPermutations.sh. (GEAR usage not tested though) @@ -731,7 +731,7 @@ F.Gaede: 2015-07-15 - moved setting of CMAKE_CXX_FLAGS (if DD4HEP_USE_CXX11) from DD4hep.cmake to CMakeLists.txt 2015-07-11 M.Frank -- added starter docs DD4hepStartersGuide.pdf +- added starter docs dd4hepStartersGuide.pdf *** **Important** *** **Before updating, backup your existing and working checkout. Though I was running @@ -740,7 +740,7 @@ F.Gaede: 2015-07-15 Notes: - Backwards compatibility mode for the usage of ROOT 5 and ROOT 6 alternatively. - For ROOT 6 the Gaudi PluginService is used and added to the distribution. -- DD4hep is distributed with a licence. See $DD4hepINSTALL/LICENSE for details. +- dd4hep is distributed with a licence. See $DD4hepINSTALL/LICENSE for details. - In the doc area the $DD4hepINSTALL/doc/CREDITS file everybode should add her/his name, if contributed significantly. - Unfortunately this meant to add/change the headers of all files and give a @@ -749,12 +749,12 @@ Notes: - The plugin factory declaration statements were changed to accomodate both ROOT 5 and ROOT 6 and to keep the number of 'ifdef' statements at a minimum. - TODO: Properly change the cmake scripts to accomodate for ROOT 6 and the - automatic switch when building DD4hep. + automatic switch when building dd4hep. - For reference reasons: this commits is revision 1812 + 1813 (DDDetectors) # v00-13 2015-07-03 F.Gaede -- updated doxygen for detector DDRec::DetectorData structs and usage in convertToGear +- updated doxygen for detector rec::DetectorData structs and usage in convertToGear 2015/07/02 Nikiforos Nikiforou - Added isRadiator() helper function in DDCore/XML/XMLDetector.h/cpp @@ -775,22 +775,22 @@ Notes: 2015-06-29 F.Gaede -- changed env scripts to prepend to library pathes (DD4hep and dependant packages) +- changed env scripts to prepend to library pathes (dd4hep and dependant packages) - using a newer lcgeo version than the one provided in ilcsoft can simply be done w/ source ./bin/thislcgeo.sh # v00-12 2015/06/17 Markus Frank -- Add possibility to block access to constants by name from LCDD. - Functionality enabled by a constant named "LCDD_InhibitConstants" with value "1", "True", "Yes". +- Add possibility to block access to constants by name from Detector. + Functionality enabled by a constant named "Detector_InhibitConstants" with value "1", "True", "Yes". Test: geoDisplay -compact file:../DD4hep.trunk/examples/ClientTests/compact/InhibitConstants.xml -- Add LCDDHelper handle object to easily access the sensitive detector object of a detector +- Add DetectorHelper handle object to easily access the sensitive detector object of a detector using either the subdetector name or the detector element (or one of its children). - See: DD4hep/LCDDHelper.h + See: dd4hep/DetectorHelper.h Test: ``` geoPluginRun -input file:../DD4hep.trunk/examples/CLICSiD/compact/compact.xml \ - -plugin CLICSiD_LCDDHelperTest \ + -plugin CLICSiD_DetectorHelperTest \ optional: -<detector-name (default:SiVertexEndcap)> [Note the '-'!!!] ``` @@ -816,11 +816,11 @@ F.Gaede to corresponding surface is needed - needs plugin "InstallSurfaceManager" to be in the compact file - access via: - SurfaceManager surfMan = *lcdd.extension< SurfaceManager >() ; + SurfaceManager surfMan = *description.extension< SurfaceManager >() ; const SurfaceMap& surfMap = *surfMan.map( "world" ) ; - renamed old SurfaceManager to SurfaceHelper -- added method: Geometry::Volume createPlacedEnvelope() +- added method: Volume createPlacedEnvelope() - to be used in all LC detector drivers to create a placed envelope volume rest of the detector is then instantiate in this volume @@ -843,23 +843,23 @@ F.Gaede 2015/05/11 Andre Sailer - CMake updates: - - Split libraries into components: use find_package(DD4hep COMPONENTS <component> [...] ) + - Split libraries into components: use find_package(dd4hep COMPONENTS <component> [...] ) to find the components you need. - At the moment there are these components are sensible to link against: DDRec, DDG4, DDEve, DDSegmentation - - To link against the librarie use either DD4hep_COMPONENT_LIBRARIES or DD4hep_<COMPONENT>_LIBRARY, + - To link against the librarie use either dd4hep_COMPONENT_LIBRARIES or dd4hep_<COMPONENT>_LIBRARY, where <COMPONENT> needs to be replaced by the UPPER case name of the component 2015/05/09 Markus Frank -- Allow to access detectors by type from lcdd. +- Allow to access detectors by type from description. - The sensitive type of a detector is set in the 'detector constructor'. - Not sensitive detector structures have the name 'passive' - Compounds (ie. nested detectors) are of type 'compound' - Dump detector types using plugin: - geoPluginRun -plugin DD4hepDetectorTypes -input <compact-file> + geoPluginRun -plugin dd4hepDetectorTypes -input <compact-file> 2015/03/12 Markus Frank -- Add support for ellipsoids in gdml/lcdd and geant4 conversion. +- Add support for ellipsoids in gdml/description and geant4 conversion. - Allow to include files with environment variables from compact notation. 2015/03/09 Markus Frank @@ -869,8 +869,8 @@ F.Gaede # v00-11 - DDDetectors - - new Package containing generic DD4hep detector palette (MF) - - added 'dimension' argument to DD4hep_SiTrackerBarrelSurfacePlugin (FG) + - new Package containing generic dd4hep detector palette (MF) + - added 'dimension' argument to dd4hep_SiTrackerBarrelSurfacePlugin (FG) to handle pixel and strip detectors - DDRec (Frank Gaede) @@ -912,9 +912,9 @@ F.Gaede - added component to allow the setup of the magnetic field tracking in Geant4 from python - DDCore (Markus Frank) - - fixed LCDD el-mag. field converter + - fixed Detector el-mag. field converter - add generic surface installers - - allow for string constants in lcdd define section + - allow for string constants in description define section - added arguments for surface plugins - DDSegmentation (FG) : @@ -932,7 +932,7 @@ F.Gaede - CMake: - made DD4HEP_USE_BOOST an option flag (FG) - - added DD4hepG4 library dependence to DDEve (MF) + - added dd4hepG4 library dependence to DDEve (MF) - disable dot -> have simpler (and faster) inheritance graphs w/ Doxygen - fixed missing search field in Doxygen doc (FG) - include boost automatically if build with Geant4 @@ -941,7 +941,7 @@ F.Gaede - Documentation - improved Doxygen documentation (MF) - added manual for DDRec (FG) - - new version of the DD4hep manual (MF) + - new version of the dd4hep manual (MF) - fixed code formating with emacs style: ./doc/format_code.sh @@ -967,7 +967,7 @@ F.Gaede - example code: DDDetectors/src/SurfaceExamplePlugin.cpp - compact: ``` - <plugin name="DD4hep_SurfaceExamplePlugin"> + <plugin name="dd4hep_SurfaceExamplePlugin"> <argument value="SiTrackerBarrel"/> <argument value="aa=1*mm"/> <argument value="bb=2*cm"/> @@ -1020,7 +1020,7 @@ F.Gaede particle filtering to optimize the size of the MC record. - DDG4 fix SimpleCalorimter sensitive action and properly support hit aggregations. -- DDEve smaller modifications to support DDG4IO if DD4hep was +- DDEve smaller modifications to support DDG4IO if dd4hep was built with the Geant4 option ON. # v00-08 @@ -1043,7 +1043,7 @@ Andre Sailer, 2014-07-17 Christian.Grefe, 2014-07-15 - Made DDSegmentation optionally a stand-alone package - create DDSgementationConfig.cmake when build as part of DD4hep + create DDSgementationConfig.cmake when build as part of dd4hep Markus Frank, 2014-07-02 - add LCIO conversions from DDSim - sensitive detectors @@ -1071,7 +1071,7 @@ Markus Frank, 2014-07-02 - DDCore: adjust a few print statements. 2014/06/27 Markus Frank -- Separate XML loading from LCDD implementation. +- Separate XML loading from Detector implementation. - New package: DDEve: a bit more sophisticated TEve specialization - To start use examples/CLICSiD/compact/DDEve.xml - DDEve can interface currently to ROOT files created by DDG4. @@ -1092,7 +1092,7 @@ Markus Frank, 2014-07-02 - convert to degrees for angles in TGeoShapes constructors - NB: there is one inconsistency left here: angles returned from TGeoShapes are already in degrees, this is the one - case where a quantity returned from DD4hep/TGeo does not have the default + case where a quantity returned from dd4hep/TGeo does not have the default units - thus one should not write ` double phi = coneSeg.Phi1() / tgeo::rad ;` @@ -1103,16 +1103,16 @@ Markus Frank, 2014-07-02 2014/06/03 Markus Frank -- Provision for ROOT persistency for DD4hep detector descriptions: - Create Cint dictionary for DD4hepCore by default when building the library. +- Provision for ROOT persistency for dd4hep detector descriptions: + Create Cint dictionary for dd4hepCore by default when building the library. For the time being the area of DDSegmentation is left out, since these objects require changes due to the handling of references and template - specializations. Besides these, DD4hep detector descriptions can be + specializations. Besides these, dd4hep detector descriptions can be saved and read-back directly to/from ROOT files - which may improve a lot the startup time of processes. - The DDG4 dictionary is created by default when building the library. - When importing DDG4 from python only the DD4hepCore DD4hepG4 libraries + When importing DDG4 from python only the dd4hepCore dd4hepG4 libraries must be present. It should no longer be necessary to compile the necessary AClick on the fly. @@ -1136,11 +1136,11 @@ Markus Frank, 2014-07-02 2014/05/21 Markus Frank - Fix material creation from XML - JIRA bug: DD4hep - DDFORHEP-4 + JIRA bug: dd4hep - DDFORHEP-4 https://sft.its.cern.ch/jira/browse/DDFORHEP-4 using <composite> in material xml files results in wrong material properties -- Fix JIRA bug: DD4hep - DDFORHEP-3 +- Fix JIRA bug: dd4hep - DDFORHEP-3 https://sft.its.cern.ch/jira/browse/DDFORHEP-3 Recursive assemblies result in error in TGeo geometry Bug results in errors when closing the geometry like: @@ -1229,7 +1229,7 @@ Markus Frank, 2014-07-02 2014/02/07 Frank Gaede - added DDGear, support for interfacing to gear for backward compatibility - - lives currently in ILDExDet ( should become (optional) part of core DD4hep) + - lives currently in ILDExDet ( should become (optional) part of core dd4hep) - users need to GearParameter objects as extensions to the DetElement -> see ILDExTPC_geo.cpp, ILDExVXD_geo.cpp, ILDExTPCSIT_geo.cpp as examples - program convertToGear creates gear xml file from compact file @@ -1308,14 +1308,14 @@ Markus Frank, 2014-07-02 - libDDG4LCIO.so LCIO output plugin for new framework 2013/11/03 Markus Frank -- doc: Add CHEP2013 paper about DD4hep as a start of the documentation +- doc: Add CHEP2013 paper about dd4hep as a start of the documentation section. More to come hopefully. - DDCore: several small improvements: - Segmentations are no longer Ref_t's. - Base internal implementing object directly on the segmentations classes from Christian. - Rearrangement of some code from Handle.h to Primitives.h - - Allow to attach extensions to LCDD + - Allow to attach extensions to Detector - DDG4: Fix Frank's simulation problem, which he caused himself introducing his famous factories.... - DDG4: First attempt to fix simulation problem with mignetic field. @@ -1372,7 +1372,7 @@ F. Gaede (see ReadMe.txt for details) - moved examples to ./example directory -- they are not built as part of DD4hep anymore +- they are not built as part of dd4hep anymore - install thisdd4hep.sh in ./bin (modified to have the correct pathes) @@ -1380,7 +1380,7 @@ F. Gaede - added -DINSTALL_DOC=on/off option to build doxygen documentation (in ./doc/html/index.html) -- create DD4hepConfig.cmake for easy building against DD4hep +- create DD4hepConfig.cmake for easy building against dd4hep ( see examples CMakeLists.txt) - fixed doxygen API documentation (C.Rosemann) @@ -1399,7 +1399,7 @@ F. Gaede - creates SimTrackerHits for VXD, SIT and TPC - creates SimCalorimeterHits for AHcal barrele and endcap - works now wigth ILDExSimu _and_ SLIC if no assemblies are used - - assemblies work with the DD4hep Geant4Converter and VolumeManager + - assemblies work with the dd4hep Geant4Converter and VolumeManager - added a prototype example for a ROOT independent plugin mechanism for SensitiveDetectors - added example implemetation for Calice test beam @@ -1422,7 +1422,7 @@ F. Gaede not compliant to 1). - The G4 package allows now to translate TGeo geometries to Geant4. Visual inspection has shown an agreement between the two geometries. -- The TGeo to LCDD/GDML conversion is still buggy. Hence, simulations +- The TGeo to Detector/GDML conversion is still buggy. Hence, simulations using slic as an engine do not yet work. This is being looked at. IMPORTANT NOTICE: @@ -1464,11 +1464,11 @@ F. Gaede +----------+---------+-------------------------------------------+ | Total | Leaking | Type identifier | +----------+---------+-------------------------------------------+ - | 13| 0|DD4hep::Geometry::DetElement::Object - | 3| 0|DD4hep::Geometry::SensitiveDetector::Object - | 3| 0|DD4hep::Geometry::Readout::Object - | 1| 0|DD4hep::Geometry::OverlayedField::Object - | 1| 0|DD4hep::Geometry::CartesianField::Object + | 13| 0|dd4hep::DetElement::Object + | 3| 0|dd4hep::SensitiveDetector::Object + | 3| 0|dd4hep::Readout::Object + | 1| 0|dd4hep::OverlayedField::Object + | 1| 0|dd4hep::CartesianField::Object .... Ideally the second column only has "0"s. Instances of 1 may be OK (singletons). ``` @@ -1480,11 +1480,11 @@ F. Gaede # v00-01 2013/20/03 Markus Frank -- Finished the compact->lcdd converter - Extract lcdd information +- Finished the compact->description converter + Extract description information ``` - $ > geoConverter -compact2lcdd -input file:<compact-input-xml-file> -output <detector>.lcdd - $ > <SimDist>/scripts/slic.sh -o output.slcio -g SiD.lcdd -m <geant4-macro>.mac -r 100 + $ > geoConverter -compact2description -input file:<compact-input-xml-file> -output <detector>.description + $ > <SimDist>/scripts/slic.sh -o output.slcio -g SiD.description -m <geant4-macro>.mac -r 100 ``` - Finished the compact->gdml converter @@ -1538,6 +1538,6 @@ F. Gaede 'thisdd4hep.(c)sh' do include these directories 2013/20/02 Markus Frank -- DD4hep release notes. Better start them late than never. - If you perform significant changes to the DD4hep core, +- dd4hep release notes. Better start them late than never. + If you perform significant changes to the dd4hep core, plase leave a small notice here. diff --git a/doc/build.sh b/doc/build.sh index e552f8aa1..403bafff4 100644 --- a/doc/build.sh +++ b/doc/build.sh @@ -17,7 +17,7 @@ if test -n "${ARCH_OS}"; then if test -n "${GCC_VSN}"; then - svn co https://svnsrv.desy.de/basic/aidasoft/DD4hep/trunk DD4hep + svn co https://svnsrv.desy.de/basic/aidasoft/DD4hep/trunk dd4hep export BUILD_DIR=`pwd`/${ARCH_OS}-${GCC_VSN}; export ARCH=x86_64-${ARCH_OS}; if test $GCC_VSN = "gcc46"; diff --git a/doc/build_doc.sh b/doc/build_doc.sh index 06e1ed1b2..1d6f1b172 100644 --- a/doc/build_doc.sh +++ b/doc/build_doc.sh @@ -8,7 +8,7 @@ cd build_doc; cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_INSTALL_PREFIX=${TARGET}/DD4hep \ -DCMAKE_MODULE_PATH=:${TARGET}/DD4hep \ - -DDD4hep_INCLUDE_DIRS=${TARGET}/DD4hep/include \ + -Ddd4hep_INCLUDE_DIRS=${TARGET}/DD4hep/include \ -DDD4HEP_USE_XERCESC=ON \ -DXERCESC_ROOT_DIR=${SW}/xercesc \ -DDD4HEP_USE_BOOST=ON \ diff --git a/doc/cmake.cmds b/doc/cmake.cmds index c36a4ee25..2497b39d4 100644 --- a/doc/cmake.cmds +++ b/doc/cmake.cmds @@ -1,11 +1,11 @@ # -# ++++ Build DD4hep (simplest) +# ++++ Build dd4hep (simplest) # cmake -DCMAKE_BUILD_TYPE=Debug -DDD4HEP_USE_GEANT4=OFF -DDD4HEP_USE_PYROOT=OFF \ -DCMAKE_INSTALL_PREFIX=../DD4hep \ ../DD4hep # -# ++++ Build DD4hep with XERCES +# ++++ Build dd4hep with XERCES # cmake -DCMAKE_BUILD_TYPE=Debug \ -DDD4HEP_USE_GEANT4=OFF -DDD4HEP_USE_PYROOT=OFF \ @@ -14,7 +14,7 @@ cmake -DCMAKE_BUILD_TYPE=Debug \ ../DD4hep # # -# ++++ Build DD4hep with XERCES and GEANT4 +# ++++ Build dd4hep with XERCES and GEANT4 # cmake -DCMAKE_BUILD_TYPE=Debug \ -DDD4HEP_USE_GEANT4=ON -DGeant4_ROOT_DIR=${G4SYS} -DCLHEP_ROOT_DIR=${CLHEPSYS} \ @@ -24,7 +24,7 @@ cmake -DCMAKE_BUILD_TYPE=Debug \ ../DD4hep # # -# ++++ Build DD4hep with GEANT4 (no Xerces) +# ++++ Build dd4hep with GEANT4 (no Xerces) # cmake -DCMAKE_BUILD_TYPE=Debug \ -DDD4HEP_USE_GEANT4=ON -DGeant4_ROOT_DIR=${G4SYS} \ @@ -62,7 +62,7 @@ export ROOTSYS=${location}/ROOT/5.34.19/${CONFIG}; Geant4=${location}/Geant4/9.6.p03/${CONFIG}; ROOTlibs=${location}/ROOT/5.34.19/${CONFIG}/lib; XERCESClibs=${location}/XercesC/3.1.1p1/${CONFIG}/lib; -DD4hepLibs=${location}/DD4hep/v00-09/${CONFIG}/lib; +dd4hepLibs=${location}/DD4hep/v00-09/${CONFIG}/lib; CLHEPlibs=${location}/clhep/2.1.4.1/${CONFIG}/lib; Geant4libs=${Geant4}/lib64; Pythonlibs=${location}/Python/2.7.6/${CONFIG}/lib; diff --git a/doc/doxygen/DD4hepFigures.dox b/doc/doxygen/DD4hepFigures.dox index 1503ff959..347573141 100644 --- a/doc/doxygen/DD4hepFigures.dox +++ b/doc/doxygen/DD4hepFigures.dox @@ -6,17 +6,17 @@ namespace DoxygenFigures { /** \image html CERN-logo.png -\image html DD4hep_big_picture.png +\image html dd4hep_big_picture.png -\image html DD4hep_compact_xml.png +\image html dd4hep_compact_xml.png -\image html DD4hep_classes.png +\image html dd4hep_classes.png -\image html DD4hep_compact_xml.png +\image html dd4hep_compact_xml.png */ -class DD4hepFigures { +class dd4hepFigures { }; } diff --git a/doc/doxygen/DD4hepGroups.h b/doc/doxygen/DD4hepGroups.h index a95bb5272..0435595c9 100644 --- a/doc/doxygen/DD4hepGroups.h +++ b/doc/doxygen/DD4hepGroups.h @@ -1,56 +1,56 @@ -/// Generic shared objects and functions for all DD4hep areas +/// Generic shared objects and functions for all dd4hep areas /** - * \defgroup DD4HEP DD4hep classes and objects + * \defgroup DD4HEP dd4hep classes and objects * @{ */ /**@}*/ -/// DD4hep XML utilities +/// dd4hep XML utilities /** - * \defgroup DD4HEP_XML DD4hep::XML classes and objects - * Summary of all XML utilities present in the DD4hep toolkit. + * \defgroup DD4HEP_XML dd4hep::XML classes and objects + * Summary of all XML utilities present in the dd4hep toolkit. * @{ */ /**@}*/ -/// DD4hep geometry components, classes and functions +/// dd4hep geometry components, classes and functions /** - * \defgroup DD4HEP_GEOMETRY DD4hep::Geometry components, classes and objects + * \defgroup DD4HEP_GEOMETRY dd4hep::detail components, classes and objects * @{ */ /**@}*/ -/// DD4hep Simulation components, classes and functions +/// dd4hep Simulation components, classes and functions /** - * \defgroup DD4HEP_SIMULATION DD4hep::Simulation components, classes and objects + * \defgroup DD4HEP_SIMULATION dd4hep::sim components, classes and objects * @{ */ /**@}*/ -/// DD4hep Alignment components, classes and functions +/// dd4hep Alignment components, classes and functions /** - * \defgroup DD4HEP_ALIGN DDAlign: DD4hep Detector geometry alignment components. + * \defgroup DD4HEP_ALIGN DDAlign: dd4hep Detector geometry alignment components. * @{ */ /**@}*/ -/// DD4hep Detector Conditions components, classes and functions +/// dd4hep Detector Conditions components, classes and functions /** - * \defgroup DD4HEP_CONDITIONS DDCond: DD4hep Detector Conditions components, classes and functions + * \defgroup DD4HEP_CONDITIONS DDCond: dd4hep Detector Conditions components, classes and functions * @{ */ /**@}*/ -/// DD4hep Event display components, classes and functions +/// dd4hep Event display components, classes and functions /** - * \defgroup DD4HEP_EVE DDEve: DD4hep event display components, classes and objects + * \defgroup DD4HEP_EVE DDEve: dd4hep event display components, classes and objects * @{ */ diff --git a/doc/doxygen/DD4hepMainpage.dox b/doc/doxygen/DD4hepMainpage.dox index 129a4ae67..8300e4203 100644 --- a/doc/doxygen/DD4hepMainpage.dox +++ b/doc/doxygen/DD4hepMainpage.dox @@ -1,10 +1,10 @@ /** -\mainpage DD4hep - Main page +\mainpage dd4hep - Main page <A href="#UsefulLinks">Useful links</A> -\section MAIN DD4hep - A Detector Description Toolkit for High Energy Physics Experiments +\section MAIN dd4hep - A Detector Description Toolkit for High Energy Physics Experiments \section INTRO Introduction The development of a coherent set of software tools for the description of @@ -18,7 +18,7 @@ materials used in the apparatus, but all parameters describing e.g. the detection techniques, constants required by alignment and calibration, description of the readout structures, conditions data, etc. -The design of the DD4hep toolkit +The design of the dd4hep toolkit is shaped on the experience of detector description systems, which were implemented for the LHC experiments, in particular the LHCb experiment, @@ -28,7 +28,7 @@ the Linear Collider. Designing a coherent set of tools, with most of the basic components already existing in one form or another, is an opportunity for getting the best of all existing solutions. -DD4hep aims to widely reuse used existing software components, in particular +dd4hep aims to widely reuse used existing software components, in particular the ROOT geometry, part of the ROOT project, a tool for building, browsing, navigating and visualizing detector geometries. The code is designed to optimize particle transport through complex @@ -38,9 +38,9 @@ sophisticated 3D visualization functionality, which is ideal for building detector and event displays. The second component is the Geant4 simulation toolkit, which is used to simulate the detector response from particle collisions in complex designs. -In DD4hep the geometrical +In dd4hep the geometrical representation provided by ROOT is the main source of information. -In addition DD4hep provides the automatic conversions to other geometrical +In addition dd4hep provides the automatic conversions to other geometrical representations, such as Geant4, and the convenient usage of these components without the reinvention of the existing functionality. @@ -97,7 +97,7 @@ The following main requirements influenced the design of the toolkit: . <img src="../LaTex/DD4hep_big_picture.png" height="400"/> -<b>The components of the DD4hep detector geometry toolkit.</b> +<b>The components of the dd4hep detector geometry toolkit.</b> \section DESIGN Toolkit Design @@ -125,7 +125,7 @@ with deviations from the ideal would be needed by the experiment. In the compact description the detector is parametrized in minimalistic terms with user provided parameters in XML. -XML is an open format, the DD4hep parsers do not validate against a fix schema +XML is an open format, the dd4hep parsers do not validate against a fix schema and hence allow to easily introduce new elements and attributes to describe detectors. This feature minimizes the burden on the end-user while still supporting flexibility. @@ -161,8 +161,8 @@ The compact description together with the detector constructors are sufficient to build the detector model and to visualize it. If during the lifetime of the experiment the detector model changes, the corresponding constructors will need to be adapted accordingly. -DD4hep provides already a palette of basic pre-implemented geometrical detector -concepts to design experiments. In view of usage of DD4hep as a detector +dd4hep provides already a palette of basic pre-implemented geometrical detector +concepts to design experiments. In view of usage of dd4hep as a detector description toolkit, this library may in the future also adopt generic designs of detector components created by end users e.g. during the design phase of future experiments. @@ -176,7 +176,7 @@ phase of future experiments. \section DETDESCMODEL Generic Detector Description Model -This is the heart of the DD4hep detector description toolkit. Its purpose is +This is the heart of the dd4hep detector description toolkit. Its purpose is to build in memory a model of the detector including its geometrical aspects as well as structural and functional aspects. The design reuses the elements from the ROOT geometry package and extends them in case required functionality @@ -196,7 +196,7 @@ the all TPC geometrical dimensions, the alignment and calibration constants and other slow varying conditions such as the gas pressure, end-plate temperatures etc. The $Detector$ $Element$ acts as a data concentrator. Applications may access the full experiment geometry and all connected data -through a singleton object called $LCDD$, which provides +through a singleton object called $Detector$, which provides management, bookkeeping and ownership to the model instances. The geometry is implemented using the ROOT geometry classes, which are used @@ -212,24 +212,24 @@ notation to end-users building custom $Detector$ $Constructors$. Here you can find the manuals: -- The basic <A href="../DD4hepManual.pdf">DD4hep manual</A>. +- The basic <A href="../DD4hepManual.pdf">dd4hep manual</A>. - The <A href="../DDG4Manual.pdf">DDG4 manual</A> to invoke the simulation toolkit Geant4 taking advantage of - detector descriptions implemented in DD4hep. + detector descriptions implemented in dd4hep. - The DDAlign manual. A Geometry alignment toolkit to handle geometrical imperfections. -- The DDCond manual to handle detector conditions for DD4hep based deytector descriptions. +- The DDCond manual to handle detector conditions for dd4hep based deytector descriptions. (Under construction though). -- The <A href="../DDEveManual.pdf">DDEve manual</A> to visualize DD4hep geometries. +- The <A href="../DDEveManual.pdf">DDEve manual</A> to visualize dd4hep geometries. (Under construction though). - <A href="../DD4hep_Diagrams.pdf">UML diagrams</A> from the design phase - <A href="../refman.pdf">Doxygen Manual</A> in pdf format - <A href="../DD4hep_Tutorial.pdf">Tutorial</A>. Relatively old... - <A href="http://cds.cern.ch/record/1473120/files/AIDA-D2_3.pdf">Design document</A> -- <A href="https://sft.its.cern.ch/jira/browse/DDFORHEP">DD4hep bug tracker</A> +- <A href="https://sft.its.cern.ch/jira/browse/DDFORHEP">dd4hep bug tracker</A> . CERN intra-web: -- DD4hep mails <A href="https://groups.cern.ch/group/dd4hep-developers/Lists/Archive/100.aspx">archive</A>. -- <A href="http://aidasoft.web.cern.ch/DD4hep">DD4hep AIDA software page</A> +- dd4hep mails <A href="https://groups.cern.ch/group/DD4hep-developers/Lists/Archive/100.aspx">archive</A>. +- <A href="http://aidasoft.web.cern.ch/DD4hep">dd4hep AIDA software page</A> . Desy: diff --git a/doc/external_build.txt b/doc/external_build.txt index fd22d3005..089e242ab 100644 --- a/doc/external_build.txt +++ b/doc/external_build.txt @@ -1,6 +1,6 @@ rm -rf build;mkdir build;cd build -cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep -DCMAKE_MODULE_PATH=:/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep -DDD4hep_INCLUDE_DIRS=/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep/include -DD4hep_DIR=/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep -DD4hep_ROOT=/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep -DDD4HEP_USE_XERCESC=ON -DXERCESC_ROOT_DIR=/home/frankm/SW/xercesc -DDD4HEP_USE_BOOST=ON -DDD4HEP_USE_LCIO=ON -DLCIO_DIR=/home/frankm/SW/lcio/v02-04-03 -DGeant4_ROOT=/home/frankm/SW/g4_10.01_dbg -DDD4HEP_USE_GEANT4=ON -DDD4HEP_USE_PYROOT=OFF -DBUILD_TESTING=ON .. +cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep -DCMAKE_MODULE_PATH=:/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep -Ddd4hep_INCLUDE_DIRS=/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep/include -DD4hep_DIR=/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep -dd4hep_ROOT=/home/frankm/SW/DD4hep_head_dbg.root_v5.34.25.g4_10.01/DD4hep -DDD4HEP_USE_XERCESC=ON -DXERCESC_ROOT_DIR=/home/frankm/SW/xercesc -DDD4HEP_USE_BOOST=ON -DDD4HEP_USE_LCIO=ON -DLCIO_DIR=/home/frankm/SW/lcio/v02-04-03 -DGeant4_ROOT=/home/frankm/SW/g4_10.01_dbg -DDD4HEP_USE_GEANT4=ON -DDD4HEP_USE_PYROOT=OFF -DBUILD_TESTING=ON .. make -j 5 diff --git a/doc/externalize/ExpressionEvaluator.cpp b/doc/externalize/ExpressionEvaluator.cpp index 460f2b8c9..884f496b4 100644 --- a/doc/externalize/ExpressionEvaluator.cpp +++ b/doc/externalize/ExpressionEvaluator.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -27,7 +27,7 @@ namespace { } } -namespace DD4hep { +namespace dd4hep { XmlTools::Evaluator& evaluator() { static XmlTools::Evaluator* e = 0; if ( !e ) { diff --git a/doc/externalize/ExtraParsers.cpp b/doc/externalize/ExtraParsers.cpp index 9591523f1..756018e57 100644 --- a/doc/externalize/ExtraParsers.cpp +++ b/doc/externalize/ExtraParsers.cpp @@ -17,7 +17,7 @@ // Note: // // This is an example file, which shows how to instantiate extera parsers, -// which are not part of DD4hep, but may be interesting for a +// which are not part of dd4hep, but may be interesting for a // client application. // //========================================================================== diff --git a/doc/externalize/ExtraProperties.cpp b/doc/externalize/ExtraProperties.cpp index c28d2e671..2f7823f73 100644 --- a/doc/externalize/ExtraProperties.cpp +++ b/doc/externalize/ExtraProperties.cpp @@ -17,7 +17,7 @@ // Note: // // This is an example file, which shows how to instantiate extera parsers, -// which are not part of DD4hep, but may be interesting for a +// which are not part of dd4hep, but may be interesting for a // client application. // //========================================================================== diff --git a/doc/externalize/PluginManager.cpp b/doc/externalize/PluginManager.cpp index f5f3480d7..f114463e5 100644 --- a/doc/externalize/PluginManager.cpp +++ b/doc/externalize/PluginManager.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. diff --git a/doc/externalize/Printout.cpp b/doc/externalize/Printout.cpp index 9c02b4ad6..a31b8c295 100644 --- a/doc/externalize/Printout.cpp +++ b/doc/externalize/Printout.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -24,24 +24,24 @@ using namespace std; namespace { string print_fmt = "%-16s %5s %s"; - DD4hep::PrintLevel print_lvl = DD4hep::INFO; - const char* print_level(DD4hep::PrintLevel lvl) { + dd4hep::PrintLevel print_lvl = dd4hep::INFO; + const char* print_level(dd4hep::PrintLevel lvl) { switch(lvl) { - case DD4hep::NOLOG: return "NOLOG"; - case DD4hep::VERBOSE: return "VERB "; - case DD4hep::DEBUG: return "DEBUG"; - case DD4hep::INFO: return "INFO "; - case DD4hep::WARNING: return "WARN "; - case DD4hep::ERROR: return "ERROR"; - case DD4hep::FATAL: return "FATAL"; - case DD4hep::ALWAYS: return " "; + case dd4hep::NOLOG: return "NOLOG"; + case dd4hep::VERBOSE: return "VERB "; + case dd4hep::DEBUG: return "DEBUG"; + case dd4hep::INFO: return "INFO "; + case dd4hep::WARNING: return "WARN "; + case dd4hep::ERROR: return "ERROR"; + case dd4hep::FATAL: return "FATAL"; + case dd4hep::ALWAYS: return " "; default: - if ( lvl> DD4hep::ALWAYS ) - return print_level(DD4hep::ALWAYS); - return print_level(DD4hep::NOLOG); + if ( lvl> dd4hep::ALWAYS ) + return print_level(dd4hep::ALWAYS); + return print_level(dd4hep::NOLOG); } } - size_t print_out(DD4hep::PrintLevel lvl, const char* src, const char* fmt, va_list& args) { + size_t print_out(dd4hep::PrintLevel lvl, const char* src, const char* fmt, va_list& args) { char text[4096]; ::snprintf(text,sizeof(text),print_fmt.c_str(),src,print_level(lvl),fmt); size_t len = ::vfprintf(stdout, text, args); @@ -51,14 +51,14 @@ namespace { } /// Set new print level. Returns the old print level -DD4hep::PrintLevel DD4hep::setPrintLevel(PrintLevel new_level) { +dd4hep::PrintLevel dd4hep::setPrintLevel(PrintLevel new_level) { PrintLevel old = print_lvl; print_lvl = new_level; return old; } /// Access the current printer level -DD4hep::PrintLevel DD4hep::printLevel() { +dd4hep::PrintLevel dd4hep::printLevel() { return print_lvl; } @@ -69,7 +69,7 @@ DD4hep::PrintLevel DD4hep::printLevel() { * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const char* src, const char* fmt, ...) { +int dd4hep::printout(PrintLevel severity, const char* src, const char* fmt, ...) { if (severity >= print_lvl) { va_list args; va_start(args, fmt); @@ -85,7 +85,7 @@ int DD4hep::printout(PrintLevel severity, const char* src, const char* fmt, ...) * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::printout(PrintLevel severity, const string& src, const char* fmt, ...) { +int dd4hep::printout(PrintLevel severity, const string& src, const char* fmt, ...) { if (severity >= print_lvl) { va_list args; va_start(args, fmt); @@ -100,7 +100,7 @@ int DD4hep::printout(PrintLevel severity, const string& src, const char* fmt, .. * \arg fmt [string,read-only] Format string for ellipsis args * \return Status code indicating success or failure */ -int DD4hep::except(const char* src, const char* fmt, ...) { +int dd4hep::except(const char* src, const char* fmt, ...) { char str[4096]; va_list args; va_start(args, fmt); diff --git a/doc/externalize/Printout.h b/doc/externalize/Printout.h index 563c724a4..68af4ecea 100644 --- a/doc/externalize/Printout.h +++ b/doc/externalize/Printout.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,7 +18,7 @@ #include <string> /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { enum PrintLevel { NOLOG = 0, VERBOSE = 1, diff --git a/doc/externalize/README.txt b/doc/externalize/README.txt index 7cf9d454d..12dd8023f 100644 --- a/doc/externalize/README.txt +++ b/doc/externalize/README.txt @@ -1,9 +1,9 @@ -DD4hep externalizations +dd4hep externalizations ======================= From time to time is is useful to import some pieces of other frameworks in new projects. -DD4hep has currently the following components, which can be used also standalone outside: +dd4hep has currently the following components, which can be used also standalone outside: - The XML parsing framework including the expression evaluator. - The property mechanism uing the boost::spirit parsers. diff --git a/doc/externalize/externalize_properties.sh b/doc/externalize/externalize_properties.sh index 0ca4ddf7e..6a46fbb17 100755 --- a/doc/externalize/externalize_properties.sh +++ b/doc/externalize/externalize_properties.sh @@ -1,6 +1,6 @@ #!/bin/bash #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -42,8 +42,8 @@ if test "" = "${TARGET}"; then cat <<EOF Usage: bash ${0} <scp-target-directory> e.g. ${USER}/cmtuser/Online_vxry/Online/Dataflow - This script extracts the DD4hep property mechanism so that - it can be used without DD4hep. + This script extracts the dd4hep property mechanism so that + it can be used without dd4hep. Note: to use the properties and the parsers, you also MUST externalize the Evaluator. diff --git a/doc/externalize/externalize_xml.sh b/doc/externalize/externalize_xml.sh index 9a6c6957c..34e8e8523 100755 --- a/doc/externalize/externalize_xml.sh +++ b/doc/externalize/externalize_xml.sh @@ -1,6 +1,6 @@ #!/bin/bash #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -40,8 +40,8 @@ if test "" = "${TARGET}"; then cat <<EOF Usage: bash ${0} <scp-target-directory> e.g. ${USER}/cmtuser/Online_vxry/Online/Dataflow - This script extracts the DD4hep XML interface so that - it can be used without DD4hep. + This script extracts the dd4hep XML interface so that + it can be used without dd4hep. EOF exit 1; fi; diff --git a/doc/gdml_root.C b/doc/gdml_root.C index 4c0524df9..ce65dd9b2 100644 --- a/doc/gdml_root.C +++ b/doc/gdml_root.C @@ -1,9 +1,9 @@ // $Id:$ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // -// Standalone ROOT script to load geometries from DD4hep: +// Standalone ROOT script to load geometries from dd4hep: // // Full GDML cycle can be tested (deplace <detector> with some meaningful identifier): // a) Extract gdml information diff --git a/doc/prepare_a_release.howto b/doc/prepare_a_release.howto index c687a3c6d..577faf913 100644 --- a/doc/prepare_a_release.howto +++ b/doc/prepare_a_release.howto @@ -1,7 +1,7 @@ #################################################### # -# Short Howto for preparing a new DD4hep release +# Short Howto for preparing a new dd4hep release # # F.Gaede, DESY # Aug 2014 diff --git a/doc/web/DD4hepStartersGuide.markup b/doc/web/DD4hepStartersGuide.markup index 4032896bd..d1a837bbd 100644 --- a/doc/web/DD4hepStartersGuide.markup +++ b/doc/web/DD4hepStartersGuide.markup @@ -9,7 +9,7 @@ <tr> <td id="projectlogo"><img alt="Logo" src="LaTex/CERN-logo.png" height="72"/></td> <td id="projectlogo"><img alt="Logo" src="LaTex/DD4hep-AIDA-logo.png" height="72"/></td> - <td id="projectbrief">DD4hep<br>The AIDA detector description toolkit</br> + <td id="projectbrief">dd4hep<br>The AIDA detector description toolkit</br> for high energy physics experiments</br></td> </tr> </tbody> @@ -20,7 +20,7 @@ <div class="space"></div> <div class="title"> -DD4hep +dd4hep <br> <br> Starter's Guide @@ -33,10 +33,10 @@ Starter's Guide <div class="space"></div> <div class="abstract"> -This starter's guide contains the basic information about <it>DD4hep</it>. +This starter's guide contains the basic information about <it>dd4hep</it>. This is the license information, instruction to obtain and build the software as well as suggestions of further reading concerning -the various <it>DD4hep</it> subpackages. +the various <it>dd4hep</it> subpackages. </div> <div class="space"></div> @@ -46,31 +46,31 @@ the various <it>DD4hep</it> subpackages. ------------------------------------------------------------------- -# *DD4hep* Project Information +# *dd4hep* Project Information ------------------------------------------------------------------- -## The *DD4hep* Project Web +## The *dd4hep* Project Web The project's welcome page can be found under the folling URL: [http://aidasoft.web.cern.ch/DD4hep](http://aidasoft.web.cern.ch/DD4hep) ***Please note:*** -To access the CERN intranet, to create new bugs in the *DD4hep* bug +To access the CERN intranet, to create new bugs in the *dd4hep* bug tracker etc, you require a CERN account, but you can create an external account very easily following [these instructions](https://account.cern.ch/account/Externals/RegisterAccount.aspx). -## The *DD4hep* Developers Mailing List +## The *dd4hep* Developers Mailing List Mailing list to contact developers is: **dd4hep-developers@cern.ch**. The mailing list archives can be consulted using the following -[URL](https://groups.cern.ch/group/dd4hep-developers/Lists/Archive/100.aspx). +[URL](https://groups.cern.ch/group/DD4hep-developers/Lists/Archive/100.aspx). -## The *DD4hep* Issue Tracker +## The *dd4hep* Issue Tracker Bug tracking and issue solving as well as feature requests may be addressed to the developers using the following @@ -82,18 +82,18 @@ nano-seconds. Most of the contributors also have other assignments! ## License -*DD4hep* is made available under the GPL license. -For full details see the file LICENSE in the *DD4hep* distribution or +*dd4hep* is made available under the GPL license. +For full details see the file LICENSE in the *dd4hep* distribution or at the following [URL](http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/LICENCE?view=markup). ------------------------------------------------------------------- -# Building and Installing *DD4hep* +# Building and Installing *dd4hep* ------------------------------------------------------------------- -The *DD4hep* software is distributed for each release in the form of +The *dd4hep* software is distributed for each release in the form of * Precompiled tar-balls, where users only untar the downloaded software. @@ -102,7 +102,7 @@ The *DD4hep* software is distributed for each release in the form of ## Release Versioning -Currently *DD4hep* is released several times a year depending on the +Currently *dd4hep* is released several times a year depending on the importance of new functionality. The versioning schema consists of two digits in the form: @@ -114,7 +114,7 @@ quite young and the binary compatibility is broken with each release. Code changes, which require clients to modify existing code are getting -rare, since the main package *DD4hep* is maturing. +rare, since the main package *dd4hep* is maturing. ## Supported Platforms @@ -127,9 +127,9 @@ Declined operating systems: - Microsoft Windows. -In principle *DD4hep* does not depend dramatically on specific +In principle *dd4hep* does not depend dramatically on specific operating systems. In principle any compiler modern enough to support -**C++11** may should be capable of building *DD4hep*. +**C++11** may should be capable of building *dd4hep*. There are some ***C++ABI*** issues, which may have to be sorted out for non-gcc platforms, but most of this work was done for MacOS and it should be feasible to solve these problems for other platforms @@ -142,36 +142,36 @@ First glance information may be taken from the readme file at the following ## Prerequisites -*DD4hep* depends on a number of "external" packages. The user will need to +*dd4hep* depends on a number of "external" packages. The user will need to install these in his/her system before building and running the examples. -Depending on the usage of *DD4hep* and it's subpackages software of other +Depending on the usage of *dd4hep* and it's subpackages software of other projects is used. The configuration options are described later in this document. -- *DD4hep* uses the *CMake* build system. A recent version +- *dd4hep* uses the *CMake* build system. A recent version (version 2.8 or higher) of [*CMake*](#bib_cmake) must be installed. -- *DD4hep* itself depends on the +- *dd4hep* itself depends on the [ROOT geometry package](#bib_ROOT-tgeo) **Tgeo** and in turn on the basic [ROOT libraries](#bib_ROOT). Version 5.30 or higher is required. -- *DD4hep* uses the [*Boost-Spirit*](#bib_boost) +- *dd4hep* uses the [*Boost-Spirit*](#bib_boost) implementation to interprete input and options. -- Optionally *DD4hep* can use [*Xerces-C*](#bib_xerces) as a +- Optionally *dd4hep* can use [*Xerces-C*](#bib_xerces) as a parser for XML input. By default it uses [*TinyXML*](#bib_tinyxml), - which is included in the *DD4hep* release. + which is included in the *dd4hep* release. - The subpackages for alignment DDAlign, conditions data \DDC and event display *DDEve* do not require additional external libraries. - The simulation extensions extension *DDG4* in addition depends on a valid [*Geant4*](#bib_geant4) installation. Version 9 and 10 of Geant4 is supported. -If *DD4hep* is not installed in the system name-space (/usr/bin, /usr/lib, etc.) -any number of *DD4hep* versions can exist in parallel. +If *dd4hep* is not installed in the system name-space (/usr/bin, /usr/lib, etc.) +any number of *dd4hep* versions can exist in parallel. ## Package Contents -The *DD4hep* project consists of several packages. +The *dd4hep* project consists of several packages. The idea has been to separate the common parts of the detector description toolkit from concrete detector examples. @@ -183,20 +183,20 @@ The package provides the basic mechanisms for constructing the "Generic Detector Description Model" in memory from XML compact detector definition files. **DDG4**: -Is the package that contains the conversion of *DD4hep* geometry into +Is the package that contains the conversion of *dd4hep* geometry into Geant4 geometry to be used for simulation. **DDAlign**: The DDAlign toolkit implements a modular and flexible approach to -introduce and access the alignment parameters in *DD4hep* geometry +introduce and access the alignment parameters in *dd4hep* geometry descruptions. **DDCond**: -Support for conditions data for *DD4hep*. +Support for conditions data for *dd4hep*. **DDEve**: *DDEve* provides an event display for detector geometries -implemented using *DD4hep*. +implemented using *dd4hep*. *DDEve* hereby takes advantage of the TEve toolkit naturally provided by the ROOT framework like the ROOT geometry toolkit TGeo. @@ -210,14 +210,14 @@ require to compiler and link against Geant4 but not the reconstruction application. -## Installing *DD4hep* from Precompiled Binaries +## Installing *dd4hep* from Precompiled Binaries The binaries are available for downloading from afs under the following location: **to be done, currently not available....**. Once downloaded you need to unzip and de-tar the file. For example, if you have downloaded the debug -version of *DD4hep* v00-13 for Linux-SLC6: +version of *dd4hep* v00-13 for Linux-SLC6: <code> % gunzip dd4hep-v00-13-slc6-gcc4.8-dbg.tar.gz % tar xvf dd4hep-v00-13-slc6-gcc4.8-dbg.tar.gz @@ -229,10 +229,10 @@ the directory structure. **TO BE DONE !!!** -## Access and Build *DD4hep* from the Repository +## Access and Build *dd4hep* from the Repository The following sections explain how to obtain a usable binary -build of the *DD4hep* software. +build of the *dd4hep* software. ### Downloading the Code from the Repository @@ -241,21 +241,21 @@ check out the most recent source. The compressed file is a one time only choice; every time you would like to upgrade you will need to download the entire new version. -The *DD4hep* code is accessible in anonymous read-only mode by anybody +The *dd4hep* code is accessible in anonymous read-only mode by anybody from the svn repository at **Desy**: <code> % svn co https://svnsrv.desy.de/basic/aidasoft/DD4hep/trunk -% mv trunk DD4hep\_src +% mv trunk dd4hep\_src </code> ### Installing the Source from Subversion -This paragraph describes how to checkout and build *DD4hep* from a checkout using subversion for Unix-like systems: +This paragraph describes how to checkout and build *dd4hep* from a checkout using subversion for Unix-like systems: <code> -% mkdir DD4hep\_install -% mkdir DD4hep\_build +% mkdir dd4hep\_install +% mkdir dd4hep\_build % export DD4hepINSTALL=`pwd`/DD4hep\_install -% cd DD4hep_build +% cd dd4hep_build % cmake -DCMAKE\_BUILD\_TYPE=Debug \ -DCMAKE\_INSTALL\_PREFIX=\${DD4hepINSTALL} \ [option [option]] ... @@ -275,11 +275,11 @@ libraries in the shared lib search path (this will vary with OS, shell, etc.) e. ### CMake Configuration Options -We describe in the following only options, which are unique to the build of *DD4hep*. Boolean values are either **ON** or **OFF** to enable or disable a feature. +We describe in the following only options, which are unique to the build of *dd4hep*. Boolean values are either **ON** or **OFF** to enable or disable a feature. <table class="cmake_var"> -<tr><td colspan=2 class="cmake_desc">DD4hep_ROOT=<directory></td></tr> -<tr><td class="item">Function: </td><td> Location of the *DD4hep* installation directory.</td></tr> +<tr><td colspan=2 class="cmake_desc">dd4hep_ROOT=<directory></td></tr> +<tr><td class="item">Function: </td><td> Location of the *dd4hep* installation directory.</td></tr> </table> <table class="cmake_var"> @@ -322,7 +322,7 @@ We describe in the following only options, which are unique to the build of *DD4 <table class="cmake_var"> <tr><td colspan=2 class="cmake_desc">BUILD_TESTING=<boolean> </td></tr> <tr><td class="item">Default: </td><td> OFF </td></tr> -<tr><td class="item">Function: </td><td> Build *DD4hep* tests. </td></tr> +<tr><td class="item">Function: </td><td> Build *dd4hep* tests. </td></tr> </table> <table class="cmake_var"> @@ -335,7 +335,7 @@ We describe in the following only options, which are unique to the build of *DD4 <table class="cmake_var"> <tr><td colspan=2 class="cmake_desc">DD4HEP_USE_PYROOT=<boolean> </td></tr> <tr><td class="item">Default: </td><td> OFF </td></tr> -<tr><td class="item">Function: </td><td> Steer the usage of <bf>PyROOT</bf> *DD4hep* detector construction. </td></tr> +<tr><td class="item">Function: </td><td> Steer the usage of <bf>PyROOT</bf> *dd4hep* detector construction. </td></tr> <tr><td class="item">Remark: </td><td> <bf>DEPRECATED</bf>. Purely historical and unsupported. </td></tr> </table> @@ -344,12 +344,12 @@ We describe in the following only options, which are unique to the build of *DD4 During the build a shell script is generated and copied to the installation area called "thisdd4hep.(c)sh". To setup the runtime and build environment for layered software -using *DD4hep* this script musty be source'd. +using *dd4hep* this script musty be source'd. -### Using *DD4hep* in Layered Software as a Client +### Using *dd4hep* in Layered Software as a Client -It is necessary to setup the *DD4hep* runtime environment before +It is necessary to setup the *dd4hep* runtime environment before the configuration of the client software. In the installation directory the cmake build instructions **DD4hepConfig.cmake** are generated, @@ -358,7 +358,7 @@ Cmake should pick-up the build instructions automatically. ### Relocation of the Installation directory -Once build, *DD4hep* can be tar'ed and/or moved to any other +Once build, *dd4hep* can be tar'ed and/or moved to any other directory. The instructions for the usage by layered client software stay intact. @@ -366,7 +366,7 @@ stay intact. ### Example Build Script -The following commands may be used to build *DD4hep* from the +The following commands may be used to build *dd4hep* from the [script in the svn repository](http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/example_build_script.sh). <pre> #!/bin/bash @@ -425,25 +425,25 @@ python examples/DDG4/examples/CLICSidSimu.py ------------------------------------------------------------------- -# *DD4hep* Documentation +# *dd4hep* Documentation ------------------------------------------------------------------- General build information is provided by [this document](http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/DD4hepStarter.pdf): -In addition all sub-packages of the *DD4hep* toolkit provide documentation in the form of manuals. +In addition all sub-packages of the *dd4hep* toolkit provide documentation in the form of manuals. Suggestions (or better improvements) of user documentation of packages being validated are highly welcome. Please contact the -developers using the *DD4hep* mailing list. +developers using the *dd4hep* mailing list. If a package is under development and not offered to the public, please ignore the package and it's errors unless you are eager to contribute. -## *DD4hep* User's Guide +## *dd4hep* User's Guide -The *DD4hep* guide is part of the distribution and the +The *dd4hep* guide is part of the distribution and the [svn repository](http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/DD4hepManual.pdf). <br>Author: M.Frank @@ -467,7 +467,7 @@ The *DDCond* guide is part of the distribution and the The DDEve guide is part of the distribution and the [svn repository](http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/DDEveManual.pdf). -**Note:** This package is not officially part of *DD4hep* and in addition +**Note:** This package is not officially part of *dd4hep* and in addition under development. The guide is very rudimentary. ## *DDG4* User's Guide @@ -501,7 +501,7 @@ provides daily information about the the current status of the software in the s ------------------------------------------------------------------- -*DD4hep* was started by me in the year 2012 in response of the +*dd4hep* was started by me in the year 2012 in response of the needs of the linear collider community (ILD, CLIC) for a flexible detector geometry usable to develop tracking code. This development relatively quickly emerged into desire to actually @@ -524,7 +524,7 @@ I would appreciate to be contacted in advance for a brief discussion of your plans. -*DD4hep* is supposed to quickly enable users to develop test and +*dd4hep* is supposed to quickly enable users to develop test and simulate the physics response of new detector models and concepts. Although a certain palette of such subdetectors concepts is provided in the **DDDetectors** package, the palette is @@ -540,7 +540,7 @@ or more detailed sensitive detector concepts for the *DDG4* package. ## Contributors In the [CREDITS file](http://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/doc/CREDITS) -the most important contributors to the *DD4hep* project and a +the most important contributors to the *dd4hep* project and a short description of their work can be found. If you think you should be part of this list, but somehow got forgotten, please contact us. @@ -557,7 +557,7 @@ No a lot to be said: **Good luck! ... and have fun!**. ## References <table> -<tr><td>[1]</td><td> <div id="bib_DD4hep"><a href="http://aidasoft.web.cern.ch/DD4hep">DD4hep web page</a>.</div> +<tr><td>[1]</td><td> <div id="bib_dd4hep"><a href="http://aidasoft.web.cern.ch/DD4hep">dd4hep web page</a>.</div> </td></tr> <tr><td>[2]</td><td> <div id="bib_ROOT-tgeo">R.Brun, A.Gheata, M.Gheata, "The ROOT geometry package",<br> Nuclear Instruments and Methods A 502 (2003) 676-680.</div> diff --git a/examples/AlignDet/CMakeLists.txt b/examples/AlignDet/CMakeLists.txt index ca177f762..08d8caa4d 100644 --- a/examples/AlignDet/CMakeLists.txt +++ b/examples/AlignDet/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -30,7 +30,7 @@ dd4hep_add_test_reg( AlignDet_Telescope_dump_geometry COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_AlignDet.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -compact file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml - -plugin DD4hepDetectorDump + -plugin dd4hepDetectorDump REGEX_PASS "/world/Telescope/module_9 NumDau\\:1 VolID\\:00000903 Place" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) @@ -60,7 +60,7 @@ dd4hep_add_test_reg( AlignDet_Telescope_dump_xml EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_AlignmentExample_read_xml -input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml -delta file:${DD4hep_DIR}/examples/Conditions/data/repository.xml - -plugin DD4hep_ConditionsXMLRepositoryWriter -iov_type run -iov_value 1500 + -plugin dd4hep_ConditionsXMLRepositoryWriter -iov_type run -iov_value 1500 REGEX_PASS "Summary: Converted 33 conditions. 0 conditions without recipe" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) @@ -71,7 +71,7 @@ dd4hep_add_test_reg( AlignDet_Telescope_write_xml EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_AlignmentExample_read_xml -input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml -delta file:${DD4hep_DIR}/examples/Conditions/data/repository.xml - -plugin DD4hep_ConditionsXMLRepositoryWriter -iov_type run -iov_value 1500 -manager -output new_cond.xml + -plugin dd4hep_ConditionsXMLRepositoryWriter -iov_type run -iov_value 1500 -manager -output new_cond.xml REGEX_PASS "Successfully wrote 33 conditions \\(0 unconverted\\) to file: new_cond.xml" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) @@ -124,7 +124,7 @@ dd4hep_add_test_reg( AlignDet_CLICSiD_stress_LONGTEST ) # #---Testing: Load Telescope geometry and read and print alignments -------- -dd4hep_add_test_reg( AlignDet_CLICSiD_align_nominal +dd4hep_add_test_reg( AlignDet_CLICSiD_align_nominal_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_AlignDet.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_AlignmentExample_nominal -input file:${DD4hep_DIR}/examples/CLICSiD/compact/compact.xml @@ -137,32 +137,32 @@ dd4hep_add_test_reg( AlignDet_AlephTPC_load COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_AlignDet.sh" EXEC_ARGS geoPluginRun -input file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC.xml - -destroy -no-interpreter -plugin DD4hep_GlobalAlignmentInstall - REGEX_PASS "189 nodes/ 23 volume UID's in LCDD Geometry" + -destroy -no-interpreter -plugin dd4hep_GlobalAlignmentInstall + REGEX_PASS "189 nodes/ 23 volume UID's in Detector Geometry" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) # #---Testing: Load and misalign ALEPH TPC geometry ------------------------- -dd4hep_add_test_reg( AlignDet_Global_AlephTPC_align +dd4hep_add_test_reg( AlignDet_AlephTPC_global_align COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_AlignDet.sh" EXEC_ARGS geoPluginRun -input file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC.xml -destroy -no-interpreter - -plugin DD4hep_GlobalAlignmentInstall - -plugin DD4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_alignment.xml BUILD_DEFAULT + -plugin dd4hep_GlobalAlignmentInstall + -plugin dd4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_alignment.xml BUILD_DEFAULT REGEX_PASS "Successfully parsed XML: AlephTPC_alignment.xml" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) # #---Testing: Load and misalign ALEPH TPC geometry ------------------------- -dd4hep_add_test_reg( AlignDet_Global_AlephTPC_reset +dd4hep_add_test_reg( AlignDet_AlephTPC_global_reset COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_AlignDet.sh" EXEC_ARGS geoPluginRun -input file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC.xml -destroy -no-interpreter - -plugin DD4hep_GlobalAlignmentInstall - -plugin DD4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_alignment.xml - -plugin DD4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_reset.xml + -plugin dd4hep_GlobalAlignmentInstall + -plugin dd4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_alignment.xml + -plugin dd4hepXMLLoader file:${DD4hep_DIR}/examples/AlignDet/compact/AlephTPC_reset.xml REGEX_PASS "Successfully parsed XML: AlephTPC_reset.xml" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) diff --git a/examples/AlignDet/compact/AlephTPC_alignment.xml b/examples/AlignDet/compact/AlephTPC_alignment.xml index 9d829c6c9..169cdfd44 100644 --- a/examples/AlignDet/compact/AlephTPC_alignment.xml +++ b/examples/AlignDet/compact/AlephTPC_alignment.xml @@ -5,7 +5,7 @@ <subdetectors> <!-- Note: The subdetector name MUST be in the list of top level - detector elements attached to the LCDD structure. + detector elements attached to the Detector structure. A generic alignment transformation is defined by - a translation in 3D space identified in XML as a <position/> element diff --git a/examples/AlignDet/compact/AlephTPC_reset.xml b/examples/AlignDet/compact/AlephTPC_reset.xml index 0aeb0e41e..0a87017bc 100644 --- a/examples/AlignDet/compact/AlephTPC_reset.xml +++ b/examples/AlignDet/compact/AlephTPC_reset.xml @@ -3,7 +3,7 @@ <subdetectors> <!-- Note: The subdetector name MUST be in the list of top level - detector elements attached to the LCDD structure. + detector elements attached to the Detector structure. --> <detelement path="TPC" reset="false"> diff --git a/examples/AlignDet/compact/AlephTPC_reset_all.xml b/examples/AlignDet/compact/AlephTPC_reset_all.xml index c8a341956..a45fa86f0 100644 --- a/examples/AlignDet/compact/AlephTPC_reset_all.xml +++ b/examples/AlignDet/compact/AlephTPC_reset_all.xml @@ -3,7 +3,7 @@ <subdetectors> <!-- Note: The subdetector name MUST be in the list of top level - detector elements attached to the LCDD structure. + detector elements attached to the Detector structure. --> <detelement path="TPC" reset="true" reset_children="true"/> diff --git a/examples/AlignDet/compact/Telescope.xml b/examples/AlignDet/compact/Telescope.xml index f9940f03a..ceb6d9235 100644 --- a/examples/AlignDet/compact/Telescope.xml +++ b/examples/AlignDet/compact/Telescope.xml @@ -42,7 +42,7 @@ <detectors> <comment>No comment so far</comment> - <detector name="Telescope" type="DD4hep_Example_Telescope" vis="DetVis" id ="3" readout="TelescopeHits"> + <detector name="Telescope" type="dd4hep_Example_Telescope" vis="DetVis" id ="3" readout="TelescopeHits"> <!-- Front arm --> <module z="0.0*cm" id="1" vis="ModVis"> <sensor thickness="3*mm" pitch="55*micron" NoOfPixY="256" NoOfPixX="256" vis="SensorVis"/> diff --git a/examples/AlignDet/drivers/BoxSegment.py b/examples/AlignDet/drivers/BoxSegment.py index 2e4e6e6eb..dd50804ce 100644 --- a/examples/AlignDet/drivers/BoxSegment.py +++ b/examples/AlignDet/drivers/BoxSegment.py @@ -1,15 +1,15 @@ -def detector_BoxSegment(lcdd, det): +def detector_BoxSegment(description, det): box = det.find('box') mat = det.find('material') pos = det.find('position') rot = det.find('rotation') - mother = lcdd.worldVolume() - de = DetElement(lcdd, det.name, det.type, det.id) - sha = Box(lcdd, det.name+'_envelope', box.x, box.y, box.z) - vol = Volume(lcdd, det.name+'_envelope_volume', sha, lcdd.material(mat.name)) + mother = description.worldVolume() + de = DetElement(description, det.name, det.type, det.id) + sha = Box(description, det.name+'_envelope', box.x, box.y, box.z) + vol = Volume(description, det.name+'_envelope_volume', sha, description.material(mat.name)) phv = mother.placeVolume(vol, Position(pos.x, pos.y, pos.z), Rotation(rot.x, rot.y, rot.z)) - vol.setVisAttributes(lcdd, det.vis) + vol.setVisAttributes(description, det.vis) phv.addPhysVolID('id',det.id) de.addPlacement(phv) return de diff --git a/examples/AlignDet/drivers/Shelf.py b/examples/AlignDet/drivers/Shelf.py index d221cc1aa..9b00fbe1d 100644 --- a/examples/AlignDet/drivers/Shelf.py +++ b/examples/AlignDet/drivers/Shelf.py @@ -1,4 +1,4 @@ -def detector_Shelf(lcdd, det): +def detector_Shelf(description, det): plane = det.find('planes') mat = det.find('material') @@ -7,17 +7,17 @@ def detector_Shelf(lcdd, det): book = det.find('books') #---Construct the ensamble plane+books volume------------------------------------------------------------- - e_vol = Volume(lcdd, 'ensemble', Box(lcdd,'box', plane.x, plane.y+book.y, plane.z), lcdd.material('Air')) - e_vol.setVisAttributes(lcdd,'InvisibleWithDaughters') + e_vol = Volume(description, 'ensemble', Box(description,'box', plane.x, plane.y+book.y, plane.z), description.material('Air')) + e_vol.setVisAttributes(description,'InvisibleWithDaughters') #---Construct the plane and place it---------------------------------------------------------------------- - p_vol = Volume(lcdd, 'plane', Box(lcdd, 'plane', plane.x, plane.y, plane.z), lcdd.material(mat.name)) - p_vol.setVisAttributes(lcdd, plane.vis) + p_vol = Volume(description, 'plane', Box(description, 'plane', plane.x, plane.y, plane.z), description.material(mat.name)) + p_vol.setVisAttributes(description, plane.vis) e_vol.placeVolume(p_vol, Position(0,-book.y,0)) #---Construct a book and place it number of times--------------------------------------------------------- - b_vol = Volume(lcdd, 'book',Box(lcdd, 'book', book.x, book.y, book.z), lcdd.material('Carbon')) - b_vol.setVisAttributes(lcdd, book.vis) + b_vol = Volume(description, 'book',Box(description, 'book', book.x, book.y, book.z), description.material('Carbon')) + b_vol.setVisAttributes(description, book.vis) x,y,z = plane.x-book.x, plane.y, -plane.z+book.z for n in range(book.number): e_vol.placeVolume(b_vol, Position(x,y,z)) @@ -25,10 +25,10 @@ def detector_Shelf(lcdd, det): #--Construct the overal envelope and Detector element----------------------------------------------------- g_x, g_y, g_z = plane.x, plane.number*plane.getF('dy'), plane.z - g_vol = Volume(lcdd, det.name, Box(lcdd,'box', g_x, g_y, g_z), lcdd.material('Air')) - g_vol.setVisAttributes(lcdd,'InvisibleWithDaughters') - de = DetElement(lcdd, det.name, det.type, det.id) - phv = lcdd.worldVolume().placeVolume(g_vol, Position(g_x,g_y,g_z)) + g_vol = Volume(description, det.name, Box(description,'box', g_x, g_y, g_z), description.material('Air')) + g_vol.setVisAttributes(description,'InvisibleWithDaughters') + de = DetElement(description, det.name, det.type, det.id) + phv = description.worldVolume().placeVolume(g_vol, Position(g_x,g_y,g_z)) phv.addPhysVolID('id',det.id) de.addPlacement(phv) x,y,z = 0,book.y+plane.y-2*plane.getF('dy'),0 diff --git a/examples/AlignDet/src/AlephTPC_geo.cpp b/examples/AlignDet/src/AlephTPC_geo.cpp index 8c506813f..0c0fe041d 100644 --- a/examples/AlignDet/src/AlephTPC_geo.cpp +++ b/examples/AlignDet/src/AlephTPC_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,8 +17,8 @@ #include <iomanip> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; static void printCoordinates(char /* sector_type */, const char* /* volume */, double [8][2]) { } @@ -32,11 +32,11 @@ static void printCoordinates(char sector_type, const char* volume, double v[8][2 } #endif -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { +static Ref_t create_element(Detector& description, xml_h e, SensitiveDetector sens_det) { xml_det_t x_det = e; string name = x_det.nameStr(); DetElement sdet(name,x_det.id()); - Volume motherVol = lcdd.pickMotherVolume(sdet); + Volume motherVol = description.pickMotherVolume(sdet); xml_comp_t x_envelope = x_det.child(_Unicode(envelope)); xml_comp_t x_sectors = x_det.child(_Unicode(sectors)); xml_comp_t x_inner = x_det.child(_Unicode(inner_wall)); @@ -57,10 +57,10 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { // the TPC mother volume //Tube envTub(env.inner,env.outer,env.zhalf); - //Volume envVol(name+"_envelope",envTub,lcdd.air()); + //Volume envVol(name+"_envelope",envTub,description.air()); Assembly envVol(name+"_envelope"); - //envVol.setVisAttributes(lcdd.visAttributes(x_envelope.visStr())); - //envVol.setVisAttributes(lcdd.invisible()); + //envVol.setVisAttributes(description.visAttributes(x_envelope.visStr())); + //envVol.setVisAttributes(description.invisible()); //envVol->SetVisibility(kFALSE); //envVol->SetVisDaughters(kTRUE); @@ -70,36 +70,36 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { // TPC Al inner shield Tube innerTub(inner_wall.inner, inner_wall.outer, inner_wall.zhalf); - Volume innerVol(name+"_inner",innerTub,lcdd.material(x_inner.materialStr())); - innerVol.setVisAttributes(lcdd.visAttributes(x_inner.visStr())); + Volume innerVol(name+"_inner",innerTub,description.material(x_inner.materialStr())); + innerVol.setVisAttributes(description.visAttributes(x_inner.visStr())); envVol.placeVolume(innerVol); // TPC outer shield Tube outerTub(outer_wall.inner, outer_wall.outer, outer_wall.zhalf); - Volume outerVol(name+"_outer",outerTub,lcdd.material(x_outer.materialStr())); - outerVol.setVisAttributes(lcdd.visAttributes(x_outer.visStr())); + Volume outerVol(name+"_outer",outerTub,description.material(x_outer.materialStr())); + outerVol.setVisAttributes(description.visAttributes(x_outer.visStr())); envVol.placeVolume(outerVol); #if 0 // TPC gas chamber envelope - Material gasMat = lcdd.material(x_gas.materialStr()); + Material gasMat = description.material(x_gas.materialStr()); Tube gasTub(gas.inner,gas.outer,gas.zhalf); Volume gasVol(name+"_chamber",gasTub,gasMat); - gasVol.setVisAttributes(lcdd.visAttributes(x_gas.visStr())); - //gasVol.setVisAttributes(lcdd.invisible()); + gasVol.setVisAttributes(description.visAttributes(x_gas.visStr())); + //gasVol.setVisAttributes(description.invisible()); envVol.placeVolume(gasVol); #endif // TPC HV plane Tube hvTub(gas.inner,gas.outer,x_cathode.thickness()/2); - Volume hvVol(name+"_cathode",hvTub,lcdd.material(x_cathode.materialStr())); - hvVol.setVisAttributes(lcdd.visAttributes(x_cathode.visStr())); + Volume hvVol(name+"_cathode",hvTub,description.material(x_cathode.materialStr())); + hvVol.setVisAttributes(description.visAttributes(x_cathode.visStr())); envVol.placeVolume(hvVol); // TPC Endcap plane to see sectors and misalignments betters Tube endCapPlane(env.inner,env.outer,0.0001); - Volume endCapPlaneVol(name+"_plane",endCapPlane,lcdd.material("Copper")); - endCapPlaneVol.setVisAttributes(lcdd.visAttributes("TPCEndcapVis")); + Volume endCapPlaneVol(name+"_plane",endCapPlane,description.material("Copper")); + endCapPlaneVol.setVisAttributes(description.visAttributes("TPCEndcapVis")); double endcap_thickness = 0; for(xml_coll_t c(x_sectors,_Unicode(sector)); c; ++c) { @@ -113,18 +113,18 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { } Tube endCapTub(env.inner,env.outer,endcap_thickness/2); - Volume endCapAVol(name+"_end_A",endCapTub,lcdd.material("Copper")); - endCapAVol.setVisAttributes(lcdd.invisible()); - //endCapAVol.setVisAttributes(lcdd.visAttributes(x_outer.visStr())); + Volume endCapAVol(name+"_end_A",endCapTub,description.material("Copper")); + endCapAVol.setVisAttributes(description.invisible()); + //endCapAVol.setVisAttributes(description.visAttributes(x_outer.visStr())); endCapAVol.placeVolume(endCapPlaneVol,Position(0,0,-endcap_thickness/2)); pv = envVol.placeVolume(endCapAVol,Position(0,0,env.zhalf+endcap_thickness/2)); pv.addPhysVolID("side",1); DetElement detA(sdet,name+"_SideA",1); detA.setPlacement(pv); - Volume endCapBVol(name+"_end_B",endCapTub,lcdd.material("Copper")); - endCapBVol.setVisAttributes(lcdd.invisible()); - //endCapBVol.setVisAttributes(lcdd.visAttributes(x_outer.visStr())); + Volume endCapBVol(name+"_end_B",endCapTub,description.material("Copper")); + endCapBVol.setVisAttributes(description.invisible()); + //endCapBVol.setVisAttributes(description.visAttributes(x_outer.visStr())); endCapBVol.placeVolume(endCapPlaneVol,Position(0,0,-endcap_thickness/2)); Transform3D trEndB(RotationY(M_PI),Position(0,0,-env.zhalf-endcap_thickness/2)); @@ -133,7 +133,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { DetElement detB(sdet,name+"_SideB",2); detB.setPlacement(pv); - //envVol.setVisAttributes(lcdd.invisible()); + //envVol.setVisAttributes(description.invisible()); int sector_count = 0; for(xml_coll_t c(x_sectors,_Unicode(sector)); c; ++c) { @@ -293,8 +293,8 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens_det) { tm = UnionSolid(UnionSolid(sectorSolid,upper_boolean),lower_boolean); } - Volume secVol(name+"_sector_"+sector_type+_toString(i_layer,"_layer%d"),tm,lcdd.material(layer_mat)); - secVol.setVisAttributes(lcdd.visAttributes(layer_vis)); + Volume secVol(name+"_sector_"+sector_type+_toString(i_layer,"_layer%d"),tm,description.material(layer_mat)); + secVol.setVisAttributes(description.visAttributes(layer_vis)); if ( x_layer.isSensitive() ) secVol.setSensitiveDetector(sens_det); sector.placeVolume(secVol,Position(0,0,z_start+layer_thickness/2)); diff --git a/examples/AlignDet/src/AlignmentExampleObjects.cpp b/examples/AlignDet/src/AlignmentExampleObjects.cpp index 61818e551..fa7c785eb 100644 --- a/examples/AlignDet/src/AlignmentExampleObjects.cpp +++ b/examples/AlignDet/src/AlignmentExampleObjects.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,17 +18,17 @@ #include "DD4hep/Objects.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::AlignmentExamples; +using namespace dd4hep; +using namespace dd4hep::AlignmentExamples; /// Install the consitions and the alignment manager -ConditionsManager DD4hep::AlignmentExamples::installManager(LCDD& lcdd) { +ConditionsManager dd4hep::AlignmentExamples::installManager(Detector& description) { // Now we instantiate the conditions manager - lcdd.apply("DD4hep_ConditionsManagerInstaller",0,(char**)0); - ConditionsManager manager = ConditionsManager::from(lcdd); - manager["PoolType"] = "DD4hep_ConditionsLinearPool"; - manager["UserPoolType"] = "DD4hep_ConditionsMapUserPool"; - manager["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool"; + description.apply("dd4hep_ConditionsManagerInstaller",0,(char**)0); + ConditionsManager manager = ConditionsManager::from(description); + manager["PoolType"] = "dd4hep_ConditionsLinearPool"; + manager["UserPoolType"] = "dd4hep_ConditionsMapUserPool"; + manager["UpdatePoolType"] = "dd4hep_ConditionsLinearUpdatePool"; manager.initialize(); return manager; } @@ -45,16 +45,16 @@ int AlignmentDataAccess::operator()(DetElement de, int) const { } // Keep it simple. To know how to access stuff, // simply look in DDDCore/src/AlignmentsPrinter.cpp... - Alignments::printElementPlacement(printLevel,"Example",de,mapping); + align::printElementPlacement(printLevel,"Example",de,mapping); return 1; } /// Callback to process a single detector element int AlignmentCreator::operator()(DetElement de, int) const { if ( de.ptr() != de.world().ptr() ) { - Condition cond(de.path()+"#"+Alignments::Keys::deltaName,Alignments::Keys::deltaName); + Condition cond(de.path()+"#"+align::Keys::deltaName,align::Keys::deltaName); Delta& delta = cond.bind<Delta>(); - cond->hash = ConditionKey(de.key(),Alignments::Keys::deltaKey).hash; + cond->hash = ConditionKey(de.key(),align::Keys::deltaKey).hash; cond->setFlag(Condition::ACTIVE|Condition::ALIGNMENT_DELTA); /// Simply move everything by 1 mm in z. Not physical, but this is just an example... delta.translation.SetZ(delta.translation.Z()+0.1*dd4hep::cm); diff --git a/examples/AlignDet/src/AlignmentExampleObjects.h b/examples/AlignDet/src/AlignmentExampleObjects.h index 8bbae379e..4e902f4cf 100644 --- a/examples/AlignDet/src/AlignmentExampleObjects.h +++ b/examples/AlignDet/src/AlignmentExampleObjects.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_ALIGNDET_ALIGNMENTEXAMPLEOBJECTS_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/Alignments.h" #include "DD4hep/AlignmentData.h" @@ -27,34 +27,23 @@ #include "DDCond/ConditionsSlice.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for alignment examples namespace AlignmentExamples { - using Geometry::LCDD; - using Geometry::RotationZYX; - using Geometry::DetElement; - using Geometry::detectorProcessor; - - using Conditions::Condition; - using Conditions::ConditionKey; - using Conditions::ConditionsMap; - using Conditions::ConditionsPool; - using Conditions::ConditionsSlice; - using Conditions::ConditionsContent; - using Conditions::ConditionsManager; - using Conditions::conditionsCollector; + using cond::ConditionsPool; + using cond::ConditionsSlice; + using cond::ConditionsContent; + using cond::ConditionsManager; + using cond::conditionsCollector; - using Alignments::Delta; - using Alignments::Alignment; - using Alignments::AlignmentData; - using Alignments::AlignmentsPrinter; - using Alignments::AlignmentsCalculator; - using Alignments::AlignedVolumePrinter; - using Alignments::DeltaCollector; - using Alignments::deltaCollector; - using Alignments::alignmentsCollector; + using align::AlignmentsPrinter; + using align::AlignmentsCalculator; + using align::AlignedVolumePrinter; + using align::DeltaCollector; + using align::deltaCollector; + using align::alignmentsCollector; /// Example how to populate the detector description with alignment constants /** @@ -97,10 +86,10 @@ namespace DD4hep { }; /// Helper to run DetElement scans - typedef Geometry::DetectorScanner Scanner; + typedef DetectorScanner Scanner; /// Install the consitions and the alignment manager - ConditionsManager installManager(LCDD& lcdd); + ConditionsManager installManager(Detector& description); } /* End namespace AlignmentExamples */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif /* DD4HEP_ALIGNDET_ALIGNMENTEXAMPLEOBJECTS_H */ diff --git a/examples/AlignDet/src/AlignmentExample_align_telescope.cpp b/examples/AlignDet/src/AlignmentExample_align_telescope.cpp index f678e04bb..ec60a600c 100644 --- a/examples/AlignDet/src/AlignmentExample_align_telescope.cpp +++ b/examples/AlignDet/src/AlignmentExample_align_telescope.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -36,16 +36,13 @@ #include "DD4hep/Factories.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::AlignmentExamples; - -using Alignments::AlignmentsCalib; -using Alignments::Delta; -using Geometry::Position; +using namespace dd4hep; +using namespace dd4hep::AlignmentExamples; +using align::AlignmentsCalib; static void print_world_trafo(AlignmentsCalib& calib, const std::string& path) { DetElement d(calib.detector(path)); - Alignment a = calib.slice.get(d,Alignments::Keys::alignmentKey); + Alignment a = calib.slice.get(d,align::Keys::alignmentKey); if ( a.isValid() ) { const double* tr = a.worldTransformation().GetTranslation(); printout(INFO,"Example","++ World transformation of: %-32s Tr:(%8.2g,%8.2g,%8.2g [cm])", @@ -53,7 +50,7 @@ static void print_world_trafo(AlignmentsCalib& calib, const std::string& path) a.worldTransformation().Print(); return; } - Condition c = calib.slice.get(d,Alignments::Keys::deltaKey); + Condition c = calib.slice.get(d,align::Keys::deltaKey); printout(WARNING,"Example", "++ Detector element:%s No alignment conditions present. Delta:%s", path.c_str(), c.isValid() ? "Present" : "Not availible"); @@ -67,7 +64,7 @@ static void print_world_trafo(AlignmentsCalib& calib, const std::string& path) * \version 1.0 * \date 01/12/2016 */ -static int AlignmentExample_align_telescope (Geometry::LCDD& lcdd, int argc, char** argv) { +static int AlignmentExample_align_telescope (Detector& description, int argc, char** argv) { string input, setup; bool arg_error = false, dump = false; @@ -94,11 +91,11 @@ static int AlignmentExample_align_telescope (Geometry::LCDD& lcdd, int argc, cha } // First we load the geometry - lcdd.fromXML(input); - ConditionsManager manager = installManager(lcdd); + description.fromXML(input); + ConditionsManager manager = installManager(description); const void* setup_args[] = {setup.c_str(), 0}; // Better zero-terminate - lcdd.apply("DD4hep_ConditionsXMLRepositoryParser",1,(char**)setup_args); + description.apply("dd4hep_ConditionsXMLRepositoryParser",1,(char**)setup_args); // Now the deltas are stored in the conditions manager in the proper IOV pools const IOVType* iov_typ = manager.iovType("run"); if ( 0 == iov_typ ) { @@ -108,15 +105,14 @@ static int AlignmentExample_align_telescope (Geometry::LCDD& lcdd, int argc, cha shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); ConditionsManager::Result cres = manager.prepare(req_iov,*slice); - Conditions::fill_content(manager,*content,*iov_typ); + cond::fill_content(manager,*content,*iov_typ); // Collect all the delta conditions and make proper alignment conditions out of them - AlignmentsCalculator::Deltas deltas; - + map<DetElement, Delta> deltas; const auto coll = deltaCollector(*slice,deltas); auto proc = detectorProcessor(coll); //auto proc = detectorProcessor(deltaCollector(*slice,deltas)); - proc.process(lcdd.world(),0,true); + proc.process(description.world(),0,true); printout(INFO,"Prepare","Got a total of %ld deltas for processing alignments.",deltas.size()); // ++++++++++++++++++++++++ Compute the tranformation matrices @@ -133,7 +129,7 @@ static int AlignmentExample_align_telescope (Geometry::LCDD& lcdd, int argc, cha printout(INFO,"Example","========================================================="); if ( dump ) slice->pool->print("*"); - AlignmentsCalib calib(lcdd,*slice); + AlignmentsCalib calib(description,*slice); try { // These are only valid if alignments got pre-loaded! print_world_trafo(calib,"/world/Telescope"); print_world_trafo(calib,"/world/Telescope/module_1"); diff --git a/examples/AlignDet/src/AlignmentExample_nominal.cpp b/examples/AlignDet/src/AlignmentExample_nominal.cpp index 52da70aa4..c89850602 100644 --- a/examples/AlignDet/src/AlignmentExample_nominal.cpp +++ b/examples/AlignDet/src/AlignmentExample_nominal.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -34,8 +34,8 @@ #include "DD4hep/Factories.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::AlignmentExamples; +using namespace dd4hep; +using namespace dd4hep::AlignmentExamples; /// Plugin function: Alignment program example /** @@ -45,16 +45,16 @@ using namespace DD4hep::AlignmentExamples; * \version 1.0 * \date 01/12/2016 */ -static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { +static int alignment_example (Detector& description, int argc, char** argv) { class Collector { public: - AlignmentsCalculator::Deltas& deltas; - ConditionsMap& mapping; - Collector(AlignmentsCalculator::Deltas& d, ConditionsMap& m) + map<DetElement, Delta>& deltas; + ConditionsMap& mapping; + Collector(map<DetElement, Delta>& d, ConditionsMap& m) : deltas(d), mapping(m) {} // Here we test the ConditionsMap interface of the AlignmentsNominalMap int operator()(DetElement de, int ) const { - Alignment a = mapping.get(de, Alignments::Keys::alignmentKey); + Alignment a = mapping.get(de, align::Keys::alignmentKey); deltas.insert(make_pair(de,a.delta())); return 1; } @@ -78,23 +78,23 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { } // First we load the geometry - lcdd.fromXML(input); + description.fromXML(input); // ++++++++++++++++++++++++ Try scam with the fake AlignmentsNominalMap - Conditions::AlignmentsNominalMap nominal(lcdd.world()); + AlignmentsNominalMap nominal(description.world()); // Collect all the delta conditions and make proper alignment conditions out of them - AlignmentsCalculator::Deltas deltas; + map<DetElement, Delta> deltas; // Show that the access interface works: - int num_delta = Scanner().scan(Collector(deltas,nominal),lcdd.world()); + int num_delta = Scanner().scan(Collector(deltas,nominal),description.world()); /// Show that utilities can work with this one: - int num_printed = Scanner().scan(AlignmentsPrinter(&nominal),lcdd.world()); + int num_printed = Scanner().scan(AlignmentsPrinter(&nominal),description.world()); printout(INFO,"Prepare","Got a total of %ld Deltas (Nominals: %d , Printed: %d)", deltas.size(), num_delta, num_printed); // ++++++++++++++++++++++++ Now compute the alignments for a generic slice - Conditions::ConditionsTreeMap slice; + ConditionsTreeMap slice; // Now compute the tranformation matrices AlignmentsCalculator calculator; AlignmentsCalculator::Result ares = calculator.compute(deltas,slice); diff --git a/examples/AlignDet/src/AlignmentExample_populate.cpp b/examples/AlignDet/src/AlignmentExample_populate.cpp index 875ef9e31..5af621137 100644 --- a/examples/AlignDet/src/AlignmentExample_populate.cpp +++ b/examples/AlignDet/src/AlignmentExample_populate.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,8 +28,8 @@ #include "DD4hep/Factories.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::AlignmentExamples; +using namespace dd4hep; +using namespace dd4hep::AlignmentExamples; /// Plugin function: Alignment program example /** @@ -39,7 +39,7 @@ using namespace DD4hep::AlignmentExamples; * \version 1.0 * \date 01/12/2016 */ -static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { +static int alignment_example (Detector& description, int argc, char** argv) { string input; int num_iov = 10; @@ -64,10 +64,10 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { } // First we load the geometry - lcdd.fromXML(input); + description.fromXML(input); /******************** Initialize the conditions manager *****************/ - ConditionsManager manager = installManager(lcdd); + ConditionsManager manager = installManager(description); const IOVType* iov_typ = manager.registerIOVType(0,"run").second; if ( 0 == iov_typ ) except("ConditionsPrepare","++ Unknown IOV type supplied."); @@ -79,13 +79,13 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10)); ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key()); // Create conditions with all deltas. Use a generic creator - total_created += Scanner().scan(AlignmentCreator(manager, *iov_pool),lcdd.world()); + total_created += Scanner().scan(AlignmentCreator(manager, *iov_pool),description.world()); } /******************** Now as usual: create the slice ********************/ shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Conditions::fill_content(manager,*content,*iov_typ); + cond::fill_content(manager,*content,*iov_typ); /******************** Register alignments *******************************/ // Note: We have to load one set of conditions in order to auto-populate @@ -95,11 +95,11 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { // IOV iov(iov_typ,10+5); manager.prepare(iov,*slice); - slice->pool->flags |= Conditions::UserPool::PRINT_INSERT; + slice->pool->flags |= cond::UserPool::PRINT_INSERT; // Collect all the delta conditions and make proper alignment conditions out of them - AlignmentsCalculator::Deltas deltas; - Scanner(deltaCollector(*slice,deltas),lcdd.world()); + map<DetElement, Delta> deltas; + Scanner(deltaCollector(*slice,deltas),description.world()); printout(INFO,"Prepare","Got a total of %ld Deltas",deltas.size()); // ++++++++++++++++++++++++ Now compute the alignments for each of these IOVs @@ -110,7 +110,7 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { shared_ptr<ConditionsSlice> sl(new ConditionsSlice(manager,content)); // Attach the proper set of conditions to the user pool ConditionsManager::Result cres = manager.prepare(req_iov,*sl); - sl->pool->flags |= Conditions::UserPool::PRINT_INSERT; + sl->pool->flags |= cond::UserPool::PRINT_INSERT; cond_total += cres; // Now compute the tranformation matrices AlignmentsCalculator calculator; @@ -125,7 +125,7 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { } if ( i == 0 ) { // What else ? let's access/print the current selection - Scanner(AlignedVolumePrinter(sl.get(),"Example"),lcdd.world()); + Scanner(AlignedVolumePrinter(sl.get(),"Example"),description.world()); } } printout(INFO,"Summary","Processed a total %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) and (C:%ld,M:%ld) alignments. Created:%ld.", diff --git a/examples/AlignDet/src/AlignmentExample_read_xml.cpp b/examples/AlignDet/src/AlignmentExample_read_xml.cpp index 1869ef027..8c4f48934 100644 --- a/examples/AlignDet/src/AlignmentExample_read_xml.cpp +++ b/examples/AlignDet/src/AlignmentExample_read_xml.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -26,8 +26,8 @@ #include "DD4hep/Factories.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::AlignmentExamples; +using namespace dd4hep; +using namespace dd4hep::AlignmentExamples; /// Plugin function: Alignment program example /** @@ -37,7 +37,7 @@ using namespace DD4hep::AlignmentExamples; * \version 1.0 * \date 01/12/2016 */ -static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { +static int alignment_example (Detector& description, int argc, char** argv) { string input, delta; bool arg_error = false; @@ -61,12 +61,12 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { } // First we load the geometry - lcdd.fromXML(input); + description.fromXML(input); - ConditionsManager manager = installManager(lcdd); + ConditionsManager manager = installManager(description); const void* delta_args[] = {delta.c_str(), 0}; // Better zero-terminate - lcdd.apply("DD4hep_ConditionsXMLRepositoryParser",1,(char**)delta_args); + description.apply("dd4hep_ConditionsXMLRepositoryParser",1,(char**)delta_args); // Now the deltas are stored in the conditions manager in the proper IOV pools const IOVType* iov_typ = manager.iovType("run"); if ( 0 == iov_typ ) @@ -75,26 +75,26 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { IOV req_iov(iov_typ,1500); // IOV goes from run 1000 ... 2000 shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Conditions::fill_content(manager,*content,*iov_typ); + cond::fill_content(manager,*content,*iov_typ); ConditionsManager::Result cres = manager.prepare(req_iov,*slice); // ++++++++++++++++++++++++ Compute the tranformation matrices AlignmentsCalculator calc; - Conditions::ConditionsHashMap alignments; + ConditionsHashMap alignments; - AlignmentsCalculator::Deltas deltas; - Scanner(deltaCollector(*slice, deltas),lcdd.world()); + map<DetElement, Delta> deltas; + Scanner(deltaCollector(*slice, deltas),description.world()); printout(INFO,"Prepare","Got a total of %ld Deltas",deltas.size()); - slice->pool->flags |= Conditions::UserPool::PRINT_INSERT; + slice->pool->flags |= cond::UserPool::PRINT_INSERT; AlignmentsCalculator::Result ares = calc.compute(deltas, alignments); ConditionsSlice::Inserter(*slice,alignments.data); // What else ? let's access the data - size_t total_accessed = Scanner().scan(AlignmentDataAccess(*slice),lcdd.world()); + size_t total_accessed = Scanner().scan(AlignmentDataAccess(*slice),description.world()); // What else ? let's print the current selection - Scanner(AlignedVolumePrinter(slice.get(),"Example"),lcdd.world()); + Scanner(AlignedVolumePrinter(slice.get(),"Example"),description.world()); printout(INFO,"Example", "%ld conditions in slice. (T:%ld,S:%ld,L:%ld,C:%ld,M:%ld) " diff --git a/examples/AlignDet/src/AlignmentExample_stress.cpp b/examples/AlignDet/src/AlignmentExample_stress.cpp index 018064d7f..91a38cff9 100644 --- a/examples/AlignDet/src/AlignmentExample_stress.cpp +++ b/examples/AlignDet/src/AlignmentExample_stress.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -31,8 +31,8 @@ #include "TRandom3.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::AlignmentExamples; +using namespace dd4hep; +using namespace dd4hep::AlignmentExamples; /// Plugin function: Alignment program example /** @@ -42,7 +42,7 @@ using namespace DD4hep::AlignmentExamples; * \version 1.0 * \date 01/12/2016 */ -static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { +static int alignment_example (Detector& description, int argc, char** argv) { string input; int num_iov = 10, num_runs = 10; @@ -70,10 +70,10 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { } // First we load the geometry - lcdd.fromXML(input); + description.fromXML(input); /******************** Initialize the conditions manager *****************/ - ConditionsManager manager = installManager(lcdd); + ConditionsManager manager = installManager(description); const IOVType* iov_typ = manager.registerIOVType(0,"run").second; if ( 0 == iov_typ ) except("ConditionsPrepare","++ Unknown IOV type supplied."); @@ -87,7 +87,7 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10)); ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key()); // Create conditions with all deltas. Use a generic creator - total_created += Scanner().scan(AlignmentCreator(manager, *iov_pool),lcdd.world()); + total_created += Scanner().scan(AlignmentCreator(manager, *iov_pool),description.world()); TTimeStamp stop; cr_stat.Fill(stop.AsDouble()-start.AsDouble()); } @@ -95,7 +95,7 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { /******************** Now as usual: create the slice ********************/ shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Conditions::fill_content(manager,*content,*iov_typ); + cond::fill_content(manager,*content,*iov_typ); /******************** Register alignments *******************************/ // Note: We have to load one set of conditions in order to auto-populate @@ -105,11 +105,11 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) { // IOV iov(iov_typ,15); manager.prepare(iov,*slice); - slice->pool->flags |= Conditions::UserPool::PRINT_INSERT; + slice->pool->flags |= cond::UserPool::PRINT_INSERT; // Collect all the delta conditions and make proper alignment conditions out of them - AlignmentsCalculator::Deltas deltas; - Scanner(deltaCollector(*slice,deltas),lcdd.world()); + map<DetElement, Delta> deltas; + Scanner(deltaCollector(*slice,deltas),description.world()); printout(INFO,"Prepare","Got a total of %ld deltas for processing alignments.",deltas.size()); ConditionsManager::Result total_cres; diff --git a/examples/AlignDet/src/Alignment_to_Condition.cpp b/examples/AlignDet/src/Alignment_to_Condition.cpp index 7db07168f..b9e6f974f 100644 --- a/examples/AlignDet/src/Alignment_to_Condition.cpp +++ b/examples/AlignDet/src/Alignment_to_Condition.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,7 +16,7 @@ This plugin behaves like a main program. Invoke the plugin with something like this: - geoPluginRun -volmgr -destroy -plugin DD4hep_Alignment2Condition + geoPluginRun -volmgr -destroy -plugin dd4hep_Alignment2Condition */ // Framework include files @@ -32,22 +32,17 @@ #include <cerrno> using namespace std; -using namespace DD4hep; -using Alignments::Alignment; -using Alignments::AlignmentData; -using Alignments::AlignmentCondition; -using Conditions::Condition; -using Conditions::ConditionKey; +using namespace dd4hep; /// Plugin function: Alignment program example /** - * Factory: DD4hep_Alignment2Condition + * Factory: dd4hep_Alignment2Condition * * \author M.Frank * \version 1.0 * \date 01/12/2016 */ -static int Alignment_to_Condition (Geometry::LCDD& , int argc, char** argv) { +static int Alignment_to_Condition (Detector& , int argc, char** argv) { for(int i=0; i<argc && argv[i]; ++i) { if ( 0 == ::strncmp("-help",argv[i],2) || 0 == ::strncmp("-?",argv[i],2) ) { /// Help printout describing the basic command line interface @@ -81,4 +76,4 @@ static int Alignment_to_Condition (Geometry::LCDD& , int argc, char** argv) { return 1; } -DECLARE_APPLY(DD4hep_Alignment2Condition,Alignment_to_Condition) +DECLARE_APPLY(dd4hep_Alignment2Condition,Alignment_to_Condition) diff --git a/examples/AlignDet/src/BoxDetector_geo.cpp b/examples/AlignDet/src/BoxDetector_geo.cpp index 021798e61..650fc9646 100644 --- a/examples/AlignDet/src/BoxDetector_geo.cpp +++ b/examples/AlignDet/src/BoxDetector_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,21 +15,21 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_element(LCDD& lcdd, xml_h e, Ref_t) { +static Ref_t create_element(Detector& description, xml_h e, Ref_t) { xml_det_t x_det = e; string name = x_det.nameStr(); xml_comp_t box (x_det.child(_U(box))); xml_dim_t pos (x_det.child(_U(position))); xml_dim_t rot (x_det.child(_U(rotation))); - Material mat (lcdd.material(x_det.materialStr())); + Material mat (description.material(x_det.materialStr())); DetElement det (name,x_det.id()); Volume det_vol(name+"_vol",Box(box.x(),box.y(),box.z()), mat); - Volume mother = lcdd.pickMotherVolume(det); + Volume mother = description.pickMotherVolume(det); Transform3D transform(Rotation3D(RotationZYX(rot.z(),rot.y(),rot.x())),Position(pos.x(),pos.y(),pos.z())); - det_vol.setVisAttributes(lcdd, x_det.visStr()); + det_vol.setVisAttributes(description, x_det.visStr()); PlacedVolume phv = mother.placeVolume(det_vol,transform); phv.addPhysVolID("id",x_det.id()); det.setPlacement(phv); diff --git a/examples/AlignDet/src/Telescope_geo.cpp b/examples/AlignDet/src/Telescope_geo.cpp index a882e6300..62d74e7aa 100644 --- a/examples/AlignDet/src/Telescope_geo.cpp +++ b/examples/AlignDet/src/Telescope_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -16,17 +16,17 @@ #include "DD4hep/DD4hepUnits.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sd) { +static Ref_t create_element(Detector& description, xml_h e, SensitiveDetector sd) { Box box; Volume vol; PlacedVolume phv; xml_det_t x_det = e; double small = 1e-3*dd4hep::mm; string name = x_det.nameStr(); - Material air = lcdd.material("Air"); + Material air = description.material("Air"); DetElement det (name,x_det.id()); Assembly envVol (name+"_envelope"); @@ -44,26 +44,26 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sd) { // Make envelope box for each module a bit bigger to ensure all children are within bounds... box = Box(pitch*noPixX/2e0+small, pitch*noPixY/2e0+small, mod_thick/2e0+small); Volume modvol(_toString(mod.id(),"module_%d"), box, air); - modvol.setVisAttributes(lcdd.visAttributes(mod.visStr())); + modvol.setVisAttributes(description.visAttributes(mod.visStr())); DetElement sens_det(mod_det,"sensor",x_det.id()); box = Box(pitch*noPixX/2e0, pitch*noPixY/2e0, sens.thickness()/2e0); vol = Volume(_toString(mod.id(),"sensor_%d"), box, air); vol.setSensitiveDetector(sd); - vol.setVisAttributes(lcdd.visAttributes(sens.visStr())); + vol.setVisAttributes(description.visAttributes(sens.visStr())); phv = modvol.placeVolume(vol, Position(0, 0, -mod_thick/2e0+sens.thickness()/2e0)); phv.addPhysVolID("sensor",1); sens_det.setPlacement(phv); box = Box(pitch*noPixX/2e0, pitch*noPixY/2e0, chip.thickness()/2e0); vol = Volume(_toString(mod.id(),"chip_%d"), box, air); - vol.setVisAttributes(lcdd.visAttributes(chip.visStr())); + vol.setVisAttributes(description.visAttributes(chip.visStr())); phv = modvol.placeVolume(vol, Position(0, 0, -mod_thick/2e0+sens.thickness()+chip.thickness()/2e0)); phv.addPhysVolID("sensor",2); box = Box(pitch*noPixX/2e0, pitch*noPixY/2e0, pcb.thickness()/2e0); vol = Volume(_toString(mod.id(),"PCB_%d"), box, air); - vol.setVisAttributes(lcdd.visAttributes(pcb.visStr())); + vol.setVisAttributes(description.visAttributes(pcb.visStr())); phv = modvol.placeVolume(vol, Position(0, 0, -mod_thick/2e0+sens.thickness()+chip.thickness()+pcb.thickness()/2e0)); phv.addPhysVolID("sensor",3); @@ -71,12 +71,12 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sd) { phv.addPhysVolID("module",mod.id()); mod_det.setPlacement(phv); } - envVol.setVisAttributes(lcdd.visAttributes(x_det.visStr())); - phv = lcdd.pickMotherVolume(det).placeVolume(envVol,Position(0,0,0)); + envVol.setVisAttributes(description.visAttributes(x_det.visStr())); + phv = description.pickMotherVolume(det).placeVolume(envVol,Position(0,0,0)); phv.addPhysVolID("system",x_det.id()); det.setPlacement(phv); return det; } // first argument is the type from the xml file -DECLARE_DETELEMENT(DD4hep_Example_Telescope,create_element) +DECLARE_DETELEMENT(dd4hep_Example_Telescope,create_element) diff --git a/examples/CLICSiD/CMakeLists.txt b/examples/CLICSiD/CMakeLists.txt index 6496cd480..ba6d2fbb5 100644 --- a/examples/CLICSiD/CMakeLists.txt +++ b/examples/CLICSiD/CMakeLists.txt @@ -1,6 +1,6 @@ # $Id: $ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -16,16 +16,16 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) dd4hep_configure_output () dd4hep_package ( CLICSiD MAJOR 0 MINOR 0 PATCH 1 USES [ROOT REQUIRED COMPONENTS Geom] - [DD4hep REQUIRED COMPONENTS DDCore] + [dd4hep REQUIRED COMPONENTS DDCore] ) dd4hep_install_dir( compact scripts sim DESTINATION ${DD4hep_DIR}/examples/CLICSiD ) #-------------------------------------------------------------------------- if (DD4HEP_USE_GEANT4) dd4hep_add_executable(CLICSiDXML SOURCES scripts/CLICSiDXML.C - USES [DD4hep REQUIRED COMPONENTS DDCore DDG4] GEANT4 ) + USES [dd4hep REQUIRED COMPONENTS DDCore DDG4] GEANT4 ) #-------------------------------------------------------------------------- dd4hep_add_executable(CLICSiDAClick SOURCES scripts/CLICSiDAClick.C - USES [DD4hep REQUIRED COMPONENTS DDCore DDG4] GEANT4 ) + USES [dd4hep REQUIRED COMPONENTS DDCore DDG4] GEANT4 ) endif() # dd4hep_configure_scripts ( CLICSiD DEFAULT_SETUP WITH_TESTS ) @@ -33,8 +33,8 @@ dd4hep_configure_scripts ( CLICSiD DEFAULT_SETUP WITH_TESTS ) #---Testing------------------------------------------------------------------------- # #----- Tests for CLICSid: here we simply require that at least 100 volumes have been converted -foreach ( typ lcdd gdml vis ) - dd4hep_add_test_reg ( "test_CLICSiD_converter_${typ}" +foreach ( typ description gdml vis ) + dd4hep_add_test_reg ( "CLICSiD_converter_${typ}_LONGTEST" COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS geoConverter -compact2${typ} -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/compact.xml @@ -43,7 +43,7 @@ foreach ( typ lcdd gdml vis ) endforeach() # # ROOT Geometry overlap checks -dd4hep_add_test_reg( test_CLICSiD_check_geometry_LONGTEST +dd4hep_add_test_reg( CLICSiD_check_geometry_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS python ${DD4hep_DIR}/python/checkGeometry.py --compact=file:${CMAKE_CURRENT_SOURCE_DIR}/compact/compact.xml @@ -51,7 +51,7 @@ dd4hep_add_test_reg( test_CLICSiD_check_geometry_LONGTEST REGEX_PASS " Execution finished..." ) # # ROOT Geometry overlap checks -dd4hep_add_test_reg( test_CLICSiD_check_overlaps_LONGTEST +dd4hep_add_test_reg( CLICSiD_check_overlaps_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS python ${DD4hep_DIR}/python/checkOverlaps.py --compact=file:${CMAKE_CURRENT_SOURCE_DIR}/compact/compact.xml @@ -64,7 +64,7 @@ if (DD4HEP_USE_GEANT4) # # Basic DDG4 component/unit tests foreach(script testDDPython CLICMagField CLICPhysics CLICRandom CLICSiDScan) - dd4hep_add_test_reg( test_CLICSiD_DDG4_${script}_LONGTEST + dd4hep_add_test_reg( CLICSiD_DDG4_${script}_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/${script}.py REQUIRES DDG4 Geant4 @@ -73,7 +73,7 @@ if (DD4HEP_USE_GEANT4) endforeach(script) # # Material scan - dd4hep_add_test_reg( test_CLICSiD_DDG4_g4material_scan_LONGTEST + dd4hep_add_test_reg( CLICSiD_DDG4_g4material_scan_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS python ${DD4hep_DIR}/python/g4MaterialScan.py --compact=file:${CMAKE_CURRENT_SOURCE_DIR}/compact/compact.xml @@ -85,7 +85,7 @@ if (DD4HEP_USE_GEANT4) foreach(script CLICSiDXML CLICSiDAClick) # # Build AClick from the source file - dd4hep_add_test_reg( test_CLICSiD_DDG4_${script}_as_AClick_LONGTEST + dd4hep_add_test_reg( CLICSiD_DDG4_${script}_as_AClick_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS root.exe -b -x -n -q -l "${DD4hep_DIR}/examples/DDG4/examples/run.C(\"${DD4hep_DIR}/examples/CLICSiD/scripts/${script}\")" REQUIRES DDG4 Geant4 @@ -93,7 +93,7 @@ if (DD4HEP_USE_GEANT4) REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" ) # # Execute identical source linked executable - dd4hep_add_test_reg( test_CLICSiD_DDG4_${script}_as_exe_LONGTEST + dd4hep_add_test_reg( CLICSiD_DDG4_${script}_as_exe_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh" EXEC_ARGS ${script} REQUIRES DDG4 Geant4 diff --git a/examples/CLICSiD/compact/compact.xml b/examples/CLICSiD/compact/compact.xml index 9395db50d..6acc87294 100644 --- a/examples/CLICSiD/compact/compact.xml +++ b/examples/CLICSiD/compact/compact.xml @@ -273,7 +273,7 @@ <detectors> <comment>Trackers</comment> - <detector id="1" name="SiVertexBarrel" type="DD4hep_SiTrackerBarrel" readout="SiVertexBarrelHits" insideTrackingVolume="true"> + <detector id="1" name="SiVertexBarrel" type="dd4hep_SiTrackerBarrel" readout="SiVertexBarrelHits" insideTrackingVolume="true"> <comment>Vertex Detector Barrel</comment> <module name="VtxBarrelModuleInner" vis="SiVertexBarrelModuleVis"> <module_envelope width="10.0*mm" length="(VertexBarrel_zmax - 0.1*cm) * 2" thickness="0.6*mm"/> @@ -321,7 +321,7 @@ </detector> <comment>Vertex Detector Endcaps</comment> - <detector id="2" name="SiVertexEndcap" type="DD4hep_SiTrackerEndcap2" readout="SiVertexEndcapHits" reflect="true"> + <detector id="2" name="SiVertexEndcap" type="dd4hep_SiTrackerEndcap2" readout="SiVertexEndcapHits" reflect="true"> <module name="SiVertexEndcapModule1"> <trd x1="VertexEndcap_rmin1 * tan(pi/(VertexEndcapModules-0.1))" x2="VertexEndcap_rmax * sin(pi/(VertexEndcapModules-0.1*cm))" z="(VertexEndcap_rmax - VertexEndcap_rmin1) / 2" /> <module_component thickness="0.005*cm" material="Silicon" sensitive="true" vis="SiVertexSensitiveVis"/> @@ -356,7 +356,7 @@ </layer> </detector> - <detector id="3" name="SiTrackerBarrel" type="DD4hep_SiTrackerBarrel" readout="SiTrackerBarrelHits"> + <detector id="3" name="SiTrackerBarrel" type="dd4hep_SiTrackerBarrel" readout="SiTrackerBarrelHits"> <comment>Outer Tracker Barrel</comment> <module name="SiTrackerModule_Layer1" vis="SiTrackerBarrelModuleVis"> <module_envelope width="97.79*mm" length="97.79*mm" thickness="0.3*cm"/> @@ -535,7 +535,7 @@ </layer> </detector> - <detector id="4" name="SiTrackerEndcap" type="DD4hep_SiTrackerEndcap2" readout="SiTrackerEndcapHits" reflect="true"> + <detector id="4" name="SiTrackerEndcap" type="dd4hep_SiTrackerEndcap2" readout="SiTrackerEndcapHits" reflect="true"> <comment>Outer Tracker Endcaps</comment> <module name="Module1" vis="SiTrackerEndcapModuleVis"> <trd x1="36.112*mm" x2="46.635*mm" z="100.114/2*mm" /> @@ -607,7 +607,7 @@ </layer> </detector> - <detector id="5" name="SiTrackerForward" type="DD4hep_SiTrackerEndcap2" readout="SiTrackerForwardHits"> + <detector id="5" name="SiTrackerForward" type="dd4hep_SiTrackerEndcap2" readout="SiTrackerForwardHits"> <comment>Forward Tracker inside Vertex Support Barrel</comment> <module name="SiTrackerForwardModule1"> <trd x1="ForwardTracker_rmin1 * tan(pi/(ForwardTrackerModules-0.1))" x2="ForwardTracker_rmax * sin(pi/(ForwardTrackerModules-0.1))" z="(ForwardTracker_rmax - ForwardTracker_rmin1) / 2" /> @@ -636,7 +636,7 @@ </detector> <comment>Calorimeters</comment> - <detector id="6" name="EcalBarrel" type="DD4hep_EcalBarrel" readout="EcalBarrelHits" vis="EcalBarrelVis" calorimeterType="EM_BARREL"> + <detector id="6" name="EcalBarrel" type="dd4hep_EcalBarrel" readout="EcalBarrelHits" vis="EcalBarrelVis" calorimeterType="EM_BARREL"> <comment>EM Calorimeter Barrel</comment> <dimensions numsides="(int) CaloSides" rmin="EcalBarrel_rmin" z="EcalBarrel_zmax*2" /> <staves vis="EcalBarrelStaveVis"/> @@ -664,7 +664,7 @@ </layer> </detector> - <detector id="7" name="EcalEndcap" type="DD4hep_PolyhedraEndcapCalorimeter2" reflect="true" readout="EcalEndcapHits" vis="EcalEndcapVis" calorimeterType="EM_ENDCAP"> + <detector id="7" name="EcalEndcap" type="dd4hep_PolyhedraEndcapCalorimeter2" reflect="true" readout="EcalEndcapHits" vis="EcalEndcapVis" calorimeterType="EM_ENDCAP"> <comment>EM Calorimeter Endcaps</comment> <dimensions numsides="(int) CaloSides" zmin="EcalEndcap_zmin" rmin="EcalEndcap_rmin" rmax="EcalEndcap_rmax" /> <layer repeat="1"> @@ -691,7 +691,7 @@ </layer> </detector> - <detector id="8" name="HcalBarrel" type="DD4hep_PolyhedraBarrelCalorimeter2" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="0.*cm" material="Steel235"> + <detector id="8" name="HcalBarrel" type="dd4hep_PolyhedraBarrelCalorimeter2" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="0.*cm" material="Steel235"> <comment>Hadron Calorimeter Barrel</comment> <dimensions numsides="(int) CaloSides" rmin="HcalBarrel_rmin" z="EcalBarrel_zmax*2"/> <staves vis="HcalBarrelStavesVis"/> @@ -703,7 +703,7 @@ </detector> - <detector id="9" name="HcalEndcap" type="DD4hep_PolyhedraEndcapCalorimeter2" readout="HcalEndcapHits" vis="HcalEndcapVis" calorimeterType="HAD_ENDCAP"> + <detector id="9" name="HcalEndcap" type="dd4hep_PolyhedraEndcapCalorimeter2" readout="HcalEndcapHits" vis="HcalEndcapVis" calorimeterType="HAD_ENDCAP"> <comment>Hadron Calorimeter Endcaps</comment> <dimensions numsides="(int) CaloSides" zmin="HcalEndcap_zmin" rmin="HcalEndcap_rmin" rmax="HcalEndcap_rmax" /> <layer repeat="(int) HcalEndcap_layers"> @@ -713,7 +713,7 @@ </layer> </detector> - <detector id="10" name="HcalPlug" type="DD4hep_PolyhedraEndcapCalorimeter2" readout="HcalPlugHits" vis="MuonEndcapVis"> + <detector id="10" name="HcalPlug" type="dd4hep_PolyhedraEndcapCalorimeter2" readout="HcalPlugHits" vis="MuonEndcapVis"> <comment>Hadron Calorimeter Plug</comment> <dimensions numsides="(int) CaloSides" zmin="SolenoidCoilOuterZ" rmin="MuonEndcap_rmin" rmax="HcalEndcap_rmax" /> <layer repeat="1" vis="MuonEndcapLayerVis"> @@ -738,7 +738,7 @@ </detector> - <detector id="11" name="MuonBarrel" type="DD4hep_PolyhedraBarrelCalorimeter2" readout="MuonBarrelHits" vis="MuonBarrelVis" calorimeterType="MUON_BARREL" gap="0.*cm" material="Steel235"> + <detector id="11" name="MuonBarrel" type="dd4hep_PolyhedraBarrelCalorimeter2" readout="MuonBarrelHits" vis="MuonBarrelVis" calorimeterType="MUON_BARREL" gap="0.*cm" material="Steel235"> <comment>Muon Calorimeter Barrel</comment> <dimensions numsides="(int) MuonSides" rmin="MuonBarrel_rmin" z="MuonBarrel_zmax * 2"/> <staves vis="MuonBarrelStavesVis"/> @@ -818,7 +818,7 @@ </layer> </detector> - <detector id="12" name="MuonEndcap" type="DD4hep_PolyhedraEndcapCalorimeter2" readout="MuonEndcapHits" reflect="true" vis="MuonEndcapVis" calorimeterType="MUON_ENDCAP"> + <detector id="12" name="MuonEndcap" type="dd4hep_PolyhedraEndcapCalorimeter2" readout="MuonEndcapHits" reflect="true" vis="MuonEndcapVis" calorimeterType="MUON_ENDCAP"> <comment>Muon Calorimeter Endcaps</comment> <dimensions numsides="(int) MuonSides" zmin="MuonEndcap_zmin" rmin="MuonEndcap_rmin" rmax="MuonEndcap_rmax" /> <layer repeat="(int) MuonEndcap_layers" vis="MuonEndcapLayerVis"> @@ -841,7 +841,7 @@ </layer> </detector> - <detector id="13" name="LumiCal" reflect="true" type="DD4hep_CylindricalEndcapCalorimeter" readout="LumiCalHits" vis="LumiCalVis" calorimeterType="LUMI"> + <detector id="13" name="LumiCal" reflect="true" type="dd4hep_CylindricalEndcapCalorimeter" readout="LumiCalHits" vis="LumiCalVis" calorimeterType="LUMI"> <comment>Luminosity Calorimeter</comment> <dimensions inner_r = "LumiCal_rmin" inner_z = "LumiCal_zmin" outer_r = "LumiCal_rmax" /> <layer repeat="20" > @@ -860,21 +860,21 @@ </layer> </detector> - <detector name="LumiReadout_Forward" type="DD4hep_PolyconeSupport" vis="LumiCalVis"> + <detector name="LumiReadout_Forward" type="dd4hep_PolyconeSupport" vis="LumiCalVis"> <comment>Readout for Luminosity Calorimeter</comment> <material name="G10"/> <zplane rmin="LumiCal_rmax" rmax="LumiCalElectronics_rmax" z="LumiCal_zmin"/> <zplane rmin="LumiCal_rmax" rmax="LumiCalElectronics_rmax" z="LumiCal_zmin+LumiCal_thickness"/> </detector> - <detector name="LumiReadout_Backward" type="DD4hep_PolyconeSupport" vis="LumiCalVis"> + <detector name="LumiReadout_Backward" type="dd4hep_PolyconeSupport" vis="LumiCalVis"> <comment>Readout for Luminosity Calorimeter</comment> <material name="G10"/> <zplane rmin="LumiCal_rmax" rmax="LumiCalElectronics_rmax" z="-LumiCal_zmin"/> <zplane rmin="LumiCal_rmax" rmax="LumiCalElectronics_rmax" z="-(LumiCal_zmin+LumiCal_thickness)"/> </detector> - <detector id="14" name="BeamCal" reflect="true" type="DD4hep_ForwardDetector" readout="BeamCalHits" vis="LumiCalVis" calorimeterType="BEAM"> + <detector id="14" name="BeamCal" reflect="true" type="dd4hep_ForwardDetector" readout="BeamCalHits" vis="LumiCalVis" calorimeterType="BEAM"> <comment>Beam Calorimeter</comment> <dimensions outer_r="BeamCal_rmax" inner_r="0.0*cm" inner_z="BeamCal_zmin" /> <beampipe crossing_angle="CrossingAngle" outgoing_r="OutgoingBP_radius + 0.05*cm" incoming_r="IncomingBP_radius + 0.05*cm" /> @@ -889,13 +889,13 @@ <comment>Dead material and supports</comment> <comment>Beampipe</comment> - <detector name="Beampipe" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> + <detector name="Beampipe" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> <comment>Central Be Beampipe</comment> <material name="Beryllium"/> <zplane rmin="CentralBeamPipe_rmin" rmax="CentralBeamPipe_rmax" z="-CentralBeamPipe_zmax"/> <zplane rmin="CentralBeamPipe_rmin" rmax="CentralBeamPipe_rmax" z="CentralBeamPipe_zmax" /> </detector> - <detector name="SteelConeZbackward" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> + <detector name="SteelConeZbackward" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> <material name="Iron"/> <zplane rmin="BeamPipe_rmax - BeamPipe_thickness" rmax="BeamPipe_rmax" @@ -907,7 +907,7 @@ rmax="CentralBeamPipe_rmax" z="-CentralBeamPipe_zmax"/> </detector> - <detector name="SteelConeZbackward2" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="BeamPipeVis"> + <detector name="SteelConeZbackward2" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="BeamPipeVis"> <material name="Iron"/> <zplane rmin="BeamPipe_rmax - BeamPipe_thickness" rmax="BeamPipe_rmax" @@ -925,7 +925,7 @@ rmax="LumiCal_rmin - BeamPipe_endThickness" z="- (ForwardMask_zmin - BeamPipe_endThickness)" /> </detector> - <detector name="SteelConeZforward" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> + <detector name="SteelConeZforward" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="BeamPipeVis"> <material name="Iron"/> <zplane rmin="CentralBeamPipe_rmin" rmax="CentralBeamPipe_rmax" @@ -937,7 +937,7 @@ rmax="BeamPipe_rmax" z="tracking_region_zmax" /> </detector> - <detector name="SteelConeZforward2" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="BeamPipeVis"> + <detector name="SteelConeZforward2" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="BeamPipeVis"> <material name="Iron"/> <zplane rmin="BeamPipe_rmax - BeamPipe_thickness" rmax="BeamPipe_rmax" @@ -956,7 +956,7 @@ z="ForwardMask_zmin - BeamPipe_endThickness" /> </detector> - <detector name="NorthIncomingBeampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> + <detector name="NorthIncomingBeampipe" type="dd4hep_TubeSegment" vis="BeamPipeVis"> <material name="Iron" /> <tubs rmin="IncomingBP_radius - IncomingBP_thickness" rmax="IncomingBP_radius" zhalf="(MuonEndcap_zmax - ForwardMask_zmin)/2.0" /> <position x="-((ForwardMask_zmin + MuonEndcap_zmax)/2.0*tan(CrossingAngle/rad)/2.0)" y="0" z="(ForwardMask_zmin + MuonEndcap_zmax)/2.0" /> @@ -964,21 +964,21 @@ </detector> - <detector name="SouthIncomingBeampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> + <detector name="SouthIncomingBeampipe" type="dd4hep_TubeSegment" vis="BeamPipeVis"> <material name="Iron" /> <tubs rmin="IncomingBP_radius - IncomingBP_thickness" rmax="IncomingBP_radius" zhalf="(MuonEndcap_zmax - ForwardMask_zmin)/2.0" /> <position x="-((ForwardMask_zmin + MuonEndcap_zmax)/2.0*tan(CrossingAngle/rad)/2.0)" y="0" z="- (ForwardMask_zmin + MuonEndcap_zmax)/2.0" /> <rotation x="0.0" y="-CrossingAngle/2.0/rad" z="0.0" /> </detector> - <detector name="NorthOutgoingBeampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> + <detector name="NorthOutgoingBeampipe" type="dd4hep_TubeSegment" vis="BeamPipeVis"> <material name="Iron" /> <tubs rmin="OutgoingBP_radius - OutgoingBP_thickness" rmax="OutgoingBP_radius" zhalf="(MuonEndcap_zmax - ForwardMask_zmin)/2.0" /> <position x="((ForwardMask_zmin + MuonEndcap_zmax)/2.0*tan(CrossingAngle/rad)/2.0)" y="0" z="(ForwardMask_zmin + MuonEndcap_zmax)/2.0" /> <rotation x="0.0" y="-CrossingAngle/2.0/rad" z="0.0" /> </detector> - <detector name="SouthOutgoingBeampipe" type="DD4hep_TubeSegment" vis="BeamPipeVis"> + <detector name="SouthOutgoingBeampipe" type="dd4hep_TubeSegment" vis="BeamPipeVis"> <material name="Iron" /> <tubs rmin="OutgoingBP_radius - OutgoingBP_thickness" rmax="OutgoingBP_radius" zhalf="(MuonEndcap_zmax - ForwardMask_zmin)/2.0" /> <position x="((ForwardMask_zmin + MuonEndcap_zmax)/2.0*tan(CrossingAngle/rad)/2.0)" y="0" z="- (ForwardMask_zmin + MuonEndcap_zmax)/2.0" /> @@ -986,7 +986,7 @@ </detector> <!-- Beam pipe liner is not needed, use thicker conical steel pipe instead - <detector name="BeamPipeLiner" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="InvisibleNoDaughters"> + <detector name="BeamPipeLiner" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="InvisibleNoDaughters"> <comment>BeamPipe Liner to shield bremsstrahlung photons</comment> <material name="Titanium"/> <zplane rmin="(tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax - BeamPipe_thickness - BeamPipeLiner_thickness" rmax="(tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax - BeamPipe_thickness" z="-tracking_region_zmax" /> @@ -998,7 +998,7 @@ </detector> --> - <detector name="BeamPipeVacuum" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="InvisibleNoDaughters"> + <detector name="BeamPipeVacuum" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="InvisibleNoDaughters"> <comment>Vacuum inside beampipe</comment> <material name="Vacuum"/> <zplane rmin="0.*cm" @@ -1014,7 +1014,7 @@ rmax="BeamPipe_rmax - BeamPipe_thickness - BeamPipeLiner_thickness" z="tracking_region_zmax" /> </detector> - <detector name="ForwardVacuum" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="InvisibleNoDaughters"> + <detector name="ForwardVacuum" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="InvisibleNoDaughters"> <material name="Vacuum"/> <zplane rmin="0.*cm" rmax="BeamPipe_rmax - BeamPipe_thickness" @@ -1032,7 +1032,7 @@ rmax="LumiCal_rmin - 2*BeamPipe_endThickness" z="ForwardMask_zmin - BeamPipe_endThickness" /> </detector> - <detector name="BackwardVacuum" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="InvisibleNoDaughters"> + <detector name="BackwardVacuum" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="InvisibleNoDaughters"> <material name="Vacuum"/> <zplane rmin="0.*cm" rmax="BeamPipe_rmax - BeamPipe_thickness" @@ -1051,7 +1051,7 @@ z="- (ForwardMask_zmin - BeamPipe_endThickness)" /> </detector> <comment>Vertex Detector Supports and Readout</comment> - <detector name="VertexBarrelSupports" type="DD4hep_MultiLayerTracker" vis="SupportVis" reflect="true"> + <detector name="VertexBarrelSupports" type="dd4hep_MultiLayerTracker" vis="SupportVis" reflect="true"> <comment>Double-walled Carbon Fiber support tube</comment> <layer id="6" inner_r = "16.87*cm" outer_z = "89.48*cm"> <slice material = "CarbonFiber" thickness ="VXD_CF_support"/> @@ -1060,7 +1060,7 @@ <slice material = "CarbonFiber" thickness ="VXD_CF_support"/> </layer> </detector> - <detector name="VertexEndSupports" type="DD4hep_DiskTracker" reflect="true" vis="SupportVis"> + <detector name="VertexEndSupports" type="dd4hep_DiskTracker" reflect="true" vis="SupportVis"> <layer id="7" inner_r = "(86.88*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexEndcap_offset" inner_z = "86.88*cm" outer_r = "16.87*cm"> <slice material = "CarbonFiber" thickness = "VXD_CF_support" /> </layer> @@ -1068,7 +1068,7 @@ <slice material = "CarbonFiber" thickness = "VXD_CF_support" /> </layer> </detector> - <detector name="VertexReadout" type="DD4hep_DiskTracker" reflect="true" vis="CableVis"> + <detector name="VertexReadout" type="dd4hep_DiskTracker" reflect="true" vis="CableVis"> <comment>Readout and Cabling</comment> <layer id="1" inner_r = "VertexBarrel_r1" outer_r="VertexBarrel_r1 + 0.02*cm" inner_z= "VertexBarrel_zmax + 0.1*cm" vis="GreenVis"> <slice material = "G10" thickness ="0.5*cm"/> @@ -1122,7 +1122,7 @@ <slice material = "G10" thickness = "0.02*cm" /> </layer> </detector> - <detector name="VXDcableZforwardBarrel" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZforwardBarrel" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin = "(CentralBeamPipe_rmax)" rmax = "(CentralBeamPipe_rmax + VertexCableThickness)" @@ -1131,7 +1131,7 @@ rmax = "(CentralBeamPipe_rmax + VertexCableThickness)" z="CentralBeamPipe_zmax"/> </detector> - <detector name="VXDcableZbackwardBarrel" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZbackwardBarrel" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin = "(CentralBeamPipe_rmax)" rmax = "(CentralBeamPipe_rmax + VertexCableThickness)" @@ -1140,7 +1140,7 @@ rmax = "(CentralBeamPipe_rmax + VertexCableThickness)" z="-CentralBeamPipe_zmax"/> </detector> - <detector name="VXDcableZbackwardOuter" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZbackwardOuter" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin = "((tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax)" rmax = "((tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + 0.004*cm)" @@ -1149,7 +1149,7 @@ rmax="(VertexService_zmax + 0.01*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + 0.01*cm" z="-(VertexService_zmax + 0.01*cm)"/> </detector> - <detector name="VXDcableZbackwardInner" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZbackwardInner" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin="CentralBeamPipe_rmax" rmax="CentralBeamPipe_rmax + VertexCableThickness" @@ -1158,7 +1158,7 @@ rmax="(VertexService_zmin - 0.01*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexCableThickness" z="-(VertexService_zmin - 0.01*cm)"/> </detector> - <detector name="VXDcableZforwardOuter" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZforwardOuter" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin = "((tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax)" rmax = "((tracking_region_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + 0.004*cm)" @@ -1167,7 +1167,7 @@ rmax="(VertexService_zmax + 0.01*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + 0.01*cm" z="VertexService_zmax + 0.01*cm"/> </detector> - <detector name="VXDcableZforwardInner" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDcableZforwardInner" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="Copper"/> <zplane rmin="(VertexService_zmin - 0.01*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax" rmax="(VertexService_zmin - 0.01*cm - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexCableThickness" @@ -1176,7 +1176,7 @@ rmax="CentralBeamPipe_rmax + VertexCableThickness" z="CentralBeamPipe_zmax"/> </detector> - <detector name="VXDserviceZbackward" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDserviceZbackward" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="G10"/> <zplane rmin = "(VertexService_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax" rmax="(VertexService_zmax - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexServiceThickness" @@ -1185,7 +1185,7 @@ rmax="(VertexService_zmin - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexServiceThickness" z="-VertexService_zmin"/> </detector> - <detector name="VXDserviceZforward" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> + <detector name="VXDserviceZforward" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="CableVis"> <material name="G10"/> <zplane rmin = "(VertexService_zmin - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax" rmax="(VertexService_zmin - CentralBeamPipe_zmax)*bp_cone_slope + CentralBeamPipe_rmax + VertexServiceThickness" @@ -1196,7 +1196,7 @@ </detector> <comment>Outer Tracker Supports and Readout</comment> - <detector name="TrackerBarrelSupports" type="DD4hep_MultiLayerTracker" reflect="true"> + <detector name="TrackerBarrelSupports" type="dd4hep_MultiLayerTracker" reflect="true"> <comment>Barrels</comment> <layer id="1" inner_r="206.0*mm" outer_z="577.328*mm"> <slice material="CarbonFiber" thickness="0.05*cm" /> @@ -1226,175 +1226,175 @@ </detector> <comment>Dished endcap disks</comment> - <detector name="SiTrackerEndcapSupport1" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport1" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="(750.417-0.001)*mm" /> <zplane rmin="504.711*mm" rmax="510.448*mm" z="(750.919-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(777.034-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(777.535-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport2" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport2" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="750.919*mm" /> <zplane rmin="438.449*mm" rmax="510.448*mm" z="757.218*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="777.535*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="783.834*mm" /> </detector> - <detector name="SiTrackerEndcapSupport3" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport3" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="(757.218+0.001)*mm" /> <zplane rmin="504.711*mm" rmax="510.448*mm" z="(757.720+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(783.834+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(784.336+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport4" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport4" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="(1014.437-0.001)*mm" /> <zplane rmin="758.059*mm" rmax="763.796*mm" z="(1014.939-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1063.219-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1063.721-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport5" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport5" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="1014.939*mm" /> <zplane rmin="691.797*mm" rmax="763.796*mm" z="1021.238*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="1063.721*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="1070.020*mm" /> </detector> - <detector name="SiTrackerEndcapSupport6" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport6" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="(1021.238+0.001)*mm" /> <zplane rmin="758.059*mm" rmax="763.796*mm" z="(1021.740+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1070.020+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1070.522+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport7" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport7" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="(1272.885-0.001)*mm" /> <zplane rmin="1010.011*mm" rmax="1015.748*mm" z="(1273.387-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1343.711-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1344.213-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport8" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport8" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="1273.387*mm" /> <zplane rmin="943.753*mm" rmax="1015.748*mm" z="1279.686*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="1344.213*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="1350.512*mm" /> </detector> - <detector name="SiTrackerEndcapSupport9" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport9" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="(1279.686+0.001)*mm" /> <zplane rmin="1010.011*mm" rmax="1015.748*mm" z="(1280.188+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1350.512+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1351.014+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport10" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport10" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="(1536.560-0.001)*mm" /> <zplane rmin="1258.071*mm" rmax="1263.808*mm" z="(1537.062-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1629.089-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1629.591-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport11" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport11" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="1537.062*mm" /> <zplane rmin="1191.810*mm" rmax="1263.808*mm" z="1543.361*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="1629.591*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="1635.890*mm" /> </detector> - <detector name="SiTrackerEndcapSupport12" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport12" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="(1543.361+0.001)*mm" /> <zplane rmin="1258.071*mm" rmax="1263.808*mm" z="(1543.863+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(1635.890+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(1636.392+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport1Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport1Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="(-750.417+0.001)*mm" /> <zplane rmin="504.711*mm" rmax="510.448*mm" z="(-750.919+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-777.034+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-777.535+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport2Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport2Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="-750.919*mm" /> <zplane rmin="438.449*mm" rmax="510.448*mm" z="-757.218*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="-777.535*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="-783.834*mm" /> </detector> - <detector name="SiTrackerEndcapSupport3Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport3Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="510.448*mm" rmax="510.448*mm" z="(-757.218-0.001)*mm" /> <zplane rmin="504.711*mm" rmax="510.448*mm" z="(-757.720-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-783.834-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-784.336-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport4Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport4Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="(-1014.437+0.001)*mm" /> <zplane rmin="758.059*mm" rmax="763.796*mm" z="(-1014.939+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1063.219+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1063.721+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport5Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport5Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="-1014.939*mm" /> <zplane rmin="691.797*mm" rmax="763.796*mm" z="-1021.238*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="-1063.721*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="-1070.020*mm" /> </detector> - <detector name="SiTrackerEndcapSupport6Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport6Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="763.796*mm" rmax="763.796*mm" z="(-1021.238-0.001)*mm" /> <zplane rmin="758.059*mm" rmax="763.796*mm" z="(-1021.740-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1070.020-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1070.522-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport7Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport7Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="(-1272.885+0.001)*mm" /> <zplane rmin="1010.011*mm" rmax="1015.748*mm" z="(-1273.387+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1343.711+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1344.213+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport8Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport8Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="-1273.387*mm" /> <zplane rmin="943.753*mm" rmax="1015.748*mm" z="-1279.686*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="-1344.213*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="-1350.512*mm" /> </detector> - <detector name="SiTrackerEndcapSupport9Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport9Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1015.748*mm" rmax="1015.748*mm" z="(-1279.686-0.001)*mm" /> <zplane rmin="1010.011*mm" rmax="1015.748*mm" z="(-1280.188-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1350.512-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1351.014-0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport10Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport10Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="(-1536.560+0.001)*mm" /> <zplane rmin="1258.071*mm" rmax="1263.808*mm" z="(-1537.062+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1629.089+0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1629.591+0.001)*mm" /> </detector> - <detector name="SiTrackerEndcapSupport11Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport11Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="Rohacell31"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="-1537.062*mm" /> <zplane rmin="1191.810*mm" rmax="1263.808*mm" z="-1543.361*mm" /> <zplane rmin="206.234*mm" rmax="278.187*mm" z="-1629.591*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="-1635.890*mm" /> </detector> - <detector name="SiTrackerEndcapSupport12Reflect" type="DD4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> + <detector name="SiTrackerEndcapSupport12Reflect" type="dd4hep_PolyconeSupport" insideTrackingVolume="true" vis="SupportVis"> <material name="CarbonFiber"/> <zplane rmin="1263.808*mm" rmax="1263.808*mm" z="(-1543.361-0.001)*mm" /> <zplane rmin="1258.071*mm" rmax="1263.808*mm" z="(-1543.863-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="211.970*mm" z="(-1635.890-0.001)*mm" /> <zplane rmin="206.234*mm" rmax="206.234*mm" z="(-1636.392-0.001)*mm" /> </detector> - <detector name="TrackerReadout" type="DD4hep_DiskTracker" reflect="true" vis="GreenVis"> + <detector name="TrackerReadout" type="dd4hep_DiskTracker" reflect="true" vis="GreenVis"> <comment>Readouts</comment> <layer id="1" inner_r="25.7*cm" inner_z="590.402*mm" outer_r="45.6*cm"> <slice material="G10" thickness="0.057*cm" /> @@ -1418,27 +1418,27 @@ </layer> </detector> <comment>Masks and Shielding</comment> - <detector name="LumiShielding_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="LumiShielding_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="LumiCal_rmin" rmax="LumiCalElectronics_rmax" z="LumiCal_zmax"/> <zplane rmin="LumiCal_rmin" rmax="LumiCalElectronics_rmax" z="LumiCal_zmax+ForwardShielding_thickness"/> </detector> - <detector name="LumiShielding_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="LumiShielding_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="LumiCal_rmin" rmax="LumiCalElectronics_rmax" z="-LumiCal_zmax"/> <zplane rmin="LumiCal_rmin" rmax="LumiCalElectronics_rmax" z="-(LumiCal_zmax+ForwardShielding_thickness)"/> </detector> - <detector name="ECalShielding_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="ECalShielding_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="LumiCalElectronics_rmax" rmax="HcalEndcap_rmin-SupportTube_thickness-1.0*cm" z="HcalEndcap_zmin"/> <zplane rmin="LumiCalElectronics_rmax" rmax="HcalEndcap_rmin-SupportTube_thickness-1.0*cm" z="HcalEndcap_zmin+ForwardShielding_thickness"/> </detector> - <detector name="ECalShielding_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="ECalShielding_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="LumiCalElectronics_rmax" rmax="HcalEndcap_rmin-SupportTube_thickness-1.0*cm" z="-HcalEndcap_zmin"/> <zplane rmin="LumiCalElectronics_rmax" rmax="HcalEndcap_rmin-SupportTube_thickness-1.0*cm" z="-(HcalEndcap_zmin+ForwardShielding_thickness)"/> </detector> - <detector name="ShieldingTube_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="ShieldingTube_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="HcalEndcap_rmin - SupportTube_thickness - ForwardShielding_thickness - 1.0*cm" rmax="HcalEndcap_rmin - SupportTube_thickness - 1.0*cm" @@ -1447,7 +1447,7 @@ rmax="HcalEndcap_rmin - SupportTube_thickness - 1.0*cm" z="HcalEndcap_zmax"/> </detector> - <detector name="ShieldingTube_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> + <detector name="ShieldingTube_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="TungstenShieldingVis"> <material name="TungstenDens24" /> <zplane rmin="HcalEndcap_rmin - SupportTube_thickness - ForwardShielding_thickness - 1.0*cm" rmax="HcalEndcap_rmin - SupportTube_thickness - 1.0*cm" @@ -1456,7 +1456,7 @@ rmax="HcalEndcap_rmin - SupportTube_thickness - 1.0*cm" z="-HcalEndcap_zmax"/> </detector> - <detector name="SupportTube_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="SupportTubeVis"> + <detector name="SupportTube_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="SupportTubeVis"> <material name="Steel235" /> <zplane rmin="HcalEndcap_rmin - 2*SupportTube_thickness" rmax="HcalEndcap_rmin - SupportTube_thickness" @@ -1465,7 +1465,7 @@ rmax="HcalEndcap_rmin - SupportTube_thickness" z="MuonEndcap_zmax"/> </detector> - <detector name="SupportTube_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="SupportTubeVis"> + <detector name="SupportTube_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="SupportTubeVis"> <material name="Steel235" /> <zplane rmin="HcalEndcap_rmin - 2*SupportTube_thickness" rmax="HcalEndcap_rmin - SupportTube_thickness" @@ -1474,7 +1474,7 @@ rmax="HcalEndcap_rmin - SupportTube_thickness" z="-MuonEndcap_zmax"/> </detector> - <detector name="AntiSolenoid_Forward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="AntiSolenoidVis"> + <detector name="AntiSolenoid_Forward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="AntiSolenoidVis"> <material name="Steel235" /> <zplane rmin="HcalEndcap_rmin + 1.0*cm" rmax="MuonEndcap_rmin - 1.0*cm" @@ -1483,7 +1483,7 @@ rmax="MuonEndcap_rmin - 1.0*cm" z="MuonEndcap_zmax"/> </detector> - <detector name="AntiSolenoid_Backward" type="DD4hep_PolyconeSupport" insideTrackingVolume="false" vis="AntiSolenoidVis"> + <detector name="AntiSolenoid_Backward" type="dd4hep_PolyconeSupport" insideTrackingVolume="false" vis="AntiSolenoidVis"> <material name="Steel235" /> <zplane rmin="HcalEndcap_rmin + 1.0*cm" rmax="MuonEndcap_rmin - 1.0*cm" @@ -1493,7 +1493,7 @@ z="-MuonEndcap_zmax"/> </detector> - <detector name="ForwardLowZ" type="DD4hep_ForwardDetector" vis="TungstenShieldingVis" reflect="true"> + <detector name="ForwardLowZ" type="dd4hep_ForwardDetector" vis="TungstenShieldingVis" reflect="true"> <dimensions outer_r="BeamCal_rmax" inner_r="0.0*cm" inner_z="ForwardMask_zmin" /> <beampipe crossing_angle="CrossingAngle" outgoing_r="OutgoingBP_radius + 0.05*cm" incoming_r="IncomingBP_radius + 0.05*cm" /> <layer repeat="1"> @@ -1502,7 +1502,7 @@ </detector> <comment>Solenoid</comment> - <detector name="SolenoidCoilBarrel" type="DD4hep_MultiLayerTracker" insideTrackingVolume="false" reflect="true"> + <detector name="SolenoidCoilBarrel" type="dd4hep_MultiLayerTracker" insideTrackingVolume="false" reflect="true"> <layer id="1" inner_r="SolenoidBarrelInnerRadius" outer_z="SolenoidBarrelOuterZ" vis="SolenoidBarrelLayerVis"> <slice material="Steel235" thickness="SolenoidBarrelInnerCryostatThickness" /> <slice material="Vacuum" thickness="SolenoidBarrelInnerAirgapThickness" /> @@ -1517,7 +1517,7 @@ </layer> </detector> - <detector name="SolenoidCoilEnds" type="DD4hep_DiskTracker" reflect="true" insideTrackingVolume="false"> + <detector name="SolenoidCoilEnds" type="dd4hep_DiskTracker" reflect="true" insideTrackingVolume="false"> <layer id="1" inner_r="SolenoidBarrelInnerRadius" inner_z="SolenoidBarrelOuterZ" outer_r="SolenoidBarrelOuterRadius" vis="SolenoidCoilEndsVis"> <slice material="Steel235" thickness="SolenoidEndcapCryostatThickness" /> </layer> diff --git a/examples/CLICSiD/eve/CLICSiD_Events.root b/examples/CLICSiD/eve/CLICSiD_Events.root index ff43b5d2077efb0134fe9c99e99fab4270ab5428..31eb519690b7b0f9ba755d8dbc842af54a12541a 100644 GIT binary patch delta 109 zcmXxcyA6V1007~DPkaIXm{{RPOu-^ZF0@in8)vYfVx(Jv2D<y2o4RW1s?RU3>*3pm tq90#NJ{mE?7&o}Z9q#dfM@;a9XT0DQZ<u0+Io|(<=X;$DWgD6W<qX#+FyR0I delta 109 zcmXxcyA6V1007~DPkaIXm{{R5)a-=hLMs)uaRv)2M!FSfpu4ZRsjH{1{`}&q8oq5P s`th~oqY)#Faf4gj;T{io!~{=x#tUBYhAC#4<Na@VzSqf6wxL;2&Y`C-;Q#;t diff --git a/examples/CLICSiD/scripts/CLICSiDAClick.C b/examples/CLICSiD/scripts/CLICSiDAClick.C index 830687ece..ec23601cf 100644 --- a/examples/CLICSiD/scripts/CLICSiDAClick.C +++ b/examples/CLICSiD/scripts/CLICSiDAClick.C @@ -26,13 +26,13 @@ #include <iostream> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation; -using namespace DD4hep::Simulation::Test; -using namespace DD4hep::Simulation::Setup; +using namespace dd4hep; +using namespace dd4hep::sim; +using namespace dd4hep::sim::Test; +using namespace dd4hep::sim::Setup; -SensitiveSeq::handled_type* setupDetector(Geant4Kernel& kernel, const std::string& name) { - SensitiveSeq sd = SensitiveSeq(kernel,name); +Geant4SensDetActionSequence* setupDetector(Geant4Kernel& kernel, const std::string& name) { + SensitiveSeq sd = SensitiveSeq(kernel,"Geant4SensDetActionSequence/"+name); Sensitive sens = Sensitive(kernel,"Geant4TestSensitive/"+name+"Handler",name); sens["OutputLevel"] = 2; sd->adopt(sens); @@ -42,7 +42,7 @@ SensitiveSeq::handled_type* setupDetector(Geant4Kernel& kernel, const std::strin } int setupG4_CINT(bool interactive) { - Geant4Kernel& kernel = Geant4Kernel::instance(Geometry::LCDD::getInstance()); + Geant4Kernel& kernel = Geant4Kernel::instance(Detector::getInstance()); string install_dir = getenv("DD4hepINSTALL"); Phase p; diff --git a/examples/CLICSiD/scripts/CLICSiDXML.C b/examples/CLICSiD/scripts/CLICSiDXML.C index bf0c580f8..c100dbded 100644 --- a/examples/CLICSiD/scripts/CLICSiDXML.C +++ b/examples/CLICSiD/scripts/CLICSiDXML.C @@ -23,12 +23,12 @@ #include <iostream> using namespace std; -using namespace DD4hep::Simulation::Setup; +using namespace dd4hep::sim::Setup; int setupG4_XML(bool interactive) { string install_dir = getenv("DD4hepINSTALL"); string prefix = "file:"+install_dir+"/examples/"; - Kernel& kernel = Kernel::instance(Kernel::LCDD::getInstance()); + Kernel& kernel = Kernel::instance(dd4hep::Detector::getInstance()); kernel.loadGeometry((prefix+"CLICSiD/compact/compact.xml").c_str()); kernel.loadXML((prefix+"CLICSiD/sim/field.xml").c_str()); kernel.loadXML((prefix+"CLICSiD/sim/sequences.xml").c_str()); diff --git a/examples/CLICSiD/scripts/CLICSid.py b/examples/CLICSiD/scripts/CLICSid.py index c43652e16..2b7d478f5 100644 --- a/examples/CLICSiD/scripts/CLICSid.py +++ b/examples/CLICSiD/scripts/CLICSid.py @@ -4,7 +4,7 @@ from SystemOfUnits import * class CLICSid: def __init__(self,tracker='Geant4TrackerCombineAction'): self.kernel = DDG4.Kernel() - self.lcdd = self.kernel.lcdd() + self.description = self.kernel.detectorDescription() self.geant4 = DDG4.Geant4(self.kernel,tracker=tracker) self.kernel.UI = "" self.noPhysics() diff --git a/examples/CLICSiD/scripts/CLIC_G4Gun.py b/examples/CLICSiD/scripts/CLIC_G4Gun.py index 92d13de77..2795726d2 100644 --- a/examples/CLICSiD/scripts/CLIC_G4Gun.py +++ b/examples/CLICSiD/scripts/CLIC_G4Gun.py @@ -19,7 +19,7 @@ def run(): kernel.UI = "UI" geant4.setupCshUI() sid.setupField(quiet=False) - DDG4.importConstants(kernel.lcdd(),debug=False) + DDG4.importConstants(kernel.detectorDescription(),debug=False) prt = DDG4.EventAction(kernel,'Geant4ParticlePrint/ParticlePrint') prt.OutputLevel = Output.INFO diff --git a/examples/CLICSiD/scripts/testDDPython.py b/examples/CLICSiD/scripts/testDDPython.py index 7740fdb05..384cd1736 100644 --- a/examples/CLICSiD/scripts/testDDPython.py +++ b/examples/CLICSiD/scripts/testDDPython.py @@ -4,7 +4,7 @@ import platform if platform.system()=="Darwin": gSystem.SetDynamicPath(os.environ['DD4HEP_LIBRARY_PATH']) gSystem.Load('libDDPython') -from ROOT import DD4hep as Core +from ROOT import dd4hep as Core name_space = __import__(__name__) def import_namespace_item(ns,nam): diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index fa5afd115..7db97b218 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -10,9 +10,9 @@ #========================================================================== # # Simple CMakeList.txt file that allows to -# build all DD4hep examples in one go, e.g. +# build all dd4hep examples in one go, e.g. # -# . ./bin/thisDD4hep.sh +# . ./bin/thisdd4hep.sh # cd examples ; # mkdir build ; cd build # cmake .. @@ -24,7 +24,6 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) option(BUILD_TESTING "Enable and build tests" ON) option(CMAKE_MACOSX_RPATH "Build with rpath on macos" ON) - # find_package ( DD4hep REQUIRED ) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) @@ -36,9 +35,9 @@ include(${ROOT_USE_FILE}) dd4hep_set_compiler_flags() # dd4hep_configure_output() -dd4hep_package ( DD4hepExample MAJOR 0 MINOR 15 PATCH 0 +dd4hep_package ( dd4hepExample MAJOR 0 MINOR 15 PATCH 0 USES [ROOT REQUIRED COMPONENTS Geom GenVector] - [DD4hep REQUIRED COMPONENTS DDCore] + [dd4hep REQUIRED COMPONENTS DDCore] ) # dd4hep_enable_tests (AlignDet diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index fa7a816f8..8780031fe 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -33,7 +33,7 @@ dd4hep_configure_scripts( ClientTests DEFAULT_SETUP WITH_TESTS) # Test JSON based parser dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Dump COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" - EXEC_ARGS geoPluginRun -destroy -plugin DD4hep_JsonDumper + EXEC_ARGS geoPluginRun -destroy -plugin dd4hep_JsonDumper ${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel.json REGEX_PASS "Successfully dumped json input" REGEX_FAIL "Exception" @@ -43,7 +43,7 @@ dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Dump # Test JSON based detector construction dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Detector COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" - EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hepCompactLoader + EXEC_ARGS geoPluginRun -volmgr -destroy -plugin dd4hepCompactLoader file:${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel_json.xml REGEX_PASS "Successfully processed JSON input" REGEX_FAIL "Exception" @@ -53,7 +53,7 @@ dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Detector # Test readout strings of the form: <id>system:8,barrel:-2</id> dd4hep_add_test_reg( ClientTests_DumpElements COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" - EXEC_ARGS geoPluginRun -plugin DD4hepElementTable -type xml + EXEC_ARGS geoPluginRun -plugin dd4hepElementTable -type xml REGEX_PASS "formula=\"UUB\" name=\"UUB\"" ) # # Test long volume IDs Detector setups with placements of @@ -62,7 +62,7 @@ dd4hep_add_test_reg( ClientTests_MultiPlace COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/SiBarrelMultiSensitiveLongVolID.xml -volmgr -destroy - -plugin DD4hepVolumeMgrTest SiTrackerBarrel + -plugin dd4hepVolumeMgrTest SiTrackerBarrel REGEX_PASS "Volume:component1_1 IDDesc:OK \\[S\\] vid:00200668000000ff system:00ff barrel:0000 layer:0001 module:0033 sensor:0001" REGEX_FAIL "FAILED: World transformation DIFFER" @@ -73,7 +73,7 @@ dd4hep_add_test_reg( ClientTests_Bitfield64_LongVoldID COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/SiBarrelMultiSensitiveLongVolID.xml -volmgr -destroy - -plugin DD4hepVolumeMgrTest SiTrackerBarrel + -plugin dd4hepVolumeMgrTest SiTrackerBarrel REGEX_PASS "Volume:component1_1 IDDesc:OK \\[S\\] vid:00200668000000ff system:00ff barrel:0000 layer:0001 module:0033 sensor:0001" REGEX_FAIL "FAILED: World transformation DIFFER" @@ -84,9 +84,9 @@ dd4hep_add_test_reg( ClientTests_Bitfield64_BarrelSides COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Bitfield_SidesTest.xml -volmgr -destroy - -plugin DD4hepDetectorVolumeDump - -plugin DD4hepVolumeDump volids - -plugin DD4hepVolumeMgrTest all + -plugin dd4hepDetectorVolumeDump + -plugin dd4hepVolumeDump volids + -plugin dd4hepVolumeMgrTest all REGEX_PASS "Volume:Shell_2 IDDesc:OK \\[S\\] vid:0000000000000102 system:0002 barrel:0001") # # Test readout strings of the form: <id>system:16,barrel:16:-5</id> @@ -94,9 +94,9 @@ dd4hep_add_test_reg( ClientTests_Bitfield64_BarrelSides2 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/Bitfield_SidesTest2.xml -volmgr -destroy - -plugin DD4hepDetectorVolumeDump - -plugin DD4hepVolumeDump volids - -plugin DD4hepVolumeMgrTest all + -plugin dd4hepDetectorVolumeDump + -plugin dd4hepVolumeDump volids + -plugin dd4hepVolumeMgrTest all REGEX_PASS "Volume:Shell_2 IDDesc:OK \\[S\\] vid:0000000000010002 system:0002 barrel:0001") # # @@ -104,7 +104,7 @@ foreach (test Assemblies BoxTrafos IronCylinder LheD_tracker MagnetFields Materi MiniTel SectorBarrelCalorimeter SiliconBlock NestedSimple NestedDetectors MultiCollections MultiSegmentations ) # Test format conversions - foreach( type lcdd gdml vis ) + foreach( type description gdml vis ) dd4hep_add_test_reg( ClientTests_${test}_converter_${type} COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoConverter -compact2${type} diff --git a/examples/ClientTests/compact/Bitfield_SidesTest.xml b/examples/ClientTests/compact/Bitfield_SidesTest.xml index 9d8986875..10266eb73 100644 --- a/examples/ClientTests/compact/Bitfield_SidesTest.xml +++ b/examples/ClientTests/compact/Bitfield_SidesTest.xml @@ -26,7 +26,7 @@ </display> <detectors> - <detector id="2" name="Shell" type="DD4hep_CylinderShell" vis="VisibleGreen" readout="ShellHits" > + <detector id="2" name="Shell" type="dd4hep_CylinderShell" vis="VisibleGreen" readout="ShellHits" > <comment>Containment shell to measure calorimeter escapes</comment> <material name="Air"/> <module name="Barrel" id="0" vis="VisibleBlue"> diff --git a/examples/ClientTests/compact/Bitfield_SidesTest2.xml b/examples/ClientTests/compact/Bitfield_SidesTest2.xml index f22f4a758..02785d1b3 100644 --- a/examples/ClientTests/compact/Bitfield_SidesTest2.xml +++ b/examples/ClientTests/compact/Bitfield_SidesTest2.xml @@ -26,7 +26,7 @@ </display> <detectors> - <detector id="2" name="Shell" type="DD4hep_CylinderShell" vis="VisibleGreen" readout="ShellHits" > + <detector id="2" name="Shell" type="dd4hep_CylinderShell" vis="VisibleGreen" readout="ShellHits" > <comment>Containment shell to measure calorimeter escapes</comment> <material name="Air"/> <module name="Barrel" id="0" vis="VisibleBlue"> diff --git a/examples/ClientTests/compact/DuplicateSysID.xml b/examples/ClientTests/compact/DuplicateSysID.xml index f8cf0d599..e5fdcca00 100644 --- a/examples/ClientTests/compact/DuplicateSysID.xml +++ b/examples/ClientTests/compact/DuplicateSysID.xml @@ -30,7 +30,7 @@ <detectors> <comment>Boxes</comment> - <detector id="3" name="B3" type="DD4hep_BoxSegment" readout="SiliconHits" sensitive="true"> + <detector id="3" name="B3" type="dd4hep_BoxSegment" readout="SiliconHits" sensitive="true"> <comment>Vertical box</comment> <material name="Steel235"/> <sensitive type="calo"/> @@ -38,7 +38,7 @@ <position x="-10" y="30" z="10"/> <rotation x="0" y="0" z="0"/> </detector> - <detector id="3" name="B4" type="DD4hep_BoxSegment" readout="SiliconHits" sensitive="true"> + <detector id="3" name="B4" type="dd4hep_BoxSegment" readout="SiliconHits" sensitive="true"> <comment>Vertical box</comment> <material name="Steel235"/> <sensitive type="calo"/> diff --git a/examples/ClientTests/compact/InhibitConstants.xml b/examples/ClientTests/compact/InhibitConstants.xml index 6a6d0a962..2db33f3c2 100644 --- a/examples/ClientTests/compact/InhibitConstants.xml +++ b/examples/ClientTests/compact/InhibitConstants.xml @@ -4,7 +4,7 @@ xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> <define> - <constant name="LCDD_InhibitConstants" value="1"/>; + <constant name="Detector_InhibitConstants" value="1"/>; <constant name="world_side" value="2*m"/> <constant name="world_x" value="world_side/2"/> <constant name="world_y" value="world_side/2"/> diff --git a/examples/ClientTests/compact/IronCylinder.xml b/examples/ClientTests/compact/IronCylinder.xml index 5d87b2c79..8396b3cf8 100644 --- a/examples/ClientTests/compact/IronCylinder.xml +++ b/examples/ClientTests/compact/IronCylinder.xml @@ -41,7 +41,7 @@ <dimensions rmin="HcalBarrel_rmin" rmax="HcalBarrel_rmax" z="HcalBarrel_zmax" phiBins="64" /> </detector> - <detector id="2" name="ContainmentShell" type="DD4hep_CylinderShell" vis="VisibleRed" readout="ContainmentHits" > + <detector id="2" name="ContainmentShell" type="dd4hep_CylinderShell" vis="VisibleRed" readout="ContainmentHits" > <comment>Containment shell to measure calorimeter escapes</comment> <material name="Air"/> <module name="Barrel" id="0" vis="VisibleRed"> diff --git a/examples/ClientTests/compact/MultiCollections.xml b/examples/ClientTests/compact/MultiCollections.xml index 1b18f5cb5..38e0cd0a4 100644 --- a/examples/ClientTests/compact/MultiCollections.xml +++ b/examples/ClientTests/compact/MultiCollections.xml @@ -35,7 +35,7 @@ <!-- Simple calorimeter with a couple of layers --> <!-- ================================================================== --> <detectors> - <detector id="13" name="TestCal" reflect="true" type="DD4hep_CylindricalEndcapCalorimeter" readout="TestCalHits" vis="BlueVis"> + <detector id="13" name="TestCal" reflect="true" type="dd4hep_CylindricalEndcapCalorimeter" readout="TestCalHits" vis="BlueVis"> <comment>Test Calorimeter</comment> <dimensions inner_r = "0.1*m" outer_r="2*m" inner_z = "2*m"/> <layer repeat="15" > diff --git a/examples/ClientTests/compact/MultiSegmentCollections.xml b/examples/ClientTests/compact/MultiSegmentCollections.xml index 599c8c598..49b3a035a 100644 --- a/examples/ClientTests/compact/MultiSegmentCollections.xml +++ b/examples/ClientTests/compact/MultiSegmentCollections.xml @@ -35,7 +35,7 @@ <!-- Simple calorimeter with a couple of layers --> <!-- ================================================================== --> <detectors> - <detector id="13" name="TestCal" reflect="true" type="DD4hep_CylindricalEndcapCalorimeter" readout="TestCalHits" vis="BlueVis"> + <detector id="13" name="TestCal" reflect="true" type="dd4hep_CylindricalEndcapCalorimeter" readout="TestCalHits" vis="BlueVis"> <comment>Test Calorimeter</comment> <dimensions inner_r = "0.1*m" outer_r="2*m" inner_z = "2*m"/> <layer repeat="15" > diff --git a/examples/ClientTests/compact/MultiSegmentations.xml b/examples/ClientTests/compact/MultiSegmentations.xml index 2e086697f..f3eaf32e9 100644 --- a/examples/ClientTests/compact/MultiSegmentations.xml +++ b/examples/ClientTests/compact/MultiSegmentations.xml @@ -35,7 +35,7 @@ <!-- Simple calorimeter with a couple of layers --> <!-- ================================================================== --> <detectors> - <detector id="13" name="TestCal" reflect="true" type="DD4hep_CylindricalEndcapCalorimeter" readout="TestCalHits" vis="BlueVis"> + <detector id="13" name="TestCal" reflect="true" type="dd4hep_CylindricalEndcapCalorimeter" readout="TestCalHits" vis="BlueVis"> <comment>Test Calorimeter</comment> <dimensions inner_r = "0.1*m" outer_r="2*m" inner_z = "2*m"/> <layer repeat="15" > diff --git a/examples/ClientTests/compact/NestedDetectors.xml b/examples/ClientTests/compact/NestedDetectors.xml index 745335a10..00aee83c4 100644 --- a/examples/ClientTests/compact/NestedDetectors.xml +++ b/examples/ClientTests/compact/NestedDetectors.xml @@ -52,7 +52,7 @@ <comment>Tracking detectors</comment> <detectors> - <detector id="99" name="SiTrackers" type="DD4hep_SubdetectorAssembly" vis="BlueVisTrans"> + <detector id="99" name="SiTrackers" type="dd4hep_SubdetectorAssembly" vis="BlueVisTrans"> <shape name="SiTrackersEnv" type="Tube" rmin="0*mm" rmax="2500*mm" dz="2200*mm" material="Air"> </shape> <comment>Silicon Tracker Assembly</comment> diff --git a/examples/ClientTests/compact/NestedSimple.xml b/examples/ClientTests/compact/NestedSimple.xml index e0d86bfe7..58ec56ff6 100644 --- a/examples/ClientTests/compact/NestedSimple.xml +++ b/examples/ClientTests/compact/NestedSimple.xml @@ -52,7 +52,7 @@ <comment>Tracking detectors</comment> <detectors> - <detector id="99" name="SiTrackers" type="DD4hep_SubdetectorAssembly" vis="BlueVisTrans"> + <detector id="99" name="SiTrackers" type="dd4hep_SubdetectorAssembly" vis="BlueVisTrans"> <shape name="SiTrackersEnv" type="Tube" rmin="0*mm" rmax="2500*mm" dz="2200*mm" material="Air"> </shape> <comment>Silicon Tracker Assembly</comment> diff --git a/examples/ClientTests/compact/NestedSolenoid.xml b/examples/ClientTests/compact/NestedSolenoid.xml index d79333629..f20167c23 100644 --- a/examples/ClientTests/compact/NestedSolenoid.xml +++ b/examples/ClientTests/compact/NestedSolenoid.xml @@ -6,7 +6,7 @@ </display> <detectors> - <detector name="NestedSolenoid" type="DD4hep_MultiLayerTracker" insideTrackingVolume="false" reflect="true"> + <detector name="NestedSolenoid" type="dd4hep_MultiLayerTracker" insideTrackingVolume="false" reflect="true"> <layer id="1" inner_r="1.8*m" outer_z="1.5*m" vis="VIS1"> <slice material="Iron" thickness="1*cm" /> <slice material="Iron" thickness="1*cm" /> diff --git a/examples/ClientTests/compact/SiBarrelMultiSensitiveDetector.xml b/examples/ClientTests/compact/SiBarrelMultiSensitiveDetector.xml index 03e38ae3d..3b5ddc12d 100644 --- a/examples/ClientTests/compact/SiBarrelMultiSensitiveDetector.xml +++ b/examples/ClientTests/compact/SiBarrelMultiSensitiveDetector.xml @@ -53,7 +53,7 @@ </readouts> <detectors> - <detector id="SiTrackerBarrel_ID" name="SiTrackerBarrel" type="DD4hep_SiBarrelMultiSensitiveDetector" readout="SiTrackerBarrelHits" region="SiTrackerBarrelRegion" limits="SiTrackerBarrelRegionLimitSet"> + <detector id="SiTrackerBarrel_ID" name="SiTrackerBarrel" type="dd4hep_SiBarrelMultiSensitiveDetector" readout="SiTrackerBarrelHits" region="SiTrackerBarrelRegion" limits="SiTrackerBarrelRegionLimitSet"> <comment>Silicon Outer Tracker Barrel</comment> diff --git a/examples/ClientTests/compact/SiBarrelMultiSensitiveLongVolID.xml b/examples/ClientTests/compact/SiBarrelMultiSensitiveLongVolID.xml index d4f9af458..5bd8ea7a3 100644 --- a/examples/ClientTests/compact/SiBarrelMultiSensitiveLongVolID.xml +++ b/examples/ClientTests/compact/SiBarrelMultiSensitiveLongVolID.xml @@ -53,7 +53,7 @@ </readouts> <detectors> - <detector id="SiTrackerBarrel_ID" name="SiTrackerBarrel" type="DD4hep_SiBarrelMultiSensitiveDetector" readout="SiTrackerBarrelHits" region="SiTrackerBarrelRegion" limits="SiTrackerBarrelRegionLimitSet"> + <detector id="SiTrackerBarrel_ID" name="SiTrackerBarrel" type="dd4hep_SiBarrelMultiSensitiveDetector" readout="SiTrackerBarrelHits" region="SiTrackerBarrelRegion" limits="SiTrackerBarrelRegionLimitSet"> <comment>Silicon Outer Tracker Barrel</comment> diff --git a/examples/ClientTests/compact/SiliconBlock.lcdd b/examples/ClientTests/compact/SiliconBlock.lcdd index 8bada85c3..ffed01adc 100644 --- a/examples/ClientTests/compact/SiliconBlock.lcdd +++ b/examples/ClientTests/compact/SiliconBlock.lcdd @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<lcdd xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcdd/1.0/lcdd.xsd"> +<description xmlns:description="http://www.lcsim.org/schemas/description/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/description/1.0/description.xsd"> <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - ++++ Linear collider detector description LCDD in C++ ++++ - ++++ DD4hep Detector description generator. ++++ + ++++ Linear collider detector description Detector in C++ ++++ + ++++ dd4hep Detector description generator. ++++ ++++ ++++ ++++ Parser: Apache Xerces-C DOM Parser ++++ ++++ ++++ @@ -14,7 +14,7 @@ <header> <detector name="SiliconBlock"/> - <generator checksum="0" file="http://www.cern.ch/lhcb" name="LCDDConverter" version="$Id: compact.xml 513 2013-04-05 14:31:53Z gaede $"/> + <generator checksum="0" file="http://www.cern.ch/lhcb" name="DetectorConverter" version="$Id: compact.xml 513 2013-04-05 14:31:53Z gaede $"/> <author name="Markus Frank"/> <comment>Alignment test with 2 simple boxes</comment> </header> @@ -135,4 +135,4 @@ <solenoid funit="tesla" inner_field="5.00000000e+00" inner_radius="3.00000000e+03" lunit="mm" name="GlobalSolenoid" outer_field="-1.50000000e+00" outer_radius="3.00000000e+04" zmax="2.00000000e+02" zmin="-2.00000000e+02"/> </fields> -</lcdd> +</description> diff --git a/examples/ClientTests/compact/SiliconBlock.xml b/examples/ClientTests/compact/SiliconBlock.xml index 0d42d9140..47ce1679f 100644 --- a/examples/ClientTests/compact/SiliconBlock.xml +++ b/examples/ClientTests/compact/SiliconBlock.xml @@ -46,14 +46,14 @@ </regions> <detectors> - <detector id="1" name="SiliconBlockUpper" type="DD4hep_BoxSegment" readout="SiliconUpperHits" vis="VisibleGreen" sensitive="true" region="SiRegion" limits="SiRegionLimitSet"> + <detector id="1" name="SiliconBlockUpper" type="dd4hep_BoxSegment" readout="SiliconUpperHits" vis="VisibleGreen" sensitive="true" region="SiRegion" limits="SiRegionLimitSet"> <material name="Silicon"/> <sensitive type="tracker"/> <box x="20*mm" y="20*cm" z="20*cm"/> <position x="4*cm" y="0" z="0"/> <rotation x="0" y="0" z="0"/> </detector> - <detector id="2" name="SiliconBlockDown" type="DD4hep_BoxSegment" readout="SiliconDownHits" vis="VisibleRed" sensitive="true" region="SiRegion" limits="SiRegionLimitSet"> + <detector id="2" name="SiliconBlockDown" type="dd4hep_BoxSegment" readout="SiliconDownHits" vis="VisibleRed" sensitive="true" region="SiRegion" limits="SiRegionLimitSet"> <material name="Silicon"/> <sensitive type="tracker"/> <box x="20*mm" y="20*cm" z="20*cm"/> diff --git a/examples/ClientTests/scripts/Assemblies.py b/examples/ClientTests/scripts/Assemblies.py index 4dc7b7a2d..b69142e4d 100644 --- a/examples/ClientTests/scripts/Assemblies.py +++ b/examples/ClientTests/scripts/Assemblies.py @@ -2,7 +2,7 @@ import os, sys, time, DDG4 from SystemOfUnits import * # """ - DD4hep example setup using the python configuration + dd4hep example setup using the python configuration \author M.Frank \version 1.0 diff --git a/examples/ClientTests/scripts/BoxTrafos.C b/examples/ClientTests/scripts/BoxTrafos.C index 6f9d7b798..7ebad8a8d 100644 --- a/examples/ClientTests/scripts/BoxTrafos.C +++ b/examples/ClientTests/scripts/BoxTrafos.C @@ -17,7 +17,7 @@ namespace { struct Loader { Loader() { gSystem->Load("libDDCore"); } } _load; } -using namespace DD4hep::Geometry; +using namespace dd4hep::detail; void printPos(const char* com, const Position& p) { printf("%-24s: %7.3f %7.3f %7.3f\n",com,p.x(),p.y(),p.z()); @@ -53,12 +53,12 @@ int BoxTrafos() { const char* argv[] = {xml.c_str(), "BUILD_DEFAULT", 0}; gSystem->Load("libDDCore"); - LCDD& lcdd = LCDD::getInstance(); - lcdd.apply("DD4hepCompactLoader",2,(char**)argv); - lcdd.apply("DD4hepGeometryDisplay",0,0); + Detector& description = Detector::getInstance(); + description.apply("dd4hepCompactLoader",2,(char**)argv); + description.apply("dd4hepGeometryDisplay",0,0); - DetElement de = lcdd.detector("B3"); + DetElement de = description.detector("B3"); PlacedVolume pv = de.placement(); Volume vol = pv.volume(); Solid solid = vol.solid(); diff --git a/examples/ClientTests/scripts/FCC_Hcal.C b/examples/ClientTests/scripts/FCC_Hcal.C index 1035c342d..ce8f83746 100644 --- a/examples/ClientTests/scripts/FCC_Hcal.C +++ b/examples/ClientTests/scripts/FCC_Hcal.C @@ -2,12 +2,12 @@ #include "DDG4/Geant4Config.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Simulation::Setup; +using namespace dd4hep; +using namespace dd4hep::sim::Setup; int setupG4_CINT() { - typedef DD4hep::Simulation::Geant4Kernel Kernel; - Kernel& kernel = Kernel::instance(DD4hep::Geometry::LCDD::getInstance()); + typedef dd4hep::sim::Geant4Kernel Kernel; + Kernel& kernel = Kernel::instance(dd4hep::Detector::getInstance()); string install_dir = getenv("DD4hepINSTALL"); string ddg4_examples = install_dir+"/examples/DDG4/examples"; char text[256]; diff --git a/examples/ClientTests/scripts/FCC_Hcal.py b/examples/ClientTests/scripts/FCC_Hcal.py index 288370d56..87460f699 100644 --- a/examples/ClientTests/scripts/FCC_Hcal.py +++ b/examples/ClientTests/scripts/FCC_Hcal.py @@ -5,7 +5,7 @@ from SystemOfUnits import * # """ - DD4hep example setup using the python configuration + dd4hep example setup using the python configuration \author M.Frank \version 1.0 diff --git a/examples/ClientTests/scripts/LheD_tracker.py b/examples/ClientTests/scripts/LheD_tracker.py index 2d14dcd37..1fafd3e63 100644 --- a/examples/ClientTests/scripts/LheD_tracker.py +++ b/examples/ClientTests/scripts/LheD_tracker.py @@ -7,7 +7,7 @@ from SystemOfUnits import * # """ - DD4hep simulation example setup using the python configuration + dd4hep simulation example setup using the python configuration @author M.Frank @version 1.0 @@ -15,12 +15,12 @@ from SystemOfUnits import * """ def run(): kernel = DDG4.Kernel() - lcdd = kernel.lcdd() + description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/LheD_tracker.xml") - DDG4.importConstants(lcdd,debug=False) + DDG4.importConstants(description,debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') geant4.printDetectors() diff --git a/examples/ClientTests/scripts/MiniTel.py b/examples/ClientTests/scripts/MiniTel.py index d5ce52fd5..3d457ba9e 100644 --- a/examples/ClientTests/scripts/MiniTel.py +++ b/examples/ClientTests/scripts/MiniTel.py @@ -5,7 +5,7 @@ from SystemOfUnits import * # """ - DD4hep example setup using the python configuration + dd4hep example setup using the python configuration \author M.Frank \version 1.0 diff --git a/examples/ClientTests/scripts/MultiCollections.py b/examples/ClientTests/scripts/MultiCollections.py index 03b9d0fc7..60abad01e 100644 --- a/examples/ClientTests/scripts/MultiCollections.py +++ b/examples/ClientTests/scripts/MultiCollections.py @@ -5,7 +5,7 @@ from SystemOfUnits import * # """ - DD4hep example setup using the python configuration + dd4hep example setup using the python configuration \author M.Frank \version 1.0 diff --git a/examples/ClientTests/scripts/MultiSegmentCollections.py b/examples/ClientTests/scripts/MultiSegmentCollections.py index 6b51b930c..909022d32 100644 --- a/examples/ClientTests/scripts/MultiSegmentCollections.py +++ b/examples/ClientTests/scripts/MultiSegmentCollections.py @@ -5,7 +5,7 @@ from SystemOfUnits import * # """ - DD4hep example setup using the python configuration + dd4hep example setup using the python configuration \author M.Frank \version 1.0 diff --git a/examples/ClientTests/scripts/NestedDetectors.py b/examples/ClientTests/scripts/NestedDetectors.py index 0bf0e972a..8d76e368f 100644 --- a/examples/ClientTests/scripts/NestedDetectors.py +++ b/examples/ClientTests/scripts/NestedDetectors.py @@ -5,7 +5,7 @@ from SystemOfUnits import * # """ - DD4hep example setup using the python configuration + dd4hep example setup using the python configuration \author M.Frank \version 1.0 diff --git a/examples/ClientTests/scripts/SiliconBlock.py b/examples/ClientTests/scripts/SiliconBlock.py index c51b4b6df..832e367aa 100644 --- a/examples/ClientTests/scripts/SiliconBlock.py +++ b/examples/ClientTests/scripts/SiliconBlock.py @@ -7,7 +7,7 @@ from SystemOfUnits import * # """ - DD4hep simulation example setup using the python configuration + dd4hep simulation example setup using the python configuration @author M.Frank @version 1.0 @@ -18,7 +18,7 @@ def run(): install_dir = os.environ['DD4hepINSTALL'] kernel.loadGeometry("file:"+install_dir+"/examples/ClientTests/compact/SiliconBlock.xml") - DDG4.importConstants(kernel.lcdd(),debug=False) + DDG4.importConstants(kernel.detectorDescription(),debug=False) geant4 = DDG4.Geant4(kernel,tracker='Geant4TrackerCombineAction') geant4.printDetectors() # Configure UI diff --git a/examples/ClientTests/src/Assemblies_VXD_geo.cpp b/examples/ClientTests/src/Assemblies_VXD_geo.cpp index e7025cd8b..fa6a7cdd5 100644 --- a/examples/ClientTests/src/Assemblies_VXD_geo.cpp +++ b/examples/ClientTests/src/Assemblies_VXD_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,17 +15,17 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_element(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; string name = x_det.nameStr(); Assembly assembly(name+"_assembly"); DetElement vxd(name, x_det.typeStr(), x_det.id()); PlacedVolume pv; - assembly.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + assembly.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); for(xml_coll_t c(e,_U(layer)); c; ++c) { xml_comp_t x_layer (c); xml_comp_t x_support (x_layer.child(_U(support))); @@ -37,7 +37,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // --- create an assembly and DetElement for the layer Assembly layer_assembly(layername); //Box layer_box(1,1,1); - //Volume layer_assembly(layername,layer_box,lcdd.air()); + //Volume layer_assembly(layername,layer_box,description.air()); DetElement layerDE( vxd , _toString(layer_id,"layer_%d"), x_det.id() ); double zhalf = x_ladder.zhalf(); @@ -50,14 +50,14 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double width = x_ladder.width(); //Box ladderbox ((sens_thick+supp_thick)/2., width/2., zhalf ); - //Volume laddervol(layername+"_ladder",ladderbox,lcdd.air()); + //Volume laddervol(layername+"_ladder",ladderbox,description.air()); Assembly laddervol (layername+"_ladder"); Box sensbox (sens_thick/2., width/2., zhalf); - Volume sensvol (layername+"_ladder_sens",sensbox,lcdd.material(x_ladder.materialStr())); + Volume sensvol (layername+"_ladder_sens",sensbox,description.material(x_ladder.materialStr())); Box suppbox (supp_thick/2.,width/2.,zhalf); - Volume suppvol (layername+"_ladder_supp",suppbox,lcdd.material(x_support.materialStr())); + Volume suppvol (layername+"_ladder_supp",suppbox,description.material(x_support.materialStr())); // --- position the sensitive on top of the support ! Position senspos ( (sens_thick+supp_thick)/2. - sens_thick/2., 0, 0 ); @@ -65,15 +65,15 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { sens.setType("tracker"); - layer_assembly.setAttributes(lcdd,x_layer.regionStr(),x_layer.limitsStr(),"invisible"); + layer_assembly.setAttributes(description,x_layer.regionStr(),x_layer.limitsStr(),"invisible"); pv = assembly.placeVolume(layer_assembly).addPhysVolID("layer",layer_id); layerDE.setPlacement( pv ) ; - laddervol.setAttributes(lcdd,x_ladder.regionStr(),x_ladder.limitsStr(),"invisible"); - suppvol.setAttributes(lcdd,x_support.regionStr(),x_support.limitsStr(),x_support.visStr()); + laddervol.setAttributes(description,x_ladder.regionStr(),x_ladder.limitsStr(),"invisible"); + suppvol.setAttributes(description,x_support.regionStr(),x_support.limitsStr(),x_support.visStr()); sensvol.setSensitiveDetector(sens); - sensvol.setAttributes(lcdd,x_ladder.regionStr(),x_ladder.limitsStr(),x_layer.visStr()); + sensvol.setAttributes(description,x_ladder.regionStr(),x_ladder.limitsStr(),x_layer.visStr()); laddervol.placeVolume(sensvol,senspos); laddervol.placeVolume(suppvol,supppos); @@ -100,7 +100,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { ladderDEnegZ.setPlacement( pv ) ; } } - Volume mother = lcdd.pickMotherVolume(vxd) ; + Volume mother = description.pickMotherVolume(vxd) ; pv = mother.placeVolume(assembly); pv.addPhysVolID( "system", x_det.id()); vxd.setPlacement(pv); diff --git a/examples/ClientTests/src/FCC_HcalBarrel2_geo.cpp b/examples/ClientTests/src/FCC_HcalBarrel2_geo.cpp index 7b2436734..61b044872 100644 --- a/examples/ClientTests/src/FCC_HcalBarrel2_geo.cpp +++ b/examples/ClientTests/src/FCC_HcalBarrel2_geo.cpp @@ -11,31 +11,31 @@ #include <vector> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { //XML detector object: DDCore/XML/XMLDetector.h - DD4hep::XML::DetElement x_det = e; + dd4hep::xml::DetElement x_det = e; - //Create the DetElement for DD4hep + //Create the DetElement for dd4hep DetElement d_det(x_det.nameStr(),x_det.id()); //Pick the mothervolume - Volume det_vol = lcdd.pickMotherVolume(d_det); + Volume det_vol = description.pickMotherVolume(d_det); //XML dimension object: DDCore/XML/XMLDimension.h - DD4hep::XML::Dimension x_det_dim(x_det.dimensions()); + dd4hep::xml::Dimension x_det_dim(x_det.dimensions()); //Tube: DDCore/DD4hep/Shapes.h Tube calo_shape(x_det_dim.rmin(),x_det_dim.rmax(),x_det_dim.z()); //Create the detector mother volume - Volume calo_vol(x_det.nameStr()+"_envelope",calo_shape,lcdd.air()); + Volume calo_vol(x_det.nameStr()+"_envelope",calo_shape,description.air()); //Set envelope volume attributes - calo_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + calo_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); //Place inside the mother volume PlacedVolume calo_plv = det_vol.placeVolume(calo_vol); @@ -61,10 +61,10 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { while(r<x_det_dim.rmax()){ //Loop over layers of type: XML Collection_t object: DDCore/XML/XMLElements.h - for(DD4hep::XML::Collection_t layerIt(x_det,_U(layer));layerIt; ++layerIt){ + for(dd4hep::xml::Collection_t layerIt(x_det,_U(layer));layerIt; ++layerIt){ //Build a layer volume - DD4hep::XML::Component x_det_layer = layerIt; + dd4hep::xml::Component x_det_layer = layerIt; float dr = x_det_layer.dr(); @@ -91,8 +91,8 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { Trapezoid layer_shape(x1,x2,y1,y2,z); //Create a volume with trapezoid shape - Volume layer_vol(layer_name, layer_shape, lcdd.air()); - layer_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det_layer.visStr()); + Volume layer_vol(layer_name, layer_shape, description.air()); + layer_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det_layer.visStr()); //DetElement layer(layer_name,_toString(layer_num,"layer%d"),x_det.id()); @@ -105,9 +105,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //Repeat slices until we reach the end of the calorimeter for(xml_coll_t k(x_det_layer,_U(slice)); k; ++k) { - DD4hep::XML::Component tile_xml = k; + dd4hep::xml::Component tile_xml = k; string tile_name = layer_name + _toString(tile_number,"_slice%d"); - Material tile_material = lcdd.material(tile_xml.materialStr()); + Material tile_material = description.material(tile_xml.materialStr()); float tile_thickness = tile_xml.dz(); float tile_y1 = tile_thickness; float tile_y2 = tile_thickness; @@ -124,7 +124,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } //Set region, limitset, and visibility settings - tile_vol.setAttributes(lcdd,tile_xml.regionStr(),tile_xml.limitsStr(),tile_xml.visStr()); + tile_vol.setAttributes(description,tile_xml.regionStr(),tile_xml.limitsStr(),tile_xml.visStr()); tiles.push_back(tile_vol); tile_number++; @@ -137,7 +137,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { tile_number=0; for(xml_coll_t k(x_det_layer,_U(slice)); k; ++k) { - DD4hep::XML::Component tile_xml = k; + dd4hep::xml::Component tile_xml = k; float tile_thickness = tile_xml.dz(); //Place the tile inside the layer diff --git a/examples/ClientTests/src/FCC_HcalBarrel_geo.cpp b/examples/ClientTests/src/FCC_HcalBarrel_geo.cpp index a3f44add1..d6daf4f4c 100644 --- a/examples/ClientTests/src/FCC_HcalBarrel_geo.cpp +++ b/examples/ClientTests/src/FCC_HcalBarrel_geo.cpp @@ -11,13 +11,13 @@ #include <vector> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { //XML detector object: DDCore/XML/XMLDetector.h xml_dim_t x_det = e; - //Create the DetElement for DD4hep + //Create the DetElement for dd4hep DetElement d_det(x_det.nameStr(),x_det.id()); //XML dimension object: DDCore/XML/XMLDimension.h @@ -28,18 +28,18 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { PlacedVolume pv; //Set envelope volume attributes - calo_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + calo_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); #if 0 //Declare this sensitive detector as a calorimeter Tube tub(inner_r,outer_r,x_det_dim.z()/2.0,0.0,2*M_PI); - //Volume tub_vol(x_det.nameStr()+"_tube",tub,lcdd.material("PyrexGlass")); - Volume tub_vol(x_det.nameStr()+"_tube",tub,lcdd.material("Iron")); + //Volume tub_vol(x_det.nameStr()+"_tube",tub,description.material("PyrexGlass")); + Volume tub_vol(x_det.nameStr()+"_tube",tub,description.material("Iron")); calo_vol.placeVolume(tub_vol); sens.setType("calorimeter"); tub_vol.setSensitiveDetector(sens); - d_det.setAttributes(lcdd,tub_vol,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + d_det.setAttributes(description,tub_vol,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); #endif #if 1 @@ -58,7 +58,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { while(r<x_det_dim.rmax()){ //Loop over layers of type: XML Collection_t object: DDCore/XML/XMLElements.h - for(DD4hep::XML::Collection_t layerIt(x_det,_U(layer));layerIt; ++layerIt, ++layer_num) { + for(dd4hep::xml::Collection_t layerIt(x_det,_U(layer));layerIt; ++layerIt, ++layer_num) { //Build a layer volume xml_comp_t x_det_layer = layerIt; @@ -88,8 +88,8 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { Trapezoid layer_shape(x1,x2,y1,y2,z); //Create a volume with trapezoid shape - Volume layer_vol(layer_name, layer_shape, lcdd.air()); - layer_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det_layer.visStr()); + Volume layer_vol(layer_name, layer_shape, description.air()); + layer_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det_layer.visStr()); //DetElement layer(layer_name,_toString(layer_num,"layer%d"),x_det.id()); @@ -98,16 +98,16 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //Assembly tile_seq(layer_name+"_seq"); Trapezoid tile_seq_shape(x1,x2,x_det_layer.dz(),x_det_layer.dz(),x_det_layer.dr()); - Volume tile_seq(layer_name + "_seq",tile_seq_shape,lcdd.air()); + Volume tile_seq(layer_name + "_seq",tile_seq_shape,description.air()); double total_thickness = 0; //Repeat slices until we reach the end of the calorimeter int slice_num = 0, tile_number = 0; - tile_seq.setVisAttributes(lcdd.visAttributes("VisibleGreen")); + tile_seq.setVisAttributes(description.visAttributes("VisibleGreen")); for(xml_coll_t k(x_det_layer,_U(slice)); k; ++k, ++slice_num) { xml_comp_t tile_xml = k; string tile_name = layer_name + _toString(tile_number,"_slice%d"); - Material tile_material = lcdd.material(tile_xml.materialStr()); + Material tile_material = description.material(tile_xml.materialStr()); float tile_thickness = tile_xml.dz(); float tile_y1 = tile_thickness; float tile_y2 = tile_thickness; @@ -124,7 +124,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } // Set region, limitset, and visibility settings - tile_vol.setAttributes(lcdd,tile_xml.regionStr(),tile_xml.limitsStr(),tile_xml.visStr()); + tile_vol.setAttributes(description,tile_xml.regionStr(),tile_xml.limitsStr(),tile_xml.visStr()); tiles.push_back(tile_vol); tile_number++; } @@ -163,7 +163,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { cout << "Number of layers: " << layer_num << endl; #endif //Place the calo inside the world - PlacedVolume calo_plv = lcdd.pickMotherVolume(d_det).placeVolume(calo_vol); + PlacedVolume calo_plv = description.pickMotherVolume(d_det).placeVolume(calo_vol); calo_plv.addPhysVolID("system",x_det.id()); calo_plv.addPhysVolID("barrel",0); d_det.setPlacement(calo_plv); diff --git a/examples/ClientTests/src/IronCylinder_geo.cpp b/examples/ClientTests/src/IronCylinder_geo.cpp index 70aa27a84..9f73e53df 100644 --- a/examples/ClientTests/src/IronCylinder_geo.cpp +++ b/examples/ClientTests/src/IronCylinder_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,13 +14,13 @@ // Framework includes #include "DD4hep/DetFactoryHelper.h" -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { // XML detector object: DDCore/XML/XMLDetector.h xml_dim_t x_det = e; - //Create the DetElement for DD4hep + //Create the DetElement for dd4hep DetElement d_det(x_det.nameStr(),x_det.id()); // XML dimension object: DDCore/XML/XMLDimension.h @@ -31,18 +31,18 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { PlacedVolume pv; // Set envelope volume attributes - calo_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + calo_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); // Declare this sensitive detector as a calorimeter Tube tub(inner_r,outer_r,x_det_dim.z()/2.0,0.0,2*M_PI); - Volume tub_vol(x_det.nameStr()+"_tube",tub,lcdd.material("Iron")); + Volume tub_vol(x_det.nameStr()+"_tube",tub,description.material("Iron")); calo_vol.placeVolume(tub_vol).addPhysVolID("module",1); sens.setType("calorimeter"); tub_vol.setSensitiveDetector(sens); - d_det.setAttributes(lcdd,tub_vol,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + d_det.setAttributes(description,tub_vol,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); // Place the calo inside the world - PlacedVolume calo_plv = lcdd.pickMotherVolume(d_det).placeVolume(calo_vol); + PlacedVolume calo_plv = description.pickMotherVolume(d_det).placeVolume(calo_vol); calo_plv.addPhysVolID("system",x_det.id()); calo_plv.addPhysVolID("barrel",0); d_det.setPlacement(calo_plv); diff --git a/examples/ClientTests/src/LheD_tracker_BeamPipe_geo.cpp b/examples/ClientTests/src/LheD_tracker_BeamPipe_geo.cpp index 5742a996f..88d9f6f23 100644 --- a/examples/ClientTests/src/LheD_tracker_BeamPipe_geo.cpp +++ b/examples/ClientTests/src/LheD_tracker_BeamPipe_geo.cpp @@ -1,6 +1,6 @@ // $Id: LhePolyconeSupport_geo.cpp 513 2013-04-05 14:31:53Z gaede $ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : M.Frank @@ -11,14 +11,14 @@ #include "XML/Layering.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, Ref_t) { +static Ref_t create_detector(Detector& description, xml_h e, Ref_t) { xml_det_t x_det = e; string name = x_det.nameStr(); DetElement sdet (name,x_det.id()); - Material mat (lcdd.material(x_det.materialStr())); + Material mat (description.material(x_det.materialStr())); // multiplication factor for ellipse major radius double c0 = 3.5; @@ -49,8 +49,8 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, Ref_t) { double z_offset = x_det.hasAttr(_U(z_offset)) ? x_det.z_offset() : 0.0; - volume.setVisAttributes(lcdd, x_det.visStr()); - PlacedVolume pv = lcdd.pickMotherVolume(sdet).placeVolume(volume,Position(0,0,z_offset)); + volume.setVisAttributes(description, x_det.visStr()); + PlacedVolume pv = description.pickMotherVolume(sdet).placeVolume(volume,Position(0,0,z_offset)); sdet.setPlacement(pv); if ( x_det.hasAttr(_U(id)) ) { diff --git a/examples/ClientTests/src/LheD_tracker_SiVertexBarrel_geo.cpp b/examples/ClientTests/src/LheD_tracker_SiVertexBarrel_geo.cpp index 49dd3747a..6acf7fe60 100644 --- a/examples/ClientTests/src/LheD_tracker_SiVertexBarrel_geo.cpp +++ b/examples/ClientTests/src/LheD_tracker_SiVertexBarrel_geo.cpp @@ -1,6 +1,6 @@ // $Id: LheSiTrackerBarrel_geo.cpp 513 2013-04-05 14:31:53Z gaede $ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : M.Frank @@ -11,8 +11,8 @@ #include "DD4hep/Printout.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; /************************************************************* function to calculate path in a given theta @@ -24,9 +24,9 @@ static double computeDpt( double ra, double rb, double theta ) { return dp; } -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; - Material air = lcdd.air(); + Material air = description.air(); int det_id = x_det.id(); string det_name = x_det.nameStr(); DetElement sdet (det_name,det_id); @@ -59,7 +59,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_comp_t x_rot = x_comp.rotation(false); string c_nam = det_name+"_"+m_nam+_toString(ncomponents,"_component%d"); Box c_box(x_comp.width()/2,x_comp.length()/2,x_comp.thickness()/2); - Volume c_vol(c_nam,c_box,lcdd.material(x_comp.materialStr())); + Volume c_vol(c_nam,c_box,description.material(x_comp.materialStr())); if ( x_pos && x_rot ) { Position c_pos(x_pos.x(0),x_pos.y(0),x_pos.z(0)); RotationZYX c_rot(x_rot.z(0),x_rot.y(0),x_rot.x(0)); @@ -74,15 +74,15 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { else { pv = m_vol.placeVolume(c_vol); } - c_vol.setRegion(lcdd, x_comp.regionStr()); - c_vol.setLimitSet(lcdd, x_comp.limitsStr()); - c_vol.setVisAttributes(lcdd, x_comp.visStr()); + c_vol.setRegion(description, x_comp.regionStr()); + c_vol.setLimitSet(description, x_comp.limitsStr()); + c_vol.setVisAttributes(description, x_comp.visStr()); if ( x_comp.isSensitive() ) { pv.addPhysVolID(_U(sensor),sensor_number++); c_vol.setSensitiveDetector(sens); } } - m_vol.setVisAttributes(lcdd.visAttributes(x_mod.visStr())); + m_vol.setVisAttributes(description.visAttributes(x_mod.visStr())); } for(xml_coll_t li(x_det,_U(layer)); li; ++li) { @@ -230,15 +230,15 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } // Create the PhysicalVolume for the layer. - assembly.setVisAttributes(lcdd.invisible()); + assembly.setVisAttributes(description.invisible()); pv = assembly.placeVolume(lay_vol); // Place layer in mother pv.addPhysVolID("layer", lay_id); // Set the layer ID. DetElement m_elt(sdet,lay_nam,lay_id); - m_elt.setAttributes(lcdd,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); + m_elt.setAttributes(description,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); m_elt.setPlacement(pv); } - pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); + pv = description.pickMotherVolume(sdet).placeVolume(assembly); pv.addPhysVolID("system", det_id); // Set the subdetector system ID. pv.addPhysVolID("barrel", 0); // Flag this as a barrel subdetector. sdet.setPlacement(pv); diff --git a/examples/ClientTests/src/MaterialTester_geo.cpp b/examples/ClientTests/src/MaterialTester_geo.cpp index d8d7c428d..cbf413553 100644 --- a/examples/ClientTests/src/MaterialTester_geo.cpp +++ b/examples/ClientTests/src/MaterialTester_geo.cpp @@ -1,6 +1,6 @@ // $Id: ILDExVXD_geo.cpp 673 2013-08-05 10:01:33Z gaede $ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : M.Frank @@ -14,10 +14,10 @@ #include "TGeoElement.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_element(LCDD& lcdd, xml_h xml_det, SensitiveDetector /* sens */) { +static Ref_t create_element(Detector& description, xml_h xml_det, SensitiveDetector /* sens */) { xml_det_t x_det = xml_det; string det_name = x_det.nameStr(); Assembly assembly(det_name+"_assembly"); @@ -25,7 +25,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h xml_det, SensitiveDetector /* sens for(xml_coll_t k(x_det,_Unicode(test)); k; ++k) { xml_comp_t c = k; - Material mat = lcdd.material(c.nameStr()); + Material mat = description.material(c.nameStr()); TGeoMaterial* m = mat->GetMaterial(); printout(INFO,det_name,"+++ Material:%s [%p, %p] Z=%6.2f A=%6.2f D=%9.4f [g/cm3]", m->GetName(), mat.ptr(), m, m->GetZ(), m->GetA(), m->GetDensity()); @@ -51,7 +51,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h xml_det, SensitiveDetector /* sens } - PlacedVolume pv = lcdd.pickMotherVolume(det).placeVolume(assembly); + PlacedVolume pv = description.pickMotherVolume(det).placeVolume(assembly); pv.addPhysVolID("system",x_det.id()); det.setPlacement(pv); return det; diff --git a/examples/ClientTests/src/MiniTel.cpp b/examples/ClientTests/src/MiniTel.cpp index b9240a4d9..ccdabbd84 100644 --- a/examples/ClientTests/src/MiniTel.cpp +++ b/examples/ClientTests/src/MiniTel.cpp @@ -1,15 +1,14 @@ // Include files #include "DD4hep/DetFactoryHelper.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" -//#include "DetDesc/MyDetExtension.h" +#include "DD4hep/Detector.h" #include <iostream> #include <map> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; namespace { struct MyDetExtension { @@ -35,7 +34,7 @@ namespace { } typedef MyDetExtension DetectorExtension; -static Ref_t create_detector(LCDD &lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector &description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; //xml-detelemnt of the detector taken as an argument string det_name = x_det.nameStr(); //det_name is the name of the xml-detelement Assembly assembly (det_name); @@ -63,9 +62,9 @@ static Ref_t create_detector(LCDD &lcdd, xml_h e, SensitiveDetector sens) { double dim_y = det_dim.y(); // det_y is the y dimension of the xml-detelement double dim_z = det_dim.z(); // det_z is the z dimension of the xml-detelement - Material mat = lcdd.material("Silicon"); + Material mat = description.material("Silicon"); - Volume motherVol = lcdd.pickMotherVolume(sdet); //the mothers volume of our detector + Volume motherVol = description.pickMotherVolume(sdet); //the mothers volume of our detector PlacedVolume pv; //struct of Handle giving the volume id(ayto pou 8a kanw volume kai 8a to steilw me setplacement),dld o detector mou @@ -96,7 +95,7 @@ static Ref_t create_detector(LCDD &lcdd, xml_h e, SensitiveDetector sens) { } } Volume m_volume(det_name, Box(dim_x, dim_y, dim_z), mat); //as parameters it needs name,solid,material - m_volume.setVisAttributes(lcdd.visAttributes(x_det.visStr())); //I DONT MIND ABOUT THIS! + m_volume.setVisAttributes(description.visAttributes(x_det.visStr())); //I DONT MIND ABOUT THIS! pv = motherVol.placeVolume(m_volume,Transform3D(Position(det_x,det_y,det_z))); //det_x,det_y,det_z are the dimensions of the detector in space xml_comp_t dtctr = x_det; @@ -106,8 +105,8 @@ static Ref_t create_detector(LCDD &lcdd, xml_h e, SensitiveDetector sens) { m_volume.setSensitiveDetector(sens); } sdet.setPlacement(pv); - // Support additional test if LCDD_InhibitConstants is set to TRUE - lcdd.constant<double>("world_side"); + // Support additional test if Detector_InhibitConstants is set to TRUE + description.constant<double>("world_side"); return sdet; } DECLARE_DETELEMENT(MiniTelPixel,create_detector) diff --git a/examples/ClientTests/src/ORG_HcalBarrel_geo.cpp b/examples/ClientTests/src/ORG_HcalBarrel_geo.cpp index 89f541644..443a20d64 100644 --- a/examples/ClientTests/src/ORG_HcalBarrel_geo.cpp +++ b/examples/ClientTests/src/ORG_HcalBarrel_geo.cpp @@ -11,31 +11,31 @@ #include <vector> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { //XML detector object: DDCore/XML/XMLDetector.h - DD4hep::XML::DetElement x_det = e; + dd4hep::xml::DetElement x_det = e; - //Create the DetElement for DD4hep + //Create the DetElement for dd4hep DetElement d_det(x_det.nameStr(),x_det.id()); //Pick the mothervolume - Volume det_vol = lcdd.pickMotherVolume(d_det); + Volume det_vol = description.pickMotherVolume(d_det); //XML dimension object: DDCore/XML/XMLDimension.h - DD4hep::XML::Dimension x_det_dim(x_det.dimensions()); + dd4hep::xml::Dimension x_det_dim(x_det.dimensions()); //Tube: DDCore/DD4hep/Shapes.h Tube calo_shape(x_det_dim.rmin(),x_det_dim.rmax(),x_det_dim.z(),2*M_PI/x_det_dim.phiBins()); //Create the detector mother volume - Volume calo_vol(x_det.nameStr()+"_envelope",calo_shape,lcdd.air()); + Volume calo_vol(x_det.nameStr()+"_envelope",calo_shape,description.air()); //Set envelope volume attributes - calo_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + calo_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); //Place inside the mother volume PlacedVolume calo_plv = det_vol.placeVolume(calo_vol); @@ -59,10 +59,10 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { while(r<x_det_dim.rmax()){ //Loop over layers of type: XML Collection_t object: DDCore/XML/XMLElements.h - for(DD4hep::XML::Collection_t layerIt(x_det,_U(layer));layerIt; ++layerIt){ + for(dd4hep::xml::Collection_t layerIt(x_det,_U(layer));layerIt; ++layerIt){ //Build a layer volume - DD4hep::XML::Component x_det_layer = layerIt; + dd4hep::xml::Component x_det_layer = layerIt; float dr = x_det_layer.dr(); @@ -89,8 +89,8 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { Trapezoid layer_shape(x1,x2,y1,y2,z); //Create a volume with trapezoid shape - Volume layer_vol(layer_name, layer_shape, lcdd.air()); - layer_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det_layer.visStr()); + Volume layer_vol(layer_name, layer_shape, description.air()); + layer_vol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det_layer.visStr()); //DetElement layer(layer_name,_toString(layer_num,"layer%d"),x_det.id()); @@ -103,9 +103,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //Repeat slices until we reach the end of the calorimeter for(xml_coll_t k(x_det_layer,_U(slice)); k; ++k) { - DD4hep::XML::Component tile_xml = k; + dd4hep::xml::Component tile_xml = k; string tile_name = layer_name + _toString(tile_number,"_slice%d"); - Material tile_material = lcdd.material(tile_xml.materialStr()); + Material tile_material = description.material(tile_xml.materialStr()); float tile_thickness = tile_xml.dz(); float tile_y1 = tile_thickness; float tile_y2 = tile_thickness; @@ -122,7 +122,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } //Set region, limitset, and visibility settings - tile_vol.setAttributes(lcdd,tile_xml.regionStr(),tile_xml.limitsStr(),tile_xml.visStr()); + tile_vol.setAttributes(description,tile_xml.regionStr(),tile_xml.limitsStr(),tile_xml.visStr()); tiles.push_back(tile_vol); tile_number++; @@ -134,7 +134,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { tile_number=0; for(xml_coll_t k(x_det_layer,_U(slice)); k; ++k) { - DD4hep::XML::Component tile_xml = k; + dd4hep::xml::Component tile_xml = k; float tile_thickness = tile_xml.dz(); //Place the tile inside the layer diff --git a/examples/ClientTests/src/SectorBarrelCalorimeter.h b/examples/ClientTests/src/SectorBarrelCalorimeter.h index 02a442a17..f1c537ad5 100644 --- a/examples/ClientTests/src/SectorBarrelCalorimeter.h +++ b/examples/ClientTests/src/SectorBarrelCalorimeter.h @@ -11,8 +11,8 @@ #include "BarrelDetector.h" #include "PolyhedralCalorimeter.h" -namespace DD4hep { -namespace Geometry { +namespace dd4hep { +namespace detail { class SectorBarrelCalorimeter: public BarrelDetector, public PolyhedralCalorimeter { public: @@ -20,6 +20,6 @@ public: virtual ~SectorBarrelCalorimeter() {} }; -} /* namespace Geometry */ -} /* namespace DD4hep */ +} /* namespace detail */ +} /* namespace dd4hep */ #endif /* SECTORBARRELCALORIMETER_H_ */ diff --git a/examples/ClientTests/src/SectorBarrelCalorimeter_geo.cpp b/examples/ClientTests/src/SectorBarrelCalorimeter_geo.cpp index 7a19c864a..5af5d2443 100644 --- a/examples/ClientTests/src/SectorBarrelCalorimeter_geo.cpp +++ b/examples/ClientTests/src/SectorBarrelCalorimeter_geo.cpp @@ -1,6 +1,6 @@ // $Id: PolyhedraBarrelCalorimeter2_geo.cpp 784 2013-09-19 20:05:24Z markus.frank@cern.ch $ //==================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------- // // Author : M.Frank @@ -11,8 +11,8 @@ #include <limits> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; static void placeStaves(DetElement& parent, DetElement& stave, @@ -45,13 +45,13 @@ static void placeStaves(DetElement& parent, } } -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; Layering layering(x_det); //xml_comp_t staves = x_det.staves(); xml_dim_t dim = x_det.dimensions(); string det_name = x_det.nameStr(); - Material air = lcdd.air(); + Material air = description.air(); double totalThickness = layering.totalThickness(); int numSides = dim.numsides(); double detZ = dim.z(); @@ -59,7 +59,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double rmax = dim.rmax(); DetElement sdet(det_name,x_det.id()); DetElement stave("stave1",x_det.id()); - Volume motherVol = lcdd.pickMotherVolume(sdet); + Volume motherVol = description.pickMotherVolume(sdet); PolyhedraRegular polyhedron(numSides,0.,rmin,detZ+10); Tube tube(0.,rmin+totalThickness,detZ/2,0,2*M_PI); SubtractionSolid sub(tube,polyhedron); @@ -95,7 +95,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double layerR = rmin; // Set envelope volume attributes. - envelopeVol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + envelopeVol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); for(xml_coll_t c(x_det,_U(layer)); c; ++c) { xml_comp_t x_layer = c; @@ -119,7 +119,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_comp_t x_slice = k; string slice_name = layer_name + _toString(slice_number,"_slice%d"); double slice_thickness = x_slice.thickness(); - Material slice_material = lcdd.material(x_slice.materialStr()); + Material slice_material = description.material(x_slice.materialStr()); DetElement slice(layer,_toString(slice_number,"slice%d"),x_det.id()); slice_pos_z += slice_thickness / 2; @@ -131,7 +131,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { slice_vol.setSensitiveDetector(sens); } // Set region, limitset, and vis. - slice_vol.setAttributes(lcdd,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + slice_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // slice PlacedVolume PlacedVolume slice_phv = layer_vol.placeVolume(slice_vol,Position(0,0,slice_pos_z)); slice_phv.addPhysVolID("slice",slice_number); @@ -143,7 +143,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { ++slice_number; } // Set region, limitset, and vis. - layer_vol.setAttributes(lcdd,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); + layer_vol.setAttributes(description,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); // Layer physical volume. PlacedVolume layer_phv = staveOuterVol.placeVolume(layer_vol,Position((layer_dim_x+layer_pos_x-half_polyFace),0,layer_pos_z)); @@ -165,7 +165,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // Add stave inner physical volume to outer stave volume. // staveOuterVol.placeVolume(staveInnerVol); //not needed // Set the vis attributes of the outer stave section. -// stave.setVisAttributes(lcdd,staves.visStr(),staveOuterVol); //not applicable for Assembly +// stave.setVisAttributes(description,staves.visStr(),staveOuterVol); //not applicable for Assembly // Place the staves. placeStaves(sdet,stave,rmin,numSides,totalThickness,envelopeVol,externalAngle,staveOuterVol); @@ -176,7 +176,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { env_phv.addPhysVolID("barrel", 0); sdet.setPlacement(env_phv); - //sdet.addExtension<LayerStack>(new Geometry::PolyhedralCalorimeterLayerStack(sdet)); + //sdet.addExtension<LayerStack>(new PolyhedralCalorimeterLayerStack(sdet)); return sdet; } diff --git a/examples/ClientTests/src/SiBarrelMultiSensitiveDetector_geo.cpp b/examples/ClientTests/src/SiBarrelMultiSensitiveDetector_geo.cpp index 916e179b8..45d31d37d 100644 --- a/examples/ClientTests/src/SiBarrelMultiSensitiveDetector_geo.cpp +++ b/examples/ClientTests/src/SiBarrelMultiSensitiveDetector_geo.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -19,13 +19,13 @@ #include "DD4hep/Printout.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { typedef vector<PlacedVolume> Placements; xml_det_t x_det = e; - Material air = lcdd.air(); + Material air = description.air(); int det_id = x_det.id(); string det_name = x_det.nameStr(); DetElement sdet (det_name,det_id); @@ -47,7 +47,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { throw runtime_error("Logics error in building modules."); } volumes[m_nam] = m_vol; - m_vol.setVisAttributes(lcdd.visAttributes(x_mod.visStr())); + m_vol.setVisAttributes(description.visAttributes(x_mod.visStr())); printout(INFO,"Detector","++ Building module: %s",m_nam.c_str()); for(xml_coll_t ci(x_mod,_U(module_component)); ci; ++ci, ++ncomponents) { xml_comp_t x_comp = ci; @@ -55,7 +55,7 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { xml_comp_t x_rot = x_comp.rotation(false); string c_nam = _toString(ncomponents,"component%d"); Box c_box(x_comp.width()/2,x_comp.length()/2,x_comp.thickness()/2); - Volume c_vol(c_nam,c_box,lcdd.material(x_comp.materialStr())); + Volume c_vol(c_nam,c_box,description.material(x_comp.materialStr())); if ( x_pos && x_rot ) { Position c_pos(x_pos.x(0),x_pos.y(0),x_pos.z(0)); @@ -71,9 +71,9 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { else { pv = m_vol.placeVolume(c_vol); } - c_vol.setRegion(lcdd, x_comp.regionStr()); - c_vol.setLimitSet(lcdd, x_comp.limitsStr()); - c_vol.setVisAttributes(lcdd, x_comp.visStr()); + c_vol.setRegion(description, x_comp.regionStr()); + c_vol.setLimitSet(description, x_comp.limitsStr()); + c_vol.setVisAttributes(description, x_comp.visStr()); if ( x_comp.isSensitive() ) { pv.addPhysVolID(_U(sensor),sensor_number++); c_vol.setSensitiveDetector(sens); @@ -167,16 +167,16 @@ static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector sens) { // Create the PhysicalVolume for the layer. pv = assembly.placeVolume(lay_vol); // Place layer in mother pv.addPhysVolID("layer", lay_id); // Set the layer ID. - lay_elt.setAttributes(lcdd,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); + lay_elt.setAttributes(description,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); lay_elt.setPlacement(pv); } - sdet.setAttributes(lcdd,assembly,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); - assembly.setVisAttributes(lcdd.invisible()); - pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly); + sdet.setAttributes(description,assembly,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + assembly.setVisAttributes(description.invisible()); + pv = description.pickMotherVolume(sdet).placeVolume(assembly); pv.addPhysVolID("system", det_id); // Set the subdetector system ID. pv.addPhysVolID("barrel", 0); // Flag this as a barrel subdetector. sdet.setPlacement(pv); return sdet; } -DECLARE_DETELEMENT(DD4hep_SiBarrelMultiSensitiveDetector,create_detector) +DECLARE_DETELEMENT(dd4hep_SiBarrelMultiSensitiveDetector,create_detector) diff --git a/examples/ClientTests/src_boost/JsonDumper.cpp b/examples/ClientTests/src_boost/JsonDumper.cpp index 471672bd3..81bddcbcf 100644 --- a/examples/ClientTests/src_boost/JsonDumper.cpp +++ b/examples/ClientTests/src_boost/JsonDumper.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -18,19 +18,19 @@ #include "DD4hep/Printout.h" #include "DD4hep/Factories.h" -using namespace DD4hep; +using namespace dd4hep; -static long json_dump(Geometry::LCDD& /* lcdd */, int argc, char** argv) { +static long json_dump(Detector& /* description */, int argc, char** argv) { if ( argc < 1 ) { - ::printf("DD4hep_JsonDumper <file> \n"); + ::printf("dd4hep_JsonDumper <file> \n"); exit(EINVAL); } std::string fname = argv[0]; - JSON::DocumentHolder doc(JSON::DocumentHandler().load(fname)); + json::DocumentHolder doc(json::DocumentHandler().load(fname)); dumpTree(doc.root()); printout(INFO,"JsonDumper","+++ Successfully dumped json input: %s.",fname.c_str()); return 1; } -DECLARE_APPLY(DD4hep_JsonDumper,json_dump) +DECLARE_APPLY(dd4hep_JsonDumper,json_dump) #endif diff --git a/examples/ClientTests/src_boost/MiniTel_json.cpp b/examples/ClientTests/src_boost/MiniTel_json.cpp index 77f0116f3..1bd754b6c 100644 --- a/examples/ClientTests/src_boost/MiniTel_json.cpp +++ b/examples/ClientTests/src_boost/MiniTel_json.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,14 +14,14 @@ // Include files #include "JSON/Helper.h" #include "DD4hep/Printout.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include <iostream> #include <map> using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; +using namespace dd4hep::detail; namespace { @@ -48,7 +48,7 @@ namespace { } typedef MyDetExtension DetectorExtension; -static Ref_t create_detector(LCDD &lcdd, json_h e, SensitiveDetector sens) { +static Ref_t create_detector(Detector &description, json_h e, SensitiveDetector sens) { json_det_t x_det = e; //json-detelemnt of the detector taken as an argument string det_name = x_det.nameStr(); //det_name is the name of the json-detelement Assembly assembly (det_name); @@ -73,9 +73,9 @@ static Ref_t create_detector(LCDD &lcdd, json_h e, SensitiveDetector sens) { double dim_y = det_dim.y(); // det_y is the y dimension of the json-detelement double dim_z = det_dim.z(); // det_z is the z dimension of the json-detelement - Material mat = lcdd.material("Silicon"); + Material mat = description.material("Silicon"); - Volume motherVol = lcdd.pickMotherVolume(sdet); //the mothers volume of our detector + Volume motherVol = description.pickMotherVolume(sdet); //the mothers volume of our detector PlacedVolume pv; //struct of Handle giving the volume id(ayto pou 8a kanw volume kai 8a to steilw me setplacement),dld o detector mou json_comp_t dtc_mod = x_det.child(_U(module)); // considering the module-pixel of the detector @@ -97,7 +97,7 @@ static Ref_t create_detector(LCDD &lcdd, json_h e, SensitiveDetector sens) { Volume m_volume(det_name, Box(dim_x, dim_y, dim_z), mat); //as parameters it needs name,solid,material - m_volume.setVisAttributes(lcdd.visAttributes(x_det.visStr())); //I DONT MIND ABOUT THIS! + m_volume.setVisAttributes(description.visAttributes(x_det.visStr())); //I DONT MIND ABOUT THIS! pv = motherVol.placeVolume(m_volume,Transform3D(Position(det_x,det_y,det_z))); //det_x,det_y,det_z are the dimensions of the detector in space json_comp_t dtctr = x_det; @@ -107,8 +107,8 @@ static Ref_t create_detector(LCDD &lcdd, json_h e, SensitiveDetector sens) { m_volume.setSensitiveDetector(sens); } sdet.setPlacement(pv); - // Support additional test if LCDD_InhibitConstants is set to TRUE - lcdd.constant<double>("world_side"); + // Support additional test if Detector_InhibitConstants is set to TRUE + description.constant<double>("world_side"); return sdet; } diff --git a/examples/Conditions/CMakeLists.txt b/examples/Conditions/CMakeLists.txt index 768101e14..8e07b9e02 100644 --- a/examples/Conditions/CMakeLists.txt +++ b/examples/Conditions/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -30,8 +30,8 @@ dd4hep_add_test_reg( Conditions_Telescope_cond_dump_by_pool COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -compact file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml - -plugin DD4hep_ConditionsXMLRepositoryParser file:${DD4hep_DIR}/examples/Conditions/data/repository.xml - -plugin DD4hep_ConditionsDump + -plugin dd4hep_ConditionsXMLRepositoryParser file:${DD4hep_DIR}/examples/Conditions/data/repository.xml + -plugin dd4hep_ConditionsDump REGEX_PASS "Data\\(Translation-Rotation-Pivot\\): \\[\\( 0 , 0 , 1 \\), \\{phi\\(Z angle\\): 3.14159 theta\\(Y angle\\): 0 psi\\(X angle\\): 0\\}, \\( 0 , 0 , 0 \\)\\]" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) @@ -41,8 +41,8 @@ dd4hep_add_test_reg( Conditions_Telescope_cond_dump_by_detelement COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -compact file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml - -plugin DD4hep_ConditionsXMLRepositoryParser file:${DD4hep_DIR}/examples/Conditions/data/repository.xml - -plugin DD4hep_DetElementConditionsDump + -plugin dd4hep_ConditionsXMLRepositoryParser file:${DD4hep_DIR}/examples/Conditions/data/repository.xml + -plugin dd4hep_DetElementConditionsDump REGEX_PASS "Path\\:/world/Telescope/module_9#alignment" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) diff --git a/examples/Conditions/data/manager.xml b/examples/Conditions/data/manager.xml index d0ec45f60..cb0be932c 100644 --- a/examples/Conditions/data/manager.xml +++ b/examples/Conditions/data/manager.xml @@ -4,10 +4,10 @@ <conditions> <manager> - <property name="PoolType" value="DD4hep_ConditionsLinearPool"/> + <property name="PoolType" value="dd4hep_ConditionsLinearPool"/> <property name="LoaderType" value="xml"/> - <property name="UserPoolType" value="DD4hep_ConditionsMapUserPool"/> - <property name="UpdatePoolType" value="DD4hep_ConditionsLinearUpdatePool"/> + <property name="UserPoolType" value="dd4hep_ConditionsMapUserPool"/> + <property name="UpdatePoolType" value="dd4hep_ConditionsLinearUpdatePool"/> </manager> <iov_type name="epoch" id="0"/> <iov_type name="run" id="1"/> diff --git a/examples/Conditions/src/ConditionExampleObjects.cpp b/examples/Conditions/src/ConditionExampleObjects.cpp index f210c4798..6216cf51d 100644 --- a/examples/Conditions/src/ConditionExampleObjects.cpp +++ b/examples/Conditions/src/ConditionExampleObjects.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -17,26 +17,25 @@ #include "DD4hep/ConditionsProcessor.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::ConditionExamples; -using Conditions::ConditionsSlice; -using Conditions::DependencyBuilder; -using Conditions::ConditionsLoadInfo; +using namespace dd4hep; +using namespace dd4hep::ConditionExamples; +using cond::DependencyBuilder; +using cond::ConditionsLoadInfo; /// Install the consitions and the alignment manager -ConditionsManager DD4hep::ConditionExamples::installManager(LCDD& lcdd) { +ConditionsManager dd4hep::ConditionExamples::installManager(Detector& description) { // Now we instantiate the conditions manager - lcdd.apply("DD4hep_ConditionsManagerInstaller",0,(char**)0); - ConditionsManager manager = ConditionsManager::from(lcdd); - manager["PoolType"] = "DD4hep_ConditionsLinearPool"; - manager["UserPoolType"] = "DD4hep_ConditionsMapUserPool"; - manager["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool"; + description.apply("dd4hep_ConditionsManagerInstaller",0,(char**)0); + ConditionsManager manager = ConditionsManager::from(description); + manager["PoolType"] = "dd4hep_ConditionsLinearPool"; + manager["UserPoolType"] = "dd4hep_ConditionsMapUserPool"; + manager["UpdatePoolType"] = "dd4hep_ConditionsLinearUpdatePool"; manager.initialize(); return manager; } /// Interface to client Callback in order to update the condition -Condition ConditionUpdate1::operator()(const ConditionKey& key, const Context& context) { +Condition ConditionUpdate1::operator()(const ConditionKey& key, const ConditionUpdateContext& context) { #ifdef DD4HEP_CONDITIONKEY_HAVE_NAME printout(printLevel,"ConditionUpdate1","++ Building dependent condition: %016llX [%s]",key.hash, key.name.c_str()); #else @@ -51,7 +50,7 @@ Condition ConditionUpdate1::operator()(const ConditionKey& key, const Context& c } /// Interface to client Callback in order to update the condition -Condition ConditionUpdate2::operator()(const ConditionKey& key, const Context& context) { +Condition ConditionUpdate2::operator()(const ConditionKey& key, const ConditionUpdateContext& context) { #ifdef DD4HEP_CONDITIONKEY_HAVE_NAME printout(printLevel,"ConditionUpdate2","++ Building dependent condition: %016llX [%s]",key.hash, key.name.c_str()); #else @@ -70,7 +69,7 @@ Condition ConditionUpdate2::operator()(const ConditionKey& key, const Context& c } /// Interface to client Callback in order to update the condition -Condition ConditionUpdate3::operator()(const ConditionKey& key, const Context& context) { +Condition ConditionUpdate3::operator()(const ConditionKey& key, const ConditionUpdateContext& context) { #ifdef DD4HEP_CONDITIONKEY_HAVE_NAME printout(printLevel,"ConditionUpdate3","++ Building dependent condition: %016llX [%s]",key.hash, key.name.c_str()); #else @@ -103,9 +102,9 @@ ConditionsDependencyCreator::ConditionsDependencyCreator(ConditionsContent& c, P /// Destructor ConditionsDependencyCreator::~ConditionsDependencyCreator() { - releasePtr(call1); - releasePtr(call2); - releasePtr(call3); + detail::releasePtr(call1); + detail::releasePtr(call2); + detail::releasePtr(call3); } /// Callback to process a single detector element diff --git a/examples/Conditions/src/ConditionExampleObjects.h b/examples/Conditions/src/ConditionExampleObjects.h index 0d83fa7cc..3ffc48f8b 100644 --- a/examples/Conditions/src/ConditionExampleObjects.h +++ b/examples/Conditions/src/ConditionExampleObjects.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DD4HEP_CONDITIONS_CONDITIONSEXAMPLEOBJECTS_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/Conditions.h" #include "DD4hep/ConditionsMap.h" @@ -27,27 +27,21 @@ #include "DDCond/ConditionsManager.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for conditions examples namespace ConditionExamples { - using Geometry::LCDD; - using Geometry::RotationZYX; - using Geometry::DetElement; - using Geometry::DetectorProcessor; - - using Conditions::UserPool; - using Conditions::Condition; - using Conditions::ConditionKey; - using Conditions::ConditionsMap; - using Conditions::ConditionsPool; - using Conditions::ConditionsSlice; - using Conditions::ConditionsContent; - using Conditions::ConditionsPrinter; - using Conditions::ConditionsManager; - using Conditions::ConditionUpdateCall; - + using cond::UserPool; + using cond::ConditionsPool; + using cond::ConditionsSlice; + using cond::ConditionsContent; + using cond::ConditionsPrinter; + using cond::ConditionsManager; + using cond::ConditionUpdateCall; + using cond::ConditionUpdateContext; + using cond::conditionsCollector; + /// Helper to reduce the number of lines of code /** * \author M.Frank @@ -81,7 +75,7 @@ namespace DD4hep { /// Default destructor virtual ~ConditionUpdate1() = default; /// Interface to client Callback in order to update the condition - virtual Condition operator()(const ConditionKey& key, const Context& context) final; + virtual Condition operator()(const ConditionKey& key, const ConditionUpdateContext& context) final; }; /// Specialized conditions update callback @@ -99,7 +93,7 @@ namespace DD4hep { /// Default destructor virtual ~ConditionUpdate2() = default; /// Interface to client Callback in order to update the condition - virtual Condition operator()(const ConditionKey& key, const Context& context) final; + virtual Condition operator()(const ConditionKey& key, const ConditionUpdateContext& context) final; }; /// Specialized conditions update callback @@ -117,7 +111,7 @@ namespace DD4hep { /// Default destructor virtual ~ConditionUpdate3() = default; /// Interface to client Callback in order to update the condition - virtual Condition operator()(const ConditionKey& key, const Context& context) final; + virtual Condition operator()(const ConditionKey& key, const ConditionUpdateContext& context) final; }; /// This is important, otherwise the register and forward calls won't find them! @@ -206,10 +200,10 @@ namespace DD4hep { }; /// Helper to run DetElement scans - typedef Geometry::DetectorScanner Scanner; + typedef DetectorScanner Scanner; /// Install the consitions and the conditions manager - ConditionsManager installManager(LCDD& lcdd); - } /* End namespace ConditionsExamples */ -} /* End namespace DD4hep */ + ConditionsManager installManager(Detector& description); + } /* End namespace condExamples */ +} /* End namespace dd4hep */ #endif /* DD4HEP_CONDITIONS_CONDITIONSEXAMPLEOBJECTS_H */ diff --git a/examples/Conditions/src/ConditionExample_MT.cpp b/examples/Conditions/src/ConditionExample_MT.cpp index 8b5bb5a48..1fc3e3fe8 100644 --- a/examples/Conditions/src/ConditionExample_MT.cpp +++ b/examples/Conditions/src/ConditionExample_MT.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -36,8 +36,8 @@ #include <unistd.h> using namespace std; -using namespace DD4hep; -using namespace DD4hep::ConditionExamples; +using namespace dd4hep; +using namespace dd4hep::ConditionExamples; namespace { mutex printout_lock; @@ -114,7 +114,7 @@ namespace { } int accessConditions(const IOV& iov) { TTimeStamp start; - int count = Scanner().scan(ConditionsDataAccess(iov,*slice),manager->lcdd().world()); + int count = Scanner().scan(ConditionsDataAccess(iov,*slice),manager->detectorDescription().world()); TTimeStamp stop; stats.access.Fill(stop.AsDouble()-start.AsDouble()); lock_guard<mutex> lock(stats.total_guard); @@ -170,7 +170,7 @@ namespace { * \version 1.0 * \date 01/12/2016 */ -static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { +static int condition_example (Detector& description, int argc, char** argv) { string input; int num_iov = 10, num_threads = 1, num_run = 30; bool arg_error = false; @@ -200,10 +200,10 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { } // First we load the geometry - lcdd.fromXML(input); + description.fromXML(input); /******************** Initialize the conditions manager *****************/ - ConditionsManager manager = installManager(lcdd); + ConditionsManager manager = installManager(description); const IOVType* iov_typ = manager.registerIOVType(0,"run").second; if ( 0 == iov_typ ) except("ConditionsPrepare","++ Unknown IOV type supplied."); @@ -211,8 +211,8 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { /******************** Now as usual: create the slice ********************/ shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Scanner(ConditionsKeys(*content,INFO),lcdd.world()); - Scanner(ConditionsDependencyCreator(*content,DEBUG),lcdd.world()); + Scanner(ConditionsKeys(*content,INFO),description.world()); + Scanner(ConditionsDependencyCreator(*content,DEBUG),description.world()); Statistics stats; EventQueue events; @@ -223,7 +223,7 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10)); ConditionsPool* pool = manager.registerIOV(*iov.iovType, iov.key()); // Create conditions with all deltas using a generic conditions creator - int count = Scanner().scan(ConditionsCreator(*slice, *pool, DEBUG),lcdd.world()); + int count = Scanner().scan(ConditionsCreator(*slice, *pool, DEBUG),description.world()); TTimeStamp stop; stats.create.Fill(stop.AsDouble()-start.AsDouble()); printout(INFO,"Example", "Setup %ld conditions for IOV:%s [%8.3f sec]", diff --git a/examples/Conditions/src/ConditionExample_populate.cpp b/examples/Conditions/src/ConditionExample_populate.cpp index fee2731c6..fa4fcf63c 100644 --- a/examples/Conditions/src/ConditionExample_populate.cpp +++ b/examples/Conditions/src/ConditionExample_populate.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,8 +28,8 @@ #include "DD4hep/Factories.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::ConditionExamples; +using namespace dd4hep; +using namespace dd4hep::ConditionExamples; /// Plugin function: Condition program example /** @@ -39,7 +39,7 @@ using namespace DD4hep::ConditionExamples; * \version 1.0 * \date 01/12/2016 */ -static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { +static int condition_example (Detector& description, int argc, char** argv) { string input; int num_iov = 10; @@ -64,10 +64,10 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { } // First we load the geometry - lcdd.fromXML(input); + description.fromXML(input); /******************** Initialize the conditions manager *****************/ - ConditionsManager manager = installManager(lcdd); + ConditionsManager manager = installManager(description); const IOVType* iov_typ = manager.registerIOVType(0,"run").second; if ( 0 == iov_typ ) except("ConditionsPrepare","++ Unknown IOV type supplied."); @@ -75,8 +75,8 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { /******************** Now as usual: create the slice ********************/ shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Scanner(ConditionsKeys(*content,INFO),lcdd.world()); - Scanner(ConditionsDependencyCreator(*content,DEBUG),lcdd.world()); + Scanner(ConditionsKeys(*content,INFO),description.world()); + Scanner(ConditionsDependencyCreator(*content,DEBUG),description.world()); /******************** Populate the conditions store *********************/ // Have 10 run-slices [11,20] .... [91,100] @@ -84,7 +84,7 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10)); ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key()); // Create conditions with all deltas. Use a generic creator - Scanner(ConditionsCreator(*slice, *iov_pool, INFO),lcdd.world(),0,true); + Scanner(ConditionsCreator(*slice, *iov_pool, INFO),description.world(),0,true); } // ++++++++++++++++++++++++ Now compute the conditions for each of these IOVs @@ -95,7 +95,7 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { ConditionsManager::Result r = manager.prepare(req_iov,*slice); total += r; if ( 0 == i ) { // First one we print... - Scanner(ConditionsPrinter(slice.get(),"Example"),lcdd.world()); + Scanner(ConditionsPrinter(slice.get(),"Example"),description.world()); } // Now compute the tranformation matrices printout(INFO,"Prepare","Total %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) of IOV %s", diff --git a/examples/Conditions/src/ConditionExample_stress.cpp b/examples/Conditions/src/ConditionExample_stress.cpp index 74a21efe5..c70242107 100644 --- a/examples/Conditions/src/ConditionExample_stress.cpp +++ b/examples/Conditions/src/ConditionExample_stress.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -31,8 +31,8 @@ #include "TRandom3.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::ConditionExamples; +using namespace dd4hep; +using namespace dd4hep::ConditionExamples; /// Plugin function: Condition program example /** @@ -42,7 +42,7 @@ using namespace DD4hep::ConditionExamples; * \version 1.0 * \date 01/12/2016 */ -static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { +static int condition_example (Detector& description, int argc, char** argv) { string input; int num_iov = 10, num_runs = 10; bool arg_error = false; @@ -69,10 +69,10 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { } // First we load the geometry - lcdd.fromXML(input); + description.fromXML(input); /******************** Initialize the conditions manager *****************/ - ConditionsManager manager = installManager(lcdd); + ConditionsManager manager = installManager(description); const IOVType* iov_typ = manager.registerIOVType(0,"run").second; if ( 0 == iov_typ ) { except("ConditionsPrepare","++ Unknown IOV type supplied."); @@ -81,8 +81,8 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { /******************** Now as usual: create the slice ********************/ shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Scanner(ConditionsKeys(*content,INFO),lcdd.world()); - Scanner(ConditionsDependencyCreator(*content,DEBUG),lcdd.world()); + Scanner(ConditionsKeys(*content,INFO),description.world()); + Scanner(ConditionsDependencyCreator(*content,DEBUG),description.world()); TStatistic cr_stat("Creation"), acc_stat("Access"); /******************** Populate the conditions store *********************/ @@ -93,7 +93,7 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10)); ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key()); // Create conditions with all deltas. Use a generic creator - int count = Scanner().scan(ConditionsCreator(*slice, *iov_pool, DEBUG), lcdd.world()); + int count = Scanner().scan(ConditionsCreator(*slice, *iov_pool, DEBUG), description.world()); TTimeStamp stop; cr_stat.Fill(stop.AsDouble()-start.AsDouble()); printout(INFO,"Example", "Setup %ld conditions for IOV:%s [%8.3f sec]", diff --git a/examples/Conditions/src/ConditionExample_stress2.cpp b/examples/Conditions/src/ConditionExample_stress2.cpp index 2b79dcb48..b9f07658a 100644 --- a/examples/Conditions/src/ConditionExample_stress2.cpp +++ b/examples/Conditions/src/ConditionExample_stress2.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -30,8 +30,8 @@ #include "TTimeStamp.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::ConditionExamples; +using namespace dd4hep; +using namespace dd4hep::ConditionExamples; /// Plugin function: Condition program example /** @@ -41,7 +41,7 @@ using namespace DD4hep::ConditionExamples; * \version 1.0 * \date 01/12/2016 */ -static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { +static int condition_example (Detector& description, int argc, char** argv) { string input; int num_iov = 10; bool arg_error = false; @@ -65,10 +65,10 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { } // First we load the geometry - lcdd.fromXML(input); + description.fromXML(input); /******************** Initialize the conditions manager *****************/ - ConditionsManager manager = installManager(lcdd); + ConditionsManager manager = installManager(description); const IOVType* iov_typ = manager.registerIOVType(0,"run").second; if ( 0 == iov_typ ) except("ConditionsPrepare","++ Unknown IOV type supplied."); @@ -76,8 +76,8 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { /******************** Now as usual: create the slice ********************/ shared_ptr<ConditionsContent> content(new ConditionsContent()); shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content)); - Scanner(ConditionsKeys(*content,INFO),lcdd.world()); - Scanner(ConditionsDependencyCreator(*content,DEBUG),lcdd.world()); + Scanner(ConditionsKeys(*content,INFO),description.world()); + Scanner(ConditionsDependencyCreator(*content,DEBUG),description.world()); size_t total_created = 0; ConditionsManager::Result total; @@ -89,7 +89,7 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) { IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10)); ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key()); // Create conditions with all deltas. Use a generic creator - int count = Scanner().scan(ConditionsCreator(*slice, *iov_pool, DEBUG),lcdd.world()); + int count = Scanner().scan(ConditionsCreator(*slice, *iov_pool, DEBUG),description.world()); TTimeStamp stop; total_created += count; cr_stat.Fill(stop.AsDouble()-start.AsDouble()); diff --git a/examples/Conditions/src/ConditionsExample.cpp b/examples/Conditions/src/ConditionsExample.cpp index 85f4c2a63..987e8d08b 100644 --- a/examples/Conditions/src/ConditionsExample.cpp +++ b/examples/Conditions/src/ConditionsExample.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -15,11 +15,8 @@ #include "ConditionsTest.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Conditions; -using Geometry::LCDD; -using Geometry::Position; -using Geometry::DetElement; +using namespace dd4hep; +using namespace dd4hep::cond; namespace { @@ -102,17 +99,17 @@ namespace { } } - int example1(LCDD& lcdd, int, char** ) { + int example1(Detector& description, int, char** ) { printout(INFO,"Example1","+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); printout(INFO,"Example1","+++ Executing Conditions example No. 1: Test conditions access. "); printout(INFO,"Example1","+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - Test::TestEnv env(lcdd, "TPC"); + Test::TestEnv env(description, "TPC"); env.add_xml_data_source("/examples/Conditions/xml/TPC.xml","1396887257,1396887257#epoch"); env.add_xml_data_source("/examples/Conditions/xml/TPC_run_563543.xml","563543#run"); env.add_xml_data_source("/examples/Conditions/xml/TPC_run_234567.xml","234567#run"); print_tpc_discrete_conditions(env); - lcdd.apply("DD4hep_ConditionsDump",0,0); + description.apply("dd4hep_ConditionsDump",0,0); print_tpc_range_conditions(env,234567,563543); // Should fail ! print_tpc_range_conditions(env,123456,563543); // Should fail ! @@ -123,11 +120,11 @@ namespace { return 1; } - int example2(LCDD& lcdd, int argc, char** argv) { + int example2(Detector& description, int argc, char** argv) { printout(INFO,"Example2","+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); printout(INFO,"Example2","+++ Executing Conditions example No. 2: Dump conditions tree. "); printout(INFO,"Example2","+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - DetElement det = lcdd.world(); + DetElement det = description.world(); string args = ""; for(int i=0; i<argc; ++i) { args += argv[i], args += " "; }; printout(INFO,"Example2","Args: %s",args.c_str()); @@ -135,11 +132,11 @@ namespace { return 1; } - int example3(LCDD& lcdd, int, char** ) { + int example3(Detector& description, int, char** ) { printout(INFO,"Example1","+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); printout(INFO,"Example1","+++ Executing Conditions example No. 3: Conditions registration "); printout(INFO,"Example1","+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - Test::TestEnv env(lcdd, "TPC"); + Test::TestEnv env(description, "TPC"); env.add_xml_data_source("/examples/Conditions/xml/TPC.xml","1396887257,1396887257#epoch"); env.add_xml_data_source("/examples/Conditions/xml/TPC_run_563543.xml","563543#run"); @@ -193,22 +190,22 @@ namespace { callback_install((*j).second,c); } - int DD4hep_CallbackInstallTest(LCDD& lcdd, int argc, char** argv) { + int dd4hep_CallbackInstallTest(Detector& description, int argc, char** argv) { printout(INFO,"Example3","+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - printout(INFO,"Example3","+++ Executing DD4hepCallbackInstallTest: Install user callbacks. "); + printout(INFO,"Example3","+++ Executing dd4hepCallbackInstallTest: Install user callbacks. "); printout(INFO,"Example3","+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); string args = ""; for(int i=0; i<argc; ++i) { args += argv[i], args += " "; }; printout(INFO,"Example3","Args: %s",args.c_str()); - DetElement det = lcdd.world(); + DetElement det = description.world(); callback_install(det, new Callee()); return 1; } } -DECLARE_APPLY(DD4hep_Test_ConditionsAccess,example1) -DECLARE_APPLY(DD4hep_Test_ConditionsExample3,example3) -DECLARE_APPLY(DD4hep_Test_ConditionsTreeDump,example2) -DECLARE_APPLY(DD4hep_Test_CallbackInstall,DD4hep_CallbackInstallTest) +DECLARE_APPLY(dd4hep_Test_ConditionsAccess,example1) +DECLARE_APPLY(dd4hep_Test_ConditionsExample3,example3) +DECLARE_APPLY(dd4hep_Test_ConditionsTreeDump,example2) +DECLARE_APPLY(dd4hep_Test_CallbackInstall,dd4hep_CallbackInstallTest) #endif diff --git a/examples/Conditions/src/ConditionsTest.cpp b/examples/Conditions/src/ConditionsTest.cpp index 7f07520c3..15f5068b8 100644 --- a/examples/Conditions/src/ConditionsTest.cpp +++ b/examples/Conditions/src/ConditionsTest.cpp @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -28,12 +28,12 @@ #include <deque> using namespace std; -using namespace DD4hep::ConditionExamples; +using namespace dd4hep::ConditionExamples; /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit + /// Namespace for implementation details of the AIDA detector description toolkit namespace ConditionExamples { template <typename T> void print_bound_condition(Condition /* c */, const char* /* norm */) {} @@ -44,12 +44,12 @@ namespace DD4hep { if ( norm ) { T val = _multiply(c.get<T>(),norm); ::snprintf(text_format,sizeof(text_format)," Bound value %%s : value:%s [%s] Type: %%s", - Primitive<T>::default_format(),Primitive<T>::default_format()); + detail::Primitive<T>::default_format(),detail::Primitive<T>::default_format()); printout(INFO,"Cond_Value",text_format, c.name(), value, val, typeName(c.typeInfo()).c_str()); return; } ::snprintf(text_format,sizeof(text_format)," Bound value %%s : value:%s Type: %%s", - Primitive<T>::default_format()); + detail::Primitive<T>::default_format()); printout(INFO,"Cond_Value",text_format, c.name(), value, typeName(c.typeInfo()).c_str()); } template <> void __print_bound_val<string>(Condition c, const char*) { @@ -76,14 +76,14 @@ namespace DD4hep { { __print_bound_container<container >(c, norm); } #if defined(DD4HEP_HAVE_ALL_PARSERS) -#define TEMPLATE_TYPE(x,f) \ - TEMPLATE_SIMPLE_TYPE(x) \ - TEMPLATE_CONTAINER_TYPE(vector<x>,x) \ - TEMPLATE_CONTAINER_TYPE(list<x>,x) \ - TEMPLATE_CONTAINER_TYPE(set<x>,x) \ - TEMPLATE_CONTAINER_TYPE(Primitive<x>::int_map_t,x) \ - TEMPLATE_CONTAINER_TYPE(Primitive<x>::size_map_t,x) \ - TEMPLATE_CONTAINER_TYPE(Primitive<x>::string_map_t,x) +#define TEMPLATE_TYPE(x,f) \ + TEMPLATE_SIMPLE_TYPE(x) \ + TEMPLATE_CONTAINER_TYPE(vector<x>,x) \ + TEMPLATE_CONTAINER_TYPE(list<x>,x) \ + TEMPLATE_CONTAINER_TYPE(set<x>,x) \ + TEMPLATE_CONTAINER_TYPE(detail::Primitive<x>::int_map_t,x) \ + TEMPLATE_CONTAINER_TYPE(detail::Primitive<x>::size_map_t,x) \ + TEMPLATE_CONTAINER_TYPE(detail::Primitive<x>::string_map_t,x) TEMPLATE_TYPE(char,"%c") TEMPLATE_TYPE(unsigned char,"%02X") @@ -92,13 +92,13 @@ namespace DD4hep { TEMPLATE_TYPE(unsigned int,"%08X") TEMPLATE_TYPE(unsigned long,"%016X") #else -#define TEMPLATE_TYPE(x,f) \ - TEMPLATE_SIMPLE_TYPE(x) \ - TEMPLATE_CONTAINER_TYPE(vector<x>,x) \ - TEMPLATE_CONTAINER_TYPE(list<x>,x) \ - TEMPLATE_CONTAINER_TYPE(set<x>,x) \ - TEMPLATE_CONTAINER_TYPE(Primitive<x>::int_map_t,x) \ - TEMPLATE_CONTAINER_TYPE(Primitive<x>::string_map_t,x) +#define TEMPLATE_TYPE(x,f) \ + TEMPLATE_SIMPLE_TYPE(x) \ + TEMPLATE_CONTAINER_TYPE(vector<x>,x) \ + TEMPLATE_CONTAINER_TYPE(list<x>,x) \ + TEMPLATE_CONTAINER_TYPE(set<x>,x) \ + TEMPLATE_CONTAINER_TYPE(detail::Primitive<x>::int_map_t,x) \ + TEMPLATE_CONTAINER_TYPE(detail::Primitive<x>::string_map_t,x) #endif // DD4HEP_HAVE_ALL_PARSERS TEMPLATE_TYPE(int,"%d") @@ -143,8 +143,8 @@ namespace DD4hep { } template <typename T> void print_conditions(const RangeConditions& rc) { - for(RangeConditions::const_iterator k=rc.begin(); k != rc.end(); ++k) - print_condition<T>(*k); + for(Condition cond : rc) + print_condition<T>(cond); } template void print_conditions<void>(const RangeConditions& rc); @@ -165,16 +165,16 @@ namespace DD4hep { } } -TestEnv::TestEnv(LCDD& _lcdd, const string& detector_name) - : lcdd(_lcdd), detector(), manager() +TestEnv::TestEnv(Detector& _description, const string& detector_name) + : description(_description), detector(), manager() { - manager = ConditionsManager::from(lcdd); + manager = ConditionsManager::from(description); manager["LoaderType"] = "multi"; - manager["PoolType"] = "DD4hep_ConditionsLinearPool"; - manager["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool"; - manager["UserPoolType"] = "DD4hep_ConditionsLinearUserPool"; + manager["PoolType"] = "dd4hep_ConditionsLinearPool"; + manager["UpdatePoolType"] = "dd4hep_ConditionsLinearUpdatePool"; + manager["UserPoolType"] = "dd4hep_ConditionsLinearUserPool"; manager.initialize(); - detector = lcdd.detector(detector_name); + detector = description.detector(detector_name); if ( detector.isValid() ) { pair<bool, const IOVType*> e = manager.registerIOVType(0, "epoch"); pair<bool, const IOVType*> r = manager.registerIOVType(1, "run"); @@ -190,8 +190,8 @@ TestEnv::TestEnv(LCDD& _lcdd, const string& detector_name) } /// Find daughter element of the detector object -DetElement TestEnv::daughter(const string& sub_path) const { - return DD4hep::Geometry::DetectorTools::findDaughterElement(detector,sub_path); +dd4hep::DetElement TestEnv::daughter(const string& sub_path) const { + return dd4hep::detail::tools::findDaughterElement(detector,sub_path); } void TestEnv::add_xml_data_source(const string& file, const string& iov_str) { @@ -204,7 +204,7 @@ void TestEnv::add_xml_data_source(const string& file, const string& iov_str) { /// Dump the conditions of one detectpr element void TestEnv::dump_detector_element(DetElement elt, ConditionsMap& map) { - vector<Conditions::Condition> conditions; + vector<Condition> conditions; conditionsCollector(map,conditions)(elt); if ( conditions.empty() ) { printout(INFO,"conditions_tree","DetElement:%s NO CONDITIONS present",elt.path().c_str()); diff --git a/examples/Conditions/src/ConditionsTest.h b/examples/Conditions/src/ConditionsTest.h index a67107d6d..8907f06c9 100644 --- a/examples/Conditions/src/ConditionsTest.h +++ b/examples/Conditions/src/ConditionsTest.h @@ -1,5 +1,5 @@ //========================================================================== -// AIDA Detector description implementation for LCD +// AIDA Detector description implementation //-------------------------------------------------------------------------- // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) // All rights reserved. @@ -14,7 +14,7 @@ #define DDCOND_CONDITIONSTEST_H // Framework include files -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DD4hep/Conditions.h" #include "DD4hep/ConditionsMap.h" @@ -27,22 +27,22 @@ /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { - /// Namespace for the geometry part of the AIDA detector description toolkit + /// Namespace for implementation details of the AIDA detector description toolkit namespace ConditionExamples { - using namespace Conditions; + using namespace cond; struct TestEnv { - LCDD& lcdd; + Detector& description; DetElement detector; ConditionsManager manager; Handle<ConditionsDataLoader> loader; const IOVType* epoch; const IOVType* run; - TestEnv(LCDD& _lcdd, const std::string& detector_name); + TestEnv(Detector& _description, const std::string& detector_name); /// Find daughter element of the detector object DetElement daughter(const std::string& sub_path) const; diff --git a/examples/Conditions/xml/Sequence_1.xml b/examples/Conditions/xml/Sequence_1.xml index d661d9afd..2c6001b6e 100644 --- a/examples/Conditions/xml/Sequence_1.xml +++ b/examples/Conditions/xml/Sequence_1.xml @@ -1,20 +1,20 @@ <plugins> - <plugin name="DD4hepXMLLoader"> + <plugin name="dd4hepXMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> </plugin> - <plugin name="DD4hepVolumeManager"/> - <plugin name="DD4hepConditionsManagerInstaller"/> + <plugin name="dd4hepVolumeManager"/> + <plugin name="dd4hepConditionsManagerInstaller"/> - <plugin name="DD4hepXMLLoader"> + <plugin name="dd4hepXMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_alignment.xml"/> </plugin> - <plugin name="DD4hepXMLLoader"> + <plugin name="dd4hepXMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_reset.xml"/> </plugin> - <plugin name="DD4hep_Test_CallbackInstall"/> - <plugin name="DD4hep_Test_ConditionsAccess"/> - <plugin name="DD4hep_Test_ConditionsTreeDump"/> + <plugin name="dd4hep_Test_CallbackInstall"/> + <plugin name="dd4hep_Test_ConditionsAccess"/> + <plugin name="dd4hep_Test_ConditionsTreeDump"/> </plugins> diff --git a/examples/Conditions/xml/Sequence_2.xml b/examples/Conditions/xml/Sequence_2.xml index e264937e8..7aa303078 100644 --- a/examples/Conditions/xml/Sequence_2.xml +++ b/examples/Conditions/xml/Sequence_2.xml @@ -1,12 +1,12 @@ <plugins> - <plugin name="DD4hepXMLLoader"> + <plugin name="dd4hepXMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> </plugin> - <plugin name="DD4hepVolumeManager"/> - <plugin name="DD4hepConditionsManagerInstaller"/> - <plugin name="DD4hep_Test_CallbackInstall"/> - <plugin name="DD4hep_Test_ConditionsExample3"/> + <plugin name="dd4hepVolumeManager"/> + <plugin name="dd4hepConditionsManagerInstaller"/> + <plugin name="dd4hep_Test_CallbackInstall"/> + <plugin name="dd4hep_Test_ConditionsExample3"/> </plugins> diff --git a/examples/Conditions/xml/TPC_alignment.xml b/examples/Conditions/xml/TPC_alignment.xml index c7181f69d..ea1a295dc 100644 --- a/examples/Conditions/xml/TPC_alignment.xml +++ b/examples/Conditions/xml/TPC_alignment.xml @@ -4,7 +4,7 @@ <subdetectors> <!-- Note: The subdetector name MUST be in the list of top level - detector elements attached to the LCDD structure. + detector elements attached to the Detector structure. A generic alignment transformation is defined by - a translation in 3D space identified in XML as a diff --git a/examples/Conditions/xml/plugins.xml b/examples/Conditions/xml/plugins.xml index ff25edf35..4dfa67d4d 100644 --- a/examples/Conditions/xml/plugins.xml +++ b/examples/Conditions/xml/plugins.xml @@ -1,25 +1,25 @@ <plugins> - <plugin name="DD4hepXMLLoader"> + <plugin name="dd4hepXMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC.xml"/> </plugin> - <plugin name="DD4hepVolumeManager"/> - <plugin name="DD4hepConditionsManagerInstaller"/> + <plugin name="dd4hepVolumeManager"/> + <plugin name="dd4hepConditionsManagerInstaller"/> - <plugin name="DD4hepXMLLoader"> + <plugin name="dd4hepXMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_alignment.xml"/> </plugin> - <plugin name="DD4hepXMLLoader"> + <plugin name="dd4hepXMLLoader"> <arg value="file:../DD4hep.trunk/DDExamples/AlignDet/compact/AlephTPC_reset.xml"/> </plugin> - <plugin name="DD4hep_Test_CallbackInstallTest"/> + <plugin name="dd4hep_Test_CallbackInstallTest"/> <!-- - <plugin name="DD4hep_Test_ConditionsAccess"/> - <plugin name="DD4hep_Test_ConditionsTreeDump"/> + <plugin name="dd4hep_Test_ConditionsAccess"/> + <plugin name="dd4hep_Test_ConditionsTreeDump"/> --> - <plugin name="DD4hepExample3"/> + <plugin name="dd4hepExample3"/> </plugins> diff --git a/examples/DDDB/CMakeLists.txt b/examples/DDDB/CMakeLists.txt index f19c8cbc8..4cf6b768c 100644 --- a/examples/DDDB/CMakeLists.txt +++ b/examples/DDDB/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -47,7 +47,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_load_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller REGEX_PASS "\\+ Converted 12852 placements" REGEX_FAIL "EXCEPTION;Exception" ) @@ -56,7 +56,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_conditions_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller REGEX_PASS "\\+ Converted 9353 conditions" REGEX_FAIL "EXCEPTION;Exception" ) @@ -65,7 +65,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_conditions_dump_simple_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -exec DDDB_ConditionsSummary REGEX_PASS "\\+ DDDB Total Number of parameters: 13650 " REGEX_FAIL "EXCEPTION;Exception" @@ -75,7 +75,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_det_elements_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller -end-plugin + -config dd4hep_ConditionsManagerInstaller -end-plugin -plugin DDDB_DetectorDump -print DEBUG -end-plugin REGEX_PASS "\\+ DDDB: Number of DetElements in the geometry: 6261" REGEX_FAIL "EXCEPTION;Exception" @@ -85,7 +85,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_det_volumes_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -plugin DDDB_DetectorVolumeDump -print DEBUG REGEX_PASS "\\+ DDDB: Number of DetElement placements: 6253" REGEX_FAIL "EXCEPTION;Exception" @@ -95,7 +95,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_det_conditions_keys_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -plugin DDDB_DetectorConditionKeysDump -print DEBUG REGEX_PASS "\\+ DDDB: Number of DetElement condition keys: 9043" REGEX_FAIL "EXCEPTION;Exception" @@ -105,7 +105,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_det_catalog_data_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -plugin DDDB_DetectorConditionDump -print DEBUG REGEX_PASS "\\+ DDDBConditions Total Number of parameters: 346312 " REGEX_FAIL "EXCEPTION;Exception" @@ -115,7 +115,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_det_catalog_align_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -plugin DDDB_DetectorAlignmentDump -print DEBUG REGEX_PASS "\\+ DDDB: Number of attached alignments: 5408" REGEX_FAIL "EXCEPTION;Exception" @@ -125,7 +125,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_detelement_conditions_dump_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -plugin DDDB_DetElementConditionDump -print DEBUG REGEX_PASS "\\+ DDDB: Total number of DetElement parameters: 13144" ) @@ -134,7 +134,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_derived_conditions_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -plugin DDDB_DerivedCondTest -print DEBUG REGEX_PASS "\\+ DDDB: Total Number of callbacks: 16215" REGEX_FAIL "EXCEPTION;Exception" @@ -144,7 +144,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_alignment_derived_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -plugin DDDB_DerivedAlignmentsTest -print DEBUG -turns 1 -access 3 REGEX_PASS "\\+ DDDB: AlignmentManager: 9352 conditions \\(S:0,L:9352,C:0,M:0\\) alignments: \\(A:6200,M:0\\) for IOV:epoch\\(0\\)" REGEX_FAIL "EXCEPTION;Exception" @@ -154,7 +154,7 @@ if (DD4HEP_USE_XERCESC) dd4hep_add_test_reg( DDDB_alignment_access_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller + -config dd4hep_ConditionsManagerInstaller -plugin DDDB_AlignmentsAccessTest -print DEBUG REGEX_PASS "\\+ DDDB: Accessed 5405 alignments from 5405 DetElement objects" REGEX_FAIL "EXCEPTION;Exception" diff --git a/examples/DDDB/scripts/extract_dddb.sh b/examples/DDDB/scripts/extract_dddb.sh index 4008be383..62ee24fe1 100755 --- a/examples/DDDB/scripts/extract_dddb.sh +++ b/examples/DDDB/scripts/extract_dddb.sh @@ -1,7 +1,7 @@ #!/bin/bash # $Id$ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/examples/DDDB/scripts/run_dddb.sh b/examples/DDDB/scripts/run_dddb.sh index 3a2c0845e..9911c2e16 100755 --- a/examples/DDDB/scripts/run_dddb.sh +++ b/examples/DDDB/scripts/run_dddb.sh @@ -1,6 +1,6 @@ #!/bin/bash #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/examples/DDG4/CMakeLists.txt b/examples/DDG4/CMakeLists.txt index 96cf04431..7985b31ef 100644 --- a/examples/DDG4/CMakeLists.txt +++ b/examples/DDG4/CMakeLists.txt @@ -1,5 +1,5 @@ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. diff --git a/examples/Segmentation/CMakeLists.txt b/examples/Segmentation/CMakeLists.txt index abc8885f8..f42e789ea 100644 --- a/examples/Segmentation/CMakeLists.txt +++ b/examples/Segmentation/CMakeLists.txt @@ -33,8 +33,8 @@ ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) find_package( DD4hep ) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_ROOT}/cmake ) -include( DD4hep ) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${dd4hep_ROOT}/cmake ) +include( dd4hep ) find_package( ROOT REQUIRED ) #find_package( ROOT REQUIRED COMPONENTS Geom Reflex) @@ -47,7 +47,7 @@ set( ROOT_COMPONENT_LIBRARIES Geom Reflex) #------------------------------------------------------------- include_directories( ${CMAKE_SOURCE_DIR}/include - ${DD4hep_INCLUDE_DIRS} + ${dd4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} ) @@ -63,7 +63,7 @@ endif() add_executable(Segmentation SegmentationTest.cpp ${sources}) -target_link_libraries(Segmentation ${DD4hep_LIBRARIES} ) +target_link_libraries(Segmentation ${dd4hep_LIBRARIES} ) #---Rootmap generation-------------------------------------------------------------- # @@ -75,7 +75,7 @@ target_link_libraries(Segmentation ${DD4hep_LIBRARIES} ) #---- configure run environment --------------- -configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY) +configure_file( ${dd4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY) install(FILES ${CMAKE_BINARY_DIR}/this${PackageName}.sh DESTINATION bin diff --git a/examples/Segmentation/SegmentationTest.cpp b/examples/Segmentation/SegmentationTest.cpp index 3452dbffa..77f685b49 100644 --- a/examples/Segmentation/SegmentationTest.cpp +++ b/examples/Segmentation/SegmentationTest.cpp @@ -5,7 +5,7 @@ * Author: Christian Grefe, CERN */ -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDSegmentation/SegmentationFactory.h" #include "DDSegmentation/SegmentationParameter.h" @@ -13,8 +13,8 @@ #include <set> using namespace std; -using namespace DD4hep; -using namespace Geometry; +using namespace dd4hep; +using namespace detail; using namespace DDSegmentation; int main(int argc, char** argv) { diff --git a/examples/SimpleDetector/CMakeLists.txt b/examples/SimpleDetector/CMakeLists.txt index fc5d0980a..a1f35438b 100644 --- a/examples/SimpleDetector/CMakeLists.txt +++ b/examples/SimpleDetector/CMakeLists.txt @@ -1,6 +1,5 @@ -# $Id: $ #========================================================================== -# AIDA Detector description implementation for LCD +# AIDA Detector description implementation #-------------------------------------------------------------------------- # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) # All rights reserved. @@ -28,7 +27,7 @@ dd4hep_configure_scripts(SimpleDetector DEFAULT_SETUP WITH_TESTS) #*** Testing ********************************************************************* foreach (test Simple_ILD) - foreach( type lcdd gdml vis ) + foreach( type description gdml vis ) dd4hep_add_test_reg( SimpleDetector_converter_${type} COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_SimpleDetector.sh" EXEC_ARGS geoConverter -compact2${type} -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/${test}.xml -output file:${test}.${type} diff --git a/examples/SimpleDetector/examples/gear_Simple_CLIC.xml b/examples/SimpleDetector/examples/gear_Simple_CLIC.xml index d3df25e41..e422cf1b0 100644 --- a/examples/SimpleDetector/examples/gear_Simple_CLIC.xml +++ b/examples/SimpleDetector/examples/gear_Simple_CLIC.xml @@ -1,6 +1,6 @@ <gear> <global detectorName="Simple_CLIC" /> - <!--Gear XML file automatically created with GearXML::createXMLFile ....--> + <!--Gear XML file automatically created with Gearxml::createXMLFile ....--> <BField type="ConstantBField" x="6.940990173e-297" y="1.976262583e-310" z="3.500000000e+00" /> <detectors> <detector name="VXD" geartype="ZPlanarParameters"> diff --git a/examples/SimpleDetector/examples/run_sitracking_SimpleCLIC.xml b/examples/SimpleDetector/examples/run_sitracking_SimpleCLIC.xml index 52c1ab272..9907202af 100644 --- a/examples/SimpleDetector/examples/run_sitracking_SimpleCLIC.xml +++ b/examples/SimpleDetector/examples/run_sitracking_SimpleCLIC.xml @@ -9,7 +9,7 @@ <marlin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ilcsoft.desy.de/marlin/marlin.xsd"> <execute> <processor name="MyAIDAProcessor"/> - <processor name="InitDD4hep"/> + <processor name="Initdd4hep"/> <processor name="MySplitCollectionByLayer" /> @@ -35,7 +35,7 @@ <parameter name="SkipNEvents" value="0" /> <parameter name="SupressCheck" value="false" /> <parameter name="GearXMLFile" value="gear_Simple_CLIC.xml"/> - <parameter name="DD4hepXMLFile" value="/Users/gaede/DD4hep/trunk/examples/SimpleDetector/compact/Simple_CLIC.xml"/> + <parameter name="dd4hepXMLFile" value="/Users/gaede/DD4hep/trunk/examples/SimpleDetector/compact/Simple_CLIC.xml"/> <parameter name="Verbosity" options="DEBUG0-4,MESSAGE0-4,WARNING0-4,ERROR0-4,SILENT"> MESSAGE DEBUG0 </parameter> <parameter name="RandomSeed" value="1234567890" /> @@ -44,10 +44,10 @@ </global> - <processor name="InitDD4hep" type="InitializeDD4hep"> - <!--InitializeDD4hep reads a compact xml file and initializes the DD4hep::LCDD object--> - <!--Name of the DD4hep compact xml file to load--> - <parameter name="DD4hepXMLFile" type="string">Simple_ClIC.xml </parameter> + <processor name="Initdd4hep" type="Initializedd4hep"> + <!--Initializedd4hep reads a compact xml file and initializes the dd4hep::Detector object--> + <!--Name of the dd4hep compact xml file to load--> + <parameter name="dd4hepXMLFile" type="string">Simple_ClIC.xml </parameter> </processor> <processor name="MyLCIOOutputProcessor" type="LCIOOutputProcessor"> diff --git a/examples/SimpleDetector/src/AirTube_geo.cpp b/examples/SimpleDetector/src/AirTube_geo.cpp index 39a39f84c..2ec90cf21 100644 --- a/examples/SimpleDetector/src/AirTube_geo.cpp +++ b/examples/SimpleDetector/src/AirTube_geo.cpp @@ -14,12 +14,12 @@ #include "DDRec/DetectorData.h" -using namespace DD4hep; -using namespace DD4hep::Geometry; -using namespace DD4hep::DDRec ; +using namespace dd4hep; +using namespace dd4hep::detail; +using namespace dd4hep::rec ; using namespace DDSurfaces ; -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector /* sens */) { +static Ref_t create_element(Detector& description, xml_h e, SensitiveDetector /* sens */) { xml_det_t x_det = e; std::string name = x_det.nameStr(); @@ -41,7 +41,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector /* sens */) Tube tubeSolid (inner_r, outer_r, z_half ) ; - Volume tube_vol( name+"_inner_cylinder_air", tubeSolid , lcdd.material("Air") ) ; + Volume tube_vol( name+"_inner_cylinder_air", tubeSolid , description.material("Air") ) ; Vector3D ocyl( inner_r + 0.5*tube_thick , 0. , 0. ) ; @@ -52,7 +52,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector /* sens */) //-------------------------------------- - Volume mother = lcdd.pickMotherVolume( airTube ) ; + Volume mother = description.pickMotherVolume( airTube ) ; pv = mother.placeVolume( tube_vol ) ; diff --git a/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp b/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp index ef755b60a..8a263d4cb 100644 --- a/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp +++ b/examples/SimpleDetector/src/ZPlanarTracker_geo.cpp @@ -14,12 +14,12 @@ #include "DDRec/DetectorData.h" #include <exception> -using namespace DD4hep; -using namespace DD4hep::Geometry; -using namespace DD4hep::DDRec ; +using namespace dd4hep; +using namespace dd4hep::detail; +using namespace dd4hep::rec ; using namespace DDSurfaces ; -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { +static Ref_t create_element(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; std::string name = x_det.nameStr(); @@ -33,7 +33,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { PlacedVolume pv; - DDRec::ZPlanarData* zPlanarData = new DDRec::ZPlanarData ; + rec::ZPlanarData* zPlanarData = new rec::ZPlanarData ; double minRadius = 1e99 ; @@ -106,7 +106,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //----------------------------------- // store the data in an extension to be used for reconstruction - DDRec::ZPlanarData::LayerLayout thisLayer ; + rec::ZPlanarData::LayerLayout thisLayer ; thisLayer.sensorsPerLadder = 1 ; // for now only one planar sensor thisLayer.lengthSensor = 2. * sens_zhalf ; @@ -130,8 +130,8 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { //----------------------------------- - Material supp_mat = lcdd.material( supp_matS ) ; - Material sens_mat = lcdd.material( sens_matS ) ; + Material supp_mat = description.material( supp_matS ) ; + Material sens_mat = description.material( sens_matS ) ; //------- @@ -165,8 +165,8 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { sens.setType("tracker"); sens_vol.setSensitiveDetector(sens); - sens_vol.setAttributes( lcdd, x_det.regionStr(), x_det.limitsStr(), sens_vis ); - supp_vol.setAttributes( lcdd, x_det.regionStr(), x_det.limitsStr(), supp_vis ); + sens_vol.setAttributes( description, x_det.regionStr(), x_det.limitsStr(), sens_vis ); + supp_vol.setAttributes( description, x_det.regionStr(), x_det.limitsStr(), supp_vis ); //--------- loop over ladders --------------------------- @@ -210,7 +210,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } - // tracker.setVisAttributes(lcdd, x_det.visStr(),laddervol); + // tracker.setVisAttributes(description, x_det.visStr(),laddervol); // is this needed ?? @@ -227,7 +227,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { double z_half = minZhalf ; Tube tubeSolid (inner_r, outer_r, z_half ) ; - Volume tube_vol( name+"_inner_cylinder_air", tubeSolid , lcdd.material("Air") ) ; + Volume tube_vol( name+"_inner_cylinder_air", tubeSolid , description.material("Air") ) ; assembly.placeVolume( tube_vol , Transform3D() ) ; @@ -241,9 +241,9 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { - tracker.addExtension< DDRec::ZPlanarData >( zPlanarData ) ; + tracker.addExtension< rec::ZPlanarData >( zPlanarData ) ; - Volume mother = lcdd.pickMotherVolume( tracker ) ; + Volume mother = description.pickMotherVolume( tracker ) ; pv = mother.placeVolume(assembly); -- GitLab