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: G4PolarizationManager.hh,v 1.1 2006/09/21 21:35:10 vnivanch Exp $ |
---|
27 | // tag $Name: $ |
---|
28 | // |
---|
29 | // GEANT4 Class header file |
---|
30 | // |
---|
31 | // |
---|
32 | // File name: G4PolarizationManager |
---|
33 | // |
---|
34 | // Author: Andreas Schaelicke |
---|
35 | // |
---|
36 | // Creation date: 01.05.2005 |
---|
37 | // |
---|
38 | // Modifications: |
---|
39 | // 12-08-06 Helper routines are moved to G4PolarizationHelper |
---|
40 | // |
---|
41 | // Class Description: |
---|
42 | // |
---|
43 | // Provides polarization information for logical volumes, and some basic |
---|
44 | // transformation routines. |
---|
45 | |
---|
46 | #ifndef G4PolarizationManager_h |
---|
47 | #define G4PolarizationManager_h 1 |
---|
48 | |
---|
49 | #include "globals.hh" |
---|
50 | #include <vector> |
---|
51 | #include "G4ThreeVector.hh" |
---|
52 | |
---|
53 | #include <map> |
---|
54 | |
---|
55 | class G4LogicalVolume; |
---|
56 | class G4PolarizationManager; |
---|
57 | class G4PolarizationMessenger; |
---|
58 | |
---|
59 | typedef std::map<G4LogicalVolume*,G4ThreeVector> PolarizationMap; |
---|
60 | |
---|
61 | class G4PolarizationManager { |
---|
62 | public: |
---|
63 | |
---|
64 | virtual ~G4PolarizationManager(); |
---|
65 | static G4PolarizationManager* GetInstance(); |
---|
66 | static void Dispose(); |
---|
67 | |
---|
68 | void ListVolumes(); |
---|
69 | inline void Clean(); |
---|
70 | |
---|
71 | void SetVolumePolarization(G4LogicalVolume* lVol, const G4ThreeVector & pol); |
---|
72 | void SetVolumePolarization(const G4String & lVolName, const G4ThreeVector & pol); |
---|
73 | |
---|
74 | inline const G4ThreeVector & GetVolumePolarization(G4LogicalVolume* lVol) const; |
---|
75 | inline bool IsPolarized(G4LogicalVolume* lVol) const; |
---|
76 | |
---|
77 | inline void SetVerbose(G4int val); |
---|
78 | inline G4int GetVerbose() const; |
---|
79 | |
---|
80 | inline void SetActivated(G4bool val); |
---|
81 | inline bool IsActivated() const; |
---|
82 | |
---|
83 | private: |
---|
84 | G4PolarizationManager(); |
---|
85 | |
---|
86 | G4ThreeVector zeroPolarization; |
---|
87 | PolarizationMap volumePolarizations; |
---|
88 | G4PolarizationMessenger * messenger; |
---|
89 | |
---|
90 | G4int verboseLevel; |
---|
91 | G4bool activated; |
---|
92 | |
---|
93 | static G4PolarizationManager* instance; |
---|
94 | }; |
---|
95 | |
---|
96 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
97 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
98 | |
---|
99 | inline const G4ThreeVector & G4PolarizationManager::GetVolumePolarization(G4LogicalVolume* lVol) const |
---|
100 | { |
---|
101 | if (!activated) return zeroPolarization; |
---|
102 | PolarizationMap::const_iterator cit=volumePolarizations.find(lVol); |
---|
103 | if (cit!=volumePolarizations.end()) return cit->second; |
---|
104 | return zeroPolarization; |
---|
105 | } |
---|
106 | |
---|
107 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
108 | |
---|
109 | inline bool G4PolarizationManager::IsPolarized(G4LogicalVolume* lVol) const |
---|
110 | { |
---|
111 | if (!activated) return false; |
---|
112 | PolarizationMap::const_iterator cit=volumePolarizations.find(lVol); |
---|
113 | return (cit!=volumePolarizations.end()); |
---|
114 | } |
---|
115 | |
---|
116 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
117 | |
---|
118 | inline void G4PolarizationManager::SetVerbose(G4int val) { verboseLevel = val; } |
---|
119 | inline G4int G4PolarizationManager::GetVerbose() const { return verboseLevel; } |
---|
120 | |
---|
121 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
122 | |
---|
123 | inline void G4PolarizationManager::SetActivated(G4bool val) { activated = val; } |
---|
124 | inline bool G4PolarizationManager::IsActivated() const { return activated; } |
---|
125 | |
---|
126 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
127 | |
---|
128 | inline void G4PolarizationManager::Clean() { volumePolarizations.clear(); } |
---|
129 | |
---|
130 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
131 | |
---|
132 | #endif |
---|
133 | |
---|