// // ******************************************************************** // * License and Disclaimer * // * * // * The GAMOS software is copyright of the Copyright Holders of * // * the GAMOS Collaboration. It is provided under the terms and * // * conditions of the GAMOS Software License, included in the file * // * LICENSE and available at http://fismed.ciemat.es/GAMOS/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 GAMOS 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 GAMOS Software license. * // ******************************************************************** // #include "GmAOData.hh" #include "GmAODataSearch.hh" #include "GmAOParam.hh" #include "GamosCore/GamosUtils/include/GmGenUtils.hh" #include std::map GmAOData::theNEvents; //---------------------------------------------------------------------- GmAOData::GmAOData( const std::vector& wl, GmAODataSearch* ds, G4String fname ) : theLine(wl), theDataSearch(ds), theFileName(fname) { } //---------------------------------------------------------------------- G4String GmAOData::GetMessage() const { return theDataSearch->GetMessage(); // should allow more flexibility /* G4String msg ; std::map::const_iterator ite; for( ite = theMessages.begin(); ite != theMessages.end(); ite++ ){ if( theMessages.size() == 1 && (*ite).second == "" ) { // return BuildMessageFromLine(); } else { msg += (*ite).second; } } return msg; */ } //---------------------------------------------------------------------- void GmAOData::PrintData() const { std::vector wordn = theDataSearch->GetWordNumbers(); for( unsigned int ii = 0; ii G4int(theLine.size()) ) { G4Exception("GmAOData::GetWord", "Error", FatalException, G4String("Asking for word number " + GmGenUtils::itoa(nw) + " while there are " + GmGenUtils::itoa(theLine.size())).c_str()); } return theLine[nw]; } G4int GmAOData::GetNEvents() { //first llok for n events read from "Number of events processed " std::map::const_iterator ite = theNEvents.find(theFileName); if( ite != theNEvents.end() ) { return (*ite).second; } else { G4int nev = theDataSearch->GetNEvents(); if( nev == -1 ) { G4Exception("GmAOData::GetNEvents", "Error", FatalException, G4String("No line with 'Number of events processed ' found in file " + theFileName + " use the command '/run/verbose 1' or alternatively set the number of events in the meta file adding ':NEV NEVENTS'").c_str()); } else { return nev; } } return -1; }