ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RegionStore.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4RegionStore.hh
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 // G4RegionStore
27 //
28 // Class description:
29 //
30 // Container for all regiong, with functionality derived from
31 // std::vector<T>. The class is a `singleton', in that only
32 // one can exist, and access is provided via the static method
33 // G4RegionStore::GetInstance().
34 //
35 // All regions should be registered with G4RegionStore, and removed on their
36 // destruction. The underlying container initially has a capacity of 20.
37 //
38 // If much additional functionality is added, should consider containment
39 // instead of inheritance for std::vector<T>
40 //
41 // Member data:
42 //
43 // static G4RegionStore*
44 // - Pointer to the single G4RegionStore
45 
46 // 18.09.02, G.Cosmo - Initial version
47 // --------------------------------------------------------------------
48 #ifndef G4REGIONSTORE_HH
49 #define G4REGIONSTORE_HH
50 
51 #include <vector>
52 #include "G4Types.hh"
53 #include "G4String.hh"
54 #include "G4VStoreNotifier.hh"
55 
56 class G4Region;
57 class G4VPhysicalVolume;
58 
59 class G4RegionStore : public std::vector<G4Region*>
60 {
61  public: // with description
62 
63  static void Register(G4Region* pRegion);
64  // Add the region to the collection.
65  static void DeRegister(G4Region* pRegion);
66  // Remove the region from the collection.
67  static G4RegionStore* GetInstance();
68  // Get a ptr to the unique G4RegionStore, creating it if necessary.
69  static void SetNotifier(G4VStoreNotifier* pNotifier);
70  // Assign a notifier for allocation/deallocation of regions.
71  static void Clean();
72  // Delete all regions from the store except for the world region.
73 
74  G4bool IsModified() const;
75  // Loops through all regions to verify if a region has been
76  // modified. It returns TRUE if just one region is modified.
77  void ResetRegionModified();
78  // Loops through all regions to reset flag for modification
79  // to FALSE. Used by the run manager to notify that the
80  // physics table has been updated.
81 
82  void UpdateMaterialList(G4VPhysicalVolume* currentWorld=0);
83  // Forces recomputation of material lists in all regions
84  // in the store.
85 
86  G4Region* GetRegion(const G4String& name, G4bool verbose = true) const;
87  // Returns a region through its name specification.
88 
89  G4Region* FindOrCreateRegion(const G4String& name);
90  // Returns a region through its name specification, if it exists.
91  // If it does not exist it will allocate one delegating ownership
92  // to the client.
93 
94  public: // without description
95 
96  void SetWorldVolume();
97  // Set a world volume pointer to a region that belongs to it.
98  // Scan over all world volumes.
99  // This method should be exclusively used by G4RunManagerKernel.
100 
101  protected:
102 
103  G4RegionStore();
104  // Protected singleton constructor.
105  virtual ~G4RegionStore();
106  // Destructor: takes care to delete allocated regions.
107 
108  private:
109 
113 };
114 
115 #endif