Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file electromagnetic/TestEm2/src/Detector << 23 // $Id: DetectorMessenger.cc,v 1.7 2004/09/17 10:51:39 maire Exp $ 27 /// \brief Implementation of the DetectorMesse << 24 // GEANT4 tag $Name: geant4-07-01 $ 28 // << 29 // 25 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 28 33 #include "DetectorMessenger.hh" 29 #include "DetectorMessenger.hh" 34 30 35 #include "DetectorConstruction.hh" 31 #include "DetectorConstruction.hh" 36 << 32 #include "G4UIdirectory.hh" >> 33 #include "G4UIcmdWithAString.hh" 37 #include "G4UIcmdWith3Vector.hh" 34 #include "G4UIcmdWith3Vector.hh" 38 #include "G4UIcmdWithADoubleAndUnit.hh" 35 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithAString.hh" << 40 #include "G4UIcmdWithoutParameter.hh" 36 #include "G4UIcmdWithoutParameter.hh" 41 #include "G4UIdirectory.hh" << 42 37 43 //....oooOO0OOooo........oooOO0OOooo........oo 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 39 45 DetectorMessenger::DetectorMessenger(DetectorC << 40 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det) >> 41 :Detector(Det) 46 { 42 { 47 fTestemDir = new G4UIdirectory("/testem/"); << 43 testemDir = new G4UIdirectory("/testem/"); 48 fTestemDir->SetGuidance(" detector control." << 44 testemDir->SetGuidance(" detector control."); 49 << 45 50 fDetDir = new G4UIdirectory("/testem/det/"); << 46 detDir = new G4UIdirectory("/testem/det/"); 51 fDetDir->SetGuidance("detector construction << 47 detDir->SetGuidance("detector construction commands"); 52 << 48 53 fMaterCmd = new G4UIcmdWithAString("/testem/ << 49 MaterCmd = new G4UIcmdWithAString("/testem/det/setMat",this); 54 fMaterCmd->SetGuidance("Select Material."); << 50 MaterCmd->SetGuidance("Select Material."); 55 fMaterCmd->SetParameterName("material", fals << 51 MaterCmd->SetParameterName("material",false); 56 fMaterCmd->AvailableForStates(G4State_PreIni << 52 MaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 57 fMaterCmd->SetToBeBroadcasted(false); << 53 58 << 54 LBinCmd = new G4UIcmdWith3Vector("/testem/det/setLbin",this); 59 fLBinCmd = new G4UIcmdWith3Vector("/testem/d << 55 LBinCmd->SetGuidance("set longitudinal bining"); 60 fLBinCmd->SetGuidance("set longitudinal bini << 56 LBinCmd->SetGuidance("nb of bins; bin thickness (in radl)"); 61 fLBinCmd->SetGuidance("nb of bins; bin thick << 57 LBinCmd->SetParameterName("nLtot","dLradl"," ",true); 62 fLBinCmd->SetParameterName("nLtot", "dLradl" << 58 LBinCmd->SetRange("nLtot>=1 && dLradl>0"); 63 fLBinCmd->SetRange("nLtot>=1 && dLradl>0"); << 59 LBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 64 fLBinCmd->AvailableForStates(G4State_PreInit << 60 65 fLBinCmd->SetToBeBroadcasted(false); << 61 RBinCmd = new G4UIcmdWith3Vector("/testem/det/setRbin",this); 66 << 62 RBinCmd->SetGuidance("set radial bining"); 67 fRBinCmd = new G4UIcmdWith3Vector("/testem/d << 63 RBinCmd->SetGuidance("nb of bins; bin thickness (in radl)"); 68 fRBinCmd->SetGuidance("set radial bining"); << 64 RBinCmd->SetParameterName("nRtot","dRradl"," ",true); 69 fRBinCmd->SetGuidance("nb of bins; bin thick << 65 RBinCmd->SetRange("nRtot>=1 && dRradl>0"); 70 fRBinCmd->SetParameterName("nRtot", "dRradl" << 66 RBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 71 fRBinCmd->SetRange("nRtot>=1 && dRradl>0"); << 67 72 fRBinCmd->AvailableForStates(G4State_PreInit << 68 FieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setField",this); 73 fRBinCmd->SetToBeBroadcasted(false); << 69 FieldCmd->SetGuidance("Define magnetic field."); >> 70 FieldCmd->SetGuidance("Magnetic field will be in Z direction."); >> 71 FieldCmd->SetParameterName("Bz",false); >> 72 FieldCmd->SetUnitCategory("Magnetic flux density"); >> 73 FieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle); >> 74 >> 75 UpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this); >> 76 UpdateCmd->SetGuidance("Update geometry."); >> 77 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); >> 78 UpdateCmd->SetGuidance("if you changed geometrical value(s)."); >> 79 UpdateCmd->AvailableForStates(G4State_Idle); 74 } 80 } 75 81 76 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 83 78 DetectorMessenger::~DetectorMessenger() 84 DetectorMessenger::~DetectorMessenger() 79 { 85 { 80 delete fMaterCmd; << 86 delete MaterCmd; 81 delete fLBinCmd; << 87 delete LBinCmd; 82 delete fRBinCmd; << 88 delete RBinCmd; 83 delete fDetDir; << 89 delete FieldCmd; 84 delete fTestemDir; << 90 delete UpdateCmd; >> 91 delete detDir; >> 92 delete testemDir; 85 } 93 } 86 94 87 //....oooOO0OOooo........oooOO0OOooo........oo 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 88 96 89 void DetectorMessenger::SetNewValue(G4UIcomman 97 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue) 90 { << 98 { 91 if (command == fMaterCmd) { << 99 if( command == MaterCmd ) 92 fDetector->SetMaterial(newValue); << 100 { Detector->SetMaterial(newValue);} 93 } << 101 94 << 102 if( command == LBinCmd ) 95 if (command == fLBinCmd) { << 103 { Detector->SetLBining(LBinCmd->GetNew3VectorValue(newValue));} 96 fDetector->SetLBining(fLBinCmd->GetNew3Vec << 104 97 } << 105 if( command == RBinCmd ) 98 << 106 { Detector->SetRBining(RBinCmd->GetNew3VectorValue(newValue));} 99 if (command == fRBinCmd) { << 107 100 fDetector->SetRBining(fRBinCmd->GetNew3Vec << 108 if( command == FieldCmd ) 101 } << 109 { Detector->SetMagField(FieldCmd->GetNewDoubleValue(newValue));} >> 110 >> 111 if( command == UpdateCmd ) >> 112 { Detector->UpdateGeometry();} 102 } 113 } 103 114 104 //....oooOO0OOooo........oooOO0OOooo........oo 115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 105 116