Skip to content

Commit

Permalink
Fix line length and indentation in PMT class
Browse files Browse the repository at this point in the history
  • Loading branch information
paolafer committed Jan 18, 2024
1 parent 1e50a7c commit c005a2f
Showing 1 changed file with 63 additions and 53 deletions.
116 changes: 63 additions & 53 deletions source/geometries/PmtR11410.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include <G4OpticalSurface.hh>
#include <G4GenericMessenger.hh>

#include <CLHEP/Units/SystemOfUnits.h>

namespace nexus {

using namespace CLHEP;
Expand All @@ -51,7 +49,8 @@ namespace nexus {
msg_ = new G4GenericMessenger(this, "/Geometry/PmtR11410/",
"Control commands of PmtR11410 geometry.");

msg_->DeclareProperty("visibility", visibility_, "Hamamatsu R11410 PMTs visibility");
msg_->DeclareProperty("visibility", visibility_,
"Hamamatsu R11410 PMTs visibility");

G4GenericMessenger::Command& bin_cmd =
msg_->DeclareProperty("time_binning", binning_,
Expand Down Expand Up @@ -95,22 +94,27 @@ namespace nexus {
G4double front_body_gas_diam = front_body_diam_ - 2. * body_thickness_;
G4double front_body_gas_length = front_body_length_ - body_thickness_;
G4Tubs* front_body_gas_solid =
new G4Tubs("FRONT_BODY_GAS", 0., front_body_gas_diam/2., front_body_gas_length/2., 0., twopi);
new G4Tubs("FRONT_BODY_GAS", 0., front_body_gas_diam/2.,
front_body_gas_length/2., 0., twopi);

G4double rear_body_gas_diam = rear_body_diam_ - 2. * body_thickness_;
G4double rear_body_gas_length = rear_body_length_;
G4Tubs* rear_body_gas_solid =
new G4Tubs("REAR_BODY_GAS", 0., rear_body_gas_diam/2., rear_body_gas_length/2., 0., twopi);
new G4Tubs("REAR_BODY_GAS", 0., rear_body_gas_diam/2.,
rear_body_gas_length/2., 0., twopi);

// Union of the two volumes of the phototube body gas
G4double z_gas_transl = -front_body_gas_length/2. - rear_body_gas_length/2.;
G4ThreeVector gas_transl(0., 0., z_gas_transl);
G4UnionSolid* pmt_gas_solid = new G4UnionSolid("PMT_GAS", front_body_gas_solid,
rear_body_gas_solid, 0, gas_transl);
G4UnionSolid* pmt_gas_solid =
new G4UnionSolid("PMT_GAS", front_body_gas_solid,
rear_body_gas_solid, 0, gas_transl);

G4Material* pmt_gas_mat = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
G4Material* pmt_gas_mat =
G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
pmt_gas_mat->SetMaterialPropertiesTable(new G4MaterialPropertiesTable());
G4LogicalVolume* pmt_gas_logic = new G4LogicalVolume(pmt_gas_solid, pmt_gas_mat, "PMT_GAS");
G4LogicalVolume* pmt_gas_logic =
new G4LogicalVolume(pmt_gas_solid, pmt_gas_mat, "PMT_GAS");

G4double pmt_gas_posz = body_thickness_/2.;
new G4PVPlacement(0, G4ThreeVector(0., 0., pmt_gas_posz), pmt_gas_logic,
Expand All @@ -121,11 +125,13 @@ namespace nexus {

window_diam_ = front_body_gas_diam;
G4Tubs* window_solid =
new G4Tubs("PMT_WINDOW", 0, window_diam_/2., window_thickness_/2., 0., twopi);
new G4Tubs("PMT_WINDOW", 0, window_diam_/2., window_thickness_/2.,
0., twopi);

G4Material* silica = materials::FusedSilica();
silica->SetMaterialPropertiesTable(opticalprops::FusedSilica());
G4LogicalVolume* window_logic = new G4LogicalVolume(window_solid, silica, "PMT_WINDOW");
G4LogicalVolume* window_logic =
new G4LogicalVolume(window_solid, silica, "PMT_WINDOW");

G4double window_posz = front_body_gas_length/2. - window_thickness_/2.;
new G4PVPlacement(0, G4ThreeVector(0.,0.,window_posz), window_logic,
Expand All @@ -135,21 +141,25 @@ namespace nexus {
// PMT PHOTOCATHODE /////////////////////////////////////////////

G4Tubs* photocathode_solid =
new G4Tubs("PMT_PHOTOCATHODE", 0, photocathode_diam_/2., photocathode_thickness_/2.,
0., twopi);
new G4Tubs("PMT_PHOTOCATHODE", 0, photocathode_diam_/2.,
photocathode_thickness_/2., 0., twopi);

G4Material* aluminum = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
G4Material* aluminum =
G4NistManager::Instance()->FindOrBuildMaterial("G4_Al");
aluminum->SetMaterialPropertiesTable(new G4MaterialPropertiesTable());
G4LogicalVolume* photocathode_logic =
new G4LogicalVolume(photocathode_solid, aluminum, "PMT_PHOTOCATHODE");

G4double photocathode_posz = window_posz - window_thickness_/2. - photocathode_thickness_/2.;
new G4PVPlacement(0, G4ThreeVector(0., 0., photocathode_posz), photocathode_logic,
"PMT_PHOTOCATHODE", pmt_gas_logic, false, 0);
G4double photocathode_posz =
window_posz - window_thickness_/2. - photocathode_thickness_/2.;
new G4PVPlacement(0, G4ThreeVector(0., 0., photocathode_posz),
photocathode_logic, "PMT_PHOTOCATHODE", pmt_gas_logic,
false, 0);

// Optical properties
G4OpticalSurface* pmt_opt_surf = GetPhotOptSurf();
new G4LogicalSkinSurface("PMT_PHOTOCATHODE", photocathode_logic, pmt_opt_surf);
new G4LogicalSkinSurface("PMT_PHOTOCATHODE", photocathode_logic,
pmt_opt_surf);

// Sensitive detector
SensorSD* pmtsd = new SensorSD("/PMT_R11410/PmtR11410");
Expand Down Expand Up @@ -184,44 +194,45 @@ namespace nexus {
G4double rear_body_irad = rear_body_diam_/2. - body_thickness_;

front_body_gen_ =
new CylinderPointSampler(front_body_irad, front_body_length_, body_thickness_, 0.,
new CylinderPointSampler(front_body_irad, front_body_length_,
body_thickness_, 0.,
G4ThreeVector (0., 0., 0.));

medium_body_gen_ =
new CylinderPointSampler(rear_body_diam_/2., body_thickness_,
front_body_irad - rear_body_diam_/2., 0.,
G4ThreeVector(0., 0., -front_body_length_/2. + body_thickness_/2.));
G4ThreeVector(0., 0., -front_body_length_/2. +
body_thickness_/2.));

rear_body_gen_ =
new CylinderPointSampler(rear_body_irad, rear_body_length_ + body_thickness_,
body_thickness_, 0., G4ThreeVector(0., 0.,
-front_body_length_/2.
- rear_body_length_/2.
+ body_thickness_/2.));
new CylinderPointSampler(rear_body_irad, rear_body_length_ +
body_thickness_, body_thickness_, 0.,
G4ThreeVector(0., 0., -front_body_length_/2.
- rear_body_length_/2.
+ body_thickness_/2.));

rear_cap_gen_ =
new CylinderPointSampler(rear_body_irad, body_thickness_, 0., 0.,
G4ThreeVector (0., 0., -front_body_length_/2.
- rear_body_length_ + body_thickness_/2.));
- rear_body_length_ +
body_thickness_/2.));

///Front cap of the pmt: frame+window+photocathode
front_cap_gen_ =
new CylinderPointSampler(front_body_irad, window_thickness_ + photocathode_thickness_,
0., 0., G4ThreeVector (0., 0.,
front_body_length_/2.
- window_thickness_/2.
- photocathode_thickness_/2.));
new CylinderPointSampler(front_body_irad,
window_thickness_ + photocathode_thickness_,
0., 0., G4ThreeVector(0., 0.,
front_body_length_/2.
- window_thickness_/2.
- photocathode_thickness_/2.));

// Getting the enclosure body volume over total
G4double front_body_vol =
front_body_length_ * pi * ((front_body_diam_/2.)*(front_body_diam_/2.)
- front_body_irad*front_body_irad);
front_body_length_ * pi * ((front_body_diam_/2.)*(front_body_diam_/2.) - front_body_irad*front_body_irad);
G4double medium_body_vol =
body_thickness_ * pi * (front_body_irad*front_body_irad
- (rear_body_diam_/2.)*(rear_body_diam_/2.));
body_thickness_ * pi * (front_body_irad*front_body_irad - (rear_body_diam_/2.)*(rear_body_diam_/2.));
G4double rear_body_vol =
(rear_body_length_+body_thickness_) * pi * ((rear_body_diam_/2.)*(rear_body_diam_/2.)
- rear_body_irad*rear_body_irad);
(rear_body_length_+body_thickness_) * pi * ((rear_body_diam_/2.)*(rear_body_diam_/2.) - rear_body_irad*rear_body_irad);
G4double rear_cap_vol = body_thickness_ * pi * rear_body_irad*rear_body_irad;
G4double front_cap_vol =
(window_thickness_ + photocathode_thickness_) * pi * front_body_irad*front_body_irad;
Expand Down Expand Up @@ -300,21 +311,21 @@ namespace nexus {
{
const G4int entries = 57;
G4double ENERGIES[entries] =
{ 2.06640321682 *eV, 2.10142700016 *eV, 2.13765850016 *eV, 2.17516128086 *eV,
2.21400344659 *eV, 2.25425805471 *eV, 2.29600357425 *eV, 2.3393243964 *eV,
2.38431140402 *eV, 2.43106260802 *eV, 2.47968386018 *eV, 2.53028965325 *eV,
2.58300402103 *eV, 2.63796155339 *eV, 2.69530854368 *eV, 2.75520428909 *eV,
2.81782256839 *eV, 2.8833533258 *eV, 2.95200459546 *eV, 3.02400470754 *eV,
3.09960482523 *eV, 3.17908187203 *eV, 3.2627419213 *eV, 3.35092413538 *eV,
3.44400536137 *eV, 3.54240551455 *eV, 3.64659391204 *eV, 3.75709675786 *eV,
3.87450603154 *eV, 3.99949009707 *eV, 4.13280643364 *eV, 4.27531700032 *eV,
4.42800689319 *eV, 4.59200714849 *eV, 4.76862280805 *eV, 4.95936772037 *eV,
5.16600804205 *eV, 5.39061708736 *eV, 5.63564513678 *eV, 5.90400919092 *eV,
6.19920965046 *eV, 6.358163744063561 *eV, 6.525483842591549 *eV, 6.7018482707697 *eV,
6.888010722735524 *eV, 7.084811029099397 *eV, 7.293187824072908 *eV, 7.314701652462505 *eV,
7.336342781611801 *eV, 7.358112344761985 *eV, 7.380011488645204 *eV, 7.402041373685937 *eV,
7.424203174205955 *eV, 7.446498078633 *eV, 7.4689272897132195 *eV, 7.491492024727459 *eV,
7.51419351571 *eV};
{ 2.06640321682*eV, 2.10142700016*eV, 2.13765850016*eV, 2.17516128086*eV,
2.21400344659*eV, 2.25425805471*eV, 2.29600357425*eV, 2.3393243964*eV,
2.38431140402*eV, 2.43106260802*eV, 2.47968386018*eV, 2.53028965325*eV,
2.58300402103*eV, 2.63796155339*eV, 2.69530854368*eV, 2.75520428909*eV,
2.81782256839*eV, 2.8833533258*eV, 2.95200459546*eV, 3.02400470754*eV,
3.09960482523*eV, 3.17908187203*eV, 3.2627419213*eV, 3.35092413538*eV,
3.44400536137*eV, 3.54240551455*eV, 3.64659391204*eV, 3.75709675786*eV,
3.87450603154*eV, 3.99949009707*eV, 4.13280643364*eV, 4.27531700032*eV,
4.42800689319*eV, 4.59200714849*eV, 4.76862280805*eV, 4.95936772037*eV,
5.16600804205*eV, 5.39061708736*eV, 5.63564513678*eV, 5.90400919092*eV,
6.19920965046*eV, 6.35816374406*eV, 6.52548384259*eV, 6.70184827077*eV,
6.88801072274*eV, 7.08481102910*eV, 7.29318782407*eV, 7.31470165246*eV,
7.33634278161*eV, 7.35811234476*eV, 7.38001148864*eV, 7.40204137369*eV,
7.42420317421*eV, 7.44649807863*eV, 7.46892728971*eV, 7.49149202473*eV,
7.51419351571*eV };

G4double EFFICIENCY[entries] =
{ 0.0530, 0.0625, 0.0720, 0.0850,
Expand All @@ -325,7 +336,6 @@ namespace nexus {
0.3320, 0.3400, 0.3480, 0.3500,
0.3530, 0.3600, 0.3680, 0.3650,
0.3640, 0.3640, 0.3560, 0.3420,

0.3280, 0.3180, 0.3050, 0.2980,
0.2920, 0.2900, 0.2920, 0.2945,
0.3100, 0.3280, 0.3560, 0.3880,
Expand Down

0 comments on commit c005a2f

Please sign in to comment.