Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
G4SDManager Class Reference

#include <G4SDManager.hh>

Public Member Functions

 ~G4SDManager ()
 
void AddNewDetector (G4VSensitiveDetector *aSD)
 
void Activate (G4String dName, G4bool activeFlag)
 
G4int GetCollectionID (G4String colName)
 
G4int GetCollectionID (G4VHitsCollection *aHC)
 
G4VSensitiveDetectorFindSensitiveDetector (G4String dName, G4bool warning=true)
 
G4HCofThisEventPrepareNewEvent ()
 
void TerminateCurrentEvent (G4HCofThisEvent *HCE)
 
void AddNewCollection (G4String SDname, G4String DCname)
 
void SetVerboseLevel (G4int vl)
 
G4SDStructureGetTreeTop () const
 
void ListTree () const
 
G4int GetCollectionCapacity () const
 
G4HCtableGetHCtable () const
 

Static Public Member Functions

static G4SDManagerGetSDMpointer ()
 
static G4SDManagerGetSDMpointerIfExist ()
 

Protected Member Functions

 G4SDManager ()
 

Detailed Description

Definition at line 50 of file G4SDManager.hh.

Constructor & Destructor Documentation

G4SDManager::G4SDManager ( )
protected

Definition at line 52 of file G4SDManager.cc.

Referenced by GetSDMpointer().

52  :verboseLevel(0)
53 {
54  G4String topName = "/";
55  treeTop = new G4SDStructure(topName);
56  theMessenger = new G4SDmessenger(this);
57  HCtable = new G4HCtable;
58 }
G4SDManager::~G4SDManager ( )

Definition at line 60 of file G4SDManager.cc.

61 {
62  delete theMessenger;
63  delete HCtable;
64  delete treeTop;
65 }

Member Function Documentation

void G4SDManager::Activate ( G4String  dName,
G4bool  activeFlag 
)

Definition at line 117 of file G4SDManager.cc.

References G4SDStructure::Activate(), and G4String::prepend().

Referenced by G4RTRunAction::BeginOfRunAction(), G4RTRunAction::EndOfRunAction(), G4TheRayTracer::RestoreUserActions(), G4SDmessenger::SetNewValue(), and G4TheRayTracer::StoreUserActions().

118 {
119  G4String pathName = dName;
120  if( pathName(0) != '/' ) pathName.prepend("/");
121  treeTop->Activate(pathName,activeFlag);
122 }
void Activate(G4String aName, G4bool sensitiveFlag)
G4String & prepend(const char *)
void G4SDManager::AddNewCollection ( G4String  SDname,
G4String  DCname 
)

Definition at line 88 of file G4SDManager.cc.

References G4cout, G4endl, and G4HCtable::Registor().

Referenced by AddNewDetector(), and G4MultiFunctionalDetector::RegisterPrimitive().

89 {
90  G4int i = HCtable->Registor(SDname,DCname);
91  if(verboseLevel>0)
92  {
93  if(i<0) {
94  if(verboseLevel>1) G4cout << "G4SDManager::AddNewCollection : the collection <"
95  << SDname << "/" << DCname << "> has already been reginstered." << G4endl;
96  }
97  else
98  {
99  G4cout << "G4SDManager::AddNewCollection : the collection <"
100  << SDname << "/" << DCname << "> is registered at " << i << G4endl;
101  }
102  }
103 }
int G4int
Definition: G4Types.hh:78
G4int Registor(G4String SDname, G4String HCname)
Definition: G4HCtable.cc:37
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4SDManager::AddNewDetector ( G4VSensitiveDetector aSD)

Definition at line 67 of file G4SDManager.cc.

References AddNewCollection(), G4SDStructure::AddNewDetector(), G4cout, G4endl, G4VSensitiveDetector::GetCollectionName(), G4VSensitiveDetector::GetName(), G4VSensitiveDetector::GetNumberOfCollections(), G4VSensitiveDetector::GetPathName(), and G4String::prepend().

