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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 /*
 27  * ============================================================================
 28  *
 29  *       Filename:  CexmcException.cc
 30  *
 31  *    Description:  cexmc exceptions
 32  *
 33  *        Version:  1.0
 34  *        Created:  23.12.2009 13:42:26
 35  *       Revision:  none
 36  *       Compiler:  gcc
 37  *
 38  *         Author:  Alexey Radkov (), 
 39  *        Company:  PNPI
 40  *
 41  * ============================================================================
 42  */
 43 
 44 #include "CexmcException.hh"
 45 #include "CexmcRunManager.hh"
 46 #include "CexmcCommon.hh"
 47 
 48 
 49 CexmcException::CexmcException( CexmcExceptionType  type_ ) : type( type_ )
 50 {
 51 }
 52 
 53 
 54 CexmcException::~CexmcException() throw()
 55 {
 56 }
 57 
 58 
 59 const char *  CexmcException::what( void ) const throw()
 60 {
 61     switch ( type )
 62     {
 63     case CexmcSystemException :
 64         return CEXMC_LINE_START "Unspecified system exception.";
 65     case CexmcEventActionIsNotInitialized :
 66         return CEXMC_LINE_START "Event action was not initialized.";
 67     case CexmcCmdLineParseException :
 68         return CEXMC_LINE_START "Exception in command line arguments. "
 69                "Check your command line arguments.";
 70     case CexmcPreinitException :
 71         return CEXMC_LINE_START "Exception in PreInit phase. "
 72                "Probably you did not specify preinit macro or production model "
 73                "in it.";
 74     case CexmcFileCompressException :
 75         return CEXMC_LINE_START "File compress exception. "
 76                "Check if the file exists and output directory is writable.";
 77     case CexmcReadProjectIncomplete :
 78         return CEXMC_LINE_START "Read project is incomplete. "
 79                "Check if the read project has complete set of data files.";
 80     case CexmcProjectExists :
 81         return CEXMC_LINE_START "Project you try to write exists. "
 82                "Use command line option '-y' to force project override.";
 83     case CexmcCmdIsNotAllowed :
 84         return CEXMC_LINE_START "Command is not allowed here. "
 85                 "Probably you tried to issue a command which would override "
 86                 "read-only settings in the read project.";
 87     case CexmcBadAngularRange :
 88         return CEXMC_LINE_START "Bad angular range. "
 89                 "Check specified angular ranges (probably they mismatch ranges "
 90                 "in the read project).";
 91     case CexmcBadThreshold :
 92         return CEXMC_LINE_START "Bad threshold. "
 93                 "Check specified thresholds (probably they mismatch thresholds "
 94                 "in the read project).";
 95     case CexmcBadCalorimeterTriggerAlgorithm :
 96         return CEXMC_LINE_START "Bad calorimeter trigger algorithm. "
 97                 "Check specified calorimeter trigger algorithm (probably it "
 98                 "mismatches algorithm in the read project).";
 99     case CexmcBadOCVetoAlgorithm :
100         return CEXMC_LINE_START "Bad outer crystals veto algorithm. "
101                 "Check specified outer crystals veto algorithm (probably it "
102                 "mismatches algorithm in the read project).";
103     case CexmcBadOCVetoFraction :
104         return CEXMC_LINE_START "Bad outer crystals veto fraction. "
105                 "Check specified outer crystals veto fraction (probably it "
106                 "has higher value than in the read project).";
107     case CexmcCalorimeterRegionNotInitialized :
108         return CEXMC_LINE_START "Calorimeter sensitive region was not "
109                 "initialized. Check gdml source file.";
110     case CexmcCalorimeterGeometryDataNotInitialized :
111         return CEXMC_LINE_START "Calorimeter geometry data was not "
112                 "initialized. Check gdml source file.";
113     case CexmcMultipleDetectorRoles :
114         return CEXMC_LINE_START "Multiple detector roles for one logical "
115                 "volume. Check gdml source file.";
116     case CexmcKinematicsException :
117         return CEXMC_LINE_START "Kinematics exception. "
118                 "Check your production model.";
119     case CexmcPoorEventData :
120         return CEXMC_LINE_START "Cannot create rich event data from poor "
121                 "original data. Set less value of event data verbose level.";
122     case CexmcIncompatibleGeometry :
123         return CEXMC_LINE_START "Incompatible geometry definition. "
124                 "Check your geometry data.";
125     case CexmcIncompleteProductionModel :
126         return CEXMC_LINE_START "Production model provided is incomplete. "
127                 "Check that your production model defines all particles.";
128     case CexmcIncompatibleProductionModel :
129         return CEXMC_LINE_START "Production model provided is incompatible "
130                 "with physical process that tries to bind it.";
131     case CexmcBeamAndIncidentParticlesMismatch :
132         return CEXMC_LINE_START "Beam and incident particles mismatch. "
133                 "Instantiated reconstructor will not give reliable results in "
134                 "this case. Make sure that beam particle and incident particle "
135                 "of provided production model are same.";
136     case CexmcInvalidAngularRange :
137         return CEXMC_LINE_START "An angular range is not valid. "
138                 "Check specified angular ranges.";
139 #ifdef CEXMC_USE_CUSTOM_FILTER
140     case CexmcCFBadSource :
141         return CEXMC_LINE_START "Custom filter source file does not exist or "
142                 "damaged. Check your command line arguments or source file.";
143     case CexmcCFParseError :
144         return CEXMC_LINE_START "Custom filter source file contains errors. "
145                 "Check your custom filter source file.";
146     case CexmcCFUninitialized :
147         return CEXMC_LINE_START "Custom filter was not properly initialized.";
148     case CexmcCFUninitializedVector :
149         return CEXMC_LINE_START "Custom filter: A vector variable was not "
150                 "initialized.";
151     case CexmcCFUnexpectedContext :
152         return CEXMC_LINE_START "Custom filter: a variable or function call is "
153                 "in wrong type context (scalar when a vector is expected or "
154                 "vice versa). Check your custom filter script.";
155     case CexmcCFUnexpectedFunction :
156         return CEXMC_LINE_START "Custom filter: a function is unknown or in "
157                 "wrong type context. Check your custom filter script.";
158     case CexmcCFUnexpectedVariable :
159         return CEXMC_LINE_START "Custom filter: a variable is unknown or in "
160                 "wrong type context. Check your custom filter script.";
161     case CexmcCFUnexpectedVariableUsage :
162         return CEXMC_LINE_START "Custom filter: a variable is used in wrong "
163                 "type context (scalar when a vector is expected or vice "
164                 "versa). Check your custom filter script.";
165     case CexmcCFUnexpectedVectorIndex :
166         return CEXMC_LINE_START "Custom filter: a vector variable with wrong "
167                 "index. Indices of vectors should start from 1. Check your "
168                 "custom filter script.";
169 #endif
170     case CexmcWeirdException :
171         return CEXMC_LINE_START "A weird exception occurred. "
172                 "The world must collapse now.";
173     default :
174         return CEXMC_LINE_START "Unknown exception.";
175     }
176 }
177 
178 
179 void  ThrowExceptionIfProjectIsRead( CexmcExceptionType  type,
180                                      G4bool  extraCond )
181 {
182     CexmcRunManager *  runManager( static_cast< CexmcRunManager * >(
183                                             G4RunManager::GetRunManager() ) );
184     if ( runManager->ProjectIsRead() && extraCond )
185         throw CexmcException( type );
186 }
187 
188