EDepSimSDFactory.cc
Go to the documentation of this file.
1 #include "EDepSimSDFactory.hh"
2 #include "EDepSimSegmentSD.hh"
3 #include "EDepSimException.hh"
4 
5 #include <G4SDManager.hh>
6 
8  : fType(type) {}
9 
10 
12 
13 G4VSensitiveDetector* EDepSim::SDFactory::GetSD(G4String name) {
14  return G4SDManager::GetSDMpointer()->FindSensitiveDetector(name);
15 }
16 
17 G4VSensitiveDetector* EDepSim::SDFactory::MakeSD(G4String name) {
18  G4VSensitiveDetector* sd = GetSD(name);
19  if (!sd) {
20  if (fType == "segment") {
21  sd = new EDepSim::SegmentSD(name);
22  }
23  else {
24  EDepSimError("No such sensitive detector " << name);
25  EDepSimThrow("sensitive detector type not implemented");
26  }
27  G4SDManager::GetSDMpointer()->AddNewDetector(sd);
28  }
29  return sd;
30 }
static QCString name
Definition: declinfo.cpp:673
G4VSensitiveDetector * GetSD(G4String name)
#define EDepSimThrow(message)
Print an error message, and then throw an exception.
G4VSensitiveDetector * MakeSD(G4String name)
G4String fType
The type of sensitive detector that this will build.
#define EDepSimError(outStream)
Definition: EDepSimLog.hh:503
SDFactory(G4String type)
Build a factory to build sensitive detectors specified by "type".