7 #include <G4Material.hh> 8 #include <G4LogicalVolume.hh> 9 #include <G4VPhysicalVolume.hh> 10 #include <G4PVPlacement.hh> 11 #include <G4VisAttributes.hh> 13 #include <G4SystemOfUnits.hh> 14 #include <G4PhysicalConstants.hh> 16 #include <G4Polyhedra.hh> 36 =
new G4UIcmdWithADoubleAndUnit(
CommandName(
"size"),
this);
37 fSizeCMD->SetGuidance(
"Set the PMT size.");
38 fSizeCMD->SetParameterName(
"size",
false);
39 fSizeCMD->SetUnitCategory(
"Length");
41 fBaseLengthCMD =
new G4UIcmdWithADoubleAndUnit(
43 fBaseLengthCMD->SetGuidance(
"Set the PMT base length.");
44 fBaseLengthCMD->SetParameterName(
"length",
false);
45 fBaseLengthCMD->SetUnitCategory(
"Length");
47 fRoundCMD =
new G4UIcmdWithABool(
49 fRoundCMD->SetGuidance(
"Flag that the PMT is round.");
60 fBuilder->
SetSize(fSizeCMD->GetNewDoubleValue(val));
62 else if (cmd==fBaseLengthCMD) {
63 fBuilder->
SetBaseLength(fBaseLengthCMD->GetNewDoubleValue(val));
65 else if (cmd==fRoundCMD) {
66 fBuilder->
SetRound(fRoundCMD->GetNewBoolValue(val));
84 const double glassThickness = 3*
CLHEP::mm;
86 G4LogicalVolume* logVolume
87 =
new G4LogicalVolume(
new G4Tubs(GetName(),
91 FindMaterial(
"Glass"),
93 logVolume->SetVisAttributes(GetColor(logVolume));
96 std::string namePhotoCathode = GetName() +
"/PhotoCathode";
97 G4LogicalVolume* logPhotoCathode
98 =
new G4LogicalVolume(
new G4Tubs(namePhotoCathode,
102 FindMaterial(
"Glass"),
104 logPhotoCathode->SetVisAttributes(GetColor(logPhotoCathode));
107 new G4PVPlacement(NULL,
109 GetBaseLength()/2.0 - glassThickness/2.0),
111 logPhotoCathode->GetName(),
119 G4LogicalVolume* logPMTVoid
120 =
new G4LogicalVolume(
new G4Tubs(namePMTVoid,
121 0.0, GetSize()/2.0-glassThickness,
122 GetBaseLength()/2.0-glassThickness,
126 logPMTVoid->SetVisAttributes(GetColor(logPMTVoid));
129 new G4PVPlacement(NULL,
130 G4ThreeVector(0,0,0),
132 logPMTVoid->GetName(),
void SetNewValue(G4UIcommand *cmd, G4String val)
void SetNewValue(G4UIcommand *cmd, G4String val)
G4UIcmdWithABool * fRoundCMD
void SetRound(bool v)
Set that the PMT is round.
Construct a module from components.
BuilderMessenger(EDepSim::Builder *c, const char *guide=NULL)
virtual ~CaptPMTBuilder()
CaptPMTBuilder * fBuilder
virtual G4LogicalVolume * GetPiece(void)
static constexpr double mm
void SetBaseLength(double v)
static constexpr double degree
G4UIcmdWithADoubleAndUnit * fSizeCMD
G4String CommandName(G4String cmd)
Build a command name with the directory prefix.
virtual ~CaptPMTMessenger()
G4UIcmdWithADoubleAndUnit * fBaseLengthCMD
CaptPMTMessenger(CaptPMTBuilder *c)