Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
+6 -1
View File
@@ -6,6 +6,11 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-07-11 Gabriele Cosmo (det-V11-02-00)
- Fixed reported Coverity defects, use consistently 'const G4String&' to
avoid implicit copy.
- Fixed class description in headers.
## 2022-12-22 Ben Morgan (det-V11-01-00)
- Apply standard clang-tidy plus range-based for and boolean simplification fixes
- General code tidy and modernization
@@ -46,7 +51,7 @@ April 28, 2020 John Apostolakis
- Added ComputeSolid methods to G4VPrimitiveScorer
Febr 26, 2013 Andrea Dotti
- Adding cloning capbailities to SD
- Adding cloning capabilities to SD
June 4, 2007, A.Howard
- Put back some classes required for scoring of geometrical biasing cells:
@@ -23,10 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4CellScoreComposer
// G4CellScoreComposer
//
// Class description:
// This class will be created for every cell standard
@@ -36,12 +33,10 @@
// sums of scores and delivers the results in
// G4CellScoreValues.
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
// Author: Michael Dressel, CERN
// --------------------------------------------------------------------
#ifndef G4CellScoreComposer_hh
#define G4CellScoreComposer_hh G4CellScoreComposer_hh
#define G4CellScoreComposer_hh 1
#include "G4CellScoreValues.hh"
@@ -23,21 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// ----------------------------------------------------------------------
// Class G4CellScoreValues
// G4CellScoreValues
//
// Class description:
//
// This struct holds sums of scores for standard scoring.
//
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
// Author: Michael Dressel, CERN
// --------------------------------------------------------------------
#ifndef G4CellScoreValues_hh
#define G4CellScoreValues_hh G4CellScoreValues_hh
#define G4CellScoreValues_hh 1
#include "globals.hh"
@@ -23,9 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4CollectionNameVector
//
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4CollectionNameVector_H
#define G4CollectionNameVector_H 1
@@ -39,7 +40,7 @@ class G4CollectionNameVector : public std::vector<G4String>
G4CollectionNameVector() {}
virtual ~G4CollectionNameVector() {}
void insert(G4String str) { push_back(str); }
void insert(const G4String& str) { push_back(str); }
};
#endif
@@ -23,28 +23,30 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4HCtable
//
// Class description:
//
// This class is used by G4SDManager for book keeping the
// sensitive detector modules and hits collections. The order of
// hits collections stored in G4HCofThisEvent is same as the
// order of HClist.
// The order may vary from run to run, if the user adds/changes
// some of his/her sensitive detector modules.
// In case user wants to make G4Run object persistent, this
// G4HCtable class object should be copied and stored with
// G4Run object.
//
// Author: Makoto Asai
// ---------------------------------------------------------------------
#ifndef G4HCtable_H
#define G4HCtable_H 1
class G4VSensitiveDetector;
#include "globals.hh"
#include <vector>
// class description:
//
// This class is used by G4SDManager for book keeping the
// sensitive detector modules and hits collections. The order of
// hits collections stored in G4HCofThisEvent is same as the
// order of HClist.
// The order may vary from run to run, if the user adds/changes
// some of his/her sensitive detector modules.
// In case user wants to make G4Run object persistent, this
// G4HCtable class object should be copied and stored with
// G4Run object.
class G4VSensitiveDetector;
class G4HCtable
{
@@ -53,8 +55,8 @@ class G4HCtable
~G4HCtable() = default;
public:
G4int Registor(G4String SDname, G4String HCname);
G4int GetCollectionID(G4String HCname) const;
G4int Registor(const G4String& SDname, const G4String& HCname);
G4int GetCollectionID(const G4String& HCname) const;
G4int GetCollectionID(G4VSensitiveDetector* aSD) const;
inline G4int entries() const { return G4int(HClist.size()); }
@@ -23,9 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MultiFunctionalDetector
//
// Class description:
//
// This is the base class of the sensitive detector which owns
// one or more G4VPrimitiveScorer class objects.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4MultiFunctionalDetector_h
#define G4MultiFunctionalDetector_h 1
@@ -39,15 +45,10 @@
#include <vector>
class G4VPrimitiveScorer;
// class description:
//
// This is the base class of the sensitive detector which owns
// one or more G4VPrimitiveScorer class objects.
class G4MultiFunctionalDetector : public G4VSensitiveDetector
{
public:
G4MultiFunctionalDetector(G4String);
G4MultiFunctionalDetector(const G4String&);
~G4MultiFunctionalDetector() override;
G4bool RegisterPrimitive(G4VPrimitiveScorer*);
@@ -23,20 +23,24 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4MultiSensitiveDetector
//
// Class description:
//
#ifndef G4MULTISENSITIVEDETECTOR_H
#define G4MULTISENSITIVEDETECTOR_H
#include "G4VSensitiveDetector.hh"
#include <vector>
// class description:
// This class allows to assign multiple sensitive detectors to a single
// logical-volume.
// SDs are added to this proxy and an instance of the proxy is assigned
// to the logical volume. Calls to SD methods are forwarded to ALL
// user-defined SD that are added.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4MULTISENSITIVEDETECTOR_H
#define G4MULTISENSITIVEDETECTOR_H 1
#include "G4VSensitiveDetector.hh"
#include <vector>
class G4MultiSensitiveDetector : public G4VSensitiveDetector
{
@@ -23,32 +23,32 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4SDManager
//
// Class description:
//
// This is a singleton class which manages the sensitive detectors.
// The user cannot access to the constructor. The pointer of the
// only existing object can be got via G4SDManager::GetSDMpointer()
// static method. The first invokation of this static method makes
// the singleton object.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4SDManager_h
#define G4SDManager_h 1
#include "G4HCtable.hh"
#include "G4SDStructure.hh"
#include "globals.hh"
class G4VHitsCollection;
class G4VSensitiveDetector;
class G4HCofThisEvent;
class G4SDmessenger;
#include "G4VSDFilter.hh"
#include <vector>
// class description:
//
// This is a singleton class which manages the sensitive detectors.
// The user cannot access to the constructor. The pointer of the
// only existing object can be got via G4SDManager::GetSDMpointer()
// static method. The first invokation of this static method makes
// the singleton object.
//
class G4VHitsCollection;
class G4VSensitiveDetector;
class G4HCofThisEvent;
class G4SDmessenger;
class G4SDManager
{
@@ -71,18 +71,18 @@ class G4SDManager
// Activate/inactivate the registered sensitive detector.
// For the inactivated detectors, hits collections will not be stored to the G4HCofThisEvent
// object.
void Activate(G4String dName, G4bool activeFlag);
void Activate(const G4String& dName, G4bool activeFlag);
// Return ID number of sensitive detector with given name
G4int GetCollectionID(G4String colName);
G4int GetCollectionID(const G4String& colName);
// Return ID number of sensitive detector creating given hits collection
G4int GetCollectionID(G4VHitsCollection* aHC);
G4VSensitiveDetector* FindSensitiveDetector(G4String dName, G4bool warning = true);
G4VSensitiveDetector* FindSensitiveDetector(const G4String& dName, G4bool warning = true);
G4HCofThisEvent* PrepareNewEvent();
void TerminateCurrentEvent(G4HCofThisEvent* HCE);
void AddNewCollection(G4String SDname, G4String DCname);
void AddNewCollection(const G4String& SDname, const G4String& DCname);
inline void SetVerboseLevel(G4int vl)
{
@@ -23,9 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4SDStructure
//
// Class description:
//
// This class is exclusively used by G4SDManager for handling the tree
// structure of the user's sensitive detector names.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4SDStructure_h
#define G4SDStructure_h 1
@@ -37,12 +43,6 @@
class G4HCofThisEvent;
// class description:
//
// This class is exclusively used by G4SDManager for handling the tree
// structure of the user's sensitive detector names.
//
class G4SDStructure
{
public:
@@ -23,9 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4SDmessenger
//
// Class description:
//
// This is a concrete class of G4UImessenger which handles the commands for
// G4SDManager. This class has the following commands:
// /hits/
// /hits/list
// /hits/activate
// /hits/inactivate
// /hts/verbose
//
// Author: Makoto Asai
// ---------------------------------------------------------------------
#ifndef G4SDmessenger_h
#define G4SDmessenger_h 1
@@ -37,17 +48,6 @@ class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
// class description:
//
// This is a cncrete class of G4UImessenger which handles the commands for
// G4SDManager. This class has the following commands:
// /hits/
// /hits/list
// /hits/activate
// /hits/inactivate
// /hts/verbose
//
class G4SDmessenger : public G4UImessenger
{
public:
@@ -23,34 +23,24 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4SensitiveVolumeList
//
// Class description:
//
// ------------------------------------------------------------
// GEANT 4 class header file --- Copyright CERN 1996
// CERN Geneva Switzerland
//
// History: first implementation, based on Hits+Digi domain
// object model of April 1996, S.Piperov
//
// ---------------- G4SensitiveVolumeList -----------------
#ifndef G4SensitiveVolumeList_h
#define G4SensitiveVolumeList_h 1
// #include "g4rw/tpordvec.h"
// #include "g4rw/tvordvec.h"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include <vector>
// class description:
//
// This class object can have lists of logical and physical volumes.
// This class object can have lists of logical and physical volumes.
// In case a sensitive detector is shared by several logical volumes and/or
// a logical volume is shared by several physical volumes, this class can be
// used by the veto list for individual logical/physical volumes.
//
// Author: S.Piperov, 1996
// --------------------------------------------------------------------
#ifndef G4SensitiveVolumeList_h
#define G4SensitiveVolumeList_h 1
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include <vector>
class G4SensitiveVolumeList
{
@@ -23,7 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4TScoreHistFiller
//
// 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.
//
// Author: Makoto Asai, September 2020
// --------------------------------------------------------------------
#ifndef G4TScoreHistFiller_h
#define G4TScoreHistFiller_h 1
@@ -32,15 +41,6 @@
#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
{
@@ -23,15 +23,10 @@
// * 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)
//
// G4TScoreHistFiller inline definitions
//
// Author: Makoto Asai, September 2020
//---------------------------------------------------------------------
template <typename T>
void G4TScoreHistFiller<T>::CreateAnalysisManager()
@@ -23,9 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// ----------------------------------------------------------------------
// Class G4TrackLogger
// G4TrackLogger
//
// Class description:
//
@@ -33,12 +31,10 @@
// a track has been logged. The loggs are cleared when ever
// the object has been informed about a new event.
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
//
// Author: Michael Dressel, CERN
// --------------------------------------------------------------------
#ifndef G4TrackLogger_hh
#define G4TrackLogger_hh G4TrackLogger_hh
#define G4TrackLogger_hh 1
#include "globals.hh"
@@ -23,8 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VPrimitivePlotter
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VPrimitivePlotter_H
#define G4VPrimitivePlotter_H 1
@@ -23,35 +23,35 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VPrimitiveScorer
//
// Class description:
//
// This is the base class of the sensitive detector which owns
// only one hits collection.
// A concrete class object derived from this base class can be
// used either as a sensitive detector or to be registered to
// G4MultiFunctionalDetector to define multiple functionalities.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VPrimitiveScorer_h
#define G4VPrimitiveScorer_h 1
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
#include "G4MultiFunctionalDetector.hh"
#include "G4VSDFilter.hh"
#include "globals.hh"
// class description:
//
// This is the base class of the sensitive detector which owns
// only one hits collection.
// A concrete class object derived from this base class can be
// used either as a sensitive detector or to be registered to
// G4MultiFunctionalDetector to define multiple functionalities.
//
//
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class G4VPrimitiveScorer
{
friend class G4MultiFunctionalDetector;
public:
G4VPrimitiveScorer(G4String name, G4int depth = 0);
G4VPrimitiveScorer(const G4String& name, G4int depth = 0);
virtual ~G4VPrimitiveScorer() = default;
// This method returns the ID of its hitsCollection. This mehod
@@ -74,7 +74,7 @@ class G4VPrimitiveScorer
// Set/Get methods
inline void SetMultiFunctionalDetector(G4MultiFunctionalDetector* d) { detector = d; }
inline G4MultiFunctionalDetector* GetMultiFunctionalDetector() const { return detector; }
inline G4String GetName() const { return primitiveName; }
inline const G4String& GetName() const { return primitiveName; }
inline void SetFilter(G4VSDFilter* f) { filter = f; }
inline G4VSDFilter* GetFilter() const { return filter; }
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
@@ -23,12 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VReadOutGeometry
//
//
// ------------------------------------------------------------
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VReadOutGeometry_h
#define G4VReadOutGeometry_h
#define G4VReadOutGeometry_h 1
#include "G4SensitiveVolumeList.hh"
#include "G4Step.hh"
@@ -40,7 +40,7 @@ class G4VReadOutGeometry
{
public:
G4VReadOutGeometry();
G4VReadOutGeometry(G4String);
G4VReadOutGeometry(const G4String&);
virtual ~G4VReadOutGeometry();
G4bool operator==(const G4VReadOutGeometry& right) const;
@@ -56,8 +56,8 @@ class G4VReadOutGeometry
inline void SetIncludeList(G4SensitiveVolumeList* value) { fincludeList = value; }
inline const G4SensitiveVolumeList* GetExcludeList() const { return fexcludeList; }
inline void SetExcludeList(G4SensitiveVolumeList* value) { fexcludeList = value; }
inline G4String GetName() const { return name; }
inline void SetName(G4String value) { name = value; }
inline const G4String& GetName() const { return name; }
inline void SetName(const G4String& value) { name = value; }
// ADDED:
inline G4VPhysicalVolume* GetROWorld() const { return ROworld; }
@@ -23,29 +23,31 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VSDFilter
//
// Class description:
//
// This is the abstract base class of a filter to be associated with a
// sensitive detector or a primitive scorer.
//
// Author Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VSDFilter_h
#define G4VSDFilter_h 1
class G4Step;
#include "globals.hh"
// class description:
//
// This is the abstract base class of a filter to be associated with a
// sensitive detector or a primitive scorer.
class G4Step;
class G4VSDFilter
{
public:
G4VSDFilter(G4String name);
G4VSDFilter(const G4String& name);
virtual ~G4VSDFilter();
virtual G4bool Accept(const G4Step*) const = 0;
inline G4String GetName() const { return filterName; }
inline const G4String& GetName() const { return filterName; }
protected:
G4String filterName;
@@ -26,25 +26,22 @@
// 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)
// 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.
// This class implements the interface for filling histograms from scorer
// type vith Geant4 analysis tools.
//
// Author: Makoto Asai, September 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:
@@ -23,9 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VSensitiveDetector
//
// Class description:
//
// This is the abstract base class of the sensitive detector. The user's
// sensitive detector which generates hits must be derived from this
// class.
// In the derived class constructor, name(s) of hits collection(s) which
// are made by the sensitive detector must be set to "collectionName" string
// vector.
//
// Author: Makoto Asai
// ---------------------------------------------------------------------
#ifndef G4VSensitiveDetector_h
#define G4VSensitiveDetector_h 1
@@ -37,22 +47,13 @@
#include "G4VReadOutGeometry.hh"
#include "G4VSDFilter.hh"
// class description:
//
// This is the abstract base class of the sensitive detector. The user's
// sensitive detector which generates hits must be derived from this
// class.
// In the derived class constructor, name(s) of hits collection(s) which
// are made by the sensitive detector must be set to "collectionName" string
// vector.
class G4VSensitiveDetector
{
public:
// Constructors. The user's concrete class must use one of these constructors
// by the constructor initializer of the derived class. The name of
// the sensitive detector must be unique.
explicit G4VSensitiveDetector(G4String name);
explicit G4VSensitiveDetector(const G4String& name);
G4VSensitiveDetector(const G4VSensitiveDetector& right);
G4VSensitiveDetector& operator=(const G4VSensitiveDetector& right);
virtual ~G4VSensitiveDetector() = default;
@@ -99,13 +100,13 @@ class G4VSensitiveDetector
inline void SetFilter(G4VSDFilter* value) { filter = value; }
inline G4int GetNumberOfCollections() const { return G4int(collectionName.size()); }
inline G4String GetCollectionName(G4int id) const { return collectionName[id]; }
inline const G4String& GetCollectionName(G4int id) const { return collectionName[id]; }
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
inline void Activate(G4bool activeFlag) { active = activeFlag; }
inline G4bool isActive() const { return active; }
inline G4String GetName() const { return SensitiveDetectorName; }
inline G4String GetPathName() const { return thePathName; }
inline G4String GetFullPathName() const { return fullPathName; }
inline const G4String& GetName() const { return SensitiveDetectorName; }
inline const G4String& GetPathName() const { return thePathName; }
inline const G4String& GetFullPathName() const { return fullPathName; }
inline G4VReadOutGeometry* GetROgeometry() const { return ROgeometry; }
inline G4VSDFilter* GetFilter() const { return filter; }
+2 -2
View File
@@ -30,7 +30,7 @@
#include "G4VSensitiveDetector.hh"
G4int G4HCtable::Registor(G4String SDname, G4String HCname)
G4int G4HCtable::Registor(const G4String& SDname, const G4String& HCname)
{
for (std::size_t i = 0; i < HClist.size(); ++i) {
if (HClist[i] == HCname && SDlist[i] == SDname) return -1;
@@ -40,7 +40,7 @@ G4int G4HCtable::Registor(G4String SDname, G4String HCname)
return (G4int)HClist.size();
}
G4int G4HCtable::GetCollectionID(G4String HCname) const
G4int G4HCtable::GetCollectionID(const G4String& HCname) const
{
G4int i = -1;
if (HCname.find('/') == std::string::npos) // HCname only
@@ -35,7 +35,8 @@
#include "G4SDManager.hh"
#include "G4VPrimitiveScorer.hh"
G4MultiFunctionalDetector::G4MultiFunctionalDetector(G4String name) : G4VSensitiveDetector(name)
G4MultiFunctionalDetector::G4MultiFunctionalDetector(const G4String& name)
: G4VSensitiveDetector(name)
{
;
}
@@ -85,7 +85,7 @@ void G4SDManager::AddNewDetector(G4VSensitiveDetector* aSD)
}
}
void G4SDManager::AddNewCollection(G4String SDname, G4String DCname)
void G4SDManager::AddNewCollection(const G4String& SDname, const G4String& DCname)
{
G4int i = HCtable->Registor(SDname, DCname);
if (verboseLevel > 0) {
@@ -110,21 +110,21 @@ G4HCofThisEvent* G4SDManager::PrepareNewEvent()
void G4SDManager::TerminateCurrentEvent(G4HCofThisEvent* HCE) { treeTop->Terminate(HCE); }
void G4SDManager::Activate(G4String dName, G4bool activeFlag)
void G4SDManager::Activate(const G4String& dName, G4bool activeFlag)
{
G4String pathName = dName;
if (pathName[0] != '/') pathName.insert(0, "/");
treeTop->Activate(pathName, activeFlag);
}
G4VSensitiveDetector* G4SDManager::FindSensitiveDetector(G4String dName, G4bool warning)
G4VSensitiveDetector* G4SDManager::FindSensitiveDetector(const G4String& dName, G4bool warning)
{
G4String pathName = dName;
if (pathName[0] != '/') pathName.insert(0, "/");
return treeTop->FindSensitiveDetector(pathName, warning);
}
G4int G4SDManager::GetCollectionID(G4String colName)
G4int G4SDManager::GetCollectionID(const G4String& colName)
{
G4int id = HCtable->GetCollectionID(colName);
if (id == -1) {
@@ -36,7 +36,7 @@
#include "G4VPVParameterisation.hh"
#include "G4VSolid.hh"
G4VPrimitiveScorer::G4VPrimitiveScorer(G4String name, G4int depth)
G4VPrimitiveScorer::G4VPrimitiveScorer(const G4String& name, G4int depth)
: primitiveName(name), indexDepth(depth)
{}
@@ -60,7 +60,7 @@ G4VReadOutGeometry::G4VReadOutGeometry(const G4VReadOutGeometry& right)
// VALUE, same for navigator and same for the World+Geom hierachy
}
G4VReadOutGeometry::G4VReadOutGeometry(G4String n)
G4VReadOutGeometry::G4VReadOutGeometry(const G4String& n)
: ROworld(nullptr),
fincludeList(nullptr),
fexcludeList(nullptr),
@@ -30,7 +30,7 @@
#include "G4SDManager.hh"
G4VSDFilter::G4VSDFilter(G4String name) : filterName(name)
G4VSDFilter::G4VSDFilter(const G4String& name) : filterName(name)
{
G4SDManager::GetSDMpointer()->RegisterSDFilter(this);
}
@@ -30,9 +30,9 @@
#include "G4SDManager.hh"
G4VSensitiveDetector::G4VSensitiveDetector(G4String name)
G4VSensitiveDetector::G4VSensitiveDetector(const G4String& name)
{
size_t sLast = name.rfind('/');
std::size_t sLast = name.rfind('/');
if (sLast == std::string::npos) { // detector name only
SensitiveDetectorName = name;
thePathName = "/";
+8 -2
View File
@@ -1,9 +1,15 @@
# Category detdigits History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-07-12 Gabriele Cosmo (detdigits-V11-02-00)
- Fixed reported Coverity defects, use consistently 'const G4String&' to
avoid implicit copy.
- Fixed class description in headers.
## 2022-22-12 Ben Morgan (detdigits-V11-01-00)
- Apply standard clang-tidy and clang-format fixes
@@ -23,9 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4DCofThisEvent
//
// Class description:
//
// This is a class which stores digi collections generated at one event.
// This class is exclusively constructed by G4DigiManager when the first
// digi collection of an event is passed to the manager, and this class
// object is deleted by G4RunManager when a G4Event class object is deleted.
// Almost all public methods must be used by Geant4 kernel classes and
// the user should not invoke them. The user can use two const methods,
// GetDC() and GetNumberOfCollections() for accessing to the stored digi
// collection(s).
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4DCofThisEvent_h
#define G4DCofThisEvent_h 1
@@ -35,52 +47,43 @@
#include <vector>
// class description:
//
// This is a class which stores digi collections generated at one event.
// This class is exclusively constructed by G4DigiManager when the first
// digi collection of an event is passed to the manager, and this class
// object is deleted by G4RunManager when a G4Event class object is deleted.
// Almost all public methods must be used by Geant4 kernel classes and
// the user should not invoke them. The user can use two const methods,
// GetDC() and GetNumberOfCollections() for accessing to the stored digi
// collection(s).
class G4DCofThisEvent
{
public:
G4DCofThisEvent();
explicit G4DCofThisEvent(G4int cap);
~G4DCofThisEvent();
G4DCofThisEvent(const G4DCofThisEvent&);
G4DCofThisEvent& operator=(const G4DCofThisEvent&);
public:
inline void* operator new(size_t);
inline void operator delete(void* anDCoTE);
G4DCofThisEvent();
explicit G4DCofThisEvent(G4int cap);
~G4DCofThisEvent();
G4DCofThisEvent(const G4DCofThisEvent&);
G4DCofThisEvent& operator=(const G4DCofThisEvent&);
void AddDigiCollection(G4int DCID, G4VDigiCollection* aDC);
inline void* operator new(std::size_t);
inline void operator delete(void* anDCoTE);
// Returns a pointer to a digi collection.
// Returns `nullptr` if the particular collection is not stored in the current event.
// The integer argument is ID number which is assigned by G4DigiManager
// and the number can be obtained by G4DigiManager::GetDigiCollectionID()
// method.
inline G4VDigiCollection* GetDC(G4int i) const { return (*DC)[i]; }
void AddDigiCollection(G4int DCID, G4VDigiCollection* aDC);
// Return number of digi collections stored
inline G4int GetNumberOfCollections() const
{
G4int n = 0;
for (const G4VDigiCollection* dc : *DC) {
if (dc != nullptr) n++;
// Returns a pointer to a digi collection.
// Returns `nullptr` if the particular collection is not stored in the current event.
// The integer argument is ID number which is assigned by G4DigiManager
// and the number can be obtained by G4DigiManager::GetDigiCollectionID()
// method.
inline G4VDigiCollection* GetDC(G4int i) const { return (*DC)[i]; }
// Return number of digi collections stored
inline G4int GetNumberOfCollections() const
{
G4int n = 0;
for (const G4VDigiCollection* dc : *DC) {
if (dc != nullptr) ++n;
}
return n;
}
return n;
}
inline size_t GetCapacity() const { return DC->size(); }
inline std::size_t GetCapacity() const { return DC->size(); }
private:
std::vector<G4VDigiCollection*>* DC;
private:
std::vector<G4VDigiCollection*>* DC;
};
#if defined G4DIGI_ALLOC_EXPORT
@@ -89,7 +92,7 @@ extern G4DLLEXPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
#endif
inline void* G4DCofThisEvent::operator new(size_t)
inline void* G4DCofThisEvent::operator new(std::size_t)
{
if (anDCoTHAllocator_G4MT_TLS_() == nullptr) {
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
@@ -23,9 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4TDigiCollection & G4DigiCollection
//
// Class description:
//
// This is a template class of digi collection and parametrised by
// The concrete class of G4VDigi. This is a uniform collection for
// a particular concrete digi class objects.
// An intermediate layer class G4DigiCollection appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instantiated with a template class. Thus G4DigiCollection
// class MUST NOT be directly used by the user.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4TDigiCollection_h
#define G4TDigiCollection_h 1
@@ -35,26 +46,18 @@
#include <vector>
// class description:
//
// This is a template class of digi collection and parametrized by
// The concrete class of G4VDigi. This is a uniform collection for
// a particular concrete digi class objects.
// An intermediate layer class G4DigiCollection appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instansiated with a template class. Thus G4DigiCollection
// class MUST NOT be directly used by the user.
class G4DigiCollection : public G4VDigiCollection
{
public:
using G4VDigiCollection::G4VDigiCollection;
~G4DigiCollection() override = default;
public:
G4bool operator==(const G4DigiCollection& right) const { return (this == &right); }
using G4VDigiCollection::G4VDigiCollection;
~G4DigiCollection() override = default;
protected:
void* theCollection = nullptr;
G4bool operator==(const G4DigiCollection& right) const { return (this == &right); }
protected:
void* theCollection = nullptr;
};
#if defined G4DIGI_ALLOC_EXPORT
@@ -66,52 +69,53 @@ extern G4DLLIMPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
template <class T>
class G4TDigiCollection : public G4DigiCollection
{
public:
G4TDigiCollection();
G4TDigiCollection(G4String detName, G4String colNam);
~G4TDigiCollection() override;
public:
G4bool operator==(const G4TDigiCollection& right) const;
G4TDigiCollection();
G4TDigiCollection(const G4String& detName, const G4String& colNam);
~G4TDigiCollection() override;
inline void* operator new(size_t);
inline void operator delete(void* aDC);
G4bool operator==(const G4TDigiCollection& right) const;
// Invoke Draw() method on all stored digit objects in collection
void DrawAllDigi() override;
inline void* operator new(std::size_t);
inline void operator delete(void* aDC);
// Invoke Print() method on all stored digit objects in collection
void PrintAllDigi() override;
// Invoke Draw() method on all stored digit objects in collection
void DrawAllDigi() override;
// Returns pointer to the concrete digi object at index i
// Not bounds checked
inline T* operator[](size_t i) const { return (*((std::vector<T*>*)theCollection))[i]; }
// Invoke Print() method on all stored digit objects in collection
void PrintAllDigi() override;
// Returns pointer to stored collection vector.
inline std::vector<T*>* GetVector() const { return (std::vector<T*>*)theCollection; }
// Returns pointer to the concrete digi object at index i
// Not bounds checked
inline T* operator[](std::size_t i) const { return (*((std::vector<T*>*)theCollection))[i]; }
// Insert a digit object in the collection, taking ownership
// Returns the total number of digi objects stored after insertion
inline size_t insert(T* aHit)
{
auto theDigiCollection = (std::vector<T*>*)theCollection;
theDigiCollection->push_back(aHit);
return theDigiCollection->size();
}
// Returns pointer to stored collection vector.
inline std::vector<T*>* GetVector() const { return (std::vector<T*>*)theCollection; }
// Returns the number of digi objects stored in this collection.
inline size_t entries() const
{
auto theDigiCollection = (std::vector<T*>*)theCollection;
return theDigiCollection->size();
}
// Insert a digit object in the collection, taking ownership
// Returns the total number of digi objects stored after insertion
inline std::size_t insert(T* aHit)
{
auto theDigiCollection = (std::vector<T*>*)theCollection;
theDigiCollection->push_back(aHit);
return theDigiCollection->size();
}
G4VDigi* GetDigi(size_t i) const override { return (*((std::vector<T*>*)theCollection))[i]; }
// Returns the number of digi objects stored in this collection.
inline std::size_t entries() const
{
auto theDigiCollection = (std::vector<T*>*)theCollection;
return theDigiCollection->size();
}
size_t GetSize() const override { return ((std::vector<T*>*)theCollection)->size(); }
G4VDigi* GetDigi(std::size_t i) const override { return (*((std::vector<T*>*)theCollection))[i]; }
std::size_t GetSize() const override { return ((std::vector<T*>*)theCollection)->size(); }
};
template <class T>
inline void* G4TDigiCollection<T>::operator new(size_t)
inline void* G4TDigiCollection<T>::operator new(std::size_t)
{
if (aDCAllocator_G4MT_TLS_() == nullptr) {
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
@@ -133,7 +137,7 @@ G4TDigiCollection<T>::G4TDigiCollection()
}
template <class T>
G4TDigiCollection<T>::G4TDigiCollection(G4String detName, G4String colNam)
G4TDigiCollection<T>::G4TDigiCollection(const G4String& detName, const G4String& colNam)
: G4DigiCollection(detName, colNam)
{
auto theDigiCollection = new std::vector<T*>;
+27 -25
View File
@@ -23,9 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VDigi
//
// Class description:
//
// This is the base class of digi object. The user should derive this
// base class to make his/her own digi class. Two virtual method Draw()
// and Print() can be implemented if the user wants these functionalities.
// If a concrete digi class is used as a transient class, G4Allocator
// must be used.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VDigi_h
#define G4VDigi_h 1
@@ -37,36 +46,29 @@
class G4AttDef;
class G4AttValue;
// class description:
//
// This is the base class of digi object. The user should derive this
// base class to make his/her own digi class. Two virtual method Draw()
// and Print() can be implemented if the user wants these functionarities.
// If a concrete digi class is used as a transient class, G4Allocator
// must be used.
class G4VDigi
{
public:
G4VDigi() = default;
virtual ~G4VDigi() = default;
public:
G4bool operator==(const G4VDigi& right) const { return (this == &right); }
G4VDigi() = default;
virtual ~G4VDigi() = default;
virtual void Draw(){};
virtual void Print(){};
G4bool operator==(const G4VDigi& right) const { return (this == &right); }
// Returns pointer to map of attribute definitions for this digit
// Caller is responsible for checking validity of returned pointer.
// See `G4Trajectory` for a concrete implementation.
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const { return nullptr; }
virtual void Draw() {}
virtual void Print() {}
// Returns pointer to list of attributes for this digit
// Each attribute must correspond to a definition returned by `GetAffDefs`.
// Caller is responsible for checking validity of returned pointer.
// See `G4Trajectory` for a concrete implementation, and
// `G4VTrajectory::ShowTrajectory` for an example of its use.
virtual std::vector<G4AttValue>* CreateAttValues() const { return nullptr; }
// Returns pointer to map of attribute definitions for this digit
// Caller is responsible for checking validity of returned pointer.
// See `G4Trajectory` for a concrete implementation.
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const { return nullptr; }
// Returns pointer to list of attributes for this digit
// Each attribute must correspond to a definition returned by `GetAffDefs`.
// Caller is responsible for checking validity of returned pointer.
// See `G4Trajectory` for a concrete implementation, and
// `G4VTrajectory::ShowTrajectory` for an example of its use.
virtual std::vector<G4AttValue>* CreateAttValues() const { return nullptr; }
};
#endif
@@ -23,9 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VDigiCollection
//
// Class description:
//
// This is the base class of digi collection. The user is advised to
// use G4TDigiCollection template class in case his/her collection is
// transient. While, in case the collection is persistent,
// the concrete collection class can be directly derived from this
// class. Geant4 kernel will use this class methods.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VDigiCollection_h
#define G4VDigiCollection_h 1
@@ -33,39 +42,32 @@
class G4VDigi;
// class description:
//
// This is the base class of digi collection. The user is advised to
// use G4TDigiCollection template class in case his/her collection is
// transient. While, in case the collection is persistent with ODBMS,
// the concrete collection class can be directly derived from this
// class.
// Geant4 kernel will use this class methods.
class G4VDigiCollection
{
public:
G4VDigiCollection() = default;
G4VDigiCollection(G4String DMnam, G4String colNam);
virtual ~G4VDigiCollection() = default;
G4bool operator==(const G4VDigiCollection& right) const;
public:
virtual void DrawAllDigi(){};
virtual void PrintAllDigi(){};
G4VDigiCollection() = default;
G4VDigiCollection(const G4String& DMnam, const G4String& colNam);
virtual ~G4VDigiCollection() = default;
G4bool operator==(const G4VDigiCollection& right) const;
inline const G4String& GetName() const { return collectionName; }
inline const G4String& GetDMname() const { return DMname; }
virtual void DrawAllDigi() {}
virtual void PrintAllDigi() {}
// GetDigi and GetSize are given a default implementation here so
// that the template G4TDigiCollection can be used, but they
// are re-implemented in G4TDigiCollection.
virtual G4VDigi* GetDigi(size_t) const { return nullptr; }
virtual size_t GetSize() const { return 0; }
inline const G4String& GetName() const { return collectionName; }
inline const G4String& GetDMname() const { return DMname; }
protected:
// Collection name
G4String collectionName = "Unknown";
G4String DMname = "Unknown";
// GetDigi and GetSize are given a default implementation here so
// that the template G4TDigiCollection can be used, but they
// are re-implemented in G4TDigiCollection.
virtual G4VDigi* GetDigi(std::size_t) const { return nullptr; }
virtual std::size_t GetSize() const { return 0; }
protected:
// Collection name
G4String collectionName = "Unknown";
G4String DMname = "Unknown";
};
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4DCofThisEvent
// --------------------------------------------------------------------
#include "G4DCofThisEvent.hh"
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4TDigiCollection
// --------------------------------------------------------------------
#include "G4TDigiCollection.hh"
@@ -23,14 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4VDigiCollection
// --------------------------------------------------------------------
#include "G4VDigiCollection.hh"
G4VDigiCollection::G4VDigiCollection(G4String DMnam, G4String colNam)
G4VDigiCollection::G4VDigiCollection(const G4String& DMnam, const G4String& colNam)
: collectionName(colNam), DMname(DMnam)
{}
+8 -2
View File
@@ -1,9 +1,15 @@
# Category dethits History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-07-12 Gabriele Cosmo (dethits-V11-02-00)
- Fixed reported Coverity defects, use consistently 'const G4String&' to
avoid implicit copy.
- Fixed class description in headers.
## 2022-22-12 Ben Morgan (dethits-V11-01-00)
- Apply standard clang-tidy and clang-format fixes
@@ -23,9 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4HCofThisEvent
//
// Class description:
//
// This is a class which stores hits collections generated at one event.
// This class is exclusively constructed by G4SDManager when the first
// hits collection of an event is passed to the manager, and this class
// object is deleted by G4RunManager when a G4Event class object is deleted.
// Almost all public methods must be used by Geant4 kernel classes and
// the user should not invoke them. The user can use two const methods,
// GetHC() and GetNumberOfCollections() for accessing to the stored hits
// collection(s).
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4HCofThisEvent_h
#define G4HCofThisEvent_h 1
@@ -35,53 +47,44 @@
#include <vector>
// class description:
//
// This is a class which stores hits collections generated at one event.
// This class is exclusively constructed by G4SDManager when the first
// hits collection of an event is passed to the manager, and this class
// object is deleted by G4RunManager when a G4Event class object is deleted.
// Almost all public methods must be used by Geant4 kernel classes and
// the user should not invoke them. The user can use two const methods,
// GetHC() and GetNumberOfCollections() for accessing to the stored hits
// collection(s).
class G4HCofThisEvent
{
public:
G4HCofThisEvent();
explicit G4HCofThisEvent(G4int cap);
~G4HCofThisEvent();
G4HCofThisEvent(const G4HCofThisEvent&);
G4HCofThisEvent& operator=(const G4HCofThisEvent&);
public:
inline void* operator new(size_t);
inline void operator delete(void* anHCoTE);
G4HCofThisEvent();
explicit G4HCofThisEvent(G4int cap);
~G4HCofThisEvent();
G4HCofThisEvent(const G4HCofThisEvent&);
G4HCofThisEvent& operator=(const G4HCofThisEvent&);
void AddHitsCollection(G4int HCID, G4VHitsCollection* aHC);
inline void* operator new(std::size_t);
inline void operator delete(void* anHCoTE);
// Returns a pointer to a hits collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4SDManager
// and the number can be obtained by G4SDManager::GetHitsCollectionID()
// method.
inline G4VHitsCollection* GetHC(G4int i) { return (*HC)[i]; }
void AddHitsCollection(G4int HCID, G4VHitsCollection* aHC);
// Return number of hits collections which are stored in this class
// object.
inline G4int GetNumberOfCollections()
{
G4int n = 0;
for (const G4VHitsCollection* h : *HC) {
if (h != nullptr) n++;
// Returns a pointer to a hits collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4SDManager
// and the number can be obtained by G4SDManager::GetHitsCollectionID()
// method.
inline G4VHitsCollection* GetHC(G4int i) { return (*HC)[i]; }
// Return number of hits collections which are stored in this class
// object.
inline G4int GetNumberOfCollections()
{
G4int n = 0;
for (const G4VHitsCollection* h : *HC) {
if (h != nullptr) ++n;
}
return n;
}
return n;
}
inline size_t GetCapacity() { return HC->size(); }
inline std::size_t GetCapacity() { return HC->size(); }
private:
std::vector<G4VHitsCollection*>* HC;
private:
std::vector<G4VHitsCollection*>* HC;
};
#if defined G4DIGI_ALLOC_EXPORT
@@ -90,7 +93,7 @@ extern G4DLLEXPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
#endif
inline void* G4HCofThisEvent::operator new(size_t)
inline void* G4HCofThisEvent::operator new(std::size_t)
{
if (anHCoTHAllocator_G4MT_TLS_() == nullptr) {
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
@@ -23,9 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4THitsCollection & G4HitsCollection
//
// Class description:
//
// This is a template class of hits collection and parametrised by
// The concrete class of G4VHit. This is a uniform collection for
// a particular concrete hit class objects.
// An intermediate layer class G4HitsCollection appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instantiated with a template class. Thus G4HitsCollection
// class MUST NOT be directly used by the user.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4THitsCollection_h
#define G4THitsCollection_h 1
@@ -35,25 +46,17 @@
#include <vector>
// class description:
//
// This is a template class of hits collection and parametrized by
// The concrete class of G4VHit. This is a uniform collection for
// a particular concrete hit class objects.
// An intermediate layer class G4HitsCollection appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instansiated with a template class. Thus G4HitsCollection
// class MUST NOT be directly used by the user.
class G4HitsCollection : public G4VHitsCollection
{
public:
using G4VHitsCollection::G4VHitsCollection;
~G4HitsCollection() override = default;
G4bool operator==(const G4HitsCollection& right) const;
public:
protected:
void* theCollection = nullptr;
using G4VHitsCollection::G4VHitsCollection;
~G4HitsCollection() override = default;
G4bool operator==(const G4HitsCollection& right) const;
protected:
void* theCollection = nullptr;
};
#if defined G4DIGI_ALLOC_EXPORT
@@ -65,53 +68,54 @@ extern G4DLLIMPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
template <class T>
class G4THitsCollection : public G4HitsCollection
{
public:
G4THitsCollection();
G4THitsCollection(G4String detName, G4String colNam);
~G4THitsCollection() override;
public:
G4bool operator==(const G4THitsCollection<T>& right) const;
G4THitsCollection();
G4THitsCollection(const G4String& detName, const G4String& colNam);
~G4THitsCollection() override;
inline void* operator new(size_t);
inline void operator delete(void* anHC);
G4bool operator==(const G4THitsCollection<T>& right) const;
// Invoke Draw() method on all hit objects in collection
void DrawAllHits() override;
inline void* operator new(std::size_t);
inline void operator delete(void* anHC);
// Invoke Print() method on all hit objects in collection
void PrintAllHits() override;
// Invoke Draw() method on all hit objects in collection
void DrawAllHits() override;
// Returns a pointer to the concrete hit object
// Returns pointer to the concrete hit object at given index
// Not bounds checked
inline T* operator[](size_t i) const { return (*((std::vector<T*>*)theCollection))[i]; }
// Invoke Print() method on all hit objects in collection
void PrintAllHits() override;
// Return pointer to hit collection
inline std::vector<T*>* GetVector() const { return (std::vector<T*>*)theCollection; }
// Returns a pointer to the concrete hit object
// Returns pointer to the concrete hit object at given index
// Not bounds checked
inline T* operator[](std::size_t i) const { return (*((std::vector<T*>*)theCollection))[i]; }
// Insert a hit object in the collection, taking onwenership
// Returns the total number of hit objects stored after insertion
inline size_t insert(T* aHit)
{
auto theHitsCollection = (std::vector<T*>*)theCollection;
theHitsCollection->push_back(aHit);
return theHitsCollection->size();
}
// Return pointer to hit collection
inline std::vector<T*>* GetVector() const { return (std::vector<T*>*)theCollection; }
// Returns the number of hit objects stored in this collection.
inline size_t entries() const
{
auto theHitsCollection = (std::vector<T*>*)theCollection;
return theHitsCollection->size();
}
// Insert a hit object in the collection, taking onwenership
// Returns the total number of hit objects stored after insertion
inline std::size_t insert(T* aHit)
{
auto theHitsCollection = (std::vector<T*>*)theCollection;
theHitsCollection->push_back(aHit);
return theHitsCollection->size();
}
G4VHit* GetHit(size_t i) const override { return (*((std::vector<T*>*)theCollection))[i]; }
// Returns the number of hit objects stored in this collection.
inline std::size_t entries() const
{
auto theHitsCollection = (std::vector<T*>*)theCollection;
return theHitsCollection->size();
}
size_t GetSize() const override { return ((std::vector<T*>*)theCollection)->size(); }
G4VHit* GetHit(std::size_t i) const override { return (*((std::vector<T*>*)theCollection))[i]; }
std::size_t GetSize() const override { return ((std::vector<T*>*)theCollection)->size(); }
};
template <class T>
inline void* G4THitsCollection<T>::operator new(size_t)
inline void* G4THitsCollection<T>::operator new(std::size_t)
{
if (anHCAllocator_G4MT_TLS_() == nullptr) {
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
@@ -133,7 +137,7 @@ G4THitsCollection<T>::G4THitsCollection()
}
template <class T>
G4THitsCollection<T>::G4THitsCollection(G4String detName, G4String colNam)
G4THitsCollection<T>::G4THitsCollection(const G4String& detName, const G4String& colNam)
: G4HitsCollection(detName, colNam)
{
auto theHitsCollection = new std::vector<T*>;
+40 -47
View File
@@ -23,8 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VTHitsMap, G4THitsMultiMap, G4THitsUnorderedMap & G4THitsUnorderedMultiMap
//
// Class description:
//
// This is a template class of hits map and parametrised by
// The concrete class of G4VHit. This is a uniform collection for
// a particular concrete hit class objects.
// An intermediate layer class G4HitsMap appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instantiated with a template class. Thus G4HitsMap
// class MUST NOT be directly used by the user.
//
// Authors: Makoto Asai, Jonathan Madsen
// --------------------------------------------------------------------
#ifndef G4THitsMap_h
#define G4THitsMap_h 1
@@ -35,20 +47,11 @@
#include <unordered_map>
#include <type_traits>
// class description:
//
// This is a template class of hits map and parametrized by
// The concrete class of G4VHit. This is a uniform collection for
// a particular concrete hit class objects.
// An intermediate layer class G4HitsMap appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instansiated with a template class. Thus G4HitsMap
// class MUST NOT be directly used by the user.
template <typename T, typename Map_t = std::map<G4int, T*>>
class G4VTHitsMap : public G4HitsCollection
{
private:
using mmap_t = std::multimap<G4int, T *>;
using pair_t = std::pair<G4int, T *>;
using uommap_t = std::unordered_multimap<G4int, T *>;
@@ -84,11 +87,10 @@ class G4VTHitsMap : public G4HitsCollection
using iterator = typename map_type::iterator;
using const_iterator = typename map_type::const_iterator;
public: // with description
// generic constructor
G4VTHitsMap();
// det + collection description constructor
G4VTHitsMap(G4String detName, G4String colNam);
G4VTHitsMap(const G4String& detName, const G4String& colNam);
// destructor
~G4VTHitsMap() override;
// equivalence operator
@@ -108,13 +110,11 @@ class G4VTHitsMap : public G4HitsCollection
}
//------------------------------------------------------------------------//
public: // with description
void DrawAllHits() override;
void PrintAllHits() override;
// These two methods invokes Draw() and Print() methods of all of
// hit objects stored in this map, respectively.
public:
// Generic iteration
inline Map_t* GetContainer() const { return (Map_t*)theCollection; }
@@ -147,20 +147,17 @@ class G4VTHitsMap : public G4HitsCollection
const_iterator cbegin() const { return GetContainer()->cbegin(); }
const_iterator cend() const { return GetContainer()->cend(); }
public: // with description
// Returns a pointer to a concrete hit object.
inline Map_t* GetMap() const { return (Map_t*)theCollection; }
// Overwrite a hit object. Total number of hit objects stored in this
// map is returned.
inline size_t entries() const { return ((Map_t*)theCollection)->size(); }
inline std::size_t entries() const { return ((Map_t*)theCollection)->size(); }
// Returns the number of hit objects stored in this map
inline void clear();
public:
G4VHit* GetHit(size_t) const override { return nullptr; }
size_t GetSize() const override { return ((Map_t*)theCollection)->size(); }
G4VHit* GetHit(std::size_t) const override { return nullptr; }
std::size_t GetSize() const override { return ((Map_t*)theCollection)->size(); }
public:
//------------------------------------------------------------------------//
// Add/Insert a hit object. Total number of hit objects stored in this
// map is returned.
@@ -171,7 +168,7 @@ class G4VTHitsMap : public G4HitsCollection
// and += adds to white (not correct)
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<is_same_t(U, T) && ! is_mmap_t(MapU_t), G4int> = 0>
size_t add(const G4int& key, U*& aHit) const
std::size_t add(const G4int& key, U*& aHit) const
{
map_type* theHitsMap = GetMap();
if (theHitsMap->find(key) == theHitsMap->end())
@@ -185,7 +182,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
size_t add(const G4int& key, U*& aHit) const
std::size_t add(const G4int& key, U*& aHit) const
{
map_type* theHitsMap = GetMap();
theHitsMap->insert(pair_t(key, aHit));
@@ -197,7 +194,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(! is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
size_t add(const G4int& key, U*& aHit) const
std::size_t add(const G4int& key, U*& aHit) const
{
map_type* theHitsMap = GetMap();
T* hit = allocate();
@@ -206,7 +203,6 @@ class G4VTHitsMap : public G4HitsCollection
return theHitsMap->size();
}
public:
//------------------------------------------------------------------------//
// Standard map overload for same type
// assumes type T has overload of += operator for U
@@ -215,7 +211,7 @@ class G4VTHitsMap : public G4HitsCollection
// and += adds to white (not correct)
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
size_t add(const G4int& key, U& aHit) const
std::size_t add(const G4int& key, U& aHit) const
{
map_type* theHitsMap = GetMap();
if (theHitsMap->find(key) == theHitsMap->end())
@@ -230,7 +226,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(! is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
size_t add(const G4int& key, U& aHit) const
std::size_t add(const G4int& key, U& aHit) const
{
map_type* theHitsMap = GetMap();
if (theHitsMap->find(key) == theHitsMap->end()) theHitsMap->insert(pair_t(key, allocate()));
@@ -242,7 +238,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
size_t add(const G4int& key, U& aHit) const
std::size_t add(const G4int& key, U& aHit) const
{
map_type* theHitsMap = GetMap();
theHitsMap->insert(pair_t(key, new T(aHit)));
@@ -254,7 +250,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(! is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
size_t add(const G4int& key, U& aHit) const
std::size_t add(const G4int& key, U& aHit) const
{
map_type* theHitsMap = GetMap();
T* hit = allocate();
@@ -262,9 +258,7 @@ class G4VTHitsMap : public G4HitsCollection
theHitsMap->insert(pair_t(key, hit));
return theHitsMap->size();
}
//------------------------------------------------------------------------//
public:
//------------------------------------------------------------------------//
// Set a hit object. Total number of hit objects stored in this
// map is returned.
@@ -273,7 +267,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
inline size_t set(const G4int& key, U*& aHit) const
inline std::size_t set(const G4int& key, U*& aHit) const
{
map_type* theHitsMap = GetMap();
if (theHitsMap->find(key) != theHitsMap->end()) delete theHitsMap->find(key)->second;
@@ -285,7 +279,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
inline size_t set(const G4int& key, U*& aHit) const
inline std::size_t set(const G4int& key, U*& aHit) const
{
map_type* theHitsMap = GetMap();
if (theHitsMap->find(key) != theHitsMap->end())
@@ -301,7 +295,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(! is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
inline size_t set(const G4int& key, U*& aHit) const
inline std::size_t set(const G4int& key, U*& aHit) const
{
map_type* theHitsMap = GetMap();
T* hit = nullptr;
@@ -317,7 +311,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(! is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
inline size_t set(const G4int& key, U*& aHit) const
inline std::size_t set(const G4int& key, U*& aHit) const
{
map_type* theHitsMap = GetMap();
T* hit = allocate();
@@ -330,9 +324,7 @@ class G4VTHitsMap : public G4HitsCollection
}
return theHitsMap->size();
}
//------------------------------------------------------------------------//
public:
//------------------------------------------------------------------------//
// Set a hit object. Total number of hit objects stored in this
// map is returned.
@@ -341,7 +333,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
inline size_t set(const G4int& key, U& aHit) const
inline std::size_t set(const G4int& key, U& aHit) const
{
map_type* theHitsMap = GetMap();
T* hit = nullptr;
@@ -357,7 +349,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
inline size_t set(const G4int& key, U& aHit) const
inline std::size_t set(const G4int& key, U& aHit) const
{
map_type* theHitsMap = GetMap();
if (theHitsMap->find(key) != theHitsMap->end())
@@ -371,7 +363,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(! is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
inline size_t set(const G4int& key, U& aHit) const
inline std::size_t set(const G4int& key, U& aHit) const
{
map_type* theHitsMap = GetMap();
T* hit = nullptr;
@@ -387,7 +379,7 @@ class G4VTHitsMap : public G4HitsCollection
//------------------------------------------------------------------------//
template <typename U = T, typename MapU_t = Map_t,
enable_if_t<(! is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
inline size_t set(const G4int& key, U& aHit) const
inline std::size_t set(const G4int& key, U& aHit) const
{
map_type* theHitsMap = GetMap();
T* hit = allocate();
@@ -398,9 +390,7 @@ class G4VTHitsMap : public G4HitsCollection
theHitsMap->insert(pair_t(key, hit));
return theHitsMap->size();
}
//------------------------------------------------------------------------//
public:
//------------------------------------------------------------------------//
// Enable bracket operator. Return pointer to data indexed by key or
// last occurring instance of pointer to data index by key in the
@@ -418,7 +408,7 @@ class G4VTHitsMap : public G4HitsCollection
T* operator[](G4int key) const
{
#ifdef G4VERBOSE
static bool _first = true;
static G4bool _first = true;
if (_first) {
_first = false;
G4Exception("G4THitsMap operator[]", "calling [] on multimap", JustWarning,
@@ -453,7 +443,7 @@ G4VTHitsMap<T, Map_t>::G4VTHitsMap()
//============================================================================//
template <typename T, typename Map_t>
G4VTHitsMap<T, Map_t>::G4VTHitsMap(G4String detName, G4String colNam)
G4VTHitsMap<T, Map_t>::G4VTHitsMap(const G4String& detName, const G4String& colNam)
: G4HitsCollection(detName, colNam)
{
theCollection = (void*)new Map_t;
@@ -564,7 +554,8 @@ class G4THitsMultiMap : public G4VTHitsMap<_Tp, std::multimap<G4int, _Tp*>>
public:
G4THitsMultiMap() : parent_type() {}
G4THitsMultiMap(G4String detName, G4String colName) : parent_type(detName, colName) {}
G4THitsMultiMap(const G4String& detName, const G4String& colName)
: parent_type(detName, colName) {}
using parent_type::operator+=;
using parent_type::operator==;
@@ -594,7 +585,8 @@ class G4THitsUnorderedMap : public G4VTHitsMap<_Tp, std::unordered_map<G4int, _T
public:
G4THitsUnorderedMap() : parent_type() {}
G4THitsUnorderedMap(G4String detName, G4String colName) : parent_type(detName, colName) {}
G4THitsUnorderedMap(const G4String& detName, const G4String& colName)
: parent_type(detName, colName) {}
using parent_type::operator+=;
using parent_type::operator==;
@@ -624,7 +616,8 @@ class G4THitsUnorderedMultiMap : public G4VTHitsMap<_Tp, std::unordered_multimap
public:
G4THitsUnorderedMultiMap() : parent_type() {}
G4THitsUnorderedMultiMap(G4String detName, G4String colName) : parent_type(detName, colName) {}
G4THitsUnorderedMultiMap(const G4String& detName, const G4String& colName)
: parent_type(detName, colName) {}
using parent_type::operator+=;
using parent_type::operator==;
@@ -23,8 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VTHitsVector, G4THitsVector & G4THitsDeque
//
// Class description:
//
// This is a template class of hits Vector and parametrised by
// The concrete class of G4VHit. This is a uniform collection for
// a particular concrete hit class objects.
// An intermediate layer class G4HitsVector appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instantiated with a template class. Thus G4HitsVector
// class MUST NOT be directly used by the user.
//
// Author: Makoto Asai, Jonathan Madsen
// --------------------------------------------------------------------
#ifndef G4THitsVector_h
#define G4THitsVector_h 1
@@ -37,20 +49,11 @@
#include <unordered_map>
#include <vector>
// class description:
//
// This is a template class of hits Vector and parametrized by
// The concrete class of G4VHit. This is a uniform collection for
// a particular concrete hit class objects.
// An intermediate layer class G4HitsVector appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instansiated with a template class. Thus G4HitsVector
// class MUST NOT be directly used by the user.
template <typename T, typename Vector_t = std::deque<T*>>
class G4VTHitsVector : public G4HitsCollection
{
public:
using this_type = G4VTHitsVector<T, Vector_t>;
using value_type = T;
using vector_type = Vector_t;
@@ -77,14 +80,15 @@ class G4VTHitsVector : public G4HitsCollection
#define is_pointer_t(_Tp) std::is_pointer<_Tp>::value
#define scast(_Tp) static_cast<_Tp>
template <bool _Bp, typename _Tp = void>
template <G4bool _Bp, typename _Tp = void>
using enable_if_t = typename std::enable_if<_Bp, _Tp>::type;
public:
// generic constructor
G4VTHitsVector(G4int init_size = 0);
// det + collection description constructor
G4VTHitsVector(G4String detName, G4String colNam, G4int init_size = 0);
G4VTHitsVector(const G4String& detName, const G4String& colNam, G4int init_size = 0);
// destructor
~G4VTHitsVector() override;
// equivalence operator
@@ -165,7 +169,6 @@ class G4VTHitsVector : public G4HitsCollection
inline map_t* GetMap() const;
public:
//------------------------------------------------------------------------//
// POINTER TYPE
//------------------------------------------------------------------------//
@@ -219,7 +222,6 @@ class G4VTHitsVector : public G4HitsCollection
return store_type();
}
public:
//------------------------------------------------------------------------//
// Generic operator += where add(...) overloads handle various
// U and VectorU_t types
@@ -269,7 +271,6 @@ class G4VTHitsVector : public G4HitsCollection
}
//------------------------------------------------------------------------//
public:
//------------------------------------------------------------------------//
// Insert a hit object. Total number of hit objects stored in this
// map is returned.
@@ -318,7 +319,6 @@ class G4VTHitsVector : public G4HitsCollection
}
//------------------------------------------------------------------------//
public:
//------------------------------------------------------------------------//
// Set a hit object. Total number of hit objects stored in this
// map is returned.
@@ -346,7 +346,6 @@ class G4VTHitsVector : public G4HitsCollection
}
//------------------------------------------------------------------------//
public:
//------------------------------------------------------------------------//
// Set a hit object. Total number of hit objects stored in this
// map is returned.
@@ -372,9 +371,7 @@ class G4VTHitsVector : public G4HitsCollection
_assign(theHitsVector, key, &aHit);
return theHitsVector->size();
}
//------------------------------------------------------------------------//
public:
//------------------------------------------------------------------------//
T* at(G4int key) const
{
@@ -392,6 +389,7 @@ class G4VTHitsVector : public G4HitsCollection
//------------------------------------------------------------------------//
protected:
template <typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int> = 0>
void resize(vector_type*& theHitsVector, const G4int& key) const
{
@@ -557,7 +555,7 @@ G4VTHitsVector<T, Vector_t>::G4VTHitsVector(G4int init_size)
//============================================================================//
template <typename T, typename Vector_t>
G4VTHitsVector<T, Vector_t>::G4VTHitsVector(G4String detName, G4String colNam, G4int init_size)
G4VTHitsVector<T, Vector_t>::G4VTHitsVector(const G4String& detName, const G4String& colNam, G4int init_size)
: G4HitsCollection(detName, colNam)
{
theCollection = static_cast<void*>(new Vector_t);
@@ -590,7 +588,7 @@ G4bool G4VTHitsVector<T, Vector_t>::operator==(const G4VTHitsVector<T, Vector_t>
template <typename T, typename Vector_t>
typename G4VTHitsVector<T, Vector_t>::map_t* G4VTHitsVector<T, Vector_t>::GetMap() const
{
G4ThreadLocalStatic auto theHitsMap = new map_t();
G4ThreadLocalStatic auto theHitsMap = new map_t();
theHitsMap->clear();
vector_type* theHitsVector = GetVector();
for (std::size_t i = 0; i < theHitsVector->size(); ++i) {
@@ -654,7 +652,7 @@ class G4THitsVector : public G4VTHitsVector<_Tp, std::vector<_Tp*>>
public:
G4THitsVector(G4int init_size = 0) : parent_type(init_size) {}
G4THitsVector(G4String detName, G4String colName, G4int init_size = 0)
G4THitsVector(const G4String& detName, const G4String& colName, G4int init_size = 0)
: parent_type(detName, colName, init_size)
{}
@@ -687,7 +685,7 @@ class G4THitsDeque : public G4VTHitsVector<_Tp, std::deque<_Tp*>>
public:
G4THitsDeque(G4int init_size = 0) : parent_type(init_size) {}
G4THitsDeque(G4String detName, G4String colName, G4int init_size = 0)
G4THitsDeque(const G4String& detName, const G4String& colName, G4int init_size = 0)
: parent_type(detName, colName, init_size)
{}
+13 -11
View File
@@ -23,9 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VHit
//
// Class description:
//
// This is the base class of hit object. The user should derive this
// base class to make his/her own hit class. Two virtual method Draw()
// and Print() can be implemented if the user wants these functionalities.
// If a concrete hit class is used as a transient class, G4Allocator
// must be used.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VHit_h
#define G4VHit_h 1
@@ -37,24 +46,17 @@
class G4AttDef;
class G4AttValue;
// class description:
//
// This is the base class of hit object. The user should derive this
// base class to make his/her own hit class. Two virtual method Draw()
// and Print() can be implemented if the user wants these functionarities.
// If a concrete hit class is used as a transient class, G4Allocator
// must be used.
class G4VHit
{
public:
G4VHit() = default;
virtual ~G4VHit() = default;
G4bool operator==(const G4VHit&) const { return false; }
virtual void Draw(){};
virtual void Print(){};
virtual void Draw() {}
virtual void Print() {}
// Returns pointer to map of attribute definitions for this hit
// Caller is responsible for checking validity of returned pointer.
@@ -23,29 +23,31 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4VHitsCollection
//
// Class description:
//
// This is the base class of hits collection. The user is advised to
// use G4THitsCollection template class in case his/her collection is
// transient. While, in case the collection is persistent,
// the concrete collection class can be directly derived from this
// class. Geant4 kernel will use this class methods.
//
// Author: Makoto Asai
// --------------------------------------------------------------------
#ifndef G4VHitsCollection_h
#define G4VHitsCollection_h 1
class G4VHit;
#include "globals.hh"
// class description:
//
// This is the base class of hits collection. The user is advised to
// use G4THitsCollection template class in case his/her collection is
// transient. While, in case the collection is persistent with ODBMS,
// the concrete collection class can be directly derived from this
// class.
// Geant4 kernel will use this class methods.
class G4VHit;
class G4VHitsCollection
{
public:
G4VHitsCollection() = default;
G4VHitsCollection(G4String detName, G4String colNam);
G4VHitsCollection(const G4String& detName, const G4String& colNam);
virtual ~G4VHitsCollection() = default;
G4bool operator==(const G4VHitsCollection& right) const;
@@ -60,10 +62,11 @@ class G4VHitsCollection
// GetHit and GetSize are given a default implementation here so
// that the template G4THitsCollection can be used, but they
// are re-implemented G4THitsCollection.
virtual G4VHit* GetHit(size_t) const { return nullptr; }
virtual size_t GetSize() const { return 0; };
virtual G4VHit* GetHit(std::size_t) const { return nullptr; }
virtual std::size_t GetSize() const { return 0; };
protected:
// Collection name
G4String collectionName = "Unknown";
G4String SDname = "Unknown";
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4HCofThisEvent
// --------------------------------------------------------------------
#include "G4HCofThisEvent.hh"
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4THitsCollection
// --------------------------------------------------------------------
#include "G4THitsCollection.hh"
@@ -23,14 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// G4VHitsCollection
// --------------------------------------------------------------------
#include "G4VHitsCollection.hh"
G4VHitsCollection::G4VHitsCollection(G4String detName, G4String colNam)
G4VHitsCollection::G4VHitsCollection(const G4String& detName, const G4String& colNam)
: collectionName(colNam), SDname(detName), colID(-1)
{}
+8 -2
View File
@@ -1,8 +1,14 @@
# Category detscorer History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-07-09 Gabriele Cosmo (detscorer-V11-02-00)
- Fixed reported Coverity defects, use "const G4String&" as argument in
a consistent way across all classes.
## 2022-10-03 Ben Morgan (detscorer-V11-00-01)
- Apply standard clang-tidy plus range-based for and boolean simplification fixes
@@ -44,8 +44,8 @@
class G4PSCellCharge : public G4VPrimitiveScorer
{
public:
G4PSCellCharge(G4String name, G4int depth = 0);
G4PSCellCharge(G4String name, const G4String& unit, G4int depth = 0);
G4PSCellCharge(const G4String& name, G4int depth = 0);
G4PSCellCharge(const G4String& name, const G4String& unit, G4int depth = 0);
~G4PSCellCharge() override = default;
void Initialize(G4HCofThisEvent*) override;
@@ -43,11 +43,11 @@
class G4PSCellCharge3D : public G4PSCellCharge
{
public:
G4PSCellCharge3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSCellCharge3D(G4String name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSCellCharge3D(const G4String& name, G4int ni=1, G4int nj=1, G4int nk=1,
G4int depi=2, G4int depj=1, G4int depk=0);
G4PSCellCharge3D(const G4String& name, const G4String& unit, G4int ni=1,
G4int nj=1, G4int nk=1, G4int depi=2, G4int depj=1,
G4int depk=0);
~G4PSCellCharge3D() override = default;
@@ -57,8 +57,8 @@ class G4VSolid;
class G4PSCellFlux : public G4VPrimitivePlotter
{
public:
G4PSCellFlux(G4String name, G4int depth = 0);
G4PSCellFlux(G4String name, const G4String& unit, G4int depth = 0);
G4PSCellFlux(const G4String& name, G4int depth = 0);
G4PSCellFlux(const G4String& name, const G4String& unit, G4int depth = 0);
~G4PSCellFlux() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -50,9 +50,9 @@
class G4PSCellFlux3D : public G4PSCellFlux
{
public:
G4PSCellFlux3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSCellFlux3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSCellFlux3D(G4String name, const G4String& unit, G4int ni = 1,
G4PSCellFlux3D(const G4String& name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
~G4PSCellFlux3D() override = default;
@@ -51,10 +51,10 @@
class G4PSCellFluxForCylinder3D : public G4PSCellFlux3D
{
public:
G4PSCellFluxForCylinder3D(G4String name, G4int ni = 1, G4int nj = 1,
G4PSCellFluxForCylinder3D(const G4String& name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSCellFluxForCylinder3D(G4String name, const G4String& unit, G4int ni = 1,
G4PSCellFluxForCylinder3D(const G4String& name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
~G4PSCellFluxForCylinder3D() override = default;
@@ -60,8 +60,8 @@
class G4PSCylinderSurfaceCurrent : public G4VPrimitivePlotter
{
public:
G4PSCylinderSurfaceCurrent(G4String name, G4int direction, G4int depth = 0);
G4PSCylinderSurfaceCurrent(G4String name, G4int direction,
G4PSCylinderSurfaceCurrent(const G4String& name, G4int direction, G4int depth = 0);
G4PSCylinderSurfaceCurrent(const G4String& name, G4int direction,
const G4String& unit, G4int depth = 0);
~G4PSCylinderSurfaceCurrent() override = default;
@@ -52,10 +52,10 @@
class G4PSCylinderSurfaceCurrent3D : public G4PSCylinderSurfaceCurrent
{
public:
G4PSCylinderSurfaceCurrent3D(G4String name, G4int direction, G4int ni = 1,
G4PSCylinderSurfaceCurrent3D(const G4String& name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSCylinderSurfaceCurrent3D(G4String name, G4int direction,
G4PSCylinderSurfaceCurrent3D(const G4String& name, G4int direction,
const G4String& unit, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
@@ -60,8 +60,8 @@
class G4PSCylinderSurfaceFlux : public G4VPrimitivePlotter
{
public:
G4PSCylinderSurfaceFlux(G4String name, G4int direction, G4int depth = 0);
G4PSCylinderSurfaceFlux(G4String name, G4int direction, const G4String& unit,
G4PSCylinderSurfaceFlux(const G4String& name, G4int direction, G4int depth = 0);
G4PSCylinderSurfaceFlux(const G4String& name, G4int direction, const G4String& unit,
G4int depth = 0);
~G4PSCylinderSurfaceFlux() override = default;
@@ -52,10 +52,10 @@
class G4PSCylinderSurfaceFlux3D : public G4PSCylinderSurfaceFlux
{
public:
G4PSCylinderSurfaceFlux3D(G4String name, G4int direction, G4int ni = 1,
G4PSCylinderSurfaceFlux3D(const G4String& name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int di = 2,
G4int dj = 1, G4int dk = 0);
G4PSCylinderSurfaceFlux3D(G4String name, G4int direction,
G4PSCylinderSurfaceFlux3D(const G4String& name, G4int direction,
const G4String& unit, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int di = 2, G4int dj = 1,
G4int dk = 0);
@@ -46,8 +46,8 @@
class G4PSDoseDeposit : public G4VPrimitivePlotter
{
public:
G4PSDoseDeposit(G4String name, G4int depth = 0);
G4PSDoseDeposit(G4String name, const G4String& unit, G4int depth = 0);
G4PSDoseDeposit(const G4String& name, G4int depth = 0);
G4PSDoseDeposit(const G4String& name, const G4String& unit, G4int depth = 0);
~G4PSDoseDeposit() override = default;
void Initialize(G4HCofThisEvent*) override;
@@ -43,9 +43,9 @@
class G4PSDoseDeposit3D : public G4PSDoseDeposit
{
public:
G4PSDoseDeposit3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSDoseDeposit3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSDoseDeposit3D(G4String name, const G4String& unit, G4int ni = 1,
G4PSDoseDeposit3D(const G4String& name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
@@ -44,10 +44,10 @@
class G4PSDoseDepositForCylinder3D : public G4PSDoseDeposit3D
{
public:
G4PSDoseDepositForCylinder3D(G4String name, G4int ni = 1, G4int nj = 1,
G4PSDoseDepositForCylinder3D(const G4String& name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSDoseDepositForCylinder3D(G4String name, const G4String& unit,
G4PSDoseDepositForCylinder3D(const G4String& name, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
@@ -47,8 +47,8 @@
class G4PSEnergyDeposit : public G4VPrimitivePlotter
{
public:
G4PSEnergyDeposit(G4String name, G4int depth = 0); // default unit
G4PSEnergyDeposit(G4String name, const G4String& unit, G4int depth = 0);
G4PSEnergyDeposit(const G4String& name, G4int depth = 0); // default unit
G4PSEnergyDeposit(const G4String& name, const G4String& unit, G4int depth = 0);
~G4PSEnergyDeposit() override = default;
public:
@@ -41,9 +41,9 @@
class G4PSEnergyDeposit3D : public G4PSEnergyDeposit
{
public:
G4PSEnergyDeposit3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSEnergyDeposit3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSEnergyDeposit3D(G4String name, const G4String& unit, G4int ni = 1,
G4PSEnergyDeposit3D(const G4String& name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
@@ -61,8 +61,8 @@
class G4PSFlatSurfaceCurrent : public G4VPrimitivePlotter
{
public:
G4PSFlatSurfaceCurrent(G4String name, G4int direction, G4int depth = 0);
G4PSFlatSurfaceCurrent(G4String name, G4int direction, const G4String& unit,
G4PSFlatSurfaceCurrent(const G4String& name, G4int direction, G4int depth = 0);
G4PSFlatSurfaceCurrent(const G4String& name, G4int direction, const G4String& unit,
G4int depth = 0);
~G4PSFlatSurfaceCurrent() override = default;
@@ -52,10 +52,10 @@
class G4PSFlatSurfaceCurrent3D : public G4PSFlatSurfaceCurrent
{
public:
G4PSFlatSurfaceCurrent3D(G4String name, G4int direction, G4int ni = 1,
G4PSFlatSurfaceCurrent3D(const G4String& name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSFlatSurfaceCurrent3D(G4String name, G4int direction, const G4String& unit,
G4PSFlatSurfaceCurrent3D(const G4String& name, G4int direction, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
~G4PSFlatSurfaceCurrent3D() override = default;
@@ -63,8 +63,8 @@
class G4PSFlatSurfaceFlux : public G4VPrimitivePlotter
{
public:
G4PSFlatSurfaceFlux(G4String name, G4int direction, G4int depth = 0);
G4PSFlatSurfaceFlux(G4String name, G4int direction, const G4String& unit,
G4PSFlatSurfaceFlux(const G4String& name, G4int direction, G4int depth = 0);
G4PSFlatSurfaceFlux(const G4String& name, G4int direction, const G4String& unit,
G4int depth = 0);
~G4PSFlatSurfaceFlux() override = default;
@@ -54,10 +54,10 @@
class G4PSFlatSurfaceFlux3D : public G4PSFlatSurfaceFlux
{
public:
G4PSFlatSurfaceFlux3D(G4String name, G4int direction, G4int ni = 1,
G4PSFlatSurfaceFlux3D(const G4String& name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSFlatSurfaceFlux3D(G4String name, G4int direction, const G4String& unit,
G4PSFlatSurfaceFlux3D(const G4String& name, G4int direction, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
~G4PSFlatSurfaceFlux3D() override = default;
@@ -48,8 +48,8 @@
class G4PSMinKinEAtGeneration : public G4VPrimitivePlotter
{
public:
G4PSMinKinEAtGeneration(G4String name, G4int depth = 0);
G4PSMinKinEAtGeneration(G4String name, const G4String& unit, G4int depth = 0);
G4PSMinKinEAtGeneration(const G4String& name, G4int depth = 0);
G4PSMinKinEAtGeneration(const G4String& name, const G4String& unit, G4int depth = 0);
~G4PSMinKinEAtGeneration() override = default;
void Initialize(G4HCofThisEvent*) override;
@@ -45,10 +45,10 @@
class G4PSMinKinEAtGeneration3D : public G4PSMinKinEAtGeneration
{
public:
G4PSMinKinEAtGeneration3D(G4String name, G4int ni = 1, G4int nj = 1,
G4PSMinKinEAtGeneration3D(const G4String& name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSMinKinEAtGeneration3D(G4String name, const G4String& unit, G4int ni = 1,
G4PSMinKinEAtGeneration3D(const G4String& name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
~G4PSMinKinEAtGeneration3D() override = default;
@@ -44,7 +44,7 @@
class G4PSNofCollision : public G4VPrimitiveScorer
{
public:
G4PSNofCollision(G4String name, G4int depth = 0);
G4PSNofCollision(const G4String& name, G4int depth = 0);
~G4PSNofCollision() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -42,7 +42,7 @@
class G4PSNofCollision3D : public G4PSNofCollision
{
public:
G4PSNofCollision3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSNofCollision3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
~G4PSNofCollision3D() override = default;
@@ -53,7 +53,7 @@
class G4PSNofSecondary : public G4VPrimitivePlotter
{
public:
G4PSNofSecondary(G4String name, G4int depth = 0);
G4PSNofSecondary(const G4String& name, G4int depth = 0);
~G4PSNofSecondary() override = default;
// Scoring option
@@ -41,7 +41,7 @@
class G4PSNofSecondary3D : public G4PSNofSecondary
{
public:
G4PSNofSecondary3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSNofSecondary3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
~G4PSNofSecondary3D() override = default;
@@ -46,7 +46,7 @@
class G4PSNofStep : public G4VPrimitivePlotter
{
public:
G4PSNofStep(G4String name, G4int depth = 0);
G4PSNofStep(const G4String& name, G4int depth = 0);
~G4PSNofStep() override = default;
void Initialize(G4HCofThisEvent*) override;
@@ -42,7 +42,7 @@
class G4PSNofStep3D : public G4PSNofStep
{
public:
G4PSNofStep3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSNofStep3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
~G4PSNofStep3D() override = default;
@@ -49,7 +49,7 @@
class G4PSPassageCellCurrent : public G4VPrimitivePlotter
{
public:
G4PSPassageCellCurrent(G4String name, G4int depth = 0);
G4PSPassageCellCurrent(const G4String& name, G4int depth = 0);
~G4PSPassageCellCurrent() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -45,7 +45,7 @@
class G4PSPassageCellCurrent3D : public G4PSPassageCellCurrent
{
public:
G4PSPassageCellCurrent3D(G4String name, G4int ni = 1, G4int nj = 1,
G4PSPassageCellCurrent3D(const G4String& name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
~G4PSPassageCellCurrent3D() override = default;
@@ -53,8 +53,8 @@
class G4PSPassageCellFlux : public G4VPrimitivePlotter
{
public:
G4PSPassageCellFlux(G4String name, G4int depth = 0);
G4PSPassageCellFlux(G4String name, const G4String& unit, G4int depth = 0);
G4PSPassageCellFlux(const G4String& name, G4int depth = 0);
G4PSPassageCellFlux(const G4String& name, const G4String& unit, G4int depth = 0);
~G4PSPassageCellFlux() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -47,9 +47,9 @@
class G4PSPassageCellFlux3D : public G4PSPassageCellFlux
{
public:
G4PSPassageCellFlux3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSPassageCellFlux3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSPassageCellFlux3D(G4String name, const G4String& unit, G4int ni = 1,
G4PSPassageCellFlux3D(const G4String& name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
~G4PSPassageCellFlux3D() override = default;
@@ -48,10 +48,10 @@
class G4PSPassageCellFluxForCylinder3D : public G4PSPassageCellFlux3D
{
public:
G4PSPassageCellFluxForCylinder3D(G4String name, G4int ni = 1, G4int nj = 1,
G4PSPassageCellFluxForCylinder3D(const G4String& name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSPassageCellFluxForCylinder3D(G4String name, const G4String& unit,
G4PSPassageCellFluxForCylinder3D(const G4String& name, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1,
G4int depk = 0);
@@ -48,8 +48,8 @@
class G4PSPassageTrackLength : public G4VPrimitivePlotter
{
public:
G4PSPassageTrackLength(G4String name, G4int depth = 0);
G4PSPassageTrackLength(G4String name, const G4String& unit, G4int depth = 0);
G4PSPassageTrackLength(const G4String& name, G4int depth = 0);
G4PSPassageTrackLength(const G4String& name, const G4String& unit, G4int depth = 0);
~G4PSPassageTrackLength() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -45,10 +45,10 @@
class G4PSPassageTrackLength3D : public G4PSPassageTrackLength
{
public:
G4PSPassageTrackLength3D(G4String name, G4int ni = 1, G4int nj = 1,
G4PSPassageTrackLength3D(const G4String& name, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
G4PSPassageTrackLength3D(G4String name, const G4String& unit, G4int ni = 1,
G4PSPassageTrackLength3D(const G4String& name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
@@ -47,7 +47,7 @@
class G4PSPopulation : public G4VPrimitiveScorer
{
public:
G4PSPopulation(G4String name, G4int depth = 0);
G4PSPopulation(const G4String& name, G4int depth = 0);
~G4PSPopulation() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -42,7 +42,7 @@
class G4PSPopulation3D : public G4PSPopulation
{
public:
G4PSPopulation3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSPopulation3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
~G4PSPopulation3D() override = default;
@@ -58,8 +58,8 @@
class G4PSSphereSurfaceCurrent : public G4VPrimitiveScorer
{
public:
G4PSSphereSurfaceCurrent(G4String name, G4int direction, G4int depth = 0);
G4PSSphereSurfaceCurrent(G4String name, G4int direction, const G4String& unit,
G4PSSphereSurfaceCurrent(const G4String& name, G4int direction, G4int depth = 0);
G4PSSphereSurfaceCurrent(const G4String& name, G4int direction, const G4String& unit,
G4int depth = 0);
~G4PSSphereSurfaceCurrent() override = default;
@@ -52,10 +52,10 @@
class G4PSSphereSurfaceCurrent3D : public G4PSSphereSurfaceCurrent
{
public:
G4PSSphereSurfaceCurrent3D(G4String name, G4int direction, G4int ni = 1,
G4PSSphereSurfaceCurrent3D(const G4String& name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSSphereSurfaceCurrent3D(G4String name, G4int direction,
G4PSSphereSurfaceCurrent3D(const G4String& name, G4int direction,
const G4String& unit, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
@@ -59,8 +59,8 @@
class G4PSSphereSurfaceFlux : public G4VPrimitiveScorer
{
public:
G4PSSphereSurfaceFlux(G4String name, G4int direction, G4int depth = 0);
G4PSSphereSurfaceFlux(G4String name, G4int direction, const G4String& unit,
G4PSSphereSurfaceFlux(const G4String& name, G4int direction, G4int depth = 0);
G4PSSphereSurfaceFlux(const G4String& name, G4int direction, const G4String& unit,
G4int depth = 0);
~G4PSSphereSurfaceFlux() override = default;
@@ -52,11 +52,11 @@
class G4PSSphereSurfaceFlux3D : public G4PSSphereSurfaceFlux
{
public:
G4PSSphereSurfaceFlux3D(G4String name, G4int direction, G4int ni = 1,
G4PSSphereSurfaceFlux3D(const G4String& name, G4int direction, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2,
G4int depj = 1, G4int depk = 0);
G4PSSphereSurfaceFlux3D(G4String name, G4int direction, const G4String& unit,
G4PSSphereSurfaceFlux3D(const G4String& name, G4int direction, const G4String& unit,
G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
@@ -43,7 +43,7 @@
class G4PSStepChecker : public G4VPrimitiveScorer
{
public:
G4PSStepChecker(G4String name, G4int depth = 0);
G4PSStepChecker(const G4String& name, G4int depth = 0);
~G4PSStepChecker() override = default;
protected:
@@ -42,7 +42,7 @@
class G4PSStepChecker3D : public G4PSStepChecker
{
public:
G4PSStepChecker3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSStepChecker3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
~G4PSStepChecker3D() override = default;
@@ -44,7 +44,7 @@
class G4PSTermination : public G4VPrimitiveScorer
{
public:
G4PSTermination(G4String name, G4int depth = 0);
G4PSTermination(const G4String& name, G4int depth = 0);
~G4PSTermination() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -42,7 +42,7 @@
class G4PSTermination3D : public G4PSTermination
{
public:
G4PSTermination3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSTermination3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int di = 2, G4int dj = 1, G4int dk = 0);
~G4PSTermination3D() override = default;
@@ -48,7 +48,7 @@
class G4PSTrackCounter : public G4VPrimitivePlotter
{
public:
G4PSTrackCounter(G4String name, G4int direction, G4int depth = 0);
G4PSTrackCounter(const G4String& name, G4int direction, G4int depth = 0);
~G4PSTrackCounter() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -43,7 +43,7 @@
class G4PSTrackCounter3D : public G4PSTrackCounter
{
public:
G4PSTrackCounter3D(G4String name, G4int direction, G4int ni = 1, G4int nj = 1,
G4PSTrackCounter3D(const G4String& name, G4int direction, G4int ni = 1, G4int nj = 1,
G4int nk = 1, G4int di = 2, G4int dj = 1, G4int dk = 0);
~G4PSTrackCounter3D() override = default;
@@ -48,8 +48,8 @@
class G4PSTrackLength : public G4VPrimitiveScorer
{
public:
G4PSTrackLength(G4String name, G4int depth = 0);
G4PSTrackLength(G4String name, const G4String& unit, G4int depth = 0);
G4PSTrackLength(const G4String& name, G4int depth = 0);
G4PSTrackLength(const G4String& name, const G4String& unit, G4int depth = 0);
~G4PSTrackLength() override = default;
inline void Weighted(G4bool flg = true) { weighted = flg; }
@@ -44,9 +44,9 @@
class G4PSTrackLength3D : public G4PSTrackLength
{
public:
G4PSTrackLength3D(G4String name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4PSTrackLength3D(const G4String& name, G4int ni = 1, G4int nj = 1, G4int nk = 1,
G4int depi = 2, G4int depj = 1, G4int depk = 0);
G4PSTrackLength3D(G4String name, const G4String& unit, G4int ni = 1,
G4PSTrackLength3D(const G4String& name, const G4String& unit, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
~G4PSTrackLength3D() override = default;
@@ -43,7 +43,7 @@
class G4PSVolumeFlux : public G4VPrimitivePlotter
{
public:
G4PSVolumeFlux(G4String name, G4int direction = 1, G4int depth = 0);
G4PSVolumeFlux(const G4String& name, G4int direction = 1, G4int depth = 0);
~G4PSVolumeFlux() override = default;
public:
@@ -41,7 +41,7 @@
class G4PSVolumeFlux3D : public G4PSVolumeFlux
{
public:
G4PSVolumeFlux3D(G4String name, G4int direction = 1, G4int ni = 1,
G4PSVolumeFlux3D(const G4String& name, G4int direction = 1, G4int ni = 1,
G4int nj = 1, G4int nk = 1, G4int depi = 2, G4int depj = 1,
G4int depk = 0);
@@ -48,7 +48,7 @@ class G4ChargedDefinition;
class G4SDChargedFilter : public G4VSDFilter
{
public:
G4SDChargedFilter(G4String name);
G4SDChargedFilter(const G4String& name);
~G4SDChargedFilter() override = default;
G4bool Accept(const G4Step*) const override;
@@ -50,7 +50,7 @@
class G4SDKineticEnergyFilter : public G4VSDFilter
{
public:
G4SDKineticEnergyFilter(G4String name, G4double elow = 0.0,
G4SDKineticEnergyFilter(const G4String& name, G4double elow = 0.0,
G4double ehigh = DBL_MAX);
// Constructor. Filter name and kinetic energy range( elow, ehigh).
@@ -49,7 +49,7 @@ class G4NeutralDefinition;
class G4SDNeutralFilter : public G4VSDFilter
{
public:
G4SDNeutralFilter(G4String name);
G4SDNeutralFilter(const G4String& name);
~G4SDNeutralFilter() override = default;
G4bool Accept(const G4Step*) const override;
@@ -52,10 +52,11 @@ class G4ParticleDefinition;
class G4SDParticleFilter : public G4VSDFilter
{
public:
G4SDParticleFilter(G4String name);
G4SDParticleFilter(G4String name, const G4String& particleName);
G4SDParticleFilter(G4String name, const std::vector<G4String>& particleNames);
G4SDParticleFilter(G4String name,
G4SDParticleFilter(const G4String& name);
G4SDParticleFilter(const G4String& name, const G4String& particleName);
G4SDParticleFilter(const G4String& name,
const std::vector<G4String>& particleNames);
G4SDParticleFilter(const G4String& name,
const std::vector<G4ParticleDefinition*>& particleDef);
// Constructors. Filter name and particle's name.
//
@@ -50,7 +50,7 @@ class G4ParticleDefinition;
class G4SDParticleWithEnergyFilter : public G4VSDFilter
{
public:
G4SDParticleWithEnergyFilter(G4String name, G4double elow = 0.0,
G4SDParticleWithEnergyFilter(const G4String& name, G4double elow = 0.0,
G4double ehigh = DBL_MAX);
G4SDParticleWithEnergyFilter(const G4SDParticleWithEnergyFilter&);
G4SDParticleWithEnergyFilter& operator=(const G4SDParticleWithEnergyFilter&);

Some files were not shown because too many files have changed in this diff Show More