ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4VSensitiveDetector.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VSensitiveDetector.hh
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
//
27
//
28
29
#ifndef G4VSensitiveDetector_h
30
#define G4VSensitiveDetector_h 1
31
32
#include "
G4VHit.hh
"
33
#include "
G4Step.hh
"
34
#include "G4HCofThisEvent.hh"
35
#include "
G4VReadOutGeometry.hh
"
36
#include "
G4TouchableHistory.hh
"
37
#include "
G4CollectionNameVector.hh
"
38
#include "
G4VSDFilter.hh
"
39
40
// class description:
41
//
42
// This is the abstract base class of the sensitive detector. The user's
43
// sensitive detector which generates hits must be derived from this
44
// class.
45
// In the derived class constructor, name(s) of hits collection(s) which
46
// are made by the sensitive detector must be set to "collectionName" string
47
// vector.
48
49
class
G4VSensitiveDetector
50
{
51
52
public
:
// with description
53
G4VSensitiveDetector
(
G4String
name
);
54
G4VSensitiveDetector
(
const
G4VSensitiveDetector
&
right
);
55
// Constructors. The user's concrete class must use one of these constructors
56
// by the constructor initializer of the derived class. The name of
57
// the sensitive detector must be unique.
58
59
public
:
60
virtual
~G4VSensitiveDetector
();
61
62
G4VSensitiveDetector
&
operator=
(
const
G4VSensitiveDetector
&right);
63
64
G4bool
operator==
(
const
G4VSensitiveDetector
&right)
const
;
65
G4bool
operator!=
(
const
G4VSensitiveDetector
&right)
const
;
66
67
public
:
// with description
68
virtual
void
Initialize
(
G4HCofThisEvent
*);
69
virtual
void
EndOfEvent
(
G4HCofThisEvent
*);
70
// These two methods are invoked at the begining and at the end of each
71
// event. The hits collection(s) created by this sensitive detector must
72
// be set to the G4HCofThisEvent object at one of these two methods.
73
virtual
void
clear
();
74
// This method is invoked if the event abortion is occured. Hits collections
75
// created but not beibg set to G4HCofThisEvent at the event should be deleted.
76
// Collection(s) which have already set to G4HCofThisEvent will be deleted
77
// automatically.
78
79
public
:
80
virtual
void
DrawAll
();
81
virtual
void
PrintAll
();
82
83
protected
:
// with description
84
virtual
G4bool
ProcessHits
(
G4Step
*aStep,
G4TouchableHistory
*ROhist) = 0;
85
// The user MUST implement this method for generating hit(s) using the
86
// information of G4Step object. Note that the volume and the position
87
// information is kept in PreStepPoint of G4Step.
88
// Be aware that this method is a protected method and it sill be invoked
89
// by Hit() method of Base class after Readout geometry associated to the
90
// sensitive detector is handled.
91
// "ROhist" will be given only is a Readout geometry is defined to this
92
// sensitive detector. The G4TouchableHistory object of the tracking geometry
93
// is stored in the PreStepPoint object of G4Step.
94
virtual
G4int
GetCollectionID
(
G4int
i);
95
// This is a utility method which returns the hits collection ID of the
96
// "i"-th collection. "i" is the order (starting with zero) of the collection
97
// whose name is stored to the collectionName protected vector.
98
G4CollectionNameVector
collectionName
;
99
// This protected name vector must be filled at the constructor of the user's
100
// concrete class for registering the name(s) of hits collection(s) being
101
// created by this particular sensitive detector.
102
103
protected
:
104
G4String
SensitiveDetectorName
;
// detector name
105
G4String
thePathName
;
// directory path
106
G4String
fullPathName
;
// path + detector name
107
G4int
verboseLevel
;
108
G4bool
active
;
109
G4VReadOutGeometry
*
ROgeometry
;
110
G4VSDFilter
*
filter
;
111
112
public
:
// with description
113
inline
G4bool
Hit
(
G4Step
*aStep)
114
{
115
G4TouchableHistory
* ROhis = 0;
116
if
(!
isActive
())
return
false
;
117
if
(
filter
)
118
{
if
(!(
filter
->
Accept
(aStep)))
return
false
; }
119
if
(
ROgeometry
)
120
{
if
(!(
ROgeometry
->
CheckROVolume
(aStep,ROhis)))
return
false
; }
121
return
ProcessHits
(aStep,ROhis);
122
}
123
// This is the public method invoked by G4SteppingManager for generating
124
// hit(s). The actual user's implementation for generating hit(s) must be
125
// implemented in GenerateHits() virtual protected method. This method
126
// MUST NOT be overrided.
127
inline
void
SetROgeometry
(
G4VReadOutGeometry
*
value
)
128
{
ROgeometry
=
value
; }
129
// Register the Readout geometry.
130
inline
void
SetFilter
(
G4VSDFilter
*
value
)
131
{
filter
=
value
; }
132
// Register a filter
133
134
public
:
135
inline
G4int
GetNumberOfCollections
()
const
136
{
return
G4int
(
collectionName
.size()); }
137
inline
G4String
GetCollectionName
(
G4int
id
)
const
138
{
return
collectionName
[id]; }
139
inline
void
SetVerboseLevel
(
G4int
vl)
140
{
verboseLevel
= vl; }
141
inline
void
Activate
(
G4bool
activeFlag)
142
{
active
= activeFlag; }
143
inline
G4bool
isActive
()
const
144
{
return
active
; }
145
inline
G4String
GetName
()
const
146
{
return
SensitiveDetectorName
; }
147
inline
G4String
GetPathName
()
const
148
{
return
thePathName
; }
149
inline
G4String
GetFullPathName
()
const
150
{
return
fullPathName
; }
151
inline
G4VReadOutGeometry
*
GetROgeometry
()
const
152
{
return
ROgeometry
; }
153
inline
G4VSDFilter
*
GetFilter
()
const
154
{
return
filter
; }
155
public
:
156
virtual
G4VSensitiveDetector
*
Clone
()
const
;
157
};
158
159
160
161
162
#endif
163
geant4
tree
geant4-10.6-release
source
digits_hits
detector
include
G4VSensitiveDetector.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:12
using
1.8.2 with
ECCE GitHub integration