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