Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DCtable Class Reference

#include <G4DCtable.hh>

Public Member Functions

 G4DCtable ()
 
 ~G4DCtable ()
 
G4int Registor (G4String SDname, G4String DCname)
 
G4int GetCollectionID (G4String DCname) const
 
G4int GetCollectionID (G4VDigitizerModule *aDM) const
 
G4int entries () const
 
G4String GetDMname (G4int i) const
 
G4String GetDCname (G4int i) const
 

Detailed Description

Definition at line 50 of file G4DCtable.hh.

Constructor & Destructor Documentation

◆ G4DCtable()

G4DCtable::G4DCtable ( )

Definition at line 32 of file G4DCtable.cc.

32{;}

◆ ~G4DCtable()

G4DCtable::~G4DCtable ( )

Definition at line 34 of file G4DCtable.cc.

34{;}

Member Function Documentation

◆ entries()

G4int G4DCtable::entries ( ) const
inline

Definition at line 66 of file G4DCtable.hh.

67 { return G4int(DClist.size()); }
int G4int
Definition G4Types.hh:85

Referenced by G4DigiManager::GetCollectionCapacity(), GetDCname(), GetDMname(), and G4DigiManager::SetDigiCollection().

◆ GetCollectionID() [1/2]

G4int G4DCtable::GetCollectionID ( G4String DCname) const

Definition at line 47 of file G4DCtable.cc.

48{
49 G4int i = -1;
50 if(DCname.find("/")==std::string::npos) // DCname only
51 {
52 for(std::size_t j=0; j<DClist.size(); ++j)
53 {
54 if(DClist[j]==DCname)
55 {
56 if(i>=0) return -2;
57 i = (G4int)j;
58 }
59 }
60 }
61 else
62 {
63 for(std::size_t j=0; j<DClist.size(); ++j)
64 {
65 G4String tgt = DMlist[j];
66 tgt += "/";
67 tgt += DClist[j];
68 if(tgt==DCname)
69 {
70 if(i>=0) return -2;
71 i = (G4int)j;
72 }
73 }
74 }
75 return i;
76}

Referenced by G4DigiManager::GetDigiCollectionID().

◆ GetCollectionID() [2/2]

G4int G4DCtable::GetCollectionID ( G4VDigitizerModule * aDM) const

Definition at line 78 of file G4DCtable.cc.

79{
80 if(aDM->GetNumberOfCollections()<1)
81 {
82 G4cerr << "Digitizer Module <" << aDM->GetName()
83 << "> does not have a registered digits collection."
84 << G4endl;
85 return -1;
86 }
87 if(aDM->GetNumberOfCollections()>1)
88 {
89 G4cerr << "Digitizer Module <" << aDM->GetName()
90 << "> has more than one registered digits collections."
91 << G4endl;
92 G4cerr << "Candidates are : ";
93 for(G4int j=0; j<aDM->GetNumberOfCollections(); ++j)
94 { G4cerr << aDM->GetCollectionName(j) << " "; }
95 G4cerr << G4endl;
96 return -1;
97 }
98 for(std::size_t k=0; k<DMlist.size(); ++k)
99 {
100 if(DMlist[k]==aDM->GetName()) return (G4int)k;
101 }
102 return -1;
103}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
G4int GetNumberOfCollections() const
G4String GetName() const
G4String GetCollectionName(G4int i) const

◆ GetDCname()

G4String G4DCtable::GetDCname ( G4int i) const
inline

Definition at line 73 of file G4DCtable.hh.

74 {
75 if(i<0||i>entries()) return "***Not Defined***";
76 return DClist[i];
77 }
G4int entries() const
Definition G4DCtable.hh:66

◆ GetDMname()

G4String G4DCtable::GetDMname ( G4int i) const
inline

Definition at line 68 of file G4DCtable.hh.

69 {
70 if(i<0||i>entries()) return "***Not Defined***";
71 return DMlist[i];
72 }

◆ Registor()

G4int G4DCtable::Registor ( G4String SDname,
G4String DCname )

Definition at line 36 of file G4DCtable.cc.

37{
38 for(std::size_t i=0; i<DClist.size(); ++i)
39 {
40 if(DClist[i]==DCname && DMlist[i]==DMname) return -1;
41 }
42 DClist.push_back(DCname);
43 DMlist.push_back(DMname);
44 return (G4int)DClist.size();
45}

Referenced by G4DigiManager::AddNewModule().


The documentation for this class was generated from the following files: