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