source: trunk/source/processes/electromagnetic/polarisation/src/G4PolarizationManager.cc @ 1055

Last change on this file since 1055 was 1007, checked in by garnier, 15 years ago

update to geant4.9.2

File size: 3.9 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// $Id: G4PolarizationManager.cc,v 1.1 2006/09/21 21:35:11 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-02 $
28//
29// GEANT4 Class file
30//
31//
32// File name:     G4PolarizationManager
33//
34// Author:        Andreas Schaelicke
35//
36// Creation date: 01.05.2005
37//
38// Modifications:
39//
40// Class Description:
41//
42// Provides polarization information for logical volumes, and some basic
43// transformation routines.
44//
45#include "G4PolarizationManager.hh"
46#include "G4PolarizationMessenger.hh"
47#include "G4StokesVector.hh"
48
49#include "G4LogicalVolume.hh"
50
51G4PolarizationManager * G4PolarizationManager::instance = 0;
52
53G4PolarizationManager* G4PolarizationManager::GetInstance()
54{
55  if (instance == 0) instance = new G4PolarizationManager();
56  return instance;
57}
58
59void G4PolarizationManager::Dispose()
60{
61  if (instance != 0)
62  {
63    delete instance;
64    instance = 0;
65  }
66}
67
68G4PolarizationManager::G4PolarizationManager()
69  : messenger(0), verboseLevel(0), activated(true)
70{
71  messenger = new G4PolarizationMessenger(this); 
72}
73
74G4PolarizationManager::~G4PolarizationManager()
75{ 
76}
77
78void G4PolarizationManager::ListVolumes()
79{
80  if (volumePolarizations.size()==0) return;
81  G4cout<<" Polarization for "<<volumePolarizations.size()
82        <<" registered volume(s) : "<<G4endl;
83  if (!activated) 
84    G4cout<<" but polarization deactivated "<<G4endl;
85  for (PolarizationMap::const_iterator cit=volumePolarizations.begin();
86       cit!=volumePolarizations.end();cit++) {
87    G4cout<<cit->first->GetName()<<" : "<<cit->second<<G4endl;
88  }
89}
90
91void G4PolarizationManager::SetVolumePolarization(G4LogicalVolume* lVol, const G4ThreeVector & pol)
92{
93  volumePolarizations[lVol]=pol;
94  if (verboseLevel>=1) G4cout<<" SetVolumePolarization "
95                             <<lVol->GetName()<<" "
96                             <<pol<<G4endl;
97}
98
99void G4PolarizationManager::SetVolumePolarization(const G4String & lVolName, const G4ThreeVector & pol)
100{
101  for (PolarizationMap::iterator it=volumePolarizations.begin();
102       it!=volumePolarizations.end();it++) {
103    if (it->first->GetName()==lVolName) {
104      it->second=pol;
105      if (verboseLevel>=1) G4cout<<" SetVolumePolarization "
106                                 <<lVolName<<" "
107                                 <<pol<<G4endl;
108      return;
109    }
110  }
111  G4cout<<" logical volume '"<<lVolName<<"'not registerd yet \n"
112        <<" please register before using '/polarization/volume/set' "<<G4endl;
113}
114
Note: See TracBrowser for help on using the repository browser.