// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // //_____________________________________________________________________________ template G4Accumulable* G4AccumulableManager::GetAccumulable(G4VAccumulable* accumulable, G4bool warn) const { // Do not check type if nullptr if ( ! accumulable ) return nullptr; // check type auto taccumulable = dynamic_cast*>(accumulable); if ( ! taccumulable && warn ) { G4ExceptionDescription description; description << " " << "Accumulable " << accumulable->GetName() << " has different type"; G4Exception("G4AccumulableManager::GetAccumulable", "Analysis_W001", JustWarning, description); return nullptr; } return taccumulable; } //_____________________________________________________________________________ template G4Accumulable* G4AccumulableManager::CreateAccumulable( const G4String& name, T value, G4MergeMode mergeMode) { // do not accept name if it is already used if ( ! CheckName(name, "CreateAccumulable") ) return 0; // create accumulable auto accumulable = new G4Accumulable(name, value, mergeMode); // register accumulable in the map and vector RegisterAccumulable(accumulable); fAccumulablesToDelete.push_back(accumulable); return accumulable; } //_____________________________________________________________________________ template G4Accumulable* G4AccumulableManager::CreateAccumulable( T value, G4MergeMode mergeMode) { return CreateAccumulable(G4String(), value, mergeMode); } //_____________________________________________________________________________ template G4bool G4AccumulableManager::RegisterAccumulable(G4Accumulable& accumulable) { return RegisterAccumulable(&accumulable); } //_____________________________________________________________________________ template G4Accumulable* G4AccumulableManager::GetAccumulable(const G4String& name, G4bool warn) const { // get G4VParammeter from the map auto accumulable = GetAccumulable(name, warn); return GetAccumulable(accumulable, warn); } //_____________________________________________________________________________ template G4Accumulable* G4AccumulableManager::GetAccumulable(G4int id, G4bool warn) const { // get G4VParammeter from the map auto accumulable = GetAccumulable(id, warn); return GetAccumulable(accumulable, warn); } //_____________________________________________________________________________ inline G4int G4AccumulableManager::GetNofAccumulables() const { return G4int(fVector.size()); } //_____________________________________________________________________________ inline std::vector::iterator G4AccumulableManager::Begin() { return fVector.begin(); } //_____________________________________________________________________________ inline std::vector::iterator G4AccumulableManager::End() { return fVector.end(); } //_____________________________________________________________________________ inline std::vector::const_iterator G4AccumulableManager::BeginConst() const { return fVector.begin(); } //_____________________________________________________________________________ inline std::vector::const_iterator G4AccumulableManager::EndConst() const { return fVector.end(); }