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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/polarisation/src/G4PolarizationMessenger.cc (Version 11.3.0) and /processes/electromagnetic/polarisation/src/G4PolarizationMessenger.cc (Version 9.0.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // Geant4 Class file                           <<  26 // $Id: G4PolarizationMessenger.cc,v 1.1 2006/09/21 21:35:11 vnivanch Exp $
                                                   >>  27 // GEANT4 tag $Name: geant4-08-03-patch-01 $
                                                   >>  28 //
                                                   >>  29 //
                                                   >>  30 // GEANT4 Class file
 27 //                                                 31 //
 28 // File name:     G4PolarizationManager            32 // File name:     G4PolarizationManager
 29 //                                                 33 //
 30 // Author:        Andreas Schaelicke               34 // Author:        Andreas Schaelicke
 31 //                                                 35 //
                                                   >>  36 // Creation date: 01.05.2005
                                                   >>  37 //
                                                   >>  38 // Modifications:
                                                   >>  39 //
 32 // Class Description:                              40 // Class Description:
 33 //   Provides access to general polarization i <<  41 //
 34 //   polarization for logical volumes through  <<  42 // Provides access to general polarization information and to 
                                                   >>  43 // polarization for logical volumes through macro files.
 35                                                    44 
 36 #include "G4PolarizationMessenger.hh"              45 #include "G4PolarizationMessenger.hh"
 37                                                << 
 38 #include "G4ios.hh"                            << 
 39 #include "G4PolarizationManager.hh"                46 #include "G4PolarizationManager.hh"
 40 #include "G4PolarizationHelper.hh"                 47 #include "G4PolarizationHelper.hh"
                                                   >>  48 
                                                   >>  49 #include "G4UIdirectory.hh"
 41 #include "G4Tokenizer.hh"                          50 #include "G4Tokenizer.hh"
 42 #include "G4UIcmdWithABool.hh"                 << 
 43 #include "G4UIcmdWithAnInteger.hh"             << 
 44 #include "G4UIcmdWithAString.hh"               << 
 45 #include "G4UIcmdWithoutParameter.hh"              51 #include "G4UIcmdWithoutParameter.hh"
 46 #include "G4UIdirectory.hh"                    <<  52 #include "G4UIcmdWithAString.hh"
                                                   >>  53 #include "G4UIcmdWithAnInteger.hh"
                                                   >>  54 #include "G4UIcmdWithABool.hh"
                                                   >>  55 #include "G4ios.hh"
                                                   >>  56 
 47                                                    57 
 48 G4PolarizationMessenger::G4PolarizationMesseng <<  58 G4PolarizationMessenger::G4PolarizationMessenger(G4PolarizationManager * polMgr)
 49   : polarizationManager(polMgr)                    59   : polarizationManager(polMgr)
 50 {                                                  60 {
 51   polarizationDirectory = new G4UIdirectory("/     61   polarizationDirectory = new G4UIdirectory("/polarization/");
 52   polarizationDirectory->SetGuidance("polariza     62   polarizationDirectory->SetGuidance("polarization control commands.");
 53                                                    63 
 54   managerDirectory = new G4UIdirectory("/polar     64   managerDirectory = new G4UIdirectory("/polarization/manager/");
 55   managerDirectory->SetGuidance("general polar     65   managerDirectory->SetGuidance("general polarization information.");
 56                                                    66 
 57   verboseCmd = new G4UIcmdWithAnInteger("/pola <<  67   verboseCmd = new G4UIcmdWithAnInteger("/polarization/manager/verbose",this);
 58   verboseCmd->SetGuidance("Set the Verbose lev     68   verboseCmd->SetGuidance("Set the Verbose level of G4PolarizationManager.");
 59   verboseCmd->SetGuidance(" 0 : Silent (defaul     69   verboseCmd->SetGuidance(" 0 : Silent (default)");
 60   verboseCmd->SetGuidance(" 1 : Verbose");         70   verboseCmd->SetGuidance(" 1 : Verbose");
 61   verboseCmd->SetParameterName("level", true); <<  71   verboseCmd->SetParameterName("level",true);
 62   verboseCmd->SetDefaultValue(0);                  72   verboseCmd->SetDefaultValue(0);
 63   verboseCmd->SetRange("level >=0 && level <=1     73   verboseCmd->SetRange("level >=0 && level <=1");
 64                                                    74 
 65   optActivateCmd = new G4UIcmdWithABool("/pola <<  75   optActivateCmd = new G4UIcmdWithABool("/polarization/manager/activate",this);
 66   optActivateCmd->SetGuidance("activate/deacti     76   optActivateCmd->SetGuidance("activate/deactivate polarization treatment");
 67   optActivateCmd->SetParameterName("flag", tru <<  77   optActivateCmd->SetParameterName("flag",true);
 68   optActivateCmd->SetDefaultValue(true);           78   optActivateCmd->SetDefaultValue(true);
 69                                                    79 
                                                   >>  80 
 70   volumeDirectory = new G4UIdirectory("/polari     81   volumeDirectory = new G4UIdirectory("/polarization/volume/");
 71   volumeDirectory->SetGuidance(                <<  82   volumeDirectory->SetGuidance("Status control commands of registered polarized logical volumes.");
 72     "Status control commands of registered pol << 
 73                                                    83 
 74   printVolumeListCmd =                         <<  84   printVolumeListCmd = new G4UIcmdWithoutParameter("/polarization/volume/list",this);
 75     new G4UIcmdWithoutParameter("/polarization <<  85   printVolumeListCmd->SetGuidance("print list of registered polarized logical volumes");
 76   printVolumeListCmd->SetGuidance(             <<  86   printVolumeListCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
 77     "print list of registered polarized logica <<  87   
 78   printVolumeListCmd->AvailableForStates(G4Sta <<  88   setPolarizationCmd = new G4UIcommand("/polarization/volume/set",this);
 79                                          G4Sta <<  89   setPolarizationCmd->SetGuidance("set or change polarization of a logical volume");
 80                                                <<  90 //   setPolarizationCmd->SetParameterName("polarization",true);
 81   setPolarizationCmd = new G4UIcommand("/polar <<  91 //   setPolarizationCmd->SetDefaultValue("worldVolume  0. 0. 0.");
 82   setPolarizationCmd->SetGuidance(             <<  92   setPolarizationCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
 83     "set or change polarization of a logical v << 
 84   setPolarizationCmd->AvailableForStates(G4Sta << 
 85                                          G4Sta << 
 86                                                    93 
 87   G4UIparameter* param;                            94   G4UIparameter* param;
 88   param = new G4UIparameter("logicalVolumeName <<  95   param = new G4UIparameter("logicalVolumeName",'s',false);
 89   param->SetDefaultValue("worldVolume");           96   param->SetDefaultValue("worldVolume");
 90   setPolarizationCmd->SetParameter(param);         97   setPolarizationCmd->SetParameter(param);
 91   param = new G4UIparameter("px", 'd', true);  <<  98   param = new G4UIparameter("px",'d',true);
 92   param->SetDefaultValue("0.0");                   99   param->SetDefaultValue("0.0");
 93   setPolarizationCmd->SetParameter(param);        100   setPolarizationCmd->SetParameter(param);
 94   param = new G4UIparameter("py", 'd', true);  << 101   param = new G4UIparameter("py",'d',true);
 95   param->SetDefaultValue("0.0");                  102   param->SetDefaultValue("0.0");
 96   setPolarizationCmd->SetParameter(param);        103   setPolarizationCmd->SetParameter(param);
 97   param = new G4UIparameter("pz", 'd', true);  << 104   param = new G4UIparameter("pz",'d',true);
 98   param->SetDefaultValue("0.0");                  105   param->SetDefaultValue("0.0");
 99   setPolarizationCmd->SetParameter(param);        106   setPolarizationCmd->SetParameter(param);
100                                                   107 
101   testDirectory = new G4UIdirectory("/polariza    108   testDirectory = new G4UIdirectory("/polarization/test/");
102   testDirectory->SetGuidance("provides access     109   testDirectory->SetGuidance("provides access to some internal test routines.");
103                                                   110 
104   testPolarizationTransformationCmd = new G4UI << 111   testPolarizationTransformationCmd = new G4UIcmdWithoutParameter("/polarization/test/polarizationTransformation",this);
105     "/polarization/test/polarizationTransforma << 112   testPolarizationTransformationCmd->SetGuidance("checks definition of particle reference frame and corresponding translation routines"); 
106   testPolarizationTransformationCmd->SetGuidan << 113   testPolarizationTransformationCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed);
107     "checks definition of particle reference f << 114 
108     "translation routines");                   << 115 
109   testPolarizationTransformationCmd->Available << 116 
110     G4State_PreInit, G4State_Idle, G4State_Geo << 
111                                                << 
112   testInteractionFrameCmd =                    << 
113     new G4UIcmdWithoutParameter("/polarization << 
114   testInteractionFrameCmd->SetGuidance(        << 
115     "checks definition of interaction frame"); << 
116   testInteractionFrameCmd->AvailableForStates( << 
117                                                << 
118 }                                                 117 }
119                                                   118 
120 G4PolarizationMessenger::~G4PolarizationMessen    119 G4PolarizationMessenger::~G4PolarizationMessenger()
121 {                                                 120 {
122   delete verboseCmd;                              121   delete verboseCmd;
123   delete testInteractionFrameCmd;              << 
124   delete testPolarizationTransformationCmd;    << 
125   delete testDirectory;                        << 
126   delete setPolarizationCmd;                   << 
127   delete printVolumeListCmd;                   << 
128   delete volumeDirectory;                      << 
129   delete optActivateCmd;                       << 
130   delete managerDirectory;                     << 
131   delete polarizationDirectory;                << 
132 }                                                 122 }
133                                                   123 
134 void G4PolarizationMessenger::SetNewValue(G4UI << 124 void G4PolarizationMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
135                                           G4St << 
136 {                                                 125 {
137   if(command == verboseCmd)                    << 126   if( command==verboseCmd ) { 
138   {                                            << 127     polarizationManager->SetVerbose(verboseCmd->GetNewIntValue(newValue)); 
139     polarizationManager->SetVerbose(verboseCmd << 128   }
140   }                                            << 129   else if ( command==optActivateCmd ) { 
141   else if(command == optActivateCmd)           << 130     polarizationManager->SetActivated(optActivateCmd->GetNewBoolValue(newValue));
142   {                                            << 
143     polarizationManager->SetActivated(         << 
144       optActivateCmd->GetNewBoolValue(newValue << 
145   }                                               131   }
146   else if(command == printVolumeListCmd)       << 132   else if ( command==printVolumeListCmd ) { 
147   {                                            << 
148     polarizationManager->ListVolumes();           133     polarizationManager->ListVolumes();
149   }                                               134   }
150   else if(command == setPolarizationCmd)       << 135   else if ( command==setPolarizationCmd ) {
151   {                                            << 136     G4Tokenizer next( newValue );
152     G4Tokenizer next(newValue);                << 137     G4String volumeName=next();
153     G4String volumeName = next();              << 138     G4double px=0.,py=0.,pz=0.;
154     G4double px = 0., py = 0., pz = 0.;        << 139     G4String dvalue=next();
155     G4String dvalue = next();                  << 140     if (!dvalue.isNull()) {
156     if(!dvalue.empty())                        << 141       px=StoD(dvalue);
157     {                                          << 142       dvalue=next();
158       px     = StoD(dvalue);                   << 143       if (!dvalue.isNull()) {
159       dvalue = next();                         << 144   py=StoD(dvalue);
160       if(!dvalue.empty())                      << 145   dvalue=next();
161       {                                        << 146   if (!dvalue.isNull()) pz=StoD(dvalue);
162         py     = StoD(dvalue);                 << 
163         dvalue = next();                       << 
164         if(!dvalue.empty())                    << 
165           pz = StoD(dvalue);                   << 
166       }                                           147       }
167     }                                             148     }
168     G4ThreeVector pol(px, py, pz);             << 149     G4ThreeVector pol(px,py,pz);
169     polarizationManager->SetVolumePolarization << 150     polarizationManager->SetVolumePolarization(volumeName,pol);
170   }                                               151   }
171   else if(command == testPolarizationTransform << 152   else if ( command==testPolarizationTransformationCmd ) {
172   {                                            << 
173     G4PolarizationHelper::TestPolarizationTran    153     G4PolarizationHelper::TestPolarizationTransformations();
174   }                                               154   }
175   else if(command == testInteractionFrameCmd)  << 155   else if (command==testInteractionFrameCmd ) {
176   {                                            << 
177     G4PolarizationHelper::TestInteractionFrame    156     G4PolarizationHelper::TestInteractionFrame();
178   }                                               157   }
179 }                                                 158 }
180                                                   159 
181 G4String G4PolarizationMessenger::GetCurrentVa << 160 G4String G4PolarizationMessenger::GetCurrentValue(G4UIcommand * command)
182 {                                                 161 {
183   G4String cv;                                    162   G4String cv;
184   if(command == verboseCmd)                    << 163   if( command==verboseCmd )
185   {                                            << 164   { cv = verboseCmd->ConvertToString(polarizationManager->GetVerbose()); }
186     cv = verboseCmd->ConvertToString(polarizat << 
187   }                                            << 
188                                                   165 
189   return cv;                                      166   return cv;
190 }                                                 167 }
191                                                   168