Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HnManager Class Reference

#include <G4HnManager.hh>

+ Inheritance 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
 
G4bool IsFileName () const
 
void SetActivation (G4bool activation)
 
void SetActivation (G4int id, G4bool activation)
 
void SetAscii (G4int id, G4bool ascii)
 
void SetPlotting (G4int id, G4bool plotting)
 
void SetPlotting (G4bool plotting)
 
void SetFileName (G4int id, const G4String &fileName)
 
void SetFileName (const G4String &fileName)
 
G4bool SetXAxisIsLog (G4int id, G4bool isLogAxis)
 
G4bool SetYAxisIsLog (G4int id, G4bool isLogAxis)
 
G4bool SetZAxisIsLog (G4int id, G4bool isLogAxis)
 
G4String GetName (G4int id) const
 
G4double GetXUnit (G4int id) const
 
G4double GetYUnit (G4int id) const
 
G4double GetZUnit (G4int id) const
 
G4bool GetXAxisIsLog (G4int id) const
 
G4bool GetYAxisIsLog (G4int id) const
 
G4bool GetZAxisIsLog (G4int id) const
 
G4bool GetActivation (G4int id) const
 
G4bool GetAscii (G4int id) const
 
G4bool GetPlotting (G4int id) const
 
G4String GetFileName (G4int id) const
 
void SetFileManager (std::shared_ptr< G4VFileManager > fileManager)
 
- 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 44 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),
40 fNofActiveObjects(0),
41 fNofAsciiObjects(0),
42 fNofPlottingObjects(0),
43 fNofFileNameObjects(0),
44 fHnVector(),
45 fFileManager(nullptr)
46{
47}

◆ ~G4HnManager()

G4HnManager::~G4HnManager ( )
virtual

Definition at line 50 of file G4HnManager.cc.

51{
52 for ( auto info : fHnVector ) {
53 delete info;
54 }
55}

Member Function Documentation

◆ AddHnInformation()

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

Definition at line 123 of file G4HnManager.cc.

124{
125 auto info = new G4HnInformation(name, nofDimensions);
126 fHnVector.push_back(info);
127 ++fNofActiveObjects;
128
129 return info;
130}

◆ GetActivation()

G4bool G4HnManager::GetActivation ( G4int  id) const

Definition at line 377 of file G4HnManager.cc.

378{
379 auto info = GetHnInformation(id, "GetActivation");
380
381 if ( ! info ) return true;
382
383 return info->GetActivation();
384}
G4HnInformation * GetHnInformation(G4int id, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:133

◆ GetAscii()

G4bool G4HnManager::GetAscii ( G4int  id) const

Definition at line 387 of file G4HnManager.cc.

388{
389 auto info = GetHnInformation(id, "GetAscii");
390
391 if ( ! info ) return false;
392
393 return info->GetAscii();
394}

◆ GetFileName()

G4String G4HnManager::GetFileName ( G4int  id) const

Definition at line 407 of file G4HnManager.cc.

408{
409 auto info = GetHnInformation(id, "GetFileName");
410
411 if ( ! info ) return "";
412
413 return info->GetFileName();
414}

◆ GetHnDimensionInformation()

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

Definition at line 155 of file G4HnManager.cc.

158{
159 auto info = GetHnInformation(id, functionName, warn);
160 if ( ! info ) return nullptr;
161
162 return info->GetHnDimensionInformation(dimension);
163}

Referenced by GetXUnit(), GetYUnit(), and GetZUnit().

◆ GetHnInformation()

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

Definition at line 133 of file G4HnManager.cc.

135{
136 G4int index = id - fFirstId;
137 if ( index < 0 || index >= G4int(fHnVector.size()) ) {
138 if ( warn ) {
139 G4String inFunction = "G4HnManager::";
140 if ( functionName.size() )
141 inFunction += functionName;
142 else
143 inFunction += "GetHnInformation";
144 G4ExceptionDescription description;
145 description << " " << fHnType << " histogram " << id
146 << " does not exist.";
147 G4Exception(inFunction, "Analysis_W011", JustWarning, description);
148 }
149 return nullptr;
150 }
151 return fHnVector[index];
152}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
int G4int
Definition: G4Types.hh:85

Referenced by GetActivation(), GetAscii(), GetFileName(), GetHnDimensionInformation(), GetName(), GetPlotting(), GetXAxisIsLog(), GetYAxisIsLog(), GetZAxisIsLog(), SetActivation(), SetAscii(), SetFileName(), SetPlotting(), SetXAxisIsLog(), SetYAxisIsLog(), and SetZAxisIsLog().

◆ GetHnType()

G4String G4HnManager::GetHnType ( ) const
inline

Definition at line 140 of file G4HnManager.hh.

141{ return fHnType; }

Referenced by G4HnMessenger::G4HnMessenger().

◆ GetHnVector()

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

Definition at line 143 of file G4HnManager.hh.

144{ return fHnVector; }

◆ GetName()

G4String G4HnManager::GetName ( G4int  id) const

Definition at line 307 of file G4HnManager.cc.

308{
309 auto info = GetHnInformation(id, "GetName");
310
311 if ( ! info ) return "";
312
313 return info->GetName();
314}

◆ GetNofHns()

G4int G4HnManager::GetNofHns ( ) const
inline

Definition at line 137 of file G4HnManager.hh.

138{ return G4int(fHnVector.size()); }

◆ GetPlotting()

G4bool G4HnManager::GetPlotting ( G4int  id) const

Definition at line 397 of file G4HnManager.cc.

398{
399 auto info = GetHnInformation(id, "GetPlotting");
400
401 if ( ! info ) return false;
402
403 return info->GetPlotting();
404}

◆ GetXAxisIsLog()

G4bool G4HnManager::GetXAxisIsLog ( G4int  id) const

Definition at line 347 of file G4HnManager.cc.

348{
349 auto info = GetHnInformation(id, "GetXAxisIsLog");
350
351 if ( ! info ) return false;
352
353 return info->GetIsLogAxis(kX);
354}
const G4int kX

◆ GetXUnit()

G4double G4HnManager::GetXUnit ( G4int  id) const

Definition at line 317 of file G4HnManager.cc.

318{
319 auto info = GetHnDimensionInformation(id, kX, "GetXUnit");
320
321 if ( ! info ) return 1.0;
322
323 return info->fUnit;
324}
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, G4String functionName="", G4bool warn=true) const
Definition: G4HnManager.cc:155

