Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:03

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 //////////////////////////////////////////////////////////////////////////////////////////////
0028 
0029 #include "FlashDetectorMessenger.hh"
0030 #include "FlashDetectorConstruction.hh"
0031 #include "G4UIdirectory.hh"
0032 #include "G4UIcmdWith3VectorAndUnit.hh"
0033 #include "G4UIcmdWithoutParameter.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIcmdWithADoubleAndUnit.hh"  
0036 
0037 /////////////////////////////////////////////////////////////////////////////
0038 FlashDetectorMessenger::FlashDetectorMessenger(FlashDetectorConstruction* detector)
0039   :flashDetector(detector)
0040 {
0041     // fChange Phantom size
0042     fChangeThePhantomDir = new G4UIdirectory("/fChangePhantom/");
0043     fChangeThePhantomDir -> SetGuidance("Command to fChange the Phantom Size/position");
0044 
0045      // fChange Phantom material 
0046     fChangeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this);
0047     fChangeThePhantomMaterialCmd -> SetGuidance("fChange the Phantom and the detector material"); 
0048     fChangeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false);
0049     fChangeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER");
0050     fChangeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle);
0051 
0052    
0053  
0054     // fChange Detector size
0055     fChangeTheDetectorDir = new G4UIdirectory("/changeDetector/");
0056     fChangeTheDetectorDir -> SetGuidance("Command to fChange the Detector Size");
0057 
0058 // fChange Detector material 
0059     fChangeTheDetectorMaterialCmd = new G4UIcmdWithAString("/changeDetector/material", this);
0060     fChangeTheDetectorMaterialCmd  -> SetGuidance("fChange the Phantom and the detector material"); 
0061     fChangeTheDetectorMaterialCmd  -> SetParameterName("PhantomMaterial", false);
0062    
0063     fChangeTheDetectorMaterialCmd  -> AvailableForStates(G4State_Idle);
0064 
0065     
0066 
0067     fUpdateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this);
0068     fUpdateCmd->SetGuidance("Update Phantom/Detector geometry.");
0069     fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0070     fUpdateCmd->SetGuidance("if you fChanged geometrical value(s).");
0071     fUpdateCmd->AvailableForStates(G4State_Idle);
0072 
0073     fUpdateCmd_d = new G4UIcmdWithoutParameter("/changeDetector/update",this);
0074     fUpdateCmd_d->SetGuidance("Update Detector geometry.");
0075     fUpdateCmd_d->SetGuidance("This command MUST be applied before \"beamOn\" ");
0076     fUpdateCmd_d->SetGuidance("if you fChanged geometrical value(s).");
0077     fUpdateCmd_d->AvailableForStates(G4State_Idle);
0078     
0079 
0080 
0081    }
0082 
0083 /////////////////////////////////////////////////////////////////////////////
0084 FlashDetectorMessenger::~FlashDetectorMessenger()
0085 {
0086 
0087 
0088   delete fChangeThePhantomDir;
0089     delete fChangeTheDetectorDir;
0090   
0091     delete fChangeThePhantomMaterialCmd;
0092     delete fChangeTheDetectorMaterialCmd; 
0093     
0094 }
0095 
0096 /////////////////////////////////////////////////////////////////////////////
0097 void FlashDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0098 {
0099     
0100  
0101   if (command == fChangeThePhantomMaterialCmd)
0102   {
0103       flashDetector -> SetPhantomMaterial(newValue);
0104   }
0105 
0106     else if (command == fChangeTheDetectorMaterialCmd)
0107   {
0108       flashDetector -> SetDetectorMaterial(newValue);
0109   }
0110   
0111   
0112   
0113 }