Skip to content

Commit

Permalink
Add vertex generator
Browse files Browse the repository at this point in the history
  • Loading branch information
paolafer committed Feb 12, 2024
1 parent de275b9 commit 56fe968
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 22 deletions.
77 changes: 57 additions & 20 deletions source/geometries/Honeycomb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,30 @@
#include "HoneycombBeam.h"
#include "MaterialsList.h"
#include "Visibilities.h"
#include "CylinderPointSampler2020.h"

#include <G4LogicalVolume.hh>
#include <G4RotationMatrix.hh>
#include <G4MultiUnion.hh>
#include <G4PVPlacement.hh>
#include <G4VisAttributes.hh>
#include <G4Trd.hh>

#include <G4TransportationManager.hh>

namespace nexus {

using namespace CLHEP;

Honeycomb::Honeycomb(): GeometryBase(), angle_(pi / 6.), beam_dist_(102.25 * mm),
Honeycomb::Honeycomb(): GeometryBase(),
angle_(pi / 6.),
beam_dist_(102.25 * mm),
beam_thickn_(6 * mm)
{
compl_angle_ = pi/2. - angle_;

/// Initializing the geometry navigator (used in vertex generation)
geom_navigator_ =
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
}

Honeycomb::~Honeycomb()
Expand All @@ -37,13 +44,14 @@ namespace nexus {
{
G4double shorter_height = 117 * mm;
G4double longer_height = 130 * mm;
G4double longer_length = 1210.6*mm;

HoneycombBeam* short_beam =
new HoneycombBeam(beam_thickn_, 1085.9*mm, 184*mm, shorter_height);
HoneycombBeam* medium_beam =
new HoneycombBeam(beam_thickn_, 1170.2*mm, 273.5*mm, longer_height);
HoneycombBeam* long_beam =
new HoneycombBeam(beam_thickn_, 1210.6*mm, 407.4*mm, longer_height);
new HoneycombBeam(beam_thickn_, longer_length, 407.4*mm, longer_height);

G4double short_displ = (longer_height-shorter_height)/2.;

Expand All @@ -57,7 +65,8 @@ namespace nexus {
G4RotationMatrix rot;
rot.rotateX(3*pi/2.);

G4ThreeVector ini_pos = G4ThreeVector(-(beam_dist_+beam_thickn_)/2., 0., 0.);
G4ThreeVector ini_pos =
G4ThreeVector(-(beam_dist_+beam_thickn_)/2., 0., 0.);
struct_solid->AddNode(long_beam->GetSolidVol(),
G4Transform3D(rot, ini_pos));

Expand All @@ -68,19 +77,24 @@ namespace nexus {
rot_right.rotateX(3*pi/2.);
rot_right.rotateY(-(pi/2.+angle_));

G4double r_pos = 1/2*beam_dist_+ 2*(beam_dist_+beam_thickn_) + 1/2*beam_thickn_;
G4double r_pos =
1/2*beam_dist_+ 2*(beam_dist_+beam_thickn_) + 1/2*beam_thickn_;
r_pos = r_pos + (beam_dist_ + beam_thickn_)/2.*cos(compl_angle_) + 2.75*cm;
G4double x = r_pos * sin(angle_);
G4double z = r_pos * cos(angle_);

struct_solid->AddNode(short_beam->GetSolidVol(),
G4Transform3D(rot_left, G4ThreeVector(x, short_displ, z)));
G4Transform3D(rot_left,
G4ThreeVector(x, short_displ, z)));
struct_solid->AddNode(short_beam->GetSolidVol(),
G4Transform3D(rot_right, G4ThreeVector(-x, short_displ, z)));
G4Transform3D(rot_right,
G4ThreeVector(-x, short_displ, z)));
struct_solid->AddNode(short_beam->GetSolidVol(),
G4Transform3D(rot_left, G4ThreeVector(-x, short_displ, -z)));
G4Transform3D(rot_left,
G4ThreeVector(-x, short_displ, -z)));
struct_solid->AddNode(short_beam->GetSolidVol(),
G4Transform3D(rot_right, G4ThreeVector(x, short_displ, -z)));
G4Transform3D(rot_right,
G4ThreeVector(x, short_displ, -z)));


x = (r_pos-(beam_dist_+beam_thickn_)) * sin(angle_);
Expand Down Expand Up @@ -116,7 +130,8 @@ namespace nexus {
G4Transform3D(rot, G4ThreeVector(x, 0., 0.)));
x = ini_pos.x() - 2*(beam_dist_+beam_thickn_);
struct_solid->AddNode(short_beam->GetSolidVol(),
G4Transform3D(rot, G4ThreeVector(x, short_displ, 0.)));
G4Transform3D(rot,
G4ThreeVector(x, short_displ, 0.)));
x = ini_pos.x() + (beam_dist_+beam_thickn_);
struct_solid->AddNode(long_beam->GetSolidVol(),
G4Transform3D(rot, G4ThreeVector(x, 0., 0.)));
Expand All @@ -125,32 +140,54 @@ namespace nexus {
G4Transform3D(rot, G4ThreeVector(x, 0., 0.)));
x = ini_pos.x() + 3*(beam_dist_+beam_thickn_);
struct_solid->AddNode(short_beam->GetSolidVol(),
G4Transform3D(rot, G4ThreeVector(x, short_displ, 0.)));
G4Transform3D(rot,
G4ThreeVector(x, short_displ, 0.)));

