Geant4 VMC Version 6.7
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
TG4SDManager.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2018 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
15#include "TG4SDManager.h"
16#include "TG4GeometryServices.h"
17#include "TG4Globals.h"
18#include "TG4Medium.h"
19#include "TG4MediumMap.h"
20#include "TG4SDConstruction.h"
21#include "TG4SDServices.h"
22
23#include <TVirtualMC.h>
24
26
27//_____________________________________________________________________________
29
30{
32
33 if (fgInstance)
34 TG4Globals::Exception("TG4SDManager", "TG4SDManager",
35 "Cannot create two instances of singleton.");
36
37 fgInstance = this;
38
41}
42
43//_____________________________________________________________________________
45{
47
48 delete fSDConstruction;
49 delete fSDServices;
50
51 fgInstance = 0;
52}
53
54//
55// public methods
56//
57
58//_____________________________________________________________________________
60{
64
65 // G4cout << "TG4SDManager::Initialize" << G4endl;
66 fSDConstruction->Construct();
67 // G4cout << "TG4SDManager::Initialize done" << G4endl;
68}
69
70//_____________________________________________________________________________
71Int_t TG4SDManager::VolId(const Text_t* volName) const
72{
74
75 return fSDServices->GetVolumeID(volName);
76}
77
78//_____________________________________________________________________________
79const char* TG4SDManager::VolName(Int_t id) const
80{
83
84 fNameBuffer = fSDServices->GetVolumeName(id).c_str();
85 return fNameBuffer.data();
86}
87
88//_____________________________________________________________________________
90{
93
94 return fSDServices->NofSensitiveDetectors();
95}
96
97//_____________________________________________________________________________
98Int_t TG4SDManager::NofVolDaughters(const char* volName) const
99{
101
102 return fSDServices->NofVolDaughters(volName);
103}
104
105//_____________________________________________________________________________
106const char* TG4SDManager::VolDaughterName(const char* volName, Int_t i) const
107{
109
110 return fSDServices->VolDaughterName(volName, i);
111}
112
113//_____________________________________________________________________________
114Int_t TG4SDManager::VolDaughterCopyNo(const char* volName, Int_t i) const
115{
117
118 return fSDServices->VolDaughterCopyNo(volName, i);
119}
120
121//_____________________________________________________________________________
122Int_t TG4SDManager::VolId2Mate(Int_t volumeId) const
123{
125
126 return fSDServices->GetMediumId(volumeId);
127}
128
129//_____________________________________________________________________________
131 const TString& volName, TVirtualMCSensitiveDetector* sd)
132{
134
135 fSDServices->MapUserSD(volName.Data(), sd);
136}
137
138//_____________________________________________________________________________
139TVirtualMCSensitiveDetector* TG4SDManager::GetSensitiveDetector(
140 const TString& volName) const
141{
143
144 return fSDServices->GetUserSD(volName.Data(), false);
145}
146
147//_____________________________________________________________________________
148void TG4SDManager::SetExclusiveSDScoring(Bool_t exclusiveSDScoring)
149{
151
152 fSDConstruction->SetExclusiveSDScoring(exclusiveSDScoring);
153}
Definition of the TG4GeometryServices class.
Definition of the TG4Globals class and basic container types.
Definition of the TG4MediumMap class.
Definition of the TG4Medium class.
Definition of the TG4SDConstruction class.
Definition of the TG4SDManager class.
Definition of the TG4SDServices class.
static void Exception(const TString &className, const TString &methodName, const TString &text)
Sensitive detector construction.
Geant4 implementation of the TVirtualMC interface methods for access to Geant4 geometry related with ...
Int_t NofVolDaughters(const char *volName) const
const char * VolDaughterName(const char *volName, Int_t i) const
TVirtualMCSensitiveDetector * GetSensitiveDetector(const TString &volName) const
Int_t NofVolumes() const
void SetSensitiveDetector(const TString &volName, TVirtualMCSensitiveDetector *sd)
void SetExclusiveSDScoring(Bool_t exclusiveSDScoring)
G4String fNameBuffer
buffer for volume name
Int_t VolDaughterCopyNo(const char *volName, Int_t i) const
TG4SDServices * fSDServices
services related with sensitive detectors
const char * VolName(Int_t id) const
Int_t VolId(const Text_t *volName) const
static TG4SDManager * fgInstance
this instance
Int_t VolId2Mate(Int_t volumeId) const
TG4SDConstruction * fSDConstruction
sensitive detectors construction
Sensitive detectors services.