Skip to content

Commit

Permalink
More line, comma and capital letters fixings
Browse files Browse the repository at this point in the history
  • Loading branch information
paolafer committed Jan 29, 2024
1 parent e5866f2 commit 77cf9a4
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 145 deletions.
12 changes: 6 additions & 6 deletions source/actions/MuonsEventAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ REGISTER_CLASS(MuonsEventAction, G4UserEventAction)
fG4AnalysisMan_ = G4AnalysisManager::Instance();

// Create histogram(s) for muons
fG4AnalysisMan_->CreateH1("Edepo","Energy_deposited",100,-1.0,3.4);
fG4AnalysisMan_->CreateH1("Zenith","Zenith generated",100,0.,pi);
fG4AnalysisMan_->CreateH1("Azimuth","Azimuth generated",100,0.,twopi);
fG4AnalysisMan_->CreateH1("Edepo", "Energy_deposited", 100, -1.0, 3.4);
fG4AnalysisMan_->CreateH1("Zenith", "Zenith generated", 100, 0., pi);
fG4AnalysisMan_->CreateH1("Azimuth", "Azimuth generated", 100, 0., twopi);

// Create Ntuple branches for muons
fG4AnalysisMan_->CreateNtuple("Tree nexus","Flat tree of muon zenith and azimuth");
fG4AnalysisMan_->CreateNtuple("Tree nexus", "Flat tree of muon zenith and azimuth");
fG4AnalysisMan_->CreateNtupleDColumn("tree_zenith");
fG4AnalysisMan_->CreateNtupleDColumn("tree_azimuth");
fG4AnalysisMan_->FinishNtuple();
Expand Down Expand Up @@ -122,8 +122,8 @@ REGISTER_CLASS(MuonsEventAction, G4UserEventAction)

// Retrieving muon generation information
G4PrimaryVertex* my_vertex = event->GetPrimaryVertex();
G4VUserPrimaryVertexInformation *getinfo2 = my_vertex->GetUserInformation();
AddUserInfoToPV *my_getinfo2 = dynamic_cast<AddUserInfoToPV*>(getinfo2);
G4VUserPrimaryVertexInformation* getinfo2 = my_vertex->GetUserInformation();
AddUserInfoToPV* my_getinfo2 = dynamic_cast<AddUserInfoToPV*>(getinfo2);

G4double my_zenith = my_getinfo2->GetZenith();
G4double my_azimuth = my_getinfo2->GetAzimuth();
Expand Down
10 changes: 4 additions & 6 deletions source/actions/SaveAllSteppingAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ kill_after_selection_(false)

msg_->DeclareMethod("select_particle",
&SaveAllSteppingAction::AddSelectedParticle,
"add a new particle to select");
"Add a new particle to select");

msg_->DeclareMethod("select_volume",
&SaveAllSteppingAction::AddSelectedVolume,
"add a new volume to select");
msg_->DeclareMethod("select_volume", &SaveAllSteppingAction::AddSelectedVolume,
"Add a new volume to select");

