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
+4
View File
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-07-15 Gabriele Cosmo (readout-V11-02-00)
- Fixed reported Coverity defects, use consistently 'const G4String&' to
avoid implicit copy.
## 2022-12-12 Ben Morgan (readout-V11-01-00)
- Remove obsolete GNUmakefile scripts
+9 -9
View File
@@ -53,18 +53,14 @@ class G4DCtable
G4DCtable();
~G4DCtable();
public:
G4int Registor(G4String SDname,G4String DCname);
G4int GetCollectionID(G4String DCname) const;
G4int Registor(const G4String& SDname, const G4String& DCname);
G4int GetCollectionID(const G4String& DCname) const;
G4int GetCollectionID(G4VDigitizerModule* aDM) const;
private:
std::vector<G4String> DMlist;
std::vector<G4String> DClist;
public:
inline G4int entries() const
{ return G4int(DClist.size()); }
{
return G4int(DClist.size());
}
inline G4String GetDMname(G4int i) const
{
if(i<0||i>entries()) return "***Not Defined***";
@@ -75,6 +71,10 @@ class G4DCtable
if(i<0||i>entries()) return "***Not Defined***";
return DClist[i];
}
private:
std::vector<G4String> DMlist;
std::vector<G4String> DClist;
};
#endif
+10 -10
View File
@@ -39,19 +39,21 @@
#define G4DigiManager_hh 1
#include "globals.hh"
class G4Event;
#include "G4VDigitizerModule.hh"
#include "G4DCtable.hh"
#include <vector>
class G4Event;
class G4VHitsCollection;
class G4VDigiCollection;
class G4DMmessenger;
#include "G4DCtable.hh"
class G4RunManager;
class G4SDManager;
#include <vector>
class G4DigiManager
{
public: // with description
public:
static G4DigiManager* GetDMpointer();
// Returns the pointer to the singleton object
@@ -63,18 +65,16 @@ class G4DigiManager
G4DigiManager(const G4DigiManager&) = delete;
G4DigiManager& operator=(const G4DigiManager&) = delete;
public: // with description
void AddNewModule(G4VDigitizerModule* DM);
// Registers the user's digitizer mudule. This method must be invoked when
// the user construct his/her digitizer module(s).
void Digitize(G4String mName);
void Digitize(const G4String& mName);
// Invokes Digitize() method of specified digitizer module. This is a kind
// of service method. The user can invoke Digitize() method of a particular
// module without knowing the pointer of the module object. The argument
// "mName" is the name of the module, which is defined at the constructor
// of the concrete digitizer module.
G4VDigitizerModule* FindDigitizerModule(G4String mName);
G4VDigitizerModule* FindDigitizerModule(const G4String& mName);
// Returns the pointer to the digitizer module object with the given name.
// Null will be returned if the name is not defined.
const G4VHitsCollection* GetHitsCollection(G4int HCID, G4int eventID = 0);
@@ -87,8 +87,8 @@ class G4DigiManager
// handled. To do this, necessary number of events must be set to G4RunManager
// by G4RunManager::SetNumberOfEventsToBeStored() method previously to the
// event loop.
G4int GetHitsCollectionID(G4String HCname);
G4int GetDigiCollectionID(G4String DCname);
G4int GetHitsCollectionID(const G4String& HCname);
G4int GetDigiCollectionID(const G4String& DCname);
// Returns the ID number of hits and digi collections, respectively. "HCname"
// and "DCname" can be the collection name if it is unique, or can be detector
// or module name and the collection name connected by "/".
+2 -2
View File
@@ -68,9 +68,9 @@ class G4VDigitizerModule
inline G4int GetNumberOfCollections() const
{ return G4int(collectionName.size()); }
inline G4String GetCollectionName(G4int i) const
inline const G4String& GetCollectionName(G4int i) const
{ return collectionName[i]; }
inline G4String GetName() const
inline const G4String& GetName() const
{ return moduleName; }
inline void SetVerboseLevel(G4int val)
{ verboseLevel = val; }
+2 -2
View File
@@ -33,7 +33,7 @@ G4DCtable::G4DCtable() {;}
G4DCtable::~G4DCtable() {;}
G4int G4DCtable::Registor(G4String DMname, G4String DCname)
G4int G4DCtable::Registor(const G4String& DMname, const G4String& DCname)
{
for(std::size_t i=0; i<DClist.size(); ++i)
{
@@ -44,7 +44,7 @@ G4int G4DCtable::Registor(G4String DMname, G4String DCname)
return (G4int)DClist.size();
}
G4int G4DCtable::GetCollectionID(G4String DCname) const
G4int G4DCtable::GetCollectionID(const G4String& DCname) const
{
G4int i = -1;
if(DCname.find("/")==std::string::npos) // DCname only
+10 -10
View File
@@ -62,7 +62,7 @@ G4DigiManager::G4DigiManager():verboseLevel(0)
G4DigiManager::~G4DigiManager()
{
//DMtable.clearAndDestroy();
for(G4int i=0;i<int(DMtable.size());i++)
for(G4int i=0;i<G4int(DMtable.size());++i)
{ delete DMtable[i]; }
DMtable.clear();
delete DCtable;
@@ -72,7 +72,7 @@ G4DigiManager::~G4DigiManager()
void G4DigiManager::AddNewModule(G4VDigitizerModule* DM)
{
G4String DMname = DM->GetName();
for(int j=0;j<int(DMtable.size());j++)
for(G4int j=0;j<G4int(DMtable.size());++j)
{
if(DMtable[j]==DM)
{
@@ -88,7 +88,7 @@ void G4DigiManager::AddNewModule(G4VDigitizerModule* DM)
DMtable.push_back(DM);
G4int numberOfCollections = DM->GetNumberOfCollections();
for(int i=0;i<numberOfCollections;i++)
for(G4int i=0;i<numberOfCollections;++i)
{
G4String DCname = DM->GetCollectionName(i);
if( DCtable->Registor(DMname,DCname) < 0 )
@@ -107,7 +107,7 @@ void G4DigiManager::AddNewModule(G4VDigitizerModule* DM)
runManager->SetDCtable(DCtable);
}
void G4DigiManager::Digitize(G4String mName)
void G4DigiManager::Digitize(const G4String& mName)
{
G4VDigitizerModule* aDM = FindDigitizerModule(mName);
if(aDM)
@@ -116,9 +116,9 @@ void G4DigiManager::Digitize(G4String mName)
{ G4cout << "Unknown digitizer module <" << mName << ">. Digitize() ignored." << G4endl; }
}
G4VDigitizerModule* G4DigiManager::FindDigitizerModule(G4String mName)
G4VDigitizerModule* G4DigiManager::FindDigitizerModule(const G4String& mName)
{
for(G4int i=0;i<int(DMtable.size());i++)
for(G4int i=0;i<G4int(DMtable.size());++i)
{
if(DMtable[i]->GetName() == mName) return DMtable[i];
}
@@ -155,12 +155,12 @@ const G4VDigiCollection* G4DigiManager::GetDigiCollection(G4int DCID,G4int event
return DCE->GetDC(DCID);
}
G4int G4DigiManager::GetHitsCollectionID(G4String HCname)
G4int G4DigiManager::GetHitsCollectionID(const G4String& HCname)
{
return SDManager->GetCollectionID(HCname);
}
G4int G4DigiManager::GetDigiCollectionID(G4String DCname)
G4int G4DigiManager::GetDigiCollectionID(const G4String& DCname)
{
G4int i = DCtable->GetCollectionID(DCname);
if(i==-2)
@@ -200,13 +200,13 @@ void G4DigiManager::SetDigiCollection(G4int DCID,G4VDigiCollection* aDC)
void G4DigiManager::SetVerboseLevel(G4int val)
{
verboseLevel = val;
for(G4int i=0;i<int(DMtable.size());i++)
for(G4int i=0;i<G4int(DMtable.size());++i)
{ DMtable[i]->SetVerboseLevel(val); }
}
void G4DigiManager::List() const
{
for(G4int i=0;i<int(DMtable.size());i++)
for(G4int i=0;i<G4int(DMtable.size());++i)
{ G4cout << " " << i << " : " << DMtable[i]->GetName() << G4endl; }
}