Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:56:58

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 // G4TScoreHistFiller inline definitions
0027 //
0028 // Author: Makoto Asai, September 2020
0029 //---------------------------------------------------------------------
0030 
0031 template <typename T>
0032 void G4TScoreHistFiller<T>::CreateAnalysisManager()
0033 {
0034   // get/create analysis manager
0035   fAnalysisManager = T::Instance();
0036 
0037   fAnalysisManager->SetVerboseLevel(fVerboseLevel);
0038 }
0039 
0040 template <typename T>
0041 G4VScoreHistFiller* G4TScoreHistFiller<T>::CreateInstance() const
0042 {
0043   auto instance = new G4TScoreHistFiller();
0044   instance->SetVerboseLevel(fVerboseLevel);
0045 
0046   return instance;
0047 }
0048 
0049 template <typename T>
0050 void G4TScoreHistFiller<T>::SetVerboseLevel(G4int value)
0051 {
0052   fVerboseLevel = value;
0053   if (fAnalysisManager) {
0054     fAnalysisManager->SetVerboseLevel(value);
0055   }
0056 }
0057 
0058 template <typename T>
0059 void G4TScoreHistFiller<T>::FillH1(G4int id, G4double value, G4double weight)
0060 {
0061   if (! fAnalysisManager) {
0062     CreateAnalysisManager();
0063   }
0064 
0065   if (! CheckH1(id)) {
0066     G4ExceptionDescription description;
0067     description << "      "
0068                 << "Cannot fill histogram id=" << id << ". Histogram is not defined.";
0069     G4Exception("G4TScoreHistFiller<T>::FillH1", "Digits_hits_utils_001", JustWarning, description);
0070 
0071     return;
0072   }
0073 
0074   fAnalysisManager->FillH1(id, value, weight);
0075 
0076 #ifdef G4VERBOSE
0077   if (fVerboseLevel > 1) {
0078     G4cout << "--- done G4TScoreHistFiller<T>::FillH1 : id = " << id << G4endl;
0079   }
0080 #endif
0081 }
0082 
0083 template <typename T>
0084 void G4TScoreHistFiller<T>::FillH2(G4int id, G4double xvalue, G4double yvalue, G4double weight)
0085 {
0086   if (! fAnalysisManager) {
0087     CreateAnalysisManager();
0088   }
0089 
0090   if (! CheckH2(id)) {
0091     G4ExceptionDescription description;
0092     description << "      "
0093                 << "Cannot fill histogram id=" << id << ". Histogram is not defined.";
0094     G4Exception("G4TScoreHistFiller<T>::FillH2", "Digits_hits_utils_001", JustWarning, description);
0095 
0096     return;
0097   }
0098 
0099   fAnalysisManager->FillH2(id, xvalue, yvalue, weight);
0100 
0101 #ifdef G4VERBOSE
0102   if (fVerboseLevel > 1) {
0103     G4cout << "--- done G4TScoreHistFiller<T>::FillH2 : id = " << id << G4endl;
0104   }
0105 #endif
0106 }
0107 
0108 template <typename T>
0109 void G4TScoreHistFiller<T>::FillH3(
0110   G4int id, G4double xvalue, G4double yvalue, G4double zvalue, G4double weight)
0111 {
0112   if (! fAnalysisManager) {
0113     CreateAnalysisManager();
0114   }
0115 
0116   if (! CheckH3(id)) {
0117     G4ExceptionDescription description;
0118     description << "      "
0119                 << "Cannot fill histogram id=" << id << ". Histogram is not defined.";
0120     G4Exception("G4TScoreHistFiller<T>::FillH3", "Digits_hits_utils_001", JustWarning, description);
0121 
0122     return;
0123   }
0124 
0125   fAnalysisManager->FillH3(id, xvalue, yvalue, zvalue, weight);
0126 
0127 #ifdef G4VERBOSE
0128   if (fVerboseLevel > 1) {
0129     G4cout << "--- done G4TScoreHistFiller<T>::FillH3 : id = " << id << G4endl;
0130   }
0131 #endif
0132 }
0133 
0134 template <typename T>
0135 void G4TScoreHistFiller<T>::FillP1(G4int id, G4double xvalue, G4double yvalue, G4double weight)
0136 {
0137   if (! fAnalysisManager) {
0138     CreateAnalysisManager();
0139   }
0140 
0141   if (! CheckP1(id)) {
0142     G4ExceptionDescription description;
0143     description << "      "
0144                 << "Cannot fill histogram id=" << id << ". Histogram is not defined.";
0145     G4Exception("G4TScoreHistFiller<T>::FillP1", "Digits_hits_utils_001", JustWarning, description);
0146 
0147     return;
0148   }
0149 
0150   fAnalysisManager->FillP1(id, xvalue, yvalue, weight);
0151 
0152 #ifdef G4VERBOSE
0153   if (fVerboseLevel > 1) {
0154     G4cout << "--- done G4TScoreHistFiller<T>::FillP1 : id = " << id << G4endl;
0155   }
0156 #endif
0157 }
0158 
0159 template <typename T>
0160 void G4TScoreHistFiller<T>::FillP2(
0161   G4int id, G4double xvalue, G4double yvalue, G4double zvalue, G4double weight)
0162 {
0163   if (! fAnalysisManager) {
0164     CreateAnalysisManager();
0165   }
0166 
0167   if (! CheckP2(id)) {
0168     G4ExceptionDescription description;
0169     description << "      "
0170                 << "Cannot fill histogram id=" << id << ". Histogram is not defined.";
0171     G4Exception("G4TScoreHistFiller<T>::FillP2", "Digits_hits_utils_001", JustWarning, description);
0172 
0173     return;
0174   }
0175 
0176   fAnalysisManager->FillP2(id, xvalue, yvalue, zvalue, weight);
0177 
0178 #ifdef G4VERBOSE
0179   if (fVerboseLevel > 1) {
0180     G4cout << "--- done G4TScoreHistFiller<T>::FillP2 : id = " << id << G4endl;
0181   }
0182 #endif
0183 }
0184 
0185 template <typename T>
0186 G4bool G4TScoreHistFiller<T>::CheckH1(G4int id)
0187 {
0188   return (fAnalysisManager->GetH1(id) != nullptr);
0189 }
0190 
0191 template <typename T>
0192 G4bool G4TScoreHistFiller<T>::CheckH2(G4int id)
0193 {
0194   return (fAnalysisManager->GetH2(id) != nullptr);
0195 }
0196 
0197 template <typename T>
0198 G4bool G4TScoreHistFiller<T>::CheckH3(G4int id)
0199 {
0200   return (fAnalysisManager->GetH3(id) != nullptr);
0201 }
0202 
0203 template <typename T>
0204 G4bool G4TScoreHistFiller<T>::CheckP1(G4int id)
0205 {
0206   return (fAnalysisManager->GetP1(id) != nullptr);
0207 }
0208 
0209 template <typename T>
0210 G4bool G4TScoreHistFiller<T>::CheckP2(G4int id)
0211 {
0212   return (fAnalysisManager->GetP2(id) != nullptr);
0213 }