|
||||
File indexing completed on 2025-01-18 09:58:55
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4PhysicsModelCatalog 0027 // 0028 // Class description: 0029 // 0030 // Singleton, collection of physics models, to be used by models and G4Track. 0031 0032 // Author: M.Asai (SLAC), 26 September 2013 0033 0034 // Revised in August 2021 by A.Ribon (CERN). 0035 // -------------------------------------------------------------------- 0036 #ifndef G4PhysicsModelCatalog_hh 0037 #define G4PhysicsModelCatalog_hh 0038 0039 #include <vector> 0040 0041 #include "G4String.hh" 0042 #include "globals.hh" 0043 0044 0045 class G4PhysicsModelCatalog { 0046 public: 0047 static void Initialize(); 0048 ~G4PhysicsModelCatalog() = default; 0049 G4PhysicsModelCatalog( const G4PhysicsModelCatalog& ) = delete; 0050 G4PhysicsModelCatalog& operator=( const G4PhysicsModelCatalog& ) = delete; 0051 0052 static const G4String GetModelNameFromID( const G4int modelID ); 0053 static const G4String GetModelNameFromIndex( const G4int modelIndex ); 0054 static G4int GetModelID( const G4int modelIndex ); 0055 static G4int GetModelID( const G4String& modelName ); 0056 static G4int GetModelIndex( const G4int modelID ); 0057 static G4int GetModelIndex( const G4String& modelName ); 0058 // There are two integer values: the model ID and the model Index. 0059 // The model ID is a unique integer which identifies not only the model 0060 // but also the category to which it belongs to; future models should 0061 // be given an model ID consistent with their category. 0062 // In the Geant4 code, it should always be the model ID, not the model Index, 0063 // which is used. 0064 // The model Index is the index of the vector of either model IDs, or 0065 // model names (these two vectors have the same size). 0066 // The model Index for a model does not have meaning in itself: 0067 // it depends only on the order in which the vectors are filled. 0068 // The model Index is useful for plotting because the index of the vector 0069 // has contiguous, small non-negative integer values, whereas the modelID 0070 // has non-contiguous, large, positive integer values (unconvenient for plotting). 0071 // The idea is that, starting from Geant4 version 11.0, all the three 0072 // identifiers (modelID, index, name) remain the same regardless of the 0073 // physics list, application, and version of Geant4. 0074 0075 static G4int Entries(); 0076 // The size of the two vectors (of model IDs and model names) are required to be the same. 0077 0078 static void PrintAllInformation(); 0079 // Print all information of this class about the models, i.e. each entry 0080 // of the two vectors - the one of model-IDs and the one of model-names. 0081 0082 static G4int GetMinAllowedModelIDValue(); 0083 static G4int GetMaxAllowedModelIDValue(); 0084 // Returns the two limits, min and max respectively, that the modelID value can have. 0085 0086 private: 0087 G4PhysicsModelCatalog() = default; 0088 0089 static void SanityCheck(); 0090 // Check that the two vectors (of model IDs and model names) have the same size, 0091 // the model IDs have the expected values (i.e. within the allowed interval), and 0092 // there are no duplication of either model IDs or model names. 0093 0094 inline static void InsertModel( G4int modelID, G4String modelName ); 0095 0096 static G4bool isInitialized; 0097 static const G4int theMinAllowedModelIDValue = 10000; 0098 static const G4int theMaxAllowedModelIDValue = 39999; 0099 0100 static std::vector< G4int >* theVectorOfModelIDs; // Non-contiguous large, positive integers 0101 static std::vector< G4String >* theVectorOfModelNames; 0102 }; 0103 0104 0105 inline G4int G4PhysicsModelCatalog::GetMinAllowedModelIDValue() { 0106 return theMinAllowedModelIDValue; 0107 } 0108 0109 inline G4int G4PhysicsModelCatalog::GetMaxAllowedModelIDValue() { 0110 return theMaxAllowedModelIDValue; 0111 } 0112 0113 inline void G4PhysicsModelCatalog::InsertModel( G4int modelID, G4String modelName ) { 0114 theVectorOfModelIDs->push_back( modelID ); 0115 theVectorOfModelNames->push_back( modelName ); 0116 } 0117 0118 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |