Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-29 08:01:35

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