Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VAnalysisManager Class Referenceabstract

#include <G4VAnalysisManager.hh>

+ Inheritance diagram for G4VAnalysisManager:

Public Types

enum  ObjectType { kH1 , kH2 , kNtuple }
 

Public Member Functions

 G4VAnalysisManager (const G4String &type="")
 
virtual ~G4VAnalysisManager ()
 
virtual G4bool OpenFile ()
 
virtual G4bool OpenFile (const G4String &fileName)=0
 
virtual G4bool Write ()=0
 
virtual G4bool CloseFile ()=0
 
virtual G4bool SetFileName (const G4String &fileName)
 
virtual G4bool SetHistoDirectoryName (const G4String &dirName)
 
virtual G4bool SetNtupleDirectoryName (const G4String &dirName)
 
virtual G4String GetFileName () const
 
virtual G4String GetFullFileName () const
 
virtual G4String GetHistoDirectoryName () const
 
virtual G4String GetNtupleDirectoryName () const
 
virtual G4int CreateH1 (const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none")=0
 
virtual G4int CreateH2 (const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none")=0
 
virtual G4bool SetH1 (G4int id, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none")=0
 
virtual G4bool SetH2 (G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none")=0
 
virtual G4bool ScaleH1 (G4int id, G4double factor)=0
 
virtual G4bool ScaleH2 (G4int id, G4double factor)=0
 
virtual void CreateNtuple (const G4String &name, const G4String &title)=0
 
virtual G4int CreateNtupleIColumn (const G4String &name)=0
 
virtual G4int CreateNtupleFColumn (const G4String &name)=0
 
virtual G4int CreateNtupleDColumn (const G4String &name)=0
 
virtual void FinishNtuple ()=0
 
virtual G4bool SetFirstHistoId (G4int firstId)
 
virtual G4bool SetFirstNtupleColumnId (G4int firstId)
 
virtual G4bool FillH1 (G4int id, G4double value, G4double weight=1.0)=0
 
virtual G4bool FillH2 (G4int id, G4double xvalue, G4double yvalue, G4double weight=1.0)=0
 
virtual G4bool FillNtupleIColumn (G4int id, G4int value)=0
 
virtual G4bool FillNtupleFColumn (G4int id, G4float value)=0
 
virtual G4bool FillNtupleDColumn (G4int id, G4double value)=0
 
virtual G4bool AddNtupleRow ()=0
 
void SetActivation (G4bool activation)
 
G4bool GetActivation () const
 
G4bool IsActive () const
 
G4bool IsAscii () const
 
virtual G4int GetNofH1s () const
 
virtual G4int GetNofH2s () const
 
void SetActivation (ObjectType type, G4bool activation)
 
void SetActivation (ObjectType type, G4int id, G4bool activation)
 
void SetAscii (ObjectType type, G4int id, G4bool ascii)
 
virtual G4int GetH1Nbins (G4int id) const =0
 
virtual G4double GetH1Xmin (G4int id) const =0
 
virtual G4double GetH1Xmax (G4int id) const =0
 
virtual G4double GetH1Width (G4int id) const =0
 
virtual G4int GetH2Nxbins (G4int id) const =0
 
virtual G4double GetH2Xmin (G4int id) const =0
 
virtual G4double GetH2Xmax (G4int id) const =0
 
virtual G4double GetH2XWidth (G4int id) const =0
 
virtual G4int GetH2Nybins (G4int id) const =0
 
virtual G4double GetH2Ymin (G4int id) const =0
 
virtual G4double GetH2Ymax (G4int id) const =0
 
virtual G4double GetH2YWidth (G4int id) const =0
 
G4String GetH1Name (G4int id) const
 
G4double GetH1Unit (G4int id) const
 
G4bool GetH1Activation (G4int id) const
 
G4bool GetH1Ascii (G4int id) const
 
G4String GetH2Name (G4int id) const
 
G4double GetH2XUnit (G4int id) const
 
G4double GetH2YUnit (G4int id) const
 
G4bool GetH2Activation (G4int id) const
 
G4bool GetH2Ascii (G4int id) const
 
virtual G4bool SetH1Title (G4int id, const G4String &title)=0
 
virtual G4bool SetH1XAxisTitle (G4int id, const G4String &title)=0
 
virtual G4bool SetH1YAxisTitle (G4int id, const G4String &title)=0
 
virtual G4bool SetH2Title (G4int id, const G4String &title)=0
 
virtual G4bool SetH2XAxisTitle (G4int id, const G4String &title)=0
 
virtual G4bool SetH2YAxisTitle (G4int id, const G4String &title)=0
 
virtual G4bool SetH2ZAxisTitle (G4int id, const G4String &title)=0
 
virtual G4String GetH1Title (G4int id) const =0
 
virtual G4String GetH1XAxisTitle (G4int id) const =0
 
virtual G4String GetH1YAxisTitle (G4int id) const =0
 
virtual G4String GetH2Title (G4int id) const =0
 
virtual G4String GetH2XAxisTitle (G4int id) const =0
 
virtual G4String GetH2YAxisTitle (G4int id) const =0
 
virtual G4String GetH2ZAxisTitle (G4int id) const =0
 
virtual G4int GetVerboseLevel () const
 
virtual void SetVerboseLevel (G4int verboseLevel)
 
G4String GetType () const
 
G4String GetFileType () const
 

Protected Member Functions

void AddH1Information (const G4String &name, const G4String &unitName, const G4String &fcnName, G4double unit, G4Fcn fx)
 
void AddH2Information (const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4double xunit, G4double yunit, G4Fcn fx, G4Fcn fy)
 
G4HnInformationGetH1Information (G4int id) const
 
G4HnInformationGetH2Information (G4int id) const
 
G4HnInformationGetInformation (ObjectType type, G4int id) const
 
G4String GetName (ObjectType type, G4int id) const
 
G4double GetXUnit (ObjectType type, G4int id) const
 
G4double GetYUnit (ObjectType type, G4int id) const
 
G4bool GetActivation (ObjectType type, G4int id) const
 
G4bool GetAscii (ObjectType type, G4int id) const
 
G4bool WriteAscii ()
 
virtual G4bool WriteOnAscii (std::ofstream &output)=0
 
G4double GetUnitValue (const G4String &unit) const
 
G4Fcn GetFunction (const G4String &fcnName) const
 

Protected Attributes

G4int fVerboseLevel
 
G4bool fActivation
 
G4int fFirstHistoId
 
G4int fFirstNtupleColumnId
 
G4String fFileName
 
G4String fHistoDirectoryName
 
G4String fNtupleDirectoryName
 
G4bool fLockFirstHistoId
 
G4bool fLockFirstNtupleColumnId
 
G4bool fLockFileName
 
G4bool fLockHistoDirectoryName
 
G4bool fLockNtupleDirectoryName
 
G4AnalysisVerbose fVerboseL1
 
G4AnalysisVerbose fVerboseL2
 
G4AnalysisVerbose fVerboseL3
 
G4AnalysisVerbose fVerboseL4
 
G4AnalysisVerbosefpVerboseL1
 
G4AnalysisVerbosefpVerboseL2
 
G4AnalysisVerbosefpVerboseL3
 
G4AnalysisVerbosefpVerboseL4
 

Detailed Description

Definition at line 42 of file G4VAnalysisManager.hh.

Member Enumeration Documentation

◆ ObjectType

Constructor & Destructor Documentation

◆ G4VAnalysisManager()

G4VAnalysisManager::G4VAnalysisManager ( const G4String type = "")

Definition at line 37 of file G4VAnalysisManager.cc.

38 : fVerboseLevel(0),
39 fActivation(false),
42 fFileName(""),
45 fLockFirstHistoId(false),
47 fLockFileName(false),
50 fVerboseL1(type,1),
51 fVerboseL2(type,2),
52 fVerboseL3(type,3),
53 fVerboseL4(type,4),
54 fpVerboseL1(0),
55 fpVerboseL2(0),
56 fpVerboseL3(0),
57 fpVerboseL4(0),
58 fMessenger(0),
59 fNofActiveObjects(0),
60 fNofAsciiObjects(0),
61 fH1Informations(),
62 fH2Informations()
63{
64 fMessenger = new G4AnalysisMessenger(this);
65}
G4AnalysisVerbose * fpVerboseL4
G4AnalysisVerbose fVerboseL2
G4AnalysisVerbose * fpVerboseL2
G4AnalysisVerbose fVerboseL3
G4AnalysisVerbose * fpVerboseL3
G4AnalysisVerbose fVerboseL4
G4AnalysisVerbose * fpVerboseL1
G4AnalysisVerbose fVerboseL1

◆ ~G4VAnalysisManager()

G4VAnalysisManager::~G4VAnalysisManager ( )
virtual

Definition at line 68 of file G4VAnalysisManager.cc.

69{
70 delete fMessenger;
71 // add delete G4HnInformation objects
72}

Member Function Documentation

◆ AddH1Information()

void G4VAnalysisManager::AddH1Information ( const G4String name,
const G4String unitName,
const G4String fcnName,
G4double  unit,
G4Fcn  fx 
)
protected

Definition at line 79 of file G4VAnalysisManager.cc.

83{
84 fH1Informations.push_back(
85 new G4HnInformation(name, unitName, unitName, fcnName, fcnName,
86 unit, unit, fcn, fcn));
87 ++fNofActiveObjects;
88}

Referenced by G4RootAnalysisManager::CreateH1(), and G4XmlAnalysisManager::CreateH1().

◆ AddH2Information()

void G4VAnalysisManager::AddH2Information ( const G4String name,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName,
G4double  xunit,
G4double  yunit,
G4Fcn  fx,
G4Fcn  fy 
)
protected

Definition at line 91 of file G4VAnalysisManager.cc.

98{
99 fH2Informations.push_back(
100 new G4HnInformation(name, xunitName, yunitName, xfcnName, yfcnName,
101 xunit, yunit, xfcn, yfcn));
102 ++fNofActiveObjects;
103}

Referenced by G4RootAnalysisManager::CreateH2(), and G4XmlAnalysisManager::CreateH2().

◆ AddNtupleRow()

virtual G4bool G4VAnalysisManager::AddNtupleRow ( )
pure virtual

◆ CloseFile()

virtual G4bool G4VAnalysisManager::CloseFile ( )
pure virtual

◆ CreateH1()

virtual G4int G4VAnalysisManager::CreateH1 ( const G4String name,
const G4String title,
G4int  nbins,
G4double  xmin,
G4double  xmax,
const G4String unitName = "none",
const G4String fcnName = "none" 
)
pure virtual

◆ CreateH2()

virtual G4int G4VAnalysisManager::CreateH2 ( const G4String name,
const G4String title,
G4int  nxbins,
G4double  xmin,
G4double  xmax,
G4int  nybins,
G4double  ymin,
G4double  ymax,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none" 
)
pure virtual

◆ CreateNtuple()

virtual void G4VAnalysisManager::CreateNtuple ( const G4String name,
const G4String title 
)
pure virtual

◆ CreateNtupleDColumn()

virtual G4int G4VAnalysisManager::CreateNtupleDColumn ( const G4String name)
pure virtual

◆ CreateNtupleFColumn()

virtual G4int G4VAnalysisManager::CreateNtupleFColumn ( const G4String name)
pure virtual

◆ CreateNtupleIColumn()

virtual G4int G4VAnalysisManager::CreateNtupleIColumn ( const G4String name)
pure virtual

◆ FillH1()

virtual G4bool G4VAnalysisManager::FillH1 ( G4int  id,
G4double  value,
G4double  weight = 1.0 
)
pure virtual

◆ FillH2()

virtual G4bool G4VAnalysisManager::FillH2 ( G4int  id,
G4double  xvalue,
G4double  yvalue,
G4double  weight = 1.0 
)
pure virtual

◆ FillNtupleDColumn()

virtual G4bool G4VAnalysisManager::FillNtupleDColumn ( G4int  id,
G4double  value 
)
pure virtual

◆ FillNtupleFColumn()

virtual G4bool G4VAnalysisManager::FillNtupleFColumn ( G4int  id,
G4float  value 
)
pure virtual

◆ FillNtupleIColumn()

virtual G4bool G4VAnalysisManager::FillNtupleIColumn ( G4int  id,
G4int  value 
)
pure virtual

◆ FinishNtuple()

virtual void G4VAnalysisManager::FinishNtuple ( )
pure virtual

◆ GetActivation() [1/2]

G4bool G4VAnalysisManager::GetActivation ( ) const
inline

◆ GetActivation() [2/2]

G4bool G4VAnalysisManager::GetActivation ( ObjectType  type,
G4int  id 
) const
protected

Definition at line 172 of file G4VAnalysisManager.cc.

173{
174 G4HnInformation* info = GetInformation(type, id);
175
176 if ( ! info ) return true;
177
178 return info->fActivation;
179}
G4HnInformation * GetInformation(ObjectType type, G4int id) const

◆ GetAscii()

G4bool G4VAnalysisManager::GetAscii ( ObjectType  type,
G4int  id 
) const
protected

Definition at line 182 of file G4VAnalysisManager.cc.

183{
184 G4HnInformation* info = GetInformation(type, id);
185
186 if ( ! info ) return false;
187
188 return info->fAscii;
189}

Referenced by GetH1Ascii(), and GetH2Ascii().

◆ GetFileName()

G4String G4VAnalysisManager::GetFileName ( ) const
inlinevirtual

Definition at line 272 of file G4VAnalysisManager.hh.

272 {
273 return fFileName;
274}

◆ GetFileType()

G4String G4VAnalysisManager::GetFileType ( ) const

Definition at line 517 of file G4VAnalysisManager.cc.

518{
519 G4String fileType = fVerboseL1.GetType();
520 fileType.toLower();
521 return fileType;
522}
G4String GetType() const
void toLower()

Referenced by GetFullFileName(), G4CsvAnalysisManager::OpenFile(), G4RootAnalysisManager::OpenFile(), and G4XmlAnalysisManager::OpenFile().

◆ GetFullFileName()

G4String G4VAnalysisManager::GetFullFileName ( ) const
virtual

Definition at line 329 of file G4VAnalysisManager.cc.

330{
331 G4String name(fFileName);
332 if ( name.find(".") == std::string::npos ) {
333 name.append(".");
334 name.append(GetFileType());
335 }
336
337 return name;
338}
G4String GetFileType() const

Referenced by G4CsvAnalysisManager::CloseFile(), G4RootAnalysisManager::CloseFile(), G4XmlAnalysisManager::CloseFile(), G4RootAnalysisManager::Write(), and G4XmlAnalysisManager::Write().

◆ GetFunction()

G4Fcn G4VAnalysisManager::GetFunction ( const G4String fcnName) const
protected

Definition at line 203 of file G4VAnalysisManager.cc.

204{
205 G4Fcn fcn = G4FcnIdentity;
206 if ( fcnName != "none" ) {
207 if ( fcnName == "log" ) fcn = std::log;
208 else if ( fcnName == "log10") fcn = std::log10;
209 else if ( fcnName == "exp" ) fcn = std::exp;
210 else {
211 G4ExceptionDescription description;
212 description
213 << " \"" << fcnName << "\" function is not supported." << G4endl
214 << " " << "No function will be applied to h1 values.";
215 G4Exception("G4AnalysisMessenger::GetFunction",
216 "Analysis_W013", JustWarning, description);
217 }
218 }
219 return fcn;
220}
@ JustWarning
G4double G4FcnIdentity(G4double value)
Definition: G4Fcn.hh:39
G4double(* G4Fcn)(G4double)
Definition: G4Fcn.hh:36
#define G4endl
Definition: G4ios.hh:52
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

Referenced by G4RootAnalysisManager::CreateH1(), G4XmlAnalysisManager::CreateH1(), G4RootAnalysisManager::CreateH2(), G4XmlAnalysisManager::CreateH2(), G4RootAnalysisManager::SetH1(), G4XmlAnalysisManager::SetH1(), G4RootAnalysisManager::SetH2(), and G4XmlAnalysisManager::SetH2().

◆ GetH1Activation()

G4bool G4VAnalysisManager::GetH1Activation ( G4int  id) const
inline

Definition at line 316 of file G4VAnalysisManager.hh.

316 {
317 return GetActivation(kH1, id);
318}
G4bool GetActivation() const

◆ GetH1Ascii()

G4bool G4VAnalysisManager::GetH1Ascii ( G4int  id) const
inline

Definition at line 320 of file G4VAnalysisManager.hh.

320 {
321 return GetAscii(kH1, id);
322}
G4bool GetAscii(ObjectType type, G4int id) const

◆ GetH1Information()

G4HnInformation * G4VAnalysisManager::GetH1Information ( G4int  id) const
protected

Definition at line 387 of file G4VAnalysisManager.cc.

388{
389 G4int index = id - fFirstHistoId;
390 if ( index < 0 || index >= GetNofH1s() ) {
391 G4ExceptionDescription description;
392 description << " " << "histo " << id << " does not exist.";
393 G4Exception("G4VAnalysisManager::GetH1Information()",
394 "Analysis_W007", JustWarning, description);
395 return 0;
396 }
397 return fH1Informations[index];
398}
int G4int
Definition: G4Types.hh:66
virtual G4int GetNofH1s() const

Referenced by GetInformation(), G4RootAnalysisManager::SetH1(), G4XmlAnalysisManager::SetH1(), G4RootAnalysisManager::Write(), G4XmlAnalysisManager::Write(), G4RootAnalysisManager::WriteOnAscii(), and G4XmlAnalysisManager::WriteOnAscii().

◆ GetH1Name()

G4String G4VAnalysisManager::GetH1Name ( G4int  id) const
inline

Definition at line 308 of file G4VAnalysisManager.hh.

308 {
309 return GetName(kH1, id);
310}
G4String GetName(ObjectType type, G4int id) const

◆ GetH1Nbins()

virtual G4int G4VAnalysisManager::GetH1Nbins ( G4int  id) const
pure virtual

◆ GetH1Title()

virtual G4String G4VAnalysisManager::GetH1Title ( G4int  id) const
pure virtual

◆ GetH1Unit()

G4double G4VAnalysisManager::GetH1Unit ( G4int  id) const
inline

Definition at line 312 of file G4VAnalysisManager.hh.

312 {
313 return GetXUnit(kH1, id);
314}
G4double GetXUnit(ObjectType type, G4int id) const

◆ GetH1Width()

virtual G4double G4VAnalysisManager::GetH1Width ( G4int  id) const
pure virtual

◆ GetH1XAxisTitle()

virtual G4String G4VAnalysisManager::GetH1XAxisTitle ( G4int  id) const
pure virtual

◆ GetH1Xmax()

virtual G4double G4VAnalysisManager::GetH1Xmax ( G4int  id) const
pure virtual

◆ GetH1Xmin()

virtual G4double G4VAnalysisManager::GetH1Xmin ( G4int  id) const
pure virtual

◆ GetH1YAxisTitle()

virtual G4String G4VAnalysisManager::GetH1YAxisTitle ( G4int  id) const
pure virtual

◆ GetH2Activation()

G4bool G4VAnalysisManager::GetH2Activation ( G4int  id) const
inline

Definition at line 336 of file G4VAnalysisManager.hh.

336 {
337 return GetActivation(kH2, id);
338}

◆ GetH2Ascii()

G4bool G4VAnalysisManager::GetH2Ascii ( G4int  id) const
inline

Definition at line 340 of file G4VAnalysisManager.hh.

340 {
341 return GetAscii(kH2, id);
342}

◆ GetH2Information()

G4HnInformation * G4VAnalysisManager::GetH2Information ( G4int  id) const
protected

Definition at line 401 of file G4VAnalysisManager.cc.

402{
403 G4int index = id - fFirstHistoId;
404 if ( index < 0 || index >= GetNofH2s() ) {
405 G4ExceptionDescription description;
406 description << " " << "histo " << id << " does not exist.";
407 G4Exception("G4VAnalysisManager::GetH2Information()",
408 "Analysis_W007", JustWarning, description);
409 return 0;
410 }
411 return fH2Informations[index];
412}
virtual G4int GetNofH2s() const

Referenced by GetInformation(), G4RootAnalysisManager::SetH2(), G4XmlAnalysisManager::SetH2(), G4RootAnalysisManager::Write(), and G4XmlAnalysisManager::Write().

◆ GetH2Name()

G4String G4VAnalysisManager::GetH2Name ( G4int  id) const
inline

Definition at line 324 of file G4VAnalysisManager.hh.

324 {
325 return GetName(kH2, id);
326}

◆ GetH2Nxbins()

virtual G4int G4VAnalysisManager::GetH2Nxbins ( G4int  id) const
pure virtual

◆ GetH2Nybins()

virtual G4int G4VAnalysisManager::GetH2Nybins ( G4int  id) const
pure virtual

◆ GetH2Title()

virtual G4String G4VAnalysisManager::GetH2Title ( G4int  id) const
pure virtual

◆ GetH2XAxisTitle()

virtual G4String G4VAnalysisManager::GetH2XAxisTitle ( G4int  id) const
pure virtual

◆ GetH2Xmax()

virtual G4double G4VAnalysisManager::GetH2Xmax ( G4int  id) const
pure virtual

◆ GetH2Xmin()

virtual G4double G4VAnalysisManager::GetH2Xmin ( G4int  id) const
pure virtual

◆ GetH2XUnit()

G4double G4VAnalysisManager::GetH2XUnit ( G4int  id) const
inline

Definition at line 328 of file G4VAnalysisManager.hh.

328 {
329 return GetXUnit(kH2, id);
330}

◆ GetH2XWidth()

virtual G4double G4VAnalysisManager::GetH2XWidth ( G4int  id) const
pure virtual

◆ GetH2YAxisTitle()

virtual G4String G4VAnalysisManager::GetH2YAxisTitle ( G4int  id) const
pure virtual

◆ GetH2Ymax()

virtual G4double G4VAnalysisManager::GetH2Ymax ( G4int  id) const
pure virtual

◆ GetH2Ymin()

virtual G4double G4VAnalysisManager::GetH2Ymin ( G4int  id) const
pure virtual

◆ GetH2YUnit()

G4double G4VAnalysisManager::GetH2YUnit ( G4int  id) const
inline

Definition at line 332 of file G4VAnalysisManager.hh.

332 {
333 return GetYUnit(kH2, id);
334}
G4double GetYUnit(ObjectType type, G4int id) const

◆ GetH2YWidth()

virtual G4double G4VAnalysisManager::GetH2YWidth ( G4int  id) const
pure virtual

◆ GetH2ZAxisTitle()

virtual G4String G4VAnalysisManager::GetH2ZAxisTitle ( G4int  id) const
pure virtual

◆ GetHistoDirectoryName()

G4String G4VAnalysisManager::GetHistoDirectoryName ( ) const
inlinevirtual

Definition at line 276 of file G4VAnalysisManager.hh.

276 {
277 return fHistoDirectoryName;
278}

◆ GetInformation()

G4HnInformation * G4VAnalysisManager::GetInformation ( ObjectType  type,
G4int  id 
) const
protected

Definition at line 415 of file G4VAnalysisManager.cc.

416{
417 switch ( objType ) {
418 case kH1:
419 return GetH1Information(id);
420 break;
421
422 case kH2:
423 return GetH2Information(id);
424 break;
425
426 case kNtuple:
427 default:
428 return 0;
429 break;
430 }
431
432 // Cannot reach this line
433 G4ExceptionDescription description;
434 description << "Wrong object type.";
435 G4Exception("G4VAnalysisManager::SetFirstHistoId()",
436 "Analysis_W010", FatalException, description);
437 return 0;
438}
@ FatalException
G4HnInformation * GetH2Information(G4int id) const
G4HnInformation * GetH1Information(G4int id) const

Referenced by G4RootAnalysisManager::FillH1(), G4XmlAnalysisManager::FillH1(), G4RootAnalysisManager::FillH2(), G4XmlAnalysisManager::FillH2(), GetActivation(), GetAscii(), G4RootAnalysisManager::GetH1Width(), G4XmlAnalysisManager::GetH1Width(), G4RootAnalysisManager::GetH1Xmax(), G4XmlAnalysisManager::GetH1Xmax(), G4RootAnalysisManager::GetH1Xmin(), G4XmlAnalysisManager::GetH1Xmin(), G4RootAnalysisManager::GetH2Xmax(), G4XmlAnalysisManager::GetH2Xmax(), G4RootAnalysisManager::GetH2Xmin(), G4XmlAnalysisManager::GetH2Xmin(), G4RootAnalysisManager::GetH2XWidth(), G4XmlAnalysisManager::GetH2XWidth(), G4RootAnalysisManager::GetH2Ymax(), G4XmlAnalysisManager::GetH2Ymax(), G4RootAnalysisManager::GetH2Ymin(), G4XmlAnalysisManager::GetH2Ymin(), G4RootAnalysisManager::GetH2YWidth(), G4XmlAnalysisManager::GetH2YWidth(), GetName(), GetXUnit(), GetYUnit(), SetActivation(), and SetAscii().

◆ GetName()

G4String G4VAnalysisManager::GetName ( ObjectType  type,
G4int  id 
) const
protected

Definition at line 142 of file G4VAnalysisManager.cc.

143{
144 G4HnInformation* info = GetInformation(type, id);
145
146 if ( ! info ) return "";
147
148 return info->fName;
149}

Referenced by GetH1Name(), and GetH2Name().

◆ GetNofH1s()

G4int G4VAnalysisManager::GetNofH1s ( ) const
inlinevirtual

Definition at line 300 of file G4VAnalysisManager.hh.

300 {
301 return fH1Informations.size();
302}

Referenced by GetH1Information().

◆ GetNofH2s()

G4int G4VAnalysisManager::GetNofH2s ( ) const
inlinevirtual

Definition at line 304 of file G4VAnalysisManager.hh.

304 {
305 return fH2Informations.size();
306}

Referenced by GetH2Information().

◆ GetNtupleDirectoryName()

G4String G4VAnalysisManager::GetNtupleDirectoryName ( ) const
inlinevirtual

Definition at line 280 of file G4VAnalysisManager.hh.

280 {
282}

◆ GetType()

G4String G4VAnalysisManager::GetType ( ) const
inline

Definition at line 288 of file G4VAnalysisManager.hh.

288 {
289 return fVerboseL1.GetType();
290}

◆ GetUnitValue()

G4double G4VAnalysisManager::GetUnitValue ( const G4String unit) const
protected

Definition at line 192 of file G4VAnalysisManager.cc.

193{
194 G4double value = 1.;
195 if ( unit != "none" ) {
196 value = G4UnitDefinition::GetValueOf(unit);
197 if ( value == 0. ) value = 1.;
198 }
199 return value;
200}
double G4double
Definition: G4Types.hh:64
static G4double GetValueOf(const G4String &)

Referenced by G4RootAnalysisManager::CreateH1(), G4XmlAnalysisManager::CreateH1(), G4RootAnalysisManager::CreateH2(), G4XmlAnalysisManager::CreateH2(), G4RootAnalysisManager::SetH1(), G4XmlAnalysisManager::SetH1(), G4RootAnalysisManager::SetH2(), and G4XmlAnalysisManager::SetH2().

◆ GetVerboseLevel()

G4int G4VAnalysisManager::GetVerboseLevel ( ) const
inlinevirtual

Definition at line 284 of file G4VAnalysisManager.hh.

284 {
285 return fVerboseLevel;
286}

◆ GetXUnit()

G4double G4VAnalysisManager::GetXUnit ( ObjectType  type,
G4int  id 
) const
protected

Definition at line 152 of file G4VAnalysisManager.cc.

153{
154 G4HnInformation* info = GetInformation(type, id);
155
156 if ( ! info ) return 1.0;
157
158 return info->fXUnit;
159}

Referenced by G4XmlAnalysisManager::FillH1(), G4XmlAnalysisManager::FillH2(), GetH1Unit(), and GetH2XUnit().

◆ GetYUnit()

G4double G4VAnalysisManager::GetYUnit ( ObjectType  type,
G4int  id 
) const
protected

Definition at line 162 of file G4VAnalysisManager.cc.

163{
164 G4HnInformation* info = GetInformation(type, id);
165
166 if ( ! info ) return 1.0;
167
168 return info->fYUnit;
169}

Referenced by G4XmlAnalysisManager::FillH2(), and GetH2YUnit().

◆ IsActive()

G4bool G4VAnalysisManager::IsActive ( ) const

Definition at line 373 of file G4VAnalysisManager.cc.

374{
375 if ( ! fActivation ) return true;
376
377 return ( fNofActiveObjects > 0 );
378}

◆ IsAscii()

G4bool G4VAnalysisManager::IsAscii ( ) const

Definition at line 381 of file G4VAnalysisManager.cc.

382{
383 return ( fNofAsciiObjects > 0 );
384}

Referenced by G4CsvAnalysisManager::Write(), G4RootAnalysisManager::Write(), and G4XmlAnalysisManager::Write().

◆ OpenFile() [1/2]

G4bool G4VAnalysisManager::OpenFile ( )
virtual

Reimplemented in G4CsvAnalysisManager, G4RootAnalysisManager, and G4XmlAnalysisManager.

Definition at line 266 of file G4VAnalysisManager.cc.

267{
268 if ( fFileName == "" ) {
269 G4ExceptionDescription description;
270 description
271 << "Cannot open file. File name is not defined.";
272 G4Exception("G4VAnalysisManager::OpenFile()",
273 "Analysis_W009", JustWarning, description);
274 return false;
275 }
276
277 return OpenFile(fFileName);
278}
virtual G4bool OpenFile()

Referenced by OpenFile().

◆ OpenFile() [2/2]

virtual G4bool G4VAnalysisManager::OpenFile ( const G4String fileName)
pure virtual

◆ ScaleH1()

virtual G4bool G4VAnalysisManager::ScaleH1 ( G4int  id,
G4double  factor 
)
pure virtual

◆ ScaleH2()

virtual G4bool G4VAnalysisManager::ScaleH2 ( G4int  id,
G4double  factor 
)
pure virtual

◆ SetActivation() [1/3]

void G4VAnalysisManager::SetActivation ( G4bool  activation)
inline

◆ SetActivation() [2/3]

void G4VAnalysisManager::SetActivation ( ObjectType  type,
G4bool  activation 
)

Definition at line 462 of file G4VAnalysisManager.cc.

463{
464// Set activation to all objects of the given type
465
466 std::vector<G4HnInformation*>* informations;
467 if ( type == kH1 )
468 informations = &fH1Informations;
469 else if ( type == kH2 )
470 informations = &fH2Informations;
471 else if ( type == kNtuple ) {
472 return;
473 }
474 else {
475 G4ExceptionDescription description;
476 description << "Wrong object type.";
477 G4Exception("G4VAnalysisManager::SetActivation()",
478 "Analysis_W010", FatalException, description);
479 return;
480 }
481
482 std::vector<G4HnInformation*>::iterator it;
483 for ( it = informations->begin(); it != informations->end(); it++ ) {
484 G4HnInformation* info = *it;
485
486 // Do nothing if activation does not change
487 if ( info->fActivation == activation ) continue;
488
489 // Change activation and account it in fNofActiveObjects
490 info->fActivation = activation;
491 if ( activation )
492 fNofActiveObjects++;
493 else
494 fNofActiveObjects--;
495 }
496}

◆ SetActivation() [3/3]

void G4VAnalysisManager::SetActivation ( ObjectType  type,
G4int  id,
G4bool  activation 
)

Definition at line 441 of file G4VAnalysisManager.cc.

443{
444// Set activation to a given object
445
446 G4HnInformation* info = GetInformation(type, id);
447
448 if ( ! info ) return;
449
450 // Do nothing if activation does not change
451 if ( info->fActivation == activation ) return;
452
453 // Change activation and account it in fNofActiveObjects
454 info->fActivation = activation;
455 if ( activation )
456 fNofActiveObjects++;
457 else
458 fNofActiveObjects--;
459}

◆ SetAscii()

void G4VAnalysisManager::SetAscii ( ObjectType  type,
G4int  id,
G4bool  ascii 
)

Definition at line 499 of file G4VAnalysisManager.cc.

500{
501 G4HnInformation* info = GetInformation(type, id);
502
503 if ( ! info ) return;
504
505 // Do nothing if ascii does not change
506 if ( info->fAscii == ascii ) return;
507
508 // Change ascii and account it in fNofAsciiObjects
509 info->fAscii = ascii;
510 if ( ascii )
511 fNofAsciiObjects++;
512 else
513 fNofAsciiObjects--;
514}

Referenced by G4AnalysisMessenger::SetNewValue().

◆ SetFileName()

G4bool G4VAnalysisManager::SetFileName ( const G4String fileName)
virtual

Definition at line 281 of file G4VAnalysisManager.cc.

282{
283 if ( fLockFileName ) {
284 G4ExceptionDescription description;
285 description
286 << "Cannot set File name as its value was already used.";
287 G4Exception("G4VAnalysisManager::SetFileName()",
288 "Analysis_W009", JustWarning, description);
289 return false;
290 }
291
292 fFileName = fileName;
293 return true;
294}

Referenced by G4AnalysisMessenger::SetNewValue().

◆ SetFirstHistoId()

G4bool G4VAnalysisManager::SetFirstHistoId ( G4int  firstId)
virtual

Definition at line 341 of file G4VAnalysisManager.cc.

342{
343 if ( fLockFirstHistoId ) {
344 G4ExceptionDescription description;
345 description
346 << "Cannot set FirstHistoId as its value was already used.";
347 G4Exception("G4VAnalysisManager::SetFirstHistoId()",
348 "Analysis_W009", JustWarning, description);
349 return false;
350 }
351
352 fFirstHistoId = firstId;
353 return true;
354}

◆ SetFirstNtupleColumnId()

G4bool G4VAnalysisManager::SetFirstNtupleColumnId ( G4int  firstId)
virtual

Definition at line 357 of file G4VAnalysisManager.cc.

358{
360 G4ExceptionDescription description;
361 description
362 << "Cannot set FirstNtupleColumnId as its value was already used.";
363 G4Exception("G4VAnalysisManager::SetFirstHistoId()",
364 "Analysis_W010", JustWarning, description);
365 return false;
366 }
367
368 fFirstNtupleColumnId = firstId;
369 return true;
370}

◆ SetH1()

virtual G4bool G4VAnalysisManager::SetH1 ( G4int  id,
G4int  nbins,
G4double  xmin,
G4double  xmax,
const G4String unitName = "none",
const G4String fcnName = "none" 
)
pure virtual

◆ SetH1Title()

virtual G4bool G4VAnalysisManager::SetH1Title ( G4int  id,
const G4String title 
)
pure virtual

◆ SetH1XAxisTitle()

virtual G4bool G4VAnalysisManager::SetH1XAxisTitle ( G4int  id,
const G4String title 
)
pure virtual

◆ SetH1YAxisTitle()

virtual G4bool G4VAnalysisManager::SetH1YAxisTitle ( G4int  id,
const G4String title 
)
pure virtual

◆ SetH2()

virtual G4bool G4VAnalysisManager::SetH2 ( G4int  id,
G4int  nxbins,
G4double  xmin,
G4double  xmax,
G4int  nybins,
G4double  ymin,
G4double  ymax,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none" 
)
pure virtual

◆ SetH2Title()

virtual G4bool G4VAnalysisManager::SetH2Title ( G4int  id,
const G4String title 
)
pure virtual

◆ SetH2XAxisTitle()

virtual G4bool G4VAnalysisManager::SetH2XAxisTitle ( G4int  id,
const G4String title 
)
pure virtual

◆ SetH2YAxisTitle()

virtual G4bool G4VAnalysisManager::SetH2YAxisTitle ( G4int  id,
const G4String title 
)
pure virtual

◆ SetH2ZAxisTitle()

virtual G4bool G4VAnalysisManager::SetH2ZAxisTitle ( G4int  id,
const G4String title 
)
pure virtual

◆ SetHistoDirectoryName()

G4bool G4VAnalysisManager::SetHistoDirectoryName ( const G4String dirName)
virtual

Definition at line 297 of file G4VAnalysisManager.cc.

298{
300 G4ExceptionDescription description;
301 description
302 << "Cannot set Histo directory name as its value was already used.";
303 G4Exception("G4VAnalysisManager::SetHistoDirectoryName()",
304 "Analysis_W009", JustWarning, description);
305 return false;
306 }
307
308 fHistoDirectoryName = dirName;
309 return true;
310}

Referenced by G4AnalysisMessenger::SetNewValue().

◆ SetNtupleDirectoryName()

G4bool G4VAnalysisManager::SetNtupleDirectoryName ( const G4String dirName)
virtual

Definition at line 313 of file G4VAnalysisManager.cc.

314{
316 G4ExceptionDescription description;
317 description
318 << "Cannot set Ntuple directory name as its value was already used.";
319 G4Exception("G4VAnalysisManager::SetNtupleDirectoryName()",
320 "Analysis_W010", JustWarning, description);
321 return false;
322 }
323
324 fNtupleDirectoryName = dirName;
325 return true;
326}

Referenced by G4AnalysisMessenger::SetNewValue().

◆ SetVerboseLevel()

void G4VAnalysisManager::SetVerboseLevel ( G4int  verboseLevel)
virtual

Definition at line 227 of file G4VAnalysisManager.cc.

228{
229 if ( verboseLevel == fVerboseLevel || verboseLevel < 0 ) return;
230
231 fVerboseLevel = verboseLevel;
232
233 if ( verboseLevel == 0 ) {
234 fpVerboseL1 = 0;
235 fpVerboseL2 = 0;
236 fpVerboseL3 = 0;
237 fpVerboseL4 = 0;
238 }
239 else if ( verboseLevel == 1 ) {
241 fpVerboseL2 = 0;
242 fpVerboseL3 = 0;
243 fpVerboseL4 = 0;
244 }
245 else if ( verboseLevel == 2 ) {
248 fpVerboseL3 = 0;
249 fpVerboseL4 = 0;
250 }
251 else if ( verboseLevel == 3 ) {
255 fpVerboseL4 = 0;
256 }
257 else {
262 }
263}

Referenced by G4AnalysisMessenger::SetNewValue().

◆ Write()

virtual G4bool G4VAnalysisManager::Write ( )
pure virtual

◆ WriteAscii()

G4bool G4VAnalysisManager::WriteAscii ( )
protected

Definition at line 106 of file G4VAnalysisManager.cc.

107{
108 // Replace or add file extension .ascii
109 G4String name(fFileName);
110 if ( name.find(".") != std::string::npos ) {
111 name.erase(name.find("."), name.length());
112 }
113 name.append(".ascii");
114
115#ifdef G4VERBOSE
116 if ( fpVerboseL3 )
117 fpVerboseL3->Message("write ASCII", "file", name);
118#endif
119
120 std::ofstream output(name, std::ios::out);
121 if ( ! output ) {
122 G4ExceptionDescription description;
123 description
124 << "Cannot open file. File name is not defined.";
125 G4Exception("G4VAnalysisManager::WriteAscii()",
126 "Analysis_W009", JustWarning, description);
127 return false;
128 }
129 output.setf( std::ios::scientific, std::ios::floatfield );
130
131 G4bool result = WriteOnAscii(output);
132
133#ifdef G4VERBOSE
134 if ( fpVerboseL1 )
135 fpVerboseL1->Message("write ASCII", "file", name, result);
136#endif
137
138 return result;
139}
bool G4bool
Definition: G4Types.hh:67
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true)
virtual G4bool WriteOnAscii(std::ofstream &output)=0

