Geant4_10
G4CascadeChannelTables.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: G4CascadeChannelTables.hh 69336 2013-04-30 20:20:23Z mkelsey $
27 //
28 // Factory class to return pointer to Bertini cross-section table based on
29 // collision initial state (hadron type codes).
30 //
31 // Author: Michael Kelsey (SLAC)
32 //
33 // 20110728 M. Kelsey -- Use static instance() function to work around
34 // "disappearance" bug on Linux (GCC 4.1.2).
35 // 20110915 M. Kelsey -- Move static implementations (won't work on Windows);
36 // Add local table instantiating function (to replace self-reg)
37 // 20110923 M. Kelsey -- Add optional stream& argument to printTable().
38 // 20130129 M. Kelsey -- Drop load-on-demand interfaces, fill in ctor
39 // 20130306 M. Kelsey -- Add inclusive printing of all tables here
40 // 20130429 M. Kelsey -- Change instance to thread-local pointer.
41 
42 #ifndef G4_CASCADE_CHANNEL_TABLES_HH
43 #define G4_CASCADE_CHANNEL_TABLES_HH
44 
45 #include "globals.hh"
46 #include <iosfwd>
47 #include <map>
48 
49 class G4CascadeChannel;
50 
51 
53 public:
54  // Argument is interaction code, product of G4InuclEP types
55  static const G4CascadeChannel* GetTable(G4int initialState);
56 
57  // Arguments are individual G4InuclElementaryParticle types
58  static const G4CascadeChannel* GetTable(G4int had1, G4int had2);
59 
60  // Convenience functions for diagnostic output
61  static void Print(std::ostream& os=G4cout);
62  static void PrintTable(G4int initialState, std::ostream& os=G4cout);
63 
64 private:
65  static const G4CascadeChannelTables& instance(); // Singleton
66  static G4ThreadLocal G4CascadeChannelTables* theInstance; // per thread
67 
70 
71  // Fetch table from map if already registered, or return null
72  const G4CascadeChannel* FindTable(G4int initialState) const;
73 
74  typedef std::map<G4int, G4CascadeChannel*> TableMap;
75  TableMap tables;
76 };
77 
78 #endif /* G4_CASCADE_CHANNEL_TABLES_HH */
static const G4CascadeChannel * GetTable(G4int initialState)
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static void Print(std::ostream &os=G4cout)
static void PrintTable(G4int initialState, std::ostream &os=G4cout)