Referenced by CCalSensAssign::assign(), ExN04DetectorConstruction::Construct(), FCALEMModule::Construct(), FCALHadModule::Construct(), eRositaDetectorConstruction::Construct(), ExN02DetectorConstruction::Construct(), ExP01DetectorConstruction::Construct(), FCALTestbeamSetup::Construct(), CML2Ph_FullWater::Construct(), DMXDetectorConstruction::Construct(), CML2Ph_BoxInBox::Construct(), B03ImportanceDetectorConstruction::ConstructSD(), B02ImportanceDetectorConstruction::ConstructSD(), Par01DetectorConstruction::ConstructSDandField(), ExGflashDetectorConstruction::ConstructSDandField(), B5DetectorConstruction::ConstructSDandField(), B01DetectorConstruction::ConstructSDandField(), RE02DetectorConstruction::ConstructSDandField(), CML2PhaseSpaces::createPlane(), G4VScoringMesh::G4VScoringMesh(), main(), G4VUserParallelWorld::SetSensitiveDetector(), and G4VUserDetectorConstruction::SetSensitiveDetector().

68 {
69  G4int numberOfCollections = aSD->GetNumberOfCollections();
70  G4String pathName = aSD->GetPathName();
71  if( pathName(0) != '/' ) pathName.prepend("/");
72  if( pathName(pathName.length()-1) != '/' ) pathName += "/";
73  treeTop->AddNewDetector(aSD,pathName);
74  if(numberOfCollections<1) return;
75  for(G4int i=0;i<numberOfCollections;i++)
76  {
77  G4String SDname = aSD->GetName();
78  G4String DCname = aSD->GetCollectionName(i);
79  AddNewCollection(SDname,DCname);
80  }
81  if( verboseLevel > 0 )
82  {
83  G4cout << "New sensitive detector <" << aSD->GetName()
84  << "> is registored at " << pathName << G4endl;
85  }
86 }
void AddNewDetector(G4VSensitiveDetector *aSD, G4String treeStructure)
void AddNewCollection(G4String SDname, G4String DCname)
Definition: G4SDManager.cc:88
int G4int
Definition: G4Types.hh:78
G4String & prepend(const char *)
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfCollections() const
#define G4endl
Definition: G4ios.hh:61
G4String GetCollectionName(G4int id) const
G4String GetPathName() const
G4VSensitiveDetector * G4SDManager::FindSensitiveDetector ( G4String  dName,
G4bool  warning = true 
)

Definition at line 124 of file G4SDManager.cc.

References G4SDStructure::FindSensitiveDetector(), and G4String::prepend().

Referenced by B01Run::B01Run(), B02Run::B02Run(), B03Run::B03Run(), DicomRun::ConstructMFD(), main(), RE02Run::RE02Run(), G4MultiFunctionalDetector::RegisterPrimitive(), LXeSteppingAction::UserSteppingAction(), and WLSSteppingAction::UserSteppingAction().

125 {
126  G4String pathName = dName;
127  if( pathName(0) != '/' ) pathName.prepend("/");
128  return treeTop->FindSensitiveDetector(pathName, warning);
129 }
G4String & prepend(const char *)
G4VSensitiveDetector * FindSensitiveDetector(G4String aName, G4bool warning=true)
G4int G4SDManager::GetCollectionCapacity ( ) const
inline

Definition at line 99 of file G4SDManager.hh.

References G4HCtable::entries().

100  { return HCtable->entries(); }
G4int entries() const
Definition: G4HCtable.hh:66
G4int G4SDManager::GetCollectionID ( G4String  colName)

Definition at line 131 of file G4SDManager.cc.

References G4cout, G4endl, and G4HCtable::GetCollectionID().

