Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:21

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 //
0027 // -------------------------------------------------------------------
0028 //
0029 // GEANT4 Class header file
0030 //
0031 // File name:     G4HadDataHandler
0032 //
0033 // Author:        V. Ivanchenko 
0034 // 
0035 // Creation date: 05 July 2022
0036 //
0037 // Modifications: 
0038 //
0039 // Class Description: 
0040 //
0041 // A storage of G4PhysicsTable
0042 //
0043 // Class Description: End 
0044 
0045 // -------------------------------------------------------------------
0046 //
0047 
0048 #ifndef G4HadDataHandler_h
0049 #define G4HadDataHandler_h 1
0050 
0051 #include "globals.hh"
0052 #include "G4PhysicsTable.hh"
0053 #include "G4PhysicsVector.hh"
0054 #include <vector>
0055 
0056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0057 
0058 class G4VProcess;
0059 
0060 class G4HadDataHandler
0061 {
0062 public:
0063 
0064   explicit G4HadDataHandler(std::size_t nTable);
0065 
0066   ~G4HadDataHandler();
0067 
0068   // add table
0069   void AddTable(G4PhysicsTable*);
0070 
0071   // update table with existing index
0072   void UpdateTable(G4PhysicsTable*, std::size_t idx);
0073 
0074   // clean existing table
0075   void CleanTable(std::size_t idx);
0076   
0077   // keep pointer of master thread process
0078   void SetMasterProcess(const G4VProcess*);
0079 
0080   // return pointer of master thread process
0081   const G4VProcess* GetMasterProcess(std::size_t idx) const;
0082 
0083   // access to the table via index
0084   inline const G4PhysicsTable* GetTable(std::size_t idx) const { 
0085     return (idx < tLength) ? data[idx] : nullptr; 
0086   }
0087   inline G4PhysicsTable* Table(std::size_t idx) const {
0088     return (idx < tLength) ? data[idx] : nullptr; 
0089   }
0090 
0091   // access to vector, no check on input index
0092   inline 
0093   const G4PhysicsVector* GetVector(std::size_t itable, std::size_t ivec) const
0094   { return (*(data[itable]))[ivec]; }
0095 
0096   inline const std::vector<G4PhysicsTable*>& GetTables() const { return data; }
0097 
0098   // hide assignment operator 
0099   G4HadDataHandler & operator=(const G4HadDataHandler &right) = delete;
0100   G4HadDataHandler(const G4HadDataHandler&) = delete;
0101 
0102 private:
0103 
0104   std::vector<G4PhysicsTable*> data;
0105   std::size_t tLength;
0106   std::vector<const G4VProcess*> masterProcess;
0107 };
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0110 
0111 #endif
0112