Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
 

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 ( const G4String hnType,
const G4AnalysisManagerState state 
)

Definition at line 36 of file G4HnManager.cc.

38  : G4BaseAnalysisManager(state),
39  fHnType(hnType),
40  fNofActiveObjects(0),
41  fNofAsciiObjects(0),
42  fNofPlottingObjects(0),
43  fHnVector()
44 {
45 }
G4BaseAnalysisManager(const G4AnalysisManagerState &state)
G4HnManager::~G4HnManager ( )
virtual

Definition at line 48 of file G4HnManager.cc.

49 {
50  for ( auto hnInformation : fHnVector ) {
51  delete hnInformation;
52  }
53 }

Member Function Documentation

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);
64  ++fNofActiveObjects;
65 
66  return hnInformation;
67 }
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 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70

Here is the call graph for this function:

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 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70

Here is the call graph for this function:

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 nullptr;
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:

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 nullptr;
87  }
88  return fHnVector[index];
89 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
int G4int
Definition: G4Types.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

Here is the caller graph for this function:

G4String G4HnManager::GetHnType ( ) const
inline

Definition at line 118 of file G4HnManager.hh.

119 { return fHnType; }

Here is the caller graph for this function:

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

Definition at line 121 of file G4HnManager.hh.

122 { return fHnVector; }
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 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70

Here is the call graph for this function:

G4int G4HnManager::GetNofHns ( ) const
inline

Definition at line 115 of file G4HnManager.hh.

116 { return fHnVector.size(); }
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 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70

Here is the call graph for this function:

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 XML_Char XML_Encoding * info
Definition: expat.h:530
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:

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 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
const G4int kY
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:92

Here is the call graph for this function:

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 XML_Char XML_Encoding * info
Definition: expat.h:530
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:

G4bool G4HnManager::IsActive ( ) const

Definition at line 103 of file G4HnManager.cc.

104 {
105  return ( fNofActiveObjects > 0 );
106 }
G4bool G4HnManager::IsAscii ( ) const

Definition at line 109 of file G4HnManager.cc.

110 {
111  return ( fNofAsciiObjects > 0 );
112 }
G4bool G4HnManager::IsPlotting ( ) const

Definition at line 115 of file G4HnManager.cc.

116 {
117  return ( fNofPlottingObjects > 0 );
118 }
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 )
157  fNofActiveObjects++;
158  else
159  fNofActiveObjects--;
160  }
161 }
const XML_Char XML_Encoding * info
Definition: expat.h:530

Here is the caller graph for this function:

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 )
135  fNofActiveObjects++;
136  else
137  fNofActiveObjects--;
138 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70

Here is the call graph for this function:

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 )
176  fNofAsciiObjects++;
177  else
178  fNofAsciiObjects--;
179 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
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:

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 )
212  fNofPlottingObjects++;
213  else
214  fNofPlottingObjects--;
215  }
216 }
const XML_Char XML_Encoding * info
Definition: expat.h:530

Here is the caller graph for this function:

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 )
194  fNofPlottingObjects++;
195  else
196  fNofPlottingObjects--;
197 }
const XML_Char XML_Encoding * info
Definition: expat.h:530
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:70

Here is the call graph for this function:


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