source: trunk/examples/extended/radioactivedecay/exrdm/include/exrdmHisto.hh

Last change on this file was 1230, checked in by garnier, 15 years ago

update to geant4.9.3

File size: 4.4 KB
Line 
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
27#ifndef exrdmHisto_h
28#define exrdmHisto_h 1
29
30//---------------------------------------------------------------------------
31//
32// ClassName:   exrdmHisto
33//
34// Description: Utility class to hold and manipulate histograms/nTuples
35//
36//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
37
38#include "globals.hh"
39#include <vector>
40
41#ifdef G4ANALYSIS_USE
42namespace AIDA {
43 class IAnalysisFactory;
44 class ITree;
45 class ITuple;
46 class IHistogram1D;
47}
48#endif
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51
52#ifdef G4ANALYSIS_USE_ROOT
53// Root classes
54class TFile;
55class TH1D;
56class TNtuple;
57#endif
58
59class exrdmHistoMessenger;
60
61class exrdmHisto
62{
63
64public:
65  exrdmHisto();
66
67  ~exrdmHisto();
68
69  void book();
70  // Book predefined histogramms
71
72  void save();
73  // Save histogramms to file
74
75  void add1D(const G4String&, const G4String&, G4int nb=100, G4double x1=0., 
76                                               G4double x2=1., G4double u=1.);
77  // In this method histogramms are predefined
78
79  void setHisto1D(G4int, G4int, G4double, G4double, G4double);
80  // It change bins and boundaries
81
82  void fillHisto(G4int, G4double, G4double);
83  // exrdmHistogramms are filled
84
85  void scaleHisto(G4int, G4double);
86
87  void addTuple(const G4String&, const G4String&, const G4String&);
88  // In this method nTuple is booked
89
90  void fillTuple(G4int, const G4String&, G4double);
91  // Fill nTuple parameter with a double
92
93  void fillTuple(G4int, G4int, G4double);
94  // Fill nTuple at a given col with a double
95  void fillTuple(G4int, const G4String&, G4String&);
96  // Fill nTuple parameter with a string
97
98  void fillTuple(G4int, const G4String&, G4bool);
99  // Fill nTuple parameter with a bool
100
101  void addRow(G4int);
102  // Save tuple event
103
104  void setFileName(const G4String&);
105
106  void setFileType(const G4String&);
107  const G4String& FileType() const;
108
109private:
110
111  G4String histName;
112  G4String histType;
113
114  G4int    nHisto;
115  G4int    nTuple;
116  G4int    verbose;
117  G4int    defaultAct;
118#ifdef G4ANALYSIS_USE
119  std::vector<AIDA::IHistogram1D*> histo;
120  std::vector<AIDA::ITuple*>   ntup;
121  AIDA::IAnalysisFactory* aida;
122  AIDA::ITree*    tree;
123#endif
124
125#ifdef G4ANALYSIS_USE_ROOT
126  TFile* hfileROOT; 
127  std::vector<TH1D*> ROOThisto;
128  std::vector<TNtuple*>   ROOTntup;
129  std::vector< std::vector<float> > Rarray;
130  std::vector<G4int> Rcol;
131#endif
132
133  exrdmHistoMessenger* messenger;
134
135  std::vector<G4int>     active;
136  std::vector<G4int>     bins;
137  std::vector<G4double>  xmin;
138  std::vector<G4double>  xmax;
139  std::vector<G4double>  unit;
140  std::vector<G4String>  ids;
141  std::vector<G4String>  titles;
142  std::vector<G4String>  tupleName;
143  std::vector<G4String>  tupleId;
144  std::vector<G4String>  tupleList;
145  std::vector<G4String>  tupleListROOT; 
146};
147
148#endif
Note: See TracBrowser for help on using the repository browser.