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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 /examples/extended/electromagnetic/TestEm8/src/DetectorMessenger.cc (Version 11.3.0) and /examples/extended/electromagnetic/TestEm8/src/DetectorMessenger.cc (Version 10.4.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 /// \file electromagnetic/TestEm8/src/Detector     26 /// \file electromagnetic/TestEm8/src/DetectorMessenger.cc
 27 /// \brief Implementation of the DetectorMesse     27 /// \brief Implementation of the DetectorMessenger class
 28 //                                                 28 //
                                                   >>  29 // $Id: DetectorMessenger.cc 106960 2017-10-31 08:35:19Z gcosmo $
 29 //                                                 30 //
 30 //////////////////////////////////////////////     31 /////////////////////////////////////////////////////////////////////////
 31 //                                                 32 //
 32 // TestEm8: Gaseous detector                       33 // TestEm8: Gaseous detector
 33 //                                                 34 //
 34 // Created: 31.08.2010 V.Ivanchenko                35 // Created: 31.08.2010 V.Ivanchenko
 35 //                                                 36 //
 36 // Modified:                                       37 // Modified:
 37 //                                                 38 //
 38 //////////////////////////////////////////////     39 ////////////////////////////////////////////////////////////////////////
 39 //                                             <<  40 // 
 40                                                    41 
 41 //....oooOO0OOooo........oooOO0OOooo........oo     42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 42                                                    43 
 43 #include "DetectorMessenger.hh"                    44 #include "DetectorMessenger.hh"
 44                                                    45 
 45 #include "DetectorConstruction.hh"                 46 #include "DetectorConstruction.hh"
 46                                                <<  47 #include "G4UIdirectory.hh"
 47 #include "G4UIcmdWithADoubleAndUnit.hh"        << 
 48 #include "G4UIcmdWithAString.hh"                   48 #include "G4UIcmdWithAString.hh"
                                                   >>  49 #include "G4UIcmdWithADoubleAndUnit.hh"
 49 #include "G4UIcmdWithoutParameter.hh"              50 #include "G4UIcmdWithoutParameter.hh"
 50 #include "G4UIdirectory.hh"                    << 
 51                                                    51 
 52 //....oooOO0OOooo........oooOO0OOooo........oo     52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 53                                                    53 
 54 DetectorMessenger::DetectorMessenger(DetectorC <<  54 DetectorMessenger::DetectorMessenger(DetectorConstruction * det)
 55 {                                              <<  55   : G4UImessenger(),fDetector(det)
                                                   >>  56 { 
 56   fDetDir = new G4UIdirectory("/testem/");         57   fDetDir = new G4UIdirectory("/testem/");
 57   fDetDir->SetGuidance("Detector control.");       58   fDetDir->SetGuidance("Detector control.");
 58                                                <<  59       
 59   fGasMaterCmd = new G4UIcmdWithAString("/test <<  60   fGasMaterCmd = new G4UIcmdWithAString("/testem/setGasMat",this);
 60   fGasMaterCmd->SetGuidance("Select material o     61   fGasMaterCmd->SetGuidance("Select material of the detector.");
 61   fGasMaterCmd->SetParameterName("gmat", true) <<  62   fGasMaterCmd->SetParameterName("gmat",true);
 62   fGasMaterCmd->SetDefaultValue("Argon");          63   fGasMaterCmd->SetDefaultValue("Argon");
 63   fGasMaterCmd->AvailableForStates(G4State_Pre <<  64   fGasMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 64                                                    65 
 65   fWindowMaterCmd = new G4UIcmdWithAString("/t <<  66   fWindowMaterCmd = new G4UIcmdWithAString("/testem/setWindowMat",this);
 66   fWindowMaterCmd->SetGuidance("Select materia     67   fWindowMaterCmd->SetGuidance("Select material of the window.");
 67   fWindowMaterCmd->SetParameterName("wmat", tr <<  68   fWindowMaterCmd->SetParameterName("wmat",true);
 68   fWindowMaterCmd->SetDefaultValue("Mylar");       69   fWindowMaterCmd->SetDefaultValue("Mylar");
 69   fWindowMaterCmd->AvailableForStates(G4State_ <<  70   fWindowMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 70                                                <<  71   
 71   fWorldMaterCmd = new G4UIcmdWithAString("/te <<  72   fWorldMaterCmd = new G4UIcmdWithAString("/testem/setWorldMat",this);
 72   fWorldMaterCmd->SetGuidance("Select material     73   fWorldMaterCmd->SetGuidance("Select material of the world.");
 73   fWorldMaterCmd->SetParameterName("worldmat", <<  74   fWorldMaterCmd->SetParameterName("worldmat",true);
 74   fWorldMaterCmd->SetDefaultValue("empty");        75   fWorldMaterCmd->SetDefaultValue("empty");
 75   fWorldMaterCmd->AvailableForStates(G4State_P <<  76   fWorldMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 76                                                <<  77   
 77   fGasThickCmd = new G4UIcmdWithADoubleAndUnit <<  78   fGasThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasThick",this);
 78   fGasThickCmd->SetGuidance("Set thickness of      79   fGasThickCmd->SetGuidance("Set thickness of the detector");
 79   fGasThickCmd->SetParameterName("SizeZ", fals <<  80   fGasThickCmd->SetParameterName("SizeZ",false,false);
 80   fGasThickCmd->SetUnitCategory("Length");         81   fGasThickCmd->SetUnitCategory("Length");
 81   fGasThickCmd->SetDefaultUnit("mm");              82   fGasThickCmd->SetDefaultUnit("mm");
 82   fGasThickCmd->SetRange("SizeZ>0.");              83   fGasThickCmd->SetRange("SizeZ>0.");
 83   fGasThickCmd->AvailableForStates(G4State_Pre <<  84   fGasThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 84                                                <<  85   
 85   fGasRadCmd = new G4UIcmdWithADoubleAndUnit(" <<  86   fGasRadCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasRad",this);
 86   fGasRadCmd->SetGuidance("Set radius of the d     87   fGasRadCmd->SetGuidance("Set radius of the detector");
 87   fGasRadCmd->SetParameterName("SizeR", false, <<  88   fGasRadCmd->SetParameterName("SizeR",false,false);
 88   fGasRadCmd->SetUnitCategory("Length");           89   fGasRadCmd->SetUnitCategory("Length");
 89   fGasRadCmd->SetDefaultUnit("mm");                90   fGasRadCmd->SetDefaultUnit("mm");
 90   fGasRadCmd->SetRange("SizeR>0.");                91   fGasRadCmd->SetRange("SizeR>0.");
 91   fGasRadCmd->AvailableForStates(G4State_PreIn <<  92   fGasRadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 92                                                <<  93   
 93   fWinThickCmd = new G4UIcmdWithADoubleAndUnit <<  94   fWinThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setWindowThick",this);
 94   fWinThickCmd->SetGuidance("Set thickness of      95   fWinThickCmd->SetGuidance("Set thickness of the window");
 95   fWinThickCmd->SetParameterName("delta", fals <<  96   fWinThickCmd->SetParameterName("delta",false,false);
 96   fWinThickCmd->SetUnitCategory("Length");         97   fWinThickCmd->SetUnitCategory("Length");
 97   fWinThickCmd->SetDefaultUnit("mm");              98   fWinThickCmd->SetDefaultUnit("mm");
 98   fWinThickCmd->SetRange("delta>0.");              99   fWinThickCmd->SetRange("delta>0.");
 99   fWinThickCmd->AvailableForStates(G4State_Pre << 100   fWinThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
100                                                   101 
101   fIonCmd = new G4UIcmdWithADoubleAndUnit("/te << 102   fIonCmd = new G4UIcmdWithADoubleAndUnit("/testem/setPairEnergy",this);
102   fIonCmd->SetGuidance("Set energy per electro    103   fIonCmd->SetGuidance("Set energy per electron-ion pair for detector");
103   fIonCmd->SetParameterName("en", false, false << 104   fIonCmd->SetParameterName("en",false,false);
104   fIonCmd->SetUnitCategory("Energy");             105   fIonCmd->SetUnitCategory("Energy");
105   fIonCmd->SetDefaultUnit("MeV");                 106   fIonCmd->SetDefaultUnit("MeV");
106   fIonCmd->SetRange("en>0.");                     107   fIonCmd->SetRange("en>0.");
107   fIonCmd->AvailableForStates(G4State_PreInit, << 108   fIonCmd->AvailableForStates(G4State_PreInit,G4State_Idle);    
108                                                   109 
109   fStepMaxCmd = new G4UIcmdWithADoubleAndUnit( << 110   fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/testem/stepMax",this);
110   fStepMaxCmd->SetGuidance("Set max allowed st    111   fStepMaxCmd->SetGuidance("Set max allowed step length for charged particles");
111   fStepMaxCmd->SetParameterName("mxStep", fals << 112   fStepMaxCmd->SetParameterName("mxStep",false);
112   fStepMaxCmd->SetRange("mxStep>0.");             113   fStepMaxCmd->SetRange("mxStep>0.");
113   fStepMaxCmd->SetUnitCategory("Length");         114   fStepMaxCmd->SetUnitCategory("Length");
114   fStepMaxCmd->AvailableForStates(G4State_PreI << 115   fStepMaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
115 }                                                 116 }
116                                                   117 
117 //....oooOO0OOooo........oooOO0OOooo........oo    118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118                                                   119 
119 DetectorMessenger::~DetectorMessenger()           120 DetectorMessenger::~DetectorMessenger()
120 {                                                 121 {
121   delete fGasMaterCmd;                         << 122   delete fGasMaterCmd; 
122   delete fGasThickCmd;                         << 123   delete fGasThickCmd; 
123   delete fGasRadCmd;                           << 124   delete fGasRadCmd;  
124   delete fWinThickCmd;                         << 125   delete fWinThickCmd; 
125   delete fWindowMaterCmd;                         126   delete fWindowMaterCmd;
126   delete fWorldMaterCmd;                          127   delete fWorldMaterCmd;
127   delete fIonCmd;                                 128   delete fIonCmd;
128   delete fStepMaxCmd;                          << 129   delete fStepMaxCmd; 
129   delete fDetDir;                                 130   delete fDetDir;
130 }                                                 131 }
131                                                   132 
132 //....oooOO0OOooo........oooOO0OOooo........oo    133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133                                                   134 
134 void DetectorMessenger::SetNewValue(G4UIcomman << 135 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
135 {                                              << 136 { 
136   if (command == fGasMaterCmd) {               << 137   if( command == fGasMaterCmd ) { 
137     fDetector->SetGasMaterial(newValue);          138     fDetector->SetGasMaterial(newValue);
138   }                                            << 139   } else if( command == fWindowMaterCmd ) { 
139   else if (command == fWindowMaterCmd) {       << 
140     fDetector->SetContainerMaterial(newValue);    140     fDetector->SetContainerMaterial(newValue);
141   }                                            << 141   } else if( command == fWorldMaterCmd ) { 
142   else if (command == fWorldMaterCmd) {        << 
143     fDetector->SetWorldMaterial(newValue);        142     fDetector->SetWorldMaterial(newValue);
144   }                                            << 143   } else if( command == fGasThickCmd ) { 
145   else if (command == fGasThickCmd) {          << 
146     fDetector->SetGasThickness(fGasThickCmd->G    144     fDetector->SetGasThickness(fGasThickCmd->GetNewDoubleValue(newValue));
147   }                                            << 145   } else if( command == fGasRadCmd ) { 
148   else if (command == fGasRadCmd) {            << 
149     fDetector->SetGasRadius(fGasRadCmd->GetNew    146     fDetector->SetGasRadius(fGasRadCmd->GetNewDoubleValue(newValue));
150   }                                            << 147   } else if( command == fWinThickCmd ) { 
151   else if (command == fWinThickCmd) {          << 
152     fDetector->SetContainerThickness(fWinThick    148     fDetector->SetContainerThickness(fWinThickCmd->GetNewDoubleValue(newValue));
153   }                                            << 149   } else if( command == fStepMaxCmd ) { 
154   else if (command == fStepMaxCmd) {           << 
155     fDetector->SetMaxChargedStep(fStepMaxCmd->    150     fDetector->SetMaxChargedStep(fStepMaxCmd->GetNewDoubleValue(newValue));
156   }                                            << 151   } else if( command == fIonCmd ) { 
157   else if (command == fIonCmd) {               << 
158     fDetector->SetPairEnergy(fIonCmd->GetNewDo    152     fDetector->SetPairEnergy(fIonCmd->GetNewDoubleValue(newValue));
159   }                                               153   }
160 }                                                 154 }
161                                                   155 
162 //....oooOO0OOooo........oooOO0OOooo........oo    156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
163                                                   157