◆ GetYAxisIsLog()

G4bool G4HnManager::GetYAxisIsLog ( G4int  id) const

Definition at line 357 of file G4HnManager.cc.

358{
359 auto info = GetHnInformation(id, "GetYAxisIsLog");
360
361 if ( ! info ) return 1.0;
362
363 return info->GetIsLogAxis(kY);
364}
const G4int kY

◆ GetYUnit()

G4double G4HnManager::GetYUnit ( G4int  id) const

Definition at line 327 of file G4HnManager.cc.

328{
329 auto info = GetHnDimensionInformation(id, kY, "GetYUnit");
330
331 if ( ! info ) return 1.0;
332
333 return info->fUnit;
334}

◆ GetZAxisIsLog()

G4bool G4HnManager::GetZAxisIsLog ( G4int  id) const

Definition at line 367 of file G4HnManager.cc.

368{
369 auto info = GetHnInformation(id, "GetZAxisIsLog");
370
371 if ( ! info ) return 1.0;
372
373 return info->GetIsLogAxis(kZ);
374}
const G4int kZ

◆ GetZUnit()

G4double G4HnManager::GetZUnit ( G4int  id) const

Definition at line 337 of file G4HnManager.cc.

338{
339 auto info = GetHnDimensionInformation(id, kZ, "GetZUnit");
340
341 if ( ! info ) return 1.0;
342
343 return info->fUnit;
344}

◆ IsActive()

G4bool G4HnManager::IsActive ( ) const

Definition at line 166 of file G4HnManager.cc.

167{
168 return ( fNofActiveObjects > 0 );
169}

◆ IsAscii()

G4bool G4HnManager::IsAscii ( ) const

Definition at line 172 of file G4HnManager.cc.

173{
174 return ( fNofAsciiObjects > 0 );
175}

◆ IsFileName()

G4bool G4HnManager::IsFileName ( ) const

Definition at line 184 of file G4HnManager.cc.

185{
186 return ( fNofFileNameObjects > 0 );
187}

◆ IsPlotting()

G4bool G4HnManager::IsPlotting ( ) const

Definition at line 178 of file G4HnManager.cc.

179{
180 return ( fNofPlottingObjects > 0 );
181}

◆ SetActivation() [1/2]

void G4HnManager::SetActivation ( G4bool  activation)

Definition at line 202 of file G4HnManager.cc.

203{
204// Set activation to all objects of the given type
205
206 //std::vector<G4HnInformation*>::iterator it;
207 //for ( it = fHnVector.begin(); it != fHnVector.end(); it++ ) {
208 // G4HnInformation* info = *it;
209
210 for ( auto info : fHnVector ) {
211 SetActivation(info, activation);
212 }
213}
void SetActivation(G4bool activation)
Definition: G4HnManager.cc:202

Referenced by SetActivation(), and G4HnMessenger::SetNewValue().

◆ SetActivation() [2/2]

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

Definition at line 190 of file G4HnManager.cc.

191{
192// Set activation to a given object
193
194 auto info = GetHnInformation(id, "SetActivation");
195
196 if ( ! info ) return;
197
198 SetActivation(info, activation);
199}

◆ SetAscii()

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

Definition at line 216 of file G4HnManager.cc.

217{
218 auto info = GetHnInformation(id, "SetAscii");
219
220 if ( ! info ) return;
221
222 // Do nothing if ascii does not change
223 if ( info->GetAscii() == ascii ) return;
224
225 // Change ascii and account it in fNofAsciiObjects
226 info->SetAscii(ascii);
227 if ( ascii )
228 fNofAsciiObjects++;
229 else
230 fNofAsciiObjects--;
231}

Referenced by G4HnMessenger::SetNewValue().

◆ SetFileManager()

void G4HnManager::SetFileManager ( std::shared_ptr< G4VFileManager fileManager)
inline

Definition at line 146 of file G4HnManager.hh.

147{ fFileManager = fileManager; }

◆ SetFileName() [1/2]

void G4HnManager::SetFileName ( const G4String fileName)

Definition at line 264 of file G4HnManager.cc.

265{
266// Set plotting to all objects of the given type
267
268 for ( auto info : fHnVector ) {
269 SetFileName(info, fileName);
270 }
271}
void SetFileName(G4int id, const G4String &fileName)
Definition: G4HnManager.cc:254

◆ SetFileName() [2/2]

void G4HnManager::SetFileName ( G4int  id,
const G4String fileName 
)

Definition at line 254 of file G4HnManager.cc.

255{
256 auto info = GetHnInformation(id, "SetFileName");
257
258 if ( ! info ) return;
259
260 SetFileName(info, fileName);
261}

Referenced by SetFileName(), and G4HnMessenger::SetNewValue().

◆ SetPlotting() [1/2]

void G4HnManager::SetPlotting ( G4bool  plotting)

Definition at line 244 of file G4HnManager.cc.

245{
246// Set plotting to all objects of the given type
247
248 for ( auto info : fHnVector ) {
249 SetPlotting(info, plotting);
250 }
251}
void SetPlotting(G4int id, G4bool plotting)
Definition: G4HnManager.cc:234

◆ SetPlotting() [2/2]

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

Definition at line 234 of file G4HnManager.cc.

235{
236 auto info = GetHnInformation(id, "SetPlotting");
237
238 if ( ! info ) return;
239
240 SetPlotting(info, plotting);
241}

Referenced by G4HnMessenger::SetNewValue(), and SetPlotting().

◆ SetXAxisIsLog()

G4bool G4HnManager::SetXAxisIsLog ( G4int  id,
G4bool  isLogAxis 
)

Definition at line 274 of file G4HnManager.cc.

275{
276 auto info = GetHnInformation(id, "SetXAxisIsLog");
277
278 if ( ! info ) return false;
279
280 info->SetIsLogAxis(kX, isLog);
281 return true;
282}

◆ SetYAxisIsLog()

G4bool G4HnManager::SetYAxisIsLog ( G4int  id,
G4bool  isLogAxis 
)

Definition at line 285 of file G4HnManager.cc.

286{
287 auto info = GetHnInformation(id, "SetYAxisIsLog");
288
289 if ( ! info ) return false;
290
291 info->SetIsLogAxis(kY, isLog);
292 return true;
293}

◆ SetZAxisIsLog()

G4bool G4HnManager::SetZAxisIsLog ( G4int  id,
G4bool  isLogAxis 
)

Definition at line 296 of file G4HnManager.cc.

297{
298 auto info = GetHnInformation(id, "SetZAxisIsLog");
299
300 if ( ! info ) return false;
301
302 info->SetIsLogAxis(kZ, isLog);
303 return true;
304}

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