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.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 /examples/extended/field/field04/src/F04FieldMessenger.cc (Version 11.3.0) and /examples/extended/field/field04/src/F04FieldMessenger.cc (Version 11.2.2)


  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 //                                                 26 //
 27 /// \file field/field04/src/F04FieldMessenger.     27 /// \file field/field04/src/F04FieldMessenger.cc
 28 /// \brief Implementation of the F04FieldMesse     28 /// \brief Implementation of the F04FieldMessenger class
 29 //                                                 29 //
 30                                                    30 
 31 #include "F04FieldMessenger.hh"                    31 #include "F04FieldMessenger.hh"
 32                                                    32 
 33 #include "F04DetectorConstruction.hh"          << 
 34 #include "F04GlobalField.hh"                       33 #include "F04GlobalField.hh"
 35                                                <<  34 #include "G4UIdirectory.hh"
 36 #include "G4UIcmdWithADoubleAndUnit.hh"        << 
 37 #include "G4UIcmdWithAString.hh"                   35 #include "G4UIcmdWithAString.hh"
 38 #include "G4UIcmdWithAnInteger.hh"                 36 #include "G4UIcmdWithAnInteger.hh"
                                                   >>  37 #include "G4UIcmdWithADoubleAndUnit.hh"
 39 #include "G4UIcmdWithoutParameter.hh"              38 #include "G4UIcmdWithoutParameter.hh"
 40 #include "G4UIdirectory.hh"                    <<  39 
                                                   >>  40 #include "F04DetectorConstruction.hh"
 41                                                    41 
 42 //....oooOO0OOooo........oooOO0OOooo........oo     42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 43                                                    43 
 44 F04FieldMessenger::F04FieldMessenger(F04Global <<  44 F04FieldMessenger::F04FieldMessenger(F04GlobalField* pEMfield,
                                                   >>  45                                      F04DetectorConstruction* detector)
 45   : fGlobalField(pEMfield)                         46   : fGlobalField(pEMfield)
 46 {                                                  47 {
 47   fDetector = detector;                            48   fDetector = detector;
 48                                                    49 
 49   fDetDir = new G4UIdirectory("/field/");          50   fDetDir = new G4UIdirectory("/field/");
 50   fDetDir->SetGuidance(" Field tracking contro     51   fDetDir->SetGuidance(" Field tracking control ");
 51                                                    52 
 52   fCaptureB1Cmd = new G4UIcmdWithADoubleAndUni <<  53   fCaptureB1Cmd = new G4UIcmdWithADoubleAndUnit("/field/SetCaptureB1",this);
 53   fCaptureB1Cmd->SetGuidance("Set B1 of the Ca     54   fCaptureB1Cmd->SetGuidance("Set B1 of the Capture Magnet");
 54   fCaptureB1Cmd->SetParameterName("CSizeB1", f <<  55   fCaptureB1Cmd->SetParameterName("CSizeB1",false,false);
 55   fCaptureB1Cmd->SetDefaultUnit("tesla");          56   fCaptureB1Cmd->SetDefaultUnit("tesla");
 56   fCaptureB1Cmd->SetRange("CSizeB1>0.");           57   fCaptureB1Cmd->SetRange("CSizeB1>0.");
 57   fCaptureB1Cmd->AvailableForStates(G4State_Pr <<  58   fCaptureB1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 58                                                    59 
 59   fCaptureB2Cmd = new G4UIcmdWithADoubleAndUni <<  60   fCaptureB2Cmd = new G4UIcmdWithADoubleAndUnit("/field/SetCaptureB2",this);
 60   fCaptureB2Cmd->SetGuidance("Set B2 of the Ca     61   fCaptureB2Cmd->SetGuidance("Set B2 of the Capture Magnet");
 61   fCaptureB2Cmd->SetParameterName("CSizeB2", f <<  62   fCaptureB2Cmd->SetParameterName("CSizeB2",false,false);
 62   fCaptureB2Cmd->SetDefaultUnit("tesla");          63   fCaptureB2Cmd->SetDefaultUnit("tesla");
 63   fCaptureB2Cmd->SetRange("CSizeB2>0.");           64   fCaptureB2Cmd->SetRange("CSizeB2>0.");
 64   fCaptureB2Cmd->AvailableForStates(G4State_Pr <<  65   fCaptureB2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 65                                                    66 
 66   fTransferBCmd = new G4UIcmdWithADoubleAndUni <<  67   fTransferBCmd = new G4UIcmdWithADoubleAndUnit("/field/SetTransferB",this);
 67   fTransferBCmd->SetGuidance("Set B of the Tra     68   fTransferBCmd->SetGuidance("Set B of the Transfer Magnet");
 68   fTransferBCmd->SetParameterName("TSizeB", fa <<  69   fTransferBCmd->SetParameterName("TSizeB",false,false);
 69   fTransferBCmd->SetDefaultUnit("tesla");          70   fTransferBCmd->SetDefaultUnit("tesla");
 70   fTransferBCmd->SetRange("TSizeB>0.");            71   fTransferBCmd->SetRange("TSizeB>0.");
 71   fTransferBCmd->AvailableForStates(G4State_Pr <<  72   fTransferBCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 72                                                    73 
 73   fStepperCMD = new G4UIcmdWithAnInteger("/fie <<  74   fStepperCMD = new G4UIcmdWithAnInteger("/field/setStepperType",this);
 74   fStepperCMD->SetGuidance("Select stepper typ     75   fStepperCMD->SetGuidance("Select stepper type for field");
 75   fStepperCMD->SetParameterName("choice", true <<  76   fStepperCMD->SetParameterName("choice",true);
 76   fStepperCMD->SetDefaultValue(4);                 77   fStepperCMD->SetDefaultValue(4);
 77   fStepperCMD->AvailableForStates(G4State_PreI <<  78   fStepperCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
 78                                                    79 
 79   fMinStepCMD = new G4UIcmdWithADoubleAndUnit( <<  80   fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
 80   fMinStepCMD->SetGuidance("Define minimal ste     81   fMinStepCMD->SetGuidance("Define minimal step");
 81   fMinStepCMD->SetParameterName("min step", fa <<  82   fMinStepCMD->SetParameterName("min step",false,false);
 82   fMinStepCMD->SetDefaultUnit("mm");               83   fMinStepCMD->SetDefaultUnit("mm");
 83   fMinStepCMD->AvailableForStates(G4State_PreI <<  84   fMinStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
 84                                                    85 
 85   fDeltaChordCMD = new G4UIcmdWithADoubleAndUn <<  86   fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord",this);
 86   fDeltaChordCMD->SetGuidance("Define delta ch     87   fDeltaChordCMD->SetGuidance("Define delta chord");
 87   fDeltaChordCMD->SetParameterName("delta chor <<  88   fDeltaChordCMD->SetParameterName("delta chord",false,false);
 88   fDeltaChordCMD->SetDefaultUnit("mm");            89   fDeltaChordCMD->SetDefaultUnit("mm");
 89   fDeltaChordCMD->AvailableForStates(G4State_P <<  90   fDeltaChordCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
 90                                                    91 
 91   fDeltaOneStepCMD = new G4UIcmdWithADoubleAnd <<  92   fDeltaOneStepCMD =
                                                   >>  93                  new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this);
 92   fDeltaOneStepCMD->SetGuidance("Define delta      94   fDeltaOneStepCMD->SetGuidance("Define delta one step");
 93   fDeltaOneStepCMD->SetParameterName("delta on <<  95   fDeltaOneStepCMD->SetParameterName("delta one step",false,false);
 94   fDeltaOneStepCMD->SetDefaultUnit("mm");          96   fDeltaOneStepCMD->SetDefaultUnit("mm");
 95   fDeltaOneStepCMD->AvailableForStates(G4State <<  97   fDeltaOneStepCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
 96                                                    98 
 97   fDeltaIntersectionCMD = new G4UIcmdWithADoub <<  99   fDeltaIntersectionCMD =
                                                   >> 100             new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection",this);
 98   fDeltaIntersectionCMD->SetGuidance("Define d    101   fDeltaIntersectionCMD->SetGuidance("Define delta intersection");
 99   fDeltaIntersectionCMD->SetParameterName("del << 102   fDeltaIntersectionCMD->SetParameterName("delta intersection",false,false);
100   fDeltaIntersectionCMD->SetDefaultUnit("mm");    103   fDeltaIntersectionCMD->SetDefaultUnit("mm");
101   fDeltaIntersectionCMD->AvailableForStates(G4 << 104   fDeltaIntersectionCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
102                                                   105 
103   fEpsMinCMD = new G4UIcmdWithADoubleAndUnit(" << 106   fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin",this);
104   fEpsMinCMD->SetGuidance("Define eps min");      107   fEpsMinCMD->SetGuidance("Define eps min");
105   fEpsMinCMD->SetParameterName("eps min", fals << 108   fEpsMinCMD->SetParameterName("eps min",false,false);
106   fEpsMinCMD->SetDefaultUnit("mm");               109   fEpsMinCMD->SetDefaultUnit("mm");
107   fEpsMinCMD->AvailableForStates(G4State_PreIn << 110   fEpsMinCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
108                                                   111 
109   fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit(" << 112   fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax",this);
110   fEpsMaxCMD->SetGuidance("Define eps max");      113   fEpsMaxCMD->SetGuidance("Define eps max");
111   fEpsMaxCMD->SetParameterName("eps max", fals << 114   fEpsMaxCMD->SetParameterName("eps max",false,false);
112   fEpsMaxCMD->SetDefaultUnit("mm");               115   fEpsMaxCMD->SetDefaultUnit("mm");
113   fEpsMaxCMD->AvailableForStates(G4State_PreIn << 116   fEpsMaxCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
114 }                                                 117 }
115                                                   118 
116 //....oooOO0OOooo........oooOO0OOooo........oo    119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117                                                   120 
118 F04FieldMessenger::~F04FieldMessenger()           121 F04FieldMessenger::~F04FieldMessenger()
119 {                                                 122 {
120   delete fDetDir;                                 123   delete fDetDir;
121                                                   124 
122   delete fCaptureB1Cmd;                           125   delete fCaptureB1Cmd;
123   delete fCaptureB2Cmd;                           126   delete fCaptureB2Cmd;
124   delete fTransferBCmd;                           127   delete fTransferBCmd;
125                                                   128 
126   delete fStepperCMD;                             129   delete fStepperCMD;
127   delete fMinStepCMD;                             130   delete fMinStepCMD;
128   delete fDeltaChordCMD;                          131   delete fDeltaChordCMD;
129   delete fDeltaOneStepCMD;                        132   delete fDeltaOneStepCMD;
130   delete fDeltaIntersectionCMD;                   133   delete fDeltaIntersectionCMD;
131   delete fEpsMinCMD;                              134   delete fEpsMinCMD;
132   delete fEpsMaxCMD;                              135   delete fEpsMaxCMD;
133 }                                                 136 }
134                                                   137 
135 //....oooOO0OOooo........oooOO0OOooo........oo    138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136                                                   139 
137 void F04FieldMessenger::SetNewValue(G4UIcomman << 140 void F04FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
138 {                                                 141 {
139   if (command == fCaptureB1Cmd)                << 142 
                                                   >> 143   if( command == fCaptureB1Cmd )
140     fDetector->SetCaptureMgntB1(fCaptureB1Cmd-    144     fDetector->SetCaptureMgntB1(fCaptureB1Cmd->GetNewDoubleValue(newValue));
141                                                   145 
142   if (command == fCaptureB2Cmd)                << 146   if( command == fCaptureB2Cmd )
143     fDetector->SetCaptureMgntB2(fCaptureB2Cmd-    147     fDetector->SetCaptureMgntB2(fCaptureB2Cmd->GetNewDoubleValue(newValue));
144                                                   148 
145   if (command == fTransferBCmd)                << 149   if( command == fTransferBCmd )
146     fDetector->SetTransferMgntB(fTransferBCmd-    150     fDetector->SetTransferMgntB(fTransferBCmd->GetNewDoubleValue(newValue));
147                                                   151 
148   if (command == fStepperCMD) {                << 152   if( command == fStepperCMD )
                                                   >> 153   {
149     fGlobalField->SetStepperType(fStepperCMD->    154     fGlobalField->SetStepperType(fStepperCMD->GetNewIntValue(newValue));
150   }                                               155   }
151   if (command == fMinStepCMD) {                << 156   if( command == fMinStepCMD )
                                                   >> 157   {
152     fGlobalField->SetMinStep(fMinStepCMD->GetN    158     fGlobalField->SetMinStep(fMinStepCMD->GetNewDoubleValue(newValue));
153   }                                               159   }
154   if (command == fDeltaChordCMD) {             << 160   if( command == fDeltaChordCMD )
                                                   >> 161   {
155     fGlobalField->SetDeltaChord(fDeltaChordCMD    162     fGlobalField->SetDeltaChord(fDeltaChordCMD->GetNewDoubleValue(newValue));
156   }                                               163   }
157   if (command == fDeltaOneStepCMD) {           << 164   if( command == fDeltaOneStepCMD )
158     fGlobalField->SetDeltaOneStep(fDeltaOneSte << 165   {
159   }                                            << 166     fGlobalField->
160   if (command == fDeltaIntersectionCMD) {      << 167                 SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue));
161     fGlobalField->SetDeltaIntersection(fDeltaI << 168   }
                                                   >> 169   if( command == fDeltaIntersectionCMD )
                                                   >> 170   {
                                                   >> 171     fGlobalField->
                                                   >> 172       SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue));
162   }                                               173   }
163   if (command == fEpsMinCMD) {                 << 174   if( command == fEpsMinCMD )
                                                   >> 175   {
164     fGlobalField->SetEpsMin(fEpsMinCMD->GetNew    176     fGlobalField->SetEpsMin(fEpsMinCMD->GetNewDoubleValue(newValue));
165   }                                               177   }
166   if (command == fEpsMaxCMD) {                 << 178   if( command == fEpsMaxCMD )
                                                   >> 179   {
167     fGlobalField->SetEpsMax(fEpsMaxCMD->GetNew    180     fGlobalField->SetEpsMax(fEpsMaxCMD->GetNewDoubleValue(newValue));
168   }                                               181   }
169 }                                                 182 }
170                                                   183