Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:27

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 common implementation for histograms managers.
0028 //
0029 // Author: Ivana Hrivnacova, 10/08/2022  (ivana@ipno.in2p3.fr)
0030 
0031 #ifndef G4VTBaseHnManager_h
0032 #define G4VTBaseHnManager_h 1
0033 
0034 #include "G4HnInformation.hh"
0035 #include "globals.hh"
0036 
0037 #include <vector>
0038 #include <memory>
0039 #include <array>
0040 
0041 class G4HnManager;
0042 
0043 template <unsigned int DIM>
0044 class G4VTBaseHnManager
0045 {
0046   // Disable using the object managers outside
0047   friend class G4VAnalysisManager;
0048   friend class G4VAnalysisReader;
0049 
0050   public:
0051     G4VTBaseHnManager() = default;
0052     virtual ~G4VTBaseHnManager() = default;
0053 
0054     // deleted copy constructor & assignment operator
0055     G4VTBaseHnManager(const G4VTBaseHnManager& rhs) = delete;
0056     G4VTBaseHnManager& operator=(const G4VTBaseHnManager& rhs) = delete;
0057 
0058     // Methods for handling histograms
0059     virtual G4int Create(const G4String& name, const G4String& title,
0060                const std::array<G4HnDimension, DIM>& bins,
0061                const std::array<G4HnDimensionInformation, DIM>& hnInfo) = 0;
0062 
0063     // virtual G4int Create(const G4String& name, const G4String& title,
0064     //            const std::array<std::vector<G4double>, DIM> edges,
0065     //            const std::array<G4HnDimensionInformation, DIM>& hnInfo) = 0;
0066 
0067     virtual G4bool Set(G4int id,
0068                const std::array<G4HnDimension, DIM>& bins,
0069                const std::array<G4HnDimensionInformation, DIM>& hnInfo) = 0;
0070 
0071     // virtual G4bool Set(G4int id,
0072     //            const std::array<std::vector<G4double>, DIM>& edges,
0073     //            const std::array<G4HnDimensionInformation, DIM>& hnInfo) = 0;
0074 
0075     virtual G4bool Scale(G4int id, G4double factor) = 0;
0076 
0077     // Methods to fill histograms
0078     virtual G4bool Fill(G4int id, std::array<G4double, DIM> value, G4double weight = 1.0) = 0;
0079 
0080     // Access methods
0081     virtual G4int  GetId(const G4String& name, G4bool warn = true) const = 0;
0082     virtual G4int  GetNofHns(G4bool onlyExisting) const = 0;
0083 
0084     // Access to bins parameters
0085     virtual G4int    GetNbins(unsigned int idim, G4int id) const = 0;
0086     virtual G4double GetMinValue(unsigned int idim, G4int id) const = 0;
0087     virtual G4double GetMaxValue(unsigned int idim, G4int id) const = 0;
0088     virtual G4double GetWidth(unsigned int idim, G4int id) const = 0;
0089 
0090     // Setters for attributes for plotting
0091     virtual G4bool SetTitle(G4int id, const G4String& title) = 0;
0092     virtual G4bool SetAxisTitle(unsigned int idim, G4int id, const G4String& title) = 0;
0093 
0094     // Access attributes for plotting
0095     virtual G4String GetTitle(G4int id) const = 0;
0096     virtual G4String GetAxisTitle(unsigned int idim, G4int id) const = 0;
0097 
0098     // Methods to list/print histograms
0099     virtual G4bool WriteOnAscii(std::ofstream& output) = 0;
0100     virtual G4bool List(std::ostream& output, G4bool onlyIfActive = true) = 0;
0101 
0102     // Methods to delete selected histograms
0103     virtual G4bool Delete(G4int id, G4bool keepSetting) = 0;
0104 
0105     virtual std::shared_ptr<G4HnManager> GetHnManager() = 0;
0106     virtual const std::shared_ptr<G4HnManager> GetHnManager() const = 0;
0107 };
0108 
0109 #endif