Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:53

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 // The state of the analysis manager instance.
0028 //
0029 // Author: Ivana Hrivnacova, 09/07/2013  (ivana@ipno.in2p3.fr)
0030 
0031 #ifndef G4AnalysisManagerState_h
0032 #define G4AnalysisManagerState_h 1
0033 
0034 #include "G4AnalysisVerbose.hh"
0035 #include "G4Threading.hh"
0036 #include "globals.hh"
0037 
0038 #include <string_view>
0039 
0040 class G4AnalysisManagerState
0041 {
0042   // Only G4VAnalysisManager can change the state
0043   friend class G4VAnalysisManager;
0044   friend class G4VAnalysisReader;
0045   friend class G4ParameterManager;
0046 
0047   public:
0048     G4AnalysisManagerState(G4String type, G4bool isMaster);
0049     // disabled constructors, operators
0050     G4AnalysisManagerState() = delete;
0051     G4AnalysisManagerState(const G4AnalysisManagerState&) = delete;
0052     G4AnalysisManagerState& operator=(const G4AnalysisManagerState&) = delete;
0053 
0054     // Methods
0055     void Message([[maybe_unused]] G4int level,
0056                  [[maybe_unused]] const G4String& action,
0057                  [[maybe_unused]] const G4String& objectType,
0058                  [[maybe_unused]] const G4String& objectName = "",
0059                  [[maybe_unused]] G4bool success = true) const;
0060     void IncrementCycle();
0061     void ResetCycle();
0062 
0063     // get methods
0064     G4String GetType() const;
0065     G4String GetFileType() const;
0066     G4bool   GetIsMaster() const;
0067     G4int    GetThreadId() const;
0068     G4bool   GetIsActivation() const;
0069     G4int    GetVerboseLevel() const;
0070     G4bool   IsVerbose(G4int verboseLevel) const;
0071     G4int    GetCycle() const;
0072 
0073   private:
0074     // set methods
0075     // (hidden from all clients except for G4VAnalysisManager friend)
0076     void SetIsActivation(G4bool isActivation);
0077     void SetVerboseLevel(G4int verboseLevel);
0078 
0079     // Static data members
0080     static constexpr std::string_view fkClass { "G4AnalysisManagerState" };
0081 
0082     // Data members
0083     G4String fType;
0084     G4bool   fIsMaster;
0085     G4int    fThreadId { G4Threading::SEQUENTIAL_ID };
0086     G4bool   fIsActivation { false };
0087     G4int    fVerboseLevel { 0 };
0088     G4int    fCycle { 0 };
0089     G4AnalysisVerbose fVerbose;
0090 };
0091 
0092 // inline functions
0093 
0094 inline void G4AnalysisManagerState::SetIsActivation(G4bool isActivation)
0095 { fIsActivation = isActivation; }
0096 
0097 inline void G4AnalysisManagerState::IncrementCycle()
0098 { ++fCycle; }
0099 
0100 inline void G4AnalysisManagerState::ResetCycle()
0101 { fCycle = 0; }
0102 
0103 inline G4String G4AnalysisManagerState::GetType() const
0104 { return fType; }
0105 
0106 inline G4String G4AnalysisManagerState::GetFileType() const
0107 { return G4StrUtil::to_lower_copy(fType); }
0108 
0109 inline G4bool  G4AnalysisManagerState::GetIsMaster() const
0110 { return fIsMaster; }
0111 
0112 inline G4int  G4AnalysisManagerState::GetThreadId() const
0113 { return fThreadId; }
0114 
0115 inline G4bool  G4AnalysisManagerState::GetIsActivation() const
0116 { return fIsActivation; }
0117 
0118 inline G4int   G4AnalysisManagerState::GetVerboseLevel() const
0119 { return fVerboseLevel; }
0120 
0121 inline G4bool  G4AnalysisManagerState::IsVerbose(G4int verboseLevel) const
0122 { return fVerboseLevel == verboseLevel; }
0123 
0124 inline G4int G4AnalysisManagerState::GetCycle() const
0125 { return fCycle; }
0126 
0127 #endif