Geant4
11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VSensitiveDetector.hh
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
// G4VSensitiveDetector
27
//
28
// Class description:
29
//
30
// This is the abstract base class of the sensitive detector. The user's
31
// sensitive detector which generates hits must be derived from this
32
// class.
33
// In the derived class constructor, name(s) of hits collection(s) which
34
// are made by the sensitive detector must be set to "collectionName" string
35
// vector.
36
//
37
// Author: Makoto Asai
38
// ---------------------------------------------------------------------
39
#ifndef G4VSensitiveDetector_h
40
#define G4VSensitiveDetector_h 1
41
42
#include "
G4CollectionNameVector.hh
"
43
#include "
G4HCofThisEvent.hh
"
44
#include "
G4Step.hh
"
45
#include "
G4TouchableHistory.hh
"
46
#include "
G4VHit.hh
"
47
#include "
G4VReadOutGeometry.hh
"
48
#include "
G4VSDFilter.hh
"
49
50
class
G4VSensitiveDetector
51
{
52
public
:
53
// Constructors. The user's concrete class must use one of these constructors
54
// by the constructor initializer of the derived class. The name of
55
// the sensitive detector must be unique.
56
explicit
G4VSensitiveDetector
(
const
G4String
& name);
57
G4VSensitiveDetector
(
const
G4VSensitiveDetector
& right);
58
G4VSensitiveDetector
&
operator=
(
const
G4VSensitiveDetector
& right);
59
virtual
~G4VSensitiveDetector
() =
default
;
60
61
G4bool
operator==
(
const
G4VSensitiveDetector
& right)
const
;
62
G4bool
operator!=
(
const
G4VSensitiveDetector
& right)
const
;
63
64
// These two methods are invoked at the begining and at the end of each
65
// event. The hits collection(s) created by this sensitive detector must
66
// be set to the G4HCofThisEvent object at one of these two methods.
67
virtual
void
Initialize
(
G4HCofThisEvent
*) {}
68
virtual
void
EndOfEvent
(
G4HCofThisEvent
*) {}
69
70
// This method is invoked if the event abortion is occured. Hits collections
71
// created but not beibg set to G4HCofThisEvent at the event should be
72
// deleted. Collection(s) which have already set to G4HCofThisEvent will be
73
// deleted automatically.
74
virtual
void
clear
() {}
75
76
virtual
void
DrawAll
() {}
77
virtual
void
PrintAll
() {}
78
79
// This is the public method invoked by G4SteppingManager for generating
80
// hit(s). The actual user's implementation for generating hit(s) must be
81
// implemented in GenerateHits() virtual protected method. This method
82
// MUST NOT be overriden.
83
inline
G4bool
Hit
(
G4Step
* aStep)
84
{
85
G4TouchableHistory
* ROhis =
nullptr
;
86
if
(!
isActive
())
return
false
;
87
if
(
filter
!=
nullptr
) {
88
if
(! (
filter
->Accept(aStep)))
return
false
;
89
}
90
if
(
ROgeometry
!=
nullptr
) {
91
if
(! (
ROgeometry
->CheckROVolume(aStep, ROhis)))
return
false
;
92
}
93
return
ProcessHits
(aStep, ROhis);
94
}
95
96
// Register the Readout geometry.
97
inline
void
SetROgeometry
(
G4VReadOutGeometry
* value) {
ROgeometry
= value; }
98
99
// Register a filter
100
inline
void
SetFilter
(
G4VSDFilter
* value) {
filter
= value; }
101
102
inline
G4int
GetNumberOfCollections
()
const
{
return
G4int
(
collectionName
.size()); }
103
inline
const
G4String
&
GetCollectionName
(
G4int
id
)
const
{
return
collectionName
[id]; }
104
inline
void
SetVerboseLevel
(
G4int
vl) {
verboseLevel
= vl; }
105
inline
void
Activate
(
G4bool
activeFlag) {
active
= activeFlag; }
106
inline
G4bool
isActive
()
const
{
return
active
; }
107
inline
const
G4String
&
GetName
()
const
{
return
SensitiveDetectorName
; }
108
inline
const
G4String
&
GetPathName
()
const
{
return
thePathName
; }
109
inline
const
G4String
&
GetFullPathName
()
const
{
return
fullPathName
; }
110
inline
G4VReadOutGeometry
*
GetROgeometry
()
const
{
return
ROgeometry
; }
111
inline
G4VSDFilter
*
GetFilter
()
const
{
return
filter
; }
112
113
virtual
G4VSensitiveDetector
*
Clone
()
const
;
114
115
protected
:
// with description
116
// The user MUST implement this method for generating hit(s) using the
117
// information of G4Step object. Note that the volume and the position
118
// information is kept in PreStepPoint of G4Step.
119
// Be aware that this method is a protected method and it sill be invoked
120
// by Hit() method of Base class after Readout geometry associated to the
121
// sensitive detector is handled.
122
// "ROhist" will be given only is a Readout geometry is defined to this
123
// sensitive detector. The G4TouchableHistory object of the tracking geometry
124
// is stored in the PreStepPoint object of G4Step.
125
virtual
G4bool
ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
* ROhist) = 0;
126
127
// This is a utility method which returns the hits collection ID of the
128
// "i"-th collection. "i" is the order (starting with zero) of the collection
129
// whose name is stored to the collectionName protected vector.
130
virtual
G4int
GetCollectionID
(
G4int
i);
131
132
protected
:
133
// This protected name vector must be filled at the constructor of the user's
134
// concrete class for registering the name(s) of hits collection(s) being
135
// created by this particular sensitive detector.
136
G4CollectionNameVector
collectionName
;
137
138
G4String
SensitiveDetectorName
;
// detector name
139
G4String
thePathName
;
// directory path
140
G4String
fullPathName
;
// path + detector name
141
G4int
verboseLevel
{0};
142
G4bool
active
{
true
};
143
G4VReadOutGeometry
*
ROgeometry
{
nullptr
};
144
G4VSDFilter
*
filter
{
nullptr
};
145
};
146
147
#endif
G4CollectionNameVector.hh
G4HCofThisEvent.hh
G4Step.hh
G4TouchableHistory.hh
G4bool
bool G4bool
Definition
G4Types.hh:86
G4int
int G4int
Definition
G4Types.hh:85
G4VHit.hh
G4VReadOutGeometry.hh
G4VSDFilter.hh
G4CollectionNameVector
Definition
G4CollectionNameVector.hh:38
G4HCofThisEvent
Definition
G4HCofThisEvent.hh:51
G4Step
Definition
G4Step.hh:61
G4String
Definition
G4String.hh:62
G4TouchableHistory
G4TouchableHistory is an object representing a touchable detector element, and its history in the geo...
Definition
G4TouchableHistory.hh:107
G4VReadOutGeometry
Definition
G4VReadOutGeometry.hh:40
G4VSDFilter
Definition
G4VSDFilter.hh:43
G4VSensitiveDetector
Definition
G4VSensitiveDetector.hh:51
G4VSensitiveDetector::clear
virtual void clear()
Definition
G4VSensitiveDetector.hh:74
G4VSensitiveDetector::Clone
virtual G4VSensitiveDetector * Clone() const
Definition
G4VSensitiveDetector.cc:61
G4VSensitiveDetector::~G4VSensitiveDetector
virtual ~G4VSensitiveDetector()=default
G4VSensitiveDetector::SetROgeometry
void SetROgeometry(G4VReadOutGeometry *value)
Definition
G4VSensitiveDetector.hh:97
G4VSensitiveDetector::operator==
G4bool operator==(const G4VSensitiveDetector &right) const
Definition
G4VSensitiveDetector.cc:84
G4VSensitiveDetector::SensitiveDetectorName
G4String SensitiveDetectorName
Definition
G4VSensitiveDetector.hh:138
G4VSensitiveDetector::GetCollectionID
virtual G4int GetCollectionID(G4int i)
Definition
G4VSensitiveDetector.cc:94
G4VSensitiveDetector::Hit
G4bool Hit(G4Step *aStep)
Definition
G4VSensitiveDetector.hh:83
G4VSensitiveDetector::verboseLevel
G4int verboseLevel
Definition
G4VSensitiveDetector.hh:141
G4VSensitiveDetector::DrawAll
virtual void DrawAll()
Definition
G4VSensitiveDetector.hh:76
G4VSensitiveDetector::isActive
G4bool isActive() const
Definition
G4VSensitiveDetector.hh:106
G4VSensitiveDetector::collectionName
G4CollectionNameVector collectionName
Definition
G4VSensitiveDetector.hh:136
G4VSensitiveDetector::Activate
void Activate(G4bool activeFlag)
Definition
G4VSensitiveDetector.hh:105
G4VSensitiveDetector::thePathName
G4String thePathName
Definition
G4VSensitiveDetector.hh:139
G4VSensitiveDetector::PrintAll
virtual void PrintAll()
Definition
G4VSensitiveDetector.hh:77
G4VSensitiveDetector::filter
G4VSDFilter * filter
Definition
G4VSensitiveDetector.hh:144
G4VSensitiveDetector::GetFullPathName
const G4String & GetFullPathName() const
Definition
G4VSensitiveDetector.hh:109
G4VSensitiveDetector::active
G4bool active
Definition
G4VSensitiveDetector.hh:142
G4VSensitiveDetector::GetCollectionName
const G4String & GetCollectionName(G4int id) const
Definition
G4VSensitiveDetector.hh:103
G4VSensitiveDetector::Initialize
virtual void Initialize(G4HCofThisEvent *)
Definition
G4VSensitiveDetector.hh:67
G4VSensitiveDetector::GetFilter
G4VSDFilter * GetFilter() const
Definition
G4VSensitiveDetector.hh:111
G4VSensitiveDetector::GetNumberOfCollections
G4int GetNumberOfCollections() const
Definition
G4VSensitiveDetector.hh:102
G4VSensitiveDetector::SetVerboseLevel
void SetVerboseLevel(G4int vl)
Definition
G4VSensitiveDetector.hh:104
G4VSensitiveDetector::operator!=
G4bool operator!=(const G4VSensitiveDetector &right) const
Definition
G4VSensitiveDetector.cc:89
G4VSensitiveDetector::SetFilter
void SetFilter(G4VSDFilter *value)
Definition
G4VSensitiveDetector.hh:100
G4VSensitiveDetector::operator=
G4VSensitiveDetector & operator=(const G4VSensitiveDetector &right)
Definition
G4VSensitiveDetector.cc:71
G4VSensitiveDetector::EndOfEvent
virtual void EndOfEvent(G4HCofThisEvent *)
Definition
G4VSensitiveDetector.hh:68
G4VSensitiveDetector::fullPathName
G4String fullPathName
Definition
G4VSensitiveDetector.hh:140
G4VSensitiveDetector::GetName
const G4String & GetName() const
Definition
G4VSensitiveDetector.hh:107
G4VSensitiveDetector::ROgeometry
G4VReadOutGeometry * ROgeometry
Definition
G4VSensitiveDetector.hh:143
G4VSensitiveDetector::ProcessHits
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)=0
G4VSensitiveDetector::GetPathName
const G4String & GetPathName() const
Definition
G4VSensitiveDetector.hh:108
G4VSensitiveDetector::G4VSensitiveDetector
G4VSensitiveDetector(const G4String &name)
Definition
G4VSensitiveDetector.cc:33
G4VSensitiveDetector::GetROgeometry
G4VReadOutGeometry * GetROgeometry() const
Definition
G4VSensitiveDetector.hh:110
geant4-v11.4.0
source
digits_hits
detector
include
G4VSensitiveDetector.hh
Generated by
1.16.1