Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exrdmHisto.hh
Go to the documentation of this file.
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 //
28 //
29 
30 #ifndef exrdmHisto_h
31 #define exrdmHisto_h 1
32 
33 //---------------------------------------------------------------------------
34 //
35 // ClassName: exrdmHisto
36 //
37 // Description: Utility class to hold and manipulate histograms/nTuples
38 //
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
40 
41 #include "globals.hh"
42 #include <vector>
43 
44 #ifdef G4ANALYSIS_USE
45 namespace AIDA {
46  class IAnalysisFactory;
47  class ITree;
48  class ITuple;
49  class IHistogram1D;
50 }
51 #endif
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54 
55 #ifdef G4ANALYSIS_USE_ROOT
56 // Root classes
57 class TFile;
58 class TH1D;
59 class TNtuple;
60 #endif
61 
63 
65 {
66 
67 public:
68  exrdmHisto();
69 
70  ~exrdmHisto();
71 
72  void Book();
73  // Book predefined histogramms
74 
75  void Save();
76  // Save histogramms to file
77 
78  void Add1D(const G4String&, const G4String&, G4int nb=100, G4double x1=0.,
79  G4double x2=1., G4double u=1.);
80  // In this method histogramms are predefined
81 
83  // It change fBins and boundaries
84 
86  // exrdmHistogramms are filled
87 
88  void ScaleHisto(G4int, G4double);
89 
90  void AddTuple(const G4String&, const G4String&, const G4String&);
91  // In this method fNTuple is booked
92 
93  void FillTuple(G4int, const G4String&, G4double);
94  // Fill fNTuple parameter with a double
95 
96  void FillTuple(G4int, G4int, G4double);
97  // Fill fNTuple at a given col with a double
98  void FillTuple(G4int, const G4String&, G4String&);
99  // Fill fNTuple parameter with a string
100 
101  void FillTuple(G4int, const G4String&, G4bool);
102  // Fill fNTuple parameter with a bool
103 
104  void AddRow(G4int);
105  // Save tuple event
106 
107  void SetFileName(const G4String&);
108  const G4String& GetFileName() const;
109 
110  void SetFileType(const G4String&);
111  const G4String& FileType() const;
112 
113 private:
114 
115  G4String fHistName;
116  G4String fHistType;
117 
118  G4int fNHisto;
119  G4int fNTuple;
120  G4int fVerbose;
121  G4int fDefaultAct;
122 #ifdef G4ANALYSIS_USE
123  std::vector<AIDA::IHistogram1D*> fHisto;
124  std::vector<AIDA::ITuple*> fNtup;
125  AIDA::IAnalysisFactory* fAida;
126  AIDA::ITree* fTree;
127 #endif
128 
129 #ifdef G4ANALYSIS_USE_ROOT
130  TFile* fHfileROOT;
131  std::vector<TH1D*> fROOThisto;
132  std::vector<TNtuple*> fROOTntup;
133  std::vector< std::vector<float> > fRarray;
134  std::vector<G4int> fRcol;
135 #endif
136 
137  exrdmHistoMessenger* fMessenger;
138 
139  std::vector<G4int> fActive;
140  std::vector<G4int> fBins;
141  std::vector<G4double> fXmin;
142  std::vector<G4double> fXmax;
143  std::vector<G4double> fUnit;
144  std::vector<G4String> fIds;
145  std::vector<G4String> fTitles;
146  std::vector<G4String> fTupleName;
147  std::vector<G4String> fTupleId;
148  std::vector<G4String> fTupleList;
149  std::vector<G4String> fTupleListROOT;
150 };
151 
152 #endif