BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSSamplerSphere.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 "BDSExtent.hh"
19#include "BDSSamplerSphere.hh"
20#include "BDSSDManager.hh"
21#include "BDSSDSamplerSphere.hh"
22
23#include "G4LogicalVolume.hh"
24#include "G4Sphere.hh"
25#include "G4String.hh"
26#include "G4Types.hh"
27
28#include "CLHEP/Units/SystemOfUnits.h"
29
30
31BDSSamplerSphere::BDSSamplerSphere(const G4String& nameIn,
32 G4double radiusIn,
33 G4double startAnglePhi,
34 G4double sweepAnglePhi,
35 G4double startAngleTheta,
36 G4double sweepAngleTheta,
37 G4int filterSetIDIn):
38 BDSSampler(nameIn, filterSetIDIn)
39{
40 G4double thickness = 1e-6 * radiusIn;
41 containerSolid = new G4Sphere(nameIn + "_solid", // name
42 radiusIn, // inner radius
43 radiusIn + thickness, // outer radius
44 startAnglePhi,
45 sweepAnglePhi,
46 startAngleTheta,
47 sweepAngleTheta);
48
49 SetExtent(BDSExtent(radiusIn, radiusIn, radiusIn));
50 CommonConstruction();
51}
52
54{
55 auto sdMan = BDSSDManager::Instance();
56 BDSSDSamplerSphere* sd = filterSetID > -1 ? sdMan->SamplerSphereWithFilter(filterSetID) : sdMan->SamplerSphere();
57 containerLogicalVolume->SetSensitiveDetector(sd);
58}
Holder for +- extents in 3 dimensions.
Definition BDSExtent.hh:38
The sensitive detector class that provides sensitivity to BDSSamplerSphere instances.
virtual void SetSensitivity()
Attach sensitive detector to containerLogicalVolume.
Base class and registry of sampler instances.
Definition BDSSampler.hh:35