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 /// \file eventgenerator/HepMC/HepMCEx01/src/HepMCG4AsciiReaderMessenger.cc 27 /// \brief Implementation of the HepMCG4AsciiR 27 /// \brief Implementation of the HepMCG4AsciiReaderMessenger class 28 // 28 // >> 29 // ==================================================================== 29 // 30 // >> 31 // HepMCG4AsciiReaderMessenger.cc >> 32 // $Id$ >> 33 // >> 34 // ==================================================================== 30 #include "HepMCG4AsciiReaderMessenger.hh" 35 #include "HepMCG4AsciiReaderMessenger.hh" 31 << 32 #include "HepMCG4AsciiReader.hh" 36 #include "HepMCG4AsciiReader.hh" 33 37 >> 38 #include "G4UIdirectory.hh" >> 39 #include "G4UIcmdWithoutParameter.hh" 34 #include "G4UIcmdWithAString.hh" 40 #include "G4UIcmdWithAString.hh" 35 #include "G4UIcmdWithAnInteger.hh" 41 #include "G4UIcmdWithAnInteger.hh" 36 #include "G4UIcmdWithoutParameter.hh" << 37 #include "G4UIdirectory.hh" << 38 42 39 //....oooOO0OOooo........oooOO0OOooo........oo << 43 //////////////////////////////////////////////////////// 40 HepMCG4AsciiReaderMessenger::HepMCG4AsciiReade << 44 HepMCG4AsciiReaderMessenger::HepMCG4AsciiReaderMessenger >> 45 (HepMCG4AsciiReader* agen) >> 46 : gen(agen) >> 47 //////////////////////////////////////////////////////// 41 { 48 { 42 dir = new G4UIdirectory("/generator/hepmcAsc << 49 dir= new G4UIdirectory("/generator/hepmcAscii/"); 43 dir->SetGuidance("Reading HepMC event from a << 50 dir-> SetGuidance("Reading HepMC event from an Ascii file"); 44 51 45 verbose = new G4UIcmdWithAnInteger("/generat << 52 verbose= 46 verbose->SetGuidance("Set verbose level"); << 53 new G4UIcmdWithAnInteger("/generator/hepmcAscii/verbose", this); 47 verbose->SetParameterName("verboseLevel", fa << 54 verbose-> SetGuidance("Set verbose level"); 48 verbose->SetRange("verboseLevel>=0 && verbos << 55 verbose-> SetParameterName("verboseLevel", false, false); 49 << 56 verbose-> SetRange("verboseLevel>=0 && verboseLevel<=1"); 50 open = new G4UIcmdWithAString("/generator/he << 57 51 open->SetGuidance("(re)open data file (HepMC << 58 open= new G4UIcmdWithAString("/generator/hepmcAscii/open", this); 52 open->SetParameterName("input ascii file", t << 59 open-> SetGuidance("(re)open data file (HepMC Ascii format)"); >> 60 open-> SetParameterName("input ascii file", true, true); 53 } 61 } 54 62 55 //....oooOO0OOooo........oooOO0OOooo........oo << 63 /////////////////////////////////////////////////////////// 56 HepMCG4AsciiReaderMessenger::~HepMCG4AsciiRead 64 HepMCG4AsciiReaderMessenger::~HepMCG4AsciiReaderMessenger() >> 65 /////////////////////////////////////////////////////////// 57 { 66 { 58 delete verbose; 67 delete verbose; 59 delete open; 68 delete open; 60 69 61 delete dir; 70 delete dir; 62 } 71 } 63 72 64 //....oooOO0OOooo........oooOO0OOooo........oo << 73 /////////////////////////////////////////////////////////////////// 65 void HepMCG4AsciiReaderMessenger::SetNewValue( << 74 void HepMCG4AsciiReaderMessenger::SetNewValue(G4UIcommand* command, >> 75 G4String newValues) >> 76 /////////////////////////////////////////////////////////////////// 66 { 77 { 67 if (command == verbose) { << 78 if (command==verbose) { 68 int level = verbose->GetNewIntValue(newVal << 79 int level= verbose-> GetNewIntValue(newValues); 69 gen->SetVerboseLevel(level); << 80 gen-> SetVerboseLevel(level); 70 } << 81 } else if (command==open) { 71 else if (command == open) { << 82 gen-> SetFileName(newValues); 72 gen->SetFileName(newValues); << 83 G4cout << "HepMC Ascii inputfile: " 73 G4cout << "HepMC Ascii inputfile: " << gen << 84 << gen-> GetFileName() << G4endl; 74 gen->Initialize(); << 85 gen-> Initialize(); 75 } 86 } 76 } 87 } 77 88 78 //....oooOO0OOooo........oooOO0OOooo........oo << 89 >> 90 /////////////////////////////////////////////////////////////////////////// 79 G4String HepMCG4AsciiReaderMessenger::GetCurre 91 G4String HepMCG4AsciiReaderMessenger::GetCurrentValue(G4UIcommand* command) >> 92 /////////////////////////////////////////////////////////////////////////// 80 { 93 { 81 G4String cv; 94 G4String cv; 82 95 83 if (command == verbose) { 96 if (command == verbose) { 84 cv = verbose->ConvertToString(gen->GetVerb << 97 cv= verbose-> ConvertToString(gen-> GetVerboseLevel()); 85 } << 98 } else if (command == open) { 86 else if (command == open) { << 99 cv= gen-> GetFileName(); 87 cv = gen->GetFileName(); << 88 } 100 } 89 return cv; 101 return cv; 90 } 102 } >> 103 91 104