ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4HnInformation.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4HnInformation.hh
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 (ivana@ipno.in2p3.fr)
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),
48  fBinScheme(G4BinScheme::kLinear)
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;
81  fBinScheme = rhs.fBinScheme;
82 
83  return *this;
84  }
85 
86  //G4String fName;
92 };
93 
95 {
96  public:
97  G4HnInformation(const G4String& name, G4int nofDimensions)
98  : fName(name),
100  fIsLogAxis({ false, false, false }),
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 SetIsLogAxis(G4int axis, G4bool isLog);
116  void SetActivation(G4bool activation);
117  void SetAscii(G4bool ascii);
118  void SetPlotting(G4bool plotting);
119 
120  // Get methods
121  G4String GetName() const;
123  G4bool GetIsLogAxis(G4int axis) const;
124  G4bool GetActivation() const;
125  G4bool GetAscii() const;
126  G4bool GetPlotting() const;
127 
128  private:
129  // Data members
131  std::vector<G4HnDimensionInformation> fHnDimensionInformations;
132  std::vector<G4bool> fIsLogAxis;
136 };
137 
138 // inline functions
139 
141  const G4HnDimensionInformation& hnDimensionInformation)
142 { fHnDimensionInformations.push_back(hnDimensionInformation); }
143 
145  const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme)
146 {
147  auto unit = G4Analysis::GetUnitValue(unitName);
148  auto fcn = G4Analysis::GetFunction(fcnName);
149  fHnDimensionInformations.push_back(
150  G4HnDimensionInformation(unitName, fcnName, unit, fcn, binScheme));
151 }
152 
153 inline void G4HnInformation::SetDimension(G4int dimension,
154  const G4String& unitName, const G4String& fcnName, G4BinScheme binScheme)
155 {
156  auto info = GetHnDimensionInformation(dimension);
157  auto unit = G4Analysis::GetUnitValue(unitName);
158  auto fcn = G4Analysis::GetFunction(fcnName);
159  info->fUnitName = unitName;
160  info->fFcnName = fcnName;
161  info->fUnit = unit;
162  info->fFcn = fcn;
163  info->fBinScheme = binScheme;
164 }
165 
167 { fIsLogAxis[axis] = isLog; }
168 
169 inline void G4HnInformation::SetActivation(G4bool activation)
170 { fActivation = activation; }
171 
173 { fAscii = ascii; }
174 
176 { fPlotting = plotting; }
177 
179 { return fName; }
180 
182 { return &(fHnDimensionInformations[dimension]); }
183 
185 { return fIsLogAxis[axis]; }
186 
188 { return fActivation; }
189 
191 { return fAscii; }
192 
194 { return fPlotting; }
195 
196 #endif