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