BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSScreenFrameRectangular.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "BDSGlobalConstants.hh"
19#include "BDSMaterials.hh"
20#include "BDSScreenFrameRectangular.hh"
21
22#include "globals.hh"
23#include "G4Box.hh"
24#include "G4LogicalVolume.hh"
25#include "G4PVPlacement.hh"
26#include "G4SubtractionSolid.hh"
27#include "G4RotationMatrix.hh"
28#include "G4ThreeVector.hh"
29#include "G4TwoVector.hh"
30
31
33 G4ThreeVector sizeIn,
34 G4TwoVector windowSizeIn,
35 G4TwoVector windowOffsetIn,
36 G4Material* materialIn):
37 BDSScreenFrame(nameIn, sizeIn, windowSizeIn, windowOffsetIn, materialIn),
38 zeroRot(new G4RotationMatrix(0,0,0))
39{
40 Build();
41}
42
43BDSScreenFrameRectangular::~BDSScreenFrameRectangular()
44{
45 delete zeroRot;
46}
47
49{
50 G4double lenSaf = BDSGlobalConstants::Instance()->LengthSafety();
51 //G4double tinyLenSaf = 1e-3*CLHEP::nm;
52
53 G4Box* frameBox = new G4Box("frameBox",
54 size.x()/2.0,
55 size.y()/2.0,
56 size.z()/2.0);
57
58
59 G4Box* windowBox = new G4Box("windowBox",
60 windowSize.x()/2.0 + lenSaf,
61 windowSize.y()/2.0 + lenSaf,
62 size.z()/2.0 + lenSaf); // must be thicker than frame.
63
64 cavityPos = G4ThreeVector(windowOffset.x(), windowOffset.y(), 0);
65 G4SubtractionSolid* frameSS = new G4SubtractionSolid((G4String)"frameSS", frameBox, windowBox, zeroRot, cavityPos);
66 logVol = new G4LogicalVolume(frameSS, material, name+"_lv");
67 SetVisAtts();
68}
69
70void BDSScreenFrameRectangular::Place(G4RotationMatrix* rot,
71 G4ThreeVector pos,
72 G4LogicalVolume* motherVol)
73{
74 new G4PVPlacement(rot,
75 pos,
76 logVol,
77 "screenFrame_pv",
78 motherVol,
79 false,
80 0,
82
83}
84
static BDSGlobalConstants * Instance()
Access method.
virtual void SetVisAtts()
Set the visual attributes to member logVol.
void Place(G4RotationMatrix *rot, G4ThreeVector pos, G4LogicalVolume *motherVol)
Place member logVol (from base class) into argument motherVol.
virtual void Build()
Construct the geometry.
BDSScreenFrameRectangular()=delete
Remove default constructor to force use of supplied one.
A frame for the vacuum window in e.g. BDSMultilayerScreen.
G4bool checkOverlaps
Cache of checking overlaps from global constants.
virtual void SetVisAtts()
Set the visual attributes to member logVol.