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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/TestEm9/src/DetectorMessenger.cc (Version 11.3.0) and /examples/extended/electromagnetic/TestEm9/src/DetectorMessenger.cc (Version 9.6.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/TestEm9/src/Detector     26 /// \file electromagnetic/TestEm9/src/DetectorMessenger.cc
 27 /// \brief Implementation of the DetectorMesse     27 /// \brief Implementation of the DetectorMessenger class
 28 //                                                 28 //
 29 //                                                 29 //
                                                   >>  30 // $Id$
                                                   >>  31 //
 30 //                                                 32 //
 31 //////////////////////////////////////////////     33 /////////////////////////////////////////////////////////////////////////
 32 //                                                 34 //
 33 // TestEm9: Crystal calorimeter                    35 // TestEm9: Crystal calorimeter
 34 //                                                 36 //
 35 // Created: 31.01.03 V.Ivanchenko                  37 // Created: 31.01.03 V.Ivanchenko
 36 //                                                 38 //
 37 // Modified:                                       39 // Modified:
 38 //                                                 40 //
 39 //////////////////////////////////////////////     41 ////////////////////////////////////////////////////////////////////////
 40 //                                                 42 //
 41                                                    43 
 42 //....oooOO0OOooo........oooOO0OOooo........oo     44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 43 //....oooOO0OOooo........oooOO0OOooo........oo     45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 44                                                    46 
 45 #include "DetectorMessenger.hh"                    47 #include "DetectorMessenger.hh"
 46                                                    48 
 47 #include "DetectorConstruction.hh"                 49 #include "DetectorConstruction.hh"
 48 #include "HistoManager.hh"                     <<  50 #include "G4UIdirectory.hh"
 49                                                <<  51 #include "G4UIcmdWithAString.hh"
 50 #include "G4UIcmdWith3Vector.hh"                   52 #include "G4UIcmdWith3Vector.hh"
 51 #include "G4UIcmdWithADoubleAndUnit.hh"            53 #include "G4UIcmdWithADoubleAndUnit.hh"
 52 #include "G4UIcmdWithAString.hh"               << 
 53 #include "G4UIcmdWithoutParameter.hh"              54 #include "G4UIcmdWithoutParameter.hh"
 54 #include "G4UIdirectory.hh"                    <<  55 #include "HistoManager.hh"
 55                                                    56 
 56 //....oooOO0OOooo........oooOO0OOooo........oo     57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 57                                                    58 
 58 DetectorMessenger::DetectorMessenger(DetectorC <<  59 DetectorMessenger::DetectorMessenger(DetectorConstruction * det)
 59   : G4UImessenger(),                           <<  60   :fDetector(det)
 60     fDetector(det),                            << 
 61     fAtestemDir(0),                            << 
 62     fAMaterCmd(0),                             << 
 63     fALBinCmd(0),                              << 
 64     fAl1Cmd(0),                                << 
 65     fAl2Cmd(0),                                << 
 66     fAl3Cmd(0),                                << 
 67     fAl4Cmd(0),                                << 
 68     fAl5Cmd(0),                                << 
 69     fAl6Cmd(0),                                << 
 70     fAUpdateCmd(0),                            << 
 71     fAaccCmd1(0),                              << 
 72     fAaccCmd2(0),                              << 
 73     fAaccCmd3(0)                               << 
 74 {                                                  61 {
 75   fAtestemDir = new G4UIdirectory("/testem/");     62   fAtestemDir = new G4UIdirectory("/testem/");
 76   fAtestemDir->SetGuidance(" detector control.     63   fAtestemDir->SetGuidance(" detector control.");
 77                                                    64 
 78   fAMaterCmd = new G4UIcmdWithAString("/testem <<  65   fAMaterCmd = new G4UIcmdWithAString("/testem/det/CalMat",this);
 79   fAMaterCmd->SetGuidance("Select Material for     66   fAMaterCmd->SetGuidance("Select Material for calorimeter");
 80   fAMaterCmd->SetParameterName("calMaterial",  <<  67   fAMaterCmd->SetParameterName("calMaterial",false);
 81   fAMaterCmd->AvailableForStates(G4State_PreIn <<  68   fAMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 82                                                    69 
 83   fALBinCmd = new G4UIcmdWithAString("/testem/ <<  70   fALBinCmd = new G4UIcmdWithAString("/testem/det/AbsMat",this);
 84   fALBinCmd->SetGuidance("Select Material for      71   fALBinCmd->SetGuidance("Select Material for absorber");
 85   fALBinCmd->SetParameterName("absMarerial", f <<  72   fALBinCmd->SetParameterName("absMarerial",false);
 86   fALBinCmd->AvailableForStates(G4State_PreIni <<  73   fALBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 87                                                    74 
 88   fAl1Cmd = new G4UIcmdWithADoubleAndUnit("/te <<  75   fAl1Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/EcalLength",this);
 89   fAl1Cmd->SetGuidance("Set length of Ecal");      76   fAl1Cmd->SetGuidance("Set length of Ecal");
 90   fAl1Cmd->SetParameterName("lEcal", false);   <<  77   fAl1Cmd->SetParameterName("lEcal",false);
 91   fAl1Cmd->SetUnitCategory("Length");              78   fAl1Cmd->SetUnitCategory("Length");
 92   fAl1Cmd->SetRange("lEcal>0");                    79   fAl1Cmd->SetRange("lEcal>0");
 93   fAl1Cmd->AvailableForStates(G4State_PreInit, <<  80   fAl1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 94                                                    81 
 95   fAl2Cmd = new G4UIcmdWithADoubleAndUnit("/te <<  82   fAl2Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/EcalWidth",this);
 96   fAl2Cmd->SetGuidance("Set width of Ecal crys     83   fAl2Cmd->SetGuidance("Set width of Ecal crystal");
 97   fAl2Cmd->SetParameterName("wEcal", false);   <<  84   fAl2Cmd->SetParameterName("wEcal",false);
 98   fAl2Cmd->SetUnitCategory("Length");              85   fAl2Cmd->SetUnitCategory("Length");
 99   fAl2Cmd->AvailableForStates(G4State_PreInit, <<  86   fAl2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
100                                                    87 
101   fAl3Cmd = new G4UIcmdWithADoubleAndUnit("/te <<  88   fAl3Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/AbsLength",this);
102   fAl3Cmd->SetGuidance("Set length of the abso     89   fAl3Cmd->SetGuidance("Set length of the absorber");
103   fAl3Cmd->SetParameterName("lAbs", false);    <<  90   fAl3Cmd->SetParameterName("lAbs",false);
104   fAl3Cmd->SetUnitCategory("Length");              91   fAl3Cmd->SetUnitCategory("Length");
105   fAl3Cmd->AvailableForStates(G4State_PreInit, <<  92   fAl3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
106                                                    93 
107   fAl4Cmd = new G4UIcmdWithADoubleAndUnit("/te <<  94   fAl4Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/VertexLength",this);
108   fAl4Cmd->SetGuidance("Set length of the vert     95   fAl4Cmd->SetGuidance("Set length of the vertex region");
109   fAl4Cmd->SetParameterName("lVert", false);   <<  96   fAl4Cmd->SetParameterName("lVert",false);
110   fAl4Cmd->SetUnitCategory("Length");              97   fAl4Cmd->SetUnitCategory("Length");
111   fAl4Cmd->AvailableForStates(G4State_PreInit, <<  98   fAl4Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
112                                                    99 
113   fAl5Cmd = new G4UIcmdWithADoubleAndUnit("/te << 100   fAl5Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/PadLength",this);
114   fAl5Cmd->SetGuidance("Set length of vertex d    101   fAl5Cmd->SetGuidance("Set length of vertex detector");
115   fAl5Cmd->SetParameterName("lPad", false);    << 102   fAl5Cmd->SetParameterName("lPad",false);
116   fAl5Cmd->SetUnitCategory("Length");             103   fAl5Cmd->SetUnitCategory("Length");
117   fAl5Cmd->AvailableForStates(G4State_PreInit, << 104   fAl5Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
118                                                   105 
119   fAl6Cmd = new G4UIcmdWithADoubleAndUnit("/te << 106   fAl6Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/PadWidth",this);
120   fAl6Cmd->SetGuidance("Set width of a vertex     107   fAl6Cmd->SetGuidance("Set width of a vertex pad");
121   fAl6Cmd->SetParameterName("wPad", false);    << 108   fAl6Cmd->SetParameterName("wPad",false);
122   fAl6Cmd->SetUnitCategory("Length");             109   fAl6Cmd->SetUnitCategory("Length");
123   fAl6Cmd->AvailableForStates(G4State_PreInit, << 110   fAl6Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
124                                                   111 
125   fAUpdateCmd = new G4UIcmdWithoutParameter("/ << 112   fAUpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this);
126   fAUpdateCmd->SetGuidance("Update geometry.")    113   fAUpdateCmd->SetGuidance("Update geometry.");
127   fAUpdateCmd->SetGuidance("This command MUST     114   fAUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
128   fAUpdateCmd->SetGuidance("if you changed geo    115   fAUpdateCmd->SetGuidance("if you changed geometrical value(s)");
129   fAUpdateCmd->AvailableForStates(G4State_PreI << 116   fAUpdateCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
130                                                   117 
131   fAaccCmd1 = new G4UIcmdWith3Vector("/testem/ << 118   fAaccCmd1 = new G4UIcmdWith3Vector("/testem/det/acceptance1",this);
132   fAaccCmd1->SetGuidance("set Edep and RMS");     119   fAaccCmd1->SetGuidance("set Edep and RMS");
133   fAaccCmd1->SetGuidance("acceptance values fo    120   fAaccCmd1->SetGuidance("acceptance values for central cell");
134   fAaccCmd1->SetParameterName("edep", "rms", " << 121   fAaccCmd1->SetParameterName("edep","rms","limit",true);
135   fAaccCmd1->SetRange("edep>0 && edep<1 && rms    122   fAaccCmd1->SetRange("edep>0 && edep<1 && rms>0");
136   fAaccCmd1->AvailableForStates(G4State_PreIni << 123   fAaccCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
137                                                   124 
138   fAaccCmd2 = new G4UIcmdWith3Vector("/testem/ << 125   fAaccCmd2 = new G4UIcmdWith3Vector("/testem/det/acceptance9",this);
139   fAaccCmd2->SetGuidance("set Edep and RMS");     126   fAaccCmd2->SetGuidance("set Edep and RMS");
140   fAaccCmd2->SetGuidance("acceptance values fo    127   fAaccCmd2->SetGuidance("acceptance values for 3x3 matrix");
141   fAaccCmd2->SetParameterName("edep", "rms", " << 128   fAaccCmd2->SetParameterName("edep","rms","limit",true);
142   fAaccCmd2->SetRange("edep>0 && edep<1 && rms    129   fAaccCmd2->SetRange("edep>0 && edep<1 && rms>0");
143   fAaccCmd2->AvailableForStates(G4State_PreIni << 130   fAaccCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
144                                                   131 
145   fAaccCmd3 = new G4UIcmdWith3Vector("/testem/ << 132   fAaccCmd3 = new G4UIcmdWith3Vector("/testem/det/acceptance25",this);
146   fAaccCmd3->SetGuidance("set Edep and RMS");     133   fAaccCmd3->SetGuidance("set Edep and RMS");
147   fAaccCmd3->SetGuidance("acceptance values fo    134   fAaccCmd3->SetGuidance("acceptance values for 5x5 matrix");
148   fAaccCmd3->SetParameterName("edep", "rms", " << 135   fAaccCmd3->SetParameterName("edep","rms","limit",true);
149   fAaccCmd3->SetRange("edep>0 && edep<1 && rms    136   fAaccCmd3->SetRange("edep>0 && edep<1 && rms>0");
150   fAaccCmd3->AvailableForStates(G4State_PreIni << 137   fAaccCmd3->AvailableForStates(G4State_PreInit,G4State_Idle);
                                                   >> 138 
151 }                                                 139 }
152                                                   140 
153 //....oooOO0OOooo........oooOO0OOooo........oo    141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
154                                                   142 
155 DetectorMessenger::~DetectorMessenger()           143 DetectorMessenger::~DetectorMessenger()
156 {                                                 144 {
157   delete fAMaterCmd;                              145   delete fAMaterCmd;
158   delete fALBinCmd;                               146   delete fALBinCmd;
159   delete fAl1Cmd;                                 147   delete fAl1Cmd;
160   delete fAl2Cmd;                                 148   delete fAl2Cmd;
161   delete fAl3Cmd;                                 149   delete fAl3Cmd;
162   delete fAl4Cmd;                                 150   delete fAl4Cmd;
163   delete fAl5Cmd;                                 151   delete fAl5Cmd;
164   delete fAl6Cmd;                                 152   delete fAl6Cmd;
165   delete fAUpdateCmd;                             153   delete fAUpdateCmd;
166   delete fAtestemDir;                             154   delete fAtestemDir;
167   delete fAaccCmd1;                               155   delete fAaccCmd1;
168   delete fAaccCmd2;                               156   delete fAaccCmd2;
169   delete fAaccCmd3;                               157   delete fAaccCmd3;
170 }                                                 158 }
171                                                   159 
172 //....oooOO0OOooo........oooOO0OOooo........oo    160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
173                                                   161 
174 void DetectorMessenger::SetNewValue(G4UIcomman << 162 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
175 {                                                 163 {
176   if (command == fAMaterCmd) {                 << 164   if( command == fAMaterCmd )
177     fDetector->SetEcalMaterial(newValue);      << 165    { fDetector->SetEcalMaterial(newValue);}
178   }                                            << 166 
179                                                << 167   if( command == fALBinCmd )
180   if (command == fALBinCmd) {                  << 168    { fDetector->SetAbsMaterial(newValue);}
181     fDetector->SetAbsMaterial(newValue);       << 169 
182   }                                            << 170   if( command == fAl1Cmd )
183                                                << 171    { fDetector->SetEcalLength(fAl1Cmd->GetNewDoubleValue(newValue));}
184   if (command == fAl1Cmd) {                    << 172 
185     fDetector->SetEcalLength(fAl1Cmd->GetNewDo << 173   if( command == fAl2Cmd )
186   }                                            << 174    { fDetector->SetEcalWidth(fAl2Cmd->GetNewDoubleValue(newValue));}
187                                                << 175 
188   if (command == fAl2Cmd) {                    << 176   if( command == fAl3Cmd )
189     fDetector->SetEcalWidth(fAl2Cmd->GetNewDou << 177    { fDetector->SetAbsLength(fAl3Cmd->GetNewDoubleValue(newValue));}
190   }                                            << 178 
191                                                << 179   if( command == fAl4Cmd )
192   if (command == fAl3Cmd) {                    << 180    { fDetector->SetVertexLength(fAl4Cmd->GetNewDoubleValue(newValue));}
193     fDetector->SetAbsLength(fAl3Cmd->GetNewDou << 181 
194   }                                            << 182   if( command == fAl5Cmd )
195                                                << 183    { fDetector->SetPadLength(fAl5Cmd->GetNewDoubleValue(newValue));}
196   if (command == fAl4Cmd) {                    << 184 
197     fDetector->SetVertexLength(fAl4Cmd->GetNew << 185   if( command == fAl6Cmd )
198   }                                            << 186    { fDetector->SetPadWidth(fAl6Cmd->GetNewDoubleValue(newValue));}
199                                                << 187 
200   if (command == fAl5Cmd) {                    << 188   if( command == fAUpdateCmd )
201     fDetector->SetPadLength(fAl5Cmd->GetNewDou << 189    { fDetector->UpdateGeometry();}
202   }                                            << 
203                                                << 
204   if (command == fAl6Cmd) {                    << 
205     fDetector->SetPadWidth(fAl6Cmd->GetNewDoub << 
206   }                                            << 
207                                                << 
208   if (command == fAUpdateCmd) {                << 
209     fDetector->UpdateGeometry();               << 
210   }                                            << 
211                                                   190 
212   HistoManager* histo = HistoManager::GetPoint    191   HistoManager* histo = HistoManager::GetPointer();
213   if (command == fAaccCmd1) {                  << 192   if( command == fAaccCmd1 )
214     histo->SetEdepAndRMS(0, fAaccCmd1->GetNew3 << 193    { histo->SetEdepAndRMS(0,fAaccCmd1->GetNew3VectorValue(newValue));}
215   }                                            << 194 
216                                                << 195   if( command == fAaccCmd2 )
217   if (command == fAaccCmd2) {                  << 196    { histo->SetEdepAndRMS(1,fAaccCmd2->GetNew3VectorValue(newValue));}
218     histo->SetEdepAndRMS(1, fAaccCmd2->GetNew3 << 197 
219   }                                            << 198   if( command == fAaccCmd3 )
220                                                << 199    { histo->SetEdepAndRMS(2,fAaccCmd3->GetNew3VectorValue(newValue));}
221   if (command == fAaccCmd3) {                  << 200 
222     histo->SetEdepAndRMS(2, fAaccCmd3->GetNew3 << 201 
223   }                                            << 
224 }                                                 202 }
225                                                   203 
226 //....oooOO0OOooo........oooOO0OOooo........oo    204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 205 
227                                                   206