Referenced by B01Run::B01Run(), B02Run::B02Run(), B03Run::B03Run(), RE05EventAction::BeginOfEventAction(), B5EventAction::BeginOfEventAction(), RE01EventAction::BeginOfEventAction(), G4HumanPhantomEventAction::BeginOfEventAction(), LXeEventAction::BeginOfEventAction(), F03EventAction::BeginOfEventAction(), F01EventAction::BeginOfEventAction(), F02EventAction::BeginOfEventAction(), Em10EventAction::BeginOfEventAction(), GammaRayTelEventAction::BeginOfEventAction(), DMXEventAction::BeginOfEventAction(), UltraEventAction::BeginOfEventAction(), XrayFluoEventAction::BeginOfEventAction(), DicomRun::ConstructMFD(), Par01CalorimeterSD::EndOfEvent(), F02CalorimeterSD::EndOfEvent(), F01CalorimeterSD::EndOfEvent(), F03CalorimeterSD::EndOfEvent(), Em10CalorimeterSD::EndOfEvent(), XrayFluoHPGeSD::EndOfEvent(), GammaRayTelAnticoincidenceSD::EndOfEvent(), GammaRayTelCalorimeterSD::EndOfEvent(), GammaRayTelTrackerSD::EndOfEvent(), DMXScintSD::EndOfEvent(), DMXPmtSD::EndOfEvent(), UltraPMTSD::EndOfEvent(), XrayFluoSD::EndOfEvent(), ExGflashEventAction::EndOfEventAction(), CCalEndOfEventAction::EndOfEventAction(), B4dEventAction::EndOfEventAction(), B4cEventAction::EndOfEventAction(), WLSEventAction::EndOfEventAction(), G4VPrimitiveScorer::GetCollectionID(), GetCollectionID(), G4VSensitiveDetector::GetCollectionID(), G4DigiManager::GetHitsCollectionID(), G4HumanPhantomSD::Initialize(), eRositaTrackerSD::Initialize(), ExTGTrackerSD::Initialize(), B5HodoscopeSD::Initialize(), B5DriftChamberSD::Initialize(), B5HadCalorimeterSD::Initialize(), SensitiveDetector::Initialize(), B5EmCalorimeterSD::Initialize(), ExN02TrackerSD::Initialize(), ExP01TrackerSD::Initialize(), XAluminumElectrodeSensitivity::Initialize(), B2TrackerSD::Initialize(), B4cCalorimeterSD::Initialize(), CCaloSD::Initialize(), RE02Run::RE02Run(), RE06Run::RE06Run(), and B3Run::RecordEvent().

132 {
133  G4int id = HCtable->GetCollectionID(colName);
134  if(id==-1)
135  { G4cout << "<" << colName << "> is not found." << G4endl; }
136  else if(id==-2)
137  { G4cout << "<" << colName << "> is ambiguous." << G4endl; }
138  return id;
139 }
G4int GetCollectionID(G4String HCname) const
Definition: G4HCtable.cc:46
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4int G4SDManager::GetCollectionID ( G4VHitsCollection aHC)
G4HCtable* G4SDManager::GetHCtable ( ) const
inline

Definition at line 101 of file G4SDManager.hh.

Referenced by G4WorkerRunManager::RunInitialization(), and G4RunManager::RunInitialization().

102  { return HCtable; }
G4SDManager * G4SDManager::GetSDMpointer ( )
static

Definition at line 40 of file G4SDManager.cc.

References G4SDManager().

