Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
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
16#include "TG4StepManager.h"
17
18#include <TVirtualMCApplication.h>
19#include <TVirtualMCSensitiveDetector.h>
20
21G4ThreadLocal G4int TG4SensitiveDetector::fgSDCounter = 0;
22
23//_____________________________________________________________________________
24TG4SensitiveDetector::TG4SensitiveDetector(G4String sdName, G4int mediumID)
25 : G4VSensitiveDetector(sdName),
26 fStepManager(TG4StepManager::Instance()),
27 fMCApplication(TVirtualMCApplication::Instance()),
28 fUserSD(0),
30 fMediumID(mediumID)
31{
33}
34
35//_____________________________________________________________________________
37 TVirtualMCSensitiveDetector* userSD, G4int mediumID, G4bool exclusiveSD)
38 : G4VSensitiveDetector(userSD->GetName()),
39 fStepManager(TG4StepManager::Instance()),
41 fUserSD(userSD),
43 fMediumID(mediumID)
44{
46
47 if (!exclusiveSD) {
48 fMCApplication = TVirtualMCApplication::Instance();
49 }
50}
51
52//_____________________________________________________________________________
57
58//
59// private methods
60//
61
62//_____________________________________________________________________________
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//_____________________________________________________________________________
81G4bool TG4SensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*)
82{
84
85 // let user sensitive detector process normal step
86 fStepManager->SetStep(step, kNormalStep);
88
89 return true;
90}
91
92//_____________________________________________________________________________
94{
97
98 // let user sensitive detector process boundary step
99 fStepManager->SetStep(step, kBoundary);
101
102 return true;
103}
104
105//_____________________________________________________________________________
Definition of the TG4SensitiveDetector class.
Definition of the TG4StepManager class.
@ kBoundary
when crossing geometrical boundary
@ kNormalStep
in post step point
virtual void ProcessHitsOnTrackStart()
virtual G4bool ProcessHitsOnBoundary(G4Step *step)
virtual G4bool ProcessHits(G4Step *step, G4TouchableHistory *history)
TVirtualMCApplication * fMCApplication
Cached pointer to thread-local VMC application.
TG4StepManager * fStepManager
Cached pointer to thread-local step manager.
TVirtualMCSensitiveDetector * fUserSD
User sensitive detector.
TG4SensitiveDetector()
Not implemented.
G4int fID
sensitive detector ID
static G4ThreadLocal G4int fgSDCounter
sensitive detector counter
Geant4 implementation of the TVirtualMC interface methods for access to Geant4 at step level.