Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HnInformation.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26
27// Data class for the added Hn/Pn information (not available in g4tools).
28//
29// Author: Ivana Hrivnacova, 04/07/2012 ([email protected])
30
31#ifndef G4HnInformation_h
32#define G4HnInformation_h 1
33
34#include "globals.hh"
35#include "G4Fcn.hh"
36#include "G4BinScheme.hh"
37#include "G4AnalysisUtilities.hh"
38
39// The additional Hn information per dimension
40
42{
44 : fUnitName(),
45 fFcnName(),
46 fUnit(),
47 fFcn(nullptr),
49 {}
50
52 const G4String& unitName,
53 const G4String& fcnName,
54 G4double unit,
55 G4Fcn fcn,
56 G4BinScheme binScheme)
57 : fUnitName(unitName),
58 fFcnName(fcnName),
59 fUnit(unit),
60 fFcn(fcn),
61 fBinScheme(binScheme)
62 {}
63
65 : fUnitName(rhs.fUnitName),
66 fFcnName(rhs.fFcnName),
67 fUnit(rhs.fUnit),
68 fFcn(rhs.fFcn),
70 {}
71
73 {
74 // check assignment to self
75 if (this == &rhs) return *this;
76
77 fUnitName = rhs.fUnitName;
78 fFcnName = rhs.fFcnName;
79 fUnit = rhs.fUnit;
80 fFcn = rhs.fFcn;
82
83 return *this;
84 }
85
86 //G4String fName;
92};
93
95{
96 public:
97 G4HnInformation(const G4String& name, G4int nofDimensions)
98 : fName(name),
99 fHnDimensionInformations(),
100 fIsLogAxis({ false, false, false }),
101 fActivation(true),
102 fAscii(false),
103 fPlotting(false),
104 fFileName("") { fHnDimensionInformations.reserve(nofDimensions); }
105
106 // Deleted default constructor
107 G4HnInformation() = delete;
108
109 // Set methods
111 const G4HnDimensionInformation& hnDimensionInformation);
112 void AddDimension(
113 const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme);
114 void SetDimension(G4int dimension,
115 const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme);
116 void SetIsLogAxis(G4int axis, G4bool isLog);
117 void SetActivation(G4bool activation);
118 void SetAscii(G4bool ascii);
119 void SetPlotting(G4bool plotting);
120 void SetFileName(G4String fileName);
121
122 // Get methods
123 G4String GetName() const;
125 G4bool GetIsLogAxis(G4int axis) const;
126 G4bool GetActivation() const;
127 G4bool GetAscii() const;
128 G4bool GetPlotting() const;
129 G4String GetFileName() const;
130
131 private:
132 // Data members
133 G4String fName;
134 std::vector<G4HnDimensionInformation> fHnDimensionInformations;
135 std::vector<G4bool> fIsLogAxis;
136 G4bool fActivation;
137 G4bool fAscii;
138 G4bool fPlotting;
139 G4String fFileName;
140};
141
142// inline functions
143
145 const G4HnDimensionInformation& hnDimensionInformation)
146{ fHnDimensionInformations.push_back(hnDimensionInformation); }
147
149 const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme)
150{
151 auto unit = G4Analysis::GetUnitValue(unitName);
152 auto fcn = G4Analysis::GetFunction(fcnName);
153 fHnDimensionInformations.push_back(
154 G4HnDimensionInformation(unitName, fcnName, unit, fcn, binScheme));
155}
156
158 const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme)
159{
160 auto info = GetHnDimensionInformation(dimension);
161 auto unit = G4Analysis::GetUnitValue(unitName);
162 auto fcn = G4Analysis::GetFunction(fcnName);
163 info->fUnitName = unitName;
164 info->fFcnName = fcnName;
165 info->fUnit = unit;
166 info->fFcn = fcn;
167 info->fBinScheme = binScheme;
168}
169
171{ fIsLogAxis[axis] = isLog; }
172
174{ fActivation = activation; }
175
177{ fAscii = ascii; }
178
180{ fPlotting = plotting; }
181
183{ fFileName = fileName; }
184
186{ return fName; }
187
189{ return &(fHnDimensionInformations[dimension]); }
190
192{ return fIsLogAxis[axis]; }
193
195{ return fActivation; }
196
198{ return fAscii; }
199
201{ return fPlotting; }
202
204{ return fFileName; }
205
206#endif
G4BinScheme
Definition: G4BinScheme.hh:39
G4double(*)(G4double) G4Fcn
Definition: G4Fcn.hh:35
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void SetAscii(G4bool ascii)
void SetPlotting(G4bool plotting)
G4bool GetIsLogAxis(G4int axis) const
G4HnInformation()=delete
void AddDimension(const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
G4HnInformation(const G4String &name, G4int nofDimensions)
G4bool GetPlotting() const
void SetFileName(G4String fileName)
G4bool GetActivation() const
G4bool GetAscii() const
G4String GetName() const
void SetIsLogAxis(G4int axis, G4bool isLog)
void AddHnDimensionInformation(const G4HnDimensionInformation &hnDimensionInformation)
G4HnDimensionInformation * GetHnDimensionInformation(G4int dimension)
void SetActivation(G4bool activation)
G4String GetFileName() const
void SetDimension(G4int dimension, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
G4double GetUnitValue(const G4String &unit)
G4Fcn GetFunction(const G4String &fcnName)
Definition: G4Fcn.cc:35
G4HnDimensionInformation & operator=(const G4HnDimensionInformation &rhs)
G4HnDimensionInformation(const G4String &unitName, const G4String &fcnName, G4double unit, G4Fcn fcn, G4BinScheme binScheme)
G4HnDimensionInformation(const G4HnDimensionInformation &rhs)