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.5 2007/05/24 13:17:41 vnivanch Exp $ |
---|
27 | // GEANT4 tag $Name: $ |
---|
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(); |
---|
69 | |
---|
70 | ~Histo(); |
---|
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 | |
---|
82 | void setHisto1D(G4int, G4int, G4double, G4double, G4double); |
---|
83 | // It change bins and boundaries |
---|
84 | |
---|
85 | void fill(G4int, G4double, G4double); |
---|
86 | // Histogramms are filled |
---|
87 | |
---|
88 | void scale(G4int, G4double); |
---|
89 | |
---|
90 | void addTuple(const G4String&, const G4String&, const G4String&); |
---|
91 | // In this method nTuple is booked |
---|
92 | |
---|
93 | void fillTuple(const G4String&, G4double); |
---|
94 | // Fill nTuple parameter |
---|
95 | |
---|
96 | void addRow(); |
---|
97 | // Save tuple event |
---|
98 | |
---|
99 | void setFileName(const G4String&); |
---|
100 | |
---|
101 | void setFileType(const G4String&); |
---|
102 | |
---|
103 | private: |
---|
104 | |
---|
105 | G4String histName; |
---|
106 | G4String histType; |
---|
107 | G4String tupleName; |
---|
108 | G4String tupleId; |
---|
109 | G4String tupleList; |
---|
110 | G4int nHisto; |
---|
111 | G4int verbose; |
---|
112 | G4int defaultAct; |
---|
113 | |
---|
114 | std::vector<AIDA::IHistogram1D*> histo; |
---|
115 | AIDA::IAnalysisFactory* af; |
---|
116 | AIDA::ITuple* ntup; |
---|
117 | AIDA::ITree* tree; |
---|
118 | HistoMessenger* messenger; |
---|
119 | std::vector<G4int> active; |
---|
120 | std::vector<G4int> bins; |
---|
121 | std::vector<G4double> xmin; |
---|
122 | std::vector<G4double> xmax; |
---|
123 | std::vector<G4double> unit; |
---|
124 | std::vector<G4String> ids; |
---|
125 | std::vector<G4String> titles; |
---|
126 | }; |
---|
127 | |
---|
128 | #endif |
---|