ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PolarizationMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 //
27 //
28 // GEANT4 Class file
29 //
30 // File name: G4PolarizationManager
31 //
32 // Author: Andreas Schaelicke
33 //
34 // Creation date: 01.05.2005
35 //
36 // Modifications:
37 //
38 // Class Description:
39 //
40 // Provides access to general polarization information and to
41 // polarization for logical volumes through macro files.
42 
44 #include "G4PolarizationManager.hh"
45 #include "G4PolarizationHelper.hh"
46 
47 #include "G4UIdirectory.hh"
48 #include "G4Tokenizer.hh"
50 #include "G4UIcmdWithAString.hh"
51 #include "G4UIcmdWithAnInteger.hh"
52 #include "G4UIcmdWithABool.hh"
53 #include "G4ios.hh"
54 
55 
57  : polarizationManager(polMgr)
58 {
59  polarizationDirectory = new G4UIdirectory("/polarization/");
60  polarizationDirectory->SetGuidance("polarization control commands.");
61 
62  managerDirectory = new G4UIdirectory("/polarization/manager/");
63  managerDirectory->SetGuidance("general polarization information.");
64 
65  verboseCmd = new G4UIcmdWithAnInteger("/polarization/manager/verbose",this);
66  verboseCmd->SetGuidance("Set the Verbose level of G4PolarizationManager.");
67  verboseCmd->SetGuidance(" 0 : Silent (default)");
68  verboseCmd->SetGuidance(" 1 : Verbose");
69  verboseCmd->SetParameterName("level",true);
71  verboseCmd->SetRange("level >=0 && level <=1");
72 
73  optActivateCmd = new G4UIcmdWithABool("/polarization/manager/activate",this);
74  optActivateCmd->SetGuidance("activate/deactivate polarization treatment");
75  optActivateCmd->SetParameterName("flag",true);
77 
78  volumeDirectory = new G4UIdirectory("/polarization/volume/");
79  volumeDirectory->SetGuidance("Status control commands of registered polarized logical volumes.");
80 
81  printVolumeListCmd = new G4UIcmdWithoutParameter("/polarization/volume/list",this);
82  printVolumeListCmd->SetGuidance("print list of registered polarized logical volumes");
84 
85  setPolarizationCmd = new G4UIcommand("/polarization/volume/set",this);
86  setPolarizationCmd->SetGuidance("set or change polarization of a logical volume");
87 // setPolarizationCmd->SetParameterName("polarization",true);
88 // setPolarizationCmd->SetDefaultValue("worldVolume 0. 0. 0.");
90 
91  G4UIparameter* param;
92  param = new G4UIparameter("logicalVolumeName",'s',false);
93  param->SetDefaultValue("worldVolume");
95  param = new G4UIparameter("px",'d',true);
96  param->SetDefaultValue("0.0");
98  param = new G4UIparameter("py",'d',true);
99  param->SetDefaultValue("0.0");
101  param = new G4UIparameter("pz",'d',true);
102  param->SetDefaultValue("0.0");
104 
105  testDirectory = new G4UIdirectory("/polarization/test/");
106  testDirectory->SetGuidance("provides access to some internal test routines.");
107 
108  testPolarizationTransformationCmd = new G4UIcmdWithoutParameter("/polarization/test/polarizationTransformation",this);
109  testPolarizationTransformationCmd->SetGuidance("checks definition of particle reference frame and corresponding translation routines");
111 
112  testInteractionFrameCmd = new G4UIcmdWithoutParameter("/polarization/test/interactionFrame",this);
113  testInteractionFrameCmd->SetGuidance("checks definition of interaction frame");
115 }
116 
118 {
119  delete verboseCmd;
122  delete testDirectory;
123  delete setPolarizationCmd;
124  delete printVolumeListCmd;
125  delete volumeDirectory;
126  delete optActivateCmd;
127  delete managerDirectory;
128  delete polarizationDirectory;
129 }
130 
132 {
133  if( command==verboseCmd ) {
135  }
136  else if ( command==optActivateCmd ) {
138  }
139  else if ( command==printVolumeListCmd ) {
141  }
142  else if ( command==setPolarizationCmd ) {
143  G4Tokenizer next( newValue );
144  G4String volumeName=next();
145  G4double px=0.,py=0.,pz=0.;
146  G4String dvalue=next();
147  if (!dvalue.isNull()) {
148  px=StoD(dvalue);
149  dvalue=next();
150  if (!dvalue.isNull()) {
151  py=StoD(dvalue);
152  dvalue=next();
153  if (!dvalue.isNull()) pz=StoD(dvalue);
154  }
155  }
156  G4ThreeVector pol(px,py,pz);
158  }
159  else if ( command==testPolarizationTransformationCmd ) {
161  }
162  else if (command==testInteractionFrameCmd ) {
164  }
165 }
166 
168 {
169  G4String cv;
170  if( command==verboseCmd )
172 
173  return cv;
174 }