Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:31

0001 // -*- C++ -*-
0002 //
0003 // Debug.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef ThePEG_Debug_H
0010 #define ThePEG_Debug_H
0011 // This is the declaration of the Debug class.
0012 
0013 #include <vector>
0014 
0015 namespace ThePEG {
0016 
0017 /**
0018  * The <code>Debug</code> class defines a number of debug levels and a
0019  * static public member giving the current debug level in a run.
0020  */
0021 class Debug {
0022 
0023 public:
0024 
0025   /**
0026    * The different debug levels.
0027    */
0028   enum Levels {
0029     noDebug = 0, /**< No debugging. */
0030     printSomeEvents = 1, /**< Lowest debug level. Some events are printed out. */
0031     printEveryEvent = 5, /**< Higher debug level. All events are printed out. */
0032     full = 9 /**< Highest possible debug level */
0033   };
0034 
0035   /**
0036    * The current level.
0037    */
0038   static int level;
0039 
0040   /**
0041    * If true, the debug level has been set from the outside from the
0042    * calling program. This would then override any debug settings in
0043    * the event generator.
0044    */
0045   static bool isset;
0046 
0047   /**
0048    * A vector of switches indicating whether a given <i>debug item</i>
0049    * is switched on or not. The index of a debug item has no special
0050    * meaning. An implementor may assume that a given number
0051    * corresponds to a certain request for debug output, but cannot be
0052    * sure that someone else uses that number for some other purpose.
0053    */
0054   static std::vector<bool> debugItems;
0055 
0056   /**
0057    * Switch on or off a given debug item. If no such item exists, one
0058    * will be created.
0059    */
0060   static void debugItem(int item, bool on);
0061 
0062   /**
0063    * Set the debug level.
0064    */
0065   static void setDebug(int ilev);
0066 
0067   /**
0068    * Check if a given item should be debugged. If no such item is
0069    * present false is returned.
0070    */
0071   static bool debugItem(int item)
0072   {
0073     if ( level == noDebug ) return false;
0074     if ( level == full ) return true;
0075     return ( item < 0 || std::size_t(item) >= debugItems.size() )? false:
0076       debugItems[item];
0077   }
0078 
0079   /** @name Functions for manipulating floating point (FPU) signals
0080    * (requires the existence of <code>fpu_controll.h</code> on the
0081    * platform). */
0082   //@{
0083   /**
0084    * Switch on signalling all FPU exceptions.
0085    */
0086   static void unmaskFpuErrors();
0087   /**
0088    * Switch on signalling overflow FPU exceptions.
0089    */
0090   static void unmaskFpuOverflow();
0091   /**
0092    * Switch on signalling underflow FPU exceptions.
0093    */
0094   static void unmaskFpuUnderflow();
0095   /**
0096    * Switch on signalling division by zero FPU exceptions.
0097    */
0098   static void unmaskFpuDivZero();
0099   /**
0100    * Switch on signalling denormalized argument FPU exceptions.
0101    */
0102   static void unmaskFpuDenorm();
0103   /**
0104    * Switch on signalling invalid operation FPU exceptions.
0105    */
0106   static void unmaskFpuInvalid();
0107   /**
0108    * Switch off signalling all FPU exceptions.
0109    */
0110   static void maskFpuErrors();
0111   /**
0112    * Switch off signalling overflow FPU exceptions.
0113    */
0114   static void maskFpuOverflow();
0115   /**
0116    * Switch off signalling underflow FPU exceptions.
0117    */
0118   static void maskFpuUnderflow();
0119   /**
0120    * Switch off signalling division by zero FPU exceptions.
0121    */
0122   static void maskFpuDivZero();
0123   /**
0124    * Switch off signalling denormalized argument FPU exceptions.
0125    */
0126   static void maskFpuDenorm();
0127   /**
0128    * Switch off signalling invalid operation FPU exceptions.
0129    */
0130   static void maskFpuInvalid();
0131   //@}
0132 
0133 };
0134 
0135 }
0136 
0137 #endif /* ThePEG_Debug_H */