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