Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Base class for the object managers.
0028 // It handles first object ID and its lock and provides common utility methods.
0029 
0030 // Author: Ivana Hrivnacova, 18/06/2013  (ivana@ipno.in2p3.fr)
0031 
0032 #ifndef G4BaseAnalysisManager_h
0033 #define G4BaseAnalysisManager_h 1
0034 
0035 #include "G4Fcn.hh"
0036 #include "G4BinScheme.hh"
0037 #include "globals.hh"
0038 
0039 #include "G4AnalysisManagerState.hh"
0040 
0041 #include <string_view>
0042 
0043 class G4BaseAnalysisManager
0044 {
0045   public:
0046     explicit G4BaseAnalysisManager(const G4AnalysisManagerState& state);
0047     G4BaseAnalysisManager() = delete;
0048     virtual ~G4BaseAnalysisManager() = default;
0049 
0050     // The ids of objects are generated automatically
0051     // starting from 0; with the following function it is possible to
0052     // change the first Id to start from other value
0053     G4bool SetFirstId(G4int firstId);
0054     void  SetLockFirstId(G4bool lockFirstId);
0055 
0056     // Access method
0057     G4int GetFirstId() const;
0058     G4int GetCycle() const;
0059 
0060   protected:
0061     // Methods for verbose
0062     G4bool IsVerbose(G4int verboseLevel) const;
0063     void Message(G4int level,
0064                  const G4String& action,
0065                  const G4String& objectType,
0066                  const G4String& objectName = "",
0067                  G4bool success = true) const;
0068 
0069     // Data members
0070     const G4AnalysisManagerState& fState;
0071     G4int    fFirstId { 0 };
0072     G4bool   fLockFirstId { false };
0073 
0074   private:
0075     // Static data members
0076     static constexpr std::string_view fkClass { "G4BaseAnalysisManager" };
0077 };
0078 
0079 // inline functions
0080 
0081 inline G4bool G4BaseAnalysisManager::IsVerbose(G4int verboseLevel) const
0082 { return fState.IsVerbose(verboseLevel); }
0083 
0084 inline void G4BaseAnalysisManager::Message(
0085   G4int level, const G4String& action, const G4String& objectType,
0086   const G4String& objectName, G4bool success) const
0087 {
0088   fState.Message(level, action, objectType, objectName, success);
0089 }
0090 
0091 inline void G4BaseAnalysisManager::SetLockFirstId(G4bool lockFirstId) {
0092   fLockFirstId = lockFirstId;
0093 }
0094 
0095 inline G4int G4BaseAnalysisManager::GetFirstId() const {
0096   return fFirstId;
0097 }
0098 
0099 inline G4int G4BaseAnalysisManager::GetCycle() const {
0100   return fState.GetCycle();
0101 }
0102 
0103 #endif
0104