Geant4 VMC
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
source
digits+hits
src
TG4SensitiveDetector.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Geant4 Virtual Monte Carlo package
3
// Copyright (C) 2007 - 2014 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 "
TG4SensitiveDetector.h
"
16
#include "
TG4StepManager.h
"
17
18
#include <TVirtualMCApplication.h>
19
#include <TVirtualMCSensitiveDetector.h>
20
21
G4ThreadLocal G4int
TG4SensitiveDetector::fgSDCounter
= 0;
22
23
//_____________________________________________________________________________
24
TG4SensitiveDetector::TG4SensitiveDetector
(G4String sdName, G4int mediumID)
25
:
G4VSensitiveDetector
(sdName),
26
fStepManager
(
TG4StepManager
::Instance()),
27
fMCApplication
(TVirtualMCApplication::Instance()),
28
fUserSD
(0),
29
fID
(++
fgSDCounter
),
30
fMediumID
(mediumID)
31
{
33
}
34
35
//_____________________________________________________________________________
36
TG4SensitiveDetector::TG4SensitiveDetector
(
37
TVirtualMCSensitiveDetector* userSD, G4int mediumID, G4bool exclusiveSD)
38
:
G4VSensitiveDetector
(userSD->GetName()),
39
fStepManager
(
TG4StepManager
::Instance()),
40
fMCApplication
(0),
41
fUserSD
(userSD),
42
fID
(++
fgSDCounter
),
43
fMediumID
(mediumID)
44
{
46
47
if
(!exclusiveSD) {
48
fMCApplication
= TVirtualMCApplication::Instance();
49
}
50
}
51
52
//_____________________________________________________________________________
53
TG4SensitiveDetector::~TG4SensitiveDetector
()
54
{
56
}
57
58
//
59
// private methods
60
//
61
62
//_____________________________________________________________________________
63
void
TG4SensitiveDetector::UserProcessHits
()
64
{
66
67
if
(
fUserSD
) {
68
fUserSD
->ProcessHits();
69
}
70
71
if
(
fMCApplication
) {
72
fMCApplication
->Stepping();
73
}
74
}
75
76
//
77
// public methods
78
//
79
80
//_____________________________________________________________________________
81
G4bool
TG4SensitiveDetector::ProcessHits
(G4Step* step, G4TouchableHistory*)
82
{
84
85
// let user sensitive detector process normal step
86
fStepManager
->SetStep(step,
kNormalStep
);
87
UserProcessHits
();
88
89
return
true
;
90
}
91
92
//_____________________________________________________________________________
93
G4bool
TG4SensitiveDetector::ProcessHitsOnBoundary
(G4Step* step)
94
{
97
98
// let user sensitive detector process boundary step
99
fStepManager
->SetStep(step,
kBoundary
);
100
UserProcessHits
();
101
102
return
true
;
103
}
104
105
//_____________________________________________________________________________
106
void
TG4SensitiveDetector::ProcessHitsOnTrackStart
()
107
{
109
110
UserProcessHits
();
111
}
TG4SensitiveDetector.h
Definition of the TG4SensitiveDetector class.
TG4StepManager.h
Definition of the TG4StepManager class.
kBoundary
@ kBoundary
when crossing geometrical boundary
Definition
TG4StepStatus.h:38
kNormalStep
@ kNormalStep
in post step point
Definition
TG4StepStatus.h:39
G4VSensitiveDetector
TG4SensitiveDetector::~TG4SensitiveDetector
virtual ~TG4SensitiveDetector()
Definition
TG4SensitiveDetector.cxx:53
TG4SensitiveDetector::ProcessHitsOnTrackStart
virtual void ProcessHitsOnTrackStart()
Definition
TG4SensitiveDetector.cxx:106
TG4SensitiveDetector::ProcessHitsOnBoundary
virtual G4bool ProcessHitsOnBoundary(G4Step *step)
Definition
TG4SensitiveDetector.cxx:93
TG4SensitiveDetector::ProcessHits
virtual G4bool ProcessHits(G4Step *step, G4TouchableHistory *history)
Definition
TG4SensitiveDetector.cxx:81
TG4SensitiveDetector::fMCApplication
TVirtualMCApplication * fMCApplication
Cached pointer to thread-local VMC application.
Definition
TG4SensitiveDetector.h:68
TG4SensitiveDetector::fStepManager
TG4StepManager * fStepManager
Cached pointer to thread-local step manager.
Definition
TG4SensitiveDetector.h:66
TG4SensitiveDetector::fMediumID
G4int fMediumID
Definition
TG4SensitiveDetector.h:85
TG4SensitiveDetector::fUserSD
TVirtualMCSensitiveDetector * fUserSD
User sensitive detector.
Definition
TG4SensitiveDetector.h:70
TG4SensitiveDetector::TG4SensitiveDetector
TG4SensitiveDetector()
Not implemented.
TG4SensitiveDetector::UserProcessHits
void UserProcessHits()
Definition
TG4SensitiveDetector.cxx:63
TG4SensitiveDetector::fID
G4int fID
sensitive detector ID
Definition
TG4SensitiveDetector.h:84
TG4SensitiveDetector::fgSDCounter
static G4ThreadLocal G4int fgSDCounter
sensitive detector counter
Definition
TG4SensitiveDetector.h:81
TG4StepManager
Geant4 implementation of the TVirtualMC interface methods for access to Geant4 at step level.
Definition
TG4StepManager.h:56
Generated on
for Geant4 VMC by
1.17.0