Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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 ( )

Definition at line 33 of file G4DCtable.cc.

33 {;}
G4DCtable::~G4DCtable ( )

Definition at line 35 of file G4DCtable.cc.

35 {;}

Member Function Documentation

G4int G4DCtable::entries ( ) const
inline

Definition at line 66 of file G4DCtable.hh.

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

67  { return DClist.size(); }
G4int G4DCtable::GetCollectionID ( G4String  DCname) const

Definition at line 46 of file G4DCtable.cc.

References G4String::index(), and int().

Referenced by G4DigiManager::GetDigiCollectionID().

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 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78
str_size index(const char *, G4int pos=0) const
G4int G4DCtable::GetCollectionID ( G4VDigitizerModule aDM) const

Definition at line 77 of file G4DCtable.cc.

References G4cerr, G4endl, G4VDigitizerModule::GetCollectionName(), G4VDigitizerModule::GetName(), and G4VDigitizerModule::GetNumberOfCollections().

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 }
int G4int
Definition: G4Types.hh:78
G4int GetNumberOfCollections() const
G4String GetName() const
G4String GetCollectionName(G4int i) const
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
G4String G4DCtable::GetDCname ( G4int  i) const
inline

Definition at line 73 of file G4DCtable.hh.

References entries().

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

Definition at line 68 of file G4DCtable.hh.

References entries().

69  {
70  if(i<0||i>entries()) return "***Not Defined***";
71  return DMlist[i];
72  }
G4int entries() const
Definition: G4DCtable.hh:66
G4int G4DCtable::Registor ( G4String  SDname,
G4String  DCname 
)

Definition at line 37 of file G4DCtable.cc.

References int().

Referenced by G4DigiManager::AddNewModule().

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 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)

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