Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4SDServices.h
Go to the documentation of this file.
1#ifndef TG4_SD_SERVICES_H
2#define TG4_SD_SERVICES_H
3
4//------------------------------------------------
5// The Geant4 Virtual Monte Carlo package
6// Copyright (C) 2007 - 2014 Ivana Hrivnacova
7// All rights reserved.
8//
9// For the licensing terms see geant4_vmc/LICENSE.
10// Contact: root-vmc@cern.ch
11//-------------------------------------------------
12
17
18#include <globals.hh>
19
20#include <Rtypes.h>
21
22#include <map>
23#include <set>
24
26
27class G4LogicalVolume;
29
30class TVirtualMCSensitiveDetector;
31
40
42{
43 public:
46
47 // static methods
48 static TG4SDServices* Instance();
49 static G4int GetFirstVolumeId();
50
51 // methods
52 void MapVolume(G4LogicalVolume* lv, G4int id, G4bool fillLVToVolIdMap);
53 void MapUserSD(
54 const G4String& volumeName, TVirtualMCSensitiveDetector* userSD);
55 void PrintStatistics(G4bool open, G4bool close) const;
56 void PrintVolNameToIdMap() const;
57 void PrintVolIdToLVMap() const;
58 void PrintSensitiveVolumes() const;
59 void PrintUserSensitiveDetectors() const;
60
61 // set methods
62 void SetIsStopRun(G4bool stopRun);
63
64 // get methods
65 // volume IDs conversions
66 G4int GetVolumeID(const G4String& volumeName) const;
67 G4int GetVolumeID(G4LogicalVolume* volume) const;
68 G4int GetMediumID(G4LogicalVolume* volume) const;
69 G4String GetVolumeName(G4int volumeId) const;
70 G4LogicalVolume* GetLogicalVolume(G4int volumeId, G4bool warn = true) const;
71 G4int GetMediumId(G4int volumeId) const;
72 TVirtualMCSensitiveDetector* GetUserSD(
73 G4String volumeName, G4bool warn = true) const;
74 G4bool GetIsStopRun() const;
75 // SDs
76 Int_t NofSensitiveDetectors() const;
78 std::set<TVirtualMCSensitiveDetector*>* GetUserSDs() const;
79
80 // Daughters
81 Int_t NofVolDaughters(const char* volName) const;
82 const char* VolDaughterName(const char* volName, Int_t i) const;
83 Int_t VolDaughterCopyNo(const char* volName, Int_t i) const;
84
85 private:
90
91 // static data members
93
94 static const G4int fgkFirstVolumeId;
95
96 G4bool fIsStopRun;
97
99 std::map<G4String, G4int> fVolNameToIdMap;
100
102 std::map<G4int, G4LogicalVolume*> fVolIdToLVMap;
103
105 std::map<G4LogicalVolume*, G4int> fLVToVolIdMap;
106
108 static G4ThreadLocal std::set<TVirtualMCSensitiveDetector*>* fgUserSDs;
109
111 static G4ThreadLocal std::map<G4String, TVirtualMCSensitiveDetector*>*
113
116};
117
118// inline methods
119
121{
123 return fgInstance;
124}
125
127{
129 return fgkFirstVolumeId;
130}
131
132inline void TG4SDServices::SetIsStopRun(G4bool isStopRun)
133{
135 fIsStopRun = isStopRun;
136}
137
138inline G4bool TG4SDServices::GetIsStopRun() const
139{
141 return fIsStopRun;
142}
143
144inline std::set<TVirtualMCSensitiveDetector*>* TG4SDServices::GetUserSDs() const
145{
147 return fgUserSDs;
148}
149
150#endif // TG4_SD_SERVICES_H
Sensitive detectors services.
G4int GetMediumID(G4LogicalVolume *volume) const
static G4ThreadLocal std::set< TVirtualMCSensitiveDetector * > * fgUserSDs
vector of user SDs
void SetIsStopRun(G4bool stopRun)
static TG4SDServices * fgInstance
this instance
G4bool fIsUserSDs
info about user SDs
static G4ThreadLocal std::map< G4String, TVirtualMCSensitiveDetector * > * fgUserSDMap
map volume name -> user SD
std::map< G4int, G4LogicalVolume * > fVolIdToLVMap
map volume id -> logical volume
TG4SensitiveDetector * GetSensitiveDetector(G4VSensitiveDetector *sd) const
TG4SDServices(const TG4SDServices &right)
Not implemented.
std::map< G4LogicalVolume *, G4int > fLVToVolIdMap
map logical volume -> volume id
TVirtualMCSensitiveDetector * GetUserSD(G4String volumeName, G4bool warn=true) const
void PrintUserSensitiveDetectors() const
G4int GetVolumeID(const G4String &volumeName) const
G4bool fIsStopRun
info about run stopping by user
void PrintSensitiveVolumes() const
TG4SDServices & operator=(const TG4SDServices &right)
Not implemented.
void PrintVolNameToIdMap() const
Int_t NofVolDaughters(const char *volName) const
void MapVolume(G4LogicalVolume *lv, G4int id, G4bool fillLVToVolIdMap)
std::map< G4String, G4int > fVolNameToIdMap
map volume name -> volume id
static const G4int fgkFirstVolumeId
the first volume id
Int_t NofSensitiveDetectors() const
void MapUserSD(const G4String &volumeName, TVirtualMCSensitiveDetector *userSD)
void PrintStatistics(G4bool open, G4bool close) const
G4bool GetIsStopRun() const
std::set< TVirtualMCSensitiveDetector * > * GetUserSDs() const
void PrintVolIdToLVMap() const
Int_t VolDaughterCopyNo(const char *volName, Int_t i) const
static TG4SDServices * Instance()
G4String GetVolumeName(G4int volumeId) const
G4int GetMediumId(G4int volumeId) const
G4LogicalVolume * GetLogicalVolume(G4int volumeId, G4bool warn=true) const
const char * VolDaughterName(const char *volName, Int_t i) const
static G4int GetFirstVolumeId()
Sensitive detector class for calling a user defined stepping function.