110 lines
4.3 KiB
C++
110 lines
4.3 KiB
C++
//
|
|
// ********************************************************************
|
|
// * 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. *
|
|
// ********************************************************************
|
|
//
|
|
//
|
|
// This software was developed by Lawrence Livermore National Laboratory.
|
|
//
|
|
// Redistribution and use in source and binary forms, with or without
|
|
// modification, are permitted provided that the following conditions are met:
|
|
//
|
|
// 1. Redistributions of source code must retain the above copyright notice,
|
|
// this list of conditions and the following disclaimer.
|
|
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
// and/or other materials provided with the distribution.
|
|
// 3. The name of the author may not be used to endorse or promote products
|
|
// derived from this software without specific prior written permission.
|
|
//
|
|
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
//
|
|
// Copyright (c) 2006 The Regents of the University of California.
|
|
// All rights reserved.
|
|
// UCRL-CODE-224807
|
|
//
|
|
//
|
|
// $Id: G4fissionerr.cc 67966 2013-03-13 09:38:38Z gcosmo $
|
|
//
|
|
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include "G4fissionEvent.hh"
|
|
|
|
std::string itoa(const G4int& x);
|
|
|
|
void G4fissionEvent::G4fissionerr(G4int iSever, std::string chSubNam, std::string chMsg)
|
|
|
|
/*
|
|
Description
|
|
multi error handling routine
|
|
*/
|
|
|
|
/*
|
|
Input
|
|
iSever - severity code: larger number: more severe
|
|
0 : no error
|
|
1-5 : non-fatal
|
|
6- : fatal
|
|
chSubNm - calling subroutine name
|
|
chMsg - error message
|
|
*/
|
|
|
|
{
|
|
G4int doExit;
|
|
std::string ExitMsg;
|
|
|
|
|
|
if (iSever <= 5) { /* warning */
|
|
doExit = 0;
|
|
}
|
|
else {
|
|
doExit = 1;
|
|
}
|
|
|
|
ExitMsg = "Error in Function "+chSubNam+", Severity=" + itoa(iSever) + " : "+chMsg;
|
|
|
|
std::cerr << "Fission " << ExitMsg << std::endl;
|
|
if (doExit == 1) G4Exception("G4fissionEvent::G4fissionerr()", "601",
|
|
FatalException, "Fatal Error");
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
std::string itoa(const G4int& x)
|
|
{
|
|
std::ostringstream o;
|
|
if (!(o << x)) return "ERROR";
|
|
return o.str();
|
|
}
|