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

Functions

G4MergeMode GetMergeMode (const G4String &mergeModeName)
 
template<typename T >
G4MergeFunction< T > GetMergeFunction (G4MergeMode mergeMode)
 
template<G4bool >
G4MergeFunction< G4boolGetMergeFunction (G4MergeMode mergeMode)
 

Function Documentation

◆ GetMergeFunction() [1/2]

template<typename T >
G4MergeFunction< T > G4Accumulables::GetMergeFunction ( G4MergeMode  mergeMode)

Definition at line 56 of file G4MergeMode.hh.

57{
58 switch ( mergeMode ) {
60 // return std::bind([](const T& x, const T& y) { return x + y; });
61 return [](const T& x, const T& y) { return x + y; };
62
64 return [](const T& x, const T& y) { return x * y; };
65
67 // return std::bind([](const T& x, const T& y) { return std::max(x,y);});
68 return [](const T& x, const T& y) { return std::max(x,y); };
69
71 // return std::bind([](const T& x, const T& y) { return std::min(x,y);});
72 return [](const T& x, const T& y) { return std::min(x,y); };
73
74 default:
75 return [](const T&, const T&) { return 0.0; };
76 }
77}

◆ GetMergeFunction() [2/2]

template<G4bool >
G4MergeFunction< G4bool > G4Accumulables::GetMergeFunction ( G4MergeMode  mergeMode)

Definition at line 80 of file G4MergeMode.hh.

81{
82 switch ( mergeMode ) {
85 // return std::bind([](const T& x, const T& y) { return x + y; });
86 return [](const G4bool& x, const G4bool& y) { return x || y; };
87
90 return [](const G4bool& x, const G4bool& y) { return x && y; };
91 }
92}
bool G4bool
Definition: G4Types.hh:86

◆ GetMergeMode()

G4MergeMode G4Accumulables::GetMergeMode ( const G4String mergeModeName)

Definition at line 35 of file G4MergeMode.cc.

35 {
36 if ( mergeModeName == "+" ) { return G4MergeMode::kAddition; }
37 else if ( mergeModeName == "*" ) { return G4MergeMode::kMultiplication; }
38 else {
39 G4ExceptionDescription description;
40 description
41 << " \"" << mergeModeName << "\" merge mode is not supported." << G4endl
42 << " " << "Addition will be applied.";
43 G4Exception("G4Analysis::GetMergeMode",
44 "Analysis_W013", JustWarning, description);
46 }
47}
@ 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
#define G4endl
Definition: G4ios.hh:57