Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4MCCIndexConversionTable << 23 // $Id: G4MCCIndexConversionTable.hh,v 1.2 2004/12/15 15:42:35 gunter Exp $ >> 24 // GEANT4 tag $Name: geant4-08-00-patch-01 $ >> 25 // >> 26 // >> 27 // ------------------------------------------------------------ >> 28 // GEANT 4 class header file 27 // 29 // 28 // Class description: 30 // Class description: 29 // 31 // 30 // G4MCCIndexConversionTable is used by G4Prod 32 // G4MCCIndexConversionTable is used by G4ProductionTable 31 // when the cut table is retrieved from the fi 33 // when the cut table is retrieved from the file. 32 // An index pointing to a Material-Cut-Couple << 34 // An index pointing a Material-Cut-Couple can be different 33 // from the index pointing to the same MCC in << 35 // from the index pointing the same MCC in the file. This class 34 // has a map between them. 36 // has a map between them. >> 37 // >> 38 // ------------------------------------------------------------ >> 39 // >> 40 // History: >> 41 // ------- >> 42 // - First implementation 20th August 2004 by H.Kurashige >> 43 //------------------------------------- 35 44 36 // Author: H.Kurashige, 20 August 2004 - First << 45 #ifndef G4MCCIndexConversionTable_h 37 // ------------------------------------------- << 46 #define G4MCCIndexConversionTable_h 1 38 #ifndef G4MCCIndexConversionTable_hh << 39 #define G4MCCIndexConversionTable_hh 1 << 40 47 41 #include <vector> 48 #include <vector> 42 #include "globals.hh" 49 #include "globals.hh" 43 #include "G4ios.hh" 50 #include "G4ios.hh" 44 51 45 class G4MCCIndexConversionTable 52 class G4MCCIndexConversionTable 46 { 53 { 47 public: << 54 public: // with description 48 55 49 G4MCCIndexConversionTable(); << 56 G4MCCIndexConversionTable(); 50 // Default constructor. << 57 // Default constructor. 51 58 52 virtual ~G4MCCIndexConversionTable(); << 59 virtual ~G4MCCIndexConversionTable(); 53 // Destructor. << 60 // Destructor. 54 61 55 void Reset(std::size_t size); << 62 void Reset(size_t size); 56 // reset conversion table << 63 // reset conversion table 57 64 58 G4bool IsUsed(std::size_t index) const; << 65 G4bool IsUsed(size_t index) const; 59 // returns 'true' if the indicated MCC i << 66 // returns 'true' if the indicated MCC in the file 60 // is used in the current production cut << 67 // is used in the current production cut table 61 68 62 void SetNewIndex(std::size_t index, std::s << 69 void SetNewIndex(size_t index, size_t new_value); 63 // set the index in the current producti << 70 // set the index in the current production cut table 64 // for the indicated MCC in the file << 71 // for the indicated MCC in the file 65 << 72 66 G4int GetIndex(std::size_t index) const; << 73 G4int GetIndex(size_t index) const; 67 // get the index in the current producti << 74 // get the index in the current production cut table 68 // for the indicated MCC in the file << 75 // for the indicated MCC in the file 69 76 70 std::size_t size() const; << 77 size_t size() const; 71 78 72 protected: 79 protected: 73 << 80 typedef std::vector<G4int> G4IntVector; 74 std::vector<G4int> vecNewIndex; << 81 G4IntVector vecNewIndex; 75 }; 82 }; 76 83 77 // ------------------ << 78 // Inline methods << 79 // ------------------ << 80 << 81 inline 84 inline 82 G4bool G4MCCIndexConversionTable::IsUsed(std:: << 85 G4bool G4MCCIndexConversionTable::IsUsed(size_t index) const 83 { 86 { >> 87 if (index >= vecNewIndex.size()) return false; >> 88 84 // returns 'true' if the indicated MCC in th 89 // returns 'true' if the indicated MCC in the file 85 // is used in the current production cut tab 90 // is used in the current production cut table 86 return ((index < vecNewIndex.size()) && (vec << 91 return (vecNewIndex[index] >= 0); 87 } 92 } 88 93 89 inline 94 inline 90 void G4MCCIndexConversionTable::SetNewIndex(st << 95 void G4MCCIndexConversionTable::SetNewIndex(size_t index, size_t new_value) 91 st << 92 { 96 { >> 97 if (index >= vecNewIndex.size()) return; 93 // set the index in the current production c 98 // set the index in the current production cut table 94 // for the indicated MCC in the file 99 // for the indicated MCC in the file 95 if (index < vecNewIndex.size()) vecNewIndex[ << 100 vecNewIndex[index]=new_value; 96 } 101 } 97 102 98 inline 103 inline 99 G4int G4MCCIndexConversionTable::GetIndex(std: << 104 G4int G4MCCIndexConversionTable::GetIndex(size_t index) const 100 { 105 { >> 106 if (index >= vecNewIndex.size()) return -1; 101 // get the index in the current production c 107 // get the index in the current production cut table 102 // for the indicated MCC in the file 108 // for the indicated MCC in the file 103 return (index < vecNewIndex.size()) ? vecNew << 109 return (vecNewIndex[index]); 104 } 110 } 105 111 106 inline 112 inline 107 std::size_t G4MCCIndexConversionTable::size() << 113 size_t G4MCCIndexConversionTable::size() const 108 { 114 { 109 return vecNewIndex.size(); 115 return vecNewIndex.size(); 110 } 116 } 111 117 112 #endif 118 #endif 113 119