Geant4 11.1.1
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 (G4String hnType, const G4AnalysisManagerState &state)
 
 G4HnManager ()=delete
 
 ~G4HnManager () override
 
G4HnInformationAddHnInformation (const G4String &name, G4int nofDimensions)
 
void ClearData ()
 
G4HnInformationGetHnInformation (G4int id, std::string_view functionName, G4bool warn=true) const
 
G4HnDimensionInformationGetHnDimensionInformation (G4int id, G4int dimension, std::string_view functionName, G4bool warn=true) const
 
const std::vector< G4HnInformation * > & GetHnVector () const
 
G4int GetNofHns () const
 
G4int GetNofActiveHns () 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 SetAxisIsLog (unsigned int idim, G4int id, G4bool isLogAxis)
 
G4String GetName (G4int id) const
 
G4double GetUnit (unsigned int idim, G4int id) const
 
G4bool GetAxisIsLog (unsigned int idim, 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)
 
 G4BaseAnalysisManager ()=delete
 
virtual ~G4BaseAnalysisManager ()=default
 
G4bool SetFirstId (G4int firstId)
 
void SetLockFirstId (G4bool lockFirstId)
 
G4int GetFirstId () const
 
G4int GetCycle () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4BaseAnalysisManager
G4bool IsVerbose (G4int verboseLevel) const
 
void Message (G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
 
- Protected Attributes inherited from G4BaseAnalysisManager
const G4AnalysisManagerStatefState
 
G4int fFirstId { 0 }
 
G4bool fLockFirstId { false }
 

Detailed Description

Definition at line 47 of file G4HnManager.hh.

Constructor & Destructor Documentation

◆ G4HnManager() [1/2]

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

Definition at line 41 of file G4HnManager.cc.

42 : G4BaseAnalysisManager(state), fHnType(std::move(hnType))
43{
44 fMessenger = std::make_unique<G4HnMessenger>(*this);
45}
G4BaseAnalysisManager()=delete

◆ G4HnManager() [2/2]

G4HnManager::G4HnManager ( )
delete

◆ ~G4HnManager()

G4HnManager::~G4HnManager ( )
override

Definition at line 48 of file G4HnManager.cc.

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

Member Function Documentation

◆ AddHnInformation()

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

Definition at line 122 of file G4HnManager.cc.

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

◆ ClearData()

void G4HnManager::ClearData ( )

Definition at line 132 of file G4HnManager.cc.

133{
134 for ( auto info : fHnVector ) {
135 delete info;
136 }
137 fHnVector.clear();
138 SetLockFirstId(false);
139}
void SetLockFirstId(G4bool lockFirstId)

◆ GetActivation()

G4bool G4HnManager::GetActivation ( G4int  id) const

Definition at line 319 of file G4HnManager.cc.

320{
321 auto info = GetHnInformation(id, "GetActivation");
322
323 if (info == nullptr) return true;
324
325 return info->GetActivation();
326}
G4HnInformation * GetHnInformation(G4int id, std::string_view functionName, G4bool warn=true) const
Definition: G4HnManager.cc:142

◆ GetAscii()

G4bool G4HnManager::GetAscii ( G4int  id) const

Definition at line 329 of file G4HnManager.cc.

330{
331 auto info = GetHnInformation(id, "GetAscii");
332
333 if (info == nullptr) return false;
334
335 return info->GetAscii();
336}

◆ GetAxisIsLog()

G4bool G4HnManager::GetAxisIsLog ( unsigned int  idim,
G4int  id 
) const

Definition at line 309 of file G4HnManager.cc.

310{
311 auto info = GetHnInformation(id, "GetXAxisIsLog");
312
313 if (info == nullptr) return false;
314
315 return info->GetIsLogAxis(idim);
316}

◆ GetFileName()

G4String G4HnManager::GetFileName ( G4int  id) const

Definition at line 349 of file G4HnManager.cc.

350{
351 auto info = GetHnInformation(id, "GetFileName");
352
353 if (info == nullptr) return "";
354
355 return info->GetFileName();
356}

◆ GetHnDimensionInformation()

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

Definition at line 157 of file G4HnManager.cc.

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

Referenced by GetUnit().

◆ GetHnInformation()

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

Definition at line 142 of file G4HnManager.cc.

144{
145 G4int index = id - fFirstId;
146 if ( index < 0 || index >= G4int(fHnVector.size()) ) {
147 if ( warn ) {
148 Warn(fHnType + " histogram " + to_string(id) + " does not exist.",
149 fkClass, functionName);
150 }
151 return nullptr;
152 }
153 return fHnVector[index];
154}
int G4int
Definition: G4Types.hh:85
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)

Referenced by GetActivation(), GetAscii(), GetAxisIsLog(), GetFileName(), GetHnDimensionInformation(), GetName(), GetPlotting(), SetActivation(), SetAscii(), SetAxisIsLog(), SetFileName(), and SetPlotting().

