From 38960532715c2f45abc7f62b5f8c4cd17b1a817c Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Tue, 16 Apr 2024 17:49:56 +0200 Subject: [PATCH 01/13] Constrain EL_GAP generator to the PMT case - Fix center in x,y to 0,0 - Fix diameter to el_gap diameter - Rename el_gap_gen_disk_z{min,max} to el_gap_slice_{min,max} --- source/geometries/Next100FieldCage.cc | 105 ++++++++++---------------- source/geometries/Next100FieldCage.h | 7 +- 2 files changed, 42 insertions(+), 70 deletions(-) diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index 1dad5e3bb..2aab21c2e 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -109,9 +109,7 @@ Next100FieldCage::Next100FieldCage(G4double grid_thickn): verbosity_(0), use_dielectric_grid_(0), // EL gap generation disk parameters - el_gap_gen_disk_diam_(0.), - el_gap_gen_disk_x_(0.), el_gap_gen_disk_y_(0.), - el_gap_gen_disk_zmin_(0.), el_gap_gen_disk_zmax_(1.), + el_gap_slice_min_(0.), el_gap_slice_max_(1.), photoe_prob_(0) { /// Define new categories @@ -170,36 +168,19 @@ Next100FieldCage::Next100FieldCage(G4double grid_thickn): step_cmd.SetParameterName("max_step_size", true); step_cmd.SetRange("max_step_size>0."); - G4GenericMessenger::Command& el_gap_gen_disk_diam_cmd = - msg_->DeclareProperty("el_gap_gen_disk_diam", el_gap_gen_disk_diam_, - "Diameter of the EL gap vertex generation disk."); - el_gap_gen_disk_diam_cmd.SetUnitCategory("Length"); - el_gap_gen_disk_diam_cmd.SetParameterName("el_gap_gen_disk_diam", false); - el_gap_gen_disk_diam_cmd.SetRange("el_gap_gen_disk_diam>=0."); - - G4GenericMessenger::Command& el_gap_gen_disk_x_cmd = - msg_->DeclareProperty("el_gap_gen_disk_x", el_gap_gen_disk_x_, - "X position of the center of the EL gap vertex generation disk."); - el_gap_gen_disk_x_cmd.SetUnitCategory("Length"); - el_gap_gen_disk_x_cmd.SetParameterName("el_gap_gen_disk_x", false); - - G4GenericMessenger::Command& el_gap_gen_disk_y_cmd = - msg_->DeclareProperty("el_gap_gen_disk_y", el_gap_gen_disk_y_, - "Y position of the center of the EL gap vertex generation disk."); - el_gap_gen_disk_y_cmd.SetUnitCategory("Length"); - el_gap_gen_disk_y_cmd.SetParameterName("el_gap_gen_disk_y", false); - - G4GenericMessenger::Command& el_gap_gen_disk_zmin_cmd = - msg_->DeclareProperty("el_gap_gen_disk_zmin", el_gap_gen_disk_zmin_, - "Minimum Z range of the EL gap vertex generation disk."); - el_gap_gen_disk_zmin_cmd.SetParameterName("el_gap_gen_disk_zmin", false); - el_gap_gen_disk_zmin_cmd.SetRange("el_gap_gen_disk_zmin>=0.0 && el_gap_gen_disk_zmin<=1.0"); - - G4GenericMessenger::Command& el_gap_gen_disk_zmax_cmd = - msg_->DeclareProperty("el_gap_gen_disk_zmax", el_gap_gen_disk_zmax_, - "Maximum Z range of the EL gap vertex generation disk."); - el_gap_gen_disk_zmax_cmd.SetParameterName("el_gap_gen_disk_zmax", false); - el_gap_gen_disk_zmax_cmd.SetRange("el_gap_gen_disk_zmax>=0.0 && el_gap_gen_disk_zmax<=1.0"); + G4GenericMessenger::Command& el_gap_slice_min_cmd = + msg_->DeclareProperty("el_gap_slice_min", el_gap_slice_min_, + "Lower limit (fraction) to the EL gap slice in which vertices are generated."); + el_gap_slice_min_cmd.SetParameterName("el_gap_slice_min", false); + el_gap_slice_min_cmd.SetRange("el_gap_slice_min >= 0.0 &&" + "el_gap_slice_min <= 1.0"); + + G4GenericMessenger::Command& el_gap_slice_max_cmd = + msg_->DeclareProperty("el_gap_slice_max", el_gap_slice_max_, + "Uppeer limit (fraction) to the EL gap slice in which vertices are generated."); + el_gap_slice_max_cmd.SetParameterName("el_gap_slice_max", false); + el_gap_slice_max_cmd.SetRange("el_gap_slice_max >= 0.0 &&" + "el_gap_slice_max <= 1.0"); msg_->DeclareProperty("photoe_prob", photoe_prob_, "Probability of photon to ie- conversion"); @@ -420,7 +401,7 @@ void Next100FieldCage::BuildCathode() // Use SS hexagonal mesh else { - // Cathode Ring + // Cathode Ring // Shift in the +z direction by half-mesh thickness and reduce thickness // by the grid thickness. The grid thickness makes up the remaining ring thickness cathode_solid = @@ -433,13 +414,13 @@ void Next100FieldCage::BuildCathode() new G4PVPlacement(0, G4ThreeVector(GetCoordOrigin().x(), GetCoordOrigin().y(), cathode_zpos_ + grid_thickn_/2.0), cathode_logic, "CATHODE_RING", mother_logic_, false, 0, false); - + // Dist from centre of hex to hex vertex, excluding the land width (circumradius) - G4double hex_circumradius = cathode_mesh_diam_/std::sqrt(3); + G4double hex_circumradius = cathode_mesh_diam_/std::sqrt(3); // Total number of hexagons that would fit side-by-side along the diameter G4int n_hex = (G4int) ((cathode_int_diam_/2.0) / hex_circumradius); - + // Define the disk to punch hexagon holes through for the mesh G4Tubs* grid_solid = new G4Tubs("CATHODE_GRID", 0., cathode_ext_diam_/2.0 , grid_thickn_/2., 0., twopi); cathode_grid_logic = new G4LogicalVolume(grid_solid, steel_, "CATHODE_MESH_LOGIC"); @@ -675,15 +656,15 @@ void Next100FieldCage::BuildELRegion() el_gap_solid = new G4Tubs("EL_GAP", 0., gate_ext_diam_/2., (el_gap_length_ + 2*grid_thickn_)/2., 0, twopi); - + // Meshes // Dist from centre of hex to hex vertex, excluding the land width (circumradius) - G4double hex_circumradius = el_mesh_diam_/std::sqrt(3)*mm; + G4double hex_circumradius = el_mesh_diam_/std::sqrt(3)*mm; // Total number of hexagons that would fit side-by-side along the diameter G4int n_hex = (G4int) ((gate_int_diam_/2.0) / hex_circumradius); - + // Define the disk to punch hexagon holes through for the mesh G4Tubs* grid_solid = new G4Tubs("EL_GRID", 0., gate_ext_diam_/2.0 , grid_thickn_/2., 0., twopi); el_grid_logic = new G4LogicalVolume(grid_solid, steel_, "EL_GRID"); @@ -691,7 +672,7 @@ void Next100FieldCage::BuildELRegion() // Define a hexagonal prism G4ExtrudedSolid* hex_prism = CreateHexagon(grid_thickn_/2.0, hex_circumradius); el_hex_logic = new G4LogicalVolume(hex_prism, gas_, "MESH_HEX_GAS"); - + // Place GXe hexagons in the disk to make the mesh PlaceHexagons(n_hex, el_mesh_diam_, grid_thickn_, el_grid_logic, el_hex_logic, gate_int_diam_); @@ -714,7 +695,7 @@ void Next100FieldCage::BuildELRegion() new G4PVPlacement(0, G4ThreeVector(0., 0., el_gap_zpos_), el_gap_logic, "EL_GAP", mother_logic_, false, 0, false); - + // Create a rotation vector to change the orientation of the EL mesh CLHEP::HepRotationZ Roty(el_mesh_rot_); G4RotationMatrix* pRot = new G4RotationMatrix(); @@ -722,11 +703,11 @@ void Next100FieldCage::BuildELRegion() new G4PVPlacement(0, G4ThreeVector(0., 0., el_gap_length_/2. + grid_thickn_/2.), el_grid_logic, "EL_GRID_GATE", el_gap_logic, false, 0, false); - + new G4PVPlacement(pRot, G4ThreeVector(0., 0., -el_gap_length_/2. - grid_thickn_/2.), el_grid_logic, "EL_GRID_ANODE", el_gap_logic, false, 1, false); - + /// Define EL electric field if (elfield_) { @@ -744,24 +725,23 @@ void Next100FieldCage::BuildELRegion() } // Vertex generator - if (el_gap_gen_disk_zmin_ > el_gap_gen_disk_zmax_) + if (el_gap_slice_min_ > el_gap_slice_max_) G4Exception("[Next100FieldCage]", "Next100FieldCage()", - FatalErrorInArgument, "Error in configuration of EL gap generator: zmax < zmin"); - - G4double el_gap_gen_disk_thickn = - el_gap_length_ * (el_gap_gen_disk_zmax_ - el_gap_gen_disk_zmin_); + FatalErrorInArgument, "Error in configuration of EL gap generator: slice_max < slice_min"); - G4double el_gap_gen_disk_z = el_gap_zpos_ + el_gap_length_/2.- - el_gap_length_ * el_gap_gen_disk_zmin_ - - el_gap_gen_disk_thickn/2.; + G4double el_gap_slice_thickness = + el_gap_length_ * (el_gap_slice_max_ - el_gap_slice_min_); - G4ThreeVector el_gap_gen_pos(el_gap_gen_disk_x_, el_gap_gen_disk_y_, el_gap_gen_disk_z); + G4double el_gap_slice_center = el_gap_zpos_ + el_gap_length_/2. // start of el gap + - el_gap_length_ * el_gap_slice_min_ // start of slice + - el_gap_slice_thickness/2.; // center of slice el_gap_gen_ = - new CylinderPointSampler(0., el_gap_gen_disk_diam_/2., - el_gap_gen_disk_thickn/2., 0., twopi, - nullptr, el_gap_gen_pos); - + new CylinderPointSampler(0., gate_int_diam_/2., + el_gap_slice_thickness/2., + 0., twopi, + nullptr, {0, 0, el_gap_slice_center}); + // Gate ring vertex generator gate_gen_ = new CylinderPointSampler(gate_int_diam_/2., gate_ext_diam_/2., @@ -784,7 +764,7 @@ void Next100FieldCage::BuildELRegion() if (!grid_visibility_ && !use_dielectric_grid_) el_hex_logic->SetVisAttributes(G4VisAttributes::GetInvisible()); - + G4VisAttributes grey = nexus::DarkGrey(); grey.SetForceSolid(true); gate_logic->SetVisAttributes(grey); @@ -1128,14 +1108,7 @@ G4ThreeVector Next100FieldCage::GenerateVertex(const G4String& region) const } else if (region == "EL_GAP") { - G4VPhysicalVolume *VertexVolume; - do { - vertex = el_gap_gen_->GenerateVertex(VOLUME); - G4ThreeVector glob_vtx(vertex); - glob_vtx = glob_vtx - GetCoordOrigin(); - VertexVolume = - geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false); - } while (VertexVolume->GetName() != region); + vertex = el_gap_gen_->GenerateVertex(VOLUME); } else if (region == "FIELD_RING") { diff --git a/source/geometries/Next100FieldCage.h b/source/geometries/Next100FieldCage.h index c552b13fa..105c632cb 100644 --- a/source/geometries/Next100FieldCage.h +++ b/source/geometries/Next100FieldCage.h @@ -86,10 +86,9 @@ namespace nexus { // Use fake mesh G4bool use_dielectric_grid_; - // Parameters related to look-up table generation - G4double el_gap_gen_disk_diam_; - G4double el_gap_gen_disk_x_, el_gap_gen_disk_y_; - G4double el_gap_gen_disk_zmin_, el_gap_gen_disk_zmax_; + // Fraction of EL gap in which to generate points. e.g (0, 0.5) + // would generate points in the first half of the EL gap + G4double el_gap_slice_min_, el_gap_slice_max_; G4double active_length_, buffer_length_; G4double teflon_drift_length_, teflon_drift_zpos_,teflon_buffer_zpos_; From 2468c07837c7344b4a43737eda3a258a15b26e06 Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Tue, 16 Apr 2024 22:43:46 +0200 Subject: [PATCH 02/13] Rename el_gap_gen_ to el_gap_pmt_gen_ --- source/geometries/Next100.cc | 2 +- source/geometries/Next100FieldCage.cc | 6 +++--- source/geometries/Next100FieldCage.h | 2 +- source/geometries/Next100InnerElements.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/geometries/Next100.cc b/source/geometries/Next100.cc index 545b7618d..f6b25104b 100644 --- a/source/geometries/Next100.cc +++ b/source/geometries/Next100.cc @@ -243,7 +243,7 @@ namespace nexus { (region == "XENON") || (region == "LIGHT_TUBE") || (region == "HDPE_TUBE") || - (region == "EL_GAP") || + (region == "EL_GAP_PMT") || (region == "EP_COPPER_PLATE") || (region == "SAPPHIRE_WINDOW") || (region == "OPTICAL_PAD") || diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index 2aab21c2e..3f619c836 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -736,7 +736,7 @@ void Next100FieldCage::BuildELRegion() - el_gap_length_ * el_gap_slice_min_ // start of slice - el_gap_slice_thickness/2.; // center of slice - el_gap_gen_ = + el_gap_pmt_gen_ = new CylinderPointSampler(0., gate_int_diam_/2., el_gap_slice_thickness/2., 0., twopi, @@ -1031,7 +1031,7 @@ Next100FieldCage::~Next100FieldCage() delete buffer_gen_; delete xenon_gen_; delete teflon_gen_; - delete el_gap_gen_; + delete el_gap_pmt_gen_; delete hdpe_gen_; delete ring_gen_; delete cathode_gen_; @@ -1108,7 +1108,7 @@ G4ThreeVector Next100FieldCage::GenerateVertex(const G4String& region) const } else if (region == "EL_GAP") { - vertex = el_gap_gen_->GenerateVertex(VOLUME); + vertex = el_gap_pmt_gen_->GenerateVertex(VOLUME); } else if (region == "FIELD_RING") { diff --git a/source/geometries/Next100FieldCage.h b/source/geometries/Next100FieldCage.h index 105c632cb..9b3a08041 100644 --- a/source/geometries/Next100FieldCage.h +++ b/source/geometries/Next100FieldCage.h @@ -102,7 +102,7 @@ namespace nexus { CylinderPointSampler* buffer_gen_; CylinderPointSampler* teflon_gen_; CylinderPointSampler* xenon_gen_; - CylinderPointSampler* el_gap_gen_; + CylinderPointSampler* el_gap_pmt_gen_; CylinderPointSampler* hdpe_gen_; CylinderPointSampler* ring_gen_; CylinderPointSampler* cathode_gen_; diff --git a/source/geometries/Next100InnerElements.cc b/source/geometries/Next100InnerElements.cc index b03657b56..2210d2ad0 100644 --- a/source/geometries/Next100InnerElements.cc +++ b/source/geometries/Next100InnerElements.cc @@ -104,7 +104,7 @@ namespace nexus { (region == "CATHODE_RING") || (region == "BUFFER") || (region == "XENON") || - (region == "EL_GAP") || + (region == "EL_GAP_PMT") || (region == "LIGHT_TUBE") || (region == "HDPE_TUBE") || (region == "FIELD_RING") || From d9bfb5aa8757ac41fcd594494461e18c8b7e05e4 Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Wed, 17 Apr 2024 11:39:21 +0200 Subject: [PATCH 03/13] Rename EL_GAP region to EL_GAP_PMT --- source/geometries/Next100FieldCage.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index 3f619c836..9a6992065 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -1107,7 +1107,7 @@ G4ThreeVector Next100FieldCage::GenerateVertex(const G4String& region) const vertex = hdpe_gen_->GenerateVertex(VOLUME); } - else if (region == "EL_GAP") { + else if (region == "EL_GAP_PMT") { vertex = el_gap_pmt_gen_->GenerateVertex(VOLUME); } From 3166601682932edd14e382636e8e6987db2d4eb0 Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Wed, 17 Apr 2024 11:40:22 +0200 Subject: [PATCH 04/13] Add generator for SiPM LT --- source/geometries/Next100.cc | 1 + source/geometries/Next100FieldCage.cc | 12 ++++++++++++ source/geometries/Next100FieldCage.h | 2 ++ source/geometries/Next100InnerElements.cc | 1 + 4 files changed, 16 insertions(+) diff --git a/source/geometries/Next100.cc b/source/geometries/Next100.cc index f6b25104b..abdcc41bf 100644 --- a/source/geometries/Next100.cc +++ b/source/geometries/Next100.cc @@ -244,6 +244,7 @@ namespace nexus { (region == "LIGHT_TUBE") || (region == "HDPE_TUBE") || (region == "EL_GAP_PMT") || + (region == "EL_GAP_SIPM") || (region == "EP_COPPER_PLATE") || (region == "SAPPHIRE_WINDOW") || (region == "OPTICAL_PAD") || diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index 9a6992065..9ddcade6c 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -15,6 +15,7 @@ #include "UniformElectricDriftField.h" #include "XenonProperties.h" #include "CylinderPointSampler.h" +#include "BoxPointSampler.h" #include "HexagonMeshTools.h" #include @@ -742,6 +743,12 @@ void Next100FieldCage::BuildELRegion() 0., twopi, nullptr, {0, 0, el_gap_slice_center}); + auto sipm_pitch_ = 123; + auto unit_cell_center = G4ThreeVector{0, 0, el_gap_slice_center}; + el_gap_sipm_gen_ = + new BoxPointSampler(sipm_pitch_/2, sipm_pitch_/2, el_gap_slice_thickness/2., + 0, unit_cell_center, nullptr); + // Gate ring vertex generator gate_gen_ = new CylinderPointSampler(gate_int_diam_/2., gate_ext_diam_/2., @@ -1032,6 +1039,7 @@ Next100FieldCage::~Next100FieldCage() delete xenon_gen_; delete teflon_gen_; delete el_gap_pmt_gen_; + delete el_gap_sipm_gen_; delete hdpe_gen_; delete ring_gen_; delete cathode_gen_; @@ -1111,6 +1119,10 @@ G4ThreeVector Next100FieldCage::GenerateVertex(const G4String& region) const vertex = el_gap_pmt_gen_->GenerateVertex(VOLUME); } + else if (region == "EL_GAP_SIPM") { + vertex = el_gap_sipm_gen_->GenerateVertex(INSIDE); + } + else if (region == "FIELD_RING") { G4VPhysicalVolume *VertexVolume; do { diff --git a/source/geometries/Next100FieldCage.h b/source/geometries/Next100FieldCage.h index 9b3a08041..4838d1c48 100644 --- a/source/geometries/Next100FieldCage.h +++ b/source/geometries/Next100FieldCage.h @@ -21,6 +21,7 @@ class G4Navigator; namespace nexus { class CylinderPointSampler; + class BoxPointSampler; class Next100FieldCage: public GeometryBase @@ -103,6 +104,7 @@ namespace nexus { CylinderPointSampler* teflon_gen_; CylinderPointSampler* xenon_gen_; CylinderPointSampler* el_gap_pmt_gen_; + BoxPointSampler* el_gap_sipm_gen_; CylinderPointSampler* hdpe_gen_; CylinderPointSampler* ring_gen_; CylinderPointSampler* cathode_gen_; diff --git a/source/geometries/Next100InnerElements.cc b/source/geometries/Next100InnerElements.cc index 2210d2ad0..810b5dbfc 100644 --- a/source/geometries/Next100InnerElements.cc +++ b/source/geometries/Next100InnerElements.cc @@ -105,6 +105,7 @@ namespace nexus { (region == "BUFFER") || (region == "XENON") || (region == "EL_GAP_PMT") || + (region == "EL_GAP_SIPM") || (region == "LIGHT_TUBE") || (region == "HDPE_TUBE") || (region == "FIELD_RING") || From 47e4fdfc6d50c50ca81d205792f7470ab0462ecf Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Wed, 17 Apr 2024 13:29:25 +0200 Subject: [PATCH 05/13] Propagate SiPM pitch information from SiPMBoard to FieldCage --- source/geometries/Next100FieldCage.cc | 6 +++++- source/geometries/Next100FieldCage.h | 8 ++++++++ source/geometries/Next100InnerElements.cc | 1 + source/geometries/Next100SiPMBoard.h | 4 ++++ source/geometries/Next100TrackingPlane.cc | 5 +++++ source/geometries/Next100TrackingPlane.h | 1 + 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index 9ddcade6c..68fc31b6e 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -111,6 +111,7 @@ Next100FieldCage::Next100FieldCage(G4double grid_thickn): use_dielectric_grid_(0), // EL gap generation disk parameters el_gap_slice_min_(0.), el_gap_slice_max_(1.), + sipm_pitch_(0), photoe_prob_(0) { /// Define new categories @@ -743,7 +744,10 @@ void Next100FieldCage::BuildELRegion() 0., twopi, nullptr, {0, 0, el_gap_slice_center}); - auto sipm_pitch_ = 123; + if (sipm_pitch_ <= 0) { + G4Exception("[Next100FieldCage]", "Next100FieldCage()", + FatalErrorInArgument, "Error in configuration of EL gap generator: sipm_pitch <= 0"); + } auto unit_cell_center = G4ThreeVector{0, 0, el_gap_slice_center}; el_gap_sipm_gen_ = new BoxPointSampler(sipm_pitch_/2, sipm_pitch_/2, el_gap_slice_thickness/2., diff --git a/source/geometries/Next100FieldCage.h b/source/geometries/Next100FieldCage.h index 4838d1c48..e964fe29a 100644 --- a/source/geometries/Next100FieldCage.h +++ b/source/geometries/Next100FieldCage.h @@ -37,6 +37,7 @@ namespace nexus { void SetMotherLogicalVolume(G4LogicalVolume* mother_logic); void SetMotherPhysicalVolume(G4VPhysicalVolume* mother_phys); void SetELtoSapphireWDWdistance(G4double); + void SetSiPMPitch(G4double); private: void DefineMaterials(); @@ -112,6 +113,9 @@ namespace nexus { CylinderPointSampler* anode_gen_; CylinderPointSampler* holder_gen_; + // SiPM pitch for ELgap vertex generation + G4double sipm_pitch_; + // Geometry Navigator G4Navigator* geom_navigator_; @@ -143,5 +147,9 @@ namespace nexus { gate_sapphire_wdw_dist_ = distance; } + inline void Next100FieldCage::SetSiPMPitch(G4double pitch) { + sipm_pitch_ = pitch; + } + } //end namespace nexus #endif diff --git a/source/geometries/Next100InnerElements.cc b/source/geometries/Next100InnerElements.cc index 810b5dbfc..e80cbbb12 100644 --- a/source/geometries/Next100InnerElements.cc +++ b/source/geometries/Next100InnerElements.cc @@ -66,6 +66,7 @@ namespace nexus { field_cage_->SetMotherPhysicalVolume(mother_phys_); field_cage_->SetCoordOrigin(coord_origin); field_cage_->SetELtoSapphireWDWdistance(gate_sapphire_wdw_distance_); + field_cage_->SetSiPMPitch(tracking_plane_->GetSiPMPitch()); field_cage_->Construct(); // Energy Plane diff --git a/source/geometries/Next100SiPMBoard.h b/source/geometries/Next100SiPMBoard.h index ec2f1865c..1eac70d54 100644 --- a/source/geometries/Next100SiPMBoard.h +++ b/source/geometries/Next100SiPMBoard.h @@ -43,6 +43,7 @@ namespace nexus { G4double GetThickness() const; const std::vector& GetSiPMPositions() const; + G4double GetSiPMPitch() const; private: G4GenericMessenger* msg_; @@ -68,6 +69,9 @@ namespace nexus { inline const std::vector& Next100SiPMBoard::GetSiPMPositions() const { return sipm_positions_; } + inline G4double Next100SiPMBoard::GetSiPMPitch() const + { return pitch_; } + } // namespace nexus #endif diff --git a/source/geometries/Next100TrackingPlane.cc b/source/geometries/Next100TrackingPlane.cc index 68a212b7e..47d3d7746 100644 --- a/source/geometries/Next100TrackingPlane.cc +++ b/source/geometries/Next100TrackingPlane.cc @@ -244,3 +244,8 @@ G4ThreeVector Next100TrackingPlane::GenerateVertex(const G4String& region) const return vertex; } + + +G4double Next100TrackingPlane::GetSiPMPitch() const { + return sipm_board_geom_->GetSiPMPitch(); +} diff --git a/source/geometries/Next100TrackingPlane.h b/source/geometries/Next100TrackingPlane.h index 8c0e8e826..f06a1dddb 100644 --- a/source/geometries/Next100TrackingPlane.h +++ b/source/geometries/Next100TrackingPlane.h @@ -42,6 +42,7 @@ namespace nexus { void PrintSiPMPosInGas() const; void GetSiPMPosInGas(std::vector& sipm_pos) const; + G4double GetSiPMPitch() const; private: void PlaceSiPMBoardColumns(G4int, G4double, G4double, G4int&, G4LogicalVolume*); From 656bc4f16fa387dfd0512aff24e2c511ee28b686 Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Wed, 17 Apr 2024 15:41:22 +0200 Subject: [PATCH 06/13] Add comments describing the behaviour of the EL_GAP generators --- source/geometries/Next100FieldCage.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index 68fc31b6e..aae880aca 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -738,6 +738,8 @@ void Next100FieldCage::BuildELRegion() - el_gap_length_ * el_gap_slice_min_ // start of slice - el_gap_slice_thickness/2.; // center of slice + // Here vertices are generated in a cylinder with the same diameter + // as the gate. In z, the vertices are limited to a slice of the EL gap. el_gap_pmt_gen_ = new CylinderPointSampler(0., gate_int_diam_/2., el_gap_slice_thickness/2., @@ -748,6 +750,14 @@ void Next100FieldCage::BuildELRegion() G4Exception("[Next100FieldCage]", "Next100FieldCage()", FatalErrorInArgument, "Error in configuration of EL gap generator: sipm_pitch <= 0"); } + + + // We generate vertices in an xy unit cell, i.e. a portion of the + // plane that can tessellate the space by translations and + // reflections. This unit cell is a square of side=pitch. The + // position of this is square is not relevant as long as it is + // sufficiently far away from the edges of the detector. The + // vertices are generated in a slice of the EL gap. auto unit_cell_center = G4ThreeVector{0, 0, el_gap_slice_center}; el_gap_sipm_gen_ = new BoxPointSampler(sipm_pitch_/2, sipm_pitch_/2, el_gap_slice_thickness/2., From 4812ce7d92e42800b0a1752c06795fe108559e7e Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Thu, 18 Apr 2024 12:50:34 +0200 Subject: [PATCH 07/13] Fix typo --- source/geometries/Next100FieldCage.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index aae880aca..f5ad4ad04 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -179,7 +179,7 @@ Next100FieldCage::Next100FieldCage(G4double grid_thickn): G4GenericMessenger::Command& el_gap_slice_max_cmd = msg_->DeclareProperty("el_gap_slice_max", el_gap_slice_max_, - "Uppeer limit (fraction) to the EL gap slice in which vertices are generated."); + "Upper limit (fraction) to the EL gap slice in which vertices are generated."); el_gap_slice_max_cmd.SetParameterName("el_gap_slice_max", false); el_gap_slice_max_cmd.SetRange("el_gap_slice_max >= 0.0 &&" "el_gap_slice_max <= 1.0"); From ccd6a56a5c2cfc9ea36307ce4a8408b7ea37fdb4 Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Thu, 18 Apr 2024 12:52:53 +0200 Subject: [PATCH 08/13] Improve help strings --- source/geometries/Next100FieldCage.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index f5ad4ad04..423ddfdd5 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -172,14 +172,18 @@ Next100FieldCage::Next100FieldCage(G4double grid_thickn): G4GenericMessenger::Command& el_gap_slice_min_cmd = msg_->DeclareProperty("el_gap_slice_min", el_gap_slice_min_, - "Lower limit (fraction) to the EL gap slice in which vertices are generated."); + "Lower limit (fraction of the whole length)" + "to the EL gap slice in which vertices are generated." + "0 is the gate, and 1 the anode"); el_gap_slice_min_cmd.SetParameterName("el_gap_slice_min", false); el_gap_slice_min_cmd.SetRange("el_gap_slice_min >= 0.0 &&" "el_gap_slice_min <= 1.0"); G4GenericMessenger::Command& el_gap_slice_max_cmd = msg_->DeclareProperty("el_gap_slice_max", el_gap_slice_max_, - "Upper limit (fraction) to the EL gap slice in which vertices are generated."); + "Upper limit (fraction of the whole length)" + "to the EL gap slice in which vertices are generated." + "0 is the gate, and 1 the anode"); el_gap_slice_max_cmd.SetParameterName("el_gap_slice_max", false); el_gap_slice_max_cmd.SetRange("el_gap_slice_max >= 0.0 &&" "el_gap_slice_max <= 1.0"); From 27545add92c60ed8c9fe7c5b7f055c0ce24e9ebc Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Thu, 18 Apr 2024 14:13:17 +0200 Subject: [PATCH 09/13] Rename generation regions --- source/geometries/Next100.cc | 4 ++-- source/geometries/Next100FieldCage.cc | 4 ++-- source/geometries/Next100InnerElements.cc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/geometries/Next100.cc b/source/geometries/Next100.cc index abdcc41bf..908c6c141 100644 --- a/source/geometries/Next100.cc +++ b/source/geometries/Next100.cc @@ -243,8 +243,8 @@ namespace nexus { (region == "XENON") || (region == "LIGHT_TUBE") || (region == "HDPE_TUBE") || - (region == "EL_GAP_PMT") || - (region == "EL_GAP_SIPM") || + (region == "S2_PMT_LT") || + (region == "S2_SIPM_PSF") || (region == "EP_COPPER_PLATE") || (region == "SAPPHIRE_WINDOW") || (region == "OPTICAL_PAD") || diff --git a/source/geometries/Next100FieldCage.cc b/source/geometries/Next100FieldCage.cc index 423ddfdd5..94a334983 100644 --- a/source/geometries/Next100FieldCage.cc +++ b/source/geometries/Next100FieldCage.cc @@ -1133,11 +1133,11 @@ G4ThreeVector Next100FieldCage::GenerateVertex(const G4String& region) const vertex = hdpe_gen_->GenerateVertex(VOLUME); } - else if (region == "EL_GAP_PMT") { + else if (region == "S2_PMT_LT") { vertex = el_gap_pmt_gen_->GenerateVertex(VOLUME); } - else if (region == "EL_GAP_SIPM") { + else if (region == "S2_SIPM_PSF") { vertex = el_gap_sipm_gen_->GenerateVertex(INSIDE); } diff --git a/source/geometries/Next100InnerElements.cc b/source/geometries/Next100InnerElements.cc index e80cbbb12..78d510c1f 100644 --- a/source/geometries/Next100InnerElements.cc +++ b/source/geometries/Next100InnerElements.cc @@ -105,8 +105,8 @@ namespace nexus { (region == "CATHODE_RING") || (region == "BUFFER") || (region == "XENON") || - (region == "EL_GAP_PMT") || - (region == "EL_GAP_SIPM") || + (region == "S2_PMT_LT") || + (region == "S2_SIPM_PSF") || (region == "LIGHT_TUBE") || (region == "HDPE_TUBE") || (region == "FIELD_RING") || From 713ae6baa9eff6d95330fc3148712b8d67b0ac00 Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Thu, 18 Apr 2024 15:40:21 +0200 Subject: [PATCH 10/13] Rename S1_table macros to S1_LT --- .../{NEXT100_S1_table.config.mac => NEXT100_S1_LT.config.mac} | 2 +- macros/{NEXT100_S1_table.init.mac => NEXT100_S1_LT.init.mac} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename macros/{NEXT100_S1_table.config.mac => NEXT100_S1_LT.config.mac} (94%) rename macros/{NEXT100_S1_table.init.mac => NEXT100_S1_LT.init.mac} (90%) diff --git a/macros/NEXT100_S1_table.config.mac b/macros/NEXT100_S1_LT.config.mac similarity index 94% rename from macros/NEXT100_S1_table.config.mac rename to macros/NEXT100_S1_LT.config.mac index da8ae6db1..d86892646 100644 --- a/macros/NEXT100_S1_table.config.mac +++ b/macros/NEXT100_S1_LT.config.mac @@ -1,5 +1,5 @@ ## ---------------------------------------------------------------------------- -## nexus | NEXT100_S1_table.config.mac +## nexus | NEXT100_S1_LT.config.mac ## ## Configuration macro to simulate primary scintillation light ## for look-up tables in the NEXT-100 detector. diff --git a/macros/NEXT100_S1_table.init.mac b/macros/NEXT100_S1_LT.init.mac similarity index 90% rename from macros/NEXT100_S1_table.init.mac rename to macros/NEXT100_S1_LT.init.mac index d6b1c5c12..d0a35930d 100644 --- a/macros/NEXT100_S1_table.init.mac +++ b/macros/NEXT100_S1_LT.init.mac @@ -1,5 +1,5 @@ ## ---------------------------------------------------------------------------- -## nexus | NEXT100_S1_table.init.mac +## nexus | NEXT100_S1_LT.init.mac ## ## Initialization macro to simulate primary scintillation light ## for look-up tables in the NEXT-100 detector. @@ -23,4 +23,4 @@ /nexus/RegisterTrackingAction DefaultTrackingAction /nexus/RegisterRunAction DefaultRunAction -/nexus/RegisterMacro macros/NEXT100_S1_table.config.mac +/nexus/RegisterMacro macros/NEXT100_S1_LT.config.mac From 2b03362c222b5246b52630bdd766eb5563918a3b Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Thu, 18 Apr 2024 15:40:35 +0200 Subject: [PATCH 11/13] Rename S2_table macros to S2_LT + adapt them to the new generator --- ...EXT100_S2_table.config.mac => NEXT100_S2_LT.config.mac} | 7 ++++--- .../{NEXT100_S2_table.init.mac => NEXT100_S2_LT.init.mac} | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) rename macros/{NEXT100_S2_table.config.mac => NEXT100_S2_LT.config.mac} (81%) rename macros/{NEXT100_S2_table.init.mac => NEXT100_S2_LT.init.mac} (88%) diff --git a/macros/NEXT100_S2_table.config.mac b/macros/NEXT100_S2_LT.config.mac similarity index 81% rename from macros/NEXT100_S2_table.config.mac rename to macros/NEXT100_S2_LT.config.mac index 21ed3dd44..bc8a87b9d 100644 --- a/macros/NEXT100_S2_table.config.mac +++ b/macros/NEXT100_S2_LT.config.mac @@ -1,5 +1,5 @@ ## ---------------------------------------------------------------------------- -## nexus | NEXT100_S2_table.config.mac +## nexus | NEXT100_S2_LT.config.mac ## ## Configuration macro to simulate secondary scintillation light ## for look-up tables in the NEXT-100 detector. @@ -20,11 +20,12 @@ ##### GEOMETRY ##### /Geometry/Next100/pressure 15. bar /Geometry/Next100/max_step_size 1. mm -/Geometry/Next100/specific_vertex 0. 0. -5. mm +/Geometry/Next100/el_gap_slice_max 1 +/Geometry/Next100/el_gap_slice_min 0 #### GENERATOR #### /Generator/ScintGenerator/nphotons 100000 -/Generator/ScintGenerator/region AD_HOC +/Generator/ScintGenerator/region S2_PMT_LT #### PERSISTENCY #### /nexus/persistency/output_file Next100_X_0_Y_0_Z_0.next diff --git a/macros/NEXT100_S2_table.init.mac b/macros/NEXT100_S2_LT.init.mac similarity index 88% rename from macros/NEXT100_S2_table.init.mac rename to macros/NEXT100_S2_LT.init.mac index d7656c678..ec5562d6f 100644 --- a/macros/NEXT100_S2_table.init.mac +++ b/macros/NEXT100_S2_LT.init.mac @@ -1,5 +1,5 @@ ## ---------------------------------------------------------------------------- -## nexus | NEXT100_S2_table.init.mac +## nexus | NEXT100_S2_LT.init.mac ## ## Initialization macro to simulate secondary scintillation light ## for look-up tables in the NEXT-100 detector. @@ -21,4 +21,4 @@ /nexus/RegisterRunAction DefaultRunAction /nexus/RegisterTrackingAction DefaultTrackingAction -/nexus/RegisterMacro macros/NEXT100_S2_table.config.mac +/nexus/RegisterMacro macros/NEXT100_S2_LT.config.mac From afb19a6f620daeb1cbfef10a524dded84c74f093 Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Thu, 18 Apr 2024 15:41:03 +0200 Subject: [PATCH 12/13] Add S2_PSF macros --- macros/NEXT100_S2_PSF.config.mac | 31 +++++++++++++++++++++++++++++++ macros/NEXT100_S2_PSF.init.mac | 24 ++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 macros/NEXT100_S2_PSF.config.mac create mode 100644 macros/NEXT100_S2_PSF.init.mac diff --git a/macros/NEXT100_S2_PSF.config.mac b/macros/NEXT100_S2_PSF.config.mac new file mode 100644 index 000000000..aa2fc082a --- /dev/null +++ b/macros/NEXT100_S2_PSF.config.mac @@ -0,0 +1,31 @@ +## ---------------------------------------------------------------------------- +## nexus | NEXT100_S2_PSF.config.mac +## +## Configuration macro to simulate secondary scintillation light +## for look-up tables in the NEXT-100 detector. +## +## The NEXT Collaboration +## ---------------------------------------------------------------------------- + +##### VERBOSITY ##### +/run/verbose 0 +/event/verbose 0 +/tracking/verbose 0 + +/process/em/verbose 0 + +##### JOB CONTROL ##### +/nexus/random_seed -2 + +##### GEOMETRY ##### +/Geometry/Next100/pressure 15. bar +/Geometry/Next100/max_step_size 1. mm +/Geometry/Next100/el_gap_slice_max 1 +/Geometry/Next100/el_gap_slice_min 0 + +#### GENERATOR #### +/Generator/ScintGenerator/nphotons 100000 +/Generator/ScintGenerator/region S2_SIPM_PSF + +#### PERSISTENCY #### +/nexus/persistency/output_file Next100_PSF.next diff --git a/macros/NEXT100_S2_PSF.init.mac b/macros/NEXT100_S2_PSF.init.mac new file mode 100644 index 000000000..ed44da7b2 --- /dev/null +++ b/macros/NEXT100_S2_PSF.init.mac @@ -0,0 +1,24 @@ +## ---------------------------------------------------------------------------- +## nexus | NEXT100_S2_PSF.init.mac +## +## Initialization macro to simulate secondary scintillation light +## for look-up tables in the NEXT-100 detector. +## +## The NEXT Collaboration +## ---------------------------------------------------------------------------- + +/PhysicsList/RegisterPhysics G4EmStandardPhysics_option4 +/PhysicsList/RegisterPhysics G4DecayPhysics +/PhysicsList/RegisterPhysics G4OpticalPhysics +/PhysicsList/RegisterPhysics NexusPhysics + +/nexus/RegisterGeometry Next100OpticalGeometry + +/nexus/RegisterGenerator ScintillationGenerator + +/nexus/RegisterPersistencyManager PersistencyManager + +/nexus/RegisterRunAction DefaultRunAction +/nexus/RegisterTrackingAction DefaultTrackingAction + +/nexus/RegisterMacro macros/NEXT100_S2_PSF.config.mac From 84e6a34f3b367f179a201e4434b18652ae78115b Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Fri, 19 Apr 2024 10:10:01 +0200 Subject: [PATCH 13/13] Fix lu_table macro list in tests --- pytest/macros_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pytest/macros_test.py b/pytest/macros_test.py index f3413c50d..91656e5ff 100644 --- a/pytest/macros_test.py +++ b/pytest/macros_test.py @@ -33,8 +33,10 @@ def check_list(NEXUSDIR): def macro_list(NEXUSDIR): all_macros = np.array(glob.glob(NEXUSDIR + '/macros/**/*.init.mac', recursive=True)) - full = np.array(['full' in m for m in all_macros]) - lu_table = np.array(['table' in m for m in all_macros]) + full = np.array(['full' in m for m in all_macros]) + lu_table = np.array(['table' in m or + 'LT' in m or + 'PSF' in m for m in all_macros]) full_macros = all_macros[ full | lu_table] fast_macros = all_macros[~(full | lu_table)]