BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSScreen.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 "BDSMultilayerScreen.hh"
19#include "BDSScreen.hh"
20#include "BDSScreenLayer.hh"
21#include "BDSSDType.hh"
22
23#include "globals.hh"
24#include "G4Colour.hh"
25#include "G4RotationMatrix.hh"
26#include "G4VisAttributes.hh"
27
28#include <list>
29#include <sstream>
30
31BDSScreen::BDSScreen(G4String nameIn,
32 G4double chordLengthIn,
33 BDSBeamPipeInfo* beamPipeInfoIn,
34 G4TwoVector sizeIn, //X Y dimensions of screen
35 G4double screenAngleIn):
36 BDSDrift(nameIn, chordLengthIn, beamPipeInfoIn),
37 size(sizeIn),
38 screenAngle(screenAngleIn),
39 screenPos(G4ThreeVector()),
40 nLayers(0)
41{
42 mlScreen = new BDSMultilayerScreen(size, nameIn+"_mlscreen");
43
44 screenRot = new G4RotationMatrix();
45 screenRot->rotateY(screenAngle);
46}
47
48BDSScreen::~BDSScreen()
49{
50 delete screenRot;
51 delete mlScreen;
52}
53
55{
56 BDSDrift::Build(); //Build the beam pipe geometry.
57
58 // Make the beam pipe wireframe
59 G4VisAttributes* VisAtt1 = new G4VisAttributes(G4Colour(0.4, 0.4, 0.4, 0.3));
60 VisAtt1->SetForceWireframe(true);
61 VisAtt1->SetVisibility(true);
62 containerLogicalVolume->SetVisAttributes(VisAtt1);
63
64 PlaceScreen(); //Place the screen in the beam pipe
65}
66
67void BDSScreen::AddScreenLayer(G4double thickness, G4String material, G4int isSampler)
68{
69 std::stringstream ss;
70 ss << nLayers;
71 G4String lNum = ss.str();
72 G4String lName = name+"_"+lNum;
73 mlScreen->AddScreenLayer(thickness,material,lName, isSampler);
74 if(!isSampler && sensitiveOuter)
75 {RegisterSensitiveVolume(mlScreen->LastLayer()->GetLog(), BDSSDType::energydep);}
76 nLayers++;
77}
78
79void BDSScreen::PlaceScreen()
80{
81 mlScreen->Build();//Build the screen.
82 G4LogicalVolume* vacuumLV = *(GetAcceleratorVacuumLogicalVolumes().begin());
83 mlScreen->Place(screenRot, screenPos, vacuumLV); //Place the screen in the beampipe centre.
84}
const G4String name
Const protected member variable that may not be changed by derived classes.
static G4bool sensitiveOuter
Useful variable often used in construction.
virtual std::set< G4LogicalVolume * > GetAcceleratorVacuumLogicalVolumes() const
Access the 'vacuum' volume(s) in this component if any. Default is empty set.
Holder class for all information required to describe a beam pipe model.
A piece of vacuum beam pipe.
Definition BDSDrift.hh:38
virtual void Build()
Construct geometry.
Definition BDSDrift.cc:36
void RegisterSensitiveVolume(G4LogicalVolume *sensitiveVolume, BDSSDType sensitivityType)
An accelerator component for diagnostics screens e.g. OTR. Screen inside beam pipe.
void AddScreenLayer(G4double thickness, G4String material, G4String name, G4int isSampler=0, G4double grooveWidth=0, G4double grooveSpatialFrequency=0)
Construct and add a screen layer.
virtual void Place(G4RotationMatrix *rot, const G4ThreeVector &pos, G4LogicalVolume *motherVol)
Place the member logical volume 'log' with a given transform in a given mother volume.
void Build()
Construct container, compute dimensions then place layers.
BDSScreenLayer * LastLayer() const
Get the last layer of the screen.
G4LogicalVolume * GetLog() const
Accessor.
virtual void Build()
Construct geometry.
Definition BDSScreen.cc:54
void AddScreenLayer(G4double thickness, G4String material, G4int isSampler=0)
Add a screen layer.
Definition BDSScreen.cc:67