Referenced by G4CsvAnalysisManager::Write(), G4RootAnalysisManager::Write(), and G4XmlAnalysisManager::Write().

◆ WriteOnAscii()

virtual G4bool G4VAnalysisManager::WriteOnAscii ( std::ofstream &  output)
protectedpure virtual

Member Data Documentation

◆ fActivation

◆ fFileName

◆ fFirstHistoId

◆ fFirstNtupleColumnId

◆ fHistoDirectoryName

G4String G4VAnalysisManager::fHistoDirectoryName
protected

◆ fLockFileName

◆ fLockFirstHistoId

◆ fLockFirstNtupleColumnId

◆ fLockHistoDirectoryName

G4bool G4VAnalysisManager::fLockHistoDirectoryName
protected

◆ fLockNtupleDirectoryName

G4bool G4VAnalysisManager::fLockNtupleDirectoryName
protected

◆ fNtupleDirectoryName

G4String G4VAnalysisManager::fNtupleDirectoryName
protected

◆ fpVerboseL1

◆ fpVerboseL2

◆ fpVerboseL3

◆ fpVerboseL4

G4AnalysisVerbose* G4VAnalysisManager::fpVerboseL4
protected

Definition at line 258 of file G4VAnalysisManager.hh.

Referenced by G4CsvAnalysisManager::AddNtupleRow(), G4RootAnalysisManager::AddNtupleRow(), G4XmlAnalysisManager::AddNtupleRow(), G4CsvAnalysisManager::CloseFile(), G4RootAnalysisManager::CloseFile(), G4XmlAnalysisManager::CloseFile(), G4RootAnalysisManager::CreateH1(), G4XmlAnalysisManager::CreateH1(), G4RootAnalysisManager::CreateH2(), G4XmlAnalysisManager::CreateH2(), G4CsvAnalysisManager::CreateNtuple(), G4RootAnalysisManager::CreateNtuple(), G4XmlAnalysisManager::CreateNtuple(), G4CsvAnalysisManager::CreateNtupleDColumn(), G4RootAnalysisManager::CreateNtupleDColumn(), G4XmlAnalysisManager::CreateNtupleDColumn(), G4CsvAnalysisManager::CreateNtupleFColumn(), G4RootAnalysisManager::CreateNtupleFColumn(), G4XmlAnalysisManager::CreateNtupleFColumn(), G4CsvAnalysisManager::CreateNtupleIColumn(), G4RootAnalysisManager::CreateNtupleIColumn(), G4XmlAnalysisManager::CreateNtupleIColumn(), G4RootAnalysisManager::FillH1(), G4XmlAnalysisManager::FillH1(), G4RootAnalysisManager::FillH2(), G4XmlAnalysisManager::FillH2(), G4CsvAnalysisManager::FillNtupleDColumn(), G4RootAnalysisManager::FillNtupleDColumn(), G4XmlAnalysisManager::FillNtupleDColumn(), G4CsvAnalysisManager::FillNtupleFColumn(), G4RootAnalysisManager::FillNtupleFColumn(), G4XmlAnalysisManager::FillNtupleFColumn(), G4CsvAnalysisManager::FillNtupleIColumn(), G4RootAnalysisManager::FillNtupleIColumn(), G4XmlAnalysisManager::FillNtupleIColumn(), G4XmlAnalysisManager::FinishNtuple(), G4CsvAnalysisManager::OpenFile(), G4RootAnalysisManager::OpenFile(), G4XmlAnalysisManager::OpenFile(), G4RootAnalysisManager::SetH1(), G4XmlAnalysisManager::SetH1(), G4RootAnalysisManager::SetH2(), G4XmlAnalysisManager::SetH2(), SetVerboseLevel(), and G4RootAnalysisManager::Write().

◆ fVerboseL1

G4AnalysisVerbose G4VAnalysisManager::fVerboseL1
protected

Definition at line 251 of file G4VAnalysisManager.hh.

Referenced by GetFileType(), GetType(), and SetVerboseLevel().

◆ fVerboseL2

G4AnalysisVerbose G4VAnalysisManager::fVerboseL2
protected

Definition at line 252 of file G4VAnalysisManager.hh.

Referenced by SetVerboseLevel().

◆ fVerboseL3

G4AnalysisVerbose G4VAnalysisManager::fVerboseL3
protected

Definition at line 253 of file G4VAnalysisManager.hh.

Referenced by SetVerboseLevel().

◆ fVerboseL4

G4AnalysisVerbose G4VAnalysisManager::fVerboseL4
protected

Definition at line 254 of file G4VAnalysisManager.hh.

Referenced by SetVerboseLevel().

◆ fVerboseLevel

G4int G4VAnalysisManager::fVerboseLevel
protected

Definition at line 237 of file G4VAnalysisManager.hh.

Referenced by GetVerboseLevel(), and SetVerboseLevel().


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