// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... #include "FileReader.hh" #include "G4SystemOfUnits.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... FileReader::FileReader(G4String fileName) { fFileName = fileName; inputFile.open(fFileName.data()); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... FileReader::~FileReader() { inputFile.close(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void FileReader::SetFileName(G4String vFileName) { fFileName=vFileName; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void FileReader::StoreEvents() { if (evListPos.size() == 0) { G4double x = 0.; G4double y = 0.; G4double z = 0.; /* G4double E = 0.; G4double px = 0.; G4double py = 0.; G4double pz = 0.; */ while (inputFile.good()) { if (inputFile.good()) inputFile >> x; if (inputFile.good()) inputFile >> y; /* if(inputFile.good()) inputFile >> z; if(inputFile.good()) inputFile >> E; if(inputFile.good()) inputFile >> px; if(inputFile.good()) inputFile >> py; if(inputFile.good()) inputFile >> pz; */ evListPos.push_back(G4ThreeVector(x*m,y*m,z*m)); //evListEnergy.push_back(E*eV); //evListMom.push_back(G4ThreeVector(px*eV,py*eV,pz*eV)); } } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4ThreeVector FileReader::GetAnEventPosition(G4int vIndex) { return evListPos.at(vIndex); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4double FileReader::GetAnEventEnergy(G4int vIndex) { return evListEnergy.at(vIndex); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4ThreeVector FileReader::GetAnEventMomentum(G4int vIndex) { return evListMom.at(vIndex); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4int FileReader::GetNumberOfEvents() { return evListPos.size(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....