Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4MCCIndexConversionTable.hh
Go to the documentation of this file.
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$
27//
28//
29// ------------------------------------------------------------
30// GEANT 4 class header file
31//
32// Class description:
33//
34// G4MCCIndexConversionTable is used by G4ProductionTable
35// when the cut table is retrieved from the file.
36// An index pointing a Material-Cut-Couple can be different
37// from the index pointing the same MCC in the file. This class
38// has a map between them.
39//
40// ------------------------------------------------------------
41//
42// History:
43// -------
44// - First implementation 20th August 2004 by H.Kurashige
45//-------------------------------------
46
47#ifndef G4MCCIndexConversionTable_h
48#define G4MCCIndexConversionTable_h 1
49
50#include <vector>
51#include "globals.hh"
52#include "G4ios.hh"
53
55{
56 public: // with description
57
59 // Default constructor.
60
62 // Destructor.
63
64 void Reset(size_t size);
65 // reset conversion table
66
67 G4bool IsUsed(size_t index) const;
68 // returns 'true' if the indicated MCC in the file
69 // is used in the current production cut table
70
71 void SetNewIndex(size_t index, size_t new_value);
72 // set the index in the current production cut table
73 // for the indicated MCC in the file
74
75 G4int GetIndex(size_t index) const;
76 // get the index in the current production cut table
77 // for the indicated MCC in the file
78
79 size_t size() const;
80
81 protected:
82 typedef std::vector<G4int> G4IntVector;
84};
85
86inline
88{
89 if (index >= vecNewIndex.size()) return false;
90
91 // returns 'true' if the indicated MCC in the file
92 // is used in the current production cut table
93 return (vecNewIndex[index] >= 0);
94}
95
96inline
97 void G4MCCIndexConversionTable::SetNewIndex(size_t index, size_t new_value)
98{
99 if (index >= vecNewIndex.size()) return;
100 // set the index in the current production cut table
101 // for the indicated MCC in the file
102 vecNewIndex[index]=new_value;
103}
104
105inline
107{
108 if (index >= vecNewIndex.size()) return -1;
109 // get the index in the current production cut table
110 // for the indicated MCC in the file
111 return (vecNewIndex[index]);
112}
113
114inline
116{
117 return vecNewIndex.size();
118}
119
120#endif
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
void SetNewIndex(size_t index, size_t new_value)
G4int GetIndex(size_t index) const
G4bool IsUsed(size_t index) const