2// ********************************************************************
3// * License and Disclaimer *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
28// This class implements filling histogram
29// In order to avoid introducing dependency on the analysis category,
30// the analysis manager type is defined via template.
32// Created : M. Asai (Sept. 2020)
37G4TScoreHistFiller<T>::G4TScoreHistFiller()
43G4TScoreHistFiller<T>::~G4TScoreHistFiller()
48void G4TScoreHistFiller<T>::CreateAnalysisManager()
50 // get/create analysis manager
51 fAnalysisManager = T::Instance();
53 fAnalysisManager->SetVerboseLevel(fVerboseLevel);
57G4VScoreHistFiller* G4TScoreHistFiller<T>::CreateInstance() const
59 auto instance = new G4TScoreHistFiller();
60 instance->SetVerboseLevel(fVerboseLevel);
66void G4TScoreHistFiller<T>::SetVerboseLevel(G4int value)
68 fVerboseLevel = value;
71 fAnalysisManager->SetVerboseLevel(value);
76void G4TScoreHistFiller<T>::FillH1(G4int id, G4double value, G4double weight)
80 CreateAnalysisManager();
85 G4ExceptionDescription description;
87 << "Cannot fill histogram id=" << id
88 << ". Histogram is not defined.";
89 G4Exception("G4TScoreHistFiller<T>::FillH1", "Digits_hits_utils_001",
90 JustWarning, description);
95 fAnalysisManager->FillH1(id, value, weight);
100 G4cout << "--- done G4TScoreHistFiller<T>::FillH1 : id = " << id << G4endl;
106void G4TScoreHistFiller<T>::FillH2(G4int id, G4double xvalue, G4double yvalue,
109 if(!fAnalysisManager)
111 CreateAnalysisManager();
116 G4ExceptionDescription description;
118 << "Cannot fill histogram id=" << id
119 << ". Histogram is not defined.";
120 G4Exception("G4TScoreHistFiller<T>::FillH2", "Digits_hits_utils_001",
121 JustWarning, description);
126 fAnalysisManager->FillH2(id, xvalue, yvalue, weight);
129 if(fVerboseLevel > 1)
131 G4cout << "--- done G4TScoreHistFiller<T>::FillH2 : id = " << id << G4endl;
137void G4TScoreHistFiller<T>::FillH3(G4int id, G4double xvalue, G4double yvalue,
138 G4double zvalue, G4double weight)
140 if(!fAnalysisManager)
142 CreateAnalysisManager();
147 G4ExceptionDescription description;
149 << "Cannot fill histogram id=" << id
150 << ". Histogram is not defined.";
151 G4Exception("G4TScoreHistFiller<T>::FillH3", "Digits_hits_utils_001",
152 JustWarning, description);
157 fAnalysisManager->FillH3(id, xvalue, yvalue, zvalue, weight);
160 if(fVerboseLevel > 1)
162 G4cout << "--- done G4TScoreHistFiller<T>::FillH3 : id = " << id << G4endl;
168void G4TScoreHistFiller<T>::FillP1(G4int id, G4double xvalue, G4double yvalue,
171 if(!fAnalysisManager)
173 CreateAnalysisManager();
178 G4ExceptionDescription description;
180 << "Cannot fill histogram id=" << id
181 << ". Histogram is not defined.";
182 G4Exception("G4TScoreHistFiller<T>::FillP1", "Digits_hits_utils_001",
183 JustWarning, description);
188 fAnalysisManager->FillP1(id, xvalue, yvalue, weight);
191 if(fVerboseLevel > 1)
193 G4cout << "--- done G4TScoreHistFiller<T>::FillP1 : id = " << id << G4endl;
199void G4TScoreHistFiller<T>::FillP2(G4int id, G4double xvalue, G4double yvalue,
200 G4double zvalue, G4double weight)
202 if(!fAnalysisManager)
204 CreateAnalysisManager();
209 G4ExceptionDescription description;
211 << "Cannot fill histogram id=" << id
212 << ". Histogram is not defined.";
213 G4Exception("G4TScoreHistFiller<T>::FillP2", "Digits_hits_utils_001",
214 JustWarning, description);
219 fAnalysisManager->FillP2(id, xvalue, yvalue, zvalue, weight);
222 if(fVerboseLevel > 1)
224 G4cout << "--- done G4TScoreHistFiller<T>::FillP2 : id = " << id << G4endl;
230G4bool G4TScoreHistFiller<T>::CheckH1(G4int id)
232 return (fAnalysisManager->GetH1(id) != nullptr);
236G4bool G4TScoreHistFiller<T>::CheckH2(G4int id)
238 return (fAnalysisManager->GetH2(id) != nullptr);
242G4bool G4TScoreHistFiller<T>::CheckH3(G4int id)
244 return (fAnalysisManager->GetH3(id) != nullptr);
248G4bool G4TScoreHistFiller<T>::CheckP1(G4int id)
250 return (fAnalysisManager->GetP1(id) != nullptr);
254G4bool G4TScoreHistFiller<T>::CheckP2(G4int id)
256 return (fAnalysisManager->GetP2(id) != nullptr);