Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-28 07:51:05

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 ExGflashMessenger.cc
0027 /// \brief Implementation of the ExGflashMessenger class
0028 
0029 #include "ExGflashMessenger.hh"
0030 
0031 #include "ExGflashDetectorConstruction.hh"
0032 
0033 #include "G4UIcmdWith3Vector.hh"
0034 #include "G4UIcmdWithADoubleAndUnit.hh"
0035 #include "G4UIcmdWithAString.hh"
0036 #include "G4UIcmdWithAnInteger.hh"
0037 #include "G4UIcmdWithoutParameter.hh"
0038 #include "G4UIdirectory.hh"
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 ExGflashMessenger::ExGflashMessenger(ExGflashDetectorConstruction* Det) : fDetector(Det)
0043 {
0044   fExGflashDir = new G4UIdirectory("/exgflash/");
0045   fExGflashDir->SetGuidance(" Gflash example commands.");
0046 
0047   fVerbose = new G4UIcmdWithAnInteger("/exgflash/verbose", this);
0048   fVerbose->SetGuidance("set exglash verbosity");
0049   fVerbose->SetGuidance("0- silent, 1 - init, 2 - run, 3 - event");
0050   fVerbose->SetParameterName("ver", false);
0051   fVerbose->SetRange("ver >= 0");
0052   fVerbose->AvailableForStates(G4State_PreInit, G4State_Idle);
0053   fVerbose->SetToBeBroadcasted(false);
0054 
0055   fDetDir = new G4UIdirectory("/exgflash/det/");
0056   fDetDir->SetGuidance("detector construction commands");
0057 
0058   fLBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setLbin", this);
0059   fLBinCmd->SetGuidance("set longitudinal bining");
0060   fLBinCmd->SetGuidance("nLtot  - nb of bins; bin thickness (in Radl)");
0061   fLBinCmd->SetGuidance("dLradl - bin thickness (in fraction of Radl)");
0062   fLBinCmd->SetGuidance("LStart - dummy");
0063   fLBinCmd->SetParameterName("nLtot", "dLradl", "LStart", true);
0064   fLBinCmd->SetDefaultValue(G4ThreeVector{100.0, 0.25, 0.0});
0065   fLBinCmd->SetRange("nLtot>=1 && dLradl>0");
0066   fLBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0067   fLBinCmd->SetToBeBroadcasted(false);
0068 
0069   fRBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setRbin", this);
0070   fRBinCmd->SetGuidance("set radial bining");
0071   fRBinCmd->SetGuidance("nRtot  - nb of bins; bin thickness (in Rm)");
0072   fRBinCmd->SetGuidance("dRradl - bin thickness (in fraction of Rm)");
0073   fRBinCmd->SetGuidance("RStart - dummy");
0074   fRBinCmd->SetParameterName("nRtot", "dRradl", "RStart", true);
0075   fRBinCmd->SetDefaultValue(G4ThreeVector{80.0, 0.05, 0.0});
0076   fRBinCmd->SetRange("nRtot>=1 && dRradl>0");
0077   fRBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0078   fRBinCmd->SetToBeBroadcasted(false);
0079 
0080   fMaterCmd = new G4UIcmdWithAString("/exgflash/det/setMat", this);
0081   fMaterCmd->SetGuidance("Select Material.");
0082   fMaterCmd->SetParameterName("material", false);
0083   fMaterCmd->AvailableForStates(G4State_PreInit);
0084   fMaterCmd->SetToBeBroadcasted(false);
0085 
0086   fNbCrysCmd = new G4UIcmdWithAnInteger("/exgflash/det/setNbCrys", this);
0087   fNbCrysCmd->SetGuidance("set numbber of crystals in row/col");
0088   fNbCrysCmd->SetGuidance("ncrys  - number of crystals ");
0089   fNbCrysCmd->SetParameterName("ncrys", false);
0090   fNbCrysCmd->SetRange("ncrys > 0");
0091   fNbCrysCmd->AvailableForStates(G4State_PreInit);
0092   fNbCrysCmd->SetToBeBroadcasted(false);
0093 
0094   fWCrysCmd = new G4UIcmdWithADoubleAndUnit("/exgflash/det/setCrysWidth", this);
0095   fWCrysCmd->SetGuidance("set crystal width (cm)");
0096   fWCrysCmd->SetGuidance("wcrys  - width of crystal ");
0097   fWCrysCmd->SetParameterName("wcrys", false);
0098   fWCrysCmd->SetRange("wcrys > 0");
0099   fWCrysCmd->SetUnitCategory("Length");
0100   fWCrysCmd->SetDefaultUnit("cm");
0101   fWCrysCmd->AvailableForStates(G4State_PreInit);
0102   fWCrysCmd->SetToBeBroadcasted(false);
0103 
0104   fLCrysCmd = new G4UIcmdWithADoubleAndUnit("/exgflash/det/setCrysLength", this);
0105   fLCrysCmd->SetGuidance("set crystal length (cm)");
0106   fLCrysCmd->SetGuidance("lcrys  - crystal length ");
0107   fLCrysCmd->SetParameterName("lcrys", false);
0108   fLCrysCmd->SetRange("lcrys > 0");
0109   fLCrysCmd->SetUnitCategory("Length");
0110   fLCrysCmd->SetDefaultUnit("cm");
0111   fLCrysCmd->AvailableForStates(G4State_PreInit);
0112   fLCrysCmd->SetToBeBroadcasted(false);
0113 }
0114 
0115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0116 
0117 ExGflashMessenger::~ExGflashMessenger()
0118 {
0119   delete fLCrysCmd;
0120   delete fWCrysCmd;
0121   delete fNbCrysCmd;
0122   delete fMaterCmd;
0123   delete fRBinCmd;
0124   delete fLBinCmd;
0125   delete fDetDir;
0126   delete fVerbose;
0127   delete fExGflashDir;
0128 }
0129 
0130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0131 
0132 void ExGflashMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0133 {
0134   if (command == fMaterCmd) {
0135     fDetector->SetMaterial(newValue);
0136   }
0137 
0138   if (command == fNbCrysCmd) {
0139     fDetector->SetNbOfCrystals(fNbCrysCmd->GetNewIntValue(newValue));
0140   }
0141 
0142   if (command == fWCrysCmd) {
0143     fDetector->SetCrystalWidth(fWCrysCmd->GetNewDoubleValue(newValue));
0144   }
0145 
0146   if (command == fLCrysCmd) {
0147     fDetector->SetCrystalLength(fLCrysCmd->GetNewDoubleValue(newValue));
0148   }
0149 
0150   if (command == fVerbose) {
0151     fDetector->SetVerbose(fVerbose->GetNewIntValue(newValue));
0152   }
0153 
0154   if (command == fLBinCmd) {
0155     fDetector->SetLBining(fLBinCmd->GetNew3VectorValue(newValue));
0156   }
0157 
0158   if (command == fRBinCmd) {
0159     fDetector->SetRBining(fRBinCmd->GetNew3VectorValue(newValue));
0160   }
0161 }
0162 
0163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......