Geant4 11.2.2
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
 
void CreateMessenger ()
 
void AddHnInformation (G4HnInformation *info)
 
void AddHnInformation (G4HnInformation *info, G4int index)
 
void SetHnDeleted (G4HnInformation *info, G4bool keepSetting)
 
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 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)
 
void SetDefaultFileType (const G4String &fileType)
 
- 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 48 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{}
G4BaseAnalysisManager()=delete

◆ G4HnManager() [2/2]

G4HnManager::G4HnManager ( )
delete

◆ ~G4HnManager()

G4HnManager::~G4HnManager ( )
override

Definition at line 46 of file G4HnManager.cc.

47{
48 for ( auto info : fHnVector ) {
49 delete info;
50 }
51}

Member Function Documentation

◆ AddHnInformation() [1/2]

void G4HnManager::AddHnInformation ( G4HnInformation * info)

Definition at line 144 of file G4HnManager.cc.

145{
146 // Add new information
147
148 fHnVector.push_back(info);
149 ++fNofActiveObjects;
150}

◆ AddHnInformation() [2/2]

void G4HnManager::AddHnInformation ( G4HnInformation * info,
G4int index )

Definition at line 153 of file G4HnManager.cc.

154{
155 // Replace the information at 'index' position with new one.
156 // Update new information with the previous one settings if the
157 // previous histogram was deleted with 'keepSetting' set true.
158
159 auto previousInfo = fHnVector[index];
160 if (previousInfo->GetDeletedPair().second) {
161 info->Update(*previousInfo);
162 }
163 delete previousInfo;
164
165 fHnVector[index] = info;
166
167 if (info->GetActivation()) { ++fNofActiveObjects; }
168 if (info->GetAscii()) { ++fNofAsciiObjects; }
169 if (info->GetPlotting()) { ++fNofPlottingObjects; }
170 if (! info->GetFileName().empty()) { ++fNofFileNameObjects; }
171}
G4bool GetPlotting() const
G4bool GetActivation() const
G4bool GetAscii() const
void Update(const G4HnInformation &other)
G4String GetFileName() const

◆ ClearData()

void G4HnManager::ClearData ( )

Definition at line 185 of file G4HnManager.cc.

186{
187 for ( auto info : fHnVector ) {
188 delete info;
189 }
190 fHnVector.clear();
191 SetLockFirstId(false);
192}
void SetLockFirstId(G4bool lockFirstId)

◆ CreateMessenger()

void G4HnManager::CreateMessenger ( )

Definition at line 138 of file G4HnManager.cc.

139{
140 fMessenger = std::make_unique<G4HnMessenger>(*this);
141}

◆ GetActivation()

G4bool G4HnManager::GetActivation ( G4int id) const

Definition at line 372 of file G4HnManager.cc.

373{
374 auto info = GetHnInformation(id, "GetActivation");
375
376 if (info == nullptr) return true;
377
378 return info->GetActivation();
379}
G4HnInformation * GetHnInformation(G4int id, std::string_view functionName, G4bool warn=true) const

◆ GetAscii()

G4bool G4HnManager::GetAscii ( G4int id) const

Definition at line 382 of file G4HnManager.cc.

383{
384 auto info = GetHnInformation(id, "GetAscii");
385
386 if (info == nullptr) return false;
387
388 return info->GetAscii();
389}

◆ GetAxisIsLog()

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

Definition at line 362 of file G4HnManager.cc.

363{
364 auto info = GetHnInformation(id, "GetXAxisIsLog");
365
366 if (info == nullptr) return false;
367
368 return info->GetIsLogAxis(idim);
369}

◆ GetFileName()

G4String G4HnManager::GetFileName ( G4int id) const

Definition at line 402 of file G4HnManager.cc.

403{
404 auto info = GetHnInformation(id, "GetFileName");
405
406 if (info == nullptr) return "";
407
408 return info->GetFileName();
409}

◆ GetHnDimensionInformation()

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

Definition at line 210 of file G4HnManager.cc.

213{
214 auto info = GetHnInformation(id, functionName, warn);
215 if (info == nullptr) return nullptr;
216
217 return info->GetHnDimensionInformation(dimension);
218}

Referenced by GetUnit().

◆ GetHnInformation()

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

Definition at line 195 of file G4HnManager.cc.

197{
198 G4int index = id - fFirstId;
199 if ( index < 0 || index >= G4int(fHnVector.size()) ) {
200 if ( warn ) {
201 Warn(fHnType + " histogram " + to_string(id) + " does not exist.",
202 fkClass, functionName);
203 }
204 return nullptr;
205 }
206 return fHnVector[index];
207}
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 152 of file G4HnManager.hh.

153{ return fHnType; }

◆ GetHnVector()

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

Definition at line 155 of file G4HnManager.hh.

156{ return fHnVector; }

◆ GetName()

G4String G4HnManager::GetName ( G4int id) const

Definition at line 342 of file G4HnManager.cc.

343{
344 auto info = GetHnInformation(id, "GetName");
345
346 if (info == nullptr) return "";
347
348 return info->GetName();
349}

◆ GetNofActiveHns()

G4int G4HnManager::GetNofActiveHns ( ) const
inline

Definition at line 149 of file G4HnManager.hh.

150{ return fNofActiveObjects; }

◆ GetPlotting()

G4bool G4HnManager::GetPlotting ( G4int id) const

