diff --git a/CMakeLists.txt b/CMakeLists.txt index 0314604ab..e4f2ba8b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,4 +22,4 @@ install(FILES ${CMAKE_BINARY_DIR}/fccrun RENAME run) gaudi_project(FCCSW HEAD - USE Gaudi v28r2 ) + USE Gaudi v29r2 ) diff --git a/Detector/DetCommon/CMakeLists.txt b/Detector/DetCommon/CMakeLists.txt index 0efc6d9e2..0baa652ea 100644 --- a/Detector/DetCommon/CMakeLists.txt +++ b/Detector/DetCommon/CMakeLists.txt @@ -9,8 +9,6 @@ find_package(DD4hep COMPONENTS DDG4 DDSegmentation REQUIRED) find_package(Geant4) include(${Geant4_USE_FILE}) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_ROOT}/cmake ) -include( DD4hep ) find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) @@ -18,7 +16,7 @@ gaudi_install_headers(DetCommon) gaudi_add_library(DetCommon src/*.cpp INCLUDE_DIRS DD4hep ROOT Geant4 DetSegmentation - LINK_LIBRARIES GaudiKernel DD4hep ROOT Geant4 DetSegmentation ${DD4hep_COMPONENT_LIBRARIES} + LINK_LIBRARIES GaudiKernel DD4hep ROOT Geant4 DetSegmentation PUBLIC_HEADERS DetCommon) install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetCommon) diff --git a/Detector/DetCommon/DetCommon/DetUtils.h b/Detector/DetCommon/DetCommon/DetUtils.h index c9d784e6a..f5b83b233 100644 --- a/Detector/DetCommon/DetCommon/DetUtils.h +++ b/Detector/DetCommon/DetCommon/DetUtils.h @@ -2,7 +2,7 @@ #define DETCOMMON_DETUTILS_H // FCCSW -#include "DetSegmentation/GridPhiEta.h" +#include "DetSegmentation/FCCSWGridPhiEta.h" // DD4hep #include "DD4hep/DetFactoryHelper.h" @@ -26,11 +26,11 @@ e.g. returns when called with (detector, "layer", "name", "1") */ namespace det { namespace utils { -DD4hep::XML::Component getNodeByStrAttr(const DD4hep::XML::Handle_t& mother, const std::string& nodeName, +dd4hep::xml::Component getNodeByStrAttr(const dd4hep::xml::Handle_t& mother, const std::string& nodeName, const std::string& attrName, const std::string& attrValue); /// try to get attribute with double value, return defaultValue if attribute not found -double getAttrValueWithFallback(const DD4hep::XML::Component& node, const std::string& attrName, +double getAttrValueWithFallback(const dd4hep::xml::Component& node, const std::string& attrName, const double& defaultValue); /** Retrieves the cellID based on the position of the step and the detector segmentation. @@ -40,7 +40,7 @@ double getAttrValueWithFallback(const DD4hep::XML::Component& node, const std::s * or the middle of the step. */ -uint64_t cellID(const DD4hep::Geometry::Segmentation& aSeg, const G4Step& aStep, bool aPreStepPoint = true); +uint64_t cellID(const dd4hep::Segmentation& aSeg, const G4Step& aStep, bool aPreStepPoint = true); /** Get neighbours in many dimensions. * @param[in] aDecoder Handle to the bitfield decoder. @@ -49,7 +49,7 @@ uint64_t cellID(const DD4hep::Geometry::Segmentation& aSeg, const G4Step& aStep, * @param[in] aCellId ID of cell. * return Vector of neighbours. */ -std::vector neighbours(DD4hep::DDSegmentation::BitField64& aDecoder, +std::vector neighbours(dd4hep::DDSegmentation::BitField64& aDecoder, const std::vector& aFieldNames, const std::vector>& aFieldExtremes, uint64_t aCellId); @@ -59,7 +59,7 @@ std::vector neighbours(DD4hep::DDSegmentation::BitField64& aDecoder, * @param[in] aFieldNames Names of the fields for which extremes are found. * return Vector of pairs (min,max) */ -std::vector> bitfieldExtremes(DD4hep::DDSegmentation::BitField64& aDecoder, +std::vector> bitfieldExtremes(dd4hep::DDSegmentation::BitField64& aDecoder, const std::vector& aFieldNames); /** Get the half widths of the box envelope (TGeoBBox). @@ -81,7 +81,7 @@ CLHEP::Hep3Vector tubeDimensions(uint64_t aVolumeId); * @param[in] aSeg Handle to the segmentation of the volume. * return Array of the number of cells in (X, Y). */ -std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::CartesianGridXY& aSeg); +std::array numberOfCells(uint64_t aVolumeId, const dd4hep::DDSegmentation::CartesianGridXY& aSeg); /** Get the number of cells for the volume and a given Cartesian XYZ segmentation. * For an example see: Test/TestReconstruction/tests/options/testcellcountingXYZ.py. @@ -90,7 +90,7 @@ std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentati * @param[in] aSeg Handle to the segmentation of the volume. * return Array of the number of cells in (X, Y, Z). */ -std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::CartesianGridXYZ& aSeg); +std::array numberOfCells(uint64_t aVolumeId, const dd4hep::DDSegmentation::CartesianGridXYZ& aSeg); /** Get the number of cells for the volume and a given Phi-Eta segmentation. * It is assumed that the volume has a cylindrical shape (and full azimuthal coverage) @@ -101,7 +101,7 @@ std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentati * @param[in] aSeg Handle to the segmentation of the volume. * return Array of the number of cells in (phi, eta). */ -std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::GridPhiEta& aSeg); +std::array numberOfCells(uint64_t aVolumeId, const dd4hep::DDSegmentation::FCCSWGridPhiEta& aSeg); /** Get the number of cells for the volume and a given R-phi segmentation. * It is assumed that the volume has a cylindrical shape - TGeoTube (and full azimuthal coverage) @@ -112,7 +112,7 @@ std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentati * @param[in] aSeg Handle to the segmentation of the volume. * return Array of the number of cells in (r, phi). */ -std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::PolarGridRPhi& aSeg); +std::array numberOfCells(uint64_t aVolumeId, const dd4hep::DDSegmentation::PolarGridRPhi& aSeg); /** Get the number of the volumes containing a given name. * For an example see: Test/TestReconstruction/tests/options/testcellcountingXYZ.py. diff --git a/Detector/DetCommon/bin/TGeoExporter.cpp b/Detector/DetCommon/bin/TGeoExporter.cpp new file mode 100644 index 000000000..f0aca98e5 --- /dev/null +++ b/Detector/DetCommon/bin/TGeoExporter.cpp @@ -0,0 +1,11 @@ + +#include "DD4hep/Detector.h" +#include "TGeoManager.h" + +int main(int argc, char *argv[]) { + std::string filename = argv[1]; + auto lcdd = &(dd4hep::Detector::getInstance()); + lcdd->fromCompact(filename); + gGeoManager->Export((filename + ".root").c_str()); + + } diff --git a/Detector/DetCommon/src/DetUtils.cpp b/Detector/DetCommon/src/DetUtils.cpp index 3d63bdf3a..edacf5b9c 100644 --- a/Detector/DetCommon/src/DetUtils.cpp +++ b/Detector/DetCommon/src/DetUtils.cpp @@ -12,18 +12,18 @@ namespace det { namespace utils { -DD4hep::XML::Component getNodeByStrAttr(const DD4hep::XML::Handle_t& mother, const std::string& nodeName, +dd4hep::xml::Component getNodeByStrAttr(const dd4hep::xml::Handle_t& mother, const std::string& nodeName, const std::string& attrName, const std::string& attrValue) { - for (DD4hep::XML::Collection_t xCompColl(mother, nodeName.c_str()); nullptr != xCompColl; ++xCompColl) { + for (dd4hep::xml::Collection_t xCompColl(mother, nodeName.c_str()); nullptr != xCompColl; ++xCompColl) { if (xCompColl.attr(attrName.c_str()) == attrValue) { - return static_cast(xCompColl); + return static_cast(xCompColl); } } // in case there was no xml daughter with matching name - return DD4hep::XML::Component(nullptr); + return dd4hep::xml::Component(nullptr); } -double getAttrValueWithFallback(const DD4hep::XML::Component& node, const std::string& attrName, +double getAttrValueWithFallback(const dd4hep::xml::Component& node, const std::string& attrName, const double& defaultValue) { if (node.hasAttr(_Unicode(attrName.c_str()))) { return node.attr(attrName.c_str()); @@ -32,9 +32,9 @@ double getAttrValueWithFallback(const DD4hep::XML::Component& node, const std::s } } -uint64_t cellID(const DD4hep::Geometry::Segmentation& aSeg, const G4Step& aStep, bool aPreStepPoint) { - DD4hep::Simulation::Geant4VolumeManager volMgr = DD4hep::Simulation::Geant4Mapping::instance().volumeManager(); - DD4hep::Geometry::VolumeManager::VolumeID volID = volMgr.volumeID(aStep.GetPreStepPoint()->GetTouchable()); +uint64_t cellID(const dd4hep::Segmentation& aSeg, const G4Step& aStep, bool aPreStepPoint) { + dd4hep::sim::Geant4VolumeManager volMgr = dd4hep::sim::Geant4Mapping::instance().volumeManager(); + dd4hep::VolumeID volID = volMgr.volumeID(aStep.GetPreStepPoint()->GetTouchable()); if (aSeg.isValid()) { G4ThreeVector global; if (aPreStepPoint) { @@ -44,15 +44,15 @@ uint64_t cellID(const DD4hep::Geometry::Segmentation& aSeg, const G4Step& aStep, } G4ThreeVector local = aStep.GetPreStepPoint()->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(global); - DD4hep::Geometry::Position loc(local.x() * MM_2_CM, local.y() * MM_2_CM, local.z() * MM_2_CM); - DD4hep::Geometry::Position glob(global.x() * MM_2_CM, global.y() * MM_2_CM, global.z() * MM_2_CM); - DD4hep::Geometry::VolumeManager::VolumeID cID = aSeg.cellID(loc, glob, volID); + dd4hep::Position loc(local.x() * MM_2_CM, local.y() * MM_2_CM, local.z() * MM_2_CM); + dd4hep::Position glob(global.x() * MM_2_CM, global.y() * MM_2_CM, global.z() * MM_2_CM); + dd4hep::VolumeID cID = aSeg.cellID(loc, glob, volID); return cID; } return volID; } -std::vector neighbours(DD4hep::DDSegmentation::BitField64& aDecoder, +std::vector neighbours(dd4hep::DDSegmentation::BitField64& aDecoder, const std::vector& aFieldNames, const std::vector>& aFieldExtremes, uint64_t aCellId) { @@ -74,7 +74,7 @@ std::vector neighbours(DD4hep::DDSegmentation::BitField64& aDecoder, return std::move(neighbours); } -std::vector> bitfieldExtremes(DD4hep::DDSegmentation::BitField64& aDecoder, +std::vector> bitfieldExtremes(dd4hep::DDSegmentation::BitField64& aDecoder, const std::vector& aFieldNames) { std::vector> extremes; int width = 0; @@ -90,8 +90,8 @@ std::vector> bitfieldExtremes(DD4hep::DDSegmentation::BitFie } CLHEP::Hep3Vector envelopeDimensions(uint64_t aVolumeId) { - DD4hep::Geometry::VolumeManager volMgr = DD4hep::Geometry::LCDD::getInstance().volumeManager(); - auto pvol = volMgr.lookupPlacement(aVolumeId); + dd4hep::VolumeManager volMgr = dd4hep::Detector::getInstance().volumeManager(); + auto pvol = volMgr.lookupVolumePlacement(aVolumeId); auto solid = pvol.volume().solid(); // get the envelope of the shape TGeoBBox* box = (dynamic_cast(solid.ptr())); @@ -99,7 +99,7 @@ CLHEP::Hep3Vector envelopeDimensions(uint64_t aVolumeId) { return CLHEP::Hep3Vector(box->GetDX(), box->GetDY(), box->GetDZ()); } -std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::CartesianGridXY& aSeg) { +std::array numberOfCells(uint64_t aVolumeId, const dd4hep::DDSegmentation::CartesianGridXY& aSeg) { // // get half-widths auto halfSizes = envelopeDimensions(aVolumeId); // get segmentation cell widths @@ -111,7 +111,7 @@ std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentati return {cellsX, cellsY}; } -std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::CartesianGridXYZ& aSeg) { +std::array numberOfCells(uint64_t aVolumeId, const dd4hep::DDSegmentation::CartesianGridXYZ& aSeg) { // // get half-widths auto halfSizes = envelopeDimensions(aVolumeId); // get segmentation cell widths @@ -126,8 +126,8 @@ std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentati } CLHEP::Hep3Vector tubeDimensions(uint64_t aVolumeId) { - DD4hep::Geometry::VolumeManager volMgr = DD4hep::Geometry::LCDD::getInstance().volumeManager(); - auto pvol = volMgr.lookupPlacement(aVolumeId); + dd4hep::VolumeManager volMgr = dd4hep::Detector::getInstance().volumeManager(); + auto pvol = volMgr.lookupVolumePlacement(aVolumeId); auto solid = pvol.volume().solid(); // get the envelope of the shape TGeoConeSeg* tube = (dynamic_cast(solid.ptr())); @@ -138,7 +138,7 @@ CLHEP::Hep3Vector tubeDimensions(uint64_t aVolumeId) { return CLHEP::Hep3Vector(tube->GetRmin1(), tube->GetRmax1(), tube->GetDZ()); } -std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::GridPhiEta& aSeg) { +std::array numberOfCells(uint64_t aVolumeId, const dd4hep::DDSegmentation::FCCSWGridPhiEta& aSeg) { // get half-widths, auto tubeSizes = tubeDimensions(aVolumeId); // get segmentation number of bins in phi @@ -151,7 +151,7 @@ std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentati return {phiCellNumber, cellsEta}; } -std::array numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::PolarGridRPhi& aSeg) { +std::array numberOfCells(uint64_t aVolumeId, const dd4hep::DDSegmentation::PolarGridRPhi& aSeg) { // get half-widths, auto tubeSizes = tubeDimensions(aVolumeId); // get segmentation cell width diff --git a/Detector/DetCommon/src/Disc_geo.cpp b/Detector/DetCommon/src/Disc_geo.cpp index 8bbc56715..caa3ed18b 100644 --- a/Detector/DetCommon/src/Disc_geo.cpp +++ b/Detector/DetCommon/src/Disc_geo.cpp @@ -1,14 +1,13 @@ #include "DD4hep/DetFactoryHelper.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; /** Simple cylinder using Tube to be used to define cylinder composed of 1 single material @author Clement Helsens **/ -static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector /*sens*/) { +static Ref_t create_element(Detector& lcdd, xml_h e, SensitiveDetector /*sens*/) { xml_det_t x_det = e; string name = x_det.nameStr(); DetElement cylinder(name, x_det.id()); diff --git a/Detector/DetCommon/src/LayeredCone_geo.cpp b/Detector/DetCommon/src/LayeredCone_geo.cpp index 8ac6c6632..14b2a497d 100644 --- a/Detector/DetCommon/src/LayeredCone_geo.cpp +++ b/Detector/DetCommon/src/LayeredCone_geo.cpp @@ -13,40 +13,40 @@ Expected xml structure: @author: Joschka Lingemann */ -static DD4hep::Geometry::Ref_t createLayeredCone(DD4hep::Geometry::LCDD& lcdd, - DD4hep::XML::Handle_t xmlElement, - DD4hep::Geometry::SensitiveDetector /*sensDet*/) { - DD4hep::XML::DetElement xmlDet = static_cast(xmlElement); +static dd4hep::Ref_t createLayeredCone(dd4hep::Detector& lcdd, + dd4hep::xml::Handle_t xmlElement, + dd4hep::SensitiveDetector /*sensDet*/) { + dd4hep::xml::DetElement xmlDet = static_cast(xmlElement); std::string name = xmlDet.nameStr(); - DD4hep::Geometry::DetElement detElement(name, xmlDet.id()); - DD4hep::Geometry::Volume experimentalHall = lcdd.pickMotherVolume(detElement); + dd4hep::DetElement detElement(name, xmlDet.id()); + dd4hep::Volume experimentalHall = lcdd.pickMotherVolume(detElement); xml_comp_t dimensions(xmlDet.dimensions()); - DD4hep::Geometry::Cone envelope( + dd4hep::Cone envelope( dimensions.dz(), dimensions.rmin1(), dimensions.rmax1(), dimensions.rmin2(), dimensions.rmax2()); - DD4hep::Geometry::Volume envVolume(name, envelope, lcdd.material(dimensions.materialStr())); + dd4hep::Volume envVolume(name, envelope, lcdd.material(dimensions.materialStr())); envVolume.setVisAttributes(lcdd.invisible()); // Create layer cylinders with their respective material, etc auto layers = xmlElement.children(_Unicode(layer)); auto numLayers = xmlElement.numChildren(_Unicode(layer), true); // Joschka: Although this is awkward, it was the only way to loop through children I could find - DD4hep::XML::Handle_t layer(layers.reset()); + dd4hep::xml::Handle_t layer(layers.reset()); for (unsigned layerIdx = 0; layerIdx < numLayers; ++layerIdx) { - DD4hep::XML::DetElement layerDet = static_cast(layer); - DD4hep::Geometry::Cone layerShape( + dd4hep::xml::DetElement layerDet = static_cast(layer); + dd4hep::Cone layerShape( layerDet.dz(), layerDet.rmin1(), layerDet.rmax1(), layerDet.rmin2(), layerDet.rmax2()); - std::string layerName = DD4hep::XML::_toString(layerIdx, "layer%d"); - DD4hep::Geometry::Volume layerVolume(layerName, layerShape, lcdd.material(layer.attr("material"))); - DD4hep::Geometry::Position transLayer(0., 0., layerDet.z_offset()); - envVolume.placeVolume(layerVolume, DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), transLayer)); + std::string layerName = dd4hep::xml::_toString(layerIdx, "layer%d"); + dd4hep::Volume layerVolume(layerName, layerShape, lcdd.material(layer.attr("material"))); + dd4hep::Position transLayer(0., 0., layerDet.z_offset()); + envVolume.placeVolume(layerVolume, dd4hep::Transform3D(dd4hep::RotationZ(0.), transLayer)); if (layer.hasAttr("vis")) { layerVolume.setVisAttributes(lcdd, layerDet.visStr()); } layer.m_node = layers.next(); } - DD4hep::Geometry::Position trans(0., 0., dimensions.z_offset()); - DD4hep::Geometry::PlacedVolume envPhys = - experimentalHall.placeVolume(envVolume, DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), trans)); + dd4hep::Position trans(0., 0., dimensions.z_offset()); + dd4hep::PlacedVolume envPhys = + experimentalHall.placeVolume(envVolume, dd4hep::Transform3D(dd4hep::RotationZ(0.), trans)); envPhys.addPhysVolID("system", xmlDet.id()); detElement.setPlacement(envPhys); detElement.setVisAttributes(lcdd, xmlDet.visStr(), envVolume); diff --git a/Detector/DetCommon/src/SimpleBox.cpp b/Detector/DetCommon/src/SimpleBox.cpp index 2b3041dd7..a89bb113e 100644 --- a/Detector/DetCommon/src/SimpleBox.cpp +++ b/Detector/DetCommon/src/SimpleBox.cpp @@ -1,29 +1,29 @@ #include "DD4hep/DetFactoryHelper.h" namespace det { -static DD4hep::Geometry::Ref_t createSimpleBox(DD4hep::Geometry::LCDD& aLcdd, - DD4hep::XML::Handle_t aXmlElement, - DD4hep::Geometry::SensitiveDetector aSensDet) { - DD4hep::XML::DetElement x_det = aXmlElement; +static dd4hep::Ref_t createSimpleBox(dd4hep::Detector& aLcdd, + dd4hep::xml::Handle_t aXmlElement, + dd4hep::SensitiveDetector aSensDet) { + dd4hep::xml::DetElement x_det = aXmlElement; std::string name = x_det.nameStr(); - DD4hep::XML::Dimension dim(x_det.dimensions()); - DD4hep::XML::Dimension pos(x_det.position()); - DD4hep::XML::Dimension rot(x_det.rotation()); - DD4hep::Geometry::Material mat(aLcdd.material(x_det.materialStr())); - DD4hep::Geometry::DetElement det(name, x_det.id()); - DD4hep::Geometry::Volume det_vol(name + "_vol", DD4hep::Geometry::Box(dim.x(), dim.y(), dim.z()), mat); - DD4hep::Geometry::Volume mother = aLcdd.pickMotherVolume(det); - DD4hep::Geometry::Transform3D transform( - DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(rot.z(), rot.y(), rot.x())), - DD4hep::Geometry::Position(pos.x(), pos.y(), pos.z())); - DD4hep::Geometry::PlacedVolume phv = mother.placeVolume(det_vol, transform); + dd4hep::xml::Dimension dim(x_det.dimensions()); + dd4hep::xml::Dimension pos(x_det.position()); + dd4hep::xml::Dimension rot(x_det.rotation()); + dd4hep::Material mat(aLcdd.material(x_det.materialStr())); + dd4hep::DetElement det(name, x_det.id()); + dd4hep::Volume det_vol(name + "_vol", dd4hep::Box(dim.x(), dim.y(), dim.z()), mat); + dd4hep::Volume mother = aLcdd.pickMotherVolume(det); + dd4hep::Transform3D transform( + dd4hep::Rotation3D(dd4hep::RotationZYX(rot.z(), rot.y(), rot.x())), + dd4hep::Position(pos.x(), pos.y(), pos.z())); + dd4hep::PlacedVolume phv = mother.placeVolume(det_vol, transform); det_vol.setVisAttributes(aLcdd, x_det.visStr()); det_vol.setLimitSet(aLcdd, x_det.limitsStr()); det_vol.setRegion(aLcdd, x_det.regionStr()); if (x_det.isSensitive()) { - DD4hep::Geometry::SensitiveDetector sd = aSensDet; - DD4hep::XML::Dimension sd_typ = x_det.child(_U(sensitive)); + dd4hep::SensitiveDetector sd = aSensDet; + dd4hep::xml::Dimension sd_typ = x_det.child(_U(sensitive)); det_vol.setSensitiveDetector(aSensDet); sd.setType(sd_typ.typeStr()); } diff --git a/Detector/DetCommon/src/SimpleCone_geo.cpp b/Detector/DetCommon/src/SimpleCone_geo.cpp index 6bb9520a2..5c7b43266 100644 --- a/Detector/DetCommon/src/SimpleCone_geo.cpp +++ b/Detector/DetCommon/src/SimpleCone_geo.cpp @@ -7,26 +7,26 @@ namespace det { Simple cone using dimensions to be used to define cone composed of 1 single material @author Clement Helsens **/ -static DD4hep::Geometry::Ref_t -createSimpleCone(DD4hep::Geometry::LCDD& lcdd, xml_h e, DD4hep::Geometry::SensitiveDetector sensDet) { +static dd4hep::Ref_t +createSimpleCone(dd4hep::Detector& lcdd, xml_h e, dd4hep::SensitiveDetector sensDet) { xml_det_t x_det = e; std::string name = x_det.nameStr(); - DD4hep::Geometry::DetElement coneDet(name, x_det.id()); + dd4hep::DetElement coneDet(name, x_det.id()); - DD4hep::Geometry::Volume experimentalHall = lcdd.pickMotherVolume(coneDet); + dd4hep::Volume experimentalHall = lcdd.pickMotherVolume(coneDet); xml_comp_t coneDim(x_det.child(_U(dimensions))); - DD4hep::Geometry::Cone cone(coneDim.dz(), coneDim.rmin1(), coneDim.rmax1(), coneDim.rmin2(), coneDim.rmax2()); + dd4hep::Cone cone(coneDim.dz(), coneDim.rmin1(), coneDim.rmax1(), coneDim.rmin2(), coneDim.rmax2()); - DD4hep::Geometry::Volume coneVol(x_det.nameStr() + "_SimpleCone", cone, lcdd.material(coneDim.materialStr())); + dd4hep::Volume coneVol(x_det.nameStr() + "_SimpleCone", cone, lcdd.material(coneDim.materialStr())); if (x_det.isSensitive()) { - DD4hep::XML::Dimension sdType(x_det.child(_U(sensitive))); + dd4hep::xml::Dimension sdType(x_det.child(_U(sensitive))); coneVol.setSensitiveDetector(sensDet); sensDet.setType(sdType.typeStr()); } - DD4hep::Geometry::PlacedVolume conePhys; + dd4hep::PlacedVolume conePhys; double zoff = coneDim.z_offset(); if (fabs(zoff) > 0.000000000001) { @@ -36,9 +36,9 @@ createSimpleCone(DD4hep::Geometry::LCDD& lcdd, xml_h e, DD4hep::Geometry::Sensit reflectionAngle = M_PI; } } - DD4hep::Geometry::Position trans(0., 0., zoff); + dd4hep::Position trans(0., 0., zoff); conePhys = - experimentalHall.placeVolume(coneVol, DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationX(reflectionAngle), trans)); + experimentalHall.placeVolume(coneVol, dd4hep::Transform3D(dd4hep::RotationX(reflectionAngle), trans)); } else conePhys = experimentalHall.placeVolume(coneVol); diff --git a/Detector/DetCommon/src/SimpleCylinder_geo.cpp b/Detector/DetCommon/src/SimpleCylinder_geo.cpp index 706281221..5ed79294e 100644 --- a/Detector/DetCommon/src/SimpleCylinder_geo.cpp +++ b/Detector/DetCommon/src/SimpleCylinder_geo.cpp @@ -5,35 +5,35 @@ namespace det { Simple cylinder using Tube to be used to define cylinder composed of 1 single material @author Clement Helsens **/ -static DD4hep::Geometry::Ref_t -createSimpleCylinder(DD4hep::Geometry::LCDD& lcdd, xml_h e, DD4hep::Geometry::SensitiveDetector sensDet) { +static dd4hep::Ref_t +createSimpleCylinder(dd4hep::Detector& lcdd, xml_h e, dd4hep::SensitiveDetector sensDet) { xml_det_t x_det = e; std::string name = x_det.nameStr(); - DD4hep::Geometry::DetElement cylinderDet(name, x_det.id()); + dd4hep::DetElement cylinderDet(name, x_det.id()); - DD4hep::Geometry::Volume experimentalHall = lcdd.pickMotherVolume(cylinderDet); + dd4hep::Volume experimentalHall = lcdd.pickMotherVolume(cylinderDet); xml_comp_t cylinderDim(x_det.child(_U(dimensions))); - DD4hep::Geometry::Tube cylinder( + dd4hep::Tube cylinder( cylinderDim.rmin(), cylinderDim.rmax(), cylinderDim.dz(), cylinderDim.phi0(), cylinderDim.deltaphi()); - DD4hep::Geometry::Volume cylinderVol( + dd4hep::Volume cylinderVol( x_det.nameStr() + "_SimpleCylinder", cylinder, lcdd.material(cylinderDim.materialStr())); if (x_det.isSensitive()) { - DD4hep::XML::Dimension sdType(x_det.child(_U(sensitive))); + dd4hep::xml::Dimension sdType(x_det.child(_U(sensitive))); cylinderVol.setSensitiveDetector(sensDet); sensDet.setType(sdType.typeStr()); } - DD4hep::Geometry::PlacedVolume cylinderPhys; + dd4hep::PlacedVolume cylinderPhys; double zoff = cylinderDim.z_offset(); if (fabs(zoff) > 0.000000000001) { - DD4hep::Geometry::Position trans(0., 0., zoff); + dd4hep::Position trans(0., 0., zoff); cylinderPhys = experimentalHall.placeVolume(cylinderVol, - DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), trans)); + dd4hep::Transform3D(dd4hep::RotationZ(0.), trans)); } else cylinderPhys = experimentalHall.placeVolume(cylinderVol); diff --git a/Detector/DetCommon/src/SimpleLayeredCylinder_geo.cpp b/Detector/DetCommon/src/SimpleLayeredCylinder_geo.cpp index adf4ee5cf..f6f85b9bd 100644 --- a/Detector/DetCommon/src/SimpleLayeredCylinder_geo.cpp +++ b/Detector/DetCommon/src/SimpleLayeredCylinder_geo.cpp @@ -13,38 +13,38 @@ Expected xml structure: @author: Joschka Lingemann */ -static DD4hep::Geometry::Ref_t createSimpleLayeredCylinder(DD4hep::Geometry::LCDD& lcdd, - DD4hep::XML::Handle_t xmlElement, - DD4hep::Geometry::SensitiveDetector /*sensDet*/) { - DD4hep::XML::DetElement xmlDet = static_cast(xmlElement); +static dd4hep::Ref_t createSimpleLayeredCylinder(dd4hep::Detector& lcdd, + dd4hep::xml::Handle_t xmlElement, + dd4hep::SensitiveDetector /*sensDet*/) { + dd4hep::xml::DetElement xmlDet = static_cast(xmlElement); std::string name = xmlDet.nameStr(); - DD4hep::Geometry::DetElement detElement(name, xmlDet.id()); - DD4hep::Geometry::Volume experimentalHall = lcdd.pickMotherVolume(detElement); + dd4hep::DetElement detElement(name, xmlDet.id()); + dd4hep::Volume experimentalHall = lcdd.pickMotherVolume(detElement); xml_comp_t dimensions(xmlDet.dimensions()); - DD4hep::Geometry::Tube envelope(dimensions.rmin(), dimensions.rmax(), dimensions.dz()); - DD4hep::Geometry::Volume envVolume(name, envelope, lcdd.material(dimensions.materialStr())); + dd4hep::Tube envelope(dimensions.rmin(), dimensions.rmax(), dimensions.dz()); + dd4hep::Volume envVolume(name, envelope, lcdd.material(dimensions.materialStr())); // Create layer cylinders with their respective material, etc auto layers = xmlElement.children(_Unicode(layer)); auto numLayers = xmlElement.numChildren(_Unicode(layer), true); // Joschka: Although this is awkward, it was the only way to loop through children I could find - DD4hep::XML::Handle_t layer(layers.reset()); + dd4hep::xml::Handle_t layer(layers.reset()); for (unsigned layerIdx = 0; layerIdx < numLayers; ++layerIdx) { - DD4hep::XML::DetElement layerDet = static_cast(layer); - DD4hep::Geometry::Tube layerShape(layerDet.rmin(), layerDet.rmax(), layerDet.dz()); - std::string layerName = DD4hep::XML::_toString(layerIdx, "layer%d"); - DD4hep::Geometry::Volume layerVolume(layerName, layerShape, lcdd.material(layer.attr("material"))); - DD4hep::Geometry::Position transLayer(0., 0., layerDet.z_offset()); - envVolume.placeVolume(layerVolume, DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), transLayer)); + dd4hep::xml::DetElement layerDet = static_cast(layer); + dd4hep::Tube layerShape(layerDet.rmin(), layerDet.rmax(), layerDet.dz()); + std::string layerName = dd4hep::xml::_toString(layerIdx, "layer%d"); + dd4hep::Volume layerVolume(layerName, layerShape, lcdd.material(layer.attr("material"))); + dd4hep::Position transLayer(0., 0., layerDet.z_offset()); + envVolume.placeVolume(layerVolume, dd4hep::Transform3D(dd4hep::RotationZ(0.), transLayer)); if (layer.hasAttr("vis")) { layerVolume.setVisAttributes(lcdd, layerDet.visStr()); } layer.m_node = layers.next(); } - DD4hep::Geometry::Position trans(0., 0., dimensions.z_offset()); - DD4hep::Geometry::PlacedVolume envPhys = - experimentalHall.placeVolume(envVolume, DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), trans)); + dd4hep::Position trans(0., 0., dimensions.z_offset()); + dd4hep::PlacedVolume envPhys = + experimentalHall.placeVolume(envVolume, dd4hep::Transform3D(dd4hep::RotationZ(0.), trans)); envPhys.addPhysVolID("system", xmlDet.id()); detElement.setPlacement(envPhys); detElement.setVisAttributes(lcdd, xmlDet.visStr(), envVolume); diff --git a/Detector/DetCommon/src/SimpleParallelogram_geo.cpp b/Detector/DetCommon/src/SimpleParallelogram_geo.cpp index f4d18c2e0..937b4fc71 100644 --- a/Detector/DetCommon/src/SimpleParallelogram_geo.cpp +++ b/Detector/DetCommon/src/SimpleParallelogram_geo.cpp @@ -5,13 +5,13 @@ namespace det { Simple parallelogram using dimensions to be used to define cone composed of 1 single material @author Clement Helsens **/ -static DD4hep::Geometry::Ref_t -createSimpleParallelogram(DD4hep::Geometry::LCDD& lcdd, xml_h e, DD4hep::Geometry::SensitiveDetector) { +static dd4hep::Ref_t +createSimpleParallelogram(dd4hep::Detector& lcdd, xml_h e, dd4hep::SensitiveDetector) { xml_det_t x_det = e; std::string name = x_det.nameStr(); - DD4hep::Geometry::DetElement parallelogramDet(name, x_det.id()); + dd4hep::DetElement parallelogramDet(name, x_det.id()); - DD4hep::Geometry::Volume experimentalHall = lcdd.pickMotherVolume(parallelogramDet); + dd4hep::Volume experimentalHall = lcdd.pickMotherVolume(parallelogramDet); xml_comp_t parallelogramDim(x_det.child(_U(dimensions))); /// correct implementation but bug in the xml parser?? @@ -33,19 +33,19 @@ createSimpleParallelogram(DD4hep::Geometry::LCDD& lcdd, xml_h e, DD4hep::Geometr parallelogramDim.x1() + parallelogramDim.dx(), parallelogramDim.y1()}; - DD4hep::Geometry::EightPointSolid parallelogram(parallelogramDim.dz(), parallelogramPoints.data()); + dd4hep::EightPointSolid parallelogram(parallelogramDim.dz(), parallelogramPoints.data()); - DD4hep::Geometry::Volume parallelogramVol( + dd4hep::Volume parallelogramVol( x_det.nameStr() + "_SimpleParallelogram", parallelogram, lcdd.material(parallelogramDim.materialStr())); - DD4hep::Geometry::PlacedVolume parallelogramPhys; + dd4hep::PlacedVolume parallelogramPhys; double zoff = parallelogramDim.z_offset(); if (fabs(zoff) > 0.000000000001) { - DD4hep::Geometry::Position trans(0., 0., zoff); + dd4hep::Position trans(0., 0., zoff); parallelogramPhys = experimentalHall.placeVolume( - parallelogramVol, DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), trans)); + parallelogramVol, dd4hep::Transform3D(dd4hep::RotationZ(0.), trans)); } else parallelogramPhys = experimentalHall.placeVolume(parallelogramVol); diff --git a/Detector/DetCommon/src/SubtractedCylinder_geo.cpp b/Detector/DetCommon/src/SubtractedCylinder_geo.cpp index 5b43b7b63..63ce30243 100644 --- a/Detector/DetCommon/src/SubtractedCylinder_geo.cpp +++ b/Detector/DetCommon/src/SubtractedCylinder_geo.cpp @@ -7,24 +7,24 @@ rmin1, rmax1, z1 dimensions of the enveloping cylinder rmin2, rmax2, z2 dimensions of the cylinder to be subtracted @author: Joschka Lingemann */ -static DD4hep::Geometry::Ref_t createSubtractedCylinder(DD4hep::Geometry::LCDD& lcdd, - DD4hep::XML::Handle_t xmlElement, - DD4hep::Geometry::SensitiveDetector /*sensDet*/) { - DD4hep::XML::DetElement xmlDet = static_cast(xmlElement); +static dd4hep::Ref_t createSubtractedCylinder(dd4hep::Detector& lcdd, + dd4hep::xml::Handle_t xmlElement, + dd4hep::SensitiveDetector /*sensDet*/) { + dd4hep::xml::DetElement xmlDet = static_cast(xmlElement); std::string name = xmlDet.nameStr(); - DD4hep::Geometry::DetElement detElement(name, xmlDet.id()); - DD4hep::Geometry::Volume experimentalHall = lcdd.pickMotherVolume(detElement); + dd4hep::DetElement detElement(name, xmlDet.id()); + dd4hep::Volume experimentalHall = lcdd.pickMotherVolume(detElement); xml_comp_t dimensions(xmlDet.dimensions()); - DD4hep::Geometry::Tube envelope(dimensions.rmin1(), dimensions.rmax1(), dimensions.z1()); - DD4hep::Geometry::Tube negative(dimensions.rmin2(), dimensions.rmax2(), dimensions.z2()); + dd4hep::Tube envelope(dimensions.rmin1(), dimensions.rmax1(), dimensions.z1()); + dd4hep::Tube negative(dimensions.rmin2(), dimensions.rmax2(), dimensions.z2()); - DD4hep::Geometry::SubtractionSolid finalShape(envelope, negative); - DD4hep::Geometry::Volume cylVolume(name, finalShape, lcdd.material(dimensions.materialStr())); + dd4hep::SubtractionSolid finalShape(envelope, negative); + dd4hep::Volume cylVolume(name, finalShape, lcdd.material(dimensions.materialStr())); - DD4hep::Geometry::Position trans(0., 0., dimensions.z_offset()); - DD4hep::Geometry::PlacedVolume conePhys = - experimentalHall.placeVolume(cylVolume, DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), trans)); + dd4hep::Position trans(0., 0., dimensions.z_offset()); + dd4hep::PlacedVolume conePhys = + experimentalHall.placeVolume(cylVolume, dd4hep::Transform3D(dd4hep::RotationZ(0.), trans)); conePhys.addPhysVolID("system", xmlDet.id()); detElement.setPlacement(conePhys); diff --git a/Detector/DetCommon/src/TestBox1_geo.cpp b/Detector/DetCommon/src/TestBox1_geo.cpp index 4c678dd01..c08e0cbb0 100644 --- a/Detector/DetCommon/src/TestBox1_geo.cpp +++ b/Detector/DetCommon/src/TestBox1_geo.cpp @@ -10,10 +10,9 @@ #include "XML/Layering.h" using namespace std; -using namespace DD4hep; -using namespace DD4hep::Geometry; +using namespace dd4hep; -static Ref_t create_detector(LCDD& lcdd, xml_h e, SensitiveDetector /*sens*/) { +static Ref_t create_detector(Detector& lcdd, xml_h e, SensitiveDetector /*sens*/) { xml_det_t x_det = e; string det_name = x_det.nameStr(); string det_type = x_det.typeStr(); diff --git a/Detector/DetComponents/src/CreateVolumePositions.cpp b/Detector/DetComponents/src/CreateVolumePositions.cpp index 7118a5123..691a69e59 100644 --- a/Detector/DetComponents/src/CreateVolumePositions.cpp +++ b/Detector/DetComponents/src/CreateVolumePositions.cpp @@ -5,7 +5,7 @@ #include "DetInterface/IGeoSvc.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Volumes.h" #include "TGeoManager.h" @@ -45,13 +45,13 @@ StatusCode CreateVolumePositions::execute() { auto edmPositionedHitCollection = m_positionedHits.createAndPut(); uint64_t cellid = 0; - DD4hep::Geometry::VolumeManager volman = m_geoSvc->lcdd()->volumeManager(); + dd4hep::VolumeManager volman = m_geoSvc->lcdd()->volumeManager(); // Loop though hits, retrieve volume position from cellID for (const auto& cell : *hits) { cellid = cell.core().cellId; auto detelement = volman.lookupDetElement(cellid); - const auto& transformMatrix = detelement.worldTransformation(); + const auto& transformMatrix = detelement.nominal().worldTransformation(); double outGlobal[3]; double inLocal[] = {0, 0, 0}; transformMatrix.LocalToMaster(inLocal, outGlobal); diff --git a/Detector/DetComponents/src/CreateVolumePositions.h b/Detector/DetComponents/src/CreateVolumePositions.h index ea2b2dbf1..da449564c 100644 --- a/Detector/DetComponents/src/CreateVolumePositions.h +++ b/Detector/DetComponents/src/CreateVolumePositions.h @@ -13,7 +13,7 @@ class IGeoSvc; * * Retrieve positions of the volumes from cell ID. * This algorithm saves the centre position of the volume. No segmentation of volume is taken into account. - * Transformation matrix from global coordinates to local is taken from DD4hep::Geometry::DetElement. + * Transformation matrix from global coordinates to local is taken from dd4hep::DetElement. * Full hierarchy of DetElements (for each sensitive volume) is required. * * @author Anna Zaborowska diff --git a/Detector/DetComponents/src/GeoConstruction.cpp b/Detector/DetComponents/src/GeoConstruction.cpp index 92367ad19..04c104679 100644 --- a/Detector/DetComponents/src/GeoConstruction.cpp +++ b/Detector/DetComponents/src/GeoConstruction.cpp @@ -3,7 +3,7 @@ #include // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" #include "DDG4/Geant4Converter.h" #include "TGeoManager.h" @@ -14,31 +14,32 @@ #include "G4VSensitiveDetector.hh" namespace det { -GeoConstruction::GeoConstruction(DD4hep::Geometry::LCDD& lcdd) : m_lcdd(lcdd) {} + +GeoConstruction::GeoConstruction(dd4hep::Detector& lcdd) : m_lcdd(lcdd) {} GeoConstruction::~GeoConstruction() {} -// method borrowed from DD4hep::Simulation::Geant4DetectorSensitivesConstruction +// method borrowed from dd4hep::sim::Geant4DetectorSensitivesConstruction // ::constructSensitives(Geant4DetectorConstructionContext* ctxt) void GeoConstruction::ConstructSDandField() { - typedef DD4hep::Geometry::GeoHandlerTypes::SensitiveVolumes _SV; - typedef DD4hep::Geometry::GeoHandlerTypes::ConstVolumeSet VolSet; - DD4hep::Simulation::Geant4GeometryInfo* p = DD4hep::Simulation::Geant4Mapping::instance().ptr(); + typedef std::set VolSet; + typedef std::map _SV; + dd4hep::sim::Geant4GeometryInfo* p = dd4hep::sim::Geant4Mapping::instance().ptr(); _SV& vols = p->sensitives; for (_SV::const_iterator iv = vols.begin(); iv != vols.end(); ++iv) { - DD4hep::Geometry::SensitiveDetector sd = (*iv).first; + dd4hep::SensitiveDetector sd = (*iv).first; std::string typ = sd.type(), nam = sd.name(); // Sensitive detectors are deleted in ~G4SDManager - G4VSensitiveDetector* g4sd = DD4hep::PluginService::Create(typ, nam, &m_lcdd); + G4VSensitiveDetector* g4sd = dd4hep::PluginService::Create(typ, nam, &m_lcdd); if (g4sd == nullptr) { std::string tmp = typ; tmp[0] = ::toupper(tmp[0]); typ = "Geant4" + tmp; - g4sd = DD4hep::PluginService::Create(typ, nam, &m_lcdd); + g4sd = dd4hep::PluginService::Create(typ, nam, &m_lcdd); if (g4sd == nullptr) { - DD4hep::PluginDebug dbg; - g4sd = DD4hep::PluginService::Create(typ, nam, &m_lcdd); + dd4hep::PluginDebug dbg; + g4sd = dd4hep::PluginService::Create(typ, nam, &m_lcdd); if (g4sd == nullptr) { throw std::runtime_error("ConstructSDandField: FATAL Failed to " "create Geant4 sensitive detector " + @@ -62,12 +63,12 @@ void GeoConstruction::ConstructSDandField() { } } -// method borrowed from DD4hep::Simulation::Geant4DetectorConstruction::Construct() +// method borrowed from dd4hep::sim::Geant4DetectorConstruction::Construct() G4VPhysicalVolume* GeoConstruction::Construct() { - DD4hep::Simulation::Geant4Mapping& g4map = DD4hep::Simulation::Geant4Mapping::instance(); - DD4hep::Geometry::DetElement world = m_lcdd.world(); - DD4hep::Simulation::Geant4Converter conv(m_lcdd, DD4hep::DEBUG); - DD4hep::Simulation::Geant4GeometryInfo* geo_info = conv.create(world).detach(); + dd4hep::sim::Geant4Mapping& g4map = dd4hep::sim::Geant4Mapping::instance(); + dd4hep::DetElement world = m_lcdd.world(); + dd4hep::sim::Geant4Converter conv(m_lcdd, dd4hep::DEBUG); + dd4hep::sim::Geant4GeometryInfo* geo_info = conv.create(world).detach(); g4map.attach(geo_info); // All volumes are deleted in ~G4PhysicalVolumeStore() G4VPhysicalVolume* m_world = geo_info->world(); diff --git a/Detector/DetComponents/src/GeoConstruction.h b/Detector/DetComponents/src/GeoConstruction.h index 9f67efa84..def876238 100644 --- a/Detector/DetComponents/src/GeoConstruction.h +++ b/Detector/DetComponents/src/GeoConstruction.h @@ -7,10 +7,8 @@ // Geant4 #include "G4VUserDetectorConstruction.hh" -namespace DD4hep { -namespace Geometry { -class LCDD; -} +namespace dd4hep { +class Detector; } /** @class GeoConstruction DetectorDescription/DetDesServices/src/GeoConstruction.h GeoConstruction.h * @@ -26,7 +24,7 @@ namespace det { class GeoConstruction : public G4VUserDetectorConstruction { public: /// Constructor - GeoConstruction(DD4hep::Geometry::LCDD& lcdd); + GeoConstruction(dd4hep::Detector& lcdd); /// Default destructor virtual ~GeoConstruction(); /// Geometry construction callback: Invoke the conversion to Geant4 @@ -37,7 +35,7 @@ class GeoConstruction : public G4VUserDetectorConstruction { private: /// Reference to geometry object - DD4hep::Geometry::LCDD& m_lcdd; + dd4hep::Detector& m_lcdd; }; } #endif /* DETDESSERVICES_GEOCONSTRUCTION_H */ diff --git a/Detector/DetComponents/src/GeoSvc.cpp b/Detector/DetComponents/src/GeoSvc.cpp index aefc279ca..88c11ecfb 100644 --- a/Detector/DetComponents/src/GeoSvc.cpp +++ b/Detector/DetComponents/src/GeoSvc.cpp @@ -30,7 +30,7 @@ StatusCode GeoSvc::initialize() { TGeoManager::SetVerboseLevel(0); } uint printoutLevel = msgLevel(); - DD4hep::setPrintLevel(DD4hep::PrintLevel(printoutLevel)); + dd4hep::setPrintLevel(dd4hep::PrintLevel(printoutLevel)); m_incidentSvc->addListener(this, "GeometryFailure"); if (buildDD4HepGeo().isFailure()) m_log << MSG::ERROR << "Could not build DD4Hep geometry" << endmsg; @@ -51,7 +51,7 @@ StatusCode GeoSvc::finalize() { return StatusCode::SUCCESS; } StatusCode GeoSvc::buildDD4HepGeo() { // we retrieve the the static instance of the DD4HEP::Geometry - m_dd4hepgeo = &(DD4hep::Geometry::LCDD::getInstance()); + m_dd4hepgeo = &(dd4hep::Detector::getInstance()); m_dd4hepgeo->addExtension(this); // load geometry @@ -65,9 +65,9 @@ StatusCode GeoSvc::buildDD4HepGeo() { return StatusCode::SUCCESS; } -DD4hep::Geometry::LCDD* GeoSvc::lcdd() { return (m_dd4hepgeo); } +dd4hep::Detector* GeoSvc::lcdd() { return (m_dd4hepgeo); } -DD4hep::Geometry::DetElement GeoSvc::getDD4HepGeo() { return (lcdd()->world()); } +dd4hep::DetElement GeoSvc::getDD4HepGeo() { return (lcdd()->world()); } StatusCode GeoSvc::buildGeant4Geo() { std::shared_ptr detector(new det::GeoConstruction(*lcdd())); diff --git a/Detector/DetComponents/src/GeoSvc.h b/Detector/DetComponents/src/GeoSvc.h index 1e3d74f5f..5303889df 100644 --- a/Detector/DetComponents/src/GeoSvc.h +++ b/Detector/DetComponents/src/GeoSvc.h @@ -21,7 +21,7 @@ #include "GaudiKernel/ServiceHandle.h" // DD4Hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // Geant4 #include "G4RunManager.hh" @@ -44,8 +44,8 @@ class GeoSvc : public extends2 { /// This function generates the Geant4 geometry StatusCode buildGeant4Geo(); // receive DD4hep Geometry - virtual DD4hep::Geometry::DetElement getDD4HepGeo() override; - virtual DD4hep::Geometry::LCDD* lcdd() override; + virtual dd4hep::DetElement getDD4HepGeo() override; + virtual dd4hep::Detector* lcdd() override; // receive Geant4 Geometry virtual G4VUserDetectorConstruction* getGeant4Geo() override; /// Inform that a new incident has occurred @@ -55,7 +55,7 @@ class GeoSvc : public extends2 { /// Pointer to the incident service ServiceHandle m_incidentSvc; /// Pointer to the interface to the DD4hep geometry - DD4hep::Geometry::LCDD* m_dd4hepgeo; + dd4hep::Detector* m_dd4hepgeo; /// Pointer to the detector construction of DDG4 std::shared_ptr m_geant4geo; /// XML-files with the detector description diff --git a/Detector/DetComponents/src/MaterialScan.cpp b/Detector/DetComponents/src/MaterialScan.cpp index 5895ad998..b0498d274 100644 --- a/Detector/DetComponents/src/MaterialScan.cpp +++ b/Detector/DetComponents/src/MaterialScan.cpp @@ -6,9 +6,10 @@ #include "GaudiKernel/RndmGenerators.h" #include "GaudiKernel/Service.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Printout.h" #include "DDRec/MaterialManager.h" +#include "DDSurfaces/Vector3D.h" #include "TFile.h" #include "TMath.h" @@ -58,7 +59,7 @@ StatusCode MaterialScan::initialize() { tree->Branch("material", &materialPtr); auto lcdd = m_geoSvc->lcdd(); - DD4hep::DDRec::MaterialManager matMgr; + dd4hep::rec::MaterialManager matMgr; DDSurfaces::Vector3D beginning(0, 0, 0); auto boundaryVol = lcdd->detector(m_envelopeName).volume()->GetShape(); std::array pos = {0, 0, 0}; @@ -72,7 +73,7 @@ StatusCode MaterialScan::initialize() { matDepth->clear(); material->clear(); - std::map phiAveragedMaterialsBetween; + std::map phiAveragedMaterialsBetween; for (int iPhi = 0; iPhi < m_nPhiTrials; ++iPhi) { phi = m_flatPhiDist(); vec.SetPtEtaPhi(1, eta, phi); @@ -87,7 +88,7 @@ StatusCode MaterialScan::initialize() { DDSurfaces::Vector3D end(dir[0] * distance, dir[1] * distance, dir[2] * distance); debug() << "Calculating material between 0 and (" << end.x() << ", " << end.y() << ", " << end.z() << ") <=> eta = " << eta << ", phi = " << phi << endmsg; - const DD4hep::DDRec::MaterialVec& materials = matMgr.materialsBetween(beginning, end); + const dd4hep::rec::MaterialVec& materials = matMgr.materialsBetween(beginning, end); for (unsigned i = 0, n = materials.size(); i < n; ++i) { phiAveragedMaterialsBetween[materials[i].first] += materials[i].second / static_cast(m_nPhiTrials); } diff --git a/Detector/DetComponents/src/MergeCells.cpp b/Detector/DetComponents/src/MergeCells.cpp index 438c8e068..f0c471113 100644 --- a/Detector/DetComponents/src/MergeCells.cpp +++ b/Detector/DetComponents/src/MergeCells.cpp @@ -7,7 +7,7 @@ #include "datamodel/CaloHitCollection.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" DECLARE_ALGORITHM_FACTORY(MergeCells) @@ -40,7 +40,7 @@ StatusCode MergeCells::initialize() { // check if identifier exists in the decoder auto itIdentifier = std::find_if(m_descriptor.fields().begin(), m_descriptor.fields().end(), - [this](const std::pair& field) { + [this](const std::pair& field) { return bool(field.first.compare(m_idToMerge) == 0); }); if (itIdentifier == m_descriptor.fields().end()) { diff --git a/Detector/DetComponents/src/MergeCells.h b/Detector/DetComponents/src/MergeCells.h index e8ee59e15..ac75d2a0c 100644 --- a/Detector/DetComponents/src/MergeCells.h +++ b/Detector/DetComponents/src/MergeCells.h @@ -56,7 +56,7 @@ class MergeCells : public GaudiAlgorithm { /// Handle for the EDM Hits to be written DataHandle m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this}; // Handle to the detector ID descriptor - DD4hep::Geometry::IDDescriptor m_descriptor; + dd4hep::IDDescriptor m_descriptor; /// Name of the detector readout Gaudi::Property m_readoutName{this, "readout", "", "Name of the detector readout"}; /// Identifier to be merged diff --git a/Detector/DetComponents/src/MergeLayers.cpp b/Detector/DetComponents/src/MergeLayers.cpp index f0f1c5c03..e78c48059 100644 --- a/Detector/DetComponents/src/MergeLayers.cpp +++ b/Detector/DetComponents/src/MergeLayers.cpp @@ -8,7 +8,7 @@ #include "datamodel/CaloHitCollection.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // ROOT #include "TGeoManager.h" @@ -47,7 +47,7 @@ StatusCode MergeLayers::initialize() { // check if identifier exists in the decoder auto itIdentifier = std::find_if(m_descriptor.fields().begin(), m_descriptor.fields().end(), - [this](const std::pair& field) { + [this](const std::pair& field) { return bool(field.first.compare(m_idToMerge) == 0); }); if (itIdentifier == m_descriptor.fields().end()) { diff --git a/Detector/DetComponents/src/MergeLayers.h b/Detector/DetComponents/src/MergeLayers.h index 62493488f..e54dd8a94 100644 --- a/Detector/DetComponents/src/MergeLayers.h +++ b/Detector/DetComponents/src/MergeLayers.h @@ -60,7 +60,7 @@ class MergeLayers : public GaudiAlgorithm { /// Handle for the EDM Hits to be written DataHandle m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this}; // Handle to the detector ID descriptor - DD4hep::Geometry::IDDescriptor m_descriptor; + dd4hep::IDDescriptor m_descriptor; /// Name of the detector readout Gaudi::Property m_readoutName{this, "readout", "", "Name of the detector readout"}; /// Identifier to be merged diff --git a/Detector/DetComponents/src/RedoSegmentation.cpp b/Detector/DetComponents/src/RedoSegmentation.cpp index 62714f28a..b22163226 100644 --- a/Detector/DetComponents/src/RedoSegmentation.cpp +++ b/Detector/DetComponents/src/RedoSegmentation.cpp @@ -9,7 +9,7 @@ #include "datamodel/PositionedCaloHitCollection.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDSegmentation/Segmentation.h" DECLARE_ALGORITHM_FACTORY(RedoSegmentation) @@ -39,8 +39,7 @@ StatusCode RedoSegmentation::initialize() { return StatusCode::FAILURE; } // Take readout, bitfield from GeoSvc - m_oldDecoder = std::shared_ptr( - m_geoSvc->lcdd()->readout(m_oldReadoutName).idSpec().decoder()); + m_oldDecoder = m_geoSvc->lcdd()->readout(m_oldReadoutName).idSpec().decoder(); // segmentation identifiers to be overwritten if (m_oldIdentifiers.size() == 0) { // it is not an error, maybe no segmentation was used previously @@ -93,7 +92,7 @@ StatusCode RedoSegmentation::execute() { debug() << "OLD: " << m_oldDecoder->valueString() << endmsg; } // factor 10 to convert mm to cm - DD4hep::DDSegmentation::Vector3D position(hit.position().x / 10, hit.position().y / 10, hit.position().z / 10); + dd4hep::DDSegmentation::Vector3D position(hit.position().x / 10, hit.position().y / 10, hit.position().z / 10); // first calculate proper segmentation fields uint64_t newcellId = m_segmentation->cellID(position, position, volumeID(hit.cellId())); m_segmentation->decoder()->setValue(newcellId); @@ -111,7 +110,9 @@ StatusCode RedoSegmentation::execute() { return StatusCode::SUCCESS; } -StatusCode RedoSegmentation::finalize() { return GaudiAlgorithm::finalize(); } +StatusCode RedoSegmentation::finalize() { + info() << "RedoSegmentation finalize! " << endmsg; + return GaudiAlgorithm::finalize(); } uint64_t RedoSegmentation::volumeID(uint64_t aCellId) const { m_oldDecoder->setValue(aCellId); diff --git a/Detector/DetComponents/src/RedoSegmentation.h b/Detector/DetComponents/src/RedoSegmentation.h index 7fada6737..cf1238ba1 100644 --- a/Detector/DetComponents/src/RedoSegmentation.h +++ b/Detector/DetComponents/src/RedoSegmentation.h @@ -11,7 +11,7 @@ class IGeoSvc; // DD4hep #include "DD4hep/Readout.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class Segmentation; } @@ -68,14 +68,14 @@ class RedoSegmentation : public GaudiAlgorithm { /// Handle for the EDM hits to be written DataHandle m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this}; /// New segmentation - DD4hep::DDSegmentation::Segmentation* m_segmentation; + dd4hep::DDSegmentation::Segmentation* m_segmentation; /// Name of the detector readout used in simulation Gaudi::Property m_oldReadoutName{this, "oldReadoutName", "", "Name of the detector readout used in simulation"}; /// Name of the new detector readout Gaudi::Property m_newReadoutName{this, "newReadoutName", "", "Name of the new detector readout"}; /// Old bitfield decoder - std::shared_ptr m_oldDecoder; + dd4hep::DDSegmentation::BitField64* m_oldDecoder; /// Segmentation fields that are going to be replaced by the new segmentation Gaudi::Property> m_oldIdentifiers{ this, "oldSegmentationIds", {}, "Segmentation fields that are going to be replaced by the new segmentation"}; diff --git a/Detector/DetComponents/src/TrackingGeoSvc.h b/Detector/DetComponents/src/TrackingGeoSvc.h index e66a5c0c6..40b68e085 100644 --- a/Detector/DetComponents/src/TrackingGeoSvc.h +++ b/Detector/DetComponents/src/TrackingGeoSvc.h @@ -8,7 +8,7 @@ #include "GaudiKernel/Service.h" // DD4Hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // DetectorDescription #include "DetInterface/IGeoSvc.h" @@ -20,11 +20,9 @@ * @author julia.hrdinka@cern.ch */ -namespace DD4hep { -namespace Geometry { +namespace dd4hep { class DetElement; } -} namespace Acts { class TrackingGeometry; @@ -42,15 +40,15 @@ class TrackingGeoSvc : public extends1 { /// Finalize function virtual StatusCode finalize() override final; // receive DD4hep Geometry - virtual std::shared_ptr trackingGeometry() const; + virtual std::shared_ptr trackingGeometry() const; private: // Tracking Geometry - std::shared_ptr m_trackingGeo; + std::shared_ptr m_trackingGeo; /// Handle to the FCC geometry service ServiceHandle m_geoSvc; }; -inline std::shared_ptr TrackingGeoSvc::trackingGeometry() const { return m_trackingGeo; } +inline std::shared_ptr TrackingGeoSvc::trackingGeometry() const { return m_trackingGeo; } #endif // TRACKINGSVC_TRACKINGSVC_H diff --git a/Detector/DetComponents/tests/options/redoSegmentationXYZ.py b/Detector/DetComponents/tests/options/redoSegmentationXYZ.py index c3b6d32ee..13aff4df3 100644 --- a/Detector/DetComponents/tests/options/redoSegmentationXYZ.py +++ b/Detector/DetComponents/tests/options/redoSegmentationXYZ.py @@ -16,7 +16,7 @@ dumper.hepmc.Path="hepmc" from Configurables import GeoSvc -geoservice = GeoSvc("GeoSvc", detectors=['file:Test/TestGeometry/data/TestBoxCaloSD_3readouts.xml'], OutputLevel = DEBUG) +geoservice = GeoSvc("GeoSvc", detectors=['file:Test/TestGeometry/data/TestBoxCaloSD_3readouts.xml'], OutputLevel = INFO) from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc", physicslist='SimG4TestPhysicsList') @@ -48,6 +48,7 @@ ApplicationMgr(EvtSel='NONE', EvtMax=30, - TopAlg=[reader, hepmc_converter, geantsim, resegment, out], + TopAlg=[reader, hepmc_converter, geantsim, resegment, + out], ExtSvc = [podiosvc, geoservice, geantservice], OutputLevel=DEBUG) diff --git a/Detector/DetExtensions/CMakeLists.txt b/Detector/DetExtensions/CMakeLists.txt deleted file mode 100644 index 0bcddfc4d..000000000 --- a/Detector/DetExtensions/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -################################################################################ -# Package: DetExtensions -################################################################################ -gaudi_subdir(DetExtensions v1r0) - -gaudi_install_headers(DetExtensions) - - diff --git a/Detector/DetExtensions/DetExtensions/DetCylinderLayer.h b/Detector/DetExtensions/DetExtensions/DetCylinderLayer.h deleted file mode 100644 index 28b3e8a8f..000000000 --- a/Detector/DetExtensions/DetExtensions/DetCylinderLayer.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// DetCylinderLayer.h -// -// -// Created by Julia Hrdinka on 12/12/14. -// -// - -#ifndef DET_DETCYLINDERLAYER_H -#define DET_DETCYLINDERLAYER_H - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetCylinderLayer : public IDetExtension { - -public: - DetCylinderLayer() {} - - DetCylinderLayer(const DetCylinderLayer&, const DD4hep::Geometry::DetElement&) {} - - virtual ~DetCylinderLayer() {} - - virtual ExtensionType type() { return ExtensionType::CylinderLayer; } -}; -} - -#endif // DET_DETCYLINDERLAYER_H diff --git a/Detector/DetExtensions/DetExtensions/DetCylinderVolume.h b/Detector/DetExtensions/DetExtensions/DetCylinderVolume.h deleted file mode 100644 index 49d5b65b5..000000000 --- a/Detector/DetExtensions/DetExtensions/DetCylinderVolume.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// DetCylinderVolume.h -// -// -// Created by Julia Hrdinka on 19/01/15. -// -// - -#ifndef DET_DETCYLINDERVOLUME_H -#define DET_DETCYLINDERVOLUME_H - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetCylinderVolume : public IDetExtension { - -public: - explicit DetCylinderVolume(int status) : m_status(status) {} - DetCylinderVolume(const DetCylinderVolume& volume, const DD4hep::Geometry::DetElement&) { - m_status = volume.m_status; - } - virtual ~DetCylinderVolume() {} - int status() { return m_status; } - virtual ExtensionType type() { return ExtensionType::CylinderVolume; } - -private: - int m_status; -}; -} - -#endif // DET_DETCYLINDERVOLUME_H diff --git a/Detector/DetExtensions/DetExtensions/DetDiscLayer.h b/Detector/DetExtensions/DetExtensions/DetDiscLayer.h deleted file mode 100644 index e4548a418..000000000 --- a/Detector/DetExtensions/DetExtensions/DetDiscLayer.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// DetDiscLayer.h -// -// -// Created by Julia Hrdinka on 07/01/15. -// -// - -#ifndef DET_DETDISCLAYER -#define DET_DETDISCLAYER - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetDiscLayer : public IDetExtension { - -public: - DetDiscLayer() {} - - DetDiscLayer(const DetDiscLayer&, const DD4hep::Geometry::DetElement&) {} - - virtual ~DetDiscLayer() {} - - virtual ExtensionType type() { return ExtensionType::DiscLayer; } -}; -} - -#endif // DET_DETDISCLAYER diff --git a/Detector/DetExtensions/DetExtensions/DetDiscVolume.h b/Detector/DetExtensions/DetExtensions/DetDiscVolume.h deleted file mode 100644 index 2326e3eda..000000000 --- a/Detector/DetExtensions/DetExtensions/DetDiscVolume.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// DetDiscVolume.h -// -// -// Created by Julia Hrdinka on 19/01/15. -// -// - -#ifndef DET_DETDISCVOLUME_H -#define DET_DETDISCVOLUME_H - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetDiscVolume : public IDetExtension { - -public: - explicit DetDiscVolume(int status) : m_status(status) {} - DetDiscVolume(const DetDiscVolume& volume, const DD4hep::Geometry::DetElement&) { m_status = volume.m_status; } - virtual ~DetDiscVolume() {} - int status() { return m_status; } - virtual ExtensionType type() { return ExtensionType::DiscVolume; } - -private: - int m_status; -}; -} - -#endif // DET_DETDISCVOLUME_H diff --git a/Detector/DetExtensions/DetExtensions/DetExtension.h b/Detector/DetExtensions/DetExtensions/DetExtension.h deleted file mode 100644 index 402d57796..000000000 --- a/Detector/DetExtensions/DetExtensions/DetExtension.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// DetExtension.h -// -// -// Created by Julia Hrdinka on 12/12/14. -// -// - -#ifndef DET_DETEXTENSION_H -#define DET_DETEXTENSION_H - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetExtension : public IDetExtension { - -public: - DetExtension() {} - DetExtension(const DetExtension&, const DD4hep::Geometry::DetElement&) {} - virtual ~DetExtension() {} - virtual ExtensionType type() { return ExtensionType::None; } -}; -} -#endif // DET_DETEXTENSION_H diff --git a/Detector/DetExtensions/DetExtensions/DetModule.h b/Detector/DetExtensions/DetExtensions/DetModule.h deleted file mode 100644 index 002a7ebc3..000000000 --- a/Detector/DetExtensions/DetExtensions/DetModule.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// DetModule.h -// -// -// Created by Julia Hrdinka on 16/12/14. -// -// - -#ifndef DET_DETMODULE_H -#define DET_DETMODULE_H - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetModule : public IDetExtension { - -public: - DetModule() {} - - DetModule(const DetModule&, const DD4hep::Geometry::DetElement&) {} - - virtual ~DetModule() {} - - virtual ExtensionType type() { return ExtensionType::Module; } -}; -} -#endif // DET_MODULE_H diff --git a/Detector/DetExtensions/DetExtensions/DetSensComponent.h b/Detector/DetExtensions/DetExtensions/DetSensComponent.h deleted file mode 100644 index 30e27c8ac..000000000 --- a/Detector/DetExtensions/DetExtensions/DetSensComponent.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// DetSensComponent.h -// -// -// Created by Julia Hrdinka on 15/06/15. -// -// - -#ifndef DET_DETSENSCOMPONENT_H -#define DET_DETSENSCOMPONENT_H - -#include "DetExtensions/IDetExtension.h" -#include - -namespace DD4hep { -namespace Geometry { -class DetElement; -class Segmentation; -} -} - -namespace Det { - -class DetSensComponent : public IDetExtension { - -public: - explicit DetSensComponent(const DD4hep::Geometry::Segmentation segmentation) : m_segmentation(segmentation) {} - DetSensComponent(const DetSensComponent&, const DD4hep::Geometry::DetElement&) {} - virtual ~DetSensComponent() {} - const DD4hep::Geometry::Segmentation segmentation() { return (m_segmentation); } - virtual ExtensionType type() { return ExtensionType::SensComponent; } - -private: - const DD4hep::Geometry::Segmentation m_segmentation; -}; -} - -#endif // DET_DETSENSCOMPONENT_H diff --git a/Detector/DetExtensions/DetExtensions/DiscLayer.h b/Detector/DetExtensions/DetExtensions/DiscLayer.h deleted file mode 100644 index 94ef962b3..000000000 --- a/Detector/DetExtensions/DetExtensions/DiscLayer.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// DetDiscLayer.h -// -// -// Created by Julia Hrdinka on 07/01/15. -// -// - -#ifndef DET_DETDISCLAYER -#define DET_DETDISCLAYER - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetDiscLayer : public IDetExtension { - -public: - DetDiscLayer() {} - - DetDiscLayer(const DetDiscLayer&, const DD4hep::Geometry::DetElement&) {} - - virtual ~DetDiscLayer() {} -}; -} - -#endif // DET_DETDISCLAYER diff --git a/Detector/DetExtensions/DetExtensions/Extension.h b/Detector/DetExtensions/DetExtensions/Extension.h deleted file mode 100644 index 2c954e6ea..000000000 --- a/Detector/DetExtensions/DetExtensions/Extension.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// Extension.h -// -// -// Created by Julia Hrdinka on 12/12/14. -// -// - -#ifndef DET_DETEXTENSION_H -#define DET_DETEXTENSION_H - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetExtension : public IDetExtension { - -public: - DetExtension() {} - DetExtension(const DetExtension&, const DD4hep::Geometry::DetElement&) {} - virtual ~DetExtension() {} -}; -} -#endif // DET_DETEXTENSION_H diff --git a/Detector/DetExtensions/DetExtensions/IDetExtension.h b/Detector/DetExtensions/DetExtensions/IDetExtension.h deleted file mode 100644 index 7fdd70917..000000000 --- a/Detector/DetExtensions/DetExtensions/IDetExtension.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// IExtension.h -// -// -// Created by Julia Hrdinka on 12/12/14. -// -// - -#ifndef DET_IDETEXTENSION_H -#define DET_IDETEXTENSION_H - -namespace Det { - -enum ExtensionType { - - None = 0, - CylinderVolume = 1, - DiscVolume = 2, - CylinderLayer = 3, - DiscLayer = 4, - Module = 5, - SensComponent = 6 -}; - -class IDetExtension { - -public: - virtual ~IDetExtension() {} - virtual ExtensionType type() = 0; - -protected: - IDetExtension() {} -}; -} - -#endif // DET_IDETEXTENSION_H diff --git a/Detector/DetExtensions/DetExtensions/Module.h b/Detector/DetExtensions/DetExtensions/Module.h deleted file mode 100644 index df67ecde0..000000000 --- a/Detector/DetExtensions/DetExtensions/Module.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// DetModule.h -// -// -// Created by Julia Hrdinka on 16/12/14. -// -// - -#ifndef DET_DETMODULE_H -#define DET_DETMODULE_H - -#include "DetExtensions/IDetExtension.h" - -namespace DD4hep { -namespace Geometry { -class DetElement; -} -} - -namespace Det { - -class DetModule : public IDetExtension { - -public: - DetModule() {} - - DetModule(const DetModule&, const DD4hep::Geometry::DetElement&) {} - - virtual ~DetModule() {} -}; -} -#endif // DET_MODULE_H diff --git a/Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo.xml b/Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo.xml index 14b386473..f7b0b841a 100644 --- a/Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo.xml +++ b/Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo.xml @@ -60,11 +60,11 @@ - + system:4,subsystem:1,type:3,subtype:3,layer:8,eta:10,phi:10 - + system:4,subsystem:1,type:3,subtype:3,layer:8,eta:10,phi:10 diff --git a/Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo_calibration.xml b/Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo_calibration.xml index 993045b1b..6fd62dce8 100644 --- a/Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo_calibration.xml +++ b/Detector/DetFCChhCalDiscs/compact/Endcaps_coneCryo_calibration.xml @@ -60,11 +60,11 @@ - + system:4,subsystem:1,type:3,subtype:3,layer:8,eta:10,phi:10 - + system:4,subsystem:1,type:3,subtype:3,layer:8,eta:10,phi:10 diff --git a/Detector/DetFCChhCalDiscs/compact/Forward_coneCryo.xml b/Detector/DetFCChhCalDiscs/compact/Forward_coneCryo.xml index 151a959cf..4a898b528 100644 --- a/Detector/DetFCChhCalDiscs/compact/Forward_coneCryo.xml +++ b/Detector/DetFCChhCalDiscs/compact/Forward_coneCryo.xml @@ -57,11 +57,11 @@ - + system:4,subsystem:1,type:3,subtype:3,layer:8,eta:11,phi:10 - + system:4,subsystem:1,type:3,subtype:3,layer:8,eta:11,phi:10 diff --git a/Detector/DetFCChhCalDiscs/compact/Forward_coneCryo_calibration.xml b/Detector/DetFCChhCalDiscs/compact/Forward_coneCryo_calibration.xml index 4ec2fd0d8..0d4574ca6 100644 --- a/Detector/DetFCChhCalDiscs/compact/Forward_coneCryo_calibration.xml +++ b/Detector/DetFCChhCalDiscs/compact/Forward_coneCryo_calibration.xml @@ -57,11 +57,11 @@ - + system:4,subsystem:1,type:3,subtype:3,layer:8,eta:11,phi:10 - + system:4,subsystem:1,type:3,subtype:3,layer:8,eta:11,phi:10 diff --git a/Detector/DetFCChhCalDiscs/src/CaloEndcapDiscs_geo.cpp b/Detector/DetFCChhCalDiscs/src/CaloEndcapDiscs_geo.cpp index 0300be5eb..55276de8e 100644 --- a/Detector/DetFCChhCalDiscs/src/CaloEndcapDiscs_geo.cpp +++ b/Detector/DetFCChhCalDiscs/src/CaloEndcapDiscs_geo.cpp @@ -6,23 +6,23 @@ #include "GaudiKernel/ServiceHandle.h" namespace det { -void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::SensitiveDetector& aSensDet, - DD4hep::Geometry::Volume& aEnvelope, DD4hep::XML::Handle_t& aXmlElement, int sign) { +void buildOneSide(MsgStream& lLog, dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, + dd4hep::Volume& aEnvelope, dd4hep::xml::Handle_t& aXmlElement, int sign) { - DD4hep::XML::Dimension dim(aXmlElement.child(_Unicode(dimensions))); + dd4hep::xml::Dimension dim(aXmlElement.child(_Unicode(dimensions))); - DD4hep::XML::DetElement active = aXmlElement.child(_Unicode(active)); + dd4hep::xml::DetElement active = aXmlElement.child(_Unicode(active)); std::string activeMaterial = active.materialStr(); double activeThickness = active.thickness(); - DD4hep::XML::DetElement readout = aXmlElement.child(_Unicode(readout)); + dd4hep::xml::DetElement readout = aXmlElement.child(_Unicode(readout)); std::string readoutMaterial = readout.materialStr(); double readoutThickness = readout.thickness(); - DD4hep::XML::DetElement passive = aXmlElement.child(_Unicode(passive)); - DD4hep::XML::DetElement passiveInner = passive.child(_Unicode(inner)); - DD4hep::XML::DetElement passiveOuter = passive.child(_Unicode(outer)); - DD4hep::XML::DetElement passiveGlue = passive.child(_Unicode(glue)); + dd4hep::xml::DetElement passive = aXmlElement.child(_Unicode(passive)); + dd4hep::xml::DetElement passiveInner = passive.child(_Unicode(inner)); + dd4hep::xml::DetElement passiveOuter = passive.child(_Unicode(outer)); + dd4hep::xml::DetElement passiveGlue = passive.child(_Unicode(glue)); double passiveInnerThickness = passiveInner.thickness(); double passiveOuterThickness = passiveOuter.thickness(); double passiveGlueThickness = passiveGlue.thickness(); @@ -37,8 +37,8 @@ void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geomet passiveMaterial = passiveInnerMaterial; } - DD4hep::Geometry::SensitiveDetector sensDet = aSensDet; - DD4hep::XML::Dimension sensDetType = aXmlElement.child(_U(sensitive)); + dd4hep::SensitiveDetector sensDet = aSensDet; + dd4hep::xml::Dimension sensDetType = aXmlElement.child(_U(sensitive)); sensDet.setType(sensDetType.typeStr()); lLog << MSG::INFO << " rmin (cm) = " << dim.rmin1() << " rmin (cm) = " << dim.rmin2() << " rmax (cm) = " << dim.rmax() << " length (cm) = " << dim.dz() << " Sensitive volume of type: " << sensDetType.typeStr() << endmsg; @@ -70,23 +70,23 @@ void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geomet (marginOutside + readoutThickness + activeThickness / 2.) * tanTheta; // for first readout position double dR1 = passiveThickness * tanTheta; // between readout and passive double dR2 = (activeThickness + readoutThickness + passiveThickness) * tanTheta; // between two readout discs - DD4hep::Geometry::Tube readoutShapePre(nonAbsorberRmin, rMax, readoutThickness / 2.); - DD4hep::Geometry::Tube activeShapePre(nonAbsorberRmin, rMax, activeThickness / 4.); - DD4hep::Geometry::Volume readoutVolPre("readoutPre", readoutShapePre, aLcdd.material(readoutMaterial)); + dd4hep::Tube readoutShapePre(nonAbsorberRmin, rMax, readoutThickness / 2.); + dd4hep::Tube activeShapePre(nonAbsorberRmin, rMax, activeThickness / 4.); + dd4hep::Volume readoutVolPre("readoutPre", readoutShapePre, aLcdd.material(readoutMaterial)); if (readout.isSensitive()) { lLog << MSG::INFO << "Readout volume set as sensitive" << endmsg; readoutVolPre.setSensitiveDetector(aSensDet); } - DD4hep::Geometry::Volume activeVolPre("activePre", activeShapePre, aLcdd.material(activeMaterial)); + dd4hep::Volume activeVolPre("activePre", activeShapePre, aLcdd.material(activeMaterial)); activeVolPre.setSensitiveDetector(sensDet); - DD4hep::Geometry::PlacedVolume readoutPhysVolPre = - aEnvelope.placeVolume(readoutVolPre, DD4hep::Geometry::Position(0, 0, zOffset)); + dd4hep::PlacedVolume readoutPhysVolPre = + aEnvelope.placeVolume(readoutVolPre, dd4hep::Position(0, 0, zOffset)); readoutPhysVolPre.addPhysVolID("layer", 0); readoutPhysVolPre.addPhysVolID("type", 2); // 0 = active, 1 = passive, 2 = readout - std::vector activePhysVols; + std::vector activePhysVols; activePhysVols.reserve(numDiscs * 2); activePhysVols.push_back(aEnvelope.placeVolume( - activeVolPre, DD4hep::Geometry::Position(0, 0, zOffset + sign * (readoutThickness / 2. + activeThickness / 4.)))); + activeVolPre, dd4hep::Position(0, 0, zOffset + sign * (readoutThickness / 2. + activeThickness / 4.)))); lLog << MSG::DEBUG << "Placing first readout at " << zOffset << " and active at z= " << zOffset + sign * (activeThickness / 4. + readoutThickness / 2.) << endmsg; // Now place complete sets of discs: absorber|active|readout|active @@ -95,14 +95,14 @@ void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geomet for (uint iDiscs = 0; iDiscs < numDiscs - 1; iDiscs++) { nonAbsorberRmin += dR2; // readout and active discs have the same radius, but different thickness - DD4hep::Geometry::Tube activeShapeBeforeSubtraction(nonAbsorberRmin, rMax, + dd4hep::Tube activeShapeBeforeSubtraction(nonAbsorberRmin, rMax, activeThickness / 2. + readoutThickness / 2.); - DD4hep::Geometry::Tube readoutShape(nonAbsorberRmin, rMax, readoutThickness / 2.); - DD4hep::Geometry::SubtractionSolid activeShape(activeShapeBeforeSubtraction, readoutShape); - DD4hep::Geometry::Tube passiveShape(nonAbsorberRmin + dR1, rMax, passiveThickness / 2.); - DD4hep::Geometry::Volume activeVol("active", activeShape, aLcdd.material(activeMaterial)); - DD4hep::Geometry::Volume readoutVol("readout", readoutShape, aLcdd.material(readoutMaterial)); - DD4hep::Geometry::Volume passiveVol("passive", passiveShape, aLcdd.material(passiveMaterial)); + dd4hep::Tube readoutShape(nonAbsorberRmin, rMax, readoutThickness / 2.); + dd4hep::SubtractionSolid activeShape(activeShapeBeforeSubtraction, readoutShape); + dd4hep::Tube passiveShape(nonAbsorberRmin + dR1, rMax, passiveThickness / 2.); + dd4hep::Volume activeVol("active", activeShape, aLcdd.material(activeMaterial)); + dd4hep::Volume readoutVol("readout", readoutShape, aLcdd.material(readoutMaterial)); + dd4hep::Volume passiveVol("passive", passiveShape, aLcdd.material(passiveMaterial)); activeVol.setSensitiveDetector(sensDet); if (readout.isSensitive()) { lLog << MSG::DEBUG << "Readout volume set as sensitive" << endmsg; @@ -111,15 +111,15 @@ void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geomet // absorber may consist of inner and outer material if (passiveInnerThickness < passiveThickness) { // create shapes - DD4hep::Geometry::Tube passiveInnerShape(nonAbsorberRmin + dR1, rMax, passiveInnerThickness / 2.); - DD4hep::Geometry::Tube passiveGlueShape(nonAbsorberRmin + dR1, rMax, passiveGlueThickness / 4.); - DD4hep::Geometry::Tube passiveOuterShape(nonAbsorberRmin + dR1, rMax, passiveOuterThickness / 4.); + dd4hep::Tube passiveInnerShape(nonAbsorberRmin + dR1, rMax, passiveInnerThickness / 2.); + dd4hep::Tube passiveGlueShape(nonAbsorberRmin + dR1, rMax, passiveGlueThickness / 4.); + dd4hep::Tube passiveOuterShape(nonAbsorberRmin + dR1, rMax, passiveOuterThickness / 4.); // create volumes - DD4hep::Geometry::Volume passiveInnerVol(passiveInnerMaterial + "_passive", passiveInnerShape, + dd4hep::Volume passiveInnerVol(passiveInnerMaterial + "_passive", passiveInnerShape, aLcdd.material(passiveInnerMaterial)); - DD4hep::Geometry::Volume passiveOuterVol(passiveOuterMaterial + "_passive", passiveOuterShape, + dd4hep::Volume passiveOuterVol(passiveOuterMaterial + "_passive", passiveOuterShape, aLcdd.material(passiveOuterMaterial)); - DD4hep::Geometry::Volume passiveGlueVol(passiveGlueMaterial + "_passive", passiveGlueShape, + dd4hep::Volume passiveGlueVol(passiveGlueMaterial + "_passive", passiveGlueShape, aLcdd.material(passiveGlueMaterial)); if (passive.isSensitive()) { lLog << MSG::INFO << "Passive volumes (inner, outer, glue) set as sensitive" << endmsg; @@ -128,20 +128,20 @@ void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geomet passiveGlueVol.setSensitiveDetector(aSensDet); } // place volumes - DD4hep::Geometry::PlacedVolume passiveInnerPhysVol = - passiveVol.placeVolume(passiveInnerVol, DD4hep::Geometry::Position(0, 0, 0)); - DD4hep::Geometry::PlacedVolume passiveOuterPhysVolBelow = passiveVol.placeVolume( + dd4hep::PlacedVolume passiveInnerPhysVol = + passiveVol.placeVolume(passiveInnerVol, dd4hep::Position(0, 0, 0)); + dd4hep::PlacedVolume passiveOuterPhysVolBelow = passiveVol.placeVolume( passiveOuterVol, - DD4hep::Geometry::Position(0, 0, passiveInnerThickness / 2. + passiveGlueThickness / 2. + + dd4hep::Position(0, 0, passiveInnerThickness / 2. + passiveGlueThickness / 2. + passiveOuterThickness / 4.)); - DD4hep::Geometry::PlacedVolume passiveOuterPhysVolAbove = passiveVol.placeVolume( + dd4hep::PlacedVolume passiveOuterPhysVolAbove = passiveVol.placeVolume( passiveOuterVol, - DD4hep::Geometry::Position(0, 0, -passiveInnerThickness / 2. - passiveGlueThickness / 2. - + dd4hep::Position(0, 0, -passiveInnerThickness / 2. - passiveGlueThickness / 2. - passiveOuterThickness / 4.)); - DD4hep::Geometry::PlacedVolume passiveGluePhysVolBelow = passiveVol.placeVolume( - passiveGlueVol, DD4hep::Geometry::Position(0, 0, -passiveInnerThickness / 2. - passiveGlueThickness / 4.)); - DD4hep::Geometry::PlacedVolume passiveGluePhysVolAbove = passiveVol.placeVolume( - passiveGlueVol, DD4hep::Geometry::Position(0, 0, passiveInnerThickness / 2. + passiveGlueThickness / 4.)); + dd4hep::PlacedVolume passiveGluePhysVolBelow = passiveVol.placeVolume( + passiveGlueVol, dd4hep::Position(0, 0, -passiveInnerThickness / 2. - passiveGlueThickness / 4.)); + dd4hep::PlacedVolume passiveGluePhysVolAbove = passiveVol.placeVolume( + passiveGlueVol, dd4hep::Position(0, 0, passiveInnerThickness / 2. + passiveGlueThickness / 4.)); passiveInnerPhysVol.addPhysVolID("subtype", 0); passiveOuterPhysVolBelow.addPhysVolID("subtype", 1); passiveOuterPhysVolAbove.addPhysVolID("subtype", 2); @@ -151,19 +151,19 @@ void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geomet lLog << MSG::INFO << "Passive volume set as sensitive" << endmsg; passiveVol.setSensitiveDetector(aSensDet); } - DD4hep::Geometry::PlacedVolume passivePhysVol = - aEnvelope.placeVolume(passiveVol, DD4hep::Geometry::Position(0, 0, zOffset)); + dd4hep::PlacedVolume passivePhysVol = + aEnvelope.placeVolume(passiveVol, dd4hep::Position(0, 0, zOffset)); passivePhysVol.addPhysVolID("layer", iDiscs); passivePhysVol.addPhysVolID("type", 1); // 0 = active, 1 = passive, 2 = readout - DD4hep::Geometry::PlacedVolume readoutPhysVol = aEnvelope.placeVolume( + dd4hep::PlacedVolume readoutPhysVol = aEnvelope.placeVolume( readoutVol, - DD4hep::Geometry::Position(0, 0, zOffset + + dd4hep::Position(0, 0, zOffset + sign * (passiveThickness / 2. + activeThickness / 2. + readoutThickness / 2.))); readoutPhysVol.addPhysVolID("layer", iDiscs + 1); // +1 because first readout is placed before that loop readoutPhysVol.addPhysVolID("type", 2); // 0 = active, 1 = passive, 2 = readout activePhysVols.push_back(aEnvelope.placeVolume( activeVol, - DD4hep::Geometry::Position(0, 0, zOffset + + dd4hep::Position(0, 0, zOffset + sign * (passiveThickness / 2. + activeThickness / 2. + readoutThickness / 2.)))); lLog << MSG::DEBUG << "Placing passive at z= " << zOffset << " readout at z= " << zOffset + sign * (passiveThickness / 2. + activeThickness / 2. + readoutThickness / 2.) @@ -172,8 +172,8 @@ void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geomet zOffset += sign * (readoutThickness + activeThickness + passiveThickness); if (iDiscs == numDiscs - 2) { // finish detector with the last disc of abosrber (for GND layer) - DD4hep::Geometry::PlacedVolume passivePhysVolPost = - aEnvelope.placeVolume(passiveVol, DD4hep::Geometry::Position(0, 0, zOffset)); + dd4hep::PlacedVolume passivePhysVolPost = + aEnvelope.placeVolume(passiveVol, dd4hep::Position(0, 0, zOffset)); passivePhysVolPost.addPhysVolID("layer", iDiscs + 1); passivePhysVolPost.addPhysVolID("type", 1); // 0 = active, 1 = passive, 2 = readout lLog << MSG::DEBUG << "Placing last passive disc at z= " << zOffset << endmsg; @@ -186,26 +186,26 @@ void buildOneSide(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geomet return; } -static DD4hep::Geometry::Ref_t createCaloDiscs(DD4hep::Geometry::LCDD& aLcdd, - DD4hep::XML::Handle_t aXmlElement, - DD4hep::Geometry::SensitiveDetector aSensDet) { +static dd4hep::Ref_t createCaloDiscs(dd4hep::Detector& aLcdd, + dd4hep::xml::Handle_t aXmlElement, + dd4hep::SensitiveDetector aSensDet) { ServiceHandle msgSvc("MessageSvc", "CalDiscsConstruction"); MsgStream lLog(&(*msgSvc), "CalDiscsConstruction"); - DD4hep::XML::DetElement xmlDetElem = aXmlElement; + dd4hep::xml::DetElement xmlDetElem = aXmlElement; std::string nameDet = xmlDetElem.nameStr(); int idDet = xmlDetElem.id(); - DD4hep::XML::Dimension dim(xmlDetElem.dimensions()); - DD4hep::Geometry::DetElement caloDetElem(nameDet, idDet); + dd4hep::xml::Dimension dim(xmlDetElem.dimensions()); + dd4hep::DetElement caloDetElem(nameDet, idDet); // Create air envelope for the whole endcap - DD4hep::Geometry::Cone envelopePositive(dim.dz(), dim.rmin1(), dim.rmax(), dim.rmin2(), dim.rmax()); - DD4hep::Geometry::Cone envelopeNegative(dim.dz(), dim.rmin2(), dim.rmax(), dim.rmin1(), dim.rmax()); - DD4hep::Geometry::UnionSolid envelopeShape(envelopePositive, envelopeNegative, - DD4hep::Geometry::Position(0, 0, -2 * dim.z_offset())); - DD4hep::Geometry::Volume envelopeVol(nameDet + "_vol", envelopeShape, aLcdd.material("Air")); - DD4hep::Geometry::Volume envelopePositiveVol(nameDet + "_positive_vol", envelopePositive, aLcdd.material("Air")); - DD4hep::Geometry::Volume envelopeNegativeVol(nameDet + "_negative_vol", envelopeNegative, aLcdd.material("Air")); + dd4hep::Cone envelopePositive(dim.dz(), dim.rmin1(), dim.rmax(), dim.rmin2(), dim.rmax()); + dd4hep::Cone envelopeNegative(dim.dz(), dim.rmin2(), dim.rmax(), dim.rmin1(), dim.rmax()); + dd4hep::UnionSolid envelopeShape(envelopePositive, envelopeNegative, + dd4hep::Position(0, 0, -2 * dim.z_offset())); + dd4hep::Volume envelopeVol(nameDet + "_vol", envelopeShape, aLcdd.material("Air")); + dd4hep::Volume envelopePositiveVol(nameDet + "_positive_vol", envelopePositive, aLcdd.material("Air")); + dd4hep::Volume envelopeNegativeVol(nameDet + "_negative_vol", envelopeNegative, aLcdd.material("Air")); lLog << MSG::DEBUG << "Placing dector on the positive side: (cm) " << dim.z_offset() << endmsg; buildOneSide(lLog, aLcdd, aSensDet, envelopePositiveVol, aXmlElement, 1); @@ -213,18 +213,18 @@ static DD4hep::Geometry::Ref_t createCaloDiscs(DD4hep::Geometry::LCDD& aLcdd, buildOneSide(lLog, aLcdd, aSensDet, envelopeNegativeVol, aXmlElement, -1); // Place the envelope - DD4hep::Geometry::PlacedVolume envelopePositivePhysVol = envelopeVol.placeVolume(envelopePositiveVol); + dd4hep::PlacedVolume envelopePositivePhysVol = envelopeVol.placeVolume(envelopePositiveVol); envelopePositivePhysVol.addPhysVolID("subsystem", 0); - DD4hep::Geometry::DetElement caloPositiveDetElem(caloDetElem, "positive", 0); + dd4hep::DetElement caloPositiveDetElem(caloDetElem, "positive", 0); caloPositiveDetElem.setPlacement(envelopePositivePhysVol); - DD4hep::Geometry::PlacedVolume envelopeNegativePhysVol = - envelopeVol.placeVolume(envelopeNegativeVol, DD4hep::Geometry::Position(0, 0, -2 * dim.z_offset())); + dd4hep::PlacedVolume envelopeNegativePhysVol = + envelopeVol.placeVolume(envelopeNegativeVol, dd4hep::Position(0, 0, -2 * dim.z_offset())); envelopeNegativePhysVol.addPhysVolID("subsystem", 1); - DD4hep::Geometry::DetElement caloNegativeDetElem(caloDetElem, "negative", 0); + dd4hep::DetElement caloNegativeDetElem(caloDetElem, "negative", 0); caloNegativeDetElem.setPlacement(envelopeNegativePhysVol); - DD4hep::Geometry::Volume motherVol = aLcdd.pickMotherVolume(caloDetElem); - DD4hep::Geometry::PlacedVolume envelopePhysVol = - motherVol.placeVolume(envelopeVol, DD4hep::Geometry::Position(0., 0., dim.z_offset())); + dd4hep::Volume motherVol = aLcdd.pickMotherVolume(caloDetElem); + dd4hep::PlacedVolume envelopePhysVol = + motherVol.placeVolume(envelopeVol, dd4hep::Position(0., 0., dim.z_offset())); caloDetElem.setPlacement(envelopePhysVol); envelopePhysVol.addPhysVolID("system", idDet); return caloDetElem; diff --git a/Detector/DetFCChhECalInclined/CMakeLists.txt b/Detector/DetFCChhECalInclined/CMakeLists.txt index 9940a2675..fe8598684 100644 --- a/Detector/DetFCChhECalInclined/CMakeLists.txt +++ b/Detector/DetFCChhECalInclined/CMakeLists.txt @@ -12,7 +12,7 @@ include( DD4hep ) find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) -include_directories(SYSTEM ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}) +#include_directories(BEFORE SYSTEM ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}) install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetFCChhECalInclined) diff --git a/Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_Common.xml b/Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_Common.xml index 53d8f1e5f..1ee025233 100644 --- a/Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_Common.xml +++ b/Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_Common.xml @@ -59,7 +59,7 @@ - + system:4,cryo:1,type:3,subtype:3,layer:8,eta:9,phi:10 diff --git a/Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_Common_calibration.xml b/Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_Common_calibration.xml index c4602351a..f51c38234 100644 --- a/Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_Common_calibration.xml +++ b/Detector/DetFCChhECalInclined/compact/FCChh_ECalBarrel_Common_calibration.xml @@ -59,7 +59,7 @@ - + system:4,cryo:1,type:3,subtype:3,layer:8,eta:9,phi:10 diff --git a/Detector/DetFCChhECalInclined/src/ECalBarrelInclined_geo.cpp b/Detector/DetFCChhECalInclined/src/ECalBarrelInclined_geo.cpp index c59c234aa..dd6e2f9e3 100644 --- a/Detector/DetFCChhECalInclined/src/ECalBarrelInclined_geo.cpp +++ b/Detector/DetFCChhECalInclined/src/ECalBarrelInclined_geo.cpp @@ -1,4 +1,5 @@ #include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Handle.h" // Gaudi #include "GaudiKernel/IIncidentSvc.h" @@ -8,48 +9,48 @@ #include "GaudiKernel/ServiceHandle.h" namespace det { -static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& aLcdd, - DD4hep::XML::Handle_t aXmlElement, - DD4hep::Geometry::SensitiveDetector aSensDet) { +static dd4hep::detail::Ref_t createECalBarrelInclined(dd4hep::Detector& aLcdd, + dd4hep::xml::Handle_t aXmlElement, + dd4hep::SensitiveDetector aSensDet) { ServiceHandle msgSvc("MessageSvc", "ECalConstruction"); MsgStream lLog(&(*msgSvc), "ECalConstruction"); - DD4hep::XML::DetElement xmlDetElem = aXmlElement; + dd4hep::xml::DetElement xmlDetElem = aXmlElement; std::string nameDet = xmlDetElem.nameStr(); - DD4hep::XML::Dimension dim(xmlDetElem.dimensions()); - DD4hep::Geometry::DetElement caloDetElem(nameDet, xmlDetElem.id()); + dd4hep::xml::Dimension dim(xmlDetElem.dimensions()); + dd4hep::DetElement caloDetElem(nameDet, xmlDetElem.id()); // Create air envelope for the whole barrel - DD4hep::Geometry::Volume envelopeVol(nameDet + "_vol", DD4hep::Geometry::Tube(dim.rmin(), dim.rmax(), dim.dz()), + dd4hep::Volume envelopeVol(nameDet + "_vol", dd4hep::Tube(dim.rmin(), dim.rmax(), dim.dz()), aLcdd.material("Air")); envelopeVol.setVisAttributes(aLcdd, dim.visStr()); // Retrieve cryostat data - DD4hep::XML::DetElement cryostat = aXmlElement.child(_Unicode(cryostat)); - DD4hep::XML::Dimension cryoDim(cryostat.dimensions()); + dd4hep::xml::DetElement cryostat = aXmlElement.child(_Unicode(cryostat)); + dd4hep::xml::Dimension cryoDim(cryostat.dimensions()); double cryoThicknessFront = cryoDim.rmin2() - cryoDim.rmin1(); double cryoThicknessBack = cryoDim.rmax2() - cryoDim.rmax1(); // Retrieve active and passive material data - DD4hep::XML::DetElement calo = aXmlElement.child(_Unicode(calorimeter)); - DD4hep::XML::Dimension caloDim(calo.dimensions()); - DD4hep::XML::DetElement active = calo.child(_Unicode(active)); + dd4hep::xml::DetElement calo = aXmlElement.child(_Unicode(calorimeter)); + dd4hep::xml::Dimension caloDim(calo.dimensions()); + dd4hep::xml::DetElement active = calo.child(_Unicode(active)); std::string activeMaterial = active.materialStr(); double activeThickness = active.thickness(); - DD4hep::XML::DetElement overlap = active.child(_Unicode(overlap)); + dd4hep::xml::DetElement overlap = active.child(_Unicode(overlap)); double activePassiveOverlap = overlap.offset(); if (activePassiveOverlap < 0 || activePassiveOverlap > 0.5) { ServiceHandle incidentSvc("IncidentSvc", "ECalConstruction"); lLog << MSG::ERROR << "Overlap between active and passive cannot be more than half of passive plane!" << endmsg; incidentSvc->fireIncident(Incident("ECalConstruction", "GeometryFailure")); } - DD4hep::XML::DetElement layers = calo.child(_Unicode(layers)); + dd4hep::xml::DetElement layers = calo.child(_Unicode(layers)); uint numLayers = 0; std::vector layerHeight; double layersTotalHeight = 0; - for (DD4hep::XML::Collection_t layer_coll(layers, _Unicode(layer)); layer_coll; ++layer_coll) { - DD4hep::XML::Component layer = layer_coll; + for (dd4hep::xml::Collection_t layer_coll(layers, _Unicode(layer)); layer_coll; ++layer_coll) { + dd4hep::xml::Component layer = layer_coll; numLayers += layer.repeat(); for (int iLay = 0; iLay < layer.repeat(); iLay++) { layerHeight.push_back(layer.thickness()); @@ -58,14 +59,14 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& } lLog << MSG::DEBUG << "Number of layers: " << numLayers << " total thickness " << layersTotalHeight << endmsg; - DD4hep::XML::DetElement readout = calo.child(_Unicode(readout)); + dd4hep::xml::DetElement readout = calo.child(_Unicode(readout)); std::string readoutMaterial = readout.materialStr(); double readoutThickness = readout.thickness(); - DD4hep::XML::DetElement passive = calo.child(_Unicode(passive)); - DD4hep::XML::DetElement passiveInner = passive.child(_Unicode(inner)); - DD4hep::XML::DetElement passiveOuter = passive.child(_Unicode(outer)); - DD4hep::XML::DetElement passiveGlue = passive.child(_Unicode(glue)); + dd4hep::xml::DetElement passive = calo.child(_Unicode(passive)); + dd4hep::xml::DetElement passiveInner = passive.child(_Unicode(inner)); + dd4hep::xml::DetElement passiveOuter = passive.child(_Unicode(outer)); + dd4hep::xml::DetElement passiveGlue = passive.child(_Unicode(glue)); std::string passiveInnerMaterial = passiveInner.materialStr(); std::string passiveOuterMaterial = passiveOuter.materialStr(); std::string passiveGlueMaterial = passiveGlue.materialStr(); @@ -84,29 +85,29 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& bathRmin = caloDim.rmin(); bathRmax = caloDim.rmax(); } - DD4hep::Geometry::Tube bathOuterShape(bathRmin, bathRmax, caloDim.dz()); + dd4hep::Tube bathOuterShape(bathRmin, bathRmax, caloDim.dz()); if (cryoThicknessFront > 0) { - DD4hep::Geometry::Tube cryoOuterShape(cryoDim.rmin1(), cryoDim.rmax2(), cryoDim.dz()); + dd4hep::Tube cryoOuterShape(cryoDim.rmin1(), cryoDim.rmax2(), cryoDim.dz()); // Subtract volumes to get the actual shape of cryo - DD4hep::Geometry::SubtractionSolid cryoShape(cryoOuterShape, bathOuterShape); + dd4hep::SubtractionSolid cryoShape(cryoOuterShape, bathOuterShape); // 1. Create cryostat lLog << MSG::INFO << "ECAL cryostat: rmin (cm) = " << cryoDim.rmin1() << " rmax (cm) = " << cryoDim.rmax2() << " thickness in front of ECal (cm) = " << cryoThicknessFront << " thickness behind ECal (cm) = " << cryoThicknessBack << endmsg; - DD4hep::Geometry::Volume cryoVol(cryostat.nameStr(), cryoShape, aLcdd.material(cryostat.materialStr())); - DD4hep::Geometry::PlacedVolume cryoPhysVol = envelopeVol.placeVolume(cryoVol); + dd4hep::Volume cryoVol(cryostat.nameStr(), cryoShape, aLcdd.material(cryostat.materialStr())); + dd4hep::PlacedVolume cryoPhysVol = envelopeVol.placeVolume(cryoVol); if (cryostat.isSensitive()) { cryoVol.setSensitiveDetector(aSensDet); cryoPhysVol.addPhysVolID("cryo", 1); lLog << MSG::INFO << "Cryostat volume set as sensitive" << endmsg; } - DD4hep::Geometry::DetElement cryoDetElem(caloDetElem, "cryo", 0); + dd4hep::DetElement cryoDetElem(caloDetElem, "cryo", 0); cryoDetElem.setPlacement(cryoPhysVol); } // 2. Create bath that is inside the cryostat and surrounds the calorimeter // Bath is filled with active material -> but not sensitive - DD4hep::Geometry::Volume bathVol(activeMaterial + "_bath", bathOuterShape, aLcdd.material(activeMaterial)); + dd4hep::Volume bathVol(activeMaterial + "_bath", bathOuterShape, aLcdd.material(activeMaterial)); lLog << MSG::INFO << "ECAL bath: material = " << activeMaterial << " rmin (cm) = " << bathRmin << " rmax (cm) = " << bathRmax << " thickness in front of ECal (cm) = " << caloDim.rmin() - cryoDim.rmin2() << " thickness behind ECal (cm) = " << cryoDim.rmax1() - caloDim.rmax() << endmsg; @@ -114,8 +115,8 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& // 3. Create the calorimeter by placing the passive material, trapezoid active layers, readout and again trapezoid // active layers in the bath. // sensitive detector for the layers - DD4hep::Geometry::SensitiveDetector sd = aSensDet; - DD4hep::XML::Dimension sdType = xmlDetElem.child(_U(sensitive)); + dd4hep::SensitiveDetector sd = aSensDet; + dd4hep::xml::Dimension sdType = xmlDetElem.child(_U(sensitive)); sd.setType(sdType.typeStr()); lLog << MSG::INFO << "ECAL calorimeter volume rmin (cm) = " << caloDim.rmin() << " rmax (cm) = " << caloDim.rmax() << endmsg; @@ -159,36 +160,36 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& } double layerFirstOffset = -planeLength / 2. + layerHeight[0] / 2.; - DD4hep::Geometry::Box passiveShape(passiveThickness / 2., caloDim.dz(), planeLength / 2.); + dd4hep::Box passiveShape(passiveThickness / 2., caloDim.dz(), planeLength / 2.); // inner layer is not in the first calo layer (to sample more uniformly in the layer where upstream correction is // applied) - DD4hep::Geometry::Box passiveInnerShape(passiveInnerThickness / 2., caloDim.dz(), planeLength / 2. - layerHeight[0] / 2.); - DD4hep::Geometry::Box passiveInnerShapeFirstLayer(passiveInnerThickness / 2., caloDim.dz(), layerHeight[0] / 2.); - DD4hep::Geometry::Box passiveOuterShape(passiveOuterThickness / 4., caloDim.dz(), planeLength / 2.); - DD4hep::Geometry::Box passiveGlueShape(passiveGlueThickness / 4., caloDim.dz(), planeLength / 2.); + dd4hep::Box passiveInnerShape(passiveInnerThickness / 2., caloDim.dz(), planeLength / 2. - layerHeight[0] / 2.); + dd4hep::Box passiveInnerShapeFirstLayer(passiveInnerThickness / 2., caloDim.dz(), layerHeight[0] / 2.); + dd4hep::Box passiveOuterShape(passiveOuterThickness / 4., caloDim.dz(), planeLength / 2.); + dd4hep::Box passiveGlueShape(passiveGlueThickness / 4., caloDim.dz(), planeLength / 2.); // passive volume consists of inner part and two outer, joind by glue - DD4hep::Geometry::Volume passiveVol("passive", passiveShape, aLcdd.material("Air")); - DD4hep::Geometry::Volume passiveInnerVol(passiveInnerMaterial + "_passive", passiveInnerShape, + dd4hep::Volume passiveVol("passive", passiveShape, aLcdd.material("Air")); + dd4hep::Volume passiveInnerVol(passiveInnerMaterial + "_passive", passiveInnerShape, aLcdd.material(passiveInnerMaterial)); - DD4hep::Geometry::Volume passiveInnerVolFirstLayer(activeMaterial + "_passive", passiveInnerShapeFirstLayer, + dd4hep::Volume passiveInnerVolFirstLayer(activeMaterial + "_passive", passiveInnerShapeFirstLayer, aLcdd.material(activeMaterial)); - DD4hep::Geometry::Volume passiveOuterVol(passiveOuterMaterial + "_passive", passiveOuterShape, + dd4hep::Volume passiveOuterVol(passiveOuterMaterial + "_passive", passiveOuterShape, aLcdd.material(passiveOuterMaterial)); - DD4hep::Geometry::Volume passiveGlueVol(passiveGlueMaterial + "_passive", passiveGlueShape, + dd4hep::Volume passiveGlueVol(passiveGlueMaterial + "_passive", passiveGlueShape, aLcdd.material(passiveGlueMaterial)); if (passiveInner.isSensitive()) { lLog << MSG::DEBUG << "Passive inner volume set as sensitive" << endmsg; double layerOffset = layerFirstOffset; for (uint iLayer = 1; iLayer < numLayers; iLayer++) { - DD4hep::Geometry::Box layerPassiveInnerShape(passiveInnerThickness / 2., caloDim.dz(), layerHeight[iLayer] / 2.); - DD4hep::Geometry::Volume layerPassiveInnerVol(passiveInnerMaterial, layerPassiveInnerShape, + dd4hep::Box layerPassiveInnerShape(passiveInnerThickness / 2., caloDim.dz(), layerHeight[iLayer] / 2.); + dd4hep::Volume layerPassiveInnerVol(passiveInnerMaterial, layerPassiveInnerShape, aLcdd.material(passiveInnerMaterial)); layerPassiveInnerVol.setSensitiveDetector(aSensDet); - DD4hep::Geometry::PlacedVolume layerPassiveInnerPhysVol = - passiveInnerVol.placeVolume(layerPassiveInnerVol, DD4hep::Geometry::Position(0, 0, layerOffset)); + dd4hep::PlacedVolume layerPassiveInnerPhysVol = + passiveInnerVol.placeVolume(layerPassiveInnerVol, dd4hep::Position(0, 0, layerOffset)); layerPassiveInnerPhysVol.addPhysVolID("layer", iLayer); - DD4hep::Geometry::DetElement layerPassiveInnerDetElem("layer", iLayer); + dd4hep::DetElement layerPassiveInnerDetElem("layer", iLayer); layerPassiveInnerDetElem.setPlacement(layerPassiveInnerPhysVol); if (iLayer != numLayers - 1) { layerOffset += layerHeight[iLayer] / 2. + layerHeight[iLayer + 1] / 2.; @@ -199,14 +200,14 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& lLog << MSG::DEBUG << "Passive outer volume set as sensitive" << endmsg; double layerOffset = layerFirstOffset; for (uint iLayer = 0; iLayer < numLayers; iLayer++) { - DD4hep::Geometry::Box layerPassiveOuterShape(passiveOuterThickness / 4., caloDim.dz(), layerHeight[iLayer] / 2.); - DD4hep::Geometry::Volume layerPassiveOuterVol(passiveOuterMaterial, layerPassiveOuterShape, + dd4hep::Box layerPassiveOuterShape(passiveOuterThickness / 4., caloDim.dz(), layerHeight[iLayer] / 2.); + dd4hep::Volume layerPassiveOuterVol(passiveOuterMaterial, layerPassiveOuterShape, aLcdd.material(passiveOuterMaterial)); layerPassiveOuterVol.setSensitiveDetector(aSensDet); - DD4hep::Geometry::PlacedVolume layerPassiveOuterPhysVol = - passiveOuterVol.placeVolume(layerPassiveOuterVol, DD4hep::Geometry::Position(0, 0, layerOffset)); + dd4hep::PlacedVolume layerPassiveOuterPhysVol = + passiveOuterVol.placeVolume(layerPassiveOuterVol, dd4hep::Position(0, 0, layerOffset)); layerPassiveOuterPhysVol.addPhysVolID("layer", iLayer); - DD4hep::Geometry::DetElement layerPassiveOuterDetElem("layer", iLayer); + dd4hep::DetElement layerPassiveOuterDetElem("layer", iLayer); layerPassiveOuterDetElem.setPlacement(layerPassiveOuterPhysVol); if (iLayer != numLayers - 1) { layerOffset += layerHeight[iLayer] / 2. + layerHeight[iLayer + 1] / 2.; @@ -217,14 +218,14 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& lLog << MSG::DEBUG << "Passive glue volume set as sensitive" << endmsg; double layerOffset = layerFirstOffset; for (uint iLayer = 0; iLayer < numLayers; iLayer++) { - DD4hep::Geometry::Box layerPassiveGlueShape(passiveGlueThickness / 4., caloDim.dz(), layerHeight[iLayer] / 2.); - DD4hep::Geometry::Volume layerPassiveGlueVol(passiveGlueMaterial, layerPassiveGlueShape, + dd4hep::Box layerPassiveGlueShape(passiveGlueThickness / 4., caloDim.dz(), layerHeight[iLayer] / 2.); + dd4hep::Volume layerPassiveGlueVol(passiveGlueMaterial, layerPassiveGlueShape, aLcdd.material(passiveGlueMaterial)); layerPassiveGlueVol.setSensitiveDetector(aSensDet); - DD4hep::Geometry::PlacedVolume layerPassiveGluePhysVol = - passiveGlueVol.placeVolume(layerPassiveGlueVol, DD4hep::Geometry::Position(0, 0, layerOffset)); + dd4hep::PlacedVolume layerPassiveGluePhysVol = + passiveGlueVol.placeVolume(layerPassiveGlueVol, dd4hep::Position(0, 0, layerOffset)); layerPassiveGluePhysVol.addPhysVolID("layer", iLayer); - DD4hep::Geometry::DetElement layerPassiveGlueDetElem("layer", iLayer); + dd4hep::DetElement layerPassiveGlueDetElem("layer", iLayer); layerPassiveGlueDetElem.setPlacement(layerPassiveGluePhysVol); if (iLayer != numLayers - 1) { layerOffset += layerHeight[iLayer] / 2. + layerHeight[iLayer + 1] / 2.; @@ -232,22 +233,22 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& } } - DD4hep::Geometry::PlacedVolume passiveInnerPhysVol = - passiveVol.placeVolume(passiveInnerVol, DD4hep::Geometry::Position(0, 0, layerHeight[0] / 2.)); - DD4hep::Geometry::PlacedVolume passiveInnerPhysVolFirstLayer = - passiveVol.placeVolume(passiveInnerVolFirstLayer, DD4hep::Geometry::Position(0, 0, layerFirstOffset)); - DD4hep::Geometry::PlacedVolume passiveOuterPhysVolBelow = passiveVol.placeVolume( + dd4hep::PlacedVolume passiveInnerPhysVol = + passiveVol.placeVolume(passiveInnerVol, dd4hep::Position(0, 0, layerHeight[0] / 2.)); + dd4hep::PlacedVolume passiveInnerPhysVolFirstLayer = + passiveVol.placeVolume(passiveInnerVolFirstLayer, dd4hep::Position(0, 0, layerFirstOffset)); + dd4hep::PlacedVolume passiveOuterPhysVolBelow = passiveVol.placeVolume( passiveOuterVol, - DD4hep::Geometry::Position(passiveInnerThickness / 2. + passiveGlueThickness / 2. + passiveOuterThickness / 4., 0, + dd4hep::Position(passiveInnerThickness / 2. + passiveGlueThickness / 2. + passiveOuterThickness / 4., 0, 0)); - DD4hep::Geometry::PlacedVolume passiveOuterPhysVolAbove = passiveVol.placeVolume( + dd4hep::PlacedVolume passiveOuterPhysVolAbove = passiveVol.placeVolume( passiveOuterVol, - DD4hep::Geometry::Position(-passiveInnerThickness / 2. - passiveGlueThickness / 2. - passiveOuterThickness / 4., + dd4hep::Position(-passiveInnerThickness / 2. - passiveGlueThickness / 2. - passiveOuterThickness / 4., 0, 0)); - DD4hep::Geometry::PlacedVolume passiveGluePhysVolBelow = passiveVol.placeVolume( - passiveGlueVol, DD4hep::Geometry::Position(-passiveInnerThickness / 2. - passiveGlueThickness / 4., 0, 0)); - DD4hep::Geometry::PlacedVolume passiveGluePhysVolAbove = passiveVol.placeVolume( - passiveGlueVol, DD4hep::Geometry::Position(passiveInnerThickness / 2. + passiveGlueThickness / 4., 0, 0)); + dd4hep::PlacedVolume passiveGluePhysVolBelow = passiveVol.placeVolume( + passiveGlueVol, dd4hep::Position(-passiveInnerThickness / 2. - passiveGlueThickness / 4., 0, 0)); + dd4hep::PlacedVolume passiveGluePhysVolAbove = passiveVol.placeVolume( + passiveGlueVol, dd4hep::Position(passiveInnerThickness / 2. + passiveGlueThickness / 4., 0, 0)); passiveInnerPhysVol.addPhysVolID("subtype", 0); passiveInnerPhysVolFirstLayer.addPhysVolID("subtype", 0); passiveOuterPhysVolBelow.addPhysVolID("subtype", 1); @@ -257,26 +258,26 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& if (passiveInner.isSensitive()) { passiveInnerVolFirstLayer.setSensitiveDetector(aSensDet); passiveInnerPhysVolFirstLayer.addPhysVolID("layer", 0); - DD4hep::Geometry::DetElement passiveInnerDetElemFirstLayer("layer", 0); + dd4hep::DetElement passiveInnerDetElemFirstLayer("layer", 0); passiveInnerDetElemFirstLayer.setPlacement(passiveInnerPhysVolFirstLayer); } ////////////////////////////// // READOUT PLANES ////////////////////////////// - DD4hep::Geometry::Box readoutShape(readoutThickness / 2., caloDim.dz(), planeLength / 2.); - DD4hep::Geometry::Volume readoutVol(readoutMaterial, readoutShape, aLcdd.material(readoutMaterial)); + dd4hep::Box readoutShape(readoutThickness / 2., caloDim.dz(), planeLength / 2.); + dd4hep::Volume readoutVol(readoutMaterial, readoutShape, aLcdd.material(readoutMaterial)); if (readout.isSensitive()) { lLog << MSG::INFO << "Readout volume set as sensitive" << endmsg; double layerOffset = layerFirstOffset; for (uint iLayer = 0; iLayer < numLayers; iLayer++) { - DD4hep::Geometry::Box layerReadoutShape(readoutThickness / 2., caloDim.dz(), layerHeight[iLayer] / 2.); - DD4hep::Geometry::Volume layerReadoutVol(readoutMaterial, layerReadoutShape, aLcdd.material(readoutMaterial)); + dd4hep::Box layerReadoutShape(readoutThickness / 2., caloDim.dz(), layerHeight[iLayer] / 2.); + dd4hep::Volume layerReadoutVol(readoutMaterial, layerReadoutShape, aLcdd.material(readoutMaterial)); layerReadoutVol.setSensitiveDetector(aSensDet); - DD4hep::Geometry::PlacedVolume layerReadoutPhysVol = - readoutVol.placeVolume(layerReadoutVol, DD4hep::Geometry::Position(0, 0, layerOffset)); + dd4hep::PlacedVolume layerReadoutPhysVol = + readoutVol.placeVolume(layerReadoutVol, dd4hep::Position(0, 0, layerOffset)); layerReadoutPhysVol.addPhysVolID("layer", iLayer); - DD4hep::Geometry::DetElement layerReadoutDetElem("layer", iLayer); + dd4hep::DetElement layerReadoutDetElem("layer", iLayer); layerReadoutDetElem.setPlacement(layerReadoutPhysVol); if (iLayer != numLayers - 1) { layerOffset += layerHeight[iLayer] / 2. + layerHeight[iLayer + 1] / 2.; @@ -321,10 +322,10 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& // creating shape for rows of layers (active material between two passive planes, with readout in the middle) // first define area between two passive planes, area can reach up to the symmetry axis of passive plane - DD4hep::Geometry::Trapezoid activeOuterShape(activeInThickness, activeOutThickness, caloDim.dz(), caloDim.dz(), + dd4hep::Trapezoid activeOuterShape(activeInThickness, activeOutThickness, caloDim.dz(), caloDim.dz(), planeLength / 2.); // subtract readout shape from the middle - DD4hep::Geometry::SubtractionSolid activeShapeNoReadout(activeOuterShape, readoutShape); + dd4hep::SubtractionSolid activeShapeNoReadout(activeOuterShape, readoutShape); // make calculation for active plane that is inclined with 0 deg (= offset + angle) double Cx = Rmin * cos(-angle) + planeLength / 2.; @@ -346,18 +347,18 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& xprimB = CBy; // subtract passive volume above - DD4hep::Geometry::SubtractionSolid activeShapeNoPassiveAbove( + dd4hep::SubtractionSolid activeShapeNoPassiveAbove( activeShapeNoReadout, passiveShape, - DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationY(-dPhi / 2.), - DD4hep::Geometry::Position(-fabs(xprim), 0, fabs(zprim)))); + dd4hep::Transform3D(dd4hep::RotationY(-dPhi / 2.), + dd4hep::Position(-fabs(xprim), 0, fabs(zprim)))); // subtract passive volume below - DD4hep::Geometry::SubtractionSolid activeShape( + dd4hep::SubtractionSolid activeShape( activeShapeNoPassiveAbove, passiveShape, - DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationY(dPhi / 2.), - DD4hep::Geometry::Position(fabs(xprimB), 0, -fabs(zprimB)))); - DD4hep::Geometry::Volume activeVol("active", activeShape, aLcdd.material("Air")); + dd4hep::Transform3D(dd4hep::RotationY(dPhi / 2.), + dd4hep::Position(fabs(xprimB), 0, -fabs(zprimB)))); + dd4hep::Volume activeVol("active", activeShape, aLcdd.material("Air")); - std::vector layerPhysVols; + std::vector layerPhysVols; // place layers within active volume std::vector layerInThickness; std::vector layerOutThickness; @@ -372,29 +373,29 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& } double layerOffset = layerFirstOffset; for (uint iLayer = 0; iLayer < numLayers; iLayer++) { - DD4hep::Geometry::Trapezoid layerOuterShape(layerInThickness[iLayer], layerOutThickness[iLayer], caloDim.dz(), + dd4hep::Trapezoid layerOuterShape(layerInThickness[iLayer], layerOutThickness[iLayer], caloDim.dz(), caloDim.dz(), layerHeight[iLayer] / 2.); - DD4hep::Geometry::SubtractionSolid layerShapeNoReadout(layerOuterShape, readoutShape); - DD4hep::Geometry::SubtractionSolid layerShapeNoPassiveAbove( + dd4hep::SubtractionSolid layerShapeNoReadout(layerOuterShape, readoutShape); + dd4hep::SubtractionSolid layerShapeNoPassiveAbove( layerShapeNoReadout, passiveShape, - DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationY(-dPhi / 2.), - DD4hep::Geometry::Position(-fabs(xprim), 0, fabs(zprim) - layerOffset))); + dd4hep::Transform3D(dd4hep::RotationY(-dPhi / 2.), + dd4hep::Position(-fabs(xprim), 0, fabs(zprim) - layerOffset))); // subtract passive volume below - DD4hep::Geometry::SubtractionSolid layerShape( + dd4hep::SubtractionSolid layerShape( layerShapeNoPassiveAbove, passiveShape, - DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationY(dPhi / 2.), - DD4hep::Geometry::Position(fabs(xprimB), 0, -fabs(zprimB) - layerOffset))); - DD4hep::Geometry::Volume layerVol("layer", layerShape, aLcdd.material(activeMaterial)); + dd4hep::Transform3D(dd4hep::RotationY(dPhi / 2.), + dd4hep::Position(fabs(xprimB), 0, -fabs(zprimB) - layerOffset))); + dd4hep::Volume layerVol("layer", layerShape, aLcdd.material(activeMaterial)); layerVol.setSensitiveDetector(aSensDet); - layerPhysVols.push_back(activeVol.placeVolume(layerVol, DD4hep::Geometry::Position(0, 0, layerOffset))); + layerPhysVols.push_back(activeVol.placeVolume(layerVol, dd4hep::Position(0, 0, layerOffset))); layerPhysVols.back().addPhysVolID("layer", iLayer); if (iLayer != numLayers - 1) { layerOffset += layerHeight[iLayer] / 2. + layerHeight[iLayer + 1] / 2.; } } - DD4hep::Geometry::DetElement bathDetElem(caloDetElem, "bath", 1); - std::vector activePhysVols; + dd4hep::DetElement bathDetElem(caloDetElem, "bath", 1); + std::vector activePhysVols; // Next place elements: passive planes, readout planes and rows of layers for (uint iPlane = 0; iPlane < numPlanes; iPlane++) { // first calculate positions of passive and readout planes @@ -409,16 +410,16 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& // rotate centre by angle wrt beginning of plane double xRotated = xRmin + (xRadial - xRmin) * cos(angle) - (yRadial - yRmin) * sin(angle); double yRotated = yRmin + (xRadial - xRmin) * sin(angle) + (yRadial - yRmin) * cos(angle); - DD4hep::Geometry::Transform3D transform(DD4hep::Geometry::RotationX(-M_PI / 2.) // to get in XY plane + dd4hep::Transform3D transform(dd4hep::RotationX(-M_PI / 2.) // to get in XY plane * - DD4hep::Geometry::RotationY(M_PI / 2. // to get pointed towards centre + dd4hep::RotationY(M_PI / 2. // to get pointed towards centre - phi - angle), - DD4hep::Geometry::Position(xRotated, yRotated, 0)); - DD4hep::Geometry::PlacedVolume passivePhysVol = bathVol.placeVolume(passiveVol, transform); + dd4hep::Position(xRotated, yRotated, 0)); + dd4hep::PlacedVolume passivePhysVol = bathVol.placeVolume(passiveVol, transform); passivePhysVol.addPhysVolID("module", iPlane); passivePhysVol.addPhysVolID("type", 1); // 0 = active, 1 = passive, 2 = readout - DD4hep::Geometry::DetElement passiveDetElem(bathDetElem, "passive" + std::to_string(iPlane), iPlane); + dd4hep::DetElement passiveDetElem(bathDetElem, "passive" + std::to_string(iPlane), iPlane); passiveDetElem.setPlacement(passivePhysVol); // READOUT @@ -432,29 +433,29 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& // rotate centre by angle wrt beginning of plane double xRotatedRead = xRminRead + (xRadialRead - xRminRead) * cos(angle) - (yRadialRead - yRminRead) * sin(angle); double yRotatedRead = yRminRead + (xRadialRead - xRminRead) * sin(angle) + (yRadialRead - yRminRead) * cos(angle); - DD4hep::Geometry::Transform3D transformRead( - DD4hep::Geometry::RotationX(-M_PI / 2.) // to get in XY plane + dd4hep::Transform3D transformRead( + dd4hep::RotationX(-M_PI / 2.) // to get in XY plane * - DD4hep::Geometry::RotationY(M_PI / 2. // to get pointed towards centre + dd4hep::RotationY(M_PI / 2. // to get pointed towards centre - phiRead - angle), - DD4hep::Geometry::Position(xRotatedRead, yRotatedRead, 0)); - DD4hep::Geometry::PlacedVolume readoutPhysVol = bathVol.placeVolume(readoutVol, transformRead); + dd4hep::Position(xRotatedRead, yRotatedRead, 0)); + dd4hep::PlacedVolume readoutPhysVol = bathVol.placeVolume(readoutVol, transformRead); readoutPhysVol.addPhysVolID("module", iPlane); readoutPhysVol.addPhysVolID("type", 2); // 0 = active, 1 = passive, 2 = readout - DD4hep::Geometry::DetElement readoutDetElem(bathDetElem, "readout" + std::to_string(iPlane), iPlane); + dd4hep::DetElement readoutDetElem(bathDetElem, "readout" + std::to_string(iPlane), iPlane); readoutDetElem.setPlacement(readoutPhysVol); // ACTIVE - DD4hep::Geometry::Rotation3D rotationActive(DD4hep::Geometry::RotationX(-M_PI / 2) * - DD4hep::Geometry::RotationY(M_PI / 2 - phiRead - angle)); + dd4hep::Rotation3D rotationActive(dd4hep::RotationX(-M_PI / 2) * + dd4hep::RotationY(M_PI / 2 - phiRead - angle)); activePhysVols.push_back(bathVol.placeVolume( activeVol, - DD4hep::Geometry::Transform3D(rotationActive, DD4hep::Geometry::Position(xRotatedRead, yRotatedRead, 0)))); + dd4hep::Transform3D(rotationActive, dd4hep::Position(xRotatedRead, yRotatedRead, 0)))); activePhysVols.back().addPhysVolID("module", iPlane); activePhysVols.back().addPhysVolID("type", 0); // 0 = active, 1 = passive, 2 = readout } - DD4hep::Geometry::PlacedVolume bathPhysVol = envelopeVol.placeVolume(bathVol); + dd4hep::PlacedVolume bathPhysVol = envelopeVol.placeVolume(bathVol); if (cryostat.isSensitive()) { bathVol.setSensitiveDetector(aSensDet); bathPhysVol.addPhysVolID("cryo", 0); @@ -463,17 +464,17 @@ static DD4hep::Geometry::Ref_t createECalBarrelInclined(DD4hep::Geometry::LCDD& bathDetElem.setPlacement(bathPhysVol); for (uint iPlane = 0; iPlane < numPlanes; iPlane++) { - DD4hep::Geometry::DetElement activeDetElem(bathDetElem, "active" + std::to_string(iPlane), iPlane); + dd4hep::DetElement activeDetElem(bathDetElem, "active" + std::to_string(iPlane), iPlane); activeDetElem.setPlacement(activePhysVols[iPlane]); for (uint iLayer = 0; iLayer < numLayers; iLayer++) { - DD4hep::Geometry::DetElement layerDetElem(activeDetElem, "layer" + std::to_string(iLayer), iLayer); + dd4hep::DetElement layerDetElem(activeDetElem, "layer" + std::to_string(iLayer), iLayer); layerDetElem.setPlacement(layerPhysVols[iLayer]); } } // Place the envelope - DD4hep::Geometry::Volume motherVol = aLcdd.pickMotherVolume(caloDetElem); - DD4hep::Geometry::PlacedVolume envelopePhysVol = motherVol.placeVolume(envelopeVol); + dd4hep::Volume motherVol = aLcdd.pickMotherVolume(caloDetElem); + dd4hep::PlacedVolume envelopePhysVol = motherVol.placeVolume(envelopeVol); envelopePhysVol.addPhysVolID("system", xmlDetElem.id()); caloDetElem.setPlacement(envelopePhysVol); return caloDetElem; diff --git a/Detector/DetFCChhECalSimple/CMakeLists.txt b/Detector/DetFCChhECalSimple/CMakeLists.txt index 67c8682a2..c9db736e9 100644 --- a/Detector/DetFCChhECalSimple/CMakeLists.txt +++ b/Detector/DetFCChhECalSimple/CMakeLists.txt @@ -14,7 +14,7 @@ find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetFCChhECalSimple) -include_directories(SYSTEM ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}) +#include_directories(SYSTEM ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}) gaudi_add_module(DetFCChhECalSimple src/*.cpp diff --git a/Detector/DetFCChhECalSimple/compact/FCChh_ECalBarrel_Common.xml b/Detector/DetFCChhECalSimple/compact/FCChh_ECalBarrel_Common.xml index b63e0823d..c44ae267d 100644 --- a/Detector/DetFCChhECalSimple/compact/FCChh_ECalBarrel_Common.xml +++ b/Detector/DetFCChhECalSimple/compact/FCChh_ECalBarrel_Common.xml @@ -34,7 +34,7 @@ - + system:4,ECAL_Cryo:1,bath:1,EM_barrel:1,active_layer:9,eta:9,phi:10 diff --git a/Detector/DetFCChhECalSimple/compact/FCChh_ECalBarrel_Gflash.xml b/Detector/DetFCChhECalSimple/compact/FCChh_ECalBarrel_Gflash.xml index 21b089cc4..7e677ef40 100644 --- a/Detector/DetFCChhECalSimple/compact/FCChh_ECalBarrel_Gflash.xml +++ b/Detector/DetFCChhECalSimple/compact/FCChh_ECalBarrel_Gflash.xml @@ -37,7 +37,7 @@ - + system:4,ECAL_Cryo:1,bath:1,EM_barrel:1,active_layer:9,eta:-9,phi:-10 diff --git a/Detector/DetFCChhECalSimple/src/ECalBarrel_geo.cpp b/Detector/DetFCChhECalSimple/src/ECalBarrel_geo.cpp index d4e0543cd..7cb3a2586 100644 --- a/Detector/DetFCChhECalSimple/src/ECalBarrel_geo.cpp +++ b/Detector/DetFCChhECalSimple/src/ECalBarrel_geo.cpp @@ -1,4 +1,6 @@ // DD4hep includes +#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" #include "DD4hep/DetFactoryHelper.h" // Gaudi @@ -6,15 +8,15 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ServiceHandle.h" -using DD4hep::Geometry::Volume; -using DD4hep::Geometry::DetElement; -using DD4hep::XML::Dimension; -using DD4hep::Geometry::PlacedVolume; +using dd4hep::Volume; +using dd4hep::DetElement; +using dd4hep::xml::Dimension; +using dd4hep::PlacedVolume; namespace det { -static DD4hep::Geometry::Ref_t createECal(DD4hep::Geometry::LCDD& lcdd, xml_h xmlElement, - DD4hep::Geometry::SensitiveDetector sensDet) { +static dd4hep::Ref_t createECal(dd4hep::Detector& lcdd, xml_h xmlElement, + dd4hep::SensitiveDetector sensDet) { ServiceHandle msgSvc("MessageSvc", "ECalConstruction"); MsgStream lLog(&(*msgSvc), "ECalConstruction"); @@ -25,7 +27,7 @@ static DD4hep::Geometry::Ref_t createECal(DD4hep::Geometry::LCDD& lcdd, xml_h xm // Make volume that envelopes the whole barrel; set material to air Dimension dimensions(xmlDet.dimensions()); - DD4hep::Geometry::Tube envelopeShape(dimensions.rmin(), dimensions.rmax(), dimensions.dz()); + dd4hep::Tube envelopeShape(dimensions.rmin(), dimensions.rmax(), dimensions.dz()); Volume envelopeVolume(detName, envelopeShape, lcdd.air()); // Invisibility seems to be broken in visualisation tags, have to hardcode that envelopeVolume.setVisAttributes(lcdd, dimensions.visStr()); @@ -42,9 +44,9 @@ static DD4hep::Geometry::Ref_t createECal(DD4hep::Geometry::LCDD& lcdd, xml_h xm double activeThickness = active.thickness(); xml_comp_t passive = calo.child(_Unicode(passive_layers)); - DD4hep::XML::DetElement passiveInner = passive.child(_Unicode(inner)); - DD4hep::XML::DetElement passiveOuter = passive.child(_Unicode(outer)); - DD4hep::XML::DetElement passiveGlue = passive.child(_Unicode(glue)); + dd4hep::xml::DetElement passiveInner = passive.child(_Unicode(inner)); + dd4hep::xml::DetElement passiveOuter = passive.child(_Unicode(outer)); + dd4hep::xml::DetElement passiveGlue = passive.child(_Unicode(glue)); std::string passiveInnerMaterial = passiveInner.materialStr(); std::string passiveOuterMaterial = passiveOuter.materialStr(); std::string passiveGlueMaterial = passiveGlue.materialStr(); @@ -58,7 +60,7 @@ static DD4hep::Geometry::Ref_t createECal(DD4hep::Geometry::LCDD& lcdd, xml_h xm DetElement caloBath(eCal, activeMaterial + "_notSensitive", 0); if (cryoThickness > 0) { // Step 1 : cryostat - DD4hep::Geometry::Tube cryoShape(cryoDim.rmin(), cryoDim.rmax(), cryoDim.dz()); + dd4hep::Tube cryoShape(cryoDim.rmin(), cryoDim.rmax(), cryoDim.dz()); lLog << MSG::DEBUG << "ECAL cryostat: rmin " << cryoDim.rmin() << " rmax " << cryoDim.rmax() << endmsg; Volume cryoVol(cryostat.nameStr(), cryoShape, lcdd.material(cryostat.materialStr())); PlacedVolume placedCryo = envelopeVolume.placeVolume(cryoVol); @@ -66,7 +68,7 @@ static DD4hep::Geometry::Ref_t createECal(DD4hep::Geometry::LCDD& lcdd, xml_h xm DetElement cryo(eCal, cryostat.nameStr(), 0); cryo.setPlacement(placedCryo); // Step 2 : fill cryostat with active medium - DD4hep::Geometry::Tube bathShape(cryoDim.rmin() + cryoThickness, cryoDim.rmax() - cryoThickness, + dd4hep::Tube bathShape(cryoDim.rmin() + cryoThickness, cryoDim.rmax() - cryoThickness, cryoDim.dz() - cryoThickness); lLog << MSG::DEBUG << "ECAL " << activeMaterial << " bath: rmin " << cryoDim.rmin() + cryoThickness << " rmax " << cryoDim.rmax() - cryoThickness << endmsg; @@ -83,8 +85,8 @@ static DD4hep::Geometry::Ref_t createECal(DD4hep::Geometry::LCDD& lcdd, xml_h xm << endmsg; // set the sensitive detector type to the DD4hep calorimeter - DD4hep::Geometry::SensitiveDetector sd = sensDet; - DD4hep::XML::Dimension sdType = xmlDet.child(_U(sensitive)); + dd4hep::SensitiveDetector sd = sensDet; + dd4hep::xml::Dimension sdType = xmlDet.child(_U(sensitive)); sd.setType(sdType.typeStr()); double glueThickness = passiveGlueThickness / 2.; @@ -95,16 +97,16 @@ static DD4hep::Geometry::Ref_t createECal(DD4hep::Geometry::LCDD& lcdd, xml_h xm // loop on the sensitive layers for (int i = 0; i < activeSamples; i++) { double layerRadius = caloDim.rmin() + passiveThickness + i * (passiveThickness + activeThickness); - DD4hep::Geometry::Tube outerShape1(layerRadius - passiveThickness, layerRadius - passiveThickness + outerThickness, + dd4hep::Tube outerShape1(layerRadius - passiveThickness, layerRadius - passiveThickness + outerThickness, caloDim.dz()); - DD4hep::Geometry::Tube glueShape1(layerRadius - passiveThickness + outerThickness, + dd4hep::Tube glueShape1(layerRadius - passiveThickness + outerThickness, layerRadius - passiveThickness + outerThickness + glueThickness, caloDim.dz()); - DD4hep::Geometry::Tube innerShape(layerRadius - passiveThickness + outerThickness + glueThickness, + dd4hep::Tube innerShape(layerRadius - passiveThickness + outerThickness + glueThickness, layerRadius - outerThickness - glueThickness, caloDim.dz()); - DD4hep::Geometry::Tube glueShape2(layerRadius - outerThickness - glueThickness, layerRadius - outerThickness, + dd4hep::Tube glueShape2(layerRadius - outerThickness - glueThickness, layerRadius - outerThickness, caloDim.dz()); - DD4hep::Geometry::Tube outerShape2(layerRadius - outerThickness, layerRadius, caloDim.dz()); - DD4hep::Geometry::Tube layerShape(layerRadius, layerRadius + activeThickness, caloDim.dz()); + dd4hep::Tube outerShape2(layerRadius - outerThickness, layerRadius, caloDim.dz()); + dd4hep::Tube layerShape(layerRadius, layerRadius + activeThickness, caloDim.dz()); Volume layerVol(activeMaterial + "_sensitive", layerShape, lcdd.material(activeMaterial)); Volume outerVol1(passiveOuterMaterial + "_below", outerShape1, lcdd.material(passiveOuterMaterial)); Volume outerVol2(passiveOuterMaterial + "_above", outerShape2, lcdd.material(passiveOuterMaterial)); diff --git a/Detector/DetFCChhHCalTile/compact/FCChh_HCalBarrel_TileCal.xml b/Detector/DetFCChhHCalTile/compact/FCChh_HCalBarrel_TileCal.xml index da90ce741..d91d461fb 100644 --- a/Detector/DetFCChhHCalTile/compact/FCChh_HCalBarrel_TileCal.xml +++ b/Detector/DetFCChhHCalTile/compact/FCChh_HCalBarrel_TileCal.xml @@ -52,11 +52,11 @@ - + system:4,module:7,row:9,layer:5,tile:2,eta:1,phi:10 - + system:4,module:7,row:9,layer:5,tile:2,eta:9,phi:10 diff --git a/Detector/DetFCChhHCalTile/compact/FCChh_HCalExtendedBarrel_TileCal.xml b/Detector/DetFCChhHCalTile/compact/FCChh_HCalExtendedBarrel_TileCal.xml index 112525e6f..61e4ca647 100644 --- a/Detector/DetFCChhHCalTile/compact/FCChh_HCalExtendedBarrel_TileCal.xml +++ b/Detector/DetFCChhHCalTile/compact/FCChh_HCalExtendedBarrel_TileCal.xml @@ -53,11 +53,11 @@ - + system:4,type:2,module:9,row:8,layer:4,tile:2,eta:1,phi:10 - + system:4,type:2,module:9,row:8,layer:4,tile:2,eta:10,phi:10 diff --git a/Detector/DetFCChhHCalTile/src/HCalBarrel_geo.cpp b/Detector/DetFCChhHCalTile/src/HCalBarrel_geo.cpp index 1b47ba9ca..0bd78408f 100644 --- a/Detector/DetFCChhHCalTile/src/HCalBarrel_geo.cpp +++ b/Detector/DetFCChhHCalTile/src/HCalBarrel_geo.cpp @@ -6,15 +6,14 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ServiceHandle.h" -using DD4hep::Geometry::Volume; -using DD4hep::Geometry::DetElement; -using DD4hep::XML::Dimension; -using DD4hep::Geometry::PlacedVolume; +using dd4hep::Volume; +using dd4hep::DetElement; +using dd4hep::xml::Dimension; +using dd4hep::PlacedVolume; namespace det { -static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xmlElement, - DD4hep::Geometry::SensitiveDetector sensDet) { +static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_h xmlElement, dd4hep::SensitiveDetector sensDet) { // Get the Gaudi message service and message stream: ServiceHandle msgSvc("MessageSvc", "HCalConstruction"); MsgStream lLog(&(*msgSvc), "HCalConstruction"); @@ -82,30 +81,30 @@ static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xm double dzDetector = (numSequencesZ * dzSequence) / 2 + dZEndPlate + space; lLog << MSG::INFO << "correction of dz (negative = size reduced):" << dzDetector - dimensions.dz() << endmsg; - DD4hep::Geometry::Tube envelopeShape(dimensions.rmin(), dimensions.rmax(), dzDetector); + dd4hep::Tube envelopeShape(dimensions.rmin(), dimensions.rmax(), dzDetector); Volume envelopeVolume("envelopeVolume", envelopeShape, lcdd.air()); envelopeVolume.setVisAttributes(lcdd, dimensions.visStr()); // Add structural support made of steel inside of HCal DetElement facePlate(hCal, "FacePlate", 0); - DD4hep::Geometry::Tube facePlateShape(dimensions.rmin(), sensitiveBarrelRmin, (dzDetector - dZEndPlate - space)); + dd4hep::Tube facePlateShape(dimensions.rmin(), sensitiveBarrelRmin, (dzDetector - dZEndPlate - space)); Volume facePlateVol("facePlate", facePlateShape, lcdd.material(xFacePlate.materialStr())); facePlateVol.setVisAttributes(lcdd, xFacePlate.visStr()); PlacedVolume placedFacePlate = envelopeVolume.placeVolume(facePlateVol); facePlate.setPlacement(placedFacePlate); // Add structural support made of steel at both ends of HCal - DD4hep::Geometry::Tube endPlateShape(dimensions.rmin(), (dimensions.rmax() - dSteelSupport), dZEndPlate / 2); + dd4hep::Tube endPlateShape(dimensions.rmin(), (dimensions.rmax() - dSteelSupport), dZEndPlate / 2); Volume endPlateVol("endPlate", endPlateShape, lcdd.material(xEndPlate.materialStr())); endPlateVol.setVisAttributes(lcdd, xEndPlate.visStr()); DetElement endPlatePos(hCal, "endPlatePos", 0); - DD4hep::Geometry::Position posOffset(0, 0, dzDetector - (dZEndPlate / 2)); + dd4hep::Position posOffset(0, 0, dzDetector - (dZEndPlate / 2)); PlacedVolume placedEndPlatePos = envelopeVolume.placeVolume(endPlateVol, posOffset); endPlatePos.setPlacement(placedEndPlatePos); DetElement endPlateNeg(hCal, "endPlateNeg", 1); - DD4hep::Geometry::Position negOffset(0, 0, -dzDetector + (dZEndPlate / 2)); + dd4hep::Position negOffset(0, 0, -dzDetector + (dZEndPlate / 2)); PlacedVolume placedEndPlateNeg = envelopeVolume.placeVolume(endPlateVol, negOffset); endPlateNeg.setPlacement(placedEndPlateNeg); @@ -129,25 +128,24 @@ static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xm double dzSupport = dSteelSupport / 2; // DetElement vectors for placement in loop at the end - std::vector supports; + std::vector supports; supports.reserve(numSequencesPhi); - std::vector modules; + std::vector modules; modules.reserve(numSequencesPhi); - std::vector rows; + std::vector rows; rows.reserve(numSequencesZ); - std::vector layers; + std::vector layers; layers.reserve(layerDepths.size()); - std::vector> tilesInLayers; + std::vector> tilesInLayers; tilesInLayers.reserve(layerDepths.size()); // First we construct one wedge: - Volume wedgeVolume("wedgeVolume", DD4hep::Geometry::Trapezoid(dx1Module, dx2Module, dy0, dy0, dzModule), - lcdd.material("Air")); + Volume wedgeVolume("wedgeVolume", dd4hep::Trapezoid(dx1Module, dx2Module, dy0, dy0, dzModule), lcdd.material("Air")); double layerR = 0.; // Placement of subWedges in Wedge for (unsigned int idxLayer = 0; idxLayer < layerDepths.size(); ++idxLayer) { - auto layerName = DD4hep::XML::_toString(idxLayer, "layer%d"); + auto layerName = dd4hep::xml::_toString(idxLayer, "layer%d"); unsigned int sequenceIdx = idxLayer % 2; // get length of layer in rho @@ -162,7 +160,7 @@ static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xm layerR += layerDepths.at(idxLayer); - Volume layerVolume("layerVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dy0, dy0, dz0), lcdd.material("Air")); + Volume layerVolume("layerVolume", dd4hep::Trapezoid(dx1, dx2, dy0, dy0, dz0), lcdd.material("Air")); layerVolume.setVisAttributes(lcdd.invisible()); unsigned int idxSubMod = 0; unsigned int idxActMod = 0; @@ -175,23 +173,23 @@ static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xm sequenceIdx = 0; } // layer middle offset - DD4hep::Geometry::Position modOffset(0, 0, rMiddle); + dd4hep::Position modOffset(0, 0, rMiddle); layers.push_back(wedgeVolume.placeVolume(layerVolume, modOffset)); layers.back().addPhysVolID("layer", idxLayer); - std::vector tiles; + std::vector tiles; // Filling of the subWedge with coponents (submodules) for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod) { xml_comp_t xComp = xCompColl; double dyComp = xComp.thickness() * 0.5; - Volume modCompVol("modCompVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), + Volume modCompVol("modCompVolume", dd4hep::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), lcdd.material(xComp.materialStr())); modCompVol.setVisAttributes(lcdd, xComp.visStr()); - DD4hep::Geometry::Position offset(0, modCompZOffset + dyComp + xComp.y_offset() / 2, 0); + dd4hep::Position offset(0, modCompZOffset + dyComp + xComp.y_offset() / 2, 0); if (xComp.isSensitive()) { - Volume tileVol("tileVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), + Volume tileVol("tileVolume", dd4hep::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), lcdd.material(xComp.materialStr())); tileVol.setSensitiveDetector(sensDet); tiles.push_back(layerVolume.placeVolume(tileVol, offset)); @@ -207,14 +205,14 @@ static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xm } Volume moduleVolume("moduleVolume", - DD4hep::Geometry::Trapezoid(dx1Module, dx2Module, (dzDetector - dZEndPlate - space), - (dzDetector - dZEndPlate - space), dzModule), + dd4hep::Trapezoid(dx1Module, dx2Module, (dzDetector - dZEndPlate - space), + (dzDetector - dZEndPlate - space), dzModule), lcdd.material("Air")); moduleVolume.setVisAttributes(lcdd.invisible()); Volume steelSupportVolume("steelSupportVolume", - DD4hep::Geometry::Trapezoid(dx1Support, dx2Support, (dzDetector - dZEndPlate - space), - (dzDetector - dZEndPlate - space), dzSupport), + dd4hep::Trapezoid(dx1Support, dx2Support, (dzDetector - dZEndPlate - space), + (dzDetector - dZEndPlate - space), dzSupport), lcdd.material(xSteelSupport.materialStr())); for (unsigned int idxZRow = 0; idxZRow < numSequencesZ; ++idxZRow) { @@ -224,7 +222,7 @@ static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xm if ((-dzDetector + zOffset) >= dzDetector) { lLog << MSG::WARNING << " WARNING!!!! Module position outside of detector envelope" << std::endl; } - DD4hep::Geometry::Position wedgeOffset(0, zOffset, 0); + dd4hep::Position wedgeOffset(0, zOffset, 0); // Fill vector for DetElements rows.push_back(moduleVolume.placeVolume(wedgeVolume, wedgeOffset)); rows.back().addPhysVolID("row", idxZRow); @@ -237,14 +235,12 @@ static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xm double yPosSupport = (sensitiveBarrelRmin + 2 * dzModule + dzSupport) * cos(phi); double xPosSupport = (sensitiveBarrelRmin + 2 * dzModule + dzSupport) * sin(phi); - DD4hep::Geometry::Position moduleOffset(xPosModule, yPosModule, 0); - DD4hep::Geometry::Position supportOffset(xPosSupport, yPosSupport, 0); + dd4hep::Position moduleOffset(xPosModule, yPosModule, 0); + dd4hep::Position supportOffset(xPosSupport, yPosSupport, 0); - DD4hep::Geometry::Transform3D trans( - DD4hep::Geometry::RotationX(-0.5 * dd4hep::pi) * DD4hep::Geometry::RotationY(phi), moduleOffset); + dd4hep::Transform3D trans(dd4hep::RotationX(-0.5 * dd4hep::pi) * dd4hep::RotationY(phi), moduleOffset); - DD4hep::Geometry::Transform3D transS( - DD4hep::Geometry::RotationX(-0.5 * dd4hep::pi) * DD4hep::Geometry::RotationY(phi), supportOffset); + dd4hep::Transform3D transS(dd4hep::RotationX(-0.5 * dd4hep::pi) * dd4hep::RotationY(phi), supportOffset); // Fill the vectors of DetElements modules.push_back(envelopeVolume.placeVolume(moduleVolume, trans)); modules.back().addPhysVolID("module", idxPhi); @@ -259,21 +255,21 @@ static DD4hep::Geometry::Ref_t createHCal(DD4hep::Geometry::LCDD& lcdd, xml_h xm lLog << MSG::DEBUG << "Tiles in layers :" << tilesInLayers[1].size() << std::endl; for (uint iPhi = 0; iPhi < numSequencesPhi; iPhi++) { - DetElement moduleDet(hCal, DD4hep::XML::_toString(iPhi, "module%d"), iPhi); + DetElement moduleDet(hCal, dd4hep::xml::_toString(iPhi, "module%d"), iPhi); moduleDet.setPlacement(modules[iPhi]); - DetElement support(hCal, DD4hep::XML::_toString(iPhi, "support%d"), iPhi); + DetElement support(hCal, dd4hep::xml::_toString(iPhi, "support%d"), iPhi); support.setPlacement(supports[iPhi]); for (uint iZ = 0; iZ < numSequencesZ; iZ++) { - DetElement wedgeDet(moduleDet, DD4hep::XML::_toString(iZ, "row%d"), iZ); + DetElement wedgeDet(moduleDet, dd4hep::xml::_toString(iZ, "row%d"), iZ); wedgeDet.setPlacement(rows[iZ]); for (uint iLayer = 0; iLayer < numSequencesR; iLayer++) { - DetElement layerDet(wedgeDet, DD4hep::XML::_toString(iLayer, "layer%d"), iLayer); + DetElement layerDet(wedgeDet, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer); layerDet.setPlacement(layers[iLayer]); for (uint iTile = 0; iTile < tilesInLayers[iLayer].size(); iTile++) { - DetElement tileDet(layerDet, DD4hep::XML::_toString(iTile, "tile%d"), iTile); + DetElement tileDet(layerDet, dd4hep::xml::_toString(iTile, "tile%d"), iTile); tileDet.setPlacement(tilesInLayers[iLayer][iTile]); } } diff --git a/Detector/DetFCChhHCalTile/src/HCalExtBarrel_geo.cpp b/Detector/DetFCChhHCalTile/src/HCalExtBarrel_geo.cpp index cfa14b9b6..46eda271d 100644 --- a/Detector/DetFCChhHCalTile/src/HCalExtBarrel_geo.cpp +++ b/Detector/DetFCChhHCalTile/src/HCalExtBarrel_geo.cpp @@ -6,17 +6,17 @@ #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/ServiceHandle.h" -using DD4hep::Geometry::Volume; -using DD4hep::Geometry::DetElement; -using DD4hep::XML::Dimension; -using DD4hep::Geometry::PlacedVolume; +using dd4hep::Volume; +using dd4hep::DetElement; +using dd4hep::xml::Dimension; +using dd4hep::PlacedVolume; namespace det { -void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::SensitiveDetector& aSensDet, - DD4hep::Geometry::Volume& aEnvelope, DD4hep::Geometry::DetElement& aHCal, - DD4hep::XML::Handle_t& aXmlElement, int sign) { +void buildEB(MsgStream& lLog, dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, + dd4hep::Volume& aEnvelope, dd4hep::DetElement& aHCal, + dd4hep::xml::Handle_t& aXmlElement, int sign) { - DD4hep::Geometry::SensitiveDetector sensDet = aSensDet; + dd4hep::SensitiveDetector sensDet = aSensDet; Dimension sensDetType = aXmlElement.child(_Unicode(sensitive)); sensDet.setType(sensDetType.typeStr()); @@ -108,19 +108,19 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S // Add structural support made of steel inside of HCal DetElement facePlate1(aHCal, "FacePlate_" + std::to_string(1 * sign), 0); - DD4hep::Geometry::Tube facePlateShape1(dimensions.rmin1(), (sensitiveBarrel1Rmin - space), + dd4hep::Tube facePlateShape1(dimensions.rmin1(), (sensitiveBarrel1Rmin - space), (dzDetector1 - 2 * dZEndPlate - space)); Volume facePlateVol1("facePlateVol1", facePlateShape1, aLcdd.material(xFacePlate.materialStr())); facePlateVol1.setVisAttributes(aLcdd, xFacePlate.visStr()); - DD4hep::Geometry::Position offsetFace1(0, 0, sign * extBarrelOffset1); + dd4hep::Position offsetFace1(0, 0, sign * extBarrelOffset1); // Faceplate for 2nd part of extended Barrel DetElement facePlate2(aHCal, "FacePlate_" + std::to_string(2 * sign), 0); - DD4hep::Geometry::Tube facePlateShape2(dimensions.rmin2(), (sensitiveBarrel2Rmin - space), + dd4hep::Tube facePlateShape2(dimensions.rmin2(), (sensitiveBarrel2Rmin - space), (dzDetector2 - 2 * dZEndPlate - space)); Volume facePlateVol2("facePlateVol2", facePlateShape2, aLcdd.material(xFacePlate.materialStr())); facePlateVol2.setVisAttributes(aLcdd, xFacePlate.visStr()); - DD4hep::Geometry::Position offsetFace2(0, 0, sign * extBarrelOffset2); + dd4hep::Position offsetFace2(0, 0, sign * extBarrelOffset2); PlacedVolume placedFacePlate1 = aEnvelope.placeVolume(facePlateVol1, offsetFace1); facePlate1.setPlacement(placedFacePlate1); @@ -128,21 +128,21 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S facePlate2.setPlacement(placedFacePlate2); // Add structural support made of steel at both ends of extHCal - DD4hep::Geometry::Tube endPlateShape1(dimensions.rmin1(), (dimensions.rmax1() - dSteelSupport), dZEndPlate); + dd4hep::Tube endPlateShape1(dimensions.rmin1(), (dimensions.rmax1() - dSteelSupport), dZEndPlate); Volume endPlateVol1("endPlateVol1", endPlateShape1, aLcdd.material(xEndPlate.materialStr())); endPlateVol1.setVisAttributes(aLcdd, xEndPlate.visStr()); - DD4hep::Geometry::Tube endPlateShape2(dimensions.rmin2(), (dimensions.rmax2() - dSteelSupport), dZEndPlate); + dd4hep::Tube endPlateShape2(dimensions.rmin2(), (dimensions.rmax2() - dSteelSupport), dZEndPlate); Volume endPlateVol2("endPlateVol2", endPlateShape2, aLcdd.material(xEndPlate.materialStr())); endPlateVol2.setVisAttributes(aLcdd, xEndPlate.visStr()); // Endplates placed for the extended Barrels in front and in the back to the central Barrel DetElement endPlatePos(aHCal, "endPlate_" + std::to_string(1 * sign), 0); - DD4hep::Geometry::Position posOffset(0, 0, sign * (extBarrelOffset2 + dzDetector2 - dZEndPlate)); + dd4hep::Position posOffset(0, 0, sign * (extBarrelOffset2 + dzDetector2 - dZEndPlate)); PlacedVolume placedEndPlatePos = aEnvelope.placeVolume(endPlateVol2, posOffset); endPlatePos.setPlacement(placedEndPlatePos); DetElement endPlateNeg(aHCal, "endPlate_" + std::to_string(2 * sign), 0); - DD4hep::Geometry::Position negOffset(0, 0, sign * (extBarrelOffset1 - dzDetector1 + dZEndPlate)); + dd4hep::Position negOffset(0, 0, sign * (extBarrelOffset1 - dzDetector1 + dZEndPlate)); PlacedVolume placedEndPlateNeg = aEnvelope.placeVolume(endPlateVol1, negOffset); endPlateNeg.setPlacement(placedEndPlateNeg); @@ -175,25 +175,25 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S double dzSupport = dSteelSupport / 2.; // DetElement vectors for placement in loop at the end - std::vector supports1; + std::vector supports1; supports1.reserve(numSequencesPhi); - std::vector modules1; + std::vector modules1; modules1.reserve(numSequencesPhi); - std::vector supports2; + std::vector supports2; supports2.reserve(numSequencesPhi); - std::vector modules2; + std::vector modules2; modules2.reserve(numSequencesPhi); - std::vector rows; + std::vector rows; rows.reserve(numSequencesZ1 + numSequencesZ2); - std::vector layers; + std::vector layers; layers.reserve(layerDepths1.size() + layerDepths2.size()); - std::vector> tilesInLayers; + std::vector> tilesInLayers; tilesInLayers.reserve(layerDepths1.size() + layerDepths2.size()); // First we construct base wedges: - Volume WedgeVolume1("WedgeVolume1", DD4hep::Geometry::Trapezoid(dx1Module1, dx2Module1, dy0, dy0, dzModule1), + Volume WedgeVolume1("WedgeVolume1", dd4hep::Trapezoid(dx1Module1, dx2Module1, dy0, dy0, dzModule1), aLcdd.material("Air")); - Volume WedgeVolume2("WedgeVolume2", DD4hep::Geometry::Trapezoid(dx1Module2, dx2Module2, dy0, dy0, dzModule2), + Volume WedgeVolume2("WedgeVolume2", dd4hep::Trapezoid(dx1Module2, dx2Module2, dy0, dy0, dzModule2), aLcdd.material("Air")); double layerR = 0.; // Placement of subWedges in Wedge @@ -212,30 +212,30 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S layerR += layerDepths1.at(idxLayer); - Volume layerVolume("layerVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dy0, dy0, dz0), aLcdd.material("Air")); + Volume layerVolume("layerVolume", dd4hep::Trapezoid(dx1, dx2, dy0, dy0, dz0), aLcdd.material("Air")); layerVolume.setVisAttributes(aLcdd.invisible()); unsigned int idxSubMod = 0; unsigned int idxActMod = 0; double modCompZOffset = -sequenceDimensions.dz() * 0.5; // layer middle offset - DD4hep::Geometry::Position modOffset(0, 0, rMiddle); + dd4hep::Position modOffset(0, 0, rMiddle); layers.push_back(WedgeVolume1.placeVolume(layerVolume, modOffset)); layers.back().addPhysVolID("layer", idxLayer); - std::vector tiles; + std::vector tiles; // Filling of the subWedge with coponents (submodules) for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod) { xml_comp_t xComp = xCompColl; double dyComp = xComp.thickness() * 0.5; - Volume modCompVol("modCompVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), + Volume modCompVol("modCompVolume", dd4hep::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), aLcdd.material(xComp.materialStr())); modCompVol.setVisAttributes(aLcdd, xComp.visStr()); - DD4hep::Geometry::Position offset(0, modCompZOffset + dyComp + xComp.y_offset() / 2, 0); + dd4hep::Position offset(0, modCompZOffset + dyComp + xComp.y_offset() / 2, 0); if (xComp.isSensitive()) { - Volume tileVol("tileVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), + Volume tileVol("tileVolume", dd4hep::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), aLcdd.material(xComp.materialStr())); tileVol.setVisAttributes(aLcdd, xComp.visStr()); tileVol.setSensitiveDetector(sensDet); @@ -268,30 +268,30 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S layerR += layerDepths2.at(idxLayer); - Volume layerVolume("layerVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dy0, dy0, dz0), aLcdd.material("Air")); + Volume layerVolume("layerVolume", dd4hep::Trapezoid(dx1, dx2, dy0, dy0, dz0), aLcdd.material("Air")); layerVolume.setVisAttributes(aLcdd.invisible()); unsigned int idxSubMod = 0; unsigned int idxActMod = 0; double modCompZOffset = -sequenceDimensions.dz() * 0.5; // layer middle offset - DD4hep::Geometry::Position modOffset(0, 0, rMiddle); + dd4hep::Position modOffset(0, 0, rMiddle); layers.push_back(WedgeVolume2.placeVolume(layerVolume, modOffset)); layers.back().addPhysVolID("layer", idxLayer); - std::vector tiles; + std::vector tiles; // Filling of the subWedge with coponents (submodules) for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod) { xml_comp_t xComp = xCompColl; double dyComp = xComp.thickness() * 0.5; - Volume modCompVol("modCompVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), + Volume modCompVol("modCompVolume", dd4hep::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), aLcdd.material(xComp.materialStr())); modCompVol.setVisAttributes(aLcdd, xComp.visStr()); - DD4hep::Geometry::Position offset(0, modCompZOffset + dyComp + xComp.y_offset() / 2, 0); + dd4hep::Position offset(0, modCompZOffset + dyComp + xComp.y_offset() / 2, 0); if (xComp.isSensitive()) { - Volume tileVol("tileVolume", DD4hep::Geometry::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), + Volume tileVol("tileVolume", dd4hep::Trapezoid(dx1, dx2, dyComp, dyComp, dz0), aLcdd.material(xComp.materialStr())); tileVol.setVisAttributes(aLcdd, xComp.visStr()); tileVol.setSensitiveDetector(sensDet); @@ -308,23 +308,23 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S } Volume ModuleVolume1("ModuleVolume1", - DD4hep::Geometry::Trapezoid(dx1Module1, dx2Module1, (dzDetector1 - 2 * dZEndPlate - space), + dd4hep::Trapezoid(dx1Module1, dx2Module1, (dzDetector1 - 2 * dZEndPlate - space), (dzDetector1 - 2 * dZEndPlate - space), dzModule1), aLcdd.material("Air")); Volume ModuleVolume2("ModuleVolume2", - DD4hep::Geometry::Trapezoid(dx1Module2, dx2Module2, (dzDetector2 - 2 * dZEndPlate - space), + dd4hep::Trapezoid(dx1Module2, dx2Module2, (dzDetector2 - 2 * dZEndPlate - space), (dzDetector2 - 2 * dZEndPlate - space), dzModule2), aLcdd.material("Air")); Volume SteelSupportVolume1("SteelSupportVolume1", - DD4hep::Geometry::Trapezoid(dx1Support1, dx2Support1, + dd4hep::Trapezoid(dx1Support1, dx2Support1, (dzDetector1 - 2 * dZEndPlate - space), (dzDetector1 - 2 * dZEndPlate - space), dzSupport), aLcdd.material(xSteelSupport.materialStr())); Volume SteelSupportVolume2("SteelSupportVolume2", - DD4hep::Geometry::Trapezoid(dx1Support2, dx2Support2, + dd4hep::Trapezoid(dx1Support2, dx2Support2, (dzDetector2 - 2 * dZEndPlate - space), (dzDetector2 - 2 * dZEndPlate - space), dzSupport), aLcdd.material(xSteelSupport.materialStr())); @@ -334,7 +334,7 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S double zOffset = -dzDetector1 + 2 * dZEndPlate + space + (2 * idxZRow + 1) * (dzSequence * 0.5); lLog << MSG::DEBUG << "z offset of wedges = " << zOffset << std::endl; - DD4hep::Geometry::Position wedgeOffset(0, zOffset, 0); + dd4hep::Position wedgeOffset(0, zOffset, 0); // Fill vector for DetElements rows.push_back(ModuleVolume1.placeVolume(WedgeVolume1, wedgeOffset)); rows.back().addPhysVolID("row", idxZRow); @@ -343,7 +343,7 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S double zOffset = -dzDetector2 + 2 * dZEndPlate + space + (2 * idxZRow + 1) * (dzSequence * 0.5); lLog << MSG::DEBUG << "z offset of wedges = " << zOffset << std::endl; - DD4hep::Geometry::Position wedgeOffset(0, zOffset, 0); + dd4hep::Position wedgeOffset(0, zOffset, 0); // Fill vector for DetElements rows.push_back(ModuleVolume2.placeVolume(WedgeVolume2, wedgeOffset)); rows.back().addPhysVolID("row", (numSequencesZ1 + idxZRow)); @@ -364,23 +364,23 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S // endplates // Placement within envelopeVolumeNeg and Pos (--> total offset in z later) // --> Offsets calculated relative to middle of envelope in z - DD4hep::Geometry::Position moduleOffset1(xPosModule1, yPosModule1, sign * extBarrelOffset1); - DD4hep::Geometry::Position supportOffset1(xPosSupport1, yPosSupport1, sign * extBarrelOffset1); - DD4hep::Geometry::Position moduleOffset2(xPosModule2, yPosModule2, sign * extBarrelOffset2); - DD4hep::Geometry::Position supportOffset2(xPosSupport2, yPosSupport2, sign * extBarrelOffset2); + dd4hep::Position moduleOffset1(xPosModule1, yPosModule1, sign * extBarrelOffset1); + dd4hep::Position supportOffset1(xPosSupport1, yPosSupport1, sign * extBarrelOffset1); + dd4hep::Position moduleOffset2(xPosModule2, yPosModule2, sign * extBarrelOffset2); + dd4hep::Position supportOffset2(xPosSupport2, yPosSupport2, sign * extBarrelOffset2); // Placement around central Barrel - DD4hep::Geometry::Transform3D trans1( - DD4hep::Geometry::RotationX(-0.5 * dd4hep::pi) * DD4hep::Geometry::RotationY(phi), moduleOffset1); + dd4hep::Transform3D trans1( + dd4hep::RotationX(-0.5 * dd4hep::pi) * dd4hep::RotationY(phi), moduleOffset1); - DD4hep::Geometry::Transform3D trans1S( - DD4hep::Geometry::RotationX(-0.5 * dd4hep::pi) * DD4hep::Geometry::RotationY(phi), supportOffset1); + dd4hep::Transform3D trans1S( + dd4hep::RotationX(-0.5 * dd4hep::pi) * dd4hep::RotationY(phi), supportOffset1); - DD4hep::Geometry::Transform3D trans2( - DD4hep::Geometry::RotationX(-0.5 * dd4hep::pi) * DD4hep::Geometry::RotationY(phi), moduleOffset2); + dd4hep::Transform3D trans2( + dd4hep::RotationX(-0.5 * dd4hep::pi) * dd4hep::RotationY(phi), moduleOffset2); - DD4hep::Geometry::Transform3D trans2S( - DD4hep::Geometry::RotationX(-0.5 * dd4hep::pi) * DD4hep::Geometry::RotationY(phi), supportOffset2); + dd4hep::Transform3D trans2S( + dd4hep::RotationX(-0.5 * dd4hep::pi) * dd4hep::RotationY(phi), supportOffset2); // Fill the vectors of DetElements modules1.push_back(aEnvelope.placeVolume(ModuleVolume1, trans1)); @@ -402,39 +402,39 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S for (uint iPhi = 0; iPhi < numSequencesPhi; iPhi++) { int signedPhi = numSequencesPhi - sign * (iPhi + 1); - DetElement moduleDet1(aHCal, DD4hep::XML::_toString(signedPhi, "module1_%d"), signedPhi); + DetElement moduleDet1(aHCal, dd4hep::xml::_toString(signedPhi, "module1_%d"), signedPhi); moduleDet1.setPlacement(modules1[iPhi]); - DetElement support1(aHCal, DD4hep::XML::_toString(signedPhi, "support1_%d"), signedPhi); + DetElement support1(aHCal, dd4hep::xml::_toString(signedPhi, "support1_%d"), signedPhi); support1.setPlacement(supports1[iPhi]); - DetElement moduleDet2(aHCal, DD4hep::XML::_toString(signedPhi, "module2_%d"), signedPhi); + DetElement moduleDet2(aHCal, dd4hep::xml::_toString(signedPhi, "module2_%d"), signedPhi); moduleDet2.setPlacement(modules2[iPhi]); - DetElement support2(aHCal, DD4hep::XML::_toString(signedPhi, "support2_%d"), signedPhi); + DetElement support2(aHCal, dd4hep::xml::_toString(signedPhi, "support2_%d"), signedPhi); support2.setPlacement(supports2[iPhi]); for (uint iZ = 0; iZ < numSequencesZ1; iZ++) { - DetElement wedgeDet(moduleDet1, DD4hep::XML::_toString(iZ, "row%d"), iZ); + DetElement wedgeDet(moduleDet1, dd4hep::xml::_toString(iZ, "row%d"), iZ); wedgeDet.setPlacement(rows[iZ]); for (uint iLayer = 0; iLayer < numSequencesR1; iLayer++) { - DetElement layerDet(wedgeDet, DD4hep::XML::_toString(iLayer, "layer%d"), iLayer); + DetElement layerDet(wedgeDet, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer); layerDet.setPlacement(layers[iLayer]); for (uint iTile = 0; iTile < tilesInLayers[iLayer].size(); iTile++) { - DetElement tileDet(layerDet, DD4hep::XML::_toString(iTile, "tile%d"), iTile); + DetElement tileDet(layerDet, dd4hep::xml::_toString(iTile, "tile%d"), iTile); tileDet.setPlacement(tilesInLayers[iLayer][iTile]); } } } for (uint iZ = numSequencesZ1; iZ < (numSequencesZ1 + numSequencesZ2); iZ++) { - DetElement wedgeDet(moduleDet2, DD4hep::XML::_toString(iZ, "row%d"), iZ); + DetElement wedgeDet(moduleDet2, dd4hep::xml::_toString(iZ, "row%d"), iZ); wedgeDet.setPlacement(rows[iZ]); for (uint iLayer = numSequencesR1; iLayer < (numSequencesR1 + numSequencesR2); iLayer++) { - DetElement layerDet(wedgeDet, DD4hep::XML::_toString(iLayer, "layer%d"), iLayer); + DetElement layerDet(wedgeDet, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer); layerDet.setPlacement(layers[iLayer]); for (uint iTile = 0; iTile < tilesInLayers[iLayer].size(); iTile++) { - DetElement tileDet(layerDet, DD4hep::XML::_toString(iTile, "tile%d"), iTile); + DetElement tileDet(layerDet, dd4hep::xml::_toString(iTile, "tile%d"), iTile); tileDet.setPlacement(tilesInLayers[iLayer][iTile]); } } @@ -443,8 +443,8 @@ void buildEB(MsgStream& lLog, DD4hep::Geometry::LCDD& aLcdd, DD4hep::Geometry::S return; } -static DD4hep::Geometry::Ref_t createHCalEB(DD4hep::Geometry::LCDD& lcdd, xml_h xmlElement, - DD4hep::Geometry::SensitiveDetector sensDet) { +static dd4hep::Ref_t createHCalEB(dd4hep::Detector& lcdd, xml_h xmlElement, + dd4hep::SensitiveDetector sensDet) { // Get the Gaudi message service and message stream: ServiceHandle msgSvc("MessageSvc", "ExtHCalConstruction"); @@ -454,14 +454,14 @@ static DD4hep::Geometry::Ref_t createHCalEB(DD4hep::Geometry::LCDD& lcdd, xml_h std::string detName = xmlDet.nameStr(); // Make DetElement - DD4hep::Geometry::DetElement hCalEB(detName, xmlDet.id()); + dd4hep::DetElement hCalEB(detName, xmlDet.id()); // Make volume that envelopes the whole barrel; set material to air Dimension dimensions(xmlDet.dimensions()); - DD4hep::Geometry::Tube envelope(dimensions.rmin2(), dimensions.rmax1(), (dimensions.z_offset() + dimensions.dz())); - DD4hep::Geometry::Tube negative(dimensions.rmin2(), dimensions.rmax1(), (dimensions.offset() - dimensions.width())); - DD4hep::Geometry::SubtractionSolid envelopeShape(envelope, negative); + dd4hep::Tube envelope(dimensions.rmin2(), dimensions.rmax1(), (dimensions.z_offset() + dimensions.dz())); + dd4hep::Tube negative(dimensions.rmin2(), dimensions.rmax1(), (dimensions.offset() - dimensions.width())); + dd4hep::SubtractionSolid envelopeShape(envelope, negative); Volume envelopeVolume(detName + "_volume", envelopeShape, lcdd.air()); envelopeVolume.setVisAttributes(lcdd, dimensions.visStr()); diff --git a/Detector/DetFCChhTailCatcher/compact/FCChh_TailCatcher.xml b/Detector/DetFCChhTailCatcher/compact/FCChh_TailCatcher.xml index 8e721a94b..ee4b6e2cb 100644 --- a/Detector/DetFCChhTailCatcher/compact/FCChh_TailCatcher.xml +++ b/Detector/DetFCChhTailCatcher/compact/FCChh_TailCatcher.xml @@ -23,7 +23,7 @@ - + system:7,eta:11,phi:8 diff --git a/Detector/DetFCChhTrackerTkLayout/src/BeamTube_geo.cpp b/Detector/DetFCChhTrackerTkLayout/src/BeamTube_geo.cpp index ffa871552..02083490a 100644 --- a/Detector/DetFCChhTrackerTkLayout/src/BeamTube_geo.cpp +++ b/Detector/DetFCChhTrackerTkLayout/src/BeamTube_geo.cpp @@ -3,12 +3,12 @@ #include "ACTS/Plugins/DD4hepPlugins/ActsExtension.hpp" #include "DD4hep/DetFactoryHelper.h" -using DD4hep::Geometry::Volume; -using DD4hep::Geometry::PlacedVolume; -using DD4hep::Geometry::Tube; -using DD4hep::Geometry::DetElement; +using dd4hep::Volume; +using dd4hep::PlacedVolume; +using dd4hep::Tube; +using dd4hep::DetElement; -static DD4hep::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, xml_h e, DD4hep::Geometry::SensitiveDetector) { +static dd4hep::Ref_t create_element(dd4hep::Detector& lcdd, xml_h e, dd4hep::SensitiveDetector ) { xml_det_t x_det = e; std::string det_name = x_det.nameStr(); // Make DetElement @@ -17,7 +17,7 @@ static DD4hep::Ref_t create_element(DD4hep::Geometry::LCDD& lcdd, xml_h e, DD4he volConfig.isBeampipe = true; Acts::ActsExtension* detvolume = new Acts::ActsExtension(volConfig); beamtube.addExtension(detvolume); - DD4hep::XML::Dimension x_det_dim(x_det.dimensions()); + dd4hep::xml::Dimension x_det_dim(x_det.dimensions()); Tube tube_shape(x_det_dim.rmin(), x_det_dim.rmax(), x_det_dim.z()); Volume tube_vol(det_name, tube_shape, lcdd.material(x_det_dim.attr("material"))); tube_vol.setVisAttributes(lcdd, x_det_dim.visStr()); diff --git a/Detector/DetFCChhTrackerTkLayout/src/TkLayoutBarrel_Geo.cpp b/Detector/DetFCChhTrackerTkLayout/src/TkLayoutBarrel_Geo.cpp index 6cd6c034e..03b7f1a82 100644 --- a/Detector/DetFCChhTrackerTkLayout/src/TkLayoutBarrel_Geo.cpp +++ b/Detector/DetFCChhTrackerTkLayout/src/TkLayoutBarrel_Geo.cpp @@ -8,20 +8,20 @@ #include "DD4hep/DetFactoryHelper.h" -using DD4hep::Geometry::Volume; -using DD4hep::Geometry::DetElement; -using DD4hep::XML::Dimension; -using DD4hep::Geometry::PlacedVolume; +using dd4hep::Volume; +using dd4hep::DetElement; +using dd4hep::xml::Dimension; +using dd4hep::PlacedVolume; namespace det { -static DD4hep::Geometry::Ref_t createTkLayoutTrackerBarrel(DD4hep::Geometry::LCDD& lcdd, - DD4hep::XML::Handle_t xmlElement, - DD4hep::Geometry::SensitiveDetector sensDet) { +static dd4hep::Ref_t createTkLayoutTrackerBarrel(dd4hep::Detector& lcdd, + dd4hep::xml::Handle_t xmlElement, + dd4hep::SensitiveDetector sensDet) { // shorthands - DD4hep::XML::DetElement xmlDet = static_cast(xmlElement); + dd4hep::xml::DetElement xmlDet = static_cast(xmlElement); Dimension dimensions(xmlDet.dimensions()); // get sensitive detector type from xml - DD4hep::XML::Dimension sdTyp = xmlElement.child(_Unicode(sensitive)); + dd4hep::xml::Dimension sdTyp = xmlElement.child(_Unicode(sensitive)); // sensitive detector used for all sensitive parts of this detector sensDet.setType(sdTyp.typeStr()); @@ -34,7 +34,7 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerBarrel(DD4hep::Geometry::LCD // detElement owns extension Acts::ActsExtension* detWorldExt = new Acts::ActsExtension(barrelConfig); topDetElement.addExtension(detWorldExt); - DD4hep::Geometry::Tube topVolumeShape( + dd4hep::Tube topVolumeShape( dimensions.rmin(), dimensions.rmax(), (dimensions.zmax() - dimensions.zmin()) * 0.5); Volume topVolume(detectorName, topVolumeShape, lcdd.air()); topVolume.setVisAttributes(lcdd.invisible()); @@ -44,16 +44,16 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerBarrel(DD4hep::Geometry::LCD double integratedModuleComponentThickness = 0; double phi = 0; // loop over 'layer' nodes in xml - DD4hep::XML::Component xLayers = xmlElement.child(_Unicode(layers)); - for (DD4hep::XML::Collection_t xLayerColl(xLayers, _U(layer)); nullptr != xLayerColl; ++xLayerColl) { - DD4hep::XML::Component xLayer = static_cast(xLayerColl); - DD4hep::XML::Component xRods = xLayer.child("rods"); - DD4hep::XML::Component xRodEven = xRods.child("rodOdd"); - DD4hep::XML::Component xRodOdd = xRods.child("rodEven"); - DD4hep::XML::Component xModulesEven = xRodEven.child("modules"); - DD4hep::XML::Component xModulePropertiesOdd = xRodOdd.child("moduleProperties"); - DD4hep::XML::Component xModulesOdd = xRodOdd.child("modules"); - DD4hep::Geometry::Tube layerShape(xLayer.rmin(), xLayer.rmax(), dimensions.zmax()); + dd4hep::xml::Component xLayers = xmlElement.child(_Unicode(layers)); + for (dd4hep::xml::Collection_t xLayerColl(xLayers, _U(layer)); nullptr != xLayerColl; ++xLayerColl) { + dd4hep::xml::Component xLayer = static_cast(xLayerColl); + dd4hep::xml::Component xRods = xLayer.child("rods"); + dd4hep::xml::Component xRodEven = xRods.child("rodOdd"); + dd4hep::xml::Component xRodOdd = xRods.child("rodEven"); + dd4hep::xml::Component xModulesEven = xRodEven.child("modules"); + dd4hep::xml::Component xModulePropertiesOdd = xRodOdd.child("moduleProperties"); + dd4hep::xml::Component xModulesOdd = xRodOdd.child("modules"); + dd4hep::Tube layerShape(xLayer.rmin(), xLayer.rmax(), dimensions.zmax()); Volume layerVolume("layer", layerShape, lcdd.material("Air")); //layerVolume.setVisAttributes(lcdd.invisible()); PlacedVolume placedLayerVolume = topVolume.placeVolume(layerVolume); @@ -68,22 +68,22 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerBarrel(DD4hep::Geometry::LCD Acts::ActsExtension* layerExtension = new Acts::ActsExtension(layConfig); lay_det.addExtension(layerExtension); lay_det.setPlacement(placedLayerVolume); - DD4hep::XML::Component xModuleComponentsOdd = xModulePropertiesOdd.child("components"); + dd4hep::xml::Component xModuleComponentsOdd = xModulePropertiesOdd.child("components"); integratedModuleComponentThickness = 0; int moduleCounter = 0; Volume moduleVolume; - for (DD4hep::XML::Collection_t xModuleComponentOddColl(xModuleComponentsOdd, _U(component)); + for (dd4hep::xml::Collection_t xModuleComponentOddColl(xModuleComponentsOdd, _U(component)); nullptr != xModuleComponentOddColl; ++xModuleComponentOddColl) { - DD4hep::XML::Component xModuleComponentOdd = static_cast(xModuleComponentOddColl); + dd4hep::xml::Component xModuleComponentOdd = static_cast(xModuleComponentOddColl); moduleVolume = Volume("module", - DD4hep::Geometry::Box(0.5 * xModulePropertiesOdd.attr("modWidth"), + dd4hep::Box(0.5 * xModulePropertiesOdd.attr("modWidth"), 0.5 * xModuleComponentOdd.thickness(), 0.5 * xModulePropertiesOdd.attr("modLength")), lcdd.material(xModuleComponentOdd.materialStr())); moduleVolume.setVisAttributes(lcdd.invisible()); unsigned int nPhi = xRods.repeat(); - DD4hep::XML::Handle_t currentComp; + dd4hep::xml::Handle_t currentComp; for (unsigned int phiIndex = 0; phiIndex < nPhi; ++phiIndex) { double lX = 0; double lY = 0; @@ -94,16 +94,16 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerBarrel(DD4hep::Geometry::LCD } else { currentComp = xModulesOdd; } - for (DD4hep::XML::Collection_t xModuleColl(currentComp, _U(module)); nullptr != xModuleColl; ++xModuleColl) { - DD4hep::XML::Component xModule = static_cast(xModuleColl); + for (dd4hep::xml::Collection_t xModuleColl(currentComp, _U(module)); nullptr != xModuleColl; ++xModuleColl) { + dd4hep::xml::Component xModule = static_cast(xModuleColl); double currentPhi = atan2(xModule.Y(), xModule.X()); double componentOffset = integratedModuleComponentThickness - 0.5 * xModulePropertiesOdd.attr("modThickness") + 0.5 * xModuleComponentOdd.thickness(); lX = xModule.X() + cos(currentPhi) * componentOffset; lY = xModule.Y() + sin(currentPhi) * componentOffset; lZ = xModule.Z(); - DD4hep::Geometry::Translation3D moduleOffset(lX, lY, lZ); - DD4hep::Geometry::Transform3D lTrafo(DD4hep::Geometry::RotationZ(atan2(lY, lX) + 0.5 * M_PI), moduleOffset); - DD4hep::Geometry::RotationZ lRotation(phi); + dd4hep::Translation3D moduleOffset(lX, lY, lZ); + dd4hep::Transform3D lTrafo(dd4hep::RotationZ(atan2(lY, lX) + 0.5 * M_PI), moduleOffset); + dd4hep::RotationZ lRotation(phi); PlacedVolume placedModuleVolume = layerVolume.placeVolume(moduleVolume, lRotation * lTrafo); if (xModuleComponentOdd.isSensitive()) { placedModuleVolume.addPhysVolID("module", moduleCounter); diff --git a/Detector/DetFCChhTrackerTkLayout/src/TkLayoutEndcap_Geo.cpp b/Detector/DetFCChhTrackerTkLayout/src/TkLayoutEndcap_Geo.cpp index 6fd4ed03e..6e334a4bf 100644 --- a/Detector/DetFCChhTrackerTkLayout/src/TkLayoutEndcap_Geo.cpp +++ b/Detector/DetFCChhTrackerTkLayout/src/TkLayoutEndcap_Geo.cpp @@ -5,24 +5,25 @@ #include "ACTS/Plugins/DD4hepPlugins/ActsExtension.hpp" #include "ACTS/Plugins/DD4hepPlugins/IActsExtension.hpp" -using DD4hep::Geometry::Volume; -using DD4hep::Geometry::DetElement; -using DD4hep::XML::Dimension; -using DD4hep::XML::Component; -using DD4hep::Geometry::PlacedVolume; + +using dd4hep::Volume; +using dd4hep::DetElement; +using dd4hep::xml::Dimension; +using dd4hep::xml::Component; +using dd4hep::PlacedVolume; namespace det { -static DD4hep::Geometry::Ref_t createTkLayoutTrackerEndcap(DD4hep::Geometry::LCDD& lcdd, - DD4hep::XML::Handle_t xmlElement, - DD4hep::Geometry::SensitiveDetector sensDet) { +static dd4hep::Ref_t createTkLayoutTrackerEndcap(dd4hep::Detector& lcdd, + dd4hep::xml::Handle_t xmlElement, + dd4hep::SensitiveDetector sensDet) { // shorthands - DD4hep::XML::DetElement xmlDet = static_cast(xmlElement); + dd4hep::xml::DetElement xmlDet = static_cast(xmlElement); Dimension dimensions(xmlDet.dimensions()); double l_overlapMargin = 0.01; // get sensitive detector type from xml - DD4hep::XML::Dimension sdTyp = xmlElement.child(_Unicode(sensitive)); // retrieve the type - sensDet.setType(sdTyp.typeStr()); // set for the whole detector + dd4hep::xml::Dimension sdTyp = xmlElement.child(_Unicode(sensitive)); // retrieve the type + sensDet.setType(sdTyp.typeStr()); // set for the whole detector // definition of top volume std::string detName = xmlDet.nameStr(); @@ -34,8 +35,7 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerEndcap(DD4hep::Geometry::LCD Acts::ActsExtension* ecapDetExt = new Acts::ActsExtension(actsEcapConfig); posEcapDetElement.addExtension(ecapDetExt); - - DD4hep::Geometry::Assembly envelopeVolume("endcapEnvelope"); + dd4hep::Assembly envelopeVolume("endcapEnvelope"); envelopeVolume.setVisAttributes(lcdd.invisible()); Component xDiscs = xmlElement.child(_Unicode(discs)); @@ -50,14 +50,14 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerEndcap(DD4hep::Geometry::LCD std::vector discVolumeVec; std::vector discDetElementVec; /// iterate over discs - for (DD4hep::XML::Collection_t xDiscColl(xDiscs, _Unicode(discZPls)); nullptr != xDiscColl; ++xDiscColl) { + for (dd4hep::xml::Collection_t xDiscColl(xDiscs, _Unicode(discZPls)); nullptr != xDiscColl; ++xDiscColl) { Component xDisc = static_cast(xDiscColl); Component xCurrentRings = xDisc.child(_Unicode(rings)); // create disc volume double discThickness = 0.5 * (xDisc.zmax() - xDisc.zmin()); currentZ = xDisc.z() - dimensions.zmin() - envelopeThickness; if(xCurrentRings.hasChild(_Unicode(ring))) { // we have information to construct a new volume - DD4hep::Geometry::Tube discShape( + dd4hep::Tube discShape( xDisc.rmin() - l_overlapMargin, xDisc.rmax() + l_overlapMargin, discThickness + l_overlapMargin); discVolumeVec.emplace_back("disc", discShape, lcdd.air()); @@ -70,7 +70,7 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerEndcap(DD4hep::Geometry::LCD Acts::ActsExtension* detlayer = new Acts::ActsExtension(layConfig); discDetElementVec.back().addExtension(detlayer); // iterate over rings - for (DD4hep::XML::Collection_t xRingColl(xCurrentRings, _U(ring)); (nullptr != xRingColl); ++xRingColl) { + for (dd4hep::xml::Collection_t xRingColl(xCurrentRings, _U(ring)); (nullptr != xRingColl); ++xRingColl) { Component xRing = static_cast(xRingColl); Component xRingModules = xRing.child(_Unicode(modules)); Component xModuleOdd = xRingModules.child(_Unicode(moduleOdd)); @@ -81,11 +81,11 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerEndcap(DD4hep::Geometry::LCD // place components in module double integratedCompThickness = 0.; - for (DD4hep::XML::Collection_t xCompColl(xModulePropertiesComp, _U(component)); nullptr != xCompColl; + for (dd4hep::xml::Collection_t xCompColl(xModulePropertiesComp, _U(component)); nullptr != xCompColl; ++xCompColl) { Component xComp = static_cast(xCompColl); Volume componentVolume("component", - DD4hep::Geometry::Trapezoid(0.5 * xModuleProperties.attr("modWidthMin"), + dd4hep::Trapezoid(0.5 * xModuleProperties.attr("modWidthMin"), 0.5 * xModuleProperties.attr("modWidthMax"), 0.5 * xComp.thickness(), 0.5 * xComp.thickness(), @@ -118,19 +118,19 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerEndcap(DD4hep::Geometry::LCD } // position module in the x-y plane, smaller end inward // and incorporate phi tilt if any - DD4hep::Geometry::RotationY lRotation1(M_PI * 0.5); - DD4hep::Geometry::RotationX lRotation2(M_PI * 0.5 + phiTilt); + dd4hep::RotationY lRotation1(M_PI * 0.5); + dd4hep::RotationX lRotation2(M_PI * 0.5 + phiTilt); // align radially double componentOffset = integratedCompThickness - 0.5 * xModuleProperties.attr("modThickness") + 0.5 * xComp.thickness(); - DD4hep::Geometry::RotationZ lRotation3(atan2(lY, lX)); + dd4hep::RotationZ lRotation3(atan2(lY, lX)); // theta tilt, if any -- note the different convention between // tklayout and here, thus the subtraction of pi / 2 - DD4hep::Geometry::RotationY lRotation4(thetaTilt - M_PI * 0.5); - DD4hep::Geometry::RotationZ lRotation_PhiPos(phi); + dd4hep::RotationY lRotation4(thetaTilt - M_PI * 0.5); + dd4hep::RotationZ lRotation_PhiPos(phi); // position in disk - DD4hep::Geometry::Translation3D lTranslation(lX, lY, lZ + componentOffset); - DD4hep::Geometry::Transform3D myTrafo(lRotation4 * lRotation3 * lRotation2 * lRotation1, lTranslation); + dd4hep::Translation3D lTranslation(lX, lY, lZ + componentOffset); + dd4hep::Transform3D myTrafo(lRotation4 * lRotation3 * lRotation2 * lRotation1, lTranslation); PlacedVolume placedComponentVolume = discVolumeVec.back().placeVolume(componentVolume, lRotation_PhiPos * myTrafo); if (xComp.isSensitive()) { placedComponentVolume.addPhysVolID("component", compCounter); @@ -148,19 +148,19 @@ static DD4hep::Geometry::Ref_t createTkLayoutTrackerEndcap(DD4hep::Geometry::LCD posEcapDetElement.add(discDetElementVec.back()); } - PlacedVolume placedDiscVolume = envelopeVolume.placeVolume(discVolumeVec.back(), DD4hep::Geometry::Position(0, 0, currentZ)); + PlacedVolume placedDiscVolume = envelopeVolume.placeVolume(discVolumeVec.back(), dd4hep::Position(0, 0, currentZ)); placedDiscVolume.addPhysVolID("disc", discCounter); ++discCounter; discDetElementVec.back().setPlacement(placedDiscVolume); } - DD4hep::Geometry::Assembly bothEndcaps("bothEndcapsEnvelope"); + dd4hep::Assembly bothEndcaps("bothEndcapsEnvelope"); - DD4hep::Geometry::Translation3D envelopeTranslation(0, 0, dimensions.zmin() + envelopeThickness); + dd4hep::Translation3D envelopeTranslation(0, 0, dimensions.zmin() + envelopeThickness); - DD4hep::Geometry::RotationX envelopeNegRotation(dd4hep::pi); - DD4hep::Geometry::RotationX envelopePosRotation(0.); + dd4hep::RotationX envelopeNegRotation(dd4hep::pi); + dd4hep::RotationX envelopePosRotation(0.); PlacedVolume placedEnvelopeVolume = bothEndcaps.placeVolume(envelopeVolume, envelopePosRotation * envelopeTranslation); PlacedVolume placedNegEnvelopeVolume = diff --git a/Detector/DetInterface/DetInterface/IGeoSvc.h b/Detector/DetInterface/DetInterface/IGeoSvc.h index d0d906f8a..4aa7c04fb 100644 --- a/Detector/DetInterface/DetInterface/IGeoSvc.h +++ b/Detector/DetInterface/DetInterface/IGeoSvc.h @@ -11,12 +11,10 @@ #include "GaudiKernel/IService.h" -namespace DD4hep { -namespace Geometry { -class LCDD; +namespace dd4hep { +class Detector; class DetElement; } -} class G4VUserDetectorConstruction; @@ -26,8 +24,8 @@ class GAUDI_API IGeoSvc : virtual public IService { /// InterfaceID DeclareInterfaceID(IGeoSvc, 1, 0); // receive DD4hep Geometry - virtual DD4hep::Geometry::DetElement getDD4HepGeo() = 0; - virtual DD4hep::Geometry::LCDD* lcdd() = 0; + virtual dd4hep::DetElement getDD4HepGeo() = 0; + virtual dd4hep::Detector* lcdd() = 0; // receive Geant4 Geometry virtual G4VUserDetectorConstruction* getGeant4Geo() = 0; diff --git a/Detector/DetInterface/DetInterface/ITrackingGeoSvc.h b/Detector/DetInterface/DetInterface/ITrackingGeoSvc.h index dc6a1b9bc..e0171fdd3 100644 --- a/Detector/DetInterface/DetInterface/ITrackingGeoSvc.h +++ b/Detector/DetInterface/DetInterface/ITrackingGeoSvc.h @@ -18,7 +18,7 @@ class ITrackingGeoSvc : virtual public IService { // InterfaceID DeclareInterfaceID(ITrackingGeoSvc, 1, 0); // receive Reconstruction geometry - virtual std::shared_ptr trackingGeometry() const = 0; + virtual std::shared_ptr trackingGeometry() const = 0; }; #endif // ITRACKINGGEOSVC_H diff --git a/Detector/DetSegmentation/CMakeLists.txt b/Detector/DetSegmentation/CMakeLists.txt index 69c847518..271599e69 100644 --- a/Detector/DetSegmentation/CMakeLists.txt +++ b/Detector/DetSegmentation/CMakeLists.txt @@ -1,6 +1,6 @@ -################################################################################ -#Package : DetSegmentation -################################################################################ +################################################################################# +##Package : DetSegmentation +################################################################################# gaudi_subdir(DetSegmentation v1r0) gaudi_depends_on_subdirs(GaudiKernel) diff --git a/Detector/DetSegmentation/DetSegmentation/GridPhiEta.h b/Detector/DetSegmentation/DetSegmentation/FCCSWGridPhiEta.h similarity index 90% rename from Detector/DetSegmentation/DetSegmentation/GridPhiEta.h rename to Detector/DetSegmentation/DetSegmentation/FCCSWGridPhiEta.h index 8160c47ff..21acaafb3 100644 --- a/Detector/DetSegmentation/DetSegmentation/GridPhiEta.h +++ b/Detector/DetSegmentation/DetSegmentation/FCCSWGridPhiEta.h @@ -4,7 +4,7 @@ // FCCSW #include "DetSegmentation/GridEta.h" -/** GridPhiEta Detector/DetSegmentation/DetSegmentation/GridPhiEta.h GridPhiEta.h +/** FCCSWGridPhiEta Detector/DetSegmentation/DetSegmentation/FCCSWGridPhiEta.h FCCSWGridPhiEta.h * * Segmentation in eta and phi. * Based on GridEta, addition of azimuthal angle coordinate. @@ -12,17 +12,17 @@ * @author Anna Zaborowska */ -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { -class GridPhiEta : public GridEta { +class FCCSWGridPhiEta : public GridEta { public: /// default constructor using an arbitrary type - GridPhiEta(const std::string& aCellEncoding); + FCCSWGridPhiEta(const std::string& aCellEncoding); /// Default constructor used by derived classes passing an existing decoder - GridPhiEta(BitField64* decoder); + FCCSWGridPhiEta(BitField64* decoder); /// destructor - virtual ~GridPhiEta() = default; + virtual ~FCCSWGridPhiEta() = default; /** Determine the global position based on the cell ID. * @warning This segmentation has no knowledge of radius, so radius = 1 is taken into calculations. diff --git a/Detector/DetSegmentation/DetSegmentation/GridPhiEtaHandle.h b/Detector/DetSegmentation/DetSegmentation/FCCSWGridPhiEtaHandle.h similarity index 79% rename from Detector/DetSegmentation/DetSegmentation/GridPhiEtaHandle.h rename to Detector/DetSegmentation/DetSegmentation/FCCSWGridPhiEtaHandle.h index 250a4a1f6..c1745ff99 100644 --- a/Detector/DetSegmentation/DetSegmentation/GridPhiEtaHandle.h +++ b/Detector/DetSegmentation/DetSegmentation/FCCSWGridPhiEtaHandle.h @@ -2,19 +2,17 @@ #define DD4HEP_DDCORE_GRIDPHIETA_H 1 // FCCSW -#include "DetSegmentation/GridPhiEta.h" +#include "DetSegmentation/FCCSWGridPhiEta.h" // DD4hep #include "DD4hep/Segmentations.h" -#include "DD4hep/objects/SegmentationsInterna.h" +#include "DD4hep/detail/SegmentationsInterna.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations -/// Namespace for the geometry part of the AIDA detector description toolkit -namespace Geometry { // Forward declarations class Segmentation; @@ -22,7 +20,7 @@ template class SegmentationWrapper; /// We need some abbreviation to make the code more readable. -typedef Handle> GridPhiEtaHandle; +typedef Handle> FCCSWGridPhiEtaHandle; /// Implementation class for the grid phi-eta segmentation. /** @@ -44,32 +42,32 @@ typedef Handle> GridPhiEtaHandle * \author A. Zaborowska * \version 1.0 */ -class GridPhiEta : public GridPhiEtaHandle { +class FCCSWGridPhiEta : public FCCSWGridPhiEtaHandle { public: /// Defintiion of the basic handled object - typedef GridPhiEtaHandle::Implementation Object; + typedef FCCSWGridPhiEtaHandle::Object Object; public: /// Default constructor - GridPhiEta() = default; + FCCSWGridPhiEta() = default; /// Copy constructor - GridPhiEta(const GridPhiEta& e) = default; + FCCSWGridPhiEta(const FCCSWGridPhiEta& e) = default; /// Copy Constructor from segmentation base object - GridPhiEta(const Segmentation& e) : Handle(e) {} + FCCSWGridPhiEta(const Segmentation& e) : Handle(e) {} /// Copy constructor from handle - GridPhiEta(const Handle& e) : Handle(e) {} + FCCSWGridPhiEta(const Handle& e) : Handle(e) {} /// Copy constructor from other polymorph/equivalent handle template - GridPhiEta(const Handle& e) : Handle(e) {} + FCCSWGridPhiEta(const Handle& e) : Handle(e) {} /// Assignment operator - GridPhiEta& operator=(const GridPhiEta& seg) = default; + FCCSWGridPhiEta& operator=(const FCCSWGridPhiEta& seg) = default; /// Equality operator - bool operator==(const GridPhiEta& seg) const { return m_element == seg.m_element; } + bool operator==(const FCCSWGridPhiEta& 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 { + inline dd4hep::CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const { return access()->implementation->cellID(local, global, volID); } @@ -117,6 +115,5 @@ class GridPhiEta : public GridPhiEtaHandle { } }; -} /* End namespace Geometry */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_GRIDPHIETA_H diff --git a/Detector/DetSegmentation/DetSegmentation/GridEta.h b/Detector/DetSegmentation/DetSegmentation/GridEta.h index 7481ea10f..d0bd97451 100644 --- a/Detector/DetSegmentation/DetSegmentation/GridEta.h +++ b/Detector/DetSegmentation/DetSegmentation/GridEta.h @@ -14,7 +14,7 @@ * @author Anna Zaborowska */ -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class GridEta : public Segmentation { public: diff --git a/Detector/DetSegmentation/DetSegmentation/GridEtaHandle.h b/Detector/DetSegmentation/DetSegmentation/GridEtaHandle.h index 66b454e65..ff789a72d 100644 --- a/Detector/DetSegmentation/DetSegmentation/GridEtaHandle.h +++ b/Detector/DetSegmentation/DetSegmentation/GridEtaHandle.h @@ -6,15 +6,13 @@ // DD4hep #include "DD4hep/Segmentations.h" -#include "DD4hep/objects/SegmentationsInterna.h" +#include "DD4hep/detail/SegmentationsInterna.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations -/// Namespace for the geometry part of the AIDA detector description toolkit -namespace Geometry { // Forward declarations class Segmentation; @@ -47,7 +45,7 @@ typedef Handle> GridEtaHandle; class GridEta : public GridEtaHandle { public: /// Defintiion of the basic handled object - typedef GridEtaHandle::Implementation Object; + typedef GridEtaHandle::Object Object; public: /// Default constructor @@ -69,7 +67,7 @@ class GridEta : public GridEtaHandle { 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 { + inline dd4hep::CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const { return access()->implementation->cellID(local, global, volID); } @@ -101,6 +99,5 @@ class GridEta : public GridEtaHandle { } }; -} /* End namespace Geometry */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_GRIDETA_H diff --git a/Detector/DetSegmentation/DetSegmentation/GridRPhiEta.h b/Detector/DetSegmentation/DetSegmentation/GridRPhiEta.h index 662efd2a6..f090117cc 100644 --- a/Detector/DetSegmentation/DetSegmentation/GridRPhiEta.h +++ b/Detector/DetSegmentation/DetSegmentation/GridRPhiEta.h @@ -2,20 +2,20 @@ #define DETSEGMENTATION_GRIDRPHIETA_H // FCCSW -#include "DetSegmentation/GridPhiEta.h" +#include "DetSegmentation/FCCSWGridPhiEta.h" /** GridRPhiEta Detector/DetSegmentation/DetSegmentation/GridRPhiEta.h GridRPhiEta.h * * Segmentation in R, eta and phi. - * Based on GridPhiEta, addition of radial coordinate. + * Based on FCCSWGridPhiEta, addition of radial coordinate. * This segmentation returns global position of the cell based on the cellID. * * @author Anna Zaborowska */ -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { -class GridRPhiEta : public GridPhiEta { +class GridRPhiEta : public FCCSWGridPhiEta { public: /// default constructor using an arbitrary type GridRPhiEta(const std::string& aCellEncoding); diff --git a/Detector/DetSegmentation/DetSegmentation/GridRPhiEtaHandle.h b/Detector/DetSegmentation/DetSegmentation/GridRPhiEtaHandle.h index cdf517200..41519f86f 100644 --- a/Detector/DetSegmentation/DetSegmentation/GridRPhiEtaHandle.h +++ b/Detector/DetSegmentation/DetSegmentation/GridRPhiEtaHandle.h @@ -6,15 +6,13 @@ // DD4hep #include "DD4hep/Segmentations.h" -#include "DD4hep/objects/SegmentationsInterna.h" +#include "DD4hep/detail/SegmentationsInterna.h" /// Namespace for the AIDA detector description toolkit -namespace DD4hep { +namespace dd4hep { /// Namespace for base segmentations -/// Namespace for the geometry part of the AIDA detector description toolkit -namespace Geometry { // Forward declarations class Segmentation; @@ -47,7 +45,7 @@ typedef Handle> GridRPhiEtaHand class GridRPhiEta : public GridRPhiEtaHandle { public: /// Defintiion of the basic handled object - typedef GridRPhiEtaHandle::Implementation Object; + typedef GridRPhiEtaHandle::Object Object; public: /// Default constructor @@ -69,7 +67,7 @@ class GridRPhiEta : public GridRPhiEtaHandle { 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 { + inline dd4hep::CellID cellID(const Position& local, const Position& global, const VolumeID& volID) const { return access()->implementation->cellID(local, global, volID); } @@ -133,6 +131,5 @@ class GridRPhiEta : public GridRPhiEtaHandle { } }; -} /* End namespace Geometry */ -} /* End namespace DD4hep */ +} /* End namespace dd4hep */ #endif // DD4HEP_DDCORE_GRIDRPHIETA_H diff --git a/Detector/DetSegmentation/src/GridPhiEta.cpp b/Detector/DetSegmentation/src/FCCSWGridPhiEta.cpp similarity index 78% rename from Detector/DetSegmentation/src/GridPhiEta.cpp rename to Detector/DetSegmentation/src/FCCSWGridPhiEta.cpp index 901fdd33e..72f7c420e 100644 --- a/Detector/DetSegmentation/src/GridPhiEta.cpp +++ b/Detector/DetSegmentation/src/FCCSWGridPhiEta.cpp @@ -1,12 +1,12 @@ -#include "DetSegmentation/GridPhiEta.h" +#include "DetSegmentation/FCCSWGridPhiEta.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string -GridPhiEta::GridPhiEta(const std::string& cellEncoding) : GridEta(cellEncoding) { +FCCSWGridPhiEta::FCCSWGridPhiEta(const std::string& cellEncoding) : GridEta(cellEncoding) { // define type and description - _type = "GridPhiEta"; + _type = "FCCSWGridPhiEta"; _description = "Phi-eta segmentation in the global coordinates"; // register all necessary parameters (additional to those registered in GridEta) @@ -15,9 +15,9 @@ GridPhiEta::GridPhiEta(const std::string& cellEncoding) : GridEta(cellEncoding) registerIdentifier("identifier_phi", "Cell ID identifier for phi", m_phiID, "phi"); } -GridPhiEta::GridPhiEta(BitField64* decoder) : GridEta(decoder) { +FCCSWGridPhiEta::FCCSWGridPhiEta(BitField64* decoder) : GridEta(decoder) { // define type and description - _type = "GridPhiEta"; + _type = "FCCSWGridPhiEta"; _description = "Phi-eta segmentation in the global coordinates"; // register all necessary parameters (additional to those registered in GridEta) @@ -27,13 +27,13 @@ GridPhiEta::GridPhiEta(BitField64* decoder) : GridEta(decoder) { } /// determine the local based on the cell ID -Vector3D GridPhiEta::position(const CellID& cID) const { +Vector3D FCCSWGridPhiEta::position(const CellID& cID) const { _decoder->setValue(cID); return positionFromREtaPhi(1.0, eta(), phi()); } /// determine the cell ID based on the position -CellID GridPhiEta::cellID(const Vector3D& /* localPosition */, const Vector3D& globalPosition, +CellID FCCSWGridPhiEta::cellID(const Vector3D& /* localPosition */, const Vector3D& globalPosition, const VolumeID& vID) const { _decoder->setValue(vID); double lEta = etaFromXYZ(globalPosition); @@ -44,13 +44,13 @@ CellID GridPhiEta::cellID(const Vector3D& /* localPosition */, const Vector3D& g } /// determine the azimuthal angle phi based on the current cell ID -double GridPhiEta::phi() const { +double FCCSWGridPhiEta::phi() const { CellID phiValue = (*_decoder)[m_phiID].value(); return binToPosition(phiValue, 2. * M_PI / (double)m_phiBins, m_offsetPhi); } /// determine the azimuthal angle phi based on the cell ID -double GridPhiEta::phi(const CellID& cID) const { +double FCCSWGridPhiEta::phi(const CellID& cID) const { _decoder->setValue(cID); CellID phiValue = (*_decoder)[m_phiID].value(); return binToPosition(phiValue, 2. * M_PI / (double)m_phiBins, m_offsetPhi); diff --git a/Detector/DetSegmentation/src/FCCSWGridPhiEtaHandle.cpp b/Detector/DetSegmentation/src/FCCSWGridPhiEtaHandle.cpp new file mode 100644 index 000000000..cddb065d7 --- /dev/null +++ b/Detector/DetSegmentation/src/FCCSWGridPhiEtaHandle.cpp @@ -0,0 +1,4 @@ +#include "DetSegmentation/FCCSWGridPhiEtaHandle.h" +#include "DD4hep/detail/Handle.inl" + +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(dd4hep::DDSegmentation::FCCSWGridPhiEta); diff --git a/Detector/DetSegmentation/src/GridEta.cpp b/Detector/DetSegmentation/src/GridEta.cpp index c013f1869..f36e26e15 100644 --- a/Detector/DetSegmentation/src/GridEta.cpp +++ b/Detector/DetSegmentation/src/GridEta.cpp @@ -1,6 +1,6 @@ #include "DetSegmentation/GridEta.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string diff --git a/Detector/DetSegmentation/src/GridEtaHandle.cpp b/Detector/DetSegmentation/src/GridEtaHandle.cpp index e466f9ee1..cb004ae06 100644 --- a/Detector/DetSegmentation/src/GridEtaHandle.cpp +++ b/Detector/DetSegmentation/src/GridEtaHandle.cpp @@ -1,4 +1,4 @@ #include "DetSegmentation/GridEtaHandle.h" -#include "DD4hep/Handle.inl" +#include "DD4hep/detail/Handle.inl" -DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DD4hep::DDSegmentation::GridEta); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(dd4hep::DDSegmentation::GridEta); diff --git a/Detector/DetSegmentation/src/GridPhiEtaHandle.cpp b/Detector/DetSegmentation/src/GridPhiEtaHandle.cpp deleted file mode 100644 index a1457c8b5..000000000 --- a/Detector/DetSegmentation/src/GridPhiEtaHandle.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "DetSegmentation/GridPhiEtaHandle.h" -#include "DD4hep/Handle.inl" - -DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DD4hep::DDSegmentation::GridPhiEta); diff --git a/Detector/DetSegmentation/src/GridRPhiEta.cpp b/Detector/DetSegmentation/src/GridRPhiEta.cpp index eecfd5abe..28b2ce784 100644 --- a/Detector/DetSegmentation/src/GridRPhiEta.cpp +++ b/Detector/DetSegmentation/src/GridRPhiEta.cpp @@ -1,27 +1,27 @@ #include "DetSegmentation/GridRPhiEta.h" -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { /// default constructor using an encoding string -GridRPhiEta::GridRPhiEta(const std::string& cellEncoding) : GridPhiEta(cellEncoding) { +GridRPhiEta::GridRPhiEta(const std::string& cellEncoding) : FCCSWGridPhiEta(cellEncoding) { // define type and description _type = "GridRPhiEta"; _description = "R-phi-eta segmentation in the global coordinates"; - // register all necessary parameters (additional to those registered in GridPhiEta) + // register all necessary parameters (additional to those registered in FCCSWGridPhiEta) registerParameter("grid_size_r", "Cell size in radial distance", m_gridSizeR, 1., SegmentationParameter::LengthUnit); registerParameter("offset_r", "Angular offset in radial distance", m_offsetR, 0., SegmentationParameter::LengthUnit, true); registerIdentifier("identifier_r", "Cell ID identifier for R", m_rID, "r"); } -GridRPhiEta::GridRPhiEta(BitField64* decoder) : GridPhiEta(decoder) { +GridRPhiEta::GridRPhiEta(BitField64* decoder) : FCCSWGridPhiEta(decoder) { // define type and description _type = "GridRPhiEta"; _description = "R-phi-eta segmentation in the global coordinates"; - // register all necessary parameters (additional to those registered in GridPhiEta) + // register all necessary parameters (additional to those registered in FCCSWGridPhiEta) registerParameter("grid_size_r", "Cell size in radial distance", m_gridSizeR, 1., SegmentationParameter::LengthUnit); registerParameter("offset_r", "Angular offset in radial distance", m_offsetR, 0., SegmentationParameter::LengthUnit, true); diff --git a/Detector/DetSegmentation/src/GridRPhiEtaHandle.cpp b/Detector/DetSegmentation/src/GridRPhiEtaHandle.cpp index 10461cff9..767bc557c 100644 --- a/Detector/DetSegmentation/src/GridRPhiEtaHandle.cpp +++ b/Detector/DetSegmentation/src/GridRPhiEtaHandle.cpp @@ -1,4 +1,4 @@ #include "DetSegmentation/GridRPhiEtaHandle.h" -#include "DD4hep/Handle.inl" +#include "DD4hep/detail/Handle.inl" -DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DD4hep::DDSegmentation::GridRPhiEta); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(dd4hep::DDSegmentation::GridRPhiEta); diff --git a/Detector/DetSegmentation/src/plugins/SegmentationFactories.cpp b/Detector/DetSegmentation/src/plugins/SegmentationFactories.cpp index 18fac8d98..bcca632f8 100644 --- a/Detector/DetSegmentation/src/plugins/SegmentationFactories.cpp +++ b/Detector/DetSegmentation/src/plugins/SegmentationFactories.cpp @@ -1,18 +1,18 @@ #include "DD4hep/Factories.h" -#include "DD4hep/objects/SegmentationsInterna.h" +#include "DD4hep/detail/SegmentationsInterna.h" namespace { template -DD4hep::Geometry::SegmentationObject* create_segmentation(DD4hep::Geometry::BitField64* decoder) { - return new DD4hep::Geometry::SegmentationWrapper(decoder); +dd4hep::SegmentationObject* create_segmentation(dd4hep::BitField64* decoder) { + return new dd4hep::SegmentationWrapper(decoder); } } #include "DetSegmentation/GridEta.h" -DECLARE_SEGMENTATION(GridEta, create_segmentation) +DECLARE_SEGMENTATION(GridEta, create_segmentation) -#include "DetSegmentation/GridPhiEta.h" -DECLARE_SEGMENTATION(GridPhiEta, create_segmentation) +#include "DetSegmentation/FCCSWGridPhiEta.h" +DECLARE_SEGMENTATION(FCCSWGridPhiEta, create_segmentation) #include "DetSegmentation/GridRPhiEta.h" -DECLARE_SEGMENTATION(GridRPhiEta, create_segmentation) +DECLARE_SEGMENTATION(GridRPhiEta, create_segmentation) diff --git a/Detector/DetSensitive/DetSensitive/AggregateCalorimeterSD.h b/Detector/DetSensitive/DetSensitive/AggregateCalorimeterSD.h index b8a0d07df..72daefd5a 100644 --- a/Detector/DetSensitive/DetSensitive/AggregateCalorimeterSD.h +++ b/Detector/DetSensitive/DetSensitive/AggregateCalorimeterSD.h @@ -12,7 +12,7 @@ /** AggregateCalorimeterSD DetectorDescription/DetSensitive/src/AggregateCalorimeterSD.h AggregateCalorimeterSD.h * * Sensitive detector for calorimeter (aggregates energy deposits within each cell). - * It is based on DD4hep::Simulation::Geant4GenericSD (but it is not identical). + * It is based on dd4hep::sim::Geant4GenericSD (but it is not identical). * In particular, the position of the hit is set to G4Step::GetPreStepPoint() position. * No timing information is saved (energy deposits are aggregated in the cells) * @@ -29,7 +29,7 @@ class AggregateCalorimeterSD : public G4VSensitiveDetector { */ AggregateCalorimeterSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg); + const dd4hep::Segmentation& aSeg); /// Destructor virtual ~AggregateCalorimeterSD(); /** Initialization. @@ -49,9 +49,9 @@ class AggregateCalorimeterSD : public G4VSensitiveDetector { private: /// Collection of calorimeter hits - G4THitsCollection* m_calorimeterCollection; + G4THitsCollection* m_calorimeterCollection; /// Segmentation of the detector used to retrieve the cell Ids - DD4hep::Geometry::Segmentation m_seg; + dd4hep::Segmentation m_seg; }; } diff --git a/Detector/DetSensitive/DetSensitive/BirksLawCalorimeterSD.h b/Detector/DetSensitive/DetSensitive/BirksLawCalorimeterSD.h index 6adcd37a2..952567635 100644 --- a/Detector/DetSensitive/DetSensitive/BirksLawCalorimeterSD.h +++ b/Detector/DetSensitive/DetSensitive/BirksLawCalorimeterSD.h @@ -12,7 +12,7 @@ /** BirksLawCalorimeterSD DetectorDescription/DetSensitive/src/BirksLawCalorimeterSD.h BirksLawCalorimeterSD.h * * Sensitive detector for calorimeters, using Polystyrene. - * It is based on DD4hep::Simulation::Geant4GenericSD (but it is not identical). + * It is based on dd4hep::sim::Geant4GenericSD (but it is not identical). * In particular, the position of the hit is set to G4Step::GetPreStepPoint() position. * New hit is created for each energy deposit. * No timing information is saved. @@ -30,7 +30,7 @@ class BirksLawCalorimeterSD : public G4VSensitiveDetector { */ BirksLawCalorimeterSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg); + const dd4hep::Segmentation& aSeg); /// Destructor virtual ~BirksLawCalorimeterSD(); /** Initialization. @@ -53,9 +53,9 @@ class BirksLawCalorimeterSD : public G4VSensitiveDetector { private: /// Collection of calorimeter hits - G4THitsCollection* m_calorimeterCollection; + G4THitsCollection* m_calorimeterCollection; /// Segmentation of the detector used to retrieve the cell Ids - DD4hep::Geometry::Segmentation m_seg; + dd4hep::Segmentation m_seg; // Variables needed for the calculation of birks law const std::string m_material; const double m_birk1; diff --git a/Detector/DetSensitive/DetSensitive/FullParticleAbsorptionSD.h b/Detector/DetSensitive/DetSensitive/FullParticleAbsorptionSD.h index bc68f2e6a..31bf65038 100644 --- a/Detector/DetSensitive/DetSensitive/FullParticleAbsorptionSD.h +++ b/Detector/DetSensitive/DetSensitive/FullParticleAbsorptionSD.h @@ -29,7 +29,7 @@ class FullParticleAbsorptionSD : public G4VSensitiveDetector { */ FullParticleAbsorptionSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg); + const dd4hep::Segmentation& aSeg); /// Destructor virtual ~FullParticleAbsorptionSD(); /** Initialization. @@ -48,9 +48,9 @@ class FullParticleAbsorptionSD : public G4VSensitiveDetector { private: /// Collection of calorimeter hits - G4THitsCollection* m_calorimeterCollection; + G4THitsCollection* m_calorimeterCollection; /// Segmentation of the detector used to retrieve the cell Ids - DD4hep::Geometry::Segmentation m_seg; + dd4hep::Segmentation m_seg; }; } diff --git a/Detector/DetSensitive/DetSensitive/GflashCalorimeterSD.h b/Detector/DetSensitive/DetSensitive/GflashCalorimeterSD.h index 312c734b6..daae0c90d 100644 --- a/Detector/DetSensitive/DetSensitive/GflashCalorimeterSD.h +++ b/Detector/DetSensitive/DetSensitive/GflashCalorimeterSD.h @@ -30,7 +30,7 @@ class GflashCalorimeterSD : public G4VSensitiveDetector, public G4VGFlashSensiti */ GflashCalorimeterSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg); + const dd4hep::Segmentation& aSeg); /// Destructor ~GflashCalorimeterSD(); /** Initialization. @@ -60,9 +60,9 @@ class GflashCalorimeterSD : public G4VSensitiveDetector, public G4VGFlashSensiti private: /// Collection of calorimeter hits that get registered in G4Event and deleted in ~G4Event - G4THitsCollection* m_calorimeterCollection; + G4THitsCollection* m_calorimeterCollection; /// Segmentation of the detector used to retrieve the cell Ids - DD4hep::Geometry::Segmentation m_seg; + dd4hep::Segmentation m_seg; }; } diff --git a/Detector/DetSensitive/DetSensitive/MiddleStepTrackerSD.h b/Detector/DetSensitive/DetSensitive/MiddleStepTrackerSD.h index d04b4fff9..c212bad7f 100644 --- a/Detector/DetSensitive/DetSensitive/MiddleStepTrackerSD.h +++ b/Detector/DetSensitive/DetSensitive/MiddleStepTrackerSD.h @@ -12,7 +12,7 @@ * * Sensitive detector for tracker. It takes middle position between G4Step::GetPreStepPoint() * and G4Step::GetPostStepPoint() to calculate the cell ID (from segmentation) and to store in cluster. - * It is based on DD4hep::Simulation::Geant4GenericSD (and is meant to be identical). + * It is based on dd4hep::sim::Geant4GenericSD (and is meant to be identical). * * @author Anna Zaborowska */ @@ -26,7 +26,7 @@ class MiddleStepTrackerSD : public G4VSensitiveDetector { */ MiddleStepTrackerSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg); + const dd4hep::Segmentation& aSeg); /// Destructor virtual ~MiddleStepTrackerSD(); /** Initialization. @@ -45,9 +45,9 @@ class MiddleStepTrackerSD : public G4VSensitiveDetector { private: /// Collection of tracker hits - G4THitsCollection* m_trackerCollection; + G4THitsCollection* m_trackerCollection; /// Segmentation of the detector used to retrieve the cell Ids - DD4hep::Geometry::Segmentation m_seg; + dd4hep::Segmentation m_seg; }; } diff --git a/Detector/DetSensitive/DetSensitive/SimpleCalorimeterSD.h b/Detector/DetSensitive/DetSensitive/SimpleCalorimeterSD.h index affca26e5..ccc344219 100644 --- a/Detector/DetSensitive/DetSensitive/SimpleCalorimeterSD.h +++ b/Detector/DetSensitive/DetSensitive/SimpleCalorimeterSD.h @@ -12,7 +12,7 @@ /** SimpleCalorimeterSD DetectorDescription/DetSensitive/src/SimpleCalorimeterSD.h SimpleCalorimeterSD.h * * Simple sensitive detector for calorimeter. - * It is based on DD4hep::Simulation::Geant4GenericSD (but it is not identical). + * It is based on dd4hep::sim::Geant4GenericSD (but it is not identical). * In particular, the position of the hit is set to G4Step::GetPreStepPoint() position. * New hit is created for each energy deposit. * No timing information is saved. @@ -30,7 +30,7 @@ class SimpleCalorimeterSD : public G4VSensitiveDetector { */ SimpleCalorimeterSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg); + const dd4hep::Segmentation& aSeg); /// Destructor virtual ~SimpleCalorimeterSD(); /** Initialization. @@ -49,9 +49,9 @@ class SimpleCalorimeterSD : public G4VSensitiveDetector { private: /// Collection of calorimeter hits - G4THitsCollection* m_calorimeterCollection; + G4THitsCollection* m_calorimeterCollection; /// Segmentation of the detector used to retrieve the cell Ids - DD4hep::Geometry::Segmentation m_seg; + dd4hep::Segmentation m_seg; }; } diff --git a/Detector/DetSensitive/DetSensitive/SimpleTrackerSD.h b/Detector/DetSensitive/DetSensitive/SimpleTrackerSD.h index 77239fd8a..6ff3c3fd2 100644 --- a/Detector/DetSensitive/DetSensitive/SimpleTrackerSD.h +++ b/Detector/DetSensitive/DetSensitive/SimpleTrackerSD.h @@ -27,7 +27,7 @@ class SimpleTrackerSD : public G4VSensitiveDetector { */ SimpleTrackerSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg); + const dd4hep::Segmentation& aSeg); /// Destructor virtual ~SimpleTrackerSD(); /** Initialization. @@ -46,9 +46,9 @@ class SimpleTrackerSD : public G4VSensitiveDetector { private: /// Collection of tracker hits - G4THitsCollection* m_trackerCollection; + G4THitsCollection* m_trackerCollection; /// Segmentation of the detector used to retrieve the cell Ids - DD4hep::Geometry::Segmentation m_seg; + dd4hep::Segmentation m_seg; }; } diff --git a/Detector/DetSensitive/src/AggregateCalorimeterSD.cpp b/Detector/DetSensitive/src/AggregateCalorimeterSD.cpp index 79771d92e..84e8c89b2 100644 --- a/Detector/DetSensitive/src/AggregateCalorimeterSD.cpp +++ b/Detector/DetSensitive/src/AggregateCalorimeterSD.cpp @@ -16,7 +16,7 @@ namespace det { AggregateCalorimeterSD::AggregateCalorimeterSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg) + const dd4hep::Segmentation& aSeg) : G4VSensitiveDetector(aDetectorName), m_calorimeterCollection(nullptr), m_seg(aSeg) { // name of the collection of hits is determined byt the readout name (from XML) collectionName.insert(aReadoutName); @@ -28,7 +28,7 @@ void AggregateCalorimeterSD::Initialize(G4HCofThisEvent* aHitsCollections) { // create a collection of hits and add it to G4HCofThisEvent // deleted in ~G4Event m_calorimeterCollection = - new G4THitsCollection(SensitiveDetectorName, collectionName[0]); + new G4THitsCollection(SensitiveDetectorName, collectionName[0]); aHitsCollections->AddHitsCollection(G4SDManager::GetSDMpointer()->GetCollectionID(m_calorimeterCollection), m_calorimeterCollection); } @@ -38,18 +38,18 @@ bool AggregateCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { G4double edep = aStep->GetTotalEnergyDeposit(); if (edep == 0.) return false; - // as in DD4hep::Simulation::Geant4GenericSD + // as in dd4hep::sim::Geant4GenericSD CLHEP::Hep3Vector prePos = aStep->GetPreStepPoint()->GetPosition(); CLHEP::Hep3Vector postPos = aStep->GetPostStepPoint()->GetPosition(); CLHEP::Hep3Vector midPos = 0.5 * (postPos + prePos); - DD4hep::Simulation::Position pos(midPos.x(), midPos.y(), midPos.z()); + dd4hep::Position pos(midPos.x(), midPos.y(), midPos.z()); // check the cell ID uint64_t id = utils::cellID(m_seg, *aStep); - DD4hep::Simulation::Geant4CalorimeterHit* hit = nullptr; - DD4hep::Simulation::Geant4CalorimeterHit* hitMatch = nullptr; + dd4hep::sim::Geant4CalorimeterHit* hit = nullptr; + dd4hep::sim::Geant4CalorimeterHit* hitMatch = nullptr; // Check if there is already some energy deposit in that cell for (int i = 0; i < m_calorimeterCollection->entries(); i++) { - hit = dynamic_cast(m_calorimeterCollection->GetHit(i)); + hit = dynamic_cast(m_calorimeterCollection->GetHit(i)); if (hit->cellID == id) { hitMatch = hit; hitMatch->energyDeposit += edep; @@ -58,7 +58,7 @@ bool AggregateCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { } // if not, create a new hit // deleted in ~G4Event - hitMatch = new DD4hep::Simulation::Geant4CalorimeterHit(pos); + hitMatch = new dd4hep::sim::Geant4CalorimeterHit(pos); hitMatch->cellID = id; hitMatch->energyDeposit = edep; m_calorimeterCollection->insert(hitMatch); diff --git a/Detector/DetSensitive/src/BirksLawCalorimeterSD.cpp b/Detector/DetSensitive/src/BirksLawCalorimeterSD.cpp index 00c8d13fd..2b2c29922 100644 --- a/Detector/DetSensitive/src/BirksLawCalorimeterSD.cpp +++ b/Detector/DetSensitive/src/BirksLawCalorimeterSD.cpp @@ -6,6 +6,7 @@ // DD4hep #include "DDG4/Geant4Mapping.h" #include "DDG4/Geant4VolumeManager.h" +#include "DDG4/Defs.h" // CLHEP #include "CLHEP/Vector/ThreeVector.h" @@ -16,7 +17,7 @@ namespace det { BirksLawCalorimeterSD::BirksLawCalorimeterSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg) + const dd4hep::Segmentation& aSeg) : G4VSensitiveDetector(aDetectorName), m_calorimeterCollection(nullptr), m_seg(aSeg), @@ -34,7 +35,7 @@ void BirksLawCalorimeterSD::Initialize(G4HCofThisEvent* aHitsCollections) { // create a collection of hits and add it to G4HCofThisEvent // deleted in ~G4Event m_calorimeterCollection = - new G4THitsCollection(SensitiveDetectorName, collectionName[0]); + new G4THitsCollection(SensitiveDetectorName, collectionName[0]); aHitsCollections->AddHitsCollection(G4SDManager::GetSDMpointer()->GetCollectionID(m_calorimeterCollection), m_calorimeterCollection); } @@ -66,10 +67,10 @@ bool BirksLawCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { } edep = response; - // as in DD4hep::Simulation::Geant4GenericSD + // as in dd4hep::sim::Geant4GenericSD CLHEP::Hep3Vector prePos = aStep->GetPreStepPoint()->GetPosition(); - DD4hep::Simulation::Position pos(prePos.x(), prePos.y(), prePos.z()); - auto hit = new DD4hep::Simulation::Geant4CalorimeterHit(pos); + dd4hep::Position pos(prePos.x(), prePos.y(), prePos.z()); + auto hit = new dd4hep::sim::Geant4CalorimeterHit(pos); hit->cellID = utils::cellID(m_seg, *aStep); hit->energyDeposit = edep; m_calorimeterCollection->insert(hit); diff --git a/Detector/DetSensitive/src/FullParticleAbsorptionSD.cpp b/Detector/DetSensitive/src/FullParticleAbsorptionSD.cpp index bb28bc255..3d9fbf8d9 100644 --- a/Detector/DetSensitive/src/FullParticleAbsorptionSD.cpp +++ b/Detector/DetSensitive/src/FullParticleAbsorptionSD.cpp @@ -16,7 +16,7 @@ namespace det { FullParticleAbsorptionSD::FullParticleAbsorptionSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg) + const dd4hep::Segmentation& aSeg) : G4VSensitiveDetector(aDetectorName), m_calorimeterCollection(nullptr), m_seg(aSeg) { // name of the collection of hits is determined byt the readout name (from XML) collectionName.insert(aReadoutName); @@ -28,7 +28,7 @@ void FullParticleAbsorptionSD::Initialize(G4HCofThisEvent* aHitsCollections) { // create a collection of hits and add it to G4HCofThisEvent // deleted in ~G4Event m_calorimeterCollection = - new G4THitsCollection(SensitiveDetectorName, collectionName[0]); + new G4THitsCollection(SensitiveDetectorName, collectionName[0]); aHitsCollections->AddHitsCollection(G4SDManager::GetSDMpointer()->GetCollectionID(m_calorimeterCollection), m_calorimeterCollection); } @@ -37,8 +37,8 @@ bool FullParticleAbsorptionSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { CLHEP::Hep3Vector prePos = aStep->GetPreStepPoint()->GetPosition(); G4Track* aTrack = aStep->GetTrack(); G4double kineticEnergy = aTrack->GetKineticEnergy(); - DD4hep::Simulation::Position pos(prePos.x(), prePos.y(), prePos.z()); - auto hit = new DD4hep::Simulation::Geant4CalorimeterHit(pos); + dd4hep::Position pos(prePos.x(), prePos.y(), prePos.z()); + auto hit = new dd4hep::sim::Geant4CalorimeterHit(pos); hit->cellID = utils::cellID(m_seg, *aStep); hit->energyDeposit = kineticEnergy; m_calorimeterCollection->insert(hit); diff --git a/Detector/DetSensitive/src/GflashCalorimeterSD.cpp b/Detector/DetSensitive/src/GflashCalorimeterSD.cpp index f6a1021dc..23643f80f 100644 --- a/Detector/DetSensitive/src/GflashCalorimeterSD.cpp +++ b/Detector/DetSensitive/src/GflashCalorimeterSD.cpp @@ -7,6 +7,7 @@ #include "DDG4/Geant4Converter.h" #include "DDG4/Geant4Mapping.h" #include "DDG4/Geant4VolumeManager.h" +#include "DDG4/Defs.h" // CLHEP #include "CLHEP/Vector/ThreeVector.h" @@ -17,7 +18,7 @@ namespace det { GflashCalorimeterSD::GflashCalorimeterSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg) + const dd4hep::Segmentation& aSeg) : G4VSensitiveDetector(aDetectorName), G4VGFlashSensitiveDetector(), m_seg(aSeg) { // name of the collection of hits is determined byt the readout name (from XML) collectionName.insert(aReadoutName); @@ -29,7 +30,7 @@ void GflashCalorimeterSD::Initialize(G4HCofThisEvent* aHitsCollections) { // create a collection of hits and add it to G4HCofThisEvent // deleted in ~G4Event m_calorimeterCollection = - new G4THitsCollection(SensitiveDetectorName, collectionName[0]); + new G4THitsCollection(SensitiveDetectorName, collectionName[0]); aHitsCollections->AddHitsCollection(G4SDManager::GetSDMpointer()->GetCollectionID(m_calorimeterCollection), m_calorimeterCollection); } @@ -41,10 +42,10 @@ bool GflashCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { if (edep == 0.) return false; CLHEP::Hep3Vector prePos = aStep->GetPreStepPoint()->GetPosition(); - DD4hep::Simulation::Position pos(prePos.x(), prePos.y(), prePos.z()); + dd4hep::Position pos(prePos.x(), prePos.y(), prePos.z()); // create a new hit // deleted in ~G4Event - DD4hep::Simulation::Geant4CalorimeterHit* hit = new DD4hep::Simulation::Geant4CalorimeterHit(pos); + dd4hep::sim::Geant4CalorimeterHit* hit = new dd4hep::sim::Geant4CalorimeterHit(pos); hit->cellID = utils::cellID(m_seg, *aStep); hit->energyDeposit = edep; m_calorimeterCollection->insert(hit); @@ -57,10 +58,10 @@ bool GflashCalorimeterSD::ProcessHits(G4GFlashSpot* aSpot, G4TouchableHistory*) // check if energy was deposited if (edep == 0.) return false; CLHEP::Hep3Vector geantPos = aSpot->GetEnergySpot()->GetPosition(); - DD4hep::Simulation::Position pos(geantPos.x(), geantPos.y(), geantPos.z()); + dd4hep::Position pos(geantPos.x(), geantPos.y(), geantPos.z()); // create a new hit // deleted in ~G4Event - DD4hep::Simulation::Geant4CalorimeterHit* hit = new DD4hep::Simulation::Geant4CalorimeterHit(pos); + dd4hep::sim::Geant4CalorimeterHit* hit = new dd4hep::sim::Geant4CalorimeterHit(pos); hit->cellID = cellID(*aSpot); hit->energyDeposit = edep; m_calorimeterCollection->insert(hit); @@ -68,14 +69,14 @@ bool GflashCalorimeterSD::ProcessHits(G4GFlashSpot* aSpot, G4TouchableHistory*) } uint64_t GflashCalorimeterSD::cellID(const G4GFlashSpot& aSpot) { - DD4hep::Simulation::Geant4VolumeManager volMgr = DD4hep::Simulation::Geant4Mapping::instance().volumeManager(); - DD4hep::Geometry::VolumeManager::VolumeID volID = volMgr.volumeID(aSpot.GetTouchableHandle()()); + dd4hep::sim::Geant4VolumeManager volMgr = dd4hep::sim::Geant4Mapping::instance().volumeManager(); + dd4hep::VolumeID volID = volMgr.volumeID(aSpot.GetTouchableHandle()()); if (m_seg.isValid()) { G4ThreeVector global = aSpot.GetEnergySpot()->GetPosition(); G4ThreeVector local = aSpot.GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(global); - DD4hep::Simulation::Position loc(local.x() * MM_2_CM, local.y() * MM_2_CM, local.z() * MM_2_CM); - DD4hep::Simulation::Position glob(global.x() * MM_2_CM, global.y() * MM_2_CM, global.z() * MM_2_CM); - DD4hep::Geometry::VolumeManager::VolumeID cID = m_seg.cellID(loc, glob, volID); + dd4hep::Position loc(local.x() * MM_2_CM, local.y() * MM_2_CM, local.z() * MM_2_CM); + dd4hep::Position glob(global.x() * MM_2_CM, global.y() * MM_2_CM, global.z() * MM_2_CM); + dd4hep::VolumeID cID = m_seg.cellID(loc, glob, volID); return cID; } return volID; diff --git a/Detector/DetSensitive/src/MiddleStepTrackerSD.cpp b/Detector/DetSensitive/src/MiddleStepTrackerSD.cpp index b7115f77f..79f2c9242 100644 --- a/Detector/DetSensitive/src/MiddleStepTrackerSD.cpp +++ b/Detector/DetSensitive/src/MiddleStepTrackerSD.cpp @@ -6,6 +6,7 @@ // DD4hep #include "DDG4/Geant4Mapping.h" #include "DDG4/Geant4VolumeManager.h" +#include "DDG4/Defs.h" // CLHEP #include "CLHEP/Vector/ThreeVector.h" @@ -16,7 +17,7 @@ namespace det { MiddleStepTrackerSD::MiddleStepTrackerSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg) + const dd4hep::Segmentation& aSeg) : G4VSensitiveDetector(aDetectorName), m_trackerCollection(nullptr), m_seg(aSeg) { // name of the collection of hits is determined byt the readout name (from XML) collectionName.insert(aReadoutName); @@ -27,7 +28,7 @@ MiddleStepTrackerSD::~MiddleStepTrackerSD() {} void MiddleStepTrackerSD::Initialize(G4HCofThisEvent* aHitsCollections) { // create a collection of hits and add it to G4HCofThisEvent // deleted in ~G4Event - m_trackerCollection = new G4THitsCollection(SensitiveDetectorName, collectionName[0]); + m_trackerCollection = new G4THitsCollection(SensitiveDetectorName, collectionName[0]); aHitsCollections->AddHitsCollection(G4SDManager::GetSDMpointer()->GetCollectionID(m_trackerCollection), m_trackerCollection); } @@ -37,17 +38,17 @@ bool MiddleStepTrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { G4double edep = aStep->GetTotalEnergyDeposit(); if (edep == 0.) return false; - // as in DD4hep::Simulation::Geant4GenericSD + // as in dd4hep::sim::Geant4GenericSD CLHEP::Hep3Vector prePos = aStep->GetPreStepPoint()->GetPosition(); CLHEP::Hep3Vector postPos = aStep->GetPostStepPoint()->GetPosition(); CLHEP::Hep3Vector medPos = 0.5 * (prePos + postPos); // middle position between prestep and poststep is saved to cluster - DD4hep::Simulation::Position position(medPos.x(), medPos.y(), medPos.z()); + dd4hep::Position position(medPos.x(), medPos.y(), medPos.z()); CLHEP::Hep3Vector direction = postPos - prePos; // create a hit and add it to collection const G4Track* track = aStep->GetTrack(); // deleted in ~G4Event - auto hit = new DD4hep::Simulation::Geant4TrackerHit( + auto hit = new dd4hep::sim::Geant4TrackerHit( track->GetTrackID(), track->GetDefinition()->GetPDGEncoding(), edep, track->GetGlobalTime()); // take mid position between prestep and poststep to calculate the position in segmentation hit->cellID = utils::cellID(m_seg, *aStep, false); diff --git a/Detector/DetSensitive/src/SDWrapper.cpp b/Detector/DetSensitive/src/SDWrapper.cpp index 70e1d5518..2a76e12fc 100644 --- a/Detector/DetSensitive/src/SDWrapper.cpp +++ b/Detector/DetSensitive/src/SDWrapper.cpp @@ -1,4 +1,4 @@ -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDG4/Factories.h" #include "DetSensitive/AggregateCalorimeterSD.h" @@ -9,64 +9,64 @@ #include "DetSensitive/SimpleCalorimeterSD.h" #include "DetSensitive/SimpleTrackerSD.h" -namespace DD4hep { -namespace Simulation { +namespace dd4hep { +namespace sim { // All G4VSensitiveDetector are deleted by ~G4SDManager called by ~G4RunManagerKernel // Factory method to create an instance of SimpleTrackerSD -static G4VSensitiveDetector* create_simple_tracker_sd(const std::string& aDetectorName, DD4hep::Geometry::LCDD& aLcdd) { +static G4VSensitiveDetector* create_simple_tracker_sd(const std::string& aDetectorName, dd4hep::Detector& aLcdd) { std::string readoutName = aLcdd.sensitiveDetector(aDetectorName).readout().name(); return new det::SimpleTrackerSD( aDetectorName, readoutName, aLcdd.sensitiveDetector(aDetectorName).readout().segmentation()); } // Factory method to create an instance of MiddleStepTrackerSD static G4VSensitiveDetector* create_middle_step_tracker_sd(const std::string& aDetectorName, - DD4hep::Geometry::LCDD& aLcdd) { + dd4hep::Detector& aLcdd) { std::string readoutName = aLcdd.sensitiveDetector(aDetectorName).readout().name(); return new det::MiddleStepTrackerSD( aDetectorName, readoutName, aLcdd.sensitiveDetector(aDetectorName).readout().segmentation()); } // Factory method to create an instance of SimpleCalorimeterSD static G4VSensitiveDetector* create_simple_calorimeter_sd(const std::string& aDetectorName, - DD4hep::Geometry::LCDD& aLcdd) { + dd4hep::Detector& aLcdd) { std::string readoutName = aLcdd.sensitiveDetector(aDetectorName).readout().name(); return new det::SimpleCalorimeterSD( aDetectorName, readoutName, aLcdd.sensitiveDetector(aDetectorName).readout().segmentation()); } // Factory method to create an instance of SimpleCalorimeterSD with Birks law static G4VSensitiveDetector* create_birks_law_calorimeter_sd(const std::string& aDetectorName, - DD4hep::Geometry::LCDD& aLcdd) { + dd4hep::Detector& aLcdd) { std::string readoutName = aLcdd.sensitiveDetector(aDetectorName).readout().name(); return new det::BirksLawCalorimeterSD( aDetectorName, readoutName, aLcdd.sensitiveDetector(aDetectorName).readout().segmentation()); } // Factory method to create an instance of AggregateCalorimeterSD static G4VSensitiveDetector* create_aggregate_calorimeter_sd(const std::string& aDetectorName, - DD4hep::Geometry::LCDD& aLcdd) { + dd4hep::Detector& aLcdd) { std::string readoutName = aLcdd.sensitiveDetector(aDetectorName).readout().name(); return new det::AggregateCalorimeterSD( aDetectorName, readoutName, aLcdd.sensitiveDetector(aDetectorName).readout().segmentation()); } // Factory method to create an instance of GflashCalorimeterSD static G4VSensitiveDetector* create_gflash_calorimeter_sd(const std::string& aDetectorName, - DD4hep::Geometry::LCDD& aLcdd) { + dd4hep::Detector& aLcdd) { std::string readoutName = aLcdd.sensitiveDetector(aDetectorName).readout().name(); return new det::GflashCalorimeterSD( aDetectorName, readoutName, aLcdd.sensitiveDetector(aDetectorName).readout().segmentation()); } // Factory method to create an instance of FullParticleAbsorptionSD static G4VSensitiveDetector* create_full_particle_absorbtion_sd(const std::string& aDetectorName, - DD4hep::Geometry::LCDD& aLcdd) { + dd4hep::Detector& aLcdd) { std::string readoutName = aLcdd.sensitiveDetector(aDetectorName).readout().name(); return new det::FullParticleAbsorptionSD( aDetectorName, readoutName, aLcdd.sensitiveDetector(aDetectorName).readout().segmentation()); } } } -DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(SimpleTrackerSD, DD4hep::Simulation::create_simple_tracker_sd) -DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(MiddleStepTrackerSD, DD4hep::Simulation::create_middle_step_tracker_sd) -DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(SimpleCalorimeterSD, DD4hep::Simulation::create_simple_calorimeter_sd) -DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(BirksLawCalorimeterSD, DD4hep::Simulation::create_birks_law_calorimeter_sd) -DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(AggregateCalorimeterSD, DD4hep::Simulation::create_aggregate_calorimeter_sd) -DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(GflashCalorimeterSD, DD4hep::Simulation::create_gflash_calorimeter_sd) -DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(FullParticleAbsorptionSD, DD4hep::Simulation::create_full_particle_absorbtion_sd) +DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(SimpleTrackerSD, dd4hep::sim::create_simple_tracker_sd) +DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(MiddleStepTrackerSD, dd4hep::sim::create_middle_step_tracker_sd) +DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(SimpleCalorimeterSD, dd4hep::sim::create_simple_calorimeter_sd) +DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(BirksLawCalorimeterSD, dd4hep::sim::create_birks_law_calorimeter_sd) +DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(AggregateCalorimeterSD, dd4hep::sim::create_aggregate_calorimeter_sd) +DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(GflashCalorimeterSD, dd4hep::sim::create_gflash_calorimeter_sd) +DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(FullParticleAbsorptionSD, dd4hep::sim::create_full_particle_absorbtion_sd) diff --git a/Detector/DetSensitive/src/SimpleCalorimeterSD.cpp b/Detector/DetSensitive/src/SimpleCalorimeterSD.cpp index 877641233..044ff0535 100644 --- a/Detector/DetSensitive/src/SimpleCalorimeterSD.cpp +++ b/Detector/DetSensitive/src/SimpleCalorimeterSD.cpp @@ -4,6 +4,7 @@ #include "DetCommon/DetUtils.h" // DD4hep +#include "DDG4/Defs.h" #include "DDG4/Geant4Mapping.h" #include "DDG4/Geant4VolumeManager.h" @@ -16,7 +17,7 @@ namespace det { SimpleCalorimeterSD::SimpleCalorimeterSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg) + const dd4hep::Segmentation& aSeg) : G4VSensitiveDetector(aDetectorName), m_calorimeterCollection(nullptr), m_seg(aSeg) { // name of the collection of hits is determined byt the readout name (from XML) collectionName.insert(aReadoutName); @@ -28,7 +29,7 @@ void SimpleCalorimeterSD::Initialize(G4HCofThisEvent* aHitsCollections) { // create a collection of hits and add it to G4HCofThisEvent // deleted in ~G4Event m_calorimeterCollection = - new G4THitsCollection(SensitiveDetectorName, collectionName[0]); + new G4THitsCollection(SensitiveDetectorName, collectionName[0]); aHitsCollections->AddHitsCollection(G4SDManager::GetSDMpointer()->GetCollectionID(m_calorimeterCollection), m_calorimeterCollection); } @@ -38,10 +39,10 @@ bool SimpleCalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { G4double edep = aStep->GetTotalEnergyDeposit(); if (edep == 0.) return false; - // as in DD4hep::Simulation::Geant4GenericSD + // as in dd4hep::sim::Geant4GenericSD CLHEP::Hep3Vector prePos = aStep->GetPreStepPoint()->GetPosition(); - DD4hep::Simulation::Position pos(prePos.x(), prePos.y(), prePos.z()); - auto hit = new DD4hep::Simulation::Geant4CalorimeterHit(pos); + dd4hep::Position pos(prePos.x(), prePos.y(), prePos.z()); + auto hit = new dd4hep::sim::Geant4CalorimeterHit(pos); hit->cellID = utils::cellID(m_seg, *aStep); hit->energyDeposit = edep; m_calorimeterCollection->insert(hit); diff --git a/Detector/DetSensitive/src/SimpleTrackerSD.cpp b/Detector/DetSensitive/src/SimpleTrackerSD.cpp index 8580698cf..61cba8f86 100644 --- a/Detector/DetSensitive/src/SimpleTrackerSD.cpp +++ b/Detector/DetSensitive/src/SimpleTrackerSD.cpp @@ -16,7 +16,7 @@ namespace det { SimpleTrackerSD::SimpleTrackerSD(const std::string& aDetectorName, const std::string& aReadoutName, - const DD4hep::Geometry::Segmentation& aSeg) + const dd4hep::Segmentation& aSeg) : G4VSensitiveDetector(aDetectorName), m_trackerCollection(nullptr), m_seg(aSeg) { // name of the collection of hits is determined byt the readout name (from XML) collectionName.insert(aReadoutName); @@ -27,7 +27,7 @@ SimpleTrackerSD::~SimpleTrackerSD() {} void SimpleTrackerSD::Initialize(G4HCofThisEvent* aHitsCollections) { // create a collection of hits and add it to G4HCofThisEvent // deleted in ~G4Event - m_trackerCollection = new G4THitsCollection(SensitiveDetectorName, collectionName[0]); + m_trackerCollection = new G4THitsCollection(SensitiveDetectorName, collectionName[0]); aHitsCollections->AddHitsCollection(G4SDManager::GetSDMpointer()->GetCollectionID(m_trackerCollection), m_trackerCollection); } @@ -38,13 +38,13 @@ bool SimpleTrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { if (edep == 0.) return false; // get track const G4Track* track = aStep->GetTrack(); - // as in DD4hep::Simulation::Geant4GenericSD + // as in dd4hep::Geant4GenericSD CLHEP::Hep3Vector prePos = aStep->GetPreStepPoint()->GetPosition(); - DD4hep::Simulation::Position position(prePos.x(), prePos.y(), prePos.z()); + dd4hep::Position position(prePos.x(), prePos.y(), prePos.z()); CLHEP::Hep3Vector momentum = aStep->GetPreStepPoint()->GetMomentum(); // create a hit and add it to collection // deleted in ~G4Event - auto hit = new DD4hep::Simulation::Geant4TrackerHit( + auto hit = new dd4hep::sim::Geant4TrackerHit( track->GetTrackID(), track->GetDefinition()->GetPDGEncoding(), edep, track->GetGlobalTime()); hit->cellID = utils::cellID(m_seg, *aStep); hit->energyDeposit = edep; diff --git a/Detector/DetStudies/src/components/SamplingFractionInLayers.cpp b/Detector/DetStudies/src/components/SamplingFractionInLayers.cpp index f71aeef9a..69acfa832 100644 --- a/Detector/DetStudies/src/components/SamplingFractionInLayers.cpp +++ b/Detector/DetStudies/src/components/SamplingFractionInLayers.cpp @@ -12,7 +12,7 @@ #include "TVector2.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Readout.h" DECLARE_ALGORITHM_FACTORY(SamplingFractionInLayers) diff --git a/Detector/doc/DD4hepInFCCSW.md b/Detector/doc/DD4hepInFCCSW.md index 452c2330d..e202123fb 100644 --- a/Detector/doc/DD4hepInFCCSW.md +++ b/Detector/doc/DD4hepInFCCSW.md @@ -31,7 +31,7 @@ To first order two files are involved to describe a detector in DD4hep. Constructing Detector Geometry -- -Similarly to Geant4 itself, DD4hep tries to re-use detector elements without having to keep every instance in memory. I.e. many `DD4hep::Geometry::PlacedVolume` are used that refer to one `DD4hep::Geometry::Volume`. To exploit this feature as much as possible: +Similarly to Geant4 itself, DD4hep tries to re-use detector elements without having to keep every instance in memory. I.e. many `dd4hep::PlacedVolume` are used that refer to one `dd4hep::Volume`. To exploit this feature as much as possible: - Come up with the largest component that is repeatable (e.g. a detector wedge) - Usually this component is similar or equal to the components that are built when physically building the detector @@ -88,30 +88,30 @@ Imagine we want to create a simple cone with a radius of 1 m and a length of 1 m ~~~{.cpp} namespace detector { -static DD4hep::Geometry::Ref_t createElement( - DD4hep::Geometry::LCDD& lcdd, // dd4hep's main detector description interface +static dd4hep::Ref_t createElement( + dd4hep::Detector& lcdd, // dd4hep's main detector description interface xml_h xmlElement, // the xml-tree that describes this detector - DD4hep::Geometry::SensitiveDetector sensDet // dd4hep's interface to the sensitive detector + dd4hep::SensitiveDetector sensDet // dd4hep's interface to the sensitive detector ) { // Get the detector description from the xml-tree xml_det_t x_det = xml_h; std::string name = x_det.nameStr(); // Create the detector element - DD4hep::Geometry::DetElement coneDet( name, x_det.id() ); + dd4hep::DetElement coneDet( name, x_det.id() ); // Get the world volume - DD4hep::Geometry::Volume experimentalHall = lcdd.pickMotherVolume( coneDet ); // gets the containing volume (i.e. the world volume in this case) + dd4hep::Volume experimentalHall = lcdd.pickMotherVolume( coneDet ); // gets the containing volume (i.e. the world volume in this case) // Get the dimensions defined in the xml-tree xml_comp_t coneDim ( x_det.child( _U(dimensions) ) ); // Create the cone - DD4hep::Geometry::Cone cone( coneDim.dz(), coneDim.rmin1(), coneDim.rmax1(), coneDim.rmin2(), coneDim.rmax2()); + dd4hep::Cone cone( coneDim.dz(), coneDim.rmin1(), coneDim.rmax1(), coneDim.rmin2(), coneDim.rmax2()); // Create the volume corresponding to the cone - DD4hep::Geometry::Volume coneVol( x_det.nameStr()+ "_SimpleCone", cone, lcdd.material(coneDim.materialStr()) ); + dd4hep::Volume coneVol( x_det.nameStr()+ "_SimpleCone", cone, lcdd.material(coneDim.materialStr()) ); // Create the placed volume - DD4hep::Geometry::PlacedVolume conePhys; + dd4hep::PlacedVolume conePhys; // And place it in the world conePhys = experimentalHall.placeVolume( coneVol, // the volume to be placed - DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), // any rotation to be done - DD4hep::Geometry::Position trans(0., 0., 0. ) )); // the position where to place it + dd4hep::Transform3D(dd4hep::RotationZ(0.), // any rotation to be done + dd4hep::Position trans(0., 0., 0. ) )); // the position where to place it // connect placed volume and physical volume coneDet.setPlacement( conePhys ); } @@ -163,8 +163,8 @@ If you need to create your own custom SDs, see [User-defined Sensitive Detectors - The factory method should then contain (corresponding to the first case): ~~~{.cpp} -DD4hep::Geometry::SensitiveDetector sd = aSensDet; -DD4hep::XML::Dimension sdTyp = x_det.child(_U(sensitive)); // retrieve the type +dd4hep::SensitiveDetector sd = aSensDet; +dd4hep::xml::Dimension sdTyp = x_det.child(_U(sensitive)); // retrieve the type detVol.setSensitiveDetector(aSensDet); // set the type if ( x_det.isSensitive() ) { sd.setType(sdTyp.typeStr()); // set for the whole detector @@ -174,7 +174,7 @@ if ( x_det.isSensitive() ) { or (corresponding to the second case) ~~~{.cpp} -DD4hep::Geometry::SensitiveDetector aSensDet +dd4hep::SensitiveDetector aSensDet aSensDet.setType("SimpleTrackerSD"); // this could also be retrieved from xml like above if (xComp.isSensitive()) { modCompVol.setSensitiveDetector(aSensDet); // only set for certain components @@ -219,16 +219,16 @@ In order to recognise where the energy was deposited, the sensitive volume has * ~~~{.cpp} // imagine the rest as above conePhys = experimentalHall.placeVolume( coneVol, // the volume to be placed - DD4hep::Geometry::Transform3D(DD4hep::Geometry::RotationZ(0.), // any rotation to be done - DD4hep::Geometry::Position trans(0., 0., 0. ) )); // the position where to place it + dd4hep::Transform3D(dd4hep::RotationZ(0.), // any rotation to be done + dd4hep::Position trans(0., 0., 0. ) )); // the position where to place it // Add the ID for our sub detector, using the ID number given in the xml conePhys.addPhysVolID( "system", x_det.id() ); // connect placed volume and physical volume coneDet.setPlacement( conePhys ); // Here you define your volume (skipping how to get dimensions, see above): -DD4hep::Geometry::Box module( ... ); -DD4hep::Geometry::Volume moduleVol( ... ); +dd4hep::Box module( ... ); +dd4hep::Volume moduleVol( ... ); // Now we place the module: for (int iMod = 0; iMod < 80; ++iMod) { // skipping rotation and position here, but placing it somewhere: @@ -249,8 +249,8 @@ As mentioned above, you may want to define your own sensitive detector. For spec 2. Factory method (of SD) for DD4hep In order to use the common methods to store your information in the EDM output (at the end of simulation), we advise to use the DD4hep hits classes: -* [*DD4hep::Simulation::Geant4TrackerHit*](https://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/DDG4/include/DDG4/Geant4Hits.h?revision=1822&view=markup&pathrev=2132) -* [*DD4hep::Simulation::Geant4CalorimeterHit*](https://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/DDG4/include/DDG4/Geant4Hits.h?revision=1822&view=markup&pathrev=2132) +* [*dd4hep::sim::Geant4TrackerHit*](https://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/DDG4/include/DDG4/Geant4Hits.h?revision=1822&view=markup&pathrev=2132) +* [*dd4hep::sim::Geant4CalorimeterHit*](https://svnsrv.desy.de/viewvc/aidasoft/DD4hep/trunk/DDG4/include/DDG4/Geant4Hits.h?revision=1822&view=markup&pathrev=2132) If those classes are not sufficient, you'll need to create your own hit class implementation and the corresponding tools to translate your hit collections to FCC-EDM. @@ -259,22 +259,22 @@ If those classes are not sufficient, you'll need to create your own hit class im - Implementation of G4VSensitiveDetector class, e.g. `det::SimpleCalorimeterSD`: * `::Initialize(..)` - create the hit collection - * `::ProcessHits(..)` - add entries to the hit collection with position, cellId, energy deposit, time, ... Hit base class used in the collection is already implemented in DD4hep `DD4hep::Simulation::Geant4CalorimeterHit`. + * `::ProcessHits(..)` - add entries to the hit collection with position, cellId, energy deposit, time, ... Hit base class used in the collection is already implemented in DD4hep `dd4hep::sim::Geant4CalorimeterHit`. - There is a method to retrieve the cell identification based on the DD4hep segmentation (`det::segmentation::cellID(DD4hep::Geometry::Segmentation, const G4Step&)`). + There is a method to retrieve the cell identification based on the DD4hep segmentation (`det::segmentation::cellID(dd4hep::Segmentation, const G4Step&)`). ~~~{.cpp} namespace det { class SimpleCalorimeterSD : public G4VSensitiveDetector { public: - SimpleCalorimeterSD(std::string aDetectorName, std::string aReadoutName, DD4hep::Geometry::Segmentation aSeg); + SimpleCalorimeterSD(std::string aDetectorName, std::string aReadoutName, dd4hep::Segmentation aSeg); /// Destructor ~SimpleCalorimeterSD(); virtual void Initialize(G4HCofThisEvent* aHitsCollections) final; virtual bool ProcessHits(G4Step* aStep, G4TouchableHistory*) final; private: /// Collection of calorimeter hits - G4THitsCollection* calorimeterCollection; + G4THitsCollection* calorimeterCollection; }; } ~~~ @@ -283,11 +283,11 @@ private: Any other sensitive detector may be added in the same way. ~~~{.cpp} -namespace DD4hep { +namespace dd4hep { namespace Simulation { // Factory method to create an instance of SimpleCalorimeterSD static G4VSensitiveDetector* create_simple_calorimeter_sd(const std::string& aDetectorName, - DD4hep::Geometry::LCDD& aLcdd) { + dd4hep::Detector& aLcdd) { std::string readoutName = aLcdd.sensitiveDetector(aDetectorName).readout().name(); return new det::SimpleCalorimeterSD(aDetectorName, readoutName, @@ -295,7 +295,7 @@ static G4VSensitiveDetector* create_simple_calorimeter_sd(const std::string& aDe } } } -DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(SimpleCalorimeterSD,DD4hep::Simulation::create_simple_calorimeter_sd) +DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(SimpleCalorimeterSD,dd4hep::sim::create_simple_calorimeter_sd) ~~~ **Note** that the name we put in the `DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR` macro corresponds to the type `SimpleCalorimeterSD` in the xml-description, this creates the link between the factory method and the xml-description. diff --git a/Examples/src/InspectHitsCollectionsTool.cpp b/Examples/src/InspectHitsCollectionsTool.cpp index 507ab53d5..5da6a0028 100644 --- a/Examples/src/InspectHitsCollectionsTool.cpp +++ b/Examples/src/InspectHitsCollectionsTool.cpp @@ -48,8 +48,8 @@ StatusCode InspectHitsCollectionsTool::finalize() { return GaudiTool::finalize() StatusCode InspectHitsCollectionsTool::saveOutput(const G4Event& aEvent) { G4HCofThisEvent* collections = aEvent.GetHCofThisEvent(); G4VHitsCollection* collect; - DD4hep::Simulation::Geant4TrackerHit* hitT; - DD4hep::Simulation::Geant4CalorimeterHit* hitC; + dd4hep::sim::Geant4TrackerHit* hitT; + dd4hep::sim::Geant4CalorimeterHit* hitC; info() << "Obtaining hits collections that are stored in this event:" << endmsg; if (collections != nullptr) { for (int iter_coll = 0; iter_coll < collections->GetNumberOfCollections(); iter_coll++) { @@ -60,13 +60,13 @@ StatusCode InspectHitsCollectionsTool::saveOutput(const G4Event& aEvent) { size_t n_hit = collect->GetSize(); auto decoder = m_geoSvc->lcdd()->readout(collect->GetName()).idSpec().decoder(); for (size_t iter_hit = 0; iter_hit < n_hit; iter_hit++) { - hitT = dynamic_cast(collect->GetHit(iter_hit)); + hitT = dynamic_cast(collect->GetHit(iter_hit)); if (hitT) { decoder->setValue(hitT->cellID); debug() << "hit Edep: " << hitT->energyDeposit << "\tcellID: " << hitT->cellID << "\t" << decoder->valueString() << endmsg; } else { - hitC = dynamic_cast(collect->GetHit(iter_hit)); + hitC = dynamic_cast(collect->GetHit(iter_hit)); if (hitC) { decoder->setValue(hitC->cellID); debug() << "hit Edep: " << hitC->energyDeposit << "\tcellID: " << hitC->cellID << "\t" diff --git a/Generation/src/components/MomentumRangeParticleGun.cpp b/Generation/src/components/MomentumRangeParticleGun.cpp index ca35d9f0d..2a5212946 100644 --- a/Generation/src/components/MomentumRangeParticleGun.cpp +++ b/Generation/src/components/MomentumRangeParticleGun.cpp @@ -3,13 +3,14 @@ #include #include "GaudiKernel/DeclareFactoryEntries.h" -#include "GaudiKernel/IParticlePropertySvc.h" #include "GaudiKernel/IRndmGenSvc.h" #include "GaudiKernel/ParticleProperty.h" #include "GaudiKernel/PhysicalConstants.h" #include "GaudiKernel/SystemOfUnits.h" #include "HepMC/GenEvent.h" +#include "HepPDT/ParticleID.hh" +#include "Pythia8/ParticleData.h" DECLARE_TOOL_FACTORY(MomentumRangeParticleGun) @@ -35,7 +36,6 @@ StatusCode MomentumRangeParticleGun::initialize() { // Get the mass of the particle to be generated // - IParticlePropertySvc* ppSvc = svc("ParticlePropertySvc", true); // check momentum and angles if ((m_minMom > m_maxMom) || (m_minTheta > m_maxTheta) || (m_minPhi > m_maxPhi)) @@ -47,14 +47,13 @@ StatusCode MomentumRangeParticleGun::initialize() { // setup particle information m_masses.clear(); + auto pd = Pythia8::ParticleData(); info() << "Particle type chosen randomly from :"; PIDs::iterator icode; for (icode = m_pdgCodes.begin(); icode != m_pdgCodes.end(); ++icode) { - const ParticleProperty* particle = ppSvc->findByPythiaID(*icode); - m_masses.push_back((particle->mass())); - m_names.push_back(particle->particle()); - info() << " " << particle->particle(); + info() << " " << *icode; + m_masses.push_back(pd.m0(*icode)); } info() << endmsg; @@ -66,7 +65,6 @@ StatusCode MomentumRangeParticleGun::initialize() { info() << "Phi range: " << m_minPhi / Gaudi::Units::rad << " rad <-> " << m_maxPhi / Gaudi::Units::rad << " rad" << endmsg; - release(ppSvc); return sc; } @@ -102,7 +100,7 @@ void MomentumRangeParticleGun::generateParticle(Gaudi::LorentzVector& momentum, pdgId = m_pdgCodes[currentType]; - debug() << " -> " << m_names[currentType] << endmsg << " P = " << momentum << endmsg; + debug() << " -> " << pdgId << endmsg << " P = " << momentum << endmsg; } StatusCode MomentumRangeParticleGun::getNextEvent(HepMC::GenEvent& theEvent) { diff --git a/Generation/src/components/PythiaInterface.cpp b/Generation/src/components/PythiaInterface.cpp index e903616f4..1255759f6 100644 --- a/Generation/src/components/PythiaInterface.cpp +++ b/Generation/src/components/PythiaInterface.cpp @@ -20,7 +20,7 @@ #include "Generation/Units.h" // FCC EDM -#include "datamodel/FloatCollection.h" +#include "datamodel/FloatValueCollection.h" #include "HepMC/GenEvent.h" @@ -38,7 +38,7 @@ PythiaInterface::PythiaInterface(const std::string& type, const std::string& nam m_setting(nullptr) { declareProperty("VertexSmearingTool", m_vertexSmearingTool); - declarePrivateTool(m_vertexSmearingTool, "FlatSmearVertex/VertexSmearingTool"); + declareTool(m_vertexSmearingTool, "FlatSmearVertex/VertexSmearingTool"); } StatusCode PythiaInterface::initialize() { diff --git a/Generation/src/components/PythiaInterface.h b/Generation/src/components/PythiaInterface.h index 77cc35322..9bdecac33 100644 --- a/Generation/src/components/PythiaInterface.h +++ b/Generation/src/components/PythiaInterface.h @@ -21,7 +21,7 @@ class amcnlo_unitarised_interface; // Forward FCC EDM namespace fcc { -class FloatCollection; +class FloatValueCollection; } class PythiaInterface : public GaudiTool, virtual public IHepMCProviderTool { @@ -44,7 +44,7 @@ class PythiaInterface : public GaudiTool, virtual public IHepMCProviderTool { // Tool to smear vertices ToolHandle m_vertexSmearingTool; // Output handle for ME/PS matching variables - DataHandle m_handleMePsMatchingVars{"mePsMatchingVars", Gaudi::DataHandle::Writer, this}; + DataHandle m_handleMePsMatchingVars{"mePsMatchingVars", Gaudi::DataHandle::Writer, this}; int m_nAbort{0}; int m_iAbort{0}; diff --git a/Reconstruction/RecCalorimeter/CMakeLists.txt b/Reconstruction/RecCalorimeter/CMakeLists.txt index 905520e56..75ba04ec2 100644 --- a/Reconstruction/RecCalorimeter/CMakeLists.txt +++ b/Reconstruction/RecCalorimeter/CMakeLists.txt @@ -11,13 +11,16 @@ find_package(ROOT COMPONENTS Physics) find_package(FCCEDM) find_package(PODIO) find_package(HepMC) -find_package(DD4hep COMPONENTS DDSegmentation) +find_package(DD4hep) find_package(Geant4) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_ROOT}/cmake ) +include( DD4hep ) + gaudi_add_module(RecCalorimeterPlugins src/components/*.cpp INCLUDE_DIRS FastJet ROOT FWCore HepMC FCCEDM PODIO DD4hep DetInterface DetSegmentation Geant4 DetCommon RecInterface RecCalorimeter - LINK_LIBRARIES Fastjet ROOT GaudiAlgLib FCCEDM PODIO HepMC DD4hep DetSegmentation Geant4 DetCommon ${DD4hep_COMPONENT_LIBRARIES}) + LINK_LIBRARIES Fastjet ROOT GaudiAlgLib FCCEDM PODIO HepMC DD4hep DetSegmentation Geant4 DetCommon) include(CTest) gaudi_add_test(genJetClustering diff --git a/Reconstruction/RecCalorimeter/src/components/CalibrateInLayersTool.cpp b/Reconstruction/RecCalorimeter/src/components/CalibrateInLayersTool.cpp index 6fe046766..f9a3e29e6 100644 --- a/Reconstruction/RecCalorimeter/src/components/CalibrateInLayersTool.cpp +++ b/Reconstruction/RecCalorimeter/src/components/CalibrateInLayersTool.cpp @@ -4,7 +4,7 @@ #include "DetInterface/IGeoSvc.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Readout.h" DECLARE_TOOL_FACTORY(CalibrateInLayersTool) diff --git a/Reconstruction/RecCalorimeter/src/components/CaloTowerTool.cpp b/Reconstruction/RecCalorimeter/src/components/CaloTowerTool.cpp index da0f85970..8b68c5976 100644 --- a/Reconstruction/RecCalorimeter/src/components/CaloTowerTool.cpp +++ b/Reconstruction/RecCalorimeter/src/components/CaloTowerTool.cpp @@ -8,7 +8,7 @@ #include "datamodel/CaloHitCollection.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Readout.h" DECLARE_TOOL_FACTORY(CaloTowerTool) @@ -218,7 +218,7 @@ float CaloTowerTool::radiusForPosition() const { return m_radius; } void CaloTowerTool::CellsIntoTowers(std::vector>& aTowers, const fcc::CaloHitCollection* aCells, - DD4hep::DDSegmentation::GridPhiEta* aSegmentation) { + dd4hep::DDSegmentation::FCCSWGridPhiEta* aSegmentation) { // Loop over a collection of calorimeter cells and build calo towers // borders of the cell in eta/phi float etaCellMin = 0, etaCellMax = 0; @@ -297,13 +297,13 @@ void CaloTowerTool::CellsIntoTowers(std::vector>& aTowers, } } -DD4hep::DDSegmentation::GridPhiEta* CaloTowerTool::retrieveSegmentation(std::string aReadoutName) { - DD4hep::DDSegmentation::GridPhiEta* segmentation = nullptr; +dd4hep::DDSegmentation::FCCSWGridPhiEta* CaloTowerTool::retrieveSegmentation(std::string aReadoutName) { + dd4hep::DDSegmentation::FCCSWGridPhiEta* segmentation = nullptr; if (m_geoSvc->lcdd()->readouts().find(aReadoutName) == m_geoSvc->lcdd()->readouts().end()) { info() << "Readout does not exist! Please check if it is correct. Processing without it." << endmsg; } else { info() << "Readout " << aReadoutName << " found." << endmsg; - segmentation = dynamic_cast( + segmentation = dynamic_cast( m_geoSvc->lcdd()->readout(aReadoutName).segmentation().segmentation()); if (segmentation == nullptr) { error() << "There is no phi-eta segmentation for the readout " << aReadoutName << " defined." << endmsg; diff --git a/Reconstruction/RecCalorimeter/src/components/CaloTowerTool.h b/Reconstruction/RecCalorimeter/src/components/CaloTowerTool.h index 66e16af90..68bd832fa 100644 --- a/Reconstruction/RecCalorimeter/src/components/CaloTowerTool.h +++ b/Reconstruction/RecCalorimeter/src/components/CaloTowerTool.h @@ -5,7 +5,7 @@ #include "GaudiAlg/GaudiTool.h" // FCCSW -#include "DetSegmentation/GridPhiEta.h" +#include "DetSegmentation/FCCSWGridPhiEta.h" #include "FWCore/DataHandle.h" #include "RecInterface/ITowerTool.h" @@ -16,7 +16,7 @@ namespace fcc { class CaloHitCollection; } -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class Segmentation; } @@ -107,11 +107,11 @@ class CaloTowerTool : public GaudiTool, virtual public ITowerTool { * @param[in] aSegmentation Segmentation of the calorimeter */ void CellsIntoTowers(std::vector>& aTowers, const fcc::CaloHitCollection* aCells, - DD4hep::DDSegmentation::GridPhiEta* aSegmentation); + dd4hep::DDSegmentation::FCCSWGridPhiEta* aSegmentation); /** Check if the readout name exists. If so, it returns the eta-phi segmentation. * @param[in] aReadoutName Readout name to be retrieved */ - DD4hep::DDSegmentation::GridPhiEta* retrieveSegmentation(std::string aReadoutName); + dd4hep::DDSegmentation::FCCSWGridPhiEta* retrieveSegmentation(std::string aReadoutName); private: /// Handle for electromagnetic barrel cells (input collection) @@ -151,19 +151,19 @@ class CaloTowerTool : public GaudiTool, virtual public ITowerTool { Gaudi::Property m_hcalFwdReadoutName{this, "hcalFwdReadoutName", "", "name of the hcal fwd readout"}; /// PhiEta segmentation of the electromagnetic barrel (owned by DD4hep) - DD4hep::DDSegmentation::GridPhiEta* m_ecalBarrelSegmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_ecalBarrelSegmentation; /// PhiEta segmentation of the ecal endcap calorimeter (owned by DD4hep) - DD4hep::DDSegmentation::GridPhiEta* m_ecalEndcapSegmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_ecalEndcapSegmentation; /// PhiEta segmentation of the ecal forward calorimeter (owned by DD4hep) - DD4hep::DDSegmentation::GridPhiEta* m_ecalFwdSegmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_ecalFwdSegmentation; /// PhiEta segmentation of the hadronic barrel (owned by DD4hep) - DD4hep::DDSegmentation::GridPhiEta* m_hcalBarrelSegmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_hcalBarrelSegmentation; /// PhiEta segmentation of the hadronic extended barrel (owned by DD4hep) - DD4hep::DDSegmentation::GridPhiEta* m_hcalExtBarrelSegmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_hcalExtBarrelSegmentation; /// PhiEta segmentation of the hcal endcap calorimeter (owned by DD4hep) - DD4hep::DDSegmentation::GridPhiEta* m_hcalEndcapSegmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_hcalEndcapSegmentation; /// PhiEta segmentation of the hcal forward calorimeter (owned by DD4hep) - DD4hep::DDSegmentation::GridPhiEta* m_hcalFwdSegmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_hcalFwdSegmentation; /// Radius used to calculate cluster position from eta and phi (in mm) Gaudi::Property m_radius{this, "radiusForPosition", 1.0, "Radius used to calculate cluster position from eta and phi (in mm)"}; diff --git a/Reconstruction/RecCalorimeter/src/components/CreateCaloCells.cpp b/Reconstruction/RecCalorimeter/src/components/CreateCaloCells.cpp index 166db7f37..c3869ee67 100644 --- a/Reconstruction/RecCalorimeter/src/components/CreateCaloCells.cpp +++ b/Reconstruction/RecCalorimeter/src/components/CreateCaloCells.cpp @@ -5,7 +5,7 @@ #include "DetInterface/IGeoSvc.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // our EDM #include "datamodel/CaloHit.h" diff --git a/Reconstruction/RecCalorimeter/src/components/LayeredCaloTowerTool.cpp b/Reconstruction/RecCalorimeter/src/components/LayeredCaloTowerTool.cpp index 00bc9647a..d2a95488c 100644 --- a/Reconstruction/RecCalorimeter/src/components/LayeredCaloTowerTool.cpp +++ b/Reconstruction/RecCalorimeter/src/components/LayeredCaloTowerTool.cpp @@ -8,7 +8,7 @@ #include "datamodel/CaloHitCollection.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Readout.h" DECLARE_TOOL_FACTORY(LayeredCaloTowerTool) @@ -37,7 +37,7 @@ StatusCode LayeredCaloTowerTool::initialize() { return StatusCode::FAILURE; } // retrieve PhiEta segmentation - m_segmentation = dynamic_cast( + m_segmentation = dynamic_cast( m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()); if (m_segmentation == nullptr) { error() << "There is no phi-eta segmentation." << endmsg; @@ -45,7 +45,7 @@ StatusCode LayeredCaloTowerTool::initialize() { } // Take readout bitfield decoder from GeoSvc m_decoder = - std::shared_ptr(m_geoSvc->lcdd()->readout(m_readoutName).idSpec().decoder()); + std::shared_ptr(m_geoSvc->lcdd()->readout(m_readoutName).idSpec().decoder()); // check if decoder contains "layer" std::vector fields; for (uint itField = 0; itField < m_decoder->size(); itField++) { diff --git a/Reconstruction/RecCalorimeter/src/components/LayeredCaloTowerTool.h b/Reconstruction/RecCalorimeter/src/components/LayeredCaloTowerTool.h index 5b26464f1..2640a88ee 100644 --- a/Reconstruction/RecCalorimeter/src/components/LayeredCaloTowerTool.h +++ b/Reconstruction/RecCalorimeter/src/components/LayeredCaloTowerTool.h @@ -5,7 +5,7 @@ #include "GaudiAlg/GaudiTool.h" // FCCSW -#include "DetSegmentation/GridPhiEta.h" +#include "DetSegmentation/FCCSWGridPhiEta.h" #include "FWCore/DataHandle.h" #include "RecInterface/ITowerTool.h" class IGeoSvc; @@ -15,7 +15,7 @@ namespace fcc { class CaloHitCollection; } -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class Segmentation; } @@ -116,7 +116,7 @@ class LayeredCaloTowerTool : public GaudiTool, virtual public ITowerTool { * (in [0, m_nPhiTower) range) */ uint phiNeighbour(int aIPhi) const; - std::shared_ptr m_decoder; + std::shared_ptr m_decoder; private: /// Handle for calo cells (input collection) @@ -126,7 +126,7 @@ class LayeredCaloTowerTool : public GaudiTool, virtual public ITowerTool { /// Name of the detector readout Gaudi::Property m_readoutName{this, "readoutName", "", "Name of the detector readout"}; /// PhiEta segmentation (owned by DD4hep) - DD4hep::DDSegmentation::GridPhiEta* m_segmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_segmentation; /// Radius used to calculate cluster position from eta and phi (in mm) Gaudi::Property m_radius{this, "radiusForPosition", 1.0, "Radius used to calculate cluster position from eta and phi (in mm)"}; diff --git a/Reconstruction/RecCalorimeter/src/components/NestedVolumesCaloTool.cpp b/Reconstruction/RecCalorimeter/src/components/NestedVolumesCaloTool.cpp index 8bf59915f..a529c15e3 100644 --- a/Reconstruction/RecCalorimeter/src/components/NestedVolumesCaloTool.cpp +++ b/Reconstruction/RecCalorimeter/src/components/NestedVolumesCaloTool.cpp @@ -1,7 +1,7 @@ #include "NestedVolumesCaloTool.h" // segm -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DetCommon/DetUtils.h" #include "DetInterface/IGeoSvc.h" diff --git a/Reconstruction/RecCalorimeter/src/components/NoiseCaloCellsFromFileTool.cpp b/Reconstruction/RecCalorimeter/src/components/NoiseCaloCellsFromFileTool.cpp index 4aca21839..669dada06 100644 --- a/Reconstruction/RecCalorimeter/src/components/NoiseCaloCellsFromFileTool.cpp +++ b/Reconstruction/RecCalorimeter/src/components/NoiseCaloCellsFromFileTool.cpp @@ -5,7 +5,7 @@ #include "DetInterface/IGeoSvc.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" // Root #include "TFile.h" @@ -42,7 +42,7 @@ StatusCode NoiseCaloCellsFromFileTool::initialize() { return StatusCode::FAILURE; } // Get PhiEta segmentation - m_segmentation = dynamic_cast( + m_segmentation = dynamic_cast( m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()); if (m_segmentation == nullptr) { error() << "There is no phi-eta segmentation." << endmsg; diff --git a/Reconstruction/RecCalorimeter/src/components/NoiseCaloCellsFromFileTool.h b/Reconstruction/RecCalorimeter/src/components/NoiseCaloCellsFromFileTool.h index 9ef661ced..a710f4592 100644 --- a/Reconstruction/RecCalorimeter/src/components/NoiseCaloCellsFromFileTool.h +++ b/Reconstruction/RecCalorimeter/src/components/NoiseCaloCellsFromFileTool.h @@ -7,7 +7,7 @@ class IRndmGenSvc; // FCCSW -#include "DetSegmentation/GridPhiEta.h" +#include "DetSegmentation/FCCSWGridPhiEta.h" #include "RecInterface/INoiseCaloCellsTool.h" class IGeoSvc; @@ -81,7 +81,7 @@ class NoiseCaloCellsFromFileTool : public GaudiTool, virtual public INoiseCaloCe /// Pointer to the geometry service SmartIF m_geoSvc; /// PhiEta segmentation - DD4hep::DDSegmentation::GridPhiEta* m_segmentation; + dd4hep::DDSegmentation::FCCSWGridPhiEta* m_segmentation; }; #endif /* RECCALORIMETER_NOISECALOCELLSFROMFILETOOL_H */ diff --git a/Reconstruction/RecCalorimeter/src/components/TubeLayerPhiEtaCaloTool.cpp b/Reconstruction/RecCalorimeter/src/components/TubeLayerPhiEtaCaloTool.cpp index 5bbf67ead..d81483b84 100644 --- a/Reconstruction/RecCalorimeter/src/components/TubeLayerPhiEtaCaloTool.cpp +++ b/Reconstruction/RecCalorimeter/src/components/TubeLayerPhiEtaCaloTool.cpp @@ -1,7 +1,7 @@ #include "TubeLayerPhiEtaCaloTool.h" // segm -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DetCommon/DetUtils.h" #include "DetInterface/IGeoSvc.h" @@ -48,16 +48,16 @@ StatusCode TubeLayerPhiEtaCaloTool::prepareEmptyCells(std::unordered_map( + dd4hep::DDSegmentation::FCCSWGridPhiEta* segmentation; + segmentation = dynamic_cast( m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()); if (segmentation == nullptr) { error() << "There is no phi-eta segmentation!!!!" << endmsg; return StatusCode::FAILURE; } - info() << "GridPhiEta: size in eta " << segmentation->gridSizeEta() << " , bins in phi " << segmentation->phiBins() + info() << "FCCSWGridPhiEta: size in eta " << segmentation->gridSizeEta() << " , bins in phi " << segmentation->phiBins() << endmsg; - info() << "GridPhiEta: offset in eta " << segmentation->offsetEta() << " , offset in phi " + info() << "FCCSWGridPhiEta: offset in eta " << segmentation->offsetEta() << " , offset in phi " << segmentation->offsetPhi() << endmsg; // Take readout bitfield decoder from GeoSvc diff --git a/Reconstruction/RecTracker/CMakeLists.txt b/Reconstruction/RecTracker/CMakeLists.txt index 091d7b953..6aa930b97 100644 --- a/Reconstruction/RecTracker/CMakeLists.txt +++ b/Reconstruction/RecTracker/CMakeLists.txt @@ -4,33 +4,38 @@ gaudi_subdir(RecTracker v1r0) # this declaration will not be needed in the future -gaudi_depends_on_subdirs(GaudiAlg FWCore Detector/DetInterface Reconstruction/RecInterface) +gaudi_depends_on_subdirs(GaudiAlg FWCore Sim/SimG4Common Sim/SimG4Interface Detector/DetInterface Reconstruction/RecInterface) +find_package(DD4hep) +find_package(HepMC) +find_package(Geant4) find_package(FCCEDM) find_package(PODIO) -find_package(HepMC) -find_package(DD4hep COMPONENTS DDG4 DDSegmentation DDRec REQUIRED) -find_package(ROOT) -find_package(ACTS COMPONENTS Core Examples TGeoPlugin DD4hepPlugin) +find_package(ROOT REQUIRED COMPONENTS Geom) +find_package(ACTS COMPONENTS Core TGeoPlugin DD4hepPlugin) + +#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_ROOT}/cmake ) +#include( DD4hep ) gaudi_install_headers(RecTracker) gaudi_add_library(TrackingUtils - src/lib/TrackingUtils.cpp - INCLUDE_DIRS ROOT FWCore HepMC FCCEDM PODIO DD4hep DetInterface RecInterface - LINK_LIBRARIES ROOT GaudiAlgLib FCCEDM PODIO HepMC DD4hep ${DD4hep_COMPONENT_LIBRARIES} + src/lib/*.cpp + INCLUDE_DIRS DD4hep HepMC FWCore FCCEDM PODIO DetInterface RecInterface SimG4Interface ROOT + LINK_LIBRARIES GaudiAlgLib FCCEDM PODIO HepMC DD4hep ROOT PUBLIC_HEADERS RecTracker) + gaudi_add_module(RecTracker src/components/*.cpp - INCLUDE_DIRS ROOT FWCore HepMC FCCEDM PODIO DD4hep DetInterface RecInterface TrackingUtils ACTS - LINK_LIBRARIES ROOT GaudiAlgLib FCCEDM PODIO HepMC DD4hep TrackingUtils ${DD4hep_COMPONENT_LIBRARIES} ACTS::ACTSCore ACTS::ACTSDD4hepPlugin) + INCLUDE_DIRS DD4hep Geant4 FWCore SimG4Common SimG4Interface ROOT RecInterface TrackingUtils ACTS + LINK_LIBRARIES ROOT GaudiAlgLib FCCEDM PODIO HepMC DD4hep TrackingUtils ACTS::ACTSCore ACTS::ACTSDD4hepPlugin) gaudi_add_library(ActsLogger src/lib/ACTSLogger.cpp INCLUDE_DIRS ROOT FWCore HepMC FCCEDM PODIO DD4hep DetInterface RecInterface ACTS NO_PUBLIC_HEADERS - LINK_LIBRARIES ROOT GaudiAlgLib FCCEDM PODIO HepMC DD4hep ${DD4hep_COMPONENT_LIBRARIES} ACTS::ACTSCore ACTS::ACTSDD4hepPlugin) + LINK_LIBRARIES ROOT GaudiAlgLib FCCEDM PODIO HepMC DD4hep ACTS::ACTSCore ACTS::ACTSDD4hepPlugin) include(CTest) diff --git a/Reconstruction/RecTracker/RecTracker/TrackingUtils.h b/Reconstruction/RecTracker/RecTracker/TrackingUtils.h index dba72c53d..0e1b93988 100644 --- a/Reconstruction/RecTracker/RecTracker/TrackingUtils.h +++ b/Reconstruction/RecTracker/RecTracker/TrackingUtils.h @@ -3,7 +3,7 @@ #include -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class BitField64; } @@ -16,7 +16,7 @@ namespace fcc { namespace rec { /// fill vector with hits ordered according to the CellIdOrder struct -void sortTrackHits(const fcc::TrackHitCollection* unsortedHits, std::vector& sortedHits, DD4hep::DDSegmentation::BitField64* decoder); +void sortTrackHits(const fcc::TrackHitCollection* unsortedHits, std::vector& sortedHits, dd4hep::DDSegmentation::BitField64* decoder); } #endif diff --git a/Reconstruction/RecTracker/src/components/CombinatorialSeedingTest.cpp b/Reconstruction/RecTracker/src/components/CombinatorialSeedingTest.cpp index cf2bb90db..4a5f95b4e 100644 --- a/Reconstruction/RecTracker/src/components/CombinatorialSeedingTest.cpp +++ b/Reconstruction/RecTracker/src/components/CombinatorialSeedingTest.cpp @@ -5,7 +5,7 @@ #include "datamodel/TrackHitCollection.h" #include "datamodel/TrackHitCollection.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Volumes.h" #include "DDRec/API/IDDecoder.h" #include "DDSegmentation/BitField64.h" diff --git a/Reconstruction/RecTracker/src/components/CombinatorialSeedingTool.cpp b/Reconstruction/RecTracker/src/components/CombinatorialSeedingTool.cpp index 12febcf79..409a42d96 100644 --- a/Reconstruction/RecTracker/src/components/CombinatorialSeedingTool.cpp +++ b/Reconstruction/RecTracker/src/components/CombinatorialSeedingTool.cpp @@ -1,3 +1,5 @@ + + #include "CombinatorialSeedingTool.h" #include "DetInterface/IGeoSvc.h" @@ -6,11 +8,12 @@ #include "datamodel/TrackHitCollection.h" #include "datamodel/TrackStateCollection.h" -#include "DD4hep/LCDD.h" -#include "DD4hep/Volumes.h" -#include "DDRec/API/IDDecoder.h" -#include "DDSegmentation/BitField64.h" -#include "DDSegmentation/CartesianGridXZ.h" +//#include "DD4hep/Volumes.h" +//#include "DDRec/API/IDDecoder.h" +//#//include "DDSegmentation/BitField64.h" +//#include "DD4hep/BitField64.h" +//#include "DDSegmentation/CartesianGridXZ.h" +#include "DDG4/Geant4Hits.h" #include "ACTS/Seeding/BarrelSeedFinder.hpp" #include "ACTS/Seeding/SpacePoint.hpp" @@ -20,8 +23,8 @@ DECLARE_TOOL_FACTORY(CombinatorialSeedingTool) CombinatorialSeedingTool::CombinatorialSeedingTool(const std::string& type, const std::string& name, const IInterface* parent) - : GaudiTool(type, name, parent), - m_geoSvc("GeoSvc", "CombinatorialSeedingTool") { + : GaudiTool(type, name, parent) + { declareInterface(this); declareProperty("trackSeeds", m_trackSeeds, "Track Seeds (Output)"); } @@ -31,9 +34,10 @@ StatusCode CombinatorialSeedingTool::initialize() { if (sc.isFailure()) { return sc; } - auto lcdd = m_geoSvc->lcdd(); - auto readout = lcdd->readout(m_readoutName); - m_decoder = readout.idSpec().decoder(); + //m_geoSvc = service("GeoSvc"); + //auto lcdd = m_geoSvc->lcdd(); + //auto readouts = lcdd->readouts(); + //m_decoder = readout.idSpec().decoder(); return sc; } @@ -42,12 +46,12 @@ void CombinatorialSeedingTool::createBarrelSpacePoints(Acts::Seeding::BarrelSpac std::pair sIndex) { size_t hitCounter = 0; for (auto hit : *theHits) { - m_decoder->setValue(hit.core().cellId); - if ((*m_decoder)["system"] == sIndex.first) { - if ((*m_decoder)["layer"] == sIndex.second) { + // m_decoder->setValue(hit.core().cellId); + // if ((*m_decoder)["system"] == sIndex.first) { + // if ((*m_decoder)["layer"] == sIndex.second) { thePoints.points.emplace_back(hit.position().x, hit.position().y, hit.position().z, hitCounter); - } - } + // } + // } ++hitCounter; } } diff --git a/Reconstruction/RecTracker/src/components/CombinatorialSeedingTool.h b/Reconstruction/RecTracker/src/components/CombinatorialSeedingTool.h index 2970f4c91..050965f4a 100644 --- a/Reconstruction/RecTracker/src/components/CombinatorialSeedingTool.h +++ b/Reconstruction/RecTracker/src/components/CombinatorialSeedingTool.h @@ -2,10 +2,12 @@ #define RECTRACKER_COMBINATORIALSEEDINGTOOL_H // from Gaudi +//#include "DDSegmentation/BitField64.h" #include "GaudiAlg/GaudiTool.h" // FCCSW #include "FWCore/DataHandle.h" +#include "SimG4Interface/ISimG4SaveOutputTool.h" #include "RecInterface/ITrackSeedingTool.h" #include "datamodel/PositionedTrackHitCollection.h" #include "datamodel/TrackHitCollection.h" @@ -17,11 +19,6 @@ class IGeoSvc; -namespace DD4hep { -namespace DDSegmentation { -class BitField64; -} -} class CombinatorialSeedingTool : public GaudiTool, virtual public ITrackSeedingTool { public: @@ -35,8 +32,8 @@ class CombinatorialSeedingTool : public GaudiTool, virtual public ITrackSeedingT const fcc::PositionedTrackHitCollection* theHits, std::pair sIndex); private: - ServiceHandle m_geoSvc; - DD4hep::DDSegmentation::BitField64* m_decoder; + SmartIF m_geoSvc; + //DDSegmentation::BitField64* m_decoder; /// system and layer ids for the inner barrel layer to be used for seeding Gaudi::Property> m_seedingLayerIndices0{this, "seedingLayerIndices0", {0, 0}}; /// system and layer ids for the middle barrel layer to be used for seeding diff --git a/Reconstruction/RecTracker/src/components/ExtrapolationTest.cpp b/Reconstruction/RecTracker/src/components/ExtrapolationTest.cpp index 928e89792..a9fc191c3 100644 --- a/Reconstruction/RecTracker/src/components/ExtrapolationTest.cpp +++ b/Reconstruction/RecTracker/src/components/ExtrapolationTest.cpp @@ -9,7 +9,6 @@ #include "ACTS/Detector/TrackingGeometry.hpp" #include "ACTS/EventData/Measurement.hpp" -#include "ACTS/Examples/BuildGenericDetector.hpp" #include "ACTS/Extrapolation/ExtrapolationCell.hpp" #include "ACTS/Extrapolation/ExtrapolationEngine.hpp" #include "ACTS/Extrapolation/IExtrapolationEngine.hpp" @@ -28,7 +27,7 @@ #include "datamodel/PositionedTrackHitCollection.h" #include "datamodel/TrackHitCollection.h" -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Volumes.h" #include "DDRec/API/IDDecoder.h" #include "DDSegmentation/BitField64.h" diff --git a/Reconstruction/RecTracker/src/components/ExtrapolationTest.h b/Reconstruction/RecTracker/src/components/ExtrapolationTest.h index 2c6ab6022..116ee0f73 100644 --- a/Reconstruction/RecTracker/src/components/ExtrapolationTest.h +++ b/Reconstruction/RecTracker/src/components/ExtrapolationTest.h @@ -42,7 +42,7 @@ class ExtrapolationTest : public GaudiAlgorithm { ServiceHandle m_trkGeoSvc; /// pointer to tracking geometry world - std::shared_ptr m_trkGeo; + std::shared_ptr m_trkGeo; /// pointer to Acts extrapolation engine std::shared_ptr m_exEngine; diff --git a/Reconstruction/RecTracker/src/lib/ACTSLogger.cpp b/Reconstruction/RecTracker/src/lib/ACTSLogger.cpp index 006b0c73e..dae39f6aa 100644 --- a/Reconstruction/RecTracker/src/lib/ACTSLogger.cpp +++ b/Reconstruction/RecTracker/src/lib/ACTSLogger.cpp @@ -5,7 +5,7 @@ namespace Acts { -std::unique_ptr getDefaultLogger(const std::string& name, const Logging::Level& lvl, std::ostream*) { +std::unique_ptr getDefaultLogger(const std::string& name, const Logging::Level& lvl, std::ostream*) { using namespace Logging; //ServiceHandle* msgSvc = new ServiceHandle("MessageSvc", name); ServiceHandle msgSvc("MessageSvc", name); diff --git a/Reconstruction/RecTracker/src/lib/TrackingUtils.cpp b/Reconstruction/RecTracker/src/lib/TrackingUtils.cpp index 682bfd542..b1e6c5a5b 100644 --- a/Reconstruction/RecTracker/src/lib/TrackingUtils.cpp +++ b/Reconstruction/RecTracker/src/lib/TrackingUtils.cpp @@ -1,9 +1,7 @@ #include "RecTracker/TrackingUtils.h" -#include "DD4hep/LCDD.h" -#include "DD4hep/Volumes.h" -#include "DDRec/API/IDDecoder.h" +#include "DD4hep/Detector.h" #include "DDSegmentation/BitField64.h" #include "DDSegmentation/CartesianGridXZ.h" @@ -17,7 +15,7 @@ namespace rec { // For use with standard sorting algorithms // compares the system fields of the hits first, then the layer field struct CellIdOrder { - CellIdOrder(DD4hep::DDSegmentation::BitField64* dec) : m_decoder(dec) {} + CellIdOrder(dd4hep::DDSegmentation::BitField64* dec) : m_decoder(dec) {} bool operator()(const fcc::TrackHit& h1, const fcc::TrackHit& h2) { m_decoder->setValue(h1.cellId()); @@ -32,12 +30,12 @@ struct CellIdOrder { } private: - DD4hep::DDSegmentation::BitField64* m_decoder; + dd4hep::DDSegmentation::BitField64* m_decoder; }; /// fill vector with hits ordered according to the CellIdOrder struct void sortTrackHits(const fcc::TrackHitCollection* unsortedHits, std::vector& sortedHits, - DD4hep::DDSegmentation::BitField64* decoder) { + dd4hep::DDSegmentation::BitField64* decoder) { sortedHits.reserve(unsortedHits->size()); for (const auto& hit : *unsortedHits) { sortedHits.push_back(hit); diff --git a/Sim/SimDelphesInterface/src/DelphesSimulation.cpp b/Sim/SimDelphesInterface/src/DelphesSimulation.cpp index 9d51caa72..def4984c9 100644 --- a/Sim/SimDelphesInterface/src/DelphesSimulation.cpp +++ b/Sim/SimDelphesInterface/src/DelphesSimulation.cpp @@ -15,7 +15,7 @@ #include "modules/Delphes.h" // FCC EDM -#include "datamodel/FloatCollection.h" +#include "datamodel/FloatValueCollection.h" #include "datamodel/GenVertexCollection.h" #include "datamodel/MCParticleCollection.h" diff --git a/Sim/SimDelphesInterface/src/DelphesSimulation.h b/Sim/SimDelphesInterface/src/DelphesSimulation.h index 4c471d5eb..b82340b63 100644 --- a/Sim/SimDelphesInterface/src/DelphesSimulation.h +++ b/Sim/SimDelphesInterface/src/DelphesSimulation.h @@ -25,7 +25,7 @@ class ExRootTreeWriter; namespace fcc { class MCParticleCollection; class GenVertexCollection; -class FloatCollection; +class FloatValueCollection; } // Forward ROOT @@ -90,7 +90,7 @@ class DelphesSimulation : public GaudiAlgorithm { DataHandle m_hepmcHandle{"hepmc", Gaudi::DataHandle::Reader, this}; // Handle for the generated or reconstructed objects to be written out - DataHandle m_handleMCEventWeights{"mcEventWeights", Gaudi::DataHandle::Writer, this}; + DataHandle m_handleMCEventWeights{"mcEventWeights", Gaudi::DataHandle::Writer, this}; DataHandle m_handleGenParticles{"genParticles", Gaudi::DataHandle::Writer, this}; int m_eventCounter{0}; diff --git a/Sim/SimG4Components/src/SimG4GeantinoDeposits.cpp b/Sim/SimG4Components/src/SimG4GeantinoDeposits.cpp index 80c7fdd17..3360e12c6 100644 --- a/Sim/SimG4Components/src/SimG4GeantinoDeposits.cpp +++ b/Sim/SimG4Components/src/SimG4GeantinoDeposits.cpp @@ -10,6 +10,7 @@ #include "G4ProcessType.hh" + class GeantinoEnergyDepositProcess: public G4VContinuousProcess { public: GeantinoEnergyDepositProcess(const G4String& processName="GeantinoDepositProcess", @@ -41,6 +42,7 @@ class GeantinoEnergyDepositProcess: public G4VContinuousProcess { class GeantinoEnergyDepositList : public G4VModularPhysicsList { void ConstructProcess() { + auto theParticleIterator = GetParticleIterator(); theParticleIterator->reset(); while( (*theParticleIterator)() ){ G4ParticleDefinition* particle = theParticleIterator->value(); diff --git a/Sim/SimG4Components/src/SimG4SaveCalHits.cpp b/Sim/SimG4Components/src/SimG4SaveCalHits.cpp index 5cf6a019e..6ab617707 100644 --- a/Sim/SimG4Components/src/SimG4SaveCalHits.cpp +++ b/Sim/SimG4Components/src/SimG4SaveCalHits.cpp @@ -54,7 +54,7 @@ StatusCode SimG4SaveCalHits::finalize() { return GaudiTool::finalize(); } StatusCode SimG4SaveCalHits::saveOutput(const G4Event& aEvent) { G4HCofThisEvent* collections = aEvent.GetHCofThisEvent(); G4VHitsCollection* collect; - DD4hep::Simulation::Geant4CalorimeterHit* hit; + dd4hep::sim::Geant4CalorimeterHit* hit; if (collections != nullptr) { auto edmPositioned = m_positionedCaloHits.createAndPut(); auto edmHits = m_caloHits.createAndPut(); @@ -65,7 +65,7 @@ StatusCode SimG4SaveCalHits::saveOutput(const G4Event& aEvent) { debug() << "\t" << n_hit << " hits are stored in a collection #" << iter_coll << ": " << collect->GetName() << endmsg; for (size_t iter_hit = 0; iter_hit < n_hit; iter_hit++) { - hit = dynamic_cast(collect->GetHit(iter_hit)); + hit = dynamic_cast(collect->GetHit(iter_hit)); auto edmHit = edmHits->create(); auto& edmHitCore = edmHit.core(); edmHitCore.cellId = hit->cellID; diff --git a/Sim/SimG4Components/src/SimG4SaveTrackerHits.cpp b/Sim/SimG4Components/src/SimG4SaveTrackerHits.cpp index e5e5703d3..7610c7992 100644 --- a/Sim/SimG4Components/src/SimG4SaveTrackerHits.cpp +++ b/Sim/SimG4Components/src/SimG4SaveTrackerHits.cpp @@ -54,7 +54,7 @@ StatusCode SimG4SaveTrackerHits::finalize() { return GaudiTool::finalize(); } StatusCode SimG4SaveTrackerHits::saveOutput(const G4Event& aEvent) { G4HCofThisEvent* collections = aEvent.GetHCofThisEvent(); G4VHitsCollection* collect; - DD4hep::Simulation::Geant4TrackerHit* hit; + dd4hep::sim::Geant4TrackerHit* hit; if (collections != nullptr) { auto edmPositions = m_positionedTrackHits.createAndPut(); auto edmHits = m_trackHits.createAndPut(); @@ -65,7 +65,7 @@ StatusCode SimG4SaveTrackerHits::saveOutput(const G4Event& aEvent) { info() << "\t" << n_hit << " hits are stored in a tracker collection #" << iter_coll << ": " << collect->GetName() << endmsg; for (size_t iter_hit = 0; iter_hit < n_hit; iter_hit++) { - hit = dynamic_cast(collect->GetHit(iter_hit)); + hit = dynamic_cast(collect->GetHit(iter_hit)); fcc::TrackHit edmHit = edmHits->create(); fcc::BareHit& edmHitCore = edmHit.core(); edmHitCore.cellId = hit->cellID; diff --git a/Sim/SimG4Fast/src/lib/FastSimPhysics.cpp b/Sim/SimG4Fast/src/lib/FastSimPhysics.cpp index 0b03e1eed..c0d46d7f2 100644 --- a/Sim/SimG4Fast/src/lib/FastSimPhysics.cpp +++ b/Sim/SimG4Fast/src/lib/FastSimPhysics.cpp @@ -19,6 +19,7 @@ void FastSimPhysics::ConstructParticle() {} void FastSimPhysics::ConstructProcess() { G4FastSimulationManagerProcess* fastSimProcess = new G4FastSimulationManagerProcess("G4FSMP"); + auto aParticleIterator = GetParticleIterator(); aParticleIterator->reset(); // Fast simulation manager process is available for all the particles while ((*aParticleIterator)()) { diff --git a/Sim/SimPapas/src/PapasAlg.cpp b/Sim/SimPapas/src/PapasAlg.cpp index eef0311d0..40ef09ddc 100644 --- a/Sim/SimPapas/src/PapasAlg.cpp +++ b/Sim/SimPapas/src/PapasAlg.cpp @@ -1,6 +1,7 @@ #include "PapasAlg.h" #include "GaudiKernel/EventContext.h" +#include "GaudiKernel/ThreadLocalContext.h" // FCCSW #include "SimPapas/IPapasDetSvc.h" #include "SimPapas/IPapasExportTool.h" @@ -62,8 +63,7 @@ StatusCode PapasAlg::execute() { m_history.clear(); papas::Event pevent(m_history); // pick up the Gaudi event number - auto context = getContext(); - m_eventno = context.evt(); + m_eventno = Gaudi::Hive::currentContext().evt(); pevent.setEventNo(m_eventno); papas::PDebug::write("Event: {}", m_eventno); diff --git a/Sim/doc/FullSimulation.md b/Sim/doc/FullSimulation.md index c84329bbd..86fdf3b1f 100644 --- a/Sim/doc/FullSimulation.md +++ b/Sim/doc/FullSimulation.md @@ -175,7 +175,7 @@ Sim/SimG4Components/tests/options/ ~~~ #### GDML example -There is a possibility to create the detector with GDML instead of DD4hep. In this case, however, no sensitive detectors are predefined and user is responsible for their implementation. Preferable hit format is the one used by DD4hep (e.g. `DD4hep::Simulation::Geant4CalorimeterHit`), this way user may use the saving output utilities that are already provided. +There is a possibility to create the detector with GDML instead of DD4hep. In this case, however, no sensitive detectors are predefined and user is responsible for their implementation. Preferable hit format is the one used by DD4hep (e.g. `dd4hep::sim::Geant4CalorimeterHit`), this way user may use the saving output utilities that are already provided. Simple example: ~~~{.sh} @@ -239,10 +239,10 @@ Sensitive detectors are responsible for creating the hits whenever a particle tr * set the sensitive detector type ~~~{.cpp} - DD4hep::Geometry::SensitiveDetector::setType("SimpleCalorimeterSD"); + dd4hep::SensitiveDetector::setType("SimpleCalorimeterSD"); ~~~ - This way the hits collection are created automatically and are filled whenever a particle traverses a sensitive material. Hits are be stored in either `DD4hep::Simulation::Geant4TrackerHit` or `DD4hep::Simulation::Geant4CalorimeterHit`. See more on the current implementations of the sensitive detector types in the [Detector documentation](../../Detector/doc/DD4hepInFCCSW.md#using-an-existing-sensitive-detector-definition). + This way the hits collection are created automatically and are filled whenever a particle traverses a sensitive material. Hits are be stored in either `dd4hep::sim::Geant4TrackerHit` or `dd4hep::sim::Geant4CalorimeterHit`. See more on the current implementations of the sensitive detector types in the [Detector documentation](../../Detector/doc/DD4hepInFCCSW.md#using-an-existing-sensitive-detector-definition). ### Physics List diff --git a/Test/TestGeneration/CMakeLists.txt b/Test/TestGeneration/CMakeLists.txt index c8a76d99f..ccc5dd85a 100644 --- a/Test/TestGeneration/CMakeLists.txt +++ b/Test/TestGeneration/CMakeLists.txt @@ -3,6 +3,8 @@ ################################################################################ gaudi_subdir(TestGeneration v1r0) +find_package(HepMC) + gaudi_depends_on_subdirs(GaudiAlg GaudiKernel FWCore Generation) gaudi_add_module(TestGenerationPlugins diff --git a/Test/TestGeometry/CMakeLists.txt b/Test/TestGeometry/CMakeLists.txt index cceea66b7..848a4aa9f 100644 --- a/Test/TestGeometry/CMakeLists.txt +++ b/Test/TestGeometry/CMakeLists.txt @@ -3,28 +3,18 @@ ################################################################################ gaudi_subdir(TestGeometry v1r0) -gaudi_depends_on_subdirs(GaudiKernel FWCore Sim/SimG4Interface Sim/SimG4Common Detector/DetInterface Detector/DetCommon) +gaudi_depends_on_subdirs(GaudiKernel FWCore Test/TestGeometryLib Sim/SimG4Interface Sim/SimG4Common Detector/DetInterface Detector/DetCommon) find_package(Geant4) -include(${Geant4_USE_FILE}) -find_package(DD4hep) +#include(${Geant4_USE_FILE}) find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) -gaudi_install_headers(TestGeometry) -gaudi_add_library(TestGeometry - src/lib/*.cpp - INCLUDE_DIRS Geant4 ROOT TestGeometry DD4hep - LINK_LIBRARIES GaudiKernel Geant4 ROOT DD4hep - PUBLIC_HEADERS TestGeometry) - -gaudi_add_module(TestGeometryPlugins +gaudi_add_module(TestGeometry src/components/*.cpp - INCLUDE_DIRS Geant4 FWCore SimG4Interface SimG4Common DetInterface DetCommon TestGeometry - LINK_LIBRARIES GaudiKernel FWCore Geant4 DetCommon TestGeometry) + INCLUDE_DIRS Geant4 FWCore SimG4Interface SimG4Common DetInterface DetCommon TestGeometryLib + LINK_LIBRARIES GaudiKernel FWCore Geant4 DetCommon TestGeometryLib) -set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) -dd4hep_generate_rootmap(TestGeometry) include(CTest) gaudi_add_test(GeantOverlapTestFCChhMaster @@ -59,12 +49,3 @@ gaudi_add_test(CmpRandomCellIDDd4hepSegmentationwithVolumes gaudi_add_test(TestGFlashHomoCalo WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Test/TestGeometry/tests/ FRAMEWORK tests/options/gflash_test_pbwo4.py) -# Test the detector baselines: -gaudi_add_test(OverlapCheckExtrusionsMaterialFCChh - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMAND python ${DD4hep_ROOT}/python/checkOverlaps.py -c Detector/DetFCChhBaseline1/compact/FCChh_DectMasterMaterial.xml - PASSREGEX "Number of illegal overlaps/extrusions : 0" ) -gaudi_add_test(OverlapCheckSamplingMaterialFCChh - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMAND python ${DD4hep_ROOT}/python/checkOverlaps.py -c Detector/DetFCChhBaseline1/compact/FCChh_DectMasterMaterial.xml -o s - PASSREGEX "Number of illegal overlaps/extrusions : 0" ) diff --git a/Test/TestGeometry/data/Barrel_testCaloSD_phieta.xml b/Test/TestGeometry/data/Barrel_testCaloSD_phieta.xml index d04e6ae0b..ae77aacfc 100644 --- a/Test/TestGeometry/data/Barrel_testCaloSD_phieta.xml +++ b/Test/TestGeometry/data/Barrel_testCaloSD_phieta.xml @@ -35,7 +35,7 @@ - + eta:-9,phi:-17,system:1 diff --git a/Test/TestGeometry/data/TestBoxCaloSD_3readouts.xml b/Test/TestGeometry/data/TestBoxCaloSD_3readouts.xml index e7c1f52e8..f2f6f2ba2 100644 --- a/Test/TestGeometry/data/TestBoxCaloSD_3readouts.xml +++ b/Test/TestGeometry/data/TestBoxCaloSD_3readouts.xml @@ -42,7 +42,7 @@ system:1,x:-4,y:-4,z:-4 - + phi:-8,eta:-8,system:1 diff --git a/Test/TestGeometry/src/components/SimG4GdmlTestDetector.cpp b/Test/TestGeometry/src/components/SimG4GdmlTestDetector.cpp index 1515e0d2c..9b9bbba71 100644 --- a/Test/TestGeometry/src/components/SimG4GdmlTestDetector.cpp +++ b/Test/TestGeometry/src/components/SimG4GdmlTestDetector.cpp @@ -1,7 +1,7 @@ #include "SimG4GdmlTestDetector.h" // FCCSW -#include "TestGeometry/GdmlDetectorConstruction.h" +#include "TestGeometryLib/GdmlDetectorConstruction.h" // Geant4 #include "G4VUserDetectorConstruction.hh" diff --git a/Test/TestGeometry/src/components/SimG4SaveTestCalHits.cpp b/Test/TestGeometry/src/components/SimG4SaveTestCalHits.cpp index fac1745b4..b92d0f7f4 100644 --- a/Test/TestGeometry/src/components/SimG4SaveTestCalHits.cpp +++ b/Test/TestGeometry/src/components/SimG4SaveTestCalHits.cpp @@ -2,7 +2,7 @@ // FCCSW #include "SimG4Common/Units.h" -#include "TestGeometry/TestCalorimeterHit.h" +#include "TestGeometryLib/TestCalorimeterHit.h" // Geant4 #include "G4Event.hh" diff --git a/Test/TestGeometry/src/components/SimG4TestPhysicsList.cpp b/Test/TestGeometry/src/components/SimG4TestPhysicsList.cpp index b7456baea..3d0ad96bf 100644 --- a/Test/TestGeometry/src/components/SimG4TestPhysicsList.cpp +++ b/Test/TestGeometry/src/components/SimG4TestPhysicsList.cpp @@ -1,5 +1,5 @@ #include "SimG4TestPhysicsList.h" -#include "TestGeometry/TestPhysicsList.h" +#include "TestGeometryLib/TestPhysicsList.h" // Geant4 #include "G4VModularPhysicsList.hh" diff --git a/Test/TestGeometry/src/lib/SimpleBarrel.cpp b/Test/TestGeometry/src/lib/SimpleBarrel.cpp deleted file mode 100644 index 4e13176e0..000000000 --- a/Test/TestGeometry/src/lib/SimpleBarrel.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "DD4hep/DetFactoryHelper.h" - -namespace det { -static DD4hep::Geometry::Ref_t createSimpleBarrel(DD4hep::Geometry::LCDD& aLcdd, - DD4hep::XML::Handle_t aXmlElement, - DD4hep::Geometry::SensitiveDetector aSensDet) { - DD4hep::XML::DetElement x_det = aXmlElement; - std::string name = x_det.nameStr(); - DD4hep::XML::Dimension dim(x_det.dimensions()); - DD4hep::XML::Dimension pos(x_det.position()); - DD4hep::XML::Dimension rot(x_det.rotation()); - DD4hep::Geometry::DetElement det(name, x_det.id()); - DD4hep::Geometry::Volume det_vol(name + "_vol", DD4hep::Geometry::Tube(dim.rmin(), dim.rmax(), dim.dz()), - aLcdd.material(x_det.materialStr())); - DD4hep::Geometry::Volume mother = aLcdd.pickMotherVolume(det); - DD4hep::Geometry::Transform3D transform( - DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(rot.z(), rot.y(), rot.x())), - DD4hep::Geometry::Position(pos.x(), pos.y(), pos.z())); - DD4hep::Geometry::PlacedVolume phv = mother.placeVolume(det_vol, transform); - det_vol.setVisAttributes(aLcdd, x_det.visStr()); - det_vol.setLimitSet(aLcdd, x_det.limitsStr()); - det_vol.setRegion(aLcdd, x_det.regionStr()); - if (x_det.isSensitive()) { - DD4hep::Geometry::SensitiveDetector sd = aSensDet; - DD4hep::XML::Dimension sd_typ = x_det.child(_U(sensitive)); - det_vol.setSensitiveDetector(aSensDet); - sd.setType(sd_typ.typeStr()); - } - if (x_det.hasAttr(_U(id))) { - phv.addPhysVolID("system", x_det.id()); - } - det.setPlacement(phv); - return det; -} -} -// first argument is the type from the xml file -DECLARE_DETELEMENT(SimpleBarrel, det::createSimpleBarrel) diff --git a/Test/TestGeometry/src/lib/SimpleBoxes.cpp b/Test/TestGeometry/src/lib/SimpleBoxes.cpp deleted file mode 100644 index b3386e581..000000000 --- a/Test/TestGeometry/src/lib/SimpleBoxes.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "DD4hep/DetFactoryHelper.h" - -namespace det { -static DD4hep::Geometry::Ref_t createSimpleBoxes(DD4hep::Geometry::LCDD& aLcdd, - DD4hep::XML::Handle_t aXmlElement, - DD4hep::Geometry::SensitiveDetector aSensDet) { - DD4hep::XML::DetElement x_det = aXmlElement; - std::string name = x_det.nameStr(); - DD4hep::XML::Dimension dim(x_det.dimensions()); - DD4hep::XML::Dimension pos(x_det.position()); - DD4hep::XML::Dimension rot(x_det.rotation()); - DD4hep::Geometry::DetElement det(name, x_det.id()); - DD4hep::Geometry::Material air = aLcdd.air(); - DD4hep::Geometry::Volume det_vol(name + "_vol", DD4hep::Geometry::Box(dim.x(), dim.y(), dim.z()), - aLcdd.material(x_det.materialStr())); - DD4hep::Geometry::Volume mother = aLcdd.pickMotherVolume(det); - DD4hep::Geometry::Transform3D transform( - DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(rot.z(), rot.y(), rot.x())), - DD4hep::Geometry::Position(pos.x(), pos.y(), pos.z())); - - // add cells : - DD4hep::XML::DetElement cell_det = aXmlElement.child(_Unicode(module)); - DD4hep::XML::Dimension cell_dim(cell_det.dimensions()); - DD4hep::Geometry::Material cell_mat(aLcdd.material(cell_det.materialStr())); - // assume same no of cells each direction (x,y,z) - unsigned int numCells = dim.x() / cell_dim.x(); - double offset = -1. * dim.x() + cell_dim.x(); - // create volumes for cell, row and layer - DD4hep::Geometry::Volume cell_vol("cell_vol", DD4hep::Geometry::Box(cell_dim.x(), cell_dim.y(), cell_dim.z()), - cell_mat); - DD4hep::Geometry::Volume row_vol("row_vol", DD4hep::Geometry::Box(dim.x(), cell_dim.y(), cell_dim.z()), air); - DD4hep::Geometry::Volume layer_vol("layer_vol", DD4hep::Geometry::Box(dim.x(), dim.y(), cell_dim.z()), air); - // attach sensitive detector - DD4hep::Geometry::SensitiveDetector sd = aSensDet; - DD4hep::XML::Dimension sd_typ = x_det.child(_U(sensitive)); - sd.setType(sd_typ.typeStr()); - cell_vol.setSensitiveDetector(aSensDet); - // place cells in a row - for (uint ix = 0; ix < numCells; ix++) { - auto cellName = std::string("cell") + DD4hep::XML::_toString(ix, "x%d"); - DD4hep::Geometry::Transform3D transformcell(DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(0, 0, 0)), - DD4hep::Geometry::Position(offset + ix * 2 * cell_dim.x(), 0, 0)); - DD4hep::Geometry::PlacedVolume cell_physvol = row_vol.placeVolume(cell_vol, transformcell); - cell_physvol.addPhysVolID("modulex", ix); - } - // place rows in a layer - for (uint iy = 0; iy < numCells; iy++) { - auto cellName = std::string("row") + DD4hep::XML::_toString(iy, "y%d"); - DD4hep::Geometry::Transform3D transformrow(DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(0, 0, 0)), - DD4hep::Geometry::Position(0, offset + iy * 2 * cell_dim.y(), 0)); - DD4hep::Geometry::PlacedVolume row_physvol = layer_vol.placeVolume(row_vol, transformrow); - row_physvol.addPhysVolID("moduley", iy); - } - // place layers in the box volume - for (uint iz = 0; iz < numCells; iz++) { - auto cellName = std::string("layer") + DD4hep::XML::_toString(iz, "z%d"); - DD4hep::Geometry::Transform3D transformlayer(DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(0, 0, 0)), - DD4hep::Geometry::Position(0, 0, offset + iz * 2 * cell_dim.z())); - DD4hep::Geometry::PlacedVolume layer_physvol = det_vol.placeVolume(layer_vol, transformlayer); - layer_physvol.addPhysVolID("modulez", iz); - } - - // place box - DD4hep::Geometry::PlacedVolume phv = mother.placeVolume(det_vol, transform); - det_vol.setVisAttributes(aLcdd, x_det.visStr()); - det_vol.setLimitSet(aLcdd, x_det.limitsStr()); - det_vol.setRegion(aLcdd, x_det.regionStr()); - phv.addPhysVolID("system", x_det.id()); - det.setPlacement(phv); - return det; -} -} -// first argument is the type from the xml file -DECLARE_DETELEMENT(SimpleBoxes, det::createSimpleBoxes) diff --git a/Test/TestGeometry/src/lib/SlicedBarrel.cpp b/Test/TestGeometry/src/lib/SlicedBarrel.cpp deleted file mode 100644 index 48107ef5e..000000000 --- a/Test/TestGeometry/src/lib/SlicedBarrel.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "DD4hep/DetFactoryHelper.h" - -namespace det { -static DD4hep::Geometry::Ref_t createSlicedBarrel(DD4hep::Geometry::LCDD& aLcdd, - DD4hep::XML::Handle_t aXmlElement, - DD4hep::Geometry::SensitiveDetector aSensDet) { - DD4hep::XML::DetElement x_det = aXmlElement; - std::string name = x_det.nameStr(); - DD4hep::XML::Dimension dim(x_det.dimensions()); - DD4hep::XML::Dimension pos(x_det.position()); - DD4hep::XML::Dimension rot(x_det.rotation()); - DD4hep::Geometry::DetElement det(name, x_det.id()); - DD4hep::Geometry::Volume det_vol(name + "_vol", DD4hep::Geometry::Tube(dim.rmin(), dim.rmax(), dim.dz()), - aLcdd.material(x_det.materialStr())); - DD4hep::Geometry::Volume mother = aLcdd.pickMotherVolume(det); - DD4hep::Geometry::Transform3D transform( - DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(rot.z(), rot.y(), rot.x())), - DD4hep::Geometry::Position(pos.x(), pos.y(), pos.z())); - - // here add cells : - DD4hep::XML::DetElement cell_det = aXmlElement.child(_Unicode(module)); - std::string cell_name = cell_det.nameStr(); - DD4hep::XML::Dimension slice_dim(cell_det.dimensions()); - DD4hep::Geometry::Material cell_mat(aLcdd.material(cell_det.materialStr())); - // we assume no segmentation in R/phi direction - unsigned int numSlices = dim.dz() / slice_dim.dz(); - double offset = -1. * dim.dz() + slice_dim.dz(); - DD4hep::Geometry::Volume slice_vol( - cell_name + "_vol", DD4hep::Geometry::Tube(slice_dim.rmin(), slice_dim.rmax(), slice_dim.dz()), cell_mat); - - DD4hep::Geometry::SensitiveDetector sd = aSensDet; - DD4hep::XML::Dimension sd_typ = x_det.child(_U(sensitive)); - sd.setType(sd_typ.typeStr()); - slice_vol.setSensitiveDetector(aSensDet); - for (uint iz = 0; iz < numSlices; iz++) { - auto sliceName = cell_name + DD4hep::XML::_toString(iz, "z%d"); - DD4hep::Geometry::Transform3D transformcell(DD4hep::Geometry::Rotation3D(DD4hep::Geometry::RotationZYX(0, 0, 0)), - DD4hep::Geometry::Position(0, 0, offset + iz * 2 * slice_dim.dz())); - DD4hep::Geometry::PlacedVolume slice_physvol = det_vol.placeVolume(slice_vol, transformcell); - slice_physvol.addPhysVolID("z", iz); - } - // place outer box - DD4hep::Geometry::PlacedVolume phv = mother.placeVolume(det_vol, transform); - det_vol.setVisAttributes(aLcdd, x_det.visStr()); - det_vol.setLimitSet(aLcdd, x_det.limitsStr()); - det_vol.setRegion(aLcdd, x_det.regionStr()); - phv.addPhysVolID("system", x_det.id()); - det.setPlacement(phv); - return det; -} -} -// first argument is the type from the xml file -DECLARE_DETELEMENT(SlicedBarrel, det::createSlicedBarrel) diff --git a/Test/TestGeometry/tests/options/geant_overlap_test_fcchh.py b/Test/TestGeometry/tests/options/geant_overlap_test_fcchh.py index b4f1644ad..93ec4d967 100644 --- a/Test/TestGeometry/tests/options/geant_overlap_test_fcchh.py +++ b/Test/TestGeometry/tests/options/geant_overlap_test_fcchh.py @@ -10,7 +10,7 @@ detector='SimG4DD4hepDetector', physicslist="SimG4FtfpBert", actions="SimG4FullSimActions", - g4PostInitCommands=['/geometry/test/recursion_depth 3', '/geometry/test/run']) + g4PostInitCommands=['/geometry/test/recursion_depth 2', '/geometry/test/run']) ApplicationMgr(TopAlg=[], EvtSel='NONE', diff --git a/Test/TestGeometryLib/CMakeLists.txt b/Test/TestGeometryLib/CMakeLists.txt new file mode 100644 index 000000000..f207eb647 --- /dev/null +++ b/Test/TestGeometryLib/CMakeLists.txt @@ -0,0 +1,24 @@ +################################################################################ +# Package: TestGeometry +################################################################################ +gaudi_subdir(TestGeometryLib v1r0) + +gaudi_depends_on_subdirs(GaudiKernel FWCore Sim/SimG4Interface Sim/SimG4Common Detector/DetInterface Detector/DetCommon) + +find_package(Geant4) +include(${Geant4_USE_FILE}) +find_package(DD4hep) +find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) + +gaudi_install_headers(TestGeometryLib) + +gaudi_add_library(TestGeometryLib + src/*.cpp + INCLUDE_DIRS Geant4 ROOT TestGeometryLib DD4hep + LINK_LIBRARIES GaudiKernel Geant4 ROOT DD4hep + PUBLIC_HEADERS TestGeometryLib) + + +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +dd4hep_generate_rootmap(TestGeometryLib) + diff --git a/Test/TestGeometry/TestGeometry/GdmlDetectorConstruction.h b/Test/TestGeometryLib/TestGeometryLib/GdmlDetectorConstruction.h similarity index 100% rename from Test/TestGeometry/TestGeometry/GdmlDetectorConstruction.h rename to Test/TestGeometryLib/TestGeometryLib/GdmlDetectorConstruction.h diff --git a/Test/TestGeometry/TestGeometry/TestCalorimeterHit.h b/Test/TestGeometryLib/TestGeometryLib/TestCalorimeterHit.h similarity index 100% rename from Test/TestGeometry/TestGeometry/TestCalorimeterHit.h rename to Test/TestGeometryLib/TestGeometryLib/TestCalorimeterHit.h diff --git a/Test/TestGeometry/TestGeometry/TestCalorimeterSD.h b/Test/TestGeometryLib/TestGeometryLib/TestCalorimeterSD.h similarity index 95% rename from Test/TestGeometry/TestGeometry/TestCalorimeterSD.h rename to Test/TestGeometryLib/TestGeometryLib/TestCalorimeterSD.h index 8ffc792d1..5891213d1 100644 --- a/Test/TestGeometry/TestGeometry/TestCalorimeterSD.h +++ b/Test/TestGeometryLib/TestGeometryLib/TestCalorimeterSD.h @@ -1,7 +1,7 @@ #ifndef TESTGEOMETRY_CALORIMETERSD_H #define TESTGEOMETRY_CALORIMETERSD_H -#include "TestGeometry/TestCalorimeterHit.h" +#include "TestGeometryLib/TestCalorimeterHit.h" #include "G4VSensitiveDetector.hh" class G4Step; diff --git a/Test/TestGeometry/TestGeometry/TestKillProcess.h b/Test/TestGeometryLib/TestGeometryLib/TestKillProcess.h similarity index 100% rename from Test/TestGeometry/TestGeometry/TestKillProcess.h rename to Test/TestGeometryLib/TestGeometryLib/TestKillProcess.h diff --git a/Test/TestGeometry/TestGeometry/TestPhysicsList.h b/Test/TestGeometryLib/TestGeometryLib/TestPhysicsList.h similarity index 95% rename from Test/TestGeometry/TestGeometry/TestPhysicsList.h rename to Test/TestGeometryLib/TestGeometryLib/TestPhysicsList.h index 71b3b0f31..328967b32 100644 --- a/Test/TestGeometry/TestGeometry/TestPhysicsList.h +++ b/Test/TestGeometryLib/TestGeometryLib/TestPhysicsList.h @@ -1,7 +1,7 @@ #ifndef TESTGEOMETRY_PHYSICSLIST_H #define TESTGEOMETRY_PHYSICSLIST_H -#include "TestGeometry/TestKillProcess.h" +#include "TestGeometryLib/TestKillProcess.h" // Geant #include "G4VModularPhysicsList.hh" diff --git a/Test/TestGeometry/src/lib/GdmlDetectorConstruction.cpp b/Test/TestGeometryLib/src/GdmlDetectorConstruction.cpp similarity index 93% rename from Test/TestGeometry/src/lib/GdmlDetectorConstruction.cpp rename to Test/TestGeometryLib/src/GdmlDetectorConstruction.cpp index ae2296b9d..ac4147b69 100644 --- a/Test/TestGeometry/src/lib/GdmlDetectorConstruction.cpp +++ b/Test/TestGeometryLib/src/GdmlDetectorConstruction.cpp @@ -1,7 +1,7 @@ -#include "TestGeometry/GdmlDetectorConstruction.h" +#include "TestGeometryLib/GdmlDetectorConstruction.h" // FCCSW -#include "TestGeometry/TestCalorimeterSD.h" +#include "TestGeometryLib/TestCalorimeterSD.h" // Geant4 #include "G4SDManager.hh" diff --git a/Test/TestGeometryLib/src/SimpleBarrel.cpp b/Test/TestGeometryLib/src/SimpleBarrel.cpp new file mode 100644 index 000000000..d9111f6bd --- /dev/null +++ b/Test/TestGeometryLib/src/SimpleBarrel.cpp @@ -0,0 +1,37 @@ +#include "DD4hep/DetFactoryHelper.h" + +namespace det { +static dd4hep::Ref_t createSimpleBarrel(dd4hep::Detector& aLcdd, + dd4hep::xml::Handle_t aXmlElement, + dd4hep::SensitiveDetector aSensDet) { + dd4hep::xml::DetElement x_det = aXmlElement; + std::string name = x_det.nameStr(); + dd4hep::xml::Dimension dim(x_det.dimensions()); + dd4hep::xml::Dimension pos(x_det.position()); + dd4hep::xml::Dimension rot(x_det.rotation()); + dd4hep::DetElement det(name, x_det.id()); + dd4hep::Volume det_vol(name + "_vol", dd4hep::Tube(dim.rmin(), dim.rmax(), dim.dz()), + aLcdd.material(x_det.materialStr())); + dd4hep::Volume mother = aLcdd.pickMotherVolume(det); + dd4hep::Transform3D transform( + dd4hep::Rotation3D(dd4hep::RotationZYX(rot.z(), rot.y(), rot.x())), + dd4hep::Position(pos.x(), pos.y(), pos.z())); + dd4hep::PlacedVolume phv = mother.placeVolume(det_vol, transform); + det_vol.setVisAttributes(aLcdd, x_det.visStr()); + det_vol.setLimitSet(aLcdd, x_det.limitsStr()); + det_vol.setRegion(aLcdd, x_det.regionStr()); + if (x_det.isSensitive()) { + dd4hep::SensitiveDetector sd = aSensDet; + dd4hep::xml::Dimension sd_typ = x_det.child(_U(sensitive)); + det_vol.setSensitiveDetector(aSensDet); + sd.setType(sd_typ.typeStr()); + } + if (x_det.hasAttr(_U(id))) { + phv.addPhysVolID("system", x_det.id()); + } + det.setPlacement(phv); + return det; +} +} +// first argument is the type from the xml file +DECLARE_DETELEMENT(SimpleBarrel, det::createSimpleBarrel) diff --git a/Test/TestGeometryLib/src/SimpleBoxes.cpp b/Test/TestGeometryLib/src/SimpleBoxes.cpp new file mode 100644 index 000000000..e337fa05e --- /dev/null +++ b/Test/TestGeometryLib/src/SimpleBoxes.cpp @@ -0,0 +1,74 @@ +#include "DD4hep/DetFactoryHelper.h" + +namespace det { +static dd4hep::Ref_t createSimpleBoxes(dd4hep::Detector& aLcdd, + dd4hep::xml::Handle_t aXmlElement, + dd4hep::SensitiveDetector aSensDet) { + dd4hep::xml::DetElement x_det = aXmlElement; + std::string name = x_det.nameStr(); + dd4hep::xml::Dimension dim(x_det.dimensions()); + dd4hep::xml::Dimension pos(x_det.position()); + dd4hep::xml::Dimension rot(x_det.rotation()); + dd4hep::DetElement det(name, x_det.id()); + dd4hep::Material air = aLcdd.air(); + dd4hep::Volume det_vol(name + "_vol", dd4hep::Box(dim.x(), dim.y(), dim.z()), + aLcdd.material(x_det.materialStr())); + dd4hep::Volume mother = aLcdd.pickMotherVolume(det); + dd4hep::Transform3D transform( + dd4hep::Rotation3D(dd4hep::RotationZYX(rot.z(), rot.y(), rot.x())), + dd4hep::Position(pos.x(), pos.y(), pos.z())); + + // add cells : + dd4hep::xml::DetElement cell_det = aXmlElement.child(_Unicode(module)); + dd4hep::xml::Dimension cell_dim(cell_det.dimensions()); + dd4hep::Material cell_mat(aLcdd.material(cell_det.materialStr())); + // assume same no of cells each direction (x,y,z) + unsigned int numCells = dim.x() / cell_dim.x(); + double offset = -1. * dim.x() + cell_dim.x(); + // create volumes for cell, row and layer + dd4hep::Volume cell_vol("cell_vol", dd4hep::Box(cell_dim.x(), cell_dim.y(), cell_dim.z()), + cell_mat); + dd4hep::Volume row_vol("row_vol", dd4hep::Box(dim.x(), cell_dim.y(), cell_dim.z()), air); + dd4hep::Volume layer_vol("layer_vol", dd4hep::Box(dim.x(), dim.y(), cell_dim.z()), air); + // attach sensitive detector + dd4hep::SensitiveDetector sd = aSensDet; + dd4hep::xml::Dimension sd_typ = x_det.child(_U(sensitive)); + sd.setType(sd_typ.typeStr()); + cell_vol.setSensitiveDetector(aSensDet); + // place cells in a row + for (uint ix = 0; ix < numCells; ix++) { + auto cellName = std::string("cell") + dd4hep::xml::_toString(ix, "x%d"); + dd4hep::Transform3D transformcell(dd4hep::Rotation3D(dd4hep::RotationZYX(0, 0, 0)), + dd4hep::Position(offset + ix * 2 * cell_dim.x(), 0, 0)); + dd4hep::PlacedVolume cell_physvol = row_vol.placeVolume(cell_vol, transformcell); + cell_physvol.addPhysVolID("modulex", ix); + } + // place rows in a layer + for (uint iy = 0; iy < numCells; iy++) { + auto cellName = std::string("row") + dd4hep::xml::_toString(iy, "y%d"); + dd4hep::Transform3D transformrow(dd4hep::Rotation3D(dd4hep::RotationZYX(0, 0, 0)), + dd4hep::Position(0, offset + iy * 2 * cell_dim.y(), 0)); + dd4hep::PlacedVolume row_physvol = layer_vol.placeVolume(row_vol, transformrow); + row_physvol.addPhysVolID("moduley", iy); + } + // place layers in the box volume + for (uint iz = 0; iz < numCells; iz++) { + auto cellName = std::string("layer") + dd4hep::xml::_toString(iz, "z%d"); + dd4hep::Transform3D transformlayer(dd4hep::Rotation3D(dd4hep::RotationZYX(0, 0, 0)), + dd4hep::Position(0, 0, offset + iz * 2 * cell_dim.z())); + dd4hep::PlacedVolume layer_physvol = det_vol.placeVolume(layer_vol, transformlayer); + layer_physvol.addPhysVolID("modulez", iz); + } + + // place box + dd4hep::PlacedVolume phv = mother.placeVolume(det_vol, transform); + det_vol.setVisAttributes(aLcdd, x_det.visStr()); + det_vol.setLimitSet(aLcdd, x_det.limitsStr()); + det_vol.setRegion(aLcdd, x_det.regionStr()); + phv.addPhysVolID("system", x_det.id()); + det.setPlacement(phv); + return det; +} +} +// first argument is the type from the xml file +DECLARE_DETELEMENT(SimpleBoxes, det::createSimpleBoxes) diff --git a/Test/TestGeometryLib/src/SlicedBarrel.cpp b/Test/TestGeometryLib/src/SlicedBarrel.cpp new file mode 100644 index 000000000..49ee6c6ab --- /dev/null +++ b/Test/TestGeometryLib/src/SlicedBarrel.cpp @@ -0,0 +1,53 @@ +#include "DD4hep/DetFactoryHelper.h" + +namespace det { +static dd4hep::Ref_t createSlicedBarrel(dd4hep::Detector& aLcdd, + dd4hep::xml::Handle_t aXmlElement, + dd4hep::SensitiveDetector aSensDet) { + dd4hep::xml::DetElement x_det = aXmlElement; + std::string name = x_det.nameStr(); + dd4hep::xml::Dimension dim(x_det.dimensions()); + dd4hep::xml::Dimension pos(x_det.position()); + dd4hep::xml::Dimension rot(x_det.rotation()); + dd4hep::DetElement det(name, x_det.id()); + dd4hep::Volume det_vol(name + "_vol", dd4hep::Tube(dim.rmin(), dim.rmax(), dim.dz()), + aLcdd.material(x_det.materialStr())); + dd4hep::Volume mother = aLcdd.pickMotherVolume(det); + dd4hep::Transform3D transform( + dd4hep::Rotation3D(dd4hep::RotationZYX(rot.z(), rot.y(), rot.x())), + dd4hep::Position(pos.x(), pos.y(), pos.z())); + + // here add cells : + dd4hep::xml::DetElement cell_det = aXmlElement.child(_Unicode(module)); + std::string cell_name = cell_det.nameStr(); + dd4hep::xml::Dimension slice_dim(cell_det.dimensions()); + dd4hep::Material cell_mat(aLcdd.material(cell_det.materialStr())); + // we assume no segmentation in R/phi direction + unsigned int numSlices = dim.dz() / slice_dim.dz(); + double offset = -1. * dim.dz() + slice_dim.dz(); + dd4hep::Volume slice_vol( + cell_name + "_vol", dd4hep::Tube(slice_dim.rmin(), slice_dim.rmax(), slice_dim.dz()), cell_mat); + + dd4hep::SensitiveDetector sd = aSensDet; + dd4hep::xml::Dimension sd_typ = x_det.child(_U(sensitive)); + sd.setType(sd_typ.typeStr()); + slice_vol.setSensitiveDetector(aSensDet); + for (uint iz = 0; iz < numSlices; iz++) { + auto sliceName = cell_name + dd4hep::xml::_toString(iz, "z%d"); + dd4hep::Transform3D transformcell(dd4hep::Rotation3D(dd4hep::RotationZYX(0, 0, 0)), + dd4hep::Position(0, 0, offset + iz * 2 * slice_dim.dz())); + dd4hep::PlacedVolume slice_physvol = det_vol.placeVolume(slice_vol, transformcell); + slice_physvol.addPhysVolID("z", iz); + } + // place outer box + dd4hep::PlacedVolume phv = mother.placeVolume(det_vol, transform); + det_vol.setVisAttributes(aLcdd, x_det.visStr()); + det_vol.setLimitSet(aLcdd, x_det.limitsStr()); + det_vol.setRegion(aLcdd, x_det.regionStr()); + phv.addPhysVolID("system", x_det.id()); + det.setPlacement(phv); + return det; +} +} +// first argument is the type from the xml file +DECLARE_DETELEMENT(SlicedBarrel, det::createSlicedBarrel) diff --git a/Test/TestGeometry/src/lib/TestCalorimeterHit.cpp b/Test/TestGeometryLib/src/TestCalorimeterHit.cpp similarity index 95% rename from Test/TestGeometry/src/lib/TestCalorimeterHit.cpp rename to Test/TestGeometryLib/src/TestCalorimeterHit.cpp index 5eeb37ac1..8975d73e9 100644 --- a/Test/TestGeometry/src/lib/TestCalorimeterHit.cpp +++ b/Test/TestGeometryLib/src/TestCalorimeterHit.cpp @@ -1,4 +1,4 @@ -#include "TestGeometry/TestCalorimeterHit.h" +#include "TestGeometryLib/TestCalorimeterHit.h" namespace test { G4ThreadLocal G4Allocator* TestCalorimeterHitAllocator; diff --git a/Test/TestGeometry/src/lib/TestCalorimeterSD.cpp b/Test/TestGeometryLib/src/TestCalorimeterSD.cpp similarity index 95% rename from Test/TestGeometry/src/lib/TestCalorimeterSD.cpp rename to Test/TestGeometryLib/src/TestCalorimeterSD.cpp index 631506694..dc054a7cc 100644 --- a/Test/TestGeometry/src/lib/TestCalorimeterSD.cpp +++ b/Test/TestGeometryLib/src/TestCalorimeterSD.cpp @@ -1,5 +1,5 @@ -#include "TestGeometry/TestCalorimeterSD.h" -#include "TestGeometry/TestCalorimeterHit.h" +#include "TestGeometryLib/TestCalorimeterSD.h" +#include "TestGeometryLib/TestCalorimeterHit.h" #include "G4HCofThisEvent.hh" #include "G4SDManager.hh" diff --git a/Test/TestGeometry/src/lib/TestKillProcess.cpp b/Test/TestGeometryLib/src/TestKillProcess.cpp similarity index 92% rename from Test/TestGeometry/src/lib/TestKillProcess.cpp rename to Test/TestGeometryLib/src/TestKillProcess.cpp index 7419ac23f..72a35c175 100644 --- a/Test/TestGeometry/src/lib/TestKillProcess.cpp +++ b/Test/TestGeometryLib/src/TestKillProcess.cpp @@ -1,4 +1,4 @@ -#include "TestGeometry/TestKillProcess.h" +#include "TestGeometryLib/TestKillProcess.h" namespace test { diff --git a/Test/TestGeometry/src/lib/TestPhysicsList.cpp b/Test/TestGeometryLib/src/TestPhysicsList.cpp similarity index 93% rename from Test/TestGeometry/src/lib/TestPhysicsList.cpp rename to Test/TestGeometryLib/src/TestPhysicsList.cpp index 697f5e17c..e4e32f689 100644 --- a/Test/TestGeometry/src/lib/TestPhysicsList.cpp +++ b/Test/TestGeometryLib/src/TestPhysicsList.cpp @@ -1,4 +1,4 @@ -#include "TestGeometry/TestPhysicsList.h" +#include "TestGeometryLib/TestPhysicsList.h" // Geant4 #include "G4Electron.hh" diff --git a/Test/TestReconstruction/CMakeLists.txt b/Test/TestReconstruction/CMakeLists.txt index 91f0348dc..42b4878f4 100644 --- a/Test/TestReconstruction/CMakeLists.txt +++ b/Test/TestReconstruction/CMakeLists.txt @@ -10,8 +10,8 @@ include(${Geant4_USE_FILE}) gaudi_add_module(TestTestPlugins src/*.cpp - INCLUDE_DIRS FWCore DetInterface Geant4 DetCommon DetSegmentation GaudiKernel ACTS::ACTSCore - LINK_LIBRARIES GaudiAlgLib FWCore Geant4 DetCommon DetSegmentation ACTS::ACTSCore) + INCLUDE_DIRS FWCore DetInterface TrackingUtils Geant4 DetCommon DetSegmentation GaudiKernel ACTS::ACTSCore + LINK_LIBRARIES GaudiAlgLib FWCore Geant4 TrackingUtils DetCommon DetSegmentation ACTS::ACTSCore) include(CTest) gaudi_add_test(LookForNeighbours diff --git a/Test/TestReconstruction/src/CompareTrackHitPositionAndCellId.cpp b/Test/TestReconstruction/src/CompareTrackHitPositionAndCellId.cpp index 0c389d732..5bc3913f1 100644 --- a/Test/TestReconstruction/src/CompareTrackHitPositionAndCellId.cpp +++ b/Test/TestReconstruction/src/CompareTrackHitPositionAndCellId.cpp @@ -8,7 +8,7 @@ #include "DetInterface/IGeoSvc.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DD4hep/Volumes.h" #include "DDSegmentation/CartesianGridXZ.h" #include "TGeoManager.h" @@ -37,7 +37,7 @@ StatusCode CompareTrackHitPositionAndCellId::execute() { auto readoutEndcap = lcdd->readout("TrackerEndcapReadout"); auto m_decoderEndcap = readoutEndcap.idSpec().decoder(); auto segmentationXZ = - dynamic_cast(readoutBarrel.segmentation().segmentation()); + dynamic_cast(readoutBarrel.segmentation().segmentation()); if (nullptr == segmentationXZ) { error() << "Could not retrieve segmentation!" << endmsg; return StatusCode::FAILURE; @@ -45,7 +45,7 @@ StatusCode CompareTrackHitPositionAndCellId::execute() { double l_segGridSizeXBarrel = segmentationXZ->gridSizeX(); double l_segGridSizeZBarrel = segmentationXZ->gridSizeZ(); - segmentationXZ = dynamic_cast(readoutEndcap.segmentation().segmentation()); + segmentationXZ = dynamic_cast(readoutEndcap.segmentation().segmentation()); if (nullptr == segmentationXZ) { error() << "Could not retrieve segmentation!" << endmsg; return StatusCode::FAILURE; @@ -54,7 +54,7 @@ StatusCode CompareTrackHitPositionAndCellId::execute() { double l_segGridSizeZEndcap = segmentationXZ->gridSizeZ(); std::cout << l_segGridSizeXBarrel << std::endl; - DD4hep::Geometry::VolumeManager volman = m_geoSvc->lcdd()->volumeManager(); + dd4hep::VolumeManager volman = m_geoSvc->lcdd()->volumeManager(); const fcc::PositionedTrackHitCollection* hits = m_positionedTrackHits.get(); double fcc_l1 = 0; @@ -71,7 +71,7 @@ StatusCode CompareTrackHitPositionAndCellId::execute() { auto detelement = volman.lookupDetElement(theCellId); debug() << "volIDfromDetElement: " << detelement.volumeID() << endmsg; - const auto& transformMatrix = detelement.worldTransformation(); + const auto& transformMatrix = detelement.nominal().worldTransformation(); double outGlobal[3] {0,0,0}; fcc_l1 = (*m_decoderBarrel)["x"] * l_segGridSizeXBarrel; fcc_l2 = (*m_decoderBarrel)["z"] * l_segGridSizeZBarrel; @@ -110,7 +110,7 @@ StatusCode CompareTrackHitPositionAndCellId::execute() { debug() << endmsg; auto detelement = volman.lookupDetElement((*m_decoderEndcap).getValue()); debug() << "volId from Detelement: " << detelement.volumeID() << endmsg; - const auto& transformMatrix = detelement.worldTransformation(); + const auto& transformMatrix = detelement.nominal().worldTransformation(); double outGlobal[3] {0, 0, 0}; fcc_l1 = (*m_decoderEndcap)["x"] * l_segGridSizeXEndcap; fcc_l2 = (*m_decoderEndcap)["z"] * l_segGridSizeZEndcap; diff --git a/Reconstruction/RecTracker/src/components/FastGaussSmearDigi.cpp b/Test/TestReconstruction/src/FastGaussSmearDigi.cpp similarity index 90% rename from Reconstruction/RecTracker/src/components/FastGaussSmearDigi.cpp rename to Test/TestReconstruction/src/FastGaussSmearDigi.cpp index f81335507..544fe0f5f 100644 --- a/Reconstruction/RecTracker/src/components/FastGaussSmearDigi.cpp +++ b/Test/TestReconstruction/src/FastGaussSmearDigi.cpp @@ -1,15 +1,13 @@ #include "DetInterface/IGeoSvc.h" +#include "DD4hep/Detector.h" +#include "DDSegmentation/BitField64.h" +#include "DDSegmentation/CartesianGridXZ.h" #include "datamodel/PositionedTrackHitCollection.h" #include "datamodel/TrackHitCollection.h" #include "datamodel/TrackHitCollection.h" -#include "DD4hep/LCDD.h" -#include "DD4hep/Volumes.h" -#include "DDRec/API/IDDecoder.h" -#include "DDSegmentation/BitField64.h" -#include "DDSegmentation/CartesianGridXZ.h" #include #include @@ -36,22 +34,22 @@ StatusCode FastGaussSmearDigi::initialize() { StatusCode sc = GaudiAlgorithm::initialize(); if (sc.isFailure()) return sc; + return sc; +} + +StatusCode FastGaussSmearDigi::execute() { + auto lcdd = m_geoSvc->lcdd(); auto readout = lcdd->readout(m_readoutName); - m_decoder = readout.idSpec().decoder(); - auto segmentationXZ = dynamic_cast(readout.segmentation().segmentation()); + auto m_decoder = readout.idSpec().decoder(); + auto segmentationXZ = dynamic_cast(readout.segmentation().segmentation()); if (nullptr == segmentationXZ) { error() << "Could not retrieve segmentation!" << endmsg; return StatusCode::FAILURE; } m_segGridSizeX = segmentationXZ->gridSizeX(); m_segGridSizeZ = segmentationXZ->gridSizeZ(); - m_volman = lcdd->volumeManager(); - return sc; -} - -StatusCode FastGaussSmearDigi::execute() { - + auto m_volman = lcdd->volumeManager(); // get hits from event store const fcc::TrackHitCollection* hits = m_trackHits.get(); std::vector sortedHits; @@ -69,7 +67,7 @@ StatusCode FastGaussSmearDigi::execute() { std::array globalPos = {0, 0, 0}; // direct lookup of transformation in the volume manager is broken in dd4hep auto detelement = m_volman.lookupDetElement(m_decoder->getValue()); - const auto& localToGlobal = detelement.worldTransformation(); + const auto& localToGlobal = detelement.nominal().worldTransformation(); localToGlobal.LocalToMaster(localPos.data(), globalPos.data()); auto position = fcc::Point(); // default dd4hep units differ from fcc ones diff --git a/Reconstruction/RecTracker/src/components/FastGaussSmearDigi.h b/Test/TestReconstruction/src/FastGaussSmearDigi.h similarity index 88% rename from Reconstruction/RecTracker/src/components/FastGaussSmearDigi.h rename to Test/TestReconstruction/src/FastGaussSmearDigi.h index 524f4adc4..abb1c7b49 100644 --- a/Reconstruction/RecTracker/src/components/FastGaussSmearDigi.h +++ b/Test/TestReconstruction/src/FastGaussSmearDigi.h @@ -1,6 +1,9 @@ #ifndef RECTRACKER_FASTGAUSSSMEARDIGI_H #define RECTRACKER_FASTGAUSSSMEARDIGI_H +//#include "DD4hep/Detector.h" +//#include "DD4hep/BitField64.h" + // GAUDI #include "GaudiAlg/GaudiAlgorithm.h" #include "GaudiKernel/RndmGenerators.h" @@ -16,6 +19,9 @@ class TrackHitCollection; class PositionedTrackHitCollection; } + + + class FastGaussSmearDigi : public GaudiAlgorithm { public: FastGaussSmearDigi(const std::string& name, ISvcLocator* svcLoc); @@ -34,8 +40,8 @@ class FastGaussSmearDigi : public GaudiAlgorithm { float m_segGridSizeZ; float m_segGridSizeX; - DD4hep::DDSegmentation::BitField64* m_decoder; - DD4hep::Geometry::VolumeManager m_volman; + //dd4hep::DDSegmentation::BitField64* m_decoder; + //dd4hep::VolumeManager m_volman; DataHandle m_trackHits{"trackHits", Gaudi::DataHandle::Reader, this}; DataHandle m_smearedTrackHits{"smearedHits", Gaudi::DataHandle::Writer, this}; diff --git a/Test/TestReconstruction/src/TestCellCounting.cpp b/Test/TestReconstruction/src/TestCellCounting.cpp index 389c516be..aecfb7caf 100644 --- a/Test/TestReconstruction/src/TestCellCounting.cpp +++ b/Test/TestReconstruction/src/TestCellCounting.cpp @@ -3,13 +3,13 @@ // FCCSW #include "DetCommon/DetUtils.h" #include "DetInterface/IGeoSvc.h" -#include "DetSegmentation/GridPhiEta.h" +#include "DetSegmentation/FCCSWGridPhiEta.h" // datamodel #include "datamodel/CaloHitCollection.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" #include "DDSegmentation/BitField64.h" #include "DDSegmentation/CartesianGridXY.h" #include "DDSegmentation/CartesianGridXYZ.h" @@ -50,7 +50,7 @@ StatusCode TestCellCounting::initialize() { // count the segmentation cells for the volume info() << "Counting cells for volume " << decoder->valueString() << " -> volume ID: " << m_volumeId << endmsg; - auto segmentationXY = dynamic_cast( + auto segmentationXY = dynamic_cast( m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()); if (segmentationXY == nullptr) { info() << "There is no Cartesian XY segmentation." << endmsg; @@ -58,7 +58,7 @@ StatusCode TestCellCounting::initialize() { info() << "Number of segmentation cells in (x,y): " << det::utils::numberOfCells(m_volumeId, *segmentationXY) << endmsg; } - auto segmentationXYZ = dynamic_cast( + auto segmentationXYZ = dynamic_cast( m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()); if (segmentationXYZ == nullptr) { info() << "There is no Cartesian XYZ segmentation." << endmsg; @@ -66,7 +66,7 @@ StatusCode TestCellCounting::initialize() { info() << "Number of segmentation cells in (x,y,z): " << det::utils::numberOfCells(m_volumeId, *segmentationXYZ) << endmsg; } - auto segmentationRPhi = dynamic_cast( + auto segmentationRPhi = dynamic_cast( m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()); if (segmentationRPhi == nullptr) { info() << "There is no R-phi segmentation." << endmsg; @@ -74,7 +74,7 @@ StatusCode TestCellCounting::initialize() { info() << "Number of segmentation cells in (r,phi): " << det::utils::numberOfCells(m_volumeId, *segmentationRPhi) << endmsg; } - auto segmentationPhiEta = dynamic_cast( + auto segmentationPhiEta = dynamic_cast( m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()); if (segmentationPhiEta == nullptr) { info() << "There is no phi-eta segmentation." << endmsg; diff --git a/Test/TestReconstruction/src/TestNeighbours.cpp b/Test/TestReconstruction/src/TestNeighbours.cpp index 05064ca01..61f58eda9 100644 --- a/Test/TestReconstruction/src/TestNeighbours.cpp +++ b/Test/TestReconstruction/src/TestNeighbours.cpp @@ -8,7 +8,7 @@ #include "datamodel/CaloHitCollection.h" // DD4hep -#include "DD4hep/LCDD.h" +#include "DD4hep/Detector.h" DECLARE_ALGORITHM_FACTORY(TestNeighbours) @@ -28,8 +28,7 @@ StatusCode TestNeighbours::initialize() { << "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg; return StatusCode::FAILURE; } - m_decoder = std::shared_ptr( - m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()->decoder()); + m_decoder = m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()->decoder(); m_fieldNames = {"x", "y", "z"}; info() << "Bitfield: " << m_decoder->fieldDescription() << endmsg; // get the minimal and maximal value that can be decoded in the bitfield diff --git a/Test/TestReconstruction/src/TestNeighbours.h b/Test/TestReconstruction/src/TestNeighbours.h index 322501f57..e926dd22f 100644 --- a/Test/TestReconstruction/src/TestNeighbours.h +++ b/Test/TestReconstruction/src/TestNeighbours.h @@ -11,7 +11,7 @@ class IGeoSvc; // DD4hep -namespace DD4hep { +namespace dd4hep { namespace DDSegmentation { class BitField64; } @@ -54,7 +54,7 @@ class TestNeighbours : public GaudiAlgorithm { /// Name of the detector readout Gaudi::Property m_readoutName{this, "readout", "", "Name of the detector readout"}; /// Pointer to the bitfield decoder - std::shared_ptr m_decoder; + dd4hep::DDSegmentation::BitField64* m_decoder; /// Names of the fields for which neighbours are found std::vector m_fieldNames; /// Minimal and maximal values of the fields for which neighbours are found diff --git a/Visualization/src/FCCEventHandler.cpp b/Visualization/src/FCCEventHandler.cpp index ef757bd8d..acc8f9cc2 100644 --- a/Visualization/src/FCCEventHandler.cpp +++ b/Visualization/src/FCCEventHandler.cpp @@ -21,9 +21,9 @@ #include "FCCEventHandler.h" -using DD4hep::DDEveParticleActor; -using DD4hep::DDEveHitActor; -using DD4hep::DDEveHit; +using dd4hep::DDEveParticleActor; +using dd4hep::DDEveHitActor; +using dd4hep::DDEveHit; static void* _createFCCEventHandler(const char*) { vis::FCCEventHandler* h = new vis::FCCEventHandler(); @@ -49,7 +49,7 @@ long FCCEventHandler::numEvents() const { } /// Access to the collection type by name -DD4hep::EventHandler::CollectionType FCCEventHandler::collectionType(const std::string& cl) const { +dd4hep::EventHandler::CollectionType FCCEventHandler::collectionType(const std::string& cl) const { if (cl == "caloPositionedHits") return CALO_HIT_COLLECTION; else if (cl == "positionedHits") diff --git a/Visualization/src/FCCEventHandler.h b/Visualization/src/FCCEventHandler.h index 1a919b7d2..c33d41340 100644 --- a/Visualization/src/FCCEventHandler.h +++ b/Visualization/src/FCCEventHandler.h @@ -12,7 +12,7 @@ namespace vis { -class FCCEventHandler : public DD4hep::EventHandler { +class FCCEventHandler : public dd4hep::EventHandler { private: podio::EventStore m_podioStore = podio::EventStore(); podio::ROOTReader m_ROOTReader = podio::ROOTReader(); @@ -36,9 +36,9 @@ class FCCEventHandler : public DD4hep::EventHandler { /// Access to the collection type by name virtual CollectionType collectionType(const std::string& collection) const; /// Call functor on hit collection - virtual size_t collectionLoop(const std::string& collection, DD4hep::DDEveHitActor& actor); + virtual size_t collectionLoop(const std::string& collection, dd4hep::DDEveHitActor& actor); /// Loop over collection and extract particle data - virtual size_t collectionLoop(const std::string& collection, DD4hep::DDEveParticleActor& actor); + virtual size_t collectionLoop(const std::string& collection, dd4hep::DDEveParticleActor& actor); /// Open new data file virtual bool Open(const std::string& type, const std::string& file_name); /// User overloadable function: Load the next event diff --git a/init.sh b/init.sh old mode 100755 new mode 100644 index a06974fb2..9a9e8c6b9 --- a/init.sh +++ b/init.sh @@ -1,7 +1,7 @@ + #!/bin/sh -u # set FCCSWBASEDIR to the directory containing this script export FCCSWBASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source /cvmfs/fcc.cern.ch/sw/0.8.3/init_fcc_stack.sh $1 - -export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/cvmfs/fcc.cern.ch/sw/0.8.3/acts/0.4.0/x86_64-slc6-gcc62-opt/share/cmake/ACTS/ +weekday=`date +%a` +source /cvmfs/fcc.cern.ch/testing/sw/views/stable/x86_64-slc6-gcc62-opt/setup.sh