Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:29:04

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 HistoManager.cc
0027 /// \brief Implementation of the HistoManager class
0028 
0029 #include "HistoManager.hh"
0030 
0031 #include "DetectorConstruction.hh"
0032 
0033 #include "G4RunManager.hh"
0034 #include "G4UnitsTable.hh"
0035 
0036 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0037 
0038 HistoManager::HistoManager() : fFileName("AuNP") {
0039   fpDetector = dynamic_cast<const DetectorConstruction *>(
0040     G4RunManager::GetRunManager()->GetUserDetectorConstruction());
0041   Book();
0042 }
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 void HistoManager::Book() const {
0047   // Create or get analysis manager
0048   G4AnalysisManager *analysisManager = G4AnalysisManager::Instance();
0049   analysisManager->SetDefaultFileType("root");
0050   analysisManager->SetFileName(fFileName);
0051   analysisManager->SetVerboseLevel(1);
0052   analysisManager->SetActivation(true);
0053 
0054   // Define histograms start values
0055   const G4String nameh1[] = {
0056     "h1Events",
0057     "h1Edep",
0058     "h1SecEnergyNP_charged",
0059     "h1SecEnergyNP_nutral",
0060     "h1SecEnergyNPSurf_charged",
0061     "h1SecEnergyNPSurf_nutral",
0062     "h1Sec_charged",
0063     "h1Sec_nutral",
0064     "h1Chem_0",
0065     "h1Chem_1",
0066     "h1Chem_2",
0067     "h1Chem_3",
0068     "h1Chem_4",
0069     "h1Chem_5",
0070     "h1Chem_6",
0071     "h1Chem_7",
0072     "h1IncEnergyNPSurf_Back",
0073     "h1IncEnergyNPSurf_Fowared"
0074   };
0075   const G4String nameh2[] = {"h2Edep", "h2SecEnergyAbs_charged", "h2SecEnergyAbs_nutral"};
0076 
0077   const G4String titleh1[] = {
0078     "Events",
0079     "Energy Deposit Distribution",
0080     "Secondary Energy in NP (charged)",
0081     "Secondary Energy in NP (nutral)",
0082     "Secondary Energy at NP Surface (charged)",
0083     "Secondary Energy at NP Surface (nutral)",
0084     "Number of Secondaries in Absorber (charged)",
0085     "Number of Secondaries in Absorber (nutral)",
0086     "Number of Chemical for ID=0 at 1 psec",
0087     "Number of Chemical for ID=1 at 1 psec",
0088     "Number of Chemical for ID=2 at 1 psec",
0089     "Number of Chemical for ID=3 at 1 psec",
0090     "Number of Chemical for ID=4 at 1 psec",
0091     "Number of Chemical for ID=5 at 1 psec",
0092     "Number of Chemical for ID=6 at 1 psec",
0093     "Number of Chemical for ID=7 at 1 psec",
0094     "Energy of Incident particle at backwared of GNP",
0095     "Energy of Incident particle at forwared of GNP"
0096   };
0097   const G4String titleh2[] = {
0098     "Energy Deposit Distribution",
0099     "Secondary Energy vs distance (charged)",
0100     "Secondary Energy vs distance (nutral)"
0101   };
0102 
0103   // for event counting
0104   constexpr G4int nbin_eve = 1;
0105   constexpr G4double vmin_eve = 0.;
0106   constexpr G4double vmax_eve = 1.;
0107 
0108   // for SecENP
0109   constexpr G4int nbin_senp = 1000;
0110   constexpr G4double vmin_senp = 1.;
0111   constexpr G4double vmax_senp = 1000000;
0112 
0113   const G4int NAzm = fpDetector->GetNReplicaAzm();
0114   G4int NR = fpDetector->GetNReplicaR();
0115   const G4double Rmin = fpDetector->GetNPRadius() / CLHEP::nm;
0116   const G4double Rmax = fpDetector->GetAbsRadius() / CLHEP::nm;
0117 
0118   const G4int Runit = static_cast<G4int>(Rmax - Rmin) / NR;
0119   NR = NR + static_cast<G4int>(Rmin / Runit);
0120 
0121   // for dose distribution
0122   const G4int nbinAzm = NAzm;
0123   constexpr G4double vminAzm = 0.;
0124   constexpr G4double vmaxAzm = 360;
0125   const G4int nbinR2D = NR;
0126   constexpr G4double vminR2D = 0.;
0127   constexpr G4double vmaxR2D = 1000.;
0128   const G4int nbinR = NR;
0129   constexpr G4double vminR_log = 10;
0130   const G4double vmaxR_log = Rmax;
0131 
0132   analysisManager->CreateH1(nameh1[0], titleh1[0], nbin_eve, vmin_eve, vmax_eve);
0133   analysisManager->CreateH1(nameh1[1], titleh1[1], nbinR, vminR_log, vmaxR_log, "none", "none",
0134                             "log");
0135   analysisManager->CreateH1(nameh1[2], titleh1[2], nbin_senp, vmin_senp, vmax_senp, "none", "none",
0136                             "log");
0137   analysisManager->CreateH1(nameh1[3], titleh1[3], nbin_senp, vmin_senp, vmax_senp, "none", "none",
0138                             "log");
0139   analysisManager->CreateH1(nameh1[4], titleh1[4], nbin_senp, vmin_senp, vmax_senp, "none", "none",
0140                             "log");
0141   analysisManager->CreateH1(nameh1[5], titleh1[5], nbin_senp, vmin_senp, vmax_senp, "none", "none",
0142                             "log");
0143   analysisManager->CreateH1(nameh1[6], titleh1[6], nbinR, vminR_log, vmaxR_log, "none", "none",
0144                             "log");
0145   analysisManager->CreateH1(nameh1[7], titleh1[7], nbinR, vminR_log, vmaxR_log, "none", "none",
0146                             "log");
0147   analysisManager->CreateH1(nameh1[16], titleh1[16], nbin_senp, vmin_senp, vmax_senp, "none",
0148                             "none", "log");
0149   analysisManager->CreateH1(nameh1[17], titleh1[17], nbin_senp, vmin_senp, vmax_senp, "none",
0150                             "none", "log");
0151   analysisManager->CreateH1(nameh1[8], titleh1[8], nbinR, vminR_log, vmaxR_log, "none", "none",
0152                             "log");
0153   analysisManager->CreateH1(nameh1[9], titleh1[9], nbinR, vminR_log, vmaxR_log, "none", "none",
0154                             "log");
0155   analysisManager->CreateH1(nameh1[10], titleh1[10], nbinR, vminR_log, vmaxR_log, "none", "none",
0156                             "log");
0157   analysisManager->CreateH1(nameh1[11], titleh1[11], nbinR, vminR_log, vmaxR_log, "none", "none",
0158                             "log");
0159   analysisManager->CreateH1(nameh1[12], titleh1[12], nbinR, vminR_log, vmaxR_log, "none", "none",
0160                             "log");
0161   analysisManager->CreateH1(nameh1[13], titleh1[13], nbinR, vminR_log, vmaxR_log, "none", "none",
0162                             "log");
0163   analysisManager->CreateH1(nameh1[14], titleh1[14], nbinR, vminR_log, vmaxR_log, "none", "none",
0164                             "log");
0165   analysisManager->CreateH1(nameh1[15], titleh1[15], nbinR, vminR_log, vmaxR_log, "none", "none",
0166                             "log");
0167 
0168   analysisManager->CreateH2(nameh2[0], titleh2[0], nbinAzm, vminAzm, vmaxAzm, nbinR2D, vminR2D,
0169                             vmaxR2D);
0170   analysisManager->CreateH2(nameh2[1], titleh2[1], nbinR2D, vminR2D, vmaxR2D, nbin_senp, vmin_senp,
0171                             vmax_senp, "none", "none", "none", "none", "linear", "log");
0172   analysisManager->CreateH2(nameh2[2], titleh2[2], nbinR2D, vminR2D, vmaxR2D, nbin_senp, vmin_senp,
0173                             vmax_senp, "none", "none", "none", "none", "linear", "log");
0174 
0175   analysisManager->SetH1Activation(0, true);
0176   analysisManager->SetH1Activation(1, true);
0177   analysisManager->SetH1Activation(2, true);
0178   analysisManager->SetH1Activation(3, true);
0179   analysisManager->SetH1Activation(4, true);
0180   analysisManager->SetH1Activation(5, true);
0181   analysisManager->SetH1Activation(6, true);
0182   analysisManager->SetH1Activation(7, true);
0183   analysisManager->SetH1Activation(8, true);
0184   analysisManager->SetH1Activation(9, true);
0185   analysisManager->SetH1Activation(10, true);
0186   analysisManager->SetH1Activation(11, true);
0187   analysisManager->SetH1Activation(12, true);
0188   analysisManager->SetH1Activation(13, true);
0189   analysisManager->SetH1Activation(14, true);
0190   analysisManager->SetH1Activation(15, true);
0191   analysisManager->SetH1Activation(16, true);
0192   analysisManager->SetH1Activation(17, true);
0193   analysisManager->SetH2Activation(0, true);
0194   analysisManager->SetH2Activation(1, true);
0195   analysisManager->SetH2Activation(2, true);
0196 }
0197 
0198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......