BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSSampler.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "BDSBeamPipe.hh"
20#include "BDSGlobalConstants.hh"
21#include "BDSMaterials.hh"
22#include "BDSSDManager.hh"
23#include "BDSSampler.hh"
24#include "BDSSDSampler.hh"
25
26#include "G4String.hh"
27#include "G4LogicalVolume.hh"
28
29BDSSampler::BDSSampler(const G4String& nameIn,
30 G4int filterSetIDIn):
31 BDSGeometryComponent(nullptr, nullptr),
32 name(nameIn),
33 filterSetID(filterSetIDIn)
34{;}
35
37{
38 containerLogicalVolume = new G4LogicalVolume(containerSolid,
39 BDSMaterials::Instance()->GetMaterial("G4_Galactic"),
40 GetName() + "_lv");
41
42 containerLogicalVolume->SetVisAttributes(BDSGlobalConstants::Instance()->VisibleDebugVisAttr());
44}
45
47{
48 auto sdMan = BDSSDManager::Instance();
49 BDSSDSampler* sd = filterSetID > -1 ? sdMan->SamplerPlaneWithFilter(filterSetID) : sdMan->SamplerPlane();
50 containerLogicalVolume->SetSensitiveDetector(sd);
51}
A generic geometry component for a bdsim model.
static BDSGlobalConstants * Instance()
Access method.
static BDSMaterials * Instance()
Singleton pattern access.
Definition: BDSMaterials.cc:38
The sensitive detector class that provides sensitivity to BDSSampler instances.
Definition: BDSSDSampler.hh:44
virtual void CommonConstruction()
Definition: BDSSampler.cc:36
virtual G4String GetName() const
Accessor.
Definition: BDSSampler.hh:49
BDSSampler()=delete
No default constructor.
virtual void SetSensitivity()
Attach sensitive detector to containerLogicalVolume.
Definition: BDSSampler.cc:46