source: trunk/examples/advanced/Rich/src/RichTbPrimaryGeneratorMessenger.cc@ 1313

Last change on this file since 1313 was 807, checked in by garnier, 17 years ago

update

File size: 4.1 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// Rich advanced example for Geant4
27// RichTbPrimaryGeneratorMessenger.cc for Rich of LHCb
28// History:
29// Created: Patricia Mendez (Patricia.Mendez@cern.ch)
30/////////////////////////////////////////////////////////////////////////////
31#include "RichTbPrimaryGeneratorMessenger.hh"
32
33#include "RichTbPrimaryGeneratorAction.hh"
34#include "G4UIcmdWithAString.hh"
35#include "G4UIcmdWithADoubleAndUnit.hh"
36
37//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
38
39RichTbPrimaryGeneratorMessenger::RichTbPrimaryGeneratorMessenger(RichTbPrimaryGeneratorAction* RichTbGun)
40:RichTbAction(RichTbGun)
41{
42 RndmCmd = new G4UIcmdWithAString("/gun/random",this);
43 RndmCmd->SetGuidance("Shoot randomly the incident particle.");
44 RndmCmd->SetGuidance(" Choice : on, off(default)");
45 RndmCmd->SetParameterName("choice",true);
46 RndmCmd->SetDefaultValue("off");
47 RndmCmd->SetCandidates("on off");
48 RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
49
50 setxvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
51 setxvertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
52 setxvertexCmd->SetParameterName("xv",true);
53 setxvertexCmd->SetDefaultValue(0.0*mm) ;
54
55 setyvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
56 setyvertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
57 setyvertexCmd->SetParameterName("yv",true);
58 setyvertexCmd->SetDefaultValue(0.0*mm) ;
59
60 setzvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
61 setzvertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
62 setzvertexCmd->SetParameterName("zv",true);
63 setzvertexCmd->SetDefaultValue(0.0*mm) ;
64
65}
66
67//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
68
69RichTbPrimaryGeneratorMessenger::~RichTbPrimaryGeneratorMessenger()
70{
71 delete RndmCmd;
72 delete setxvertexCmd;
73 delete setyvertexCmd;
74 delete setzvertexCmd;
75}
76
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
78
79void RichTbPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
80{
81 if( command == RndmCmd )
82 { RichTbAction->SetRndmFlag(newValue);}
83 if( command == setxvertexCmd)
84 { RichTbAction->Setxvertex(setxvertexCmd->GetNewDoubleValue(newValue));}
85 if( command == setyvertexCmd)
86 { RichTbAction->Setyvertex(setyvertexCmd->GetNewDoubleValue(newValue));}
87 if( command == setzvertexCmd)
88 { RichTbAction->Setzvertex(setzvertexCmd->GetNewDoubleValue(newValue));}
89}
90
91//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
92
Note: See TracBrowser for help on using the repository browser.