Geant4  10.01.p02
Histo.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 // $Id: Histo.hh 66241 2012-12-13 18:34:42Z gunter $
30 
31 #ifndef Histo_h
32 #define Histo_h 1
33 
34 //---------------------------------------------------------------------------
35 //
36 // ClassName: Histo
37 //
38 // Description: Utility class to hold and manipulate histograms/nTuples
39 //
40 // Author: V.Ivanchenko 30/10/03
41 //
42 //----------------------------------------------------------------------------
43 //
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46 
47 #include "globals.hh"
48 #include "G4DataVector.hh"
49 #include <vector>
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52 
54 class HistoMessenger;
55 
56 class Histo
57 {
58 public:
59 
60  Histo();
61 
62  ~Histo();
63 
64  // Book predefined histogramms
65  void Book();
66 
67  // Save histogramms to file
68  void Save();
69 
70  // In this method 1-D histogramms are predefined
71  void Add1D(const G4String&, const G4String&, G4int nb, G4double x1,
72  G4double x2, G4double u=1.);
73 
74  // It change bins and boundaries
76 
77  // Histogram activation/deactivation
78  void Activate(G4int, G4bool);
79 
80  // Histogramms are filled
81  void Fill(G4int, G4double, G4double);
82 
83  // Histogramms are scaled
84  void ScaleH1(G4int, G4double);
85 
86  // In this method nTuple is booked
87  void AddTuple(const G4String&);
88 
89  // In this method nTuple is booked
90  void AddTupleI(const G4String&);
91  void AddTupleF(const G4String&);
92  void AddTupleD(const G4String&);
93 
94  // Fill nTuple parameter
95  void FillTupleI(G4int, G4int);
96  void FillTupleF(G4int, G4float);
97  void FillTupleD(G4int, G4double);
98 
99  // Save tuple event
100  void AddRow();
101 
102  // Set output file
103  void SetFileName(const G4String&);
104  void SetFileType(const G4String&);
105 
106  inline void SetVerbose(G4int val) { fVerbose = val; };
107 
108  inline G4bool IsActive() const { return fHistoActive; };
109 
110 private:
111 
114 
119  G4int fNHisto;
120  G4int fVerbose;
124 
125  std::vector<G4int> fHisto;
126  std::vector<G4int> fTupleI;
127  std::vector<G4int> fTupleF;
128  std::vector<G4int> fTupleD;
129  std::vector<G4int> fBins;
130  std::vector<G4bool> fActive;
131  std::vector<G4double> fXmin;
132  std::vector<G4double> fXmax;
133  std::vector<G4double> fUnit;
134  std::vector<G4String> fIds;
135  std::vector<G4String> fTitles;
136  std::vector<G4String> fNtupleI;
137  std::vector<G4String> fNtupleF;
138  std::vector<G4String> fNtupleD;
139 
140 };
141 
142 #endif
void AddTupleD(const G4String &)
Definition: Histo.cc:279
void AddTuple(const G4String &)
Definition: Histo.cc:254
~Histo()
Definition: Histo.cc:70
void AddTupleI(const G4String &)
Definition: Histo.cc:261
Definition: Histo.hh:56
Histo()
Definition: Histo.cc:51
float G4float
Definition: G4Types.hh:77
G4bool fHistoActive
Definition: Histo.hh:122
std::vector< G4int > fTupleF
Definition: Histo.hh:127
G4int fNHisto
Definition: Histo.hh:119
std::vector< G4int > fTupleD
Definition: Histo.hh:128
std::vector< G4String > fNtupleI
Definition: Histo.hh:136
void Activate(G4int, G4bool)
Definition: Histo.cc:207
std::vector< G4bool > fActive
Definition: Histo.hh:130
void Book()
Definition: Histo.cc:78
int G4int
Definition: G4Types.hh:78
G4String fTupleName
Definition: Histo.hh:117
std::vector< G4String > fIds
Definition: Histo.hh:134
std::vector< G4String > fTitles
Definition: Histo.hh:135
void Fill(G4int, G4double, G4double)
Definition: Histo.cc:221
G4bool fDefaultAct
Definition: Histo.hh:121
std::vector< G4double > fXmin
Definition: Histo.hh:131
void FillTupleF(G4int, G4float)
Definition: Histo.cc:306
std::vector< G4String > fNtupleD
Definition: Histo.hh:138
HistoMessenger * fMessenger
Definition: Histo.hh:113
bool G4bool
Definition: G4Types.hh:79
void ScaleH1(G4int, G4double)
Definition: Histo.cc:238
void Add1D(const G4String &, const G4String &, G4int nb, G4double x1, G4double x2, G4double u=1.)
Definition: Histo.cc:161
std::vector< G4int > fBins
Definition: Histo.hh:129
std::vector< G4int > fTupleI
Definition: Histo.hh:126
std::vector< G4String > fNtupleF
Definition: Histo.hh:137
std::vector< G4double > fUnit
Definition: Histo.hh:133
void SetVerbose(G4int val)
Definition: Histo.hh:106
G4bool IsActive() const
Definition: Histo.hh:108
void AddTupleF(const G4String &)
Definition: Histo.cc:270
void SetHisto1D(G4int, G4int, G4double, G4double, G4double)
Definition: Histo.cc:185
G4int fVerbose
Definition: Histo.hh:120
void FillTupleD(G4int, G4double)
Definition: Histo.cc:324
G4String fHistType
Definition: Histo.hh:116
G4String fHistName
Definition: Histo.hh:115
void AddRow()
Definition: Histo.cc:342
std::vector< G4int > fHisto
Definition: Histo.hh:125
void SetFileType(const G4String &)
Definition: Histo.cc:358
double G4double
Definition: G4Types.hh:76
G4String fTupleTitle
Definition: Histo.hh:118
G4RootAnalysisManager * fManager
Definition: Histo.hh:108
void FillTupleI(G4int, G4int)
Definition: Histo.cc:288
void Save()
Definition: Histo.cc:137
G4bool fNtupleActive
Definition: Histo.hh:123
void SetFileName(const G4String &)
Definition: Histo.cc:350
std::vector< G4double > fXmax
Definition: Histo.hh:132