struct_solid->Voxelize();

G4LogicalVolume* struct_logic = new G4LogicalVolume(struct_solid, materials::Steel(),
"UnionBeams");

//this->SetLogicalVolume(struct_logic);

G4LogicalVolume* struct_logic =
new G4LogicalVolume(struct_solid, materials::Steel(), "HONEYCOMB");

G4RotationMatrix rot_placement;
rot_placement.rotateZ(-pi/2);
rot_placement.rotateY(-pi/2);

G4double hc_posz_ = end_of_EP_copper_plate_z_ + longer_height/2.;
new G4PVPlacement(G4Transform3D(rot_placement, G4ThreeVector(0., 0., hc_posz_)),
struct_logic, "HONEYCOMB", mother_logic_, false, 0, true);
G4double hc_posz = end_of_EP_copper_plate_z_ + longer_height/2.;
new G4PVPlacement(G4Transform3D(rot_placement,
G4ThreeVector(0., 0., hc_posz)),
struct_logic, "HONEYCOMB", mother_logic_,
false, 0, false);

G4VisAttributes red_col = nexus::Red();
red_col.SetForceSolid(true);
struct_logic->SetVisAttributes(red_col);

// Vertex generator
gen_ =
new CylinderPointSampler2020(0., longer_length/2., longer_height/2.,
0., 360.*deg, 0,
G4ThreeVector(0., 0., hc_posz));

}

G4ThreeVector Honeycomb::GenerateVertex(const G4String& region) const
{
return G4ThreeVector(0, 0, 0);
G4ThreeVector vertex(0, 0, 0);

if (region == "HONEYCOMB") {
G4VPhysicalVolume* VertexVolume;
do {
vertex = gen_->GenerateVertex("VOLUME");
G4ThreeVector glob_vtx(vertex);
glob_vtx = glob_vtx + G4ThreeVector(0, 0, -GetELzCoord());
VertexVolume = geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
} while (VertexVolume->GetName() != region);
}
else {
G4Exception("[Honeycomb]", "GenerateVertex()", FatalException,
"Unknown vertex generation region!");
}

return vertex;
}
}
8 changes: 8 additions & 0 deletions source/geometries/Honeycomb.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

#include "GeometryBase.h"

#include <G4Navigator.hh>

namespace nexus {
class CylinderPointSampler2020;

class Honeycomb: public GeometryBase
{
public:
Expand Down Expand Up @@ -43,6 +47,10 @@ namespace nexus {
// Relationships among beams
G4double angle_, beam_dist_, beam_thickn_;
G4double compl_angle_;

CylinderPointSampler2020* gen_;

G4Navigator* geom_navigator_;
};

inline void Honeycomb::SetMotherLogicalVolume(G4LogicalVolume* mother_logic) {
Expand Down
1 change: 1 addition & 0 deletions source/geometries/HoneycombBeam.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class G4Trd;

namespace nexus {

class HoneycombBeam: public GeometryBase
{
public:
Expand Down
3 changes: 2 additions & 1 deletion source/geometries/Next100.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ namespace nexus {
(region == "FIELD_RING") ||
(region == "GATE_RING") ||
(region == "ANODE_RING") ||
(region == "RING_HOLDER")) {
(region == "RING_HOLDER") ||
(region == "HONEYCOMB")) {
vertex = inner_elements_->GenerateVertex(region);
}

Expand Down
6 changes: 5 additions & 1 deletion source/geometries/Next100InnerElements.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace nexus {

// Honeycomb support structure for EP
honeycomb_->SetMotherLogicalVolume(mother_logic_);
//honeycomb_->SetELzCoord(gate_zpos);
honeycomb_->SetELzCoord(gate_zpos);
honeycomb_->SetEndOfCopperPlateZ(energy_plane_->GetCopperPlateEndZ());
honeycomb_->Construct();

Expand Down Expand Up @@ -129,6 +129,10 @@ namespace nexus {
(region == "PMT_BASE")) {
vertex = energy_plane_->GenerateVertex(region);
}
// Honeycomb region
else if (region == "HONEYCOMB") {
vertex = honeycomb_->GenerateVertex(region);
}
// Tracking Plane regions
else if ((region == "TP_COPPER_PLATE") ||
(region == "SIPM_BOARD") ||
Expand Down

0 comments on commit 56fe968

Please sign in to comment.