Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-01 07:50:29

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file Histo.hh
0027 /// \brief Definition of the Histo class
0028 
0029 #ifndef Histo_h
0030 #define Histo_h 1
0031 
0032 //---------------------------------------------------------------------------
0033 //
0034 // ClassName:   Histo
0035 //
0036 // Description: Utility class to hold and manipulate histograms/nTuples
0037 //
0038 // Author:      V.Ivanchenko 30/10/03
0039 //
0040 //----------------------------------------------------------------------------
0041 //
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0044 
0045 #include "G4DataVector.hh"
0046 #include "globals.hh"
0047 
0048 #include <vector>
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0051 
0052 class G4RootAnalysisManager;
0053 class HistoMessenger;
0054 
0055 class Histo
0056 {
0057   public:
0058     Histo();
0059 
0060     ~Histo();
0061 
0062     // Book predefined histogramms
0063     void Book();
0064 
0065     // Save histogramms to file
0066     void Save();
0067 
0068     // In this method 1-D histogramms are predefined
0069     void Add1D(const G4String&, const G4String&, G4int nb, G4double x1, G4double x2,
0070                G4double u = 1.);
0071 
0072     // It change bins and boundaries
0073     void SetHisto1D(G4int, G4int, G4double, G4double, G4double);
0074 
0075     // Histogram activation/deactivation
0076     void Activate(G4int, G4bool);
0077 
0078     // Histogramms are filled
0079     void Fill(G4int, G4double, G4double);
0080 
0081     // Histogramms are scaled
0082     void ScaleH1(G4int, G4double);
0083 
0084     // In this method nTuple is booked
0085     void AddTuple(const G4String&);
0086 
0087     // In this method nTuple is booked
0088     void AddTupleI(const G4String&);
0089     void AddTupleF(const G4String&);
0090     void AddTupleD(const G4String&);
0091 
0092     // Fill nTuple parameter
0093     void FillTupleI(G4int, G4int);
0094     void FillTupleF(G4int, G4float);
0095     void FillTupleD(G4int, G4double);
0096 
0097     // Save tuple event
0098     void AddRow();
0099 
0100     // Set output file
0101     void SetFileName(const G4String&);
0102     void SetFileType(const G4String&);
0103 
0104     inline void SetVerbose(G4int val) { fVerbose = val; };
0105 
0106     inline G4bool IsActive() const { return fHistoActive; };
0107 
0108   private:
0109     G4RootAnalysisManager* fManager;
0110     HistoMessenger* fMessenger;
0111 
0112     G4String fHistName;
0113     G4String fHistType;
0114     G4String fTupleName;
0115     G4String fTupleTitle;
0116     G4int fNHisto;
0117     G4int fVerbose;
0118     G4bool fDefaultAct;
0119     G4bool fHistoActive;
0120     G4bool fNtupleActive;
0121 
0122     std::vector<G4int> fHisto;
0123     std::vector<G4int> fTupleI;
0124     std::vector<G4int> fTupleF;
0125     std::vector<G4int> fTupleD;
0126     std::vector<G4int> fBins;
0127     std::vector<G4bool> fActive;
0128     std::vector<G4double> fXmin;
0129     std::vector<G4double> fXmax;
0130     std::vector<G4double> fUnit;
0131     std::vector<G4String> fIds;
0132     std::vector<G4String> fTitles;
0133     std::vector<G4String> fNtupleI;
0134     std::vector<G4String> fNtupleF;
0135     std::vector<G4String> fNtupleD;
0136 };
0137 
0138 #endif