Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:05

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 electromagnetic/TestEm9/include/Histo.hh
0027 /// \brief Definition of the Histo class
0028 //
0029 
0030 #ifndef Histo_h
0031 #define Histo_h 1
0032 
0033 //---------------------------------------------------------------------------
0034 //
0035 // ClassName:   Histo
0036 //
0037 // Description: Utility class to hold and manipulate histograms/nTuples
0038 //
0039 // Author:      V.Ivanchenko 30/10/03
0040 //
0041 //----------------------------------------------------------------------------
0042 //
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0045 
0046 #include "G4DataVector.hh"
0047 #include "globals.hh"
0048 
0049 #include <vector>
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0052 
0053 class G4RootAnalysisManager;
0054 class HistoMessenger;
0055 
0056 class Histo
0057 {
0058   public:
0059     Histo();
0060 
0061     ~Histo();
0062 
0063     // Book predefined histogramms
0064     void Book();
0065 
0066     // Save histogramms to file
0067     void Save();
0068 
0069     // In this method 1-D histogramms are predefined
0070     void Add1D(const G4String&, const G4String&, G4int nb, G4double x1, G4double x2,
0071                G4double u = 1.);
0072 
0073     // It change bins and boundaries
0074     void SetHisto1D(G4int, G4int, G4double, G4double, G4double);
0075 
0076     // Histogram activation/deactivation
0077     void Activate(G4int, G4bool);
0078 
0079     // Histogramms are filled
0080     void Fill(G4int, G4double, G4double);
0081 
0082     // Histogramms are scaled
0083     void ScaleH1(G4int, G4double);
0084 
0085     // In this method nTuple is booked
0086     void AddTuple(const G4String&);
0087 
0088     // In this method nTuple is booked
0089     void AddTupleI(const G4String&);
0090     void AddTupleF(const G4String&);
0091     void AddTupleD(const G4String&);
0092 
0093     // Fill nTuple parameter
0094     void FillTupleI(G4int, G4int);
0095     void FillTupleF(G4int, G4float);
0096     void FillTupleD(G4int, G4double);
0097 
0098     // Save tuple event
0099     void AddRow();
0100 
0101     // Set output file
0102     void SetFileName(const G4String&);
0103     void SetFileType(const G4String&);
0104 
0105     inline void SetVerbose(G4int val) { fVerbose = val; };
0106 
0107     inline G4bool IsActive() const { return fHistoActive; };
0108 
0109   private:
0110     G4RootAnalysisManager* fManager;
0111     HistoMessenger* fMessenger;
0112 
0113     G4String fHistName;
0114     G4String fHistType;
0115     G4String fTupleName;
0116     G4String fTupleTitle;
0117     G4int fNHisto;
0118     G4int fVerbose;
0119     G4bool fDefaultAct;
0120     G4bool fHistoActive;
0121     G4bool fNtupleActive;
0122 
0123     std::vector<G4int> fHisto;
0124     std::vector<G4int> fTupleI;
0125     std::vector<G4int> fTupleF;
0126     std::vector<G4int> fTupleD;
0127     std::vector<G4int> fBins;
0128     std::vector<G4bool> fActive;
0129     std::vector<G4double> fXmin;
0130     std::vector<G4double> fXmax;
0131     std::vector<G4double> fUnit;
0132     std::vector<G4String> fIds;
0133     std::vector<G4String> fTitles;
0134     std::vector<G4String> fNtupleI;
0135     std::vector<G4String> fNtupleF;
0136     std::vector<G4String> fNtupleD;
0137 };
0138 
0139 #endif