Geant4  10.02.p03
ExG4HbookBaseHnManager Class Reference

#include <ExG4HbookBaseHnManager.hh>

Collaboration diagram for ExG4HbookBaseHnManager:

Public Member Functions

 ExG4HbookBaseHnManager (const G4String &hnType)
 
virtual ~ExG4HbookBaseHnManager ()
 

Protected Types

typedef tools::hbook::base_histo G4HbookBaseHisto
 

Protected Member Functions

G4int GetNbins (const tools::hbook::axis &axis) const
 
G4double GetMin (const tools::hbook::axis &axis) const
 
G4double GetMax (const tools::hbook::axis &axis) const
 
G4double GetWidth (const tools::hbook::axis &axis) const
 
G4bool SetAxisTitle (G4HbookBaseHisto &baseHisto, G4int dimension, const G4String &title)
 
G4String GetAxisTitle (const G4HbookBaseHisto &baseHisto, G4int dimension) const
 

Static Protected Attributes

static const G4int kX = 0
 
static const G4int kY = 1
 
static const G4int kZ = 2
 

Private Attributes

G4String fHnType
 

Friends

class ExG4HbookH1Manager
 
class ExG4HbookH2Manager
 
class ExG4HbookP1Manager
 

Detailed Description

Manager class for tools::hbook::base_histo functions.

It implements functions common to all hbook histograms and profiles.

Definition at line 45 of file ExG4HbookBaseHnManager.hh.

Member Typedef Documentation

◆ G4HbookBaseHisto

typedef tools::hbook::base_histo ExG4HbookBaseHnManager::G4HbookBaseHisto
protected

Definition at line 56 of file ExG4HbookBaseHnManager.hh.

Constructor & Destructor Documentation

◆ ExG4HbookBaseHnManager()

ExG4HbookBaseHnManager::ExG4HbookBaseHnManager ( const G4String hnType)

Definition at line 46 of file ExG4HbookBaseHnManager.cc.

47  : fHnType(hnType)
48 {
49 }

◆ ~ExG4HbookBaseHnManager()

ExG4HbookBaseHnManager::~ExG4HbookBaseHnManager ( )
virtual

Definition at line 52 of file ExG4HbookBaseHnManager.cc.

53 {
54 }

Member Function Documentation

◆ GetAxisTitle()

G4String ExG4HbookBaseHnManager::GetAxisTitle ( const G4HbookBaseHisto baseHisto,
G4int  dimension 
) const
protected

Definition at line 130 of file ExG4HbookBaseHnManager.cc.

132 {
133  G4String title;
134  G4bool result = false;
135  if ( dimension == 0 ) {
136  result = baseHisto.annotation(tools::hbook::key_axis_x_title(), title);
137  }
138  else if ( dimension == 1 ) {
139  result = baseHisto.annotation(tools::hbook::key_axis_y_title(), title);
140  }
141  else if ( dimension == 2 ) {
142  result = baseHisto.annotation(tools::hbook::key_axis_z_title(), title);
143  }
144 
145  if ( ! result ) {
146  G4String axes("xyz");
147  G4String axis = axes(dimension, 1);
148  G4String functionName = "ExG4HbookBaseHnManager::Get";
149  functionName += fHnType;
150  functionName += axis;
151  functionName += "Title";
152  G4ExceptionDescription description;
153  description << " Failed to get " << axis << " axis " << fHnType << " title.";
154  G4Exception(functionName, "Analysis_W014", JustWarning, description);
155  return "";
156  }
157 
158  return title;
159 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
subroutine title
Definition: hijing1.383.f:5981
Here is the call graph for this function:

◆ GetMax()

G4double ExG4HbookBaseHnManager::GetMax ( const tools::hbook::axis &  axis) const
protected

Definition at line 71 of file ExG4HbookBaseHnManager.cc.

72 {
73 // Returns max data value
74 
75  return axis.upper_edge();
76 }

◆ GetMin()

G4double ExG4HbookBaseHnManager::GetMin ( const tools::hbook::axis &  axis) const
protected

Definition at line 63 of file ExG4HbookBaseHnManager.cc.

64 {
65 // Returns min data value
66 
67  return axis.lower_edge();
68 }

◆ GetNbins()

G4int ExG4HbookBaseHnManager::GetNbins ( const tools::hbook::axis &  axis) const
protected

Definition at line 57 of file ExG4HbookBaseHnManager.cc.

58 {
59  return axis.bins();
60 }

◆ GetWidth()

G4double ExG4HbookBaseHnManager::GetWidth ( const tools::hbook::axis &  axis) const
protected

Definition at line 79 of file ExG4HbookBaseHnManager.cc.

80 {
81  G4int nbins = axis.bins();
82  if ( ! nbins ) {
83  G4String functionName = "ExG4HbookBaseHnManager::Get";
84  functionName += fHnType;
85  functionName += "Width";
86  G4ExceptionDescription description;
87  description << " nbins = 0 (for " << fHnType << ").";
88  G4Exception(functionName, "Analysis_W014", JustWarning, description);
89  return 0;
90  }
91 
92  return ( axis.upper_edge() - axis.lower_edge() )/nbins;
93 }
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:

◆ SetAxisTitle()

G4bool ExG4HbookBaseHnManager::SetAxisTitle ( G4HbookBaseHisto baseHisto,
G4int  dimension,
const G4String title 
)
protected

Definition at line 104 of file ExG4HbookBaseHnManager.cc.

106 {
107  if ( title == "" ) return false;
108 
109  if ( dimension == 0 ) {
110  baseHisto.add_annotation(tools::hbook::key_axis_x_title(), title);
111  }
112  else if ( dimension == 1 ) {
113  baseHisto.add_annotation(tools::hbook::key_axis_y_title(), title);
114  }
115  else if ( dimension == 2 ) {
116  baseHisto.add_annotation(tools::hbook::key_axis_z_title(), title);
117  }
118 
119  return true;
120 }

Friends And Related Function Documentation

◆ ExG4HbookH1Manager

friend class ExG4HbookH1Manager
friend

Definition at line 51 of file ExG4HbookBaseHnManager.hh.

◆ ExG4HbookH2Manager

friend class ExG4HbookH2Manager
friend

Definition at line 52 of file ExG4HbookBaseHnManager.hh.

◆ ExG4HbookP1Manager

friend class ExG4HbookP1Manager
friend

Definition at line 53 of file ExG4HbookBaseHnManager.hh.

Member Data Documentation

◆ fHnType

G4String ExG4HbookBaseHnManager::fHnType
private

Definition at line 82 of file ExG4HbookBaseHnManager.hh.

◆ kX

const G4int ExG4HbookBaseHnManager::kX = 0
staticprotected

Definition at line 76 of file ExG4HbookBaseHnManager.hh.

◆ kY

const G4int ExG4HbookBaseHnManager::kY = 1
staticprotected

Definition at line 77 of file ExG4HbookBaseHnManager.hh.

◆ kZ

const G4int ExG4HbookBaseHnManager::kZ = 2
staticprotected

Definition at line 78 of file ExG4HbookBaseHnManager.hh.


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