msg_->DeclareProperty("kill_after_selection",
kill_after_selection_,
msg_->DeclareProperty("kill_after_selection", kill_after_selection_,
"Whether to kill a particle after a step has been selected");

PersistencyManager* pm = dynamic_cast<PersistencyManager*>
Expand Down
3 changes: 1 addition & 2 deletions source/generators/LambertianGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ void LambertianGenerator::SetParticleDefinition(G4String particle_name)
void LambertianGenerator::GeneratePrimaryVertex(G4Event* event)
{
// Generate uniform random energy in [E_min, E_max]
G4double kinetic_energy =
nexus::UniformRandomInRange(energy_max_, energy_min_);
G4double kinetic_energy = nexus::UniformRandomInRange(energy_max_, energy_min_);

// Calculate cartesian components of momentum
G4double mass = particle_definition_->GetPDGMass();
Expand Down
3 changes: 1 addition & 2 deletions source/generators/MuonGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ void MuonGenerator::GeneratePrimaryVertex(G4Event* event)

// Load in the Muon angular distribution from file
if (use_lsc_dist_){
std::cout << "[MuonGenerator]: Generating muons using "
"lsc distribution loaded from file" << std::endl;
std::cout << "[MuonGenerator]: Generating muons using lsc distribution loaded from file" << std::endl;
LoadMuonDistribution();

// Throw exception if a user dir given
Expand Down
4 changes: 1 addition & 3 deletions source/geometries/Next100.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ namespace nexus {
G4ThreeVector vessel_displacement =
shielding_->GetAirDisplacement(); // explained below

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

// SHIELDING
shielding_->SetCoordOrigin(coord_origin_);
Expand Down Expand Up @@ -197,7 +196,6 @@ namespace nexus {
}
}
}

}


Expand Down
27 changes: 9 additions & 18 deletions source/geometries/Next100EnergyPlane.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,13 @@ namespace nexus {
hole_length_front_ + pmt_stand_out_ + optical_pad_thickn_
+ sapphire_window_thickn_ + tpb_thickn_;
G4Tubs* vacuum_front_solid =
new G4Tubs("HOLE_FRONT", 0., hole_diam_front_/2., vacuum_front_length/2.,
0., twopi);
new G4Tubs("HOLE_FRONT", 0., hole_diam_front_/2., vacuum_front_length/2., 0., twopi);

G4Tubs* vacuum_rear_solid =
new G4Tubs("HOLE_REAR", 0., hole_diam_rear_/2.,
(hole_length_rear_+offset)/2., 0., twopi);
new G4Tubs("HOLE_REAR", 0., hole_diam_rear_/2., (hole_length_rear_+offset)/2., 0., twopi);

G4Tubs* vacuum_hut_solid =
new G4Tubs("HOLE_HUT", 0., hut_int_diam_/2., hut_hole_length_/2.,
0., twopi);
new G4Tubs("HOLE_HUT", 0., hut_int_diam_/2., hut_hole_length_/2., 0., twopi);

G4UnionSolid* vacuum_solid =
new G4UnionSolid("EP_HOLE", vacuum_front_solid, vacuum_rear_solid, 0,
Expand All @@ -258,8 +255,7 @@ namespace nexus {
new G4UnionSolid("EP_HOLE", vacuum_solid, vacuum_hut_solid, 0,
G4ThreeVector(0., 0., vacuum_front_length/2.+hole_length_rear_+hut_hole_length_/2.));

G4LogicalVolume* vacuum_logic =
new G4LogicalVolume(vacuum_solid, vacuum, "EP_HOLE");
G4LogicalVolume* vacuum_logic = new G4LogicalVolume(vacuum_solid, vacuum, "EP_HOLE");

/// Sapphire window ///
G4Tubs* sapphire_window_solid =
Expand All @@ -269,8 +265,7 @@ namespace nexus {
G4LogicalVolume* sapphire_window_logic
= new G4LogicalVolume(sapphire_window_solid, sapphire, "SAPPHIRE_WINDOW");

G4double window_posz =
-vacuum_front_length/2. + (sapphire_window_thickn_ + tpb_thickn_)/2.;
G4double window_posz = -vacuum_front_length/2. + (sapphire_window_thickn_ + tpb_thickn_)/2.;

G4VPhysicalVolume* sapphire_window_phys =
new G4PVPlacement(0, G4ThreeVector(0., 0., window_posz),
Expand All @@ -282,8 +277,7 @@ namespace nexus {
new G4Tubs("SAPPHIRE_WDW_TPB", 0., hole_diam_front_/2, tpb_thickn_/2.,
0., twopi);

G4LogicalVolume* tpb_logic =
new G4LogicalVolume(tpb_solid, tpb, "SAPPHIRE_WDW_TPB");
G4LogicalVolume* tpb_logic = new G4LogicalVolume(tpb_solid, tpb, "SAPPHIRE_WDW_TPB");

G4double tpb_posz = - (sapphire_window_thickn_ + tpb_thickn_)/2. + tpb_thickn_/2.;

Expand Down Expand Up @@ -340,8 +334,7 @@ namespace nexus {
G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON"),
"PMT_BASE");

G4double pmt_base_posz =
vacuum_front_length/2. + hole_length_rear_ + hut_hole_length_/2.;
G4double pmt_base_posz = vacuum_front_length/2. + hole_length_rear_ + hut_hole_length_/2.;

G4VPhysicalVolume* pmt_base_phys =
new G4PVPlacement(0, G4ThreeVector(0., 0., pmt_base_posz),
Expand Down Expand Up @@ -445,8 +438,7 @@ namespace nexus {
vertex = copper_gen_->GenerateVertex("VOLUME");
G4ThreeVector glob_vtx(vertex);
glob_vtx = glob_vtx - GetCoordOrigin();
VertexVolume =
geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
VertexVolume = geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
} while (VertexVolume->GetName() != region);
}

Expand All @@ -462,8 +454,7 @@ namespace nexus {
vertex.setZ(vertex.z() + z_translation);
G4ThreeVector glob_vtx(vertex);
glob_vtx = glob_vtx - GetCoordOrigin();
VertexVolume =
geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
VertexVolume = geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
} while (VertexVolume->GetName() != region);
}

Expand Down
36 changes: 12 additions & 24 deletions source/geometries/Next100FieldCage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ Next100FieldCage::Next100FieldCage(G4double grid_thickn):
msg_ = new G4GenericMessenger(this, "/Geometry/Next100/",
"Control commands of geometry Next100.");
msg_->DeclareProperty("field_cage_vis", visibility_, "Field Cage Visibility");
msg_->DeclareProperty("field_cage_verbosity", verbosity_,
"Field Cage Verbosity");
msg_->DeclareProperty("field_cage_verbosity", verbosity_, "Field Cage Verbosity");

G4GenericMessenger::Command& drift_transv_diff_cmd =
msg_->DeclareProperty("drift_transv_diff", drift_transv_diff_,
Expand Down Expand Up @@ -291,8 +290,7 @@ void Next100FieldCage::BuildActive()
G4double router[2] = {active_diam_/2., active_diam_/2.};

G4Polyhedra* active_solid =
new G4Polyhedra("ACTIVE_TEFLON", 0., twopi, n_panels_, 2, zplane,
rinner, router);
new G4Polyhedra("ACTIVE_TEFLON", 0., twopi, n_panels_, 2, zplane, rinner, router);

// This volume is added as an extension of the active volume that reaches the gate grid.
G4Tubs* active_gate_solid =
Expand Down Expand Up @@ -425,12 +423,10 @@ void Next100FieldCage::BuildCathode()

void Next100FieldCage::BuildBuffer()
{
G4double buffer_zpos =
active_zpos_ + active_length_/2. + grid_thickn_ + buffer_length_/2.;
G4double buffer_zpos = active_zpos_ + active_length_/2. + grid_thickn_ + buffer_length_/2.;

/// Position of z planes
G4double zplane[2] =
{-buffer_length_/2. - grid_thickn_ + cathode_thickn_, buffer_length_/2.};
G4double zplane[2] = {-buffer_length_/2. - grid_thickn_ + cathode_thickn_, buffer_length_/2.};
/// Inner radius
G4double rinner[2] = {0., 0.};
/// Outer radius
Expand Down Expand Up @@ -533,8 +529,7 @@ void Next100FieldCage::BuildELRegion()
G4LogicalVolume* anode_logic =
new G4LogicalVolume(anode_solid, steel_, "ANODE_RING");

G4double anode_sim_zpos =
el_gap_zpos_ - el_gap_length_/2. - anode_ring_thickn/2.;
G4double anode_sim_zpos = el_gap_zpos_ - el_gap_length_/2. - anode_ring_thickn/2.;
new G4PVPlacement(0, G4ThreeVector(0., 0., anode_sim_zpos),
anode_logic, "ANODE_RING", mother_logic_, false, 0, false);

Expand Down Expand Up @@ -663,8 +658,7 @@ void Next100FieldCage::BuildLightTube()
tpb_drift_logic, "DRIFT_TPB", teflon_drift_logic, false, 0, false);

/// BUFFER PART ///
G4double zplane_buff[2] =
{-teflon_buffer_length_/2., teflon_buffer_length_/2.};
G4double zplane_buff[2] = {-teflon_buffer_length_/2., teflon_buffer_length_/2.};
G4double router_buff[2] =
{(active_diam_ + 2.*teflon_thickn_)/2., (active_diam_ + 2.*teflon_thickn_)/2.};

Expand Down Expand Up @@ -715,8 +709,7 @@ void Next100FieldCage::BuildLightTube()
tpb_buffer_phys, gas_tpb_teflon_surf);

// Vertex generator
G4double teflon_ext_radius =
(active_diam_ + 2.*teflon_thickn_)/2. / cos(pi/n_panels_);
G4double teflon_ext_radius = (active_diam_ + 2.*teflon_thickn_)/2. / cos(pi/n_panels_);
G4double teflon_zpos = GetCoordOrigin().z() + gate_sapphire_wdw_dist_/2.;
teflon_gen_ =
new CylinderPointSampler2020(active_diam_/2., teflon_ext_radius,
Expand Down Expand Up @@ -748,15 +741,13 @@ void Next100FieldCage::BuildFieldCage()
// HDPE cylinder.
// It is placed in such a way that it ends at the same z
// as the teflon buffer reflector, in the side of the EP.
G4double hdpe_tube_z_pos =
teflon_buffer_zpos_ - (hdpe_length_ - teflon_buffer_length_)/2.;
G4double hdpe_tube_z_pos = teflon_buffer_zpos_ - (hdpe_length_ - teflon_buffer_length_)/2.;

G4Tubs* hdpe_tube_solid =
new G4Tubs("HDPE_TUBE", hdpe_tube_int_diam_/2., hdpe_tube_ext_diam_/2.,
hdpe_length_/2., 0, twopi);

G4LogicalVolume* hdpe_tube_logic =
new G4LogicalVolume(hdpe_tube_solid, hdpe_, "HDPE_TUBE");
G4LogicalVolume* hdpe_tube_logic = new G4LogicalVolume(hdpe_tube_solid, hdpe_, "HDPE_TUBE");

new G4PVPlacement(0, G4ThreeVector(GetCoordOrigin().x(),
GetCoordOrigin().y(), hdpe_tube_z_pos),
Expand Down Expand Up @@ -802,10 +793,8 @@ void Next100FieldCage::BuildFieldCage()
}

// Ring vertex generator
G4double ring_gen_length =
first_ring_buff_z_pos + ring_thickn_/2. - (posz - ring_thickn_/2.);
G4double ring_gen_zpos =
first_ring_buff_z_pos + ring_thickn_/2. - ring_gen_length/2.;
G4double ring_gen_length = first_ring_buff_z_pos + ring_thickn_/2. - (posz - ring_thickn_/2.);
G4double ring_gen_zpos = first_ring_buff_z_pos + ring_thickn_/2. - ring_gen_length/2.;
ring_gen_ =
new CylinderPointSampler2020(ring_int_diam_/2., ring_ext_diam_/2.,
ring_gen_length/2., 0., twopi, nullptr,
Expand All @@ -817,8 +806,7 @@ void Next100FieldCage::BuildFieldCage()

// 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.
Next100Stave stave =
Next100Stave(ring_drift_buffer_dist_, num_drift_rings_, num_buffer_rings_);
Next100Stave stave = Next100Stave(ring_drift_buffer_dist_, num_drift_rings_, num_buffer_rings_);
stave.Construct();
G4LogicalVolume* stave_logic = stave.GetLogicalVolume();

Expand Down
50 changes: 18 additions & 32 deletions source/geometries/Next100Ics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ namespace nexus {
geom_navigator_ = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();

/// Messenger
msg_ = new G4GenericMessenger(this, "/Geometry/Next100/",
"Control commands of geometry Next100.");
msg_ = new G4GenericMessenger(this, "/Geometry/Next100/", "Control commands of geometry Next100.");
msg_->DeclareProperty("ics_vis", visibility_, "ICS Visibility");

}
Expand Down Expand Up @@ -91,24 +90,20 @@ namespace nexus {


ics_solid =
new G4SubtractionSolid("ICS", ics_body, port_hole_solid,
port_a_Rot, G4ThreeVector(port_x, port_y,
port_z_1a_-ics_z_pos));
new G4SubtractionSolid("ICS", ics_body, port_hole_solid, port_a_Rot,
G4ThreeVector(port_x, port_y, port_z_1a_-ics_z_pos));

ics_solid =
new G4SubtractionSolid("ICS", ics_solid, port_hole_solid,
port_a_Rot, G4ThreeVector(port_x, port_y,
port_z_2a_-ics_z_pos));
new G4SubtractionSolid("ICS", ics_solid, port_hole_solid, port_a_Rot,
G4ThreeVector(port_x, port_y, port_z_2a_-ics_z_pos));

ics_solid =
new G4SubtractionSolid("ICS", ics_solid, port_hole_solid,
port_b_Rot, G4ThreeVector(-port_x, port_y,
port_z_1b_-ics_z_pos));
new G4SubtractionSolid("ICS", ics_solid, port_hole_solid, port_b_Rot,
G4ThreeVector(-port_x, port_y, port_z_1b_-ics_z_pos));

ics_solid =
new G4SubtractionSolid("ICS", ics_solid, port_hole_solid,
port_b_Rot, G4ThreeVector(-port_x, port_y,
port_z_2b_-ics_z_pos));
new G4SubtractionSolid("ICS", ics_solid, port_hole_solid, port_b_Rot,
G4ThreeVector(-port_x, port_y, port_z_2b_-ics_z_pos));

/// Upper holes
// z distances measured with respect to TP plate, ie the start of ICS
Expand All @@ -127,18 +122,14 @@ namespace nexus {
ics_solid =
new G4SubtractionSolid("ICS", ics_solid, upp_hole_solid_1,
port_upp_Rot,
G4ThreeVector(0, (in_rad_ + thickness_/2.),
upp_hole_1_z-length/2.));
G4ThreeVector(0, (in_rad_ + thickness_/2.), upp_hole_1_z-length/2.));

G4Tubs* upp_hole_solid_2 =
new G4Tubs("UPP_HOLE", 0., upp_hole_2_rad,
(thickness_ + offset)/2., 0.*deg, 360.*deg);
new G4Tubs("UPP_HOLE", 0., upp_hole_2_rad, (thickness_ + offset)/2., 0.*deg, 360.*deg);

ics_solid =
new G4SubtractionSolid("ICS", ics_solid, upp_hole_solid_2,
port_upp_Rot,
G4ThreeVector(0, (in_rad_ + thickness_/2.),
upp_hole_2_z-length/2.));
new G4SubtractionSolid("ICS", ics_solid, upp_hole_solid_2, port_upp_Rot,
G4ThreeVector(0, (in_rad_ + thickness_/2.), upp_hole_2_z-length/2.));

/// Lateral holes (also known as feedthrough holes)
G4double lat_hole_rad = upp_hole_1_rad;
Expand All @@ -151,13 +142,11 @@ namespace nexus {

ics_solid =
new G4SubtractionSolid("ICS", ics_solid, lat_hole_solid,
port_a_Rot, G4ThreeVector(port_x, port_y,
lat_hole_z_1-length/2.));
port_a_Rot, G4ThreeVector(port_x, port_y, lat_hole_z_1-length/2.));

ics_solid =
new G4SubtractionSolid("ICS", ics_solid, lat_hole_solid,
port_b_Rot, G4ThreeVector(-port_x, port_y,
lat_hole_z_2-length/2.));
port_b_Rot, G4ThreeVector(-port_x, port_y, lat_hole_z_2-length/2.));


/// ICS step at the TP end.
Expand All @@ -170,8 +159,7 @@ namespace nexus {

ics_solid =
new G4SubtractionSolid("ICS", ics_solid, tp_step_solid, 0,
G4ThreeVector(0., 0.,
-length/2. + (step_length - offset)/2.));
G4ThreeVector(0., 0., -length/2. + (step_length - offset)/2.));

/// ICS lip at the EP end.
// It is necessary to avoid clashing with the internal part
Expand All @@ -183,8 +171,7 @@ namespace nexus {

ics_solid =
new G4SubtractionSolid("ICS", ics_solid, ep_lip_solid, 0,
G4ThreeVector(0., 0., length/2. -
(ics_ep_lip_width_ - offset)/2.));
G4ThreeVector(0., 0., length/2. - (ics_ep_lip_width_ - offset)/2.));

G4LogicalVolume* ics_logic =
new G4LogicalVolume(ics_solid,
Expand Down Expand Up @@ -229,8 +216,7 @@ namespace nexus {

G4ThreeVector glob_vtx(vertex);
glob_vtx = glob_vtx - GetCoordOrigin();
VertexVolume =
geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
VertexVolume = geom_navigator_->LocateGlobalPointAndSetup(glob_vtx, 0, false);
} while (VertexVolume->GetName() != "ICS");
}

Expand Down
Loading

0 comments on commit 77cf9a4

Please sign in to comment.