Skip to content

Commit

Permalink
Use new class in FC code
Browse files Browse the repository at this point in the history
  • Loading branch information
paolafer committed Nov 6, 2023
1 parent 5af7909 commit cd9ab9f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 178 deletions.
215 changes: 41 additions & 174 deletions source/geometries/Next100FieldCage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// ----------------------------------------------------------------------------

#include "Next100FieldCage.h"
#include "Next100Stave.h"
#include "MaterialsList.h"
#include "Visibilities.h"
#include "IonizationSD.h"
Expand Down Expand Up @@ -79,10 +80,11 @@ Next100FieldCage::Next100FieldCage(G4double grid_thickn):
ring_int_diam_ (1014. * mm),
ring_thickn_ (10. * mm),
drift_ring_dist_ (24. * mm),
buffer_ring_dist_ (48. * mm),
holder_x_ (60. * mm), //x dimension of the holders
holder_long_y_ (9.1 * mm), //(9. * mm), // y dim of the base of the ring holders
holder_short_y_ (33.9 * mm), //(33.15 * mm),// y dim of the pieces added over the base of the ring holders
buffer_ring_dist_ (48. * mm), // distance between buffer rings
buffer_first_ring_dist_ (69. * mm), // distance of first ring from end of the stave
ring_drift_buffer_dist_ (72. * mm), // distance between last ring of buffer and first ring of drift part.
num_drift_rings_ (48),
num_buffer_rings_ (4),

tpb_thickn_ (1 * micrometer),
overlap_ (0.001*mm), //defined for G4UnionSolids to ensure a common volume within the two joined solids
Expand Down Expand Up @@ -211,9 +213,6 @@ void Next100FieldCage::Construct()
active_length_ = gate_cathode_dist_;
buffer_length_ = gate_sapphire_wdw_dist_ - gate_cathode_dist_ - grid_thickn_;

/// Calculate radial position of the ring holders.
holder_r_ = (active_diam_+2.*teflon_thickn_+holder_long_y_)/2.;

/// Calculate relative z positions in mother volume
/// All of them are calculated from GetELzCoord(), which is the position
/// of the beginning of the ACTIVE volume and the end of the gate grid.
Expand Down Expand Up @@ -257,9 +256,6 @@ void Next100FieldCage::DefineMaterials()
/// High density polyethylene for the field cage
hdpe_ = materials::HDPE();

/// PE500 for the holders
pe500_ = materials::PE500();

/// Copper for field rings
copper_ = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu");

Expand Down Expand Up @@ -743,33 +739,24 @@ void Next100FieldCage::BuildFieldCage()
G4LogicalVolume* ring_logic =
new G4LogicalVolume(ring_solid, copper_, "FIELD_RING");

G4double buffer_short_z = 37. * mm; // Thickness of holders in the buffer volume.
// Distance between the last ring of the buffer and the first ring of the drift part.
G4double ring_drift_buffer_dist = 72. * mm;
G4int num_drift_rings = 48;
G4int num_buffer_rings = 4;


// Placement of the buffer rings, in such a way that the holder ends
// at the same z position as the teflon buffer reflector.
// The placements go from higher to lower z.

// Distance of first ring from the end of the stave.
G4double buffer_first_ring_dist = 69. * mm;
// The placements go from higher to lower z.
G4double first_ring_buff_z_pos =
teflon_buffer_zpos_ + teflon_buffer_length_/2. - buffer_first_ring_dist;
teflon_buffer_zpos_ + teflon_buffer_length_/2. - buffer_first_ring_dist_;

