Skip to content

Commit

Permalink
Merge pull request #222 from paolafer/fc-displacement
Browse files Browse the repository at this point in the history
FC displacement
  • Loading branch information
paolafer authored Jan 15, 2024
2 parents 67568a9 + a1279f5 commit 4f4fa8a
Show file tree
Hide file tree
Showing 19 changed files with 369 additions and 259 deletions.
24 changes: 12 additions & 12 deletions source/geometries/GeometryBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ namespace nexus {
/// Returns the 3 dimensions of the geometry (x, y, z)
G4ThreeVector GetDimensions();

/// Returns true if geometry has a drift field
G4bool GetDrift() const;

// Getter for the starting point of EL generation in z
G4double GetELzCoord() const;

/// Setter for the starting point of EL generation in z
void SetELzCoord(G4double z);

/// Getter for the origin of coordinates
G4ThreeVector GetCoordOrigin() const;

/// Setter for the origin of coordinates
void SetCoordOrigin(G4ThreeVector origin);

/// Translates position to G4 global position
void CalculateGlobalPos(G4ThreeVector& vertex) const;

Expand All @@ -72,9 +75,6 @@ namespace nexus {
/// Sets the span (maximum dimension) of the geometry
void SetSpan(G4double);

/// Sets the drift variable to true if a drift field exists
void SetDrift(G4bool);

/// Sets the 3 dimensions of the geometry (x, y, z)
void SetDimensions(G4ThreeVector dim);

Expand All @@ -88,14 +88,14 @@ namespace nexus {
G4LogicalVolume* logicVol_; ///< Pointer to the logical volume
G4double span_; ///< Maximum dimension of the geometry
G4ThreeVector dimensions_; ///< XYZ dimensions of a regular geometry
G4bool drift_; ///< True if geometry contains a drift field (for hit coordinates)
G4double el_z_; ///< Starting point of EL generation in z
G4ThreeVector coord_origin_; ///< Origin of coordinates of the mother volume
};


// Inline definitions ///////////////////////////////////

inline GeometryBase::GeometryBase(): logicVol_(0), span_(25.*m), drift_(false), el_z_(0.*mm) {}
inline GeometryBase::GeometryBase(): logicVol_(0), span_(25.*m), el_z_(0.*mm), coord_origin_(G4ThreeVector(0., 0., 0.)) {}

inline GeometryBase::~GeometryBase() {}

Expand All @@ -121,14 +121,14 @@ namespace nexus {

inline G4ThreeVector GeometryBase::GetDimensions() { return dimensions_; }

inline void GeometryBase::SetDrift(G4bool drift) { drift_ = drift; }

inline G4bool GeometryBase::GetDrift() const { return drift_; }

inline G4double GeometryBase::GetELzCoord() const {return el_z_;}

inline void GeometryBase::SetELzCoord(G4double z) {el_z_ = z;}

inline G4ThreeVector GeometryBase::GetCoordOrigin() const {return coord_origin_;}

inline void GeometryBase::SetCoordOrigin(G4ThreeVector origin) {coord_origin_ = origin;}

// This methods is to be used only in the Next1EL and NEW geometries
inline void GeometryBase::CalculateGlobalPos(G4ThreeVector& vertex) const
{
Expand Down
57 changes: 41 additions & 16 deletions source/geometries/Next100.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ namespace nexus {
gate_tracking_plane_distance_(25. * mm + grid_thickness_), // Jordi = 1.5 (distance TP plate-anode ring) + 13.5 (anode ring thickness) + 10 (EL gap)
gate_sapphire_wdw_distance_ (1458.8 * mm - grid_thickness_), // Jordi
ics_ep_lip_width_ (55. * mm), // length of the step cut out in the ICS, in the EP side
fc_displ_x_ (-3.7 * mm), // displacement of the field cage volumes from 0
fc_displ_y_ (-6.4 * mm), // displacement of the field cage volumes from 0

specific_vertex_{},
lab_walls_(false)
lab_walls_(false),
print_(false)
{

msg_ = new G4GenericMessenger(this, "/Geometry/Next100/",
Expand All @@ -54,7 +57,9 @@ namespace nexus {
msg_->DeclarePropertyWithUnit("specific_vertex", "mm", specific_vertex_,
"Set generation vertex.");

msg_->DeclareProperty("lab_walls", lab_walls_, "Placement of Hall A walls");
msg_->DeclareProperty("lab_walls", lab_walls_, "Placement of Hall A walls.");

msg_->DeclareProperty("print_sipms", print_, "Print SiPM positions.");

// The following methods must be invoked in this particular
// order since some of them depend on the previous ones
Expand Down Expand Up @@ -121,7 +126,11 @@ namespace nexus {
this->SetLogicalVolume(lab_logic_);

// VESSEL (initialize first since it defines EL position)
// The z coord origin is not set, because it is not defined, yet
vessel_->SetELtoTPdistance(gate_tracking_plane_distance_);
vessel_->SetCoordOrigin(G4ThreeVector(fc_displ_x_,
fc_displ_y_,
0.));
vessel_->Construct();
G4LogicalVolume* vessel_logic = vessel_->GetLogicalVolume();
G4LogicalVolume* vessel_internal_logic =
Expand All @@ -130,56 +139,73 @@ namespace nexus {
vessel_->GetInternalPhysicalVolume();
G4ThreeVector vessel_displacement =
shielding_->GetAirDisplacement(); // explained below
gate_zpos_in_vessel_ = vessel_->GetELzCoord();

coord_origin_ = G4ThreeVector(fc_displ_x_, fc_displ_y_, vessel_->GetGateZpos());

// SHIELDING
shielding_->SetCoordOrigin(coord_origin_);
shielding_->Construct();
shielding_->SetELzCoord(gate_zpos_in_vessel_);
G4LogicalVolume* shielding_logic = shielding_->GetLogicalVolume();
G4LogicalVolume* shielding_air_logic = shielding_->GetAirLogicalVolume();

// Recall that airbox is slighly displaced in Y dimension. In order to avoid
// mistmatch with vertex generators, we place the vessel i
// n the center of the world volume
// Recall that air box is slightly displaced in Y dimension.
// In order to avoid mistmatch with vertex generators,
// we place the vessel in the center of the world volume
new G4PVPlacement(0, -vessel_displacement, vessel_logic,
"VESSEL", shielding_air_logic, false, 0);

// INNER ELEMENTS
inner_elements_->SetLogicalVolume(vessel_internal_logic);
inner_elements_->SetPhysicalVolume(vessel_internal_phys);
inner_elements_->SetELzCoord(gate_zpos_in_vessel_);
inner_elements_->SetCoordOrigin(coord_origin_);
inner_elements_->SetELtoSapphireWDWdistance(gate_sapphire_wdw_distance_);
inner_elements_->SetELtoTPdistance (gate_tracking_plane_distance_);
inner_elements_->Construct();

// INNER COPPER SHIELDING
ics_->SetLogicalVolume(vessel_internal_logic);
ics_->SetELzCoord(gate_zpos_in_vessel_);
ics_->SetCoordOrigin(coord_origin_);
ics_->SetELtoSapphireWDWdistance(gate_sapphire_wdw_distance_);
ics_->SetELtoTPdistance (gate_tracking_plane_distance_);
ics_->SetPortZpositions(vessel_->GetPortZpositions());
ics_->Construct();

G4ThreeVector gate_pos(0., 0., -gate_zpos_in_vessel_);
if (lab_walls_){
G4ThreeVector castle_pos(0., hallA_walls_->GetLSCHallACastleY(),
hallA_walls_->GetLSCHallACastleZ());

new G4PVPlacement(0, castle_pos, shielding_logic,
"LEAD_BOX", hallA_logic_, false, 0);
new G4PVPlacement(0, gate_pos - castle_pos, hallA_logic_,
new G4PVPlacement(0, -coord_origin_ - castle_pos, hallA_logic_,
"Hall_A", lab_logic_, false, 0, false);
}
else {
new G4PVPlacement(0, gate_pos, shielding_logic, "LEAD_BOX", lab_logic_,
false, 0);
new G4PVPlacement(0, -coord_origin_, shielding_logic,
"LEAD_BOX", lab_logic_, false, 0);
}

if (print_) {
std::vector<G4ThreeVector> sipm_pos = inner_elements_->GetSiPMPosInGas();
G4int n_sipm = 0;
G4int b = 1;
for (unsigned int i=0; i<sipm_pos.size(); i++) {
G4ThreeVector pos = sipm_pos[i] - coord_origin_;;
G4int id = 1000 * b + n_sipm;
G4cout << "SiPM " << id << ": " << pos.x() << ", "<< pos.y() << G4endl;
n_sipm++;
if (id % 1000 == 63) {
n_sipm = 0;
b++;
}
}
}

//// VERTEX GENERATORS
lab_gen_ =
new BoxPointSampler(lab_size_ - 1.*m, lab_size_ - 1.*m,
lab_size_ - 1.*m, 1.*m,
G4ThreeVector(0., 0., 0.), 0);

}


Expand Down Expand Up @@ -265,8 +291,7 @@ namespace nexus {
"Unknown vertex generation region!");
}

G4ThreeVector displacement = G4ThreeVector(0., 0., -gate_zpos_in_vessel_);
vertex = vertex + displacement;
vertex = vertex - coord_origin_;

return vertex;
}
Expand All @@ -293,7 +318,7 @@ namespace nexus {
"Unknown vertex generation region!");
}

return vertex + G4ThreeVector(0., 0., -gate_zpos_in_vessel_);
return vertex - coord_origin_;
}

} //end namespace nexus
8 changes: 6 additions & 2 deletions source/geometries/Next100.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace nexus {
const G4double gate_tracking_plane_distance_, gate_sapphire_wdw_distance_;
const G4double ics_ep_lip_width_ ; ///< width of step of the ICS bars in the
/// energy plane side
const G4double fc_displ_x_, fc_displ_y_;

// Pointers to logical volumes
G4LogicalVolume* lab_logic_;
Expand All @@ -80,11 +81,14 @@ namespace nexus {
/// Specific vertex for AD_HOC region
G4ThreeVector specific_vertex_;

/// Position of gate in its mother volume
G4double gate_zpos_in_vessel_;
/// Origin of coordinates
G4ThreeVector coord_origin_;

/// Whether or not to build LSC HallA.
G4bool lab_walls_;

/// Whether or not to print SiPM positions
G4bool print_;
};

} // end namespace nexus
Expand Down
9 changes: 5 additions & 4 deletions source/geometries/Next100EnergyPlane.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace nexus {
hut_hole_length_ (45. * mm),
hut_length_long_ (120.* mm),
hut_length_medium_(100.* mm),
hut_length_short_ (60. * mm),
hut_length_short_ (60. * mm - 1 * mm), // 60 from drawings, subtraction needed to solve small overlap
last_hut_long_ (17),
last_hut_medium_ (35),

Expand Down Expand Up @@ -207,7 +207,8 @@ namespace nexus {
G4double stand_out_length =
sapphire_window_thickn_ + tpb_thickn_ + optical_pad_thickn_ + pmt_stand_out_;

copper_plate_posz_ = GetELzCoord() + gate_sapphire_wdw_dist_ + stand_out_length + copper_plate_thickn_/2.;
copper_plate_posz_ = GetCoordOrigin().z()
+ gate_sapphire_wdw_dist_ + stand_out_length + copper_plate_thickn_/2.;

new G4PVPlacement(0, G4ThreeVector(0., 0., copper_plate_posz_), copper_plate_logic,
"EP_COPPER_PLATE", mother_logic_, false, 0, false);
Expand Down Expand Up @@ -414,7 +415,7 @@ namespace nexus {
do {
vertex = copper_gen_->GenerateVertex("VOLUME");
G4ThreeVector glob_vtx(vertex);
glob_vtx = glob_vtx + G4ThreeVector(0, 0, -GetELzCoord());
glob_vtx = glob_vtx - GetCoordOrigin();
VertexVolume = geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
} while (VertexVolume->GetName() != region);
}
Expand All @@ -430,7 +431,7 @@ namespace nexus {
G4double z_translation = vacuum_posz_;
vertex.setZ(vertex.z() + z_translation);
G4ThreeVector glob_vtx(vertex);
glob_vtx = glob_vtx + G4ThreeVector(0, 0, -GetELzCoord());
glob_vtx = glob_vtx - GetCoordOrigin();
VertexVolume = geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
} while (VertexVolume->GetName() != region);
}
Expand Down
Loading

0 comments on commit 4f4fa8a

Please sign in to comment.