Geant4 9.6.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 33 of file G4DCtable.cc.

33{;}

◆ ~G4DCtable()

G4DCtable::~G4DCtable ( )

Definition at line 35 of file G4DCtable.cc.

35{;}

Member Function Documentation

◆ entries()

G4int G4DCtable::entries ( ) const
inline

Definition at line 66 of file G4DCtable.hh.

67 { return DClist.size(); }

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

◆ GetCollectionID() [1/2]

G4int G4DCtable::GetCollectionID ( G4String  DCname) const

Definition at line 46 of file G4DCtable.cc.

47{
48 G4int i = -1;
49 if(DCname.index("/")==std::string::npos) // DCname only
50 {
51 for(int j=0;j<int(DClist.size());j++)
52 {
53 if(DClist[j]==DCname)
54 {
55 if(i>=0) return -2;
56 i = j;
57 }
58 }
59 }
60 else
61 {
62 for(int j=0;j<int(DClist.size());j++)
63 {
64 G4String tgt = DMlist[j];
65 tgt += "/";
66 tgt += DClist[j];
67 if(tgt==DCname)
68 {
69 if(i>=0) return -2;
70 i = j;
71 }
72 }
73 }
74 return i;
75}
int G4int
Definition: G4Types.hh:66
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 77 of file G4DCtable.cc.

78{
79 if(aDM->GetNumberOfCollections()<1)
80 {
81 G4cerr << "Digitizer Module <" << aDM->GetName()
82 << "> does not have a registered digits collection."
83 << G4endl;
84 return -1;
85 }
86 if(aDM->GetNumberOfCollections()>1)
87 {
88 G4cerr << "Digitizer Module <" << aDM->GetName()
89 << "> has more than one registered digits collections."
90 << G4endl;
91 G4cerr << "Candidates are : ";
92 for(G4int j=0;j<aDM->GetNumberOfCollections();j++)
93 { G4cerr << aDM->GetCollectionName(j) << " "; }
94 G4cerr << G4endl;
95 return -1;
96 }
97 for(size_t k=0;k<DMlist.size();k++)
98 { if(DMlist[k]==aDM->GetName()) return k; }
99 return -1;
100}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
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 37 of file G4DCtable.cc.

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

Referenced by G4DigiManager::AddNewModule().


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