G4double posz;
for (G4int i=0; i<num_buffer_rings; i++) {
for (G4int i=0; i<num_buffer_rings_; i++) {
posz = first_ring_buff_z_pos - i*buffer_ring_dist_;
new G4PVPlacement(0, G4ThreeVector(0., 0., posz),
ring_logic, "FIELD_RING", mother_logic_,
false, i, false);
}

// Placement of the drift rings.
G4double first_ring_drift_z_pos = posz - ring_drift_buffer_dist;
for (G4int i=0; i<num_drift_rings; i++) {
G4double first_ring_drift_z_pos = posz - ring_drift_buffer_dist_;
for (G4int i=0; i<num_drift_rings_; i++) {
posz = first_ring_drift_z_pos - i*drift_ring_dist_;
new G4PVPlacement(0, G4ThreeVector(0., 0., posz),
ring_logic, "FIELD_RING", mother_logic_,
Expand All @@ -783,179 +770,61 @@ void Next100FieldCage::BuildFieldCage()
0., twopi, nullptr,
G4ThreeVector(0., 0., ring_gen_zpos));

// Ring holders (a.k.a. staves).
G4double cathode_opening = 15.5 * mm;
// Ring holders (a.k.a. staves)

// BUFFER holders.
// They are placed in such a way that they end at the same z position
// as the teflon buffer reflector, in the side of the EP.
// The unions of volumes go from lower to higher z.
G4double buffer_long_length = 241.3 * mm;
G4Box* buffer_short_solid =
new G4Box("BUFF_SHORT", holder_x_/2., holder_short_y_/2.+overlap_/2., buffer_short_z/2.);

G4Box* buffer_long_solid =
new G4Box("BUFF_LONG", holder_x_/2., holder_long_y_/2., buffer_long_length/2.);

G4double first_buff_short_z = -buffer_long_length/2. +
(ring_drift_buffer_dist/2.-cathode_opening/2.) + buffer_ring_dist_/2.;

G4UnionSolid* buff_holder_solid =
new G4UnionSolid ("BUFF_HOLDER", buffer_long_solid, buffer_short_solid, 0,
G4ThreeVector(0.,holder_long_y_/2.+holder_short_y_/2.-overlap_/2.,
first_buff_short_z));

for (G4int j=1; j<num_buffer_rings-1; j++) {
posz = first_buff_short_z + j*buffer_ring_dist_;

buff_holder_solid =
new G4UnionSolid("BUFF_HOLDER", buff_holder_solid, buffer_short_solid, 0,
G4ThreeVector(0.,holder_long_y_/2.+holder_short_y_/2.-overlap_/2.,posz));
}

G4double buffer_last_z = 63.5 *mm;
G4Box* buffer_last_solid =
new G4Box("BUFF_LAST", holder_x_/2., holder_short_y_/2.+overlap_/2., buffer_last_z/2.);
Next100Stave stave = Next100Stave(ring_drift_buffer_dist_, num_drift_rings_, num_buffer_rings_);
stave.Construct();
G4LogicalVolume* stave_logic = stave.GetLogicalVolume();

buff_holder_solid =
new G4UnionSolid("BUFF_HOLDER", buff_holder_solid, buffer_last_solid, 0,
G4ThreeVector(0.,holder_long_y_/2. + holder_short_y_/2.-overlap_/2.,
teflon_buffer_length_/2. - buffer_last_z/2.));
G4double holder_long_y = stave.GetHolderLongY();
G4double holder_short_y = stave.GetHolderShortY();
G4double cathode_long_y = stave.GetCathodeLongY();
G4double buffer_long_length = stave.GetBufferLongLength();
G4double cathode_opening = stave.GetCathodeOpening();

G4LogicalVolume* buff_holder_logic =
new G4LogicalVolume(buff_holder_solid, pe500_, "BUFF_HOLDER");

G4double stave_buffer_zpos =
teflon_buffer_zpos_ + teflon_buffer_length_/2. - buffer_long_length/2.;
G4double stave_r =
active_diam_/2. + teflon_thickn_ + holder_long_y + holder_short_y - cathode_long_y/2.;
G4double stave_zpos =
teflon_buffer_zpos_ + teflon_buffer_length_/2. - buffer_long_length - cathode_opening/2.;

G4int numbering = 0;
for (G4int i=10; i<360; i +=20){
G4RotationMatrix* rot = new G4RotationMatrix();
rot -> rotateZ((90-i) * deg);
new G4PVPlacement(rot, G4ThreeVector(holder_r_*cos(i*deg), holder_r_*sin(i*deg),
stave_buffer_zpos), buff_holder_logic, "BUFF_HOLDER", mother_logic_,
false, numbering, false);
numbering +=1;
}

// ACTIVE holders.
G4double active_long_length = 1170.2 * mm;
G4double active_short_first_length = 8.5 * mm; // Thickness of first holder in the active volume.
G4double active_short_length = 13. * mm; // Thickness of holders in the active volume.
G4Box* active_short_first_solid =
new G4Box("ACT_SHORT", holder_x_/2., holder_short_y_/2.+overlap_/2., active_short_first_length/2.);

G4double first_act_short_z = -active_long_length/2. + active_short_first_length/2.;

G4Box* active_long_solid =
new G4Box("ACT_LONG", holder_x_/2., holder_long_y_/2., active_long_length/2.);

G4UnionSolid* act_holder_solid =
new G4UnionSolid ("ACT_HOLDER", active_long_solid, active_short_first_solid, 0,
G4ThreeVector(0., holder_long_y_/2.+holder_short_y_/2.-overlap_/2.,
first_act_short_z));

G4Box* active_short_solid =
new G4Box("ACT_SHORT", holder_x_/2., holder_short_y_/2.+overlap_/2., active_short_length/2.);

for (G4int j=0; j<num_drift_rings-1; j++) {
posz = -active_long_length/2. + active_short_first_length + drift_ring_dist_ -
active_short_length /2 + j*drift_ring_dist_;

act_holder_solid =
new G4UnionSolid("ACT_HOLDER", act_holder_solid, active_short_solid, 0,
G4ThreeVector(0.,holder_long_y_/2.+holder_short_y_/2.-overlap_/2., posz));
}

G4LogicalVolume* act_holder_logic =
new G4LogicalVolume(act_holder_solid, pe500_, "ACT_HOLDER");

// It is placed relatively to the buffer and the cathode holders
G4double stave_drift_zpos =
stave_buffer_zpos - buffer_long_length/2. - cathode_opening - active_long_length/2.;

numbering = 0;
for (G4int i=10; i<360; i +=20){
G4RotationMatrix* rot = new G4RotationMatrix();
rot -> rotateZ((90-i) *deg);
new G4PVPlacement(rot,G4ThreeVector(holder_r_*cos(i*deg),holder_r_*sin(i*deg), stave_drift_zpos),
act_holder_logic, "ACT_HOLDER", mother_logic_,
false, numbering, false);
numbering +=1;
}


// CATHODE holders.
// They are placed at the same z position as the cathode ring.
G4double cathode_long_y = 28.15 * mm;// 29.*mm (previous) - 0.85 * mm (what has been removed);
G4double cathode_long_length = 61 * mm;
G4double cathode_short_length = 22.75 * mm; // 24.5*mm
G4Box* cathode_large_solid =
new G4Box("CATHODE_LARGE", holder_x_/2., cathode_long_y/2., cathode_long_length/2.);

G4Box* cathode_short_solid =
new G4Box("CATHODE_SHORT", holder_x_/2., holder_short_y_/2., cathode_short_length/2.);

G4UnionSolid* cathode_holder_solid =
new G4UnionSolid ("CATHODE_HOLDER", cathode_large_solid, cathode_short_solid, 0,
G4ThreeVector(0.,-(holder_short_y_/2.-cathode_long_y/2),
cathode_long_length/2.-cathode_short_length/2.));

cathode_holder_solid =
new G4UnionSolid("CATHODE_HOLDER", cathode_holder_solid, cathode_short_solid, 0,
G4ThreeVector(0.,-(holder_short_y_/2.-cathode_long_y/2),
-(cathode_long_length/2.-cathode_short_length/2.)));

G4LogicalVolume* cathode_holder_logic =
new G4LogicalVolume(cathode_holder_solid, pe500_, "CATHODE_HOLDER");

numbering=0;
G4double cathode_holder_r = (active_diam_+2*teflon_thickn_+ 2*holder_long_y_+
2*holder_short_y_)/2.-cathode_long_y/2.;
G4double cathode_holder_zpos =
stave_buffer_zpos - buffer_long_length/2. - cathode_opening/2.;
for (G4int i=10; i<360; i +=20){
G4RotationMatrix* rot = new G4RotationMatrix();
rot -> rotateZ((90-i) *deg);
new G4PVPlacement(rot, G4ThreeVector(cathode_holder_r*cos(i*deg), cathode_holder_r*sin(i*deg),
cathode_holder_zpos), cathode_holder_logic, "CATHODE_HOLDER", mother_logic_,
new G4PVPlacement(rot, G4ThreeVector(stave_r*cos(i*deg), stave_r *sin(i*deg),
stave_zpos), stave_logic, "STAVE", mother_logic_,
false, numbering, false);
numbering +=1;
}

G4double total_stave_length = buffer_long_length + active_long_length + cathode_opening;
assert(total_stave_length == 1427. * mm);
G4double holder_gen_zpos =
(buffer_long_length*stave_buffer_zpos + active_long_length*stave_drift_zpos +
cathode_opening*cathode_zpos_)/total_stave_length;

// Stave vertex generator
// Length is approximated to avoid complicated calculations.
// The correct positioning of vertices is checked at run time anyway.
G4double stave_gen_length =
teflon_buffer_zpos_ - GetELzCoord() + teflon_buffer_length_/2;
holder_gen_ =
new CylinderPointSampler2020(holder_r_ - holder_long_y_/2.,
holder_r_ + holder_long_y_/2. + holder_short_y_,
total_stave_length/2., 0., twopi, nullptr,
G4ThreeVector(0., 0., holder_gen_zpos));
new CylinderPointSampler2020(active_diam_/2. + teflon_thickn_ ,
active_diam_/2. + teflon_thickn_ + holder_long_y + holder_short_y,
stave_gen_length/2., 0., twopi, nullptr,
G4ThreeVector(0., 0., GetELzCoord() + stave_gen_length/2.));

/// Visibilities
/// Visibilities
if (visibility_) {
G4VisAttributes ring_col = nexus::CopperBrown();
ring_col.SetForceSolid(true);
ring_logic->SetVisAttributes(ring_col);
G4VisAttributes hdpe_col =nexus::WhiteAlpha();
hdpe_col.SetForceSolid(true);
hdpe_tube_logic->SetVisAttributes(hdpe_col);
G4VisAttributes hold_col = nexus::LightGrey();
hold_col.SetForceSolid(true);
G4VisAttributes hold_col_cath = nexus::Lilla();
hold_col_cath.SetForceSolid(true);
act_holder_logic->SetVisAttributes(hold_col);
buff_holder_logic->SetVisAttributes(hold_col);
cathode_holder_logic->SetVisAttributes(hold_col_cath);
G4VisAttributes stave_col = nexus::LightGrey();
stave_col.SetForceSolid(true);
stave_logic->SetVisAttributes(stave_col);
} else {
ring_logic->SetVisAttributes(G4VisAttributes::GetInvisible());
hdpe_tube_logic->SetVisAttributes(G4VisAttributes::GetInvisible());
act_holder_logic->SetVisAttributes(G4VisAttributes::GetInvisible());
buff_holder_logic->SetVisAttributes(G4VisAttributes::GetInvisible());
cathode_holder_logic->SetVisAttributes(G4VisAttributes::GetInvisible());
stave_logic->SetVisAttributes(G4VisAttributes::GetInvisible());
}
}

Expand Down Expand Up @@ -1079,9 +948,7 @@ G4ThreeVector Next100FieldCage::GenerateVertex(const G4String& region) const
glob_vtx = glob_vtx + G4ThreeVector(0, 0, -GetELzCoord());
VertexVolume =
geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
} while ((VertexVolume->GetName() != "ACT_HOLDER") &&
(VertexVolume->GetName() != "BUFF_HOLDER") &&
(VertexVolume->GetName() != "CATHODE_HOLDER"));
} while (VertexVolume->GetName() != "STAVE");
}

