From f3967a2e8dbc3b0f9ca8a04b43b285c8963aa35e Mon Sep 17 00:00:00 2001 From: Kim Date: Thu, 26 Mar 2020 17:36:12 -0500 Subject: [PATCH 1/6] added endcap detector --- .../Electron_Endcap_EMcal_PbWO4_example.xml | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml diff --git a/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml b/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml new file mode 100644 index 0000000..66b72ec --- /dev/null +++ b/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml @@ -0,0 +1,184 @@ + + + + + Electron Endcap EMCAL detector + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Common Generic visualization attributes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Electromagnetic Calorimeter Endcaps + + + + + + + + + + + + Electromagnetic Calorimeter Barrel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + system:8,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16 + + + + + system:6,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16 + + + + + + + + + + + + + -- GitLab From 8bd49bf2136b4ab6d5aa2c92812422f0a43ead68 Mon Sep 17 00:00:00 2001 From: "jihee.kim" Date: Thu, 26 Mar 2020 18:05:55 -0500 Subject: [PATCH 2/6] corrected nlayer --- .../compact/Electron_Endcap_EMcal_PbWO4_example.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml b/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml index 66b72ec..1ce7b80 100644 --- a/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml +++ b/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml @@ -117,7 +117,7 @@ Electromagnetic Calorimeter Endcaps - + -- GitLab From dc0c9ece41336b87310746adff738950dd28901b Mon Sep 17 00:00:00 2001 From: "jihee.kim" Date: Fri, 27 Mar 2020 15:50:49 -0500 Subject: [PATCH 3/6] Added EndcapECAL detector type and Created EndcapECAL_geo.cpp --- .../Electron_Endcap_EMcal_PbWO4_example.xml | 2 +- .../calorimeters/src/EndcapECAL_geo.cpp | 134 ++++++++++++++++++ 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 src/GenericDetectors/calorimeters/src/EndcapECAL_geo.cpp diff --git a/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml b/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml index 1ce7b80..ebacc28 100644 --- a/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml +++ b/src/GenericDetectors/calorimeters/compact/Electron_Endcap_EMcal_PbWO4_example.xml @@ -112,7 +112,7 @@ - + Electromagnetic Calorimeter Endcaps diff --git a/src/GenericDetectors/calorimeters/src/EndcapECAL_geo.cpp b/src/GenericDetectors/calorimeters/src/EndcapECAL_geo.cpp new file mode 100644 index 0000000..8de145e --- /dev/null +++ b/src/GenericDetectors/calorimeters/src/EndcapECAL_geo.cpp @@ -0,0 +1,134 @@ +//========================================================================== +// 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 +// +//========================================================================== +// +// Specialized generic detector constructor +// +//========================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "XML/Layering.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; + xml_dim_t dim = x_det.dimensions(); + int det_id = x_det.id(); + bool reflect = x_det.reflect(true); + string det_name = x_det.nameStr(); + Material air = description.air(); + int numsides = dim.numsides(); + double rmin = dim.rmin(); + double rmax = dim.rmax()*std::cos(M_PI/numsides); + double zmin = dim.zmin(); + Layering layering(x_det); + double totalThickness = layering.totalThickness(); + Volume endcapVol("endcap",PolyhedraRegular(numsides,rmin,rmax,totalThickness),air); + DetElement endcap("endcap",det_id); + + int l_num = 1; + int layerType = 0; + double layerZ = -totalThickness/2; + + endcapVol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + + for(xml_coll_t xc(x_det,_U(layer)); xc; ++xc) { + xml_comp_t x_layer = xc; + double l_thick = layering.layer(l_num-1)->thickness(); + string l_name = _toString(layerType,"layer%d"); + int l_repeat = x_layer.repeat(); + Volume l_vol(l_name,PolyhedraRegular(numsides,rmin,rmax,l_thick),air); + vector sensitives; + + int s_num = 1; + double sliceZ = -l_thick/2; + for(xml_coll_t xs(x_layer,_U(slice)); xs; ++xs) { + xml_comp_t x_slice = xs; + string s_name = _toString(s_num,"slice%d"); + double s_thick = x_slice.thickness(); + Material s_mat = description.material(x_slice.materialStr()); + Volume s_vol(s_name,PolyhedraRegular(numsides,rmin,rmax,s_thick),s_mat); + + s_vol.setVisAttributes(description.visAttributes(x_slice.visStr())); + sliceZ += s_thick/2; + PlacedVolume s_phv = l_vol.placeVolume(s_vol,Position(0,0,sliceZ)); + s_phv.addPhysVolID("slice",s_num); + if ( x_slice.isSensitive() ) { + sens.setType("calorimeter"); + s_vol.setSensitiveDetector(sens); + sensitives.push_back(s_phv); + } + sliceZ += s_thick/2; + s_num++; + } + l_vol.setVisAttributes(description.visAttributes(x_layer.visStr())); + if ( l_repeat <= 0 ) throw std::runtime_error(x_det.nameStr()+"> Invalid repeat value"); + for(int j=0; jSetName((det_name+"_A").c_str()); + DetElement sdetB = endcap.clone(det_name+"_B",x_det.id()); + + pv = assembly.placeVolume(endcapVol,Transform3D(RotationZYX(M_PI/numsides,0,0), + Position(0,0,z_pos))); + pv.addPhysVolID("barrel", 1); + sdetA.setPlacement(pv); + + pv = assembly.placeVolume(endcapVol,Transform3D(RotationZYX(M_PI/numsides,M_PI,0), + Position(0,0,-z_pos))); + pv.addPhysVolID("barrel", 2); + sdetB.setPlacement(pv); + + pv = motherVol.placeVolume(assembly); + pv.addPhysVolID("system", det_id); + both_endcaps.setPlacement(pv); + both_endcaps.add(sdetA); + both_endcaps.add(sdetB); + return both_endcaps; + } + Volume motherVol = description.pickMotherVolume(endcap); + pv = motherVol.placeVolume(endcapVol,Transform3D(RotationZYX(M_PI/numsides,0,0), + Position(0,0,z_pos))); + pv.addPhysVolID("system", det_id); + pv.addPhysVolID("barrel", 1); + endcap.setPlacement(pv); + Ref_t(endcap)->SetName(det_name.c_str()); + return endcap; +} + +DECLARE_DETELEMENT(EndcapECAL,create_detector) +//DECLARE_DEPRECATED_DETELEMENT(EndcapECAL,create_detector) -- GitLab From ce8e86d0f3b2250acffc15b6b2b0799e2ad59e72 Mon Sep 17 00:00:00 2001 From: Whitney Armstrong Date: Fri, 27 Mar 2020 21:28:52 -0500 Subject: [PATCH 4/6] Added crystal calorimeter starting example Note that I added a new material as well. --- src/GenericDetectors/CMakeLists.txt | 1 + .../compact/CrystalEndcapECAL_example.xml | 148 ++++++++++++++++++ .../calorimeters/compact/materials.xml | 7 + .../src/CrystalEndcapECAL_geo.cpp | 51 ++++++ 4 files changed, 207 insertions(+) create mode 100644 src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml create mode 100644 src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp diff --git a/src/GenericDetectors/CMakeLists.txt b/src/GenericDetectors/CMakeLists.txt index 3449809..f601338 100644 --- a/src/GenericDetectors/CMakeLists.txt +++ b/src/GenericDetectors/CMakeLists.txt @@ -32,6 +32,7 @@ dd4hep_add_plugin(GenDetectors calorimeters/src/EcalBarrel_geo.cpp calorimeters/src/PolyhedraEndcapCalorimeter3_geo.cpp calorimeters/src/EndcapECAL_geo.cpp + calorimeters/src/CrystalEndcapECAL_geo.cpp beamline/src/Beampipe_geo.cpp pid/src/GenericRICH_geo.cpp USES ActsCore ActsDD4hepPlugin diff --git a/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml b/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml new file mode 100644 index 0000000..46e8006 --- /dev/null +++ b/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml @@ -0,0 +1,148 @@ + + + + + Electron Endcap EMCAL detector + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Common Generic visualization attributes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Electromagnetic Calorimeter Endcaps + + + + + + + + system:8,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16 + + + + + system:6,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16 + + + + + + + + + + + + + diff --git a/src/GenericDetectors/calorimeters/compact/materials.xml b/src/GenericDetectors/calorimeters/compact/materials.xml index 5f74558..aa759ab 100644 --- a/src/GenericDetectors/calorimeters/compact/materials.xml +++ b/src/GenericDetectors/calorimeters/compact/materials.xml @@ -169,4 +169,11 @@ + + + + + + + diff --git a/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp b/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp new file mode 100644 index 0000000..b71d8d5 --- /dev/null +++ b/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp @@ -0,0 +1,51 @@ +//========================================================================== +// Crystal Endcap EM Calorimeter Detector implementation +//-------------------------------------------------------------------------- +// +// Authors : W.Armstrong +// +//========================================================================== +// +// +//========================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "XML/Layering.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; + xml_dim_t dim = x_det.dimensions(); + int det_id = x_det.id(); + string det_name = x_det.nameStr(); + Material PbWO4 = description.material("PbWO4"); + double rmin = dim.rmin(); + double rmax = dim.rmax(); + double zmin = dim.zmin(); + double zmax = dim.zmax(); + double thickness = zmax - zmin; + double z_pos = zmin + thickness / 2.0; + + Assembly assembly(det_name); + DetElement endcap_DE(det_name,det_id); + + // Here we just create a tube to represent the calorimeter + // In the future this should be broken into individual blocks + // of cristals forming a grid. + Tube dummy_calorimeter_tube(rmin, rmax, thickness / 2.0); + Volume dummy_calorimeter_Vol(det_name + "_dummy", dummy_calorimeter_tube, PbWO4); + auto dummy_PV = assembly.placeVolume(dummy_calorimeter_Vol, Position(0.0, 0.0, 0.0)); + dummy_PV.addPhysVolID("layer", 0); + sens.setType("calorimeter"); + dummy_calorimeter_Vol.setSensitiveDetector(sens); + + Volume motherVol = description.pickMotherVolume(endcap_DE); + auto pv = motherVol.placeVolume(assembly, Position(0.0, 0.0, z_pos)); + pv.addPhysVolID("system", det_id); + endcap_DE.setPlacement(pv); + return endcap_DE; +} + +DECLARE_DETELEMENT(CrystalEndcapECAL,create_detector) -- GitLab From 399a37f34e721556cffd5a898e5e8e15e185edee Mon Sep 17 00:00:00 2001 From: "jihee.kim" Date: Wed, 1 Apr 2020 18:54:37 +0000 Subject: [PATCH 5/6] Added box-shaped crystals assembly --- .../compact/CrystalEndcapECAL_example.xml | 16 +- .../src/CrystalEndcapECAL_geo.cpp | 185 +++++++++++++++++- 2 files changed, 180 insertions(+), 21 deletions(-) diff --git a/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml b/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml index 46e8006..acf7104 100644 --- a/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml +++ b/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml @@ -7,7 +7,7 @@ author="Jihee Kim" url="https://eicweb.phy.anl.gov/EIC/NPDet" status="development" - version="v1.0 2020-03-26"> + version="v1.1 2020-03-31"> Electron Endcap EMCAL detector @@ -112,24 +112,18 @@ - - + + Electromagnetic Calorimeter Endcaps - + system:8,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16 - - - - - system:6,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16 - + diff --git a/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp b/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp index b71d8d5..6115fb6 100644 --- a/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp +++ b/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp @@ -5,11 +5,12 @@ // Authors : W.Armstrong // //========================================================================== -// -// +// J.KIM 2020-04-01 +// Added box assembly of volumes //========================================================================== #include "DD4hep/DetFactoryHelper.h" #include "XML/Layering.h" +#include using namespace std; using namespace dd4hep; @@ -31,15 +32,179 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s Assembly assembly(det_name); DetElement endcap_DE(det_name,det_id); - // Here we just create a tube to represent the calorimeter - // In the future this should be broken into individual blocks - // of cristals forming a grid. - Tube dummy_calorimeter_tube(rmin, rmax, thickness / 2.0); - Volume dummy_calorimeter_Vol(det_name + "_dummy", dummy_calorimeter_tube, PbWO4); - auto dummy_PV = assembly.placeVolume(dummy_calorimeter_Vol, Position(0.0, 0.0, 0.0)); - dummy_PV.addPhysVolID("layer", 0); + // Create a tube to represent the calorimeter + Tube tube(rmin, rmax, thickness / 2.0); + Volume Vol("tube_volume", tube, PbWO4); + auto PV = assembly.placeVolume(Vol, Position(0.0, 0.0, 0.0)); + PV.addPhysVolID("layer", 0); sens.setType("calorimeter"); - dummy_calorimeter_Vol.setSensitiveDetector(sens); + Vol.setSensitiveDetector(sens); + + // Tube is filled with box-shaped crystals forming a grid. + Assembly box_assembly("box_assembly"); + PlacedVolume pv_box; + + // Box-shaped crystal dimension + double box_x_width = 2*cm; + double box_y_width = 2*cm; + double box_z_length = 60.5*cm; + // Gap between box-shaped crystals + double offset_x = 1*mm; + double offset_y = 1*mm; + // Number of crystals in a grid + int nx = floor(rmax/box_x_width); + int ny = floor(rmax/box_y_width); + // X or Y spacing increasement + double x_spacing = box_x_width + offset_x; + double y_spacing = box_y_width + offset_y; + // initial positions in X or Y. + double pos_x = 0*cm; + double pos_y = 0*cm; + + // Create Box and Volume + Box box(box_x_width/2.0, box_y_width/2.0, box_z_length/2.0); + Volume vol("box_volume", box, PbWO4); + + //////////////////////////////////////////////////////////////////////////////////// + // Divide tube into 4 sections; top left, top right, bottom left, and bottom right + //////////////////////////////////////////////////////////////////////////////////// + // Top left + //////////////////////////////////////////////////////////////////////////////////// + for(int iy=0; iy rmin) + pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); + else + continue; + } + else + { + // Move to +X + pos_x += x_spacing; + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin) + pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); + else + continue; + } + pv_box.addPhysVolID("layer",0); + sens.setType("calorimeter"); + vol.setSensitiveDetector(sens); + } + // Move to +Y + pos_y += y_spacing; + } + + //////////////////////////////////////////////////////////////////////////////////// + // Top right + //////////////////////////////////////////////////////////////////////////////////// + // Initialize position in Y + pos_y = 0.0; + for(int iy=0; iy rmin) + pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); + else + continue; + } + else + { + // Move to -X + pos_x -= x_spacing; + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin) + pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); + else + continue; + } + pv_box.addPhysVolID("layer",0); + sens.setType("calorimeter"); + vol.setSensitiveDetector(sens); + } + // Move to +Y + pos_y += y_spacing; + } + + //////////////////////////////////////////////////////////////////////////////////// + // Bottom left + //////////////////////////////////////////////////////////////////////////////////// + // It's below the first row of the section of Top left + // That's why ny goes up to ny -2 (the first row of Bottom left starts one row less) + pos_y = -y_spacing; + for(int iy=0; iy rmin) + pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); + else + continue; + } + else + { + // Move to +X + pos_x += x_spacing; + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin) + pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); + else + continue; + } + pv_box.addPhysVolID("layer",0); + sens.setType("calorimeter"); + vol.setSensitiveDetector(sens); + } + // Move to -Y + pos_y -= y_spacing; + } + + //////////////////////////////////////////////////////////////////////////////////// + // Bottom right + //////////////////////////////////////////////////////////////////////////////////// + // Again it's below the first row of the section of Top left + // That's why ny goes up to ny -2 (the first row of Bottom left starts one row less) + pos_y = -y_spacing; + for(int iy=0; iy rmin) + pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); + else + continue; + } + else + { + // Move to -X + pos_x -= x_spacing; + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin) + pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); + else + continue; + } + pv_box.addPhysVolID("layer",0); + sens.setType("calorimeter"); + vol.setSensitiveDetector(sens); + } + // Move to -Y + pos_y -= y_spacing; + } + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// Volume motherVol = description.pickMotherVolume(endcap_DE); auto pv = motherVol.placeVolume(assembly, Position(0.0, 0.0, z_pos)); -- GitLab From 34d86f76480293ccf5ae9032c3544097ba6d8959 Mon Sep 17 00:00:00 2001 From: Whitney Armstrong Date: Thu, 2 Apr 2020 11:52:42 -0500 Subject: [PATCH 6/6] Fixed the CellID numbering. Created hierarchy: system, sector, module --- .../compact/CrystalEndcapECAL_example.xml | 6 +- .../src/CrystalEndcapECAL_geo.cpp | 75 +++++++++++++------ 2 files changed, 56 insertions(+), 25 deletions(-) diff --git a/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml b/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml index acf7104..a3ebc44 100644 --- a/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml +++ b/src/GenericDetectors/calorimeters/compact/CrystalEndcapECAL_example.xml @@ -26,6 +26,8 @@ + + @@ -121,8 +123,8 @@ - - system:8,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16 + + system:8,sector:4,module:20,layer:6,x:48:-8,y:-8 diff --git a/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp b/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp index 6115fb6..8f05d57 100644 --- a/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp +++ b/src/GenericDetectors/calorimeters/src/CrystalEndcapECAL_geo.cpp @@ -35,10 +35,10 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s // Create a tube to represent the calorimeter Tube tube(rmin, rmax, thickness / 2.0); Volume Vol("tube_volume", tube, PbWO4); - auto PV = assembly.placeVolume(Vol, Position(0.0, 0.0, 0.0)); - PV.addPhysVolID("layer", 0); - sens.setType("calorimeter"); - Vol.setSensitiveDetector(sens); + //auto PV = assembly.placeVolume(Vol, Position(0.0, 0.0, 0.0)); + //PV.addPhysVolID("layer", 0); + //sens.setType("calorimeter"); + //Vol.setSensitiveDetector(sens); // Tube is filled with box-shaped crystals forming a grid. Assembly box_assembly("box_assembly"); @@ -70,6 +70,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s //////////////////////////////////////////////////////////////////////////////////// // Top left //////////////////////////////////////////////////////////////////////////////////// + int i_module = 0; for(int iy=0; iy rmin) + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){ pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); - else + i_module++; + } + else{ continue; + } } else { // Move to +X pos_x += x_spacing; if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin) + { pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); - else + i_module++; + } + else{ continue; + } } - pv_box.addPhysVolID("layer",0); + pv_box.addPhysVolID("sector",1).addPhysVolID("module",i_module); sens.setType("calorimeter"); vol.setSensitiveDetector(sens); } @@ -104,6 +112,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s //////////////////////////////////////////////////////////////////////////////////// // Initialize position in Y pos_y = 0.0; + i_module=0; for(int iy=0; iy rmin) + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){ pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); - else + i_module++; + } + else{ continue; + } } else { // Move to -X pos_x -= x_spacing; - if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin) + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){ pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); - else + i_module++; + } + else{ continue; + } } - pv_box.addPhysVolID("layer",0); + pv_box.addPhysVolID("sector",2).addPhysVolID("module",i_module); sens.setType("calorimeter"); vol.setSensitiveDetector(sens); } @@ -139,6 +154,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s // It's below the first row of the section of Top left // That's why ny goes up to ny -2 (the first row of Bottom left starts one row less) pos_y = -y_spacing; + i_module=0; for(int iy=0; iy rmin) + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){ pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); - else + i_module++; + } + else{ continue; + } } else { // Move to +X pos_x += x_spacing; - if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin) + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){ pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); - else + i_module++; + } + else{ continue; + } } - pv_box.addPhysVolID("layer",0); + pv_box.addPhysVolID("sector",3).addPhysVolID("module",i_module); sens.setType("calorimeter"); vol.setSensitiveDetector(sens); } @@ -174,6 +196,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s // Again it's below the first row of the section of Top left // That's why ny goes up to ny -2 (the first row of Bottom left starts one row less) pos_y = -y_spacing; + i_module=0; for(int iy=0; iy rmin) + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){ pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); - else + i_module++; + } + else{ continue; + } } else { // Move to -X pos_x -= x_spacing; - if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin) + if(sqrt((pos_x*pos_x) + (pos_y*pos_y)) < rmax && sqrt((pos_x*pos_x) + (pos_y*pos_y)) > rmin){ pv_box = assembly.placeVolume(vol, Position(pos_x,pos_y,0.0)); - else + i_module++; + } + else{ continue; + } } - pv_box.addPhysVolID("layer",0); + pv_box.addPhysVolID("sector",4).addPhysVolID("module",i_module); sens.setType("calorimeter"); vol.setSensitiveDetector(sens); } -- GitLab