source: trunk/source/geometry/solids/test/OpticalEscape/src/AXPETPrimaryGeneratorMessenger.cc @ 1316

Last change on this file since 1316 was 1316, checked in by garnier, 14 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 3.2 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26// $Id: AXPETPrimaryGeneratorMessenger.cc,v 1.1 2008/09/03 13:34:03 gcosmo Exp $
27// ------------------------------------------------------------
28// Geant4 class implementation file
29//
30// 03/09/2008, by T.Nikitina
31// ------------------------------------------------------------
32
33#include "AXPETPrimaryGeneratorMessenger.hh"
34
35#include "AXPETPrimaryGeneratorAction.hh"
36#include "G4UIdirectory.hh"
37#include "G4UIcmdWithADoubleAndUnit.hh"
38
39AXPETPrimaryGeneratorMessenger::AXPETPrimaryGeneratorMessenger(
40                                          AXPETPrimaryGeneratorAction* AXPETGun)
41:AXPETAction(AXPETGun)
42{
43  gunDir = new G4UIdirectory("/AXPET/gun/");
44  gunDir->SetGuidance("PrimaryGenerator control");
45   
46  polarCmd = new G4UIcmdWithADoubleAndUnit("/AXPET/gun/optPhotonPolar",this);
47  polarCmd->SetGuidance("Set linear polarization");
48  polarCmd->SetGuidance("  angle w.r.t. (k,n) plane");
49  polarCmd->SetParameterName("angle",true);
50  polarCmd->SetUnitCategory("Angle"); 
51  polarCmd->SetDefaultValue(-360.0);
52  polarCmd->SetDefaultUnit("deg");
53  polarCmd->AvailableForStates(G4State_Idle);
54}
55
56AXPETPrimaryGeneratorMessenger::~AXPETPrimaryGeneratorMessenger()
57{
58  delete polarCmd;
59  delete gunDir;
60}
61
62void AXPETPrimaryGeneratorMessenger::SetNewValue(
63                                        G4UIcommand* command, G4String newValue)
64{ 
65  if( command == polarCmd ) {
66      G4double angle = polarCmd->GetNewDoubleValue(newValue);
67      if ( angle == -360.0*deg ) {
68         AXPETAction->SetOptPhotonPolar();
69      } else {
70         AXPETAction->SetOptPhotonPolar(angle);
71      }
72  }
73}
Note: See TracBrowser for help on using the repository browser.