Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4HnManager.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // Class for management of G4HnInformation.
0028 // It implements functions handling the added H1/H2 information
0029 // (not available in g4tools).
0030 //
0031 // Author: Ivana Hrivnacova, 18/06/2013  (ivana@ipno.in2p3.fr)
0032 
0033 #ifndef G4HnManager_h
0034 #define G4HnManager_h 1
0035 
0036 #include "G4BaseAnalysisManager.hh"
0037 #include "G4HnInformation.hh"
0038 #include "globals.hh"
0039 
0040 #include <set>
0041 #include <string_view>
0042 #include <utility>
0043 #include <vector>
0044 
0045 class G4VFileManager;
0046 class G4HnMessenger;
0047 
0048 class G4HnManager : public G4BaseAnalysisManager
0049 {
0050   public:
0051     G4HnManager(G4String hnType, const G4AnalysisManagerState& state);
0052     G4HnManager() = delete;
0053     ~G4HnManager() override;
0054 
0055     void CreateMessenger();
0056 
0057     // Methods to manipulate additional information
0058     void AddHnInformation(G4HnInformation* info);
0059     void AddHnInformation(G4HnInformation* info, G4int index);
0060 
0061     void SetHnDeleted(G4HnInformation* info, G4bool keepSetting);
0062     void ClearData();
0063 
0064     // Access methofd
0065     G4HnInformation* GetHnInformation(G4int id,
0066                           std::string_view functionName,
0067                           G4bool warn = true) const;
0068 
0069     G4HnDimensionInformation* GetHnDimensionInformation(G4int id,
0070                           G4int dimension,
0071                           std::string_view functionName,
0072                           G4bool warn = true) const;
0073 
0074     const std::vector<G4HnInformation*>& GetHnVector() const;
0075     G4int GetNofActiveHns() const;
0076     G4String GetHnType() const;
0077 
0078     // Activation option
0079 
0080     // Return false if activation is enabled and there is no object activated,
0081     // return true otherwise
0082     G4bool IsActive() const;
0083 
0084     // ASCII option
0085 
0086     // Return false if there is no object selected for ASCII output,
0087     // return true otherwise
0088     G4bool IsAscii() const;
0089 
0090     // Plotting option
0091 
0092     // Return false if there is no object selected for plotting,
0093     // return true otherwise
0094     G4bool IsPlotting() const;
0095 
0096     // Return false if there is no object with a specific file name
0097     G4bool IsFileName() const;
0098 
0099     // Function implementing public analysis manager interface
0100     //
0101     void  SetActivation(G4bool activation);
0102     void  SetActivation(G4int id, G4bool activation);
0103     void  SetAscii(G4int id, G4bool ascii);
0104     void  SetPlotting(G4int id, G4bool plotting);
0105     void  SetPlotting(G4bool plotting);
0106     void  SetFileName(G4int id, const G4String& fileName);
0107     void  SetFileName(const G4String& fileName);
0108     G4bool  SetAxisIsLog(unsigned int idim, G4int id, G4bool isLogAxis);
0109 
0110 
0111     // Access to Hn additional information
0112     G4String GetName(G4int id) const;
0113     G4double GetUnit(unsigned int idim, G4int id) const;
0114     G4bool   GetAxisIsLog(unsigned int idim, G4int id) const;
0115     G4bool   GetActivation(G4int id) const;
0116     G4bool   GetAscii(G4int id) const;
0117     G4bool   GetPlotting(G4int id) const;
0118     G4String GetFileName(G4int id) const;
0119 
0120     void SetFileManager(std::shared_ptr<G4VFileManager> fileManager);
0121     void SetDefaultFileType(const G4String& fileType);
0122 
0123   private:
0124     // Methods
0125     void  SetActivation(G4HnInformation* info, G4bool activation);
0126     void  SetPlotting(G4HnInformation* info, G4bool plotting);
0127     void  SetFileName(G4HnInformation* info, const G4String& fileName);
0128 
0129     // Static data members
0130     static constexpr std::string_view fkClass { "G4HnManager" };
0131 
0132     // Data members
0133     G4String  fHnType;
0134     G4String  fDefaultFileType;
0135     G4int     fNofActiveObjects { 0 };
0136     G4int     fNofAsciiObjects { 0 };
0137     G4int     fNofPlottingObjects { 0 };
0138     G4int     fNofFileNameObjects { 0 };
0139 
0140     // Additional histograms/ntuple properties not included in tools
0141     std::vector<G4HnInformation*> fHnVector;
0142     std::set<G4int> fFreeIds;
0143     std::shared_ptr<G4VFileManager> fFileManager { nullptr };
0144 
0145     // Messenger
0146     std::unique_ptr<G4HnMessenger> fMessenger;
0147 };
0148 
0149 inline G4int G4HnManager::GetNofActiveHns() const
0150 { return fNofActiveObjects; }
0151 
0152 inline G4String G4HnManager::GetHnType() const
0153 { return fHnType; }
0154 
0155 inline const std::vector<G4HnInformation*>& G4HnManager::GetHnVector() const
0156 { return fHnVector; }
0157 
0158 inline void G4HnManager::SetFileManager(std::shared_ptr<G4VFileManager> fileManager)
0159 {
0160   fFileManager = std::move(fileManager);
0161 }
0162 
0163 inline void G4HnManager::SetDefaultFileType(const G4String& fileType)
0164 {
0165   fDefaultFileType = fileType;
0166 }
0167 
0168 #endif