49G4AccumulableManager::G4AccumulableManager()
58 for (
auto it : fAccumulablesToDelete ) {
68G4String G4AccumulableManager::GenerateName()
const
71 std::ostringstream os;
74 name.append(os.str());
81 if ( fMap.find(name) == fMap.end() )
return true;
84 description <<
"Name " <<
name <<
" is already used." <<
G4endl;
85 description <<
"Parameter will be not created/registered.";
86 G4String method(
"G4AccumulableManager::");
99 auto name = accumulable->
GetName();
102 if ( ! CheckName(name,
"RegisterAccumulable") )
return false;
105 if (name.length() == 0u) {
106 name = GenerateName();
107 accumulable->
fName = name;
110 fMap[name] = accumulable;
111 fVector.push_back(accumulable);
120 auto it = fMap.find(name);
121 if ( it == fMap.end() ) {
124 description <<
"Accumulable " << name <<
" does not exist.";
125 G4Exception(
"G4AccumulableManager::GetAccumulable",
139 if ( id < 0 || id >=
G4int(fVector.size()) ) {
142 description <<
"Accumulable " <<
id <<
" does not exist.";
143 G4Exception(
"G4AccumulableManager::GetAccumulable",
160 if (fgMasterInstance ==
nullptr) {
163 <<
"No master G4AccumulableManager instance exists." <<
G4endl
164 <<
"Accumulables will not be merged.";
176 auto it = fVector.begin();
177 for (
auto itMaster : fgMasterInstance->fVector ) {
181 itMaster->Merge(*(*(it++)));
191 for (
auto it : fVector ) {
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4MUTEX_INITIALIZER
G4Accumulable< T > * GetAccumulable(const G4String &name, G4bool warn=true) const
virtual ~G4AccumulableManager()
static G4AccumulableManager * Instance()
G4bool RegisterAccumulable(G4Accumulable< T > &accumulable)
const char * name(G4int ptype)