Geant4  10.02.p03
G4HnManager Class Reference

#include <G4HnManager.hh>

Inheritance diagram for G4HnManager:
Collaboration diagram for G4HnManager:

Public Member Functions

 G4HnManager (const G4String &hnType, const G4AnalysisManagerState &state)
 
virtual ~G4HnManager ()
 
G4HnInformationAddHnInformation (const G4String &name, G4int nofDimensions)
 
G4HnInformationGetHnInformation (G4int id, G4String functionName="", G4bool warn=true) const
 
G4HnDimensionInformationGetHnDimensionInformation (G4int id, G4int dimension, G4String functionName="", G4bool warn=true) const
 
const std::vector< G4HnInformation * > & GetHnVector () const
 
G4int GetNofHns () const
 
G4String GetHnType () const
 
G4bool IsActive () const
 
G4bool IsAscii () const
 
G4bool IsPlotting () const
 
void SetActivation (G4bool activation)
 
void SetActivation (G4int id, G4bool activation)
 
void SetAscii (G4int id, G4bool ascii)
 
void SetPlotting (G4bool plotting)
 
void SetPlotting (G4int id, G4bool plotting)
 
G4String GetName (G4int id) const
 
G4double GetXUnit (G4int id) const
 
G4double GetYUnit (G4int id) const
 
G4double GetZUnit (G4int id) const
 
G4bool GetActivation (G4int id) const
 
G4bool GetAscii (G4int id) const
 
G4bool GetPlotting (G4int id) const
 
- Public Member Functions inherited from G4BaseAnalysisManager
 G4BaseAnalysisManager (const G4AnalysisManagerState &state)
 
virtual ~G4BaseAnalysisManager ()
 
G4bool SetFirstId (G4int firstId)
 
void SetLockFirstId (G4bool lockFirstId)
 
G4int GetFirstId () const
 

Private Attributes

G4String fHnType
 
G4int fNofActiveObjects
 
G4int fNofAsciiObjects
 
G4int fNofPlottingObjects
 
std::vector< G4HnInformation * > fHnVector
 

Additional Inherited Members

- Protected Attributes inherited from G4BaseAnalysisManager
const G4AnalysisManagerStatefState
 
G4int fFirstId
 
G4bool fLockFirstId
 

Detailed Description

Definition at line 43 of file G4HnManager.hh.

Constructor & Destructor Documentation

◆ G4HnManager()

G4HnManager::G4HnManager ( const G4String hnType,
const G4AnalysisManagerState state 
)

Definition at line 36 of file G4HnManager.cc.

38  : G4BaseAnalysisManager(state),
39  fHnType(hnType),
43  fHnVector()
44 {
45 }
G4String fHnType
Definition: G4HnManager.hh:106
G4int fNofPlottingObjects
Definition: G4HnManager.hh:109
G4int fNofAsciiObjects
Definition: G4HnManager.hh:108
G4BaseAnalysisManager(const G4AnalysisManagerState &state)
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:112
G4int fNofActiveObjects
Definition: G4HnManager.hh:107

◆ ~G4HnManager()

G4HnManager::~G4HnManager ( )
virtual

Definition at line 48 of file G4HnManager.cc.

49 {
50  for ( auto hnInformation : fHnVector ) {
51  delete hnInformation;
52  }
53 }
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:112

Member Function Documentation

◆ AddHnInformation()

G4HnInformation * G4HnManager::AddHnInformation ( const G4String name,
G4int  nofDimensions 
)

Definition at line 60 of file G4HnManager.cc.

61 {
62  auto hnInformation = new G4HnInformation(name, nofDimensions);
63  fHnVector.push_back(hnInformation);
65 
66  return hnInformation;
67 }
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:112
G4int fNofActiveObjects
Definition: G4HnManager.hh:107

◆ GetActivation()

G4bool G4HnManager::GetActivation ( G4int  id) const

Definition at line 259 of file G4HnManager.cc.

260 {
261  auto info = GetHnInformation(id, "GetActivation");
262 
263  if ( ! info ) return true;
264 
265  return info->GetActivation();
266 }
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70
Here is the call graph for this function:

◆ GetAscii()

G4bool G4HnManager::GetAscii ( G4int  id) const

Definition at line 269 of file G4HnManager.cc.

270 {
271  auto info = GetHnInformation(id, "GetAscii");
272 
273  if ( ! info ) return false;
274 
275  return info->GetAscii();
276 }
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70
Here is the call graph for this function:

