Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-03 07:52:56

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file DetectorMessenger.cc
0027 /// \brief Implementation of the DetectorMessenger class
0028 
0029 // -------------------------------------------------------------
0030 //      GEANT4  test  IBREM
0031 //
0032 // Authors: V.Grichine, V.Ivanchenko
0033 //
0034 // Modified:
0035 //
0036 // 18-02-03 V.Ivanchenko create
0037 //
0038 // -------------------------------------------------------------
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 #include "DetectorMessenger.hh"
0044 
0045 #include "DetectorConstruction.hh"
0046 
0047 #include "G4UIcmdWithABool.hh"
0048 #include "G4UIcmdWithADoubleAndUnit.hh"
0049 #include "G4UIcmdWithAString.hh"
0050 #include "G4UIcmdWithAnInteger.hh"
0051 #include "G4UIcmdWithoutParameter.hh"
0052 #include "G4UIdirectory.hh"
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 DetectorMessenger::DetectorMessenger(DetectorConstruction* h) : fDetector(h)
0057 {
0058   fDetDir = new G4UIdirectory("/testem/");
0059   fDetDir->SetGuidance("General  commands");
0060   fDetDir1 = new G4UIdirectory("/testem/physics/");
0061   fDetDir1->SetGuidance(" commands to define physics");
0062   fDetDir2 = new G4UIdirectory("/testem/gun/");
0063   fDetDir2->SetGuidance(" commands to define gun");
0064 
0065   fAbsMaterCmd = new G4UIcmdWithAString("/testem/target1Material", this);
0066   fAbsMaterCmd->SetGuidance("Select Material of the target1.");
0067   fAbsMaterCmd->SetParameterName("Material1", false);
0068   fAbsMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0069 
0070   fWorldMaterCmd = new G4UIcmdWithAString("/testem/target2Material", this);
0071   fWorldMaterCmd->SetGuidance("Select Material of the target2.");
0072   fWorldMaterCmd->SetParameterName("Material2", false);
0073   fWorldMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0074 
0075   fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/mylarZ", this);
0076   fAbsThickCmd->SetGuidance("Set mylarZ");
0077   fAbsThickCmd->SetParameterName("mylarZ", false);
0078   fAbsThickCmd->SetUnitCategory("Length");
0079   fAbsThickCmd->AvailableForStates(G4State_PreInit);
0080 
0081   fAbsGapCmd = new G4UIcmdWithADoubleAndUnit("/testem/delta", this);
0082   fAbsGapCmd->SetGuidance("Set gap between absorbers");
0083   fAbsGapCmd->SetParameterName("delta", false);
0084   fAbsGapCmd->SetUnitCategory("Length");
0085   fAbsGapCmd->AvailableForStates(G4State_PreInit);
0086 
0087   fAbsSizYZCmd = new G4UIcmdWithADoubleAndUnit("/testem/target1Z", this);
0088   fAbsSizYZCmd->SetGuidance("Set targeet1Z");
0089   fAbsSizYZCmd->SetParameterName("target1Z", false);
0090   fAbsSizYZCmd->SetUnitCategory("Length");
0091   fAbsSizYZCmd->AvailableForStates(G4State_PreInit);
0092 
0093   fWorldXCmd = new G4UIcmdWithADoubleAndUnit("/testem/target2Z", this);
0094   fWorldXCmd->SetGuidance("Set target2Z");
0095   fWorldXCmd->SetParameterName("target2Z", false);
0096   fWorldXCmd->SetUnitCategory("Length");
0097   fWorldXCmd->AvailableForStates(G4State_PreInit);
0098 
0099   fXMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/checkShiftZ", this);
0100   fXMagFieldCmd->SetGuidance("Define checkShftZ");
0101   fXMagFieldCmd->SetParameterName("CheckSZ", false);
0102   fXMagFieldCmd->SetUnitCategory("Length");
0103   fXMagFieldCmd->AvailableForStates(G4State_PreInit);
0104 
0105   fYMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdZ", this);
0106   fYMagFieldCmd->SetGuidance("Define sensitive detector Z");
0107   fYMagFieldCmd->SetParameterName("sdZ", false);
0108   fYMagFieldCmd->SetUnitCategory("Length");
0109   fYMagFieldCmd->AvailableForStates(G4State_PreInit);
0110 
0111   fZMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdShiftZ", this);
0112   fZMagFieldCmd->SetGuidance("Define shift of sensitive detector");
0113   fZMagFieldCmd->SetParameterName("sdShiftZ", false);
0114   fZMagFieldCmd->SetUnitCategory("Length");
0115   fZMagFieldCmd->AvailableForStates(G4State_PreInit);
0116 
0117   fNumOfAbsCmd = new G4UIcmdWithAnInteger("/testem/numberDivR", this);
0118   fNumOfAbsCmd->SetGuidance("Set number divisions R");
0119   fNumOfAbsCmd->SetParameterName("NR", false);
0120   fNumOfAbsCmd->AvailableForStates(G4State_PreInit);
0121 
0122   fNumOfEvt = new G4UIcmdWithAnInteger("/testem/numberDivZ", this);
0123   fNumOfEvt->SetGuidance("Set number of divisions Z");
0124   fNumOfEvt->SetParameterName("NZ", false);
0125   fNumOfEvt->AvailableForStates(G4State_PreInit);
0126 
0127   fVerbCmd = new G4UIcmdWithAnInteger("/testem/verbose", this);
0128   fVerbCmd->SetGuidance("Set verbose for ");
0129   fVerbCmd->SetParameterName("verb", false);
0130   fVerbCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0131 
0132   fIntCmd = new G4UIcmdWithAnInteger("/testem/numberDivE", this);
0133   fIntCmd->SetGuidance("Set number of divisions E");
0134   fIntCmd->SetParameterName("NZ", false);
0135   fIntCmd->AvailableForStates(G4State_PreInit);
0136 
0137   fDeltaECmd = new G4UIcmdWithADoubleAndUnit("/testem/maxEnergy", this);
0138   fDeltaECmd->SetGuidance("Define scale of secondary energy histogram");
0139   fDeltaECmd->SetParameterName("DeltaE", false);
0140   fDeltaECmd->SetUnitCategory("Energy");
0141   fDeltaECmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0142 }
0143 
0144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0145 
0146 DetectorMessenger::~DetectorMessenger()
0147 {
0148   delete fDetDir;
0149   delete fDetDir1;
0150   delete fDetDir2;
0151 
0152   delete fAbsMaterCmd;
0153   delete fAbsThickCmd;
0154   delete fAbsGapCmd;
0155   delete fAbsSizYZCmd;
0156   delete fWorldMaterCmd;
0157   delete fWorldXCmd;
0158   delete fXMagFieldCmd;
0159   delete fYMagFieldCmd;
0160   delete fZMagFieldCmd;
0161   delete fNumOfAbsCmd;
0162   delete fNumOfEvt;
0163   delete fVerbCmd;
0164   delete fIntCmd;
0165   delete fDeltaECmd;
0166 }
0167 
0168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0169 
0170 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0171 {
0172   if (command == fAbsMaterCmd) {
0173     fDetector->SetTarget1Material(newValue);
0174   }
0175 
0176   if (command == fWorldMaterCmd) {
0177     fDetector->SetTarget2Material(newValue);
0178   }
0179 
0180   if (command == fAbsThickCmd) {
0181     fDetector->SetMylarZ(fAbsThickCmd->GetNewDoubleValue(newValue));
0182   }
0183 
0184   if (command == fAbsGapCmd) {
0185     fDetector->SetGap(fAbsGapCmd->GetNewDoubleValue(newValue));
0186   }
0187 
0188   if (command == fAbsSizYZCmd) {
0189     fDetector->SetTarget1Z(fAbsSizYZCmd->GetNewDoubleValue(newValue));
0190   }
0191 
0192   if (command == fWorldXCmd) {
0193     fDetector->SetTarget2Z(fWorldXCmd->GetNewDoubleValue(newValue));
0194   }
0195 
0196   if (command == fXMagFieldCmd) {
0197     fDetector->SetCheckShiftZ(fXMagFieldCmd->GetNewDoubleValue(newValue));
0198   }
0199 
0200   if (command == fYMagFieldCmd) {
0201     G4double x = fYMagFieldCmd->GetNewDoubleValue(newValue);
0202     fDetector->SetAbsorberZ(x);
0203   }
0204 
0205   if (command == fZMagFieldCmd) {
0206     fDetector->SetAbsorberShiftZ(fZMagFieldCmd->GetNewDoubleValue(newValue));
0207   }
0208 
0209   if (command == fNumOfAbsCmd) {
0210     fDetector->SetNumberDivR(fNumOfAbsCmd->GetNewIntValue(newValue));
0211   }
0212 
0213   if (command == fNumOfEvt) {
0214     fDetector->SetNumberDivZ(fNumOfEvt->GetNewIntValue(newValue));
0215   }
0216 
0217   if (command == fIntCmd) {
0218     fDetector->SetNumberDivE(fIntCmd->GetNewIntValue(newValue));
0219   }
0220   if (command == fDeltaECmd) {
0221     fDetector->SetMaxEnergy(fDeltaECmd->GetNewDoubleValue(newValue));
0222   }
0223 
0224   if (command == fVerbCmd) {
0225     G4int ver = fVerbCmd->GetNewIntValue(newValue);
0226     fDetector->SetVerbose(ver);
0227   }
0228 }
0229 
0230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......