source: trunk/examples/extended/eventgenerator/HepMC/HepMCEx01/src/HepMCG4AsciiReaderMessenger.cc @ 1358

Last change on this file since 1358 was 807, checked in by garnier, 16 years ago

update

File size: 4.0 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// ====================================================================
27//
28//   HepMCG4AsciiReaderMessenger.cc
29//   $Id: HepMCG4AsciiReaderMessenger.cc,v 1.3 2006/06/29 17:06:39 gunter Exp $
30//
31// ====================================================================
32#include "HepMCG4AsciiReaderMessenger.hh"
33#include "HepMCG4AsciiReader.hh"
34
35#include "G4UIdirectory.hh"
36#include "G4UIcmdWithoutParameter.hh"
37#include "G4UIcmdWithAString.hh"
38#include "G4UIcmdWithAnInteger.hh"
39
40////////////////////////////////////////////////////////
41HepMCG4AsciiReaderMessenger::HepMCG4AsciiReaderMessenger
42                             (HepMCG4AsciiReader* agen)
43  : gen(agen)
44////////////////////////////////////////////////////////
45{
46  dir= new G4UIdirectory("/generator/hepmcAscii/");
47  dir-> SetGuidance("Reading HepMC event from an Ascii file");
48
49  verbose= 
50    new G4UIcmdWithAnInteger("/generator/hepmcAscii/verbose", this);
51  verbose-> SetGuidance("Set verbose level");
52  verbose-> SetParameterName("verboseLevel", false, false);
53  verbose-> SetRange("verboseLevel>=0 && verboseLevel<=1");
54
55  open= new G4UIcmdWithAString("/generator/hepmcAscii/open", this);
56  open-> SetGuidance("(re)open data file (HepMC Ascii format)");
57  open-> SetParameterName("input ascii file", true, true); 
58}
59
60///////////////////////////////////////////////////////////
61HepMCG4AsciiReaderMessenger::~HepMCG4AsciiReaderMessenger()
62///////////////////////////////////////////////////////////
63{
64  delete verbose;
65  delete open;
66
67  delete dir;
68}
69
70///////////////////////////////////////////////////////////////////
71void HepMCG4AsciiReaderMessenger::SetNewValue(G4UIcommand* command,
72                                              G4String newValues)
73///////////////////////////////////////////////////////////////////
74{
75  if (command==verbose) {
76    int level= verbose-> GetNewIntValue(newValues);
77    gen-> SetVerboseLevel(level);
78  } else if (command==open) {
79    gen-> SetFileName(newValues);
80    G4cout << "HepMC Ascii inputfile: " 
81           << gen-> GetFileName() << G4endl;
82    gen-> Initialize();
83  }
84}
85
86
87///////////////////////////////////////////////////////////////////////////
88G4String HepMCG4AsciiReaderMessenger::GetCurrentValue(G4UIcommand* command)
89///////////////////////////////////////////////////////////////////////////
90{
91  G4String cv;
92
93  if (command == verbose) {
94    cv= verbose-> ConvertToString(gen-> GetVerboseLevel());
95  } else  if (command == open) {
96    cv= gen-> GetFileName();
97  }
98  return cv;
99}
100
Note: See TracBrowser for help on using the repository browser.