Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:52

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /*
0027  * ============================================================================
0028  *
0029  *       Filename:  CexmcException.cc
0030  *
0031  *    Description:  cexmc exceptions
0032  *
0033  *        Version:  1.0
0034  *        Created:  23.12.2009 13:42:26
0035  *       Revision:  none
0036  *       Compiler:  gcc
0037  *
0038  *         Author:  Alexey Radkov (), 
0039  *        Company:  PNPI
0040  *
0041  * ============================================================================
0042  */
0043 
0044 #include "CexmcException.hh"
0045 #include "CexmcRunManager.hh"
0046 #include "CexmcCommon.hh"
0047 
0048 
0049 CexmcException::CexmcException( CexmcExceptionType  type_ ) : type( type_ )
0050 {
0051 }
0052 
0053 
0054 CexmcException::~CexmcException() throw()
0055 {
0056 }
0057 
0058 
0059 const char *  CexmcException::what( void ) const throw()
0060 {
0061     switch ( type )
0062     {
0063     case CexmcSystemException :
0064         return CEXMC_LINE_START "Unspecified system exception.";
0065     case CexmcEventActionIsNotInitialized :
0066         return CEXMC_LINE_START "Event action was not initialized.";
0067     case CexmcCmdLineParseException :
0068         return CEXMC_LINE_START "Exception in command line arguments. "
0069                "Check your command line arguments.";
0070     case CexmcPreinitException :
0071         return CEXMC_LINE_START "Exception in PreInit phase. "
0072                "Probably you did not specify preinit macro or production model "
0073                "in it.";
0074     case CexmcFileCompressException :
0075         return CEXMC_LINE_START "File compress exception. "
0076                "Check if the file exists and output directory is writable.";
0077     case CexmcReadProjectIncomplete :
0078         return CEXMC_LINE_START "Read project is incomplete. "
0079                "Check if the read project has complete set of data files.";
0080     case CexmcProjectExists :
0081         return CEXMC_LINE_START "Project you try to write exists. "
0082                "Use command line option '-y' to force project override.";
0083     case CexmcCmdIsNotAllowed :
0084         return CEXMC_LINE_START "Command is not allowed here. "
0085                 "Probably you tried to issue a command which would override "
0086                 "read-only settings in the read project.";
0087     case CexmcBadAngularRange :
0088         return CEXMC_LINE_START "Bad angular range. "
0089                 "Check specified angular ranges (probably they mismatch ranges "
0090                 "in the read project).";
0091     case CexmcBadThreshold :
0092         return CEXMC_LINE_START "Bad threshold. "
0093                 "Check specified thresholds (probably they mismatch thresholds "
0094                 "in the read project).";
0095     case CexmcBadCalorimeterTriggerAlgorithm :
0096         return CEXMC_LINE_START "Bad calorimeter trigger algorithm. "
0097                 "Check specified calorimeter trigger algorithm (probably it "
0098                 "mismatches algorithm in the read project).";
0099     case CexmcBadOCVetoAlgorithm :
0100         return CEXMC_LINE_START "Bad outer crystals veto algorithm. "
0101                 "Check specified outer crystals veto algorithm (probably it "
0102                 "mismatches algorithm in the read project).";
0103     case CexmcBadOCVetoFraction :
0104         return CEXMC_LINE_START "Bad outer crystals veto fraction. "
0105                 "Check specified outer crystals veto fraction (probably it "
0106                 "has higher value than in the read project).";
0107     case CexmcCalorimeterRegionNotInitialized :
0108         return CEXMC_LINE_START "Calorimeter sensitive region was not "
0109                 "initialized. Check gdml source file.";
0110     case CexmcCalorimeterGeometryDataNotInitialized :
0111         return CEXMC_LINE_START "Calorimeter geometry data was not "
0112                 "initialized. Check gdml source file.";
0113     case CexmcMultipleDetectorRoles :
0114         return CEXMC_LINE_START "Multiple detector roles for one logical "
0115                 "volume. Check gdml source file.";
0116     case CexmcKinematicsException :
0117         return CEXMC_LINE_START "Kinematics exception. "
0118                 "Check your production model.";
0119     case CexmcPoorEventData :
0120         return CEXMC_LINE_START "Cannot create rich event data from poor "
0121                 "original data. Set less value of event data verbose level.";
0122     case CexmcIncompatibleGeometry :
0123         return CEXMC_LINE_START "Incompatible geometry definition. "
0124                 "Check your geometry data.";
0125     case CexmcIncompleteProductionModel :
0126         return CEXMC_LINE_START "Production model provided is incomplete. "
0127                 "Check that your production model defines all particles.";
0128     case CexmcIncompatibleProductionModel :
0129         return CEXMC_LINE_START "Production model provided is incompatible "
0130                 "with physical process that tries to bind it.";
0131     case CexmcBeamAndIncidentParticlesMismatch :
0132         return CEXMC_LINE_START "Beam and incident particles mismatch. "
0133                 "Instantiated reconstructor will not give reliable results in "
0134                 "this case. Make sure that beam particle and incident particle "
0135                 "of provided production model are same.";
0136     case CexmcInvalidAngularRange :
0137         return CEXMC_LINE_START "An angular range is not valid. "
0138                 "Check specified angular ranges.";
0139 #ifdef CEXMC_USE_CUSTOM_FILTER
0140     case CexmcCFBadSource :
0141         return CEXMC_LINE_START "Custom filter source file does not exist or "
0142                 "damaged. Check your command line arguments or source file.";
0143     case CexmcCFParseError :
0144         return CEXMC_LINE_START "Custom filter source file contains errors. "
0145                 "Check your custom filter source file.";
0146     case CexmcCFUninitialized :
0147         return CEXMC_LINE_START "Custom filter was not properly initialized.";
0148     case CexmcCFUninitializedVector :
0149         return CEXMC_LINE_START "Custom filter: A vector variable was not "
0150                 "initialized.";
0151     case CexmcCFUnexpectedContext :
0152         return CEXMC_LINE_START "Custom filter: a variable or function call is "
0153                 "in wrong type context (scalar when a vector is expected or "
0154                 "vice versa). Check your custom filter script.";
0155     case CexmcCFUnexpectedFunction :
0156         return CEXMC_LINE_START "Custom filter: a function is unknown or in "
0157                 "wrong type context. Check your custom filter script.";
0158     case CexmcCFUnexpectedVariable :
0159         return CEXMC_LINE_START "Custom filter: a variable is unknown or in "
0160                 "wrong type context. Check your custom filter script.";
0161     case CexmcCFUnexpectedVariableUsage :
0162         return CEXMC_LINE_START "Custom filter: a variable is used in wrong "
0163                 "type context (scalar when a vector is expected or vice "
0164                 "versa). Check your custom filter script.";
0165     case CexmcCFUnexpectedVectorIndex :
0166         return CEXMC_LINE_START "Custom filter: a vector variable with wrong "
0167                 "index. Indices of vectors should start from 1. Check your "
0168                 "custom filter script.";
0169 #endif
0170     case CexmcWeirdException :
0171         return CEXMC_LINE_START "A weird exception occurred. "
0172                 "The world must collapse now.";
0173     default :
0174         return CEXMC_LINE_START "Unknown exception.";
0175     }
0176 }
0177 
0178 
0179 void  ThrowExceptionIfProjectIsRead( CexmcExceptionType  type,
0180                                      G4bool  extraCond )
0181 {
0182     CexmcRunManager *  runManager( static_cast< CexmcRunManager * >(
0183                                             G4RunManager::GetRunManager() ) );
0184     if ( runManager->ProjectIsRead() && extraCond )
0185         throw CexmcException( type );
0186 }
0187