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 | // $Id: Histo.hh,v 1.6 2007/05/24 13:52:31 vnivanch Exp $ |
---|
27 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
28 | |
---|
29 | #ifndef Histo_h |
---|
30 | #define Histo_h 1 |
---|
31 | |
---|
32 | //--------------------------------------------------------------------------- |
---|
33 | // |
---|
34 | // ClassName: Histo |
---|
35 | // |
---|
36 | // Description: Utility class to hold and manipulate histograms/nTuples |
---|
37 | // |
---|
38 | // Author: V.Ivanchenko 30/10/03 |
---|
39 | // |
---|
40 | //---------------------------------------------------------------------------- |
---|
41 | // |
---|
42 | |
---|
43 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
44 | |
---|
45 | #include "globals.hh" |
---|
46 | #include <vector> |
---|
47 | #include "G4DynamicParticle.hh" |
---|
48 | #include "G4VPhysicalVolume.hh" |
---|
49 | #include "G4DataVector.hh" |
---|
50 | #include "G4Track.hh" |
---|
51 | |
---|
52 | |
---|
53 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
54 | |
---|
55 | class HistoMessenger; |
---|
56 | |
---|
57 | namespace AIDA { |
---|
58 | class ITree; |
---|
59 | class ITuple; |
---|
60 | class IHistogram1D; |
---|
61 | class IAnalysisFactory; |
---|
62 | } |
---|
63 | |
---|
64 | class Histo |
---|
65 | { |
---|
66 | |
---|
67 | public: |
---|
68 | Histo(G4int ver); |
---|
69 | |
---|
70 | ~Histo(); |
---|
71 | |
---|
72 | void book(); |
---|
73 | // Book predefined histogramms |
---|
74 | |
---|
75 | void save(); |
---|
76 | // Save histogramms to file |
---|
77 | |
---|
78 | void reset(); |
---|
79 | // Reset histogramms |
---|
80 | |
---|
81 | void add1D(const G4String&, const G4String&, G4int nb=100, G4double x1=0., |
---|
82 | G4double x2=1., G4double u=1.); |
---|
83 | // In this method histogramms are predefined |
---|
84 | |
---|
85 | void setHisto1D(G4int, G4int, G4double, G4double, G4double); |
---|
86 | // It change bins and boundaries |
---|
87 | |
---|
88 | void fill(G4int, G4double, G4double); |
---|
89 | // Histogramms are filled |
---|
90 | |
---|
91 | void scale(G4int, G4double); |
---|
92 | |
---|
93 | void addTuple(const G4String&, const G4String&, const G4String&); |
---|
94 | // In this method nTuple is booked |
---|
95 | |
---|
96 | void fillTuple(const G4String&, G4double); |
---|
97 | // Fill nTuple parameter |
---|
98 | |
---|
99 | void addRow(); |
---|
100 | // Save tuple event |
---|
101 | |
---|
102 | void setFileName(const G4String& nam) {histName = nam;}; |
---|
103 | |
---|
104 | void setFileOption(const G4String& nam) {option = nam;}; |
---|
105 | |
---|
106 | void setFileType(const G4String& nam); |
---|
107 | |
---|
108 | void print(G4int i); |
---|
109 | |
---|
110 | void setVerbose(G4int val) {verbose = val;}; |
---|
111 | |
---|
112 | private: |
---|
113 | |
---|
114 | G4String histName; |
---|
115 | G4String histType; |
---|
116 | G4String option; |
---|
117 | G4String tupleName; |
---|
118 | G4String tupleId; |
---|
119 | G4String tupleList; |
---|
120 | G4int nHisto; |
---|
121 | G4int verbose; |
---|
122 | G4int defaultAct; |
---|
123 | |
---|
124 | std::vector<AIDA::IHistogram1D*> histo; |
---|
125 | AIDA::IAnalysisFactory* af; |
---|
126 | AIDA::ITuple* ntup; |
---|
127 | AIDA::ITree* tree; |
---|
128 | HistoMessenger* messenger; |
---|
129 | std::vector<G4int> active; |
---|
130 | std::vector<G4int> bins; |
---|
131 | std::vector<G4double> xmin; |
---|
132 | std::vector<G4double> xmax; |
---|
133 | std::vector<G4double> unit; |
---|
134 | std::vector<G4String> ids; |
---|
135 | std::vector<G4String> tittles; |
---|
136 | }; |
---|
137 | |
---|
138 | #endif |
---|