Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-02 08:28:13

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 // Author: Ivana Hrivnacova, IJCLab IN2P3/CNRS, 25/07/2024
0028 
0029 #ifndef G4AccType_h
0030 #define G4AccType_h 1
0031 
0032 #include "globals.hh"
0033 
0034 #include <bitset>
0035 
0036 // Enumeration for definition available accummulables
0037 
0038 enum class G4AccType {
0039   kValue,        // G4AccValue<T>
0040   kArray,        // G4AccArray<T>
0041   kMap,          // G4AccMap<T>
0042   kUnorderedMap, // G4AccUnorderedMap<T>
0043   kVector,       // G4AccumulableVector<T>
0044   kUser          // User type
0045 };
0046 
0047 // TODO: add G4String GetTypeName(G4AccType)
0048 
0049 // Helper class for printing
0050 //
0051 class G4PrintOptions {
0052   public:
0053     enum Option : std::size_t {
0054         kName = 0,
0055         kType = 1,
0056         kId = 2
0057     };
0058 
0059     G4PrintOptions() {
0060         SetDefaults();
0061     }
0062     G4PrintOptions(std::initializer_list<Option> options) {
0063         SetDefaults();
0064         for (const Option& option : options) {
0065             fValue.set(option);
0066         }
0067     }
0068     ~G4PrintOptions() = default;
0069 
0070     void Set(Option option, bool value = true) { fValue.set(option, value); }
0071     bool Has(Option option) const { return fValue[option]; }
0072 
0073   private:
0074     // methods
0075     void SetDefaults() {
0076       fValue.set(kName);
0077       fValue.set(kType);
0078     }
0079 
0080     // data members
0081     static constexpr std::size_t kMax = G4PrintOptions::kId + 1;
0082     std::bitset<kMax> fValue{0};
0083 };
0084 
0085 namespace G4Accumulables
0086 {
0087 
0088 // Constant expressions
0089 //
0090 constexpr G4int kInvalidId { -1 };
0091 
0092 // Verbose level
0093 //
0094 [[maybe_unused]] static G4int VerboseLevel {1};
0095 
0096 }
0097 
0098 #endif