Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4PolarizationMessenger.cc
이 파일의 문서화 페이지로 가기
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: G4PolarizationMessenger.cc 81375 2014-05-27 13:08:40Z gcosmo $
27 //
28 //
29 // GEANT4 Class file
30 //
31 // File name: G4PolarizationManager
32 //
33 // Author: Andreas Schaelicke
34 //
35 // Creation date: 01.05.2005
36 //
37 // Modifications:
38 //
39 // Class Description:
40 //
41 // Provides access to general polarization information and to
42 // polarization for logical volumes through macro files.
43 
45 #include "G4PolarizationManager.hh"
46 #include "G4PolarizationHelper.hh"
47 
48 #include "G4UIdirectory.hh"
49 #include "G4Tokenizer.hh"
51 #include "G4UIcmdWithAString.hh"
52 #include "G4UIcmdWithAnInteger.hh"
53 #include "G4UIcmdWithABool.hh"
54 #include "G4ios.hh"
55 
56 
58  : polarizationManager(polMgr)
59 {
60  polarizationDirectory = new G4UIdirectory("/polarization/");
61  polarizationDirectory->SetGuidance("polarization control commands.");
62 
63  managerDirectory = new G4UIdirectory("/polarization/manager/");
64  managerDirectory->SetGuidance("general polarization information.");
65 
66  verboseCmd = new G4UIcmdWithAnInteger("/polarization/manager/verbose",this);
67  verboseCmd->SetGuidance("Set the Verbose level of G4PolarizationManager.");
68  verboseCmd->SetGuidance(" 0 : Silent (default)");
69  verboseCmd->SetGuidance(" 1 : Verbose");
70  verboseCmd->SetParameterName("level",true);
72  verboseCmd->SetRange("level >=0 && level <=1");
73 
74  optActivateCmd = new G4UIcmdWithABool("/polarization/manager/activate",this);
75  optActivateCmd->SetGuidance("activate/deactivate polarization treatment");
76  optActivateCmd->SetParameterName("flag",true);
78 
79  volumeDirectory = new G4UIdirectory("/polarization/volume/");
80  volumeDirectory->SetGuidance("Status control commands of registered polarized logical volumes.");
81 
82  printVolumeListCmd = new G4UIcmdWithoutParameter("/polarization/volume/list",this);
83  printVolumeListCmd->SetGuidance("print list of registered polarized logical volumes");
85 
86  setPolarizationCmd = new G4UIcommand("/polarization/volume/set",this);
87  setPolarizationCmd->SetGuidance("set or change polarization of a logical volume");
88 // setPolarizationCmd->SetParameterName("polarization",true);
89 // setPolarizationCmd->SetDefaultValue("worldVolume 0. 0. 0.");
91 
92  G4UIparameter* param;
93  param = new G4UIparameter("logicalVolumeName",'s',false);
94  param->SetDefaultValue("worldVolume");
96  param = new G4UIparameter("px",'d',true);
97  param->SetDefaultValue("0.0");
99  param = new G4UIparameter("py",'d',true);
100  param->SetDefaultValue("0.0");
102  param = new G4UIparameter("pz",'d',true);
103  param->SetDefaultValue("0.0");
105 
106  testDirectory = new G4UIdirectory("/polarization/test/");
107  testDirectory->SetGuidance("provides access to some internal test routines.");
108 
109  testPolarizationTransformationCmd = new G4UIcmdWithoutParameter("/polarization/test/polarizationTransformation",this);
110  testPolarizationTransformationCmd->SetGuidance("checks definition of particle reference frame and corresponding translation routines");
112 
113  testInteractionFrameCmd = new G4UIcmdWithoutParameter("/polarization/test/interactionFrame",this);
114  testInteractionFrameCmd->SetGuidance("checks definition of interaction frame");
116 }
117 
119 {
120  delete verboseCmd;
123  delete testDirectory;
124  delete setPolarizationCmd;
125  delete printVolumeListCmd;
126  delete volumeDirectory;
127  delete optActivateCmd;
128  delete managerDirectory;
129  delete polarizationDirectory;
130 }
131 
133 {
134  if( command==verboseCmd ) {
136  }
137  else if ( command==optActivateCmd ) {
139  }
140  else if ( command==printVolumeListCmd ) {
142  }
143  else if ( command==setPolarizationCmd ) {
144  G4Tokenizer next( newValue );
145  G4String volumeName=next();
146  G4double px=0.,py=0.,pz=0.;
147  G4String dvalue=next();
148  if (!dvalue.isNull()) {
149  px=StoD(dvalue);
150  dvalue=next();
151  if (!dvalue.isNull()) {
152  py=StoD(dvalue);
153  dvalue=next();
154  if (!dvalue.isNull()) pz=StoD(dvalue);
155  }
156  }
157  G4ThreeVector pol(px,py,pz);
159  }
160  else if ( command==testPolarizationTransformationCmd ) {
162  }
163  else if (command==testInteractionFrameCmd ) {
165  }
166 }
167 
169 {
170  G4String cv;
171  if( command==verboseCmd )
173 
174  return cv;
175 }
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4bool isNull() const
static void TestInteractionFrame()
void SetDefaultValue(G4bool defVal)
void SetDefaultValue(G4int defVal)
G4UIcmdWithoutParameter * printVolumeListCmd
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
static void TestPolarizationTransformations()
G4PolarizationMessenger(G4PolarizationManager *runMgr)
static G4bool GetNewBoolValue(const char *paramString)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetDefaultValue(const char *theDefaultValue)
void SetVolumePolarization(G4LogicalVolume *lVol, const G4ThreeVector &pol)
double G4double
Definition: G4Types.hh:76
G4PolarizationManager * polarizationManager
G4UIcmdWithoutParameter * testInteractionFrameCmd
G4UIcmdWithoutParameter * testPolarizationTransformationCmd
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:374
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetNewValue(G4UIcommand *command, G4String newValues) override
static G4int GetNewIntValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4double StoD(G4String s)
G4UIcmdWithAnInteger * verboseCmd
G4String GetCurrentValue(G4UIcommand *command) override
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242