◆ GetHnDimensionInformation()

G4HnDimensionInformation * G4HnManager::GetHnDimensionInformation ( G4int  id,
G4int  dimension,
G4String  functionName = "",
G4bool  warn = true 
) const

Definition at line 92 of file G4HnManager.cc.

95 {
96  auto hnInformation = GetHnInformation(id, functionName, warn);
97  if ( ! hnInformation ) return 0;
98 
99  return hnInformation->GetHnDimensionInformation(dimension);
100 }
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHnInformation()

G4HnInformation * G4HnManager::GetHnInformation ( G4int  id,
G4String  functionName = "",
G4bool  warn = true 
) const

Definition at line 70 of file G4HnManager.cc.

72 {
73  G4int index = id - fFirstId;
74  if ( index < 0 || index >= G4int(fHnVector.size()) ) {
75  if ( warn ) {
76  G4String inFunction = "G4HnManager::";
77  if ( functionName.size() )
78  inFunction += functionName;
79  else
80  inFunction += "GetHnInformation";
81  G4ExceptionDescription description;
82  description << " " << fHnType << " histogram " << id
83  << " does not exist.";
84  G4Exception(inFunction, "Analysis_W011", JustWarning, description);
85  }
86  return 0;
87  }
88  return fHnVector[index];
89 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
Int_t index
G4String fHnType
Definition: G4HnManager.hh:106
int G4int
Definition: G4Types.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHnType()

G4String G4HnManager::GetHnType ( ) const
inline

Definition at line 118 of file G4HnManager.hh.

119 { return fHnType; }
G4String fHnType
Definition: G4HnManager.hh:106
Here is the caller graph for this function:

◆ GetHnVector()

const std::vector< G4HnInformation * > & G4HnManager::GetHnVector ( ) const
inline

Definition at line 121 of file G4HnManager.hh.

122 { return fHnVector; }
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:112

◆ GetName()

G4String G4HnManager::GetName ( G4int  id) const

Definition at line 219 of file G4HnManager.cc.

220 {
221  auto info = GetHnInformation(id, "GetName");
222 
223  if ( ! info ) return "";
224 
225  return info->GetName();
226 }
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70
Here is the call graph for this function:

◆ GetNofHns()

G4int G4HnManager::GetNofHns ( ) const
inline

Definition at line 115 of file G4HnManager.hh.

116 { return fHnVector.size(); }
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:112

◆ GetPlotting()

G4bool G4HnManager::GetPlotting ( G4int  id) const

Definition at line 279 of file G4HnManager.cc.

280 {
281  auto info = GetHnInformation(id, "GetPlotting");
282 
283  if ( ! info ) return false;
284 
285  return info->GetPlotting();
286 }
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70
Here is the call graph for this function:

◆ GetXUnit()

G4double G4HnManager::GetXUnit ( G4int  id) const

Definition at line 229 of file G4HnManager.cc.

230 {
231  auto info = GetHnDimensionInformation(id, kX, "GetXUnit");
232 
233  if ( ! info ) return 1.0;
234 
235  return info->fUnit;
236 }
const G4int kX
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:92
Here is the call graph for this function:

◆ GetYUnit()

G4double G4HnManager::GetYUnit ( G4int  id) const

Definition at line 239 of file G4HnManager.cc.

240 {
241  auto info = GetHnDimensionInformation(id, kY, "GetYUnit");
242 
243  if ( ! info ) return 1.0;
244 
245  return info->fUnit;
246 }
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:92
const G4int kY
Here is the call graph for this function:

◆ GetZUnit()

G4double G4HnManager::GetZUnit ( G4int  id) const

Definition at line 249 of file G4HnManager.cc.

250 {
251  auto info = GetHnDimensionInformation(id, kZ, "GetZUnit");
252 
253  if ( ! info ) return 1.0;
254 
255  return info->fUnit;
256 }
const G4int kZ
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:92
Here is the call graph for this function:

◆ IsActive()

G4bool G4HnManager::IsActive ( ) const

Definition at line 103 of file G4HnManager.cc.

104 {
105  return ( fNofActiveObjects > 0 );
106 }
G4int fNofActiveObjects
Definition: G4HnManager.hh:107

◆ IsAscii()

G4bool G4HnManager::IsAscii ( ) const

Definition at line 109 of file G4HnManager.cc.

110 {
111  return ( fNofAsciiObjects > 0 );
112 }
G4int fNofAsciiObjects
Definition: G4HnManager.hh:108

◆ IsPlotting()

G4bool G4HnManager::IsPlotting ( ) const

Definition at line 115 of file G4HnManager.cc.

116 {
117  return ( fNofPlottingObjects > 0 );
118 }
G4int fNofPlottingObjects
Definition: G4HnManager.hh:109

◆ SetActivation() [1/2]

void G4HnManager::SetActivation ( G4bool  activation)

Definition at line 141 of file G4HnManager.cc.

142 {
143 // Set activation to all objects of the given type
144 
145  //std::vector<G4HnInformation*>::iterator it;
146  //for ( it = fHnVector.begin(); it != fHnVector.end(); it++ ) {
147  // G4HnInformation* info = *it;
148 
149  for ( auto info : fHnVector ) {
150 
151  // Do nothing if activation does not change
152  if ( info->GetActivation() == activation ) continue;
153 
154  // Change activation and account it in fNofActiveObjects
155  info->SetActivation(activation);
156  if ( activation )
158  else
160  }
161 }
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:112
G4int fNofActiveObjects
Definition: G4HnManager.hh:107
Here is the caller graph for this function:

◆ SetActivation() [2/2]

void G4HnManager::SetActivation ( G4int  id,
G4bool  activation 
)

Definition at line 121 of file G4HnManager.cc.

122 {
123 // Set activation to a given object
124 
125  auto info = GetHnInformation(id, "SetActivation");
126 
127  if ( ! info ) return;
128 
129  // Do nothing if activation does not change
130  if ( info->GetActivation() == activation ) return;
131 
132  // Change activation and account it in fNofActiveObjects
133  info->SetActivation(activation);
134  if ( activation )
136  else
138 }
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70
G4int fNofActiveObjects
Definition: G4HnManager.hh:107
Here is the call graph for this function:

◆ SetAscii()

void G4HnManager::SetAscii ( G4int  id,
G4bool  ascii 
)

Definition at line 164 of file G4HnManager.cc.

165 {
166  auto info = GetHnInformation(id, "SetAscii");
167 
168  if ( ! info ) return;
169 
170  // Do nothing if ascii does not change
171  if ( info->GetAscii() == ascii ) return;
172 
173  // Change ascii and account it in fNofAsciiObjects
174  info->SetAscii(ascii);
175  if ( ascii )
177  else
178  fNofAsciiObjects--;
179 }
G4int fNofAsciiObjects
Definition: G4HnManager.hh:108
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetPlotting() [1/2]

void G4HnManager::SetPlotting ( G4bool  plotting)

Definition at line 200 of file G4HnManager.cc.

201 {
202 // Set plotting to all objects of the given type
203 
204  for ( auto info : fHnVector ) {
205 
206  // Do nothing if plotting does not change
207  if ( info->GetPlotting() == plotting ) continue;
208 
209  // Change plotting and account it in fNofActiveObjects
210  info->SetPlotting(plotting);
211  if ( plotting )
213  else
215  }
216 }
G4int fNofPlottingObjects
Definition: G4HnManager.hh:109
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:112
Here is the caller graph for this function:

◆ SetPlotting() [2/2]

void G4HnManager::SetPlotting ( G4int  id,
G4bool  plotting 
)

Definition at line 182 of file G4HnManager.cc.

183 {
184  auto info = GetHnInformation(id, "SetPlotting");
185 
186  if ( ! info ) return;
187 
188  // Do nothing if ascii does not change
189  if ( info->GetPlotting() == plotting ) return;
190 
191  // Change Plotting and account it in fNofPlottingObjects
192  info->SetPlotting(plotting);
193  if ( plotting )
195  else
197 }
G4int fNofPlottingObjects
Definition: G4HnManager.hh:109
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70
Here is the call graph for this function:

Member Data Documentation

◆ fHnType

G4String G4HnManager::fHnType
private

Definition at line 106 of file G4HnManager.hh.

◆ fHnVector

std::vector<G4HnInformation*> G4HnManager::fHnVector
private

Definition at line 112 of file G4HnManager.hh.

◆ fNofActiveObjects

G4int G4HnManager::fNofActiveObjects
private

Definition at line 107 of file G4HnManager.hh.

◆ fNofAsciiObjects

G4int G4HnManager::fNofAsciiObjects
private

Definition at line 108 of file G4HnManager.hh.

◆ fNofPlottingObjects

G4int G4HnManager::fNofPlottingObjects
private

Definition at line 109 of file G4HnManager.hh.


The documentation for this class was generated from the following files: