BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSSampler.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 "BDSBeamPipe.hh"
19#include "BDSGlobalConstants.hh"
20#include "BDSMaterials.hh"
21#include "BDSSDManager.hh"
22#include "BDSSampler.hh"
23#include "BDSSDSampler.hh"
24
25#include "G4String.hh"
26#include "G4LogicalVolume.hh"
27
28BDSSampler::BDSSampler(const G4String& nameIn,
29 G4int filterSetIDIn):
30 BDSGeometryComponent(nullptr, nullptr),
31 name(nameIn),
32 filterSetID(filterSetIDIn)
33{;}
34
36{
37 containerLogicalVolume = new G4LogicalVolume(containerSolid, nullptr, GetName() + "_lv");
38 containerLogicalVolume->SetVisAttributes(BDSGlobalConstants::Instance()->VisibleDebugVisAttr());
40}
41
43{
44 auto sdMan = BDSSDManager::Instance();
45 BDSSDSampler* sd = filterSetID > -1 ? sdMan->SamplerPlaneWithFilter(filterSetID) : sdMan->SamplerPlane();
46 containerLogicalVolume->SetSensitiveDetector(sd);
47}
48
50{
51 if (containerLogicalVolume)
52 {containerLogicalVolume->SetMaterial(BDSMaterials::Instance()->GetMaterial("G4_Galactic"));}
53}
A generic geometry component for a bdsim model.
static BDSGlobalConstants * Instance()
Access method.
static BDSMaterials * Instance()
Singleton pattern access.
The sensitive detector class that provides sensitivity to BDSSampler instances.
void MakeMaterialValidForUseInMassWorld()
Definition BDSSampler.cc:49
virtual void CommonConstruction()
Definition BDSSampler.cc:35
virtual G4String GetName() const
Accessor.
Definition BDSSampler.hh:48
BDSSampler()=delete
No default constructor.
virtual void SetSensitivity()
Attach sensitive detector to containerLogicalVolume.
Definition BDSSampler.cc:42