Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HepMCEx02/src/HepMCG4AsciiReaderMessenger.cc
Go to the documentation of this file.
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 /// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4AsciiReaderMessenger.cc
27 /// \brief Implementation of the HepMCG4AsciiReaderMessenger class
28 //
29 // $Id: HepMCG4AsciiReaderMessenger.cc 77801 2013-11-28 13:33:20Z gcosmo $
30 //
31 #include "G4UIdirectory.hh"
33 #include "G4UIcmdWithAString.hh"
34 #include "G4UIcmdWithAnInteger.hh"
35 #include "HepMCG4AsciiReaderMessenger.hh"
36 #include "HepMCG4AsciiReader.hh"
37 
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41  (HepMCG4AsciiReader* agen)
42  : gen(agen)
43 {
44  dir= new G4UIdirectory("/generator/hepmcAscii/");
45  dir-> SetGuidance("Reading HepMC event from an Ascii file");
46 
47  verbose=
48  new G4UIcmdWithAnInteger("/generator/hepmcAscii/verbose", this);
49  verbose-> SetGuidance("Set verbose level");
50  verbose-> SetParameterName("verboseLevel", false, false);
51  verbose-> SetRange("verboseLevel>=0 && verboseLevel<=1");
52 
53  open= new G4UIcmdWithAString("/generator/hepmcAscii/open", this);
54  open-> SetGuidance("(re)open data file (HepMC Ascii format)");
55  open-> SetParameterName("input ascii file", true, true);
56 }
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 {
61  delete verbose;
62  delete open;
63 
64  delete dir;
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69  G4String newValues)
70 {
71  if (command==verbose) {
72  int level= verbose-> GetNewIntValue(newValues);
73  gen-> SetVerboseLevel(level);
74  } else if (command==open) {
75  gen-> SetFileName(newValues);
76  G4cout << "HepMC Ascii inputfile: "
77  << gen-> GetFileName() << G4endl;
78  gen-> Initialize();
79  }
80 }
81 
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 {
86  G4String cv;
87 
88  if (command == verbose) {
89  cv= verbose-> ConvertToString(gen-> GetVerboseLevel());
90  } else if (command == open) {
91  cv= gen-> GetFileName();
92  }
93  return cv;
94 }
void Initialize()
Definition: errprop.cc:96
void SetNewValue(G4UIcommand *command, G4String newValues)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61