ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HepMCG4AsciiReaderMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file HepMCG4AsciiReaderMessenger.cc
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 //
28 //
29 //
30 #include "G4UIdirectory.hh"
32 #include "G4UIcmdWithAString.hh"
33 #include "G4UIcmdWithAnInteger.hh"
34 #include "HepMCG4AsciiReaderMessenger.hh"
35 #include "HepMCG4AsciiReader.hh"
36 
37 
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40  (HepMCG4AsciiReader* agen)
41  : gen(agen)
42 {
43  dir= new G4UIdirectory("/generator/hepmcAscii/");
44  dir-> SetGuidance("Reading HepMC event from an Ascii file");
45 
46  verbose=
47  new G4UIcmdWithAnInteger("/generator/hepmcAscii/verbose", this);
48  verbose-> SetGuidance("Set verbose level");
49  verbose-> SetParameterName("verboseLevel", false, false);
50  verbose-> SetRange("verboseLevel>=0 && verboseLevel<=1");
51 
52  open= new G4UIcmdWithAString("/generator/hepmcAscii/open", this);
53  open-> SetGuidance("(re)open data file (HepMC Ascii format)");
54  open-> SetParameterName("input ascii file", true, true);
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 {
60  delete verbose;
61  delete open;
62 
63  delete dir;
64 }
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68  G4String newValues)
69 {
70  if (command==verbose) {
71  int level= verbose-> GetNewIntValue(newValues);
72  gen-> SetVerboseLevel(level);
73  } else if (command==open) {
74  gen-> SetFileName(newValues);
75  G4cout << "HepMC Ascii inputfile: "
76  << gen-> GetFileName() << G4endl;
77  gen-> Initialize();
78  }
79 }
80 
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84 {
85  G4String cv;
86 
87  if (command == verbose) {
88  cv= verbose-> ConvertToString(gen-> GetVerboseLevel());
89  } else if (command == open) {
90  cv= gen-> GetFileName();
91  }
92  return cv;
93 }