Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BiasingProcessSharedData.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 // G4BiasingProcessSharedData
31 //
32 // Class Description:
33 // This class represents the data that the G4BiasingProcessInterface
34 // objects attached to a same particle / hold by a same G4ProcessManager
35 // share. It allows the active G4BiasingProcessInterface objects to share
36 // information on operations that are common the these instances:
37 // - the current and previous G4VBiasingOperator objects (their
38 // pointers are collected once, at the beginning of the PostStepGPIL
39 // by the first interface invoked)
40 // - add the list of cooperating G4BiasingProcessInterface objects,
41 // acting on a same particle type.
42 // G4BiasingProcessInterface is friend class of this one.
43 //---------------------------------------------------------------------------
44 // Initial version Sep. 2014 M. Verderi
45 
46 #ifndef G4BiasingProcessSharedData_h
47 #define G4BiasingProcessSharedData_h
48 
49 #include "globals.hh"
50 #include "G4Cache.hh"
51 #include <vector>
52 
53 class G4VBiasingOperator;
55 class G4ProcessManager;
57 
59 
62 
63 public:
64  // -------------------------
65  // -- Public access methods:
66  // -------------------------
67  // -- The biasing process interface objects sharing this shared data class:
68  const std::vector< const G4BiasingProcessInterface* >& GetBiasingProcessInterfaces() const
69  { return fPublicBiasingProcessInterfaces; }
70  const std::vector< const G4BiasingProcessInterface* >& GetPhysicsBiasingProcessInterfaces() const
71  { return fPublicPhysicsBiasingProcessInterfaces; }
72  const std::vector< const G4BiasingProcessInterface* >& GetNonPhysicsBiasingProcessInterfaces() const
73  { return fPublicNonPhysicsBiasingProcessInterfaces; }
74 
75  // -- The possible geometry limiter process:
77  { return fParallelGeometriesLimiterProcess; }
78 
79 
80 private:
81  // -- Methods used by the G4BiasingProcessInterface objects, thanks to class friendness.
82  // -- Object is created by G4BiasingProcessInterface object:
84  : fProcessManager (mgr),
85  fCurrentBiasingOperator ( nullptr ),
86  fPreviousBiasingOperator ( nullptr ),
87  fParallelGeometryOperator ( nullptr ),
88  fMassGeometryOperator ( nullptr ),
89  fIsNewOperator (true),
90  fLeavingPreviousOperator (false),
91  fParallelGeometriesLimiterProcess( nullptr )
92  {}
94  // -- biasing operators:
95  void CurrentBiasingOperator( G4VBiasingOperator* );
96  G4VBiasingOperator* CurrentBiasingOperator() const;
97  void PreviousBiasingOperator( G4VBiasingOperator* );
98  G4VBiasingOperator* PreviousBiasingOperator() const;
99 
100 private:
101  // --
102  const G4ProcessManager* fProcessManager;
103  // -- biasing operators:
104  G4VBiasingOperator* fCurrentBiasingOperator;
105  G4VBiasingOperator* fPreviousBiasingOperator;
106  G4VBiasingOperator* fParallelGeometryOperator;
107  G4VBiasingOperator* fMassGeometryOperator;
108  // --
109  G4bool fIsNewOperator;
110  G4bool fLeavingPreviousOperator;
111 
112  // -- biasing process interfaces sharing this object:
113  std::vector < G4BiasingProcessInterface* > fBiasingProcessInterfaces;
114  std::vector < G4BiasingProcessInterface* > fPhysicsBiasingProcessInterfaces;
115  std::vector < G4BiasingProcessInterface* > fNonPhysicsBiasingProcessInterfaces;
116  // -- the same ones, for public use:
117  std::vector < const G4BiasingProcessInterface* > fPublicBiasingProcessInterfaces;
118  std::vector < const G4BiasingProcessInterface* > fPublicPhysicsBiasingProcessInterfaces;
119  std::vector < const G4BiasingProcessInterface* > fPublicNonPhysicsBiasingProcessInterfaces;
120 
121  // -- possible process limiting step on parallel geometries:
122  G4ParallelGeometriesLimiterProcess* fParallelGeometriesLimiterProcess;
123 
124 
125  // -- thread local:
126  // -- Map between process managers and shared data. This map is made of
127  // -- pointers of G4BiasingSharedData instead of objects themselves :
128  // -- each process needs to keep a valid pointer of a shared data object
129  // -- but a map of object will make pointers invalid when map is increased.
130  static G4MapCache< const G4ProcessManager*,
131  G4BiasingProcessSharedData* > fSharedDataMap;
132 
133 };
134 
135 #endif
const std::vector< const G4BiasingProcessInterface * > & GetPhysicsBiasingProcessInterfaces() const
const std::vector< const G4BiasingProcessInterface * > & GetBiasingProcessInterfaces() const
const std::vector< const G4BiasingProcessInterface * > & GetNonPhysicsBiasingProcessInterfaces() const
const G4ParallelGeometriesLimiterProcess * GetParallelGeometriesLimiterProcess() const
bool G4bool
Definition: G4Types.hh:79