Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
+15 -2
View File
@@ -15,6 +15,19 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Sep 12, 2020 B. Morgan (det-V10-06-02)
- Apply typo fixes from Gurkan Myczko (https://github.com/Geant4/geant4/pull/15)
Sep 23, 2020 M.Asai (det-V10-06-01)
- G4VScoreHistFiller and G4TScoreHistFiller :
Adding 2D and 3D histogram and 1P and 2P profile graph options.
Sep 7, 2020 M.Asai (det-V10-06-00)
- Introducing G4VScoreHistFiller and G4TScoreHistFiller that allow scorers to fill
histograms defined by G4Analysis
- G4VPrimitivePlotter.hh is moved from digits_hits/util.
April 28, 2020 John Apostolakis
- Added ComputeSolid methods to G4VPrimitiveScorer
@@ -28,8 +41,8 @@ June 4, 2007, A.Howard
May 31, 2007, A.Howard
- Removed classes associated with old biasing/scoring scheme:
G4CellScoreComposer, G4CellScoreValues, G4CellStoreScorer
(in module tag: "digits_hits-V08-03-02")
G4CellScoreComposer, G4CellScoreValues, G4CellStoreScorer
(in module tag: "digits_hits-V08-03-02")
- Files remain on the HEAD for testing purposes
Jul, 1st 2004 G.Cosmo
@@ -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
@@ -19,9 +19,13 @@ geant4_define_module(NAME G4detector
G4SensitiveVolumeList.hh
G4SensitiveVolumeList.icc
G4TrackLogger.hh
G4TScoreHistFiller.hh
G4TScoreHistFiller.icc
G4VPrimitivePlotter.hh
G4VPrimitiveScorer.hh
G4VReadOutGeometry.hh
G4VSDFilter.hh
G4VScoreHistFiller.hh
G4VSensitiveDetector.hh
G4MultiSensitiveDetector.hh
SOURCES
@@ -36,6 +40,7 @@ geant4_define_module(NAME G4detector
G4VPrimitiveScorer.cc
G4VReadOutGeometry.cc
G4VSDFilter.cc
G4VScoreHistFiller.cc
G4VSensitiveDetector.cc
G4MultiSensitiveDetector.cc
GRANULAR_DEPENDENCIES
@@ -85,7 +85,7 @@ void G4SDStructure::AddNewDetector(G4VSensitiveDetector*aSD,
#ifdef G4VERBOSE
G4ExceptionDescription ed;
ed << aSD->GetName() << " had already been stored in "
<< pathName << ". Object pointer is overwitten.\n";
<< pathName << ". Object pointer is overwritten.\n";
ed << "It's users' responsibility to delete the old sensitive detector object.";
G4Exception("G4SDStructure::AddNewDetector()","DET1010",JustWarning,ed);
#endif
@@ -0,0 +1,90 @@
//
// ********************************************************************
// * 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)
//
//
#include "G4VScoreHistFiller.hh"
G4VScoreHistFiller* G4VScoreHistFiller::fgMasterInstance = nullptr;
G4ThreadLocal G4VScoreHistFiller* G4VScoreHistFiller::fgInstance = nullptr;
G4VScoreHistFiller* G4VScoreHistFiller::Instance()
{
// This function invokes creating the objects on workes,
// The master instance should be created by the user
// via the concrete class constructor
G4bool isMaster = ! G4Threading::IsWorkerThread();
if ( ( ! isMaster ) && ( ! fgInstance ) ) {
if ( fgMasterInstance ) {
fgInstance = fgMasterInstance->CreateInstance();
}
}
return fgInstance;
}
G4VScoreHistFiller::G4VScoreHistFiller()
{
G4bool isMaster = ! G4Threading::IsWorkerThread();
if ( isMaster && fgMasterInstance ) {
G4ExceptionDescription description;
description
<< " "
<< "G4VScoreHistFiller on master already exists."
<< "Cannot create another instance.";
G4Exception("G4VScoreHistFiller::G4VScoreHistFiller()",
"Analysis_F001", FatalException, description);
}
if ( fgInstance ) {
G4ExceptionDescription description;
description
<< " "
<< "G4VScoreHistFiller on worker already exists."
<< "Cannot create another instance.";
G4Exception("G4VScoreHistFiller::G4VScoreHistFiller()",
"Analysis_F001", FatalException, description);
}
if ( isMaster ) fgMasterInstance = this;
fgInstance = this;
}
G4VScoreHistFiller::~G4VScoreHistFiller()
{
fgInstance = 0;
}