G4MCCIndexConversionTable.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 // 
00029 // ------------------------------------------------------------
00030 //      GEANT 4 class header file
00031 //
00032 // Class description:
00033 //
00034 // G4MCCIndexConversionTable is used by G4ProductionTable 
00035 // when the cut table is retrieved from the file. 
00036 // An index pointing a Material-Cut-Couple can be different 
00037 // from the index pointing the same MCC in the file. This class
00038 // has a map between them.
00039 //
00040 // ------------------------------------------------------------
00041 //
00042 // History:
00043 // -------
00044 // - First implementation   20th August 2004  by H.Kurashige
00045 //-------------------------------------
00046 
00047 #ifndef G4MCCIndexConversionTable_h
00048 #define G4MCCIndexConversionTable_h 1
00049 
00050 #include <vector>
00051 #include "globals.hh"
00052 #include "G4ios.hh"
00053 
00054 class G4MCCIndexConversionTable
00055 {
00056  public: // with description
00057 
00058   G4MCCIndexConversionTable();
00059     // Default constructor.
00060 
00061   virtual ~G4MCCIndexConversionTable();
00062     // Destructor.
00063 
00064   void Reset(size_t size);
00065     // reset conversion table 
00066  
00067   G4bool IsUsed(size_t index) const;
00068     // returns 'true' if the indicated MCC in the file 
00069     // is used in the current production cut table
00070   
00071   void SetNewIndex(size_t index, size_t new_value);   
00072     // set the index in the current production cut table
00073     // for the indicated MCC in the file
00074 
00075   G4int GetIndex(size_t index) const;
00076     // get the index in the current production cut table
00077     // for the indicated MCC in the file
00078  
00079   size_t size() const;
00080 
00081   protected:
00082    typedef std::vector<G4int> G4IntVector;
00083    G4IntVector vecNewIndex;
00084 };
00085 
00086 inline
00087  G4bool G4MCCIndexConversionTable::IsUsed(size_t index) const
00088 {
00089   if (index >= vecNewIndex.size()) return false;
00090 
00091   // returns 'true' if the indicated MCC in the file 
00092   // is used in the current production cut table
00093   return (vecNewIndex[index] >= 0); 
00094 }
00095 
00096 inline
00097  void G4MCCIndexConversionTable::SetNewIndex(size_t index, size_t new_value)
00098 {
00099   if (index >= vecNewIndex.size()) return;
00100   // set the index in the current production cut table
00101   // for the indicated MCC in the file
00102   vecNewIndex[index]=new_value;  
00103 }  
00104 
00105 inline
00106   G4int G4MCCIndexConversionTable::GetIndex(size_t index) const
00107 {
00108   if (index >= vecNewIndex.size()) return -1;
00109   // get the index in the current production cut table
00110   // for the indicated MCC in the file
00111   return (vecNewIndex[index]);  
00112 }
00113 
00114 inline
00115   size_t G4MCCIndexConversionTable::size() const
00116 {
00117   return vecNewIndex.size();
00118 }
00119 
00120 #endif

Generated on Mon May 27 17:48:51 2013 for Geant4 by  doxygen 1.4.7