Definition at line 392 of file G4HnManager.cc.

393{
394 auto info = GetHnInformation(id, "GetPlotting");
395
396 if (info == nullptr) return false;
397
398 return info->GetPlotting();
399}

◆ GetUnit()

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

Definition at line 352 of file G4HnManager.cc.

353{
354 auto info = GetHnDimensionInformation(id, idim, "GetXUnit");
355
356 if (info == nullptr) return 1.0;
357
358 return info->fUnit;
359}
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, std::string_view functionName, G4bool warn=true) const

◆ IsActive()

G4bool G4HnManager::IsActive ( ) const

Definition at line 221 of file G4HnManager.cc.

222{
223 return ( fNofActiveObjects > 0 );
224}

◆ IsAscii()

G4bool G4HnManager::IsAscii ( ) const

Definition at line 227 of file G4HnManager.cc.

228{
229 return ( fNofAsciiObjects > 0 );
230}

◆ IsFileName()

G4bool G4HnManager::IsFileName ( ) const

Definition at line 239 of file G4HnManager.cc.

240{
241 return ( fNofFileNameObjects > 0 );
242}

◆ IsPlotting()

G4bool G4HnManager::IsPlotting ( ) const

Definition at line 233 of file G4HnManager.cc.

234{
235 return ( fNofPlottingObjects > 0 );
236}

◆ SetActivation() [1/2]

void G4HnManager::SetActivation ( G4bool activation)

Definition at line 257 of file G4HnManager.cc.

258{
259// Set activation to all objects of the given type
260
261 //std::vector<G4HnInformation*>::iterator it;
262 //for ( it = fHnVector.begin(); it != fHnVector.end(); it++ ) {
263 // G4HnInformation* info = *it;
264
265 for ( auto info : fHnVector ) {
266 SetActivation(info, activation);
267 }
268}
void SetActivation(G4bool activation)

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

◆ SetActivation() [2/2]

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

Definition at line 245 of file G4HnManager.cc.

246{
247// Set activation to a given object
248
249 auto info = GetHnInformation(id, "SetActivation");
250
251 if (info == nullptr) return;
252
253 SetActivation(info, activation);
254}

◆ SetAscii()

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

Definition at line 271 of file G4HnManager.cc.

272{
273 auto info = GetHnInformation(id, "SetAscii");
274
275 if (info == nullptr) return;
276
277 // Do nothing if ascii does not change
278 if ( info->GetAscii() == ascii ) return;
279
280 // Change ascii and account it in fNofAsciiObjects
281 info->SetAscii(ascii);
282 if (ascii) {
283 fNofAsciiObjects++;
284 }
285 else {
286 fNofAsciiObjects--;
287 }
288}

Referenced by G4HnMessenger::SetNewValue().

◆ SetAxisIsLog()

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

Definition at line 331 of file G4HnManager.cc.

332{
333 auto info = GetHnInformation(id, "SetAxisIsLog");
334
335 if (info == nullptr) return false;
336
337 info->SetIsLogAxis(idim, isLog);
338 return true;
339}

Referenced by G4HnMessenger::SetNewValue().

◆ SetDefaultFileType()

void G4HnManager::SetDefaultFileType ( const G4String & fileType)
inline

Definition at line 163 of file G4HnManager.hh.

164{
165 fDefaultFileType = fileType;
166}

◆ SetFileManager()

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

Definition at line 158 of file G4HnManager.hh.

159{
160 fFileManager = std::move(fileManager);
161}

◆ SetFileName() [1/2]

void G4HnManager::SetFileName ( const G4String & fileName)

Definition at line 321 of file G4HnManager.cc.

322{
323// Set plotting to all objects of the given type
324
325 for ( auto info : fHnVector ) {
326 SetFileName(info, fileName);
327 }
328}
void SetFileName(G4int id, const G4String &fileName)

◆ SetFileName() [2/2]

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

Definition at line 311 of file G4HnManager.cc.

312{
313 auto info = GetHnInformation(id, "SetFileName");
314
315 if (info == nullptr) return;
316
317 SetFileName(info, fileName);
318}

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

◆ SetHnDeleted()

void G4HnManager::SetHnDeleted ( G4HnInformation * info,
G4bool keepSetting )

Definition at line 174 of file G4HnManager.cc.

175{
176 info->SetDeleted(true, keepSetting);
177
178 if (info->GetActivation()) { --fNofActiveObjects; }
179 if (info->GetAscii()) { --fNofAsciiObjects; }
180 if (info->GetPlotting()) { --fNofPlottingObjects; }
181 if (! info->GetFileName().empty()) { --fNofFileNameObjects; }
182}
void SetDeleted(G4bool deleted, G4bool keepSetting)

◆ SetPlotting() [1/2]

void G4HnManager::SetPlotting ( G4bool plotting)

Definition at line 301 of file G4HnManager.cc.

302{
303// Set plotting to all objects of the given type
304
305 for ( auto info : fHnVector ) {
306 SetPlotting(info, plotting);
307 }
308}
void SetPlotting(G4int id, G4bool plotting)

◆ SetPlotting() [2/2]

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

Definition at line 291 of file G4HnManager.cc.

292{
293 auto info = GetHnInformation(id, "SetPlotting");
294
295 if (info == nullptr) return;
296
297 SetPlotting(info, plotting);
298}

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


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