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] [ 10.4.p3 ] [ 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/hadronic/ParticleFluence/ConcentricSpheres/src/DetectorMessenger.cc (Version 11.3.0) and /examples/extended/hadronic/ParticleFluence/ConcentricSpheres/src/DetectorMessenger.cc (Version 11.1.3)


  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 DetectorMessenger.cc                     26 /// \file DetectorMessenger.cc
 27 /// \brief Implementation of the DetectorMesse     27 /// \brief Implementation of the DetectorMessenger class
 28 //                                                 28 //
 29 //                                                 29 //
 30                                                    30 
 31 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32 //....oooOO0OOooo........oooOO0OOooo........oo     32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 33                                                    33 
 34 #include "DetectorMessenger.hh"                    34 #include "DetectorMessenger.hh"
 35                                                << 
 36 #include "DetectorConstruction.hh"                 35 #include "DetectorConstruction.hh"
 37                                                <<  36 #include "G4UIdirectory.hh"
 38 #include "G4UIcmdWithADoubleAndUnit.hh"            37 #include "G4UIcmdWithADoubleAndUnit.hh"
 39 #include "G4UIcmdWithAString.hh"                   38 #include "G4UIcmdWithAString.hh"
 40 #include "G4UIcmdWithoutParameter.hh"              39 #include "G4UIcmdWithoutParameter.hh"
 41 #include "G4UIdirectory.hh"                    << 
 42 #include "globals.hh"                              40 #include "globals.hh"
 43                                                    41 
 44 //....oooOO0OOooo........oooOO0OOooo........oo     42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 45                                                    43 
 46 DetectorMessenger::DetectorMessenger(DetectorC <<  44 DetectorMessenger::DetectorMessenger( DetectorConstruction* myDet ) : fDetector( myDet ) {
 47 {                                              <<  45   fDetectorDir = new G4UIdirectory( "/mydet/" );
 48   fDetectorDir = new G4UIdirectory("/mydet/"); <<  46   fDetectorDir->SetGuidance( "Detector control." );
 49   fDetectorDir->SetGuidance("Detector control. <<  47 
 50                                                <<  48   fMaterialTracker = new G4UIcmdWithAString( "/mydet/material_tracker", this );
 51   fMaterialTracker = new G4UIcmdWithAString("/ <<  49   fMaterialTracker->SetGuidance( "Choice of the material for the Tracker:" );
 52   fMaterialTracker->SetGuidance("Choice of the <<  50   fMaterialTracker->SetGuidance( "   a Geant4 NIST material, e.g. G4_Si " );
 53   fMaterialTracker->SetGuidance("   a Geant4 N <<  51   fMaterialTracker->SetParameterName( "choiceMaterial", true );
 54   fMaterialTracker->SetParameterName("choiceMa <<  52   fMaterialTracker->SetDefaultValue( "G4_Si" );
 55   fMaterialTracker->SetDefaultValue("G4_Si");  <<  53   fMaterialTracker->AvailableForStates( G4State_PreInit, G4State_Idle );
 56   fMaterialTracker->AvailableForStates(G4State <<  54 
 57                                                <<  55   fMaterialEmCalo = new G4UIcmdWithAString( "/mydet/material_emCalo", this );
 58   fMaterialEmCalo = new G4UIcmdWithAString("/m <<  56   fMaterialEmCalo->SetGuidance( "Choice of the material for the EM calo:" );
 59   fMaterialEmCalo->SetGuidance("Choice of the  <<  57   fMaterialEmCalo->SetGuidance( "   a Geant4 NIST material, e.g. G4_Pb " );
 60   fMaterialEmCalo->SetGuidance("   a Geant4 NI <<  58   fMaterialEmCalo->SetParameterName( "choiceMaterial", true );
 61   fMaterialEmCalo->SetParameterName("choiceMat <<  59   fMaterialEmCalo->SetDefaultValue( "G4_Pb" );
 62   fMaterialEmCalo->SetDefaultValue("G4_Pb");   <<  60   fMaterialEmCalo->AvailableForStates( G4State_PreInit, G4State_Idle );
 63   fMaterialEmCalo->AvailableForStates(G4State_ <<  61   
 64                                                <<  62   fMaterialHadCalo = new G4UIcmdWithAString( "/mydet/material_hadCalo", this );
 65   fMaterialHadCalo = new G4UIcmdWithAString("/ <<  63   fMaterialHadCalo->SetGuidance( "Choice of the material for the HAD calo:" );
 66   fMaterialHadCalo->SetGuidance("Choice of the <<  64   fMaterialHadCalo->SetGuidance( "   a Geant4 NIST material, e.g. G4_Fe " );
 67   fMaterialHadCalo->SetGuidance("   a Geant4 N <<  65   fMaterialHadCalo->SetParameterName( "choiceMaterial", true );
 68   fMaterialHadCalo->SetParameterName("choiceMa <<  66   fMaterialHadCalo->SetDefaultValue( "G4_Fe" );
 69   fMaterialHadCalo->SetDefaultValue("G4_Fe");  <<  67   fMaterialHadCalo->AvailableForStates( G4State_PreInit, G4State_Idle );
 70   fMaterialHadCalo->AvailableForStates(G4State <<  68   
 71                                                <<  69   fInnerRadiusTracker = new G4UIcmdWithADoubleAndUnit( "/mydet/inner_radius_tracker", this );
 72   fInnerRadiusTracker = new G4UIcmdWithADouble <<  70   fInnerRadiusTracker->SetParameterName( "choiceInnerRadiusTracker", true );
 73   fInnerRadiusTracker->SetParameterName("choic <<  71   fInnerRadiusTracker->SetGuidance( "Inner radius of the Tracker" );
 74   fInnerRadiusTracker->SetGuidance("Inner radi <<  72   fInnerRadiusTracker->SetDefaultValue( 100.0 );  // default: 10 cm.
 75   fInnerRadiusTracker->SetDefaultValue(100.0); <<  73   fInnerRadiusTracker->AvailableForStates( G4State_PreInit, G4State_Idle );
 76   fInnerRadiusTracker->AvailableForStates(G4St <<  74 
 77                                                <<  75   fOuterRadiusTracker = new G4UIcmdWithADoubleAndUnit( "/mydet/outer_radius_tracker", this );
 78   fOuterRadiusTracker = new G4UIcmdWithADouble <<  76   fOuterRadiusTracker->SetParameterName( "choiceOuterRadiusTracker", true );
 79   fOuterRadiusTracker->SetParameterName("choic <<  77   fOuterRadiusTracker->SetGuidance( "Outer radius of the Tracker" );
 80   fOuterRadiusTracker->SetGuidance("Outer radi <<  78   fOuterRadiusTracker->SetDefaultValue( 200.0 );  // default: 20 cm.
 81   fOuterRadiusTracker->SetDefaultValue(200.0); <<  79   fOuterRadiusTracker->AvailableForStates( G4State_PreInit, G4State_Idle );
 82   fOuterRadiusTracker->AvailableForStates(G4St <<  80 
 83                                                <<  81   fInnerRadiusEmCalo = new G4UIcmdWithADoubleAndUnit( "/mydet/inner_radius_emCalo", this );
 84   fInnerRadiusEmCalo = new G4UIcmdWithADoubleA <<  82   fInnerRadiusEmCalo->SetParameterName( "choiceInnerRadiusEmCalo", true );
 85   fInnerRadiusEmCalo->SetParameterName("choice <<  83   fInnerRadiusEmCalo->SetGuidance( "Inner radius of the EM Calo" );
 86   fInnerRadiusEmCalo->SetGuidance("Inner radiu <<  84   fInnerRadiusEmCalo->SetDefaultValue( 300.0 );  // default: 30 cm.
 87   fInnerRadiusEmCalo->SetDefaultValue(300.0);  <<  85   fInnerRadiusEmCalo->AvailableForStates( G4State_PreInit, G4State_Idle );
 88   fInnerRadiusEmCalo->AvailableForStates(G4Sta <<  86 
 89                                                <<  87   fOuterRadiusEmCalo = new G4UIcmdWithADoubleAndUnit( "/mydet/outer_radius_emCalo", this );
 90   fOuterRadiusEmCalo = new G4UIcmdWithADoubleA <<  88   fOuterRadiusEmCalo->SetParameterName( "choiceOuterRadiusEmCalo", true );
 91   fOuterRadiusEmCalo->SetParameterName("choice <<  89   fOuterRadiusEmCalo->SetGuidance( "Outer radius of the EM Calo" );
 92   fOuterRadiusEmCalo->SetGuidance("Outer radiu <<  90   fOuterRadiusEmCalo->SetDefaultValue( 600.0 );  // default: 60 cm.
 93   fOuterRadiusEmCalo->SetDefaultValue(600.0);  <<  91   fOuterRadiusEmCalo->AvailableForStates( G4State_PreInit, G4State_Idle );
 94   fOuterRadiusEmCalo->AvailableForStates(G4Sta <<  92   
 95                                                <<  93   fInnerRadiusHadCalo = new G4UIcmdWithADoubleAndUnit( "/mydet/inner_radius_hadCalo", this );
 96   fInnerRadiusHadCalo = new G4UIcmdWithADouble <<  94   fInnerRadiusHadCalo->SetParameterName( "choiceInnerRadiusHadCalo", true );
 97   fInnerRadiusHadCalo->SetParameterName("choic <<  95   fInnerRadiusHadCalo->SetGuidance( "Inner radius of the HAD Calo" );
 98   fInnerRadiusHadCalo->SetGuidance("Inner radi <<  96   fInnerRadiusHadCalo->SetDefaultValue( 700.0 );  // default: 70 cm.
 99   fInnerRadiusHadCalo->SetDefaultValue(700.0); <<  97   fInnerRadiusHadCalo->AvailableForStates( G4State_PreInit, G4State_Idle );
100   fInnerRadiusHadCalo->AvailableForStates(G4St <<  98 
101                                                <<  99   fOuterRadiusHadCalo = new G4UIcmdWithADoubleAndUnit( "/mydet/outer_radius_hadCalo", this );
102   fOuterRadiusHadCalo = new G4UIcmdWithADouble << 100   fOuterRadiusHadCalo->SetParameterName( "choiceOuterRadiusHadCalo", true );
103   fOuterRadiusHadCalo->SetParameterName("choic << 101   fOuterRadiusHadCalo->SetGuidance( "Outer radius of the HAD Calo" );
104   fOuterRadiusHadCalo->SetGuidance("Outer radi << 102   fOuterRadiusHadCalo->SetDefaultValue( 1700.0 );  // default: 170 cm.
105   fOuterRadiusHadCalo->SetDefaultValue(1700.0) << 103   fOuterRadiusHadCalo->AvailableForStates( G4State_PreInit, G4State_Idle );
106   fOuterRadiusHadCalo->AvailableForStates(G4St << 104   
107                                                << 105   fUpdateCommand = new G4UIcmdWithoutParameter( "/mydet/update", this);
108   fUpdateCommand = new G4UIcmdWithoutParameter << 106   fUpdateCommand->SetGuidance( "Update geometry." );
109   fUpdateCommand->SetGuidance("Update geometry << 107   fUpdateCommand->SetGuidance( "This command MUST be applied before \"beamOn\" " );
110   fUpdateCommand->SetGuidance("This command MU << 108   fUpdateCommand->SetGuidance( "if you changed geometrical value(s)." );
111   fUpdateCommand->SetGuidance("if you changed  << 109   fUpdateCommand->AvailableForStates( G4State_Idle ); 
112   fUpdateCommand->AvailableForStates(G4State_I << 
113 }                                                 110 }
114                                                   111 
115 //....oooOO0OOooo........oooOO0OOooo........oo    112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
116                                                   113 
117 DetectorMessenger::~DetectorMessenger()        << 114 DetectorMessenger::~DetectorMessenger() {
118 {                                              << 
119   delete fDetectorDir;                            115   delete fDetectorDir;
120   delete fMaterialTracker;                        116   delete fMaterialTracker;
121   delete fMaterialEmCalo;                         117   delete fMaterialEmCalo;
122   delete fMaterialHadCalo;                        118   delete fMaterialHadCalo;
123   delete fInnerRadiusTracker;                     119   delete fInnerRadiusTracker;
124   delete fOuterRadiusTracker;                     120   delete fOuterRadiusTracker;
125   delete fInnerRadiusEmCalo;                      121   delete fInnerRadiusEmCalo;
126   delete fOuterRadiusEmCalo;                      122   delete fOuterRadiusEmCalo;
127   delete fInnerRadiusHadCalo;                     123   delete fInnerRadiusHadCalo;
128   delete fOuterRadiusHadCalo;                     124   delete fOuterRadiusHadCalo;
129   delete fUpdateCommand;                          125   delete fUpdateCommand;
130 }                                                 126 }
131                                                   127 
132 //....oooOO0OOooo........oooOO0OOooo........oo    128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133                                                   129 
134 void DetectorMessenger::SetNewValue(G4UIcomman << 130 void DetectorMessenger::SetNewValue( G4UIcommand* command, G4String newValue ) {
135 {                                              << 131   if ( command == fMaterialTracker ) { 
136   if (command == fMaterialTracker) {           << 132     fDetector->SetMaterialTracker( newValue );
137     fDetector->SetMaterialTracker(newValue);   << 
138   }                                            << 
139   if (command == fMaterialEmCalo) {            << 
140     fDetector->SetMaterialEmCalo(newValue);    << 
141   }                                               133   }
142   if (command == fMaterialHadCalo) {           << 134   if ( command == fMaterialEmCalo ) { 
143     fDetector->SetMaterialHadCalo(newValue);   << 135     fDetector->SetMaterialEmCalo( newValue );
144   }                                               136   }
145   if (command == fInnerRadiusTracker) {        << 137   if ( command == fMaterialHadCalo ) { 
146     fDetector->SetInnerRadiusTracker(fInnerRad << 138     fDetector->SetMaterialHadCalo( newValue );
                                                   >> 139   }  
                                                   >> 140   if ( command == fInnerRadiusTracker ) {
                                                   >> 141     fDetector->SetInnerRadiusTracker( fInnerRadiusTracker->GetNewDoubleValue( newValue ) );
147   }                                               142   }
148   if (command == fOuterRadiusTracker) {        << 143   if ( command == fOuterRadiusTracker ) {
149     fDetector->SetOuterRadiusTracker(fOuterRad << 144     fDetector->SetOuterRadiusTracker( fOuterRadiusTracker->GetNewDoubleValue( newValue ) );
150   }                                               145   }
151   if (command == fInnerRadiusEmCalo) {         << 146   if ( command == fInnerRadiusEmCalo ) {
152     fDetector->SetInnerRadiusEmCalo(fInnerRadi << 147     fDetector->SetInnerRadiusEmCalo( fInnerRadiusEmCalo->GetNewDoubleValue( newValue ) );
153   }                                               148   }
154   if (command == fOuterRadiusEmCalo) {         << 149   if ( command == fOuterRadiusEmCalo ) {
155     fDetector->SetOuterRadiusEmCalo(fOuterRadi << 150     fDetector->SetOuterRadiusEmCalo( fOuterRadiusEmCalo->GetNewDoubleValue( newValue ) );
156   }                                               151   }
157   if (command == fInnerRadiusHadCalo) {        << 152   if ( command == fInnerRadiusHadCalo ) {
158     fDetector->SetInnerRadiusHadCalo(fInnerRad << 153     fDetector->SetInnerRadiusHadCalo( fInnerRadiusHadCalo->GetNewDoubleValue( newValue ) );
159   }                                               154   }
160   if (command == fOuterRadiusHadCalo) {        << 155   if ( command == fOuterRadiusHadCalo ) {
161     fDetector->SetOuterRadiusHadCalo(fOuterRad << 156     fDetector->SetOuterRadiusHadCalo( fOuterRadiusHadCalo->GetNewDoubleValue( newValue ) );
162   }                                               157   }
163   if (command == fUpdateCommand) {             << 158   if ( command == fUpdateCommand ) {
164     fDetector->UpdateGeometry();                  159     fDetector->UpdateGeometry();
165   }                                               160   }
166 }                                                 161 }
167                                                   162 
168 //....oooOO0OOooo........oooOO0OOooo........oo    163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
169                                                   164