Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Factory class to return pointer to Bertini cross-section table based on
0028 // collision initial state (hadron type codes).
0029 //
0030 // Author:  Michael Kelsey (SLAC)
0031 //
0032 // 20110728  M. Kelsey -- Use static instance() function to work around
0033 //      "disappearance" bug on Linux (GCC 4.1.2).
0034 // 20110915  M. Kelsey -- Move static implementations (won't work on Windows);
0035 //      Add local table instantiating function (to replace self-reg)
0036 // 20110923  M. Kelsey -- Add optional stream& argument to printTable().
0037 // 20130129  M. Kelsey -- Drop load-on-demand interfaces, fill in ctor
0038 // 20130306  M. Kelsey -- Add inclusive printing of all tables here
0039 // 20130429  M. Kelsey -- Change instance to thread-local pointer.
0040 // 20141121  M. Kelsey -- Dtor must be public for end-of-job cleanup.
0041 
0042 #ifndef G4_CASCADE_CHANNEL_TABLES_HH
0043 #define G4_CASCADE_CHANNEL_TABLES_HH
0044 
0045 #include "globals.hh"
0046 #include <iosfwd>
0047 #include <map>
0048 
0049 class G4CascadeChannel;
0050 
0051 
0052 class G4CascadeChannelTables {
0053 public:
0054   // Argument is interaction code, product of G4InuclEP types
0055   static const G4CascadeChannel* GetTable(G4int initialState);
0056 
0057   // Arguments are individual G4InuclElementaryParticle types
0058   static const G4CascadeChannel* GetTable(G4int had1, G4int had2);
0059 
0060   // Convenience functions for diagnostic output
0061   static void Print(std::ostream& os=G4cout);
0062   static void PrintTable(G4int initialState, std::ostream& os=G4cout);
0063 
0064 public:
0065   ~G4CascadeChannelTables();
0066 
0067 private:
0068   static const G4CascadeChannelTables& instance();      // Singleton
0069   static G4ThreadLocal G4CascadeChannelTables* theInstance; // per thread
0070 
0071   G4CascadeChannelTables();
0072 
0073   // Fetch table from map if already registered, or return null
0074   const G4CascadeChannel* FindTable(G4int initialState) const;
0075 
0076   typedef std::map<G4int, G4CascadeChannel*> TableMap;
0077   TableMap tables;
0078 };
0079 
0080 #endif  /* G4_CASCADE_CHANNEL_TABLES_HH */