Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file eventgenerator/HepMC/HepMCEx01/src/H << 26 // ==================================================================== 27 /// \brief Implementation of the HepMCG4AsciiR << 28 // 27 // >> 28 // HepMCG4AsciiReaderMessenger.cc >> 29 // $Id: HepMCG4AsciiReaderMessenger.cc,v 1.4 2006-06-29 17:12:20 gunter Exp $ 29 // 30 // >> 31 // ==================================================================== 30 #include "HepMCG4AsciiReaderMessenger.hh" 32 #include "HepMCG4AsciiReaderMessenger.hh" 31 << 32 #include "HepMCG4AsciiReader.hh" 33 #include "HepMCG4AsciiReader.hh" 33 34 >> 35 #include "G4UIdirectory.hh" >> 36 #include "G4UIcmdWithoutParameter.hh" 34 #include "G4UIcmdWithAString.hh" 37 #include "G4UIcmdWithAString.hh" 35 #include "G4UIcmdWithAnInteger.hh" 38 #include "G4UIcmdWithAnInteger.hh" 36 #include "G4UIcmdWithoutParameter.hh" << 37 #include "G4UIdirectory.hh" << 38 39 39 //....oooOO0OOooo........oooOO0OOooo........oo << 40 //////////////////////////////////////////////////////// 40 HepMCG4AsciiReaderMessenger::HepMCG4AsciiReade << 41 HepMCG4AsciiReaderMessenger::HepMCG4AsciiReaderMessenger >> 42 (HepMCG4AsciiReader* agen) >> 43 : gen(agen) >> 44 //////////////////////////////////////////////////////// 41 { 45 { 42 dir = new G4UIdirectory("/generator/hepmcAsc << 46 dir= new G4UIdirectory("/generator/hepmcAscii/"); 43 dir->SetGuidance("Reading HepMC event from a << 47 dir-> SetGuidance("Reading HepMC event from an Ascii file"); 44 48 45 verbose = new G4UIcmdWithAnInteger("/generat << 49 verbose= 46 verbose->SetGuidance("Set verbose level"); << 50 new G4UIcmdWithAnInteger("/generator/hepmcAscii/verbose", this); 47 verbose->SetParameterName("verboseLevel", fa << 51 verbose-> SetGuidance("Set verbose level"); 48 verbose->SetRange("verboseLevel>=0 && verbos << 52 verbose-> SetParameterName("verboseLevel", false, false); 49 << 53 verbose-> SetRange("verboseLevel>=0 && verboseLevel<=1"); 50 open = new G4UIcmdWithAString("/generator/he << 54 51 open->SetGuidance("(re)open data file (HepMC << 55 open= new G4UIcmdWithAString("/generator/hepmcAscii/open", this); 52 open->SetParameterName("input ascii file", t << 56 open-> SetGuidance("(re)open data file (HepMC Ascii format)"); >> 57 open-> SetParameterName("input ascii file", true, true); 53 } 58 } 54 59 55 //....oooOO0OOooo........oooOO0OOooo........oo << 60 /////////////////////////////////////////////////////////// 56 HepMCG4AsciiReaderMessenger::~HepMCG4AsciiRead 61 HepMCG4AsciiReaderMessenger::~HepMCG4AsciiReaderMessenger() >> 62 /////////////////////////////////////////////////////////// 57 { 63 { 58 delete verbose; 64 delete verbose; 59 delete open; 65 delete open; 60 66 61 delete dir; 67 delete dir; 62 } 68 } 63 69 64 //....oooOO0OOooo........oooOO0OOooo........oo << 70 /////////////////////////////////////////////////////////////////// 65 void HepMCG4AsciiReaderMessenger::SetNewValue( << 71 void HepMCG4AsciiReaderMessenger::SetNewValue(G4UIcommand* command, >> 72 G4String newValues) >> 73 /////////////////////////////////////////////////////////////////// 66 { 74 { 67 if (command == verbose) { << 75 if (command==verbose) { 68 int level = verbose->GetNewIntValue(newVal << 76 int level= verbose-> GetNewIntValue(newValues); 69 gen->SetVerboseLevel(level); << 77 gen-> SetVerboseLevel(level); 70 } << 78 } else if (command==open) { 71 else if (command == open) { << 79 gen-> SetFileName(newValues); 72 gen->SetFileName(newValues); << 80 G4cout << "HepMC Ascii inputfile: " 73 G4cout << "HepMC Ascii inputfile: " << gen << 81 << gen-> GetFileName() << G4endl; 74 gen->Initialize(); << 82 gen-> Initialize(); 75 } 83 } 76 } 84 } 77 85 78 //....oooOO0OOooo........oooOO0OOooo........oo << 86 >> 87 /////////////////////////////////////////////////////////////////////////// 79 G4String HepMCG4AsciiReaderMessenger::GetCurre 88 G4String HepMCG4AsciiReaderMessenger::GetCurrentValue(G4UIcommand* command) >> 89 /////////////////////////////////////////////////////////////////////////// 80 { 90 { 81 G4String cv; 91 G4String cv; 82 92 83 if (command == verbose) { 93 if (command == verbose) { 84 cv = verbose->ConvertToString(gen->GetVerb << 94 cv= verbose-> ConvertToString(gen-> GetVerboseLevel()); 85 } << 95 } else if (command == open) { 86 else if (command == open) { << 96 cv= gen-> GetFileName(); 87 cv = gen->GetFileName(); << 88 } 97 } 89 return cv; 98 return cv; 90 } 99 } >> 100 91 101