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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 9.1.p3)


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