◆ GetHnType()

G4String G4HnManager::GetHnType ( ) const
inline

Definition at line 149 of file G4HnManager.hh.

150{ return fHnType; }

◆ GetHnVector()

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

Definition at line 152 of file G4HnManager.hh.

153{ return fHnVector; }

◆ GetName()

G4String G4HnManager::GetName ( G4int  id) const

Definition at line 289 of file G4HnManager.cc.

290{
291 auto info = GetHnInformation(id, "GetName");
292
293 if (info == nullptr) return "";
294
295 return info->GetName();
296}

◆ GetNofActiveHns()

G4int G4HnManager::GetNofActiveHns ( ) const
inline

Definition at line 146 of file G4HnManager.hh.

147{ return fNofActiveObjects; }

◆ GetNofHns()

G4int G4HnManager::GetNofHns ( ) const
inline

Definition at line 143 of file G4HnManager.hh.

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

◆ GetPlotting()

G4bool G4HnManager::GetPlotting ( G4int  id) const

Definition at line 339 of file G4HnManager.cc.

340{
341 auto info = GetHnInformation(id, "GetPlotting");
342
343 if (info == nullptr) return false;
344
345 return info->GetPlotting();
346}

◆ GetUnit()

G4double G4HnManager::GetUnit ( unsigned int  idim,
G4int  id 
) const

Definition at line 299 of file G4HnManager.cc.

300{
301 auto info = GetHnDimensionInformation(id, idim, "GetXUnit");
302
303 if (info == nullptr) return 1.0;
304
305 return info->fUnit;
306}
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, std::string_view functionName, G4bool warn=true) const
Definition: G4HnManager.cc:157

◆ IsActive()

G4bool G4HnManager::IsActive ( ) const

Definition at line 168 of file G4HnManager.cc.

169{
170 return ( fNofActiveObjects > 0 );
171}

◆ IsAscii()

G4bool G4HnManager::IsAscii ( ) const

Definition at line 174 of file G4HnManager.cc.

175{
176 return ( fNofAsciiObjects > 0 );
177}

◆ IsFileName()

G4bool G4HnManager::IsFileName ( ) const

Definition at line 186 of file G4HnManager.cc.

187{
188 return ( fNofFileNameObjects > 0 );
189}

◆ IsPlotting()

G4bool G4HnManager::IsPlotting ( ) const

Definition at line 180 of file G4HnManager.cc.

181{
182 return ( fNofPlottingObjects > 0 );
183}

◆ SetActivation() [1/2]

void G4HnManager::SetActivation ( G4bool  activation)

Definition at line 204 of file G4HnManager.cc.

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

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

◆ SetActivation() [2/2]

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

Definition at line 192 of file G4HnManager.cc.

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

◆ SetAscii()

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

Definition at line 218 of file G4HnManager.cc.

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

Referenced by G4HnMessenger::SetNewValue().

◆ SetAxisIsLog()

G4bool G4HnManager::SetAxisIsLog ( unsigned int  idim,
G4int  id,
G4bool  isLogAxis 
)

Definition at line 278 of file G4HnManager.cc.

279{
280 auto info = GetHnInformation(id, "SetAxisIsLog");
281
282 if (info == nullptr) return false;
283
284 info->SetIsLogAxis(idim, isLog);
285 return true;
286}

◆ SetFileManager()

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

Definition at line 155 of file G4HnManager.hh.

156{
157 fFileManager = std::move(fileManager);
158}

◆ SetFileName() [1/2]

void G4HnManager::SetFileName ( const G4String fileName)

Definition at line 268 of file G4HnManager.cc.

269{
270// Set plotting to all objects of the given type
271
272 for ( auto info : fHnVector ) {
273 SetFileName(info, fileName);
274 }
275}
void SetFileName(G4int id, const G4String &fileName)
Definition: G4HnManager.cc:258

◆ SetFileName() [2/2]

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

Definition at line 258 of file G4HnManager.cc.

259{
260 auto info = GetHnInformation(id, "SetFileName");
261
262 if (info == nullptr) return;
263
264 SetFileName(info, fileName);
265}

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

◆ SetPlotting() [1/2]

void G4HnManager::SetPlotting ( G4bool  plotting)

Definition at line 248 of file G4HnManager.cc.

249{
250// Set plotting to all objects of the given type
251
252 for ( auto info : fHnVector ) {
253 SetPlotting(info, plotting);
254 }
255}
void SetPlotting(G4int id, G4bool plotting)
Definition: G4HnManager.cc:238

◆ SetPlotting() [2/2]

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

Definition at line 238 of file G4HnManager.cc.

239{
240 auto info = GetHnInformation(id, "SetPlotting");
241
242 if (info == nullptr) return;
243
244 SetPlotting(info, plotting);
245}

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


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