Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 // $Id: G4HnInformation.hh 92688 2015-09-14 07:01:13Z gcosmo $
27 
28 // Data class for the added Hn/Pn information (not available in g4tools).
29 //
30 // Author: Ivana Hrivnacova, 04/07/2012 (ivana@ipno.in2p3.fr)
31 
32 #ifndef G4HnInformation_h
33 #define G4HnInformation_h 1
34 
35 #include "globals.hh"
36 #include "G4Fcn.hh"
37 #include "G4BinScheme.hh"
38 #include "G4AnalysisUtilities.hh"
39 
40 // The additional Hn information per dimension
41 
43 {
45  : fUnitName(),
46  fFcnName(),
47  fUnit(),
48  fFcn(nullptr),
50  {}
51 
53  const G4String& unitName,
54  const G4String& fcnName,
55  G4double unit,
56  G4Fcn fcn,
57  G4BinScheme binScheme)
58  : fUnitName(unitName),
59  fFcnName(fcnName),
60  fUnit(unit),
61  fFcn(fcn),
62  fBinScheme(binScheme)
63  {}
64 
66  : fUnitName(rhs.fUnitName),
67  fFcnName(rhs.fFcnName),
68  fUnit(rhs.fUnit),
69  fFcn(rhs.fFcn),
71  {}
72 
74  {
75  // check assignment to self
76  if (this == &rhs) return *this;
77 
78  fUnitName = rhs.fUnitName;
79  fFcnName = rhs.fFcnName;
80  fUnit = rhs.fUnit;
81  fFcn = rhs.fFcn;
82  fBinScheme = rhs.fBinScheme;
83 
84  return *this;
85  }
86 
87  //G4String fName;
93 };
94 
96 {
97  public:
98  G4HnInformation(const G4String& name, G4int nofDimensions)
99  : fName(name),
100  fHnDimensionInformations(),
101  fActivation(true),
102  fAscii(false),
103  fPlotting(false) { fHnDimensionInformations.reserve(nofDimensions); }
104 
105  // Deleted default constructor
106  G4HnInformation() = delete;
107 
108  // Set methods
110  const G4HnDimensionInformation& hnDimensionInformation);
111  void AddDimension(
112  const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme);
113  void SetDimension(G4int dimension,
114  const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme);
115  void SetActivation(G4bool activation);
116  void SetAscii(G4bool ascii);
117  void SetPlotting(G4bool plotting);
118 
119  // Get methods
120  G4String GetName() const;
122  G4bool GetActivation() const;
123  G4bool GetAscii() const;
124  G4bool GetPlotting() const;
125 
126  private:
127  // Data members
128  G4String fName;
129  std::vector<G4HnDimensionInformation> fHnDimensionInformations;
130  G4bool fActivation;
131  G4bool fAscii;
132  G4bool fPlotting;
133 };
134 
135 // inline functions
136 
138  const G4HnDimensionInformation& hnDimensionInformation)
139 { fHnDimensionInformations.push_back(hnDimensionInformation); }
140 
142  const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme)
143 {
144  auto unit = G4Analysis::GetUnitValue(unitName);
145  auto fcn = G4Analysis::GetFunction(fcnName);
146  fHnDimensionInformations.push_back(
147  G4HnDimensionInformation(unitName, fcnName, unit, fcn, binScheme));
148 }
149 
150 inline void G4HnInformation::SetDimension(G4int dimension,
151  const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme)
152 {
153  auto info = GetHnDimensionInformation(dimension);
154  auto unit = G4Analysis::GetUnitValue(unitName);
155  auto fcn = G4Analysis::GetFunction(fcnName);
156  info->fUnitName = unitName;
157  info->fFcnName = fcnName;
158  info->fUnit = unit;
159  info->fFcn = fcn;
160  info->fBinScheme = binScheme;
161 }
162 
163 inline void G4HnInformation::SetActivation(G4bool activation)
164 { fActivation = activation; }
165 
167 { fAscii = ascii; }
168 
170 { fPlotting = plotting; }
171 
173 { return fName; }
174 
176 { return &(fHnDimensionInformations[dimension]); }
177 
179 { return fActivation; }
180 
182 { return fAscii; }
183 
185 { return fPlotting; }
186 
187 #endif
G4HnDimensionInformation & operator=(const G4HnDimensionInformation &rhs)
const XML_Char XML_Encoding * info
Definition: expat.h:530
const XML_Char * name
Definition: expat.h:151
G4double(*)(G4double) G4Fcn
Definition: G4Fcn.hh:36
G4HnDimensionInformation(const G4HnDimensionInformation &rhs)
G4bool GetActivation() const
G4bool GetPlotting() const
void SetActivation(G4bool activation)
void SetAscii(G4bool ascii)
void AddHnDimensionInformation(const G4HnDimensionInformation &hnDimensionInformation)
int G4int
Definition: G4Types.hh:78
G4HnDimensionInformation(const G4String &unitName, const G4String &fcnName, G4double unit, G4Fcn fcn, G4BinScheme binScheme)
void SetPlotting(G4bool plotting)
G4HnInformation()=delete
bool G4bool
Definition: G4Types.hh:79
G4double GetUnitValue(const G4String &unit)
G4Fcn GetFunction(const G4String &fcnName)
Definition: G4Fcn.cc:36
G4HnDimensionInformation * GetHnDimensionInformation(G4int dimension)
G4bool GetAscii() const
G4String GetName() const
G4BinScheme
Definition: G4BinScheme.hh:40
double G4double
Definition: G4Types.hh:76
void AddDimension(const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
G4HnInformation(const G4String &name, G4int nofDimensions)
void SetDimension(G4int dimension, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)