19#include "BDSBeamPipeFactoryBase.hh"
20#include "BDSBeamPipeFactoryLHCDetailed.hh"
21#include "BDSBeamPipe.hh"
22#include "BDSColours.hh"
23#include "BDSExtent.hh"
24#include "BDSGlobalConstants.hh"
25#include "BDSMaterials.hh"
26#include "BDSSDType.hh"
30#include "G4CutTubs.hh"
31#include "G4IntersectionSolid.hh"
32#include "G4LogicalVolume.hh"
33#include "G4Material.hh"
34#include "G4PVPlacement.hh"
35#include "G4SubtractionSolid.hh"
36#include "G4ThreeVector.hh"
38#include "G4VisAttributes.hh"
45BDSBeamPipeFactoryLHCDetailed::BDSBeamPipeFactoryLHCDetailed()
48 coolingPipeThickness = 0.53*CLHEP::mm;
49 coolingPipeRadius = 3.7*CLHEP::mm*0.5;
51 copperSkinThickness = 75*CLHEP::um;
58 BDSBeamPipeFactoryBase::CleanUp();
63 copperSkinSolid =
nullptr;
64 screenSolid =
nullptr;
65 coolingPipeSolid =
nullptr;
66 copperSkinLV =
nullptr;
68 coolingPipeLV =
nullptr;
69 copperSkinPV =
nullptr;
71 coolingPipeTopPV =
nullptr;
72 coolingPipeBottomPV =
nullptr;
82 cuOuterRadius = 0, cuOuterBoxX = 0, cuOuterBoxY = 0;
85 bsOuterRadius = 0, bsOuterBoxX = 0, bsOuterBoxY = 0;
102 return coolingPipeRadius + coolingPipeThickness + 2*
lengthSafety;
108 G4double beamPipeThickness,
118 cuInnerBoxX = vacBoxX + 1*CLHEP::um;
119 cuInnerBoxY = vacBoxY + 1*CLHEP::um;
121 cuOuterBoxX = cuInnerBoxX + copperSkinThickness;
122 cuOuterBoxY = cuInnerBoxY + copperSkinThickness;
126 bsInnerBoxX = cuOuterBoxX + 1*CLHEP::um;
127 bsInnerBoxY = cuOuterBoxY + 1*CLHEP::um;
129 bsOuterBoxX = bsInnerBoxX + beamPipeThickness;
130 bsOuterBoxY = bsInnerBoxY + beamPipeThickness;
141 halfLength = length*0.5 - 1*CLHEP::um;
144 G4double fullWidthOfCoolingPipe = coolingPipeRadius + coolingPipeThickness + 1*CLHEP::um;
156 G4double valueToCompare;
158 {valueToCompare = bsOuterBoxX;}
160 {valueToCompare = bsInnerBoxY;}
162 G4double gapForCoolingPipe = std::abs(
cbInnerRadius - valueToCompare);
163 if (gapForCoolingPipe < fullWidthOfCoolingPipe + 1*CLHEP::um)
174 G4Material* vacuumMaterial,
175 G4double beamPipeThickness,
176 G4Material* beamPipeMaterial,
191 G4VSolid* vacCylSolid =
new G4Tubs(name +
"_vacuum_cylinder",
198 G4VSolid* vacRectSolid =
new G4Box(name +
"_vacuum_box",
202 allSolids.insert(vacCylSolid);
203 allSolids.insert(vacRectSolid);
206 vacuumSolid =
new G4IntersectionSolid(name +
"_vacuum_solid",
213 G4VSolid* cuInnerCylSolid =
new G4Tubs(name +
"_cu_inner_cylinder",
220 G4VSolid* cuInnerRectSolid =
new G4Box(name +
"_cu_inner_box",
225 G4VSolid* cuInnerSolid =
new G4IntersectionSolid(name +
"_cu_inner_solid",
231 G4VSolid* cuOuterCylSolid =
new G4Tubs(name +
"_cu_outer_cylinder",
238 G4VSolid* cuOuterRectSolid =
new G4Box(name +
"_cu_outer_box",
242 G4VSolid* cuOuterSolid =
new G4IntersectionSolid(name +
"_cu_outer_solid",
245 copperSkinSolid =
new G4SubtractionSolid(name +
"_copper_skin_solid",
248 allSolids.insert(cuInnerCylSolid);
249 allSolids.insert(cuInnerRectSolid);
250 allSolids.insert(cuInnerSolid);
251 allSolids.insert(cuOuterCylSolid);
252 allSolids.insert(cuOuterRectSolid);
253 allSolids.insert(cuOuterSolid);
254 allSolids.insert(copperSkinSolid);
259 G4VSolid* screenInnerCylSolid =
new G4Tubs(name +
"_screen_inner_cylinder",
267 G4VSolid* screenInnerRectSolid =
new G4Box(name +
"_screen_inner_box",
272 G4VSolid* screenInnerSolid =
new G4IntersectionSolid(name +
"_screen_inner_solid",
274 screenInnerRectSolid);
277 G4VSolid* screenOuterCylSolid =
new G4Tubs(name +
"_screen_outer_cylinder",
284 G4VSolid* screenOuterRectSolid =
new G4Box(name +
"_screen_outer_box",
288 G4VSolid* screenOuterSolid =
new G4IntersectionSolid(name +
"_screen__outersolid",
290 screenOuterRectSolid);
291 screenSolid =
new G4SubtractionSolid(name +
"_screen_solid",
294 allSolids.insert(screenInnerCylSolid);
295 allSolids.insert(screenInnerRectSolid);
296 allSolids.insert(screenInnerSolid);
297 allSolids.insert(screenOuterCylSolid);
298 allSolids.insert(screenOuterRectSolid);
299 allSolids.insert(screenOuterSolid);
300 allSolids.insert(screenSolid);
304 coolingPipeSolid =
new G4Tubs(name +
"_cooling_pipe_solid",
306 coolingPipeRadius + coolingPipeThickness,
311 allSolids.insert(coolingPipeSolid);
315 beamPipeSolid =
new G4Tubs(name +
"_beampipe_solid",
324 containerSolid =
new G4Tubs(name +
"_container_cylinder",
344 const G4ThreeVector& inputFaceNormalIn,
345 const G4ThreeVector& outputFaceNormalIn,
350 G4Material* vacuumMaterial,
351 G4double beamPipeThickness,
352 G4Material* beamPipeMaterial,
373 G4Material* vacuumMaterial,
374 G4Material* beamPipeMaterial,
379 beamPipeMaterial, length);
400 G4Material* vacuumMaterialIn,
401 G4Material* beamPipeMaterialIn)
408 copperSkinLV =
new G4LogicalVolume(copperSkinSolid,
410 name +
"_copper_lv");
412 screenLV =
new G4LogicalVolume(screenSolid,
414 name +
"_screen_lv");
418 coolingPipeLV =
new G4LogicalVolume(coolingPipeSolid,
420 name +
"_cooling_pipe_lv");
421 allLogicalVolumes.insert(coolingPipeLV);
423 allLogicalVolumes.insert(copperSkinLV);
424 allLogicalVolumes.insert(screenLV);
432 G4VisAttributes* cuVisAttr =
new G4VisAttributes(*
BDSColours::Instance()->GetColour(
"LHCcopperskin"));
434 cuVisAttr->SetVisibility(
true);
435 allVisAttributes.insert(cuVisAttr);
438 G4VisAttributes* pipeVisAttr =
new G4VisAttributes(*
BDSColours::Instance()->GetColour(
"beampipe"));
439 pipeVisAttr->SetVisibility(
true);
441 allVisAttributes.insert(pipeVisAttr);
443 copperSkinLV->SetVisAttributes(cuVisAttr);
444 screenLV->SetVisAttributes(pipeVisAttr);
446 {coolingPipeLV->SetVisAttributes(pipeVisAttr);}
454 auto ul = vacuumLV->GetUserLimits();
456 copperSkinLV->SetUserLimits(ul);
457 screenLV->SetUserLimits(ul);
459 {coolingPipeLV->SetUserLimits(ul);}
466 copperSkinPV =
new G4PVPlacement(
nullptr,
469 name +
"_copper_skin_pv",
475 screenPV =
new G4PVPlacement(
nullptr,
484 allPhysicalVolumes.insert(copperSkinPV);
485 allPhysicalVolumes.insert(screenPV);
489 G4ThreeVector coolingPipeTopPosition;
490 G4ThreeVector coolingPipeBottomPosition;
502 coolingPipeTopPV =
new G4PVPlacement(
nullptr,
503 coolingPipeTopPosition,
505 name +
"_cooling_pipe_top_pv",
511 coolingPipeBottomPV =
new G4PVPlacement(
nullptr,
512 coolingPipeBottomPosition,
514 name +
"_cooling_pipe_bottom_pv",
520 allPhysicalVolumes.insert(coolingPipeTopPV);
521 allPhysicalVolumes.insert(coolingPipeBottomPV);
529 const G4ThreeVector& inputface,
530 const G4ThreeVector& outputface)
534 G4VSolid* vacCylSolid =
new G4CutTubs(name +
"_vacuum_cylinder",
543 G4VSolid* vacRectSolid =
new G4Box(name +
"_vacuum_box",
548 vacuumSolid =
new G4IntersectionSolid(name +
"_vacuum_solid",
551 allSolids.insert(vacCylSolid);
552 allSolids.insert(vacRectSolid);
556 G4VSolid* cuInnerCylSolid =
new G4CutTubs(name +
"_cu_inner_cylinder",
565 G4VSolid* cuInnerRectSolid =
new G4Box(name +
"_cu_inner_box",
570 G4VSolid* cuInnerSolid =
new G4IntersectionSolid(name +
"_cu_inner_solid",
575 G4VSolid* cuOuterCylSolid =
new G4CutTubs(name +
"_cu_outer_cylinder",
584 G4VSolid* cuOuterRectSolid =
new G4Box(name +
"_cu_outer_box",
588 G4VSolid* cuOuterSolid =
new G4IntersectionSolid(name +
"_cu_outer_solid",
591 copperSkinSolid =
new G4SubtractionSolid(name +
"_copper_skin_solid",
594 allSolids.insert(cuInnerCylSolid);
595 allSolids.insert(cuInnerRectSolid);
596 allSolids.insert(cuInnerSolid);
597 allSolids.insert(cuOuterCylSolid);
598 allSolids.insert(cuOuterRectSolid);
599 allSolids.insert(cuOuterSolid);
600 allSolids.insert(copperSkinSolid);
604 G4VSolid* screenInnerCylSolid =
new G4CutTubs(name +
"_screen_inner_cylinder",
613 G4VSolid* screenInnerRectSolid =
new G4Box(name +
"_screen_inner_box",
618 G4VSolid* screenInnerSolid =
new G4IntersectionSolid(name +
"_screen_inner_solid",
620 screenInnerRectSolid);
623 G4VSolid* screenOuterCylSolid =
new G4CutTubs(name +
"_screen_outer_cylinder",
632 G4VSolid* screenOuterRectSolid =
new G4Box(name +
"_screen_outer_box",
636 G4VSolid* screenOuterSolid =
new G4IntersectionSolid(name +
"_pipe_outer_solid",
638 screenOuterRectSolid);
640 screenSolid =
new G4SubtractionSolid(name +
"_screen_solid",
644 allSolids.insert(screenInnerCylSolid);
645 allSolids.insert(screenInnerRectSolid);
646 allSolids.insert(screenInnerSolid);
647 allSolids.insert(screenOuterCylSolid);
648 allSolids.insert(screenOuterRectSolid);
649 allSolids.insert(screenOuterSolid);
650 allSolids.insert(screenSolid);
654 coolingPipeSolid =
new G4CutTubs(name +
"_cooling_pipe_solid",
656 coolingPipeRadius + coolingPipeThickness,
663 allSolids.insert(coolingPipeSolid);
667 beamPipeSolid =
new G4CutTubs(name +
"_beampipe_solid",
678 containerSolid =
new G4CutTubs(name +
"_container_cylinder",
virtual void SetVisAttributes(G4Material *beamPipeMaterialIn)
Set visual attributes.
G4ThreeVector outputFaceNormal
For recording the face normals in the finished pipe component.
virtual void BuildLogicalVolumes(const G4String &nameIn, G4Material *vacuumMaterialIn, G4Material *beamPipeMaterialIn)
build logical volumes
G4ThreeVector inputFaceNormal
For recording the face normals in the finished pipe component.
void CommonConstruction(const G4String &nameIn, G4Material *vacuumMaterialIn, G4Material *beamPipeMaterialIn, G4double length)
finalise beampipe construction
BDSBeamPipe * BuildBeamPipeAndRegisterVolumes(BDSExtent extent, G4double containerRadius, G4bool containerIsCircular=false)
build beampipe and register logical volumes
virtual void PlaceComponents(const G4String &nameIn)
Place volumes.
G4bool sensitiveBeamPipe
Whether the beam pipe will record energy deposition.
G4VSolid * containerSubtractionSolid
Longer (in length) version of container solid for unambiguous subtraction.
virtual void SetUserLimits(G4double length)
Set user limits.
G4double GetFullWidthOfCoolingPipe()
Access cooling pipe information from factory for parameter tests.
virtual void SetVisAttributes(G4Material *beamPipeMaterialIn)
Set visual attributes.
void InitialiseGeometricalParameters()
Utility function to initialise the geometry parameters.
BDSBeamPipe * CommonFinalConstruction(const G4String &name, G4Material *vacuumMaterial, G4Material *beamPipeMaterial, G4double length, G4double containerRadius)
G4bool buildCoolingPipe
Whether to build the cooling pipes on either side.
virtual void BuildLogicalVolumes(const G4String &nameIn, G4Material *vacuumMaterialIn, G4Material *beamPipeMaterialIn)
build logical volumes
G4double cbInnerRadius
Cold bore geometrical parameters.
G4double vacHalfLength
General length variable (to avoid mistakes)
G4double coolingPipeOffset
Cooling pipe geometrical parameters.
virtual void PlaceComponents(const G4String &nameIn)
Place volumes.
G4double containerRadius
Container geometrical parameters.
G4double coldBoreThickness
Parameters that control the design.
virtual BDSBeamPipe * CreateBeamPipe(const G4String &nameIn, G4double lengthIn, G4double aper1=0, G4double aper2=0, G4double aper3=0, G4double aper4=0, G4Material *vacuumMaterialIn=nullptr, G4double beamPipeThicknessIn=0, G4Material *beamPipeMaterialIn=nullptr, const G4String &pointsFileIn="", const G4String &pointsUnitIn="")
create a flat ended beampipe
G4double cuInnerRadius
Copper skin geometrical parameters.
G4double bsInnerRadius
Beam screen geometrical parameters.
G4bool verticalOrientation
virtual void CleanUp()
Clean up extra pointers particular to this factory before use.
G4double CreateGeneralAngledSolids(const G4String &name, G4double length, const G4ThreeVector &inputface, const G4ThreeVector &outputface)
virtual void SetUserLimits(G4double length)
Set user limits.
void CleanUpLHCDetailed()
void CalculateGeometricalParameters(G4double aper1, G4double aper2, G4double aper3, G4double beamPipeThickness, G4double length)
A holder class for a piece of beam pipe geometry.
static BDSColours * Instance()
singleton pattern
Holder for +- extents in 3 dimensions.
G4bool checkOverlaps
Cache of global constants variable.
G4double nSegmentsPerCircle
Cache of global constants variable.
G4double lengthSafety
Cache of global constants variable.
void RegisterSensitiveVolume(G4LogicalVolume *sensitiveVolume, BDSSDType sensitivityType)
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.