diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fedc35d305cb9c2a690419ca275163d38f73609..9896f2f564d6a31035e4b61c05cb8de6aa3be421 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -185,15 +185,19 @@ overlap_check_tgeo: - echo "$(cat doc/overlap_check_tgeo.out | grep ovlp | wc -l) overlaps..." - if [[ "$(cat doc/overlap_check_tgeo.out | grep ovlp | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi -overlap_check_geant4:full: +overlap_check_geant4:full_fast: stage: test needs: - ["common:detector"] script: + ## disable fibers in ECAL for normal overlap check + - sed -i '/<fiber/,+6d' ${DETECTOR_PATH}/compact/ecal_barrel_interlayers.xml - python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/athena.xml | tee doc/overlap_check_geant4.out - echo "$(cat doc/overlap_check_geant4.out | grep GeomVol1002 | wc -l) overlaps..." - if [[ "$(cat doc/overlap_check_geant4.out | grep GeomVol1002 | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi +## TODO: add real full overlap check as child pipeline to run on branches only + overlap_check_geant4:inner_detector: stage: test needs: diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d868e192eae5fd1a32e5a9c75476f314b913f5c..5d97ae91e55f6d0654a093c8ee3d5e0faae5f441 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,8 +37,7 @@ dd4hep_add_plugin(${a_lib_name} SOURCES src/MRich_geo.cpp src/PolyhedraEndcapCalorimeter2_geo.cpp src/ShashlikCalorimeter_geo.cpp - src/SimpleDiskTracker_geo.cpp - src/SimpleRectangularTracker_geo.cpp + src/SimpleDiskDetector_geo.cpp src/SolenoidCoil_geo.cpp src/TrapEndcapTracker_geo.cpp USES ActsCore ActsPluginDD4hep diff --git a/compact/central_tracker.xml b/compact/central_tracker.xml index 5dee338c36035cecd49794f359106282ab64c9ff..a1aed4d51c5b367bdc6686e22d7dcf0c78c34c6e 100644 --- a/compact/central_tracker.xml +++ b/compact/central_tracker.xml @@ -532,11 +532,11 @@ total X0 0.24% per disk layer (4 sectors per disk): <readouts> <readout name="TrackerBarrelHits"> <segmentation type="CartesianGridXY" grid_size_x="0.010*mm" grid_size_y="0.010*mm" /> - <id>system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-14,y:-18</id> + <id>system:8,layer:4,module:12,sensor:2,x:32:-14,y:-18</id> </readout> <readout name="TrackerEndcapHits"> <segmentation type="CartesianGridXZ" grid_size_x="0.010*mm" grid_size_z="0.010*mm" /> - <id>system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-16,z:-16</id> + <id>system:8,layer:4,module:12,sensor:2,x:32:-16,z:-16</id> </readout> diff --git a/compact/display.xml b/compact/display.xml index abf6f3a865c27fbec45c512a73341b46cd07ab50..8c5edf5dbbfc6fa5b15b0617de7dedb3e86251e6 100644 --- a/compact/display.xml +++ b/compact/display.xml @@ -66,7 +66,7 @@ <vis name="DIRCVis" ref="AnlTeal" showDaughters="true" visible="false"/> <vis name="DIRCLayerVis" ref="AnlTeal" showDaughters="true" visible="false"/> <vis name="DIRCModuleVis" ref="AnlTeal" showDaughters="true" visible="false"/> - <vis name="DIRCSupportVis" ref="AnlGray" showDaughters="true" visible="true"/> + <vis name="DIRCSupportVis" ref="AnlTeal" showDaughters="true" visible="true"/> <vis name="DIRCFrameVis" ref="AnlOrange" showDaughters="true" visible="true"/> <vis name="DIRCBarVis" ref="AnlTeal" showDaughters="true" visible="true"/> diff --git a/compact/fake_dirc.xml b/compact/fake_dirc.xml index 9af533ee957acfee076b6c43a94b40f8413ac4d2..7dfce9ab006eea9c498d0de8af7dccc0df5fe5dc 100644 --- a/compact/fake_dirc.xml +++ b/compact/fake_dirc.xml @@ -97,7 +97,7 @@ <readouts> <readout name="DIRCBarHits"> <segmentation type="CartesianGridXY" grid_size_x="3.0*mm" grid_size_y="3.0*mm" /> - <id>system:8,barrel:2,layer:4,module:8,section:4,x:32:-16,y:-16</id> + <id>system:8,layer:4,module:8,section:4,x:32:-16,y:-16</id> </readout> </readouts> diff --git a/compact/gem_tracker_endcap.xml b/compact/gem_tracker_endcap.xml index f88e530af0e42389a42e569f0b0706a46a83b0b7..6ae6f6c54442c1357b61b6ca57188ac36a95b584 100644 --- a/compact/gem_tracker_endcap.xml +++ b/compact/gem_tracker_endcap.xml @@ -216,7 +216,7 @@ <readouts> <readout name="GEMTrackerEndcapHits"> <segmentation type="CartesianGridXZ" grid_size_x="50*um" grid_size_z="250*um" /> - <id>system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-16,z:-16</id> + <id>system:8,layer:4,module:12,sensor:2,x:32:-16,z:-16</id> </readout> </readouts> diff --git a/compact/mrich.xml b/compact/mrich.xml index 0826d32c298f4939c6838646e0cff8d09bb1f4e7..469952a1e95ebb25d25122d50228bfdec436b2f8 100644 --- a/compact/mrich.xml +++ b/compact/mrich.xml @@ -91,19 +91,20 @@ </photodet> </module> <comment> - Modules are only listed here for one quadrant + Modules are only listed here for one quadrant. The modules point back to the + z0 position (should be their actual position, but breaks parametrization). </comment> - <positions scale="1.03"> + <positions scale="1.03" z0="157.5*cm"> <position x="-41.3250000000" y="178.6750000000"/> <position x=" 96.0250000001" y="178.6750000000"/> </positions> - <positions scale="1.036"> + <positions scale="1.036" z0="157.5*cm"> <position x="-41.3250000000" y="316.0250000001"/> <position x=" 96.0250000001" y="316.0250000001"/> <position x="233.3750000002" y="178.6750000000"/> <position x="233.3750000002" y="316.0250000001"/> </positions> - <positions scale="1.052"> + <positions scale="1.052" z0="157.5*cm"> <position x="-41.3250000000" y="453.3750000002"/> <position x=" 96.0250000001" y="453.3750000002"/> <position x="233.3750000002" y="453.3750000002"/> @@ -111,7 +112,7 @@ <position x="370.7250000003" y="316.0250000001"/> <position x="370.7250000003" y="178.6750000000"/> </positions> - <positions scale="1.078"> + <positions scale="1.078" z0="157.5*cm"> <position x="-41.3250000000" y="590.7250000003"/> <position x=" 96.0250000001" y="590.7250000003"/> <position x="233.3750000002" y="590.7250000003"/> @@ -121,7 +122,7 @@ <position x="508.0750000004" y="316.0250000001"/> <position x="508.0750000004" y="453.3750000002"/> </positions> - <positions scale="1.09"> + <positions scale="1.09" z0="157.5*cm"> <position x="-41.3250000000" y="728.0750000004"/> <position x=" 96.0250000001" y="728.0750000004"/> <!--position x="233.3750000002" y="728.0750000004"/--> @@ -132,7 +133,7 @@ <position x="645.4250000005" y="316.0250000001"/> <position x="645.4250000005" y="178.6750000000"/> </positions> - <positions scale="1.095"> + <positions scale="1.095" z0="157.5*cm"> <!--position x="-41.3250000000" y="865.4250000005"/--> <!--position x=" 96.0250000001" y="865.4250000005"/--> <!--position x="233.3750000002" y="865.4250000005"/--> diff --git a/compact/tof_barrel.xml b/compact/tof_barrel.xml index 7ba847259e566f5441818c7a49faeafc217cdba7..510654825097750a2bd4b1402d61e542bf70047b 100644 --- a/compact/tof_barrel.xml +++ b/compact/tof_barrel.xml @@ -71,7 +71,7 @@ <readouts> <readout name="BarrelTOFHits"> <segmentation type="CartesianGridXY" grid_size_x="0.150*mm" grid_size_y="0.150*mm" /> - <id>system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-16,y:-16</id> + <id>system:8,layer:4,module:12,sensor:2,x:32:-16,y:-16</id> </readout> </readouts> diff --git a/compact/tof_endcap.xml b/compact/tof_endcap.xml index c79fe5e00bff8a8c43d6dc3587531dc699549d6d..a9b22dc0295a75aefd4dbcfa8feb2c0873703c47 100644 --- a/compact/tof_endcap.xml +++ b/compact/tof_endcap.xml @@ -130,8 +130,8 @@ <readouts> <readout name="TOFEndcapHits"> - <segmentation type="CartesianGridXY" grid_size_x="0.20*mm" grid_size_y="0.20*mm" /> - <id>system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-16,y:-16</id> + <segmentation type="CartesianGridXZ" grid_size_x="0.20*mm" grid_size_z="0.20*mm" /> + <id>system:8,layer:4,module:12,sensor:2,x:32:-16,z:-16</id> </readout> </readouts> diff --git a/compact/vertex_tracker.xml b/compact/vertex_tracker.xml index 0e0d7e65ada2b52aa3446e55b0786f479715bf2c..ce9abfc04eff5c5c40bdb23ac484246532a4abf2 100644 --- a/compact/vertex_tracker.xml +++ b/compact/vertex_tracker.xml @@ -311,11 +311,11 @@ Simple carbon fiber support shell. <readouts> <readout name="VertexBarrelHits"> <segmentation type="CartesianGridXY" grid_size_x="0.010*mm" grid_size_y="0.010*mm" /> - <id>system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-16,y:-16</id> + <id>system:8,layer:4,module:12,sensor:2,x:32:-16,y:-16</id> </readout> <readout name="VertexEndcapHits"> <segmentation type="CartesianGridXZ" grid_size_x="0.20*mm" grid_size_z="0.20*mm" /> - <id>system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-16,z:-16</id> + <id>system:8,layer:4,module:12,sensor:2,x:32:-16,z:-16</id> </readout> </readouts> diff --git a/src/BarrelBarDetectorWithSideFrame_geo.cpp b/src/BarrelBarDetectorWithSideFrame_geo.cpp index eda8daae25f3b60b4aa28515d382a5aad42635c4..d7911bde8a54ec3cc8fde728a7146c22fe61e32a 100644 --- a/src/BarrelBarDetectorWithSideFrame_geo.cpp +++ b/src/BarrelBarDetectorWithSideFrame_geo.cpp @@ -241,7 +241,6 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h assembly.setVisAttributes(description.invisible()); pv = description.pickMotherVolume(sdet).placeVolume(assembly, Position(0, 0, dirc_pos.z())); pv.addPhysVolID("system", det_id); // Set the subdetector system ID. - pv.addPhysVolID("barrel", 1); // Flag this as a barrel subdetector. sdet.setPlacement(pv); return sdet; } diff --git a/src/BarrelTrackerWithFrame_geo.cpp b/src/BarrelTrackerWithFrame_geo.cpp index 6233a2a4eff431d6075c1c1acd791e85238aebd6..bc82b124ffb75442981a5687d4975829fce54941 100644 --- a/src/BarrelTrackerWithFrame_geo.cpp +++ b/src/BarrelTrackerWithFrame_geo.cpp @@ -319,7 +319,6 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi assembly.setVisAttributes(description.invisible()); pv = description.pickMotherVolume(sdet).placeVolume(assembly); pv.addPhysVolID("system", det_id); // Set the subdetector system ID. - pv.addPhysVolID("barrel", 1); // Flag this as a barrel subdetector. sdet.setPlacement(pv); return sdet; } diff --git a/src/MRich_geo.cpp b/src/MRich_geo.cpp index 21054dfbe1e0d8990e087690452621a1d2727d94..65954a1eaf72c9768b572d284fbeae7937af80e6 100644 --- a/src/MRich_geo.cpp +++ b/src/MRich_geo.cpp @@ -33,14 +33,15 @@ static Ref_t createDetector(Detector& description, xml::Handle_t e, SensitiveDet OpticalSurfaceManager surfMgr = description.surfaceManager(); // read module positions - std::vector<std::pair<double,double>> positions; + std::vector<std::tuple<double,double,double>> positions; for (xml_coll_t x_positions_i(x_det, _Unicode(positions)); x_positions_i; ++x_positions_i) { xml_comp_t x_positions = x_positions_i; for (xml_coll_t x_position_i(x_positions, _U(position)); x_position_i; ++x_position_i) { xml_comp_t x_position = x_position_i; positions.push_back( - std::make_pair(x_positions.scale() * x_position.x() * mm, - x_positions.scale() * x_position.y() * mm)); + std::make_tuple(x_positions.scale() * x_position.x() * mm, + x_positions.scale() * x_position.y() * mm, + -x_positions.z0())); } } @@ -303,20 +304,21 @@ static Ref_t createDetector(Detector& description, xml::Handle_t e, SensitiveDet for (auto& p: positions) { // get positions in one quadrant - double x = p.first; - double y = p.second; - double z = -zpos; + double x = std::get<0>(p); + double y = std::get<1>(p); + double z0 = std::get<2>(p); // and place in all quadrants (intentional shadowing) - for (auto& p: decltype(positions){{x,y}, {y,-x}, {-x,-y}, {-y,x}}) { + for (auto& p: decltype(positions){{x,y,z0}, {y,-x,z0}, {-x,-y,z0}, {-y,x,z0}}) { // get positions (intentional shadowing) - double x = p.first; - double y = p.second; + double x = std::get<0>(p); + double y = std::get<1>(p); + double z0 = std::get<2>(p); // get angles - double rotAngX = atan(y/z); - double rotAngY = -1.*atan(x/z); + double rotAngX = atan(y/z0); + double rotAngY = -1.*atan(x/z0); /* ROOT::Math::XYZVector x_location(p.x(), p.y(), zmin+std::signbit(zmin)*mod_length/2.0); diff --git a/src/SimpleDiskTracker_geo.cpp b/src/SimpleDiskDetector_geo.cpp similarity index 95% rename from src/SimpleDiskTracker_geo.cpp rename to src/SimpleDiskDetector_geo.cpp index 484276e33548da44b242246d878b412e44571d15..7381a06474c49e24b235f8ad5185291afbc093cd 100644 --- a/src/SimpleDiskTracker_geo.cpp +++ b/src/SimpleDiskDetector_geo.cpp @@ -22,7 +22,7 @@ using namespace std; using namespace dd4hep; using namespace dd4hep::detail; -static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) +static Ref_t SimpleDiskDetector_create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; Material air = description.air(); @@ -126,6 +126,5 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s return sdet; } -DECLARE_DETELEMENT(athena_SimpleDiskTracker, create_detector) -DECLARE_DETELEMENT(ref_DiskTracker, create_detector) -DECLARE_DETELEMENT(ref_SolenoidEndcap, create_detector) +DECLARE_DETELEMENT(ref_SolenoidEndcap, SimpleDiskDetector_create_detector) +DECLARE_DETELEMENT(athena_SolenoidEndcap, SimpleDiskDetector_create_detector) diff --git a/src/SimpleRectangularTracker_geo.cpp b/src/SimpleRectangularTracker_geo.cpp deleted file mode 100644 index 1b8ae7436203c77c221a2ff8d44600109a890084..0000000000000000000000000000000000000000 --- a/src/SimpleRectangularTracker_geo.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//========================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see $DD4hepINSTALL/LICENSE. -// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -// -// Author : M.Frank -// Modified : W.Armstrong -// -//========================================================================== -// -// Specialized generic detector constructor -// -//========================================================================== -#include "DD4hep/DetFactoryHelper.h" - -using namespace std; -using namespace dd4hep; -using namespace dd4hep::detail; - -static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { - xml_det_t x_det = e; - Material air = description.air(); - string det_name = x_det.nameStr(); - bool reflect = x_det.reflect(); - DetElement sdet(det_name,x_det.id()); - Assembly assembly(det_name); - PlacedVolume pv; - int l_num = 0; - xml::Component pos = x_det.position(); - - for(xml_coll_t i(x_det,_U(layer)); i; ++i, ++l_num) { - xml_comp_t x_layer = i; - string l_nam = det_name + _toString(l_num, "_layer%d"); - double x_lay = x_layer.x(); - double y_lay = x_layer.y(); - double z = 0; - double zmin = 0; - double layerWidth = 0.; - int s_num = 0; - for(xml_coll_t j(x_layer,_U(slice)); j; ++j) { - double thickness = xml_comp_t(j).thickness(); - layerWidth += thickness; - } - Box l_box(x_lay/2.0, y_lay/2.0, layerWidth/2.0 ); - Volume l_vol(l_nam, l_box, air); - l_vol.setVisAttributes(description, x_layer.visStr()); - for (xml_coll_t j(x_layer, _U(slice)); j; ++j, ++s_num) { - xml_comp_t x_slice = j; - double thick = x_slice.thickness(); - Material mat = description.material(x_slice.materialStr()); - string s_nam = l_nam + _toString(s_num, "_slice%d"); - Volume s_vol(s_nam, Box(x_lay/2.0, y_lay/2.0, thick/2.0), mat); - if (x_slice.isSensitive()) { - sens.setType("tracker"); - s_vol.setSensitiveDetector(sens); - } - s_vol.setAttributes(description, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); - pv = l_vol.placeVolume(s_vol, Position(0, 0, z - zmin - layerWidth / 2 + thick / 2)); - pv.addPhysVolID("slice", s_num); - } - - DetElement layer(sdet,l_nam+"_pos",l_num); - pv = assembly.placeVolume(l_vol,Position(0,0,zmin+layerWidth/2.)); - pv.addPhysVolID("layer",l_num); - pv.addPhysVolID("barrel",1); - layer.setPlacement(pv); - if ( reflect ) { - pv = assembly.placeVolume(l_vol,Transform3D(RotationY(M_PI),Position(0,0,-zmin-layerWidth/2))); - pv.addPhysVolID("layer",l_num); - pv.addPhysVolID("barrel",2); - DetElement layerR = layer.clone(l_nam+"_neg"); - sdet.add(layerR.setPlacement(pv)); - } - } - if ( x_det.hasAttr(_U(combineHits)) ) { - sdet.setCombineHits(x_det.attr<bool>(_U(combineHits)),sens); - } - pv = description.pickMotherVolume(sdet).placeVolume(assembly,Position(pos.x(),pos.y(),pos.z())); - pv.addPhysVolID("system", x_det.id()); // Set the subdetector system ID. - sdet.setPlacement(pv); - return sdet; -} - -DECLARE_DETELEMENT(ref_RectangularTracker,create_detector) diff --git a/src/TrapEndcapTracker_geo.cpp b/src/TrapEndcapTracker_geo.cpp index b20e6d161b7209bfe8313e949bfde636e2740be5..f12bf94b2223b30d9ced14ea6caf6698aa4504fa 100644 --- a/src/TrapEndcapTracker_geo.cpp +++ b/src/TrapEndcapTracker_geo.cpp @@ -224,11 +224,11 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s if (reflect) { layer_pv = assembly.placeVolume(layer_vol, Transform3D(RotationZYX(0.0, -M_PI, 0.0), Position(0, 0, -layer_center_z))); - layer_pv.addPhysVolID("barrel", 3).addPhysVolID("layer", l_id); + layer_pv.addPhysVolID("layer", l_id); layer_name += "_N"; } else { layer_pv = assembly.placeVolume(layer_vol, Position(0, 0, layer_center_z)); - layer_pv.addPhysVolID("barrel", 2).addPhysVolID("layer", l_id); + layer_pv.addPhysVolID("layer", l_id); layer_name += "_P"; } DetElement layer_element(sdet, layer_name, l_id); @@ -262,7 +262,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s DetElement module(layer_element, m_base + "_pos", det_id); pv = layer_vol.placeVolume( m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2), Position(x, y, zstart + dz))); - pv.addPhysVolID("barrel", 1).addPhysVolID("layer", l_id).addPhysVolID("module", mod_num); + pv.addPhysVolID("module", mod_num); module.setPlacement(pv); for (size_t ic = 0; ic < sensVols.size(); ++ic) { PlacedVolume sens_pv = sensVols[ic]; @@ -276,7 +276,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } else { pv = layer_vol.placeVolume( m_vol, Transform3D(RotationZYX(0, -M_PI / 2 - phi, -M_PI / 2), Position(x, y, -zstart - dz))); - pv.addPhysVolID("barrel", 2).addPhysVolID("layer", l_id).addPhysVolID("module", mod_num); + pv.addPhysVolID("module", mod_num); DetElement r_module(layer_element, m_base + "_neg", det_id); r_module.setPlacement(pv); for (size_t ic = 0; ic < sensVols.size(); ++ic) {