Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/extended/hadronic/FlukaCern/ProcessLevel/CrossSection/include/XSHistoManager.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 XSHistoManager.hh
0027 ///  \brief Create a set of profiles for XS study.
0028 //
0029 //  Adapted from hadronic/Hadr00/include/HistoManager.hh
0030 //  Author: G.Hugo, 06 January 2023
0031 //
0032 // ***************************************************************************
0033 //
0034 //      XSHistoManager
0035 //
0036 ///  Create a set of profiles for XS study.
0037 ///
0038 ///  All profiles are G4H1.
0039 ///  They are created and filled via G4VAnalysisManager.
0040 ///
0041 ///  The profiles can be dumped to all usual formats, including ROOT
0042 ///  (via G4VAnalysisManager).
0043 ///  An interesting added feature here, is that the plots, while being allocated
0044 ///  and filled via G4VAnalysisManager, are also dumped
0045 ///  in a Flair-compatible format (via tools::histo::flair).
0046 ///
0047 ///  NB: tools::histo::flair code, which allows the dump of any G4H1
0048 ///  into Flair-compatible format, is fully application-agnostic,
0049 ///  and is placed in FlukaCern/utils.
0050 ///  It could also be added as an extension of core G4 Analysis Manager.
0051 //
0052 // ***************************************************************************
0053 
0054 #ifndef XS_HISTO_MANAGER_HH
0055 #define XS_HISTO_MANAGER_HH
0056 
0057 #include "XSHistoManagerMessenger.hh"
0058 
0059 #include "G4SystemOfUnits.hh"
0060 #include "globals.hh"
0061 
0062 #include <unordered_map>
0063 
0064 class G4ParticleDefinition;
0065 class G4Element;
0066 class G4Material;
0067 class G4VAnalysisManager;
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 
0071 class XSHistoManager
0072 {
0073   public:
0074     XSHistoManager();
0075 
0076     void SetOutputFileName(const G4String& outputFileName);
0077     void SetParticle(const G4String& particleName);
0078     void SetElement(const G4String& elementName);
0079     void SetMaterial(const G4String& materialName);
0080     void SetNumberOfBins(const G4int numBins) { fNumBins = numBins; }
0081     void SetMinKinEnergy(const G4double minKineticEnergy) { fMinKineticEnergy = minKineticEnergy; }
0082     void SetMaxKinEnergy(const G4double maxKineticEnergy) { fMaxKineticEnergy = maxKineticEnergy; }
0083 
0084     void Book();
0085     void EndOfRun();
0086 
0087   private:
0088     void CheckInput();
0089     void DumpAllG4H1IntoRootFile() const;
0090     void DumpAllG4H1IntoFlairFile() const;
0091 
0092     XSHistoManagerMessenger* fMessenger = nullptr;
0093 
0094     G4String fOutputFileName = "all_XS";
0095     G4String fRootOutputFileName = "all_XS.root";
0096     G4String fFlairOutputFileName = "all_XS.hist";
0097     const G4ParticleDefinition* fParticle = nullptr;
0098     const G4Element* fElement = nullptr;
0099     const G4Material* fMaterial = nullptr;
0100     G4int fNumBins = 10000;
0101     G4double fMinKineticEnergy = 1. * keV;
0102     G4double fMaxKineticEnergy = 10. * TeV;
0103     G4String fFunctionName = "none";
0104     G4String fBinSchemeName = "log";
0105     G4String fRootEnergyUnit = "MeV";
0106 
0107     G4VAnalysisManager* fAnalysisManager = nullptr;
0108     std::unordered_map<G4int, G4int> fXSProfileIndex;  // key: XS index
0109                                                        // value: histo index from G4VAnalysisManager
0110 
0111     G4int fElasticXSIndex = 0;
0112     G4int fInelasticXSIndex = 1;
0113     G4int fCaptureXSIndex = 2;
0114     G4int fFissionXSIndex = 3;
0115     G4int fChargeExchangeXSIndex = 4;
0116     G4int fTotalXSIndex = 5;
0117     G4int fElasticPerVolumeXSIndex = 6;
0118     G4int fInelasticPerVolumeXSIndex = 7;
0119 };
0120 
0121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0122 
0123 #endif