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10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 
 27 // Class for management of G4HnInformation.
 28 // It implements functions handling the added H1/H2 information
 29 // (not available in g4tools).
 30 //
 31 // Author: Ivana Hrivnacova, 18/06/2013  (ivana@ipno.in2p3.fr)
 32 
 33 #ifndef G4HnManager_h
 34 #define G4HnManager_h 1
 35 
 36 #include "G4BaseAnalysisManager.hh"
 37 #include "G4HnInformation.hh"
 38 #include "globals.hh"
 39 
 40 #include <set>
 41 #include <string_view>
 42 #include <utility>
 43 #include <vector>
 44 
 45 class G4VFileManager;
 46 class G4HnMessenger;
 47 
 48 class G4HnManager : public G4BaseAnalysisManager
 49 {
 50   public:
 51     G4HnManager(G4String hnType, const G4AnalysisManagerState& state);
 52     G4HnManager() = delete;
 53     ~G4HnManager() override;
 54 
 55     void CreateMessenger();
 56 
 57     // Methods to manipulate additional information
 58     void AddHnInformation(G4HnInformation* info);
 59     void AddHnInformation(G4HnInformation* info, G4int index);
 60 
 61     void SetHnDeleted(G4HnInformation* info, G4bool keepSetting);
 62     void ClearData();
 63 
 64     // Access methofd
 65     G4HnInformation* GetHnInformation(G4int id,
 66                           std::string_view functionName,
 67                           G4bool warn = true) const;
 68 
 69     G4HnDimensionInformation* GetHnDimensionInformation(G4int id,
 70                           G4int dimension,
 71                           std::string_view functionName,
 72                           G4bool warn = true) const;
 73 
 74     const std::vector<G4HnInformation*>& GetHnVector() const;
 75     G4int GetNofActiveHns() const;
 76     G4String GetHnType() const;
 77 
 78     // Activation option
 79 
 80     // Return false if activation is enabled and there is no object activated,
 81     // return true otherwise
 82     G4bool IsActive() const;
 83 
 84     // ASCII option
 85 
 86     // Return false if there is no object selected for ASCII output,
 87     // return true otherwise
 88     G4bool IsAscii() const;
 89 
 90     // Plotting option
 91 
 92     // Return false if there is no object selected for plotting,
 93     // return true otherwise
 94     G4bool IsPlotting() const;
 95 
 96     // Return false if there is no object with a specific file name
 97     G4bool IsFileName() const;
 98 
 99     // Function implementing public analysis manager interface
100     //
101     void  SetActivation(G4bool activation);
102     void  SetActivation(G4int id, G4bool activation);
103     void  SetAscii(G4int id, G4bool ascii);
104     void  SetPlotting(G4int id, G4bool plotting);
105     void  SetPlotting(G4bool plotting);
106     void  SetFileName(G4int id, const G4String& fileName);
107     void  SetFileName(const G4String& fileName);
108     G4bool  SetAxisIsLog(unsigned int idim, G4int id, G4bool isLogAxis);
109 
110 
111     // Access to Hn additional information
112     G4String GetName(G4int id) const;
113     G4double GetUnit(unsigned int idim, G4int id) const;
114     G4bool   GetAxisIsLog(unsigned int idim, G4int id) const;
115     G4bool   GetActivation(G4int id) const;
116     G4bool   GetAscii(G4int id) const;
117     G4bool   GetPlotting(G4int id) const;
118     G4String GetFileName(G4int id) const;
119 
120     void SetFileManager(std::shared_ptr<G4VFileManager> fileManager);
121     void SetDefaultFileType(const G4String& fileType);
122 
123   private:
124     // Methods
125     void  SetActivation(G4HnInformation* info, G4bool activation);
126     void  SetPlotting(G4HnInformation* info, G4bool plotting);
127     void  SetFileName(G4HnInformation* info, const G4String& fileName);
128 
129     // Static data members
130     static constexpr std::string_view fkClass { "G4HnManager" };
131 
132     // Data members
133     G4String  fHnType;
134     G4String  fDefaultFileType;
135     G4int     fNofActiveObjects { 0 };
136     G4int     fNofAsciiObjects { 0 };
137     G4int     fNofPlottingObjects { 0 };
138     G4int     fNofFileNameObjects { 0 };
139 
140     // Additional histograms/ntuple properties not included in tools
141     std::vector<G4HnInformation*> fHnVector;
142     std::set<G4int> fFreeIds;
143     std::shared_ptr<G4VFileManager> fFileManager { nullptr };
144 
145     // Messenger
146     std::unique_ptr<G4HnMessenger> fMessenger;
147 };
148 
149 inline G4int G4HnManager::GetNofActiveHns() const
150 { return fNofActiveObjects; }
151 
152 inline G4String G4HnManager::GetHnType() const
153 { return fHnType; }
154 
155 inline const std::vector<G4HnInformation*>& G4HnManager::GetHnVector() const
156 { return fHnVector; }
157 
158 inline void G4HnManager::SetFileManager(std::shared_ptr<G4VFileManager> fileManager)
159 {
160   fFileManager = std::move(fileManager);
161 }
162 
163 inline void G4HnManager::SetDefaultFileType(const G4String& fileType)
164 {
165   fDefaultFileType = fileType;
166 }
167 
168 #endif
169