Download Geant4 User's Guide for Application Developers
Transcript
Analysis values, or via the const std::vector<G4double>& edges parameter (second function) representing the edges defined explicitly. The other parameters in both functions are optional and their meaning is explained in the subsection "HistogramsProperties". A two-dimensional (2D) histogram can be created with one of these two functions analogous to those for 1D histograms: G4int CreateH2(const G4int G4int const const const const const const G4String& name, const G4String& title, nxbins, G4double xmin, G4double xmax, nybins, G4double ymin, G4double ymax, G4String& xunitName = "none", G4String& yunitName = "none", G4String& xfcnName = "none", G4String& yfcnName = "none", G4String& xbinScheme = "linear", G4String& ybinScheme = "linear"); G4int CreateH2(const const const const const const const G4String& name, const G4String& title, std::vector<G4double>& xedges, std::vector<G4double>& yedges, G4String& xunitName = "none", G4String& yunitName = "none", G4String& xfcnName = "none", G4String& yfcnName = "none"); The meaning of parameters is the same as in the functions for 1D histograms, they are just applied in x and y dimensions. The histograms created with G4AnalysisManager get automatically attributed an integer identifier which value is returned from the "Create" function. The default start value is 0 and it is incremented by 1 for each next created histogram. The numbering of 2D histograms is independent from 1D histograms and so the first created 2D histogram identifier is equal to the start value even when several 1D histograms have been already created. The start histogram identifier value can be changed either with the SetFirstHistoId(G4int) method, which applies the new value to both 1D and 2D histogram types, or with the SetFirstH1Id(G4int) and SetFirstH2Id(G4int) methods, which apply the new value only to the relevant histogram type. The first method is demonstrated in the example. The histogram names "1", "2" in the demonstrated example are defined to correspond the histograms identifiers in a similar way as in extended/analysis/AnaEx01 example. This choice is however fully in hands of the user who can prefer longer and more meaningful names. All histograms created by G4AnalysisManager are automatically deleted with deleting the G4AnalysisManager object. 9.2.1.3. Functions for Configuring Histograms The properties of already created histograms can be changed with use of one of these two functions for 1D histograms: G4bool SetH1(G4int id, G4int nbins, G4double xmin, G4double xmax, const G4String& unitName = "none", const G4String& fcnName = "none", const G4String& binSchemeName = "linear"); G4bool SetH1(G4int id, const std::vector<G4double>& edges, const G4String& unitName = "none", const G4String& fcnName = "none"); and these two functions for 2D histograms: G4bool SetH1(G4int id, 310