else {
Expand Down
8 changes: 4 additions & 4 deletions source/geometries/Next100FieldCage.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ namespace nexus {
const G4double gate_ext_diam_, gate_int_diam_, gate_ring_thickn_;
const G4double gate_teflon_dist_, gate_cathode_dist_; //cathode_sapphire_wdw_dist_;
const G4double hdpe_tube_int_diam_, hdpe_tube_ext_diam_, hdpe_length_;
const G4double ring_ext_diam_, ring_int_diam_, ring_thickn_, drift_ring_dist_, buffer_ring_dist_;
const G4double holder_x_, holder_long_y_, holder_short_y_;
const G4double ring_ext_diam_, ring_int_diam_, ring_thickn_;
const G4double drift_ring_dist_, buffer_ring_dist_;
const G4double buffer_first_ring_dist_, ring_drift_buffer_dist_;
const G4int num_drift_rings_, num_buffer_rings_;
const G4double tpb_thickn_;
const G4double overlap_;

Expand All @@ -81,7 +83,6 @@ namespace nexus {

G4double active_length_, buffer_length_;
G4double teflon_drift_length_, teflon_drift_zpos_,teflon_buffer_zpos_;
G4double holder_r_;
G4double active_zpos_, cathode_zpos_, gate_zpos_, el_gap_zpos_, anode_zpos_;
G4double gate_grid_zpos_, anode_grid_zpos_;

Expand Down Expand Up @@ -116,7 +117,6 @@ namespace nexus {

// Pointers to materials definition
G4Material* hdpe_;
G4Material* pe500_;
G4Material* tpb_;
G4Material* teflon_;
G4Material* copper_;
Expand Down

0 comments on commit cd9ab9f

Please sign in to comment.