BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSHistBinMapper.hh
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#ifndef BDSHISTBINMAPPER_H
20#define BDSHISTBINMAPPER_H
21
22#include "BDSBH4DTypeDefs.hh"
23#include "G4ThreeVector.hh"
24
32{
33public:
34 BDSHistBinMapper(G4int nBinsIIn,
35 G4int nBinsJIn,
36 G4int nBinsKIn,
37 G4int nBinsLIn);
38#ifdef USE_BOOST
39 BDSHistBinMapper(G4int nBinsIIn,
40 G4int nBinsJIn,
41 G4int nBinsKIn,
42 G4int nBinsLIn,
43 boost_histogram_axes_variant energyAxisIn);
44#endif
45
46 virtual ~BDSHistBinMapper(){;}
47
48 virtual G4int GlobalFromIJKLIndex(G4int iIndex,
49 G4int jIndex,
50 G4int kIndex,
51 G4int lIndex = 0) const;
52
53 virtual void IJKLFromGlobal(G4int globalBin,
54 G4int& iIndex,
55 G4int& jIndex,
56 G4int& kIndex,
57 G4int& lIndex) const;
58
59 inline G4double NBinsI() const {return nBinsI;}
60 inline G4double NBinsJ() const {return nBinsJ;}
61 inline G4double NBinsK() const {return nBinsK;}
62 inline G4double NBinsL() const {return nBinsL;}
63
64#ifdef USE_BOOST
65 inline boost_histogram_axes_variant GetEnergyAxis() const {return energyAxis;}
66#endif
67
68protected:
69 G4int nBinsI;
70 G4int nBinsJ;
71 G4int nBinsK;
72 G4int nBinsL;
73#ifdef USE_BOOST
74 boost_histogram_axes_variant energyAxis;
75#endif
76};
77
78#endif
Mapping from axis indices to 1D index.