From c5966693ad45f7bbd2c5e36d9b02e2201d5bb51e Mon Sep 17 00:00:00 2001 From: Alvaro Tolosa Delgado Date: Thu, 21 Sep 2023 15:50:31 +0200 Subject: [PATCH] SimpleCylinder from FCCDetectors/common migrated to detector/other directory in k4geo --- .../FCCee_EcalEndcaps_coneCryo.xml | 28 +++++------ .../compact/ALLEGRO_o1_v01/MuonTagger.xml | 6 +-- detector/other/SimpleCylinder_geo_o1_v01.cpp | 50 +++++++++++++++++++ 3 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 detector/other/SimpleCylinder_geo_o1_v01.cpp diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_EcalEndcaps_coneCryo.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_EcalEndcaps_coneCryo.xml index 4df534bf0..33abcf035 100644 --- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_EcalEndcaps_coneCryo.xml +++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_EcalEndcaps_coneCryo.xml @@ -70,33 +70,33 @@ - + - + - + - + - + - + - + @@ -131,33 +131,33 @@ - + - + - + - + - + - + - + diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/MuonTagger.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/MuonTagger.xml index 479893849..79b0ed182 100644 --- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/MuonTagger.xml +++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/MuonTagger.xml @@ -27,19 +27,19 @@ - + - + - + diff --git a/detector/other/SimpleCylinder_geo_o1_v01.cpp b/detector/other/SimpleCylinder_geo_o1_v01.cpp new file mode 100644 index 000000000..af4a60d76 --- /dev/null +++ b/detector/other/SimpleCylinder_geo_o1_v01.cpp @@ -0,0 +1,50 @@ +#include "DD4hep/DetFactoryHelper.h" + +namespace det { +/** + Simple cylinder using Tube to be used to define cylinder composed of 1 single material + @author Clement Helsens +**/ +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::DetElement cylinderDet(name, x_det.id()); + + dd4hep::Volume experimentalHall = lcdd.pickMotherVolume(cylinderDet); + + xml_comp_t cylinderDim(x_det.child(_U(dimensions))); + + dd4hep::Tube cylinder( + cylinderDim.rmin(), cylinderDim.rmax(), cylinderDim.dz(), cylinderDim.phi0(), cylinderDim.deltaphi()); + + 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))); + cylinderVol.setSensitiveDetector(sensDet); + sensDet.setType(sdType.typeStr()); + } + + dd4hep::PlacedVolume cylinderPhys; + + double zoff = cylinderDim.z_offset(); + if (fabs(zoff) > 0.000000000001) { + dd4hep::Position trans(0., 0., zoff); + cylinderPhys = experimentalHall.placeVolume(cylinderVol, + dd4hep::Transform3D(dd4hep::RotationZ(0.), trans)); + } else + cylinderPhys = experimentalHall.placeVolume(cylinderVol); + + cylinderPhys.addPhysVolID("system", x_det.id()); + + cylinderDet.setPlacement(cylinderPhys); + + cylinderDet.setVisAttributes(lcdd, x_det.visStr(), cylinderVol); + + return cylinderDet; +} +} +DECLARE_DETELEMENT(SimpleCylinder_o1_v01, det::createSimpleCylinder) +