Referenced by CCalSensAssign::assign(), B01Run::B01Run(), B02Run::B02Run(), B03Run::B03Run(), ExN04EventAction::BeginOfEventAction(), RE05EventAction::BeginOfEventAction(), B5EventAction::BeginOfEventAction(), RE01EventAction::BeginOfEventAction(), G4HumanPhantomEventAction::BeginOfEventAction(), HadrontherapyEventAction::BeginOfEventAction(), LXeEventAction::BeginOfEventAction(), F01EventAction::BeginOfEventAction(), F02EventAction::BeginOfEventAction(), F03EventAction::BeginOfEventAction(), Em10EventAction::BeginOfEventAction(), IORTEventAction::BeginOfEventAction(), GammaRayTelEventAction::BeginOfEventAction(), UltraEventAction::BeginOfEventAction(), DMXEventAction::BeginOfEventAction(), XrayFluoEventAction::BeginOfEventAction(), H02DetectorConstruction::Construct(), ExN04DetectorConstruction::Construct(), FCALEMModule::Construct(), FCALHadModule::Construct(), eRositaDetectorConstruction::Construct(), ExN02DetectorConstruction::Construct(), ExP01DetectorConstruction::Construct(), FCALTestbeamSetup::Construct(), CML2Ph_FullWater::Construct(), DMXDetectorConstruction::Construct(), CML2Ph_BoxInBox::Construct(), DicomRun::ConstructMFD(), B03ImportanceDetectorConstruction::ConstructSD(), B02ImportanceDetectorConstruction::ConstructSD(), Par01DetectorConstruction::ConstructSDandField(), B3DetectorConstruction::ConstructSDandField(), ExGflashDetectorConstruction::ConstructSDandField(), ElectronBenchmarkDetector::ConstructSDandField(), B5DetectorConstruction::ConstructSDandField(), B4dDetectorConstruction::ConstructSDandField(), B01DetectorConstruction::ConstructSDandField(), RE02DetectorConstruction::ConstructSDandField(), CML2PhaseSpaces::createPlane(), Par01CalorimeterSD::EndOfEvent(), F02CalorimeterSD::EndOfEvent(), F01CalorimeterSD::EndOfEvent(), F03CalorimeterSD::EndOfEvent(), XrayFluoHPGeSD::EndOfEvent(), Em10CalorimeterSD::EndOfEvent(), GammaRayTelCalorimeterSD::EndOfEvent(), GammaRayTelAnticoincidenceSD::EndOfEvent(), GammaRayTelTrackerSD::EndOfEvent(), DMXScintSD::EndOfEvent(), UltraPMTSD::EndOfEvent(), DMXPmtSD::EndOfEvent(), XrayFluoSD::EndOfEvent(), H02EventAction::EndOfEventAction(), ExGflashEventAction::EndOfEventAction(), CCalEndOfEventAction::EndOfEventAction(), B4dEventAction::EndOfEventAction(), B4cEventAction::EndOfEventAction(), WLSEventAction::EndOfEventAction(), G4DigiManager::G4DigiManager(), G4VScoringMesh::G4VScoringMesh(), G4VPrimitiveScorer::GetCollectionID(), G4VSensitiveDetector::GetCollectionID(), eRositaTrackerSD::Initialize(), B5HodoscopeSD::Initialize(), ExTGTrackerSD::Initialize(), G4HumanPhantomSD::Initialize(), B5HadCalorimeterSD::Initialize(), B5DriftChamberSD::Initialize(), B5EmCalorimeterSD::Initialize(), SensitiveDetector::Initialize(), ExN02TrackerSD::Initialize(), ExP01TrackerSD::Initialize(), XAluminumElectrodeSensitivity::Initialize(), B2TrackerSD::Initialize(), B4cCalorimeterSD::Initialize(), CCaloSD::Initialize(), main(), RE02Run::RE02Run(), RE06Run::RE06Run(), B3Run::RecordEvent(), G4MultiFunctionalDetector::RegisterPrimitive(), G4VUserParallelWorld::SetSensitiveDetector(), G4VUserDetectorConstruction::SetSensitiveDetector(), LXeSteppingAction::UserSteppingAction(), WLSSteppingAction::UserSteppingAction(), and VoxelSD::VoxelSD().

41 {
42  if(!fSDManager)
43  {
44  fSDManager = new G4SDManager;
45  }
46  return fSDManager;
47 }
G4SDManager * G4SDManager::GetSDMpointerIfExist ( )
static
G4SDStructure* G4SDManager::GetTreeTop ( ) const
inline

Definition at line 95 of file G4SDManager.hh.

96  { return treeTop; }
void G4SDManager::ListTree ( ) const
inline

Definition at line 97 of file G4SDManager.hh.

References G4SDStructure::ListTree().

Referenced by G4SDmessenger::SetNewValue().

98  { treeTop->ListTree(); }
G4HCofThisEvent * G4SDManager::PrepareNewEvent ( )

Definition at line 105 of file G4SDManager.cc.

References G4HCtable::entries(), and G4SDStructure::Initialize().

106 {
107  G4HCofThisEvent* HCE = new G4HCofThisEvent(HCtable->entries());
108  treeTop->Initialize(HCE);
109  return HCE;
110 }
void Initialize(G4HCofThisEvent *HCE)
G4int entries() const
Definition: G4HCtable.hh:66
void G4SDManager::SetVerboseLevel ( G4int  vl)
inline
void G4SDManager::TerminateCurrentEvent ( G4HCofThisEvent HCE)

Definition at line 112 of file G4SDManager.cc.

References G4SDStructure::Terminate().

113 {
114  treeTop->Terminate(HCE);
115 }
void Terminate(G4HCofThisEvent *HCE)

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