Geant4 10.7.0
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 45 of file G4DCtable.cc.

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

Referenced by G4DigiManager::GetDigiCollectionID().

◆ GetCollectionID() [2/2]

G4int G4DCtable::GetCollectionID ( G4VDigitizerModule aDM) const

Definition at line 76 of file G4DCtable.cc.

77{
78 if(aDM->GetNumberOfCollections()<1)
79 {
80 G4cerr << "Digitizer Module <" << aDM->GetName()
81 << "> does not have a registered digits collection."
82 << G4endl;
83 return -1;
84 }
85 if(aDM->GetNumberOfCollections()>1)
86 {
87 G4cerr << "Digitizer Module <" << aDM->GetName()
88 << "> has more than one registered digits collections."
89 << G4endl;
90 G4cerr << "Candidates are : ";
91 for(G4int j=0;j<aDM->GetNumberOfCollections();j++)
92 { G4cerr << aDM->GetCollectionName(j) << " "; }
93 G4cerr << G4endl;
94 return -1;
95 }
96 for(size_t k=0;k<DMlist.size();k++)
97 { if(DMlist[k]==aDM->GetName()) return k; }
98 return -1;
99}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
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(int i=0;i<int(DClist.size());i++)
39 { if(DClist[i]==DCname && DMlist[i]==DMname) return -1; }
40 DClist.push_back(DCname);
41 DMlist.push_back(DMname);
42 return DClist.size();
43}

Referenced by G4DigiManager::AddNewModule().


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