source: trunk/source/geometry/management/include/G4Region.hh @ 1202

Last change on this file since 1202 was 1058, checked in by garnier, 15 years ago

file release beta

File size: 8.0 KB
Line 
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//
27// $Id: G4Region.hh,v 1.20 2008/07/10 09:46:01 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30// class G4Region
31//
32// Class description:
33//
34// Defines a region or a group of regions in the detector geometry
35// setup, sharing properties associated to materials or production
36// cuts which may affect or bias specific physics processes.
37
38// History:
39// 18.09.02 G.Cosmo Initial version
40// --------------------------------------------------------------------
41#ifndef G4REGION_HH
42#define G4REGION_HH
43
44class G4ProductionCuts;
45class G4LogicalVolume;
46class G4Material;
47class G4VUserRegionInformation;
48class G4MaterialCutsCouple;
49class G4UserLimits;
50class G4FastSimulationManager;
51class G4VPhysicalVolume;
52class G4UserSteppingAction;
53
54#include <vector>
55#include <map>
56#include <algorithm>
57
58#include "G4Types.hh"
59#include "G4String.hh"
60
61class G4Region
62{
63    typedef std::vector<G4LogicalVolume*> G4RootLVList;
64    typedef std::vector<G4Material*> G4MaterialList;
65    typedef std::pair<G4Material*,G4MaterialCutsCouple*> G4MaterialCouplePair;
66    typedef std::map<G4Material*,G4MaterialCutsCouple*> G4MaterialCoupleMap;
67
68  public:  // with description
69
70    G4Region(const G4String& name);
71    virtual ~G4Region();
72
73    inline G4bool operator==(const G4Region& rg) const;
74      // Equality defined by address only.
75
76    void AddRootLogicalVolume(G4LogicalVolume* lv);
77    void RemoveRootLogicalVolume(G4LogicalVolume* lv, G4bool scan=true);
78      // Add/remove root logical volumes and set/reset their
79      // daughters flags as regions. They also recompute the
80      // materials list for the region.
81
82    inline void SetName(const G4String& name);
83    inline const G4String& GetName() const;
84      // Set/get region's name.
85
86    inline void RegionModified(G4bool flag);
87    inline G4bool IsModified() const;
88      // Accessors to flag identifying if a region has been modified
89      // (and still cuts needs to be computed) or not.
90
91    inline void SetProductionCuts(G4ProductionCuts* cut);
92    inline G4ProductionCuts* GetProductionCuts() const;
93
94    inline std::vector<G4LogicalVolume*>::iterator
95           GetRootLogicalVolumeIterator();
96    inline std::vector<G4Material*>::const_iterator
97           GetMaterialIterator() const;
98      // Return iterators to lists of root logical volumes and materials.
99
100    inline size_t GetNumberOfMaterials() const;
101    inline size_t GetNumberOfRootVolumes() const;
102      // Return the number of elements in the lists of materials and
103      // root logical volumes.
104
105    void UpdateMaterialList();
106      // Clears material list and recomputes it looping through
107      // each root logical volume in the region.
108
109    void ClearMaterialList();
110      // Clears the material list.
111
112    void ScanVolumeTree(G4LogicalVolume* lv, G4bool region);
113      // Scans recursively the 'lv' logical volume tree, retrieves
114      // and places all materials in the list if becoming a region.
115
116    inline void SetUserInformation(G4VUserRegionInformation* ui);
117    inline G4VUserRegionInformation* GetUserInformation() const;
118      // Set and Get methods for user information.
119
120    inline void SetUserLimits(G4UserLimits* ul);
121    inline G4UserLimits* GetUserLimits() const;
122      // Set and Get methods for userL-limits associated to a region.
123      // Once user-limits are set, it will propagate to daughter volumes.
124
125    inline void ClearMap();
126      // Reset G4MaterialCoupleMap
127
128    inline void RegisterMaterialCouplePair(G4Material* mat,
129                                           G4MaterialCutsCouple* couple);
130      // Method invoked by G4ProductionCutsTable to register the pair.
131
132    inline G4MaterialCutsCouple* FindCouple(G4Material* mat);
133      // Find a G4MaterialCutsCouple which corresponds to the material
134      // in this region.
135
136    inline void SetFastSimulationManager(G4FastSimulationManager* fsm);
137    inline G4FastSimulationManager* GetFastSimulationManager() const;
138      // Set and Get methods for G4FastSimulationManager.
139      // The root logical volume that has the region with G4FastSimulationManager
140      // becomes an envelope of fast simulation.
141   
142    void ClearFastSimulationManager();
143      // Set G4FastSimulationManager pointer to the one for the parent region
144      // if it exists. Otherwise set to null.
145
146    inline G4VPhysicalVolume* GetWorldPhysical() const;
147      // Get method for the world physical volume which this region
148      // belongs to. A valid pointer will be assigned by G4RunManagerKernel
149      // through G4RegionStore when the geometry is to be closed. Thus, this
150      // pointer may be incorrect at PreInit and Idle state. If the pointer
151      // is null at the proper state, this particular region does not belong
152      // to any world (maybe not assigned to any volume, etc.).
153
154    void SetWorld(G4VPhysicalVolume* wp);
155      // Set the world physical volume if this region belongs to this world.
156      // If wp is null, reset the pointer.
157
158    G4bool BelongsTo(G4VPhysicalVolume* thePhys) const;
159      // Returns whether this region belongs to the given physical volume
160      // (recursively scanned to the bottom of the hierarchy).
161
162    G4Region* GetParentRegion(G4bool& unique) const;
163      // Returns a region that contains this region. Otherwise null returned.
164      // Flag 'unique' is true if there is only one parent region containing
165      // the current region.
166
167    inline void SetRegionalSteppingAction(G4UserSteppingAction* rusa);
168    inline G4UserSteppingAction* GetRegionalSteppingAction() const;
169      // Set/Get method of the regional user stepping action
170
171  public:  // without description
172
173    G4Region(__void__&);
174      // Fake default constructor for usage restricted to direct object
175      // persistency for clients requiring preallocation of memory for
176      // persistifiable objects.
177
178  private:
179
180    G4Region(const G4Region&);
181    G4Region& operator=(const G4Region&);
182      // Private copy constructor and assignment operator.
183
184    inline void AddMaterial (G4Material* aMaterial);
185      // Searchs the specified material in the material table and
186      // if not present adds it.
187
188  private:
189
190    G4String fName;
191
192    G4RootLVList fRootVolumes;
193    G4MaterialList fMaterials;
194    G4MaterialCoupleMap fMaterialCoupleMap;
195
196    G4bool fRegionMod;
197    G4ProductionCuts* fCut;
198
199    G4VUserRegionInformation* fUserInfo;
200    G4UserLimits* fUserLimits;
201
202    G4FastSimulationManager* fFastSimulationManager;
203
204    G4VPhysicalVolume* fWorldPhys;
205
206    G4UserSteppingAction* fRegionalSteppingAction;
207};
208
209#include "G4Region.icc"
210
211#endif
Note: See TracBrowser for help on using the repository browser.