Geant4  10.03
CexmcException.cc
Go to the documentation of this file.
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 
50 {
51 }
52 
53 
55 {
56 }
57 
58 
59 const char * CexmcException::what( void ) const throw()
60 {
61  switch ( type )
62  {
64  return CEXMC_LINE_START "Unspecified system exception.";
66  return CEXMC_LINE_START "Event action was not initialized.";
68  return CEXMC_LINE_START "Exception in command line arguments. "
69  "Check your command line arguments.";
71  return CEXMC_LINE_START "Exception in PreInit phase. "
72  "Probably you did not specify preinit macro or production model "
73  "in it.";
75  return CEXMC_LINE_START "File compress exception. "
76  "Check if the file exists and output directory is writable.";
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.";
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.";
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).";
96  return CEXMC_LINE_START "Bad calorimeter trigger algorithm. "
97  "Check specified calorimeter trigger algorithm (probably it "
98  "mismatches algorithm in the read project).";
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).";
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).";
108  return CEXMC_LINE_START "Calorimeter sensitive region was not "
109  "initialized. Check gdml source file.";
111  return CEXMC_LINE_START "Calorimeter geometry data was not "
112  "initialized. Check gdml source file.";
114  return CEXMC_LINE_START "Multiple detector roles for one logical "
115  "volume. Check gdml source file.";
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.";
123  return CEXMC_LINE_START "Incompatible geometry definition. "
124  "Check your geometry data.";
126  return CEXMC_LINE_START "Production model provided is incomplete. "
127  "Check that your production model defines all particles.";
129  return CEXMC_LINE_START "Production model provided is incompatible "
130  "with physical process that tries to bind it.";
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.";
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 occured. "
172  "The world must collapse now.";
173  default :
174  return CEXMC_LINE_START "Unknown exception.";
175  }
176 }
177 
178 
180  G4bool extraCond )
181 {
182  CexmcRunManager * runManager( static_cast< CexmcRunManager * >(
184  if ( runManager->ProjectIsRead() && extraCond )
185  throw CexmcException( type );
186 }
187 
CexmcExceptionType type
G4bool ProjectIsRead(void) const
void ThrowExceptionIfProjectIsRead(CexmcExceptionType type, G4bool extraCond)
CexmcExceptionType
#define CEXMC_LINE_START
Definition: CexmcCommon.hh:52
bool G4bool
Definition: G4Types.hh:79
const char * what(void) const
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
CexmcException(CexmcExceptionType type)