Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
|
||||
#ifndef G4TScoreHistFiller_h
|
||||
#define G4TScoreHistFiller_h 1
|
||||
|
||||
#include "G4VScoreHistFiller.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <memory>
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This class implements filling histogram
|
||||
// In order to avoid introducing dependency on the analysis category,
|
||||
// the analysis manager type is defined via template.
|
||||
//
|
||||
// Created : M. Asai (Sept. 2020)
|
||||
//
|
||||
|
||||
template <typename T>
|
||||
class G4TScoreHistFiller : public G4VScoreHistFiller
|
||||
{
|
||||
public:
|
||||
G4TScoreHistFiller();
|
||||
virtual ~G4TScoreHistFiller();
|
||||
|
||||
// methods
|
||||
virtual void FillH1(G4int id, G4double value, G4double weight = 1.0);
|
||||
virtual void FillH2(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double weight = 1.0);
|
||||
virtual void FillH3(G4int id,
|
||||
G4double xvalue, G4double yvalue, G4double zvalue,
|
||||
G4double weight = 1.0);
|
||||
virtual void FillP1(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double weight = 1.0);
|
||||
virtual void FillP2(G4int id,
|
||||
G4double xvalue, G4double yvalue, G4double zvalue,
|
||||
G4double weight = 1.0);
|
||||
|
||||
virtual G4bool CheckH1(G4int id);
|
||||
virtual G4bool CheckH2(G4int id);
|
||||
virtual G4bool CheckH3(G4int id);
|
||||
virtual G4bool CheckP1(G4int id);
|
||||
virtual G4bool CheckP2(G4int id);
|
||||
|
||||
void SetVerboseLevel(G4int value);
|
||||
G4int GetVerboseLevel() const
|
||||
{ return fVerboseLevel; }
|
||||
|
||||
protected:
|
||||
// methods
|
||||
virtual G4VScoreHistFiller* CreateInstance() const;
|
||||
|
||||
private:
|
||||
// methods
|
||||
void CreateAnalysisManager();
|
||||
|
||||
// data members
|
||||
T* fAnalysisManager = nullptr;
|
||||
G4int fVerboseLevel = 0;
|
||||
G4bool fHasAnalysisManager = false;
|
||||
G4bool fIsInitialized = false;
|
||||
};
|
||||
|
||||
#include "G4TScoreHistFiller.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,228 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// class description:
|
||||
//
|
||||
// This class implements filling histogram
|
||||
// In order to avoid introducing dependency on the analysis category,
|
||||
// the analysis manager type is defined via template.
|
||||
//
|
||||
// Created : M. Asai (Sept. 2020)
|
||||
//
|
||||
//
|
||||
|
||||
template <typename T>
|
||||
G4TScoreHistFiller<T>::G4TScoreHistFiller()
|
||||
{;}
|
||||
|
||||
template <typename T>
|
||||
G4TScoreHistFiller<T>::~G4TScoreHistFiller()
|
||||
{
|
||||
if( fHasAnalysisManager )
|
||||
{ delete fAnalysisManager; }
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void G4TScoreHistFiller<T>::CreateAnalysisManager()
|
||||
{
|
||||
// create analysis manager
|
||||
if( ! T::IsInstance() ) fHasAnalysisManager = true;
|
||||
fAnalysisManager = T::Instance();
|
||||
|
||||
fAnalysisManager->SetVerboseLevel(fVerboseLevel);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
G4VScoreHistFiller* G4TScoreHistFiller<T>::CreateInstance() const
|
||||
{
|
||||
auto instance = new G4TScoreHistFiller();
|
||||
instance->SetVerboseLevel(fVerboseLevel);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void G4TScoreHistFiller<T>::SetVerboseLevel(G4int value)
|
||||
{
|
||||
fVerboseLevel = value;
|
||||
if( fAnalysisManager ) {
|
||||
fAnalysisManager->SetVerboseLevel(value);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void G4TScoreHistFiller<T>::FillH1(G4int id, G4double value, G4double weight)
|
||||
{
|
||||
if( !fAnalysisManager )
|
||||
{ CreateAnalysisManager(); }
|
||||
|
||||
if( ! CheckH1(id) ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
|
||||
G4Exception("G4TScoreHistFiller<T>::FillH1",
|
||||
"Digits_hits_utils_001", JustWarning, description);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fAnalysisManager->FillH1(id, value, weight);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- done G4TScoreHistFiller<T>::FillH1 : id = " << id << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void G4TScoreHistFiller<T>::FillH2(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double weight)
|
||||
{
|
||||
if( !fAnalysisManager )
|
||||
{ CreateAnalysisManager(); }
|
||||
|
||||
if( ! CheckH2(id) ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
|
||||
G4Exception("G4TScoreHistFiller<T>::FillH2",
|
||||
"Digits_hits_utils_001", JustWarning, description);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fAnalysisManager->FillH2(id, xvalue, yvalue, weight);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- done G4TScoreHistFiller<T>::FillH2 : id = " << id << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void G4TScoreHistFiller<T>::FillH3(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double zvalue, G4double weight)
|
||||
{
|
||||
if( !fAnalysisManager )
|
||||
{ CreateAnalysisManager(); }
|
||||
|
||||
if( ! CheckH3(id) ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
|
||||
G4Exception("G4TScoreHistFiller<T>::FillH3",
|
||||
"Digits_hits_utils_001", JustWarning, description);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fAnalysisManager->FillH3(id, xvalue, yvalue, zvalue, weight);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- done G4TScoreHistFiller<T>::FillH3 : id = " << id << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void G4TScoreHistFiller<T>::FillP1(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double weight)
|
||||
{
|
||||
if( !fAnalysisManager )
|
||||
{ CreateAnalysisManager(); }
|
||||
|
||||
if( ! CheckP1(id) ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
|
||||
G4Exception("G4TScoreHistFiller<T>::FillP1",
|
||||
"Digits_hits_utils_001", JustWarning, description);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fAnalysisManager->FillP1(id, xvalue, yvalue, weight);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- done G4TScoreHistFiller<T>::FillP1 : id = " << id << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void G4TScoreHistFiller<T>::FillP2(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double zvalue, G4double weight)
|
||||
{
|
||||
if( !fAnalysisManager )
|
||||
{ CreateAnalysisManager(); }
|
||||
|
||||
if( ! CheckP2(id) ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "Cannot fill histogram id=" << id << ". Histogram is not defined.";
|
||||
G4Exception("G4TScoreHistFiller<T>::FillP2",
|
||||
"Digits_hits_utils_001", JustWarning, description);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fAnalysisManager->FillP2(id, xvalue, yvalue, zvalue, weight);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerboseLevel > 1 ) {
|
||||
G4cout << "--- done G4TScoreHistFiller<T>::FillP2 : id = " << id << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
G4bool G4TScoreHistFiller<T>::CheckH1(G4int id)
|
||||
{ return (fAnalysisManager->GetH1(id) != nullptr); }
|
||||
|
||||
template <typename T>
|
||||
G4bool G4TScoreHistFiller<T>::CheckH2(G4int id)
|
||||
{ return (fAnalysisManager->GetH2(id) != nullptr); }
|
||||
|
||||
template <typename T>
|
||||
G4bool G4TScoreHistFiller<T>::CheckH3(G4int id)
|
||||
{ return (fAnalysisManager->GetH3(id) != nullptr); }
|
||||
|
||||
template <typename T>
|
||||
G4bool G4TScoreHistFiller<T>::CheckP1(G4int id)
|
||||
{ return (fAnalysisManager->GetP1(id) != nullptr); }
|
||||
|
||||
template <typename T>
|
||||
G4bool G4TScoreHistFiller<T>::CheckP2(G4int id)
|
||||
{ return (fAnalysisManager->GetP2(id) != nullptr); }
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef G4VPrimitivePlotter_H
|
||||
#define G4VPrimitivePlotter_H 1
|
||||
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
#include <map>
|
||||
|
||||
class G4VPrimitivePlotter : public G4VPrimitiveScorer
|
||||
{
|
||||
public: // with description
|
||||
G4VPrimitivePlotter(G4String name, G4int depth=0)
|
||||
:G4VPrimitiveScorer(name,depth)
|
||||
{;}
|
||||
virtual ~G4VPrimitivePlotter()
|
||||
{;}
|
||||
|
||||
public:
|
||||
void Plot(G4int copyNo,G4int histID)
|
||||
{ hitIDMap[copyNo] = histID; }
|
||||
|
||||
protected:
|
||||
std::map<G4int,G4int> hitIDMap;
|
||||
|
||||
public:
|
||||
G4int GetNumberOfHist() const
|
||||
{ return hitIDMap.size(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Class G4VScoreHistFiller
|
||||
//
|
||||
// Class description:
|
||||
// Abstract base class that defines functions to fill histogram and
|
||||
// profile plot. This class avoids the direct dependency to G4Analysis
|
||||
// category. Template class G4TScoreHistFiller should be used by the
|
||||
// user to specify the type of the file format.
|
||||
//
|
||||
// Created: M. Asai (Sept. 2020)
|
||||
//
|
||||
|
||||
#ifndef G4VScoreHistFiller_h
|
||||
#define G4VScoreHistFiller_h 1
|
||||
|
||||
#include "G4Threading.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This class implements the interface for filling histograms from scorer
|
||||
// type vith Geant4 analysis tools.
|
||||
|
||||
class G4VScoreHistFiller
|
||||
{
|
||||
public:
|
||||
virtual ~G4VScoreHistFiller();
|
||||
|
||||
// static method
|
||||
static G4VScoreHistFiller* Instance();
|
||||
|
||||
// methods
|
||||
virtual void FillH1(G4int id, G4double value, G4double weight = 1.0) = 0;
|
||||
virtual void FillH2(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double weight = 1.0) = 0;
|
||||
virtual void FillH3(G4int id,
|
||||
G4double xvalue, G4double yvalue, G4double zvalue,
|
||||
G4double weight = 1.0) = 0;
|
||||
virtual void FillP1(G4int id, G4double xvalue, G4double yvalue,
|
||||
G4double weight = 1.0) = 0;
|
||||
virtual void FillP2(G4int id,
|
||||
G4double xvalue, G4double yvalue, G4double zvalue,
|
||||
G4double weight = 1.0) = 0;
|
||||
|
||||
virtual G4bool CheckH1(G4int id) = 0;
|
||||
virtual G4bool CheckH2(G4int id) = 0;
|
||||
virtual G4bool CheckH3(G4int id) = 0;
|
||||
virtual G4bool CheckP1(G4int id) = 0;
|
||||
virtual G4bool CheckP2(G4int id) = 0;
|
||||
|
||||
protected:
|
||||
G4VScoreHistFiller();
|
||||
virtual G4VScoreHistFiller* CreateInstance() const = 0;
|
||||
|
||||
// static data members
|
||||
static G4VScoreHistFiller* fgMasterInstance;
|
||||
static G4ThreadLocal G4VScoreHistFiller* fgInstance;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user