Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-10 08:05:56

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 G4H1Wrapper.hh
0027 ///  \brief This allows statistics compatible with FLUKA.
0028 ///         It is fully relying on G4VAnalysisManager's G4H1.
0029 //
0030 //  Author: G.Hugo, 08 December 2022
0031 //
0032 // ***************************************************************************
0033 //
0034 //      G4H1Wrapper
0035 //
0036 ///  This allows event-level statistics.
0037 ///  This is necessary IN THIS SPECIFIC CASE ONLY, to be able to compare errors on results
0038 ///  with e.g. FLUKA, MCNP, PENELOPE, SERPENT, which all use an event-based error approach.
0039 ///
0040 ///  It is fully relying on G4VAnalysisManager's G4H1.
0041 ///  Collects info within an event, then flush it to G4VAnalysisManager's G4H1.
0042 //
0043 // ***************************************************************************
0044 
0045 #ifndef G4H1_WRAPPER_HH
0046 #define G4H1_WRAPPER_HH
0047 
0048 #include "g4hntools_defs.hh"
0049 #include "globals.hh"
0050 
0051 #include <vector>
0052 
0053 class G4VAnalysisManager;
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 class G4H1Wrapper
0058 {
0059   public:
0060     G4H1Wrapper(G4VAnalysisManager* const analysisManager, const G4int histoIndex);
0061 
0062     void Fill(const G4double abscissaValue, const G4double weight);
0063     void EndOfEvent();
0064 
0065     G4double GetSumSquaredEventTotals() const { return fSumSquaredEventTotals; }
0066     G4double GetSumSquaredEventInRangeTotals() const { return fSumSquaredEventInRangeTotals; }
0067     G4H1* GetG4H1() const { return fHisto; }  // RUN DATA (G4H1 from G4VAnalysisManager)
0068 
0069   private:
0070     G4VAnalysisManager* fAnalysisManager = nullptr;
0071     G4int fHistoIndex;
0072     G4H1* fHisto = nullptr;
0073     G4int fNumBins;
0074 
0075     G4bool fIsSet;
0076     G4double fUnderflow;
0077     G4double fOverflow;
0078     G4double fSumSquaredEventTotals;
0079     G4double fSumSquaredEventInRangeTotals;
0080     std::vector<G4double> fEventData;  // EVENT DATA (data stored on the fly WITHIN the event)
0081 };
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0084 
0085 #endif