G4PolarizationManager.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id: G4PolarizationManager.hh 69847 2013-05-16 09:36:18Z gcosmo $
00027 //
00028 // GEANT4 Class header file
00029 //
00030 //
00031 // File name:     G4PolarizationManager
00032 //
00033 // Author:        Andreas Schaelicke
00034 //
00035 // Creation date: 01.05.2005
00036 //
00037 // Modifications:
00038 // 12-08-06   Helper routines are moved to G4PolarizationHelper
00039 //
00040 // Class Description:
00041 //
00042 // Provides polarization information for logical volumes, and some basic 
00043 // transformation routines.
00044 
00045 #ifndef G4PolarizationManager_h
00046 #define G4PolarizationManager_h 1
00047 
00048 #include "globals.hh"
00049 #include <vector>
00050 #include "G4ThreeVector.hh"
00051 
00052 #include <map>
00053 
00054 class G4LogicalVolume;
00055 class G4PolarizationManager;
00056 class G4PolarizationMessenger;
00057 
00058 typedef std::map<G4LogicalVolume*,G4ThreeVector> PolarizationMap;
00059 
00060 class G4PolarizationManager {
00061 public:
00062 
00063   virtual ~G4PolarizationManager();
00064   static G4PolarizationManager* GetInstance();
00065   static void Dispose();
00066 
00067   void ListVolumes();
00068   inline void Clean();
00069 
00070   void SetVolumePolarization(G4LogicalVolume* lVol, const G4ThreeVector & pol);
00071   void SetVolumePolarization(const G4String & lVolName, const G4ThreeVector & pol);
00072 
00073   inline const G4ThreeVector & GetVolumePolarization(G4LogicalVolume* lVol) const;
00074   inline bool IsPolarized(G4LogicalVolume* lVol) const;
00075 
00076   inline void SetVerbose(G4int val);
00077   inline G4int GetVerbose() const;
00078 
00079   inline void SetActivated(G4bool val);
00080   inline bool IsActivated() const;
00081 
00082 private:
00083   G4PolarizationManager();
00084 
00085   G4ThreeVector zeroPolarization;
00086   PolarizationMap volumePolarizations;
00087   G4PolarizationMessenger * messenger;
00088 
00089   G4int verboseLevel;
00090   G4bool activated;
00091 
00092   static G4PolarizationManager* instance;
00093 };
00094 
00095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00097 
00098 inline const G4ThreeVector & G4PolarizationManager::GetVolumePolarization(G4LogicalVolume* lVol) const
00099 {
00100   if (!activated) return zeroPolarization;
00101   PolarizationMap::const_iterator cit=volumePolarizations.find(lVol);
00102   if (cit!=volumePolarizations.end()) return cit->second;
00103   return zeroPolarization;
00104 }
00105 
00106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00107 
00108 inline bool G4PolarizationManager::IsPolarized(G4LogicalVolume* lVol) const
00109 {
00110   if (!activated) return false;
00111   PolarizationMap::const_iterator cit=volumePolarizations.find(lVol);
00112   return (cit!=volumePolarizations.end());
00113 }
00114 
00115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00116 
00117 inline void G4PolarizationManager::SetVerbose(G4int val) { verboseLevel = val; }
00118 inline G4int G4PolarizationManager::GetVerbose() const { return verboseLevel; }
00119 
00120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00121 
00122 inline void G4PolarizationManager::SetActivated(G4bool val) { activated = val; }
00123 inline bool G4PolarizationManager::IsActivated() const { return activated; }
00124 
00125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00126 
00127 inline void G4PolarizationManager::Clean() { volumePolarizations.clear(); }
00128 
00129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00130 
00131 #endif
00132 

Generated on Mon May 27 17:49:22 2013 for Geant4 by  doxygen 1.4.7